@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * |
16 | 16 | */ |
17 | 17 | |
18 | -if ( ! defined( 'ABSPATH' ) ) { |
|
18 | +if ( ! defined('ABSPATH')) { |
|
19 | 19 | exit; |
20 | 20 | } |
21 | 21 | |
@@ -29,30 +29,30 @@ discard block |
||
29 | 29 | */ |
30 | 30 | function woocommerce_stripe_missing_wc_notice() { |
31 | 31 | /* translators: 1. URL link. */ |
32 | - 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>'; |
|
32 | + 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>'; |
|
33 | 33 | } |
34 | 34 | |
35 | -add_action( 'plugins_loaded', 'woocommerce_gateway_stripe_init' ); |
|
35 | +add_action('plugins_loaded', 'woocommerce_gateway_stripe_init'); |
|
36 | 36 | |
37 | 37 | function woocommerce_gateway_stripe_init() { |
38 | - load_plugin_textdomain( 'woocommerce-gateway-stripe', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' ); |
|
38 | + load_plugin_textdomain('woocommerce-gateway-stripe', false, plugin_basename(dirname(__FILE__)) . '/languages'); |
|
39 | 39 | |
40 | - if ( ! class_exists( 'WooCommerce' ) ) { |
|
41 | - add_action( 'admin_notices', 'woocommerce_stripe_missing_wc_notice' ); |
|
40 | + if ( ! class_exists('WooCommerce')) { |
|
41 | + add_action('admin_notices', 'woocommerce_stripe_missing_wc_notice'); |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | |
45 | - if ( ! class_exists( 'WC_Stripe' ) ) : |
|
45 | + if ( ! class_exists('WC_Stripe')) : |
|
46 | 46 | /** |
47 | 47 | * Required minimums and constants |
48 | 48 | */ |
49 | - define( 'WC_STRIPE_VERSION', '4.3.2' ); |
|
50 | - define( 'WC_STRIPE_MIN_PHP_VER', '5.6.0' ); |
|
51 | - define( 'WC_STRIPE_MIN_WC_VER', '2.6.0' ); |
|
52 | - define( 'WC_STRIPE_FUTURE_MIN_WC_VER', '3.0' ); |
|
53 | - define( 'WC_STRIPE_MAIN_FILE', __FILE__ ); |
|
54 | - define( 'WC_STRIPE_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) ); |
|
55 | - define( 'WC_STRIPE_PLUGIN_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) ); |
|
49 | + define('WC_STRIPE_VERSION', '4.3.2'); |
|
50 | + define('WC_STRIPE_MIN_PHP_VER', '5.6.0'); |
|
51 | + define('WC_STRIPE_MIN_WC_VER', '2.6.0'); |
|
52 | + define('WC_STRIPE_FUTURE_MIN_WC_VER', '3.0'); |
|
53 | + define('WC_STRIPE_MAIN_FILE', __FILE__); |
|
54 | + define('WC_STRIPE_PLUGIN_URL', untrailingslashit(plugins_url(basename(plugin_dir_path(__FILE__)), basename(__FILE__)))); |
|
55 | + define('WC_STRIPE_PLUGIN_PATH', untrailingslashit(plugin_dir_path(__FILE__))); |
|
56 | 56 | |
57 | 57 | class WC_Stripe { |
58 | 58 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @return Singleton The *Singleton* instance. |
68 | 68 | */ |
69 | 69 | public static function get_instance() { |
70 | - if ( null === self::$instance ) { |
|
70 | + if (null === self::$instance) { |
|
71 | 71 | self::$instance = new self(); |
72 | 72 | } |
73 | 73 | return self::$instance; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * *Singleton* via the `new` operator from outside of this class. |
95 | 95 | */ |
96 | 96 | private function __construct() { |
97 | - add_action( 'admin_init', array( $this, 'install' ) ); |
|
97 | + add_action('admin_init', array($this, 'install')); |
|
98 | 98 | $this->init(); |
99 | 99 | } |
100 | 100 | |
@@ -105,52 +105,52 @@ discard block |
||
105 | 105 | * @version 4.0.0 |
106 | 106 | */ |
107 | 107 | public function init() { |
108 | - if ( is_admin() ) { |
|
109 | - require_once dirname( __FILE__ ) . '/includes/admin/class-wc-stripe-privacy.php'; |
|
108 | + if (is_admin()) { |
|
109 | + require_once dirname(__FILE__) . '/includes/admin/class-wc-stripe-privacy.php'; |
|
110 | 110 | } |
111 | 111 | |
112 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-exception.php'; |
|
113 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-logger.php'; |
|
114 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-helper.php'; |
|
115 | - include_once dirname( __FILE__ ) . '/includes/class-wc-stripe-api.php'; |
|
116 | - require_once dirname( __FILE__ ) . '/includes/abstracts/abstract-wc-stripe-payment-gateway.php'; |
|
117 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-webhook-handler.php'; |
|
118 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-sepa-payment-token.php'; |
|
119 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-apple-pay-registration.php'; |
|
120 | - require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-pre-orders-compat.php'; |
|
121 | - require_once dirname( __FILE__ ) . '/includes/class-wc-gateway-stripe.php'; |
|
122 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-bancontact.php'; |
|
123 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-sofort.php'; |
|
124 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-giropay.php'; |
|
125 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-eps.php'; |
|
126 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-ideal.php'; |
|
127 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-p24.php'; |
|
128 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-alipay.php'; |
|
129 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-sepa.php'; |
|
130 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-multibanco.php'; |
|
131 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-payment-request.php'; |
|
132 | - require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-subs-compat.php'; |
|
133 | - require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-sepa-subs-compat.php'; |
|
134 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-order-handler.php'; |
|
135 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-payment-tokens.php'; |
|
136 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-customer.php'; |
|
137 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-intent-controller.php'; |
|
138 | - |
|
139 | - if ( is_admin() ) { |
|
140 | - require_once dirname( __FILE__ ) . '/includes/admin/class-wc-stripe-admin-notices.php'; |
|
112 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-exception.php'; |
|
113 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-logger.php'; |
|
114 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-helper.php'; |
|
115 | + include_once dirname(__FILE__) . '/includes/class-wc-stripe-api.php'; |
|
116 | + require_once dirname(__FILE__) . '/includes/abstracts/abstract-wc-stripe-payment-gateway.php'; |
|
117 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-webhook-handler.php'; |
|
118 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-sepa-payment-token.php'; |
|
119 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-apple-pay-registration.php'; |
|
120 | + require_once dirname(__FILE__) . '/includes/compat/class-wc-stripe-pre-orders-compat.php'; |
|
121 | + require_once dirname(__FILE__) . '/includes/class-wc-gateway-stripe.php'; |
|
122 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-bancontact.php'; |
|
123 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-sofort.php'; |
|
124 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-giropay.php'; |
|
125 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-eps.php'; |
|
126 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-ideal.php'; |
|
127 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-p24.php'; |
|
128 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-alipay.php'; |
|
129 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-sepa.php'; |
|
130 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-multibanco.php'; |
|
131 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-stripe-payment-request.php'; |
|
132 | + require_once dirname(__FILE__) . '/includes/compat/class-wc-stripe-subs-compat.php'; |
|
133 | + require_once dirname(__FILE__) . '/includes/compat/class-wc-stripe-sepa-subs-compat.php'; |
|
134 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-order-handler.php'; |
|
135 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-payment-tokens.php'; |
|
136 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-customer.php'; |
|
137 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-intent-controller.php'; |
|
138 | + |
|
139 | + if (is_admin()) { |
|
140 | + require_once dirname(__FILE__) . '/includes/admin/class-wc-stripe-admin-notices.php'; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | // REMOVE IN THE FUTURE. |
144 | - require_once dirname( __FILE__ ) . '/includes/deprecated/class-wc-stripe-apple-pay.php'; |
|
144 | + require_once dirname(__FILE__) . '/includes/deprecated/class-wc-stripe-apple-pay.php'; |
|
145 | 145 | |
146 | - add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateways' ) ); |
|
147 | - add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugin_action_links' ) ); |
|
146 | + add_filter('woocommerce_payment_gateways', array($this, 'add_gateways')); |
|
147 | + add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($this, 'plugin_action_links')); |
|
148 | 148 | |
149 | 149 | // Modify emails emails. |
150 | - add_filter( 'woocommerce_email_classes', array( $this, 'add_emails' ), 20 ); |
|
150 | + add_filter('woocommerce_email_classes', array($this, 'add_emails'), 20); |
|
151 | 151 | |
152 | - if ( version_compare( WC_VERSION, '3.4', '<' ) ) { |
|
153 | - add_filter( 'woocommerce_get_sections_checkout', array( $this, 'filter_gateway_order_admin' ) ); |
|
152 | + if (version_compare(WC_VERSION, '3.4', '<')) { |
|
153 | + add_filter('woocommerce_get_sections_checkout', array($this, 'filter_gateway_order_admin')); |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | * @version 4.0.0 |
162 | 162 | */ |
163 | 163 | public function update_plugin_version() { |
164 | - delete_option( 'wc_stripe_version' ); |
|
165 | - update_option( 'wc_stripe_version', WC_STRIPE_VERSION ); |
|
164 | + delete_option('wc_stripe_version'); |
|
165 | + update_option('wc_stripe_version', WC_STRIPE_VERSION); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
@@ -172,15 +172,15 @@ discard block |
||
172 | 172 | * @version 3.1.0 |
173 | 173 | */ |
174 | 174 | public function install() { |
175 | - if ( ! is_plugin_active( plugin_basename( __FILE__ ) ) ) { |
|
175 | + if ( ! is_plugin_active(plugin_basename(__FILE__))) { |
|
176 | 176 | return; |
177 | 177 | } |
178 | 178 | |
179 | - if ( ! defined( 'IFRAME_REQUEST' ) && ( WC_STRIPE_VERSION !== get_option( 'wc_stripe_version' ) ) ) { |
|
180 | - do_action( 'woocommerce_stripe_updated' ); |
|
179 | + if ( ! defined('IFRAME_REQUEST') && (WC_STRIPE_VERSION !== get_option('wc_stripe_version'))) { |
|
180 | + do_action('woocommerce_stripe_updated'); |
|
181 | 181 | |
182 | - if ( ! defined( 'WC_STRIPE_INSTALLING' ) ) { |
|
183 | - define( 'WC_STRIPE_INSTALLING', true ); |
|
182 | + if ( ! defined('WC_STRIPE_INSTALLING')) { |
|
183 | + define('WC_STRIPE_INSTALLING', true); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | $this->update_plugin_version(); |
@@ -193,13 +193,13 @@ discard block |
||
193 | 193 | * @since 1.0.0 |
194 | 194 | * @version 4.0.0 |
195 | 195 | */ |
196 | - public function plugin_action_links( $links ) { |
|
196 | + public function plugin_action_links($links) { |
|
197 | 197 | $plugin_links = array( |
198 | - '<a href="admin.php?page=wc-settings&tab=checkout§ion=stripe">' . esc_html__( 'Settings', 'woocommerce-gateway-stripe' ) . '</a>', |
|
199 | - '<a href="https://docs.woocommerce.com/document/stripe/">' . esc_html__( 'Docs', 'woocommerce-gateway-stripe' ) . '</a>', |
|
200 | - '<a href="https://woocommerce.com/my-account/create-a-ticket?broken=primary&select=18627">' . esc_html__( 'Support', 'woocommerce-gateway-stripe' ) . '</a>', |
|
198 | + '<a href="admin.php?page=wc-settings&tab=checkout§ion=stripe">' . esc_html__('Settings', 'woocommerce-gateway-stripe') . '</a>', |
|
199 | + '<a href="https://docs.woocommerce.com/document/stripe/">' . esc_html__('Docs', 'woocommerce-gateway-stripe') . '</a>', |
|
200 | + '<a href="https://woocommerce.com/my-account/create-a-ticket?broken=primary&select=18627">' . esc_html__('Support', 'woocommerce-gateway-stripe') . '</a>', |
|
201 | 201 | ); |
202 | - return array_merge( $plugin_links, $links ); |
|
202 | + return array_merge($plugin_links, $links); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | /** |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | * @since 1.0.0 |
209 | 209 | * @version 4.0.0 |
210 | 210 | */ |
211 | - public function add_gateways( $methods ) { |
|
212 | - if ( class_exists( 'WC_Subscriptions_Order' ) && function_exists( 'wcs_create_renewal_order' ) ) { |
|
211 | + public function add_gateways($methods) { |
|
212 | + if (class_exists('WC_Subscriptions_Order') && function_exists('wcs_create_renewal_order')) { |
|
213 | 213 | $methods[] = 'WC_Stripe_Subs_Compat'; |
214 | 214 | $methods[] = 'WC_Stripe_Sepa_Subs_Compat'; |
215 | 215 | } else { |
@@ -235,28 +235,28 @@ discard block |
||
235 | 235 | * @since 4.0.0 |
236 | 236 | * @version 4.0.0 |
237 | 237 | */ |
238 | - public function filter_gateway_order_admin( $sections ) { |
|
239 | - unset( $sections['stripe'] ); |
|
240 | - unset( $sections['stripe_bancontact'] ); |
|
241 | - unset( $sections['stripe_sofort'] ); |
|
242 | - unset( $sections['stripe_giropay'] ); |
|
243 | - unset( $sections['stripe_eps'] ); |
|
244 | - unset( $sections['stripe_ideal'] ); |
|
245 | - unset( $sections['stripe_p24'] ); |
|
246 | - unset( $sections['stripe_alipay'] ); |
|
247 | - unset( $sections['stripe_sepa'] ); |
|
248 | - unset( $sections['stripe_multibanco'] ); |
|
238 | + public function filter_gateway_order_admin($sections) { |
|
239 | + unset($sections['stripe']); |
|
240 | + unset($sections['stripe_bancontact']); |
|
241 | + unset($sections['stripe_sofort']); |
|
242 | + unset($sections['stripe_giropay']); |
|
243 | + unset($sections['stripe_eps']); |
|
244 | + unset($sections['stripe_ideal']); |
|
245 | + unset($sections['stripe_p24']); |
|
246 | + unset($sections['stripe_alipay']); |
|
247 | + unset($sections['stripe_sepa']); |
|
248 | + unset($sections['stripe_multibanco']); |
|
249 | 249 | |
250 | 250 | $sections['stripe'] = 'Stripe'; |
251 | - $sections['stripe_bancontact'] = __( 'Stripe Bancontact', 'woocommerce-gateway-stripe' ); |
|
252 | - $sections['stripe_sofort'] = __( 'Stripe SOFORT', 'woocommerce-gateway-stripe' ); |
|
253 | - $sections['stripe_giropay'] = __( 'Stripe Giropay', 'woocommerce-gateway-stripe' ); |
|
254 | - $sections['stripe_eps'] = __( 'Stripe EPS', 'woocommerce-gateway-stripe' ); |
|
255 | - $sections['stripe_ideal'] = __( 'Stripe iDeal', 'woocommerce-gateway-stripe' ); |
|
256 | - $sections['stripe_p24'] = __( 'Stripe P24', 'woocommerce-gateway-stripe' ); |
|
257 | - $sections['stripe_alipay'] = __( 'Stripe Alipay', 'woocommerce-gateway-stripe' ); |
|
258 | - $sections['stripe_sepa'] = __( 'Stripe SEPA Direct Debit', 'woocommerce-gateway-stripe' ); |
|
259 | - $sections['stripe_multibanco'] = __( 'Stripe Multibanco', 'woocommerce-gateway-stripe' ); |
|
251 | + $sections['stripe_bancontact'] = __('Stripe Bancontact', 'woocommerce-gateway-stripe'); |
|
252 | + $sections['stripe_sofort'] = __('Stripe SOFORT', 'woocommerce-gateway-stripe'); |
|
253 | + $sections['stripe_giropay'] = __('Stripe Giropay', 'woocommerce-gateway-stripe'); |
|
254 | + $sections['stripe_eps'] = __('Stripe EPS', 'woocommerce-gateway-stripe'); |
|
255 | + $sections['stripe_ideal'] = __('Stripe iDeal', 'woocommerce-gateway-stripe'); |
|
256 | + $sections['stripe_p24'] = __('Stripe P24', 'woocommerce-gateway-stripe'); |
|
257 | + $sections['stripe_alipay'] = __('Stripe Alipay', 'woocommerce-gateway-stripe'); |
|
258 | + $sections['stripe_sepa'] = __('Stripe SEPA Direct Debit', 'woocommerce-gateway-stripe'); |
|
259 | + $sections['stripe_multibanco'] = __('Stripe Multibanco', 'woocommerce-gateway-stripe'); |
|
260 | 260 | |
261 | 261 | return $sections; |
262 | 262 | } |
@@ -267,16 +267,16 @@ discard block |
||
267 | 267 | * @param WC_Email[] $email_classes All existing emails. |
268 | 268 | * @return WC_Email[] |
269 | 269 | */ |
270 | - public function add_emails( $email_classes ) { |
|
270 | + public function add_emails($email_classes) { |
|
271 | 271 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-authentication.php'; |
272 | 272 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-renewal-authentication.php'; |
273 | 273 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-preorder-authentication.php'; |
274 | 274 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-authentication-retry.php'; |
275 | 275 | |
276 | 276 | // Add all emails, generated by the gateway. |
277 | - $email_classes['WC_Stripe_Email_Failed_Renewal_Authentication'] = new WC_Stripe_Email_Failed_Renewal_Authentication( $email_classes ); |
|
278 | - $email_classes['WC_Stripe_Email_Failed_Preorder_Authentication'] = new WC_Stripe_Email_Failed_Preorder_Authentication( $email_classes ); |
|
279 | - $email_classes['WC_Stripe_Email_Failed_Authentication_Retry'] = new WC_Stripe_Email_Failed_Authentication_Retry( $email_classes ); |
|
277 | + $email_classes['WC_Stripe_Email_Failed_Renewal_Authentication'] = new WC_Stripe_Email_Failed_Renewal_Authentication($email_classes); |
|
278 | + $email_classes['WC_Stripe_Email_Failed_Preorder_Authentication'] = new WC_Stripe_Email_Failed_Preorder_Authentication($email_classes); |
|
279 | + $email_classes['WC_Stripe_Email_Failed_Authentication_Retry'] = new WC_Stripe_Email_Failed_Authentication_Retry($email_classes); |
|
280 | 280 | |
281 | 281 | return $email_classes; |
282 | 282 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | * @since 4.1.0 |
22 | 22 | */ |
23 | 23 | public function __construct() { |
24 | - add_action( 'admin_notices', array( $this, 'admin_notices' ) ); |
|
25 | - add_action( 'wp_loaded', array( $this, 'hide_notices' ) ); |
|
26 | - add_action( 'woocommerce_stripe_updated', array( $this, 'stripe_updated' ) ); |
|
24 | + add_action('admin_notices', array($this, 'admin_notices')); |
|
25 | + add_action('wp_loaded', array($this, 'hide_notices')); |
|
26 | + add_action('woocommerce_stripe_updated', array($this, 'stripe_updated')); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | * @since 1.0.0 |
33 | 33 | * @version 4.0.0 |
34 | 34 | */ |
35 | - public function add_admin_notice( $slug, $class, $message, $dismissible = false ) { |
|
36 | - $this->notices[ $slug ] = array( |
|
35 | + public function add_admin_notice($slug, $class, $message, $dismissible = false) { |
|
36 | + $this->notices[$slug] = array( |
|
37 | 37 | 'class' => $class, |
38 | 38 | 'message' => $message, |
39 | 39 | 'dismissible' => $dismissible, |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @version 4.0.0 |
48 | 48 | */ |
49 | 49 | public function admin_notices() { |
50 | - if ( ! current_user_can( 'manage_woocommerce' ) ) { |
|
50 | + if ( ! current_user_can('manage_woocommerce')) { |
|
51 | 51 | return; |
52 | 52 | } |
53 | 53 | |
@@ -57,17 +57,17 @@ discard block |
||
57 | 57 | // All other payment methods. |
58 | 58 | $this->payment_methods_check_environment(); |
59 | 59 | |
60 | - foreach ( (array) $this->notices as $notice_key => $notice ) { |
|
61 | - echo '<div class="' . esc_attr( $notice['class'] ) . '" style="position:relative;">'; |
|
60 | + foreach ((array) $this->notices as $notice_key => $notice) { |
|
61 | + echo '<div class="' . esc_attr($notice['class']) . '" style="position:relative;">'; |
|
62 | 62 | |
63 | - if ( $notice['dismissible'] ) { |
|
63 | + if ($notice['dismissible']) { |
|
64 | 64 | ?> |
65 | - <a href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wc-stripe-hide-notice', $notice_key ), 'wc_stripe_hide_notices_nonce', '_wc_stripe_notice_nonce' ) ); ?>" class="woocommerce-message-close notice-dismiss" style="position:relative;float:right;padding:9px 0px 9px 9px 9px;text-decoration:none;"></a> |
|
65 | + <a href="<?php echo esc_url(wp_nonce_url(add_query_arg('wc-stripe-hide-notice', $notice_key), 'wc_stripe_hide_notices_nonce', '_wc_stripe_notice_nonce')); ?>" class="woocommerce-message-close notice-dismiss" style="position:relative;float:right;padding:9px 0px 9px 9px 9px;text-decoration:none;"></a> |
|
66 | 66 | <?php |
67 | 67 | } |
68 | 68 | |
69 | 69 | echo '<p>'; |
70 | - echo wp_kses( $notice['message'], array( 'a' => array( 'href' => array(), 'target' => array() ) ) ); |
|
70 | + echo wp_kses($notice['message'], array('a' => array('href' => array(), 'target' => array()))); |
|
71 | 71 | echo '</p></div>'; |
72 | 72 | } |
73 | 73 | } |
@@ -100,122 +100,122 @@ discard block |
||
100 | 100 | * @version 4.0.0 |
101 | 101 | */ |
102 | 102 | public function stripe_check_environment() { |
103 | - $show_style_notice = get_option( 'wc_stripe_show_style_notice' ); |
|
104 | - $show_ssl_notice = get_option( 'wc_stripe_show_ssl_notice' ); |
|
105 | - $show_keys_notice = get_option( 'wc_stripe_show_keys_notice' ); |
|
106 | - $show_3ds_notice = get_option( 'wc_stripe_show_3ds_notice' ); |
|
107 | - $show_phpver_notice = get_option( 'wc_stripe_show_phpver_notice' ); |
|
108 | - $show_wcver_notice = get_option( 'wc_stripe_show_wcver_notice' ); |
|
109 | - $show_curl_notice = get_option( 'wc_stripe_show_curl_notice' ); |
|
110 | - $show_sca_notice = get_option( 'wc_stripe_show_sca_notice' ); |
|
111 | - $changed_keys_notice = get_option( 'wc_stripe_show_changed_keys_notice' ); |
|
112 | - $options = get_option( 'woocommerce_stripe_settings' ); |
|
113 | - $testmode = ( isset( $options['testmode'] ) && 'yes' === $options['testmode'] ) ? true : false; |
|
114 | - $test_pub_key = isset( $options['test_publishable_key'] ) ? $options['test_publishable_key'] : ''; |
|
115 | - $test_secret_key = isset( $options['test_secret_key'] ) ? $options['test_secret_key'] : ''; |
|
116 | - $live_pub_key = isset( $options['publishable_key'] ) ? $options['publishable_key'] : ''; |
|
117 | - $live_secret_key = isset( $options['secret_key'] ) ? $options['secret_key'] : ''; |
|
118 | - $three_d_secure = isset( $options['three_d_secure'] ) && 'yes' === $options['three_d_secure']; |
|
119 | - |
|
120 | - if ( WC_Stripe_Helper::is_wc_lt( WC_STRIPE_FUTURE_MIN_WC_VER ) ) { |
|
103 | + $show_style_notice = get_option('wc_stripe_show_style_notice'); |
|
104 | + $show_ssl_notice = get_option('wc_stripe_show_ssl_notice'); |
|
105 | + $show_keys_notice = get_option('wc_stripe_show_keys_notice'); |
|
106 | + $show_3ds_notice = get_option('wc_stripe_show_3ds_notice'); |
|
107 | + $show_phpver_notice = get_option('wc_stripe_show_phpver_notice'); |
|
108 | + $show_wcver_notice = get_option('wc_stripe_show_wcver_notice'); |
|
109 | + $show_curl_notice = get_option('wc_stripe_show_curl_notice'); |
|
110 | + $show_sca_notice = get_option('wc_stripe_show_sca_notice'); |
|
111 | + $changed_keys_notice = get_option('wc_stripe_show_changed_keys_notice'); |
|
112 | + $options = get_option('woocommerce_stripe_settings'); |
|
113 | + $testmode = (isset($options['testmode']) && 'yes' === $options['testmode']) ? true : false; |
|
114 | + $test_pub_key = isset($options['test_publishable_key']) ? $options['test_publishable_key'] : ''; |
|
115 | + $test_secret_key = isset($options['test_secret_key']) ? $options['test_secret_key'] : ''; |
|
116 | + $live_pub_key = isset($options['publishable_key']) ? $options['publishable_key'] : ''; |
|
117 | + $live_secret_key = isset($options['secret_key']) ? $options['secret_key'] : ''; |
|
118 | + $three_d_secure = isset($options['three_d_secure']) && 'yes' === $options['three_d_secure']; |
|
119 | + |
|
120 | + if (WC_Stripe_Helper::is_wc_lt(WC_STRIPE_FUTURE_MIN_WC_VER)) { |
|
121 | 121 | /* translators: 1) int version 2) int version */ |
122 | - $message = __( 'WooCommerce Stripe - This is the last version of the plugin compatible with WooCommerce %1$s. All further versions of the plugin will require WooCommerce %2$s or greater.', 'woocommerce-gateway-stripe' ); |
|
123 | - $this->add_admin_notice( 'wcver', 'notice notice-warning', sprintf( $message, WC_VERSION, WC_STRIPE_FUTURE_MIN_WC_VER ), true ); |
|
122 | + $message = __('WooCommerce Stripe - This is the last version of the plugin compatible with WooCommerce %1$s. All further versions of the plugin will require WooCommerce %2$s or greater.', 'woocommerce-gateway-stripe'); |
|
123 | + $this->add_admin_notice('wcver', 'notice notice-warning', sprintf($message, WC_VERSION, WC_STRIPE_FUTURE_MIN_WC_VER), true); |
|
124 | 124 | } |
125 | 125 | |
126 | - if ( isset( $options['enabled'] ) && 'yes' === $options['enabled'] ) { |
|
127 | - if ( empty( $show_3ds_notice ) && $three_d_secure ) { |
|
126 | + if (isset($options['enabled']) && 'yes' === $options['enabled']) { |
|
127 | + if (empty($show_3ds_notice) && $three_d_secure) { |
|
128 | 128 | $url = 'https://stripe.com/docs/payments/3d-secure#three-ds-radar'; |
129 | 129 | |
130 | 130 | /* translators: 1) A URL that explains Stripe Radar. */ |
131 | - $message = __( 'WooCommerce Stripe - We see that you had the "Require 3D secure when applicable" setting turned on. This setting is not available here anymore, because it is now replaced by Stripe Radar. You can learn more about it <a href="%s" target="_blank">here</a>.', 'woocommerce-gateway-stripe' ); |
|
131 | + $message = __('WooCommerce Stripe - We see that you had the "Require 3D secure when applicable" setting turned on. This setting is not available here anymore, because it is now replaced by Stripe Radar. You can learn more about it <a href="%s" target="_blank">here</a>.', 'woocommerce-gateway-stripe'); |
|
132 | 132 | |
133 | - $this->add_admin_notice( '3ds', 'notice notice-warning', sprintf( $message, $url ), true ); |
|
133 | + $this->add_admin_notice('3ds', 'notice notice-warning', sprintf($message, $url), true); |
|
134 | 134 | } |
135 | 135 | |
136 | - if ( empty( $show_style_notice ) ) { |
|
136 | + if (empty($show_style_notice)) { |
|
137 | 137 | /* translators: 1) int version 2) int version */ |
138 | - $message = __( 'WooCommerce Stripe - We recently made changes to Stripe that may impact the appearance of your checkout. If your checkout has changed unexpectedly, please follow these <a href="https://docs.woocommerce.com/document/stripe/#styling" target="_blank">instructions</a> to fix.', 'woocommerce-gateway-stripe' ); |
|
138 | + $message = __('WooCommerce Stripe - We recently made changes to Stripe that may impact the appearance of your checkout. If your checkout has changed unexpectedly, please follow these <a href="https://docs.woocommerce.com/document/stripe/#styling" target="_blank">instructions</a> to fix.', 'woocommerce-gateway-stripe'); |
|
139 | 139 | |
140 | - $this->add_admin_notice( 'style', 'notice notice-warning', $message, true ); |
|
140 | + $this->add_admin_notice('style', 'notice notice-warning', $message, true); |
|
141 | 141 | |
142 | 142 | return; |
143 | 143 | } |
144 | 144 | |
145 | - if ( empty( $show_phpver_notice ) ) { |
|
146 | - if ( version_compare( phpversion(), WC_STRIPE_MIN_PHP_VER, '<' ) ) { |
|
145 | + if (empty($show_phpver_notice)) { |
|
146 | + if (version_compare(phpversion(), WC_STRIPE_MIN_PHP_VER, '<')) { |
|
147 | 147 | /* translators: 1) int version 2) int version */ |
148 | - $message = __( 'WooCommerce Stripe - The minimum PHP version required for this plugin is %1$s. You are running %2$s.', 'woocommerce-gateway-stripe' ); |
|
148 | + $message = __('WooCommerce Stripe - The minimum PHP version required for this plugin is %1$s. You are running %2$s.', 'woocommerce-gateway-stripe'); |
|
149 | 149 | |
150 | - $this->add_admin_notice( 'phpver', 'error', sprintf( $message, WC_STRIPE_MIN_PHP_VER, phpversion() ), true ); |
|
150 | + $this->add_admin_notice('phpver', 'error', sprintf($message, WC_STRIPE_MIN_PHP_VER, phpversion()), true); |
|
151 | 151 | |
152 | 152 | return; |
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
156 | - if ( empty( $show_wcver_notice ) ) { |
|
157 | - if ( version_compare( WC_VERSION, WC_STRIPE_MIN_WC_VER, '<' ) ) { |
|
156 | + if (empty($show_wcver_notice)) { |
|
157 | + if (version_compare(WC_VERSION, WC_STRIPE_MIN_WC_VER, '<')) { |
|
158 | 158 | /* translators: 1) int version 2) int version */ |
159 | - $message = __( 'WooCommerce Stripe - The minimum WooCommerce version required for this plugin is %1$s. You are running %2$s.', 'woocommerce-gateway-stripe' ); |
|
159 | + $message = __('WooCommerce Stripe - The minimum WooCommerce version required for this plugin is %1$s. You are running %2$s.', 'woocommerce-gateway-stripe'); |
|
160 | 160 | |
161 | - $this->add_admin_notice( 'wcver', 'notice notice-warning', sprintf( $message, WC_STRIPE_MIN_WC_VER, WC_VERSION ), true ); |
|
161 | + $this->add_admin_notice('wcver', 'notice notice-warning', sprintf($message, WC_STRIPE_MIN_WC_VER, WC_VERSION), true); |
|
162 | 162 | |
163 | 163 | return; |
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
167 | - if ( empty( $show_curl_notice ) ) { |
|
168 | - if ( ! function_exists( 'curl_init' ) ) { |
|
169 | - $this->add_admin_notice( 'curl', 'notice notice-warning', __( 'WooCommerce Stripe - cURL is not installed.', 'woocommerce-gateway-stripe' ), true ); |
|
167 | + if (empty($show_curl_notice)) { |
|
168 | + if ( ! function_exists('curl_init')) { |
|
169 | + $this->add_admin_notice('curl', 'notice notice-warning', __('WooCommerce Stripe - cURL is not installed.', 'woocommerce-gateway-stripe'), true); |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | |
173 | - if ( empty( $show_keys_notice ) ) { |
|
173 | + if (empty($show_keys_notice)) { |
|
174 | 174 | $secret = WC_Stripe_API::get_secret_key(); |
175 | 175 | |
176 | - if ( empty( $secret ) && ! ( isset( $_GET['page'], $_GET['section'] ) && 'wc-settings' === $_GET['page'] && 'stripe' === $_GET['section'] ) ) { |
|
176 | + if (empty($secret) && ! (isset($_GET['page'], $_GET['section']) && 'wc-settings' === $_GET['page'] && 'stripe' === $_GET['section'])) { |
|
177 | 177 | $setting_link = $this->get_setting_link(); |
178 | 178 | /* translators: 1) link */ |
179 | - $this->add_admin_notice( 'keys', 'notice notice-warning', sprintf( __( 'Stripe is almost ready. To get started, <a href="%s">set your Stripe account keys</a>.', 'woocommerce-gateway-stripe' ), $setting_link ), true ); |
|
179 | + $this->add_admin_notice('keys', 'notice notice-warning', sprintf(__('Stripe is almost ready. To get started, <a href="%s">set your Stripe account keys</a>.', 'woocommerce-gateway-stripe'), $setting_link), true); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | // Check if keys are entered properly per live/test mode. |
183 | - if ( $testmode ) { |
|
183 | + if ($testmode) { |
|
184 | 184 | if ( |
185 | - ! empty( $test_pub_key ) && ! preg_match( '/^pk_test_/', $test_pub_key ) |
|
186 | - || ( ! empty( $test_secret_key ) && ! preg_match( '/^sk_test_/', $test_secret_key ) |
|
187 | - && ! empty( $test_secret_key ) && ! preg_match( '/^rk_test_/', $test_secret_key ) ) ) { |
|
185 | + ! empty($test_pub_key) && ! preg_match('/^pk_test_/', $test_pub_key) |
|
186 | + || ( ! empty($test_secret_key) && ! preg_match('/^sk_test_/', $test_secret_key) |
|
187 | + && ! empty($test_secret_key) && ! preg_match('/^rk_test_/', $test_secret_key)) ) { |
|
188 | 188 | $setting_link = $this->get_setting_link(); |
189 | 189 | /* translators: 1) link */ |
190 | - $this->add_admin_notice( 'keys', 'notice notice-error', sprintf( __( 'Stripe is in test mode however your test keys may not be valid. Test keys start with pk_test and sk_test or rk_test. Please go to your settings and, <a href="%s">set your Stripe account keys</a>.', 'woocommerce-gateway-stripe' ), $setting_link ), true ); |
|
190 | + $this->add_admin_notice('keys', 'notice notice-error', sprintf(__('Stripe is in test mode however your test keys may not be valid. Test keys start with pk_test and sk_test or rk_test. Please go to your settings and, <a href="%s">set your Stripe account keys</a>.', 'woocommerce-gateway-stripe'), $setting_link), true); |
|
191 | 191 | } |
192 | 192 | } else { |
193 | 193 | if ( |
194 | - ! empty( $live_pub_key ) && ! preg_match( '/^pk_live_/', $live_pub_key ) |
|
195 | - || ( ! empty( $live_secret_key ) && ! preg_match( '/^sk_live_/', $live_secret_key ) |
|
196 | - && ! empty( $live_secret_key ) && ! preg_match( '/^rk_live_/', $live_secret_key ) ) ) { |
|
194 | + ! empty($live_pub_key) && ! preg_match('/^pk_live_/', $live_pub_key) |
|
195 | + || ( ! empty($live_secret_key) && ! preg_match('/^sk_live_/', $live_secret_key) |
|
196 | + && ! empty($live_secret_key) && ! preg_match('/^rk_live_/', $live_secret_key)) ) { |
|
197 | 197 | $setting_link = $this->get_setting_link(); |
198 | 198 | /* translators: 1) link */ |
199 | - $this->add_admin_notice( 'keys', 'notice notice-error', sprintf( __( 'Stripe is in live mode however your test keys may not be valid. Live keys start with pk_live and sk_live or rk_live. Please go to your settings and, <a href="%s">set your Stripe account keys</a>.', 'woocommerce-gateway-stripe' ), $setting_link ), true ); |
|
199 | + $this->add_admin_notice('keys', 'notice notice-error', sprintf(__('Stripe is in live mode however your test keys may not be valid. Live keys start with pk_live and sk_live or rk_live. Please go to your settings and, <a href="%s">set your Stripe account keys</a>.', 'woocommerce-gateway-stripe'), $setting_link), true); |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | } |
203 | 203 | |
204 | - if ( empty( $show_ssl_notice ) ) { |
|
204 | + if (empty($show_ssl_notice)) { |
|
205 | 205 | // Show message if enabled and FORCE SSL is disabled and WordpressHTTPS plugin is not detected. |
206 | - if ( ! wc_checkout_is_https() ) { |
|
206 | + if ( ! wc_checkout_is_https()) { |
|
207 | 207 | /* translators: 1) link */ |
208 | - $this->add_admin_notice( 'ssl', 'notice notice-warning', sprintf( __( 'Stripe is enabled, but a SSL certificate is not detected. Your checkout may not be secure! Please ensure your server has a valid <a href="%1$s" target="_blank">SSL certificate</a>', 'woocommerce-gateway-stripe' ), 'https://en.wikipedia.org/wiki/Transport_Layer_Security' ), true ); |
|
208 | + $this->add_admin_notice('ssl', 'notice notice-warning', sprintf(__('Stripe is enabled, but a SSL certificate is not detected. Your checkout may not be secure! Please ensure your server has a valid <a href="%1$s" target="_blank">SSL certificate</a>', 'woocommerce-gateway-stripe'), 'https://en.wikipedia.org/wiki/Transport_Layer_Security'), true); |
|
209 | 209 | } |
210 | 210 | } |
211 | 211 | |
212 | - if ( empty( $show_sca_notice ) ) { |
|
213 | - $this->add_admin_notice( 'sca', 'notice notice-success', sprintf( __( 'Stripe is now ready for Strong Customer Authentication (SCA) and 3D Secure 2! <a href="%1$s" target="_blank">Read about SCA</a>', 'woocommerce-gateway-stripe' ), 'https://woocommerce.com/posts/introducing-strong-customer-authentication-sca/' ), true ); |
|
212 | + if (empty($show_sca_notice)) { |
|
213 | + $this->add_admin_notice('sca', 'notice notice-success', sprintf(__('Stripe is now ready for Strong Customer Authentication (SCA) and 3D Secure 2! <a href="%1$s" target="_blank">Read about SCA</a>', 'woocommerce-gateway-stripe'), 'https://woocommerce.com/posts/introducing-strong-customer-authentication-sca/'), true); |
|
214 | 214 | } |
215 | 215 | |
216 | - if ( 'yes' === $changed_keys_notice ) { |
|
216 | + if ('yes' === $changed_keys_notice) { |
|
217 | 217 | // translators: %s is a the URL for the link. |
218 | - $this->add_admin_notice( 'changed_keys', 'notice notice-warning', sprintf( __( 'The public and/or secret keys for the Stripe gateway have been changed. This might cause errors for existing customers and saved payment methods. <a href="%s" target="_blank">Click here to learn more</a>.', 'woocommerce-gateway-stripe' ), 'https://docs.woocommerce.com/document/stripe-fixing-customer-errors/' ), true ); |
|
218 | + $this->add_admin_notice('changed_keys', 'notice notice-warning', sprintf(__('The public and/or secret keys for the Stripe gateway have been changed. This might cause errors for existing customers and saved payment methods. <a href="%s" target="_blank">Click here to learn more</a>.', 'woocommerce-gateway-stripe'), 'https://docs.woocommerce.com/document/stripe-fixing-customer-errors/'), true); |
|
219 | 219 | } |
220 | 220 | } |
221 | 221 | } |
@@ -228,17 +228,17 @@ discard block |
||
228 | 228 | public function payment_methods_check_environment() { |
229 | 229 | $payment_methods = $this->get_payment_methods(); |
230 | 230 | |
231 | - foreach ( $payment_methods as $method => $class ) { |
|
232 | - $show_notice = get_option( 'wc_stripe_show_' . strtolower( $method ) . '_notice' ); |
|
231 | + foreach ($payment_methods as $method => $class) { |
|
232 | + $show_notice = get_option('wc_stripe_show_' . strtolower($method) . '_notice'); |
|
233 | 233 | $gateway = new $class(); |
234 | 234 | |
235 | - if ( 'yes' !== $gateway->enabled || 'no' === $show_notice ) { |
|
235 | + if ('yes' !== $gateway->enabled || 'no' === $show_notice) { |
|
236 | 236 | continue; |
237 | 237 | } |
238 | 238 | |
239 | - if ( ! in_array( get_woocommerce_currency(), $gateway->get_supported_currency() ) ) { |
|
239 | + if ( ! in_array(get_woocommerce_currency(), $gateway->get_supported_currency())) { |
|
240 | 240 | /* translators: %1$s Payment method, %2$s List of supported currencies */ |
241 | - $this->add_admin_notice( $method, 'notice notice-error', sprintf( __( '%1$s is enabled - it requires store currency to be set to %2$s', 'woocommerce-gateway-stripe' ), $method, implode( ', ', $gateway->get_supported_currency() ) ), true ); |
|
241 | + $this->add_admin_notice($method, 'notice notice-error', sprintf(__('%1$s is enabled - it requires store currency to be set to %2$s', 'woocommerce-gateway-stripe'), $method, implode(', ', $gateway->get_supported_currency())), true); |
|
242 | 242 | } |
243 | 243 | } |
244 | 244 | } |
@@ -250,71 +250,71 @@ discard block |
||
250 | 250 | * @version 4.0.0 |
251 | 251 | */ |
252 | 252 | public function hide_notices() { |
253 | - if ( isset( $_GET['wc-stripe-hide-notice'] ) && isset( $_GET['_wc_stripe_notice_nonce'] ) ) { |
|
254 | - if ( ! wp_verify_nonce( $_GET['_wc_stripe_notice_nonce'], 'wc_stripe_hide_notices_nonce' ) ) { |
|
255 | - wp_die( __( 'Action failed. Please refresh the page and retry.', 'woocommerce-gateway-stripe' ) ); |
|
253 | + if (isset($_GET['wc-stripe-hide-notice']) && isset($_GET['_wc_stripe_notice_nonce'])) { |
|
254 | + if ( ! wp_verify_nonce($_GET['_wc_stripe_notice_nonce'], 'wc_stripe_hide_notices_nonce')) { |
|
255 | + wp_die(__('Action failed. Please refresh the page and retry.', 'woocommerce-gateway-stripe')); |
|
256 | 256 | } |
257 | 257 | |
258 | - if ( ! current_user_can( 'manage_woocommerce' ) ) { |
|
259 | - wp_die( __( 'Cheatin’ huh?', 'woocommerce-gateway-stripe' ) ); |
|
258 | + if ( ! current_user_can('manage_woocommerce')) { |
|
259 | + wp_die(__('Cheatin’ huh?', 'woocommerce-gateway-stripe')); |
|
260 | 260 | } |
261 | 261 | |
262 | - $notice = wc_clean( $_GET['wc-stripe-hide-notice'] ); |
|
262 | + $notice = wc_clean($_GET['wc-stripe-hide-notice']); |
|
263 | 263 | |
264 | - switch ( $notice ) { |
|
264 | + switch ($notice) { |
|
265 | 265 | case 'style': |
266 | - update_option( 'wc_stripe_show_style_notice', 'no' ); |
|
266 | + update_option('wc_stripe_show_style_notice', 'no'); |
|
267 | 267 | break; |
268 | 268 | case 'phpver': |
269 | - update_option( 'wc_stripe_show_phpver_notice', 'no' ); |
|
269 | + update_option('wc_stripe_show_phpver_notice', 'no'); |
|
270 | 270 | break; |
271 | 271 | case 'wcver': |
272 | - update_option( 'wc_stripe_show_wcver_notice', 'no' ); |
|
272 | + update_option('wc_stripe_show_wcver_notice', 'no'); |
|
273 | 273 | break; |
274 | 274 | case 'curl': |
275 | - update_option( 'wc_stripe_show_curl_notice', 'no' ); |
|
275 | + update_option('wc_stripe_show_curl_notice', 'no'); |
|
276 | 276 | break; |
277 | 277 | case 'ssl': |
278 | - update_option( 'wc_stripe_show_ssl_notice', 'no' ); |
|
278 | + update_option('wc_stripe_show_ssl_notice', 'no'); |
|
279 | 279 | break; |
280 | 280 | case 'keys': |
281 | - update_option( 'wc_stripe_show_keys_notice', 'no' ); |
|
281 | + update_option('wc_stripe_show_keys_notice', 'no'); |
|
282 | 282 | break; |
283 | 283 | case '3ds': |
284 | - update_option( 'wc_stripe_show_3ds_notice', 'no' ); |
|
284 | + update_option('wc_stripe_show_3ds_notice', 'no'); |
|
285 | 285 | break; |
286 | 286 | case 'Alipay': |
287 | - update_option( 'wc_stripe_show_alipay_notice', 'no' ); |
|
287 | + update_option('wc_stripe_show_alipay_notice', 'no'); |
|
288 | 288 | break; |
289 | 289 | case 'Bancontact': |
290 | - update_option( 'wc_stripe_show_bancontact_notice', 'no' ); |
|
290 | + update_option('wc_stripe_show_bancontact_notice', 'no'); |
|
291 | 291 | break; |
292 | 292 | case 'EPS': |
293 | - update_option( 'wc_stripe_show_eps_notice', 'no' ); |
|
293 | + update_option('wc_stripe_show_eps_notice', 'no'); |
|
294 | 294 | break; |
295 | 295 | case 'Giropay': |
296 | - update_option( 'wc_stripe_show_giropay_notice', 'no' ); |
|
296 | + update_option('wc_stripe_show_giropay_notice', 'no'); |
|
297 | 297 | break; |
298 | 298 | case 'iDeal': |
299 | - update_option( 'wc_stripe_show_ideal_notice', 'no' ); |
|
299 | + update_option('wc_stripe_show_ideal_notice', 'no'); |
|
300 | 300 | break; |
301 | 301 | case 'Multibanco': |
302 | - update_option( 'wc_stripe_show_multibanco_notice', 'no' ); |
|
302 | + update_option('wc_stripe_show_multibanco_notice', 'no'); |
|
303 | 303 | break; |
304 | 304 | case 'P24': |
305 | - update_option( 'wc_stripe_show_p24_notice', 'no' ); |
|
305 | + update_option('wc_stripe_show_p24_notice', 'no'); |
|
306 | 306 | break; |
307 | 307 | case 'SEPA': |
308 | - update_option( 'wc_stripe_show_sepa_notice', 'no' ); |
|
308 | + update_option('wc_stripe_show_sepa_notice', 'no'); |
|
309 | 309 | break; |
310 | 310 | case 'SOFORT': |
311 | - update_option( 'wc_stripe_show_sofort_notice', 'no' ); |
|
311 | + update_option('wc_stripe_show_sofort_notice', 'no'); |
|
312 | 312 | break; |
313 | 313 | case 'sca': |
314 | - update_option( 'wc_stripe_show_sca_notice', 'no' ); |
|
314 | + update_option('wc_stripe_show_sca_notice', 'no'); |
|
315 | 315 | break; |
316 | 316 | case 'changed_keys': |
317 | - update_option( 'wc_stripe_show_changed_keys_notice', 'no' ); |
|
317 | + update_option('wc_stripe_show_changed_keys_notice', 'no'); |
|
318 | 318 | } |
319 | 319 | } |
320 | 320 | } |
@@ -327,11 +327,11 @@ discard block |
||
327 | 327 | * @return string Setting link |
328 | 328 | */ |
329 | 329 | public function get_setting_link() { |
330 | - $use_id_as_section = function_exists( 'WC' ) ? version_compare( WC()->version, '2.6', '>=' ) : false; |
|
330 | + $use_id_as_section = function_exists('WC') ? version_compare(WC()->version, '2.6', '>=') : false; |
|
331 | 331 | |
332 | - $section_slug = $use_id_as_section ? 'stripe' : strtolower( 'WC_Gateway_Stripe' ); |
|
332 | + $section_slug = $use_id_as_section ? 'stripe' : strtolower('WC_Gateway_Stripe'); |
|
333 | 333 | |
334 | - return admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=' . $section_slug ); |
|
334 | + return admin_url('admin.php?page=wc-settings&tab=checkout§ion=' . $section_slug); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | /** |
@@ -340,16 +340,16 @@ discard block |
||
340 | 340 | * @since 4.3.0 |
341 | 341 | */ |
342 | 342 | public function stripe_updated() { |
343 | - $previous_version = get_option( 'wc_stripe_version' ); |
|
343 | + $previous_version = get_option('wc_stripe_version'); |
|
344 | 344 | |
345 | 345 | // Only show the style notice if the plugin was installed and older than 4.1.4. |
346 | - if ( empty( $previous_version ) || version_compare( $previous_version, '4.1.4', 'ge' ) ) { |
|
347 | - update_option( 'wc_stripe_show_style_notice', 'no' ); |
|
346 | + if (empty($previous_version) || version_compare($previous_version, '4.1.4', 'ge')) { |
|
347 | + update_option('wc_stripe_show_style_notice', 'no'); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | // Only show the SCA notice on pre-4.3.0 installs. |
351 | - if ( empty( $previous_version ) || version_compare( $previous_version, '4.3.0', 'ge' ) ) { |
|
352 | - update_option( 'wc_stripe_show_sca_notice', 'no' ); |
|
351 | + if (empty($previous_version) || version_compare($previous_version, '4.3.0', 'ge')) { |
|
352 | + update_option('wc_stripe_show_sca_notice', 'no'); |
|
353 | 353 | } |
354 | 354 | } |
355 | 355 | } |