Completed
Push — master ( 27afec...e35083 )
by Roy
05:12
created
includes/admin/class-wc-stripe-admin-notices.php 1 patch
Spacing   +79 added lines, -79 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
 
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
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' ) );
24
+		add_action('admin_notices', array($this, 'admin_notices'));
25
+		add_action('wp_loaded', array($this, 'hide_notices'));
26 26
 	}
27 27
 
28 28
 	/**
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 	 * @since 1.0.0
32 32
 	 * @version 4.0.0
33 33
 	 */
34
-	public function add_admin_notice( $slug, $class, $message, $dismissible = false ) {
35
-		$this->notices[ $slug ] = array(
34
+	public function add_admin_notice($slug, $class, $message, $dismissible = false) {
35
+		$this->notices[$slug] = array(
36 36
 			'class'       => $class,
37 37
 			'message'     => $message,
38 38
 			'dismissible' => $dismissible,
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * @version 4.0.0
47 47
 	 */
48 48
 	public function admin_notices() {
49
-		if ( ! current_user_can( 'manage_woocommerce' ) ) {
49
+		if ( ! current_user_can('manage_woocommerce')) {
50 50
 			return;
51 51
 		}
52 52
 
@@ -56,17 +56,17 @@  discard block
 block discarded – undo
56 56
 		// All other payment methods.
57 57
 		$this->payment_methods_check_environment();
58 58
 
59
-		foreach ( (array) $this->notices as $notice_key => $notice ) {
60
-			echo '<div class="' . esc_attr( $notice['class'] ) . '" style="position:relative;">';
59
+		foreach ((array) $this->notices as $notice_key => $notice) {
60
+			echo '<div class="' . esc_attr($notice['class']) . '" style="position:relative;">';
61 61
 
62
-			if ( $notice['dismissible'] ) {
62
+			if ($notice['dismissible']) {
63 63
 			?>
64
-				<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:absolute;right:1px;padding:9px;text-decoration:none;"></a>
64
+				<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:absolute;right:1px;padding:9px;text-decoration:none;"></a>
65 65
 			<?php
66 66
 			}
67 67
 
68 68
 			echo '<p>';
69
-			echo wp_kses( $notice['message'], array( 'a' => array( 'href' => array() ) ) );
69
+			echo wp_kses($notice['message'], array('a' => array('href' => array())));
70 70
 			echo '</p></div>';
71 71
 		}
72 72
 	}
@@ -99,85 +99,85 @@  discard block
 block discarded – undo
99 99
 	 * @version 4.0.0
100 100
 	 */
101 101
 	public function stripe_check_environment() {
102
-		$show_ssl_notice    = get_option( 'wc_stripe_show_ssl_notice' );
103
-		$show_keys_notice   = get_option( 'wc_stripe_show_keys_notice' );
104
-		$show_phpver_notice = get_option( 'wc_stripe_show_phpver_notice' );
105
-		$show_wcver_notice  = get_option( 'wc_stripe_show_wcver_notice' );
106
-		$show_curl_notice   = get_option( 'wc_stripe_show_curl_notice' );
107
-		$options            = get_option( 'woocommerce_stripe_settings' );
108
-		$testmode           = ( isset( $options['testmode'] ) && 'yes' === $options['testmode'] ) ? true : false;
109
-		$test_pub_key       = isset( $options['test_publishable_key'] ) ? $options['test_publishable_key'] : '';
110
-		$test_secret_key    = isset( $options['test_secret_key'] ) ? $options['test_secret_key'] : '';
111
-		$live_pub_key       = isset( $options['publishable_key'] ) ? $options['publishable_key'] : '';
112
-		$live_secret_key    = isset( $options['secret_key'] ) ? $options['secret_key'] : '';
113
-
114
-		if ( isset( $options['enabled'] ) && 'yes' === $options['enabled'] ) {
115
-			if ( empty( $show_phpver_notice ) ) {
116
-				if ( version_compare( phpversion(), WC_STRIPE_MIN_PHP_VER, '<' ) ) {
102
+		$show_ssl_notice    = get_option('wc_stripe_show_ssl_notice');
103
+		$show_keys_notice   = get_option('wc_stripe_show_keys_notice');
104
+		$show_phpver_notice = get_option('wc_stripe_show_phpver_notice');
105
+		$show_wcver_notice  = get_option('wc_stripe_show_wcver_notice');
106
+		$show_curl_notice   = get_option('wc_stripe_show_curl_notice');
107
+		$options            = get_option('woocommerce_stripe_settings');
108
+		$testmode           = (isset($options['testmode']) && 'yes' === $options['testmode']) ? true : false;
109
+		$test_pub_key       = isset($options['test_publishable_key']) ? $options['test_publishable_key'] : '';
110
+		$test_secret_key    = isset($options['test_secret_key']) ? $options['test_secret_key'] : '';
111
+		$live_pub_key       = isset($options['publishable_key']) ? $options['publishable_key'] : '';
112
+		$live_secret_key    = isset($options['secret_key']) ? $options['secret_key'] : '';
113
+
114
+		if (isset($options['enabled']) && 'yes' === $options['enabled']) {
115
+			if (empty($show_phpver_notice)) {
116
+				if (version_compare(phpversion(), WC_STRIPE_MIN_PHP_VER, '<')) {
117 117
 					/* translators: 1) int version 2) int version */
118
-					$message = __( 'WooCommerce Stripe - The minimum PHP version required for this plugin is %1$s. You are running %2$s.', 'woocommerce-gateway-stripe' );
118
+					$message = __('WooCommerce Stripe - The minimum PHP version required for this plugin is %1$s. You are running %2$s.', 'woocommerce-gateway-stripe');
119 119
 
120
-					$this->add_admin_notice( 'phpver', 'error', sprintf( $message, WC_STRIPE_MIN_PHP_VER, phpversion() ), true );
120
+					$this->add_admin_notice('phpver', 'error', sprintf($message, WC_STRIPE_MIN_PHP_VER, phpversion()), true);
121 121
 
122 122
 					return;
123 123
 				}
124 124
 			}
125 125
 
126
-			if ( empty( $show_wcver_notice ) ) {
127
-				if ( version_compare( WC_VERSION, WC_STRIPE_MIN_WC_VER, '<' ) ) {
126
+			if (empty($show_wcver_notice)) {
127
+				if (version_compare(WC_VERSION, WC_STRIPE_MIN_WC_VER, '<')) {
128 128
 					/* translators: 1) int version 2) int version */
129
-					$message = __( 'WooCommerce Stripe - The minimum WooCommerce version required for this plugin is %1$s. You are running %2$s.', 'woocommerce-gateway-stripe' );
129
+					$message = __('WooCommerce Stripe - The minimum WooCommerce version required for this plugin is %1$s. You are running %2$s.', 'woocommerce-gateway-stripe');
130 130
 
131
-					$this->add_admin_notice( 'wcver', 'notice notice-warning', sprintf( $message, WC_STRIPE_MIN_WC_VER, WC_VERSION ), true );
131
+					$this->add_admin_notice('wcver', 'notice notice-warning', sprintf($message, WC_STRIPE_MIN_WC_VER, WC_VERSION), true);
132 132
 
133 133
 					return;
134 134
 				}
135 135
 			}
136 136
 
137
-			if ( empty( $show_curl_notice ) ) {
138
-				if ( ! function_exists( 'curl_init' ) ) {
139
-					$this->add_admin_notice( 'curl', 'notice notice-warning', __( 'WooCommerce Stripe - cURL is not installed.', 'woocommerce-gateway-stripe' ), true );
137
+			if (empty($show_curl_notice)) {
138
+				if ( ! function_exists('curl_init')) {
139
+					$this->add_admin_notice('curl', 'notice notice-warning', __('WooCommerce Stripe - cURL is not installed.', 'woocommerce-gateway-stripe'), true);
140 140
 				}
141 141
 			}
142 142
 
143
-			if ( empty( $show_keys_notice ) ) {
143
+			if (empty($show_keys_notice)) {
144 144
 				$secret = WC_Stripe_API::get_secret_key();
145 145
 
146
-				if ( empty( $secret ) && ! ( isset( $_GET['page'], $_GET['section'] ) && 'wc-settings' === $_GET['page'] && 'stripe' === $_GET['section'] ) ) {
146
+				if (empty($secret) && ! (isset($_GET['page'], $_GET['section']) && 'wc-settings' === $_GET['page'] && 'stripe' === $_GET['section'])) {
147 147
 					$setting_link = $this->get_setting_link();
148 148
 					/* translators: 1) link */
149
-					$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 );
149
+					$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);
150 150
 				}
151 151
 
152 152
 				// Check if keys are entered properly per live/test mode.
153
-				if ( $testmode ) {
153
+				if ($testmode) {
154 154
 					if (
155
-						! empty( $test_pub_key ) && ! preg_match( '/^pk_test_/', $test_pub_key )
156
-						|| ( ! empty( $test_secret_key ) && ! preg_match( '/^sk_test_/', $test_secret_key )
157
-						&& ! empty( $test_secret_key ) && ! preg_match( '/^rk_test_/', $test_secret_key ) ) )
155
+						! empty($test_pub_key) && ! preg_match('/^pk_test_/', $test_pub_key)
156
+						|| ( ! empty($test_secret_key) && ! preg_match('/^sk_test_/', $test_secret_key)
157
+						&& ! empty($test_secret_key) && ! preg_match('/^rk_test_/', $test_secret_key)) )
158 158
 					{
159 159
 						$setting_link = $this->get_setting_link();
160 160
 						/* translators: 1) link */
161
-						$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 );
161
+						$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);
162 162
 					}
163 163
 				} else {
164 164
 					if (
165
-						! empty( $live_pub_key ) && ! preg_match( '/^pk_live_/', $live_pub_key )
166
-						|| ( ! empty( $live_secret_key ) && ! preg_match( '/^sk_live_/', $live_secret_key )
167
-						&& ! empty( $live_secret_key ) && ! preg_match( '/^rk_live_/', $live_secret_key ) ) )
165
+						! empty($live_pub_key) && ! preg_match('/^pk_live_/', $live_pub_key)
166
+						|| ( ! empty($live_secret_key) && ! preg_match('/^sk_live_/', $live_secret_key)
167
+						&& ! empty($live_secret_key) && ! preg_match('/^rk_live_/', $live_secret_key)) )
168 168
 					{
169 169
 						$setting_link = $this->get_setting_link();
170 170
 						/* translators: 1) link */
171
-						$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 );
171
+						$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);
172 172
 					}
173 173
 				}
174 174
 			}
175 175
 
176
-			if ( empty( $show_ssl_notice ) ) {
176
+			if (empty($show_ssl_notice)) {
177 177
 				// Show message if enabled and FORCE SSL is disabled and WordpressHTTPS plugin is not detected.
178
-				if ( ! wc_checkout_is_https() ) {
178
+				if ( ! wc_checkout_is_https()) {
179 179
 					/* translators: 1) link */
180
-					$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 );
180
+					$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);
181 181
 				}
182 182
 			}
183 183
 		}
@@ -191,16 +191,16 @@  discard block
 block discarded – undo
191 191
 	public function payment_methods_check_environment() {
192 192
 		$payment_methods = $this->get_payment_methods();
193 193
 
194
-		foreach ( $payment_methods as $method => $class ) {
195
-			$show_notice = get_option( 'wc_stripe_show_' . strtolower( $method ) . '_notice' );
194
+		foreach ($payment_methods as $method => $class) {
195
+			$show_notice = get_option('wc_stripe_show_' . strtolower($method) . '_notice');
196 196
 			$gateway     = new $class();
197 197
 
198
-			if ( 'yes' !== $gateway->enabled || 'no' === $show_notice ) {
198
+			if ('yes' !== $gateway->enabled || 'no' === $show_notice) {
199 199
 				continue;
200 200
 			}
201 201
 
202
-			if ( ! in_array( get_woocommerce_currency(), $gateway->get_supported_currency() ) ) {
203
-				$this->add_admin_notice( $method, 'notice notice-error', sprintf( __( '%s is enabled - it requires store currency to be set to %s', 'woocommerce-gateway-stripe' ), $method, implode( ', ', $gateway->get_supported_currency() ) ), true );
202
+			if ( ! in_array(get_woocommerce_currency(), $gateway->get_supported_currency())) {
203
+				$this->add_admin_notice($method, 'notice notice-error', sprintf(__('%s is enabled - it requires store currency to be set to %s', 'woocommerce-gateway-stripe'), $method, implode(', ', $gateway->get_supported_currency())), true);
204 204
 			}
205 205
 		}
206 206
 	}
@@ -212,59 +212,59 @@  discard block
 block discarded – undo
212 212
 	 * @version 4.0.0
213 213
 	 */
214 214
 	public function hide_notices() {
215
-		if ( isset( $_GET['wc-stripe-hide-notice'] ) && isset( $_GET['_wc_stripe_notice_nonce'] ) ) {
216
-			if ( ! wp_verify_nonce( $_GET['_wc_stripe_notice_nonce'], 'wc_stripe_hide_notices_nonce' ) ) {
217
-				wp_die( __( 'Action failed. Please refresh the page and retry.', 'woocommerce-gateway-stripe' ) );
215
+		if (isset($_GET['wc-stripe-hide-notice']) && isset($_GET['_wc_stripe_notice_nonce'])) {
216
+			if ( ! wp_verify_nonce($_GET['_wc_stripe_notice_nonce'], 'wc_stripe_hide_notices_nonce')) {
217
+				wp_die(__('Action failed. Please refresh the page and retry.', 'woocommerce-gateway-stripe'));
218 218
 			}
219 219
 
220
-			if ( ! current_user_can( 'manage_woocommerce' ) ) {
221
-				wp_die( __( 'Cheatin&#8217; huh?', 'woocommerce-gateway-stripe' ) );
220
+			if ( ! current_user_can('manage_woocommerce')) {
221
+				wp_die(__('Cheatin&#8217; huh?', 'woocommerce-gateway-stripe'));
222 222
 			}
223 223
 
224
-			$notice = wc_clean( $_GET['wc-stripe-hide-notice'] );
224
+			$notice = wc_clean($_GET['wc-stripe-hide-notice']);
225 225
 
226
-			switch ( $notice ) {
226
+			switch ($notice) {
227 227
 				case 'phpver':
228
-					update_option( 'wc_stripe_show_phpver_notice', 'no' );
228
+					update_option('wc_stripe_show_phpver_notice', 'no');
229 229
 					break;
230 230
 				case 'wcver':
231
-					update_option( 'wc_stripe_show_wcver_notice', 'no' );
231
+					update_option('wc_stripe_show_wcver_notice', 'no');
232 232
 					break;
233 233
 				case 'curl':
234
-					update_option( 'wc_stripe_show_curl_notice', 'no' );
234
+					update_option('wc_stripe_show_curl_notice', 'no');
235 235
 					break;
236 236
 				case 'ssl':
237
-					update_option( 'wc_stripe_show_ssl_notice', 'no' );
237
+					update_option('wc_stripe_show_ssl_notice', 'no');
238 238
 					break;
239 239
 				case 'keys':
240
-					update_option( 'wc_stripe_show_keys_notice', 'no' );
240
+					update_option('wc_stripe_show_keys_notice', 'no');
241 241
 					break;
242 242
 				case 'Alipay':
243
-					update_option( 'wc_stripe_show_alipay_notice', 'no' );
243
+					update_option('wc_stripe_show_alipay_notice', 'no');
244 244
 					break;
245 245
 				case 'Bancontact':
246
-					update_option( 'wc_stripe_show_bancontact_notice', 'no' );
246
+					update_option('wc_stripe_show_bancontact_notice', 'no');
247 247
 					break;
248 248
 				case 'EPS':
249
-					update_option( 'wc_stripe_show_eps_notice', 'no' );
249
+					update_option('wc_stripe_show_eps_notice', 'no');
250 250
 					break;
251 251
 				case 'Giropay':
252
-					update_option( 'wc_stripe_show_giropay_notice', 'no' );
252
+					update_option('wc_stripe_show_giropay_notice', 'no');
253 253
 					break;
254 254
 				case 'iDeal':
255
-					update_option( 'wc_stripe_show_ideal_notice', 'no' );
255
+					update_option('wc_stripe_show_ideal_notice', 'no');
256 256
 					break;
257 257
 				case 'Multibanco':
258
-					update_option( 'wc_stripe_show_multibanco_notice', 'no' );
258
+					update_option('wc_stripe_show_multibanco_notice', 'no');
259 259
 					break;
260 260
 				case 'P24':
261
-					update_option( 'wc_stripe_show_p24_notice', 'no' );
261
+					update_option('wc_stripe_show_p24_notice', 'no');
262 262
 					break;
263 263
 				case 'SEPA':
264
-					update_option( 'wc_stripe_show_sepa_notice', 'no' );
264
+					update_option('wc_stripe_show_sepa_notice', 'no');
265 265
 					break;
266 266
 				case 'SOFORT':
267
-					update_option( 'wc_stripe_show_sofort_notice', 'no' );
267
+					update_option('wc_stripe_show_sofort_notice', 'no');
268 268
 					break;
269 269
 			}
270 270
 		}
@@ -278,11 +278,11 @@  discard block
 block discarded – undo
278 278
 	 * @return string Setting link
279 279
 	 */
280 280
 	public function get_setting_link() {
281
-		$use_id_as_section = function_exists( 'WC' ) ? version_compare( WC()->version, '2.6', '>=' ) : false;
281
+		$use_id_as_section = function_exists('WC') ? version_compare(WC()->version, '2.6', '>=') : false;
282 282
 
283
-		$section_slug = $use_id_as_section ? 'stripe' : strtolower( 'WC_Gateway_Stripe' );
283
+		$section_slug = $use_id_as_section ? 'stripe' : strtolower('WC_Gateway_Stripe');
284 284
 
285
-		return admin_url( 'admin.php?page=wc-settings&tab=checkout&section=' . $section_slug );
285
+		return admin_url('admin.php?page=wc-settings&tab=checkout&section=' . $section_slug);
286 286
 	}
287 287
 }
288 288
 
Please login to merge, or discard this patch.
woocommerce-gateway-stripe.php 1 patch
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  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
 
@@ -27,29 +27,29 @@  discard block
 block discarded – undo
27 27
  */
28 28
 function woocommerce_stripe_missing_wc_notice() {
29 29
 	/* translators: 1. URL link. */
30
-	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>';
30
+	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>';
31 31
 }
32 32
 
33
-add_action( 'plugins_loaded', 'woocommerce_gateway_stripe_init' );
33
+add_action('plugins_loaded', 'woocommerce_gateway_stripe_init');
34 34
 
35 35
 function woocommerce_gateway_stripe_init() {
36
-	load_plugin_textdomain( 'woocommerce-gateway-stripe', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
36
+	load_plugin_textdomain('woocommerce-gateway-stripe', false, plugin_basename(dirname(__FILE__)) . '/languages');
37 37
 
38
-	if ( ! class_exists( 'WooCommerce' ) ) {
39
-		add_action( 'admin_notices', 'woocommerce_stripe_missing_wc_notice' );
38
+	if ( ! class_exists('WooCommerce')) {
39
+		add_action('admin_notices', 'woocommerce_stripe_missing_wc_notice');
40 40
 		return;
41 41
 	}
42 42
 
43
-	if ( ! class_exists( 'WC_Stripe' ) ) :
43
+	if ( ! class_exists('WC_Stripe')) :
44 44
 		/**
45 45
 		 * Required minimums and constants
46 46
 		 */
47
-		define( 'WC_STRIPE_VERSION', '4.1.6' );
48
-		define( 'WC_STRIPE_MIN_PHP_VER', '5.6.0' );
49
-		define( 'WC_STRIPE_MIN_WC_VER', '2.6.0' );
50
-		define( 'WC_STRIPE_MAIN_FILE', __FILE__ );
51
-		define( 'WC_STRIPE_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
52
-		define( 'WC_STRIPE_PLUGIN_PATH', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
47
+		define('WC_STRIPE_VERSION', '4.1.6');
48
+		define('WC_STRIPE_MIN_PHP_VER', '5.6.0');
49
+		define('WC_STRIPE_MIN_WC_VER', '2.6.0');
50
+		define('WC_STRIPE_MAIN_FILE', __FILE__);
51
+		define('WC_STRIPE_PLUGIN_URL', untrailingslashit(plugins_url(basename(plugin_dir_path(__FILE__)), basename(__FILE__))));
52
+		define('WC_STRIPE_PLUGIN_PATH', untrailingslashit(plugin_dir_path(__FILE__)));
53 53
 
54 54
 		class WC_Stripe {
55 55
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 			 * @return Singleton The *Singleton* instance.
70 70
 			 */
71 71
 			public static function get_instance() {
72
-				if ( null === self::$instance ) {
72
+				if (null === self::$instance) {
73 73
 					self::$instance = new self();
74 74
 				}
75 75
 				return self::$instance;
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 			 * *Singleton* via the `new` operator from outside of this class.
97 97
 			 */
98 98
 			private function __construct() {
99
-				add_action( 'admin_init', array( $this, 'install' ) );
99
+				add_action('admin_init', array($this, 'install'));
100 100
 				$this->init();
101 101
 			}
102 102
 
@@ -107,48 +107,48 @@  discard block
 block discarded – undo
107 107
 			 * @version 4.0.0
108 108
 			 */
109 109
 			public function init() {
110
-				if ( is_admin() ) {
111
-					require_once( dirname( __FILE__ ) . '/includes/admin/class-wc-stripe-privacy.php' );
110
+				if (is_admin()) {
111
+					require_once(dirname(__FILE__) . '/includes/admin/class-wc-stripe-privacy.php');
112 112
 				}
113 113
 
114
-				require_once( dirname( __FILE__ ) . '/includes/class-wc-stripe-exception.php' );
115
-				require_once( dirname( __FILE__ ) . '/includes/class-wc-stripe-logger.php' );
116
-				require_once( dirname( __FILE__ ) . '/includes/class-wc-stripe-helper.php' );
117
-				include_once( dirname( __FILE__ ) . '/includes/class-wc-stripe-api.php' );
118
-				require_once( dirname( __FILE__ ) . '/includes/abstracts/abstract-wc-stripe-payment-gateway.php' );
119
-				require_once( dirname( __FILE__ ) . '/includes/class-wc-stripe-webhook-handler.php' );
120
-				require_once( dirname( __FILE__ ) . '/includes/class-wc-stripe-sepa-payment-token.php' );
121
-				require_once( dirname( __FILE__ ) . '/includes/class-wc-stripe-apple-pay-registration.php' );
122
-				require_once( dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-pre-orders-compat.php' );
123
-				require_once( dirname( __FILE__ ) . '/includes/class-wc-gateway-stripe.php' );
124
-				require_once( dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-bancontact.php' );
125
-				require_once( dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-sofort.php' );
126
-				require_once( dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-giropay.php' );
127
-				require_once( dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-eps.php' );
128
-				require_once( dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-ideal.php' );
129
-				require_once( dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-p24.php' );
130
-				require_once( dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-alipay.php' );
131
-				require_once( dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-sepa.php' );
132
-				require_once( dirname( __FILE__ ) . '/includes/payment-methods/class-wc-gateway-stripe-multibanco.php' );
133
-				require_once( dirname( __FILE__ ) . '/includes/payment-methods/class-wc-stripe-payment-request.php' );
134
-				require_once( dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-subs-compat.php' );
135
-				require_once( dirname( __FILE__ ) . '/includes/compat/class-wc-stripe-sepa-subs-compat.php' );
136
-				require_once( dirname( __FILE__ ) . '/includes/class-wc-stripe-order-handler.php' );
137
-				require_once( dirname( __FILE__ ) . '/includes/class-wc-stripe-payment-tokens.php' );
138
-				require_once( dirname( __FILE__ ) . '/includes/class-wc-stripe-customer.php' );
139
-
140
-				if ( is_admin() ) {
141
-					require_once( dirname( __FILE__ ) . '/includes/admin/class-wc-stripe-admin-notices.php' );
114
+				require_once(dirname(__FILE__) . '/includes/class-wc-stripe-exception.php');
115
+				require_once(dirname(__FILE__) . '/includes/class-wc-stripe-logger.php');
116
+				require_once(dirname(__FILE__) . '/includes/class-wc-stripe-helper.php');
117
+				include_once(dirname(__FILE__) . '/includes/class-wc-stripe-api.php');
118
+				require_once(dirname(__FILE__) . '/includes/abstracts/abstract-wc-stripe-payment-gateway.php');
119
+				require_once(dirname(__FILE__) . '/includes/class-wc-stripe-webhook-handler.php');
120
+				require_once(dirname(__FILE__) . '/includes/class-wc-stripe-sepa-payment-token.php');
121
+				require_once(dirname(__FILE__) . '/includes/class-wc-stripe-apple-pay-registration.php');
122
+				require_once(dirname(__FILE__) . '/includes/compat/class-wc-stripe-pre-orders-compat.php');
123
+				require_once(dirname(__FILE__) . '/includes/class-wc-gateway-stripe.php');
124
+				require_once(dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-bancontact.php');
125
+				require_once(dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-sofort.php');
126
+				require_once(dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-giropay.php');
127
+				require_once(dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-eps.php');
128
+				require_once(dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-ideal.php');
129
+				require_once(dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-p24.php');
130
+				require_once(dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-alipay.php');
131
+				require_once(dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-sepa.php');
132
+				require_once(dirname(__FILE__) . '/includes/payment-methods/class-wc-gateway-stripe-multibanco.php');
133
+				require_once(dirname(__FILE__) . '/includes/payment-methods/class-wc-stripe-payment-request.php');
134
+				require_once(dirname(__FILE__) . '/includes/compat/class-wc-stripe-subs-compat.php');
135
+				require_once(dirname(__FILE__) . '/includes/compat/class-wc-stripe-sepa-subs-compat.php');
136
+				require_once(dirname(__FILE__) . '/includes/class-wc-stripe-order-handler.php');
137
+				require_once(dirname(__FILE__) . '/includes/class-wc-stripe-payment-tokens.php');
138
+				require_once(dirname(__FILE__) . '/includes/class-wc-stripe-customer.php');
139
+
140
+				if (is_admin()) {
141
+					require_once(dirname(__FILE__) . '/includes/admin/class-wc-stripe-admin-notices.php');
142 142
 				}
143 143
 
144 144
 				// REMOVE IN THE FUTURE.
145
-				require_once( dirname( __FILE__ ) . '/includes/deprecated/class-wc-stripe-apple-pay.php' );
145
+				require_once(dirname(__FILE__) . '/includes/deprecated/class-wc-stripe-apple-pay.php');
146 146
 
147
-				add_filter( 'woocommerce_payment_gateways', array( $this, 'add_gateways' ) );
148
-				add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugin_action_links' ) );
147
+				add_filter('woocommerce_payment_gateways', array($this, 'add_gateways'));
148
+				add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($this, 'plugin_action_links'));
149 149
 
150
-				if ( version_compare( WC_VERSION, '3.4', '<' ) ) {
151
-					add_filter( 'woocommerce_get_sections_checkout', array( $this, 'filter_gateway_order_admin' ) );
150
+				if (version_compare(WC_VERSION, '3.4', '<')) {
151
+					add_filter('woocommerce_get_sections_checkout', array($this, 'filter_gateway_order_admin'));
152 152
 				}
153 153
 			}
154 154
 
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
 			 * @version 4.0.0
160 160
 			 */
161 161
 			public function update_plugin_version() {
162
-				delete_option( 'wc_stripe_version' );
163
-				update_option( 'wc_stripe_version', WC_STRIPE_VERSION );
162
+				delete_option('wc_stripe_version');
163
+				update_option('wc_stripe_version', WC_STRIPE_VERSION);
164 164
 			}
165 165
 
166 166
 			/**
@@ -170,15 +170,15 @@  discard block
 block discarded – undo
170 170
 			 * @version 3.1.0
171 171
 			 */
172 172
 			public function install() {
173
-				if ( ! is_plugin_active( plugin_basename( __FILE__ ) ) ) {
173
+				if ( ! is_plugin_active(plugin_basename(__FILE__))) {
174 174
 					return;
175 175
 				}
176 176
 
177
-				if ( ! defined( 'IFRAME_REQUEST' ) && ( WC_STRIPE_VERSION !== get_option( 'wc_stripe_version' ) ) ) {
178
-					do_action( 'woocommerce_stripe_updated' );
177
+				if ( ! defined('IFRAME_REQUEST') && (WC_STRIPE_VERSION !== get_option('wc_stripe_version'))) {
178
+					do_action('woocommerce_stripe_updated');
179 179
 
180
-					if ( ! defined( 'WC_STRIPE_INSTALLING' ) ) {
181
-						define( 'WC_STRIPE_INSTALLING', true );
180
+					if ( ! defined('WC_STRIPE_INSTALLING')) {
181
+						define('WC_STRIPE_INSTALLING', true);
182 182
 					}
183 183
 
184 184
 					$this->update_plugin_version();
@@ -191,13 +191,13 @@  discard block
 block discarded – undo
191 191
 			 * @since 1.0.0
192 192
 			 * @version 4.0.0
193 193
 			 */
194
-			public function plugin_action_links( $links ) {
194
+			public function plugin_action_links($links) {
195 195
 				$plugin_links = array(
196
-					'<a href="admin.php?page=wc-settings&tab=checkout&section=stripe">' . esc_html__( 'Settings', 'woocommerce-gateway-stripe' ) . '</a>',
197
-					'<a href="https://docs.woocommerce.com/document/stripe/">' . esc_html__( 'Docs', 'woocommerce-gateway-stripe' ) . '</a>',
198
-					'<a href="https://woocommerce.com/contact-us/">' . esc_html__( 'Support', 'woocommerce-gateway-stripe' ) . '</a>',
196
+					'<a href="admin.php?page=wc-settings&tab=checkout&section=stripe">' . esc_html__('Settings', 'woocommerce-gateway-stripe') . '</a>',
197
+					'<a href="https://docs.woocommerce.com/document/stripe/">' . esc_html__('Docs', 'woocommerce-gateway-stripe') . '</a>',
198
+					'<a href="https://woocommerce.com/contact-us/">' . esc_html__('Support', 'woocommerce-gateway-stripe') . '</a>',
199 199
 				);
200
-				return array_merge( $plugin_links, $links );
200
+				return array_merge($plugin_links, $links);
201 201
 			}
202 202
 
203 203
 			/**
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
 			 * @since 1.0.0
207 207
 			 * @version 4.0.0
208 208
 			 */
209
-			public function add_gateways( $methods ) {
210
-				if ( class_exists( 'WC_Subscriptions_Order' ) && function_exists( 'wcs_create_renewal_order' ) ) {
209
+			public function add_gateways($methods) {
210
+				if (class_exists('WC_Subscriptions_Order') && function_exists('wcs_create_renewal_order')) {
211 211
 					$methods[] = 'WC_Stripe_Subs_Compat';
212 212
 					$methods[] = 'WC_Stripe_Sepa_Subs_Compat';
213 213
 				} else {
@@ -233,28 +233,28 @@  discard block
 block discarded – undo
233 233
 			 * @since 4.0.0
234 234
 			 * @version 4.0.0
235 235
 			 */
236
-			public function filter_gateway_order_admin( $sections ) {
237
-				unset( $sections['stripe'] );
238
-				unset( $sections['stripe_bancontact'] );
239
-				unset( $sections['stripe_sofort'] );
240
-				unset( $sections['stripe_giropay'] );
241
-				unset( $sections['stripe_eps'] );
242
-				unset( $sections['stripe_ideal'] );
243
-				unset( $sections['stripe_p24'] );
244
-				unset( $sections['stripe_alipay'] );
245
-				unset( $sections['stripe_sepa'] );
246
-				unset( $sections['stripe_multibanco'] );
236
+			public function filter_gateway_order_admin($sections) {
237
+				unset($sections['stripe']);
238
+				unset($sections['stripe_bancontact']);
239
+				unset($sections['stripe_sofort']);
240
+				unset($sections['stripe_giropay']);
241
+				unset($sections['stripe_eps']);
242
+				unset($sections['stripe_ideal']);
243
+				unset($sections['stripe_p24']);
244
+				unset($sections['stripe_alipay']);
245
+				unset($sections['stripe_sepa']);
246
+				unset($sections['stripe_multibanco']);
247 247
 
248 248
 				$sections['stripe']            = 'Stripe';
249
-				$sections['stripe_bancontact'] = __( 'Stripe Bancontact', 'woocommerce-gateway-stripe' );
250
-				$sections['stripe_sofort']     = __( 'Stripe SOFORT', 'woocommerce-gateway-stripe' );
251
-				$sections['stripe_giropay']    = __( 'Stripe Giropay', 'woocommerce-gateway-stripe' );
252
-				$sections['stripe_eps']        = __( 'Stripe EPS', 'woocommerce-gateway-stripe' );
253
-				$sections['stripe_ideal']      = __( 'Stripe iDeal', 'woocommerce-gateway-stripe' );
254
-				$sections['stripe_p24']        = __( 'Stripe P24', 'woocommerce-gateway-stripe' );
255
-				$sections['stripe_alipay']     = __( 'Stripe Alipay', 'woocommerce-gateway-stripe' );
256
-				$sections['stripe_sepa']       = __( 'Stripe SEPA Direct Debit', 'woocommerce-gateway-stripe' );
257
-				$sections['stripe_multibanco'] = __( 'Stripe Multibanco', 'woocommerce-gateway-stripe' );
249
+				$sections['stripe_bancontact'] = __('Stripe Bancontact', 'woocommerce-gateway-stripe');
250
+				$sections['stripe_sofort']     = __('Stripe SOFORT', 'woocommerce-gateway-stripe');
251
+				$sections['stripe_giropay']    = __('Stripe Giropay', 'woocommerce-gateway-stripe');
252
+				$sections['stripe_eps']        = __('Stripe EPS', 'woocommerce-gateway-stripe');
253
+				$sections['stripe_ideal']      = __('Stripe iDeal', 'woocommerce-gateway-stripe');
254
+				$sections['stripe_p24']        = __('Stripe P24', 'woocommerce-gateway-stripe');
255
+				$sections['stripe_alipay']     = __('Stripe Alipay', 'woocommerce-gateway-stripe');
256
+				$sections['stripe_sepa']       = __('Stripe SEPA Direct Debit', 'woocommerce-gateway-stripe');
257
+				$sections['stripe_multibanco'] = __('Stripe Multibanco', 'woocommerce-gateway-stripe');
258 258
 
259 259
 				return $sections;
260 260
 			}
Please login to merge, or discard this patch.