Completed
Pull Request — master (#1309)
by
unknown
01:41
created
woocommerce-gateway-stripe.php 1 patch
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -15,20 +15,20 @@  discard block
 block discarded – undo
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' );
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');
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
 block discarded – undo
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,25 +51,25 @@  discard block
 block discarded – undo
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
-add_action( 'plugins_loaded', 'woocommerce_gateway_stripe_init' );
57
+add_action('plugins_loaded', 'woocommerce_gateway_stripe_init');
58 58
 
59 59
 function woocommerce_gateway_stripe_init() {
60
-	load_plugin_textdomain( 'woocommerce-gateway-stripe', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
60
+	load_plugin_textdomain('woocommerce-gateway-stripe', false, plugin_basename(dirname(__FILE__)) . '/languages');
61 61
 
62
-	if ( ! class_exists( 'WooCommerce' ) ) {
63
-		add_action( 'admin_notices', 'woocommerce_stripe_missing_wc_notice' );
62
+	if ( ! class_exists('WooCommerce')) {
63
+		add_action('admin_notices', 'woocommerce_stripe_missing_wc_notice');
64 64
 		return;
65 65
 	}
66 66
 
67
-	if ( version_compare( WC_VERSION, WC_STRIPE_MIN_WC_VER, '<' ) ) {
68
-		add_action( 'admin_notices', 'woocommerce_stripe_wc_not_supported' );
67
+	if (version_compare(WC_VERSION, WC_STRIPE_MIN_WC_VER, '<')) {
68
+		add_action('admin_notices', 'woocommerce_stripe_wc_not_supported');
69 69
 		return;
70 70
 	}
71 71
 
72
-	if ( ! class_exists( 'WC_Stripe' ) ) :
72
+	if ( ! class_exists('WC_Stripe')) :
73 73
 
74 74
 		class WC_Stripe {
75 75
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 			 * @return Singleton The *Singleton* instance.
85 85
 			 */
86 86
 			public static function get_instance() {
87
-				if ( null === self::$instance ) {
87
+				if (null === self::$instance) {
88 88
 					self::$instance = new self();
89 89
 				}
90 90
 				return self::$instance;
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 			 * *Singleton* via the `new` operator from outside of this class.
112 112
 			 */
113 113
 			private function __construct() {
114
-				add_action( 'admin_init', array( $this, 'install' ) );
114
+				add_action('admin_init', array($this, 'install'));
115 115
 				$this->init();
116 116
 			}
117 117
 
@@ -122,53 +122,53 @@  discard block
 block discarded – undo
122 122
 			 * @version 4.0.0
123 123
 			 */
124 124
 			public function init() {
125
-				if ( is_admin() ) {
126
-					require_once dirname( __FILE__ ) . '/includes/admin/class-wc-stripe-privacy.php';
125
+				if (is_admin()) {
126
+					require_once dirname(__FILE__) . '/includes/admin/class-wc-stripe-privacy.php';
127 127
 				}
128 128
 
129
-				require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-exception.php';
130
-				require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-logger.php';
131
-				require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-helper.php';
132
-				include_once dirname( __FILE__ ) . '/includes/class-wc-stripe-api.php';
133
-				require_once dirname( __FILE__ ) . '/includes/abstracts/abstract-wc-stripe-payment-gateway.php';
134
-				require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-webhook-handler.php';
135
-				require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-sepa-payment-token.php';
136
-				require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-apple-pay-registration.php';
137
-				require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-pre-orders-compat.php';
138
-				require_once dirname( __FILE__ ) . '/includes/class-wc-gateway-stripe.php';
139
-				require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-bancontact.php';
140
-				require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-sofort.php';
141
-				require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-giropay.php';
142
-				require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-eps.php';
143
-				require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-ideal.php';
144
-				require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-p24.php';
145
-				require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-alipay.php';
146
-				require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-sepa.php';
147
-				require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-multibanco.php';
148
-				require_once dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-payment-request.php';
149
-				require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-subs-compat.php';
150
-				require_once dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-sepa-subs-compat.php';
151
-				require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-order-handler.php';
152
-				require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-payment-tokens.php';
153
-				require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-customer.php';
154
-				require_once dirname( __FILE__ ) . '/includes/class-wc-stripe-intent-controller.php';
155
-
156
-				if ( is_admin() ) {
157
-					require_once dirname( __FILE__ ) . '/includes/admin/class-wc-stripe-admin-notices.php';
129
+				require_once dirname(__FILE__) . '/includes/class-wc-stripe-exception.php';
130
+				require_once dirname(__FILE__) . '/includes/class-wc-stripe-logger.php';
131
+				require_once dirname(__FILE__) . '/includes/class-wc-stripe-helper.php';
132
+				include_once dirname(__FILE__) . '/includes/class-wc-stripe-api.php';
133
+				require_once dirname(__FILE__) . '/includes/abstracts/abstract-wc-stripe-payment-gateway.php';
134
+				require_once dirname(__FILE__) . '/includes/class-wc-stripe-webhook-handler.php';
135
+				require_once dirname(__FILE__) . '/includes/class-wc-stripe-sepa-payment-token.php';
136
+				require_once dirname(__FILE__) . '/includes/class-wc-stripe-apple-pay-registration.php';
137
+				require_once dirname(__FILE__) . '/includes/compat/class-wc-stripe-pre-orders-compat.php';
138
+				require_once dirname(__FILE__) . '/includes/class-wc-gateway-stripe.php';
139
+				require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-bancontact.php';
140
+				require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-sofort.php';
141
+				require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-giropay.php';
142
+				require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-eps.php';
143
+				require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-ideal.php';
144
+				require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-p24.php';
145
+				require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-alipay.php';
146
+				require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-sepa.php';
147
+				require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-multibanco.php';
148
+				require_once dirname(__FILE__) . '/includes/payment-methods/class-wc-stripe-payment-request.php';
149
+				require_once dirname(__FILE__) . '/includes/compat/class-wc-stripe-subs-compat.php';
150
+				require_once dirname(__FILE__) . '/includes/compat/class-wc-stripe-sepa-subs-compat.php';
151
+				require_once dirname(__FILE__) . '/includes/class-wc-stripe-order-handler.php';
152
+				require_once dirname(__FILE__) . '/includes/class-wc-stripe-payment-tokens.php';
153
+				require_once dirname(__FILE__) . '/includes/class-wc-stripe-customer.php';
154
+				require_once dirname(__FILE__) . '/includes/class-wc-stripe-intent-controller.php';
155
+
156
+				if (is_admin()) {
157
+					require_once dirname(__FILE__) . '/includes/admin/class-wc-stripe-admin-notices.php';
158 158
 				}
159 159
 
160 160
 				// REMOVE IN THE FUTURE.
161
-				require_once dirname( __FILE__ ) . '/includes/deprecated/class-wc-stripe-apple-pay.php';
161
+				require_once dirname(__FILE__) . '/includes/deprecated/class-wc-stripe-apple-pay.php';
162 162
 
163
-				add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateways' ) );
164
-				add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugin_action_links' ) );
165
-				add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
163
+				add_filter('woocommerce_payment_gateways', array($this, 'add_gateways'));
164
+				add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($this, 'plugin_action_links'));
165
+				add_filter('plugin_row_meta', array($this, 'plugin_row_meta'), 10, 2);
166 166
 
167 167
 				// Modify emails emails.
168
-				add_filter( 'woocommerce_email_classes', array( $this, 'add_emails' ), 20 );
168
+				add_filter('woocommerce_email_classes', array($this, 'add_emails'), 20);
169 169
 
170
-				if ( version_compare( WC_VERSION, '3.4', '<' ) ) {
171
-					add_filter( 'woocommerce_get_sections_checkout', array( $this, 'filter_gateway_order_admin' ) );
170
+				if (version_compare(WC_VERSION, '3.4', '<')) {
171
+					add_filter('woocommerce_get_sections_checkout', array($this, 'filter_gateway_order_admin'));
172 172
 				}
173 173
 			}
174 174
 
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 			 * @version 4.0.0
180 180
 			 */
181 181
 			public function update_plugin_version() {
182
-				delete_option( 'wc_stripe_version' );
183
-				update_option( 'wc_stripe_version', WC_STRIPE_VERSION );
182
+				delete_option('wc_stripe_version');
183
+				update_option('wc_stripe_version', WC_STRIPE_VERSION);
184 184
 			}
185 185
 
186 186
 			/**
@@ -190,15 +190,15 @@  discard block
 block discarded – undo
190 190
 			 * @version 3.1.0
191 191
 			 */
192 192
 			public function install() {
193
-				if ( ! is_plugin_active( plugin_basename( __FILE__ ) ) ) {
193
+				if ( ! is_plugin_active(plugin_basename(__FILE__))) {
194 194
 					return;
195 195
 				}
196 196
 
197
-				if ( ! defined( 'IFRAME_REQUEST' ) && ( WC_STRIPE_VERSION !== get_option( 'wc_stripe_version' ) ) ) {
198
-					do_action( 'woocommerce_stripe_updated' );
197
+				if ( ! defined('IFRAME_REQUEST') && (WC_STRIPE_VERSION !== get_option('wc_stripe_version'))) {
198
+					do_action('woocommerce_stripe_updated');
199 199
 
200
-					if ( ! defined( 'WC_STRIPE_INSTALLING' ) ) {
201
-						define( 'WC_STRIPE_INSTALLING', true );
200
+					if ( ! defined('WC_STRIPE_INSTALLING')) {
201
+						define('WC_STRIPE_INSTALLING', true);
202 202
 					}
203 203
 
204 204
 					$this->update_plugin_version();
@@ -211,11 +211,11 @@  discard block
 block discarded – undo
211 211
 			 * @since 1.0.0
212 212
 			 * @version 4.0.0
213 213
 			 */
214
-			public function plugin_action_links( $links ) {
214
+			public function plugin_action_links($links) {
215 215
 				$plugin_links = array(
216
-					'<a href="admin.php?page=wc-settings&tab=checkout&section=stripe">' . esc_html__( 'Settings', 'woocommerce-gateway-stripe' ) . '</a>',
216
+					'<a href="admin.php?page=wc-settings&tab=checkout&section=stripe">' . esc_html__('Settings', 'woocommerce-gateway-stripe') . '</a>',
217 217
 				);
218
-				return array_merge( $plugin_links, $links );
218
+				return array_merge($plugin_links, $links);
219 219
 			}
220 220
 
221 221
 			/**
@@ -226,13 +226,13 @@  discard block
 block discarded – undo
226 226
 			 * @param  string $file  Name of current file.
227 227
 			 * @return array  $links Update list of plugin links.
228 228
 			 */
229
-			public function plugin_row_meta( $links, $file ) {
230
-				if ( plugin_basename( __FILE__ ) === $file ) {
229
+			public function plugin_row_meta($links, $file) {
230
+				if (plugin_basename(__FILE__) === $file) {
231 231
 					$row_meta = array(
232
-						'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>',
233
-						'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>',
232
+						'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>',
233
+						'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>',
234 234
 					);
235
-					return array_merge( $links, $row_meta );
235
+					return array_merge($links, $row_meta);
236 236
 				}
237 237
 				return (array) $links;
238 238
 			}
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
 			 * @since 1.0.0
244 244
 			 * @version 4.0.0
245 245
 			 */
246
-			public function add_gateways( $methods ) {
247
-				if ( class_exists( 'WC_Subscriptions_Order' ) && function_exists( 'wcs_create_renewal_order' ) ) {
246
+			public function add_gateways($methods) {
247
+				if (class_exists('WC_Subscriptions_Order') && function_exists('wcs_create_renewal_order')) {
248 248
 					$methods[] = 'WC_Stripe_Subs_Compat';
249 249
 					$methods[] = 'WC_Stripe_Sepa_Subs_Compat';
250 250
 				} else {
@@ -270,28 +270,28 @@  discard block
 block discarded – undo
270 270
 			 * @since 4.0.0
271 271
 			 * @version 4.0.0
272 272
 			 */
273
-			public function filter_gateway_order_admin( $sections ) {
274
-				unset( $sections['stripe'] );
275
-				unset( $sections['stripe_bancontact'] );
276
-				unset( $sections['stripe_sofort'] );
277
-				unset( $sections['stripe_giropay'] );
278
-				unset( $sections['stripe_eps'] );
279
-				unset( $sections['stripe_ideal'] );
280
-				unset( $sections['stripe_p24'] );
281
-				unset( $sections['stripe_alipay'] );
282
-				unset( $sections['stripe_sepa'] );
283
-				unset( $sections['stripe_multibanco'] );
273
+			public function filter_gateway_order_admin($sections) {
274
+				unset($sections['stripe']);
275
+				unset($sections['stripe_bancontact']);
276
+				unset($sections['stripe_sofort']);
277
+				unset($sections['stripe_giropay']);
278
+				unset($sections['stripe_eps']);
279
+				unset($sections['stripe_ideal']);
280
+				unset($sections['stripe_p24']);
281
+				unset($sections['stripe_alipay']);
282
+				unset($sections['stripe_sepa']);
283
+				unset($sections['stripe_multibanco']);
284 284
 
285 285
 				$sections['stripe']            = 'Stripe';
286
-				$sections['stripe_bancontact'] = __( 'Stripe Bancontact', 'woocommerce-gateway-stripe' );
287
-				$sections['stripe_sofort']     = __( 'Stripe SOFORT', 'woocommerce-gateway-stripe' );
288
-				$sections['stripe_giropay']    = __( 'Stripe Giropay', 'woocommerce-gateway-stripe' );
289
-				$sections['stripe_eps']        = __( 'Stripe EPS', 'woocommerce-gateway-stripe' );
290
-				$sections['stripe_ideal']      = __( 'Stripe iDeal', 'woocommerce-gateway-stripe' );
291
-				$sections['stripe_p24']        = __( 'Stripe P24', 'woocommerce-gateway-stripe' );
292
-				$sections['stripe_alipay']     = __( 'Stripe Alipay', 'woocommerce-gateway-stripe' );
293
-				$sections['stripe_sepa']       = __( 'Stripe SEPA Direct Debit', 'woocommerce-gateway-stripe' );
294
-				$sections['stripe_multibanco'] = __( 'Stripe Multibanco', 'woocommerce-gateway-stripe' );
286
+				$sections['stripe_bancontact'] = __('Stripe Bancontact', 'woocommerce-gateway-stripe');
287
+				$sections['stripe_sofort']     = __('Stripe SOFORT', 'woocommerce-gateway-stripe');
288
+				$sections['stripe_giropay']    = __('Stripe Giropay', 'woocommerce-gateway-stripe');
289
+				$sections['stripe_eps']        = __('Stripe EPS', 'woocommerce-gateway-stripe');
290
+				$sections['stripe_ideal']      = __('Stripe iDeal', 'woocommerce-gateway-stripe');
291
+				$sections['stripe_p24']        = __('Stripe P24', 'woocommerce-gateway-stripe');
292
+				$sections['stripe_alipay']     = __('Stripe Alipay', 'woocommerce-gateway-stripe');
293
+				$sections['stripe_sepa']       = __('Stripe SEPA Direct Debit', 'woocommerce-gateway-stripe');
294
+				$sections['stripe_multibanco'] = __('Stripe Multibanco', 'woocommerce-gateway-stripe');
295 295
 
296 296
 				return $sections;
297 297
 			}
@@ -302,16 +302,16 @@  discard block
 block discarded – undo
302 302
 			 * @param WC_Email[] $email_classes All existing emails.
303 303
 			 * @return WC_Email[]
304 304
 			 */
305
-			public function add_emails( $email_classes ) {
305
+			public function add_emails($email_classes) {
306 306
 				require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-authentication.php';
307 307
 				require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-renewal-authentication.php';
308 308
 				require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-preorder-authentication.php';
309 309
 				require_once WC_STRIPE_PLUGIN_PATH . '/includes/compat/class-wc-stripe-email-failed-authentication-retry.php';
310 310
 
311 311
 				// Add all emails, generated by the gateway.
312
-				$email_classes['WC_Stripe_Email_Failed_Renewal_Authentication']  = new WC_Stripe_Email_Failed_Renewal_Authentication( $email_classes );
313
-				$email_classes['WC_Stripe_Email_Failed_Preorder_Authentication'] = new WC_Stripe_Email_Failed_Preorder_Authentication( $email_classes );
314
-				$email_classes['WC_Stripe_Email_Failed_Authentication_Retry'] = new WC_Stripe_Email_Failed_Authentication_Retry( $email_classes );
312
+				$email_classes['WC_Stripe_Email_Failed_Renewal_Authentication']  = new WC_Stripe_Email_Failed_Renewal_Authentication($email_classes);
313
+				$email_classes['WC_Stripe_Email_Failed_Preorder_Authentication'] = new WC_Stripe_Email_Failed_Preorder_Authentication($email_classes);
314
+				$email_classes['WC_Stripe_Email_Failed_Authentication_Retry'] = new WC_Stripe_Email_Failed_Authentication_Retry($email_classes);
315 315
 
316 316
 				return $email_classes;
317 317
 			}
Please login to merge, or discard this patch.
includes/admin/stripe-settings.php 1 patch
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if ( ! defined('ABSPATH')) {
3 3
 	exit;
4 4
 }
5 5
 
@@ -7,109 +7,109 @@  discard block
 block discarded – undo
7 7
 	'wc_stripe_settings',
8 8
 	array(
9 9
 		'enabled'                       => array(
10
-			'title'       => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ),
11
-			'label'       => __( 'Enable Stripe', 'woocommerce-gateway-stripe' ),
10
+			'title'       => __('Enable/Disable', 'woocommerce-gateway-stripe'),
11
+			'label'       => __('Enable Stripe', 'woocommerce-gateway-stripe'),
12 12
 			'type'        => 'checkbox',
13 13
 			'description' => '',
14 14
 			'default'     => 'no',
15 15
 		),
16 16
 		'title'                         => array(
17
-			'title'       => __( 'Title', 'woocommerce-gateway-stripe' ),
17
+			'title'       => __('Title', 'woocommerce-gateway-stripe'),
18 18
 			'type'        => 'text',
19
-			'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
20
-			'default'     => __( 'Credit Card (Stripe)', 'woocommerce-gateway-stripe' ),
19
+			'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'),
20
+			'default'     => __('Credit Card (Stripe)', 'woocommerce-gateway-stripe'),
21 21
 			'desc_tip'    => true,
22 22
 		),
23 23
 		'description'                   => array(
24
-			'title'       => __( 'Description', 'woocommerce-gateway-stripe' ),
24
+			'title'       => __('Description', 'woocommerce-gateway-stripe'),
25 25
 			'type'        => 'text',
26
-			'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
27
-			'default'     => __( 'Pay with your credit card via Stripe.', 'woocommerce-gateway-stripe' ),
26
+			'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'),
27
+			'default'     => __('Pay with your credit card via Stripe.', 'woocommerce-gateway-stripe'),
28 28
 			'desc_tip'    => true,
29 29
 		),
30 30
 		'webhook'                       => array(
31
-			'title'       => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ),
31
+			'title'       => __('Webhook Endpoints', 'woocommerce-gateway-stripe'),
32 32
 			'type'        => 'title',
33 33
 			/* translators: webhook URL */
34 34
 			'description' => $this->display_admin_settings_webhook_description(),
35 35
 		),
36 36
 		'testmode'                      => array(
37
-			'title'       => __( 'Test mode', 'woocommerce-gateway-stripe' ),
38
-			'label'       => __( 'Enable Test Mode', 'woocommerce-gateway-stripe' ),
37
+			'title'       => __('Test mode', 'woocommerce-gateway-stripe'),
38
+			'label'       => __('Enable Test Mode', 'woocommerce-gateway-stripe'),
39 39
 			'type'        => 'checkbox',
40
-			'description' => __( 'Place the payment gateway in test mode using test API keys.', 'woocommerce-gateway-stripe' ),
40
+			'description' => __('Place the payment gateway in test mode using test API keys.', 'woocommerce-gateway-stripe'),
41 41
 			'default'     => 'yes',
42 42
 			'desc_tip'    => true,
43 43
 		),
44 44
 		'test_publishable_key'          => array(
45
-			'title'       => __( 'Test Publishable Key', 'woocommerce-gateway-stripe' ),
45
+			'title'       => __('Test Publishable Key', 'woocommerce-gateway-stripe'),
46 46
 			'type'        => 'text',
47
-			'description' => __( 'Get your API keys from your stripe account. Invalid values will be rejected. Only values starting with "pk_test_" will be saved.', 'woocommerce-gateway-stripe' ),
47
+			'description' => __('Get your API keys from your stripe account. Invalid values will be rejected. Only values starting with "pk_test_" will be saved.', 'woocommerce-gateway-stripe'),
48 48
 			'default'     => '',
49 49
 			'desc_tip'    => true,
50 50
 		),
51 51
 		'test_secret_key'               => array(
52
-			'title'       => __( 'Test Secret Key', 'woocommerce-gateway-stripe' ),
52
+			'title'       => __('Test Secret Key', 'woocommerce-gateway-stripe'),
53 53
 			'type'        => 'password',
54
-			'description' => __( 'Get your API keys from your stripe account. Invalid values will be rejected. Only values starting with "sk_test_" or "rk_test_" will be saved.', 'woocommerce-gateway-stripe' ),
54
+			'description' => __('Get your API keys from your stripe account. Invalid values will be rejected. Only values starting with "sk_test_" or "rk_test_" will be saved.', 'woocommerce-gateway-stripe'),
55 55
 			'default'     => '',
56 56
 			'desc_tip'    => true,
57 57
 		),
58 58
 		'test_webhook_secret'           => array(
59
-			'title'       => __( 'Test Webhook Secret', 'woocommerce-gateway-stripe' ),
59
+			'title'       => __('Test Webhook Secret', 'woocommerce-gateway-stripe'),
60 60
 			'type'        => 'password',
61
-			'description' => __( 'Get your webhook signing secret from the webhooks section in your stripe account.', 'woocommerce-gateway-stripe' ),
61
+			'description' => __('Get your webhook signing secret from the webhooks section in your stripe account.', 'woocommerce-gateway-stripe'),
62 62
 			'default'     => '',
63 63
 			'desc_tip'    => true,
64 64
 		),
65 65
 		'publishable_key'               => array(
66
-			'title'       => __( 'Live Publishable Key', 'woocommerce-gateway-stripe' ),
66
+			'title'       => __('Live Publishable Key', 'woocommerce-gateway-stripe'),
67 67
 			'type'        => 'text',
68
-			'description' => __( 'Get your API keys from your stripe account. Invalid values will be rejected. Only values starting with "pk_live_" will be saved.', 'woocommerce-gateway-stripe' ),
68
+			'description' => __('Get your API keys from your stripe account. Invalid values will be rejected. Only values starting with "pk_live_" will be saved.', 'woocommerce-gateway-stripe'),
69 69
 			'default'     => '',
70 70
 			'desc_tip'    => true,
71 71
 		),
72 72
 		'secret_key'                    => array(
73
-			'title'       => __( 'Live Secret Key', 'woocommerce-gateway-stripe' ),
73
+			'title'       => __('Live Secret Key', 'woocommerce-gateway-stripe'),
74 74
 			'type'        => 'password',
75
-			'description' => __( 'Get your API keys from your stripe account. Invalid values will be rejected. Only values starting with "sk_live_" or "rk_live_" will be saved.', 'woocommerce-gateway-stripe' ),
75
+			'description' => __('Get your API keys from your stripe account. Invalid values will be rejected. Only values starting with "sk_live_" or "rk_live_" will be saved.', 'woocommerce-gateway-stripe'),
76 76
 			'default'     => '',
77 77
 			'desc_tip'    => true,
78 78
 		),
79 79
 		'webhook_secret'               => array(
80
-			'title'       => __( 'Webhook Secret', 'woocommerce-gateway-stripe' ),
80
+			'title'       => __('Webhook Secret', 'woocommerce-gateway-stripe'),
81 81
 			'type'        => 'password',
82
-			'description' => __( 'Get your webhook signing secret from the webhooks section in your stripe account.', 'woocommerce-gateway-stripe' ),
82
+			'description' => __('Get your webhook signing secret from the webhooks section in your stripe account.', 'woocommerce-gateway-stripe'),
83 83
 			'default'     => '',
84 84
 			'desc_tip'    => true,
85 85
 		),
86 86
 		'inline_cc_form'                => array(
87
-			'title'       => __( 'Inline Credit Card Form', 'woocommerce-gateway-stripe' ),
87
+			'title'       => __('Inline Credit Card Form', 'woocommerce-gateway-stripe'),
88 88
 			'type'        => 'checkbox',
89
-			'description' => __( 'Choose the style you want to show for your credit card form. When unchecked, the credit card form will display separate credit card number field, expiry date field and cvc field.', 'woocommerce-gateway-stripe' ),
89
+			'description' => __('Choose the style you want to show for your credit card form. When unchecked, the credit card form will display separate credit card number field, expiry date field and cvc field.', 'woocommerce-gateway-stripe'),
90 90
 			'default'     => 'no',
91 91
 			'desc_tip'    => true,
92 92
 		),
93 93
 		'statement_descriptor'          => array(
94
-			'title'       => __( 'Statement Descriptor', 'woocommerce-gateway-stripe' ),
94
+			'title'       => __('Statement Descriptor', 'woocommerce-gateway-stripe'),
95 95
 			'type'        => 'text',
96
-			'description' => __( 'Statement descriptors are limited to 22 characters, cannot use the special characters >, <, ", \, \', *, and must not consist solely of numbers. This will appear on your customer\'s statement in capital letters.', 'woocommerce-gateway-stripe' ),
96
+			'description' => __('Statement descriptors are limited to 22 characters, cannot use the special characters >, <, ", \, \', *, and must not consist solely of numbers. This will appear on your customer\'s statement in capital letters.', 'woocommerce-gateway-stripe'),
97 97
 			'default'     => '',
98 98
 			'desc_tip'    => true,
99 99
 		),
100 100
 		'capture'                       => array(
101
-			'title'       => __( 'Capture', 'woocommerce-gateway-stripe' ),
102
-			'label'       => __( 'Capture charge immediately', 'woocommerce-gateway-stripe' ),
101
+			'title'       => __('Capture', 'woocommerce-gateway-stripe'),
102
+			'label'       => __('Capture charge immediately', 'woocommerce-gateway-stripe'),
103 103
 			'type'        => 'checkbox',
104
-			'description' => __( 'Whether or not to immediately capture the charge. When unchecked, the charge issues an authorization and will need to be captured later. Uncaptured charges expire in 7 days.', 'woocommerce-gateway-stripe' ),
104
+			'description' => __('Whether or not to immediately capture the charge. When unchecked, the charge issues an authorization and will need to be captured later. Uncaptured charges expire in 7 days.', 'woocommerce-gateway-stripe'),
105 105
 			'default'     => 'yes',
106 106
 			'desc_tip'    => true,
107 107
 		),
108 108
 		'payment_request'               => array(
109
-			'title'       => __( 'Payment Request Buttons', 'woocommerce-gateway-stripe' ),
109
+			'title'       => __('Payment Request Buttons', 'woocommerce-gateway-stripe'),
110 110
 			/* translators: 1) br tag 2) Stripe anchor tag 3) Apple anchor tag 4) Stripe dashboard opening anchor tag 5) Stripe dashboard closing anchor tag */
111 111
 			'label'       => sprintf(
112
-				__( 'Enable Payment Request Buttons. (Apple Pay/Google Pay) %1$sBy using Apple Pay, you agree to %2$s and %3$s\'s terms of service. %4$sLog into your Stripe dashboard%5$s to complete or update your Apple Pay setup.', 'woocommerce-gateway-stripe' ),
112
+				__('Enable Payment Request Buttons. (Apple Pay/Google Pay) %1$sBy using Apple Pay, you agree to %2$s and %3$s\'s terms of service. %4$sLog into your Stripe dashboard%5$s to complete or update your Apple Pay setup.', 'woocommerce-gateway-stripe'),
113 113
 				'<br />',
114 114
 				'<a href="https://stripe.com/apple-pay/legal" target="_blank">Stripe</a>',
115 115
 				'<a href="https://developer.apple.com/apple-pay/acceptable-use-guidelines-for-websites/" target="_blank">Apple</a>',
@@ -117,79 +117,79 @@  discard block
 block discarded – undo
117 117
 				'</a>'
118 118
 			),
119 119
 			'type'        => 'checkbox',
120
-			'description' => __( 'If enabled, users will be able to pay using Apple Pay or Chrome Payment Request if supported by the browser.', 'woocommerce-gateway-stripe' ),
120
+			'description' => __('If enabled, users will be able to pay using Apple Pay or Chrome Payment Request if supported by the browser.', 'woocommerce-gateway-stripe'),
121 121
 			'default'     => 'yes',
122 122
 			'desc_tip'    => true,
123 123
 		),
124 124
 		'payment_request_button_type'   => array(
125
-			'title'       => __( 'Payment Request Button Type', 'woocommerce-gateway-stripe' ),
126
-			'label'       => __( 'Button Type', 'woocommerce-gateway-stripe' ),
125
+			'title'       => __('Payment Request Button Type', 'woocommerce-gateway-stripe'),
126
+			'label'       => __('Button Type', 'woocommerce-gateway-stripe'),
127 127
 			'type'        => 'select',
128
-			'description' => __( 'Select the button type you would like to show.', 'woocommerce-gateway-stripe' ),
128
+			'description' => __('Select the button type you would like to show.', 'woocommerce-gateway-stripe'),
129 129
 			'default'     => 'buy',
130 130
 			'desc_tip'    => true,
131 131
 			'options'     => array(
132
-				'default' => __( 'Default', 'woocommerce-gateway-stripe' ),
133
-				'buy'     => __( 'Buy', 'woocommerce-gateway-stripe' ),
134
-				'donate'  => __( 'Donate', 'woocommerce-gateway-stripe' ),
135
-				'branded' => __( 'Branded', 'woocommerce-gateway-stripe' ),
136
-				'custom'  => __( 'Custom', 'woocommerce-gateway-stripe' ),
132
+				'default' => __('Default', 'woocommerce-gateway-stripe'),
133
+				'buy'     => __('Buy', 'woocommerce-gateway-stripe'),
134
+				'donate'  => __('Donate', 'woocommerce-gateway-stripe'),
135
+				'branded' => __('Branded', 'woocommerce-gateway-stripe'),
136
+				'custom'  => __('Custom', 'woocommerce-gateway-stripe'),
137 137
 			),
138 138
 		),
139 139
 		'payment_request_button_theme'  => array(
140
-			'title'       => __( 'Payment Request Button Theme', 'woocommerce-gateway-stripe' ),
141
-			'label'       => __( 'Button Theme', 'woocommerce-gateway-stripe' ),
140
+			'title'       => __('Payment Request Button Theme', 'woocommerce-gateway-stripe'),
141
+			'label'       => __('Button Theme', 'woocommerce-gateway-stripe'),
142 142
 			'type'        => 'select',
143
-			'description' => __( 'Select the button theme you would like to show.', 'woocommerce-gateway-stripe' ),
143
+			'description' => __('Select the button theme you would like to show.', 'woocommerce-gateway-stripe'),
144 144
 			'default'     => 'dark',
145 145
 			'desc_tip'    => true,
146 146
 			'options'     => array(
147
-				'dark'          => __( 'Dark', 'woocommerce-gateway-stripe' ),
148
-				'light'         => __( 'Light', 'woocommerce-gateway-stripe' ),
149
-				'light-outline' => __( 'Light-Outline', 'woocommerce-gateway-stripe' ),
147
+				'dark'          => __('Dark', 'woocommerce-gateway-stripe'),
148
+				'light'         => __('Light', 'woocommerce-gateway-stripe'),
149
+				'light-outline' => __('Light-Outline', 'woocommerce-gateway-stripe'),
150 150
 			),
151 151
 		),
152 152
 		'payment_request_button_height' => array(
153
-			'title'       => __( 'Payment Request Button Height', 'woocommerce-gateway-stripe' ),
154
-			'label'       => __( 'Button Height', 'woocommerce-gateway-stripe' ),
153
+			'title'       => __('Payment Request Button Height', 'woocommerce-gateway-stripe'),
154
+			'label'       => __('Button Height', 'woocommerce-gateway-stripe'),
155 155
 			'type'        => 'text',
156
-			'description' => __( 'Enter the height you would like the button to be in pixels. Width will always be 100%.', 'woocommerce-gateway-stripe' ),
156
+			'description' => __('Enter the height you would like the button to be in pixels. Width will always be 100%.', 'woocommerce-gateway-stripe'),
157 157
 			'default'     => '44',
158 158
 			'desc_tip'    => true,
159 159
 		),
160 160
 		'payment_request_button_label' => array(
161
-			'title'       => __( 'Payment Request Button Label', 'woocommerce-gateway-stripe' ),
162
-			'label'       => __( 'Button Label', 'woocommerce-gateway-stripe' ),
161
+			'title'       => __('Payment Request Button Label', 'woocommerce-gateway-stripe'),
162
+			'label'       => __('Button Label', 'woocommerce-gateway-stripe'),
163 163
 			'type'        => 'text',
164
-			'description' => __( 'Enter the custom text you would like the button to have.', 'woocommerce-gateway-stripe' ),
165
-			'default'     => __( 'Buy now', 'woocommerce-gateway-stripe' ),
164
+			'description' => __('Enter the custom text you would like the button to have.', 'woocommerce-gateway-stripe'),
165
+			'default'     => __('Buy now', 'woocommerce-gateway-stripe'),
166 166
 			'desc_tip'    => true,
167 167
 		),
168 168
 		'payment_request_button_branded_type' => array(
169
-			'title'       => __( 'Payment Request Branded Button Label Format', 'woocommerce-gateway-stripe' ),
170
-			'label'       => __( 'Branded Button Label Format', 'woocommerce-gateway-stripe' ),
169
+			'title'       => __('Payment Request Branded Button Label Format', 'woocommerce-gateway-stripe'),
170
+			'label'       => __('Branded Button Label Format', 'woocommerce-gateway-stripe'),
171 171
 			'type'        => 'select',
172
-			'description' => __( 'Select the branded button label format.', 'woocommerce-gateway-stripe' ),
172
+			'description' => __('Select the branded button label format.', 'woocommerce-gateway-stripe'),
173 173
 			'default'     => 'long',
174 174
 			'desc_tip'    => true,
175 175
 			'options'     => array(
176
-				'short' => __( 'Logo only', 'woocommerce-gateway-stripe' ),
177
-				'long'  => __( 'Text and logo', 'woocommerce-gateway-stripe' ),
176
+				'short' => __('Logo only', 'woocommerce-gateway-stripe'),
177
+				'long'  => __('Text and logo', 'woocommerce-gateway-stripe'),
178 178
 			),
179 179
 		),
180 180
 		'saved_cards'                   => array(
181
-			'title'       => __( 'Saved Cards', 'woocommerce-gateway-stripe' ),
182
-			'label'       => __( 'Enable Payment via Saved Cards', 'woocommerce-gateway-stripe' ),
181
+			'title'       => __('Saved Cards', 'woocommerce-gateway-stripe'),
182
+			'label'       => __('Enable Payment via Saved Cards', 'woocommerce-gateway-stripe'),
183 183
 			'type'        => 'checkbox',
184
-			'description' => __( 'If enabled, users will be able to pay with a saved card during checkout. Card details are saved on Stripe servers, not on your store.', 'woocommerce-gateway-stripe' ),
184
+			'description' => __('If enabled, users will be able to pay with a saved card during checkout. Card details are saved on Stripe servers, not on your store.', 'woocommerce-gateway-stripe'),
185 185
 			'default'     => 'yes',
186 186
 			'desc_tip'    => true,
187 187
 		),
188 188
 		'logging'                       => array(
189
-			'title'       => __( 'Logging', 'woocommerce-gateway-stripe' ),
190
-			'label'       => __( 'Log debug messages', 'woocommerce-gateway-stripe' ),
189
+			'title'       => __('Logging', 'woocommerce-gateway-stripe'),
190
+			'label'       => __('Log debug messages', 'woocommerce-gateway-stripe'),
191 191
 			'type'        => 'checkbox',
192
-			'description' => __( 'Save debug messages to the WooCommerce System Status log.', 'woocommerce-gateway-stripe' ),
192
+			'description' => __('Save debug messages to the WooCommerce System Status log.', 'woocommerce-gateway-stripe'),
193 193
 			'default'     => 'no',
194 194
 			'desc_tip'    => true,
195 195
 		),
Please login to merge, or discard this patch.