Test Failed
Push — master ( cd44a0...d8bbfb )
by Devin
01:14
created
includes/payments/actions.php 1 patch
Spacing   +106 added lines, -110 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,21 +28,21 @@  discard block
 block discarded – undo
28 28
  *
29 29
  * @return void
30 30
  */
31
-function give_complete_purchase( $payment_id, $new_status, $old_status ) {
31
+function give_complete_purchase($payment_id, $new_status, $old_status) {
32 32
 
33 33
 	// Make sure that payments are only completed once.
34
-	if ( $old_status == 'publish' || $old_status == 'complete' ) {
34
+	if ($old_status == 'publish' || $old_status == 'complete') {
35 35
 		return;
36 36
 	}
37 37
 
38 38
 	// Make sure the payment completion is only processed when new status is complete.
39
-	if ( $new_status != 'publish' && $new_status != 'complete' ) {
39
+	if ($new_status != 'publish' && $new_status != 'complete') {
40 40
 		return;
41 41
 	}
42 42
 
43
-	$payment = new Give_Payment( $payment_id );
43
+	$payment = new Give_Payment($payment_id);
44 44
 
45
-	$creation_date  = get_post_field( 'post_date', $payment_id, 'raw' );
45
+	$creation_date  = get_post_field('post_date', $payment_id, 'raw');
46 46
 	$payment_meta   = $payment->payment_meta;
47 47
 	$completed_date = $payment->completed_date;
48 48
 	$user_info      = $payment->user_info;
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
 	 *
59 59
 	 * @param int $payment_id The ID of the payment.
60 60
 	 */
61
-	do_action( 'give_pre_complete_donation', $payment_id );
61
+	do_action('give_pre_complete_donation', $payment_id);
62 62
 
63 63
 	// Ensure these actions only run once, ever.
64
-	if ( empty( $completed_date ) ) {
64
+	if (empty($completed_date)) {
65 65
 
66
-		give_record_donation_in_log( $form_id, $payment_id, $price_id, $creation_date );
66
+		give_record_donation_in_log($form_id, $payment_id, $price_id, $creation_date);
67 67
 
68 68
 		/**
69 69
 		 * Fires after logging donation record.
@@ -74,29 +74,29 @@  discard block
 block discarded – undo
74 74
 		 * @param int   $payment_id   The ID number of the payment.
75 75
 		 * @param array $payment_meta The payment meta.
76 76
 		 */
77
-		do_action( 'give_complete_form_donation', $form_id, $payment_id, $payment_meta );
77
+		do_action('give_complete_form_donation', $form_id, $payment_id, $payment_meta);
78 78
 
79 79
 	}
80 80
 
81 81
 	// Increase the earnings for this form ID.
82
-	give_increase_earnings( $form_id, $amount );
83
-	give_increase_donation_count( $form_id );
82
+	give_increase_earnings($form_id, $amount);
83
+	give_increase_donation_count($form_id);
84 84
 
85 85
 	// @todo: Refresh only range related stat cache
86 86
 	give_delete_donation_stats();
87 87
 
88 88
 	// Increase the donor's donation stats.
89
-	$donor = new Give_Donor( $donor_id );
89
+	$donor = new Give_Donor($donor_id);
90 90
 	$donor->increase_purchase_count();
91
-	$donor->increase_value( $amount );
91
+	$donor->increase_value($amount);
92 92
 
93
-	give_increase_total_earnings( $amount );
93
+	give_increase_total_earnings($amount);
94 94
 
95 95
 	// Ensure this action only runs once ever.
96
-	if ( empty( $completed_date ) ) {
96
+	if (empty($completed_date)) {
97 97
 
98 98
 		// Save the completed date.
99
-		$payment->completed_date = current_time( 'mysql' );
99
+		$payment->completed_date = current_time('mysql');
100 100
 		$payment->save();
101 101
 
102 102
 		/**
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
 		 *
107 107
 		 * @param int $payment_id The ID of the payment.
108 108
 		 */
109
-		do_action( 'give_complete_donation', $payment_id );
109
+		do_action('give_complete_donation', $payment_id);
110 110
 	}
111 111
 
112 112
 }
113 113
 
114
-add_action( 'give_update_payment_status', 'give_complete_purchase', 100, 3 );
114
+add_action('give_update_payment_status', 'give_complete_purchase', 100, 3);
115 115
 
116 116
 
117 117
 /**
@@ -125,20 +125,20 @@  discard block
 block discarded – undo
125 125
  *
126 126
  * @return void
127 127
  */
128
-function give_record_status_change( $payment_id, $new_status, $old_status ) {
128
+function give_record_status_change($payment_id, $new_status, $old_status) {
129 129
 
130 130
 	// Get the list of statuses so that status in the payment note can be translated.
131 131
 	$stati      = give_get_payment_statuses();
132
-	$old_status = isset( $stati[ $old_status ] ) ? $stati[ $old_status ] : $old_status;
133
-	$new_status = isset( $stati[ $new_status ] ) ? $stati[ $new_status ] : $new_status;
132
+	$old_status = isset($stati[$old_status]) ? $stati[$old_status] : $old_status;
133
+	$new_status = isset($stati[$new_status]) ? $stati[$new_status] : $new_status;
134 134
 
135 135
 	// translators: 1: old status 2: new status.
136
-	$status_change = sprintf( esc_html__( 'Status changed from %1$s to %2$s.', 'give' ), $old_status, $new_status );
136
+	$status_change = sprintf(esc_html__('Status changed from %1$s to %2$s.', 'give'), $old_status, $new_status);
137 137
 
138
-	give_insert_payment_note( $payment_id, $status_change );
138
+	give_insert_payment_note($payment_id, $status_change);
139 139
 }
140 140
 
141
-add_action( 'give_update_payment_status', 'give_record_status_change', 100, 3 );
141
+add_action('give_update_payment_status', 'give_record_status_change', 100, 3);
142 142
 
143 143
 
144 144
 /**
@@ -154,25 +154,25 @@  discard block
 block discarded – undo
154 154
  *
155 155
  * @return void
156 156
  */
157
-function give_update_old_payments_with_totals( $data ) {
158
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_upgrade_payments_nonce' ) ) {
157
+function give_update_old_payments_with_totals($data) {
158
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give_upgrade_payments_nonce')) {
159 159
 		return;
160 160
 	}
161 161
 
162
-	if ( get_option( 'give_payment_totals_upgraded' ) ) {
162
+	if (get_option('give_payment_totals_upgraded')) {
163 163
 		return;
164 164
 	}
165 165
 
166
-	$payments = give_get_payments( array(
166
+	$payments = give_get_payments(array(
167 167
 		'offset' => 0,
168
-		'number' => - 1,
168
+		'number' => -1,
169 169
 		'mode'   => 'all',
170
-	) );
170
+	));
171 171
 
172
-	if ( $payments ) {
173
-		foreach ( $payments as $payment ) {
172
+	if ($payments) {
173
+		foreach ($payments as $payment) {
174 174
 
175
-			$payment = new Give_Payment( $payment->ID );
175
+			$payment = new Give_Payment($payment->ID);
176 176
 			$meta    = $payment->get_meta();
177 177
 
178 178
 			$payment->total = $meta['amount'];
@@ -181,10 +181,10 @@  discard block
 block discarded – undo
181 181
 		}
182 182
 	}
183 183
 
184
-	add_option( 'give_payment_totals_upgraded', 1 );
184
+	add_option('give_payment_totals_upgraded', 1);
185 185
 }
186 186
 
187
-add_action( 'give_upgrade_payments', 'give_update_old_payments_with_totals' );
187
+add_action('give_upgrade_payments', 'give_update_old_payments_with_totals');
188 188
 
189 189
 /**
190 190
  * Mark Abandoned Donations
@@ -198,17 +198,17 @@  discard block
 block discarded – undo
198 198
 function give_mark_abandoned_donations() {
199 199
 	$args = array(
200 200
 		'status' => 'pending',
201
-		'number' => - 1,
201
+		'number' => -1,
202 202
 		'output' => 'give_payments',
203 203
 	);
204 204
 
205
-	add_filter( 'posts_where', 'give_filter_where_older_than_week' );
205
+	add_filter('posts_where', 'give_filter_where_older_than_week');
206 206
 
207
-	$payments = give_get_payments( $args );
207
+	$payments = give_get_payments($args);
208 208
 
209
-	remove_filter( 'posts_where', 'give_filter_where_older_than_week' );
209
+	remove_filter('posts_where', 'give_filter_where_older_than_week');
210 210
 
211
-	if ( $payments ) {
211
+	if ($payments) {
212 212
 		/**
213 213
 		 * Filter payment gateways:  Used to set payment gateways which can be skip while transferring pending payment to abandon.
214 214
 		 *
@@ -216,13 +216,13 @@  discard block
 block discarded – undo
216 216
 		 *
217 217
 		 * @param array $skip_payment_gateways Array of payment gateways
218 218
 		 */
219
-		$skip_payment_gateways = apply_filters( 'give_mark_abandoned_donation_gateways', array( 'offline' ) );
219
+		$skip_payment_gateways = apply_filters('give_mark_abandoned_donation_gateways', array('offline'));
220 220
 
221
-		foreach ( $payments as $payment ) {
222
-			$gateway = give_get_payment_gateway( $payment );
221
+		foreach ($payments as $payment) {
222
+			$gateway = give_get_payment_gateway($payment);
223 223
 
224 224
 			// Skip payment gateways.
225
-			if ( in_array( $gateway, $skip_payment_gateways ) ) {
225
+			if (in_array($gateway, $skip_payment_gateways)) {
226 226
 				continue;
227 227
 			}
228 228
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	}
233 233
 }
234 234
 
235
-Give_Cron::add_weekly_event( 'give_mark_abandoned_donations' );
235
+Give_Cron::add_weekly_event('give_mark_abandoned_donations');
236 236
 
237 237
 
238 238
 /**
@@ -244,15 +244,15 @@  discard block
 block discarded – undo
244 244
  *
245 245
  * @return void
246 246
  */
247
-function give_refresh_thismonth_stat_transients( $payment_ID ) {
247
+function give_refresh_thismonth_stat_transients($payment_ID) {
248 248
 	// Monthly stats.
249
-	Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) );
249
+	Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats'));
250 250
 
251 251
 	// @todo: Refresh only range related stat cache
252 252
 	give_delete_donation_stats();
253 253
 }
254 254
 
255
-add_action( 'save_post_give_payment', 'give_refresh_thismonth_stat_transients' );
255
+add_action('save_post_give_payment', 'give_refresh_thismonth_stat_transients');
256 256
 
257 257
 
258 258
 /**
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
  *
269 269
  * @return array
270 270
  */
271
-function give_bc_v20_get_payment_meta( $check, $object_id, $meta_key, $single ) {
271
+function give_bc_v20_get_payment_meta($check, $object_id, $meta_key, $single) {
272 272
 	// Bailout.
273 273
 	if (
274
-		'give_payment' !== get_post_type( $object_id ) ||
274
+		'give_payment' !== get_post_type($object_id) ||
275 275
 		'_give_payment_meta' !== $meta_key ||
276
-		! give_has_upgrade_completed( 'v20_upgrades_payment_metadata' )
276
+		! give_has_upgrade_completed('v20_upgrades_payment_metadata')
277 277
 	) {
278 278
 		return $check;
279 279
 	}
@@ -281,73 +281,69 @@  discard block
 block discarded – undo
281 281
 	$cache_key = "_give_payment_meta_{$object_id}";
282 282
 
283 283
 	// Get already calculate payment meta from cache.
284
-	$payment_meta = Give_Cache::get_db_query( $cache_key );
284
+	$payment_meta = Give_Cache::get_db_query($cache_key);
285 285
 
286
-	if ( is_null( $payment_meta ) ) {
286
+	if (is_null($payment_meta)) {
287 287
 		// Remove filter.
288
-		remove_filter( 'get_post_metadata', 'give_bc_v20_get_payment_meta', 999 );
288
+		remove_filter('get_post_metadata', 'give_bc_v20_get_payment_meta', 999);
289 289
 
290
-		$donation = new Give_Payment( $object_id );
290
+		$donation = new Give_Payment($object_id);
291 291
 
292 292
 		// Get all payment meta.
293
-		$payment_meta = give_get_meta( $object_id );
293
+		$payment_meta = give_get_meta($object_id);
294 294
 
295 295
 		// Set default value to array.
296
-		if ( empty( $payment_meta ) ) {
296
+		if (empty($payment_meta)) {
297 297
 			return $check;
298 298
 		}
299 299
 
300 300
 		// Convert all meta key value to string instead of array
301
-		array_walk( $payment_meta, function ( &$meta, $key ) {
302
-			$meta = current( $meta );
301
+		array_walk($payment_meta, function(&$meta, $key) {
302
+			$meta = current($meta);
303 303
 		} );
304 304
 
305 305
 		/**
306 306
 		 * Add backward compatibility to old meta keys.
307 307
 		 */
308 308
 		// Donation key.
309
-		$payment_meta['key'] = ! empty( $payment_meta['_give_payment_purchase_key'] ) ? $payment_meta['_give_payment_purchase_key'] : '';
309
+		$payment_meta['key'] = ! empty($payment_meta['_give_payment_purchase_key']) ? $payment_meta['_give_payment_purchase_key'] : '';
310 310
 
311 311
 		// Donation form.
312
-		$payment_meta['form_title'] = ! empty( $payment_meta['_give_payment_form_title'] ) ? $payment_meta['_give_payment_form_title'] : '';
312
+		$payment_meta['form_title'] = ! empty($payment_meta['_give_payment_form_title']) ? $payment_meta['_give_payment_form_title'] : '';
313 313
 
314 314
 		// Donor email.
315
-		$payment_meta['email'] = ! empty( $payment_meta['_give_payment_donor_email'] ) ? $payment_meta['_give_payment_donor_email'] : '';
316
-		$payment_meta['email'] = ! empty( $payment_meta['email'] ) ?
317
-			$payment_meta['email'] :
318
-			Give()->donors->get_column( 'email', $donation->donor_id );
315
+		$payment_meta['email'] = ! empty($payment_meta['_give_payment_donor_email']) ? $payment_meta['_give_payment_donor_email'] : '';
316
+		$payment_meta['email'] = ! empty($payment_meta['email']) ?
317
+			$payment_meta['email'] : Give()->donors->get_column('email', $donation->donor_id);
319 318
 
320 319
 		// Form id.
321
-		$payment_meta['form_id'] = ! empty( $payment_meta['_give_payment_form_id'] ) ? $payment_meta['_give_payment_form_id'] : '';
320
+		$payment_meta['form_id'] = ! empty($payment_meta['_give_payment_form_id']) ? $payment_meta['_give_payment_form_id'] : '';
322 321
 
323 322
 		// Price id.
324
-		$payment_meta['price_id'] = ! empty( $payment_meta['_give_payment_price_id'] ) ? $payment_meta['_give_payment_price_id'] : '';
323
+		$payment_meta['price_id'] = ! empty($payment_meta['_give_payment_price_id']) ? $payment_meta['_give_payment_price_id'] : '';
325 324
 
326 325
 		// Date.
327
-		$payment_meta['date'] = ! empty( $payment_meta['_give_payment_date'] ) ? $payment_meta['_give_payment_date'] : '';
328
-		$payment_meta['date'] = ! empty( $payment_meta['date'] ) ?
329
-			$payment_meta['date'] :
330
-			get_post_field( 'post_date', $object_id );
326
+		$payment_meta['date'] = ! empty($payment_meta['_give_payment_date']) ? $payment_meta['_give_payment_date'] : '';
327
+		$payment_meta['date'] = ! empty($payment_meta['date']) ?
328
+			$payment_meta['date'] : get_post_field('post_date', $object_id);
331 329
 
332 330
 
333 331
 		// Currency.
334
-		$payment_meta['currency'] = ! empty( $payment_meta['_give_payment_currency'] ) ? $payment_meta['_give_payment_currency'] : '';
332
+		$payment_meta['currency'] = ! empty($payment_meta['_give_payment_currency']) ? $payment_meta['_give_payment_currency'] : '';
335 333
 
336 334
 		// Decode donor data.
337
-		$donor_id = ! empty( $payment_meta['_give_payment_donor_id'] ) ? $payment_meta['_give_payment_donor_id'] : 0;
338
-		$donor    = new Give_Donor( $donor_id );
335
+		$donor_id = ! empty($payment_meta['_give_payment_donor_id']) ? $payment_meta['_give_payment_donor_id'] : 0;
336
+		$donor    = new Give_Donor($donor_id);
339 337
 
340 338
 		// Donor first name.
341
-		$donor_data['first_name'] = ! empty( $payment_meta['_give_donor_billing_first_name'] ) ? $payment_meta['_give_donor_billing_first_name'] : '';
342
-		$donor_data['first_name'] = ! empty( $donor_data['first_name'] ) ?
343
-			$donor_data['first_name'] :
344
-			$donor->get_first_name();
339
+		$donor_data['first_name'] = ! empty($payment_meta['_give_donor_billing_first_name']) ? $payment_meta['_give_donor_billing_first_name'] : '';
340
+		$donor_data['first_name'] = ! empty($donor_data['first_name']) ?
341
+			$donor_data['first_name'] : $donor->get_first_name();
345 342
 
346 343
 		// Donor last name.
347
-		$donor_data['last_name'] = ! empty( $payment_meta['_give_donor_billing_last_name'] ) ? $payment_meta['_give_donor_billing_last_name'] : '';
348
-		$donor_data['last_name'] = ! empty( $donor_data['last_name'] ) ?
349
-			$donor_data['last_name'] :
350
-			$donor->get_last_name();
344
+		$donor_data['last_name'] = ! empty($payment_meta['_give_donor_billing_last_name']) ? $payment_meta['_give_donor_billing_last_name'] : '';
345
+		$donor_data['last_name'] = ! empty($donor_data['last_name']) ?
346
+			$donor_data['last_name'] : $donor->get_last_name();
351 347
 
352 348
 		// Donor email.
353 349
 		$donor_data['email'] = $payment_meta['email'];
@@ -358,63 +354,63 @@  discard block
 block discarded – undo
358 354
 		$donor_data['address'] = false;
359 355
 
360 356
 		// Address1.
361
-		$address1 = ! empty( $payment_meta['_give_donor_billing_address1'] ) ? $payment_meta['_give_donor_billing_address1'] : '';
362
-		if ( $address1 ) {
357
+		$address1 = ! empty($payment_meta['_give_donor_billing_address1']) ? $payment_meta['_give_donor_billing_address1'] : '';
358
+		if ($address1) {
363 359
 			$donor_data['address']['line1'] = $address1;
364 360
 		}
365 361
 
366 362
 		// Address2.
367
-		$address2 = ! empty( $payment_meta['_give_donor_billing_address2'] ) ? $payment_meta['_give_donor_billing_address2'] : '';
368
-		if ( $address2 ) {
363
+		$address2 = ! empty($payment_meta['_give_donor_billing_address2']) ? $payment_meta['_give_donor_billing_address2'] : '';
364
+		if ($address2) {
369 365
 			$donor_data['address']['line2'] = $address2;
370 366
 		}
371 367
 
372 368
 		// City.
373
-		$city = ! empty( $payment_meta['_give_donor_billing_city'] ) ? $payment_meta['_give_donor_billing_city'] : '';
374
-		if ( $city ) {
369
+		$city = ! empty($payment_meta['_give_donor_billing_city']) ? $payment_meta['_give_donor_billing_city'] : '';
370
+		if ($city) {
375 371
 			$donor_data['address']['city'] = $city;
376 372
 		}
377 373
 
378 374
 		// Zip.
379
-		$zip = ! empty( $payment_meta['_give_donor_billing_zip'] ) ? $payment_meta['_give_donor_billing_zip'] : '';
380
-		if ( $zip ) {
375
+		$zip = ! empty($payment_meta['_give_donor_billing_zip']) ? $payment_meta['_give_donor_billing_zip'] : '';
376
+		if ($zip) {
381 377
 			$donor_data['address']['zip'] = $zip;
382 378
 		}
383 379
 
384 380
 		// State.
385
-		$state = ! empty( $payment_meta['_give_donor_billing_state'] ) ? $payment_meta['_give_donor_billing_state'] : '';
386
-		if ( $state ) {
381
+		$state = ! empty($payment_meta['_give_donor_billing_state']) ? $payment_meta['_give_donor_billing_state'] : '';
382
+		if ($state) {
387 383
 			$donor_data['address']['state'] = $state;
388 384
 		}
389 385
 
390 386
 		// Country.
391
-		$country = ! empty( $payment_meta['_give_donor_billing_country'] ) ? $payment_meta['_give_donor_billing_country'] : '';
392
-		if ( $country ) {
387
+		$country = ! empty($payment_meta['_give_donor_billing_country']) ? $payment_meta['_give_donor_billing_country'] : '';
388
+		if ($country) {
393 389
 			$donor_data['address']['country'] = $country;
394 390
 		}
395 391
 
396 392
 		$payment_meta['user_info'] = $donor_data;
397 393
 
398 394
 		// Add filter
399
-		add_filter( 'get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4 );
395
+		add_filter('get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4);
400 396
 
401 397
 		// Set custom meta key into payment meta.
402
-		if ( ! empty( $payment_meta['_give_payment_meta'] ) ) {
403
-			$payment_meta = array_merge( maybe_unserialize( $payment_meta['_give_payment_meta'] ), $payment_meta );
398
+		if ( ! empty($payment_meta['_give_payment_meta'])) {
399
+			$payment_meta = array_merge(maybe_unserialize($payment_meta['_give_payment_meta']), $payment_meta);
404 400
 		}
405 401
 
406 402
 		// Set cache.
407
-		Give_Cache::set_db_query( $cache_key, $payment_meta );
403
+		Give_Cache::set_db_query($cache_key, $payment_meta);
408 404
 	}
409 405
 
410
-	if ( $single ) {
406
+	if ($single) {
411 407
 		/**
412 408
 		 * Filter the payment meta
413 409
 		 * Add custom meta key to payment meta
414 410
 		 *
415 411
 		 * @since 2.0
416 412
 		 */
417
-		$new_payment_meta[0] = apply_filters( 'give_get_payment_meta', $payment_meta, $object_id, $meta_key );
413
+		$new_payment_meta[0] = apply_filters('give_get_payment_meta', $payment_meta, $object_id, $meta_key);
418 414
 
419 415
 		$payment_meta = $new_payment_meta;
420 416
 	}
@@ -422,7 +418,7 @@  discard block
 block discarded – undo
422 418
 	return $payment_meta;
423 419
 }
424 420
 
425
-add_filter( 'get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4 );
421
+add_filter('get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4);
426 422
 
427 423
 /**
428 424
  * Add meta in payment that store page id and page url.
@@ -434,19 +430,19 @@  discard block
 block discarded – undo
434 430
  *
435 431
  * @param int $payment_id Payment id for which the meta value should be updated.
436 432
  */
437
-function give_payment_save_page_data( $payment_id ) {
438
-	$page_url = ( ! empty( $_REQUEST['give-current-url'] ) ? esc_url( $_REQUEST['give-current-url'] ) : false );
433
+function give_payment_save_page_data($payment_id) {
434
+	$page_url = ( ! empty($_REQUEST['give-current-url']) ? esc_url($_REQUEST['give-current-url']) : false);
439 435
 
440 436
 	// Check $page_url is not empty.
441
-	if ( $page_url ) {
442
-		update_post_meta( $payment_id, '_give_current_url', $page_url );
443
-		$page_id = url_to_postid( $page_url );
437
+	if ($page_url) {
438
+		update_post_meta($payment_id, '_give_current_url', $page_url);
439
+		$page_id = url_to_postid($page_url);
444 440
 		// Check $page_id is not empty.
445
-		if ( $page_id ) {
446
-			update_post_meta( $payment_id, '_give_current_page_id', $page_id );
441
+		if ($page_id) {
442
+			update_post_meta($payment_id, '_give_current_page_id', $page_id);
447 443
 		}
448 444
 	}
449 445
 }
450 446
 
451 447
 // Fire when payment is save.
452
-add_action( 'give_insert_payment', 'give_payment_save_page_data' );
453 448
\ No newline at end of file
449
+add_action('give_insert_payment', 'give_payment_save_page_data');
454 450
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-give-db-payment-meta.php 1 patch
Spacing   +3 added lines, -3 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
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		/* @var WPDB $wpdb */
51 51
 		global $wpdb;
52 52
 
53
-		$wpdb->paymentmeta = $this->table_name = $wpdb->prefix . 'give_paymentmeta';
53
+		$wpdb->paymentmeta = $this->table_name = $wpdb->prefix.'give_paymentmeta';
54 54
 		$this->primary_key = 'meta_id';
55 55
 		$this->version     = '1.0';
56 56
 
@@ -84,6 +84,6 @@  discard block
 block discarded – undo
84 84
 	 * @return bool
85 85
 	 */
86 86
 	protected function is_custom_meta_table_active() {
87
-		return give_has_upgrade_completed( 'v20_move_metadata_into_new_table' );
87
+		return give_has_upgrade_completed('v20_move_metadata_into_new_table');
88 88
 	}
89 89
 }
Please login to merge, or discard this patch.
includes/class-give-db-logs-meta.php 1 patch
Spacing   +7 added lines, -7 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
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		/* @var WPDB $wpdb */
51 51
 		global $wpdb;
52 52
 
53
-		$wpdb->logmeta     = $this->table_name = $wpdb->prefix . 'give_logmeta';
53
+		$wpdb->logmeta     = $this->table_name = $wpdb->prefix.'give_logmeta';
54 54
 		$this->primary_key = 'meta_id';
55 55
 		$this->version     = '1.0';
56 56
 
@@ -86,18 +86,18 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @return bool
88 88
 	 */
89
-	public function delete_row( $log_id = 0 ) {
89
+	public function delete_row($log_id = 0) {
90 90
 		/* @var WPDB $wpdb */
91 91
 		global $wpdb;
92 92
 
93 93
 		// Row ID must be positive integer
94
-		$log_id = absint( $log_id );
94
+		$log_id = absint($log_id);
95 95
 
96
-		if ( empty( $log_id ) ) {
96
+		if (empty($log_id)) {
97 97
 			return false;
98 98
 		}
99 99
 
100
-		if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE log_id = %d", $log_id ) ) ) {
100
+		if (false === $wpdb->query($wpdb->prepare("DELETE FROM $this->table_name WHERE log_id = %d", $log_id))) {
101 101
 			return false;
102 102
 		}
103 103
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @return bool
116 116
 	 */
117
-	protected function is_valid_post_type( $ID ) {
117
+	protected function is_valid_post_type($ID) {
118 118
 		return $ID && true;
119 119
 	}
120 120
 }
Please login to merge, or discard this patch.
includes/class-give-background-updater.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @category Class
12 12
  * @author   WordImpress
13 13
  */
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
 	 * and data exists in the queue.
55 55
 	 */
56 56
 	public function handle_cron_healthcheck() {
57
-		if ( $this->is_process_running() || $this->is_paused_process()  ) {
57
+		if ($this->is_process_running() || $this->is_paused_process()) {
58 58
 			// Background process already running.
59 59
 			return;
60 60
 		}
61 61
 
62
-		if ( $this->is_queue_empty() ) {
62
+		if ($this->is_queue_empty()) {
63 63
 			// No data to process.
64 64
 			$this->clear_scheduled_event();
65 65
 
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 	 * Schedule fallback event.
74 74
 	 */
75 75
 	protected function schedule_event() {
76
-		if ( ! wp_next_scheduled( $this->cron_hook_identifier ) && ! $this->is_paused_process() ) {
77
-			wp_schedule_event( time() + 10, $this->cron_interval_identifier, $this->cron_hook_identifier );
76
+		if ( ! wp_next_scheduled($this->cron_hook_identifier) && ! $this->is_paused_process()) {
77
+			wp_schedule_event(time() + 10, $this->cron_interval_identifier, $this->cron_hook_identifier);
78 78
 		}
79 79
 	}
80 80
 
@@ -90,13 +90,13 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @return mixed
92 92
 	 */
93
-	protected function task( $update ) {
93
+	protected function task($update) {
94 94
 		// Pause upgrade immediately if admin pausing upgrades.
95
-		if( $this->is_paused_process() ) {
95
+		if ($this->is_paused_process()) {
96 96
 			wp_die();
97 97
 		}
98 98
 
99
-		if ( empty( $update ) ) {
99
+		if (empty($update)) {
100 100
 			return false;
101 101
 		}
102 102
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 				'update_info' => $update,
111 111
 				'step'        => 1,
112 112
 				'update'      => 1,
113
-				'heading'     => sprintf( 'Update %s of {update_count}', 1 ),
113
+				'heading'     => sprintf('Update %s of {update_count}', 1),
114 114
 				'percentage'  => $give_updates->percentage,
115 115
 			)
116 116
 		);
@@ -118,22 +118,22 @@  discard block
 block discarded – undo
118 118
 		// Continuously skip update if previous update does not complete yet.
119 119
 		if (
120 120
 			$resume_update['update_info']['id'] !== $update['id'] &&
121
-			! give_has_upgrade_completed( $resume_update['update_info']['id'] )
121
+			! give_has_upgrade_completed($resume_update['update_info']['id'])
122 122
 		) {
123 123
 			return $update;
124 124
 		}
125 125
 
126 126
 		// Set params.
127 127
 		$resume_update['update_info'] = $update;
128
-		$give_updates->step           = absint( $resume_update['step'] );
129
-		$give_updates->update         = absint( $resume_update['update'] );
130
-		$is_parent_update_completed   = $give_updates->is_parent_updates_completed( $update );
128
+		$give_updates->step           = absint($resume_update['step']);
129
+		$give_updates->update         = absint($resume_update['update']);
130
+		$is_parent_update_completed   = $give_updates->is_parent_updates_completed($update);
131 131
 
132 132
 
133 133
 		// Skip update if dependency update does not complete yet.
134
-		if ( empty( $is_parent_update_completed ) ) {
134
+		if (empty($is_parent_update_completed)) {
135 135
 			// @todo: set error when you have only one update with invalid dependency
136
-			if ( ! is_null( $is_parent_update_completed ) ) {
136
+			if ( ! is_null($is_parent_update_completed)) {
137 137
 				return $update;
138 138
 			}
139 139
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 		Give_Cache::disable();
145 145
 
146 146
 		// Run update.
147
-		if ( is_array( $update['callback'] ) ) {
147
+		if (is_array($update['callback'])) {
148 148
 			$update['callback'][0]->$update['callback'][1]();
149 149
 		} else {
150 150
 			$update['callback']();
@@ -153,21 +153,21 @@  discard block
 block discarded – undo
153 153
 		// Set update info.
154 154
 		$doing_upgrade_args = array(
155 155
 			'update_info'      => $update,
156
-			'step'             => ++ $give_updates->step,
156
+			'step'             => ++$give_updates->step,
157 157
 			'update'           => $give_updates->update,
158
-			'heading'          => sprintf( 'Update %s of %s', $give_updates->update, get_option( 'give_db_update_count' ) ),
158
+			'heading'          => sprintf('Update %s of %s', $give_updates->update, get_option('give_db_update_count')),
159 159
 			'percentage'       => $give_updates->percentage,
160 160
 			'total_percentage' => $give_updates->get_db_update_processing_percentage(),
161 161
 		);
162 162
 
163 163
 		// Cache upgrade.
164
-		update_option( 'give_doing_upgrade', $doing_upgrade_args );
164
+		update_option('give_doing_upgrade', $doing_upgrade_args);
165 165
 
166 166
 		// Enable cache.
167 167
 		Give_Cache::enable();
168 168
 
169 169
 		// Check if current update completed or not.
170
-		if ( give_has_upgrade_completed( $update['id'] ) ) {
170
+		if (give_has_upgrade_completed($update['id'])) {
171 171
 			return false;
172 172
 		}
173 173
 
@@ -181,21 +181,21 @@  discard block
 block discarded – undo
181 181
 	 * performed, or, call parent::complete().
182 182
 	 */
183 183
 	protected function complete() {
184
-		if( $this->is_paused_process() ) {
184
+		if ($this->is_paused_process()) {
185 185
 			return false;
186 186
 		}
187 187
 
188 188
 		parent::complete();
189 189
 
190
-		delete_option( 'give_db_update_count' );
191
-		delete_option( 'give_doing_upgrade' );
192
-		add_option( 'give_show_db_upgrade_complete_notice', 1, '', 'no' );
190
+		delete_option('give_db_update_count');
191
+		delete_option('give_doing_upgrade');
192
+		add_option('give_show_db_upgrade_complete_notice', 1, '', 'no');
193 193
 
194 194
 		// Flush cache.
195 195
 		Give_Cache::get_instance()->flush_cache();
196 196
 
197
-		if( $cache_keys = Give_Cache::get_options_like('') ) {
198
-			Give_Cache::delete( $cache_keys );
197
+		if ($cache_keys = Give_Cache::get_options_like('')) {
198
+			Give_Cache::delete($cache_keys);
199 199
 		}
200 200
 	}
201 201
 
@@ -205,19 +205,19 @@  discard block
 block discarded – undo
205 205
 	 * @return int
206 206
 	 */
207 207
 	protected function get_memory_limit() {
208
-		if ( function_exists( 'ini_get' ) ) {
209
-			$memory_limit = ini_get( 'memory_limit' );
208
+		if (function_exists('ini_get')) {
209
+			$memory_limit = ini_get('memory_limit');
210 210
 		} else {
211 211
 			// Sensible default.
212 212
 			$memory_limit = '128M';
213 213
 		}
214 214
 
215
-		if ( ! $memory_limit || '-1' === $memory_limit ) {
215
+		if ( ! $memory_limit || '-1' === $memory_limit) {
216 216
 			// Unlimited, set to 32GB.
217 217
 			$memory_limit = '32000M';
218 218
 		}
219 219
 
220
-		return intval( $memory_limit ) * 1024 * 1024;
220
+		return intval($memory_limit) * 1024 * 1024;
221 221
 	}
222 222
 
223 223
 	/**
@@ -230,17 +230,17 @@  discard block
 block discarded – undo
230 230
 		// Don't lock up other requests while processing
231 231
 		session_write_close();
232 232
 
233
-		if ( $this->is_process_running() || $this->is_paused_process() ) {
233
+		if ($this->is_process_running() || $this->is_paused_process()) {
234 234
 			// Background process already running.
235 235
 			wp_die();
236 236
 		}
237 237
 
238
-		if ( $this->is_queue_empty() ) {
238
+		if ($this->is_queue_empty()) {
239 239
 			// No data to process.
240 240
 			wp_die();
241 241
 		}
242 242
 
243
-		check_ajax_referer( $this->identifier, 'nonce' );
243
+		check_ajax_referer($this->identifier, 'nonce');
244 244
 
245 245
 		$this->handle();
246 246
 
@@ -255,13 +255,13 @@  discard block
 block discarded – undo
255 255
 	 * @access public
256 256
 	 * @return bool
257 257
 	 */
258
-	public function is_paused_process(){
258
+	public function is_paused_process() {
259 259
 		// Not using get_option because i am facing some caching releated issue.
260 260
 		global $wpdb;
261 261
 
262
-		$options = $wpdb->get_results( "SELECT * FROM $wpdb->options WHERE option_name='give_paused_batches' LIMIT 1" );
262
+		$options = $wpdb->get_results("SELECT * FROM $wpdb->options WHERE option_name='give_paused_batches' LIMIT 1");
263 263
 
264
-		return ! empty( $options );
264
+		return ! empty($options);
265 265
 	}
266 266
 
267 267
 
Please login to merge, or discard this patch.
includes/emails/class-give-email-tags.php 1 patch
Spacing   +245 added lines, -245 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  */
24 24
 
25 25
 // Exit if accessed directly.
26
-if ( ! defined( 'ABSPATH' ) ) {
26
+if ( ! defined('ABSPATH')) {
27 27
 	exit;
28 28
 }
29 29
 
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 	 * @param callable $func        Hook to run when email tag is found
57 57
 	 * @param string   $context     Email tag category
58 58
 	 */
59
-	public function add( $tag, $description, $func, $context = '' ) {
60
-		if ( is_callable( $func ) ) {
61
-			$this->tags[ $tag ] = array(
59
+	public function add($tag, $description, $func, $context = '') {
60
+		if (is_callable($func)) {
61
+			$this->tags[$tag] = array(
62 62
 				'tag'         => $tag,
63 63
 				'description' => $description,
64 64
 				'func'        => $func,
65
-				'context'     => give_check_variable( $context, 'empty', 'general' ),
65
+				'context'     => give_check_variable($context, 'empty', 'general'),
66 66
 			);
67 67
 		}
68 68
 	}
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @param string $tag Email tag to remove hook from
76 76
 	 */
77
-	public function remove( $tag ) {
78
-		unset( $this->tags[ $tag ] );
77
+	public function remove($tag) {
78
+		unset($this->tags[$tag]);
79 79
 	}
80 80
 
81 81
 	/**
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @return bool
89 89
 	 */
90
-	public function email_tag_exists( $tag ) {
91
-		return array_key_exists( $tag, $this->tags );
90
+	public function email_tag_exists($tag) {
91
+		return array_key_exists($tag, $this->tags);
92 92
 	}
93 93
 
94 94
 	/**
@@ -102,23 +102,23 @@  discard block
 block discarded – undo
102 102
 	 *
103 103
 	 * @return array
104 104
 	 */
105
-	public function get_tags( $context_type = 'all', $field = '' ) {
105
+	public function get_tags($context_type = 'all', $field = '') {
106 106
 		$tags = $this->tags;
107 107
 
108
-		if ( 'all' !== $context_type ) {
108
+		if ('all' !== $context_type) {
109 109
 			$tags = array();
110 110
 
111
-			foreach ( $this->tags as $tag ) {
112
-				if ( empty( $tag['context'] ) || $context_type !== $tag['context'] ) {
111
+			foreach ($this->tags as $tag) {
112
+				if (empty($tag['context']) || $context_type !== $tag['context']) {
113 113
 					continue;
114 114
 				}
115 115
 
116
-				$tags[ $tag['tag'] ] = $tag;
116
+				$tags[$tag['tag']] = $tag;
117 117
 			}
118 118
 		}
119 119
 
120
-		if ( ! empty( $tags ) && ! empty( $field ) ) {
121
-			$tags = wp_list_pluck( $tags, $field );
120
+		if ( ! empty($tags) && ! empty($field)) {
121
+			$tags = wp_list_pluck($tags, $field);
122 122
 		}
123 123
 
124 124
 		return $tags;
@@ -136,16 +136,16 @@  discard block
 block discarded – undo
136 136
 	 *
137 137
 	 * @return string Content with email tags filtered out.
138 138
 	 */
139
-	public function do_tags( $content, $tag_args ) {
139
+	public function do_tags($content, $tag_args) {
140 140
 
141 141
 		// Check if there is at least one tag added.
142
-		if ( empty( $this->tags ) || ! is_array( $this->tags ) ) {
142
+		if (empty($this->tags) || ! is_array($this->tags)) {
143 143
 			return $content;
144 144
 		}
145 145
 
146 146
 		$this->tag_args = $tag_args;
147 147
 
148
-		$new_content = preg_replace_callback( "/{([A-z0-9\-\_]+)}/s", array( $this, 'do_tag' ), $content );
148
+		$new_content = preg_replace_callback("/{([A-z0-9\-\_]+)}/s", array($this, 'do_tag'), $content);
149 149
 
150 150
 		$this->tag_args = null;
151 151
 
@@ -161,17 +161,17 @@  discard block
 block discarded – undo
161 161
 	 *
162 162
 	 * @return mixed
163 163
 	 */
164
-	public function do_tag( $m ) {
164
+	public function do_tag($m) {
165 165
 
166 166
 		// Get tag
167 167
 		$tag = $m[1];
168 168
 
169 169
 		// Return tag if tag not set
170
-		if ( ! $this->email_tag_exists( $tag ) ) {
170
+		if ( ! $this->email_tag_exists($tag)) {
171 171
 			return $m[0];
172 172
 		}
173 173
 
174
-		return call_user_func( $this->tags[ $tag ]['func'], $this->tag_args, $tag );
174
+		return call_user_func($this->tags[$tag]['func'], $this->tag_args, $tag);
175 175
 	}
176 176
 
177 177
 }
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
  * @param callable $func        Hook to run when email tag is found
187 187
  * @param string   $context     Email tag category
188 188
  */
189
-function give_add_email_tag( $tag, $description, $func, $context = '' ) {
190
-	Give()->email_tags->add( $tag, $description, $func, $context );
189
+function give_add_email_tag($tag, $description, $func, $context = '') {
190
+	Give()->email_tags->add($tag, $description, $func, $context);
191 191
 }
192 192
 
193 193
 /**
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
  *
198 198
  * @param string $tag Email tag to remove hook from
199 199
  */
200
-function give_remove_email_tag( $tag ) {
201
-	Give()->email_tags->remove( $tag );
200
+function give_remove_email_tag($tag) {
201
+	Give()->email_tags->remove($tag);
202 202
 }
203 203
 
204 204
 /**
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
  *
211 211
  * @return bool
212 212
  */
213
-function give_email_tag_exists( $tag ) {
214
-	return Give()->email_tags->email_tag_exists( $tag );
213
+function give_email_tag_exists($tag) {
214
+	return Give()->email_tags->email_tag_exists($tag);
215 215
 }
216 216
 
217 217
 /**
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
 	$email_tags = give_get_email_tags();
239 239
 
240 240
 	ob_start();
241
-	if ( count( $email_tags ) > 0 ) : ?>
241
+	if (count($email_tags) > 0) : ?>
242 242
 		<div class="give-email-tags-wrap">
243
-			<?php foreach ( $email_tags as $email_tag ) : ?>
243
+			<?php foreach ($email_tags as $email_tag) : ?>
244 244
 				<span class="give_<?php echo $email_tag['tag']; ?>_tag">
245 245
 					<code>{<?php echo $email_tag['tag']; ?>}</code> - <?php echo $email_tag['description']; ?>
246 246
 				</span>
@@ -264,14 +264,14 @@  discard block
 block discarded – undo
264 264
  *
265 265
  * @return string Content with email tags filtered out.
266 266
  */
267
-function give_do_email_tags( $content, $tag_args ) {
267
+function give_do_email_tags($content, $tag_args) {
268 268
 	// Backward compatibility < 2.0
269
-	if ( ! is_array( $tag_args ) ) {
270
-		$tag_args = array( 'payment_id' => $tag_args );
269
+	if ( ! is_array($tag_args)) {
270
+		$tag_args = array('payment_id' => $tag_args);
271 271
 	}
272 272
 
273 273
 	// Replace all tags
274
-	$content = Give()->email_tags->do_tags( $content, $tag_args );
274
+	$content = Give()->email_tags->do_tags($content, $tag_args);
275 275
 
276 276
 	/**
277 277
 	 * Filter the filtered content text.
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	 * @since 1.0
280 280
 	 * @since 2.0 $payment_meta, $payment_id removed and $tag_args added.
281 281
 	 */
282
-	$content = apply_filters( 'give_email_template_tags', $content, $tag_args );
282
+	$content = apply_filters('give_email_template_tags', $content, $tag_args);
283 283
 
284 284
 	// Return content
285 285
 	return $content;
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
 	 *
299 299
 	 * @since 1.0
300 300
 	 */
301
-	do_action( 'give_add_email_tags' );
301
+	do_action('give_add_email_tags');
302 302
 }
303 303
 
304
-add_action( 'init', 'give_load_email_tags', - 999 );
304
+add_action('init', 'give_load_email_tags', - 999);
305 305
 
306 306
 
307 307
 /**
@@ -316,67 +316,67 @@  discard block
 block discarded – undo
316 316
 		/*	Donation Payment */
317 317
 		array(
318 318
 			'tag'         => 'donation',
319
-			'description' => esc_html__( 'The donation form name, and the donation level (if applicable).', 'give' ),
319
+			'description' => esc_html__('The donation form name, and the donation level (if applicable).', 'give'),
320 320
 			'function'    => 'give_email_tag_donation',
321 321
 			'context'     => 'donation',
322 322
 		),
323 323
 		array(
324 324
 			'tag'         => 'amount',
325
-			'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ),
325
+			'description' => esc_html__('The total donation amount with currency sign.', 'give'),
326 326
 			'function'    => 'give_email_tag_amount',
327 327
 			'context'     => 'donation',
328 328
 		),
329 329
 		array(
330 330
 			'tag'         => 'price',
331
-			'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ),
331
+			'description' => esc_html__('The total donation amount with currency sign.', 'give'),
332 332
 			'function'    => 'give_email_tag_price',
333 333
 			'context'     => 'donation',
334 334
 		),
335 335
 		array(
336 336
 			'tag'         => 'billing_address',
337
-			'description' => esc_html__( 'The donor\'s billing address.', 'give' ),
337
+			'description' => esc_html__('The donor\'s billing address.', 'give'),
338 338
 			'function'    => 'give_email_tag_billing_address',
339 339
 			'context'     => 'donation',
340 340
 		),
341 341
 		array(
342 342
 			'tag'         => 'date',
343
-			'description' => esc_html__( 'The date of the donation.', 'give' ),
343
+			'description' => esc_html__('The date of the donation.', 'give'),
344 344
 			'function'    => 'give_email_tag_date',
345 345
 			'context'     => 'donation',
346 346
 		),
347 347
 		array(
348 348
 			'tag'         => 'payment_id',
349
-			'description' => esc_html__( 'The unique ID number for this donation.', 'give' ),
349
+			'description' => esc_html__('The unique ID number for this donation.', 'give'),
350 350
 			'function'    => 'give_email_tag_payment_id',
351 351
 			'context'     => 'donation',
352 352
 		),
353 353
 		array(
354 354
 			'tag'         => 'payment_method',
355
-			'description' => esc_html__( 'The method of payment used for this donation.', 'give' ),
355
+			'description' => esc_html__('The method of payment used for this donation.', 'give'),
356 356
 			'function'    => 'give_email_tag_payment_method',
357 357
 			'context'     => 'donation',
358 358
 		),
359 359
 		array(
360 360
 			'tag'         => 'payment_total',
361
-			'description' => esc_html__( 'The payment total for this donation.', 'give' ),
361
+			'description' => esc_html__('The payment total for this donation.', 'give'),
362 362
 			'function'    => 'give_email_tag_payment_total',
363 363
 			'context'     => 'donation',
364 364
 		),
365 365
 		array(
366 366
 			'tag'         => 'receipt_id',
367
-			'description' => esc_html__( 'The unique ID number for this donation receipt.', 'give' ),
367
+			'description' => esc_html__('The unique ID number for this donation receipt.', 'give'),
368 368
 			'function'    => 'give_email_tag_receipt_id',
369 369
 			'context'     => 'donation',
370 370
 		),
371 371
 		array(
372 372
 			'tag'         => 'receipt_link',
373
-			'description' => esc_html__( 'The donation receipt direct link, to view the receipt on the website.', 'give' ),
373
+			'description' => esc_html__('The donation receipt direct link, to view the receipt on the website.', 'give'),
374 374
 			'function'    => 'give_email_tag_receipt_link',
375 375
 			'context'     => 'donation',
376 376
 		),
377 377
 		array(
378 378
 			'tag'         => 'receipt_link_url',
379
-			'description' => esc_html__( 'The donation receipt direct URL, to view the receipt on the website.', 'give' ),
379
+			'description' => esc_html__('The donation receipt direct URL, to view the receipt on the website.', 'give'),
380 380
 			'function'    => 'give_email_tag_receipt_link_url',
381 381
 			'context'     => 'donation',
382 382
 		),
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 		/* Donation Form */
385 385
 		array(
386 386
 			'tag'         => 'form_title',
387
-			'description' => esc_html__( 'The donation form name.', 'give' ),
387
+			'description' => esc_html__('The donation form name.', 'give'),
388 388
 			'function'    => 'give_email_tag_form_title',
389 389
 			'context'     => 'form',
390 390
 		),
@@ -392,31 +392,31 @@  discard block
 block discarded – undo
392 392
 		/* Donor */
393 393
 		array(
394 394
 			'tag'         => 'name',
395
-			'description' => esc_html__( 'The donor\'s first name.', 'give' ),
395
+			'description' => esc_html__('The donor\'s first name.', 'give'),
396 396
 			'function'    => 'give_email_tag_first_name',
397 397
 			'context'     => 'donor',
398 398
 		),
399 399
 		array(
400 400
 			'tag'         => 'fullname',
401
-			'description' => esc_html__( 'The donor\'s full name, first and last.', 'give' ),
401
+			'description' => esc_html__('The donor\'s full name, first and last.', 'give'),
402 402
 			'function'    => 'give_email_tag_fullname',
403 403
 			'context'     => 'donor',
404 404
 		),
405 405
 		array(
406 406
 			'tag'         => 'username',
407
-			'description' => esc_html__( 'The donor\'s user name on the site, if they registered an account.', 'give' ),
407
+			'description' => esc_html__('The donor\'s user name on the site, if they registered an account.', 'give'),
408 408
 			'function'    => 'give_email_tag_username',
409 409
 			'context'     => 'donor',
410 410
 		),
411 411
 		array(
412 412
 			'tag'         => 'user_email',
413
-			'description' => esc_html__( 'The donor\'s email address.', 'give' ),
413
+			'description' => esc_html__('The donor\'s email address.', 'give'),
414 414
 			'function'    => 'give_email_tag_user_email',
415 415
 			'context'     => 'donor',
416 416
 		),
417 417
 		array(
418 418
 			'tag'         => 'email_access_link',
419
-			'description' => esc_html__( 'The donor\'s email access link.', 'give' ),
419
+			'description' => esc_html__('The donor\'s email access link.', 'give'),
420 420
 			'function'    => 'give_email_tag_email_access_link',
421 421
 			'context'     => 'donor',
422 422
 		),
@@ -424,14 +424,14 @@  discard block
 block discarded – undo
424 424
 		/* General */
425 425
 		array(
426 426
 			'tag'         => 'sitename',
427
-			'description' => esc_html__( 'The name of your site.', 'give' ),
427
+			'description' => esc_html__('The name of your site.', 'give'),
428 428
 			'function'    => 'give_email_tag_sitename',
429 429
 			'context'     => 'general',
430 430
 		),
431 431
 
432 432
 		array(
433 433
 			'tag'         => 'reset_password_link',
434
-			'description' => esc_html__( 'The reset password link for user.', 'give' ),
434
+			'description' => esc_html__('The reset password link for user.', 'give'),
435 435
 			'function'    => 'give_email_tag_reset_password_link',
436 436
 			'context'     => 'general',
437 437
 		),
@@ -439,21 +439,21 @@  discard block
 block discarded – undo
439 439
 	);
440 440
 
441 441
 	// Apply give_email_tags filter
442
-	$email_tags = apply_filters( 'give_email_tags', $email_tags );
442
+	$email_tags = apply_filters('give_email_tags', $email_tags);
443 443
 
444 444
 	// Add email tags
445
-	foreach ( $email_tags as $email_tag ) {
445
+	foreach ($email_tags as $email_tag) {
446 446
 		give_add_email_tag(
447 447
 			$email_tag['tag'],
448 448
 			$email_tag['description'],
449 449
 			$email_tag['function'],
450
-			( ! empty( $email_tag['context'] ) ? $email_tag['context'] : '' )
450
+			( ! empty($email_tag['context']) ? $email_tag['context'] : '')
451 451
 		);
452 452
 	}
453 453
 
454 454
 }
455 455
 
456
-add_action( 'give_add_email_tags', 'give_setup_email_tags' );
456
+add_action('give_add_email_tags', 'give_setup_email_tags');
457 457
 
458 458
 
459 459
 /**
@@ -465,26 +465,26 @@  discard block
 block discarded – undo
465 465
  *
466 466
  * @return string $firstname
467 467
  */
468
-function give_email_tag_first_name( $tag_args ) {
468
+function give_email_tag_first_name($tag_args) {
469 469
 	$user_info = array();
470 470
 	$firstname = '';
471 471
 
472 472
 	// Backward compatibility.
473
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
473
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
474 474
 
475
-	switch ( true ) {
476
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
477
-			$payment = new Give_Payment( $tag_args['payment_id'] );
475
+	switch (true) {
476
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
477
+			$payment = new Give_Payment($tag_args['payment_id']);
478 478
 
479 479
 			// Get firstname.
480
-			if ( ! empty( $payment->user_info ) ) {
481
-				$email_names = give_get_email_names( $payment->user_info );
480
+			if ( ! empty($payment->user_info)) {
481
+				$email_names = give_get_email_names($payment->user_info);
482 482
 				$firstname   = $email_names['name'];
483 483
 			}
484 484
 			break;
485 485
 
486
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
487
-			$donor = new Give_Donor( $tag_args['user_id'], true );
486
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
487
+			$donor = new Give_Donor($tag_args['user_id'], true);
488 488
 			$firstname = $donor->get_first_name();
489 489
 			break;
490 490
 
@@ -493,8 +493,8 @@  discard block
 block discarded – undo
493 493
 		 *
494 494
 		 * @since 2.0
495 495
 		 */
496
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
497
-			$donor = new Give_Donor( $tag_args['donor_id'] );
496
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
497
+			$donor = new Give_Donor($tag_args['donor_id']);
498 498
 			$firstname = $donor->get_first_name();
499 499
 			break;
500 500
 	}
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 	 * @param string $firstname
508 508
 	 * @param array  $tag_args
509 509
 	 */
510
-	$firstname = apply_filters( 'give_email_tag_first_name', $firstname, $tag_args );
510
+	$firstname = apply_filters('give_email_tag_first_name', $firstname, $tag_args);
511 511
 
512 512
 	return $firstname;
513 513
 }
@@ -521,26 +521,26 @@  discard block
 block discarded – undo
521 521
  *
522 522
  * @return string $fullname
523 523
  */
524
-function give_email_tag_fullname( $tag_args ) {
524
+function give_email_tag_fullname($tag_args) {
525 525
 	$fullname = '';
526 526
 
527 527
 	// Backward compatibility.
528
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
528
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
529 529
 
530
-	switch ( true ) {
531
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
532
-			$payment = new Give_Payment( $tag_args['payment_id'] );
530
+	switch (true) {
531
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
532
+			$payment = new Give_Payment($tag_args['payment_id']);
533 533
 
534 534
 			// Get fullname.
535
-			if ( ! empty( $payment->user_info ) ) {
536
-				$email_names = give_get_email_names( $payment->user_info );
535
+			if ( ! empty($payment->user_info)) {
536
+				$email_names = give_get_email_names($payment->user_info);
537 537
 				$fullname    = $email_names['fullname'];
538 538
 			}
539 539
 			break;
540 540
 
541
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
542
-			$donor = new Give_Donor( $tag_args['user_id'], true );
543
-			$fullname  = trim( "{$donor->get_first_name()} {$donor->get_last_name()}" );
541
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
542
+			$donor = new Give_Donor($tag_args['user_id'], true);
543
+			$fullname = trim("{$donor->get_first_name()} {$donor->get_last_name()}");
544 544
 			break;
545 545
 
546 546
 		/**
@@ -548,8 +548,8 @@  discard block
 block discarded – undo
548 548
 		 *
549 549
 		 * @since 2.0
550 550
 		 */
551
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
552
-			$donor = new Give_Donor( $tag_args['donor_id'] );
551
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
552
+			$donor = new Give_Donor($tag_args['donor_id']);
553 553
 			$fullname = $donor->name;
554 554
 			break;
555 555
 	}
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 	 * @param string $fullname
563 563
 	 * @param array  $tag_args
564 564
 	 */
565
-	$fullname = apply_filters( 'give_email_tag_fullname', $fullname, $tag_args );
565
+	$fullname = apply_filters('give_email_tag_fullname', $fullname, $tag_args);
566 566
 
567 567
 	return $fullname;
568 568
 }
@@ -576,25 +576,25 @@  discard block
 block discarded – undo
576 576
  *
577 577
  * @return string username.
578 578
  */
579
-function give_email_tag_username( $tag_args ) {
579
+function give_email_tag_username($tag_args) {
580 580
 	$username = '';
581 581
 
582 582
 	// Backward compatibility.
583
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
583
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
584 584
 
585
-	switch ( true ) {
586
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
587
-			$payment = new Give_Payment( $tag_args['payment_id'] );
585
+	switch (true) {
586
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
587
+			$payment = new Give_Payment($tag_args['payment_id']);
588 588
 
589 589
 			// Get username.
590
-			if ( ! empty( $payment->user_info ) ) {
591
-				$email_names = give_get_email_names( $payment->user_info );
590
+			if ( ! empty($payment->user_info)) {
591
+				$email_names = give_get_email_names($payment->user_info);
592 592
 				$username    = $email_names['username'];
593 593
 			}
594 594
 			break;
595 595
 
596
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
597
-			$user_info = get_user_by( 'id', $tag_args['user_id'] );
596
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
597
+			$user_info = get_user_by('id', $tag_args['user_id']);
598 598
 			$username  = $user_info->user_login;
599 599
 			break;
600 600
 
@@ -603,10 +603,10 @@  discard block
 block discarded – undo
603 603
 		 *
604 604
 		 * @since 2.0
605 605
 		 */
606
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
607
-			$donor = new Give_Donor( $tag_args['donor_id'] );
608
-			if ( ! empty( $donor->id ) && ! empty( $donor->user_id ) ) {
609
-				$user_info = get_user_by( 'id', $donor->user_id );
606
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
607
+			$donor = new Give_Donor($tag_args['donor_id']);
608
+			if ( ! empty($donor->id) && ! empty($donor->user_id)) {
609
+				$user_info = get_user_by('id', $donor->user_id);
610 610
 				$username  = $user_info->user_login;
611 611
 			}
612 612
 			break;
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 	 * @param string $username
621 621
 	 * @param array  $tag_args
622 622
 	 */
623
-	$username = apply_filters( 'give_email_tag_username', $username, $tag_args );
623
+	$username = apply_filters('give_email_tag_username', $username, $tag_args);
624 624
 
625 625
 	return $username;
626 626
 }
@@ -634,20 +634,20 @@  discard block
 block discarded – undo
634 634
  *
635 635
  * @return string user_email
636 636
  */
637
-function give_email_tag_user_email( $tag_args ) {
637
+function give_email_tag_user_email($tag_args) {
638 638
 	$email = '';
639 639
 
640 640
 	// Backward compatibility.
641
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
641
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
642 642
 
643
-	switch ( true ) {
644
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
645
-			$payment = new Give_Payment( $tag_args['payment_id'] );
643
+	switch (true) {
644
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
645
+			$payment = new Give_Payment($tag_args['payment_id']);
646 646
 			$email   = $payment->email;
647 647
 			break;
648 648
 
649
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
650
-			$user_info = get_user_by( 'id', $tag_args['user_id'] );
649
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
650
+			$user_info = get_user_by('id', $tag_args['user_id']);
651 651
 			$email     = $user_info->user_email;
652 652
 			break;
653 653
 
@@ -656,9 +656,9 @@  discard block
 block discarded – undo
656 656
 		 *
657 657
 		 * @since 2.0
658 658
 		 */
659
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
660
-			$donor = new Give_Donor( $tag_args['donor_id'] );
661
-			$email     = $donor->email;
659
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
660
+			$donor = new Give_Donor($tag_args['donor_id']);
661
+			$email = $donor->email;
662 662
 			break;
663 663
 	}
664 664
 
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
 	 * @param string $email
671 671
 	 * @param array  $tag_args
672 672
 	 */
673
-	$email = apply_filters( 'give_email_tag_user_email', $email, $tag_args );
673
+	$email = apply_filters('give_email_tag_user_email', $email, $tag_args);
674 674
 
675 675
 	return $email;
676 676
 }
@@ -684,22 +684,22 @@  discard block
 block discarded – undo
684 684
  *
685 685
  * @return string billing_address
686 686
  */
687
-function give_email_tag_billing_address( $tag_args ) {
687
+function give_email_tag_billing_address($tag_args) {
688 688
 	$address = '';
689 689
 
690 690
 	// Backward compatibility.
691
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
691
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
692 692
 
693
-	switch ( true ) {
694
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
695
-			$donation   = new Give_Payment( $tag_args['payment_id'] );
696
-			$address = $donation->address['line1'] . "\n";
693
+	switch (true) {
694
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
695
+			$donation = new Give_Payment($tag_args['payment_id']);
696
+			$address = $donation->address['line1']."\n";
697 697
 
698
-			if ( ! empty( $donation->address['line2'] ) ) {
699
-				$address .= $donation->address['line2'] . "\n";
698
+			if ( ! empty($donation->address['line2'])) {
699
+				$address .= $donation->address['line2']."\n";
700 700
 			}
701 701
 
702
-			$address .= $donation->address['city'] . ' ' . $donation->address['zip'] . ' ' . $donation->address['state'] . "\n";
702
+			$address .= $donation->address['city'].' '.$donation->address['zip'].' '.$donation->address['state']."\n";
703 703
 			$address .= $donation->address['country'];
704 704
 			break;
705 705
 	}
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 	 * @param string $address
713 713
 	 * @param array  $tag_args
714 714
 	 */
715
-	$address = apply_filters( 'give_email_tag_billing_address', $address, $tag_args );
715
+	$address = apply_filters('give_email_tag_billing_address', $address, $tag_args);
716 716
 
717 717
 	return $address;
718 718
 }
@@ -726,16 +726,16 @@  discard block
 block discarded – undo
726 726
  *
727 727
  * @return string date
728 728
  */
729
-function give_email_tag_date( $tag_args ) {
729
+function give_email_tag_date($tag_args) {
730 730
 	$date = '';
731 731
 
732 732
 	// Backward compatibility.
733
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
733
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
734 734
 
735
-	switch ( true ) {
736
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
737
-			$payment = new Give_Payment( $tag_args['payment_id'] );
738
-			$date    = date_i18n( give_date_format(), strtotime( $payment->date ) );
735
+	switch (true) {
736
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
737
+			$payment = new Give_Payment($tag_args['payment_id']);
738
+			$date    = date_i18n(give_date_format(), strtotime($payment->date));
739 739
 			break;
740 740
 	}
741 741
 
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 	 * @param string $date
748 748
 	 * @param array  $tag_args
749 749
 	 */
750
-	$date = apply_filters( 'give_email_tag_date', $date, $tag_args );
750
+	$date = apply_filters('give_email_tag_date', $date, $tag_args);
751 751
 
752 752
 	return $date;
753 753
 }
@@ -761,17 +761,17 @@  discard block
 block discarded – undo
761 761
  *
762 762
  * @return string amount
763 763
  */
764
-function give_email_tag_amount( $tag_args ) {
764
+function give_email_tag_amount($tag_args) {
765 765
 	$amount = '';
766 766
 
767 767
 	// Backward compatibility.
768
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
768
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
769 769
 
770
-	switch ( true ) {
771
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
772
-			$payment     = new Give_Payment( $tag_args['payment_id'] );
773
-			$give_amount = give_currency_filter( give_format_amount( $payment->total, array( 'sanitize' => false ) ), array( 'currency_code' => $payment->currency ) );
774
-			$amount      = html_entity_decode( $give_amount, ENT_COMPAT, 'UTF-8' );
770
+	switch (true) {
771
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
772
+			$payment     = new Give_Payment($tag_args['payment_id']);
773
+			$give_amount = give_currency_filter(give_format_amount($payment->total, array('sanitize' => false)), array('currency_code' => $payment->currency));
774
+			$amount      = html_entity_decode($give_amount, ENT_COMPAT, 'UTF-8');
775 775
 			break;
776 776
 	}
777 777
 
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
 	 * @param string $amount
784 784
 	 * @param array  $tag_args
785 785
 	 */
786
-	$amount = apply_filters( 'give_email_tag_amount', $amount, $tag_args );
786
+	$amount = apply_filters('give_email_tag_amount', $amount, $tag_args);
787 787
 
788 788
 	return $amount;
789 789
 }
@@ -797,8 +797,8 @@  discard block
 block discarded – undo
797 797
  *
798 798
  * @return string price
799 799
  */
800
-function give_email_tag_price( $tag_args ) {
801
-	return give_email_tag_amount( $tag_args );
800
+function give_email_tag_price($tag_args) {
801
+	return give_email_tag_amount($tag_args);
802 802
 }
803 803
 
804 804
 /**
@@ -810,15 +810,15 @@  discard block
 block discarded – undo
810 810
  *
811 811
  * @return int payment_id
812 812
  */
813
-function give_email_tag_payment_id( $tag_args ) {
813
+function give_email_tag_payment_id($tag_args) {
814 814
 	$payment_id = '';
815 815
 
816 816
 	// Backward compatibility.
817
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
817
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
818 818
 
819
-	switch ( true ) {
820
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
821
-			$payment    = new Give_Payment( $tag_args['payment_id'] );
819
+	switch (true) {
820
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
821
+			$payment    = new Give_Payment($tag_args['payment_id']);
822 822
 			$payment_id = $payment->number;
823 823
 			break;
824 824
 	}
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
 	 * @param string $payment_id
832 832
 	 * @param array  $tag_args
833 833
 	 */
834
-	return apply_filters( 'give_email_tag_payment_id', $payment_id, $tag_args );
834
+	return apply_filters('give_email_tag_payment_id', $payment_id, $tag_args);
835 835
 }
836 836
 
837 837
 /**
@@ -843,15 +843,15 @@  discard block
 block discarded – undo
843 843
  *
844 844
  * @return string receipt_id
845 845
  */
846
-function give_email_tag_receipt_id( $tag_args ) {
846
+function give_email_tag_receipt_id($tag_args) {
847 847
 	$receipt_id = '';
848 848
 
849 849
 	// Backward compatibility.
850
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
850
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
851 851
 
852
-	switch ( true ) {
853
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
854
-			$payment    = new Give_Payment( $tag_args['payment_id'] );
852
+	switch (true) {
853
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
854
+			$payment    = new Give_Payment($tag_args['payment_id']);
855 855
 			$receipt_id = $payment->key;
856 856
 			break;
857 857
 	}
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
 	 * @param string $receipt_id
865 865
 	 * @param array  $tag_args
866 866
 	 */
867
-	return apply_filters( 'give_email_tag_receipt_id', $receipt_id, $tag_args );
867
+	return apply_filters('give_email_tag_receipt_id', $receipt_id, $tag_args);
868 868
 }
869 869
 
870 870
 /**
@@ -876,23 +876,23 @@  discard block
 block discarded – undo
876 876
  *
877 877
  * @return string $form_title
878 878
  */
879
-function give_email_tag_donation( $tag_args ) {
879
+function give_email_tag_donation($tag_args) {
880 880
 	$donation_form_title = '';
881 881
 
882 882
 	// Backward compatibility.
883
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
883
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
884 884
 
885
-	switch ( true ) {
886
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
887
-			$payment             = new Give_Payment( $tag_args['payment_id'] );
888
-			$level_title         = give_has_variable_prices( $payment->form_id );
885
+	switch (true) {
886
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
887
+			$payment             = new Give_Payment($tag_args['payment_id']);
888
+			$level_title         = give_has_variable_prices($payment->form_id);
889 889
 			$separator           = $level_title ? '-' : '';
890
-			$donation_form_title = strip_tags( give_check_variable( give_get_donation_form_title(
890
+			$donation_form_title = strip_tags(give_check_variable(give_get_donation_form_title(
891 891
 				$payment,
892 892
 				array(
893 893
 					'separator' => $separator,
894 894
 				)
895
-			), 'empty', '' ) );
895
+			), 'empty', ''));
896 896
 			break;
897 897
 	}
898 898
 
@@ -920,17 +920,17 @@  discard block
 block discarded – undo
920 920
  *
921 921
  * @return string $form_title
922 922
  */
923
-function give_email_tag_form_title( $tag_args ) {
923
+function give_email_tag_form_title($tag_args) {
924 924
 	$donation_form_title = '';
925 925
 
926 926
 	// Backward compatibility.
927
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
927
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
928 928
 
929
-	switch ( true ) {
930
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
931
-			$payment             = new Give_Payment( $tag_args['payment_id'] );
929
+	switch (true) {
930
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
931
+			$payment             = new Give_Payment($tag_args['payment_id']);
932 932
 			$payment_meta        = $payment->payment_meta;
933
-			$donation_form_title = strip_tags( give_check_variable( $payment_meta, 'empty', '', 'form_title' ) );
933
+			$donation_form_title = strip_tags(give_check_variable($payment_meta, 'empty', '', 'form_title'));
934 934
 			break;
935 935
 	}
936 936
 
@@ -958,19 +958,19 @@  discard block
 block discarded – undo
958 958
  *
959 959
  * @return string gateway
960 960
  */
961
-function give_email_tag_payment_method( $tag_args ) {
961
+function give_email_tag_payment_method($tag_args) {
962 962
 	$payment_method = '';
963 963
 
964 964
 	// Backward compatibility.
965
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
965
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
966 966
 
967 967
 	// Backward compatibility.
968
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
968
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
969 969
 
970
-	switch ( true ) {
971
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
972
-			$payment        = new Give_Payment( $tag_args['payment_id'] );
973
-			$payment_method = give_get_gateway_checkout_label( $payment->gateway );
970
+	switch (true) {
971
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
972
+			$payment        = new Give_Payment($tag_args['payment_id']);
973
+			$payment_method = give_get_gateway_checkout_label($payment->gateway);
974 974
 			break;
975 975
 	}
976 976
 
@@ -1001,16 +1001,16 @@  discard block
 block discarded – undo
1001 1001
  *
1002 1002
  * @return string
1003 1003
  */
1004
-function give_email_tag_payment_total( $tag_args ) {
1004
+function give_email_tag_payment_total($tag_args) {
1005 1005
 	$payment_total = '';
1006 1006
 
1007 1007
 	// Backward compatibility.
1008
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1008
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1009 1009
 
1010
-	switch ( true ) {
1011
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
1012
-			$payment       = new Give_Payment( $tag_args['payment_id'] );
1013
-			$payment_total = give_currency_filter( $payment->total );
1010
+	switch (true) {
1011
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
1012
+			$payment       = new Give_Payment($tag_args['payment_id']);
1013
+			$payment_total = give_currency_filter($payment->total);
1014 1014
 			break;
1015 1015
 	}
1016 1016
 
@@ -1038,11 +1038,11 @@  discard block
 block discarded – undo
1038 1038
  *
1039 1039
  * @return string
1040 1040
  */
1041
-function give_email_tag_sitename( $tag_args = array() ) {
1042
-	$sitename = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES );
1041
+function give_email_tag_sitename($tag_args = array()) {
1042
+	$sitename = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES);
1043 1043
 
1044 1044
 	// Backward compatibility.
1045
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1045
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1046 1046
 
1047 1047
 	/**
1048 1048
 	 * Filter the {sitename} email template tag output.
@@ -1068,26 +1068,26 @@  discard block
 block discarded – undo
1068 1068
  *
1069 1069
  * @return string receipt_link
1070 1070
  */
1071
-function give_email_tag_receipt_link( $tag_args ) {
1071
+function give_email_tag_receipt_link($tag_args) {
1072 1072
 	// Backward compatibility.
1073
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1073
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1074 1074
 
1075
-	$receipt_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) );
1075
+	$receipt_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id'));
1076 1076
 
1077 1077
 	// Bailout.
1078
-	if ( give_get_option( 'email_template' ) === 'none' ) {
1078
+	if (give_get_option('email_template') === 'none') {
1079 1079
 		return $receipt_url;
1080 1080
 	}
1081 1081
 
1082 1082
 
1083
-	$receipt_url = esc_url( add_query_arg( array(
1084
-		'payment_key' => give_get_payment_key( $tag_args['payment_id'] ),
1085
-	), give_get_history_page_uri() ) );
1083
+	$receipt_url = esc_url(add_query_arg(array(
1084
+		'payment_key' => give_get_payment_key($tag_args['payment_id']),
1085
+	), give_get_history_page_uri()));
1086 1086
 
1087
-	$formatted   = sprintf(
1087
+	$formatted = sprintf(
1088 1088
 		'<a href="%1$s">%2$s</a>',
1089 1089
 		$receipt_url,
1090
-		__( 'View it in your browser &raquo;', 'give' )
1090
+		__('View it in your browser &raquo;', 'give')
1091 1091
 	);
1092 1092
 
1093 1093
 	/**
@@ -1116,11 +1116,11 @@  discard block
 block discarded – undo
1116 1116
  *
1117 1117
  * @return string receipt_url
1118 1118
  */
1119
-function give_email_tag_receipt_link_url( $tag_args ) {
1119
+function give_email_tag_receipt_link_url($tag_args) {
1120 1120
 	// Backward compatibility.
1121
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1121
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1122 1122
 
1123
-	$receipt_link_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) );
1123
+	$receipt_link_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id'));
1124 1124
 
1125 1125
 	/**
1126 1126
 	 * Filter the {receipt_link_url} email template tag output.
@@ -1147,13 +1147,13 @@  discard block
 block discarded – undo
1147 1147
  *
1148 1148
  * @return string
1149 1149
  */
1150
-function give_get_receipt_url( $payment_id ) {
1150
+function give_get_receipt_url($payment_id) {
1151 1151
 	$receipt_url = '';
1152 1152
 
1153
-	if ( $payment_id ) {
1154
-		$receipt_url = esc_url( add_query_arg( array(
1155
-			'payment_key' => give_get_payment_key( $payment_id ),
1156
-		), give_get_history_page_uri() ) );
1153
+	if ($payment_id) {
1154
+		$receipt_url = esc_url(add_query_arg(array(
1155
+			'payment_key' => give_get_payment_key($payment_id),
1156
+		), give_get_history_page_uri()));
1157 1157
 	}
1158 1158
 
1159 1159
 	return $receipt_url;
@@ -1169,22 +1169,22 @@  discard block
 block discarded – undo
1169 1169
  *
1170 1170
  * @return string
1171 1171
  */
1172
-function give_email_tag_email_access_link( $tag_args ) {
1172
+function give_email_tag_email_access_link($tag_args) {
1173 1173
 	$donor_id          = 0;
1174 1174
 	$donor             = array();
1175 1175
 	$email_access_link = '';
1176 1176
 
1177 1177
 	// Backward compatibility.
1178
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1178
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1179 1179
 
1180
-	switch ( true ) {
1181
-		case ! empty( $tag_args['donor_id'] ):
1180
+	switch (true) {
1181
+		case ! empty($tag_args['donor_id']):
1182 1182
 			$donor_id = $tag_args['donor_id'];
1183
-			$donor    = Give()->donors->get_by( 'id', $tag_args['donor_id'] );
1183
+			$donor    = Give()->donors->get_by('id', $tag_args['donor_id']);
1184 1184
 			break;
1185 1185
 
1186
-		case ! empty( $tag_args['user_id'] ):
1187
-			$donor    = Give()->donors->get_by( 'user_id', $tag_args['user_id'] );
1186
+		case ! empty($tag_args['user_id']):
1187
+			$donor    = Give()->donors->get_by('user_id', $tag_args['user_id']);
1188 1188
 			$donor_id = $donor->id;
1189 1189
 			break;
1190 1190
 
@@ -1193,11 +1193,11 @@  discard block
 block discarded – undo
1193 1193
 	}
1194 1194
 
1195 1195
 	// Set email access link if donor exist.
1196
-	if ( $donor_id ) {
1197
-		$verify_key = wp_generate_password( 20, false );
1196
+	if ($donor_id) {
1197
+		$verify_key = wp_generate_password(20, false);
1198 1198
 
1199 1199
 		// Generate a new verify key
1200
-		Give()->email_access->set_verify_key( $donor_id, $donor->email, $verify_key );
1200
+		Give()->email_access->set_verify_key($donor_id, $donor->email, $verify_key);
1201 1201
 
1202 1202
 		$access_url = add_query_arg(
1203 1203
 			array(
@@ -1207,28 +1207,28 @@  discard block
 block discarded – undo
1207 1207
 		);
1208 1208
 
1209 1209
 		// Add Payment Key to email access url, if it exists.
1210
-		if ( ! empty( $_GET['payment_key'] ) ) {
1210
+		if ( ! empty($_GET['payment_key'])) {
1211 1211
 			$access_url = add_query_arg(
1212 1212
 				array(
1213
-					'payment_key' => give_clean( $_GET['payment_key'] ),
1213
+					'payment_key' => give_clean($_GET['payment_key']),
1214 1214
 				),
1215 1215
 				$access_url
1216 1216
 			);
1217 1217
 		}
1218 1218
 
1219
-		if ( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) {
1219
+		if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) {
1220 1220
 			$email_access_link = sprintf(
1221 1221
 				'<a href="%1$s" target="_blank">%2$s</a>',
1222
-				esc_url( $access_url ),
1223
-				__( 'View your donation history &raquo;', 'give' )
1222
+				esc_url($access_url),
1223
+				__('View your donation history &raquo;', 'give')
1224 1224
 			);
1225 1225
 
1226 1226
 		} else {
1227 1227
 
1228 1228
 			$email_access_link = sprintf(
1229 1229
 				'%1$s: %2$s',
1230
-				__( 'View your donation history', 'give' ),
1231
-				esc_url( $access_url )
1230
+				__('View your donation history', 'give'),
1231
+				esc_url($access_url)
1232 1232
 			);
1233 1233
 		}
1234 1234
 	}
@@ -1260,23 +1260,23 @@  discard block
 block discarded – undo
1260 1260
  *
1261 1261
  * @return array
1262 1262
  */
1263
-function __give_20_bc_str_type_email_tag_param( $tag_args ) {
1264
-	if ( ! is_array( $tag_args ) ) {
1265
-		switch ( true ) {
1266
-			case ( 'give_payment' === get_post_type( $tag_args ) ):
1267
-				$tag_args = array( 'payment_id' => $tag_args );
1263
+function __give_20_bc_str_type_email_tag_param($tag_args) {
1264
+	if ( ! is_array($tag_args)) {
1265
+		switch (true) {
1266
+			case ('give_payment' === get_post_type($tag_args)):
1267
+				$tag_args = array('payment_id' => $tag_args);
1268 1268
 				break;
1269 1269
 
1270
-			case ( ! is_wp_error( get_user_by( 'id', $tag_args ) ) ):
1271
-				$tag_args = array( 'user_id' => $tag_args );
1270
+			case ( ! is_wp_error(get_user_by('id', $tag_args))):
1271
+				$tag_args = array('user_id' => $tag_args);
1272 1272
 				break;
1273 1273
 
1274
-			case ( Give()->donors->get_by( 'id', $tag_args ) ):
1275
-				$tag_args = array( 'donor_id' => $tag_args );
1274
+			case (Give()->donors->get_by('id', $tag_args)):
1275
+				$tag_args = array('donor_id' => $tag_args);
1276 1276
 				break;
1277 1277
 
1278
-			case ( Give()->donors->get_by( 'user_id', $tag_args ) ):
1279
-				$tag_args = array( 'user_id' => $tag_args );
1278
+			case (Give()->donors->get_by('user_id', $tag_args)):
1279
+				$tag_args = array('user_id' => $tag_args);
1280 1280
 				break;
1281 1281
 		}
1282 1282
 	}
@@ -1294,39 +1294,39 @@  discard block
 block discarded – undo
1294 1294
  *
1295 1295
  * @return array
1296 1296
  */
1297
-function give_email_tag_reset_password_link( $tag_args, $payment_id ) {
1297
+function give_email_tag_reset_password_link($tag_args, $payment_id) {
1298 1298
 
1299 1299
 	$reset_password_url = '';
1300 1300
 
1301
-	switch ( true ) {
1302
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
1303
-			$payment    = new Give_Payment( $tag_args['payment_id'] );
1301
+	switch (true) {
1302
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
1303
+			$payment    = new Give_Payment($tag_args['payment_id']);
1304 1304
 			$payment_id = $payment->number;
1305 1305
 			break;
1306 1306
 
1307
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
1308
-			$reset_password_url = give_get_reset_password_url( $tag_args['user_id'] );
1307
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
1308
+			$reset_password_url = give_get_reset_password_url($tag_args['user_id']);
1309 1309
 			break;
1310 1310
 
1311
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
1311
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
1312 1312
 			/* @var Give_Donor $donor */
1313
-			$donor = new Give_Donor( $tag_args['user_id'], true );
1314
-			$reset_password_url = give_get_reset_password_url( $donor->user_id );
1313
+			$donor = new Give_Donor($tag_args['user_id'], true);
1314
+			$reset_password_url = give_get_reset_password_url($donor->user_id);
1315 1315
 			break;
1316 1316
 	}
1317 1317
 
1318
-	if( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) {
1318
+	if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) {
1319 1319
 		// Generate link, if Email content type is html.
1320 1320
 		$reset_password_link = sprintf(
1321 1321
 			'<a href="%1$s" target="_blank">%2$s</a>',
1322
-			esc_url( $reset_password_url ),
1323
-			__( 'Reset your password &raquo;', 'give' )
1322
+			esc_url($reset_password_url),
1323
+			__('Reset your password &raquo;', 'give')
1324 1324
 		);
1325
-	} else{
1325
+	} else {
1326 1326
 		$reset_password_link = sprintf(
1327 1327
 			'%1$s: %2$s',
1328
-			__( 'Reset your password', 'give' ),
1329
-			esc_url( $reset_password_url )
1328
+			__('Reset your password', 'give'),
1329
+			esc_url($reset_password_url)
1330 1330
 		);
1331 1331
 	}
1332 1332
 
@@ -1355,21 +1355,21 @@  discard block
 block discarded – undo
1355 1355
  *
1356 1356
  * @return mixed|string
1357 1357
  */
1358
-function give_get_reset_password_url( $user_id ) {
1358
+function give_get_reset_password_url($user_id) {
1359 1359
 	$reset_password_url = '';
1360 1360
 
1361 1361
 	// Proceed further only, if user_id exists.
1362
-	if ( $user_id ) {
1362
+	if ($user_id) {
1363 1363
 
1364 1364
 		// Get User Object Details.
1365
-		$user = get_user_by( 'ID', $user_id );
1365
+		$user = get_user_by('ID', $user_id);
1366 1366
 
1367 1367
 		// Prepare Reset Password URL.
1368
-		$reset_password_url = esc_url( add_query_arg( array(
1368
+		$reset_password_url = esc_url(add_query_arg(array(
1369 1369
 			'action' => 'rp',
1370
-			'key' => get_password_reset_key( $user ),
1370
+			'key' => get_password_reset_key($user),
1371 1371
 			'login' => $user->user_login,
1372
-		), wp_login_url() ) );
1372
+		), wp_login_url()));
1373 1373
 	}
1374 1374
 
1375 1375
 	return $reset_password_url;
Please login to merge, or discard this patch.
includes/class-give-db-donor-meta.php 1 patch
Spacing   +9 added lines, -9 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,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		/* @var WPDB $wpdb */
54 54
 		global $wpdb;
55 55
 
56
-		$wpdb->donormeta   = $this->table_name = $wpdb->prefix . 'give_donormeta';
56
+		$wpdb->donormeta   = $this->table_name = $wpdb->prefix.'give_donormeta';
57 57
 		$this->primary_key = 'meta_id';
58 58
 		$this->version     = '1.0';
59 59
 
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @return  bool  False for failure. True for success.
92 92
 	 */
93
-	public function delete_all_meta( $donor_id = 0 ) {
93
+	public function delete_all_meta($donor_id = 0) {
94 94
 		global $wpdb;
95
-		$status = $wpdb->delete( $this->table_name, array( 'donor_id' => $donor_id ), array( '%d' ) );
95
+		$status = $wpdb->delete($this->table_name, array('donor_id' => $donor_id), array('%d'));
96 96
 
97
-		if( $status ) {
98
-			Give_Cache::delete_group( $donor_id, 'give-donors' );
97
+		if ($status) {
98
+			Give_Cache::delete_group($donor_id, 'give-donors');
99 99
 		}
100 100
 	}
101 101
 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 		global $wpdb;
112 112
 
113 113
 		if (
114
-			! give_has_upgrade_completed( 'v20_rename_donor_tables' ) &&
115
-			$wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s","{$wpdb->prefix}give_customermeta" ) )
114
+			! give_has_upgrade_completed('v20_rename_donor_tables') &&
115
+			$wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customermeta"))
116 116
 		) {
117 117
 			$wpdb->donormeta = $this->table_name = "{$wpdb->prefix}give_customermeta";
118 118
 			$this->meta_type = 'customer';
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @return bool
133 133
 	 */
134
-	protected function is_valid_post_type( $ID ) {
134
+	protected function is_valid_post_type($ID) {
135 135
 		return $ID && true;
136 136
 	}
137 137
 
Please login to merge, or discard this patch.
includes/admin/tools/data/class-give-tools-recount-donor-stats.php 1 patch
Spacing   +37 added lines, -37 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
 
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	/**
49 49
 	 * Constructor.
50 50
 	 */
51
-	public function __construct( $_step = 1 ) {
52
-		parent::__construct( $_step );
51
+	public function __construct($_step = 1) {
52
+		parent::__construct($_step);
53 53
 
54 54
 		$this->is_writable = true;
55 55
 	}
@@ -66,32 +66,32 @@  discard block
 block discarded – undo
66 66
 
67 67
 		$args = array(
68 68
 			'number'  => $this->per_step,
69
-			'offset'  => $this->per_step * ( $this->step - 1 ),
69
+			'offset'  => $this->per_step * ($this->step - 1),
70 70
 			'orderby' => 'id',
71 71
 			'order'   => 'DESC',
72 72
 		);
73 73
 
74
-		$donors = Give()->donors->get_donors( $args );
74
+		$donors = Give()->donors->get_donors($args);
75 75
 
76
-		if ( $donors ) {
76
+		if ($donors) {
77 77
 
78
-			$allowed_payment_status = apply_filters( 'give_recount_donors_donation_statuses', give_get_payment_status_keys() );
78
+			$allowed_payment_status = apply_filters('give_recount_donors_donation_statuses', give_get_payment_status_keys());
79 79
 
80
-			foreach ( $donors as $donor ) {
80
+			foreach ($donors as $donor) {
81 81
 
82
-				$attached_payment_ids = explode( ',', $donor->payment_ids );
82
+				$attached_payment_ids = explode(',', $donor->payment_ids);
83 83
 
84 84
 				$attached_args = array(
85 85
 					'post__in' => $attached_payment_ids,
86
-					'number'   => - 1,
86
+					'number'   => -1,
87 87
 					'status'   => $allowed_payment_status,
88 88
 				);
89 89
 
90
-				$attached_payments = (array) give_get_payments( $attached_args );
90
+				$attached_payments = (array) give_get_payments($attached_args);
91 91
 
92 92
 				$unattached_args = array(
93 93
 					'post__not_in' => $attached_payment_ids,
94
-					'number'       => - 1,
94
+					'number'       => -1,
95 95
 					'status'       => $allowed_payment_status,
96 96
 					'meta_query'   => array(
97 97
 						array(
@@ -102,29 +102,29 @@  discard block
 block discarded – undo
102 102
 					),
103 103
 				);
104 104
 
105
-				$unattached_payments = give_get_payments( $unattached_args );
105
+				$unattached_payments = give_get_payments($unattached_args);
106 106
 
107
-				$payments = array_merge( $attached_payments, $unattached_payments );
107
+				$payments = array_merge($attached_payments, $unattached_payments);
108 108
 
109 109
 				$purchase_value = 0.00;
110 110
 				$purchase_count = 0;
111 111
 				$payment_ids    = array();
112 112
 
113
-				if ( $payments ) {
113
+				if ($payments) {
114 114
 
115
-					foreach ( $payments as $payment ) {
115
+					foreach ($payments as $payment) {
116 116
 
117 117
 						$should_process_payment = 'publish' == $payment->post_status ? true : false;
118
-						$should_process_payment = apply_filters( 'give_donor_recount_should_process_donation', $should_process_payment, $payment );
118
+						$should_process_payment = apply_filters('give_donor_recount_should_process_donation', $should_process_payment, $payment);
119 119
 
120
-						if ( true === $should_process_payment ) {
120
+						if (true === $should_process_payment) {
121 121
 
122
-							if ( apply_filters( 'give_donor_recount_should_increase_value', true, $payment ) ) {
123
-								$purchase_value += (float) give_donation_amount( $payment->ID, array( 'type' => 'stats' ) );
122
+							if (apply_filters('give_donor_recount_should_increase_value', true, $payment)) {
123
+								$purchase_value += (float) give_donation_amount($payment->ID, array('type' => 'stats'));
124 124
 							}
125 125
 
126
-							if ( apply_filters( 'give_donor_recount_should_increase_count', true, $payment ) ) {
127
-								$purchase_count ++;
126
+							if (apply_filters('give_donor_recount_should_increase_count', true, $payment)) {
127
+								$purchase_count++;
128 128
 							}
129 129
 						}
130 130
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 					}
133 133
 				}
134 134
 
135
-				$payment_ids = implode( ',', $payment_ids );
135
+				$payment_ids = implode(',', $payment_ids);
136 136
 
137 137
 				$donor_update_data = array(
138 138
 					'purchase_count' => $purchase_count,
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
 					'payment_ids'    => $payment_ids,
141 141
 				);
142 142
 
143
-				$donor_instance = new Give_Donor( $donor->id );
144
-				$donor_instance->update( $donor_update_data );
143
+				$donor_instance = new Give_Donor($donor->id);
144
+				$donor_instance->update($donor_update_data);
145 145
 
146 146
 			}// End foreach().
147 147
 
@@ -161,21 +161,21 @@  discard block
 block discarded – undo
161 161
 	public function get_percentage_complete() {
162 162
 
163 163
 		$args = array(
164
-			'number'  => - 1,
164
+			'number'  => -1,
165 165
 			'orderby' => 'id',
166 166
 			'order'   => 'DESC',
167 167
 		);
168 168
 
169
-		$donors = Give()->donors->get_donors( $args );
170
-		$total     = count( $donors );
169
+		$donors = Give()->donors->get_donors($args);
170
+		$total = count($donors);
171 171
 
172 172
 		$percentage = 100;
173 173
 
174
-		if ( $total > 0 ) {
175
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
174
+		if ($total > 0) {
175
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
176 176
 		}
177 177
 
178
-		if ( $percentage > 100 ) {
178
+		if ($percentage > 100) {
179 179
 			$percentage = 100;
180 180
 		}
181 181
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 *
190 190
 	 * @param array $request The Form Data passed into the batch processing
191 191
 	 */
192
-	public function set_properties( $request ) {
192
+	public function set_properties($request) {
193 193
 	}
194 194
 
195 195
 	/**
@@ -200,21 +200,21 @@  discard block
 block discarded – undo
200 200
 	 */
201 201
 	public function process_step() {
202 202
 
203
-		if ( ! $this->can_export() ) {
204
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array(
203
+		if ( ! $this->can_export()) {
204
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array(
205 205
 				'response' => 403,
206
-			) );
206
+			));
207 207
 		}
208 208
 
209 209
 		$had_data = $this->get_data();
210 210
 
211
-		if ( $had_data ) {
211
+		if ($had_data) {
212 212
 			$this->done = false;
213 213
 
214 214
 			return true;
215 215
 		} else {
216 216
 			$this->done    = true;
217
-			$this->message = esc_html__( 'Donor stats have been successfully recounted.', 'give' );
217
+			$this->message = esc_html__('Donor stats have been successfully recounted.', 'give');
218 218
 
219 219
 			return false;
220 220
 		}
Please login to merge, or discard this patch.
includes/admin/tools/data/class-give-tools-recount-form-stats.php 1 patch
Spacing   +53 added lines, -53 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,8 +53,8 @@  discard block
 block discarded – undo
53 53
 	/**
54 54
 	 * Constructor.
55 55
 	 */
56
-	public function __construct( $_step = 1 ) {
57
-		parent::__construct( $_step );
56
+	public function __construct($_step = 1) {
57
+		parent::__construct($_step);
58 58
 
59 59
 		$this->is_writable = true;
60 60
 	}
@@ -69,59 +69,59 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function get_data() {
71 71
 
72
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
72
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
73 73
 
74
-		if ( $this->step == 1 ) {
75
-			$this->delete_data( 'give_temp_recount_form_stats' );
74
+		if ($this->step == 1) {
75
+			$this->delete_data('give_temp_recount_form_stats');
76 76
 		}
77 77
 
78
-		$totals = $this->get_stored_data( 'give_temp_recount_form_stats' );
78
+		$totals = $this->get_stored_data('give_temp_recount_form_stats');
79 79
 
80
-		if ( false === $totals ) {
80
+		if (false === $totals) {
81 81
 			$totals = array(
82 82
 				'earnings' => (float) 0,
83 83
 				'sales'    => 0,
84 84
 			);
85
-			$this->store_data( 'give_temp_recount_form_stats', $totals );
85
+			$this->store_data('give_temp_recount_form_stats', $totals);
86 86
 		}
87 87
 
88
-		$args = apply_filters( 'give_recount_form_stats_args', array(
88
+		$args = apply_filters('give_recount_form_stats_args', array(
89 89
 			'give_forms' => $this->form_id,
90 90
 			'number'     => $this->per_step,
91 91
 			'status'     => $accepted_statuses,
92 92
 			'paged'      => $this->step,
93 93
 			'fields'     => 'ids',
94
-		) );
94
+		));
95 95
 
96
-		$payments = new Give_Payments_Query( $args );
96
+		$payments = new Give_Payments_Query($args);
97 97
 		$payments = $payments->get_payments();
98 98
 
99
-		if ( $payments ) {
100
-			foreach ( $payments as $payment ) {
99
+		if ($payments) {
100
+			foreach ($payments as $payment) {
101 101
 
102 102
 				// Ensure acceptable status only.
103
-				if ( ! in_array( $payment->post_status, $accepted_statuses ) ) {
103
+				if ( ! in_array($payment->post_status, $accepted_statuses)) {
104 104
 					continue;
105 105
 				}
106 106
 
107 107
 				// Ensure only payments for this form are counted.
108
-				if ( $payment->form_id != $this->form_id ) {
108
+				if ($payment->form_id != $this->form_id) {
109 109
 					continue;
110 110
 				}
111 111
 
112
-				$totals['sales'] ++;
112
+				$totals['sales']++;
113 113
 				$totals['earnings'] += $payment->total;
114 114
 
115 115
 			}
116 116
 
117
-			$this->store_data( 'give_temp_recount_form_stats', $totals );
117
+			$this->store_data('give_temp_recount_form_stats', $totals);
118 118
 
119 119
 			return true;
120 120
 		}
121 121
 
122 122
 
123
-		give_update_meta( $this->form_id, '_give_form_sales', $totals['sales'] );
124
-		give_update_meta( $this->form_id, '_give_form_earnings', give_sanitize_amount_for_db( $totals['earnings'] ) );
123
+		give_update_meta($this->form_id, '_give_form_sales', $totals['sales']);
124
+		give_update_meta($this->form_id, '_give_form_earnings', give_sanitize_amount_for_db($totals['earnings']));
125 125
 
126 126
 		return false;
127 127
 	}
@@ -133,35 +133,35 @@  discard block
 block discarded – undo
133 133
 	 * @return int
134 134
 	 */
135 135
 	public function get_percentage_complete() {
136
-		if ( $this->step == 1 ) {
137
-			$this->delete_data( 'give_recount_total_' . $this->form_id );
136
+		if ($this->step == 1) {
137
+			$this->delete_data('give_recount_total_'.$this->form_id);
138 138
 		}
139 139
 
140
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
141
-		$total             = $this->get_stored_data( 'give_recount_total_' . $this->form_id );
140
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
141
+		$total             = $this->get_stored_data('give_recount_total_'.$this->form_id);
142 142
 
143
-		if ( false === $total ) {
143
+		if (false === $total) {
144 144
 			$total = 0;
145
-			$args  = apply_filters( 'give_recount_form_stats_total_args', array(
145
+			$args  = apply_filters('give_recount_form_stats_total_args', array(
146 146
 				'give_forms' => $this->form_id,
147
-				'number'     => - 1,
147
+				'number'     => -1,
148 148
 				'status'     => $accepted_statuses,
149 149
 				'fields'     => 'ids',
150
-			) );
150
+			));
151 151
 
152
-			$payments = new Give_Payments_Query( $args );
153
-			$total    = count( $payments->get_payments() );
154
-			$this->store_data( 'give_recount_total_' . $this->form_id, $total );
152
+			$payments = new Give_Payments_Query($args);
153
+			$total    = count($payments->get_payments());
154
+			$this->store_data('give_recount_total_'.$this->form_id, $total);
155 155
 
156 156
 		}
157 157
 
158 158
 		$percentage = 100;
159 159
 
160
-		if ( $total > 0 ) {
161
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
160
+		if ($total > 0) {
161
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
162 162
 		}
163 163
 
164
-		if ( $percentage > 100 ) {
164
+		if ($percentage > 100) {
165 165
 			$percentage = 100;
166 166
 		}
167 167
 
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 	 *
176 176
 	 * @param array $request The Form Data passed into the batch processing
177 177
 	 */
178
-	public function set_properties( $request ) {
179
-		$this->form_id = isset( $request['form_id'] ) ? sanitize_text_field( $request['form_id'] ) : false;
178
+	public function set_properties($request) {
179
+		$this->form_id = isset($request['form_id']) ? sanitize_text_field($request['form_id']) : false;
180 180
 	}
181 181
 
182 182
 	/**
@@ -187,21 +187,21 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	public function process_step() {
189 189
 
190
-		if ( ! $this->can_export() ) {
191
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
190
+		if ( ! $this->can_export()) {
191
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
192 192
 		}
193 193
 
194 194
 		$had_data = $this->get_data();
195 195
 
196
-		if ( $had_data ) {
196
+		if ($had_data) {
197 197
 			$this->done = false;
198 198
 
199 199
 			return true;
200 200
 		} else {
201
-			$this->delete_data( 'give_recount_total_' . $this->form_id );
202
-			$this->delete_data( 'give_temp_recount_form_stats' );
201
+			$this->delete_data('give_recount_total_'.$this->form_id);
202
+			$this->delete_data('give_temp_recount_form_stats');
203 203
 			$this->done    = true;
204
-			$this->message = sprintf( esc_html__( 'Donation counts and income amount statistics successfully recounted for "%s".', 'give' ), get_the_title( $this->form_id ) );
204
+			$this->message = sprintf(esc_html__('Donation counts and income amount statistics successfully recounted for "%s".', 'give'), get_the_title($this->form_id));
205 205
 
206 206
 			return false;
207 207
 		}
@@ -235,17 +235,17 @@  discard block
 block discarded – undo
235 235
 	 *
236 236
 	 * @return mixed       Returns the data from the database
237 237
 	 */
238
-	private function get_stored_data( $key ) {
238
+	private function get_stored_data($key) {
239 239
 		global $wpdb;
240
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
240
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
241 241
 
242
-		if ( empty( $value ) ) {
242
+		if (empty($value)) {
243 243
 			return false;
244 244
 		}
245 245
 
246
-		$maybe_json = json_decode( $value );
247
-		if ( ! is_null( $maybe_json ) ) {
248
-			$value = json_decode( $value, true );
246
+		$maybe_json = json_decode($value);
247
+		if ( ! is_null($maybe_json)) {
248
+			$value = json_decode($value, true);
249 249
 		}
250 250
 
251 251
 		return $value;
@@ -261,10 +261,10 @@  discard block
 block discarded – undo
261 261
 	 *
262 262
 	 * @return void
263 263
 	 */
264
-	private function store_data( $key, $value ) {
264
+	private function store_data($key, $value) {
265 265
 		global $wpdb;
266 266
 
267
-		$value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value );
267
+		$value = is_array($value) ? wp_json_encode($value) : esc_attr($value);
268 268
 
269 269
 		$data = array(
270 270
 			'option_name'  => $key,
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 			'%s',
279 279
 		);
280 280
 
281
-		$wpdb->replace( $wpdb->options, $data, $formats );
281
+		$wpdb->replace($wpdb->options, $data, $formats);
282 282
 	}
283 283
 
284 284
 	/**
@@ -290,9 +290,9 @@  discard block
 block discarded – undo
290 290
 	 *
291 291
 	 * @return void
292 292
 	 */
293
-	private function delete_data( $key ) {
293
+	private function delete_data($key) {
294 294
 		global $wpdb;
295
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
295
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
296 296
 	}
297 297
 
298 298
 }
299 299
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/tools/data/class-give-tools-recount-income.php 1 patch
Spacing   +47 added lines, -47 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
 
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 	/**
47 47
 	 * Constructor.
48 48
 	 */
49
-	public function __construct( $_step = 1 ) {
50
-		parent::__construct( $_step );
49
+	public function __construct($_step = 1) {
50
+		parent::__construct($_step);
51 51
 
52 52
 		$this->is_writable = true;
53 53
 	}
@@ -61,49 +61,49 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	public function get_data() {
63 63
 
64
-		if ( $this->step == 1 ) {
65
-			$this->delete_data( 'give_temp_recount_earnings' );
64
+		if ($this->step == 1) {
65
+			$this->delete_data('give_temp_recount_earnings');
66 66
 		}
67 67
 
68
-		$total = get_option( 'give_temp_recount_earnings', false );
68
+		$total = get_option('give_temp_recount_earnings', false);
69 69
 
70
-		if ( false === $total ) {
70
+		if (false === $total) {
71 71
 			$total = (float) 0;
72
-			$this->store_data( 'give_temp_recount_earnings', $total );
72
+			$this->store_data('give_temp_recount_earnings', $total);
73 73
 		}
74 74
 
75
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
75
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
76 76
 
77
-		$args = apply_filters( 'give_recount_earnings_args', array(
77
+		$args = apply_filters('give_recount_earnings_args', array(
78 78
 			'number' => $this->per_step,
79 79
 			'page'   => $this->step,
80 80
 			'status' => $accepted_statuses,
81 81
 			'fields' => 'ids'
82
-		) );
82
+		));
83 83
 
84
-		$payments = give_get_payments( $args );
84
+		$payments = give_get_payments($args);
85 85
 
86
-		if ( ! empty( $payments ) ) {
86
+		if ( ! empty($payments)) {
87 87
 
88
-			foreach ( $payments as $payment ) {
88
+			foreach ($payments as $payment) {
89 89
 
90
-				$total += (float) give_donation_amount( $payment, array( 'type' => 'stats' ) );
90
+				$total += (float) give_donation_amount($payment, array('type' => 'stats'));
91 91
 
92 92
 			}
93 93
 
94
-			if ( $total < 0 ) {
94
+			if ($total < 0) {
95 95
 				$totals = 0;
96 96
 			}
97 97
 
98
-			$total = round( $total, give_get_price_decimals() );
98
+			$total = round($total, give_get_price_decimals());
99 99
 
100
-			$this->store_data( 'give_temp_recount_earnings', $total );
100
+			$this->store_data('give_temp_recount_earnings', $total);
101 101
 
102 102
 			return true;
103 103
 
104 104
 		}
105 105
 
106
-		update_option( 'give_earnings_total', $total );
106
+		update_option('give_earnings_total', $total);
107 107
 
108 108
 		return false;
109 109
 
@@ -117,25 +117,25 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function get_percentage_complete() {
119 119
 
120
-		$total = $this->get_stored_data( 'give_recount_earnings_total' );
120
+		$total = $this->get_stored_data('give_recount_earnings_total');
121 121
 
122
-		if ( false === $total ) {
123
-			$args = apply_filters( 'give_recount_earnings_total_args', array() );
122
+		if (false === $total) {
123
+			$args = apply_filters('give_recount_earnings_total_args', array());
124 124
 
125
-			$counts = give_count_payments( $args );
126
-			$total  = absint( $counts->publish );
127
-			$total  = apply_filters( 'give_recount_store_earnings_total', $total );
125
+			$counts = give_count_payments($args);
126
+			$total  = absint($counts->publish);
127
+			$total  = apply_filters('give_recount_store_earnings_total', $total);
128 128
 
129
-			$this->store_data( 'give_recount_earnings_total', $total );
129
+			$this->store_data('give_recount_earnings_total', $total);
130 130
 		}
131 131
 
132 132
 		$percentage = 100;
133 133
 
134
-		if ( $total > 0 ) {
135
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
134
+		if ($total > 0) {
135
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
136 136
 		}
137 137
 
138
-		if ( $percentage > 100 ) {
138
+		if ($percentage > 100) {
139 139
 			$percentage = 100;
140 140
 		}
141 141
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 *
150 150
 	 * @param array $request The Form Data passed into the batch processing
151 151
 	 */
152
-	public function set_properties( $request ) {
152
+	public function set_properties($request) {
153 153
 	}
154 154
 
155 155
 	/**
@@ -160,21 +160,21 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	public function process_step() {
162 162
 
163
-		if ( ! $this->can_export() ) {
164
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
163
+		if ( ! $this->can_export()) {
164
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
165 165
 		}
166 166
 
167 167
 		$had_data = $this->get_data();
168 168
 
169
-		if ( $had_data ) {
169
+		if ($had_data) {
170 170
 			$this->done = false;
171 171
 
172 172
 			return true;
173 173
 		} else {
174
-			$this->delete_data( 'give_recount_earnings_total' );
175
-			$this->delete_data( 'give_temp_recount_earnings' );
174
+			$this->delete_data('give_recount_earnings_total');
175
+			$this->delete_data('give_temp_recount_earnings');
176 176
 			$this->done    = true;
177
-			$this->message = esc_html__( 'Income stats have been successfully recounted.', 'give' );
177
+			$this->message = esc_html__('Income stats have been successfully recounted.', 'give');
178 178
 
179 179
 			return false;
180 180
 		}
@@ -211,17 +211,17 @@  discard block
 block discarded – undo
211 211
 	 *
212 212
 	 * @return mixed       Returns the data from the database
213 213
 	 */
214
-	private function get_stored_data( $key ) {
214
+	private function get_stored_data($key) {
215 215
 		global $wpdb;
216
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
216
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
217 217
 
218
-		if ( empty( $value ) ) {
218
+		if (empty($value)) {
219 219
 			return false;
220 220
 		}
221 221
 
222
-		$maybe_json = json_decode( $value );
223
-		if ( ! is_null( $maybe_json ) ) {
224
-			$value = json_decode( $value, true );
222
+		$maybe_json = json_decode($value);
223
+		if ( ! is_null($maybe_json)) {
224
+			$value = json_decode($value, true);
225 225
 		}
226 226
 
227 227
 		return $value;
@@ -237,10 +237,10 @@  discard block
 block discarded – undo
237 237
 	 *
238 238
 	 * @return void
239 239
 	 */
240
-	private function store_data( $key, $value ) {
240
+	private function store_data($key, $value) {
241 241
 		global $wpdb;
242 242
 
243
-		$value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value );
243
+		$value = is_array($value) ? wp_json_encode($value) : esc_attr($value);
244 244
 
245 245
 		$data = array(
246 246
 			'option_name'  => $key,
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 			'%s',
255 255
 		);
256 256
 
257
-		$wpdb->replace( $wpdb->options, $data, $formats );
257
+		$wpdb->replace($wpdb->options, $data, $formats);
258 258
 	}
259 259
 
260 260
 	/**
@@ -266,9 +266,9 @@  discard block
 block discarded – undo
266 266
 	 *
267 267
 	 * @return void
268 268
 	 */
269
-	private function delete_data( $key ) {
269
+	private function delete_data($key) {
270 270
 		global $wpdb;
271
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
271
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
272 272
 	}
273 273
 
274 274
 }
Please login to merge, or discard this patch.