Test Failed
Pull Request — master (#3152)
by Devin
07:21
created
includes/class-give-cache.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 *
122 122
 	 * @param  string $cache_key
123 123
 	 * @param  bool   $custom_key
124
-	 * @param  mixed  $query_args
124
+	 * @param  string  $query_args
125 125
 	 *
126 126
 	 * @return mixed
127 127
 	 */
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 	 *
238 238
 	 * @param bool  $force If set to true then all cached values will be delete instead of only expired
239 239
 	 *
240
-	 * @return bool
240
+	 * @return false|null
241 241
 	 */
242 242
 	public static function delete_all_expired( $force = false ) {
243 243
 		global $wpdb;
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
 	 * @since  2.0
670 670
 	 * @access private
671 671
 	 *
672
-	 * @param $group
672
+	 * @param string $group
673 673
 	 *
674 674
 	 * @return mixed
675 675
 	 */
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -722,9 +722,9 @@
 block discarded – undo
722 722
 	public static function flush_cache() {
723 723
 		if (
724 724
 			( Give_Admin_Settings::is_saving_settings()
725
-		       && isset( $_POST['cache'] )
726
-		       && give_is_setting_enabled( give_clean( $_POST['cache'] ) )
727
-		     )
725
+			   && isset( $_POST['cache'] )
726
+			   && give_is_setting_enabled( give_clean( $_POST['cache'] ) )
727
+			 )
728 728
 			|| ( wp_doing_ajax() && 'give_cache_flush' === give_clean( $_GET['action'] ) )
729 729
 		) {
730 730
 			self::$instance->get_incrementer( true );
Please login to merge, or discard this patch.
Spacing   +146 added lines, -146 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 * @return static
54 54
 	 */
55 55
 	public static function get_instance() {
56
-		if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give_Cache ) ) {
56
+		if ( ! isset(self::$instance) && ! (self::$instance instanceof Give_Cache)) {
57 57
 			self::$instance = new Give_Cache();
58 58
 		}
59 59
 
@@ -68,20 +68,20 @@  discard block
 block discarded – undo
68 68
 	 */
69 69
 	public function setup() {
70 70
 		// Currently enable cache only for backend.
71
-		self::$instance->is_cache = ( defined( 'GIVE_CACHE' ) ? GIVE_CACHE : give_is_setting_enabled( give_get_option( 'cache', 'enabled' ) ) ) && is_admin();
71
+		self::$instance->is_cache = (defined('GIVE_CACHE') ? GIVE_CACHE : give_is_setting_enabled(give_get_option('cache', 'enabled'))) && is_admin();
72 72
 
73 73
 		// weekly delete all expired cache.
74
-		Give_Cron::add_weekly_event( array( $this, 'delete_all_expired' ) );
74
+		Give_Cron::add_weekly_event(array($this, 'delete_all_expired'));
75 75
 
76
-		add_action( 'save_post_give_forms', array( $this, 'delete_form_related_cache' ) );
77
-		add_action( 'save_post_give_payment', array( $this, 'delete_payment_related_cache' ) );
78
-		add_action( 'give_deleted_give-donors_cache', array( $this, 'delete_donor_related_cache' ), 10, 3 );
79
-		add_action( 'give_deleted_give-donations_cache', array( $this, 'delete_donations_related_cache' ), 10, 3 );
76
+		add_action('save_post_give_forms', array($this, 'delete_form_related_cache'));
77
+		add_action('save_post_give_payment', array($this, 'delete_payment_related_cache'));
78
+		add_action('give_deleted_give-donors_cache', array($this, 'delete_donor_related_cache'), 10, 3);
79
+		add_action('give_deleted_give-donations_cache', array($this, 'delete_donations_related_cache'), 10, 3);
80 80
 
81
-		add_action( 'give_save_settings_give_settings', array( __CLASS__, 'flush_cache' ) );
81
+		add_action('give_save_settings_give_settings', array(__CLASS__, 'flush_cache'));
82 82
 
83
-		add_action( 'wp', array( __CLASS__,  'prevent_caching' ) );
84
-		add_action( 'admin_notices', array( $this, '__notices' ) );
83
+		add_action('wp', array(__CLASS__, 'prevent_caching'));
84
+		add_action('admin_notices', array($this, '__notices'));
85 85
 	}
86 86
 
87 87
 	/**
@@ -92,19 +92,19 @@  discard block
 block discarded – undo
92 92
 	 * @credit WooCommerce
93 93
 	 */
94 94
 	public static function prevent_caching() {
95
-		if ( ! is_blog_installed() ) {
95
+		if ( ! is_blog_installed()) {
96 96
 			return;
97 97
 		}
98 98
 
99
-		$page_ids = array_filter( array(
100
-			give_get_option( 'success_page' ),
101
-			give_get_option( 'failure_page' ),
102
-			give_get_option( 'history_page' ),
103
-		) );
99
+		$page_ids = array_filter(array(
100
+			give_get_option('success_page'),
101
+			give_get_option('failure_page'),
102
+			give_get_option('history_page'),
103
+		));
104 104
 
105 105
 		if (
106
-			is_page( $page_ids )
107
-			|| is_singular( 'give_forms' )
106
+			is_page($page_ids)
107
+			|| is_singular('give_forms')
108 108
 		) {
109 109
 			self::set_nocache_constants();
110 110
 			nocache_headers();
@@ -122,10 +122,10 @@  discard block
 block discarded – undo
122 122
 	 *
123 123
 	 * @return mixed
124 124
 	 */
125
-	public static function set_nocache_constants( $return = true ) {
126
-		give_maybe_define_constant( 'DONOTCACHEPAGE', true );
127
-		give_maybe_define_constant( 'DONOTCACHEOBJECT', true );
128
-		give_maybe_define_constant( 'DONOTCACHEDB', true );
125
+	public static function set_nocache_constants($return = true) {
126
+		give_maybe_define_constant('DONOTCACHEPAGE', true);
127
+		give_maybe_define_constant('DONOTCACHEOBJECT', true);
128
+		give_maybe_define_constant('DONOTCACHEDB', true);
129 129
 
130 130
 		return $return;
131 131
 	}
@@ -138,18 +138,18 @@  discard block
 block discarded – undo
138 138
 	 * @credit WooCommerce
139 139
 	 */
140 140
 	public function __notices() {
141
-		if ( ! function_exists( 'w3tc_pgcache_flush' ) || ! function_exists( 'w3_instance' ) ) {
141
+		if ( ! function_exists('w3tc_pgcache_flush') || ! function_exists('w3_instance')) {
142 142
 			return;
143 143
 		}
144 144
 
145
-		$config   = w3_instance( 'W3_Config' );
146
-		$enabled  = $config->get_integer( 'dbcache.enabled' );
147
-		$settings = array_map( 'trim', $config->get_array( 'dbcache.reject.sql' ) );
145
+		$config   = w3_instance('W3_Config');
146
+		$enabled  = $config->get_integer('dbcache.enabled');
147
+		$settings = array_map('trim', $config->get_array('dbcache.reject.sql'));
148 148
 
149
-		if ( $enabled && ! in_array( 'give', $settings, true ) ) {
149
+		if ($enabled && ! in_array('give', $settings, true)) {
150 150
 			?>
151 151
 			<div class="error">
152
-				<p><?php echo wp_kses_post( sprintf( __( 'In order for <strong>database caching</strong> to work with Give you must add %1$s to the "Ignored Query Strings" option in <a href="%2$s">W3 Total Cache settings</a>.', 'give' ), '<code>give</code>', esc_url( admin_url( 'admin.php?page=w3tc_dbcache' ) ) ) ); ?></p>
152
+				<p><?php echo wp_kses_post(sprintf(__('In order for <strong>database caching</strong> to work with Give you must add %1$s to the "Ignored Query Strings" option in <a href="%2$s">W3 Total Cache settings</a>.', 'give'), '<code>give</code>', esc_url(admin_url('admin.php?page=w3tc_dbcache')))); ?></p>
153 153
 			</div>
154 154
 			<?php
155 155
 		}
@@ -166,18 +166,18 @@  discard block
 block discarded – undo
166 166
 	 *
167 167
 	 * @return string
168 168
 	 */
169
-	public static function get_key( $action, $query_args = null, $is_prefix = true ) {
169
+	public static function get_key($action, $query_args = null, $is_prefix = true) {
170 170
 		// Bailout.
171
-		if ( empty( $action ) ) {
172
-			return new WP_Error( 'give_invalid_cache_key_action', __( 'Do not pass empty action to generate cache key.', 'give' ) );
171
+		if (empty($action)) {
172
+			return new WP_Error('give_invalid_cache_key_action', __('Do not pass empty action to generate cache key.', 'give'));
173 173
 		}
174 174
 
175 175
 		// Set cache key.
176 176
 		$cache_key = $is_prefix ? "give_cache_{$action}" : $action;
177 177
 
178 178
 		// Bailout.
179
-		if ( ! empty( $query_args ) ) {
180
-			$cache_key = "{$cache_key}_" . substr( md5( serialize( $query_args ) ), 0, 15 );
179
+		if ( ! empty($query_args)) {
180
+			$cache_key = "{$cache_key}_".substr(md5(serialize($query_args)), 0, 15);
181 181
 		}
182 182
 
183 183
 		/**
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 		 *
186 186
 		 * @since 2.0
187 187
 		 */
188
-		return apply_filters( 'give_get_cache_key', $cache_key, $action, $query_args );
188
+		return apply_filters('give_get_cache_key', $cache_key, $action, $query_args);
189 189
 	}
190 190
 
191 191
 	/**
@@ -199,26 +199,26 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @return mixed
201 201
 	 */
202
-	public static function get( $cache_key, $custom_key = false, $query_args = array() ) {
203
-		if ( ! self::is_valid_cache_key( $cache_key ) ) {
204
-			if ( ! $custom_key ) {
205
-				return new WP_Error( 'give_invalid_cache_key', __( 'Cache key format should be give_cache_*', 'give' ) );
202
+	public static function get($cache_key, $custom_key = false, $query_args = array()) {
203
+		if ( ! self::is_valid_cache_key($cache_key)) {
204
+			if ( ! $custom_key) {
205
+				return new WP_Error('give_invalid_cache_key', __('Cache key format should be give_cache_*', 'give'));
206 206
 			}
207 207
 
208
-			$cache_key = self::get_key( $cache_key, $query_args );
208
+			$cache_key = self::get_key($cache_key, $query_args);
209 209
 		}
210 210
 
211
-		$option = get_option( $cache_key );
211
+		$option = get_option($cache_key);
212 212
 
213 213
 		// Backward compatibility (<1.8.7).
214
-		if ( ! is_array( $option ) || empty( $option ) || ! array_key_exists( 'expiration', $option ) ) {
214
+		if ( ! is_array($option) || empty($option) || ! array_key_exists('expiration', $option)) {
215 215
 			return $option;
216 216
 		}
217 217
 
218 218
 		// Get current time.
219
-		$current_time = current_time( 'timestamp', 1 );
219
+		$current_time = current_time('timestamp', 1);
220 220
 
221
-		if ( empty( $option['expiration'] ) || ( $current_time < $option['expiration'] ) ) {
221
+		if (empty($option['expiration']) || ($current_time < $option['expiration'])) {
222 222
 			$option = $option['data'];
223 223
 		} else {
224 224
 			$option = false;
@@ -240,23 +240,23 @@  discard block
 block discarded – undo
240 240
 	 *
241 241
 	 * @return mixed
242 242
 	 */
243
-	public static function set( $cache_key, $data, $expiration = null, $custom_key = false, $query_args = array() ) {
244
-		if ( ! self::is_valid_cache_key( $cache_key ) ) {
245
-			if ( ! $custom_key ) {
246
-				return new WP_Error( 'give_invalid_cache_key', __( 'Cache key format should be give_cache_*', 'give' ) );
243
+	public static function set($cache_key, $data, $expiration = null, $custom_key = false, $query_args = array()) {
244
+		if ( ! self::is_valid_cache_key($cache_key)) {
245
+			if ( ! $custom_key) {
246
+				return new WP_Error('give_invalid_cache_key', __('Cache key format should be give_cache_*', 'give'));
247 247
 			}
248 248
 
249
-			$cache_key = self::get_key( $cache_key, $query_args );
249
+			$cache_key = self::get_key($cache_key, $query_args);
250 250
 		}
251 251
 
252 252
 		$option_value = array(
253 253
 			'data'       => $data,
254
-			'expiration' => ! is_null( $expiration )
255
-				? ( $expiration + current_time( 'timestamp', 1 ) )
254
+			'expiration' => ! is_null($expiration)
255
+				? ($expiration + current_time('timestamp', 1))
256 256
 				: null,
257 257
 		);
258 258
 
259
-		$result = update_option( $cache_key, $option_value, 'no' );
259
+		$result = update_option($cache_key, $option_value, 'no');
260 260
 
261 261
 		return $result;
262 262
 	}
@@ -272,27 +272,27 @@  discard block
 block discarded – undo
272 272
 	 *
273 273
 	 * @return bool|WP_Error
274 274
 	 */
275
-	public static function delete( $cache_keys ) {
275
+	public static function delete($cache_keys) {
276 276
 		$result       = true;
277 277
 		$invalid_keys = array();
278 278
 
279
-		if ( ! empty( $cache_keys ) ) {
280
-			$cache_keys = is_array( $cache_keys ) ? $cache_keys : array( $cache_keys );
279
+		if ( ! empty($cache_keys)) {
280
+			$cache_keys = is_array($cache_keys) ? $cache_keys : array($cache_keys);
281 281
 
282
-			foreach ( $cache_keys as $cache_key ) {
283
-				if ( ! self::is_valid_cache_key( $cache_key ) ) {
282
+			foreach ($cache_keys as $cache_key) {
283
+				if ( ! self::is_valid_cache_key($cache_key)) {
284 284
 					$invalid_keys[] = $cache_key;
285 285
 					$result         = false;
286 286
 				}
287 287
 
288
-				delete_option( $cache_key );
288
+				delete_option($cache_key);
289 289
 			}
290 290
 		}
291 291
 
292
-		if ( ! $result ) {
292
+		if ( ! $result) {
293 293
 			$result = new WP_Error(
294 294
 				'give_invalid_cache_key',
295
-				__( 'Cache key format should be give_cache_*', 'give' ),
295
+				__('Cache key format should be give_cache_*', 'give'),
296 296
 				$invalid_keys
297 297
 			);
298 298
 		}
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	 *
314 314
 	 * @return bool
315 315
 	 */
316
-	public static function delete_all_expired( $force = false ) {
316
+	public static function delete_all_expired($force = false) {
317 317
 		global $wpdb;
318 318
 		$options = $wpdb->get_results(
319 319
 			$wpdb->prepare(
@@ -327,30 +327,30 @@  discard block
 block discarded – undo
327 327
 		);
328 328
 
329 329
 		// Bailout.
330
-		if ( empty( $options ) ) {
330
+		if (empty($options)) {
331 331
 			return false;
332 332
 		}
333 333
 
334
-		$current_time = current_time( 'timestamp', 1 );
334
+		$current_time = current_time('timestamp', 1);
335 335
 
336 336
 		// Delete log cache.
337
-		foreach ( $options as $option ) {
338
-			$option['option_value'] = maybe_unserialize( $option['option_value'] );
337
+		foreach ($options as $option) {
338
+			$option['option_value'] = maybe_unserialize($option['option_value']);
339 339
 
340 340
 			if (
341 341
 				(
342
-					! self::is_valid_cache_key( $option['option_name'] )
343
-					|| ! is_array( $option['option_value'] ) // Backward compatibility (<1.8.7).
344
-					|| ! array_key_exists( 'expiration', $option['option_value'] ) // Backward compatibility (<1.8.7).
345
-					|| empty( $option['option_value']['expiration'] )
346
-					|| ( $current_time < $option['option_value']['expiration'] )
342
+					! self::is_valid_cache_key($option['option_name'])
343
+					|| ! is_array($option['option_value']) // Backward compatibility (<1.8.7).
344
+					|| ! array_key_exists('expiration', $option['option_value']) // Backward compatibility (<1.8.7).
345
+					|| empty($option['option_value']['expiration'])
346
+					|| ($current_time < $option['option_value']['expiration'])
347 347
 				)
348 348
 				&& ! $force
349 349
 			) {
350 350
 				continue;
351 351
 			}
352 352
 
353
-			self::delete( $option['option_name'] );
353
+			self::delete($option['option_name']);
354 354
 		}
355 355
 	}
356 356
 
@@ -368,12 +368,12 @@  discard block
 block discarded – undo
368 368
 	 *
369 369
 	 * @return array
370 370
 	 */
371
-	public static function get_options_like( $option_name, $fields = false ) {
371
+	public static function get_options_like($option_name, $fields = false) {
372 372
 		global $wpdb;
373 373
 
374 374
 		$field_names = $fields ? 'option_name, option_value' : 'option_name';
375 375
 
376
-		if ( $fields ) {
376
+		if ($fields) {
377 377
 			$options = $wpdb->get_results(
378 378
 				$wpdb->prepare(
379 379
 					"SELECT {$field_names }
@@ -397,10 +397,10 @@  discard block
 block discarded – undo
397 397
 			);
398 398
 		}
399 399
 
400
-		if ( ! empty( $options ) && $fields ) {
401
-			foreach ( $options as $index => $option ) {
402
-				$option['option_value'] = maybe_unserialize( $option['option_value'] );
403
-				$options[ $index ]      = $option;
400
+		if ( ! empty($options) && $fields) {
401
+			foreach ($options as $index => $option) {
402
+				$option['option_value'] = maybe_unserialize($option['option_value']);
403
+				$options[$index]      = $option;
404 404
 			}
405 405
 		}
406 406
 
@@ -417,8 +417,8 @@  discard block
 block discarded – undo
417 417
 	 *
418 418
 	 * @return bool
419 419
 	 */
420
-	public static function is_valid_cache_key( $cache_key ) {
421
-		$is_valid = ( false !== strpos( $cache_key, 'give_cache_' ) );
420
+	public static function is_valid_cache_key($cache_key) {
421
+		$is_valid = (false !== strpos($cache_key, 'give_cache_'));
422 422
 
423 423
 
424 424
 		/**
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 		 *
427 427
 		 * @since 2.0
428 428
 		 */
429
-		return apply_filters( 'give_is_valid_cache_key', $is_valid, $cache_key );
429
+		return apply_filters('give_is_valid_cache_key', $is_valid, $cache_key);
430 430
 	}
431 431
 
432 432
 
@@ -441,14 +441,14 @@  discard block
 block discarded – undo
441 441
 	 *
442 442
 	 * @return mixed
443 443
 	 */
444
-	public static function get_group( $id, $group = '' ) {
444
+	public static function get_group($id, $group = '') {
445 445
 		$cached_data = null;
446 446
 
447 447
 		// Bailout.
448
-		if ( self::$instance->is_cache && ! empty( $id ) ) {
449
-			$group = self::$instance->filter_group_name( $group );
448
+		if (self::$instance->is_cache && ! empty($id)) {
449
+			$group = self::$instance->filter_group_name($group);
450 450
 
451
-			$cached_data = wp_cache_get( $id, $group );
451
+			$cached_data = wp_cache_get($id, $group);
452 452
 			$cached_data = false !== $cached_data ? $cached_data : null;
453 453
 		}
454 454
 
@@ -468,17 +468,17 @@  discard block
 block discarded – undo
468 468
 	 *
469 469
 	 * @return bool
470 470
 	 */
471
-	public static function set_group( $id, $data, $group = '', $expire = 0 ) {
471
+	public static function set_group($id, $data, $group = '', $expire = 0) {
472 472
 		$status = false;
473 473
 
474 474
 		// Bailout.
475
-		if ( ! self::$instance->is_cache || empty( $id ) ) {
475
+		if ( ! self::$instance->is_cache || empty($id)) {
476 476
 			return $status;
477 477
 		}
478 478
 
479
-		$group = self::$instance->filter_group_name( $group );
479
+		$group = self::$instance->filter_group_name($group);
480 480
 
481
-		$status = wp_cache_set( $id, $data, $group, $expire );
481
+		$status = wp_cache_set($id, $data, $group, $expire);
482 482
 
483 483
 		return $status;
484 484
 	}
@@ -494,15 +494,15 @@  discard block
 block discarded – undo
494 494
 	 *
495 495
 	 * @return bool
496 496
 	 */
497
-	public static function set_db_query( $id, $data ) {
497
+	public static function set_db_query($id, $data) {
498 498
 		$status = false;
499 499
 
500 500
 		// Bailout.
501
-		if ( ! self::$instance->is_cache || empty( $id ) ) {
501
+		if ( ! self::$instance->is_cache || empty($id)) {
502 502
 			return $status;
503 503
 		}
504 504
 
505
-		return self::set_group( $id, $data, 'give-db-queries', 0 );
505
+		return self::set_group($id, $data, 'give-db-queries', 0);
506 506
 	}
507 507
 
508 508
 	/**
@@ -515,8 +515,8 @@  discard block
 block discarded – undo
515 515
 	 *
516 516
 	 * @return mixed
517 517
 	 */
518
-	public static function get_db_query( $id ) {
519
-		return self::get_group( $id, 'give-db-queries' );
518
+	public static function get_db_query($id) {
519
+		return self::get_group($id, 'give-db-queries');
520 520
 	}
521 521
 
522 522
 	/**
@@ -531,21 +531,21 @@  discard block
 block discarded – undo
531 531
 	 *
532 532
 	 * @return bool
533 533
 	 */
534
-	public static function delete_group( $ids, $group = '', $expire = 0 ) {
534
+	public static function delete_group($ids, $group = '', $expire = 0) {
535 535
 		$status = false;
536 536
 
537 537
 		// Bailout.
538
-		if ( ! self::$instance->is_cache || empty( $ids ) ) {
538
+		if ( ! self::$instance->is_cache || empty($ids)) {
539 539
 			return $status;
540 540
 		}
541 541
 
542 542
 		$group_prefix = $group;
543
-		$group = self::$instance->filter_group_name( $group );
543
+		$group = self::$instance->filter_group_name($group);
544 544
 
545 545
 		// Delete single or multiple cache items from cache.
546
-		if ( ! is_array( $ids ) ) {
547
-			$status = wp_cache_delete( $ids, $group );
548
-			self::$instance->get_incrementer( true );
546
+		if ( ! is_array($ids)) {
547
+			$status = wp_cache_delete($ids, $group);
548
+			self::$instance->get_incrementer(true);
549 549
 
550 550
 			/**
551 551
 			 * Fire action when cache deleted for specific id.
@@ -556,12 +556,12 @@  discard block
 block discarded – undo
556 556
 			 * @param string $group
557 557
 			 * @param int    $expire
558 558
 			 */
559
-			do_action( "give_deleted_{$group_prefix}_cache", $ids, $group, $expire, $status );
559
+			do_action("give_deleted_{$group_prefix}_cache", $ids, $group, $expire, $status);
560 560
 
561 561
 		} else {
562
-			foreach ( $ids as $id ) {
563
-				$status = wp_cache_delete( $id, $group );
564
-				self::$instance->get_incrementer( true );
562
+			foreach ($ids as $id) {
563
+				$status = wp_cache_delete($id, $group);
564
+				self::$instance->get_incrementer(true);
565 565
 
566 566
 				/**
567 567
 				 * Fire action when cache deleted for specific id .
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 				 * @param string $group
573 573
 				 * @param int    $expire
574 574
 				 */
575
-				do_action( "give_deleted_{$group_prefix}_cache", $id, $group, $expire, $status );
575
+				do_action("give_deleted_{$group_prefix}_cache", $id, $group, $expire, $status);
576 576
 			}
577 577
 		}
578 578
 
@@ -589,15 +589,15 @@  discard block
 block discarded – undo
589 589
 	 *
590 590
 	 * @param int $form_id
591 591
 	 */
592
-	public function delete_form_related_cache( $form_id ) {
592
+	public function delete_form_related_cache($form_id) {
593 593
 		// If this is just a revision, don't send the email.
594
-		if ( wp_is_post_revision( $form_id ) ) {
594
+		if (wp_is_post_revision($form_id)) {
595 595
 			return;
596 596
 		}
597 597
 
598 598
 		$donation_query = new Give_Payments_Query(
599 599
 			array(
600
-				'number'     => - 1,
600
+				'number'     => -1,
601 601
 				'give_forms' => $form_id,
602 602
 				'output'     => '',
603 603
 				'fields'     => 'ids',
@@ -606,15 +606,15 @@  discard block
 block discarded – undo
606 606
 
607 607
 		$donations = $donation_query->get_payments();
608 608
 
609
-		if ( ! empty( $donations ) ) {
609
+		if ( ! empty($donations)) {
610 610
 			/* @var Give_Payment $donation */
611
-			foreach ( $donations as $donation_id ) {
612
-				wp_cache_delete( $donation_id, $this->filter_group_name( 'give-donations' ) );
613
-				wp_cache_delete( give_get_payment_donor_id( $donation_id ), $this->filter_group_name( 'give-donors' ) );
611
+			foreach ($donations as $donation_id) {
612
+				wp_cache_delete($donation_id, $this->filter_group_name('give-donations'));
613
+				wp_cache_delete(give_get_payment_donor_id($donation_id), $this->filter_group_name('give-donors'));
614 614
 			}
615 615
 		}
616 616
 
617
-		self::$instance->get_incrementer( true );
617
+		self::$instance->get_incrementer(true);
618 618
 	}
619 619
 
620 620
 	/**
@@ -626,19 +626,19 @@  discard block
 block discarded – undo
626 626
 	 *
627 627
 	 * @param int $donation_id
628 628
 	 */
629
-	public function delete_payment_related_cache( $donation_id ) {
629
+	public function delete_payment_related_cache($donation_id) {
630 630
 		// If this is just a revision, don't send the email.
631
-		if ( wp_is_post_revision( $donation_id ) ) {
631
+		if (wp_is_post_revision($donation_id)) {
632 632
 			return;
633 633
 		}
634 634
 
635
-		if ( $donation_id && ( $donor_id = give_get_payment_donor_id( $donation_id ) ) ) {
636
-			wp_cache_delete( $donor_id, $this->filter_group_name( 'give-donors' ) );
635
+		if ($donation_id && ($donor_id = give_get_payment_donor_id($donation_id))) {
636
+			wp_cache_delete($donor_id, $this->filter_group_name('give-donors'));
637 637
 		}
638 638
 
639
-		wp_cache_delete( $donation_id, $this->filter_group_name( 'give-donations' ) );
639
+		wp_cache_delete($donation_id, $this->filter_group_name('give-donations'));
640 640
 
641
-		self::$instance->get_incrementer( true );
641
+		self::$instance->get_incrementer(true);
642 642
 	}
643 643
 
644 644
 	/**
@@ -652,18 +652,18 @@  discard block
 block discarded – undo
652 652
 	 * @param string $group
653 653
 	 * @param int    $expire
654 654
 	 */
655
-	public function delete_donor_related_cache( $id, $group, $expire ) {
656
-		$donation_ids = Give()->donors->get_column( 'payment_ids', $id );
655
+	public function delete_donor_related_cache($id, $group, $expire) {
656
+		$donation_ids = Give()->donors->get_column('payment_ids', $id);
657 657
 
658
-		if ( ! empty( $donation_ids ) ) {
659
-			$donation_ids = array_map( 'trim', (array) explode( ',', trim( $donation_ids  ) ) );
658
+		if ( ! empty($donation_ids)) {
659
+			$donation_ids = array_map('trim', (array) explode(',', trim($donation_ids)));
660 660
 
661
-			foreach ( $donation_ids as $donation ) {
662
-				wp_cache_delete( $donation, $this->filter_group_name( 'give-donations' ) );
661
+			foreach ($donation_ids as $donation) {
662
+				wp_cache_delete($donation, $this->filter_group_name('give-donations'));
663 663
 			}
664 664
 		}
665 665
 
666
-		self::$instance->get_incrementer( true );
666
+		self::$instance->get_incrementer(true);
667 667
 	}
668 668
 
669 669
 	/**
@@ -677,12 +677,12 @@  discard block
 block discarded – undo
677 677
 	 * @param string $group
678 678
 	 * @param int    $expire
679 679
 	 */
680
-	public function delete_donations_related_cache( $id, $group, $expire ) {
681
-		if ( $id && ( $donor_id = give_get_payment_donor_id( $id ) ) ) {
682
-			wp_cache_delete( $donor_id, $this->filter_group_name( 'give-donors' ) );
680
+	public function delete_donations_related_cache($id, $group, $expire) {
681
+		if ($id && ($donor_id = give_get_payment_donor_id($id))) {
682
+			wp_cache_delete($donor_id, $this->filter_group_name('give-donors'));
683 683
 		}
684 684
 
685
-		self::$instance->get_incrementer( true );
685
+		self::$instance->get_incrementer(true);
686 686
 	}
687 687
 
688 688
 
@@ -700,12 +700,12 @@  discard block
 block discarded – undo
700 700
 	 *
701 701
 	 * @return string
702 702
 	 */
703
-	public function get_incrementer( $refresh = false, $incrementer_key = 'give-cache-incrementer-db-queries' ) {
704
-		$incrementer_value = wp_cache_get( $incrementer_key );
703
+	public function get_incrementer($refresh = false, $incrementer_key = 'give-cache-incrementer-db-queries') {
704
+		$incrementer_value = wp_cache_get($incrementer_key);
705 705
 
706
-		if ( false === $incrementer_value || true === $refresh ) {
707
-			$incrementer_value = microtime( true );
708
-			wp_cache_set( $incrementer_key, $incrementer_value );
706
+		if (false === $incrementer_value || true === $refresh) {
707
+			$incrementer_value = microtime(true);
708
+			wp_cache_set($incrementer_key, $incrementer_value);
709 709
 		}
710 710
 
711 711
 		return $incrementer_value;
@@ -721,21 +721,21 @@  discard block
 block discarded – undo
721 721
 	 */
722 722
 	public static function flush_cache() {
723 723
 		if (
724
-			( Give_Admin_Settings::is_saving_settings()
725
-		       && isset( $_POST['cache'] )
726
-		       && give_is_setting_enabled( give_clean( $_POST['cache'] ) )
724
+			(Give_Admin_Settings::is_saving_settings()
725
+		       && isset($_POST['cache'])
726
+		       && give_is_setting_enabled(give_clean($_POST['cache']))
727 727
 		     )
728
-			|| ( wp_doing_ajax() && 'give_cache_flush' === give_clean( $_GET['action'] ) )
728
+			|| (wp_doing_ajax() && 'give_cache_flush' === give_clean($_GET['action']))
729 729
 		) {
730
-			self::$instance->get_incrementer( true );
731
-			self::$instance->get_incrementer( true, 'give-cache-incrementer' );
730
+			self::$instance->get_incrementer(true);
731
+			self::$instance->get_incrementer(true, 'give-cache-incrementer');
732 732
 
733 733
 			/**
734 734
 			 * Fire the action when all cache deleted.
735 735
 			 *
736 736
 			 * @since 2.1.0
737 737
 			 */
738
-			do_action( 'give_fluched_cache' );
738
+			do_action('give_fluched_cache');
739 739
 
740 740
 			return true;
741 741
 		}
@@ -754,23 +754,23 @@  discard block
 block discarded – undo
754 754
 	 *
755 755
 	 * @return mixed
756 756
 	 */
757
-	private function filter_group_name( $group ) {
757
+	private function filter_group_name($group) {
758 758
 		/**
759 759
 		 * Filter the group name
760 760
 		 *
761 761
 		 * @since 2.1.0
762 762
 		 */
763
-		$filtered_group = apply_filters( 'give_cache_filter_group_name', '', $group );
763
+		$filtered_group = apply_filters('give_cache_filter_group_name', '', $group);
764 764
 
765
-		if ( empty( $filtered_group ) ) {
765
+		if (empty($filtered_group)) {
766 766
 
767
-			switch ( $group ) {
767
+			switch ($group) {
768 768
 				case 'give-db-queries':
769 769
 					$incrementer = self::$instance->get_incrementer();
770 770
 					break;
771 771
 
772 772
 				default:
773
-					$incrementer = self::$instance->get_incrementer( false, 'give-cache-incrementer' );
773
+					$incrementer = self::$instance->get_incrementer(false, 'give-cache-incrementer');
774 774
 
775 775
 			}
776 776
 
Please login to merge, or discard this patch.
includes/class-give-db-donors.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 * NOTE: This should not be called directly as it does not make necessary changes to
208 208
 	 * the payment meta and logs. Use give_donor_delete() instead.
209 209
 	 *
210
-	 * @param  bool|string|int $_id_or_email ID or Email of Donor.
210
+	 * @param  integer $_id_or_email ID or Email of Donor.
211 211
 	 *
212 212
 	 * @since  1.0
213 213
 	 * @access public
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 	 * @access public
408 408
 	 *
409 409
 	 * @param  string $field ID or email. Default is 'id'.
410
-	 * @param  mixed  $value The Customer ID or email to search. Default is 0.
410
+	 * @param  integer  $value The Customer ID or email to search. Default is 0.
411 411
 	 *
412 412
 	 * @return mixed         Upon success, an object of the donor. Upon failure, NULL
413 413
 	 */
Please login to merge, or discard this patch.
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 		$this->bc_200_params();
43 43
 
44 44
 		// Set hooks and register table only if instance loading first time.
45
-		if ( ! ( Give()->donors instanceof Give_DB_Donors ) ) {
45
+		if ( ! (Give()->donors instanceof Give_DB_Donors)) {
46 46
 			// Install table.
47 47
 			$this->register_table();
48 48
 		}
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 			'purchase_value'  => 0.00,
92 92
 			'purchase_count'  => 0,
93 93
 			'notes'           => '',
94
-			'date_created'    => date( 'Y-m-d H:i:s' ),
94
+			'date_created'    => date('Y-m-d H:i:s'),
95 95
 			'token'           => '',
96 96
 			'verify_key'      => '',
97 97
 			'verify_throttle' => '',
@@ -108,40 +108,40 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @return int|bool
110 110
 	 */
111
-	public function add( $data = array() ) {
111
+	public function add($data = array()) {
112 112
 
113 113
 		$defaults = array(
114 114
 			'payment_ids' => '',
115 115
 		);
116 116
 
117
-		$args = wp_parse_args( $data, $defaults );
117
+		$args = wp_parse_args($data, $defaults);
118 118
 
119
-		if ( empty( $args['email'] ) ) {
119
+		if (empty($args['email'])) {
120 120
 			return false;
121 121
 		}
122 122
 
123
-		if ( ! empty( $args['payment_ids'] ) && is_array( $args['payment_ids'] ) ) {
124
-			$args['payment_ids'] = implode( ',', array_unique( array_values( $args['payment_ids'] ) ) );
123
+		if ( ! empty($args['payment_ids']) && is_array($args['payment_ids'])) {
124
+			$args['payment_ids'] = implode(',', array_unique(array_values($args['payment_ids'])));
125 125
 		}
126 126
 
127
-		$donor = $this->get_donor_by( 'email', $args['email'] );
127
+		$donor = $this->get_donor_by('email', $args['email']);
128 128
 
129 129
 		// update an existing donor.
130
-		if ( $donor ) {
130
+		if ($donor) {
131 131
 
132 132
 			// Update the payment IDs attached to the donor
133
-			if ( ! empty( $args['payment_ids'] ) ) {
133
+			if ( ! empty($args['payment_ids'])) {
134 134
 
135
-				if ( empty( $donor->payment_ids ) ) {
135
+				if (empty($donor->payment_ids)) {
136 136
 
137 137
 					$donor->payment_ids = $args['payment_ids'];
138 138
 
139 139
 				} else {
140 140
 
141
-					$existing_ids       = array_map( 'absint', explode( ',', $donor->payment_ids ) );
142
-					$payment_ids        = array_map( 'absint', explode( ',', $args['payment_ids'] ) );
143
-					$payment_ids        = array_merge( $payment_ids, $existing_ids );
144
-					$donor->payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) );
141
+					$existing_ids       = array_map('absint', explode(',', $donor->payment_ids));
142
+					$payment_ids        = array_map('absint', explode(',', $args['payment_ids']));
143
+					$payment_ids        = array_merge($payment_ids, $existing_ids);
144
+					$donor->payment_ids = implode(',', array_unique(array_values($payment_ids)));
145 145
 
146 146
 				}
147 147
 
@@ -149,13 +149,13 @@  discard block
 block discarded – undo
149 149
 
150 150
 			}
151 151
 
152
-			$this->update( $donor->id, $args );
152
+			$this->update($donor->id, $args);
153 153
 
154 154
 			return $donor->id;
155 155
 
156 156
 		} else {
157 157
 
158
-			return $this->insert( $args, 'donor' );
158
+			return $this->insert($args, 'donor');
159 159
 
160 160
 		}
161 161
 
@@ -172,12 +172,12 @@  discard block
 block discarded – undo
172 172
 	 *
173 173
 	 * @return bool
174 174
 	 */
175
-	public function update( $row_id, $data = array(), $where = '' ) {
175
+	public function update($row_id, $data = array(), $where = '') {
176 176
 
177
-		$status = parent::update( $row_id, $data, $where );
177
+		$status = parent::update($row_id, $data, $where);
178 178
 
179
-		if ( $status ) {
180
-			Give_Cache::delete_group( $row_id, 'give-donors' );
179
+		if ($status) {
180
+			Give_Cache::delete_group($row_id, 'give-donors');
181 181
 		}
182 182
 
183 183
 		return $status;
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
 	 *
192 192
 	 * @return int
193 193
 	 */
194
-	public function insert( $data, $type = '' ) {
195
-		$donor_id = parent::insert( $data, $type );
194
+	public function insert($data, $type = '') {
195
+		$donor_id = parent::insert($data, $type);
196 196
 
197
-		if ( $donor_id ) {
198
-			Give_Cache::delete_group( $donor_id, 'give-donors' );
197
+		if ($donor_id) {
198
+			Give_Cache::delete_group($donor_id, 'give-donors');
199 199
 		}
200 200
 
201 201
 		return $donor_id;
@@ -214,16 +214,16 @@  discard block
 block discarded – undo
214 214
 	 *
215 215
 	 * @return bool|int
216 216
 	 */
217
-	public function delete( $_id_or_email = false ) {
217
+	public function delete($_id_or_email = false) {
218 218
 
219
-		if ( empty( $_id_or_email ) ) {
219
+		if (empty($_id_or_email)) {
220 220
 			return false;
221 221
 		}
222 222
 
223
-		$column = is_email( $_id_or_email ) ? 'email' : 'id';
224
-		$donor  = $this->get_donor_by( $column, $_id_or_email );
223
+		$column = is_email($_id_or_email) ? 'email' : 'id';
224
+		$donor  = $this->get_donor_by($column, $_id_or_email);
225 225
 
226
-		if ( $donor->id > 0 ) {
226
+		if ($donor->id > 0) {
227 227
 
228 228
 			global $wpdb;
229 229
 
@@ -232,11 +232,11 @@  discard block
 block discarded – undo
232 232
 			 *
233 233
 			 * @since 1.8.14
234 234
 			 */
235
-			Give()->donor_meta->delete_all_meta( $donor->id );
235
+			Give()->donor_meta->delete_all_meta($donor->id);
236 236
 
237 237
 			// Cache already deleted in delete_all_meta fn.
238 238
 
239
-			return $wpdb->delete( $this->table_name, array( 'id' => $donor->id ), array( '%d' ) );
239
+			return $wpdb->delete($this->table_name, array('id' => $donor->id), array('%d'));
240 240
 
241 241
 		} else {
242 242
 			return false;
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 	 *
258 258
 	 * @return bool|int
259 259
 	 */
260
-	public function delete_by_user_id( $user_id = false ) {
260
+	public function delete_by_user_id($user_id = false) {
261 261
 		global $wpdb;
262 262
 
263
-		if ( empty( $user_id ) ) {
263
+		if (empty($user_id)) {
264 264
 			return false;
265 265
 		}
266 266
 
@@ -269,14 +269,14 @@  discard block
 block discarded – undo
269 269
 		 *
270 270
 		 * @since 1.8.14
271 271
 		 */
272
-		$donor = new Give_Donor( $user_id, true );
273
-		if ( ! empty( $donor->id ) ) {
274
-			Give()->donor_meta->delete_all_meta( $donor->id );
272
+		$donor = new Give_Donor($user_id, true);
273
+		if ( ! empty($donor->id)) {
274
+			Give()->donor_meta->delete_all_meta($donor->id);
275 275
 		}
276 276
 
277 277
 		// Cache is already deleted in delete_all_meta fn.
278 278
 
279
-		return $wpdb->delete( $this->table_name, array( 'user_id' => $user_id ), array( '%d' ) );
279
+		return $wpdb->delete($this->table_name, array('user_id' => $user_id), array('%d'));
280 280
 	}
281 281
 
282 282
 	/**
@@ -290,14 +290,14 @@  discard block
 block discarded – undo
290 290
 	 *
291 291
 	 * @return bool          True is exists, false otherwise.
292 292
 	 */
293
-	public function exists( $value = '', $field = 'email' ) {
293
+	public function exists($value = '', $field = 'email') {
294 294
 
295 295
 		$columns = $this->get_columns();
296
-		if ( ! array_key_exists( $field, $columns ) ) {
296
+		if ( ! array_key_exists($field, $columns)) {
297 297
 			return false;
298 298
 		}
299 299
 
300
-		return (bool) $this->get_column_by( 'id', $field, $value );
300
+		return (bool) $this->get_column_by('id', $field, $value);
301 301
 
302 302
 	}
303 303
 
@@ -312,16 +312,16 @@  discard block
 block discarded – undo
312 312
 	 *
313 313
 	 * @return bool
314 314
 	 */
315
-	public function attach_payment( $donor_id = 0, $payment_id = 0 ) {
315
+	public function attach_payment($donor_id = 0, $payment_id = 0) {
316 316
 
317
-		$donor = new Give_Donor( $donor_id );
317
+		$donor = new Give_Donor($donor_id);
318 318
 
319
-		if ( empty( $donor->id ) ) {
319
+		if (empty($donor->id)) {
320 320
 			return false;
321 321
 		}
322 322
 
323 323
 		// Attach the payment, but don't increment stats, as this function previously did not
324
-		return $donor->attach_payment( $payment_id, false );
324
+		return $donor->attach_payment($payment_id, false);
325 325
 
326 326
 	}
327 327
 
@@ -336,16 +336,16 @@  discard block
 block discarded – undo
336 336
 	 *
337 337
 	 * @return bool
338 338
 	 */
339
-	public function remove_payment( $donor_id = 0, $payment_id = 0 ) {
339
+	public function remove_payment($donor_id = 0, $payment_id = 0) {
340 340
 
341
-		$donor = new Give_Donor( $donor_id );
341
+		$donor = new Give_Donor($donor_id);
342 342
 
343
-		if ( ! $donor ) {
343
+		if ( ! $donor) {
344 344
 			return false;
345 345
 		}
346 346
 
347 347
 		// Remove the payment, but don't decrease stats, as this function previously did not
348
-		return $donor->remove_payment( $payment_id, false );
348
+		return $donor->remove_payment($payment_id, false);
349 349
 
350 350
 	}
351 351
 
@@ -359,18 +359,18 @@  discard block
 block discarded – undo
359 359
 	 *
360 360
 	 * @return bool
361 361
 	 */
362
-	public function increment_stats( $donor_id = 0, $amount = 0.00 ) {
362
+	public function increment_stats($donor_id = 0, $amount = 0.00) {
363 363
 
364
-		$donor = new Give_Donor( $donor_id );
364
+		$donor = new Give_Donor($donor_id);
365 365
 
366
-		if ( empty( $donor->id ) ) {
366
+		if (empty($donor->id)) {
367 367
 			return false;
368 368
 		}
369 369
 
370 370
 		$increased_count = $donor->increase_purchase_count();
371
-		$increased_value = $donor->increase_value( $amount );
371
+		$increased_value = $donor->increase_value($amount);
372 372
 
373
-		return ( $increased_count && $increased_value ) ? true : false;
373
+		return ($increased_count && $increased_value) ? true : false;
374 374
 
375 375
 	}
376 376
 
@@ -385,18 +385,18 @@  discard block
 block discarded – undo
385 385
 	 *
386 386
 	 * @return bool
387 387
 	 */
388
-	public function decrement_stats( $donor_id = 0, $amount = 0.00 ) {
388
+	public function decrement_stats($donor_id = 0, $amount = 0.00) {
389 389
 
390
-		$donor = new Give_Donor( $donor_id );
390
+		$donor = new Give_Donor($donor_id);
391 391
 
392
-		if ( ! $donor ) {
392
+		if ( ! $donor) {
393 393
 			return false;
394 394
 		}
395 395
 
396 396
 		$decreased_count = $donor->decrease_donation_count();
397
-		$decreased_value = $donor->decrease_value( $amount );
397
+		$decreased_value = $donor->decrease_value($amount);
398 398
 
399
-		return ( $decreased_count && $decreased_value ) ? true : false;
399
+		return ($decreased_count && $decreased_value) ? true : false;
400 400
 
401 401
 	}
402 402
 
@@ -411,44 +411,44 @@  discard block
 block discarded – undo
411 411
 	 *
412 412
 	 * @return mixed         Upon success, an object of the donor. Upon failure, NULL
413 413
 	 */
414
-	public function get_donor_by( $field = 'id', $value = 0 ) {
415
-		$value = sanitize_text_field( $value );
414
+	public function get_donor_by($field = 'id', $value = 0) {
415
+		$value = sanitize_text_field($value);
416 416
 
417 417
 		// Bailout.
418
-		if ( empty( $field ) || empty( $value ) ) {
418
+		if (empty($field) || empty($value)) {
419 419
 			return null;
420 420
 		}
421 421
 
422 422
 		// Verify values.
423
-		if ( 'id' === $field || 'user_id' === $field ) {
423
+		if ('id' === $field || 'user_id' === $field) {
424 424
 			// Make sure the value is numeric to avoid casting objects, for example,
425 425
 			// to int 1.
426
-			if ( ! is_numeric( $value ) ) {
426
+			if ( ! is_numeric($value)) {
427 427
 				return false;
428 428
 			}
429 429
 
430
-			$value = absint( $value );
430
+			$value = absint($value);
431 431
 
432
-			if ( $value < 1 ) {
432
+			if ($value < 1) {
433 433
 				return false;
434 434
 			}
435 435
 
436
-		} elseif ( 'email' === $field ) {
436
+		} elseif ('email' === $field) {
437 437
 
438
-			if ( ! is_email( $value ) ) {
438
+			if ( ! is_email($value)) {
439 439
 				return false;
440 440
 			}
441 441
 
442
-			$value = trim( $value );
442
+			$value = trim($value);
443 443
 		}
444 444
 
445 445
 		// Bailout
446
-		if ( ! $value ) {
446
+		if ( ! $value) {
447 447
 			return false;
448 448
 		}
449 449
 
450 450
 		// Set query params.
451
-		switch ( $field ) {
451
+		switch ($field) {
452 452
 			case 'id':
453 453
 				$args['donor'] = $value;
454 454
 				break;
@@ -463,9 +463,9 @@  discard block
 block discarded – undo
463 463
 		}
464 464
 
465 465
 		// Get donors.
466
-		$donor = new Give_Donors_Query( $args );
466
+		$donor = new Give_Donors_Query($args);
467 467
 
468
-		if ( ! $donor = $donor->get_donors() ) {
468
+		if ( ! $donor = $donor->get_donors()) {
469 469
 			// Look for donor from an additional email.
470 470
 			$args = array(
471 471
 				'meta_query' => array(
@@ -476,15 +476,15 @@  discard block
 block discarded – undo
476 476
 				),
477 477
 			);
478 478
 
479
-			$donor = new Give_Donors_Query( $args );
479
+			$donor = new Give_Donors_Query($args);
480 480
 			$donor = $donor->get_donors();
481 481
 
482
-			if ( empty( $donor ) ) {
482
+			if (empty($donor)) {
483 483
 				return false;
484 484
 			}
485 485
 		}
486 486
 
487
-		return current( $donor );
487
+		return current($donor);
488 488
 	}
489 489
 
490 490
 	/**
@@ -497,10 +497,10 @@  discard block
 block discarded – undo
497 497
 	 *
498 498
 	 * @return array|object|null Donors array or object. Null if not found.
499 499
 	 */
500
-	public function get_donors( $args = array() ) {
501
-		$this->bc_1814_params( $args );
500
+	public function get_donors($args = array()) {
501
+		$this->bc_1814_params($args);
502 502
 
503
-		$donors = new Give_Donors_Query( $args );
503
+		$donors = new Give_Donors_Query($args);
504 504
 
505 505
 		return $donors->get_donors();
506 506
 
@@ -517,21 +517,21 @@  discard block
 block discarded – undo
517 517
 	 *
518 518
 	 * @return int         Total number of donors.
519 519
 	 */
520
-	public function count( $args = array() ) {
521
-		$this->bc_1814_params( $args );
520
+	public function count($args = array()) {
521
+		$this->bc_1814_params($args);
522 522
 		$args['count'] = true;
523 523
 
524
-		$cache_key = md5( 'give_donors_count' . serialize( $args ) );
525
-		$count     = Give_Cache::get_group( $cache_key, 'donors' );
524
+		$cache_key = md5('give_donors_count'.serialize($args));
525
+		$count     = Give_Cache::get_group($cache_key, 'donors');
526 526
 
527
-		if ( is_null( $count ) ) {
528
-			$donors = new Give_Donors_Query( $args );
527
+		if (is_null($count)) {
528
+			$donors = new Give_Donors_Query($args);
529 529
 			$count  = $donors->get_donors();
530 530
 
531
-			Give_Cache::set_group( $cache_key, $count, 'donors', 3600 );
531
+			Give_Cache::set_group($cache_key, $count, 'donors', 3600);
532 532
 		}
533 533
 
534
-		return absint( $count );
534
+		return absint($count);
535 535
 
536 536
 	}
537 537
 
@@ -545,9 +545,9 @@  discard block
 block discarded – undo
545 545
 	 */
546 546
 	public function create_table() {
547 547
 
548
-		require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
548
+		require_once(ABSPATH.'wp-admin/includes/upgrade.php');
549 549
 
550
-		$sql = "CREATE TABLE " . $this->table_name . " (
550
+		$sql = "CREATE TABLE ".$this->table_name." (
551 551
 		id bigint(20) NOT NULL AUTO_INCREMENT,
552 552
 		user_id bigint(20) NOT NULL,
553 553
 		email varchar(50) NOT NULL,
@@ -565,9 +565,9 @@  discard block
 block discarded – undo
565 565
 		KEY user (user_id)
566 566
 		) CHARACTER SET utf8 COLLATE utf8_general_ci;";
567 567
 
568
-		dbDelta( $sql );
568
+		dbDelta($sql);
569 569
 
570
-		update_option( $this->table_name . '_db_version', $this->version );
570
+		update_option($this->table_name.'_db_version', $this->version);
571 571
 	}
572 572
 
573 573
 	/**
@@ -582,8 +582,8 @@  discard block
 block discarded – undo
582 582
 		global $wpdb;
583 583
 
584 584
 		if (
585
-			! give_has_upgrade_completed( 'v20_rename_donor_tables' ) &&
586
-			$wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers" ) )
585
+			! give_has_upgrade_completed('v20_rename_donor_tables') &&
586
+			$wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers"))
587 587
 		) {
588 588
 			$wpdb->donors = $this->table_name = "{$wpdb->prefix}give_customers";
589 589
 		}
@@ -597,41 +597,41 @@  discard block
 block discarded – undo
597 597
 	 *
598 598
 	 * @param $args
599 599
 	 */
600
-	private function bc_1814_params( &$args ) {
600
+	private function bc_1814_params(&$args) {
601 601
 		// Backward compatibility: user_id
602
-		if ( ! empty( $args['user_id'] ) ) {
602
+		if ( ! empty($args['user_id'])) {
603 603
 			$args['user'] = $args['user_id'];
604 604
 		}
605 605
 
606 606
 		// Backward compatibility: id
607
-		if ( ! empty( $args['id'] ) ) {
607
+		if ( ! empty($args['id'])) {
608 608
 			$args['donor'] = $args['id'];
609 609
 		}
610 610
 
611 611
 		// Backward compatibility: name
612
-		if ( ! empty( $args['name'] ) ) {
612
+		if ( ! empty($args['name'])) {
613 613
 			$args['s'] = "name:{$args['name']}";
614 614
 		}
615 615
 
616 616
 		// Backward compatibility: date
617 617
 		// Donors created for a specific date or in a date range.
618
-		if ( ! empty( $args['date'] ) ) {
618
+		if ( ! empty($args['date'])) {
619 619
 
620
-			if ( is_array( $args['date'] ) ) {
620
+			if (is_array($args['date'])) {
621 621
 
622
-				if ( ! empty( $args['date']['start'] ) ) {
623
-					$args['date_query']['after'] = date( 'Y-m-d H:i:s', strtotime( $args['date']['start'] ) );
622
+				if ( ! empty($args['date']['start'])) {
623
+					$args['date_query']['after'] = date('Y-m-d H:i:s', strtotime($args['date']['start']));
624 624
 				}
625 625
 
626
-				if ( ! empty( $args['date']['end'] ) ) {
627
-					$args['date_query']['before'] = date( 'Y-m-d H:i:s', strtotime( $args['date']['end'] ) );
626
+				if ( ! empty($args['date']['end'])) {
627
+					$args['date_query']['before'] = date('Y-m-d H:i:s', strtotime($args['date']['end']));
628 628
 				}
629 629
 
630 630
 			} else {
631 631
 
632
-				$args['date_query']['year']  = date( 'Y', strtotime( $args['date'] ) );
633
-				$args['date_query']['month'] = date( 'm', strtotime( $args['date'] ) );
634
-				$args['date_query']['day']   = date( 'd', strtotime( $args['date'] ) );
632
+				$args['date_query']['year']  = date('Y', strtotime($args['date']));
633
+				$args['date_query']['month'] = date('m', strtotime($args['date']));
634
+				$args['date_query']['day']   = date('d', strtotime($args['date']));
635 635
 			}
636 636
 		}
637 637
 	}
Please login to merge, or discard this patch.
includes/class-give-logging.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -512,7 +512,7 @@
 block discarded – undo
512 512
 	 * @since  1.7
513 513
 	 * @access public
514 514
 	 *
515
-	 * @return bool
515
+	 * @return false|null
516 516
 	 */
517 517
 	public function delete_cache() {
518 518
 		// Add log related keys to delete.
Please login to merge, or discard this patch.
Spacing   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 		 * Setup properties
54 54
 		 */
55 55
 
56
-		require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-logs.php';
57
-		require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-logs-meta.php';
56
+		require_once GIVE_PLUGIN_DIR.'includes/class-give-db-logs.php';
57
+		require_once GIVE_PLUGIN_DIR.'includes/class-give-db-logs-meta.php';
58 58
 		$this->log_db     = new Give_DB_Logs();
59 59
 		$this->logmeta_db = new Give_DB_Log_Meta();
60 60
 
@@ -62,22 +62,22 @@  discard block
 block discarded – undo
62 62
 		 * Setup hooks.
63 63
 		 */
64 64
 
65
-		add_action( 'save_post_give_payment', array( $this, 'background_process_delete_cache' ) );
66
-		add_action( 'save_post_give_forms', array( $this, 'background_process_delete_cache' ) );
67
-		add_action( 'save_post_give_log', array( $this, 'background_process_delete_cache' ) );
68
-		add_action( 'give_delete_log_cache', array( $this, 'delete_cache' ) );
69
-		add_action( 'update_log_metadata', array( $this, 'bc_200_set_payment_as_log_parent' ), 10, 4 );
65
+		add_action('save_post_give_payment', array($this, 'background_process_delete_cache'));
66
+		add_action('save_post_give_forms', array($this, 'background_process_delete_cache'));
67
+		add_action('save_post_give_log', array($this, 'background_process_delete_cache'));
68
+		add_action('give_delete_log_cache', array($this, 'delete_cache'));
69
+		add_action('update_log_metadata', array($this, 'bc_200_set_payment_as_log_parent'), 10, 4);
70 70
 
71 71
 		// Backward compatibility.
72
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
72
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
73 73
 			// Create the log post type
74
-			add_action( 'init', array( $this, 'register_post_type' ), -2 );
74
+			add_action('init', array($this, 'register_post_type'), -2);
75 75
 		}
76 76
 
77 77
 		// Create types taxonomy and default types
78 78
 		// @todo: remove this taxonomy, some addon use this taxonomy with there custom log post type for example: recurring
79 79
 		// Do not use this taxonomy with your log type because we will remove it in future releases.
80
-		add_action( 'init', array( $this, 'register_taxonomy' ), -2 );
80
+		add_action('init', array($this, 'register_taxonomy'), -2);
81 81
 	}
82 82
 
83 83
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 		/* Logs post type */
96 96
 		$log_args = array(
97 97
 			'labels'              => array(
98
-				'name' => esc_html__( 'Logs', 'give' ),
98
+				'name' => esc_html__('Logs', 'give'),
99 99
 			),
100 100
 			'public'              => false,
101 101
 			'exclude_from_search' => true,
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
 			'query_var'           => false,
105 105
 			'rewrite'             => false,
106 106
 			'capability_type'     => 'post',
107
-			'supports'            => array( 'title', 'editor' ),
107
+			'supports'            => array('title', 'editor'),
108 108
 			'can_export'          => true,
109 109
 		);
110 110
 
111
-		register_post_type( 'give_log', $log_args );
111
+		register_post_type('give_log', $log_args);
112 112
 	}
113 113
 
114 114
 	/**
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
 	 * @return void
123 123
 	 */
124 124
 	public function register_taxonomy() {
125
-		register_taxonomy( 'give_log_type', 'give_log', array(
125
+		register_taxonomy('give_log_type', 'give_log', array(
126 126
 			'public' => false,
127
-		) );
127
+		));
128 128
 	}
129 129
 
130 130
 	/**
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			'update',
146 146
 		);
147 147
 
148
-		return apply_filters( 'give_log_types', $terms );
148
+		return apply_filters('give_log_types', $terms);
149 149
 	}
150 150
 
151 151
 	/**
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 	 *
161 161
 	 * @return bool         Whether log type is valid.
162 162
 	 */
163
-	public function valid_type( $type ) {
164
-		return in_array( $type, $this->log_types() );
163
+	public function valid_type($type) {
164
+		return in_array($type, $this->log_types());
165 165
 	}
166 166
 
167 167
 	/**
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 *
181 181
 	 * @return int             Log ID.
182 182
 	 */
183
-	public function add( $title = '', $message = '', $parent = 0, $type = '' ) {
183
+	public function add($title = '', $message = '', $parent = 0, $type = '') {
184 184
 		$log_data = array(
185 185
 			'post_title'   => $title,
186 186
 			'post_content' => $message,
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 			'log_type'     => $type,
189 189
 		);
190 190
 
191
-		return $this->insert_log( $log_data );
191
+		return $this->insert_log($log_data);
192 192
 	}
193 193
 
194 194
 	/**
@@ -205,12 +205,12 @@  discard block
 block discarded – undo
205 205
 	 *
206 206
 	 * @return array             An array of the connected logs.
207 207
 	 */
208
-	public function get_logs( $object_id = 0, $type = '', $paged = null ) {
209
-		return $this->get_connected_logs( array(
208
+	public function get_logs($object_id = 0, $type = '', $paged = null) {
209
+		return $this->get_connected_logs(array(
210 210
 			'log_parent' => $object_id,
211 211
 			'paged'      => $paged,
212 212
 			'log_type'   => $type,
213
-		) );
213
+		));
214 214
 	}
215 215
 
216 216
 	/**
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 	 *
225 225
 	 * @return int             The ID of the newly created log item.
226 226
 	 */
227
-	public function insert_log( $log_data = array(), $log_meta = array() ) {
227
+	public function insert_log($log_data = array(), $log_meta = array()) {
228 228
 		$log_id = 0;
229 229
 
230 230
 		$defaults = array(
@@ -237,28 +237,28 @@  discard block
 block discarded – undo
237 237
 			'post_status' => 'publish',
238 238
 		);
239 239
 
240
-		$args = wp_parse_args( $log_data, $defaults );
241
-		$this->bc_200_validate_params( $args, $log_meta );
240
+		$args = wp_parse_args($log_data, $defaults);
241
+		$this->bc_200_validate_params($args, $log_meta);
242 242
 
243
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
243
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
244 244
 			global $wpdb;
245 245
 
246 246
 			// Backward Compatibility.
247
-			if ( ! $wpdb->get_var( "SELECT ID from {$this->log_db->table_name} ORDER BY id DESC LIMIT 1" ) ) {
248
-				$latest_log_id = $wpdb->get_var( "SELECT ID from $wpdb->posts ORDER BY id DESC LIMIT 1" );
249
-				$latest_log_id = empty( $latest_log_id ) ? 1 : ++ $latest_log_id;
247
+			if ( ! $wpdb->get_var("SELECT ID from {$this->log_db->table_name} ORDER BY id DESC LIMIT 1")) {
248
+				$latest_log_id = $wpdb->get_var("SELECT ID from $wpdb->posts ORDER BY id DESC LIMIT 1");
249
+				$latest_log_id = empty($latest_log_id) ? 1 : ++ $latest_log_id;
250 250
 
251 251
 				$args['ID'] = $latest_log_id;
252
-				$this->log_db->insert( $args );
252
+				$this->log_db->insert($args);
253 253
 			}
254 254
 		}
255 255
 
256
-		$log_id = $this->log_db->add( $args );
256
+		$log_id = $this->log_db->add($args);
257 257
 
258 258
 		// Set log meta, if any
259
-		if ( $log_id && ! empty( $log_meta ) ) {
260
-			foreach ( (array) $log_meta as $key => $meta ) {
261
-				$this->logmeta_db->update_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
259
+		if ($log_id && ! empty($log_meta)) {
260
+			foreach ((array) $log_meta as $key => $meta) {
261
+				$this->logmeta_db->update_meta($log_id, '_give_log_'.sanitize_key($key), $meta);
262 262
 			}
263 263
 		}
264 264
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	 *
281 281
 	 * @return bool|null       True if successful, false otherwise.
282 282
 	 */
283
-	public function update_log( $log_data = array(), $log_meta = array() ) {
283
+	public function update_log($log_data = array(), $log_meta = array()) {
284 284
 		$log_id = 0;
285 285
 
286 286
 		/**
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 		 * @param array $log_data Log entry data.
292 292
 		 * @param array $log_meta Log entry meta.
293 293
 		 */
294
-		do_action( 'give_pre_update_log', $log_data, $log_meta );
294
+		do_action('give_pre_update_log', $log_data, $log_meta);
295 295
 
296 296
 		$defaults = array(
297 297
 			'log_parent'  => 0,
@@ -301,28 +301,28 @@  discard block
 block discarded – undo
301 301
 			'post_status' => 'publish',
302 302
 		);
303 303
 
304
-		$args = wp_parse_args( $log_data, $defaults );
305
-		$this->bc_200_validate_params( $args, $log_meta );
304
+		$args = wp_parse_args($log_data, $defaults);
305
+		$this->bc_200_validate_params($args, $log_meta);
306 306
 
307 307
 		// Store the log entry
308
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
308
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
309 309
 			// Backward compatibility.
310
-			$log_id = wp_update_post( $args );
310
+			$log_id = wp_update_post($args);
311 311
 
312
-			if ( $log_id && ! empty( $log_meta ) ) {
313
-				foreach ( (array) $log_meta as $key => $meta ) {
314
-					if ( ! empty( $meta ) ) {
315
-						give_update_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
312
+			if ($log_id && ! empty($log_meta)) {
313
+				foreach ((array) $log_meta as $key => $meta) {
314
+					if ( ! empty($meta)) {
315
+						give_update_meta($log_id, '_give_log_'.sanitize_key($key), $meta);
316 316
 					}
317 317
 				}
318 318
 			}
319 319
 		} else {
320
-			$log_id = $this->log_db->add( $args );
320
+			$log_id = $this->log_db->add($args);
321 321
 
322
-			if ( $log_id && ! empty( $log_meta ) ) {
323
-				foreach ( (array) $log_meta as $key => $meta ) {
324
-					if ( ! empty( $meta ) ) {
325
-						$this->logmeta_db->update_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
322
+			if ($log_id && ! empty($log_meta)) {
323
+				foreach ((array) $log_meta as $key => $meta) {
324
+					if ( ! empty($meta)) {
325
+						$this->logmeta_db->update_meta($log_id, '_give_log_'.sanitize_key($key), $meta);
326 326
 					}
327 327
 				}
328 328
 			}
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 		 * @param array $log_data Log entry data.
338 338
 		 * @param array $log_meta Log entry meta.
339 339
 		 */
340
-		do_action( 'give_post_update_log', $log_id, $log_data, $log_meta );
340
+		do_action('give_post_update_log', $log_id, $log_data, $log_meta);
341 341
 	}
342 342
 
343 343
 	/**
@@ -354,30 +354,30 @@  discard block
 block discarded – undo
354 354
 	 *
355 355
 	 * @return array|false Array if logs were found, false otherwise.
356 356
 	 */
357
-	public function get_connected_logs( $args = array() ) {
357
+	public function get_connected_logs($args = array()) {
358 358
 		$logs = array();
359 359
 
360
-		$defaults   = array(
360
+		$defaults = array(
361 361
 			'number'      => 20,
362
-			'paged'       => get_query_var( 'paged' ),
362
+			'paged'       => get_query_var('paged'),
363 363
 			'log_type'    => false,
364 364
 
365 365
 			// Backward compatibility.
366 366
 			'post_type'   => 'give_log',
367 367
 			'post_status' => 'publish',
368 368
 		);
369
-		$query_args = wp_parse_args( $args, $defaults );
370
-		$this->bc_200_validate_params( $query_args );
369
+		$query_args = wp_parse_args($args, $defaults);
370
+		$this->bc_200_validate_params($query_args);
371 371
 
372
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
372
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
373 373
 			// Backward compatibility.
374
-			$logs = get_posts( $query_args );
375
-			$this->bc_200_add_new_properties( $logs );
374
+			$logs = get_posts($query_args);
375
+			$this->bc_200_add_new_properties($logs);
376 376
 		} else {
377
-			$logs = $this->log_db->get_logs( $query_args );
377
+			$logs = $this->log_db->get_logs($query_args);
378 378
 		}
379 379
 
380
-		return ( ! empty( $logs ) ? $logs : false );
380
+		return ( ! empty($logs) ? $logs : false);
381 381
 	}
382 382
 
383 383
 	/**
@@ -395,41 +395,41 @@  discard block
 block discarded – undo
395 395
 	 *
396 396
 	 * @return int                Log count.
397 397
 	 */
398
-	public function get_log_count( $object_id = 0, $type = '', $meta_query = null, $date_query = null ) {
398
+	public function get_log_count($object_id = 0, $type = '', $meta_query = null, $date_query = null) {
399 399
 		$logs_count = 0;
400 400
 
401 401
 		$query_args = array(
402
-			'number'      => - 1,
402
+			'number'      => -1,
403 403
 
404 404
 			// Backward comatibility.
405 405
 			'post_type'   => 'give_log',
406 406
 			'post_status' => 'publish',
407 407
 		);
408 408
 
409
-		if ( $object_id ) {
409
+		if ($object_id) {
410 410
 			$query_args['log_parent'] = $object_id;
411 411
 		}
412 412
 
413
-		if ( ! empty( $type ) && $this->valid_type( $type ) ) {
413
+		if ( ! empty($type) && $this->valid_type($type)) {
414 414
 			$query_args['log_type'] = $type;
415 415
 		}
416 416
 
417
-		if ( ! empty( $meta_query ) ) {
417
+		if ( ! empty($meta_query)) {
418 418
 			$query_args['meta_query'] = $meta_query;
419 419
 		}
420 420
 
421
-		if ( ! empty( $date_query ) ) {
421
+		if ( ! empty($date_query)) {
422 422
 			$query_args['date_query'] = $date_query;
423 423
 		}
424 424
 
425
-		$this->bc_200_validate_params( $query_args );
425
+		$this->bc_200_validate_params($query_args);
426 426
 
427
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
427
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
428 428
 			// Backward compatibility.
429
-			$logs       = new WP_Query( $query_args );
429
+			$logs       = new WP_Query($query_args);
430 430
 			$logs_count = (int) $logs->post_count;
431 431
 		} else {
432
-			$logs_count = $this->log_db->count( $query_args );
432
+			$logs_count = $this->log_db->count($query_args);
433 433
 		}
434 434
 
435 435
 		return $logs_count;
@@ -449,10 +449,10 @@  discard block
 block discarded – undo
449 449
 	 *
450 450
 	 * @return void
451 451
 	 */
452
-	public function delete_logs( $object_id = 0, $type = '', $meta_query = null ) {
452
+	public function delete_logs($object_id = 0, $type = '', $meta_query = null) {
453 453
 		$query_args = array(
454 454
 			'log_parent'  => $object_id,
455
-			'number'      => - 1,
455
+			'number'      => -1,
456 456
 			'fields'      => 'ID',
457 457
 
458 458
 			// Backward compatibility.
@@ -460,32 +460,32 @@  discard block
 block discarded – undo
460 460
 			'post_status' => 'publish',
461 461
 		);
462 462
 
463
-		if ( ! empty( $type ) && $this->valid_type( $type ) ) {
463
+		if ( ! empty($type) && $this->valid_type($type)) {
464 464
 			$query_args['log_type'] = $type;
465 465
 		}
466 466
 
467
-		if ( ! empty( $meta_query ) ) {
467
+		if ( ! empty($meta_query)) {
468 468
 			$query_args['meta_query'] = $meta_query;
469 469
 		}
470 470
 
471
-		$this->bc_200_validate_params( $query_args );
471
+		$this->bc_200_validate_params($query_args);
472 472
 
473
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
473
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
474 474
 			// Backward compatibility.
475
-			$logs = get_posts( $query_args );
475
+			$logs = get_posts($query_args);
476 476
 
477
-			if ( $logs ) {
478
-				foreach ( $logs as $log ) {
479
-					wp_delete_post( $log, true );
477
+			if ($logs) {
478
+				foreach ($logs as $log) {
479
+					wp_delete_post($log, true);
480 480
 				}
481 481
 			}
482 482
 		} else {
483
-			$logs = $this->log_db->get_logs( $query_args );
483
+			$logs = $this->log_db->get_logs($query_args);
484 484
 
485
-			if ( $logs ) {
486
-				foreach ( $logs as $log ) {
487
-					if ( $this->log_db->delete( $log->ID ) ) {
488
-						$this->logmeta_db->delete_row( $log->ID );
485
+			if ($logs) {
486
+				foreach ($logs as $log) {
487
+					if ($this->log_db->delete($log->ID)) {
488
+						$this->logmeta_db->delete_row($log->ID);
489 489
 					}
490 490
 				}
491 491
 			}
@@ -502,9 +502,9 @@  discard block
 block discarded – undo
502 502
 	 *
503 503
 	 * @param int $post_id
504 504
 	 */
505
-	public function background_process_delete_cache( $post_id ) {
505
+	public function background_process_delete_cache($post_id) {
506 506
 		// Delete log cache immediately
507
-		wp_schedule_single_event( time() - 5, 'give_delete_log_cache' );
507
+		wp_schedule_single_event(time() - 5, 'give_delete_log_cache');
508 508
 	}
509 509
 
510 510
 	/**
@@ -517,17 +517,17 @@  discard block
 block discarded – undo
517 517
 	 */
518 518
 	public function delete_cache() {
519 519
 		// Add log related keys to delete.
520
-		$cache_give_logs      = Give_Cache::get_options_like( 'give_logs' );
521
-		$cache_give_log_count = Give_Cache::get_options_like( 'log_count' );
520
+		$cache_give_logs      = Give_Cache::get_options_like('give_logs');
521
+		$cache_give_log_count = Give_Cache::get_options_like('log_count');
522 522
 
523
-		$cache_option_names = array_merge( $cache_give_logs, $cache_give_log_count );
523
+		$cache_option_names = array_merge($cache_give_logs, $cache_give_log_count);
524 524
 
525 525
 		// Bailout.
526
-		if ( empty( $cache_option_names ) ) {
526
+		if (empty($cache_option_names)) {
527 527
 			return false;
528 528
 		}
529 529
 
530
-		Give_Cache::delete( $cache_option_names );
530
+		Give_Cache::delete($cache_option_names);
531 531
 	}
532 532
 
533 533
 	/**
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 	 * @param array $log_query
540 540
 	 * @param array $log_meta
541 541
 	 */
542
-	private function bc_200_validate_params( &$log_query, &$log_meta = array() ) {
542
+	private function bc_200_validate_params(&$log_query, &$log_meta = array()) {
543 543
 		$query_params = array(
544 544
 			'log_title'    => 'post_title',
545 545
 			'log_parent'   => 'post_parent',
@@ -551,41 +551,41 @@  discard block
 block discarded – undo
551 551
 			'meta_query'   => 'meta_query',
552 552
 		);
553 553
 
554
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
554
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
555 555
 			// Set old params.
556
-			foreach ( $query_params as $new_query_param => $old_query_param ) {
556
+			foreach ($query_params as $new_query_param => $old_query_param) {
557 557
 
558
-				if ( isset( $log_query[ $old_query_param ] ) && empty( $log_query[ $new_query_param ] ) ) {
559
-					$log_query[ $new_query_param ] = $log_query[ $old_query_param ];
558
+				if (isset($log_query[$old_query_param]) && empty($log_query[$new_query_param])) {
559
+					$log_query[$new_query_param] = $log_query[$old_query_param];
560 560
 					continue;
561
-				} elseif ( ! isset( $log_query[ $new_query_param ] ) ) {
561
+				} elseif ( ! isset($log_query[$new_query_param])) {
562 562
 					continue;
563
-				} elseif( empty( $log_query[ $new_query_param ] ) ) {
563
+				} elseif (empty($log_query[$new_query_param])) {
564 564
 					continue;
565 565
 				}
566 566
 
567
-				switch ( $new_query_param ) {
567
+				switch ($new_query_param) {
568 568
 					case 'log_type':
569 569
 						$log_query['tax_query'] = array(
570 570
 							array(
571 571
 								'taxonomy' => 'give_log_type',
572 572
 								'field'    => 'slug',
573
-								'terms'    => $log_query[ $new_query_param ],
573
+								'terms'    => $log_query[$new_query_param],
574 574
 							),
575 575
 						);
576 576
 						break;
577 577
 
578 578
 					case 'meta_query':
579
-						if( ! empty( $log_query['meta_query'] ) && empty( $log_query['post_parent'] ) ) {
580
-							foreach ( $log_query['meta_query'] as $index => $meta_query ){
581
-								if( ! is_array( $meta_query ) || empty( $meta_query['key'] ) ) {
579
+						if ( ! empty($log_query['meta_query']) && empty($log_query['post_parent'])) {
580
+							foreach ($log_query['meta_query'] as $index => $meta_query) {
581
+								if ( ! is_array($meta_query) || empty($meta_query['key'])) {
582 582
 									continue;
583 583
 								}
584 584
 
585
-								switch ( $meta_query['key'] ) {
585
+								switch ($meta_query['key']) {
586 586
 									case '_give_log_form_id':
587 587
 										$log_query['post_parent'] = $meta_query['value'];
588
-										unset( $log_query['meta_query'][$index] );
588
+										unset($log_query['meta_query'][$index]);
589 589
 										break;
590 590
 								}
591 591
 							}
@@ -593,40 +593,40 @@  discard block
 block discarded – undo
593 593
 						break;
594 594
 
595 595
 					default:
596
-						switch( $new_query_param ){
596
+						switch ($new_query_param) {
597 597
 							case 'log_parent':
598 598
 								$log_query['meta_query'][] = array(
599 599
 									'key' => '_give_log_payment_id',
600
-									'value' => $log_query[ $new_query_param ]
600
+									'value' => $log_query[$new_query_param]
601 601
 								);
602 602
 
603 603
 								break;
604 604
 
605 605
 							default:
606
-								$log_query[ $old_query_param ] = $log_query[ $new_query_param ];
606
+								$log_query[$old_query_param] = $log_query[$new_query_param];
607 607
 						}
608 608
 				}
609 609
 			}
610 610
 		} else {
611 611
 			// Set only old params.
612
-			$query_params = array_flip( $query_params );
613
-			foreach ( $query_params as $old_query_param => $new_query_param ) {
614
-				if ( isset( $log_query[ $new_query_param ] ) && empty( $log_query[ $old_query_param ] ) ) {
615
-					$log_query[ $old_query_param ] = $log_query[ $new_query_param ];
612
+			$query_params = array_flip($query_params);
613
+			foreach ($query_params as $old_query_param => $new_query_param) {
614
+				if (isset($log_query[$new_query_param]) && empty($log_query[$old_query_param])) {
615
+					$log_query[$old_query_param] = $log_query[$new_query_param];
616 616
 					continue;
617
-				} elseif ( ! isset( $log_query[ $old_query_param ] ) ) {
617
+				} elseif ( ! isset($log_query[$old_query_param])) {
618 618
 					continue;
619 619
 				}
620 620
 
621
-				switch ( $old_query_param ) {
621
+				switch ($old_query_param) {
622 622
 					case 'tax_query':
623
-						if ( isset( $log_query[ $old_query_param ][0]['terms'] ) ) {
624
-							$log_query[ $new_query_param ] = $log_query[ $old_query_param ][0]['terms'];
623
+						if (isset($log_query[$old_query_param][0]['terms'])) {
624
+							$log_query[$new_query_param] = $log_query[$old_query_param][0]['terms'];
625 625
 						}
626 626
 						break;
627 627
 
628 628
 					default:
629
-						$log_query[ $new_query_param ] = $log_query[ $old_query_param ];
629
+						$log_query[$new_query_param] = $log_query[$old_query_param];
630 630
 				}
631 631
 			}
632 632
 		}
@@ -640,8 +640,8 @@  discard block
 block discarded – undo
640 640
 	 *
641 641
 	 * @param  array $logs
642 642
 	 */
643
-	private function bc_200_add_new_properties( &$logs ) {
644
-		if ( empty( $logs ) ) {
643
+	private function bc_200_add_new_properties(&$logs) {
644
+		if (empty($logs)) {
645 645
 			return;
646 646
 		}
647 647
 
@@ -654,30 +654,30 @@  discard block
 block discarded – undo
654 654
 			'log_type'     => 'give_log_type',
655 655
 		);
656 656
 
657
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
658
-			foreach ( $logs as $index => $log ) {
659
-				foreach ( $query_params as $new_query_param => $old_query_param ) {
660
-					if ( ! property_exists( $log, $old_query_param ) ) {
657
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
658
+			foreach ($logs as $index => $log) {
659
+				foreach ($query_params as $new_query_param => $old_query_param) {
660
+					if ( ! property_exists($log, $old_query_param)) {
661 661
 						/**
662 662
 						 *  Set unmatched properties.
663 663
 						 */
664 664
 
665 665
 						// 1. log_type
666
-						$term = get_the_terms( $log->ID, 'give_log_type' );
667
-						$term = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array();
666
+						$term = get_the_terms($log->ID, 'give_log_type');
667
+						$term = ! is_wp_error($term) && ! empty($term) ? $term[0] : array();
668 668
 
669
-						$logs[ $index ]->{$new_query_param} = ! empty( $term ) ? $term->slug : '';
669
+						$logs[$index]->{$new_query_param} = ! empty($term) ? $term->slug : '';
670 670
 
671 671
 						continue;
672 672
 					}
673 673
 
674
-					switch ( $old_query_param ) {
674
+					switch ($old_query_param) {
675 675
 						case 'post_parent':
676
-							$logs[ $index ]->{$new_query_param} = give_get_meta( $log->ID, '_give_log_payment_id', true );
676
+							$logs[$index]->{$new_query_param} = give_get_meta($log->ID, '_give_log_payment_id', true);
677 677
 							break;
678 678
 
679 679
 						default:
680
-							$logs[ $index ]->{$new_query_param} = $log->{$old_query_param};
680
+							$logs[$index]->{$new_query_param} = $log->{$old_query_param};
681 681
 					}
682 682
 				}
683 683
 			}
@@ -697,10 +697,10 @@  discard block
 block discarded – undo
697 697
 	 *
698 698
 	 * @return mixed
699 699
 	 */
700
-	public function bc_200_set_payment_as_log_parent( $check, $log_id, $meta_key, $meta_value ) {
700
+	public function bc_200_set_payment_as_log_parent($check, $log_id, $meta_key, $meta_value) {
701 701
 		global $wpdb;
702 702
 		$update_status = false;
703
-		$post_type     = get_post_type( $log_id );
703
+		$post_type     = get_post_type($log_id);
704 704
 
705 705
 		// Bailout.
706 706
 		if (
@@ -720,9 +720,9 @@  discard block
 block discarded – undo
720 720
 			)
721 721
 		);
722 722
 
723
-		if ( $form_id ) {
724
-			$this->logmeta_db->delete_meta( $log_id, '_give_log_payment_id' );
725
-			$this->logmeta_db->update_meta( $log_id, '_give_log_form_id', $form_id );
723
+		if ($form_id) {
724
+			$this->logmeta_db->delete_meta($log_id, '_give_log_payment_id');
725
+			$this->logmeta_db->update_meta($log_id, '_give_log_form_id', $form_id);
726 726
 
727 727
 			$update_status = $wpdb->update(
728 728
 				$this->log_db->table_name,
Please login to merge, or discard this patch.
includes/install.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -397,7 +397,7 @@
 block discarded – undo
397 397
  *
398 398
  * @since 1.8.11
399 399
  *
400
- * @return void
400
+ * @return false|null
401 401
  */
402 402
 function give_create_pages() {
403 403
 
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -28,15 +28,15 @@  discard block
 block discarded – undo
28 28
  * @global     $wpdb
29 29
  * @return void
30 30
  */
31
-function give_install( $network_wide = false ) {
31
+function give_install($network_wide = false) {
32 32
 
33 33
 	global $wpdb;
34 34
 
35
-	if ( is_multisite() && $network_wide ) {
35
+	if (is_multisite() && $network_wide) {
36 36
 
37
-		foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs LIMIT 100" ) as $blog_id ) {
37
+		foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs LIMIT 100") as $blog_id) {
38 38
 
39
-			switch_to_blog( $blog_id );
39
+			switch_to_blog($blog_id);
40 40
 			give_run_install();
41 41
 			restore_current_blog();
42 42
 
@@ -63,31 +63,31 @@  discard block
 block discarded – undo
63 63
 	give_setup_post_types();
64 64
 
65 65
 	// Add Upgraded From Option.
66
-	$current_version = get_option( 'give_version' );
67
-	if ( $current_version ) {
68
-		update_option( 'give_version_upgraded_from', $current_version );
66
+	$current_version = get_option('give_version');
67
+	if ($current_version) {
68
+		update_option('give_version_upgraded_from', $current_version);
69 69
 	}
70 70
 
71 71
 	// Setup some default options.
72 72
 	$options = array();
73 73
 
74 74
 	//Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency.
75
-	if ( empty( $current_version ) ) {
76
-		$options = array_merge( $options, give_get_default_settings() );
75
+	if (empty($current_version)) {
76
+		$options = array_merge($options, give_get_default_settings());
77 77
 	}
78 78
 
79 79
 	// Populate the default values.
80
-	update_option( 'give_settings', array_merge( $give_options, $options ) );
80
+	update_option('give_settings', array_merge($give_options, $options));
81 81
 
82 82
 	/**
83 83
 	 * Run plugin upgrades.
84 84
 	 *
85 85
 	 * @since 1.8
86 86
 	 */
87
-	do_action( 'give_upgrades' );
87
+	do_action('give_upgrades');
88 88
 
89
-	if ( GIVE_VERSION !== get_option( 'give_version' ) ) {
90
-		update_option( 'give_version', GIVE_VERSION );
89
+	if (GIVE_VERSION !== get_option('give_version')) {
90
+		update_option('give_version', GIVE_VERSION);
91 91
 	}
92 92
 
93 93
 	// Create Give roles.
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	// Set api version, end point and refresh permalink.
99 99
 	$api = new Give_API();
100 100
 	$api->add_endpoint();
101
-	update_option( 'give_default_api_version', 'v' . $api->get_version() );
101
+	update_option('give_default_api_version', 'v'.$api->get_version());
102 102
 
103 103
 	flush_rewrite_rules();
104 104
 
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
 	$give_sessions->use_php_sessions();
114 114
 
115 115
 	// Add a temporary option to note that Give pages have been created.
116
-	Give_Cache::set( '_give_installed', $options, 30, true );
116
+	Give_Cache::set('_give_installed', $options, 30, true);
117 117
 
118
-	if ( ! $current_version ) {
118
+	if ( ! $current_version) {
119 119
 
120
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
120
+		require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
121 121
 
122 122
 		// When new upgrade routines are added, mark them as complete on fresh install.
123 123
 		$upgrade_routines = array(
@@ -149,18 +149,18 @@  discard block
 block discarded – undo
149 149
 			'v210_verify_form_status_upgrades',
150 150
 		);
151 151
 
152
-		foreach ( $upgrade_routines as $upgrade ) {
153
-			give_set_upgrade_complete( $upgrade );
152
+		foreach ($upgrade_routines as $upgrade) {
153
+			give_set_upgrade_complete($upgrade);
154 154
 		}
155 155
 	}
156 156
 
157 157
 	// Bail if activating from network, or bulk.
158
-	if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
158
+	if (is_network_admin() || isset($_GET['activate-multi'])) {
159 159
 		return;
160 160
 	}
161 161
 
162 162
 	// Add the transient to redirect.
163
-	Give_Cache::set( '_give_activation_redirect', true, 30, true );
163
+	Give_Cache::set('_give_activation_redirect', true, 30, true);
164 164
 }
165 165
 
166 166
 /**
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
  * @param  int    $site_id The Site ID.
179 179
  * @param  array  $meta    Blog Meta.
180 180
  */
181
-function give_on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
181
+function give_on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) {
182 182
 
183
-	if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) {
183
+	if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) {
184 184
 
185
-		switch_to_blog( $blog_id );
185
+		switch_to_blog($blog_id);
186 186
 		give_install();
187 187
 		restore_current_blog();
188 188
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 
191 191
 }
192 192
 
193
-add_action( 'wpmu_new_blog', 'give_on_create_blog', 10, 6 );
193
+add_action('wpmu_new_blog', 'give_on_create_blog', 10, 6);
194 194
 
195 195
 
196 196
 /**
@@ -203,13 +203,13 @@  discard block
 block discarded – undo
203 203
  *
204 204
  * @return array          The tables to drop.
205 205
  */
206
-function give_wpmu_drop_tables( $tables, $blog_id ) {
206
+function give_wpmu_drop_tables($tables, $blog_id) {
207 207
 
208
-	switch_to_blog( $blog_id );
208
+	switch_to_blog($blog_id);
209 209
 	$donors_db     = new Give_DB_Donors();
210 210
 	$donor_meta_db = new Give_DB_Donor_Meta();
211 211
 
212
-	if ( $donors_db->installed() ) {
212
+	if ($donors_db->installed()) {
213 213
 		$tables[] = $donors_db->table_name;
214 214
 		$tables[] = $donor_meta_db->table_name;
215 215
 	}
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 
220 220
 }
221 221
 
222
-add_filter( 'wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2 );
222
+add_filter('wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2);
223 223
 
224 224
 /**
225 225
  * Post-installation
@@ -231,16 +231,16 @@  discard block
 block discarded – undo
231 231
  */
232 232
 function give_after_install() {
233 233
 
234
-	if ( ! is_admin() ) {
234
+	if ( ! is_admin()) {
235 235
 		return;
236 236
 	}
237 237
 
238
-	$give_options     = Give_Cache::get( '_give_installed', true );
239
-	$give_table_check = get_option( '_give_table_check', false );
238
+	$give_options     = Give_Cache::get('_give_installed', true);
239
+	$give_table_check = get_option('_give_table_check', false);
240 240
 
241
-	if ( false === $give_table_check || current_time( 'timestamp' ) > $give_table_check ) {
241
+	if (false === $give_table_check || current_time('timestamp') > $give_table_check) {
242 242
 
243
-		if ( ! @Give()->donor_meta->installed() ) {
243
+		if ( ! @Give()->donor_meta->installed()) {
244 244
 
245 245
 			// Create the donor meta database.
246 246
 			// (this ensures it creates it on multisite instances where it is network activated).
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 
249 249
 		}
250 250
 
251
-		if ( ! @Give()->donors->installed() ) {
251
+		if ( ! @Give()->donors->installed()) {
252 252
 			// Create the donor database.
253 253
 			// (this ensures it creates it on multisite instances where it is network activated).
254 254
 			@Give()->donors->create_table();
@@ -260,22 +260,22 @@  discard block
 block discarded – undo
260 260
 			 *
261 261
 			 * @param array $give_options Give plugin options.
262 262
 			 */
263
-			do_action( 'give_after_install', $give_options );
263
+			do_action('give_after_install', $give_options);
264 264
 		}
265 265
 
266
-		update_option( '_give_table_check', ( current_time( 'timestamp' ) + WEEK_IN_SECONDS ) );
266
+		update_option('_give_table_check', (current_time('timestamp') + WEEK_IN_SECONDS));
267 267
 
268 268
 	}
269 269
 
270 270
 	// Delete the transient
271
-	if ( false !== $give_options ) {
272
-		Give_Cache::delete( Give_Cache::get_key( '_give_installed' ) );
271
+	if (false !== $give_options) {
272
+		Give_Cache::delete(Give_Cache::get_key('_give_installed'));
273 273
 	}
274 274
 
275 275
 
276 276
 }
277 277
 
278
-add_action( 'admin_init', 'give_after_install' );
278
+add_action('admin_init', 'give_after_install');
279 279
 
280 280
 
281 281
 /**
@@ -290,11 +290,11 @@  discard block
 block discarded – undo
290 290
 
291 291
 	global $wp_roles;
292 292
 
293
-	if ( ! is_object( $wp_roles ) ) {
293
+	if ( ! is_object($wp_roles)) {
294 294
 		return;
295 295
 	}
296 296
 
297
-	if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) {
297
+	if ( ! array_key_exists('give_manager', $wp_roles->roles)) {
298 298
 
299 299
 		// Create Give plugin roles
300 300
 		$roles = new Give_Roles();
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 
306 306
 }
307 307
 
308
-add_action( 'admin_init', 'give_install_roles_on_network' );
308
+add_action('admin_init', 'give_install_roles_on_network');
309 309
 
310 310
 /**
311 311
  * Default core setting values.
@@ -346,14 +346,14 @@  discard block
 block discarded – undo
346 346
 		'uninstall_on_delete'                         => 'disabled',
347 347
 		'the_content_filter'                          => 'enabled',
348 348
 		'scripts_footer'                              => 'disabled',
349
-		'agree_to_terms_label'                        => __( 'Agree to Terms?', 'give' ),
349
+		'agree_to_terms_label'                        => __('Agree to Terms?', 'give'),
350 350
 		'agreement_text'                              => give_get_default_agreement_text(),
351 351
 
352 352
 		// Paypal IPN verification.
353 353
 		'paypal_verification'                         => 'enabled',
354 354
 
355 355
 		// Default is manual gateway.
356
-		'gateways'                                    => array( 'manual' => 1, 'offline' => 1 ),
356
+		'gateways'                                    => array('manual' => 1, 'offline' => 1),
357 357
 		'default_gateway'                             => 'manual',
358 358
 
359 359
 		// Offline gateway setup.
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
  */
382 382
 function give_get_default_agreement_text() {
383 383
 
384
-	$org_name = get_bloginfo( 'name' );
384
+	$org_name = get_bloginfo('name');
385 385
 
386 386
 	$agreement = sprintf(
387 387
 		'<p>Acceptance of any contribution, gift or grant is at the discretion of the %1$s. The  %1$s will not accept any gift unless it can be used or expended consistently with the purpose and mission of the  %1$s.</p>
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 		$org_name
396 396
 	);
397 397
 
398
-	return apply_filters( 'give_get_default_agreement_text', $agreement, $org_name );
398
+	return apply_filters('give_get_default_agreement_text', $agreement, $org_name);
399 399
 }
400 400
 
401 401
 
@@ -409,19 +409,19 @@  discard block
 block discarded – undo
409 409
 function give_create_pages() {
410 410
 
411 411
 	// Bailout if pages already created.
412
-	if ( get_option( 'give_install_pages_created' ) ) {
412
+	if (get_option('give_install_pages_created')) {
413 413
 		return false;
414 414
 	}
415 415
 
416 416
 	$options = array();
417 417
 
418 418
 	// Checks if the Success Page option exists AND that the page exists.
419
-	if ( ! get_post( give_get_option( 'success_page' ) ) ) {
419
+	if ( ! get_post(give_get_option('success_page'))) {
420 420
 
421 421
 		// Donation Confirmation (Success) Page
422 422
 		$success = wp_insert_post(
423 423
 			array(
424
-				'post_title'     => esc_html__( 'Donation Confirmation', 'give' ),
424
+				'post_title'     => esc_html__('Donation Confirmation', 'give'),
425 425
 				'post_content'   => '[give_receipt]',
426 426
 				'post_status'    => 'publish',
427 427
 				'post_author'    => 1,
@@ -435,13 +435,13 @@  discard block
 block discarded – undo
435 435
 	}
436 436
 
437 437
 	// Checks if the Failure Page option exists AND that the page exists.
438
-	if ( ! get_post( give_get_option( 'failure_page' ) ) ) {
438
+	if ( ! get_post(give_get_option('failure_page'))) {
439 439
 
440 440
 		// Failed Donation Page
441 441
 		$failed = wp_insert_post(
442 442
 			array(
443
-				'post_title'     => esc_html__( 'Donation Failed', 'give' ),
444
-				'post_content'   => esc_html__( 'We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give' ),
443
+				'post_title'     => esc_html__('Donation Failed', 'give'),
444
+				'post_content'   => esc_html__('We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give'),
445 445
 				'post_status'    => 'publish',
446 446
 				'post_author'    => 1,
447 447
 				'post_type'      => 'page',
@@ -453,11 +453,11 @@  discard block
 block discarded – undo
453 453
 	}
454 454
 
455 455
 	// Checks if the History Page option exists AND that the page exists.
456
-	if ( ! get_post( give_get_option( 'history_page' ) ) ) {
456
+	if ( ! get_post(give_get_option('history_page'))) {
457 457
 		// Donation History Page
458 458
 		$history = wp_insert_post(
459 459
 			array(
460
-				'post_title'     => esc_html__( 'Donation History', 'give' ),
460
+				'post_title'     => esc_html__('Donation History', 'give'),
461 461
 				'post_content'   => '[donation_history]',
462 462
 				'post_status'    => 'publish',
463 463
 				'post_author'    => 1,
@@ -469,11 +469,11 @@  discard block
 block discarded – undo
469 469
 		$options['history_page'] = $history;
470 470
 	}
471 471
 
472
-	if ( ! empty( $options ) ) {
473
-		update_option( 'give_settings', array_merge( give_get_settings(), $options ) );
472
+	if ( ! empty($options)) {
473
+		update_option('give_settings', array_merge(give_get_settings(), $options));
474 474
 	}
475 475
 
476
-	add_option( 'give_install_pages_created', 1, '', 'no' );
476
+	add_option('give_install_pages_created', 1, '', 'no');
477 477
 }
478 478
 
479
-add_action( 'admin_init', 'give_create_pages', - 1 );
479
+add_action('admin_init', 'give_create_pages', - 1);
Please login to merge, or discard this patch.
includes/payments/backward-compatibility.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -207,7 +207,7 @@
 block discarded – undo
207 207
  *                              metadata entries with the specified value.
208 208
  *                              Otherwise, update all entries.
209 209
  *
210
- * @return mixed
210
+ * @return null|boolean
211 211
  */
212 212
 function _give_20_bc_saving_old_payment_meta( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
213 213
 	// Bailout.
Please login to merge, or discard this patch.
Spacing   +166 added lines, -171 removed lines patch added patch discarded remove patch
@@ -9,74 +9,74 @@  discard block
 block discarded – undo
9 9
  *
10 10
  * @return void
11 11
  */
12
-function _give_20_bc_split_and_save_give_payment_meta( $object_id, $meta_value ) {
12
+function _give_20_bc_split_and_save_give_payment_meta($object_id, $meta_value) {
13 13
 	// Bailout
14
-	if ( empty( $meta_value ) ) {
14
+	if (empty($meta_value)) {
15 15
 		return;
16
-	} elseif ( ! is_array( $meta_value ) ) {
16
+	} elseif ( ! is_array($meta_value)) {
17 17
 		$meta_value = array();
18 18
 	}
19 19
 
20
-	remove_filter( 'get_post_metadata', '_give_20_bc_get_new_payment_meta', 10 );
20
+	remove_filter('get_post_metadata', '_give_20_bc_get_new_payment_meta', 10);
21 21
 
22 22
 	// Date payment meta.
23
-	if ( ! empty( $meta_value['date'] ) ) {
24
-		give_update_meta( $object_id, '_give_payment_date', $meta_value['date'] );
23
+	if ( ! empty($meta_value['date'])) {
24
+		give_update_meta($object_id, '_give_payment_date', $meta_value['date']);
25 25
 	}
26 26
 
27 27
 	// Currency payment meta.
28
-	if ( ! empty( $meta_value['currency'] ) ) {
29
-		give_update_meta( $object_id, '_give_payment_currency', $meta_value['currency'] );
28
+	if ( ! empty($meta_value['currency'])) {
29
+		give_update_meta($object_id, '_give_payment_currency', $meta_value['currency']);
30 30
 	}
31 31
 
32 32
 	// User information.
33
-	if ( ! empty( $meta_value['user_info'] ) ) {
33
+	if ( ! empty($meta_value['user_info'])) {
34 34
 		// Donor first name.
35
-		if ( ! empty( $meta_value['user_info']['first_name'] ) ) {
36
-			give_update_meta( $object_id, '_give_donor_billing_first_name', $meta_value['user_info']['first_name'] );
35
+		if ( ! empty($meta_value['user_info']['first_name'])) {
36
+			give_update_meta($object_id, '_give_donor_billing_first_name', $meta_value['user_info']['first_name']);
37 37
 		}
38 38
 
39 39
 		// Donor last name.
40
-		if ( ! empty( $meta_value['user_info']['last_name'] ) ) {
41
-			give_update_meta( $object_id, '_give_donor_billing_last_name', $meta_value['user_info']['last_name'] );
40
+		if ( ! empty($meta_value['user_info']['last_name'])) {
41
+			give_update_meta($object_id, '_give_donor_billing_last_name', $meta_value['user_info']['last_name']);
42 42
 		}
43 43
 
44 44
 		// Donor address payment meta.
45
-		if ( ! empty( $meta_value['user_info']['address'] ) ) {
45
+		if ( ! empty($meta_value['user_info']['address'])) {
46 46
 
47 47
 			// Address1.
48
-			if ( ! empty( $meta_value['user_info']['address']['line1'] ) ) {
49
-				give_update_meta( $object_id, '_give_donor_billing_address1', $meta_value['user_info']['address']['line1'] );
48
+			if ( ! empty($meta_value['user_info']['address']['line1'])) {
49
+				give_update_meta($object_id, '_give_donor_billing_address1', $meta_value['user_info']['address']['line1']);
50 50
 			}
51 51
 
52 52
 			// Address2.
53
-			if ( ! empty( $meta_value['user_info']['address']['line2'] ) ) {
54
-				give_update_meta( $object_id, '_give_donor_billing_address2', $meta_value['user_info']['address']['line2'] );
53
+			if ( ! empty($meta_value['user_info']['address']['line2'])) {
54
+				give_update_meta($object_id, '_give_donor_billing_address2', $meta_value['user_info']['address']['line2']);
55 55
 			}
56 56
 
57 57
 			// City.
58
-			if ( ! empty( $meta_value['user_info']['address']['city'] ) ) {
59
-				give_update_meta( $object_id, '_give_donor_billing_city', $meta_value['user_info']['address']['city'] );
58
+			if ( ! empty($meta_value['user_info']['address']['city'])) {
59
+				give_update_meta($object_id, '_give_donor_billing_city', $meta_value['user_info']['address']['city']);
60 60
 			}
61 61
 
62 62
 			// Zip.
63
-			if ( ! empty( $meta_value['user_info']['address']['zip'] ) ) {
64
-				give_update_meta( $object_id, '_give_donor_billing_zip', $meta_value['user_info']['address']['zip'] );
63
+			if ( ! empty($meta_value['user_info']['address']['zip'])) {
64
+				give_update_meta($object_id, '_give_donor_billing_zip', $meta_value['user_info']['address']['zip']);
65 65
 			}
66 66
 
67 67
 			// State.
68
-			if ( ! empty( $meta_value['user_info']['address']['state'] ) ) {
69
-				give_update_meta( $object_id, '_give_donor_billing_state', $meta_value['user_info']['address']['state'] );
68
+			if ( ! empty($meta_value['user_info']['address']['state'])) {
69
+				give_update_meta($object_id, '_give_donor_billing_state', $meta_value['user_info']['address']['state']);
70 70
 			}
71 71
 
72 72
 			// Country.
73
-			if ( ! empty( $meta_value['user_info']['address']['country'] ) ) {
74
-				give_update_meta( $object_id, '_give_donor_billing_country', $meta_value['user_info']['address']['country'] );
73
+			if ( ! empty($meta_value['user_info']['address']['country'])) {
74
+				give_update_meta($object_id, '_give_donor_billing_country', $meta_value['user_info']['address']['country']);
75 75
 			}
76 76
 		}
77 77
 	}// End if().
78 78
 
79
-	add_filter( 'get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5 );
79
+	add_filter('get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5);
80 80
 }
81 81
 
82 82
 /**
@@ -89,103 +89,99 @@  discard block
 block discarded – undo
89 89
  *
90 90
  * @return array
91 91
  */
92
-function _give_20_bc_give_payment_meta_value( $object_id, $meta_value ) {
92
+function _give_20_bc_give_payment_meta_value($object_id, $meta_value) {
93 93
 	$cache_key = "_give_payment_meta_{$object_id}";
94
-	$cache     = Give_Cache::get_db_query( $cache_key );
94
+	$cache     = Give_Cache::get_db_query($cache_key);
95 95
 
96
-	if ( ! is_null( $cache ) ) {
96
+	if ( ! is_null($cache)) {
97 97
 		return $cache;
98 98
 	}
99 99
 
100 100
 	// Set default value to array.
101
-	if ( ! is_array( $meta_value ) ) {
101
+	if ( ! is_array($meta_value)) {
102 102
 		$meta_value = array();
103 103
 	}
104 104
 
105 105
 	// Donation key.
106
-	$meta_value['key'] = give_get_meta( $object_id, '_give_payment_purchase_key', true );
106
+	$meta_value['key'] = give_get_meta($object_id, '_give_payment_purchase_key', true);
107 107
 
108 108
 	// Donation form.
109
-	$meta_value['form_title'] = give_get_meta( $object_id, '_give_payment_form_title', true );
109
+	$meta_value['form_title'] = give_get_meta($object_id, '_give_payment_form_title', true);
110 110
 
111 111
 	// Donor email.
112
-	$meta_value['email'] = give_get_meta( $object_id, '_give_payment_donor_email', true );
113
-	$meta_value['email'] = ! empty( $meta_value['email'] ) ?
114
-		$meta_value['email'] :
115
-		Give()->donors->get_column( 'email', give_get_payment_donor_id( $object_id ) );
112
+	$meta_value['email'] = give_get_meta($object_id, '_give_payment_donor_email', true);
113
+	$meta_value['email'] = ! empty($meta_value['email']) ?
114
+		$meta_value['email'] : Give()->donors->get_column('email', give_get_payment_donor_id($object_id));
116 115
 
117 116
 	// Form id.
118
-	$meta_value['form_id'] = give_get_meta( $object_id, '_give_payment_form_id', true );
117
+	$meta_value['form_id'] = give_get_meta($object_id, '_give_payment_form_id', true);
119 118
 
120 119
 	// Price id.
121
-	$meta_value['price_id'] = give_get_meta( $object_id, '_give_payment_price_id', true );
120
+	$meta_value['price_id'] = give_get_meta($object_id, '_give_payment_price_id', true);
122 121
 
123 122
 	// Date.
124
-	$meta_value['date'] = give_get_meta( $object_id, '_give_payment_date', true );
125
-	$meta_value['date'] = ! empty( $meta_value['date'] ) ?
126
-		$meta_value['date'] :
127
-		get_post_field( 'post_date', $object_id );
123
+	$meta_value['date'] = give_get_meta($object_id, '_give_payment_date', true);
124
+	$meta_value['date'] = ! empty($meta_value['date']) ?
125
+		$meta_value['date'] : get_post_field('post_date', $object_id);
128 126
 
129 127
 	// Currency.
130
-	$meta_value['currency'] = give_get_meta( $object_id, '_give_payment_currency', true );
128
+	$meta_value['currency'] = give_get_meta($object_id, '_give_payment_currency', true);
131 129
 
132 130
 	// Decode donor data.
133
-	$donor_names = give_get_donor_name_by( give_get_meta( $object_id, '_give_payment_donor_id', true ), 'donor' );
134
-	$donor_names = explode( ' ', $donor_names, 2 );
131
+	$donor_names = give_get_donor_name_by(give_get_meta($object_id, '_give_payment_donor_id', true), 'donor');
132
+	$donor_names = explode(' ', $donor_names, 2);
135 133
 
136 134
 	// Donor first name.
137
-	$donor_data['first_name'] = give_get_meta( $object_id, '_give_donor_billing_first_name', true );
138
-	$donor_data['first_name'] = ! empty( $donor_data['first_name'] ) ?
139
-		$donor_data['first_name'] :
140
-		$donor_names[0];
135
+	$donor_data['first_name'] = give_get_meta($object_id, '_give_donor_billing_first_name', true);
136
+	$donor_data['first_name'] = ! empty($donor_data['first_name']) ?
137
+		$donor_data['first_name'] : $donor_names[0];
141 138
 
142 139
 	// Donor last name.
143
-	$donor_data['last_name'] = give_get_meta( $object_id, '_give_donor_billing_last_name', true );
144
-	$donor_data['last_name'] = ! empty( $donor_data['last_name'] ) ?
145
-		$donor_data['last_name'] :
146
-		( isset( $donor_names[1] ) ? $donor_names[1] : '' );
140
+	$donor_data['last_name'] = give_get_meta($object_id, '_give_donor_billing_last_name', true);
141
+	$donor_data['last_name'] = ! empty($donor_data['last_name']) ?
142
+		$donor_data['last_name'] : (isset($donor_names[1]) ? $donor_names[1] : '');
147 143
 
148 144
 	// Donor email.
149 145
 	$donor_data['email'] = $meta_value['email'];
150 146
 
151 147
 	// User ID.
152
-	$donor_data['id'] = give_get_payment_user_id( $object_id );
148
+	$donor_data['id'] = give_get_payment_user_id($object_id);
153 149
 
154 150
 	$donor_data['address'] = false;
155 151
 
156 152
 	// Address1.
157
-	if ( $address1 = give_get_meta( $object_id, '_give_donor_billing_address1', true ) ) {
153
+	if ($address1 = give_get_meta($object_id, '_give_donor_billing_address1', true)) {
158 154
 		$donor_data['address']['line1'] = $address1;
159 155
 	}
160 156
 
161 157
 	// Address2.
162
-	if ( $address2 = give_get_meta( $object_id, '_give_donor_billing_address2', true ) ) {
158
+	if ($address2 = give_get_meta($object_id, '_give_donor_billing_address2', true)) {
163 159
 		$donor_data['address']['line2'] = $address2;
164 160
 	}
165 161
 
166 162
 	// City.
167
-	if ( $city = give_get_meta( $object_id, '_give_donor_billing_city', true ) ) {
163
+	if ($city = give_get_meta($object_id, '_give_donor_billing_city', true)) {
168 164
 		$donor_data['address']['city'] = $city;
169 165
 	}
170 166
 
171 167
 	// Zip.
172
-	if ( $zip = give_get_meta( $object_id, '_give_donor_billing_zip', true ) ) {
168
+	if ($zip = give_get_meta($object_id, '_give_donor_billing_zip', true)) {
173 169
 		$donor_data['address']['zip'] = $zip;
174 170
 	}
175 171
 
176 172
 	// State.
177
-	if ( $state = give_get_meta( $object_id, '_give_donor_billing_state', true ) ) {
173
+	if ($state = give_get_meta($object_id, '_give_donor_billing_state', true)) {
178 174
 		$donor_data['address']['state'] = $state;
179 175
 	}
180 176
 
181 177
 	// Country.
182
-	if ( $country = give_get_meta( $object_id, '_give_donor_billing_country', true ) ) {
178
+	if ($country = give_get_meta($object_id, '_give_donor_billing_country', true)) {
183 179
 		$donor_data['address']['country'] = $country;
184 180
 	}
185 181
 
186
-	$meta_value['user_info'] = maybe_unserialize( $donor_data );
182
+	$meta_value['user_info'] = maybe_unserialize($donor_data);
187 183
 
188
-	Give_Cache::set_db_query( $cache_key, $meta_value );
184
+	Give_Cache::set_db_query($cache_key, $meta_value);
189 185
 
190 186
 	return $meta_value;
191 187
 }
@@ -209,37 +205,37 @@  discard block
 block discarded – undo
209 205
  *
210 206
  * @return mixed
211 207
  */
212
-function _give_20_bc_saving_old_payment_meta( $check, $object_id, $meta_key, $meta_value, $prev_value ) {
208
+function _give_20_bc_saving_old_payment_meta($check, $object_id, $meta_key, $meta_value, $prev_value) {
213 209
 	// Bailout.
214 210
 	if (
215
-		'give_payment' !== get_post_type( $object_id ) ||
216
-		! in_array( $meta_key, array(
211
+		'give_payment' !== get_post_type($object_id) ||
212
+		! in_array($meta_key, array(
217 213
 			'_give_payment_meta',
218 214
 			'_give_payment_user_email',
219 215
 			'_give_payment_customer_id',
220 216
 			'give_payment_user_ip',
221
-		) )
217
+		))
222 218
 	) {
223 219
 		return $check;
224 220
 	}
225 221
 
226
-	if ( '_give_payment_meta' === $meta_key ) {
227
-		_give_20_bc_split_and_save_give_payment_meta( $object_id, $meta_value );
228
-	} elseif ( '_give_payment_user_email' === $meta_key ) {
229
-		give_update_meta( $object_id, '_give_payment_donor_email', $meta_value );
222
+	if ('_give_payment_meta' === $meta_key) {
223
+		_give_20_bc_split_and_save_give_payment_meta($object_id, $meta_value);
224
+	} elseif ('_give_payment_user_email' === $meta_key) {
225
+		give_update_meta($object_id, '_give_payment_donor_email', $meta_value);
230 226
 		$check = true;
231
-	} elseif ( '_give_payment_customer_id' === $meta_key ) {
232
-		give_update_meta( $object_id, '_give_payment_donor_id', $meta_value );
227
+	} elseif ('_give_payment_customer_id' === $meta_key) {
228
+		give_update_meta($object_id, '_give_payment_donor_id', $meta_value);
233 229
 		$check = true;
234
-	} elseif ( 'give_payment_user_ip' === $meta_key ) {
235
-		give_update_meta( $object_id, '_give_payment_donor_ip', $meta_value );
230
+	} elseif ('give_payment_user_ip' === $meta_key) {
231
+		give_update_meta($object_id, '_give_payment_donor_ip', $meta_value);
236 232
 		$check = true;
237 233
 	}
238 234
 
239 235
 	return $check;
240 236
 }
241 237
 
242
-add_filter( 'update_post_metadata', '_give_20_bc_saving_old_payment_meta', 10, 5 );
238
+add_filter('update_post_metadata', '_give_20_bc_saving_old_payment_meta', 10, 5);
243 239
 
244 240
 
245 241
 /**
@@ -254,7 +250,7 @@  discard block
 block discarded – undo
254 250
  *
255 251
  * @return mixed
256 252
  */
257
-function _give_20_bc_get_old_payment_meta( $check, $object_id, $meta_key, $single ) {
253
+function _give_20_bc_get_old_payment_meta($check, $object_id, $meta_key, $single) {
258 254
 	global $wpdb;
259 255
 
260 256
 	// Deprecated meta keys.
@@ -265,32 +261,31 @@  discard block
 block discarded – undo
265 261
 	);
266 262
 
267 263
 	// Add _give_payment_meta to backward compatibility
268
-	if ( ! give_has_upgrade_completed( 'v20_upgrades_payment_metadata' ) ) {
264
+	if ( ! give_has_upgrade_completed('v20_upgrades_payment_metadata')) {
269 265
 		$old_meta_keys[] = '_give_payment_meta';
270 266
 	}
271 267
 
272 268
 	// Bailout.
273 269
 	if (
274
-		'give_payment' !== get_post_type( $object_id ) ||
275
-		! in_array( $meta_key, $old_meta_keys )
270
+		'give_payment' !== get_post_type($object_id) ||
271
+		! in_array($meta_key, $old_meta_keys)
276 272
 	) {
277 273
 		return $check;
278 274
 	}
279 275
 
280 276
 	$cache_key = "{$meta_key}_{$object_id}";
281
-	$check     = Give_Cache::get_db_query( $cache_key );
277
+	$check     = Give_Cache::get_db_query($cache_key);
282 278
 
283
-	if ( is_null( $check ) ) {
284
-		switch ( $meta_key ) {
279
+	if (is_null($check)) {
280
+		switch ($meta_key) {
285 281
 
286 282
 			// Handle old meta keys.
287 283
 			case '_give_payment_meta':
288
-				remove_filter( 'get_post_metadata', '_give_20_bc_get_old_payment_meta' );
284
+				remove_filter('get_post_metadata', '_give_20_bc_get_old_payment_meta');
289 285
 
290 286
 				// if ( $meta_value = give_get_meta( $object_id, '_give_payment_meta' ) ) {
291
-				$meta_value = ! empty( $meta_value ) ?
292
-					current( $meta_value ) :
293
-					(array) maybe_unserialize(
287
+				$meta_value = ! empty($meta_value) ?
288
+					current($meta_value) : (array) maybe_unserialize(
294 289
 						$wpdb->get_var(
295 290
 							$wpdb->prepare(
296 291
 								"
@@ -304,44 +299,44 @@  discard block
 block discarded – undo
304 299
 							)
305 300
 						)
306 301
 					);
307
-				$check      = _give_20_bc_give_payment_meta_value( $object_id, $meta_value );
302
+				$check = _give_20_bc_give_payment_meta_value($object_id, $meta_value);
308 303
 				// }
309 304
 
310
-				add_filter( 'get_post_metadata', '_give_20_bc_get_old_payment_meta', 10, 5 );
305
+				add_filter('get_post_metadata', '_give_20_bc_get_old_payment_meta', 10, 5);
311 306
 
312 307
 				break;
313 308
 
314 309
 			case '_give_payment_customer_id':
315
-				if ( $donor_id = give_get_meta( $object_id, '_give_payment_donor_id', $single ) ) {
310
+				if ($donor_id = give_get_meta($object_id, '_give_payment_donor_id', $single)) {
316 311
 					$check = $donor_id;
317 312
 				}
318 313
 				break;
319 314
 
320 315
 			case '_give_payment_user_email':
321
-				if ( $donor_email = give_get_meta( $object_id, '_give_payment_donor_email', $single ) ) {
316
+				if ($donor_email = give_get_meta($object_id, '_give_payment_donor_email', $single)) {
322 317
 					$check = $donor_email;
323 318
 				}
324 319
 				break;
325 320
 
326 321
 			case '_give_payment_user_ip':
327
-				if ( $donor_ip = give_get_meta( $object_id, '_give_payment_donor_ip', $single ) ) {
322
+				if ($donor_ip = give_get_meta($object_id, '_give_payment_donor_ip', $single)) {
328 323
 					$check = $donor_ip;
329 324
 				}
330 325
 				break;
331 326
 		}// End switch().
332 327
 
333
-		Give_Cache::set_db_query( $cache_key, $check );
328
+		Give_Cache::set_db_query($cache_key, $check);
334 329
 	}
335 330
 
336 331
 	// Put result in an array on zero index.
337
-	if ( ! is_null( $check ) ) {
338
-		$check = array( $check );
332
+	if ( ! is_null($check)) {
333
+		$check = array($check);
339 334
 	}
340 335
 
341 336
 	return $check;
342 337
 }
343 338
 
344
-add_filter( 'get_post_metadata', '_give_20_bc_get_old_payment_meta', 10, 5 );
339
+add_filter('get_post_metadata', '_give_20_bc_get_old_payment_meta', 10, 5);
345 340
 
346 341
 
347 342
 /**
@@ -356,9 +351,9 @@  discard block
 block discarded – undo
356 351
  *
357 352
  * @return mixed
358 353
  */
359
-function _give_20_bc_get_new_payment_meta( $check, $object_id, $meta_key, $single ) {
354
+function _give_20_bc_get_new_payment_meta($check, $object_id, $meta_key, $single) {
360 355
 	// Bailout: do not apply backward compatibility if upgrade done.
361
-	if ( give_has_upgrade_completed( 'v20_upgrades_payment_metadata' ) ) {
356
+	if (give_has_upgrade_completed('v20_upgrades_payment_metadata')) {
362 357
 		return $check;
363 358
 	}
364 359
 
@@ -380,26 +375,26 @@  discard block
 block discarded – undo
380 375
 	);
381 376
 
382 377
 	// metadata_exists fx will cause of firing get_post_metadata filter again so remove it to prevent infinite loop.
383
-	remove_filter( 'get_post_metadata', '_give_20_bc_get_new_payment_meta' );
378
+	remove_filter('get_post_metadata', '_give_20_bc_get_new_payment_meta');
384 379
 
385 380
 	// Bailout.
386 381
 	if (
387
-		'give_payment' !== get_post_type( $object_id ) ||
388
-		! in_array( $meta_key, $new_meta_keys ) ||
389
-		metadata_exists( 'post', $object_id, $meta_key )
382
+		'give_payment' !== get_post_type($object_id) ||
383
+		! in_array($meta_key, $new_meta_keys) ||
384
+		metadata_exists('post', $object_id, $meta_key)
390 385
 	) {
391
-		add_filter( 'get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5 );
386
+		add_filter('get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5);
392 387
 
393 388
 		return $check;
394 389
 	}
395 390
 
396
-	add_filter( 'get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5 );
391
+	add_filter('get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5);
397 392
 
398 393
 	$cache_key = "{$meta_key}_{$object_id}";
399
-	$check    = Give_Cache::get_db_query( $cache_key );
394
+	$check = Give_Cache::get_db_query($cache_key);
400 395
 
401
-	if ( is_null( $check ) ) {
402
-		switch ( $meta_key ) {
396
+	if (is_null($check)) {
397
+		switch ($meta_key) {
403 398
 
404 399
 			// Handle new meta keys.
405 400
 			case '_give_payment_donor_id':
@@ -442,9 +437,9 @@  discard block
 block discarded – undo
442 437
 			case '_give_donor_billing_country':
443 438
 			case '_give_payment_date':
444 439
 			case '_give_payment_currency':
445
-				$donation_meta = Give_Cache::get_db_query( "_give_payment_meta_{$object_id}" );
440
+				$donation_meta = Give_Cache::get_db_query("_give_payment_meta_{$object_id}");
446 441
 
447
-				if ( is_null( $donation_meta ) ) {
442
+				if (is_null($donation_meta)) {
448 443
 					$donation_meta = $wpdb->get_var(
449 444
 						$wpdb->prepare(
450 445
 							"SELECT meta_value FROM {$wpdb->postmeta} WHERE post_id=%d AND meta_key=%s",
@@ -452,51 +447,51 @@  discard block
 block discarded – undo
452 447
 							'_give_payment_meta'
453 448
 						)
454 449
 					);
455
-					$donation_meta = maybe_unserialize( $donation_meta );
456
-					$donation_meta = ! is_array( $donation_meta ) ? array() : $donation_meta;
457
-					Give_Cache::set_db_query( "_give_payment_meta_{$object_id}", $donation_meta );
450
+					$donation_meta = maybe_unserialize($donation_meta);
451
+					$donation_meta = ! is_array($donation_meta) ? array() : $donation_meta;
452
+					Give_Cache::set_db_query("_give_payment_meta_{$object_id}", $donation_meta);
458 453
 				}
459 454
 
460 455
 				// Get results.
461
-				if ( empty( $donation_meta ) ) {
456
+				if (empty($donation_meta)) {
462 457
 					$check = '';
463
-				} elseif ( in_array( $meta_key, array( '_give_payment_date', '_give_payment_currency' ) ) ) {
464
-					$payment_meta_key = str_replace( '_give_payment_', '', $meta_key );
458
+				} elseif (in_array($meta_key, array('_give_payment_date', '_give_payment_currency'))) {
459
+					$payment_meta_key = str_replace('_give_payment_', '', $meta_key);
465 460
 
466
-					if ( isset( $donation_meta[ $payment_meta_key ] ) ) {
467
-						$check = $donation_meta[ $payment_meta_key ];
461
+					if (isset($donation_meta[$payment_meta_key])) {
462
+						$check = $donation_meta[$payment_meta_key];
468 463
 					}
469 464
 				} else {
470
-					$payment_meta_key = str_replace( '_give_donor_billing_', '', $meta_key );
465
+					$payment_meta_key = str_replace('_give_donor_billing_', '', $meta_key);
471 466
 
472
-					switch ( $payment_meta_key ) {
467
+					switch ($payment_meta_key) {
473 468
 						case 'address1':
474
-							if ( isset( $donation_meta['user_info']['address']['line1'] ) ) {
469
+							if (isset($donation_meta['user_info']['address']['line1'])) {
475 470
 								$check = $donation_meta['user_info']['address']['line1'];
476 471
 							}
477 472
 							break;
478 473
 
479 474
 						case 'address2':
480
-							if ( isset( $donation_meta['user_info']['address']['line2'] ) ) {
475
+							if (isset($donation_meta['user_info']['address']['line2'])) {
481 476
 								$check = $donation_meta['user_info']['address']['line2'];
482 477
 							}
483 478
 							break;
484 479
 
485 480
 						case 'first_name':
486
-							if ( isset( $donation_meta['user_info']['first_name'] ) ) {
481
+							if (isset($donation_meta['user_info']['first_name'])) {
487 482
 								$check = $donation_meta['user_info']['first_name'];
488 483
 							}
489 484
 							break;
490 485
 
491 486
 						case 'last_name':
492
-							if ( isset( $donation_meta['user_info']['last_name'] ) ) {
487
+							if (isset($donation_meta['user_info']['last_name'])) {
493 488
 								$check = $donation_meta['user_info']['last_name'];
494 489
 							}
495 490
 							break;
496 491
 
497 492
 						default:
498
-							if ( isset( $donation_meta['user_info']['address'][ $payment_meta_key ] ) ) {
499
-								$check = $donation_meta['user_info']['address'][ $payment_meta_key ];
493
+							if (isset($donation_meta['user_info']['address'][$payment_meta_key])) {
494
+								$check = $donation_meta['user_info']['address'][$payment_meta_key];
500 495
 							}
501 496
 					}
502 497
 				}
@@ -505,19 +500,19 @@  discard block
 block discarded – undo
505 500
 		}// End switch().
506 501
 
507 502
 		// Set cache.
508
-		Give_Cache::set_db_query( $cache_key, $check );
503
+		Give_Cache::set_db_query($cache_key, $check);
509 504
 	}
510 505
 
511 506
 	// Put result in an array on zero index.
512
-	if ( ! $single ) {
513
-		$check = array( $check );
507
+	if ( ! $single) {
508
+		$check = array($check);
514 509
 	}
515 510
 
516 511
 
517 512
 	return $check;
518 513
 }
519 514
 
520
-add_filter( 'get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5 );
515
+add_filter('get_post_metadata', '_give_20_bc_get_new_payment_meta', 10, 5);
521 516
 
522 517
 
523 518
 /**
@@ -529,9 +524,9 @@  discard block
 block discarded – undo
529 524
  *
530 525
  * @return void
531 526
  */
532
-function _give_20_bc_support_deprecated_meta_key_query( $query ) {
527
+function _give_20_bc_support_deprecated_meta_key_query($query) {
533 528
 	// Bailout.
534
-	if ( give_has_upgrade_completed( 'v20_upgrades_payment_metadata' ) ) {
529
+	if (give_has_upgrade_completed('v20_upgrades_payment_metadata')) {
535 530
 		return;
536 531
 	}
537 532
 
@@ -541,21 +536,21 @@  discard block
 block discarded – undo
541 536
 		// '_give_payment_user_ip'     => '_give_payment_donor_ip',
542 537
 	);
543 538
 
544
-	$deprecated_meta_keys = array_flip( $new_meta_keys );
539
+	$deprecated_meta_keys = array_flip($new_meta_keys);
545 540
 
546 541
 	// Set meta keys.
547 542
 	$meta_keys = array();
548 543
 
549 544
 
550 545
 	// Bailout.
551
-	if ( ! empty( $query->query_vars['meta_key'] ) ) {
552
-		if ( in_array( $query->query_vars['meta_key'], $new_meta_keys ) ) {
546
+	if ( ! empty($query->query_vars['meta_key'])) {
547
+		if (in_array($query->query_vars['meta_key'], $new_meta_keys)) {
553 548
 			$meta_keys = $deprecated_meta_keys;
554
-		} elseif ( in_array( $query->query_vars['meta_key'], $deprecated_meta_keys ) ) {
549
+		} elseif (in_array($query->query_vars['meta_key'], $deprecated_meta_keys)) {
555 550
 			$meta_keys = $new_meta_keys;
556 551
 		}
557 552
 
558
-		if ( ! empty( $meta_keys ) ) {
553
+		if ( ! empty($meta_keys)) {
559 554
 			// Set meta_query
560 555
 			$query->set(
561 556
 				'meta_query',
@@ -566,35 +561,35 @@  discard block
 block discarded – undo
566 561
 						'value' => $query->query_vars['meta_value'],
567 562
 					),
568 563
 					array(
569
-						'key'   => $meta_keys[ $query->query_vars['meta_key'] ],
564
+						'key'   => $meta_keys[$query->query_vars['meta_key']],
570 565
 						'value' => $query->query_vars['meta_value'],
571 566
 					),
572 567
 				)
573 568
 			);
574 569
 
575 570
 			// Unset single meta query.
576
-			unset( $query->query_vars['meta_key'] );
577
-			unset( $query->query_vars['meta_value'] );
571
+			unset($query->query_vars['meta_key']);
572
+			unset($query->query_vars['meta_value']);
578 573
 		}
579 574
 	} elseif (
580
-		! empty( $query->query_vars['meta_query'] ) &&
581
-		( 1 === count( $query->query_vars['meta_query'] ) )
575
+		! empty($query->query_vars['meta_query']) &&
576
+		(1 === count($query->query_vars['meta_query']))
582 577
 	) {
583
-		$meta_query = current( $query->query_vars['meta_query'] );
578
+		$meta_query = current($query->query_vars['meta_query']);
584 579
 
585
-		if ( empty( $meta_query[0]['key'] ) ) {
580
+		if (empty($meta_query[0]['key'])) {
586 581
 			return;
587 582
 		}
588 583
 
589
-		if ( in_array( $meta_query[0]['key'], $new_meta_keys ) ) {
584
+		if (in_array($meta_query[0]['key'], $new_meta_keys)) {
590 585
 			$meta_keys = $deprecated_meta_keys;
591
-		} elseif ( in_array( $meta_query[0]['key'], $deprecated_meta_keys ) ) {
586
+		} elseif (in_array($meta_query[0]['key'], $deprecated_meta_keys)) {
592 587
 			$meta_keys = $new_meta_keys;
593 588
 		} else {
594 589
 			return;
595 590
 		}
596 591
 
597
-		if ( ! empty( $meta_keys ) ) {
592
+		if ( ! empty($meta_keys)) {
598 593
 			// Set meta_query
599 594
 			$query->set(
600 595
 				'meta_query',
@@ -605,7 +600,7 @@  discard block
 block discarded – undo
605 600
 						'value' => $query->query_vars['meta_query'][0]['value'],
606 601
 					),
607 602
 					array(
608
-						'key'   => $meta_keys[ $query->query_vars['meta_query'][0]['key'] ],
603
+						'key'   => $meta_keys[$query->query_vars['meta_query'][0]['key']],
609 604
 						'value' => $query->query_vars['meta_query'][0]['value'],
610 605
 					),
611 606
 				)
@@ -614,7 +609,7 @@  discard block
 block discarded – undo
614 609
 	}
615 610
 }
616 611
 
617
-add_action( 'pre_get_posts', '_give_20_bc_support_deprecated_meta_key_query' );
612
+add_action('pre_get_posts', '_give_20_bc_support_deprecated_meta_key_query');
618 613
 
619 614
 
620 615
 /**
@@ -627,49 +622,49 @@  discard block
 block discarded – undo
627 622
  * @param Give_Payment $payment
628 623
  * @param string       $key
629 624
  */
630
-function _give_20_bc_payment_save( $payment, $key ) {
625
+function _give_20_bc_payment_save($payment, $key) {
631 626
 	// Bailout.
632
-	if ( ! give_has_upgrade_completed( 'v20_upgrades_payment_metadata' ) ) {
627
+	if ( ! give_has_upgrade_completed('v20_upgrades_payment_metadata')) {
633 628
 		return;
634 629
 	}
635 630
 
636
-	switch ( $key ) {
631
+	switch ($key) {
637 632
 		case 'user_info':
638
-			if ( empty( $payment->user_info ) ) {
633
+			if (empty($payment->user_info)) {
639 634
 				// Bailout.
640 635
 				break;
641
-			} elseif ( is_string( $payment->user_info ) ) {
636
+			} elseif (is_string($payment->user_info)) {
642 637
 				// Check if value serialize.
643
-				$payment->user_info = maybe_unserialize( $payment->user_info );
638
+				$payment->user_info = maybe_unserialize($payment->user_info);
644 639
 			}
645 640
 
646 641
 
647 642
 			// Save first name.
648
-			if ( isset( $payment->user_info['first_name'] ) ) {
649
-				$payment->update_meta( '_give_donor_billing_first_name', $payment->user_info['first_name'] );
643
+			if (isset($payment->user_info['first_name'])) {
644
+				$payment->update_meta('_give_donor_billing_first_name', $payment->user_info['first_name']);
650 645
 			}
651 646
 
652 647
 
653 648
 			// Save last name.
654
-			if ( isset( $payment->user_info['last_name'] ) ) {
655
-				$payment->update_meta( '_give_donor_billing_last_name', $payment->user_info['last_name'] );
649
+			if (isset($payment->user_info['last_name'])) {
650
+				$payment->update_meta('_give_donor_billing_last_name', $payment->user_info['last_name']);
656 651
 			}
657 652
 
658 653
 
659 654
 			// Save address.
660
-			if ( ! empty( $payment->user_info['address'] ) ) {
661
-				foreach ( $payment->user_info['address'] as $address_name => $address ) {
662
-					switch ( $address_name ) {
655
+			if ( ! empty($payment->user_info['address'])) {
656
+				foreach ($payment->user_info['address'] as $address_name => $address) {
657
+					switch ($address_name) {
663 658
 						case 'line1':
664
-							$payment->update_meta( '_give_donor_billing_address1', $address );
659
+							$payment->update_meta('_give_donor_billing_address1', $address);
665 660
 							break;
666 661
 
667 662
 						case 'line2':
668
-							$payment->update_meta( '_give_donor_billing_address2', $address );
663
+							$payment->update_meta('_give_donor_billing_address2', $address);
669 664
 							break;
670 665
 
671 666
 						default:
672
-							$payment->update_meta( "_give_donor_billing_{$address_name}", $address );
667
+							$payment->update_meta("_give_donor_billing_{$address_name}", $address);
673 668
 					}
674 669
 				}
675 670
 			}
@@ -678,7 +673,7 @@  discard block
 block discarded – undo
678 673
 	}
679 674
 }
680 675
 
681
-add_action( 'give_payment_save', '_give_20_bc_payment_save', 10, 2 );
676
+add_action('give_payment_save', '_give_20_bc_payment_save', 10, 2);
682 677
 
683 678
 
684 679
 /**
@@ -691,16 +686,16 @@  discard block
 block discarded – undo
691 686
  *
692 687
  * @return mixed
693 688
  */
694
-function __give_20_bc_flush_cache( $check, $object_id ) {
689
+function __give_20_bc_flush_cache($check, $object_id) {
695 690
 	if (
696
-		! give_has_upgrade_completed( 'v20_move_metadata_into_new_table' ) &&
697
-		'give_payment' === get_post_type( $object_id )
691
+		! give_has_upgrade_completed('v20_move_metadata_into_new_table') &&
692
+		'give_payment' === get_post_type($object_id)
698 693
 	) {
699
-		Give_Cache::delete_group( $object_id, 'give-donations' );
694
+		Give_Cache::delete_group($object_id, 'give-donations');
700 695
 	}
701 696
 
702 697
 	return $check;
703 698
 }
704 699
 
705
-add_action( 'update_post_metadata', '__give_20_bc_flush_cache', 9999, 2 );
706
-add_action( 'add_post_metadata', '__give_20_bc_flush_cache', 9999, 2 );
700
+add_action('update_post_metadata', '__give_20_bc_flush_cache', 9999, 2);
701
+add_action('add_post_metadata', '__give_20_bc_flush_cache', 9999, 2);
Please login to merge, or discard this patch.
includes/payments/class-payments-query.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 * @since  1.0
108 108
 	 * @access public
109 109
 	 *
110
-	 * @param $query_var
110
+	 * @param string $query_var
111 111
 	 * @param $value
112 112
 	 */
113 113
 	public function __set( $query_var, $value ) {
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 * @since  1.0
125 125
 	 * @access public
126 126
 	 *
127
-	 * @param $query_var
127
+	 * @param string $query_var
128 128
 	 */
129 129
 	public function __unset( $query_var ) {
130 130
 		unset( $this->args[ $query_var ] );
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 	 * @param string   $order
469 469
 	 * @param WP_Query $query
470 470
 	 *
471
-	 * @return mixed
471
+	 * @return string
472 472
 	 */
473 473
 	public function custom_orderby( $order, $query ) {
474 474
 
Please login to merge, or discard this patch.
Spacing   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
 	 *
67 67
 	 * @param  $args array The array of arguments that can be passed in and used for setting up this payment query.
68 68
 	 */
69
-	public function __construct( $args = array() ) {
69
+	public function __construct($args = array()) {
70 70
 		$defaults = array(
71 71
 			'output'          => 'payments',
72
-			'post_type'       => array( 'give_payment' ),
72
+			'post_type'       => array('give_payment'),
73 73
 			'start_date'      => false,
74 74
 			'end_date'        => false,
75 75
 			'number'          => 20,
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 			'count'           => false,
97 97
 		);
98 98
 
99
-		$this->args = $this->_args = wp_parse_args( $args, $defaults );
99
+		$this->args = $this->_args = wp_parse_args($args, $defaults);
100 100
 
101 101
 		$this->init();
102 102
 	}
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
 	 * @param $query_var
111 111
 	 * @param $value
112 112
 	 */
113
-	public function __set( $query_var, $value ) {
114
-		if ( in_array( $query_var, array( 'meta_query', 'tax_query' ) ) ) {
115
-			$this->args[ $query_var ][] = $value;
113
+	public function __set($query_var, $value) {
114
+		if (in_array($query_var, array('meta_query', 'tax_query'))) {
115
+			$this->args[$query_var][] = $value;
116 116
 		} else {
117
-			$this->args[ $query_var ] = $value;
117
+			$this->args[$query_var] = $value;
118 118
 		}
119 119
 	}
120 120
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 *
127 127
 	 * @param $query_var
128 128
 	 */
129
-	public function __unset( $query_var ) {
130
-		unset( $this->args[ $query_var ] );
129
+	public function __unset($query_var) {
130
+		unset($this->args[$query_var]);
131 131
 	}
132 132
 
133 133
 	/**
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		$this->give_forms();
168 168
 		$this->gateway_filter();
169 169
 
170
-		add_filter( 'posts_orderby', array( $this, 'custom_orderby' ), 10, 2 );
170
+		add_filter('posts_orderby', array($this, 'custom_orderby'), 10, 2);
171 171
 
172 172
 		/**
173 173
 		 * Fires after setup filters.
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 		 *
177 177
 		 * @param Give_Payments_Query $this Payments query object.
178 178
 		 */
179
-		do_action( 'give_pre_get_payments', $this );
179
+		do_action('give_pre_get_payments', $this);
180 180
 	}
181 181
 
182 182
 	/**
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 * @access private
187 187
 	 */
188 188
 	private function unset_filters() {
189
-		remove_filter( 'posts_orderby', array( $this, 'custom_orderby' ) );
189
+		remove_filter('posts_orderby', array($this, 'custom_orderby'));
190 190
 
191 191
 		/**
192 192
 		 * Fires after retrieving payments.
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 		 *
196 196
 		 * @param Give_Payments_Query $this Payments query object.
197 197
 		 */
198
-		do_action( 'give_post_get_payments', $this );
198
+		do_action('give_post_get_payments', $this);
199 199
 	}
200 200
 
201 201
 
@@ -214,11 +214,11 @@  discard block
 block discarded – undo
214 214
 	public function get_payments() {
215 215
 		global $post;
216 216
 
217
-		$cache_key      = Give_Cache::get_key( 'give_payment_query', $this->args, false );
218
-		$this->payments = Give_Cache::get_db_query( $cache_key );
217
+		$cache_key      = Give_Cache::get_key('give_payment_query', $this->args, false);
218
+		$this->payments = Give_Cache::get_db_query($cache_key);
219 219
 
220 220
 		// Return cached result.
221
-		if ( ! is_null( $this->payments ) ) {
221
+		if ( ! is_null($this->payments)) {
222 222
 			return $this->payments;
223 223
 		}
224 224
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 		// Modify the query/query arguments before we retrieve payments.
227 227
 		$this->set_filters();
228 228
 
229
-		$query          = new WP_Query( $this->args );
229
+		$query          = new WP_Query($this->args);
230 230
 		$this->payments = array();
231 231
 
232 232
 		$custom_output = array(
@@ -234,32 +234,32 @@  discard block
 block discarded – undo
234 234
 			'give_payments',
235 235
 		);
236 236
 
237
-		if ( ! in_array( $this->args['output'], $custom_output ) ) {
237
+		if ( ! in_array($this->args['output'], $custom_output)) {
238 238
 			return $query->posts;
239 239
 		}
240 240
 
241
-		if ( $query->have_posts() ) {
241
+		if ($query->have_posts()) {
242 242
 			$previous_post = $post;
243 243
 
244
-			while ( $query->have_posts() ) {
244
+			while ($query->have_posts()) {
245 245
 				$query->the_post();
246 246
 
247 247
 				$payment_id = get_post()->ID;
248
-				$payment    = new Give_Payment( $payment_id );
248
+				$payment    = new Give_Payment($payment_id);
249 249
 
250
-				$this->payments[] = apply_filters( 'give_payment', $payment, $payment_id, $this );
250
+				$this->payments[] = apply_filters('give_payment', $payment, $payment_id, $this);
251 251
 			}
252 252
 
253 253
 			wp_reset_postdata();
254 254
 
255 255
 			// Prevent nest loop from producing unexpected results.
256
-			if( $previous_post instanceof WP_Post ) {
256
+			if ($previous_post instanceof WP_Post) {
257 257
 				$post = $previous_post;
258
-				setup_postdata( $post );
258
+				setup_postdata($post);
259 259
 			}
260 260
 		}
261 261
 
262
-		Give_Cache::set_db_query( $cache_key, $this->payments );
262
+		Give_Cache::set_db_query($cache_key, $this->payments);
263 263
 
264 264
 		// Remove query filters after we retrieve payments.
265 265
 		$this->unset_filters();
@@ -278,31 +278,31 @@  discard block
 block discarded – undo
278 278
 	public function get_payment_by_group() {
279 279
 		global $wpdb;
280 280
 
281
-		$allowed_groups = array( 'post_status' );
281
+		$allowed_groups = array('post_status');
282 282
 		$result         = array();
283 283
 
284 284
 
285
-		if ( in_array( $this->args['group_by'], $allowed_groups ) ) {
285
+		if (in_array($this->args['group_by'], $allowed_groups)) {
286 286
 			// Set only count in result.
287
-			if ( $this->args['count'] ) {
287
+			if ($this->args['count']) {
288 288
 
289 289
 				$this->set_filters();
290 290
 
291
-				$new_results = $wpdb->get_results( $this->get_sql(), ARRAY_N );
291
+				$new_results = $wpdb->get_results($this->get_sql(), ARRAY_N);
292 292
 
293 293
 				$this->unset_filters();
294 294
 
295
-				foreach ( $new_results as $results ) {
296
-					$result[ $results[0] ] = $results[1];
295
+				foreach ($new_results as $results) {
296
+					$result[$results[0]] = $results[1];
297 297
 				}
298 298
 
299
-				switch ( $this->args['group_by'] ) {
299
+				switch ($this->args['group_by']) {
300 300
 					case 'post_status':
301 301
 
302 302
 						/* @var Give_Payment $donation */
303
-						foreach ( give_get_payment_status_keys() as $status ) {
304
-							if ( ! isset( $result[ $status ] ) ) {
305
-								$result[ $status ] = 0;
303
+						foreach (give_get_payment_status_keys() as $status) {
304
+							if ( ! isset($result[$status])) {
305
+								$result[$status] = 0;
306 306
 							}
307 307
 						}
308 308
 
@@ -312,8 +312,8 @@  discard block
 block discarded – undo
312 312
 				$donations = $this->get_payments();
313 313
 
314 314
 				/* @var $donation Give_Payment */
315
-				foreach ( $donations as $donation ) {
316
-					$result[ $donation->{$this->args['group_by']} ][] = $donation;
315
+				foreach ($donations as $donation) {
316
+					$result[$donation->{$this->args['group_by']}][] = $donation;
317 317
 				}
318 318
 			}
319 319
 		}
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 		 *
325 325
 		 * @since 1.8.17
326 326
 		 */
327
-		return apply_filters( 'give_get_payment_by_group', $result, $this );
327
+		return apply_filters('give_get_payment_by_group', $result, $this);
328 328
 	}
329 329
 
330 330
 	/**
@@ -336,29 +336,29 @@  discard block
 block discarded – undo
336 336
 	 * @return void
337 337
 	 */
338 338
 	public function date_filter_pre() {
339
-		if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) {
339
+		if ( ! ($this->args['start_date'] || $this->args['end_date'])) {
340 340
 			return;
341 341
 		}
342 342
 
343
-		$this->setup_dates( $this->args['start_date'], $this->args['end_date'] );
344
-		$is_start_date = property_exists( __CLASS__, 'start_date' );
345
-		$is_end_date   = property_exists( __CLASS__, 'end_date' );
343
+		$this->setup_dates($this->args['start_date'], $this->args['end_date']);
344
+		$is_start_date = property_exists(__CLASS__, 'start_date');
345
+		$is_end_date   = property_exists(__CLASS__, 'end_date');
346 346
 
347
-		if ( $is_start_date || $is_end_date ) {
347
+		if ($is_start_date || $is_end_date) {
348 348
 			$date_query = array();
349 349
 
350
-			if ( $is_start_date && ! is_wp_error( $this->start_date ) ) {
351
-				$date_query['after'] = date( 'Y-m-d H:i:s', $this->start_date );
350
+			if ($is_start_date && ! is_wp_error($this->start_date)) {
351
+				$date_query['after'] = date('Y-m-d H:i:s', $this->start_date);
352 352
 			}
353 353
 
354
-			if ( $is_end_date && ! is_wp_error( $this->end_date ) ) {
355
-				$date_query['before'] = date( 'Y-m-d H:i:s', $this->end_date );
354
+			if ($is_end_date && ! is_wp_error($this->end_date)) {
355
+				$date_query['before'] = date('Y-m-d H:i:s', $this->end_date);
356 356
 			}
357 357
 
358 358
 			// Include Start Date and End Date while querying.
359 359
 			$date_query['inclusive'] = true;
360 360
 
361
-			$this->__set( 'date_query', $date_query );
361
+			$this->__set('date_query', $date_query);
362 362
 
363 363
 		}
364 364
 	}
@@ -372,12 +372,12 @@  discard block
 block discarded – undo
372 372
 	 * @return void
373 373
 	 */
374 374
 	public function status() {
375
-		if ( ! isset( $this->args['status'] ) ) {
375
+		if ( ! isset($this->args['status'])) {
376 376
 			return;
377 377
 		}
378 378
 
379
-		$this->__set( 'post_status', $this->args['status'] );
380
-		$this->__unset( 'status' );
379
+		$this->__set('post_status', $this->args['status']);
380
+		$this->__unset('status');
381 381
 	}
382 382
 
383 383
 	/**
@@ -389,12 +389,12 @@  discard block
 block discarded – undo
389 389
 	 * @return void
390 390
 	 */
391 391
 	public function page() {
392
-		if ( ! isset( $this->args['page'] ) ) {
392
+		if ( ! isset($this->args['page'])) {
393 393
 			return;
394 394
 		}
395 395
 
396
-		$this->__set( 'paged', $this->args['page'] );
397
-		$this->__unset( 'page' );
396
+		$this->__set('paged', $this->args['page']);
397
+		$this->__unset('page');
398 398
 	}
399 399
 
400 400
 	/**
@@ -407,17 +407,17 @@  discard block
 block discarded – undo
407 407
 	 */
408 408
 	public function per_page() {
409 409
 
410
-		if ( ! isset( $this->args['number'] ) ) {
410
+		if ( ! isset($this->args['number'])) {
411 411
 			return;
412 412
 		}
413 413
 
414
-		if ( $this->args['number'] == - 1 ) {
415
-			$this->__set( 'nopaging', true );
414
+		if ($this->args['number'] == - 1) {
415
+			$this->__set('nopaging', true);
416 416
 		} else {
417
-			$this->__set( 'posts_per_page', $this->args['number'] );
417
+			$this->__set('posts_per_page', $this->args['number']);
418 418
 		}
419 419
 
420
-		$this->__unset( 'number' );
420
+		$this->__unset('number');
421 421
 	}
422 422
 
423 423
 	/**
@@ -429,12 +429,12 @@  discard block
 block discarded – undo
429 429
 	 * @return void
430 430
 	 */
431 431
 	public function month() {
432
-		if ( ! isset( $this->args['month'] ) ) {
432
+		if ( ! isset($this->args['month'])) {
433 433
 			return;
434 434
 		}
435 435
 
436
-		$this->__set( 'monthnum', $this->args['month'] );
437
-		$this->__unset( 'month' );
436
+		$this->__set('monthnum', $this->args['month']);
437
+		$this->__unset('month');
438 438
 	}
439 439
 
440 440
 	/**
@@ -446,23 +446,23 @@  discard block
 block discarded – undo
446 446
 	 * @return void
447 447
 	 */
448 448
 	public function orderby() {
449
-		switch ( $this->args['orderby'] ) {
449
+		switch ($this->args['orderby']) {
450 450
 			case 'amount':
451
-				$this->__set( 'orderby', 'meta_value_num' );
452
-				$this->__set( 'meta_key', '_give_payment_total' );
451
+				$this->__set('orderby', 'meta_value_num');
452
+				$this->__set('meta_key', '_give_payment_total');
453 453
 				break;
454 454
 
455 455
 			case 'status':
456
-				$this->__set( 'orderby', 'post_status' );
456
+				$this->__set('orderby', 'post_status');
457 457
 				break;
458 458
 
459 459
 			case 'donation_form':
460
-				$this->__set( 'orderby', 'meta_value' );
461
-				$this->__set( 'meta_key', '_give_payment_form_title' );
460
+				$this->__set('orderby', 'meta_value');
461
+				$this->__set('meta_key', '_give_payment_form_title');
462 462
 				break;
463 463
 
464 464
 			default:
465
-				$this->__set( 'orderby', $this->args['orderby'] );
465
+				$this->__set('orderby', $this->args['orderby']);
466 466
 				break;
467 467
 		}
468 468
 	}
@@ -479,19 +479,19 @@  discard block
 block discarded – undo
479 479
 	 *
480 480
 	 * @return mixed
481 481
 	 */
482
-	public function custom_orderby( $order, $query ) {
482
+	public function custom_orderby($order, $query) {
483 483
 
484
-		if ( ! empty( $query->query['post_type'] ) ) {
485
-			$post_types = is_array( $query->query['post_type'] ) ? $query->query['post_type'] : array( $query->query['post_type'] );
484
+		if ( ! empty($query->query['post_type'])) {
485
+			$post_types = is_array($query->query['post_type']) ? $query->query['post_type'] : array($query->query['post_type']);
486 486
 
487
-			if ( ! in_array( 'give_payment', $post_types ) || ! isset( $query->query['orderby'] ) || is_array( $query->query['orderby'] ) ) {
487
+			if ( ! in_array('give_payment', $post_types) || ! isset($query->query['orderby']) || is_array($query->query['orderby'])) {
488 488
 				return $order;
489 489
 			}
490 490
 
491 491
 			global $wpdb;
492
-			switch ( $query->query['orderby'] ) {
492
+			switch ($query->query['orderby']) {
493 493
 				case 'post_status':
494
-					$order = $wpdb->posts . '.post_status ' . strtoupper( $query->query['order'] );
494
+					$order = $wpdb->posts.'.post_status '.strtoupper($query->query['order']);
495 495
 					break;
496 496
 			}
497 497
 		}
@@ -508,11 +508,11 @@  discard block
 block discarded – undo
508 508
 	 * @return void
509 509
 	 */
510 510
 	public function user() {
511
-		if ( is_null( $this->args['user'] ) ) {
511
+		if (is_null($this->args['user'])) {
512 512
 			return;
513 513
 		}
514 514
 
515
-		if ( is_numeric( $this->args['user'] ) ) {
515
+		if (is_numeric($this->args['user'])) {
516 516
 			$user_key = '_give_payment_donor_id';
517 517
 		} else {
518 518
 			$user_key = '_give_payment_donor_email';
@@ -534,16 +534,16 @@  discard block
 block discarded – undo
534 534
 	 * @return  void
535 535
 	 */
536 536
 	public function donor() {
537
-		if ( is_null( $this->args['donor'] ) || ! is_numeric( $this->args['donor'] ) ) {
537
+		if (is_null($this->args['donor']) || ! is_numeric($this->args['donor'])) {
538 538
 			return;
539 539
 		}
540 540
 
541 541
 		$donor_meta_type = Give()->donor_meta->meta_type;
542 542
 
543
-		$this->__set( 'meta_query', array(
543
+		$this->__set('meta_query', array(
544 544
 			'key'   => "_give_payment_{$donor_meta_type}_id",
545 545
 			'value' => (int) $this->args['donor'],
546
-		) );
546
+		));
547 547
 	}
548 548
 
549 549
 	/**
@@ -556,33 +556,33 @@  discard block
 block discarded – undo
556 556
 	 */
557 557
 	public function search() {
558 558
 
559
-		if ( ! isset( $this->args['s'] ) ) {
559
+		if ( ! isset($this->args['s'])) {
560 560
 			return;
561 561
 		}
562 562
 
563
-		$search = trim( $this->args['s'] );
563
+		$search = trim($this->args['s']);
564 564
 
565
-		if ( empty( $search ) ) {
565
+		if (empty($search)) {
566 566
 			return;
567 567
 		}
568 568
 
569
-		$is_email = is_email( $search ) || strpos( $search, '@' ) !== false;
570
-		$is_user  = strpos( $search, strtolower( 'user:' ) ) !== false;
569
+		$is_email = is_email($search) || strpos($search, '@') !== false;
570
+		$is_user  = strpos($search, strtolower('user:')) !== false;
571 571
 
572
-		if ( ! empty( $this->args['search_in_notes'] ) ) {
572
+		if ( ! empty($this->args['search_in_notes'])) {
573 573
 
574
-			$notes = give_get_payment_notes( 0, $search );
574
+			$notes = give_get_payment_notes(0, $search);
575 575
 
576
-			if ( ! empty( $notes ) ) {
576
+			if ( ! empty($notes)) {
577 577
 
578
-				$payment_ids = wp_list_pluck( (array) $notes, 'comment_post_ID' );
578
+				$payment_ids = wp_list_pluck((array) $notes, 'comment_post_ID');
579 579
 
580
-				$this->__set( 'post__in', $payment_ids );
580
+				$this->__set('post__in', $payment_ids);
581 581
 			}
582 582
 
583
-			$this->__unset( 's' );
583
+			$this->__unset('s');
584 584
 
585
-		} elseif ( $is_email || strlen( $search ) == 32 ) {
585
+		} elseif ($is_email || strlen($search) == 32) {
586 586
 
587 587
 			$key         = $is_email ? '_give_payment_donor_email' : '_give_payment_purchase_key';
588 588
 			$search_meta = array(
@@ -591,40 +591,40 @@  discard block
 block discarded – undo
591 591
 				'compare' => 'LIKE',
592 592
 			);
593 593
 
594
-			$this->__set( 'meta_query', $search_meta );
595
-			$this->__unset( 's' );
594
+			$this->__set('meta_query', $search_meta);
595
+			$this->__unset('s');
596 596
 
597
-		} elseif ( $is_user ) {
597
+		} elseif ($is_user) {
598 598
 
599 599
 			$search_meta = array(
600 600
 				'key'   => '_give_payment_donor_id',
601
-				'value' => trim( str_replace( 'user:', '', strtolower( $search ) ) ),
601
+				'value' => trim(str_replace('user:', '', strtolower($search))),
602 602
 			);
603 603
 
604
-			$this->__set( 'meta_query', $search_meta );
604
+			$this->__set('meta_query', $search_meta);
605 605
 
606
-			$this->__unset( 's' );
606
+			$this->__unset('s');
607 607
 
608
-		} elseif ( is_numeric( $search ) ) {
608
+		} elseif (is_numeric($search)) {
609 609
 
610
-			$post = get_post( $search );
610
+			$post = get_post($search);
611 611
 
612
-			if ( is_object( $post ) && $post->post_type == 'give_payment' ) {
612
+			if (is_object($post) && $post->post_type == 'give_payment') {
613 613
 
614 614
 				$arr   = array();
615 615
 				$arr[] = $search;
616
-				$this->__set( 'post__in', $arr );
617
-				$this->__unset( 's' );
616
+				$this->__set('post__in', $arr);
617
+				$this->__unset('s');
618 618
 			}
619
-		} elseif ( '#' == substr( $search, 0, 1 ) ) {
619
+		} elseif ('#' == substr($search, 0, 1)) {
620 620
 
621
-			$search = str_replace( '#:', '', $search );
622
-			$search = str_replace( '#', '', $search );
623
-			$this->__set( 'give_forms', $search );
624
-			$this->__unset( 's' );
621
+			$search = str_replace('#:', '', $search);
622
+			$search = str_replace('#', '', $search);
623
+			$this->__set('give_forms', $search);
624
+			$this->__unset('s');
625 625
 
626 626
 		} else {
627
-			$this->__set( 's', $search );
627
+			$this->__set('s', $search);
628 628
 
629 629
 		}
630 630
 
@@ -639,8 +639,8 @@  discard block
 block discarded – undo
639 639
 	 * @return void
640 640
 	 */
641 641
 	public function mode() {
642
-		if ( empty( $this->args['mode'] ) || $this->args['mode'] == 'all' ) {
643
-			$this->__unset( 'mode' );
642
+		if (empty($this->args['mode']) || $this->args['mode'] == 'all') {
643
+			$this->__unset('mode');
644 644
 
645 645
 			return;
646 646
 		}
@@ -662,10 +662,10 @@  discard block
 block discarded – undo
662 662
 	 * @return void
663 663
 	 */
664 664
 	public function children() {
665
-		if ( empty( $this->args['children'] ) ) {
666
-			$this->__set( 'post_parent', 0 );
665
+		if (empty($this->args['children'])) {
666
+			$this->__set('post_parent', 0);
667 667
 		}
668
-		$this->__unset( 'children' );
668
+		$this->__unset('children');
669 669
 	}
670 670
 
671 671
 	/**
@@ -678,13 +678,13 @@  discard block
 block discarded – undo
678 678
 	 */
679 679
 	public function give_forms() {
680 680
 
681
-		if ( empty( $this->args['give_forms'] ) ) {
681
+		if (empty($this->args['give_forms'])) {
682 682
 			return;
683 683
 		}
684 684
 
685 685
 		$compare = '=';
686 686
 
687
-		if ( is_array( $this->args['give_forms'] ) ) {
687
+		if (is_array($this->args['give_forms'])) {
688 688
 			$compare = 'IN';
689 689
 		}
690 690
 
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 			)
698 698
 		);
699 699
 
700
-		$this->__unset( 'give_forms' );
700
+		$this->__unset('give_forms');
701 701
 
702 702
 	}
703 703
 
@@ -711,13 +711,13 @@  discard block
 block discarded – undo
711 711
 	 */
712 712
 	public function gateway_filter() {
713 713
 
714
-		if ( empty( $this->args['gateway'] ) ) {
714
+		if (empty($this->args['gateway'])) {
715 715
 			return;
716 716
 		}
717 717
 
718 718
 		$compare = '=';
719 719
 
720
-		if ( is_array( $this->args['gateway'] ) ) {
720
+		if (is_array($this->args['gateway'])) {
721 721
 			$compare = 'IN';
722 722
 		}
723 723
 
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
 			)
732 732
 		);
733 733
 
734
-		$this->__unset( 'gateway' );
734
+		$this->__unset('gateway');
735 735
 
736 736
 	}
737 737
 
@@ -751,9 +751,9 @@  discard block
 block discarded – undo
751 751
 		global $wpdb;
752 752
 
753 753
 		$where = "WHERE {$wpdb->posts}.post_type = 'give_payment'";
754
-		$where .= " AND {$wpdb->posts}.post_status IN ('" . implode( "','", $this->args['post_status'] ) . "')";
754
+		$where .= " AND {$wpdb->posts}.post_status IN ('".implode("','", $this->args['post_status'])."')";
755 755
 
756
-		if( is_numeric( $this->args['post_parent'] ) ) {
756
+		if (is_numeric($this->args['post_parent'])) {
757 757
 			$where .= " AND {$wpdb->posts}.post_parent={$this->args['post_parent']}";
758 758
 		}
759 759
 
@@ -762,42 +762,42 @@  discard block
 block discarded – undo
762 762
 		$group_by = '';
763 763
 
764 764
 		// Set group by.
765
-		if ( ! empty( $this->args['group_by'] ) ) {
765
+		if ( ! empty($this->args['group_by'])) {
766 766
 			$group_by = "GROUP BY {$wpdb->posts}.{$this->args['group_by']}";
767 767
 		}
768 768
 
769 769
 		// Set offset.
770 770
 		if (
771
-			empty( $this->args['nopaging'] ) &&
772
-			empty( $this->args['offset'] ) &&
773
-			( ! empty( $this->args['page'] ) && 0 < $this->args['page'] )
771
+			empty($this->args['nopaging']) &&
772
+			empty($this->args['offset']) &&
773
+			( ! empty($this->args['page']) && 0 < $this->args['page'])
774 774
 		) {
775
-			$this->args['offset'] = $this->args['posts_per_page'] * ( $this->args['page'] - 1 );
775
+			$this->args['offset'] = $this->args['posts_per_page'] * ($this->args['page'] - 1);
776 776
 		}
777 777
 
778 778
 		// Set fields.
779 779
 		$fields = "{$wpdb->posts}.*";
780
-		if ( ! empty( $this->args['fields'] ) && 'all' !== $this->args['fields'] ) {
781
-			if ( is_string( $this->args['fields'] ) ) {
780
+		if ( ! empty($this->args['fields']) && 'all' !== $this->args['fields']) {
781
+			if (is_string($this->args['fields'])) {
782 782
 				$fields = "{$wpdb->posts}.{$this->args['fields']}";
783
-			} elseif ( is_array( $this->args['fields'] ) ) {
784
-				$fields = "{$wpdb->posts}." . implode( " , {$wpdb->posts}.", $this->args['fields'] );
783
+			} elseif (is_array($this->args['fields'])) {
784
+				$fields = "{$wpdb->posts}.".implode(" , {$wpdb->posts}.", $this->args['fields']);
785 785
 			}
786 786
 		}
787 787
 
788 788
 		// Set count.
789
-		if ( ! empty( $this->args['count'] ) ) {
789
+		if ( ! empty($this->args['count'])) {
790 790
 			$fields = "COUNT({$wpdb->posts}.ID)";
791 791
 
792
-			if ( ! empty( $this->args['group_by'] ) ) {
792
+			if ( ! empty($this->args['group_by'])) {
793 793
 				$fields = "{$wpdb->posts}.{$this->args['group_by']}, {$fields}";
794 794
 			}
795 795
 		}
796 796
 
797 797
 		// Date query.
798
-		if ( ! empty( $this->args['date_query'] ) ) {
799
-			$date_query_obj = new WP_Date_Query( $this->args['date_query'] );
800
-			$where          .= str_replace(
798
+		if ( ! empty($this->args['date_query'])) {
799
+			$date_query_obj = new WP_Date_Query($this->args['date_query']);
800
+			$where .= str_replace(
801 801
 				array(
802 802
 					"\n",
803 803
 					'(   (',
@@ -813,22 +813,22 @@  discard block
 block discarded – undo
813 813
 		}
814 814
 
815 815
 		// Meta query.
816
-		if ( ! empty( $this->args['meta_query'] ) ) {
817
-			$meta_query_obj = new WP_Meta_Query( $this->args['meta_query'] );
818
-			$where          = implode( ' ', $meta_query_obj->get_sql( 'post', $wpdb->posts, 'ID' ) ) . " {$where}";
819
-			$where          = Give()->payment_meta->__rename_meta_table_name( $where, 'posts_where' );
816
+		if ( ! empty($this->args['meta_query'])) {
817
+			$meta_query_obj = new WP_Meta_Query($this->args['meta_query']);
818
+			$where          = implode(' ', $meta_query_obj->get_sql('post', $wpdb->posts, 'ID'))." {$where}";
819
+			$where          = Give()->payment_meta->__rename_meta_table_name($where, 'posts_where');
820 820
 		}
821 821
 
822 822
 		// Set sql query.
823 823
 		$sql = $wpdb->prepare(
824 824
 			"SELECT {$fields} FROM {$wpdb->posts} LIMIT %d,%d;",
825
-			absint( $this->args['offset'] ),
826
-			( empty( $this->args['nopaging'] ) ? absint( $this->args['posts_per_page'] ) : 99999999999 )
825
+			absint($this->args['offset']),
826
+			(empty($this->args['nopaging']) ? absint($this->args['posts_per_page']) : 99999999999)
827 827
 		);
828 828
 
829 829
 		// $where, $orderby and order already prepared query they can generate notice if you re prepare them in above.
830 830
 		// WordPress consider LIKE condition as placeholder if start with s,f, or d.
831
-		$sql = str_replace( 'LIMIT', "{$where} {$group_by} {$orderby} {$this->args['order']} LIMIT", $sql );
831
+		$sql = str_replace('LIMIT', "{$where} {$group_by} {$orderby} {$this->args['order']} LIMIT", $sql);
832 832
 
833 833
 		return $sql;
834 834
 	}
Please login to merge, or discard this patch.
includes/admin/tools/logs/class-gateway-error-logs-list-table.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly.
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
16 16
 // Load WP_List_Table if not loaded.
17
-if ( ! class_exists( 'WP_List_Table' ) ) {
18
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
17
+if ( ! class_exists('WP_List_Table')) {
18
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
19 19
 }
20 20
 
21 21
 /**
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public function __construct() {
46 46
 		// Set parent defaults.
47
-		parent::__construct( array(
48
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records.
49
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records.
50
-			'ajax'     => false,// Does this table support ajax?.
51
-		) );
47
+		parent::__construct(array(
48
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records.
49
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records.
50
+			'ajax'     => false, // Does this table support ajax?.
51
+		));
52 52
 	}
53 53
 
54 54
 	/**
@@ -62,19 +62,19 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @return string Column Name.
64 64
 	 */
65
-	public function column_default( $item, $column_name ) {
65
+	public function column_default($item, $column_name) {
66 66
 
67
-		switch ( $column_name ) {
67
+		switch ($column_name) {
68 68
 			case 'ID' :
69 69
 				return $item['ID_label'];
70 70
 			case 'payment_id' :
71
-				return empty( $item['payment_id'] ) ? esc_html__( 'n/a', 'give' ) : sprintf( "<a href=\"%s\" target=\"_blank\">{$item['payment_id']}</a>", get_edit_post_link( $item['payment_id'] ) );
71
+				return empty($item['payment_id']) ? esc_html__('n/a', 'give') : sprintf("<a href=\"%s\" target=\"_blank\">{$item['payment_id']}</a>", get_edit_post_link($item['payment_id']));
72 72
 			case 'gateway' :
73
-				return empty( $item['gateway'] ) ? esc_html__( 'n/a', 'give' ) : $item['gateway'];
73
+				return empty($item['gateway']) ? esc_html__('n/a', 'give') : $item['gateway'];
74 74
 			case 'error' :
75
-				return esc_html( $item['log_title'] );
75
+				return esc_html($item['log_title']);
76 76
 			default:
77
-				return $item[ $column_name ];
77
+				return $item[$column_name];
78 78
 		}
79 79
 	}
80 80
 
@@ -88,35 +88,35 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @return void
90 90
 	 */
91
-	public function column_message( $item ) {
91
+	public function column_message($item) {
92 92
 		?>
93 93
 		<?php
94
-		echo Give()->tooltips->render_link( array(
95
-			'label'       => __( 'View Log Message', 'give' ),
94
+		echo Give()->tooltips->render_link(array(
95
+			'label'       => __('View Log Message', 'give'),
96 96
 			'tag_content' => '<span class="dashicons dashicons-visibility"></span>',
97 97
 			'link'        => "#TB_inline?width=640&amp;inlineId=log-message-{$item['ID']}",
98 98
 			'attributes'  => array(
99 99
 				'class' => 'thickbox give-error-log-details-link button button-small',
100 100
 			),
101
-		) );
101
+		));
102 102
 		?>
103 103
 		<div id="log-message-<?php echo $item['ID']; ?>" style="display:none;">
104 104
 			<?php
105 105
 
106
-			$serialized = strpos( $item['log_content'], '{"' );
106
+			$serialized = strpos($item['log_content'], '{"');
107 107
 
108 108
 			// Check to see if the log message contains serialized information
109
-			if ( $serialized !== false ) {
110
-				$length = strlen( $item['log_content'] ) - $serialized;
111
-				$intro  = substr( $item['log_content'], 0, - $length );
112
-				$data   = substr( $item['log_content'], $serialized, strlen( $item['log_content'] ) - 1 );
109
+			if ($serialized !== false) {
110
+				$length = strlen($item['log_content']) - $serialized;
111
+				$intro  = substr($item['log_content'], 0, - $length);
112
+				$data   = substr($item['log_content'], $serialized, strlen($item['log_content']) - 1);
113 113
 
114
-				echo wpautop( $intro );
115
-				echo wpautop( '<strong>' . esc_html__( 'Log data:', 'give' ) . '</strong>' );
116
-				echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>';
114
+				echo wpautop($intro);
115
+				echo wpautop('<strong>'.esc_html__('Log data:', 'give').'</strong>');
116
+				echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>';
117 117
 			} else {
118 118
 				// No serialized data found
119
-				echo wpautop( $item['log_content'] );
119
+				echo wpautop($item['log_content']);
120 120
 			}
121 121
 			?>
122 122
 		</div>
@@ -132,12 +132,12 @@  discard block
 block discarded – undo
132 132
 	 */
133 133
 	public function get_columns() {
134 134
 		$columns = array(
135
-			'ID'         => esc_html__( 'Log ID', 'give' ),
136
-			'error'      => esc_html__( 'Error', 'give' ),
137
-			'gateway'    => esc_html__( 'Gateway', 'give' ),
138
-			'payment_id' => esc_html__( 'Donation ID', 'give' ),
139
-			'date'       => esc_html__( 'Date', 'give' ),
140
-			'message'    => esc_html__( 'Details', 'give' ),
135
+			'ID'         => esc_html__('Log ID', 'give'),
136
+			'error'      => esc_html__('Error', 'give'),
137
+			'gateway'    => esc_html__('Gateway', 'give'),
138
+			'payment_id' => esc_html__('Donation ID', 'give'),
139
+			'date'       => esc_html__('Date', 'give'),
140
+			'message'    => esc_html__('Details', 'give'),
141 141
 		);
142 142
 
143 143
 		return $columns;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 * @return int Current page number
152 152
 	 */
153 153
 	public function get_paged() {
154
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
154
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
155 155
 	}
156 156
 
157 157
 	/**
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	 * @since  1.0
162 162
 	 * @return void
163 163
 	 */
164
-	public function bulk_actions( $which = '' ) {
164
+	public function bulk_actions($which = '') {
165 165
 		give_log_views();
166 166
 	}
167 167
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	public function get_logs() {
177 177
 		// Prevent the queries from getting cached.
178 178
 		// Without this there are occasional memory issues for some installs.
179
-		wp_suspend_cache_addition( true );
179
+		wp_suspend_cache_addition(true);
180 180
 
181 181
 		$logs_data = array();
182 182
 		$paged     = $this->get_paged();
@@ -186,17 +186,17 @@  discard block
 block discarded – undo
186 186
 			'posts_per_page' => $this->per_page,
187 187
 		);
188 188
 
189
-		$logs = Give()->logs->get_connected_logs( $log_query );
189
+		$logs = Give()->logs->get_connected_logs($log_query);
190 190
 
191
-		if ( $logs ) {
192
-			foreach ( $logs as $log ) {
191
+		if ($logs) {
192
+			foreach ($logs as $log) {
193 193
 
194 194
 				$logs_data[] = array(
195 195
 					'ID'          => $log->ID,
196
-					'ID_label'    => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>',
196
+					'ID_label'    => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>',
197 197
 					'payment_id'  => $log->log_parent,
198 198
 					'error'       => 'error',
199
-					'gateway'     => give_get_payment_gateway( $log->log_parent ),
199
+					'gateway'     => give_get_payment_gateway($log->log_parent),
200 200
 					'date'        => $log->log_date,
201 201
 					'log_content' => $log->log_content,
202 202
 					'log_title'   => $log->log_title,
@@ -220,19 +220,19 @@  discard block
 block discarded – undo
220 220
 	 *
221 221
 	 * @param string $which
222 222
 	 */
223
-	protected function display_tablenav( $which ) {
224
-		if ( 'top' === $which ) {
225
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
223
+	protected function display_tablenav($which) {
224
+		if ('top' === $which) {
225
+			wp_nonce_field('bulk-'.$this->_args['plural']);
226 226
 		}
227 227
 		?>
228
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
228
+		<div class="tablenav <?php echo esc_attr($which); ?>">
229 229
 
230 230
 			<div class="alignleft actions bulkactions">
231
-				<?php $this->bulk_actions( $which ); ?>
231
+				<?php $this->bulk_actions($which); ?>
232 232
 			</div>
233 233
 			<?php
234
-			$this->extra_tablenav( $which );
235
-			$this->pagination( $which );
234
+			$this->extra_tablenav($which);
235
+			$this->pagination($which);
236 236
 			?>
237 237
 
238 238
 			<br class="clear"/>
@@ -258,14 +258,14 @@  discard block
 block discarded – undo
258 258
 		$columns               = $this->get_columns();
259 259
 		$hidden                = array(); // No hidden columns
260 260
 		$sortable              = $this->get_sortable_columns();
261
-		$this->_column_headers = array( $columns, $hidden, $sortable );
261
+		$this->_column_headers = array($columns, $hidden, $sortable);
262 262
 		$this->items           = $this->get_logs();
263
-		$total_items           = Give()->logs->get_log_count( 0, 'gateway_error' );
263
+		$total_items           = Give()->logs->get_log_count(0, 'gateway_error');
264 264
 
265
-		$this->set_pagination_args( array(
265
+		$this->set_pagination_args(array(
266 266
 				'total_items' => $total_items,
267 267
 				'per_page'    => $this->per_page,
268
-				'total_pages' => ceil( $total_items / $this->per_page ),
268
+				'total_pages' => ceil($total_items / $this->per_page),
269 269
 			)
270 270
 		);
271 271
 	}
Please login to merge, or discard this patch.
includes/admin/emails/class-new-offline-donation-email.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if access directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
19
-if ( ! class_exists( 'Give_New_Offline_Donation_Email' ) ) :
19
+if ( ! class_exists('Give_New_Offline_Donation_Email')) :
20 20
 
21 21
 	/**
22 22
 	 * Give_New_Offline_Donation_Email
@@ -36,32 +36,32 @@  discard block
 block discarded – undo
36 36
 		 */
37 37
 		public function init() {
38 38
 			// Initialize empty payment.
39
-			$this->payment = new Give_Payment( 0 );
39
+			$this->payment = new Give_Payment(0);
40 40
 
41
-			$this->load( array(
41
+			$this->load(array(
42 42
 				'id'                           => 'new-offline-donation',
43
-				'label'                        => __( 'New Offline Donation', 'give' ),
44
-				'description'                  => __( 'Sent to designated recipient(s) for a new (pending) offline donation.', 'give' ),
43
+				'label'                        => __('New Offline Donation', 'give'),
44
+				'description'                  => __('Sent to designated recipient(s) for a new (pending) offline donation.', 'give'),
45 45
 				'has_recipient_field'          => true,
46
-				'notification_status'          => give_is_gateway_active( 'offline' ) ? 'enabled' : 'disabled',
46
+				'notification_status'          => give_is_gateway_active('offline') ? 'enabled' : 'disabled',
47 47
 				'notification_status_editable' => false,
48 48
 				'preview_email_tags_values'    => array(
49
-					'payment_method' => esc_html__( 'Offline', 'give' ),
49
+					'payment_method' => esc_html__('Offline', 'give'),
50 50
 				),
51 51
 				'default_email_subject'        => $this->get_default_email_subject(),
52 52
 				'default_email_message'        => $this->get_default_email_message(),
53 53
 				'notices' => array(
54 54
 					'non-notification-status-editable' => sprintf(
55 55
 						'%1$s <a href="%2$s">%3$s &raquo;</a>',
56
-						__( 'This notification is automatically toggled based on whether the gateway is enabled or not.', 'give' ),
57
-						esc_url( admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=offline-donations') ),
58
-						__( 'Edit Setting', 'give' )
56
+						__('This notification is automatically toggled based on whether the gateway is enabled or not.', 'give'),
57
+						esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=offline-donations')),
58
+						__('Edit Setting', 'give')
59 59
 					)
60 60
 				),
61
-			) );
61
+			));
62 62
 
63
-			add_action( 'give_insert_payment', array( $this, 'setup_email_notification' ) );
64
-			add_action( 'give_save_settings_give_settings', array( $this, 'set_notification_status' ), 10, 2 );
63
+			add_action('give_insert_payment', array($this, 'setup_email_notification'));
64
+			add_action('give_save_settings_give_settings', array($this, 'set_notification_status'), 10, 2);
65 65
 		}
66 66
 
67 67
 		/**
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 			 */
81 81
 			$subject = apply_filters(
82 82
 				'give_offline_admin_donation_notification_subject',
83
-				__( 'New Pending Donation', 'give' )
83
+				__('New Pending Donation', 'give')
84 84
 			);
85 85
 
86 86
 			/**
@@ -105,18 +105,18 @@  discard block
 block discarded – undo
105 105
 		 * @return string
106 106
 		 */
107 107
 		public function get_default_email_message() {
108
-			$message = __( 'Dear Admin,', 'give' ) . "\n\n";
109
-			$message .= __( 'An offline donation has been made on your website:', 'give' ) . ' ' . get_bloginfo( 'name' ) . ' ';
110
-			$message .= __( 'Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n";
108
+			$message = __('Dear Admin,', 'give')."\n\n";
109
+			$message .= __('An offline donation has been made on your website:', 'give').' '.get_bloginfo('name').' ';
110
+			$message .= __('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n";
111 111
 
112
-			$message .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n";
113
-			$message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n";
112
+			$message .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n";
113
+			$message .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n\n";
114 114
 
115 115
 			$message .= sprintf(
116 116
 				'<a href="%1$s">%2$s</a>',
117
-				admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $this->payment->ID ),
118
-				__( 'Click Here to View and/or Update Donation Details', 'give' )
119
-			) . "\n\n";
117
+				admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$this->payment->ID),
118
+				__('Click Here to View and/or Update Donation Details', 'give')
119
+			)."\n\n";
120 120
 
121 121
 			/**
122 122
 			 * Filter the donation receipt email message
@@ -154,10 +154,10 @@  discard block
 block discarded – undo
154 154
 		 *
155 155
 		 * @return string
156 156
 		 */
157
-		public function get_email_message( $form_id = null ) {
157
+		public function get_email_message($form_id = null) {
158 158
 			$message = Give_Email_Notification_Util::get_value(
159 159
 				$this,
160
-				Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message',
160
+				Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message',
161 161
 				$form_id,
162 162
 				$this->config['default_email_message']
163 163
 			);
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 		 *
198 198
 		 * @return array
199 199
 		 */
200
-		public function get_email_attachments( $form_id = null ) {
200
+		public function get_email_attachments($form_id = null) {
201 201
 			/**
202 202
 			 * Filter the attachments.
203 203
 			 * Note: This filter will deprecate soon.
@@ -248,11 +248,11 @@  discard block
 block discarded – undo
248 248
 		 *
249 249
 		 * @param int $payment_id
250 250
 		 */
251
-		public function setup_email_notification( $payment_id ) {
252
-			$this->payment = new Give_Payment( $payment_id );
251
+		public function setup_email_notification($payment_id) {
252
+			$this->payment = new Give_Payment($payment_id);
253 253
 
254 254
 			// Exit if not donation was not with offline donation.
255
-			if ( 'offline' !== $this->payment->gateway ) {
255
+			if ('offline' !== $this->payment->gateway) {
256 256
 				return;
257 257
 			}
258 258
 
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
 			$this->setup_email_data();
261 261
 
262 262
 			// Send email.
263
-			$this->send_email_notification( array(
263
+			$this->send_email_notification(array(
264 264
 				'payment_id' => $this->payment->ID,
265
-			) );
265
+			));
266 266
 		}
267 267
 
268 268
 		/**
@@ -274,18 +274,18 @@  discard block
 block discarded – undo
274 274
 		 * @param $update_options
275 275
 		 * @param $option_name
276 276
 		 */
277
-		public function set_notification_status( $update_options, $option_name ) {
277
+		public function set_notification_status($update_options, $option_name) {
278 278
 			// Get updated settings.
279 279
 			$update_options = give_get_settings();
280 280
 
281
-			$notification_status = isset( $update_options['gateways']['offline'] ) ? 'enabled' : 'disabled';
281
+			$notification_status = isset($update_options['gateways']['offline']) ? 'enabled' : 'disabled';
282 282
 
283 283
 			if (
284
-				empty( $update_options[ "{$this->config['id']}_notification" ] )
285
-				|| $notification_status !== $update_options[ "{$this->config['id']}_notification" ]
284
+				empty($update_options["{$this->config['id']}_notification"])
285
+				|| $notification_status !== $update_options["{$this->config['id']}_notification"]
286 286
 			) {
287
-				$update_options[ "{$this->config['id']}_notification" ] = $notification_status;
288
-				update_option( $option_name, $update_options );
287
+				$update_options["{$this->config['id']}_notification"] = $notification_status;
288
+				update_option($option_name, $update_options);
289 289
 			}
290 290
 		}
291 291
 
@@ -300,13 +300,13 @@  discard block
 block discarded – undo
300 300
 		 *
301 301
 		 * @return array
302 302
 		 */
303
-		public function add_metabox_setting_field( $settings, $form_id ) {
303
+		public function add_metabox_setting_field($settings, $form_id) {
304 304
 
305
-			if ( in_array( 'offline', array_keys( give_get_enabled_payment_gateways($form_id) ) ) ) {
305
+			if (in_array('offline', array_keys(give_get_enabled_payment_gateways($form_id)))) {
306 306
 				$settings[] = array(
307 307
 					'id'     => $this->config['id'],
308 308
 					'title'  => $this->config['label'],
309
-					'fields' => $this->get_setting_fields( $form_id ),
309
+					'fields' => $this->get_setting_fields($form_id),
310 310
 				);
311 311
 			}
312 312
 
Please login to merge, or discard this patch.
includes/admin/emails/filters.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -19,28 +19,28 @@  discard block
 block discarded – undo
19 19
  *
20 20
  * @return array
21 21
  */
22
-function give_email_notification_row_actions_callback( $row_actions, $email ) {
23
-	if( Give_Email_Notification_Util::is_email_preview( $email ) ) {
22
+function give_email_notification_row_actions_callback($row_actions, $email) {
23
+	if (Give_Email_Notification_Util::is_email_preview($email)) {
24 24
 		$preview_link = sprintf(
25 25
 			'<a href="%1$s" target="_blank">%2$s</a>',
26 26
 			wp_nonce_url(
27 27
 				add_query_arg(
28
-					array( 'give_action' => 'preview_email', 'email_type' => $email->config['id'] ),
28
+					array('give_action' => 'preview_email', 'email_type' => $email->config['id']),
29 29
 					home_url()
30 30
 				), 'give-preview-email'
31 31
 			),
32
-			__( 'Preview', 'give' )
32
+			__('Preview', 'give')
33 33
 		);
34 34
 
35 35
 		$send_preview_email_link = sprintf(
36 36
 			'<a href="%1$s">%2$s</a>',
37 37
 			wp_nonce_url(
38
-				add_query_arg( array(
38
+				add_query_arg(array(
39 39
 					'give_action'  => 'send_preview_email',
40 40
 					'email_type' => $email->config['id'],
41 41
 					'give-message' => 'sent-test-email',
42
-				) ), 'give-send-preview-email' ),
43
-			__( 'Send test email', 'give' )
42
+				)), 'give-send-preview-email' ),
43
+			__('Send test email', 'give')
44 44
 		);
45 45
 
46 46
 		$row_actions['email_preview'] = $preview_link;
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
 	return $row_actions;
51 51
 }
52
-add_filter( 'give_email_notification_row_actions', 'give_email_notification_row_actions_callback', 10, 2 );
52
+add_filter('give_email_notification_row_actions', 'give_email_notification_row_actions_callback', 10, 2);
53 53
 
54 54
 /**
55 55
  * This help to decode all email template tags.
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
  *
62 62
  * @return string
63 63
  */
64
-function give_decode_email_tags( $message, $email_obj ) {
65
-	if ( ! empty( $email_obj->tag_args ) ) {
66
-		$message = give_do_email_tags( $message, $email_obj->tag_args );
64
+function give_decode_email_tags($message, $email_obj) {
65
+	if ( ! empty($email_obj->tag_args)) {
66
+		$message = give_do_email_tags($message, $email_obj->tag_args);
67 67
 	}
68 68
 
69 69
 	return $message;
70 70
 }
71 71
 
72
-add_filter( 'give_email_message', 'give_decode_email_tags', 10, 2 );
73 72
\ No newline at end of file
73
+add_filter('give_email_message', 'give_decode_email_tags', 10, 2);
74 74
\ No newline at end of file
Please login to merge, or discard this patch.