Skip to content

Commit

Permalink
updated for phpcs configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
0xBeycan committed Mar 6, 2024
1 parent 1377521 commit 10aa848
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion classes/class.pmpro_ajax_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function pmpro_cryptopay_use_discount(): void
}

$codeCheck = pmpro_checkDiscountCode($discountCode, $levelId, true);
if ($codeCheck[0] == false) {
if (false == $codeCheck[0]) {
Response::error(esc_html__('Invalid discount code!', 'pmpro-cryptopay'));
}

Expand Down
8 changes: 4 additions & 4 deletions classes/lite/class.pmpro_register_hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function __construct()

$startdate = current_time("mysql");
if (!empty($level->expiration_number)) {
if ($level->expiration_period == 'Hour') {
if ('Hour' == $level->expiration_period) {
$enddate = date("Y-m-d H:i:s", strtotime("+ " . $level->expiration_number . " " . $level->expiration_period, current_time("timestamp")));
} else {
$enddate = date("Y-m-d 23:59:59", strtotime("+ " . $level->expiration_number . " " . $level->expiration_period, current_time("timestamp")));
Expand All @@ -160,7 +160,7 @@ public function __construct()
$discountCode = $data->getParams()->get('discountCode');
$codeCheck = pmpro_checkDiscountCode($discountCode, $level->id, true);

if ($codeCheck[0] == false) {
if (false == $codeCheck[0]) {
$useDiscountCode = false;
} else {
$useDiscountCode = true;
Expand All @@ -174,7 +174,7 @@ public function __construct()
}
}

$userLevel = array(
$userLevel = [
'enddate' => $enddate,
'startdate' => $startdate,
'membership_id' => $level->id,
Expand All @@ -187,7 +187,7 @@ public function __construct()
'trial_amount' => pmpro_round_price($level->trial_amount),
'billing_amount' => pmpro_round_price($level->billing_amount),
'initial_payment' => pmpro_round_price($level->initial_payment),
);
];

pmpro_changeMembershipLevel($userLevel, $data->getUserId(), 'changed');

Expand Down
4 changes: 2 additions & 2 deletions classes/lite/class.pmprogateway_cryptopay.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static function init(): void
add_filter('pmpro_payment_options', ['PMProGateway_cryptopay_lite', 'pmpro_payment_options']);
add_filter('pmpro_required_billing_fields', ['PMProGateway_cryptopay_lite', 'pmpro_required_billing_fields']);

if (pmpro_getOption('gateway') == 'cryptopay_lite') {
if ('cryptopay_lite' == pmpro_getOption('gateway')) {
add_filter('pmpro_billing_show_payment_method', '__return_false');
add_filter('pmpro_include_billing_address_fields', '__return_false');
add_filter('pmpro_include_payment_information_fields', '__return_false');
Expand Down Expand Up @@ -120,7 +120,7 @@ public static function pmpro_checkout(): void
{
global $gateway, $pmpro_level, $discount_code;

if ($gateway == 'cryptopay_lite' && is_user_logged_in()) {
if ('cryptopay_lite' == $gateway && is_user_logged_in()) {
?>
<div id="PMProCryptoPayWrapper">
<?php
Expand Down
8 changes: 4 additions & 4 deletions classes/pro/class.pmpro_register_hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function __construct()

$startdate = current_time("mysql");
if (!empty($level->expiration_number)) {
if ($level->expiration_period == 'Hour') {
if ('Hour' == $level->expiration_period) {
$enddate = date("Y-m-d H:i:s", strtotime("+ " . $level->expiration_number . " " . $level->expiration_period, current_time("timestamp")));
} else {
$enddate = date("Y-m-d 23:59:59", strtotime("+ " . $level->expiration_number . " " . $level->expiration_period, current_time("timestamp")));
Expand All @@ -160,7 +160,7 @@ public function __construct()
$discountCode = $data->getParams()->get('discountCode');
$codeCheck = pmpro_checkDiscountCode($discountCode, $level->id, true);

if ($codeCheck[0] == false) {
if (false == $codeCheck[0]) {
$useDiscountCode = false;
} else {
$useDiscountCode = true;
Expand All @@ -174,7 +174,7 @@ public function __construct()
}
}

$userLevel = array(
$userLevel = [
'enddate' => $enddate,
'startdate' => $startdate,
'membership_id' => $level->id,
Expand All @@ -187,7 +187,7 @@ public function __construct()
'trial_amount' => pmpro_round_price($level->trial_amount),
'billing_amount' => pmpro_round_price($level->billing_amount),
'initial_payment' => pmpro_round_price($level->initial_payment),
);
];

pmpro_changeMembershipLevel($userLevel, $data->getUserId(), 'changed');

Expand Down
4 changes: 2 additions & 2 deletions classes/pro/class.pmprogateway_cryptopay.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static function init(): void
add_filter('pmpro_payment_options', ['PMProGateway_cryptopay', 'pmpro_payment_options']);
add_filter('pmpro_required_billing_fields', ['PMProGateway_cryptopay', 'pmpro_required_billing_fields']);

if (pmpro_getOption('gateway') == 'cryptopay') {
if ('cryptopay' == pmpro_getOption('gateway')) {
add_filter('pmpro_billing_show_payment_method', '__return_false');
add_filter('pmpro_include_billing_address_fields', '__return_false');
add_filter('pmpro_include_payment_information_fields', '__return_false');
Expand Down Expand Up @@ -120,7 +120,7 @@ public static function pmpro_checkout(): void
{
global $gateway, $pmpro_level, $discount_code;

if ($gateway == 'cryptopay' && is_user_logged_in()) {
if ('cryptopay' == $gateway && is_user_logged_in()) {
?>
<div id="PMProCryptoPayWrapper">
<?php
Expand Down
4 changes: 2 additions & 2 deletions cryptocurrency-payments-for-paid-memberships-pro.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function pmpro_cryptopay_check_discount_code(object &$level, ?string $discountCo
if ($discountCode) {
global $wpdb;
$codeCheck = pmpro_checkDiscountCode($discountCode, $level->id, true);
if ($codeCheck[0] == false) {
if (false == $codeCheck[0]) {
Response::error(esc_html__('Invalid discount code!', 'pmpro-cryptopay'));
}

Expand All @@ -103,7 +103,7 @@ function pmpro_cryptopay_check_discount_code(object &$level, ?string $discountCo

load_plugin_textdomain('pmpro-cryptopay', false, basename(__DIR__) . '/languages');

if (defined('PMPRO_DIR') == false) {
if (false == defined('PMPRO_DIR')) {
add_action('admin_notices', function (): void {
$class = 'notice notice-error';
$message = sprintf(esc_html__('Paid Memberships Pro - CryptoPay Gateway: This plugin is an extra feature plugin so it cannot do anything on its own. It needs Paid Memberships Pro to work. You can download Paid Memberships Pro by %s.', 'pmpro-cryptopay'), '<a href="https://wordpress.org/plugins/paid-memberships-pro/" target="_blank">' . esc_html__('clicking here', 'pmpro-cryptopay') . '</a>');
Expand Down

0 comments on commit 10aa848

Please sign in to comment.