From 10aa8480b2204c857daa9885c9dc270ae7746ab1 Mon Sep 17 00:00:00 2001 From: Halil Beycan <50718965+BeycanDeveloper@users.noreply.github.com> Date: Wed, 6 Mar 2024 16:09:46 +0800 Subject: [PATCH] updated for phpcs configurations --- classes/class.pmpro_ajax_api.php | 2 +- classes/lite/class.pmpro_register_hooks.php | 8 ++++---- classes/lite/class.pmprogateway_cryptopay.php | 4 ++-- classes/pro/class.pmpro_register_hooks.php | 8 ++++---- classes/pro/class.pmprogateway_cryptopay.php | 4 ++-- cryptocurrency-payments-for-paid-memberships-pro.php | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/classes/class.pmpro_ajax_api.php b/classes/class.pmpro_ajax_api.php index 0975dfe..fc085dc 100644 --- a/classes/class.pmpro_ajax_api.php +++ b/classes/class.pmpro_ajax_api.php @@ -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')); } diff --git a/classes/lite/class.pmpro_register_hooks.php b/classes/lite/class.pmpro_register_hooks.php index 95a7685..26e7816 100644 --- a/classes/lite/class.pmpro_register_hooks.php +++ b/classes/lite/class.pmpro_register_hooks.php @@ -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"))); @@ -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; @@ -174,7 +174,7 @@ public function __construct() } } - $userLevel = array( + $userLevel = [ 'enddate' => $enddate, 'startdate' => $startdate, 'membership_id' => $level->id, @@ -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'); diff --git a/classes/lite/class.pmprogateway_cryptopay.php b/classes/lite/class.pmprogateway_cryptopay.php index 8bde905..0894410 100644 --- a/classes/lite/class.pmprogateway_cryptopay.php +++ b/classes/lite/class.pmprogateway_cryptopay.php @@ -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'); @@ -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()) { ?>
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"))); @@ -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; @@ -174,7 +174,7 @@ public function __construct() } } - $userLevel = array( + $userLevel = [ 'enddate' => $enddate, 'startdate' => $startdate, 'membership_id' => $level->id, @@ -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'); diff --git a/classes/pro/class.pmprogateway_cryptopay.php b/classes/pro/class.pmprogateway_cryptopay.php index 18f8b1f..bc100a7 100644 --- a/classes/pro/class.pmprogateway_cryptopay.php +++ b/classes/pro/class.pmprogateway_cryptopay.php @@ -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'); @@ -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()) { ?>
id, true); - if ($codeCheck[0] == false) { + if (false == $codeCheck[0]) { Response::error(esc_html__('Invalid discount code!', 'pmpro-cryptopay')); } @@ -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'), '' . esc_html__('clicking here', 'pmpro-cryptopay') . '');