@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -7,40 +7,40 @@ discard block |
||
7 | 7 | 'wc_stripe_bancontact_settings', |
8 | 8 | array( |
9 | 9 | 'geo_target' => array( |
10 | - 'description' => __( 'Customer Geography: Belgium', 'woocommerce-gateway-stripe' ), |
|
10 | + 'description' => __('Customer Geography: Belgium', 'woocommerce-gateway-stripe'), |
|
11 | 11 | 'type' => 'title', |
12 | 12 | ), |
13 | 13 | 'guide' => array( |
14 | - 'description' => __( '<a href="https://stripe.com/payments/payment-methods-guide#bancontact" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe' ), |
|
14 | + 'description' => __('<a href="https://stripe.com/payments/payment-methods-guide#bancontact" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe'), |
|
15 | 15 | 'type' => 'title', |
16 | 16 | ), |
17 | 17 | 'activation' => array( |
18 | - 'description' => __( 'Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe' ), |
|
18 | + 'description' => __('Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe'), |
|
19 | 19 | 'type' => 'title', |
20 | 20 | ), |
21 | 21 | 'enabled' => array( |
22 | - 'title' => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ), |
|
23 | - 'label' => __( 'Enable Stripe Bancontact', 'woocommerce-gateway-stripe' ), |
|
22 | + 'title' => __('Enable/Disable', 'woocommerce-gateway-stripe'), |
|
23 | + 'label' => __('Enable Stripe Bancontact', 'woocommerce-gateway-stripe'), |
|
24 | 24 | 'type' => 'checkbox', |
25 | 25 | 'description' => '', |
26 | 26 | 'default' => 'no', |
27 | 27 | ), |
28 | 28 | 'title' => array( |
29 | - 'title' => __( 'Title', 'woocommerce-gateway-stripe' ), |
|
29 | + 'title' => __('Title', 'woocommerce-gateway-stripe'), |
|
30 | 30 | 'type' => 'text', |
31 | - 'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ), |
|
32 | - 'default' => __( 'Bancontact', 'woocommerce-gateway-stripe' ), |
|
31 | + 'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'), |
|
32 | + 'default' => __('Bancontact', 'woocommerce-gateway-stripe'), |
|
33 | 33 | 'desc_tip' => true, |
34 | 34 | ), |
35 | 35 | 'description' => array( |
36 | - 'title' => __( 'Description', 'woocommerce-gateway-stripe' ), |
|
36 | + 'title' => __('Description', 'woocommerce-gateway-stripe'), |
|
37 | 37 | 'type' => 'text', |
38 | - 'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ), |
|
39 | - 'default' => __( 'You will be redirected to Bancontact.', 'woocommerce-gateway-stripe' ), |
|
38 | + 'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'), |
|
39 | + 'default' => __('You will be redirected to Bancontact.', 'woocommerce-gateway-stripe'), |
|
40 | 40 | 'desc_tip' => true, |
41 | 41 | ), |
42 | 42 | 'webhook' => array( |
43 | - 'title' => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ), |
|
43 | + 'title' => __('Webhook Endpoints', 'woocommerce-gateway-stripe'), |
|
44 | 44 | 'type' => 'title', |
45 | 45 | /* translators: webhook URL */ |
46 | 46 | 'description' => $this->display_admin_settings_webhook_description(), |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -7,40 +7,40 @@ discard block |
||
7 | 7 | 'wc_stripe_ideal_settings', |
8 | 8 | array( |
9 | 9 | 'geo_target' => array( |
10 | - 'description' => __( 'Customer Geography: The Netherlands', 'woocommerce-gateway-stripe' ), |
|
10 | + 'description' => __('Customer Geography: The Netherlands', 'woocommerce-gateway-stripe'), |
|
11 | 11 | 'type' => 'title', |
12 | 12 | ), |
13 | 13 | 'guide' => array( |
14 | - 'description' => __( '<a href="https://stripe.com/payments/payment-methods-guide#ideal" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe' ), |
|
14 | + 'description' => __('<a href="https://stripe.com/payments/payment-methods-guide#ideal" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe'), |
|
15 | 15 | 'type' => 'title', |
16 | 16 | ), |
17 | 17 | 'activation' => array( |
18 | - 'description' => __( 'Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe' ), |
|
18 | + 'description' => __('Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe'), |
|
19 | 19 | 'type' => 'title', |
20 | 20 | ), |
21 | 21 | 'enabled' => array( |
22 | - 'title' => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ), |
|
23 | - 'label' => __( 'Enable Stripe iDeal', 'woocommerce-gateway-stripe' ), |
|
22 | + 'title' => __('Enable/Disable', 'woocommerce-gateway-stripe'), |
|
23 | + 'label' => __('Enable Stripe iDeal', 'woocommerce-gateway-stripe'), |
|
24 | 24 | 'type' => 'checkbox', |
25 | 25 | 'description' => '', |
26 | 26 | 'default' => 'no', |
27 | 27 | ), |
28 | 28 | 'title' => array( |
29 | - 'title' => __( 'Title', 'woocommerce-gateway-stripe' ), |
|
29 | + 'title' => __('Title', 'woocommerce-gateway-stripe'), |
|
30 | 30 | 'type' => 'text', |
31 | - 'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ), |
|
32 | - 'default' => __( 'iDeal', 'woocommerce-gateway-stripe' ), |
|
31 | + 'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'), |
|
32 | + 'default' => __('iDeal', 'woocommerce-gateway-stripe'), |
|
33 | 33 | 'desc_tip' => true, |
34 | 34 | ), |
35 | 35 | 'description' => array( |
36 | - 'title' => __( 'Description', 'woocommerce-gateway-stripe' ), |
|
36 | + 'title' => __('Description', 'woocommerce-gateway-stripe'), |
|
37 | 37 | 'type' => 'text', |
38 | - 'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ), |
|
39 | - 'default' => __( 'You will be redirected to iDeal.', 'woocommerce-gateway-stripe' ), |
|
38 | + 'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'), |
|
39 | + 'default' => __('You will be redirected to iDeal.', 'woocommerce-gateway-stripe'), |
|
40 | 40 | 'desc_tip' => true, |
41 | 41 | ), |
42 | 42 | 'webhook' => array( |
43 | - 'title' => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ), |
|
43 | + 'title' => __('Webhook Endpoints', 'woocommerce-gateway-stripe'), |
|
44 | 44 | 'type' => 'title', |
45 | 45 | /* translators: webhook URL */ |
46 | 46 | 'description' => $this->display_admin_settings_webhook_description(), |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -7,36 +7,36 @@ discard block |
||
7 | 7 | 'wc_stripe_eps_settings', |
8 | 8 | array( |
9 | 9 | 'geo_target' => array( |
10 | - 'description' => __( 'Customer Geography: Austria', 'woocommerce-gateway-stripe' ), |
|
10 | + 'description' => __('Customer Geography: Austria', 'woocommerce-gateway-stripe'), |
|
11 | 11 | 'type' => 'title', |
12 | 12 | ), |
13 | 13 | 'activation' => array( |
14 | - 'description' => __( 'Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe' ), |
|
14 | + 'description' => __('Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe'), |
|
15 | 15 | 'type' => 'title', |
16 | 16 | ), |
17 | 17 | 'enabled' => array( |
18 | - 'title' => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ), |
|
19 | - 'label' => __( 'Enable Stripe EPS', 'woocommerce-gateway-stripe' ), |
|
18 | + 'title' => __('Enable/Disable', 'woocommerce-gateway-stripe'), |
|
19 | + 'label' => __('Enable Stripe EPS', 'woocommerce-gateway-stripe'), |
|
20 | 20 | 'type' => 'checkbox', |
21 | 21 | 'description' => '', |
22 | 22 | 'default' => 'no', |
23 | 23 | ), |
24 | 24 | 'title' => array( |
25 | - 'title' => __( 'Title', 'woocommerce-gateway-stripe' ), |
|
25 | + 'title' => __('Title', 'woocommerce-gateway-stripe'), |
|
26 | 26 | 'type' => 'text', |
27 | - 'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ), |
|
28 | - 'default' => __( 'EPS', 'woocommerce-gateway-stripe' ), |
|
27 | + 'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'), |
|
28 | + 'default' => __('EPS', 'woocommerce-gateway-stripe'), |
|
29 | 29 | 'desc_tip' => true, |
30 | 30 | ), |
31 | 31 | 'description' => array( |
32 | - 'title' => __( 'Description', 'woocommerce-gateway-stripe' ), |
|
32 | + 'title' => __('Description', 'woocommerce-gateway-stripe'), |
|
33 | 33 | 'type' => 'text', |
34 | - 'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ), |
|
35 | - 'default' => __( 'You will be redirected to EPS.', 'woocommerce-gateway-stripe' ), |
|
34 | + 'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'), |
|
35 | + 'default' => __('You will be redirected to EPS.', 'woocommerce-gateway-stripe'), |
|
36 | 36 | 'desc_tip' => true, |
37 | 37 | ), |
38 | 38 | 'webhook' => array( |
39 | - 'title' => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ), |
|
39 | + 'title' => __('Webhook Endpoints', 'woocommerce-gateway-stripe'), |
|
40 | 40 | 'type' => 'title', |
41 | 41 | /* translators: webhook URL */ |
42 | 42 | 'description' => $this->display_admin_settings_webhook_description(), |
@@ -21,6 +21,7 @@ |
||
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Manage notes to show after Apple Pay domain verification. |
24 | + * @param boolean $verification_complete |
|
24 | 25 | */ |
25 | 26 | public static function notify_on_apple_pay_domain_verification( $verification_complete ) { |
26 | 27 | if ( ! class_exists( 'Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes' ) ) { |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -18,39 +18,39 @@ discard block |
||
18 | 18 | const POST_SETUP_SUCCESS_ACTION = 'wc_stripe_apple_pay_post_setup_success'; |
19 | 19 | |
20 | 20 | public function __construct() { |
21 | - add_action( self::POST_SETUP_SUCCESS_ACTION, array( self::class, 'create_marketing_note' ) ); |
|
21 | + add_action(self::POST_SETUP_SUCCESS_ACTION, array(self::class, 'create_marketing_note')); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
25 | 25 | * Manage notes to show after Apple Pay domain verification. |
26 | 26 | */ |
27 | - public static function notify_on_apple_pay_domain_verification( $verification_complete ) { |
|
28 | - if ( ! class_exists( 'Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes' ) ) { |
|
27 | + public static function notify_on_apple_pay_domain_verification($verification_complete) { |
|
28 | + if ( ! class_exists('Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes')) { |
|
29 | 29 | return; |
30 | 30 | } |
31 | 31 | |
32 | - if ( ! class_exists( 'WC_Data_Store' ) ) { |
|
32 | + if ( ! class_exists('WC_Data_Store')) { |
|
33 | 33 | return; |
34 | 34 | } |
35 | 35 | |
36 | - if ( $verification_complete ) { |
|
37 | - if ( self::should_show_marketing_note() && ! wp_next_scheduled( self::POST_SETUP_SUCCESS_ACTION ) ) { |
|
38 | - wp_schedule_single_event( time() + DAY_IN_SECONDS, self::POST_SETUP_SUCCESS_ACTION ); |
|
36 | + if ($verification_complete) { |
|
37 | + if (self::should_show_marketing_note() && ! wp_next_scheduled(self::POST_SETUP_SUCCESS_ACTION)) { |
|
38 | + wp_schedule_single_event(time() + DAY_IN_SECONDS, self::POST_SETUP_SUCCESS_ACTION); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | // If the domain verification completed after failure note was created, make sure it's marked as actioned. |
42 | - $data_store = WC_Data_Store::load( 'admin-note' ); |
|
43 | - $failure_note_ids = $data_store->get_notes_with_name( self::FAILURE_NOTE_NAME ); |
|
44 | - if ( ! empty( $failure_note_ids ) ) { |
|
45 | - $note_id = array_pop( $failure_note_ids ); |
|
46 | - $note = WC_Admin_Notes::get_note( $note_id ); |
|
47 | - if ( false !== $note && WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED !== $note->get_status() ) { |
|
48 | - $note->set_status( WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED ); |
|
42 | + $data_store = WC_Data_Store::load('admin-note'); |
|
43 | + $failure_note_ids = $data_store->get_notes_with_name(self::FAILURE_NOTE_NAME); |
|
44 | + if ( ! empty($failure_note_ids)) { |
|
45 | + $note_id = array_pop($failure_note_ids); |
|
46 | + $note = WC_Admin_Notes::get_note($note_id); |
|
47 | + if (false !== $note && WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED !== $note->get_status()) { |
|
48 | + $note->set_status(WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED); |
|
49 | 49 | $note->save(); |
50 | 50 | } |
51 | 51 | } |
52 | 52 | } else { |
53 | - if ( empty( $failure_note_ids ) ) { |
|
53 | + if (empty($failure_note_ids)) { |
|
54 | 54 | self::create_failure_note(); |
55 | 55 | } |
56 | 56 | } |
@@ -62,23 +62,23 @@ discard block |
||
62 | 62 | public static function should_show_marketing_note() { |
63 | 63 | // Display to US merchants only. |
64 | 64 | $base_location = wc_get_base_location(); |
65 | - if ( ! $base_location || 'US' !== $base_location['country'] ) { |
|
65 | + if ( ! $base_location || 'US' !== $base_location['country']) { |
|
66 | 66 | return false; |
67 | 67 | } |
68 | 68 | |
69 | 69 | // Make sure Apple Pay is enabled and setup is successful. |
70 | - $stripe_settings = get_option( 'woocommerce_stripe_settings', array() ); |
|
71 | - $stripe_enabled = isset( $stripe_settings['enabled'] ) && 'yes' === $stripe_settings['enabled']; |
|
72 | - $button_enabled = isset( $stripe_settings['payment_request'] ) && 'yes' === $stripe_settings['payment_request']; |
|
73 | - $verification_complete = isset( $stripe_settings['apple_pay_domain_set'] ) && 'yes' === $stripe_settings['apple_pay_domain_set']; |
|
74 | - if ( ! $stripe_enabled || ! $button_enabled || ! $verification_complete ) { |
|
70 | + $stripe_settings = get_option('woocommerce_stripe_settings', array()); |
|
71 | + $stripe_enabled = isset($stripe_settings['enabled']) && 'yes' === $stripe_settings['enabled']; |
|
72 | + $button_enabled = isset($stripe_settings['payment_request']) && 'yes' === $stripe_settings['payment_request']; |
|
73 | + $verification_complete = isset($stripe_settings['apple_pay_domain_set']) && 'yes' === $stripe_settings['apple_pay_domain_set']; |
|
74 | + if ( ! $stripe_enabled || ! $button_enabled || ! $verification_complete) { |
|
75 | 75 | return false; |
76 | 76 | } |
77 | 77 | |
78 | 78 | // Make sure note doesn't already exist. |
79 | - $data_store = WC_Data_Store::load( 'admin-note' ); |
|
80 | - $success_note_ids = $data_store->get_notes_with_name( self::SUCCESS_NOTE_NAME ); |
|
81 | - if ( ! empty( $success_note_ids ) ) { |
|
79 | + $data_store = WC_Data_Store::load('admin-note'); |
|
80 | + $success_note_ids = $data_store->get_notes_with_name(self::SUCCESS_NOTE_NAME); |
|
81 | + if ( ! empty($success_note_ids)) { |
|
82 | 82 | return false; |
83 | 83 | } |
84 | 84 | |
@@ -90,19 +90,19 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public static function create_marketing_note() { |
92 | 92 | // Make sure conditions for this note still hold. |
93 | - if ( ! self::should_show_marketing_note() ) { |
|
93 | + if ( ! self::should_show_marketing_note()) { |
|
94 | 94 | return; |
95 | 95 | } |
96 | 96 | |
97 | 97 | $note = new WC_Admin_Note(); |
98 | - $note->set_title( __( 'Boost sales this holiday season with Apple Pay!', 'woocommerce-gateway-stripe' ) ); |
|
99 | - $note->set_content( __( 'Now that you accept Apple Pay® with Stripe, you can increase conversion rates by letting your customers know that Apple Pay is available. Here’s a marketing guide to help you get started.', 'woocommerce-gateway-stripe' ) ); |
|
100 | - $note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_MARKETING ); |
|
101 | - $note->set_name( self::SUCCESS_NOTE_NAME ); |
|
102 | - $note->set_source( 'woocommerce-gateway-stripe' ); |
|
98 | + $note->set_title(__('Boost sales this holiday season with Apple Pay!', 'woocommerce-gateway-stripe')); |
|
99 | + $note->set_content(__('Now that you accept Apple Pay® with Stripe, you can increase conversion rates by letting your customers know that Apple Pay is available. Here’s a marketing guide to help you get started.', 'woocommerce-gateway-stripe')); |
|
100 | + $note->set_type(WC_Admin_Note::E_WC_ADMIN_NOTE_MARKETING); |
|
101 | + $note->set_name(self::SUCCESS_NOTE_NAME); |
|
102 | + $note->set_source('woocommerce-gateway-stripe'); |
|
103 | 103 | $note->add_action( |
104 | 104 | 'marketing-guide', |
105 | - __( 'See marketing guide', 'woocommerce-gateway-stripe' ), |
|
105 | + __('See marketing guide', 'woocommerce-gateway-stripe'), |
|
106 | 106 | 'https://developer.apple.com/apple-pay/marketing/' |
107 | 107 | ); |
108 | 108 | $note->save(); |
@@ -113,14 +113,14 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public static function create_failure_note() { |
115 | 115 | $note = new WC_Admin_Note(); |
116 | - $note->set_title( __( 'Apple Pay domain verification needed', 'woocommerce-gateway-stripe' ) ); |
|
117 | - $note->set_content( __( 'The WooCommerce Stripe Gateway extension attempted to perform domain verification on behalf of your store, but was unable to do so. This must be resolved before Apple Pay can be offered to your customers.', 'woocommerce-gateway-stripe' ) ); |
|
118 | - $note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); |
|
119 | - $note->set_name( self::FAILURE_NOTE_NAME ); |
|
120 | - $note->set_source( 'woocommerce-gateway-stripe' ); |
|
116 | + $note->set_title(__('Apple Pay domain verification needed', 'woocommerce-gateway-stripe')); |
|
117 | + $note->set_content(__('The WooCommerce Stripe Gateway extension attempted to perform domain verification on behalf of your store, but was unable to do so. This must be resolved before Apple Pay can be offered to your customers.', 'woocommerce-gateway-stripe')); |
|
118 | + $note->set_type(WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL); |
|
119 | + $note->set_name(self::FAILURE_NOTE_NAME); |
|
120 | + $note->set_source('woocommerce-gateway-stripe'); |
|
121 | 121 | $note->add_action( |
122 | 122 | 'learn-more', |
123 | - __( 'Learn more', 'woocommerce-gateway-stripe' ), |
|
123 | + __('Learn more', 'woocommerce-gateway-stripe'), |
|
124 | 124 | 'https://docs.woocommerce.com/document/stripe/#apple-pay' |
125 | 125 | ); |
126 | 126 | $note->save(); |
@@ -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.4' ); // WRCS: DEFINED_VERSION. |
|
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.4'); // WRCS: DEFINED_VERSION. |
|
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,14 +51,14 @@ 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 | function wc_stripe() { |
58 | 58 | |
59 | 59 | static $plugin; |
60 | 60 | |
61 | - if ( ! isset( $plugin ) ) { |
|
61 | + if ( ! isset($plugin)) { |
|
62 | 62 | |
63 | 63 | class WC_Stripe { |
64 | 64 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @return Singleton The *Singleton* instance. |
74 | 74 | */ |
75 | 75 | public static function get_instance() { |
76 | - if ( null === self::$instance ) { |
|
76 | + if (null === self::$instance) { |
|
77 | 77 | self::$instance = new self(); |
78 | 78 | } |
79 | 79 | return self::$instance; |
@@ -114,14 +114,14 @@ discard block |
||
114 | 114 | * *Singleton* via the `new` operator from outside of this class. |
115 | 115 | */ |
116 | 116 | private function __construct() { |
117 | - add_action( 'admin_init', array( $this, 'install' ) ); |
|
117 | + add_action('admin_init', array($this, 'install')); |
|
118 | 118 | |
119 | 119 | $this->init(); |
120 | 120 | |
121 | 121 | $this->api = new WC_Stripe_Connect_API(); |
122 | - $this->connect = new WC_Stripe_Connect( $this->api ); |
|
122 | + $this->connect = new WC_Stripe_Connect($this->api); |
|
123 | 123 | |
124 | - add_action( 'rest_api_init', array( $this, 'register_connect_routes' ) ); |
|
124 | + add_action('rest_api_init', array($this, 'register_connect_routes')); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -131,57 +131,57 @@ discard block |
||
131 | 131 | * @version 4.0.0 |
132 | 132 | */ |
133 | 133 | public function init() { |
134 | - if ( is_admin() ) { |
|
135 | - require_once dirname( __FILE__ ) . '/includes/admin/class-wc-stripe-privacy.php'; |
|
134 | + if (is_admin()) { |
|
135 | + require_once dirname(__FILE__) . '/includes/admin/class-wc-stripe-privacy.php'; |
|
136 | 136 | } |
137 | 137 | |
138 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-exception.php'; |
|
139 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-logger.php'; |
|
140 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-helper.php'; |
|
141 | - include_once dirname( __FILE__ ) . '/includes/class-wc-stripe-api.php'; |
|
142 | - require_once dirname( __FILE__ ) . '/includes/abstracts/abstract-wc-stripe-payment-gateway.php'; |
|
143 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-webhook-handler.php'; |
|
144 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-sepa-payment-token.php'; |
|
145 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-apple-pay-registration.php'; |
|
146 | - require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-pre-orders-compat.php'; |
|
147 | - require_once dirname( __FILE__ ) . '/includes/class-wc-gateway-stripe.php'; |
|
148 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-bancontact.php'; |
|
149 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-sofort.php'; |
|
150 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-giropay.php'; |
|
151 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-eps.php'; |
|
152 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-ideal.php'; |
|
153 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-p24.php'; |
|
154 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-alipay.php'; |
|
155 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-sepa.php'; |
|
156 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-multibanco.php'; |
|
157 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-payment-request.php'; |
|
158 | - require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-subs-compat.php'; |
|
159 | - require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-sepa-subs-compat.php'; |
|
160 | - require_once dirname( __FILE__ ) . '/includes/connect/class-wc-stripe-connect.php'; |
|
161 | - require_once dirname( __FILE__ ) . '/includes/connect/class-wc-stripe-connect-api.php'; |
|
162 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-order-handler.php'; |
|
163 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-payment-tokens.php'; |
|
164 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-customer.php'; |
|
165 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-intent-controller.php'; |
|
166 | - require_once dirname( __FILE__ ) . '/includes/admin/class-wc-stripe-inbox-notes.php'; |
|
167 | - |
|
168 | - if ( is_admin() ) { |
|
169 | - require_once dirname( __FILE__ ) . '/includes/admin/class-wc-stripe-admin-notices.php'; |
|
138 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-exception.php'; |
|
139 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-logger.php'; |
|
140 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-helper.php'; |
|
141 | + include_once dirname(__FILE__) . '/includes/class-wc-stripe-api.php'; |
|
142 | + require_once dirname(__FILE__) . '/includes/abstracts/abstract-wc-stripe-payment-gateway.php'; |
|
143 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-webhook-handler.php'; |
|
144 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-sepa-payment-token.php'; |
|
145 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-apple-pay-registration.php'; |
|
146 | + require_once dirname(__FILE__) . '/includes/compat/class-wc-stripe-pre-orders-compat.php'; |
|
147 | + require_once dirname(__FILE__) . '/includes/class-wc-gateway-stripe.php'; |
|
148 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-bancontact.php'; |
|
149 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-sofort.php'; |
|
150 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-giropay.php'; |
|
151 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-eps.php'; |
|
152 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-ideal.php'; |
|
153 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-p24.php'; |
|
154 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-alipay.php'; |
|
155 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-sepa.php'; |
|
156 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-multibanco.php'; |
|
157 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-stripe-payment-request.php'; |
|
158 | + require_once dirname(__FILE__) . '/includes/compat/class-wc-stripe-subs-compat.php'; |
|
159 | + require_once dirname(__FILE__) . '/includes/compat/class-wc-stripe-sepa-subs-compat.php'; |
|
160 | + require_once dirname(__FILE__) . '/includes/connect/class-wc-stripe-connect.php'; |
|
161 | + require_once dirname(__FILE__) . '/includes/connect/class-wc-stripe-connect-api.php'; |
|
162 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-order-handler.php'; |
|
163 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-payment-tokens.php'; |
|
164 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-customer.php'; |
|
165 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-intent-controller.php'; |
|
166 | + require_once dirname(__FILE__) . '/includes/admin/class-wc-stripe-inbox-notes.php'; |
|
167 | + |
|
168 | + if (is_admin()) { |
|
169 | + require_once dirname(__FILE__) . '/includes/admin/class-wc-stripe-admin-notices.php'; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | // REMOVE IN THE FUTURE. |
173 | - require_once dirname( __FILE__ ) . '/includes/deprecated/class-wc-stripe-apple-pay.php'; |
|
173 | + require_once dirname(__FILE__) . '/includes/deprecated/class-wc-stripe-apple-pay.php'; |
|
174 | 174 | |
175 | - add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateways' ) ); |
|
176 | - add_filter( 'pre_update_option_woocommerce_stripe_settings', array( $this, 'gateway_settings_update' ), 10, 2 ); |
|
177 | - add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugin_action_links' ) ); |
|
178 | - add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 ); |
|
175 | + add_filter('woocommerce_payment_gateways', array($this, 'add_gateways')); |
|
176 | + add_filter('pre_update_option_woocommerce_stripe_settings', array($this, 'gateway_settings_update'), 10, 2); |
|
177 | + add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($this, 'plugin_action_links')); |
|
178 | + add_filter('plugin_row_meta', array($this, 'plugin_row_meta'), 10, 2); |
|
179 | 179 | |
180 | 180 | // Modify emails emails. |
181 | - add_filter( 'woocommerce_email_classes', array( $this, 'add_emails' ), 20 ); |
|
181 | + add_filter('woocommerce_email_classes', array($this, 'add_emails'), 20); |
|
182 | 182 | |
183 | - if ( version_compare( WC_VERSION, '3.4', '<' ) ) { |
|
184 | - add_filter( 'woocommerce_get_sections_checkout', array( $this, 'filter_gateway_order_admin' ) ); |
|
183 | + if (version_compare(WC_VERSION, '3.4', '<')) { |
|
184 | + add_filter('woocommerce_get_sections_checkout', array($this, 'filter_gateway_order_admin')); |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | * @version 4.0.0 |
193 | 193 | */ |
194 | 194 | public function update_plugin_version() { |
195 | - delete_option( 'wc_stripe_version' ); |
|
196 | - update_option( 'wc_stripe_version', WC_STRIPE_VERSION ); |
|
195 | + delete_option('wc_stripe_version'); |
|
196 | + update_option('wc_stripe_version', WC_STRIPE_VERSION); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | /** |
@@ -203,15 +203,15 @@ discard block |
||
203 | 203 | * @version 3.1.0 |
204 | 204 | */ |
205 | 205 | public function install() { |
206 | - if ( ! is_plugin_active( plugin_basename( __FILE__ ) ) ) { |
|
206 | + if ( ! is_plugin_active(plugin_basename(__FILE__))) { |
|
207 | 207 | return; |
208 | 208 | } |
209 | 209 | |
210 | - if ( ! defined( 'IFRAME_REQUEST' ) && ( WC_STRIPE_VERSION !== get_option( 'wc_stripe_version' ) ) ) { |
|
211 | - do_action( 'woocommerce_stripe_updated' ); |
|
210 | + if ( ! defined('IFRAME_REQUEST') && (WC_STRIPE_VERSION !== get_option('wc_stripe_version'))) { |
|
211 | + do_action('woocommerce_stripe_updated'); |
|
212 | 212 | |
213 | - if ( ! defined( 'WC_STRIPE_INSTALLING' ) ) { |
|
214 | - define( 'WC_STRIPE_INSTALLING', true ); |
|
213 | + if ( ! defined('WC_STRIPE_INSTALLING')) { |
|
214 | + define('WC_STRIPE_INSTALLING', true); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | $this->update_plugin_version(); |
@@ -224,11 +224,11 @@ discard block |
||
224 | 224 | * @since 1.0.0 |
225 | 225 | * @version 4.0.0 |
226 | 226 | */ |
227 | - public function plugin_action_links( $links ) { |
|
227 | + public function plugin_action_links($links) { |
|
228 | 228 | $plugin_links = array( |
229 | - '<a href="admin.php?page=wc-settings&tab=checkout§ion=stripe">' . esc_html__( 'Settings', 'woocommerce-gateway-stripe' ) . '</a>', |
|
229 | + '<a href="admin.php?page=wc-settings&tab=checkout§ion=stripe">' . esc_html__('Settings', 'woocommerce-gateway-stripe') . '</a>', |
|
230 | 230 | ); |
231 | - return array_merge( $plugin_links, $links ); |
|
231 | + return array_merge($plugin_links, $links); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | /** |
@@ -239,13 +239,13 @@ discard block |
||
239 | 239 | * @param string $file Name of current file. |
240 | 240 | * @return array $links Update list of plugin links. |
241 | 241 | */ |
242 | - public function plugin_row_meta( $links, $file ) { |
|
243 | - if ( plugin_basename( __FILE__ ) === $file ) { |
|
242 | + public function plugin_row_meta($links, $file) { |
|
243 | + if (plugin_basename(__FILE__) === $file) { |
|
244 | 244 | $row_meta = array( |
245 | - '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>', |
|
246 | - '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>', |
|
245 | + '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>', |
|
246 | + '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>', |
|
247 | 247 | ); |
248 | - return array_merge( $links, $row_meta ); |
|
248 | + return array_merge($links, $row_meta); |
|
249 | 249 | } |
250 | 250 | return (array) $links; |
251 | 251 | } |
@@ -256,8 +256,8 @@ discard block |
||
256 | 256 | * @since 1.0.0 |
257 | 257 | * @version 4.0.0 |
258 | 258 | */ |
259 | - public function add_gateways( $methods ) { |
|
260 | - if ( class_exists( 'WC_Subscriptions_Order' ) && function_exists( 'wcs_create_renewal_order' ) ) { |
|
259 | + public function add_gateways($methods) { |
|
260 | + if (class_exists('WC_Subscriptions_Order') && function_exists('wcs_create_renewal_order')) { |
|
261 | 261 | $methods[] = 'WC_Stripe_Subs_Compat'; |
262 | 262 | $methods[] = 'WC_Stripe_Sepa_Subs_Compat'; |
263 | 263 | } else { |
@@ -283,28 +283,28 @@ discard block |
||
283 | 283 | * @since 4.0.0 |
284 | 284 | * @version 4.0.0 |
285 | 285 | */ |
286 | - public function filter_gateway_order_admin( $sections ) { |
|
287 | - unset( $sections['stripe'] ); |
|
288 | - unset( $sections['stripe_bancontact'] ); |
|
289 | - unset( $sections['stripe_sofort'] ); |
|
290 | - unset( $sections['stripe_giropay'] ); |
|
291 | - unset( $sections['stripe_eps'] ); |
|
292 | - unset( $sections['stripe_ideal'] ); |
|
293 | - unset( $sections['stripe_p24'] ); |
|
294 | - unset( $sections['stripe_alipay'] ); |
|
295 | - unset( $sections['stripe_sepa'] ); |
|
296 | - unset( $sections['stripe_multibanco'] ); |
|
286 | + public function filter_gateway_order_admin($sections) { |
|
287 | + unset($sections['stripe']); |
|
288 | + unset($sections['stripe_bancontact']); |
|
289 | + unset($sections['stripe_sofort']); |
|
290 | + unset($sections['stripe_giropay']); |
|
291 | + unset($sections['stripe_eps']); |
|
292 | + unset($sections['stripe_ideal']); |
|
293 | + unset($sections['stripe_p24']); |
|
294 | + unset($sections['stripe_alipay']); |
|
295 | + unset($sections['stripe_sepa']); |
|
296 | + unset($sections['stripe_multibanco']); |
|
297 | 297 | |
298 | 298 | $sections['stripe'] = 'Stripe'; |
299 | - $sections['stripe_bancontact'] = __( 'Stripe Bancontact', 'woocommerce-gateway-stripe' ); |
|
300 | - $sections['stripe_sofort'] = __( 'Stripe SOFORT', 'woocommerce-gateway-stripe' ); |
|
301 | - $sections['stripe_giropay'] = __( 'Stripe Giropay', 'woocommerce-gateway-stripe' ); |
|
302 | - $sections['stripe_eps'] = __( 'Stripe EPS', 'woocommerce-gateway-stripe' ); |
|
303 | - $sections['stripe_ideal'] = __( 'Stripe iDeal', 'woocommerce-gateway-stripe' ); |
|
304 | - $sections['stripe_p24'] = __( 'Stripe P24', 'woocommerce-gateway-stripe' ); |
|
305 | - $sections['stripe_alipay'] = __( 'Stripe Alipay', 'woocommerce-gateway-stripe' ); |
|
306 | - $sections['stripe_sepa'] = __( 'Stripe SEPA Direct Debit', 'woocommerce-gateway-stripe' ); |
|
307 | - $sections['stripe_multibanco'] = __( 'Stripe Multibanco', 'woocommerce-gateway-stripe' ); |
|
299 | + $sections['stripe_bancontact'] = __('Stripe Bancontact', 'woocommerce-gateway-stripe'); |
|
300 | + $sections['stripe_sofort'] = __('Stripe SOFORT', 'woocommerce-gateway-stripe'); |
|
301 | + $sections['stripe_giropay'] = __('Stripe Giropay', 'woocommerce-gateway-stripe'); |
|
302 | + $sections['stripe_eps'] = __('Stripe EPS', 'woocommerce-gateway-stripe'); |
|
303 | + $sections['stripe_ideal'] = __('Stripe iDeal', 'woocommerce-gateway-stripe'); |
|
304 | + $sections['stripe_p24'] = __('Stripe P24', 'woocommerce-gateway-stripe'); |
|
305 | + $sections['stripe_alipay'] = __('Stripe Alipay', 'woocommerce-gateway-stripe'); |
|
306 | + $sections['stripe_sepa'] = __('Stripe SEPA Direct Debit', 'woocommerce-gateway-stripe'); |
|
307 | + $sections['stripe_multibanco'] = __('Stripe Multibanco', 'woocommerce-gateway-stripe'); |
|
308 | 308 | |
309 | 309 | return $sections; |
310 | 310 | } |
@@ -319,12 +319,12 @@ discard block |
||
319 | 319 | * @param array|bool $old_settings Existing settings, if any. |
320 | 320 | * @return array New value but with defaults initially filled in for missing settings. |
321 | 321 | */ |
322 | - public function gateway_settings_update( $settings, $old_settings ) { |
|
323 | - if ( false === $old_settings ) { |
|
322 | + public function gateway_settings_update($settings, $old_settings) { |
|
323 | + if (false === $old_settings) { |
|
324 | 324 | $gateway = new WC_Gateway_Stripe(); |
325 | 325 | $fields = $gateway->get_form_fields(); |
326 | - $defaults = array_merge( array_fill_keys( array_keys( $fields ), '' ), wp_list_pluck( $fields, 'default' ) ); |
|
327 | - return array_merge( $defaults, $settings ); |
|
326 | + $defaults = array_merge(array_fill_keys(array_keys($fields), ''), wp_list_pluck($fields, 'default')); |
|
327 | + return array_merge($defaults, $settings); |
|
328 | 328 | } |
329 | 329 | return $settings; |
330 | 330 | } |
@@ -335,16 +335,16 @@ discard block |
||
335 | 335 | * @param WC_Email[] $email_classes All existing emails. |
336 | 336 | * @return WC_Email[] |
337 | 337 | */ |
338 | - public function add_emails( $email_classes ) { |
|
338 | + public function add_emails($email_classes) { |
|
339 | 339 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-authentication.php'; |
340 | 340 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-renewal-authentication.php'; |
341 | 341 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-preorder-authentication.php'; |
342 | 342 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-authentication-retry.php'; |
343 | 343 | |
344 | 344 | // Add all emails, generated by the gateway. |
345 | - $email_classes['WC_Stripe_Email_Failed_Renewal_Authentication'] = new WC_Stripe_Email_Failed_Renewal_Authentication( $email_classes ); |
|
346 | - $email_classes['WC_Stripe_Email_Failed_Preorder_Authentication'] = new WC_Stripe_Email_Failed_Preorder_Authentication( $email_classes ); |
|
347 | - $email_classes['WC_Stripe_Email_Failed_Authentication_Retry'] = new WC_Stripe_Email_Failed_Authentication_Retry( $email_classes ); |
|
345 | + $email_classes['WC_Stripe_Email_Failed_Renewal_Authentication'] = new WC_Stripe_Email_Failed_Renewal_Authentication($email_classes); |
|
346 | + $email_classes['WC_Stripe_Email_Failed_Preorder_Authentication'] = new WC_Stripe_Email_Failed_Preorder_Authentication($email_classes); |
|
347 | + $email_classes['WC_Stripe_Email_Failed_Authentication_Retry'] = new WC_Stripe_Email_Failed_Authentication_Retry($email_classes); |
|
348 | 348 | |
349 | 349 | return $email_classes; |
350 | 350 | } |
@@ -358,8 +358,8 @@ discard block |
||
358 | 358 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/connect/class-wc-stripe-connect-rest-oauth-init-controller.php'; |
359 | 359 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/connect/class-wc-stripe-connect-rest-oauth-connect-controller.php'; |
360 | 360 | |
361 | - $oauth_init = new WC_Stripe_Connect_REST_Oauth_Init_Controller( $this->connect, $this->api ); |
|
362 | - $oauth_connect = new WC_Stripe_Connect_REST_Oauth_Connect_Controller( $this->connect, $this->api ); |
|
361 | + $oauth_init = new WC_Stripe_Connect_REST_Oauth_Init_Controller($this->connect, $this->api); |
|
362 | + $oauth_connect = new WC_Stripe_Connect_REST_Oauth_Connect_Controller($this->connect, $this->api); |
|
363 | 363 | |
364 | 364 | $oauth_init->register_routes(); |
365 | 365 | $oauth_connect->register_routes(); |
@@ -373,18 +373,18 @@ discard block |
||
373 | 373 | return $plugin; |
374 | 374 | } |
375 | 375 | |
376 | -add_action( 'plugins_loaded', 'woocommerce_gateway_stripe_init' ); |
|
376 | +add_action('plugins_loaded', 'woocommerce_gateway_stripe_init'); |
|
377 | 377 | |
378 | 378 | function woocommerce_gateway_stripe_init() { |
379 | - load_plugin_textdomain( 'woocommerce-gateway-stripe', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' ); |
|
379 | + load_plugin_textdomain('woocommerce-gateway-stripe', false, plugin_basename(dirname(__FILE__)) . '/languages'); |
|
380 | 380 | |
381 | - if ( ! class_exists( 'WooCommerce' ) ) { |
|
382 | - add_action( 'admin_notices', 'woocommerce_stripe_missing_wc_notice' ); |
|
381 | + if ( ! class_exists('WooCommerce')) { |
|
382 | + add_action('admin_notices', 'woocommerce_stripe_missing_wc_notice'); |
|
383 | 383 | return; |
384 | 384 | } |
385 | 385 | |
386 | - if ( version_compare( WC_VERSION, WC_STRIPE_MIN_WC_VER, '<' ) ) { |
|
387 | - add_action( 'admin_notices', 'woocommerce_stripe_wc_not_supported' ); |
|
386 | + if (version_compare(WC_VERSION, WC_STRIPE_MIN_WC_VER, '<')) { |
|
387 | + add_action('admin_notices', 'woocommerce_stripe_wc_not_supported'); |
|
388 | 388 | return; |
389 | 389 | } |
390 | 390 |