@@ -1,10 +1,10 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | +if ( ! defined('ABSPATH')) { |
|
| 4 | 4 | exit; |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | -if ( ! class_exists( 'WC_Stripe_Connect_REST_Deauthorize_Controller' ) ) { |
|
| 7 | +if ( ! class_exists('WC_Stripe_Connect_REST_Deauthorize_Controller')) { |
|
| 8 | 8 | /** |
| 9 | 9 | * Stripe Connect deauthorize controller class. |
| 10 | 10 | */ |
@@ -30,9 +30,9 @@ discard block |
||
| 30 | 30 | * @param WC_Stripe_Connect $connect stripe connect. |
| 31 | 31 | * @param WC_Stripe_Connect_API $api stripe connect api. |
| 32 | 32 | */ |
| 33 | - public function __construct( WC_Stripe_Connect $connect, WC_Stripe_Connect_API $api ) { |
|
| 33 | + public function __construct(WC_Stripe_Connect $connect, WC_Stripe_Connect_API $api) { |
|
| 34 | 34 | |
| 35 | - parent::__construct( $api ); |
|
| 35 | + parent::__construct($api); |
|
| 36 | 36 | |
| 37 | 37 | $this->connect = $connect; |
| 38 | 38 | } |
@@ -44,18 +44,18 @@ discard block |
||
| 44 | 44 | * |
| 45 | 45 | * @return array|WP_Error |
| 46 | 46 | */ |
| 47 | - public function post( $request ) { |
|
| 47 | + public function post($request) { |
|
| 48 | 48 | |
| 49 | 49 | $response = $connect->deauthorize_account(); |
| 50 | 50 | |
| 51 | - if ( is_wp_error( $response ) ) { |
|
| 51 | + if (is_wp_error($response)) { |
|
| 52 | 52 | |
| 53 | - WC_Stripe_Logger::log( $response, __CLASS__ ); |
|
| 53 | + WC_Stripe_Logger::log($response, __CLASS__); |
|
| 54 | 54 | |
| 55 | 55 | return new WP_Error( |
| 56 | 56 | $response->get_error_code(), |
| 57 | 57 | $response->get_error_message(), |
| 58 | - array( 'status' => 400 ) |
|
| 58 | + array('status' => 400) |
|
| 59 | 59 | ); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -1,28 +1,28 @@ |
||
| 1 | 1 | <?php |
| 2 | -$_tests_dir = getenv( 'WP_TESTS_DIR' ); |
|
| 3 | -if ( ! $_tests_dir ) { |
|
| 2 | +$_tests_dir = getenv('WP_TESTS_DIR'); |
|
| 3 | +if ( ! $_tests_dir) { |
|
| 4 | 4 | $_tests_dir = '/tmp/wordpress-tests-lib'; |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | require_once $_tests_dir . '/includes/functions.php'; |
| 8 | 8 | |
| 9 | 9 | function _manually_load_plugin() { |
| 10 | - $plugin_dir = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . '/'; |
|
| 10 | + $plugin_dir = dirname(dirname(dirname(dirname(__FILE__)))) . '/'; |
|
| 11 | 11 | require $plugin_dir . 'woocommerce/woocommerce.php'; |
| 12 | - require dirname( __FILE__ ) . '/setup.php'; |
|
| 12 | + require dirname(__FILE__) . '/setup.php'; |
|
| 13 | 13 | require $plugin_dir . 'woocommerce-gateway-stripe/woocommerce-gateway-stripe.php'; |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' ); |
|
| 16 | +tests_add_filter('muplugins_loaded', '_manually_load_plugin'); |
|
| 17 | 17 | |
| 18 | 18 | require $_tests_dir . '/includes/bootstrap.php'; |
| 19 | 19 | |
| 20 | -$wc_tests_framework_base_dir = dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . '/woocommerce/tests/framework/'; |
|
| 21 | -require_once( $wc_tests_framework_base_dir . 'class-wc-mock-session-handler.php' ); |
|
| 20 | +$wc_tests_framework_base_dir = dirname(dirname(dirname(dirname(__FILE__)))) . '/woocommerce/tests/framework/'; |
|
| 21 | +require_once($wc_tests_framework_base_dir . 'class-wc-mock-session-handler.php'); |
|
| 22 | 22 | //require_once( $wc_tests_framework_base_dir . 'class-wc-unit-test-case.php' ); |
| 23 | -require_once( $wc_tests_framework_base_dir . 'helpers/class-wc-helper-product.php' ); |
|
| 24 | -require_once( $wc_tests_framework_base_dir . 'helpers/class-wc-helper-coupon.php' ); |
|
| 25 | -require_once( $wc_tests_framework_base_dir . 'helpers/class-wc-helper-fee.php' ); |
|
| 26 | -require_once( $wc_tests_framework_base_dir . 'helpers/class-wc-helper-shipping.php' ); |
|
| 27 | -require_once( $wc_tests_framework_base_dir . 'helpers/class-wc-helper-customer.php' ); |
|
| 28 | -require_once( $wc_tests_framework_base_dir . 'helpers/class-wc-helper-order.php' ); |
|
| 23 | +require_once($wc_tests_framework_base_dir . 'helpers/class-wc-helper-product.php'); |
|
| 24 | +require_once($wc_tests_framework_base_dir . 'helpers/class-wc-helper-coupon.php'); |
|
| 25 | +require_once($wc_tests_framework_base_dir . 'helpers/class-wc-helper-fee.php'); |
|
| 26 | +require_once($wc_tests_framework_base_dir . 'helpers/class-wc-helper-shipping.php'); |
|
| 27 | +require_once($wc_tests_framework_base_dir . 'helpers/class-wc-helper-customer.php'); |
|
| 28 | +require_once($wc_tests_framework_base_dir . 'helpers/class-wc-helper-order.php'); |
|
@@ -2,4 +2,4 @@ |
||
| 2 | 2 | /** |
| 3 | 3 | * Set up shared by all tests. |
| 4 | 4 | */ |
| 5 | -update_option( 'woocommerce_default_country', 'US:CA' ); |
|
| 5 | +update_option('woocommerce_default_country', 'US:CA'); |
|
@@ -15,20 +15,20 @@ discard block |
||
| 15 | 15 | * |
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 18 | +if ( ! defined('ABSPATH')) { |
|
| 19 | 19 | exit; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * Required minimums and constants |
| 24 | 24 | */ |
| 25 | -define( 'WC_STRIPE_VERSION', '4.5.0' ); |
|
| 26 | -define( 'WC_STRIPE_MIN_PHP_VER', '5.6.0' ); |
|
| 27 | -define( 'WC_STRIPE_MIN_WC_VER', '3.0' ); |
|
| 28 | -define( 'WC_STRIPE_FUTURE_MIN_WC_VER', '3.0' ); |
|
| 29 | -define( 'WC_STRIPE_MAIN_FILE', __FILE__ ); |
|
| 30 | -define( 'WC_STRIPE_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) ); |
|
| 31 | -define( 'WC_STRIPE_PLUGIN_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) ); |
|
| 25 | +define('WC_STRIPE_VERSION', '4.5.0'); |
|
| 26 | +define('WC_STRIPE_MIN_PHP_VER', '5.6.0'); |
|
| 27 | +define('WC_STRIPE_MIN_WC_VER', '3.0'); |
|
| 28 | +define('WC_STRIPE_FUTURE_MIN_WC_VER', '3.0'); |
|
| 29 | +define('WC_STRIPE_MAIN_FILE', __FILE__); |
|
| 30 | +define('WC_STRIPE_PLUGIN_URL', untrailingslashit(plugins_url(basename(plugin_dir_path(__FILE__)), basename(__FILE__)))); |
|
| 31 | +define('WC_STRIPE_PLUGIN_PATH', untrailingslashit(plugin_dir_path(__FILE__))); |
|
| 32 | 32 | |
| 33 | 33 | // phpcs:disable WordPress.Files.FileName |
| 34 | 34 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | function woocommerce_stripe_missing_wc_notice() { |
| 42 | 42 | /* translators: 1. URL link. */ |
| 43 | - echo '<div class="error"><p><strong>' . sprintf( esc_html__( 'Stripe requires WooCommerce to be installed and active. You can download %s here.', 'woocommerce-gateway-stripe' ), '<a href="https://woocommerce.com/" target="_blank">WooCommerce</a>' ) . '</strong></p></div>'; |
|
| 43 | + echo '<div class="error"><p><strong>' . sprintf(esc_html__('Stripe requires WooCommerce to be installed and active. You can download %s here.', 'woocommerce-gateway-stripe'), '<a href="https://woocommerce.com/" target="_blank">WooCommerce</a>') . '</strong></p></div>'; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | function woocommerce_stripe_wc_not_supported() { |
| 53 | 53 | /* translators: $1. Minimum WooCommerce version. $2. Current WooCommerce version. */ |
| 54 | - echo '<div class="error"><p><strong>' . sprintf( esc_html__( 'Stripe requires WooCommerce %1$s or greater to be installed and active. WooCommerce %2$s is no longer supported.', 'woocommerce-gateway-stripe' ), WC_STRIPE_MIN_WC_VER, WC_VERSION ) . '</strong></p></div>'; |
|
| 54 | + echo '<div class="error"><p><strong>' . sprintf(esc_html__('Stripe requires WooCommerce %1$s or greater to be installed and active. WooCommerce %2$s is no longer supported.', 'woocommerce-gateway-stripe'), WC_STRIPE_MIN_WC_VER, WC_VERSION) . '</strong></p></div>'; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * @return string |
| 62 | 62 | */ |
| 63 | 63 | function woocommerce_stripe_wc_country_not_supported() { |
| 64 | - echo '<div class="error"><p><strong>' . __( 'Stripe is not available in your store\'s country and will not be available for buyers to choose during checkout.', 'woocommerce-gateway-stripe' ) . '</strong></p></div>'; |
|
| 64 | + echo '<div class="error"><p><strong>' . __('Stripe is not available in your store\'s country and will not be available for buyers to choose during checkout.', 'woocommerce-gateway-stripe') . '</strong></p></div>'; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * @return bool |
| 73 | 73 | */ |
| 74 | 74 | function woocommerce_stripe_wc_country_is_supported_country() { |
| 75 | - $wc_default_country = substr( get_option( 'woocommerce_default_country' ), 0, 2 ); |
|
| 75 | + $wc_default_country = substr(get_option('woocommerce_default_country'), 0, 2); |
|
| 76 | 76 | |
| 77 | 77 | $supported_countries = apply_filters( |
| 78 | 78 | 'wc_stripe_supported_countries', |
@@ -118,30 +118,30 @@ discard block |
||
| 118 | 118 | ) |
| 119 | 119 | ); |
| 120 | 120 | |
| 121 | - return in_array( $wc_default_country, $supported_countries ); |
|
| 121 | + return in_array($wc_default_country, $supported_countries); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | -add_action( 'plugins_loaded', 'woocommerce_gateway_stripe_init' ); |
|
| 124 | +add_action('plugins_loaded', 'woocommerce_gateway_stripe_init'); |
|
| 125 | 125 | |
| 126 | 126 | function woocommerce_gateway_stripe_init() { |
| 127 | - load_plugin_textdomain( 'woocommerce-gateway-stripe', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' ); |
|
| 127 | + load_plugin_textdomain('woocommerce-gateway-stripe', false, plugin_basename(dirname(__FILE__)) . '/languages'); |
|
| 128 | 128 | |
| 129 | - if ( ! class_exists( 'WooCommerce' ) ) { |
|
| 130 | - add_action( 'admin_notices', 'woocommerce_stripe_missing_wc_notice' ); |
|
| 129 | + if ( ! class_exists('WooCommerce')) { |
|
| 130 | + add_action('admin_notices', 'woocommerce_stripe_missing_wc_notice'); |
|
| 131 | 131 | return; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - if ( version_compare( WC_VERSION, WC_STRIPE_MIN_WC_VER, '<' ) ) { |
|
| 135 | - add_action( 'admin_notices', 'woocommerce_stripe_wc_not_supported' ); |
|
| 134 | + if (version_compare(WC_VERSION, WC_STRIPE_MIN_WC_VER, '<')) { |
|
| 135 | + add_action('admin_notices', 'woocommerce_stripe_wc_not_supported'); |
|
| 136 | 136 | return; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - if ( ! woocommerce_stripe_wc_country_is_supported_country() ) { |
|
| 140 | - add_action( 'admin_notices', 'woocommerce_stripe_wc_country_not_supported' ); |
|
| 139 | + if ( ! woocommerce_stripe_wc_country_is_supported_country()) { |
|
| 140 | + add_action('admin_notices', 'woocommerce_stripe_wc_country_not_supported'); |
|
| 141 | 141 | return; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - if ( ! class_exists( 'WC_Stripe' ) ) : |
|
| 144 | + if ( ! class_exists('WC_Stripe')) : |
|
| 145 | 145 | |
| 146 | 146 | class WC_Stripe { |
| 147 | 147 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * @return Singleton The *Singleton* instance. |
| 157 | 157 | */ |
| 158 | 158 | public static function get_instance() { |
| 159 | - if ( null === self::$instance ) { |
|
| 159 | + if (null === self::$instance) { |
|
| 160 | 160 | self::$instance = new self(); |
| 161 | 161 | } |
| 162 | 162 | return self::$instance; |
@@ -197,17 +197,17 @@ discard block |
||
| 197 | 197 | * *Singleton* via the `new` operator from outside of this class. |
| 198 | 198 | */ |
| 199 | 199 | private function __construct() { |
| 200 | - add_action( 'admin_init', array( $this, 'install' ) ); |
|
| 200 | + add_action('admin_init', array($this, 'install')); |
|
| 201 | 201 | |
| 202 | 202 | $this->init(); |
| 203 | 203 | |
| 204 | 204 | $this->api = new WC_Stripe_Connect_API(); |
| 205 | - $this->connect = new WC_Stripe_Connect( $this->api ); |
|
| 205 | + $this->connect = new WC_Stripe_Connect($this->api); |
|
| 206 | 206 | |
| 207 | - add_action( 'rest_api_init', array( $this, 'register_connect_routes' ) ); |
|
| 207 | + add_action('rest_api_init', array($this, 'register_connect_routes')); |
|
| 208 | 208 | |
| 209 | - if ( get_option( 'stripe_state', false ) ) { |
|
| 210 | - add_action( 'admin_enqueue_scripts', array( $this->connect, 'maybe_connect_oauth' ) ); |
|
| 209 | + if (get_option('stripe_state', false)) { |
|
| 210 | + add_action('admin_enqueue_scripts', array($this->connect, 'maybe_connect_oauth')); |
|
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | |
@@ -218,55 +218,55 @@ discard block |
||
| 218 | 218 | * @version 4.0.0 |
| 219 | 219 | */ |
| 220 | 220 | public function init() { |
| 221 | - if ( is_admin() ) { |
|
| 222 | - require_once dirname( __FILE__ ) . '/includes/admin/class-wc-stripe-privacy.php'; |
|
| 221 | + if (is_admin()) { |
|
| 222 | + require_once dirname(__FILE__) . '/includes/admin/class-wc-stripe-privacy.php'; |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-exception.php'; |
|
| 226 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-logger.php'; |
|
| 227 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-helper.php'; |
|
| 228 | - include_once dirname( __FILE__ ) . '/includes/class-wc-stripe-api.php'; |
|
| 229 | - require_once dirname( __FILE__ ) . '/includes/abstracts/abstract-wc-stripe-payment-gateway.php'; |
|
| 230 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-webhook-handler.php'; |
|
| 231 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-sepa-payment-token.php'; |
|
| 232 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-apple-pay-registration.php'; |
|
| 233 | - require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-pre-orders-compat.php'; |
|
| 234 | - require_once dirname( __FILE__ ) . '/includes/class-wc-gateway-stripe.php'; |
|
| 235 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-bancontact.php'; |
|
| 236 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-sofort.php'; |
|
| 237 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-giropay.php'; |
|
| 238 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-eps.php'; |
|
| 239 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-ideal.php'; |
|
| 240 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-p24.php'; |
|
| 241 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-alipay.php'; |
|
| 242 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-sepa.php'; |
|
| 243 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-multibanco.php'; |
|
| 244 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-payment-request.php'; |
|
| 245 | - require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-subs-compat.php'; |
|
| 246 | - require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-sepa-subs-compat.php'; |
|
| 247 | - require_once dirname( __FILE__ ) . '/includes/connect/class-wc-stripe-connect.php'; |
|
| 248 | - require_once dirname( __FILE__ ) . '/includes/connect/class-wc-stripe-connect-api.php'; |
|
| 249 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-order-handler.php'; |
|
| 250 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-payment-tokens.php'; |
|
| 251 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-customer.php'; |
|
| 252 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-intent-controller.php'; |
|
| 253 | - |
|
| 254 | - if ( is_admin() ) { |
|
| 255 | - require_once dirname( __FILE__ ) . '/includes/admin/class-wc-stripe-admin-notices.php'; |
|
| 225 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-exception.php'; |
|
| 226 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-logger.php'; |
|
| 227 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-helper.php'; |
|
| 228 | + include_once dirname(__FILE__) . '/includes/class-wc-stripe-api.php'; |
|
| 229 | + require_once dirname(__FILE__) . '/includes/abstracts/abstract-wc-stripe-payment-gateway.php'; |
|
| 230 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-webhook-handler.php'; |
|
| 231 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-sepa-payment-token.php'; |
|
| 232 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-apple-pay-registration.php'; |
|
| 233 | + require_once dirname(__FILE__) . '/includes/compat/class-wc-stripe-pre-orders-compat.php'; |
|
| 234 | + require_once dirname(__FILE__) . '/includes/class-wc-gateway-stripe.php'; |
|
| 235 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-bancontact.php'; |
|
| 236 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-sofort.php'; |
|
| 237 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-giropay.php'; |
|
| 238 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-eps.php'; |
|
| 239 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-ideal.php'; |
|
| 240 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-p24.php'; |
|
| 241 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-alipay.php'; |
|
| 242 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-sepa.php'; |
|
| 243 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-multibanco.php'; |
|
| 244 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-stripe-payment-request.php'; |
|
| 245 | + require_once dirname(__FILE__) . '/includes/compat/class-wc-stripe-subs-compat.php'; |
|
| 246 | + require_once dirname(__FILE__) . '/includes/compat/class-wc-stripe-sepa-subs-compat.php'; |
|
| 247 | + require_once dirname(__FILE__) . '/includes/connect/class-wc-stripe-connect.php'; |
|
| 248 | + require_once dirname(__FILE__) . '/includes/connect/class-wc-stripe-connect-api.php'; |
|
| 249 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-order-handler.php'; |
|
| 250 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-payment-tokens.php'; |
|
| 251 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-customer.php'; |
|
| 252 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-intent-controller.php'; |
|
| 253 | + |
|
| 254 | + if (is_admin()) { |
|
| 255 | + require_once dirname(__FILE__) . '/includes/admin/class-wc-stripe-admin-notices.php'; |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | // REMOVE IN THE FUTURE. |
| 259 | - require_once dirname( __FILE__ ) . '/includes/deprecated/class-wc-stripe-apple-pay.php'; |
|
| 259 | + require_once dirname(__FILE__) . '/includes/deprecated/class-wc-stripe-apple-pay.php'; |
|
| 260 | 260 | |
| 261 | - add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateways' ) ); |
|
| 262 | - add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugin_action_links' ) ); |
|
| 263 | - add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 ); |
|
| 261 | + add_filter('woocommerce_payment_gateways', array($this, 'add_gateways')); |
|
| 262 | + add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($this, 'plugin_action_links')); |
|
| 263 | + add_filter('plugin_row_meta', array($this, 'plugin_row_meta'), 10, 2); |
|
| 264 | 264 | |
| 265 | 265 | // Modify emails emails. |
| 266 | - add_filter( 'woocommerce_email_classes', array( $this, 'add_emails' ), 20 ); |
|
| 266 | + add_filter('woocommerce_email_classes', array($this, 'add_emails'), 20); |
|
| 267 | 267 | |
| 268 | - if ( version_compare( WC_VERSION, '3.4', '<' ) ) { |
|
| 269 | - add_filter( 'woocommerce_get_sections_checkout', array( $this, 'filter_gateway_order_admin' ) ); |
|
| 268 | + if (version_compare(WC_VERSION, '3.4', '<')) { |
|
| 269 | + add_filter('woocommerce_get_sections_checkout', array($this, 'filter_gateway_order_admin')); |
|
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | 272 | |
@@ -277,8 +277,8 @@ discard block |
||
| 277 | 277 | * @version 4.0.0 |
| 278 | 278 | */ |
| 279 | 279 | public function update_plugin_version() { |
| 280 | - delete_option( 'wc_stripe_version' ); |
|
| 281 | - update_option( 'wc_stripe_version', WC_STRIPE_VERSION ); |
|
| 280 | + delete_option('wc_stripe_version'); |
|
| 281 | + update_option('wc_stripe_version', WC_STRIPE_VERSION); |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | /** |
@@ -288,15 +288,15 @@ discard block |
||
| 288 | 288 | * @version 3.1.0 |
| 289 | 289 | */ |
| 290 | 290 | public function install() { |
| 291 | - if ( ! is_plugin_active( plugin_basename( __FILE__ ) ) ) { |
|
| 291 | + if ( ! is_plugin_active(plugin_basename(__FILE__))) { |
|
| 292 | 292 | return; |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - if ( ! defined( 'IFRAME_REQUEST' ) && ( WC_STRIPE_VERSION !== get_option( 'wc_stripe_version' ) ) ) { |
|
| 296 | - do_action( 'woocommerce_stripe_updated' ); |
|
| 295 | + if ( ! defined('IFRAME_REQUEST') && (WC_STRIPE_VERSION !== get_option('wc_stripe_version'))) { |
|
| 296 | + do_action('woocommerce_stripe_updated'); |
|
| 297 | 297 | |
| 298 | - if ( ! defined( 'WC_STRIPE_INSTALLING' ) ) { |
|
| 299 | - define( 'WC_STRIPE_INSTALLING', true ); |
|
| 298 | + if ( ! defined('WC_STRIPE_INSTALLING')) { |
|
| 299 | + define('WC_STRIPE_INSTALLING', true); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | $this->update_plugin_version(); |
@@ -309,11 +309,11 @@ discard block |
||
| 309 | 309 | * @since 1.0.0 |
| 310 | 310 | * @version 4.0.0 |
| 311 | 311 | */ |
| 312 | - public function plugin_action_links( $links ) { |
|
| 312 | + public function plugin_action_links($links) { |
|
| 313 | 313 | $plugin_links = array( |
| 314 | - '<a href="admin.php?page=wc-settings&tab=checkout§ion=stripe">' . esc_html__( 'Settings', 'woocommerce-gateway-stripe' ) . '</a>', |
|
| 314 | + '<a href="admin.php?page=wc-settings&tab=checkout§ion=stripe">' . esc_html__('Settings', 'woocommerce-gateway-stripe') . '</a>', |
|
| 315 | 315 | ); |
| 316 | - return array_merge( $plugin_links, $links ); |
|
| 316 | + return array_merge($plugin_links, $links); |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | /** |
@@ -324,13 +324,13 @@ discard block |
||
| 324 | 324 | * @param string $file Name of current file. |
| 325 | 325 | * @return array $links Update list of plugin links. |
| 326 | 326 | */ |
| 327 | - public function plugin_row_meta( $links, $file ) { |
|
| 328 | - if ( plugin_basename( __FILE__ ) === $file ) { |
|
| 327 | + public function plugin_row_meta($links, $file) { |
|
| 328 | + if (plugin_basename(__FILE__) === $file) { |
|
| 329 | 329 | $row_meta = array( |
| 330 | - 'docs' => '<a href="' . esc_url( apply_filters( 'woocommerce_gateway_stripe_docs_url', 'https://docs.woocommerce.com/document/stripe/' ) ) . '" title="' . esc_attr( __( 'View Documentation', 'woocommerce-gateway-stripe' ) ) . '">' . __( 'Docs', 'woocommerce-gateway-stripe' ) . '</a>', |
|
| 331 | - 'support' => '<a href="' . esc_url( apply_filters( 'woocommerce_gateway_stripe_support_url', 'https://woocommerce.com/my-account/create-a-ticket?select=18627' ) ) . '" title="' . esc_attr( __( 'Open a support request at WooCommerce.com', 'woocommerce-gateway-stripe' ) ) . '">' . __( 'Support', 'woocommerce-gateway-stripe' ) . '</a>', |
|
| 330 | + 'docs' => '<a href="' . esc_url(apply_filters('woocommerce_gateway_stripe_docs_url', 'https://docs.woocommerce.com/document/stripe/')) . '" title="' . esc_attr(__('View Documentation', 'woocommerce-gateway-stripe')) . '">' . __('Docs', 'woocommerce-gateway-stripe') . '</a>', |
|
| 331 | + 'support' => '<a href="' . esc_url(apply_filters('woocommerce_gateway_stripe_support_url', 'https://woocommerce.com/my-account/create-a-ticket?select=18627')) . '" title="' . esc_attr(__('Open a support request at WooCommerce.com', 'woocommerce-gateway-stripe')) . '">' . __('Support', 'woocommerce-gateway-stripe') . '</a>', |
|
| 332 | 332 | ); |
| 333 | - return array_merge( $links, $row_meta ); |
|
| 333 | + return array_merge($links, $row_meta); |
|
| 334 | 334 | } |
| 335 | 335 | return (array) $links; |
| 336 | 336 | } |
@@ -341,8 +341,8 @@ discard block |
||
| 341 | 341 | * @since 1.0.0 |
| 342 | 342 | * @version 4.0.0 |
| 343 | 343 | */ |
| 344 | - public function add_gateways( $methods ) { |
|
| 345 | - if ( class_exists( 'WC_Subscriptions_Order' ) && function_exists( 'wcs_create_renewal_order' ) ) { |
|
| 344 | + public function add_gateways($methods) { |
|
| 345 | + if (class_exists('WC_Subscriptions_Order') && function_exists('wcs_create_renewal_order')) { |
|
| 346 | 346 | $methods[] = 'WC_Stripe_Subs_Compat'; |
| 347 | 347 | $methods[] = 'WC_Stripe_Sepa_Subs_Compat'; |
| 348 | 348 | } else { |
@@ -368,28 +368,28 @@ discard block |
||
| 368 | 368 | * @since 4.0.0 |
| 369 | 369 | * @version 4.0.0 |
| 370 | 370 | */ |
| 371 | - public function filter_gateway_order_admin( $sections ) { |
|
| 372 | - unset( $sections['stripe'] ); |
|
| 373 | - unset( $sections['stripe_bancontact'] ); |
|
| 374 | - unset( $sections['stripe_sofort'] ); |
|
| 375 | - unset( $sections['stripe_giropay'] ); |
|
| 376 | - unset( $sections['stripe_eps'] ); |
|
| 377 | - unset( $sections['stripe_ideal'] ); |
|
| 378 | - unset( $sections['stripe_p24'] ); |
|
| 379 | - unset( $sections['stripe_alipay'] ); |
|
| 380 | - unset( $sections['stripe_sepa'] ); |
|
| 381 | - unset( $sections['stripe_multibanco'] ); |
|
| 371 | + public function filter_gateway_order_admin($sections) { |
|
| 372 | + unset($sections['stripe']); |
|
| 373 | + unset($sections['stripe_bancontact']); |
|
| 374 | + unset($sections['stripe_sofort']); |
|
| 375 | + unset($sections['stripe_giropay']); |
|
| 376 | + unset($sections['stripe_eps']); |
|
| 377 | + unset($sections['stripe_ideal']); |
|
| 378 | + unset($sections['stripe_p24']); |
|
| 379 | + unset($sections['stripe_alipay']); |
|
| 380 | + unset($sections['stripe_sepa']); |
|
| 381 | + unset($sections['stripe_multibanco']); |
|
| 382 | 382 | |
| 383 | 383 | $sections['stripe'] = 'Stripe'; |
| 384 | - $sections['stripe_bancontact'] = __( 'Stripe Bancontact', 'woocommerce-gateway-stripe' ); |
|
| 385 | - $sections['stripe_sofort'] = __( 'Stripe SOFORT', 'woocommerce-gateway-stripe' ); |
|
| 386 | - $sections['stripe_giropay'] = __( 'Stripe Giropay', 'woocommerce-gateway-stripe' ); |
|
| 387 | - $sections['stripe_eps'] = __( 'Stripe EPS', 'woocommerce-gateway-stripe' ); |
|
| 388 | - $sections['stripe_ideal'] = __( 'Stripe iDeal', 'woocommerce-gateway-stripe' ); |
|
| 389 | - $sections['stripe_p24'] = __( 'Stripe P24', 'woocommerce-gateway-stripe' ); |
|
| 390 | - $sections['stripe_alipay'] = __( 'Stripe Alipay', 'woocommerce-gateway-stripe' ); |
|
| 391 | - $sections['stripe_sepa'] = __( 'Stripe SEPA Direct Debit', 'woocommerce-gateway-stripe' ); |
|
| 392 | - $sections['stripe_multibanco'] = __( 'Stripe Multibanco', 'woocommerce-gateway-stripe' ); |
|
| 384 | + $sections['stripe_bancontact'] = __('Stripe Bancontact', 'woocommerce-gateway-stripe'); |
|
| 385 | + $sections['stripe_sofort'] = __('Stripe SOFORT', 'woocommerce-gateway-stripe'); |
|
| 386 | + $sections['stripe_giropay'] = __('Stripe Giropay', 'woocommerce-gateway-stripe'); |
|
| 387 | + $sections['stripe_eps'] = __('Stripe EPS', 'woocommerce-gateway-stripe'); |
|
| 388 | + $sections['stripe_ideal'] = __('Stripe iDeal', 'woocommerce-gateway-stripe'); |
|
| 389 | + $sections['stripe_p24'] = __('Stripe P24', 'woocommerce-gateway-stripe'); |
|
| 390 | + $sections['stripe_alipay'] = __('Stripe Alipay', 'woocommerce-gateway-stripe'); |
|
| 391 | + $sections['stripe_sepa'] = __('Stripe SEPA Direct Debit', 'woocommerce-gateway-stripe'); |
|
| 392 | + $sections['stripe_multibanco'] = __('Stripe Multibanco', 'woocommerce-gateway-stripe'); |
|
| 393 | 393 | |
| 394 | 394 | return $sections; |
| 395 | 395 | } |
@@ -400,16 +400,16 @@ discard block |
||
| 400 | 400 | * @param WC_Email[] $email_classes All existing emails. |
| 401 | 401 | * @return WC_Email[] |
| 402 | 402 | */ |
| 403 | - public function add_emails( $email_classes ) { |
|
| 403 | + public function add_emails($email_classes) { |
|
| 404 | 404 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-authentication.php'; |
| 405 | 405 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-renewal-authentication.php'; |
| 406 | 406 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-preorder-authentication.php'; |
| 407 | 407 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-authentication-retry.php'; |
| 408 | 408 | |
| 409 | 409 | // Add all emails, generated by the gateway. |
| 410 | - $email_classes['WC_Stripe_Email_Failed_Renewal_Authentication'] = new WC_Stripe_Email_Failed_Renewal_Authentication( $email_classes ); |
|
| 411 | - $email_classes['WC_Stripe_Email_Failed_Preorder_Authentication'] = new WC_Stripe_Email_Failed_Preorder_Authentication( $email_classes ); |
|
| 412 | - $email_classes['WC_Stripe_Email_Failed_Authentication_Retry'] = new WC_Stripe_Email_Failed_Authentication_Retry( $email_classes ); |
|
| 410 | + $email_classes['WC_Stripe_Email_Failed_Renewal_Authentication'] = new WC_Stripe_Email_Failed_Renewal_Authentication($email_classes); |
|
| 411 | + $email_classes['WC_Stripe_Email_Failed_Preorder_Authentication'] = new WC_Stripe_Email_Failed_Preorder_Authentication($email_classes); |
|
| 412 | + $email_classes['WC_Stripe_Email_Failed_Authentication_Retry'] = new WC_Stripe_Email_Failed_Authentication_Retry($email_classes); |
|
| 413 | 413 | |
| 414 | 414 | return $email_classes; |
| 415 | 415 | } |
@@ -424,9 +424,9 @@ discard block |
||
| 424 | 424 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/connect/class-wc-stripe-connect-rest-oauth-connect-controller.php'; |
| 425 | 425 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/connect/class-wc-stripe-connect-rest-deauthorize-controller.php'; |
| 426 | 426 | |
| 427 | - $oauth_init = new WC_Stripe_Connect_REST_Oauth_Init_Controller( $this->connect, $this->api ); |
|
| 428 | - $oauth_connect = new WC_Stripe_Connect_REST_Oauth_Connect_Controller( $this->connect, $this->api ); |
|
| 429 | - $deauthorize = new WC_Stripe_Connect_REST_Deauthorize_Controller( $this->connect, $this->api ); |
|
| 427 | + $oauth_init = new WC_Stripe_Connect_REST_Oauth_Init_Controller($this->connect, $this->api); |
|
| 428 | + $oauth_connect = new WC_Stripe_Connect_REST_Oauth_Connect_Controller($this->connect, $this->api); |
|
| 429 | + $deauthorize = new WC_Stripe_Connect_REST_Deauthorize_Controller($this->connect, $this->api); |
|
| 430 | 430 | |
| 431 | 431 | $oauth_init->register_routes(); |
| 432 | 432 | $oauth_connect->register_routes(); |
@@ -1,10 +1,10 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | +if ( ! defined('ABSPATH')) { |
|
| 4 | 4 | exit; |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | -if ( ! class_exists( 'WC_Stripe_Connect' ) ) { |
|
| 7 | +if ( ! class_exists('WC_Stripe_Connect')) { |
|
| 8 | 8 | /** |
| 9 | 9 | * Stripe Connect class. |
| 10 | 10 | */ |
@@ -24,11 +24,11 @@ discard block |
||
| 24 | 24 | * |
| 25 | 25 | * @param WC_Stripe_Connect_API $api stripe connect api. |
| 26 | 26 | */ |
| 27 | - public function __construct( WC_Stripe_Connect_API $api ) { |
|
| 27 | + public function __construct(WC_Stripe_Connect_API $api) { |
|
| 28 | 28 | |
| 29 | 29 | $this->api = $api; |
| 30 | 30 | |
| 31 | - add_action( 'wc_ajax_wc_stripe_connect_oauth', array( $this, 'wc_ajax_connect_oauth' ) ); |
|
| 31 | + add_action('wc_ajax_wc_stripe_connect_oauth', array($this, 'wc_ajax_connect_oauth')); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -38,23 +38,23 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @return string|WP_Error |
| 40 | 40 | */ |
| 41 | - public function get_oauth_url( $return_url = '' ) { |
|
| 41 | + public function get_oauth_url($return_url = '') { |
|
| 42 | 42 | |
| 43 | - if ( empty( $return_url ) ) { |
|
| 44 | - $return_url = admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=stripe' ); |
|
| 43 | + if (empty($return_url)) { |
|
| 44 | + $return_url = admin_url('admin.php?page=wc-settings&tab=checkout§ion=stripe'); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - if ( substr( $return_url, 0, 8 ) !== 'https://' ) { |
|
| 48 | - return new WP_Error( 'invalid_url_protocol', __( 'Your site must be served over HTTPS in order to connect your Stripe account automatically.', 'woocommerce-gateway-stripe' ) ); |
|
| 47 | + if (substr($return_url, 0, 8) !== 'https://') { |
|
| 48 | + return new WP_Error('invalid_url_protocol', __('Your site must be served over HTTPS in order to connect your Stripe account automatically.', 'woocommerce-gateway-stripe')); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - $result = $this->api->get_stripe_oauth_init( $return_url ); |
|
| 51 | + $result = $this->api->get_stripe_oauth_init($return_url); |
|
| 52 | 52 | |
| 53 | - if ( is_wp_error( $result ) ) { |
|
| 53 | + if (is_wp_error($result)) { |
|
| 54 | 54 | return $result; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - update_option( 'stripe_state', $result->state ); |
|
| 57 | + update_option('stripe_state', $result->state); |
|
| 58 | 58 | |
| 59 | 59 | return $result->oauthUrl; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
| 60 | 60 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | $response = $this->api->deauthorize_stripe_account(); |
| 70 | 70 | |
| 71 | - if ( is_wp_error( $response ) ) { |
|
| 71 | + if (is_wp_error($response)) { |
|
| 72 | 72 | return $response; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -85,21 +85,21 @@ discard block |
||
| 85 | 85 | * |
| 86 | 86 | * @return string|WP_Error |
| 87 | 87 | */ |
| 88 | - public function connect_oauth( $state, $code ) { |
|
| 88 | + public function connect_oauth($state, $code) { |
|
| 89 | 89 | |
| 90 | - if ( get_option( 'stripe_state', false ) !== $state ) { |
|
| 91 | - return new WP_Error( 'Invalid stripe state' ); |
|
| 90 | + if (get_option('stripe_state', false) !== $state) { |
|
| 91 | + return new WP_Error('Invalid stripe state'); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - $response = $this->api->get_stripe_oauth_keys( $code ); |
|
| 94 | + $response = $this->api->get_stripe_oauth_keys($code); |
|
| 95 | 95 | |
| 96 | - if ( is_wp_error( $response ) ) { |
|
| 96 | + if (is_wp_error($response)) { |
|
| 97 | 97 | return $response; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - delete_option( 'stripe_state' ); |
|
| 100 | + delete_option('stripe_state'); |
|
| 101 | 101 | |
| 102 | - return $this->save_stripe_keys( $response ); |
|
| 102 | + return $this->save_stripe_keys($response); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -107,10 +107,10 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function maybe_connect_oauth() { |
| 109 | 109 | |
| 110 | - if ( isset( $_GET['wcs_stripe_code'], $_GET['wcs_stripe_state'] ) ) { |
|
| 111 | - $response = $this->connect_oauth( $_GET['wcs_stripe_state'], $_GET['wcs_stripe_code'] ); |
|
| 110 | + if (isset($_GET['wcs_stripe_code'], $_GET['wcs_stripe_state'])) { |
|
| 111 | + $response = $this->connect_oauth($_GET['wcs_stripe_state'], $_GET['wcs_stripe_code']); |
|
| 112 | 112 | |
| 113 | - wp_safe_redirect( remove_query_arg( array( 'wcs_stripe_state', 'wcs_stripe_code' ) ) ); |
|
| 113 | + wp_safe_redirect(remove_query_arg(array('wcs_stripe_state', 'wcs_stripe_code'))); |
|
| 114 | 114 | exit; |
| 115 | 115 | } |
| 116 | 116 | } |
@@ -123,28 +123,28 @@ discard block |
||
| 123 | 123 | * |
| 124 | 124 | * @return array|WP_Error |
| 125 | 125 | */ |
| 126 | - private function save_stripe_keys( $result ) { |
|
| 126 | + private function save_stripe_keys($result) { |
|
| 127 | 127 | |
| 128 | - if ( ! isset( $result->publishableKey, $result->secretKey ) ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
| 129 | - return new WP_Error( 'Invalid credentials received from WooCommerce Connect server' ); |
|
| 128 | + if ( ! isset($result->publishableKey, $result->secretKey)) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
| 129 | + return new WP_Error('Invalid credentials received from WooCommerce Connect server'); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - $is_test = false !== strpos( $result->publishableKey, '_test_' ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
| 132 | + $is_test = false !== strpos($result->publishableKey, '_test_'); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
| 133 | 133 | $prefix = $is_test ? 'test_' : ''; |
| 134 | 134 | $default_options = array(); |
| 135 | 135 | |
| 136 | - $options = array_merge( $default_options, get_option( self::SETTINGS_OPTION, array() ) ); |
|
| 136 | + $options = array_merge($default_options, get_option(self::SETTINGS_OPTION, array())); |
|
| 137 | 137 | $options['enabled'] = 'yes'; |
| 138 | 138 | $options['testmode'] = $is_test ? 'yes' : 'no'; |
| 139 | - $options[ $prefix . 'publishable_key' ] = $result->publishableKey; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
| 140 | - $options[ $prefix . 'secret_key' ] = $result->secretKey; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
| 139 | + $options[$prefix . 'publishable_key'] = $result->publishableKey; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
| 140 | + $options[$prefix . 'secret_key'] = $result->secretKey; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
|
| 141 | 141 | |
| 142 | 142 | // While we are at it, let's also clear the account_id and |
| 143 | 143 | // test_account_id if present. |
| 144 | - unset( $options['account_id'] ); |
|
| 145 | - unset( $options['test_account_id'] ); |
|
| 144 | + unset($options['account_id']); |
|
| 145 | + unset($options['test_account_id']); |
|
| 146 | 146 | |
| 147 | - update_option( self::SETTINGS_OPTION, $options ); |
|
| 147 | + update_option(self::SETTINGS_OPTION, $options); |
|
| 148 | 148 | |
| 149 | 149 | return $result; |
| 150 | 150 | } |
@@ -155,9 +155,9 @@ discard block |
||
| 155 | 155 | private function clear_stripe_keys() { |
| 156 | 156 | |
| 157 | 157 | $default_options = $this->get_default_config(); |
| 158 | - $options = array_merge( $default_options, get_option( self::SETTINGS_OPTION, array() ) ); |
|
| 158 | + $options = array_merge($default_options, get_option(self::SETTINGS_OPTION, array())); |
|
| 159 | 159 | |
| 160 | - if ( 'yes' === $options['testmode'] ) { |
|
| 160 | + if ('yes' === $options['testmode']) { |
|
| 161 | 161 | $options['test_publishable_key'] = ''; |
| 162 | 162 | $options['test_secret_key'] = ''; |
| 163 | 163 | } else { |
@@ -167,10 +167,10 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | // While we are at it, let's also clear the account_id and |
| 169 | 169 | // test_account_id if present. |
| 170 | - unset( $options['account_id'] ); |
|
| 171 | - unset( $options['test_account_id'] ); |
|
| 170 | + unset($options['account_id']); |
|
| 171 | + unset($options['test_account_id']); |
|
| 172 | 172 | |
| 173 | - update_option( self::SETTINGS_OPTION, $options ); |
|
| 173 | + update_option(self::SETTINGS_OPTION, $options); |
|
| 174 | 174 | |
| 175 | 175 | } |
| 176 | 176 | |
@@ -179,17 +179,17 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | public function wc_ajax_connect_oauth() { |
| 181 | 181 | |
| 182 | - if ( empty( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], '_wc_stripe_connect_nonce' ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.ValidatedSanitizedInput.MissingUnslash |
|
| 183 | - wp_die( __( 'You are not authorized to automatically copy Stripe keys', 'woocommerce-gateway-stripe' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 182 | + if (empty($_POST['nonce']) || ! wp_verify_nonce($_POST['nonce'], '_wc_stripe_connect_nonce')) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized,WordPress.Security.ValidatedSanitizedInput.MissingUnslash |
|
| 183 | + wp_die(__('You are not authorized to automatically copy Stripe keys', 'woocommerce-gateway-stripe')); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | $oauth_url = $this->get_oauth_url(); |
| 187 | 187 | |
| 188 | - if ( is_wp_error( $oauth_url ) ) { |
|
| 188 | + if (is_wp_error($oauth_url)) { |
|
| 189 | 189 | wp_send_json_error(); |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - wp_send_json_success( $oauth_url ); |
|
| 192 | + wp_send_json_success($oauth_url); |
|
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | } |