Passed
Push — develop ( 880e1e...04c4f1 )
by Remco
09:23 queued 05:16
created
src/readme-md/gateways.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,39 +1,39 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-$data = file_get_contents( __DIR__ . '/../providers.json' );
4
-$data = json_decode( $data );
3
+$data = file_get_contents(__DIR__ . '/../providers.json');
4
+$data = json_decode($data);
5 5
 
6 6
 $providers = array();
7
-foreach ( $data as $provider ) {
8
-	$providers[ $provider->slug ] = $provider;
7
+foreach ($data as $provider) {
8
+	$providers[$provider->slug] = $provider;
9 9
 }
10 10
 
11
-$data     = file_get_contents( __DIR__ . '/../gateways.json' );
12
-$gateways = json_decode( $data );
11
+$data     = file_get_contents(__DIR__ . '/../gateways.json');
12
+$gateways = json_decode($data);
13 13
 
14
-foreach ( $gateways as $gateway ) {
15
-	if ( isset( $providers[ $gateway->provider ] ) ) {
16
-		$provider = $providers[ $gateway->provider ];
14
+foreach ($gateways as $gateway) {
15
+	if (isset($providers[$gateway->provider])) {
16
+		$provider = $providers[$gateway->provider];
17 17
 
18
-		if ( ! isset( $provider->gateways ) ) {
18
+		if ( ! isset($provider->gateways)) {
19 19
 			$provider->gateways = array();
20 20
 		}
21 21
 
22
-		$provider->gateways[ $gateway->slug ] = $gateway;
22
+		$provider->gateways[$gateway->slug] = $gateway;
23 23
 	}
24 24
 }
25 25
 
26 26
 ?>
27 27
 | Provider | Name |
28 28
 | -------- | ---- |
29
-<?php foreach ( $gateways as $gateway ) : ?>
29
+<?php foreach ($gateways as $gateway) : ?>
30 30
 | <?php
31 31
 
32
-if ( isset( $gateway->provider, $providers[ $gateway->provider ] ) ) {
33
-	$provider = $providers[ $gateway->provider ];
32
+if (isset($gateway->provider, $providers[$gateway->provider])) {
33
+	$provider = $providers[$gateway->provider];
34 34
 
35
-	if ( isset( $provider->url ) ) {
36
-		printf( '[%s](%s)', $provider->name, $provider->url );
35
+	if (isset($provider->url)) {
36
+		printf('[%s](%s)', $provider->name, $provider->url);
37 37
 	} else {
38 38
 		echo $provider->name;
39 39
 	}
Please login to merge, or discard this patch.
includes/updates/update-3.7.0.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
 	'Open'      => 'payment_pending',
29 29
 );
30 30
 
31
-foreach ( $states as $meta_value => $post_status ) {
32
-	$condition = empty( $meta_value ) ? 'IS NULL' : '= %s';
31
+foreach ($states as $meta_value => $post_status) {
32
+	$condition = empty($meta_value) ? 'IS NULL' : '= %s';
33 33
 
34 34
 	$query = "
35 35
 		UPDATE
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 		;
49 49
 	";
50 50
 
51
-	$query = $wpdb->prepare( $query, $post_status, $meta_value ); // WPCS: unprepared SQL ok.
51
+	$query = $wpdb->prepare($query, $post_status, $meta_value); // WPCS: unprepared SQL ok.
52 52
 
53
-	$wpdb->query( $query ); // WPCS: unprepared SQL ok.
53
+	$wpdb->query($query); // WPCS: unprepared SQL ok.
54 54
 }
Please login to merge, or discard this patch.
includes/updates/update-3.3.0.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,16 +15,16 @@
 block discarded – undo
15 15
  * @since 3.3.0
16 16
  */
17 17
 
18
-$license_md5 = get_option( 'pronamic_pay_license_key' );
18
+$license_md5 = get_option('pronamic_pay_license_key');
19 19
 
20
-$url = add_query_arg( 'license', $license_md5, 'http://api.pronamic.eu/licenses/convert-md5/1.0/' );
20
+$url = add_query_arg('license', $license_md5, 'http://api.pronamic.eu/licenses/convert-md5/1.0/');
21 21
 
22
-$result = wp_remote_get( $url );
22
+$result = wp_remote_get($url);
23 23
 
24
-if ( 200 === wp_remote_retrieve_response_code( $result ) ) {
25
-	$body = wp_remote_retrieve_body( $result );
24
+if (200 === wp_remote_retrieve_response_code($result)) {
25
+	$body = wp_remote_retrieve_body($result);
26 26
 
27
-	if ( 32 === strlen( $body ) ) {
28
-		update_option( 'pronamic_pay_license_key', $body );
27
+	if (32 === strlen($body)) {
28
+		update_option('pronamic_pay_license_key', $body);
29 29
 	}
30 30
 }
Please login to merge, or discard this patch.
includes/updates/update-2.0.1.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@
 block discarded – undo
32 32
 	'pronamic_ideal_key' => 'pronamic_pay_license_key',
33 33
 );
34 34
 
35
-foreach ( $options as $key_old => $key_new ) {
36
-	$value = get_option( $key_old );
35
+foreach ($options as $key_old => $key_new) {
36
+	$value = get_option($key_old);
37 37
 
38
-	if ( ! empty( $value ) ) {
39
-		update_option( $key_new, $value );
38
+	if ( ! empty($value)) {
39
+		update_option($key_new, $value);
40 40
 	}
41 41
 }
Please login to merge, or discard this patch.
includes/updates/update-3.7.2.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,4 +8,4 @@
 block discarded – undo
8 8
  * @package   Pronamic\WordPress\Pay
9 9
  */
10 10
 
11
-require dirname( __FILE__ ) . '/update-3.7.0.php';
11
+require dirname(__FILE__) . '/update-3.7.0.php';
Please login to merge, or discard this patch.
includes/updates/update-2.0.0.php 1 patch
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 // Check if there is not already an upgrade running
19
-if ( get_transient( 'pronamic_pay_upgrade_200' ) ) {
19
+if (get_transient('pronamic_pay_upgrade_200')) {
20 20
 	return;
21 21
 }
22 22
 
23
-set_transient( 'pronamic_pay_upgrade_200', true, 3600 ); // 60 minutes
23
+set_transient('pronamic_pay_upgrade_200', true, 3600); // 60 minutes
24 24
 
25 25
 // Upgrade
26 26
 global $wpdb;
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
 require_once ABSPATH . '/wp-admin/includes/upgrade.php';
29 29
 
30 30
 $charset_collate = '';
31
-if ( ! empty( $wpdb->charset ) ) {
31
+if ( ! empty($wpdb->charset)) {
32 32
 	$charset_collate = 'DEFAULT CHARACTER SET ' . $wpdb->charset;
33 33
 }
34
-if ( ! empty( $wpdb->collate ) ) {
34
+if ( ! empty($wpdb->collate)) {
35 35
 	$charset_collate .= ' COLLATE ' . $wpdb->collate;
36 36
 }
37 37
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	PRIMARY KEY  (id)
78 78
 ) $charset_collate;";
79 79
 
80
-dbDelta( $sql );
80
+dbDelta($sql);
81 81
 
82 82
 // Query
83 83
 $query = "
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
 
95 95
 $have_configs = true;
96 96
 
97
-while ( $have_configs ) {
98
-	$configs = $wpdb->get_results( $query ); // WPCS: unprepared SQL ok.
97
+while ($have_configs) {
98
+	$configs = $wpdb->get_results($query); // WPCS: unprepared SQL ok.
99 99
 
100
-	$have_configs = ! empty( $configs );
100
+	$have_configs = ! empty($configs);
101 101
 
102
-	foreach ( $configs as $config ) {
103
-		$title = sprintf( __( 'Configuration %d', 'pronamic_ideal' ), $config->id );
102
+	foreach ($configs as $config) {
103
+		$title = sprintf(__('Configuration %d', 'pronamic_ideal'), $config->id);
104 104
 
105 105
 		// Post
106 106
 		$post = array(
@@ -109,9 +109,9 @@  discard block
 block discarded – undo
109 109
 			'post_status' => 'publish',
110 110
 		);
111 111
 
112
-		$post_id = wp_insert_post( $post );
112
+		$post_id = wp_insert_post($post);
113 113
 
114
-		if ( $post_id ) {
114
+		if ($post_id) {
115 115
 			$wpdb->update(
116 116
 				$config_table,
117 117
 				array(
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
 			// Meta
128 128
 			// We ignore (@) all notice of not existing properties
129
-			$config_meta = json_decode( $config->meta );
129
+			$config_meta = json_decode($config->meta);
130 130
 
131 131
 			$meta = array();
132 132
 
@@ -147,18 +147,18 @@  discard block
 block discarded – undo
147 147
 			$meta['ideal_private_certificate']  = $config->private_certificate;
148 148
 
149 149
 			// OmniKassa
150
-			if ( 'rabobank-omnikassa' === $config->variant_id ) {
150
+			if ('rabobank-omnikassa' === $config->variant_id) {
151 151
 				$meta['omnikassa_merchant_id'] = $config->merchant_id;
152 152
 				$meta['omnikassa_secret_key']  = $config->hash_key;
153 153
 
154 154
 				$key_version = @$config_meta->keyVersion;
155 155
 				// In Pronamic iDEAL v1.0 we stored the key version in the iDEAL sub ID
156
-				$key_version = empty( $key_version ) ? $config->sub_id : $key_version;
156
+				$key_version = empty($key_version) ? $config->sub_id : $key_version;
157 157
 
158 158
 				$meta['omnikassa_key_version'] = $key_version;
159 159
 
160
-				unset( $meta['ideal_merchant_id'] );
161
-				unset( $meta['ideal_hash_key'] );
160
+				unset($meta['ideal_merchant_id']);
161
+				unset($meta['ideal_hash_key']);
162 162
 			}
163 163
 
164 164
 			// Buckaroo
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
 			$meta['common_name']       = @$config_meta->commonName;
202 202
 			$meta['email']             = @$config_meta->eMailAddress;
203 203
 
204
-			foreach ( $meta as $key => $value ) {
205
-				if ( ! empty( $value ) ) {
204
+			foreach ($meta as $key => $value) {
205
+				if ( ! empty($value)) {
206 206
 					$meta_key = '_pronamic_gateway_' . $key;
207 207
 
208
-					update_post_meta( $post_id, $meta_key, $value );
208
+					update_post_meta($post_id, $meta_key, $value);
209 209
 				}
210 210
 			}
211 211
 		}
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
 
227 227
 $config_ids_map = array();
228 228
 
229
-$config_ids = $wpdb->get_results( $query ); // WPCS: unprepared SQL ok.
229
+$config_ids = $wpdb->get_results($query); // WPCS: unprepared SQL ok.
230 230
 
231
-foreach ( $config_ids as $config_id ) {
232
-	$config_ids_map[ $config_id->id ] = $config_id->post_id;
231
+foreach ($config_ids as $config_id) {
232
+	$config_ids_map[$config_id->id] = $config_id->post_id;
233 233
 }
234 234
 
235 235
 /**
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	KEY configuration_id (configuration_id)
250 250
 ) $charset_collate;";
251 251
 
252
-dbDelta( $sql );
252
+dbDelta($sql);
253 253
 
254 254
 // Query
255 255
 $query = "
@@ -266,22 +266,22 @@  discard block
 block discarded – undo
266 266
 
267 267
 $have_feeds = true;
268 268
 
269
-while ( $have_feeds ) {
270
-	$feeds = $wpdb->get_results( $query ); // WPCS: unprepared SQL ok.
269
+while ($have_feeds) {
270
+	$feeds = $wpdb->get_results($query); // WPCS: unprepared SQL ok.
271 271
 
272
-	$have_feeds = ! empty( $feeds );
272
+	$have_feeds = ! empty($feeds);
273 273
 
274
-	foreach ( $feeds as $feed ) {
274
+	foreach ($feeds as $feed) {
275 275
 		// Post
276 276
 		$post = array(
277
-			'post_title'  => sprintf( __( 'Payment Form %d', 'pronamic_ideal' ), $feed->id ),
277
+			'post_title'  => sprintf(__('Payment Form %d', 'pronamic_ideal'), $feed->id),
278 278
 			'post_type'   => 'pronamic_pay_gf',
279 279
 			'post_status' => 'publish',
280 280
 		);
281 281
 
282
-		$post_id = wp_insert_post( $post );
282
+		$post_id = wp_insert_post($post);
283 283
 
284
-		if ( $post_id ) {
284
+		if ($post_id) {
285 285
 			$wpdb->update(
286 286
 				$feeds_table,
287 287
 				array(
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
 			// We ignore (@) all notice of not existing properties
299 299
 			$meta = array();
300 300
 
301
-			$feed_meta = json_decode( $feed->meta, true );
301
+			$feed_meta = json_decode($feed->meta, true);
302 302
 
303 303
 			$meta['form_id']                  = $feed->form_id;
304
-			$meta['config_id']                = @$config_ids_map[ $feed->configuration_id ];
304
+			$meta['config_id']                = @$config_ids_map[$feed->configuration_id];
305 305
 			$meta['is_active']                = $feed->is_active;
306 306
 			$meta['transaction_description']  = @$feed_meta['transactionDescription'];
307 307
 			$meta['delay_notification_ids']   = @$feed_meta['delayNotificationIds'];
@@ -316,19 +316,19 @@  discard block
 block discarded – undo
316 316
 			$meta['fields']                   = @$feed_meta['fields'];
317 317
 			$meta['links']                    = @$feed_meta['links'];
318 318
 
319
-			if ( is_array( $meta['links'] ) ) {
320
-				foreach ( $meta['links'] as &$link ) {
321
-					if ( isset( $link['pageId'] ) ) {
319
+			if (is_array($meta['links'])) {
320
+				foreach ($meta['links'] as &$link) {
321
+					if (isset($link['pageId'])) {
322 322
 						$link['page_id'] = $link['pageId'];
323 323
 					}
324 324
 				}
325 325
 			}
326 326
 
327
-			foreach ( $meta as $key => $value ) {
328
-				if ( ! empty( $value ) ) {
327
+			foreach ($meta as $key => $value) {
328
+				if ( ! empty($value)) {
329 329
 					$meta_key = '_pronamic_pay_gf_' . $key;
330 330
 
331
-					update_post_meta( $post_id, $meta_key, $value );
331
+					update_post_meta($post_id, $meta_key, $value);
332 332
 				}
333 333
 			}
334 334
 		}
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 	PRIMARY KEY  (id)
367 367
 ) $charset_collate;";
368 368
 
369
-dbDelta( $sql );
369
+dbDelta($sql);
370 370
 
371 371
 // We convert the payments in groups of 100 so not everything will load in memory at once.
372 372
 $query = "
@@ -383,24 +383,24 @@  discard block
 block discarded – undo
383 383
 
384 384
 $have_payments = true;
385 385
 
386
-while ( $have_payments ) {
387
-	$payments = $wpdb->get_results( $query ); // WPCS: unprepared SQL ok.
386
+while ($have_payments) {
387
+	$payments = $wpdb->get_results($query); // WPCS: unprepared SQL ok.
388 388
 
389
-	$have_payments = ! empty( $payments );
389
+	$have_payments = ! empty($payments);
390 390
 
391
-	foreach ( $payments as $payment ) {
391
+	foreach ($payments as $payment) {
392 392
 		// Post
393 393
 		$post = array(
394
-			'post_title'    => sprintf( __( 'Payment %d', 'pronamic_ideal' ), $payment->id ),
395
-			'post_date'     => get_date_from_gmt( $payment->date_gmt ),
394
+			'post_title'    => sprintf(__('Payment %d', 'pronamic_ideal'), $payment->id),
395
+			'post_date'     => get_date_from_gmt($payment->date_gmt),
396 396
 			'post_date_gmt' => $payment->date_gmt,
397 397
 			'post_type'     => 'pronamic_payment',
398 398
 			'post_status'   => 'publish',
399 399
 		);
400 400
 
401
-		$post_id = wp_insert_post( $post );
401
+		$post_id = wp_insert_post($post);
402 402
 
403
-		if ( $post_id ) {
403
+		if ($post_id) {
404 404
 			$wpdb->update(
405 405
 				$payments_table,
406 406
 				array(
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 
416 416
 			// Meta
417 417
 			$meta = array(
418
-				'config_id'               => @$config_ids_map[ $payment->configuration_id ],
418
+				'config_id'               => @$config_ids_map[$payment->configuration_id],
419 419
 				'purchase_id'             => $payment->purchase_id,
420 420
 				'transaction_id'          => $payment->transaction_id,
421 421
 				'currency'                => $payment->currency,
@@ -435,11 +435,11 @@  discard block
 block discarded – undo
435 435
 				'email'                   => $payment->email,
436 436
 			);
437 437
 
438
-			foreach ( $meta as $key => $value ) {
439
-				if ( ! empty( $value ) ) {
438
+			foreach ($meta as $key => $value) {
439
+				if ( ! empty($value)) {
440 440
 					$meta_key = '_pronamic_payment_' . $key;
441 441
 
442
-					update_post_meta( $post_id, $meta_key, $value );
442
+					update_post_meta($post_id, $meta_key, $value);
443 443
 				}
444 444
 			}
445 445
 		}
@@ -470,13 +470,13 @@  discard block
 block discarded – undo
470 470
 	'pronamic_ideal_wpsc_configuration_id'           => 'pronamic_pay_ideal_wpsc_config_id',
471 471
 );
472 472
 
473
-foreach ( $options as $key_old => $key_new ) {
474
-	$value = get_option( $key_old );
473
+foreach ($options as $key_old => $key_new) {
474
+	$value = get_option($key_old);
475 475
 
476
-	if ( ! empty( $value ) ) {
477
-		$value_new = @$config_ids_map[ $value ];
476
+	if ( ! empty($value)) {
477
+		$value_new = @$config_ids_map[$value];
478 478
 
479
-		update_option( $key_new, $value_new );
479
+		update_option($key_new, $value_new);
480 480
 	}
481 481
 }
482 482
 
@@ -489,23 +489,23 @@  discard block
 block discarded – undo
489 489
 $shopp_meta_table = $wpdb->prefix . 'shopp_meta';
490 490
 
491 491
 // @see http://cube3x.com/2013/04/how-to-check-if-table-exists-in-wordpress-database/
492
-if ( $shopp_meta_table === $wpdb->get_var( "SHOW TABLES LIKE '$shopp_meta_table';" ) ) { // WPCS: unprepared SQL ok.
492
+if ($shopp_meta_table === $wpdb->get_var("SHOW TABLES LIKE '$shopp_meta_table';")) { // WPCS: unprepared SQL ok.
493 493
 	$query = "SELECT id, value FROM $shopp_meta_table WHERE type = 'setting' AND name = 'Pronamic_Shopp_IDeal_GatewayModule';";
494 494
 
495
-	$row = $wpdb->get_row( $query ); // WPCS: unprepared SQL ok.
495
+	$row = $wpdb->get_row($query); // WPCS: unprepared SQL ok.
496 496
 
497
-	if ( $row ) {
498
-		$settings = maybe_unserialize( $row->value );
497
+	if ($row) {
498
+		$settings = maybe_unserialize($row->value);
499 499
 
500
-		if ( is_array( $settings ) && isset( $settings['pronamic_shopp_ideal_configuration'] ) ) {
500
+		if (is_array($settings) && isset($settings['pronamic_shopp_ideal_configuration'])) {
501 501
 			$value = $settings['pronamic_shopp_ideal_configuration'];
502 502
 
503
-			$settings['config_id'] = @$config_ids_map[ $value ];
503
+			$settings['config_id'] = @$config_ids_map[$value];
504 504
 
505 505
 			$wpdb->update(
506 506
 				$shopp_meta_table,
507 507
 				array(
508
-					'value' => serialize( $settings ),
508
+					'value' => serialize($settings),
509 509
 				),
510 510
 				array(
511 511
 					'id' => $row->id,
@@ -517,16 +517,16 @@  discard block
 block discarded – undo
517 517
 
518 518
 // WooCommerce
519 519
 // @see https://github.com/pronamic/wp-pronamic-ideal/blob/1.3.4/classes/Pronamic/WooCommerce/IDeal/IDealGateway.php#L42
520
-$settings = get_option( 'woocommerce_pronamic_ideal_settings' );
520
+$settings = get_option('woocommerce_pronamic_ideal_settings');
521 521
 
522
-if ( is_array( $settings ) && isset( $settings['configuration_id'] ) ) {
522
+if (is_array($settings) && isset($settings['configuration_id'])) {
523 523
 	$value = $settings['configuration_id'];
524 524
 
525
-	$settings['config_id'] = @$config_ids_map[ $value ];
525
+	$settings['config_id'] = @$config_ids_map[$value];
526 526
 
527
-	unset( $settings['configuration_id'] );
527
+	unset($settings['configuration_id']);
528 528
 
529
-	update_option( 'woocommerce_pronamic_pay_ideal_settings', $settings );
529
+	update_option('woocommerce_pronamic_pay_ideal_settings', $settings);
530 530
 }
531 531
 
532
-delete_transient( 'pronamic_pay_upgrade_200' );
532
+delete_transient('pronamic_pay_upgrade_200');
Please login to merge, or discard this patch.
includes/functions.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
  * @param int $post_id A payment post ID.
18 18
  * @return Payment
19 19
  */
20
-function get_pronamic_payment( $post_id ) {
21
-	$payment = new Payment( $post_id );
20
+function get_pronamic_payment($post_id) {
21
+	$payment = new Payment($post_id);
22 22
 
23 23
 	return $payment;
24 24
 }
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
  * @param string $meta_value The Meta value to query for.
31 31
  * @return Payment
32 32
  */
33
-function get_pronamic_payment_by_meta( $meta_key, $meta_value ) {
33
+function get_pronamic_payment_by_meta($meta_key, $meta_value) {
34 34
 	global $wpdb;
35 35
 
36 36
 	$payment = null;
37 37
 
38
-	$db_query = $wpdb->prepare( "
38
+	$db_query = $wpdb->prepare("
39 39
 		SELECT
40 40
 			post_id
41 41
 		FROM
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
 				AND
46 46
 			meta_value = %s
47 47
 			;
48
-	", $meta_key, $meta_value );
48
+	", $meta_key, $meta_value);
49 49
 
50
-	$post_id = $wpdb->get_var( $db_query ); // WPCS: unprepared SQL ok.
50
+	$post_id = $wpdb->get_var($db_query); // WPCS: unprepared SQL ok.
51 51
 
52
-	if ( $post_id ) {
53
-		$payment = new Payment( $post_id );
52
+	if ($post_id) {
53
+		$payment = new Payment($post_id);
54 54
 	}
55 55
 
56 56
 	return $payment;
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
  * @param string $meta_value The Meta value to query for.
64 64
  * @return array
65 65
  */
66
-function get_pronamic_payments_by_meta( $meta_key, $meta_value ) {
66
+function get_pronamic_payments_by_meta($meta_key, $meta_value) {
67 67
 	global $wpdb;
68 68
 
69 69
 	$payments = array();
70 70
 
71
-	$db_query = $wpdb->prepare( "
71
+	$db_query = $wpdb->prepare("
72 72
 		SELECT
73 73
 			post_id
74 74
 		FROM
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
 		ORDER BY
81 81
 			meta_id ASC
82 82
 			;
83
-	", $meta_key, $meta_value );
83
+	", $meta_key, $meta_value);
84 84
 
85
-	$results = $wpdb->get_results( $db_query ); // WPCS: unprepared SQL ok.
85
+	$results = $wpdb->get_results($db_query); // WPCS: unprepared SQL ok.
86 86
 
87
-	foreach ( $results as $result ) {
88
-		$payments[] = new Payment( $result->post_id );
87
+	foreach ($results as $result) {
88
+		$payments[] = new Payment($result->post_id);
89 89
 	}
90 90
 
91 91
 	return $payments;
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
  * @param string $purchase_id The purchase ID to query for.
98 98
  * @return Payment
99 99
  */
100
-function get_pronamic_payment_by_purchase_id( $purchase_id ) {
101
-	return get_pronamic_payment_by_meta( '_pronamic_payment_purchase_id', $purchase_id );
100
+function get_pronamic_payment_by_purchase_id($purchase_id) {
101
+	return get_pronamic_payment_by_meta('_pronamic_payment_purchase_id', $purchase_id);
102 102
 }
103 103
 
104 104
 /**
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
  * @param string $entrance_code  The entrance code to query for.
109 109
  * @return Payment
110 110
  */
111
-function get_pronamic_payment_by_transaction_id( $transaction_id, $entrance_code = null ) {
112
-	return get_pronamic_payment_by_meta( '_pronamic_payment_transaction_id', $transaction_id );
111
+function get_pronamic_payment_by_transaction_id($transaction_id, $entrance_code = null) {
112
+	return get_pronamic_payment_by_meta('_pronamic_payment_transaction_id', $transaction_id);
113 113
 }
114 114
 
115 115
 /**
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
  * @param int $post_id A subscription post ID.
119 119
  * @return Subscription
120 120
  */
121
-function get_pronamic_subscription( $post_id ) {
122
-	$subscription = new Subscription( $post_id );
121
+function get_pronamic_subscription($post_id) {
122
+	$subscription = new Subscription($post_id);
123 123
 
124 124
 	return $subscription;
125 125
 }
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
  * @param string $meta_value The Meta value to query for.
132 132
  * @return Subscription
133 133
  */
134
-function get_pronamic_subscription_by_meta( $meta_key, $meta_value ) {
134
+function get_pronamic_subscription_by_meta($meta_key, $meta_value) {
135 135
 	global $wpdb;
136 136
 
137 137
 	$subscription = null;
138 138
 
139
-	$db_query = $wpdb->prepare( "
139
+	$db_query = $wpdb->prepare("
140 140
 		SELECT
141 141
 			post_id
142 142
 		FROM
@@ -146,12 +146,12 @@  discard block
 block discarded – undo
146 146
 				AND
147 147
 			meta_value = %s
148 148
 			;
149
-	", $meta_key, $meta_value );
149
+	", $meta_key, $meta_value);
150 150
 
151
-	$post_id = $wpdb->get_var( $db_query ); // WPCS: unprepared SQL ok.
151
+	$post_id = $wpdb->get_var($db_query); // WPCS: unprepared SQL ok.
152 152
 
153
-	if ( $post_id ) {
154
-		$subscription = new Subscription( $post_id );
153
+	if ($post_id) {
154
+		$subscription = new Subscription($post_id);
155 155
 	}
156 156
 
157 157
 	return $subscription;
@@ -165,11 +165,11 @@  discard block
 block discarded – undo
165 165
 
166 166
 	global $pronamic_ideal;
167 167
 
168
-	foreach ( $pronamic_ideal->gateway_integrations as $integration ) {
169
-		if ( isset( $pronamic_pay_providers[ $integration->provider ] ) ) {
170
-			$provider =& $pronamic_pay_providers[ $integration->provider ];
168
+	foreach ($pronamic_ideal->gateway_integrations as $integration) {
169
+		if (isset($pronamic_pay_providers[$integration->provider])) {
170
+			$provider = & $pronamic_pay_providers[$integration->provider];
171 171
 
172
-			if ( ! isset( $provider['integrations'] ) ) {
172
+			if ( ! isset($provider['integrations'])) {
173 173
 				$provider['integrations'] = array();
174 174
 			}
175 175
 
@@ -188,11 +188,11 @@  discard block
 block discarded – undo
188 188
  * @param string $size A php.ini notation for nubmer to convert to an integer.
189 189
  * @return int
190 190
  */
191
-function pronamic_pay_let_to_num( $size ) {
192
-	$l   = substr( $size, -1 );
193
-	$ret = substr( $size, 0, -1 );
191
+function pronamic_pay_let_to_num($size) {
192
+	$l   = substr($size, -1);
193
+	$ret = substr($size, 0, -1);
194 194
 
195
-	switch ( strtoupper( $l ) ) {
195
+	switch (strtoupper($l)) {
196 196
 		case 'P':
197 197
 			$ret *= 1024;
198 198
 			// no break.
@@ -222,10 +222,10 @@  discard block
 block discarded – undo
222 222
 	global $wp_locale;
223 223
 
224 224
 	// Seperator.
225
-	$separator = get_option( 'pronamic_pay_thousands_sep' );
225
+	$separator = get_option('pronamic_pay_thousands_sep');
226 226
 
227 227
 	// WordPress.
228
-	if ( false === $separator ) {
228
+	if (false === $separator) {
229 229
 		// WordPress locale number format was introduced in WordPress version 2.3.
230 230
 		// @see https://github.com/WordPress/WordPress/blob/2.3/wp-includes/locale.php#L90-L100.
231 231
 		$separator = $wp_locale->number_format['thousands_sep'];
@@ -243,10 +243,10 @@  discard block
 block discarded – undo
243 243
 	global $wp_locale;
244 244
 
245 245
 	// Seperator.
246
-	$separator = get_option( 'pronamic_pay_decimal_sep' );
246
+	$separator = get_option('pronamic_pay_decimal_sep');
247 247
 
248 248
 	// WordPress.
249
-	if ( false === $separator ) {
249
+	if (false === $separator) {
250 250
 		// WordPress locale number format was introduced in WordPress version 2.3.
251 251
 		// @see https://github.com/WordPress/WordPress/blob/2.3/wp-includes/locale.php#L90-L100.
252 252
 		$separator = $wp_locale->number_format['decimal_point'];
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
  * @param string $page Pronamic Pay page identifier slug.
264 264
  * @return int
265 265
  */
266
-function pronamic_pay_get_page_id( $page ) {
267
-	$option = sprintf( 'pronamic_pay_%s_page_id', $page );
266
+function pronamic_pay_get_page_id($page) {
267
+	$option = sprintf('pronamic_pay_%s_page_id', $page);
268 268
 
269
-	return get_option( $option, -1 );
269
+	return get_option($option, -1);
270 270
 }
271 271
 
272 272
 /**
@@ -276,20 +276,20 @@  discard block
 block discarded – undo
276 276
  * @param int   $post_id The post ID to update the specified meta data for.
277 277
  * @param array $data    The data array with meta keys/values.
278 278
  */
279
-function pronamic_pay_update_post_meta_data( $post_id, array $data ) {
279
+function pronamic_pay_update_post_meta_data($post_id, array $data) {
280 280
 	/*
281 281
 	 * Post meta values are passed through the stripslashes() function
282 282
 	 * upon being stored, so you will need to be careful when passing
283 283
 	 * in values such as JSON that might include \ escaped characters.
284 284
 	 */
285
-	$data = wp_slash( $data );
285
+	$data = wp_slash($data);
286 286
 
287 287
 	// Meta.
288
-	foreach ( $data as $key => $value ) {
289
-		if ( isset( $value ) && '' !== $value ) {
290
-			update_post_meta( $post_id, $key, $value );
288
+	foreach ($data as $key => $value) {
289
+		if (isset($value) && '' !== $value) {
290
+			update_post_meta($post_id, $key, $value);
291 291
 		} else {
292
-			delete_post_meta( $post_id, $key );
292
+			delete_post_meta($post_id, $key);
293 293
 		}
294 294
 	}
295 295
 }
Please login to merge, or discard this patch.
admin/pointer-forms.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,18 +9,18 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 ?>
12
-<h3><?php esc_html_e( 'Payment Forms', 'pronamic_ideal' ); ?></h3>
12
+<h3><?php esc_html_e('Payment Forms', 'pronamic_ideal'); ?></h3>
13 13
 
14 14
 <p>
15
-	<?php esc_html_e( 'On the payment forms page you can add, edit or delete simple payment forms.', 'pronamic_ideal' ); ?>
16
-	<?php esc_html_e( 'Currently it’s not possible to adjust the form fields or styling of these forms.', 'pronamic_ideal' ); ?>
15
+	<?php esc_html_e('On the payment forms page you can add, edit or delete simple payment forms.', 'pronamic_ideal'); ?>
16
+	<?php esc_html_e('Currently it’s not possible to adjust the form fields or styling of these forms.', 'pronamic_ideal'); ?>
17 17
 	<?php
18 18
 
19 19
 	echo wp_kses(
20 20
 		sprintf(
21
-			__( 'For more advanced payment forms we advice you to use the <a href="%1$s" target="%2$s">“Gravity Forms” plugin</a>.', 'pronamic_ideal' ),
22
-			esc_attr( 'https://www.e-junkie.com/ecom/gb.php?cl=54585&c=ib&aff=226579' ),
23
-			esc_attr( '_blank' )
21
+			__('For more advanced payment forms we advice you to use the <a href="%1$s" target="%2$s">“Gravity Forms” plugin</a>.', 'pronamic_ideal'),
22
+			esc_attr('https://www.e-junkie.com/ecom/gb.php?cl=54585&c=ib&aff=226579'),
23
+			esc_attr('_blank')
24 24
 		),
25 25
 		array(
26 26
 			'a' => array(
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
 </p>
35 35
 
36 36
 <div class="wp-pointer-buttons pp-pointer-buttons">
37
-	<a href="<?php echo esc_attr( add_query_arg( 'post_type', 'pronamic_gateway', admin_url( 'edit.php' ) ) ); ?>" class="button-secondary pp-pointer-button-prev"><?php esc_html_e( 'Previous', 'pronamic_ideal' ); ?></a>
37
+	<a href="<?php echo esc_attr(add_query_arg('post_type', 'pronamic_gateway', admin_url('edit.php'))); ?>" class="button-secondary pp-pointer-button-prev"><?php esc_html_e('Previous', 'pronamic_ideal'); ?></a>
38 38
 
39 39
 	<span class="pp-pointer-buttons-right">
40
-		<a href="<?php echo esc_attr( add_query_arg( 'page', 'pronamic_pay_reports', admin_url( 'admin.php' ) ) ); ?>" class="button-primary pp-pointer-button-next"><?php esc_html_e( 'Next', 'pronamic_ideal' ); ?></a>
40
+		<a href="<?php echo esc_attr(add_query_arg('page', 'pronamic_pay_reports', admin_url('admin.php'))); ?>" class="button-primary pp-pointer-button-next"><?php esc_html_e('Next', 'pronamic_ideal'); ?></a>
41 41
 
42
-		<a href="<?php echo esc_attr( $this->get_close_url() ); ?>" class="button-secondary pp-pointer-button-close"><?php esc_html_e( 'Close', 'pronamic_ideal' ); ?></a>
42
+		<a href="<?php echo esc_attr($this->get_close_url()); ?>" class="button-secondary pp-pointer-button-close"><?php esc_html_e('Close', 'pronamic_ideal'); ?></a>
43 43
 	</span>
44 44
 </div>
Please login to merge, or discard this patch.
admin/page-about.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -15,20 +15,20 @@  discard block
 block discarded – undo
15 15
  */
16 16
 
17 17
 // If this file is called directly, abort.
18
-if ( ! defined( 'WPINC' ) ) {
18
+if ( ! defined('WPINC')) {
19 19
 	die;
20 20
 }
21 21
 
22 22
 ?>
23 23
 <div class="wrap about-wrap">
24
-	<h1><?php esc_html_e( 'Welcome to Pronamic Pay', 'pronamic_ideal' ); ?></h1>
24
+	<h1><?php esc_html_e('Welcome to Pronamic Pay', 'pronamic_ideal'); ?></h1>
25 25
 
26 26
 	<div class="about-text">
27 27
 		<?php
28 28
 
29 29
 		printf(
30
-			esc_html__( 'Thanks for installing Pronamic Pay. Version %s is more powerful, stable and secure than ever before. We hope you enjoy using it.', 'pronamic_ideal' ),
31
-			esc_html( $this->plugin->get_version() )
30
+			esc_html__('Thanks for installing Pronamic Pay. Version %s is more powerful, stable and secure than ever before. We hope you enjoy using it.', 'pronamic_ideal'),
31
+			esc_html($this->plugin->get_version())
32 32
 		);
33 33
 
34 34
 		?>
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 		<?php
39 39
 
40 40
 		printf(
41
-			esc_html__( 'Version: %s', 'pronamic_ideal' ),
42
-			esc_html( $this->plugin->get_version() )
41
+			esc_html__('Version: %s', 'pronamic_ideal'),
42
+			esc_html($this->plugin->get_version())
43 43
 		);
44 44
 
45 45
 		?>
@@ -49,27 +49,27 @@  discard block
 block discarded – undo
49 49
 		<?php
50 50
 
51 51
 		$tabs = array(
52
-			'new'             => __( 'What is new', 'pronamic_ideal' ),
53
-			'getting-started' => __( 'Getting started', 'pronamic_ideal' ),
52
+			'new'             => __('What is new', 'pronamic_ideal'),
53
+			'getting-started' => __('Getting started', 'pronamic_ideal'),
54 54
 		);
55 55
 
56
-		$current_tab = filter_input( INPUT_GET, 'tab', FILTER_SANITIZE_STRING );
57
-		$current_tab = empty( $current_tab ) ? key( $tabs ) : $current_tab;
56
+		$current_tab = filter_input(INPUT_GET, 'tab', FILTER_SANITIZE_STRING);
57
+		$current_tab = empty($current_tab) ? key($tabs) : $current_tab;
58 58
 
59
-		foreach ( $tabs as $tab => $title ) {
60
-			$classes = array( 'nav-tab' );
59
+		foreach ($tabs as $tab => $title) {
60
+			$classes = array('nav-tab');
61 61
 
62
-			if ( $current_tab === $tab ) {
62
+			if ($current_tab === $tab) {
63 63
 				$classes[] = 'nav-tab-active';
64 64
 			}
65 65
 
66
-			$url = add_query_arg( 'tab', $tab );
66
+			$url = add_query_arg('tab', $tab);
67 67
 
68 68
 			printf(
69 69
 				'<a class="nav-tab %s" href="%s">%s</a>',
70
-				esc_attr( implode( ' ', $classes ) ),
71
-				esc_attr( $url ),
72
-				esc_html( $title )
70
+				esc_attr(implode(' ', $classes)),
71
+				esc_attr($url),
72
+				esc_html($title)
73 73
 			);
74 74
 		}
75 75
 
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 
79 79
 	<?php
80 80
 
81
-	$file = plugin_dir_path( Plugin::$file ) . 'admin/tab-' . $current_tab . '.php';
81
+	$file = plugin_dir_path(Plugin::$file) . 'admin/tab-' . $current_tab . '.php';
82 82
 
83
-	if ( is_readable( $file ) ) {
83
+	if (is_readable($file)) {
84 84
 		include $file;
85 85
 	}
86 86
 
Please login to merge, or discard this patch.