Completed
Push — master ( 13af8d...f5fd58 )
by Roy
02:49
created
includes/admin/stripe-ideal-settings.php 1 patch
Spacing   +13 added lines, -13 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,40 +7,40 @@  discard block
 block discarded – undo
7 7
 	'wc_stripe_ideal_settings',
8 8
 	array(
9 9
 		'geo_target'  => array(
10
-			'description' => __( 'Relevant Payer Geography: The Netherlands', 'woocommerce-gateway-stripe' ),
10
+			'description' => __('Relevant Payer Geography: The Netherlands', 'woocommerce-gateway-stripe'),
11 11
 			'type'        => 'title',
12 12
 		),
13 13
 		'guide'       => array(
14
-			'description' => __( '<a href="https://stripe.com/payments/payment-methods-guide#ideal" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe' ),
14
+			'description' => __('<a href="https://stripe.com/payments/payment-methods-guide#ideal" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe'),
15 15
 			'type'        => 'title',
16 16
 		),
17 17
 		'activation'  => array(
18
-			'description' => __( 'Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe' ),
18
+			'description' => __('Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe'),
19 19
 			'type'        => 'title',
20 20
 		),
21 21
 		'enabled'     => array(
22
-			'title'       => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ),
23
-			'label'       => __( 'Enable Stripe iDeal', 'woocommerce-gateway-stripe' ),
22
+			'title'       => __('Enable/Disable', 'woocommerce-gateway-stripe'),
23
+			'label'       => __('Enable Stripe iDeal', 'woocommerce-gateway-stripe'),
24 24
 			'type'        => 'checkbox',
25 25
 			'description' => '',
26 26
 			'default'     => 'no',
27 27
 		),
28 28
 		'title'       => array(
29
-			'title'       => __( 'Title', 'woocommerce-gateway-stripe' ),
29
+			'title'       => __('Title', 'woocommerce-gateway-stripe'),
30 30
 			'type'        => 'text',
31
-			'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
32
-			'default'     => __( 'iDeal', 'woocommerce-gateway-stripe' ),
31
+			'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'),
32
+			'default'     => __('iDeal', 'woocommerce-gateway-stripe'),
33 33
 			'desc_tip'    => true,
34 34
 		),
35 35
 		'description' => array(
36
-			'title'       => __( 'Description', 'woocommerce-gateway-stripe' ),
36
+			'title'       => __('Description', 'woocommerce-gateway-stripe'),
37 37
 			'type'        => 'text',
38
-			'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
39
-			'default'     => __( 'You will be redirected to iDeal.', 'woocommerce-gateway-stripe' ),
38
+			'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'),
39
+			'default'     => __('You will be redirected to iDeal.', 'woocommerce-gateway-stripe'),
40 40
 			'desc_tip'    => true,
41 41
 		),
42 42
 		'webhook'     => array(
43
-			'title'       => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ),
43
+			'title'       => __('Webhook Endpoints', 'woocommerce-gateway-stripe'),
44 44
 			'type'        => 'title',
45 45
 			/* translators: webhook URL */
46 46
 			'description' => $this->display_admin_settings_webhook_description(),
Please login to merge, or discard this patch.
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,83 +99,83 @@  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
 						$setting_link = $this->get_setting_link();
159 159
 						/* translators: 1) link */
160
-						$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 );
160
+						$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 161
 					}
162 162
 				} else {
163 163
 					if (
164
-						! empty( $live_pub_key ) && ! preg_match( '/^pk_live_/', $live_pub_key )
165
-						|| ( ! empty( $live_secret_key ) && ! preg_match( '/^sk_live_/', $live_secret_key )
166
-						&& ! empty( $live_secret_key ) && ! preg_match( '/^rk_live_/', $live_secret_key ) ) ) {
164
+						! empty($live_pub_key) && ! preg_match('/^pk_live_/', $live_pub_key)
165
+						|| ( ! empty($live_secret_key) && ! preg_match('/^sk_live_/', $live_secret_key)
166
+						&& ! empty($live_secret_key) && ! preg_match('/^rk_live_/', $live_secret_key)) ) {
167 167
 						$setting_link = $this->get_setting_link();
168 168
 						/* translators: 1) link */
169
-						$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 );
169
+						$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);
170 170
 					}
171 171
 				}
172 172
 			}
173 173
 
174
-			if ( empty( $show_ssl_notice ) ) {
174
+			if (empty($show_ssl_notice)) {
175 175
 				// Show message if enabled and FORCE SSL is disabled and WordpressHTTPS plugin is not detected.
176
-				if ( ! wc_checkout_is_https() ) {
176
+				if ( ! wc_checkout_is_https()) {
177 177
 					/* translators: 1) link */
178
-					$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 );
178
+					$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);
179 179
 				}
180 180
 			}
181 181
 		}
@@ -189,17 +189,17 @@  discard block
 block discarded – undo
189 189
 	public function payment_methods_check_environment() {
190 190
 		$payment_methods = $this->get_payment_methods();
191 191
 
192
-		foreach ( $payment_methods as $method => $class ) {
193
-			$show_notice = get_option( 'wc_stripe_show_' . strtolower( $method ) . '_notice' );
192
+		foreach ($payment_methods as $method => $class) {
193
+			$show_notice = get_option('wc_stripe_show_' . strtolower($method) . '_notice');
194 194
 			$gateway     = new $class();
195 195
 
196
-			if ( 'yes' !== $gateway->enabled || 'no' === $show_notice ) {
196
+			if ('yes' !== $gateway->enabled || 'no' === $show_notice) {
197 197
 				continue;
198 198
 			}
199 199
 
200
-			if ( ! in_array( get_woocommerce_currency(), $gateway->get_supported_currency() ) ) {
200
+			if ( ! in_array(get_woocommerce_currency(), $gateway->get_supported_currency())) {
201 201
 				/* translators: %1$s Payment method, %2$s List of supported currencies */
202
-				$this->add_admin_notice( $method, 'notice notice-error', sprintf( __( '%1$s is enabled - it requires store currency to be set to %2$s', 'woocommerce-gateway-stripe' ), $method, implode( ', ', $gateway->get_supported_currency() ) ), true );
202
+				$this->add_admin_notice($method, 'notice notice-error', sprintf(__('%1$s is enabled - it requires store currency to be set to %2$s', 'woocommerce-gateway-stripe'), $method, implode(', ', $gateway->get_supported_currency())), true);
203 203
 			}
204 204
 		}
205 205
 	}
@@ -211,59 +211,59 @@  discard block
 block discarded – undo
211 211
 	 * @version 4.0.0
212 212
 	 */
213 213
 	public function hide_notices() {
214
-		if ( isset( $_GET['wc-stripe-hide-notice'] ) && isset( $_GET['_wc_stripe_notice_nonce'] ) ) {
215
-			if ( ! wp_verify_nonce( $_GET['_wc_stripe_notice_nonce'], 'wc_stripe_hide_notices_nonce' ) ) {
216
-				wp_die( __( 'Action failed. Please refresh the page and retry.', 'woocommerce-gateway-stripe' ) );
214
+		if (isset($_GET['wc-stripe-hide-notice']) && isset($_GET['_wc_stripe_notice_nonce'])) {
215
+			if ( ! wp_verify_nonce($_GET['_wc_stripe_notice_nonce'], 'wc_stripe_hide_notices_nonce')) {
216
+				wp_die(__('Action failed. Please refresh the page and retry.', 'woocommerce-gateway-stripe'));
217 217
 			}
218 218
 
219
-			if ( ! current_user_can( 'manage_woocommerce' ) ) {
220
-				wp_die( __( 'Cheatin&#8217; huh?', 'woocommerce-gateway-stripe' ) );
219
+			if ( ! current_user_can('manage_woocommerce')) {
220
+				wp_die(__('Cheatin&#8217; huh?', 'woocommerce-gateway-stripe'));
221 221
 			}
222 222
 
223
-			$notice = wc_clean( $_GET['wc-stripe-hide-notice'] );
223
+			$notice = wc_clean($_GET['wc-stripe-hide-notice']);
224 224
 
225
-			switch ( $notice ) {
225
+			switch ($notice) {
226 226
 				case 'phpver':
227
-					update_option( 'wc_stripe_show_phpver_notice', 'no' );
227
+					update_option('wc_stripe_show_phpver_notice', 'no');
228 228
 					break;
229 229
 				case 'wcver':
230
-					update_option( 'wc_stripe_show_wcver_notice', 'no' );
230
+					update_option('wc_stripe_show_wcver_notice', 'no');
231 231
 					break;
232 232
 				case 'curl':
233
-					update_option( 'wc_stripe_show_curl_notice', 'no' );
233
+					update_option('wc_stripe_show_curl_notice', 'no');
234 234
 					break;
235 235
 				case 'ssl':
236
-					update_option( 'wc_stripe_show_ssl_notice', 'no' );
236
+					update_option('wc_stripe_show_ssl_notice', 'no');
237 237
 					break;
238 238
 				case 'keys':
239
-					update_option( 'wc_stripe_show_keys_notice', 'no' );
239
+					update_option('wc_stripe_show_keys_notice', 'no');
240 240
 					break;
241 241
 				case 'Alipay':
242
-					update_option( 'wc_stripe_show_alipay_notice', 'no' );
242
+					update_option('wc_stripe_show_alipay_notice', 'no');
243 243
 					break;
244 244
 				case 'Bancontact':
245
-					update_option( 'wc_stripe_show_bancontact_notice', 'no' );
245
+					update_option('wc_stripe_show_bancontact_notice', 'no');
246 246
 					break;
247 247
 				case 'EPS':
248
-					update_option( 'wc_stripe_show_eps_notice', 'no' );
248
+					update_option('wc_stripe_show_eps_notice', 'no');
249 249
 					break;
250 250
 				case 'Giropay':
251
-					update_option( 'wc_stripe_show_giropay_notice', 'no' );
251
+					update_option('wc_stripe_show_giropay_notice', 'no');
252 252
 					break;
253 253
 				case 'iDeal':
254
-					update_option( 'wc_stripe_show_ideal_notice', 'no' );
254
+					update_option('wc_stripe_show_ideal_notice', 'no');
255 255
 					break;
256 256
 				case 'Multibanco':
257
-					update_option( 'wc_stripe_show_multibanco_notice', 'no' );
257
+					update_option('wc_stripe_show_multibanco_notice', 'no');
258 258
 					break;
259 259
 				case 'P24':
260
-					update_option( 'wc_stripe_show_p24_notice', 'no' );
260
+					update_option('wc_stripe_show_p24_notice', 'no');
261 261
 					break;
262 262
 				case 'SEPA':
263
-					update_option( 'wc_stripe_show_sepa_notice', 'no' );
263
+					update_option('wc_stripe_show_sepa_notice', 'no');
264 264
 					break;
265 265
 				case 'SOFORT':
266
-					update_option( 'wc_stripe_show_sofort_notice', 'no' );
266
+					update_option('wc_stripe_show_sofort_notice', 'no');
267 267
 					break;
268 268
 			}
269 269
 		}
@@ -277,11 +277,11 @@  discard block
 block discarded – undo
277 277
 	 * @return string Setting link
278 278
 	 */
279 279
 	public function get_setting_link() {
280
-		$use_id_as_section = function_exists( 'WC' ) ? version_compare( WC()->version, '2.6', '>=' ) : false;
280
+		$use_id_as_section = function_exists('WC') ? version_compare(WC()->version, '2.6', '>=') : false;
281 281
 
282
-		$section_slug = $use_id_as_section ? 'stripe' : strtolower( 'WC_Gateway_Stripe' );
282
+		$section_slug = $use_id_as_section ? 'stripe' : strtolower('WC_Gateway_Stripe');
283 283
 
284
-		return admin_url( 'admin.php?page=wc-settings&tab=checkout&section=' . $section_slug );
284
+		return admin_url('admin.php?page=wc-settings&tab=checkout&section=' . $section_slug);
285 285
 	}
286 286
 }
287 287
 
Please login to merge, or discard this patch.
includes/admin/stripe-settings.php 1 patch
Spacing   +62 added lines, -62 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,176 +7,176 @@  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'        => 'password',
47
-			'description' => __( 'Get your API keys from your stripe account.', 'woocommerce-gateway-stripe' ),
47
+			'description' => __('Get your API keys from your stripe account.', '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.', 'woocommerce-gateway-stripe' ),
54
+			'description' => __('Get your API keys from your stripe account.', 'woocommerce-gateway-stripe'),
55 55
 			'default'     => '',
56 56
 			'desc_tip'    => true,
57 57
 		),
58 58
 		'publishable_key'               => array(
59
-			'title'       => __( 'Live Publishable Key', 'woocommerce-gateway-stripe' ),
59
+			'title'       => __('Live Publishable Key', 'woocommerce-gateway-stripe'),
60 60
 			'type'        => 'password',
61
-			'description' => __( 'Get your API keys from your stripe account.', 'woocommerce-gateway-stripe' ),
61
+			'description' => __('Get your API keys from your stripe account.', 'woocommerce-gateway-stripe'),
62 62
 			'default'     => '',
63 63
 			'desc_tip'    => true,
64 64
 		),
65 65
 		'secret_key'                    => array(
66
-			'title'       => __( 'Live Secret Key', 'woocommerce-gateway-stripe' ),
66
+			'title'       => __('Live Secret Key', 'woocommerce-gateway-stripe'),
67 67
 			'type'        => 'password',
68
-			'description' => __( 'Get your API keys from your stripe account.', 'woocommerce-gateway-stripe' ),
68
+			'description' => __('Get your API keys from your stripe account.', 'woocommerce-gateway-stripe'),
69 69
 			'default'     => '',
70 70
 			'desc_tip'    => true,
71 71
 		),
72 72
 		'inline_cc_form'                => array(
73
-			'title'       => __( 'Inline Credit Card Form', 'woocommerce-gateway-stripe' ),
73
+			'title'       => __('Inline Credit Card Form', 'woocommerce-gateway-stripe'),
74 74
 			'type'        => 'checkbox',
75
-			'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' ),
75
+			'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'),
76 76
 			'default'     => 'no',
77 77
 			'desc_tip'    => true,
78 78
 		),
79 79
 		'statement_descriptor'          => array(
80
-			'title'       => __( 'Statement Descriptor', 'woocommerce-gateway-stripe' ),
80
+			'title'       => __('Statement Descriptor', 'woocommerce-gateway-stripe'),
81 81
 			'type'        => 'text',
82
-			'description' => __( 'This may be up to 22 characters. The statement description must contain at least one letter, may not include ><"\' characters, and will appear on your customer\'s statement in capital letters.', 'woocommerce-gateway-stripe' ),
82
+			'description' => __('This may be up to 22 characters. The statement description must contain at least one letter, may not include ><"\' characters, and will appear on your customer\'s statement in capital letters.', 'woocommerce-gateway-stripe'),
83 83
 			'default'     => '',
84 84
 			'desc_tip'    => true,
85 85
 		),
86 86
 		'capture'                       => array(
87
-			'title'       => __( 'Capture', 'woocommerce-gateway-stripe' ),
88
-			'label'       => __( 'Capture charge immediately', 'woocommerce-gateway-stripe' ),
87
+			'title'       => __('Capture', 'woocommerce-gateway-stripe'),
88
+			'label'       => __('Capture charge immediately', 'woocommerce-gateway-stripe'),
89 89
 			'type'        => 'checkbox',
90
-			'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' ),
90
+			'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'),
91 91
 			'default'     => 'yes',
92 92
 			'desc_tip'    => true,
93 93
 		),
94 94
 		'three_d_secure'                => array(
95
-			'title'       => __( '3D Secure', 'woocommerce-gateway-stripe' ),
96
-			'label'       => __( 'Require 3D Secure when applicable', 'woocommerce-gateway-stripe' ),
95
+			'title'       => __('3D Secure', 'woocommerce-gateway-stripe'),
96
+			'label'       => __('Require 3D Secure when applicable', 'woocommerce-gateway-stripe'),
97 97
 			'type'        => 'checkbox',
98
-			'description' => __( 'Some payment methods have 3D Secure feature. This is an extra security layer for your store. Choose how to handle payments when 3D Secure is recommended. Enabling would require customers to use 3D Secure when recommended.', 'woocommerce-gateway-stripe' ),
98
+			'description' => __('Some payment methods have 3D Secure feature. This is an extra security layer for your store. Choose how to handle payments when 3D Secure is recommended. Enabling would require customers to use 3D Secure when recommended.', 'woocommerce-gateway-stripe'),
99 99
 			'default'     => 'yes',
100 100
 			'desc_tip'    => true,
101 101
 		),
102 102
 		'stripe_checkout'               => array(
103
-			'title'       => __( 'Stripe Modal Checkout', 'woocommerce-gateway-stripe' ),
104
-			'label'       => __( 'Enable Stripe Checkout', 'woocommerce-gateway-stripe' ),
103
+			'title'       => __('Stripe Modal Checkout', 'woocommerce-gateway-stripe'),
104
+			'label'       => __('Enable Stripe Checkout', 'woocommerce-gateway-stripe'),
105 105
 			'type'        => 'checkbox',
106
-			'description' => __( 'If enabled, this option shows a "pay" button and modal credit card form on the checkout, instead of credit card fields directly on the page. We recommend you leave this disabled and use the embedded form as that is the preferred method.', 'woocommerce-gateway-stripe' ),
106
+			'description' => __('If enabled, this option shows a "pay" button and modal credit card form on the checkout, instead of credit card fields directly on the page. We recommend you leave this disabled and use the embedded form as that is the preferred method.', 'woocommerce-gateway-stripe'),
107 107
 			'default'     => 'no',
108 108
 			'desc_tip'    => true,
109 109
 		),
110 110
 		'stripe_checkout_image'         => array(
111
-			'title'       => __( 'Stripe Checkout Image', 'woocommerce-gateway-stripe' ),
112
-			'description' => __( 'Optionally enter the URL to a 128x128px image of your brand or product. e.g. <code>https://yoursite.com/wp-content/uploads/2013/09/yourimage.jpg</code>', 'woocommerce-gateway-stripe' ),
111
+			'title'       => __('Stripe Checkout Image', 'woocommerce-gateway-stripe'),
112
+			'description' => __('Optionally enter the URL to a 128x128px image of your brand or product. e.g. <code>https://yoursite.com/wp-content/uploads/2013/09/yourimage.jpg</code>', 'woocommerce-gateway-stripe'),
113 113
 			'type'        => 'text',
114 114
 			'default'     => '',
115 115
 			'desc_tip'    => true,
116 116
 		),
117 117
 		'stripe_checkout_description'   => array(
118
-			'title'       => __( 'Stripe Checkout Description', 'woocommerce-gateway-stripe' ),
118
+			'title'       => __('Stripe Checkout Description', 'woocommerce-gateway-stripe'),
119 119
 			'type'        => 'text',
120
-			'description' => __( 'Shows a description of your store on Stripe Modal Checkout.', 'woocommerce-gateway-stripe' ),
120
+			'description' => __('Shows a description of your store on Stripe Modal Checkout.', 'woocommerce-gateway-stripe'),
121 121
 			'default'     => '',
122 122
 			'desc_tip'    => true,
123 123
 		),
124 124
 		'payment_request'               => array(
125
-			'title'       => __( 'Payment Request Buttons', 'woocommerce-gateway-stripe' ),
125
+			'title'       => __('Payment Request Buttons', 'woocommerce-gateway-stripe'),
126 126
 			/* translators: 1) br tag 2) opening anchor tag 3) closing anchor tag */
127
-			'label'       => sprintf( __( 'Enable Payment Request Buttons. (Apple Pay/Chrome Payment Request API) %1$sBy using Apple Pay, you agree to %2$s and %3$s\'s terms of service.', 'woocommerce-gateway-stripe' ), '<br />', '<a href="https://stripe.com/apple-pay/legal" target="_blank">Stripe</a>', '<a href="https://developer.apple.com/apple-pay/acceptable-use-guidelines-for-websites/" target="_blank">Apple</a>' ),
127
+			'label'       => sprintf(__('Enable Payment Request Buttons. (Apple Pay/Chrome Payment Request API) %1$sBy using Apple Pay, you agree to %2$s and %3$s\'s terms of service.', 'woocommerce-gateway-stripe'), '<br />', '<a href="https://stripe.com/apple-pay/legal" target="_blank">Stripe</a>', '<a href="https://developer.apple.com/apple-pay/acceptable-use-guidelines-for-websites/" target="_blank">Apple</a>'),
128 128
 			'type'        => 'checkbox',
129
-			'description' => __( 'If enabled, users will be able to pay using Apple Pay or Chrome Payment Request if supported by the browser.', 'woocommerce-gateway-stripe' ),
129
+			'description' => __('If enabled, users will be able to pay using Apple Pay or Chrome Payment Request if supported by the browser.', 'woocommerce-gateway-stripe'),
130 130
 			'default'     => 'yes',
131 131
 			'desc_tip'    => true,
132 132
 		),
133 133
 		'payment_request_button_type'   => array(
134
-			'title'       => __( 'Payment Request Button Type', 'woocommerce-gateway-stripe' ),
135
-			'label'       => __( 'Button Type', 'woocommerce-gateway-stripe' ),
134
+			'title'       => __('Payment Request Button Type', 'woocommerce-gateway-stripe'),
135
+			'label'       => __('Button Type', 'woocommerce-gateway-stripe'),
136 136
 			'type'        => 'select',
137
-			'description' => __( 'Select the button type you would like to show.', 'woocommerce-gateway-stripe' ),
137
+			'description' => __('Select the button type you would like to show.', 'woocommerce-gateway-stripe'),
138 138
 			'default'     => 'buy',
139 139
 			'desc_tip'    => true,
140 140
 			'options'     => array(
141
-				'default' => __( 'Default', 'woocommerce-gateway-stripe' ),
142
-				'buy'     => __( 'Buy', 'woocommerce-gateway-stripe' ),
143
-				'donate'  => __( 'Donate', 'woocommerce-gateway-stripe' ),
141
+				'default' => __('Default', 'woocommerce-gateway-stripe'),
142
+				'buy'     => __('Buy', 'woocommerce-gateway-stripe'),
143
+				'donate'  => __('Donate', 'woocommerce-gateway-stripe'),
144 144
 			),
145 145
 		),
146 146
 		'payment_request_button_theme'  => array(
147
-			'title'       => __( 'Payment Request Button Theme', 'woocommerce-gateway-stripe' ),
148
-			'label'       => __( 'Button Theme', 'woocommerce-gateway-stripe' ),
147
+			'title'       => __('Payment Request Button Theme', 'woocommerce-gateway-stripe'),
148
+			'label'       => __('Button Theme', 'woocommerce-gateway-stripe'),
149 149
 			'type'        => 'select',
150
-			'description' => __( 'Select the button theme you would like to show.', 'woocommerce-gateway-stripe' ),
150
+			'description' => __('Select the button theme you would like to show.', 'woocommerce-gateway-stripe'),
151 151
 			'default'     => 'dark',
152 152
 			'desc_tip'    => true,
153 153
 			'options'     => array(
154
-				'dark'          => __( 'Dark', 'woocommerce-gateway-stripe' ),
155
-				'light'         => __( 'Light', 'woocommerce-gateway-stripe' ),
156
-				'light-outline' => __( 'Light-Outline', 'woocommerce-gateway-stripe' ),
154
+				'dark'          => __('Dark', 'woocommerce-gateway-stripe'),
155
+				'light'         => __('Light', 'woocommerce-gateway-stripe'),
156
+				'light-outline' => __('Light-Outline', 'woocommerce-gateway-stripe'),
157 157
 			),
158 158
 		),
159 159
 		'payment_request_button_height' => array(
160
-			'title'       => __( 'Payment Request Button Height', 'woocommerce-gateway-stripe' ),
161
-			'label'       => __( 'Button Height', 'woocommerce-gateway-stripe' ),
160
+			'title'       => __('Payment Request Button Height', 'woocommerce-gateway-stripe'),
161
+			'label'       => __('Button Height', 'woocommerce-gateway-stripe'),
162 162
 			'type'        => 'text',
163
-			'description' => __( 'Enter the height you would like the button to be in pixels. Width will always be 100%.', 'woocommerce-gateway-stripe' ),
163
+			'description' => __('Enter the height you would like the button to be in pixels. Width will always be 100%.', 'woocommerce-gateway-stripe'),
164 164
 			'default'     => '44',
165 165
 			'desc_tip'    => true,
166 166
 		),
167 167
 		'saved_cards'                   => array(
168
-			'title'       => __( 'Saved Cards', 'woocommerce-gateway-stripe' ),
169
-			'label'       => __( 'Enable Payment via Saved Cards', 'woocommerce-gateway-stripe' ),
168
+			'title'       => __('Saved Cards', 'woocommerce-gateway-stripe'),
169
+			'label'       => __('Enable Payment via Saved Cards', 'woocommerce-gateway-stripe'),
170 170
 			'type'        => 'checkbox',
171
-			'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' ),
171
+			'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'),
172 172
 			'default'     => 'no',
173 173
 			'desc_tip'    => true,
174 174
 		),
175 175
 		'logging'                       => array(
176
-			'title'       => __( 'Logging', 'woocommerce-gateway-stripe' ),
177
-			'label'       => __( 'Log debug messages', 'woocommerce-gateway-stripe' ),
176
+			'title'       => __('Logging', 'woocommerce-gateway-stripe'),
177
+			'label'       => __('Log debug messages', 'woocommerce-gateway-stripe'),
178 178
 			'type'        => 'checkbox',
179
-			'description' => __( 'Save debug messages to the WooCommerce System Status log.', 'woocommerce-gateway-stripe' ),
179
+			'description' => __('Save debug messages to the WooCommerce System Status log.', 'woocommerce-gateway-stripe'),
180 180
 			'default'     => 'no',
181 181
 			'desc_tip'    => true,
182 182
 		),
Please login to merge, or discard this patch.
includes/admin/stripe-sepa-settings.php 1 patch
Spacing   +13 added lines, -13 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,40 +7,40 @@  discard block
 block discarded – undo
7 7
 	'wc_stripe_sepa_settings',
8 8
 	array(
9 9
 		'geo_target'  => array(
10
-			'description' => __( 'Relevant Payer Geography: France, Germany, Spain, Belgium, Netherlands, Luxembourg, Italy, Portugal, Austria, Ireland', 'woocommerce-gateway-stripe' ),
10
+			'description' => __('Relevant Payer Geography: France, Germany, Spain, Belgium, Netherlands, Luxembourg, Italy, Portugal, Austria, Ireland', 'woocommerce-gateway-stripe'),
11 11
 			'type'        => 'title',
12 12
 		),
13 13
 		'guide'       => array(
14
-			'description' => __( '<a href="https://stripe.com/payments/payment-methods-guide#sepa-direct-debit" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe' ),
14
+			'description' => __('<a href="https://stripe.com/payments/payment-methods-guide#sepa-direct-debit" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe'),
15 15
 			'type'        => 'title',
16 16
 		),
17 17
 		'activation'  => array(
18
-			'description' => __( 'Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe' ),
18
+			'description' => __('Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe'),
19 19
 			'type'        => 'title',
20 20
 		),
21 21
 		'enabled'     => array(
22
-			'title'       => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ),
23
-			'label'       => __( 'Enable Stripe SEPA Direct Debit', 'woocommerce-gateway-stripe' ),
22
+			'title'       => __('Enable/Disable', 'woocommerce-gateway-stripe'),
23
+			'label'       => __('Enable Stripe SEPA Direct Debit', 'woocommerce-gateway-stripe'),
24 24
 			'type'        => 'checkbox',
25 25
 			'description' => '',
26 26
 			'default'     => 'no',
27 27
 		),
28 28
 		'title'       => array(
29
-			'title'       => __( 'Title', 'woocommerce-gateway-stripe' ),
29
+			'title'       => __('Title', 'woocommerce-gateway-stripe'),
30 30
 			'type'        => 'text',
31
-			'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
32
-			'default'     => __( 'SEPA Direct Debit', 'woocommerce-gateway-stripe' ),
31
+			'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'),
32
+			'default'     => __('SEPA Direct Debit', 'woocommerce-gateway-stripe'),
33 33
 			'desc_tip'    => true,
34 34
 		),
35 35
 		'description' => array(
36
-			'title'       => __( 'Description', 'woocommerce-gateway-stripe' ),
36
+			'title'       => __('Description', 'woocommerce-gateway-stripe'),
37 37
 			'type'        => 'text',
38
-			'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
39
-			'default'     => __( 'Mandate Information.', 'woocommerce-gateway-stripe' ),
38
+			'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'),
39
+			'default'     => __('Mandate Information.', 'woocommerce-gateway-stripe'),
40 40
 			'desc_tip'    => true,
41 41
 		),
42 42
 		'webhook'     => array(
43
-			'title'       => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ),
43
+			'title'       => __('Webhook Endpoints', 'woocommerce-gateway-stripe'),
44 44
 			'type'        => 'title',
45 45
 			/* translators: webhook URL */
46 46
 			'description' => $this->display_admin_settings_webhook_description(),
Please login to merge, or discard this patch.
includes/admin/stripe-sofort-settings.php 1 patch
Spacing   +13 added lines, -13 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,40 +7,40 @@  discard block
 block discarded – undo
7 7
 	'wc_stripe_sofort_settings',
8 8
 	array(
9 9
 		'geo_target'  => array(
10
-			'description' => __( 'Relevant Payer Geography: Germany, Austria', 'woocommerce-gateway-stripe' ),
10
+			'description' => __('Relevant Payer Geography: Germany, Austria', 'woocommerce-gateway-stripe'),
11 11
 			'type'        => 'title',
12 12
 		),
13 13
 		'guide'       => array(
14
-			'description' => __( '<a href="https://stripe.com/payments/payment-methods-guide#sofort" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe' ),
14
+			'description' => __('<a href="https://stripe.com/payments/payment-methods-guide#sofort" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe'),
15 15
 			'type'        => 'title',
16 16
 		),
17 17
 		'activation'  => array(
18
-			'description' => __( 'Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe' ),
18
+			'description' => __('Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe'),
19 19
 			'type'        => 'title',
20 20
 		),
21 21
 		'enabled'     => array(
22
-			'title'       => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ),
23
-			'label'       => __( 'Enable Stripe SOFORT', 'woocommerce-gateway-stripe' ),
22
+			'title'       => __('Enable/Disable', 'woocommerce-gateway-stripe'),
23
+			'label'       => __('Enable Stripe SOFORT', 'woocommerce-gateway-stripe'),
24 24
 			'type'        => 'checkbox',
25 25
 			'description' => '',
26 26
 			'default'     => 'no',
27 27
 		),
28 28
 		'title'       => array(
29
-			'title'       => __( 'Title', 'woocommerce-gateway-stripe' ),
29
+			'title'       => __('Title', 'woocommerce-gateway-stripe'),
30 30
 			'type'        => 'text',
31
-			'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
32
-			'default'     => __( 'SOFORT', 'woocommerce-gateway-stripe' ),
31
+			'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'),
32
+			'default'     => __('SOFORT', 'woocommerce-gateway-stripe'),
33 33
 			'desc_tip'    => true,
34 34
 		),
35 35
 		'description' => array(
36
-			'title'       => __( 'Description', 'woocommerce-gateway-stripe' ),
36
+			'title'       => __('Description', 'woocommerce-gateway-stripe'),
37 37
 			'type'        => 'text',
38
-			'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
39
-			'default'     => __( 'You will be redirected to SOFORT.', 'woocommerce-gateway-stripe' ),
38
+			'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'),
39
+			'default'     => __('You will be redirected to SOFORT.', 'woocommerce-gateway-stripe'),
40 40
 			'desc_tip'    => true,
41 41
 		),
42 42
 		'webhook'     => array(
43
-			'title'       => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ),
43
+			'title'       => __('Webhook Endpoints', 'woocommerce-gateway-stripe'),
44 44
 			'type'        => 'title',
45 45
 			/* translators: webhook URL */
46 46
 			'description' => $this->display_admin_settings_webhook_description(),
Please login to merge, or discard this patch.
includes/admin/stripe-p24-settings.php 1 patch
Spacing   +12 added lines, -12 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,36 +7,36 @@  discard block
 block discarded – undo
7 7
 	'wc_stripe_p24_settings',
8 8
 	array(
9 9
 		'geo_target'  => array(
10
-			'description' => __( 'Relevant Payer Geography: Poland', 'woocommerce-gateway-stripe' ),
10
+			'description' => __('Relevant Payer Geography: Poland', 'woocommerce-gateway-stripe'),
11 11
 			'type'        => 'title',
12 12
 		),
13 13
 		'activation'  => array(
14
-			'description' => __( 'Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe' ),
14
+			'description' => __('Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe'),
15 15
 			'type'        => 'title',
16 16
 		),
17 17
 		'enabled'     => array(
18
-			'title'       => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ),
19
-			'label'       => __( 'Enable Stripe P24', 'woocommerce-gateway-stripe' ),
18
+			'title'       => __('Enable/Disable', 'woocommerce-gateway-stripe'),
19
+			'label'       => __('Enable Stripe P24', 'woocommerce-gateway-stripe'),
20 20
 			'type'        => 'checkbox',
21 21
 			'description' => '',
22 22
 			'default'     => 'no',
23 23
 		),
24 24
 		'title'       => array(
25
-			'title'       => __( 'Title', 'woocommerce-gateway-stripe' ),
25
+			'title'       => __('Title', 'woocommerce-gateway-stripe'),
26 26
 			'type'        => 'text',
27
-			'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
28
-			'default'     => __( 'Przelewy24 (P24)', 'woocommerce-gateway-stripe' ),
27
+			'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'),
28
+			'default'     => __('Przelewy24 (P24)', 'woocommerce-gateway-stripe'),
29 29
 			'desc_tip'    => true,
30 30
 		),
31 31
 		'description' => array(
32
-			'title'       => __( 'Description', 'woocommerce-gateway-stripe' ),
32
+			'title'       => __('Description', 'woocommerce-gateway-stripe'),
33 33
 			'type'        => 'text',
34
-			'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
35
-			'default'     => __( 'You will be redirected to P24.', 'woocommerce-gateway-stripe' ),
34
+			'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'),
35
+			'default'     => __('You will be redirected to P24.', 'woocommerce-gateway-stripe'),
36 36
 			'desc_tip'    => true,
37 37
 		),
38 38
 		'webhook'     => array(
39
-			'title'       => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ),
39
+			'title'       => __('Webhook Endpoints', 'woocommerce-gateway-stripe'),
40 40
 			'type'        => 'title',
41 41
 			/* translators: webhook URL */
42 42
 			'description' => $this->display_admin_settings_webhook_description(),
Please login to merge, or discard this patch.
includes/admin/stripe-eps-settings.php 1 patch
Spacing   +12 added lines, -12 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,36 +7,36 @@  discard block
 block discarded – undo
7 7
 	'wc_stripe_eps_settings',
8 8
 	array(
9 9
 		'geo_target'  => array(
10
-			'description' => __( 'Relevant Payer Geography: Austria', 'woocommerce-gateway-stripe' ),
10
+			'description' => __('Relevant Payer Geography: Austria', 'woocommerce-gateway-stripe'),
11 11
 			'type'        => 'title',
12 12
 		),
13 13
 		'activation'  => array(
14
-			'description' => __( 'Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe' ),
14
+			'description' => __('Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe'),
15 15
 			'type'        => 'title',
16 16
 		),
17 17
 		'enabled'     => array(
18
-			'title'       => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ),
19
-			'label'       => __( 'Enable Stripe EPS', 'woocommerce-gateway-stripe' ),
18
+			'title'       => __('Enable/Disable', 'woocommerce-gateway-stripe'),
19
+			'label'       => __('Enable Stripe EPS', 'woocommerce-gateway-stripe'),
20 20
 			'type'        => 'checkbox',
21 21
 			'description' => '',
22 22
 			'default'     => 'no',
23 23
 		),
24 24
 		'title'       => array(
25
-			'title'       => __( 'Title', 'woocommerce-gateway-stripe' ),
25
+			'title'       => __('Title', 'woocommerce-gateway-stripe'),
26 26
 			'type'        => 'text',
27
-			'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
28
-			'default'     => __( 'EPS', 'woocommerce-gateway-stripe' ),
27
+			'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'),
28
+			'default'     => __('EPS', 'woocommerce-gateway-stripe'),
29 29
 			'desc_tip'    => true,
30 30
 		),
31 31
 		'description' => array(
32
-			'title'       => __( 'Description', 'woocommerce-gateway-stripe' ),
32
+			'title'       => __('Description', 'woocommerce-gateway-stripe'),
33 33
 			'type'        => 'text',
34
-			'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
35
-			'default'     => __( 'You will be redirected to EPS.', 'woocommerce-gateway-stripe' ),
34
+			'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'),
35
+			'default'     => __('You will be redirected to EPS.', 'woocommerce-gateway-stripe'),
36 36
 			'desc_tip'    => true,
37 37
 		),
38 38
 		'webhook'     => array(
39
-			'title'       => __( 'Webhook Enpoints', 'woocommerce-gateway-stripe' ),
39
+			'title'       => __('Webhook Enpoints', 'woocommerce-gateway-stripe'),
40 40
 			'type'        => 'title',
41 41
 			/* translators: webhook URL */
42 42
 			'description' => $this->display_admin_settings_webhook_description(),
Please login to merge, or discard this patch.
includes/admin/class-wc-stripe-privacy.php 1 patch
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! class_exists( 'WC_Abstract_Privacy' ) ) {
2
+if ( ! class_exists('WC_Abstract_Privacy')) {
3 3
 	return;
4 4
 }
5 5
 
@@ -9,20 +9,20 @@  discard block
 block discarded – undo
9 9
 	 *
10 10
 	 */
11 11
 	public function __construct() {
12
-		parent::__construct( __( 'Stripe', 'woocommerce-gateway-stripe' ) );
12
+		parent::__construct(__('Stripe', 'woocommerce-gateway-stripe'));
13 13
 
14
-		$this->add_exporter( 'woocommerce-gateway-stripe-order-data', __( 'WooCommerce Stripe Order Data', 'woocommerce-gateway-stripe' ), array( $this, 'order_data_exporter' ) );
14
+		$this->add_exporter('woocommerce-gateway-stripe-order-data', __('WooCommerce Stripe Order Data', 'woocommerce-gateway-stripe'), array($this, 'order_data_exporter'));
15 15
 
16
-		if ( function_exists( 'wcs_get_subscriptions' ) ) {
17
-			$this->add_exporter( 'woocommerce-gateway-stripe-subscriptions-data', __( 'WooCommerce Stripe Subscriptions Data', 'woocommerce-gateway-stripe' ), array( $this, 'subscriptions_data_exporter' ) );
16
+		if (function_exists('wcs_get_subscriptions')) {
17
+			$this->add_exporter('woocommerce-gateway-stripe-subscriptions-data', __('WooCommerce Stripe Subscriptions Data', 'woocommerce-gateway-stripe'), array($this, 'subscriptions_data_exporter'));
18 18
 		}
19 19
 
20
-		$this->add_exporter( 'woocommerce-gateway-stripe-customer-data', __( 'WooCommerce Stripe Customer Data', 'woocommerce-gateway-stripe' ), array( $this, 'customer_data_exporter' ) );
20
+		$this->add_exporter('woocommerce-gateway-stripe-customer-data', __('WooCommerce Stripe Customer Data', 'woocommerce-gateway-stripe'), array($this, 'customer_data_exporter'));
21 21
 
22
-		$this->add_eraser( 'woocommerce-gateway-stripe-customer-data', __( 'WooCommerce Stripe Customer Data', 'woocommerce-gateway-stripe' ), array( $this, 'customer_data_eraser' ) );
23
-		$this->add_eraser( 'woocommerce-gateway-stripe-order-data', __( 'WooCommerce Stripe Data', 'woocommerce-gateway-stripe' ), array( $this, 'order_data_eraser' ) );
22
+		$this->add_eraser('woocommerce-gateway-stripe-customer-data', __('WooCommerce Stripe Customer Data', 'woocommerce-gateway-stripe'), array($this, 'customer_data_eraser'));
23
+		$this->add_eraser('woocommerce-gateway-stripe-order-data', __('WooCommerce Stripe Data', 'woocommerce-gateway-stripe'), array($this, 'order_data_eraser'));
24 24
 
25
-		add_filter( 'woocommerce_get_settings_account', array( $this, 'account_settings' ) );
25
+		add_filter('woocommerce_get_settings_account', array($this, 'account_settings'));
26 26
 	}
27 27
 
28 28
 	/**
@@ -31,20 +31,20 @@  discard block
 block discarded – undo
31 31
 	 * @param array $settings
32 32
 	 * @return array $settings Updated
33 33
 	 */
34
-	public function account_settings( $settings ) {
34
+	public function account_settings($settings) {
35 35
 		$insert_setting = array(
36 36
 			array(
37
-				'title'       => __( 'Retain Stripe Data', 'woocommerce-gateway-stripe' ),
38
-				'desc_tip'    => __( 'Retains any Stripe data such as Stripe customer ID, source ID.', 'woocommerce-gateway-stripe' ),
37
+				'title'       => __('Retain Stripe Data', 'woocommerce-gateway-stripe'),
38
+				'desc_tip'    => __('Retains any Stripe data such as Stripe customer ID, source ID.', 'woocommerce-gateway-stripe'),
39 39
 				'id'          => 'woocommerce_gateway_stripe_retention',
40 40
 				'type'        => 'relative_date_selector',
41
-				'placeholder' => __( 'N/A', 'woocommerce-gateway-stripe' ),
41
+				'placeholder' => __('N/A', 'woocommerce-gateway-stripe'),
42 42
 				'default'     => '',
43 43
 				'autoload'    => false,
44 44
 			),
45 45
 		);
46 46
 
47
-		array_splice( $settings, ( count( $settings ) - 1 ), 0, $insert_setting );
47
+		array_splice($settings, (count($settings) - 1), 0, $insert_setting);
48 48
 
49 49
 		return $settings;
50 50
 	}
@@ -57,22 +57,22 @@  discard block
 block discarded – undo
57 57
 	 *
58 58
 	 * @return array WP_Post
59 59
 	 */
60
-	protected function get_stripe_orders( $email_address, $page ) {
61
-		$user = get_user_by( 'email', $email_address ); // Check if user has an ID in the DB to load stored personal data.
60
+	protected function get_stripe_orders($email_address, $page) {
61
+		$user = get_user_by('email', $email_address); // Check if user has an ID in the DB to load stored personal data.
62 62
 
63 63
 		$order_query = array(
64
-			'payment_method' => array( 'stripe', 'stripe_alipay', 'stripe_bancontact', 'stripe_eps', 'stripe_giropay', 'stripe_ideal', 'stripe_multibanco', 'stripe_p24', 'stripe_sepa', 'stripe_sofort' ),
64
+			'payment_method' => array('stripe', 'stripe_alipay', 'stripe_bancontact', 'stripe_eps', 'stripe_giropay', 'stripe_ideal', 'stripe_multibanco', 'stripe_p24', 'stripe_sepa', 'stripe_sofort'),
65 65
 			'limit'          => 10,
66 66
 			'page'           => $page,
67 67
 		);
68 68
 
69
-		if ( $user instanceof WP_User ) {
69
+		if ($user instanceof WP_User) {
70 70
 			$order_query['customer_id'] = (int) $user->ID;
71 71
 		} else {
72 72
 			$order_query['billing_email'] = $email_address;
73 73
 		}
74 74
 
75
-		return wc_get_orders( $order_query );
75
+		return wc_get_orders($order_query);
76 76
 	}
77 77
 
78 78
 	/**
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public function get_privacy_message() {
83 83
 		/* translators: %s URL to docs */
84
-		return wpautop( sprintf( __( 'By using this extension, you may be storing personal data or sharing data with an external service. <a href="%s" target="_blank">Learn more about how this works, including what you may want to include in your privacy policy.</a>', 'woocommerce-gateway-stripe' ), 'https://docs.woocommerce.com/document/privacy-payments/#woocommerce-gateway-stripe' ) );
84
+		return wpautop(sprintf(__('By using this extension, you may be storing personal data or sharing data with an external service. <a href="%s" target="_blank">Learn more about how this works, including what you may want to include in your privacy policy.</a>', 'woocommerce-gateway-stripe'), 'https://docs.woocommerce.com/document/privacy-payments/#woocommerce-gateway-stripe'));
85 85
 	}
86 86
 
87 87
 	/**
@@ -92,34 +92,34 @@  discard block
 block discarded – undo
92 92
 	 *
93 93
 	 * @return array
94 94
 	 */
95
-	public function order_data_exporter( $email_address, $page = 1 ) {
95
+	public function order_data_exporter($email_address, $page = 1) {
96 96
 		$done           = false;
97 97
 		$data_to_export = array();
98 98
 
99
-		$orders = $this->get_stripe_orders( $email_address, (int) $page );
99
+		$orders = $this->get_stripe_orders($email_address, (int) $page);
100 100
 
101 101
 		$done = true;
102 102
 
103
-		if ( 0 < count( $orders ) ) {
104
-			foreach ( $orders as $order ) {
103
+		if (0 < count($orders)) {
104
+			foreach ($orders as $order) {
105 105
 				$data_to_export[] = array(
106 106
 					'group_id'    => 'woocommerce_orders',
107
-					'group_label' => __( 'Orders', 'woocommerce-gateway-stripe' ),
107
+					'group_label' => __('Orders', 'woocommerce-gateway-stripe'),
108 108
 					'item_id'     => 'order-' . $order->get_id(),
109 109
 					'data'        => array(
110 110
 						array(
111
-							'name'  => __( 'Stripe payment id', 'woocommerce-gateway-stripe' ),
112
-							'value' => get_post_meta( $order->get_id(), '_stripe_source_id', true ),
111
+							'name'  => __('Stripe payment id', 'woocommerce-gateway-stripe'),
112
+							'value' => get_post_meta($order->get_id(), '_stripe_source_id', true),
113 113
 						),
114 114
 						array(
115
-							'name'  => __( 'Stripe customer id', 'woocommerce-gateway-stripe' ),
116
-							'value' => get_post_meta( $order->get_id(), '_stripe_customer_id', true ),
115
+							'name'  => __('Stripe customer id', 'woocommerce-gateway-stripe'),
116
+							'value' => get_post_meta($order->get_id(), '_stripe_customer_id', true),
117 117
 						),
118 118
 					),
119 119
 				);
120 120
 			}
121 121
 
122
-			$done = 10 > count( $orders );
122
+			$done = 10 > count($orders);
123 123
 		}
124 124
 
125 125
 		return array(
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 *
137 137
 	 * @return array
138 138
 	 */
139
-	public function subscriptions_data_exporter( $email_address, $page = 1 ) {
139
+	public function subscriptions_data_exporter($email_address, $page = 1) {
140 140
 		$done           = false;
141 141
 		$page           = (int) $page;
142 142
 		$data_to_export = array();
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			'relation' => 'AND',
146 146
 			array(
147 147
 				'key'     => '_payment_method',
148
-				'value'   => array( 'stripe', 'stripe_alipay', 'stripe_bancontact', 'stripe_eps', 'stripe_giropay', 'stripe_ideal', 'stripe_multibanco', 'stripe_p24', 'stripe_sepa', 'stripe_sofort' ),
148
+				'value'   => array('stripe', 'stripe_alipay', 'stripe_bancontact', 'stripe_eps', 'stripe_giropay', 'stripe_ideal', 'stripe_multibanco', 'stripe_p24', 'stripe_sepa', 'stripe_sofort'),
149 149
 				'compare' => 'IN',
150 150
 			),
151 151
 			array(
@@ -161,30 +161,30 @@  discard block
 block discarded – undo
161 161
 			'meta_query'     => $meta_query,
162 162
 		);
163 163
 
164
-		$subscriptions = wcs_get_subscriptions( $subscription_query );
164
+		$subscriptions = wcs_get_subscriptions($subscription_query);
165 165
 
166 166
 		$done = true;
167 167
 
168
-		if ( 0 < count( $subscriptions ) ) {
169
-			foreach ( $subscriptions as $subscription ) {
168
+		if (0 < count($subscriptions)) {
169
+			foreach ($subscriptions as $subscription) {
170 170
 				$data_to_export[] = array(
171 171
 					'group_id'    => 'woocommerce_subscriptions',
172
-					'group_label' => __( 'Subscriptions', 'woocommerce-gateway-stripe' ),
172
+					'group_label' => __('Subscriptions', 'woocommerce-gateway-stripe'),
173 173
 					'item_id'     => 'subscription-' . $subscription->get_id(),
174 174
 					'data'        => array(
175 175
 						array(
176
-							'name'  => __( 'Stripe payment id', 'woocommerce-gateway-stripe' ),
177
-							'value' => get_post_meta( $subscription->get_id(), '_stripe_source_id', true ),
176
+							'name'  => __('Stripe payment id', 'woocommerce-gateway-stripe'),
177
+							'value' => get_post_meta($subscription->get_id(), '_stripe_source_id', true),
178 178
 						),
179 179
 						array(
180
-							'name'  => __( 'Stripe customer id', 'woocommerce-gateway-stripe' ),
181
-							'value' => get_post_meta( $subscription->get_id(), '_stripe_customer_id', true ),
180
+							'name'  => __('Stripe customer id', 'woocommerce-gateway-stripe'),
181
+							'value' => get_post_meta($subscription->get_id(), '_stripe_customer_id', true),
182 182
 						),
183 183
 					),
184 184
 				);
185 185
 			}
186 186
 
187
-			$done = 10 > count( $subscriptions );
187
+			$done = 10 > count($subscriptions);
188 188
 		}
189 189
 
190 190
 		return array(
@@ -200,24 +200,24 @@  discard block
 block discarded – undo
200 200
 	 * @param int    $page  Page.
201 201
 	 * @return array An array of personal data in name value pairs
202 202
 	 */
203
-	public function customer_data_exporter( $email_address, $page ) {
204
-		$user           = get_user_by( 'email', $email_address ); // Check if user has an ID in the DB to load stored personal data.
203
+	public function customer_data_exporter($email_address, $page) {
204
+		$user           = get_user_by('email', $email_address); // Check if user has an ID in the DB to load stored personal data.
205 205
 		$data_to_export = array();
206 206
 
207
-		if ( $user instanceof WP_User ) {
208
-			$stripe_user = new WC_Stripe_Customer( $user->ID );
207
+		if ($user instanceof WP_User) {
208
+			$stripe_user = new WC_Stripe_Customer($user->ID);
209 209
 
210 210
 			$data_to_export[] = array(
211 211
 				'group_id'    => 'woocommerce_customer',
212
-				'group_label' => __( 'Customer Data', 'woocommerce-gateway-stripe' ),
212
+				'group_label' => __('Customer Data', 'woocommerce-gateway-stripe'),
213 213
 				'item_id'     => 'user',
214 214
 				'data'        => array(
215 215
 					array(
216
-						'name'  => __( 'Stripe payment id', 'woocommerce-gateway-stripe' ),
217
-						'value' => get_user_meta( $user->ID, '_stripe_source_id', true ),
216
+						'name'  => __('Stripe payment id', 'woocommerce-gateway-stripe'),
217
+						'value' => get_user_meta($user->ID, '_stripe_source_id', true),
218 218
 					),
219 219
 					array(
220
-						'name'  => __( 'Stripe customer id', 'woocommerce-gateway-stripe' ),
220
+						'name'  => __('Stripe customer id', 'woocommerce-gateway-stripe'),
221 221
 						'value' => $stripe_user->get_id(),
222 222
 					),
223 223
 				),
@@ -237,25 +237,25 @@  discard block
 block discarded – undo
237 237
 	 * @param int    $page  Page.
238 238
 	 * @return array An array of personal data in name value pairs
239 239
 	 */
240
-	public function customer_data_eraser( $email_address, $page ) {
240
+	public function customer_data_eraser($email_address, $page) {
241 241
 		$page               = (int) $page;
242
-		$user               = get_user_by( 'email', $email_address ); // Check if user has an ID in the DB to load stored personal data.
242
+		$user               = get_user_by('email', $email_address); // Check if user has an ID in the DB to load stored personal data.
243 243
 		$stripe_customer_id = '';
244 244
 		$stripe_source_id   = '';
245 245
 
246
-		if ( $user instanceof WP_User ) {
247
-			$stripe_customer_id = get_user_meta( $user->ID, '_stripe_customer_id', true );
248
-			$stripe_source_id   = get_user_meta( $user->ID, '_stripe_source_id', true );
246
+		if ($user instanceof WP_User) {
247
+			$stripe_customer_id = get_user_meta($user->ID, '_stripe_customer_id', true);
248
+			$stripe_source_id   = get_user_meta($user->ID, '_stripe_source_id', true);
249 249
 		}
250 250
 
251 251
 		$items_removed = false;
252 252
 		$messages      = array();
253 253
 
254
-		if ( ! empty( $stripe_customer_id ) || ! empty( $stripe_source_id ) ) {
254
+		if ( ! empty($stripe_customer_id) || ! empty($stripe_source_id)) {
255 255
 			$items_removed = true;
256
-			delete_user_meta( $user->ID, '_stripe_customer_id' );
257
-			delete_user_meta( $user->ID, '_stripe_source_id' );
258
-			$messages[] = __( 'Stripe User Data Erased.', 'woocommerce-gateway-stripe' );
256
+			delete_user_meta($user->ID, '_stripe_customer_id');
257
+			delete_user_meta($user->ID, '_stripe_source_id');
258
+			$messages[] = __('Stripe User Data Erased.', 'woocommerce-gateway-stripe');
259 259
 		}
260 260
 
261 261
 		return array(
@@ -273,29 +273,29 @@  discard block
 block discarded – undo
273 273
 	 * @param int    $page  Page.
274 274
 	 * @return array An array of personal data in name value pairs
275 275
 	 */
276
-	public function order_data_eraser( $email_address, $page ) {
277
-		$orders = $this->get_stripe_orders( $email_address, (int) $page );
276
+	public function order_data_eraser($email_address, $page) {
277
+		$orders = $this->get_stripe_orders($email_address, (int) $page);
278 278
 
279 279
 		$items_removed  = false;
280 280
 		$items_retained = false;
281 281
 		$messages       = array();
282 282
 
283
-		foreach ( (array) $orders as $order ) {
284
-			$order = wc_get_order( $order->get_id() );
283
+		foreach ((array) $orders as $order) {
284
+			$order = wc_get_order($order->get_id());
285 285
 
286
-			list( $removed, $retained, $msgs ) = $this->maybe_handle_order( $order );
286
+			list($removed, $retained, $msgs) = $this->maybe_handle_order($order);
287 287
 			$items_removed                    |= $removed;
288 288
 			$items_retained                   |= $retained;
289
-			$messages                          = array_merge( $messages, $msgs );
289
+			$messages                          = array_merge($messages, $msgs);
290 290
 
291
-			list( $removed, $retained, $msgs ) = $this->maybe_handle_subscription( $order );
291
+			list($removed, $retained, $msgs) = $this->maybe_handle_subscription($order);
292 292
 			$items_removed                    |= $removed;
293 293
 			$items_retained                   |= $retained;
294
-			$messages                          = array_merge( $messages, $msgs );
294
+			$messages                          = array_merge($messages, $msgs);
295 295
 		}
296 296
 
297 297
 		// Tell core if we have more orders to work on still
298
-		$done = count( $orders ) < 10;
298
+		$done = count($orders) < 10;
299 299
 
300 300
 		return array(
301 301
 			'items_removed'  => $items_removed,
@@ -311,47 +311,47 @@  discard block
 block discarded – undo
311 311
 	 * @param WC_Order $order
312 312
 	 * @return array
313 313
 	 */
314
-	protected function maybe_handle_subscription( $order ) {
315
-		if ( ! class_exists( 'WC_Subscriptions' ) ) {
316
-			return array( false, false, array() );
314
+	protected function maybe_handle_subscription($order) {
315
+		if ( ! class_exists('WC_Subscriptions')) {
316
+			return array(false, false, array());
317 317
 		}
318 318
 
319
-		if ( ! wcs_order_contains_subscription( $order ) ) {
320
-			return array( false, false, array() );
319
+		if ( ! wcs_order_contains_subscription($order)) {
320
+			return array(false, false, array());
321 321
 		}
322 322
 
323
-		$subscription    = current( wcs_get_subscriptions_for_order( $order->get_id() ) );
323
+		$subscription    = current(wcs_get_subscriptions_for_order($order->get_id()));
324 324
 		$subscription_id = $subscription->get_id();
325 325
 
326
-		$stripe_source_id = get_post_meta( $subscription_id, '_stripe_source_id', true );
326
+		$stripe_source_id = get_post_meta($subscription_id, '_stripe_source_id', true);
327 327
 
328
-		if ( empty( $stripe_source_id ) ) {
329
-			return array( false, false, array() );
328
+		if (empty($stripe_source_id)) {
329
+			return array(false, false, array());
330 330
 		}
331 331
 
332
-		if ( ! $this->is_retention_expired( $order->get_date_created()->getTimestamp() ) ) {
332
+		if ( ! $this->is_retention_expired($order->get_date_created()->getTimestamp())) {
333 333
 			/* translators: %d Order ID */
334
-			return array( false, true, array( sprintf( __( 'Order ID %d is less than set retention days. Personal data retained. (Stripe)', 'woocommerce-gateway-stripe' ), $order->get_id() ) ) );
334
+			return array(false, true, array(sprintf(__('Order ID %d is less than set retention days. Personal data retained. (Stripe)', 'woocommerce-gateway-stripe'), $order->get_id())));
335 335
 		}
336 336
 
337
-		if ( $subscription->has_status( apply_filters( 'wc_stripe_privacy_eraser_subs_statuses', array( 'on-hold', 'active' ) ) ) ) {
337
+		if ($subscription->has_status(apply_filters('wc_stripe_privacy_eraser_subs_statuses', array('on-hold', 'active')))) {
338 338
 			/* translators: %d Order ID */
339
-			return array( false, true, array( sprintf( __( 'Order ID %d contains an active Subscription. Personal data retained. (Stripe)', 'woocommerce-gateway-stripe' ), $order->get_id() ) ) );
339
+			return array(false, true, array(sprintf(__('Order ID %d contains an active Subscription. Personal data retained. (Stripe)', 'woocommerce-gateway-stripe'), $order->get_id())));
340 340
 		}
341 341
 
342
-		$renewal_orders = WC_Subscriptions_Renewal_Order::get_renewal_orders( $order->get_id() );
342
+		$renewal_orders = WC_Subscriptions_Renewal_Order::get_renewal_orders($order->get_id());
343 343
 
344
-		foreach ( $renewal_orders as $renewal_order_id ) {
345
-			delete_post_meta( $renewal_order_id, '_stripe_source_id' );
346
-			delete_post_meta( $renewal_order_id, '_stripe_refund_id' );
347
-			delete_post_meta( $renewal_order_id, '_stripe_customer_id' );
344
+		foreach ($renewal_orders as $renewal_order_id) {
345
+			delete_post_meta($renewal_order_id, '_stripe_source_id');
346
+			delete_post_meta($renewal_order_id, '_stripe_refund_id');
347
+			delete_post_meta($renewal_order_id, '_stripe_customer_id');
348 348
 		}
349 349
 
350
-		delete_post_meta( $subscription_id, '_stripe_source_id' );
351
-		delete_post_meta( $subscription_id, '_stripe_refund_id' );
352
-		delete_post_meta( $subscription_id, '_stripe_customer_id' );
350
+		delete_post_meta($subscription_id, '_stripe_source_id');
351
+		delete_post_meta($subscription_id, '_stripe_refund_id');
352
+		delete_post_meta($subscription_id, '_stripe_customer_id');
353 353
 
354
-		return array( true, false, array( __( 'Stripe Subscription Data Erased.', 'woocommerce-gateway-stripe' ) ) );
354
+		return array(true, false, array(__('Stripe Subscription Data Erased.', 'woocommerce-gateway-stripe')));
355 355
 	}
356 356
 
357 357
 	/**
@@ -360,61 +360,61 @@  discard block
 block discarded – undo
360 360
 	 * @param WC_Order $order
361 361
 	 * @return array
362 362
 	 */
363
-	protected function maybe_handle_order( $order ) {
363
+	protected function maybe_handle_order($order) {
364 364
 		$order_id           = $order->get_id();
365
-		$stripe_source_id   = get_post_meta( $order_id, '_stripe_source_id', true );
366
-		$stripe_refund_id   = get_post_meta( $order_id, '_stripe_refund_id', true );
367
-		$stripe_customer_id = get_post_meta( $order_id, '_stripe_customer_id', true );
365
+		$stripe_source_id   = get_post_meta($order_id, '_stripe_source_id', true);
366
+		$stripe_refund_id   = get_post_meta($order_id, '_stripe_refund_id', true);
367
+		$stripe_customer_id = get_post_meta($order_id, '_stripe_customer_id', true);
368 368
 
369
-		if ( ! $this->is_retention_expired( $order->get_date_created()->getTimestamp() ) ) {
369
+		if ( ! $this->is_retention_expired($order->get_date_created()->getTimestamp())) {
370 370
 			/* translators: %d Order ID */
371
-			return array( false, true, array( sprintf( __( 'Order ID %d is less than set retention days. Personal data retained. (Stripe)', 'woocommerce-gateway-stripe' ), $order->get_id() ) ) );
371
+			return array(false, true, array(sprintf(__('Order ID %d is less than set retention days. Personal data retained. (Stripe)', 'woocommerce-gateway-stripe'), $order->get_id())));
372 372
 		}
373 373
 
374
-		if ( empty( $stripe_source_id ) && empty( $stripe_refund_id ) && empty( $stripe_customer_id ) ) {
375
-			return array( false, false, array() );
374
+		if (empty($stripe_source_id) && empty($stripe_refund_id) && empty($stripe_customer_id)) {
375
+			return array(false, false, array());
376 376
 		}
377 377
 
378
-		delete_post_meta( $order_id, '_stripe_source_id' );
379
-		delete_post_meta( $order_id, '_stripe_refund_id' );
380
-		delete_post_meta( $order_id, '_stripe_customer_id' );
378
+		delete_post_meta($order_id, '_stripe_source_id');
379
+		delete_post_meta($order_id, '_stripe_refund_id');
380
+		delete_post_meta($order_id, '_stripe_customer_id');
381 381
 
382
-		return array( true, false, array( __( 'Stripe personal data erased.', 'woocommerce-gateway-stripe' ) ) );
382
+		return array(true, false, array(__('Stripe personal data erased.', 'woocommerce-gateway-stripe')));
383 383
 	}
384 384
 
385 385
 	/**
386 386
 	 * Checks if create date is passed retention duration.
387 387
 	 *
388 388
 	 */
389
-	public function is_retention_expired( $created_date ) {
390
-		$retention  = wc_parse_relative_date_option( get_option( 'woocommerce_gateway_stripe_retention' ) );
389
+	public function is_retention_expired($created_date) {
390
+		$retention  = wc_parse_relative_date_option(get_option('woocommerce_gateway_stripe_retention'));
391 391
 		$is_expired = false;
392
-		$time_span  = time() - strtotime( $created_date );
393
-		if ( empty( $retention ) || empty( $created_date ) ) {
392
+		$time_span  = time() - strtotime($created_date);
393
+		if (empty($retention) || empty($created_date)) {
394 394
 			return false;
395 395
 		}
396
-		switch ( $retention['unit'] ) {
396
+		switch ($retention['unit']) {
397 397
 			case 'days':
398 398
 				$retention = $retention['number'] * DAY_IN_SECONDS;
399
-				if ( $time_span > $retention ) {
399
+				if ($time_span > $retention) {
400 400
 					$is_expired = true;
401 401
 				}
402 402
 				break;
403 403
 			case 'weeks':
404 404
 				$retention = $retention['number'] * WEEK_IN_SECONDS;
405
-				if ( $time_span > $retention ) {
405
+				if ($time_span > $retention) {
406 406
 					$is_expired = true;
407 407
 				}
408 408
 				break;
409 409
 			case 'months':
410 410
 				$retention = $retention['number'] * MONTH_IN_SECONDS;
411
-				if ( $time_span > $retention ) {
411
+				if ($time_span > $retention) {
412 412
 					$is_expired = true;
413 413
 				}
414 414
 				break;
415 415
 			case 'years':
416 416
 				$retention = $retention['number'] * YEAR_IN_SECONDS;
417
-				if ( $time_span > $retention ) {
417
+				if ($time_span > $retention) {
418 418
 					$is_expired = true;
419 419
 				}
420 420
 				break;
Please login to merge, or discard this patch.
includes/admin/stripe-alipay-settings.php 1 patch
Spacing   +13 added lines, -13 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,40 +7,40 @@  discard block
 block discarded – undo
7 7
 	'wc_stripe_alipay_settings',
8 8
 	array(
9 9
 		'geo_target'  => array(
10
-			'description' => __( 'Relevant Payer Geography: China', 'woocommerce-gateway-stripe' ),
10
+			'description' => __('Relevant Payer Geography: China', 'woocommerce-gateway-stripe'),
11 11
 			'type'        => 'title',
12 12
 		),
13 13
 		'guide'       => array(
14
-			'description' => __( '<a href="https://stripe.com/payments/payment-methods-guide#alipay" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe' ),
14
+			'description' => __('<a href="https://stripe.com/payments/payment-methods-guide#alipay" target="_blank">Payment Method Guide</a>', 'woocommerce-gateway-stripe'),
15 15
 			'type'        => 'title',
16 16
 		),
17 17
 		'activation'  => array(
18
-			'description' => __( 'Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe' ),
18
+			'description' => __('Must be activated from your Stripe Dashboard Settings <a href="https://dashboard.stripe.com/account/payments/settings" target="_blank">here</a>', 'woocommerce-gateway-stripe'),
19 19
 			'type'        => 'title',
20 20
 		),
21 21
 		'enabled'     => array(
22
-			'title'       => __( 'Enable/Disable', 'woocommerce-gateway-stripe' ),
23
-			'label'       => __( 'Enable Stripe Alipay', 'woocommerce-gateway-stripe' ),
22
+			'title'       => __('Enable/Disable', 'woocommerce-gateway-stripe'),
23
+			'label'       => __('Enable Stripe Alipay', 'woocommerce-gateway-stripe'),
24 24
 			'type'        => 'checkbox',
25 25
 			'description' => '',
26 26
 			'default'     => 'no',
27 27
 		),
28 28
 		'title'       => array(
29
-			'title'       => __( 'Title', 'woocommerce-gateway-stripe' ),
29
+			'title'       => __('Title', 'woocommerce-gateway-stripe'),
30 30
 			'type'        => 'text',
31
-			'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
32
-			'default'     => __( 'Alipay', 'woocommerce-gateway-stripe' ),
31
+			'description' => __('This controls the title which the user sees during checkout.', 'woocommerce-gateway-stripe'),
32
+			'default'     => __('Alipay', 'woocommerce-gateway-stripe'),
33 33
 			'desc_tip'    => true,
34 34
 		),
35 35
 		'description' => array(
36
-			'title'       => __( 'Description', 'woocommerce-gateway-stripe' ),
36
+			'title'       => __('Description', 'woocommerce-gateway-stripe'),
37 37
 			'type'        => 'text',
38
-			'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe' ),
39
-			'default'     => __( 'You will be redirected to Alipay.', 'woocommerce-gateway-stripe' ),
38
+			'description' => __('This controls the description which the user sees during checkout.', 'woocommerce-gateway-stripe'),
39
+			'default'     => __('You will be redirected to Alipay.', 'woocommerce-gateway-stripe'),
40 40
 			'desc_tip'    => true,
41 41
 		),
42 42
 		'webhook'     => array(
43
-			'title'       => __( 'Webhook Endpoints', 'woocommerce-gateway-stripe' ),
43
+			'title'       => __('Webhook Endpoints', 'woocommerce-gateway-stripe'),
44 44
 			'type'        => 'title',
45 45
 			/* translators: webhook URL */
46 46
 			'description' => $this->display_admin_settings_webhook_description(),
Please login to merge, or discard this patch.