@@ -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.3' ); // 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.3'); // 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,56 +131,56 @@ 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'; |
|
136 | - require_once dirname( __FILE__ ) . '/includes/admin/class-wc-stripe-inbox-notes.php'; |
|
134 | + if (is_admin()) { |
|
135 | + require_once dirname(__FILE__) . '/includes/admin/class-wc-stripe-privacy.php'; |
|
136 | + require_once dirname(__FILE__) . '/includes/admin/class-wc-stripe-inbox-notes.php'; |
|
137 | 137 | } |
138 | 138 | |
139 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-exception.php'; |
|
140 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-logger.php'; |
|
141 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-helper.php'; |
|
142 | - include_once dirname( __FILE__ ) . '/includes/class-wc-stripe-api.php'; |
|
143 | - require_once dirname( __FILE__ ) . '/includes/abstracts/abstract-wc-stripe-payment-gateway.php'; |
|
144 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-webhook-handler.php'; |
|
145 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-sepa-payment-token.php'; |
|
146 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-apple-pay-registration.php'; |
|
147 | - require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-pre-orders-compat.php'; |
|
148 | - require_once dirname( __FILE__ ) . '/includes/class-wc-gateway-stripe.php'; |
|
149 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-bancontact.php'; |
|
150 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-sofort.php'; |
|
151 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-giropay.php'; |
|
152 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-eps.php'; |
|
153 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-ideal.php'; |
|
154 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-p24.php'; |
|
155 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-alipay.php'; |
|
156 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-sepa.php'; |
|
157 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-multibanco.php'; |
|
158 | - require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-payment-request.php'; |
|
159 | - require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-subs-compat.php'; |
|
160 | - require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-sepa-subs-compat.php'; |
|
161 | - require_once dirname( __FILE__ ) . '/includes/connect/class-wc-stripe-connect.php'; |
|
162 | - require_once dirname( __FILE__ ) . '/includes/connect/class-wc-stripe-connect-api.php'; |
|
163 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-order-handler.php'; |
|
164 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-payment-tokens.php'; |
|
165 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-customer.php'; |
|
166 | - require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-intent-controller.php'; |
|
167 | - |
|
168 | - if ( is_admin() ) { |
|
169 | - require_once dirname( __FILE__ ) . '/includes/admin/class-wc-stripe-admin-notices.php'; |
|
139 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-exception.php'; |
|
140 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-logger.php'; |
|
141 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-helper.php'; |
|
142 | + include_once dirname(__FILE__) . '/includes/class-wc-stripe-api.php'; |
|
143 | + require_once dirname(__FILE__) . '/includes/abstracts/abstract-wc-stripe-payment-gateway.php'; |
|
144 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-webhook-handler.php'; |
|
145 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-sepa-payment-token.php'; |
|
146 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-apple-pay-registration.php'; |
|
147 | + require_once dirname(__FILE__) . '/includes/compat/class-wc-stripe-pre-orders-compat.php'; |
|
148 | + require_once dirname(__FILE__) . '/includes/class-wc-gateway-stripe.php'; |
|
149 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-bancontact.php'; |
|
150 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-sofort.php'; |
|
151 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-giropay.php'; |
|
152 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-eps.php'; |
|
153 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-ideal.php'; |
|
154 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-p24.php'; |
|
155 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-alipay.php'; |
|
156 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-sepa.php'; |
|
157 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-multibanco.php'; |
|
158 | + require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-stripe-payment-request.php'; |
|
159 | + require_once dirname(__FILE__) . '/includes/compat/class-wc-stripe-subs-compat.php'; |
|
160 | + require_once dirname(__FILE__) . '/includes/compat/class-wc-stripe-sepa-subs-compat.php'; |
|
161 | + require_once dirname(__FILE__) . '/includes/connect/class-wc-stripe-connect.php'; |
|
162 | + require_once dirname(__FILE__) . '/includes/connect/class-wc-stripe-connect-api.php'; |
|
163 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-order-handler.php'; |
|
164 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-payment-tokens.php'; |
|
165 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-customer.php'; |
|
166 | + require_once dirname(__FILE__) . '/includes/class-wc-stripe-intent-controller.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( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugin_action_links' ) ); |
|
177 | - 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('plugin_action_links_' . plugin_basename(__FILE__), array($this, 'plugin_action_links')); |
|
177 | + add_filter('plugin_row_meta', array($this, 'plugin_row_meta'), 10, 2); |
|
178 | 178 | |
179 | 179 | // Modify emails emails. |
180 | - add_filter( 'woocommerce_email_classes', array( $this, 'add_emails' ), 20 ); |
|
180 | + add_filter('woocommerce_email_classes', array($this, 'add_emails'), 20); |
|
181 | 181 | |
182 | - if ( version_compare( WC_VERSION, '3.4', '<' ) ) { |
|
183 | - add_filter( 'woocommerce_get_sections_checkout', array( $this, 'filter_gateway_order_admin' ) ); |
|
182 | + if (version_compare(WC_VERSION, '3.4', '<')) { |
|
183 | + add_filter('woocommerce_get_sections_checkout', array($this, 'filter_gateway_order_admin')); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
@@ -191,8 +191,8 @@ discard block |
||
191 | 191 | * @version 4.0.0 |
192 | 192 | */ |
193 | 193 | public function update_plugin_version() { |
194 | - delete_option( 'wc_stripe_version' ); |
|
195 | - update_option( 'wc_stripe_version', WC_STRIPE_VERSION ); |
|
194 | + delete_option('wc_stripe_version'); |
|
195 | + update_option('wc_stripe_version', WC_STRIPE_VERSION); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -202,15 +202,15 @@ discard block |
||
202 | 202 | * @version 3.1.0 |
203 | 203 | */ |
204 | 204 | public function install() { |
205 | - if ( ! is_plugin_active( plugin_basename( __FILE__ ) ) ) { |
|
205 | + if ( ! is_plugin_active(plugin_basename(__FILE__))) { |
|
206 | 206 | return; |
207 | 207 | } |
208 | 208 | |
209 | - if ( ! defined( 'IFRAME_REQUEST' ) && ( WC_STRIPE_VERSION !== get_option( 'wc_stripe_version' ) ) ) { |
|
210 | - do_action( 'woocommerce_stripe_updated' ); |
|
209 | + if ( ! defined('IFRAME_REQUEST') && (WC_STRIPE_VERSION !== get_option('wc_stripe_version'))) { |
|
210 | + do_action('woocommerce_stripe_updated'); |
|
211 | 211 | |
212 | - if ( ! defined( 'WC_STRIPE_INSTALLING' ) ) { |
|
213 | - define( 'WC_STRIPE_INSTALLING', true ); |
|
212 | + if ( ! defined('WC_STRIPE_INSTALLING')) { |
|
213 | + define('WC_STRIPE_INSTALLING', true); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | $this->update_plugin_version(); |
@@ -223,11 +223,11 @@ discard block |
||
223 | 223 | * @since 1.0.0 |
224 | 224 | * @version 4.0.0 |
225 | 225 | */ |
226 | - public function plugin_action_links( $links ) { |
|
226 | + public function plugin_action_links($links) { |
|
227 | 227 | $plugin_links = array( |
228 | - '<a href="admin.php?page=wc-settings&tab=checkout§ion=stripe">' . esc_html__( 'Settings', 'woocommerce-gateway-stripe' ) . '</a>', |
|
228 | + '<a href="admin.php?page=wc-settings&tab=checkout§ion=stripe">' . esc_html__('Settings', 'woocommerce-gateway-stripe') . '</a>', |
|
229 | 229 | ); |
230 | - return array_merge( $plugin_links, $links ); |
|
230 | + return array_merge($plugin_links, $links); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -238,13 +238,13 @@ discard block |
||
238 | 238 | * @param string $file Name of current file. |
239 | 239 | * @return array $links Update list of plugin links. |
240 | 240 | */ |
241 | - public function plugin_row_meta( $links, $file ) { |
|
242 | - if ( plugin_basename( __FILE__ ) === $file ) { |
|
241 | + public function plugin_row_meta($links, $file) { |
|
242 | + if (plugin_basename(__FILE__) === $file) { |
|
243 | 243 | $row_meta = array( |
244 | - '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>', |
|
245 | - '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>', |
|
244 | + '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>', |
|
245 | + '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>', |
|
246 | 246 | ); |
247 | - return array_merge( $links, $row_meta ); |
|
247 | + return array_merge($links, $row_meta); |
|
248 | 248 | } |
249 | 249 | return (array) $links; |
250 | 250 | } |
@@ -255,8 +255,8 @@ discard block |
||
255 | 255 | * @since 1.0.0 |
256 | 256 | * @version 4.0.0 |
257 | 257 | */ |
258 | - public function add_gateways( $methods ) { |
|
259 | - if ( class_exists( 'WC_Subscriptions_Order' ) && function_exists( 'wcs_create_renewal_order' ) ) { |
|
258 | + public function add_gateways($methods) { |
|
259 | + if (class_exists('WC_Subscriptions_Order') && function_exists('wcs_create_renewal_order')) { |
|
260 | 260 | $methods[] = 'WC_Stripe_Subs_Compat'; |
261 | 261 | $methods[] = 'WC_Stripe_Sepa_Subs_Compat'; |
262 | 262 | } else { |
@@ -282,28 +282,28 @@ discard block |
||
282 | 282 | * @since 4.0.0 |
283 | 283 | * @version 4.0.0 |
284 | 284 | */ |
285 | - public function filter_gateway_order_admin( $sections ) { |
|
286 | - unset( $sections['stripe'] ); |
|
287 | - unset( $sections['stripe_bancontact'] ); |
|
288 | - unset( $sections['stripe_sofort'] ); |
|
289 | - unset( $sections['stripe_giropay'] ); |
|
290 | - unset( $sections['stripe_eps'] ); |
|
291 | - unset( $sections['stripe_ideal'] ); |
|
292 | - unset( $sections['stripe_p24'] ); |
|
293 | - unset( $sections['stripe_alipay'] ); |
|
294 | - unset( $sections['stripe_sepa'] ); |
|
295 | - unset( $sections['stripe_multibanco'] ); |
|
285 | + public function filter_gateway_order_admin($sections) { |
|
286 | + unset($sections['stripe']); |
|
287 | + unset($sections['stripe_bancontact']); |
|
288 | + unset($sections['stripe_sofort']); |
|
289 | + unset($sections['stripe_giropay']); |
|
290 | + unset($sections['stripe_eps']); |
|
291 | + unset($sections['stripe_ideal']); |
|
292 | + unset($sections['stripe_p24']); |
|
293 | + unset($sections['stripe_alipay']); |
|
294 | + unset($sections['stripe_sepa']); |
|
295 | + unset($sections['stripe_multibanco']); |
|
296 | 296 | |
297 | 297 | $sections['stripe'] = 'Stripe'; |
298 | - $sections['stripe_bancontact'] = __( 'Stripe Bancontact', 'woocommerce-gateway-stripe' ); |
|
299 | - $sections['stripe_sofort'] = __( 'Stripe SOFORT', 'woocommerce-gateway-stripe' ); |
|
300 | - $sections['stripe_giropay'] = __( 'Stripe Giropay', 'woocommerce-gateway-stripe' ); |
|
301 | - $sections['stripe_eps'] = __( 'Stripe EPS', 'woocommerce-gateway-stripe' ); |
|
302 | - $sections['stripe_ideal'] = __( 'Stripe iDeal', 'woocommerce-gateway-stripe' ); |
|
303 | - $sections['stripe_p24'] = __( 'Stripe P24', 'woocommerce-gateway-stripe' ); |
|
304 | - $sections['stripe_alipay'] = __( 'Stripe Alipay', 'woocommerce-gateway-stripe' ); |
|
305 | - $sections['stripe_sepa'] = __( 'Stripe SEPA Direct Debit', 'woocommerce-gateway-stripe' ); |
|
306 | - $sections['stripe_multibanco'] = __( 'Stripe Multibanco', 'woocommerce-gateway-stripe' ); |
|
298 | + $sections['stripe_bancontact'] = __('Stripe Bancontact', 'woocommerce-gateway-stripe'); |
|
299 | + $sections['stripe_sofort'] = __('Stripe SOFORT', 'woocommerce-gateway-stripe'); |
|
300 | + $sections['stripe_giropay'] = __('Stripe Giropay', 'woocommerce-gateway-stripe'); |
|
301 | + $sections['stripe_eps'] = __('Stripe EPS', 'woocommerce-gateway-stripe'); |
|
302 | + $sections['stripe_ideal'] = __('Stripe iDeal', 'woocommerce-gateway-stripe'); |
|
303 | + $sections['stripe_p24'] = __('Stripe P24', 'woocommerce-gateway-stripe'); |
|
304 | + $sections['stripe_alipay'] = __('Stripe Alipay', 'woocommerce-gateway-stripe'); |
|
305 | + $sections['stripe_sepa'] = __('Stripe SEPA Direct Debit', 'woocommerce-gateway-stripe'); |
|
306 | + $sections['stripe_multibanco'] = __('Stripe Multibanco', 'woocommerce-gateway-stripe'); |
|
307 | 307 | |
308 | 308 | return $sections; |
309 | 309 | } |
@@ -314,16 +314,16 @@ discard block |
||
314 | 314 | * @param WC_Email[] $email_classes All existing emails. |
315 | 315 | * @return WC_Email[] |
316 | 316 | */ |
317 | - public function add_emails( $email_classes ) { |
|
317 | + public function add_emails($email_classes) { |
|
318 | 318 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-authentication.php'; |
319 | 319 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-renewal-authentication.php'; |
320 | 320 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-preorder-authentication.php'; |
321 | 321 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-authentication-retry.php'; |
322 | 322 | |
323 | 323 | // Add all emails, generated by the gateway. |
324 | - $email_classes['WC_Stripe_Email_Failed_Renewal_Authentication'] = new WC_Stripe_Email_Failed_Renewal_Authentication( $email_classes ); |
|
325 | - $email_classes['WC_Stripe_Email_Failed_Preorder_Authentication'] = new WC_Stripe_Email_Failed_Preorder_Authentication( $email_classes ); |
|
326 | - $email_classes['WC_Stripe_Email_Failed_Authentication_Retry'] = new WC_Stripe_Email_Failed_Authentication_Retry( $email_classes ); |
|
324 | + $email_classes['WC_Stripe_Email_Failed_Renewal_Authentication'] = new WC_Stripe_Email_Failed_Renewal_Authentication($email_classes); |
|
325 | + $email_classes['WC_Stripe_Email_Failed_Preorder_Authentication'] = new WC_Stripe_Email_Failed_Preorder_Authentication($email_classes); |
|
326 | + $email_classes['WC_Stripe_Email_Failed_Authentication_Retry'] = new WC_Stripe_Email_Failed_Authentication_Retry($email_classes); |
|
327 | 327 | |
328 | 328 | return $email_classes; |
329 | 329 | } |
@@ -337,8 +337,8 @@ discard block |
||
337 | 337 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/connect/class-wc-stripe-connect-rest-oauth-init-controller.php'; |
338 | 338 | require_once WC_STRIPE_PLUGIN_PATH . '/includes/connect/class-wc-stripe-connect-rest-oauth-connect-controller.php'; |
339 | 339 | |
340 | - $oauth_init = new WC_Stripe_Connect_REST_Oauth_Init_Controller( $this->connect, $this->api ); |
|
341 | - $oauth_connect = new WC_Stripe_Connect_REST_Oauth_Connect_Controller( $this->connect, $this->api ); |
|
340 | + $oauth_init = new WC_Stripe_Connect_REST_Oauth_Init_Controller($this->connect, $this->api); |
|
341 | + $oauth_connect = new WC_Stripe_Connect_REST_Oauth_Connect_Controller($this->connect, $this->api); |
|
342 | 342 | |
343 | 343 | $oauth_init->register_routes(); |
344 | 344 | $oauth_connect->register_routes(); |
@@ -352,18 +352,18 @@ discard block |
||
352 | 352 | return $plugin; |
353 | 353 | } |
354 | 354 | |
355 | -add_action( 'plugins_loaded', 'woocommerce_gateway_stripe_init' ); |
|
355 | +add_action('plugins_loaded', 'woocommerce_gateway_stripe_init'); |
|
356 | 356 | |
357 | 357 | function woocommerce_gateway_stripe_init() { |
358 | - load_plugin_textdomain( 'woocommerce-gateway-stripe', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' ); |
|
358 | + load_plugin_textdomain('woocommerce-gateway-stripe', false, plugin_basename(dirname(__FILE__)) . '/languages'); |
|
359 | 359 | |
360 | - if ( ! class_exists( 'WooCommerce' ) ) { |
|
361 | - add_action( 'admin_notices', 'woocommerce_stripe_missing_wc_notice' ); |
|
360 | + if ( ! class_exists('WooCommerce')) { |
|
361 | + add_action('admin_notices', 'woocommerce_stripe_missing_wc_notice'); |
|
362 | 362 | return; |
363 | 363 | } |
364 | 364 | |
365 | - if ( version_compare( WC_VERSION, WC_STRIPE_MIN_WC_VER, '<' ) ) { |
|
366 | - add_action( 'admin_notices', 'woocommerce_stripe_wc_not_supported' ); |
|
365 | + if (version_compare(WC_VERSION, WC_STRIPE_MIN_WC_VER, '<')) { |
|
366 | + add_action('admin_notices', 'woocommerce_stripe_wc_not_supported'); |
|
367 | 367 | return; |
368 | 368 | } |
369 | 369 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -15,46 +15,46 @@ discard block |
||
15 | 15 | const NOTE_NAME = 'stripe-apple-pay-domain-verification'; |
16 | 16 | |
17 | 17 | public static function notify_of_apple_pay_domain_verification_if_needed() { |
18 | - if ( ! class_exists( 'Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes' ) ) { |
|
18 | + if ( ! class_exists('Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes')) { |
|
19 | 19 | return; |
20 | 20 | } |
21 | 21 | |
22 | - if ( ! class_exists( 'WC_Data_Store' ) ) { |
|
22 | + if ( ! class_exists('WC_Data_Store')) { |
|
23 | 23 | return; |
24 | 24 | } |
25 | 25 | |
26 | - $stripe_settings = get_option( 'woocommerce_stripe_settings', array() ); |
|
26 | + $stripe_settings = get_option('woocommerce_stripe_settings', array()); |
|
27 | 27 | $domain_flag_key = 'apple_pay_domain_set'; |
28 | - $verification_complete = isset( $stripe_settings[ $domain_flag_key ] ) && 'yes' === $stripe_settings[ $domain_flag_key ]; |
|
28 | + $verification_complete = isset($stripe_settings[$domain_flag_key]) && 'yes' === $stripe_settings[$domain_flag_key]; |
|
29 | 29 | |
30 | - $data_store = WC_Data_Store::load( 'admin-note' ); |
|
30 | + $data_store = WC_Data_Store::load('admin-note'); |
|
31 | 31 | |
32 | 32 | // First, see if we've already created this kind of note so we don't do it again. |
33 | - $note_ids = $data_store->get_notes_with_name( self::NOTE_NAME ); |
|
34 | - if ( ! empty( $note_ids ) ) { |
|
35 | - $note_id = array_pop( $note_ids ); |
|
36 | - $note = WC_Admin_Notes::get_note( $note_id ); |
|
37 | - if ( false === $note ) { |
|
33 | + $note_ids = $data_store->get_notes_with_name(self::NOTE_NAME); |
|
34 | + if ( ! empty($note_ids)) { |
|
35 | + $note_id = array_pop($note_ids); |
|
36 | + $note = WC_Admin_Notes::get_note($note_id); |
|
37 | + if (false === $note) { |
|
38 | 38 | return; |
39 | 39 | } |
40 | 40 | |
41 | 41 | // If the domain verification completed after the note was created, make sure it's marked as actioned. |
42 | - if ( $verification_complete && WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED !== $note->get_status() ) { |
|
43 | - $note->set_status( WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED ); |
|
42 | + if ($verification_complete && WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED !== $note->get_status()) { |
|
43 | + $note->set_status(WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED); |
|
44 | 44 | $note->save(); |
45 | 45 | } |
46 | 46 | return; |
47 | 47 | } |
48 | 48 | |
49 | 49 | $note = new WC_Admin_Note(); |
50 | - $note->set_title( __( 'Apple Pay domain verification needed', 'woocommerce-admin' ) ); |
|
51 | - $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-admin' ) ); |
|
52 | - $note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); |
|
53 | - $note->set_name( self::NOTE_NAME ); |
|
54 | - $note->set_source( 'woocommerce-admin' ); |
|
50 | + $note->set_title(__('Apple Pay domain verification needed', 'woocommerce-admin')); |
|
51 | + $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-admin')); |
|
52 | + $note->set_type(WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL); |
|
53 | + $note->set_name(self::NOTE_NAME); |
|
54 | + $note->set_source('woocommerce-admin'); |
|
55 | 55 | $note->add_action( |
56 | 56 | 'learn-more', |
57 | - __( 'Learn more', 'woocommerce-admin' ), |
|
57 | + __('Learn more', 'woocommerce-admin'), |
|
58 | 58 | 'https://docs.woocommerce.com/document/stripe/#apple-pay' |
59 | 59 | ); |
60 | 60 | $note->save(); |