Test Failed
Push — master ( 1d3b59...426730 )
by Devin
01:16
created
includes/payments/functions.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
  *
566 566
  * @since 1.0
567 567
  *
568
- * @return int $earnings Earnings
568
+ * @return double $earnings Earnings
569 569
  */
570 570
 function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
571 571
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_earnings() method instead.
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
  *
865 865
  * @since 1.0
866 866
  *
867
- * @return array $user_info User Info Meta Values.
867
+ * @return string $user_info User Info Meta Values.
868 868
  */
869 869
 function give_get_payment_meta_user_info( $payment_id ) {
870 870
 	$payment = new Give_Payment( $payment_id );
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
  *
882 882
  * @since 1.0
883 883
  *
884
- * @return int $form_id Form ID.
884
+ * @return string $form_id Form ID.
885 885
  */
886 886
 function give_get_payment_form_id( $payment_id ) {
887 887
 	$payment = new Give_Payment( $payment_id );
@@ -1729,7 +1729,7 @@  discard block
 block discarded – undo
1729 1729
  *
1730 1730
  * Retrieves the form title and appends the level name if present.
1731 1731
  *
1732
- * @param int|Give_Payment $donation Donation Data Object.
1732
+ * @param Give_Payment $donation Donation Data Object.
1733 1733
  * @param array            $args     a. only_level = If set to true will only return the level name if multi-level enabled.
1734 1734
  *                                   b. separator  = The separator between the Form Title and the Donation Level.
1735 1735
  *
Please login to merge, or discard this patch.
Spacing   +380 added lines, -382 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
 
@@ -44,15 +44,15 @@  discard block
 block discarded – undo
44 44
  *
45 45
  * @return array $payments Payments retrieved from the database
46 46
  */
47
-function give_get_payments( $args = array() ) {
47
+function give_get_payments($args = array()) {
48 48
 
49 49
 	// Fallback to post objects to ensure backwards compatibility.
50
-	if ( ! isset( $args['output'] ) ) {
50
+	if ( ! isset($args['output'])) {
51 51
 		$args['output'] = 'posts';
52 52
 	}
53 53
 
54
-	$args     = apply_filters( 'give_get_payments_args', $args );
55
-	$payments = new Give_Payments_Query( $args );
54
+	$args     = apply_filters('give_get_payments_args', $args);
55
+	$payments = new Give_Payments_Query($args);
56 56
 
57 57
 	return $payments->get_payments();
58 58
 }
@@ -67,48 +67,48 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @return mixed
69 69
  */
70
-function give_get_payment_by( $field = '', $value = '' ) {
70
+function give_get_payment_by($field = '', $value = '') {
71 71
 
72
-	if ( empty( $field ) || empty( $value ) ) {
72
+	if (empty($field) || empty($value)) {
73 73
 		return false;
74 74
 	}
75 75
 
76
-	switch ( strtolower( $field ) ) {
76
+	switch (strtolower($field)) {
77 77
 
78 78
 		case 'id':
79
-			$payment = new Give_Payment( $value );
79
+			$payment = new Give_Payment($value);
80 80
 			$id      = $payment->ID;
81 81
 
82
-			if ( empty( $id ) ) {
82
+			if (empty($id)) {
83 83
 				return false;
84 84
 			}
85 85
 
86 86
 			break;
87 87
 
88 88
 		case 'key':
89
-			$payment = give_get_payments( array(
89
+			$payment = give_get_payments(array(
90 90
 				'meta_key'       => '_give_payment_purchase_key',
91 91
 				'meta_value'     => $value,
92 92
 				'posts_per_page' => 1,
93 93
 				'fields'         => 'ids',
94
-			) );
94
+			));
95 95
 
96
-			if ( $payment ) {
97
-				$payment = new Give_Payment( $payment[0] );
96
+			if ($payment) {
97
+				$payment = new Give_Payment($payment[0]);
98 98
 			}
99 99
 
100 100
 			break;
101 101
 
102 102
 		case 'payment_number':
103
-			$payment = give_get_payments( array(
103
+			$payment = give_get_payments(array(
104 104
 				'meta_key'       => '_give_payment_number',
105 105
 				'meta_value'     => $value,
106 106
 				'posts_per_page' => 1,
107 107
 				'fields'         => 'ids',
108
-			) );
108
+			));
109 109
 
110
-			if ( $payment ) {
111
-				$payment = new Give_Payment( $payment[0] );
110
+			if ($payment) {
111
+				$payment = new Give_Payment($payment[0]);
112 112
 			}
113 113
 
114 114
 			break;
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 			return false;
118 118
 	}// End switch().
119 119
 
120
-	if ( $payment ) {
120
+	if ($payment) {
121 121
 		return $payment;
122 122
 	}
123 123
 
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
  *
134 134
  * @return int|bool Payment ID if payment is inserted, false otherwise.
135 135
  */
136
-function give_insert_payment( $payment_data = array() ) {
136
+function give_insert_payment($payment_data = array()) {
137 137
 
138
-	if ( empty( $payment_data ) ) {
138
+	if (empty($payment_data)) {
139 139
 		return false;
140 140
 	}
141 141
 
@@ -146,25 +146,25 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 * @param array $payment_data Arguments passed.
148 148
 	 */
149
-	$payment_data = apply_filters( 'give_pre_insert_payment', $payment_data );
149
+	$payment_data = apply_filters('give_pre_insert_payment', $payment_data);
150 150
 
151 151
 	$payment    = new Give_Payment();
152
-	$gateway    = ! empty( $payment_data['gateway'] ) ? $payment_data['gateway'] : '';
153
-	$gateway    = empty( $gateway ) && isset( $_POST['give-gateway'] ) ? $_POST['give-gateway'] : $gateway;
154
-	$form_id    = isset( $payment_data['give_form_id'] ) ? $payment_data['give_form_id'] : 0;
155
-	$price_id   = give_get_payment_meta_price_id( $payment_data );
156
-	$form_title = isset( $payment_data['give_form_title'] ) ? $payment_data['give_form_title'] : get_the_title( $form_id );
152
+	$gateway    = ! empty($payment_data['gateway']) ? $payment_data['gateway'] : '';
153
+	$gateway    = empty($gateway) && isset($_POST['give-gateway']) ? $_POST['give-gateway'] : $gateway;
154
+	$form_id    = isset($payment_data['give_form_id']) ? $payment_data['give_form_id'] : 0;
155
+	$price_id   = give_get_payment_meta_price_id($payment_data);
156
+	$form_title = isset($payment_data['give_form_title']) ? $payment_data['give_form_title'] : get_the_title($form_id);
157 157
 
158 158
 	// Set properties.
159 159
 	$payment->total          = $payment_data['price'];
160
-	$payment->status         = ! empty( $payment_data['status'] ) ? $payment_data['status'] : 'pending';
161
-	$payment->currency       = ! empty( $payment_data['currency'] ) ? $payment_data['currency'] : give_get_currency( $payment_data['give_form_id'], $payment_data );
160
+	$payment->status         = ! empty($payment_data['status']) ? $payment_data['status'] : 'pending';
161
+	$payment->currency       = ! empty($payment_data['currency']) ? $payment_data['currency'] : give_get_currency($payment_data['give_form_id'], $payment_data);
162 162
 	$payment->user_info      = $payment_data['user_info'];
163 163
 	$payment->gateway        = $gateway;
164 164
 	$payment->form_title     = $form_title;
165 165
 	$payment->form_id        = $form_id;
166 166
 	$payment->price_id       = $price_id;
167
-	$payment->donor_id       = ( ! empty( $payment_data['donor_id'] ) ? $payment_data['donor_id'] : '' );
167
+	$payment->donor_id       = ( ! empty($payment_data['donor_id']) ? $payment_data['donor_id'] : '');
168 168
 	$payment->user_id        = $payment_data['user_info']['id'];
169 169
 	$payment->email          = $payment_data['user_email'];
170 170
 	$payment->first_name     = $payment_data['user_info']['first_name'];
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 	$payment->email          = $payment_data['user_info']['email'];
173 173
 	$payment->ip             = give_get_ip();
174 174
 	$payment->key            = $payment_data['purchase_key'];
175
-	$payment->mode           = ( ! empty( $payment_data['mode'] ) ? (string) $payment_data['mode'] : ( give_is_test_mode() ? 'test' : 'live' ) );
176
-	$payment->parent_payment = ! empty( $payment_data['parent'] ) ? absint( $payment_data['parent'] ) : '';
175
+	$payment->mode           = ( ! empty($payment_data['mode']) ? (string) $payment_data['mode'] : (give_is_test_mode() ? 'test' : 'live'));
176
+	$payment->parent_payment = ! empty($payment_data['parent']) ? absint($payment_data['parent']) : '';
177 177
 
178 178
 	// Add the donation.
179 179
 	$args = array(
@@ -181,19 +181,19 @@  discard block
 block discarded – undo
181 181
 		'price_id' => $payment->price_id,
182 182
 	);
183 183
 
184
-	$payment->add_donation( $payment->form_id, $args );
184
+	$payment->add_donation($payment->form_id, $args);
185 185
 
186 186
 
187 187
 	// Set date if present.
188
-	if ( isset( $payment_data['post_date'] ) ) {
188
+	if (isset($payment_data['post_date'])) {
189 189
 		$payment->date = $payment_data['post_date'];
190 190
 	}
191 191
 
192 192
 	// Handle sequential payments.
193
-	if ( give_get_option( 'enable_sequential' ) ) {
193
+	if (give_get_option('enable_sequential')) {
194 194
 		$number          = give_get_next_payment_number();
195
-		$payment->number = give_format_payment_number( $number );
196
-		update_option( 'give_last_payment_number', $number );
195
+		$payment->number = give_format_payment_number($number);
196
+		update_option('give_last_payment_number', $number);
197 197
 	}
198 198
 
199 199
 	// Save payment.
@@ -207,10 +207,10 @@  discard block
 block discarded – undo
207 207
 	 * @param int   $payment_id   The payment ID.
208 208
 	 * @param array $payment_data Arguments passed.
209 209
 	 */
210
-	do_action( 'give_insert_payment', $payment->ID, $payment_data );
210
+	do_action('give_insert_payment', $payment->ID, $payment_data);
211 211
 
212 212
 	// Return payment ID upon success.
213
-	if ( ! empty( $payment->ID ) ) {
213
+	if ( ! empty($payment->ID)) {
214 214
 		return $payment->ID;
215 215
 	}
216 216
 
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
  *
227 227
  * @return bool|int
228 228
  */
229
-function give_create_payment( $payment_data ) {
229
+function give_create_payment($payment_data) {
230 230
 
231
-	$form_id  = intval( $payment_data['post_data']['give-form-id'] );
232
-	$price_id = isset( $payment_data['post_data']['give-price-id'] ) ? $payment_data['post_data']['give-price-id'] : '';
231
+	$form_id  = intval($payment_data['post_data']['give-form-id']);
232
+	$price_id = isset($payment_data['post_data']['give-price-id']) ? $payment_data['post_data']['give-price-id'] : '';
233 233
 
234 234
 	// Collect payment data.
235 235
 	$insert_payment_data = array(
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 		'date'            => $payment_data['date'],
241 241
 		'user_email'      => $payment_data['user_email'],
242 242
 		'purchase_key'    => $payment_data['purchase_key'],
243
-		'currency'        => give_get_currency( $form_id, $payment_data ),
243
+		'currency'        => give_get_currency($form_id, $payment_data),
244 244
 		'user_info'       => $payment_data['user_info'],
245 245
 		'status'          => 'pending',
246 246
 		'gateway'         => 'paypal',
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
 	 *
254 254
 	 * @param array $insert_payment_data
255 255
 	 */
256
-	$insert_payment_data = apply_filters( 'give_create_payment', $insert_payment_data );
256
+	$insert_payment_data = apply_filters('give_create_payment', $insert_payment_data);
257 257
 
258 258
 	// Record the pending payment.
259
-	return give_insert_payment( $insert_payment_data );
259
+	return give_insert_payment($insert_payment_data);
260 260
 }
261 261
 
262 262
 /**
@@ -269,12 +269,12 @@  discard block
 block discarded – undo
269 269
  *
270 270
  * @return bool
271 271
  */
272
-function give_update_payment_status( $payment_id, $new_status = 'publish' ) {
272
+function give_update_payment_status($payment_id, $new_status = 'publish') {
273 273
 
274 274
 	$updated = false;
275
-	$payment = new Give_Payment( $payment_id );
275
+	$payment = new Give_Payment($payment_id);
276 276
 
277
-	if ( $payment && $payment->ID > 0 ) {
277
+	if ($payment && $payment->ID > 0) {
278 278
 
279 279
 		$payment->status = $new_status;
280 280
 		$updated         = $payment->save();
@@ -295,45 +295,45 @@  discard block
 block discarded – undo
295 295
  *
296 296
  * @return void
297 297
  */
298
-function give_delete_donation( $payment_id = 0, $update_donor = true ) {
299
-	$payment = new Give_Payment( $payment_id );
298
+function give_delete_donation($payment_id = 0, $update_donor = true) {
299
+	$payment = new Give_Payment($payment_id);
300 300
 
301 301
 	// Bailout.
302
-	if ( ! $payment->ID ) {
302
+	if ( ! $payment->ID) {
303 303
 		return;
304 304
 	}
305 305
 
306
-	$amount   = give_donation_amount( $payment_id );
306
+	$amount   = give_donation_amount($payment_id);
307 307
 	$status   = $payment->post_status;
308
-	$donor_id = give_get_payment_donor_id( $payment_id );
309
-	$donor    = new Give_Donor( $donor_id );
308
+	$donor_id = give_get_payment_donor_id($payment_id);
309
+	$donor    = new Give_Donor($donor_id);
310 310
 
311 311
 	// Only undo donations that aren't these statuses.
312
-	$dont_undo_statuses = apply_filters( 'give_undo_donation_statuses', array(
312
+	$dont_undo_statuses = apply_filters('give_undo_donation_statuses', array(
313 313
 		'pending',
314 314
 		'cancelled',
315
-	) );
315
+	));
316 316
 
317
-	if ( ! in_array( $status, $dont_undo_statuses ) ) {
318
-		give_undo_donation( $payment_id );
317
+	if ( ! in_array($status, $dont_undo_statuses)) {
318
+		give_undo_donation($payment_id);
319 319
 	}
320 320
 
321 321
 	// Only undo donations that aren't these statuses.
322
-	$status_to_decrease_stats = apply_filters( 'give_decrease_donor_statuses', array( 'publish' ) );
322
+	$status_to_decrease_stats = apply_filters('give_decrease_donor_statuses', array('publish'));
323 323
 
324
-	if ( in_array( $status, $status_to_decrease_stats ) ) {
324
+	if (in_array($status, $status_to_decrease_stats)) {
325 325
 
326 326
 		// Only decrease earnings if they haven't already been decreased (or were never increased for this payment).
327
-		give_decrease_total_earnings( $amount );
327
+		give_decrease_total_earnings($amount);
328 328
 
329 329
 		// @todo: Refresh only range related stat cache
330 330
 		give_delete_donation_stats();
331 331
 
332
-		if ( $donor->id && $update_donor ) {
332
+		if ($donor->id && $update_donor) {
333 333
 
334 334
 			// Decrement the stats for the donor.
335 335
 			$donor->decrease_donation_count();
336
-			$donor->decrease_value( $amount );
336
+			$donor->decrease_value($amount);
337 337
 
338 338
 		}
339 339
 	}
@@ -345,18 +345,18 @@  discard block
 block discarded – undo
345 345
 	 *
346 346
 	 * @since 1.0
347 347
 	 */
348
-	do_action( 'give_payment_delete', $payment_id );
348
+	do_action('give_payment_delete', $payment_id);
349 349
 
350
-	if ( $donor->id && $update_donor ) {
350
+	if ($donor->id && $update_donor) {
351 351
 		// Remove the payment ID from the donor.
352
-		$donor->remove_payment( $payment_id );
352
+		$donor->remove_payment($payment_id);
353 353
 	}
354 354
 
355 355
 	// Remove the payment.
356
-	wp_delete_post( $payment_id, true );
356
+	wp_delete_post($payment_id, true);
357 357
 
358 358
 	// Remove related sale log entries.
359
-	Give()->logs->delete_logs( $payment_id );
359
+	Give()->logs->delete_logs($payment_id);
360 360
 
361 361
 	/**
362 362
 	 * Fires after payment deleted.
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 *
366 366
 	 * @since 1.0
367 367
 	 */
368
-	do_action( 'give_payment_deleted', $payment_id );
368
+	do_action('give_payment_deleted', $payment_id);
369 369
 }
370 370
 
371 371
 /**
@@ -380,20 +380,20 @@  discard block
 block discarded – undo
380 380
  *
381 381
  * @return void
382 382
  */
383
-function give_undo_donation( $payment_id ) {
383
+function give_undo_donation($payment_id) {
384 384
 
385
-	$payment = new Give_Payment( $payment_id );
385
+	$payment = new Give_Payment($payment_id);
386 386
 
387
-	$maybe_decrease_earnings = apply_filters( 'give_decrease_earnings_on_undo', true, $payment, $payment->form_id );
388
-	if ( true === $maybe_decrease_earnings ) {
387
+	$maybe_decrease_earnings = apply_filters('give_decrease_earnings_on_undo', true, $payment, $payment->form_id);
388
+	if (true === $maybe_decrease_earnings) {
389 389
 		// Decrease earnings.
390
-		give_decrease_form_earnings( $payment->form_id, $payment->total );
390
+		give_decrease_form_earnings($payment->form_id, $payment->total);
391 391
 	}
392 392
 
393
-	$maybe_decrease_donations = apply_filters( 'give_decrease_donations_on_undo', true, $payment, $payment->form_id );
394
-	if ( true === $maybe_decrease_donations ) {
393
+	$maybe_decrease_donations = apply_filters('give_decrease_donations_on_undo', true, $payment, $payment->form_id);
394
+	if (true === $maybe_decrease_donations) {
395 395
 		// Decrease donation count.
396
-		give_decrease_donation_count( $payment->form_id );
396
+		give_decrease_donation_count($payment->form_id);
397 397
 	}
398 398
 
399 399
 }
@@ -410,21 +410,21 @@  discard block
 block discarded – undo
410 410
  *
411 411
  * @return object $stats Contains the number of payments per payment status.
412 412
  */
413
-function give_count_payments( $args = array() ) {
413
+function give_count_payments($args = array()) {
414 414
 	// Backward compatibility.
415
-	if ( ! empty( $args['start-date'] ) ) {
415
+	if ( ! empty($args['start-date'])) {
416 416
 		$args['start_date'] = $args['start-date'];
417
-		unset( $args['start-date'] );
417
+		unset($args['start-date']);
418 418
 	}
419 419
 
420
-	if ( ! empty( $args['end-date'] ) ) {
420
+	if ( ! empty($args['end-date'])) {
421 421
 		$args['end_date'] = $args['end-date'];
422
-		unset( $args['end-date'] );
422
+		unset($args['end-date']);
423 423
 	}
424 424
 
425
-	if ( ! empty( $args['form_id'] ) ) {
425
+	if ( ! empty($args['form_id'])) {
426 426
 		$args['give_forms'] = $args['form_id'];
427
-		unset( $args['form_id'] );
427
+		unset($args['form_id']);
428 428
 	}
429 429
 
430 430
 	// Extract all donations
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 	$args['group_by']    = 'post_status';
433 433
 	$args['count']       = 'true';
434 434
 
435
-	$donations_obj   = new Give_Payments_Query( $args );
435
+	$donations_obj   = new Give_Payments_Query($args);
436 436
 	$donations_count = $donations_obj->get_payment_by_group();
437 437
 
438 438
 	/**
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 *
441 441
 	 * @since 1.0
442 442
 	 */
443
-	return (object) apply_filters( 'give_count_payments', $donations_count, $args, $donations_obj );
443
+	return (object) apply_filters('give_count_payments', $donations_count, $args, $donations_obj);
444 444
 }
445 445
 
446 446
 
@@ -453,11 +453,11 @@  discard block
 block discarded – undo
453 453
  *
454 454
  * @return bool $exists True if payment exists, false otherwise.
455 455
  */
456
-function give_check_for_existing_payment( $payment_id ) {
456
+function give_check_for_existing_payment($payment_id) {
457 457
 	$exists  = false;
458
-	$payment = new Give_Payment( $payment_id );
458
+	$payment = new Give_Payment($payment_id);
459 459
 
460
-	if ( $payment_id === $payment->ID && 'publish' === $payment->status ) {
460
+	if ($payment_id === $payment->ID && 'publish' === $payment->status) {
461 461
 		$exists = true;
462 462
 	}
463 463
 
@@ -475,41 +475,41 @@  discard block
 block discarded – undo
475 475
  *
476 476
  * @return bool|mixed True if payment status exists, false otherwise.
477 477
  */
478
-function give_get_payment_status( $payment, $return_label = false ) {
478
+function give_get_payment_status($payment, $return_label = false) {
479 479
 
480
-	if ( is_numeric( $payment ) ) {
480
+	if (is_numeric($payment)) {
481 481
 
482
-		$payment = new Give_Payment( $payment );
482
+		$payment = new Give_Payment($payment);
483 483
 
484
-		if ( ! $payment->ID > 0 ) {
484
+		if ( ! $payment->ID > 0) {
485 485
 			return false;
486 486
 		}
487 487
 
488 488
 	}
489 489
 
490
-	if ( ! is_object( $payment ) || ! isset( $payment->post_status ) ) {
490
+	if ( ! is_object($payment) || ! isset($payment->post_status)) {
491 491
 		return false;
492 492
 	}
493 493
 
494 494
 	$statuses = give_get_payment_statuses();
495 495
 
496
-	if ( ! is_array( $statuses ) || empty( $statuses ) ) {
496
+	if ( ! is_array($statuses) || empty($statuses)) {
497 497
 		return false;
498 498
 	}
499 499
 
500 500
 	// Get payment object if not already given.
501
-	$payment = $payment instanceof Give_Payment ? $payment : new Give_Payment( $payment->ID );
501
+	$payment = $payment instanceof Give_Payment ? $payment : new Give_Payment($payment->ID);
502 502
 
503
-	if ( array_key_exists( $payment->status, $statuses ) ) {
504
-		if ( true === $return_label ) {
503
+	if (array_key_exists($payment->status, $statuses)) {
504
+		if (true === $return_label) {
505 505
 			// Return translated status label.
506
-			return $statuses[ $payment->status ];
506
+			return $statuses[$payment->status];
507 507
 		} else {
508 508
 			// Account that our 'publish' status is labeled 'Complete'
509 509
 			$post_status = 'publish' === $payment->status ? 'Complete' : $payment->post_status;
510 510
 
511 511
 			// Make sure we're matching cases, since they matter
512
-			return array_search( strtolower( $post_status ), array_map( 'strtolower', $statuses ) );
512
+			return array_search(strtolower($post_status), array_map('strtolower', $statuses));
513 513
 		}
514 514
 	}
515 515
 
@@ -525,18 +525,18 @@  discard block
 block discarded – undo
525 525
  */
526 526
 function give_get_payment_statuses() {
527 527
 	$payment_statuses = array(
528
-		'pending'     => __( 'Pending', 'give' ),
529
-		'publish'     => __( 'Complete', 'give' ),
530
-		'refunded'    => __( 'Refunded', 'give' ),
531
-		'failed'      => __( 'Failed', 'give' ),
532
-		'cancelled'   => __( 'Cancelled', 'give' ),
533
-		'abandoned'   => __( 'Abandoned', 'give' ),
534
-		'preapproval' => __( 'Pre-Approved', 'give' ),
535
-		'processing'  => __( 'Processing', 'give' ),
536
-		'revoked'     => __( 'Revoked', 'give' ),
528
+		'pending'     => __('Pending', 'give'),
529
+		'publish'     => __('Complete', 'give'),
530
+		'refunded'    => __('Refunded', 'give'),
531
+		'failed'      => __('Failed', 'give'),
532
+		'cancelled'   => __('Cancelled', 'give'),
533
+		'abandoned'   => __('Abandoned', 'give'),
534
+		'preapproval' => __('Pre-Approved', 'give'),
535
+		'processing'  => __('Processing', 'give'),
536
+		'revoked'     => __('Revoked', 'give'),
537 537
 	);
538 538
 
539
-	return apply_filters( 'give_payment_statuses', $payment_statuses );
539
+	return apply_filters('give_payment_statuses', $payment_statuses);
540 540
 }
541 541
 
542 542
 /**
@@ -549,10 +549,10 @@  discard block
 block discarded – undo
549 549
  * @return array $payment_status All the available payment statuses.
550 550
  */
551 551
 function give_get_payment_status_keys() {
552
-	$statuses = array_keys( give_get_payment_statuses() );
553
-	asort( $statuses );
552
+	$statuses = array_keys(give_get_payment_statuses());
553
+	asort($statuses);
554 554
 
555
-	return array_values( $statuses );
555
+	return array_values($statuses);
556 556
 }
557 557
 
558 558
 /**
@@ -567,44 +567,44 @@  discard block
 block discarded – undo
567 567
  *
568 568
  * @return int $earnings Earnings
569 569
  */
570
-function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
570
+function give_get_earnings_by_date($day = null, $month_num, $year = null, $hour = null) {
571 571
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_earnings() method instead.
572 572
 
573 573
 	global $wpdb;
574
-	$meta_table = __give_v20_bc_table_details( 'payment' );
574
+	$meta_table = __give_v20_bc_table_details('payment');
575 575
 
576 576
 	$args = array(
577 577
 		'post_type'              => 'give_payment',
578 578
 		'nopaging'               => true,
579 579
 		'year'                   => $year,
580 580
 		'monthnum'               => $month_num,
581
-		'post_status'            => array( 'publish' ),
581
+		'post_status'            => array('publish'),
582 582
 		'fields'                 => 'ids',
583 583
 		'update_post_term_cache' => false,
584 584
 	);
585
-	if ( ! empty( $day ) ) {
585
+	if ( ! empty($day)) {
586 586
 		$args['day'] = $day;
587 587
 	}
588 588
 
589
-	if ( isset( $hour ) ) {
589
+	if (isset($hour)) {
590 590
 		$args['hour'] = $hour;
591 591
 	}
592 592
 
593
-	$args = apply_filters( 'give_get_earnings_by_date_args', $args );
594
-	$key  = Give_Cache::get_key( 'give_stats', $args );
593
+	$args = apply_filters('give_get_earnings_by_date_args', $args);
594
+	$key  = Give_Cache::get_key('give_stats', $args);
595 595
 
596
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
596
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
597 597
 		$earnings = false;
598 598
 	} else {
599
-		$earnings = Give_Cache::get( $key );
599
+		$earnings = Give_Cache::get($key);
600 600
 	}
601 601
 
602
-	if ( false === $earnings ) {
603
-		$donations = get_posts( $args );
602
+	if (false === $earnings) {
603
+		$donations = get_posts($args);
604 604
 		$earnings  = 0;
605
-		if ( $donations ) {
606
-			$donations      = implode( ',', $donations );
607
-			$earning_totals = $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$donations})" );
605
+		if ($donations) {
606
+			$donations      = implode(',', $donations);
607
+			$earning_totals = $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$donations})");
608 608
 
609 609
 			/**
610 610
 			 * Filter The earnings by dates.
@@ -615,13 +615,13 @@  discard block
 block discarded – undo
615 615
 			 * @param array $donations      Donations lists.
616 616
 			 * @param array $args           Donation query args.
617 617
 			 */
618
-			$earnings = apply_filters( 'give_get_earnings_by_date', $earning_totals, $donations, $args );
618
+			$earnings = apply_filters('give_get_earnings_by_date', $earning_totals, $donations, $args);
619 619
 		}
620 620
 		// Cache the results for one hour.
621
-		Give_Cache::set( $key, $earnings, HOUR_IN_SECONDS );
621
+		Give_Cache::set($key, $earnings, HOUR_IN_SECONDS);
622 622
 	}
623 623
 
624
-	return round( $earnings, 2 );
624
+	return round($earnings, 2);
625 625
 }
626 626
 
627 627
 /**
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
  *
637 637
  * @return int $count Sales
638 638
  */
639
-function give_get_sales_by_date( $day = null, $month_num = null, $year = null, $hour = null ) {
639
+function give_get_sales_by_date($day = null, $month_num = null, $year = null, $hour = null) {
640 640
 
641 641
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_sales() method instead.
642 642
 	$args = array(
@@ -644,14 +644,14 @@  discard block
 block discarded – undo
644 644
 		'nopaging'               => true,
645 645
 		'year'                   => $year,
646 646
 		'fields'                 => 'ids',
647
-		'post_status'            => array( 'publish' ),
647
+		'post_status'            => array('publish'),
648 648
 		'update_post_meta_cache' => false,
649 649
 		'update_post_term_cache' => false,
650 650
 	);
651 651
 
652
-	$show_free = apply_filters( 'give_sales_by_date_show_free', true, $args );
652
+	$show_free = apply_filters('give_sales_by_date_show_free', true, $args);
653 653
 
654
-	if ( false === $show_free ) {
654
+	if (false === $show_free) {
655 655
 		$args['meta_query'] = array(
656 656
 			array(
657 657
 				'key'     => '_give_payment_total',
@@ -662,33 +662,33 @@  discard block
 block discarded – undo
662 662
 		);
663 663
 	}
664 664
 
665
-	if ( ! empty( $month_num ) ) {
665
+	if ( ! empty($month_num)) {
666 666
 		$args['monthnum'] = $month_num;
667 667
 	}
668 668
 
669
-	if ( ! empty( $day ) ) {
669
+	if ( ! empty($day)) {
670 670
 		$args['day'] = $day;
671 671
 	}
672 672
 
673
-	if ( isset( $hour ) ) {
673
+	if (isset($hour)) {
674 674
 		$args['hour'] = $hour;
675 675
 	}
676 676
 
677
-	$args = apply_filters( 'give_get_sales_by_date_args', $args );
677
+	$args = apply_filters('give_get_sales_by_date_args', $args);
678 678
 
679
-	$key = Give_Cache::get_key( 'give_stats', $args );
679
+	$key = Give_Cache::get_key('give_stats', $args);
680 680
 
681
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
681
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
682 682
 		$count = false;
683 683
 	} else {
684
-		$count = Give_Cache::get( $key );
684
+		$count = Give_Cache::get($key);
685 685
 	}
686 686
 
687
-	if ( false === $count ) {
688
-		$donations = new WP_Query( $args );
687
+	if (false === $count) {
688
+		$donations = new WP_Query($args);
689 689
 		$count     = (int) $donations->post_count;
690 690
 		// Cache the results for one hour.
691
-		Give_Cache::set( $key, $count, HOUR_IN_SECONDS );
691
+		Give_Cache::set($key, $count, HOUR_IN_SECONDS);
692 692
 	}
693 693
 
694 694
 	return $count;
@@ -703,19 +703,19 @@  discard block
 block discarded – undo
703 703
  *
704 704
  * @return bool $ret True if complete, false otherwise.
705 705
  */
706
-function give_is_payment_complete( $payment_id ) {
707
-	$payment = new Give_Payment( $payment_id );
706
+function give_is_payment_complete($payment_id) {
707
+	$payment = new Give_Payment($payment_id);
708 708
 
709 709
 	$ret = false;
710 710
 
711
-	if ( $payment->ID > 0 ) {
711
+	if ($payment->ID > 0) {
712 712
 
713
-		if ( (int) $payment_id === (int) $payment->ID && 'publish' == $payment->status ) {
713
+		if ((int) $payment_id === (int) $payment->ID && 'publish' == $payment->status) {
714 714
 			$ret = true;
715 715
 		}
716 716
 	}
717 717
 
718
-	return apply_filters( 'give_is_payment_complete', $ret, $payment_id, $payment->post_status );
718
+	return apply_filters('give_is_payment_complete', $ret, $payment_id, $payment->post_status);
719 719
 }
720 720
 
721 721
 /**
@@ -741,50 +741,50 @@  discard block
 block discarded – undo
741 741
  *
742 742
  * @return float $total Total earnings.
743 743
  */
744
-function give_get_total_earnings( $recalculate = false ) {
744
+function give_get_total_earnings($recalculate = false) {
745 745
 
746
-	$total      = get_option( 'give_earnings_total', 0 );
747
-	$meta_table = __give_v20_bc_table_details( 'payment' );
746
+	$total      = get_option('give_earnings_total', 0);
747
+	$meta_table = __give_v20_bc_table_details('payment');
748 748
 
749 749
 	// Calculate total earnings.
750
-	if ( ! $total || $recalculate ) {
750
+	if ( ! $total || $recalculate) {
751 751
 		global $wpdb;
752 752
 
753 753
 		$total = (float) 0;
754 754
 
755
-		$args = apply_filters( 'give_get_total_earnings_args', array(
755
+		$args = apply_filters('give_get_total_earnings_args', array(
756 756
 			'offset' => 0,
757
-			'number' => - 1,
758
-			'status' => array( 'publish' ),
757
+			'number' => -1,
758
+			'status' => array('publish'),
759 759
 			'fields' => 'ids',
760
-		) );
760
+		));
761 761
 
762
-		$payments = give_get_payments( $args );
763
-		if ( $payments ) {
762
+		$payments = give_get_payments($args);
763
+		if ($payments) {
764 764
 
765 765
 			/**
766 766
 			 * If performing a donation, we need to skip the very last payment in the database,
767 767
 			 * since it calls give_increase_total_earnings() on completion,
768 768
 			 * which results in duplicated earnings for the very first donation.
769 769
 			 */
770
-			if ( did_action( 'give_update_payment_status' ) ) {
771
-				array_pop( $payments );
770
+			if (did_action('give_update_payment_status')) {
771
+				array_pop($payments);
772 772
 			}
773 773
 
774
-			if ( ! empty( $payments ) ) {
775
-				$payments = implode( ',', $payments );
776
-				$total    += $wpdb->get_var( "SELECT SUM(meta_value) FROM {$meta_table['name']} WHERE meta_key = '_give_payment_total' AND {$meta_table['column']['id']} IN({$payments})" );
774
+			if ( ! empty($payments)) {
775
+				$payments = implode(',', $payments);
776
+				$total += $wpdb->get_var("SELECT SUM(meta_value) FROM {$meta_table['name']} WHERE meta_key = '_give_payment_total' AND {$meta_table['column']['id']} IN({$payments})");
777 777
 			}
778 778
 		}
779 779
 
780
-		update_option( 'give_earnings_total', $total, 'no' );
780
+		update_option('give_earnings_total', $total, 'no');
781 781
 	}
782 782
 
783
-	if ( $total < 0 ) {
783
+	if ($total < 0) {
784 784
 		$total = 0; // Don't ever show negative earnings.
785 785
 	}
786 786
 
787
-	return apply_filters( 'give_total_earnings', round( $total, give_get_price_decimals() ), $total );
787
+	return apply_filters('give_total_earnings', round($total, give_get_price_decimals()), $total);
788 788
 }
789 789
 
790 790
 /**
@@ -796,10 +796,10 @@  discard block
 block discarded – undo
796 796
  *
797 797
  * @return float $total Total earnings.
798 798
  */
799
-function give_increase_total_earnings( $amount = 0 ) {
799
+function give_increase_total_earnings($amount = 0) {
800 800
 	$total = give_get_total_earnings();
801 801
 	$total += $amount;
802
-	update_option( 'give_earnings_total', $total );
802
+	update_option('give_earnings_total', $total);
803 803
 
804 804
 	return $total;
805 805
 }
@@ -813,13 +813,13 @@  discard block
 block discarded – undo
813 813
  *
814 814
  * @return float $total Total earnings.
815 815
  */
816
-function give_decrease_total_earnings( $amount = 0 ) {
816
+function give_decrease_total_earnings($amount = 0) {
817 817
 	$total = give_get_total_earnings();
818 818
 	$total -= $amount;
819
-	if ( $total < 0 ) {
819
+	if ($total < 0) {
820 820
 		$total = 0;
821 821
 	}
822
-	update_option( 'give_earnings_total', $total );
822
+	update_option('give_earnings_total', $total);
823 823
 
824 824
 	return $total;
825 825
 }
@@ -835,10 +835,10 @@  discard block
 block discarded – undo
835 835
  *
836 836
  * @return mixed $meta Payment Meta.
837 837
  */
838
-function give_get_payment_meta( $payment_id = 0, $meta_key = '_give_payment_meta', $single = true ) {
839
-	$payment = new Give_Payment( $payment_id );
838
+function give_get_payment_meta($payment_id = 0, $meta_key = '_give_payment_meta', $single = true) {
839
+	$payment = new Give_Payment($payment_id);
840 840
 
841
-	return $payment->get_meta( $meta_key, $single );
841
+	return $payment->get_meta($meta_key, $single);
842 842
 }
843 843
 
844 844
 /**
@@ -851,10 +851,10 @@  discard block
 block discarded – undo
851 851
  *
852 852
  * @return mixed Meta ID if successful, false if unsuccessful.
853 853
  */
854
-function give_update_payment_meta( $payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '' ) {
855
-	$payment = new Give_Payment( $payment_id );
854
+function give_update_payment_meta($payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '') {
855
+	$payment = new Give_Payment($payment_id);
856 856
 
857
-	return $payment->update_meta( $meta_key, $meta_value, $prev_value );
857
+	return $payment->update_meta($meta_key, $meta_value, $prev_value);
858 858
 }
859 859
 
860 860
 /**
@@ -866,8 +866,8 @@  discard block
 block discarded – undo
866 866
  *
867 867
  * @return array $user_info User Info Meta Values.
868 868
  */
869
-function give_get_payment_meta_user_info( $payment_id ) {
870
-	$payment = new Give_Payment( $payment_id );
869
+function give_get_payment_meta_user_info($payment_id) {
870
+	$payment = new Give_Payment($payment_id);
871 871
 
872 872
 	return $payment->user_info;
873 873
 }
@@ -883,8 +883,8 @@  discard block
 block discarded – undo
883 883
  *
884 884
  * @return int $form_id Form ID.
885 885
  */
886
-function give_get_payment_form_id( $payment_id ) {
887
-	$payment = new Give_Payment( $payment_id );
886
+function give_get_payment_form_id($payment_id) {
887
+	$payment = new Give_Payment($payment_id);
888 888
 
889 889
 	return $payment->form_id;
890 890
 }
@@ -898,8 +898,8 @@  discard block
 block discarded – undo
898 898
  *
899 899
  * @return string $email User email.
900 900
  */
901
-function give_get_payment_user_email( $payment_id ) {
902
-	$payment = new Give_Payment( $payment_id );
901
+function give_get_payment_user_email($payment_id) {
902
+	$payment = new Give_Payment($payment_id);
903 903
 
904 904
 	return $payment->email;
905 905
 }
@@ -913,11 +913,11 @@  discard block
 block discarded – undo
913 913
  *
914 914
  * @return bool $is_guest_payment If the payment is associated with a user (false) or not (true)
915 915
  */
916
-function give_is_guest_payment( $payment_id ) {
917
-	$payment_user_id  = give_get_payment_user_id( $payment_id );
918
-	$is_guest_payment = ! empty( $payment_user_id ) && $payment_user_id > 0 ? false : true;
916
+function give_is_guest_payment($payment_id) {
917
+	$payment_user_id  = give_get_payment_user_id($payment_id);
918
+	$is_guest_payment = ! empty($payment_user_id) && $payment_user_id > 0 ? false : true;
919 919
 
920
-	return (bool) apply_filters( 'give_is_guest_payment', $is_guest_payment, $payment_id );
920
+	return (bool) apply_filters('give_is_guest_payment', $is_guest_payment, $payment_id);
921 921
 }
922 922
 
923 923
 /**
@@ -929,8 +929,8 @@  discard block
 block discarded – undo
929 929
  *
930 930
  * @return int $user_id User ID.
931 931
  */
932
-function give_get_payment_user_id( $payment_id ) {
933
-	$payment = new Give_Payment( $payment_id );
932
+function give_get_payment_user_id($payment_id) {
933
+	$payment = new Give_Payment($payment_id);
934 934
 
935 935
 	return $payment->user_id;
936 936
 }
@@ -944,8 +944,8 @@  discard block
 block discarded – undo
944 944
  *
945 945
  * @return int $payment->customer_id Donor ID.
946 946
  */
947
-function give_get_payment_donor_id( $payment_id ) {
948
-	$payment = new Give_Payment( $payment_id );
947
+function give_get_payment_donor_id($payment_id) {
948
+	$payment = new Give_Payment($payment_id);
949 949
 
950 950
 	return $payment->customer_id;
951 951
 }
@@ -959,8 +959,8 @@  discard block
 block discarded – undo
959 959
  *
960 960
  * @return string $ip User IP.
961 961
  */
962
-function give_get_payment_user_ip( $payment_id ) {
963
-	$payment = new Give_Payment( $payment_id );
962
+function give_get_payment_user_ip($payment_id) {
963
+	$payment = new Give_Payment($payment_id);
964 964
 
965 965
 	return $payment->ip;
966 966
 }
@@ -974,8 +974,8 @@  discard block
 block discarded – undo
974 974
  *
975 975
  * @return string $date The date the payment was completed.
976 976
  */
977
-function give_get_payment_completed_date( $payment_id = 0 ) {
978
-	$payment = new Give_Payment( $payment_id );
977
+function give_get_payment_completed_date($payment_id = 0) {
978
+	$payment = new Give_Payment($payment_id);
979 979
 
980 980
 	return $payment->completed_date;
981 981
 }
@@ -989,8 +989,8 @@  discard block
 block discarded – undo
989 989
  *
990 990
  * @return string $gateway Gateway.
991 991
  */
992
-function give_get_payment_gateway( $payment_id ) {
993
-	$payment = new Give_Payment( $payment_id );
992
+function give_get_payment_gateway($payment_id) {
993
+	$payment = new Give_Payment($payment_id);
994 994
 
995 995
 	return $payment->gateway;
996 996
 }
@@ -1004,8 +1004,8 @@  discard block
 block discarded – undo
1004 1004
  *
1005 1005
  * @return string $currency The currency code.
1006 1006
  */
1007
-function give_get_payment_currency_code( $payment_id = 0 ) {
1008
-	$payment = new Give_Payment( $payment_id );
1007
+function give_get_payment_currency_code($payment_id = 0) {
1008
+	$payment = new Give_Payment($payment_id);
1009 1009
 
1010 1010
 	return $payment->currency;
1011 1011
 }
@@ -1019,10 +1019,10 @@  discard block
 block discarded – undo
1019 1019
  *
1020 1020
  * @return string $currency The currency name.
1021 1021
  */
1022
-function give_get_payment_currency( $payment_id = 0 ) {
1023
-	$currency = give_get_payment_currency_code( $payment_id );
1022
+function give_get_payment_currency($payment_id = 0) {
1023
+	$currency = give_get_payment_currency_code($payment_id);
1024 1024
 
1025
-	return apply_filters( 'give_payment_currency', give_get_currency_name( $currency ), $payment_id );
1025
+	return apply_filters('give_payment_currency', give_get_currency_name($currency), $payment_id);
1026 1026
 }
1027 1027
 
1028 1028
 /**
@@ -1034,8 +1034,8 @@  discard block
 block discarded – undo
1034 1034
  *
1035 1035
  * @return string $key Donation key.
1036 1036
  */
1037
-function give_get_payment_key( $payment_id = 0 ) {
1038
-	$payment = new Give_Payment( $payment_id );
1037
+function give_get_payment_key($payment_id = 0) {
1038
+	$payment = new Give_Payment($payment_id);
1039 1039
 
1040 1040
 	return $payment->key;
1041 1041
 }
@@ -1051,8 +1051,8 @@  discard block
 block discarded – undo
1051 1051
  *
1052 1052
  * @return string $number Payment order number.
1053 1053
  */
1054
-function give_get_payment_number( $payment_id = 0 ) {
1055
-	$payment = new Give_Payment( $payment_id );
1054
+function give_get_payment_number($payment_id = 0) {
1055
+	$payment = new Give_Payment($payment_id);
1056 1056
 
1057 1057
 	return $payment->number;
1058 1058
 }
@@ -1066,23 +1066,23 @@  discard block
 block discarded – undo
1066 1066
  *
1067 1067
  * @return string      The formatted payment number.
1068 1068
  */
1069
-function give_format_payment_number( $number ) {
1069
+function give_format_payment_number($number) {
1070 1070
 
1071
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1071
+	if ( ! give_get_option('enable_sequential')) {
1072 1072
 		return $number;
1073 1073
 	}
1074 1074
 
1075
-	if ( ! is_numeric( $number ) ) {
1075
+	if ( ! is_numeric($number)) {
1076 1076
 		return $number;
1077 1077
 	}
1078 1078
 
1079
-	$prefix  = give_get_option( 'sequential_prefix' );
1080
-	$number  = absint( $number );
1081
-	$postfix = give_get_option( 'sequential_postfix' );
1079
+	$prefix  = give_get_option('sequential_prefix');
1080
+	$number  = absint($number);
1081
+	$postfix = give_get_option('sequential_postfix');
1082 1082
 
1083
-	$formatted_number = $prefix . $number . $postfix;
1083
+	$formatted_number = $prefix.$number.$postfix;
1084 1084
 
1085
-	return apply_filters( 'give_format_payment_number', $formatted_number, $prefix, $number, $postfix );
1085
+	return apply_filters('give_format_payment_number', $formatted_number, $prefix, $number, $postfix);
1086 1086
 }
1087 1087
 
1088 1088
 /**
@@ -1096,17 +1096,17 @@  discard block
 block discarded – undo
1096 1096
  */
1097 1097
 function give_get_next_payment_number() {
1098 1098
 
1099
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1099
+	if ( ! give_get_option('enable_sequential')) {
1100 1100
 		return false;
1101 1101
 	}
1102 1102
 
1103
-	$number           = get_option( 'give_last_payment_number' );
1104
-	$start            = give_get_option( 'sequential_start', 1 );
1103
+	$number           = get_option('give_last_payment_number');
1104
+	$start            = give_get_option('sequential_start', 1);
1105 1105
 	$increment_number = true;
1106 1106
 
1107
-	if ( false !== $number ) {
1107
+	if (false !== $number) {
1108 1108
 
1109
-		if ( empty( $number ) ) {
1109
+		if (empty($number)) {
1110 1110
 
1111 1111
 			$number           = $start;
1112 1112
 			$increment_number = false;
@@ -1115,24 +1115,24 @@  discard block
 block discarded – undo
1115 1115
 	} else {
1116 1116
 
1117 1117
 		// This case handles the first addition of the new option, as well as if it get's deleted for any reason.
1118
-		$payments     = new Give_Payments_Query( array(
1118
+		$payments = new Give_Payments_Query(array(
1119 1119
 			'number'  => 1,
1120 1120
 			'order'   => 'DESC',
1121 1121
 			'orderby' => 'ID',
1122 1122
 			'output'  => 'posts',
1123 1123
 			'fields'  => 'ids',
1124
-		) );
1124
+		));
1125 1125
 		$last_payment = $payments->get_payments();
1126 1126
 
1127
-		if ( ! empty( $last_payment ) ) {
1127
+		if ( ! empty($last_payment)) {
1128 1128
 
1129
-			$number = give_get_payment_number( $last_payment[0] );
1129
+			$number = give_get_payment_number($last_payment[0]);
1130 1130
 
1131 1131
 		}
1132 1132
 
1133
-		if ( ! empty( $number ) && $number !== (int) $last_payment[0] ) {
1133
+		if ( ! empty($number) && $number !== (int) $last_payment[0]) {
1134 1134
 
1135
-			$number = give_remove_payment_prefix_postfix( $number );
1135
+			$number = give_remove_payment_prefix_postfix($number);
1136 1136
 
1137 1137
 		} else {
1138 1138
 
@@ -1141,13 +1141,13 @@  discard block
 block discarded – undo
1141 1141
 		}
1142 1142
 	}// End if().
1143 1143
 
1144
-	$increment_number = apply_filters( 'give_increment_payment_number', $increment_number, $number );
1144
+	$increment_number = apply_filters('give_increment_payment_number', $increment_number, $number);
1145 1145
 
1146
-	if ( $increment_number ) {
1147
-		$number ++;
1146
+	if ($increment_number) {
1147
+		$number++;
1148 1148
 	}
1149 1149
 
1150
-	return apply_filters( 'give_get_next_payment_number', $number );
1150
+	return apply_filters('give_get_next_payment_number', $number);
1151 1151
 }
1152 1152
 
1153 1153
 /**
@@ -1159,25 +1159,25 @@  discard block
 block discarded – undo
1159 1159
  *
1160 1160
  * @return string The new Payment number without prefix and postfix.
1161 1161
  */
1162
-function give_remove_payment_prefix_postfix( $number ) {
1162
+function give_remove_payment_prefix_postfix($number) {
1163 1163
 
1164
-	$prefix  = give_get_option( 'sequential_prefix' );
1165
-	$postfix = give_get_option( 'sequential_postfix' );
1164
+	$prefix  = give_get_option('sequential_prefix');
1165
+	$postfix = give_get_option('sequential_postfix');
1166 1166
 
1167 1167
 	// Remove prefix.
1168
-	$number = preg_replace( '/' . $prefix . '/', '', $number, 1 );
1168
+	$number = preg_replace('/'.$prefix.'/', '', $number, 1);
1169 1169
 
1170 1170
 	// Remove the postfix.
1171
-	$length      = strlen( $number );
1172
-	$postfix_pos = strrpos( $number, $postfix );
1173
-	if ( false !== $postfix_pos ) {
1174
-		$number = substr_replace( $number, '', $postfix_pos, $length );
1171
+	$length      = strlen($number);
1172
+	$postfix_pos = strrpos($number, $postfix);
1173
+	if (false !== $postfix_pos) {
1174
+		$number = substr_replace($number, '', $postfix_pos, $length);
1175 1175
 	}
1176 1176
 
1177 1177
 	// Ensure it's a whole number.
1178
-	$number = intval( $number );
1178
+	$number = intval($number);
1179 1179
 
1180
-	return apply_filters( 'give_remove_payment_prefix_postfix', $number, $prefix, $postfix );
1180
+	return apply_filters('give_remove_payment_prefix_postfix', $number, $prefix, $postfix);
1181 1181
 
1182 1182
 }
1183 1183
 
@@ -1195,16 +1195,16 @@  discard block
 block discarded – undo
1195 1195
  *
1196 1196
  * @return string $amount Fully formatted donation amount.
1197 1197
  */
1198
-function give_donation_amount( $donation, $format_args = array() ) {
1198
+function give_donation_amount($donation, $format_args = array()) {
1199 1199
 	/* @var Give_Payment $donation */
1200
-	if ( ! ( $donation instanceof Give_Payment ) ) {
1201
-		$donation = new Give_Payment( absint( $donation ) );
1200
+	if ( ! ($donation instanceof Give_Payment)) {
1201
+		$donation = new Give_Payment(absint($donation));
1202 1202
 	}
1203 1203
 
1204 1204
 	$amount           = $donation->total;
1205 1205
 	$formatted_amount = $amount;
1206 1206
 
1207
-	if ( is_bool( $format_args ) ) {
1207
+	if (is_bool($format_args)) {
1208 1208
 		$format_args = array(
1209 1209
 			'currency' => (bool) $format_args,
1210 1210
 			'amount'   => (bool) $format_args,
@@ -1227,27 +1227,25 @@  discard block
 block discarded – undo
1227 1227
 		)
1228 1228
 	);
1229 1229
 
1230
-	if ( $format_args['amount'] || $format_args['currency'] ) {
1230
+	if ($format_args['amount'] || $format_args['currency']) {
1231 1231
 
1232
-		if ( $format_args['amount'] ) {
1232
+		if ($format_args['amount']) {
1233 1233
 
1234 1234
 			$formatted_amount = give_format_amount(
1235 1235
 				$amount,
1236
-				! is_array( $format_args['amount'] ) ?
1236
+				! is_array($format_args['amount']) ?
1237 1237
 					array(
1238 1238
 						'sanitize' => false,
1239 1239
 						'currency' => $donation->currency,
1240
-					) :
1241
-					$format_args['amount']
1240
+					) : $format_args['amount']
1242 1241
 			);
1243 1242
 		}
1244 1243
 
1245
-		if ( $format_args['currency'] ) {
1244
+		if ($format_args['currency']) {
1246 1245
 			$formatted_amount = give_currency_filter(
1247 1246
 				$formatted_amount,
1248
-				! is_array( $format_args['currency'] ) ?
1249
-					array( 'currency_code' => $donation->currency ) :
1250
-					$format_args['currency']
1247
+				! is_array($format_args['currency']) ?
1248
+					array('currency_code' => $donation->currency) : $format_args['currency']
1251 1249
 			);
1252 1250
 		}
1253 1251
 	}
@@ -1262,7 +1260,7 @@  discard block
 block discarded – undo
1262 1260
 	 * @param int    $donation_id      Donation ID.
1263 1261
 	 * @param string $type             Donation amount type.
1264 1262
 	 */
1265
-	return apply_filters( 'give_donation_amount', (string) $formatted_amount, $amount, $donation, $format_args );
1263
+	return apply_filters('give_donation_amount', (string) $formatted_amount, $amount, $donation, $format_args);
1266 1264
 }
1267 1265
 
1268 1266
 /**
@@ -1279,10 +1277,10 @@  discard block
 block discarded – undo
1279 1277
  *
1280 1278
  * @return array Fully formatted payment subtotal.
1281 1279
  */
1282
-function give_payment_subtotal( $payment_id = 0 ) {
1283
-	$subtotal = give_get_payment_subtotal( $payment_id );
1280
+function give_payment_subtotal($payment_id = 0) {
1281
+	$subtotal = give_get_payment_subtotal($payment_id);
1284 1282
 
1285
-	return give_currency_filter( give_format_amount( $subtotal, array( 'sanitize' => false ) ), array( 'currency_code' => give_get_payment_currency_code( $payment_id ) ) );
1283
+	return give_currency_filter(give_format_amount($subtotal, array('sanitize' => false)), array('currency_code' => give_get_payment_currency_code($payment_id)));
1286 1284
 }
1287 1285
 
1288 1286
 /**
@@ -1296,8 +1294,8 @@  discard block
 block discarded – undo
1296 1294
  *
1297 1295
  * @return float $subtotal Subtotal for payment (non formatted).
1298 1296
  */
1299
-function give_get_payment_subtotal( $payment_id = 0 ) {
1300
-	$payment = new Give_Payment( $payment_id );
1297
+function give_get_payment_subtotal($payment_id = 0) {
1298
+	$payment = new Give_Payment($payment_id);
1301 1299
 
1302 1300
 	return $payment->subtotal;
1303 1301
 }
@@ -1311,8 +1309,8 @@  discard block
 block discarded – undo
1311 1309
  *
1312 1310
  * @return string The donation ID.
1313 1311
  */
1314
-function give_get_payment_transaction_id( $payment_id = 0 ) {
1315
-	$payment = new Give_Payment( $payment_id );
1312
+function give_get_payment_transaction_id($payment_id = 0) {
1313
+	$payment = new Give_Payment($payment_id);
1316 1314
 
1317 1315
 	return $payment->transaction_id;
1318 1316
 }
@@ -1327,15 +1325,15 @@  discard block
 block discarded – undo
1327 1325
  *
1328 1326
  * @return bool|mixed
1329 1327
  */
1330
-function give_set_payment_transaction_id( $payment_id = 0, $transaction_id = '' ) {
1328
+function give_set_payment_transaction_id($payment_id = 0, $transaction_id = '') {
1331 1329
 
1332
-	if ( empty( $payment_id ) || empty( $transaction_id ) ) {
1330
+	if (empty($payment_id) || empty($transaction_id)) {
1333 1331
 		return false;
1334 1332
 	}
1335 1333
 
1336
-	$transaction_id = apply_filters( 'give_set_payment_transaction_id', $transaction_id, $payment_id );
1334
+	$transaction_id = apply_filters('give_set_payment_transaction_id', $transaction_id, $payment_id);
1337 1335
 
1338
-	return give_update_payment_meta( $payment_id, '_give_payment_transaction_id', $transaction_id );
1336
+	return give_update_payment_meta($payment_id, '_give_payment_transaction_id', $transaction_id);
1339 1337
 }
1340 1338
 
1341 1339
 /**
@@ -1348,10 +1346,10 @@  discard block
 block discarded – undo
1348 1346
  *
1349 1347
  * @return int $purchase Donation ID.
1350 1348
  */
1351
-function give_get_donation_id_by_key( $key ) {
1349
+function give_get_donation_id_by_key($key) {
1352 1350
 	global $wpdb;
1353 1351
 
1354
-	$meta_table = __give_v20_bc_table_details( 'payment' );
1352
+	$meta_table = __give_v20_bc_table_details('payment');
1355 1353
 
1356 1354
 	$purchase = $wpdb->get_var(
1357 1355
 		$wpdb->prepare(
@@ -1367,7 +1365,7 @@  discard block
 block discarded – undo
1367 1365
 		)
1368 1366
 	);
1369 1367
 
1370
-	if ( $purchase != null ) {
1368
+	if ($purchase != null) {
1371 1369
 		return $purchase;
1372 1370
 	}
1373 1371
 
@@ -1385,13 +1383,13 @@  discard block
 block discarded – undo
1385 1383
  *
1386 1384
  * @return int $purchase Donation ID.
1387 1385
  */
1388
-function give_get_purchase_id_by_transaction_id( $key ) {
1386
+function give_get_purchase_id_by_transaction_id($key) {
1389 1387
 	global $wpdb;
1390
-	$meta_table = __give_v20_bc_table_details( 'payment' );
1388
+	$meta_table = __give_v20_bc_table_details('payment');
1391 1389
 
1392
-	$purchase = $wpdb->get_var( $wpdb->prepare( "SELECT {$meta_table['column']['id']} FROM {$meta_table['name']} WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key ) );
1390
+	$purchase = $wpdb->get_var($wpdb->prepare("SELECT {$meta_table['column']['id']} FROM {$meta_table['name']} WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key));
1393 1391
 
1394
-	if ( $purchase != null ) {
1392
+	if ($purchase != null) {
1395 1393
 		return $purchase;
1396 1394
 	}
1397 1395
 
@@ -1408,23 +1406,23 @@  discard block
 block discarded – undo
1408 1406
  *
1409 1407
  * @return array $notes Donation Notes
1410 1408
  */
1411
-function give_get_payment_notes( $payment_id = 0, $search = '' ) {
1409
+function give_get_payment_notes($payment_id = 0, $search = '') {
1412 1410
 
1413
-	if ( empty( $payment_id ) && empty( $search ) ) {
1411
+	if (empty($payment_id) && empty($search)) {
1414 1412
 		return false;
1415 1413
 	}
1416 1414
 
1417
-	remove_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1418
-	remove_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10 );
1415
+	remove_action('pre_get_comments', 'give_hide_payment_notes', 10);
1416
+	remove_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10);
1419 1417
 
1420
-	$notes = get_comments( array(
1418
+	$notes = get_comments(array(
1421 1419
 		'post_id' => $payment_id,
1422 1420
 		'order'   => 'ASC',
1423 1421
 		'search'  => $search,
1424
-	) );
1422
+	));
1425 1423
 
1426
-	add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1427
-	add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1424
+	add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1425
+	add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1428 1426
 
1429 1427
 	return $notes;
1430 1428
 }
@@ -1440,8 +1438,8 @@  discard block
 block discarded – undo
1440 1438
  *
1441 1439
  * @return int The new note ID
1442 1440
  */
1443
-function give_insert_payment_note( $payment_id = 0, $note = '' ) {
1444
-	if ( empty( $payment_id ) ) {
1441
+function give_insert_payment_note($payment_id = 0, $note = '') {
1442
+	if (empty($payment_id)) {
1445 1443
 		return false;
1446 1444
 	}
1447 1445
 
@@ -1453,14 +1451,14 @@  discard block
 block discarded – undo
1453 1451
 	 *
1454 1452
 	 * @since 1.0
1455 1453
 	 */
1456
-	do_action( 'give_pre_insert_payment_note', $payment_id, $note );
1454
+	do_action('give_pre_insert_payment_note', $payment_id, $note);
1457 1455
 
1458
-	$note_id = wp_insert_comment( wp_filter_comment( array(
1456
+	$note_id = wp_insert_comment(wp_filter_comment(array(
1459 1457
 		'comment_post_ID'      => $payment_id,
1460 1458
 		'comment_content'      => $note,
1461 1459
 		'user_id'              => is_admin() ? get_current_user_id() : 0,
1462
-		'comment_date'         => current_time( 'mysql' ),
1463
-		'comment_date_gmt'     => current_time( 'mysql', 1 ),
1460
+		'comment_date'         => current_time('mysql'),
1461
+		'comment_date_gmt'     => current_time('mysql', 1),
1464 1462
 		'comment_approved'     => 1,
1465 1463
 		'comment_parent'       => 0,
1466 1464
 		'comment_author'       => '',
@@ -1469,7 +1467,7 @@  discard block
 block discarded – undo
1469 1467
 		'comment_author_email' => '',
1470 1468
 		'comment_type'         => 'give_payment_note',
1471 1469
 
1472
-	) ) );
1470
+	)));
1473 1471
 
1474 1472
 	/**
1475 1473
 	 * Fires after payment note inserted.
@@ -1480,7 +1478,7 @@  discard block
 block discarded – undo
1480 1478
 	 *
1481 1479
 	 * @since 1.0
1482 1480
 	 */
1483
-	do_action( 'give_insert_payment_note', $note_id, $payment_id, $note );
1481
+	do_action('give_insert_payment_note', $note_id, $payment_id, $note);
1484 1482
 
1485 1483
 	return $note_id;
1486 1484
 }
@@ -1495,8 +1493,8 @@  discard block
 block discarded – undo
1495 1493
  *
1496 1494
  * @return bool True on success, false otherwise.
1497 1495
  */
1498
-function give_delete_payment_note( $comment_id = 0, $payment_id = 0 ) {
1499
-	if ( empty( $comment_id ) ) {
1496
+function give_delete_payment_note($comment_id = 0, $payment_id = 0) {
1497
+	if (empty($comment_id)) {
1500 1498
 		return false;
1501 1499
 	}
1502 1500
 
@@ -1508,9 +1506,9 @@  discard block
 block discarded – undo
1508 1506
 	 *
1509 1507
 	 * @since 1.0
1510 1508
 	 */
1511
-	do_action( 'give_pre_delete_payment_note', $comment_id, $payment_id );
1509
+	do_action('give_pre_delete_payment_note', $comment_id, $payment_id);
1512 1510
 
1513
-	$ret = wp_delete_comment( $comment_id, true );
1511
+	$ret = wp_delete_comment($comment_id, true);
1514 1512
 
1515 1513
 	/**
1516 1514
 	 * Fires after donation note deleted.
@@ -1520,7 +1518,7 @@  discard block
 block discarded – undo
1520 1518
 	 *
1521 1519
 	 * @since 1.0
1522 1520
 	 */
1523
-	do_action( 'give_post_delete_payment_note', $comment_id, $payment_id );
1521
+	do_action('give_post_delete_payment_note', $comment_id, $payment_id);
1524 1522
 
1525 1523
 	return $ret;
1526 1524
 }
@@ -1535,32 +1533,32 @@  discard block
 block discarded – undo
1535 1533
  *
1536 1534
  * @return string
1537 1535
  */
1538
-function give_get_payment_note_html( $note, $payment_id = 0 ) {
1536
+function give_get_payment_note_html($note, $payment_id = 0) {
1539 1537
 
1540
-	if ( is_numeric( $note ) ) {
1541
-		$note = get_comment( $note );
1538
+	if (is_numeric($note)) {
1539
+		$note = get_comment($note);
1542 1540
 	}
1543 1541
 
1544
-	if ( ! empty( $note->user_id ) ) {
1545
-		$user = get_userdata( $note->user_id );
1542
+	if ( ! empty($note->user_id)) {
1543
+		$user = get_userdata($note->user_id);
1546 1544
 		$user = $user->display_name;
1547 1545
 	} else {
1548
-		$user = __( 'System', 'give' );
1546
+		$user = __('System', 'give');
1549 1547
 	}
1550 1548
 
1551
-	$date_format = give_date_format() . ', ' . get_option( 'time_format' );
1549
+	$date_format = give_date_format().', '.get_option('time_format');
1552 1550
 
1553
-	$delete_note_url = wp_nonce_url( add_query_arg( array(
1551
+	$delete_note_url = wp_nonce_url(add_query_arg(array(
1554 1552
 		'give-action' => 'delete_payment_note',
1555 1553
 		'note_id'     => $note->comment_ID,
1556 1554
 		'payment_id'  => $payment_id,
1557
-	) ), 'give_delete_payment_note_' . $note->comment_ID );
1555
+	)), 'give_delete_payment_note_'.$note->comment_ID);
1558 1556
 
1559
-	$note_html = '<div class="give-payment-note" id="give-payment-note-' . $note->comment_ID . '">';
1557
+	$note_html = '<div class="give-payment-note" id="give-payment-note-'.$note->comment_ID.'">';
1560 1558
 	$note_html .= '<p>';
1561
-	$note_html .= '<strong>' . $user . '</strong>&nbsp;&ndash;&nbsp;<span style="color:#aaa;font-style:italic;">' . date_i18n( $date_format, strtotime( $note->comment_date ) ) . '</span><br/>';
1559
+	$note_html .= '<strong>'.$user.'</strong>&nbsp;&ndash;&nbsp;<span style="color:#aaa;font-style:italic;">'.date_i18n($date_format, strtotime($note->comment_date)).'</span><br/>';
1562 1560
 	$note_html .= $note->comment_content;
1563
-	$note_html .= '&nbsp;&ndash;&nbsp;<a href="' . esc_url( $delete_note_url ) . '" class="give-delete-payment-note" data-note-id="' . absint( $note->comment_ID ) . '" data-payment-id="' . absint( $payment_id ) . '" aria-label="' . __( 'Delete this donation note.', 'give' ) . '">' . __( 'Delete', 'give' ) . '</a>';
1561
+	$note_html .= '&nbsp;&ndash;&nbsp;<a href="'.esc_url($delete_note_url).'" class="give-delete-payment-note" data-note-id="'.absint($note->comment_ID).'" data-payment-id="'.absint($payment_id).'" aria-label="'.__('Delete this donation note.', 'give').'">'.__('Delete', 'give').'</a>';
1564 1562
 	$note_html .= '</p>';
1565 1563
 	$note_html .= '</div>';
1566 1564
 
@@ -1578,18 +1576,18 @@  discard block
 block discarded – undo
1578 1576
  *
1579 1577
  * @return void
1580 1578
  */
1581
-function give_hide_payment_notes( $query ) {
1582
-	if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '>=' ) ) {
1583
-		$types = isset( $query->query_vars['type__not_in'] ) ? $query->query_vars['type__not_in'] : array();
1584
-		if ( ! is_array( $types ) ) {
1585
-			$types = array( $types );
1579
+function give_hide_payment_notes($query) {
1580
+	if (version_compare(floatval(get_bloginfo('version')), '4.1', '>=')) {
1581
+		$types = isset($query->query_vars['type__not_in']) ? $query->query_vars['type__not_in'] : array();
1582
+		if ( ! is_array($types)) {
1583
+			$types = array($types);
1586 1584
 		}
1587 1585
 		$types[]                           = 'give_payment_note';
1588 1586
 		$query->query_vars['type__not_in'] = $types;
1589 1587
 	}
1590 1588
 }
1591 1589
 
1592
-add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1590
+add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1593 1591
 
1594 1592
 /**
1595 1593
  * Exclude notes (comments) on give_payment post type from showing in Recent Comments widgets
@@ -1601,15 +1599,15 @@  discard block
 block discarded – undo
1601 1599
  *
1602 1600
  * @return array $clauses Updated comment clauses.
1603 1601
  */
1604
-function give_hide_payment_notes_pre_41( $clauses, $wp_comment_query ) {
1605
-	if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '<' ) ) {
1602
+function give_hide_payment_notes_pre_41($clauses, $wp_comment_query) {
1603
+	if (version_compare(floatval(get_bloginfo('version')), '4.1', '<')) {
1606 1604
 		$clauses['where'] .= ' AND comment_type != "give_payment_note"';
1607 1605
 	}
1608 1606
 
1609 1607
 	return $clauses;
1610 1608
 }
1611 1609
 
1612
-add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1610
+add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1613 1611
 
1614 1612
 
1615 1613
 /**
@@ -1622,15 +1620,15 @@  discard block
 block discarded – undo
1622 1620
  *
1623 1621
  * @return string $where
1624 1622
  */
1625
-function give_hide_payment_notes_from_feeds( $where, $wp_comment_query ) {
1623
+function give_hide_payment_notes_from_feeds($where, $wp_comment_query) {
1626 1624
 	global $wpdb;
1627 1625
 
1628
-	$where .= $wpdb->prepare( ' AND comment_type != %s', 'give_payment_note' );
1626
+	$where .= $wpdb->prepare(' AND comment_type != %s', 'give_payment_note');
1629 1627
 
1630 1628
 	return $where;
1631 1629
 }
1632 1630
 
1633
-add_filter( 'comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2 );
1631
+add_filter('comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2);
1634 1632
 
1635 1633
 
1636 1634
 /**
@@ -1644,32 +1642,32 @@  discard block
 block discarded – undo
1644 1642
  *
1645 1643
  * @return array|object Array of comment counts.
1646 1644
  */
1647
-function give_remove_payment_notes_in_comment_counts( $stats, $post_id ) {
1645
+function give_remove_payment_notes_in_comment_counts($stats, $post_id) {
1648 1646
 	global $wpdb, $pagenow;
1649 1647
 
1650
-	if ( 'index.php' != $pagenow ) {
1648
+	if ('index.php' != $pagenow) {
1651 1649
 		return $stats;
1652 1650
 	}
1653 1651
 
1654 1652
 	$post_id = (int) $post_id;
1655 1653
 
1656
-	if ( apply_filters( 'give_count_payment_notes_in_comments', false ) ) {
1654
+	if (apply_filters('give_count_payment_notes_in_comments', false)) {
1657 1655
 		return $stats;
1658 1656
 	}
1659 1657
 
1660
-	$stats = Give_Cache::get_group( "comments-{$post_id}", 'counts' );
1658
+	$stats = Give_Cache::get_group("comments-{$post_id}", 'counts');
1661 1659
 
1662
-	if ( ! is_null( $stats ) ) {
1660
+	if ( ! is_null($stats)) {
1663 1661
 		return $stats;
1664 1662
 	}
1665 1663
 
1666 1664
 	$where = 'WHERE comment_type != "give_payment_note"';
1667 1665
 
1668
-	if ( $post_id > 0 ) {
1669
-		$where .= $wpdb->prepare( ' AND comment_post_ID = %d', $post_id );
1666
+	if ($post_id > 0) {
1667
+		$where .= $wpdb->prepare(' AND comment_post_ID = %d', $post_id);
1670 1668
 	}
1671 1669
 
1672
-	$count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A );
1670
+	$count = $wpdb->get_results("SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A);
1673 1671
 
1674 1672
 	$total    = 0;
1675 1673
 	$approved = array(
@@ -1679,30 +1677,30 @@  discard block
 block discarded – undo
1679 1677
 		'trash'        => 'trash',
1680 1678
 		'post-trashed' => 'post-trashed',
1681 1679
 	);
1682
-	foreach ( (array) $count as $row ) {
1680
+	foreach ((array) $count as $row) {
1683 1681
 		// Don't count post-trashed toward totals.
1684
-		if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) {
1682
+		if ('post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved']) {
1685 1683
 			$total += $row['num_comments'];
1686 1684
 		}
1687
-		if ( isset( $approved[ $row['comment_approved'] ] ) ) {
1688
-			$stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments'];
1685
+		if (isset($approved[$row['comment_approved']])) {
1686
+			$stats[$approved[$row['comment_approved']]] = $row['num_comments'];
1689 1687
 		}
1690 1688
 	}
1691 1689
 
1692 1690
 	$stats['total_comments'] = $total;
1693
-	foreach ( $approved as $key ) {
1694
-		if ( empty( $stats[ $key ] ) ) {
1695
-			$stats[ $key ] = 0;
1691
+	foreach ($approved as $key) {
1692
+		if (empty($stats[$key])) {
1693
+			$stats[$key] = 0;
1696 1694
 		}
1697 1695
 	}
1698 1696
 
1699 1697
 	$stats = (object) $stats;
1700
-	Give_Cache::set_group( "comments-{$post_id}", $stats, 'counts' );
1698
+	Give_Cache::set_group("comments-{$post_id}", $stats, 'counts');
1701 1699
 
1702 1700
 	return $stats;
1703 1701
 }
1704 1702
 
1705
-add_filter( 'wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2 );
1703
+add_filter('wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2);
1706 1704
 
1707 1705
 
1708 1706
 /**
@@ -1715,9 +1713,9 @@  discard block
 block discarded – undo
1715 1713
  *
1716 1714
  * @return string $where Modified where clause.
1717 1715
  */
1718
-function give_filter_where_older_than_week( $where = '' ) {
1716
+function give_filter_where_older_than_week($where = '') {
1719 1717
 	// Payments older than one week.
1720
-	$start = date( 'Y-m-d', strtotime( '-7 days' ) );
1718
+	$start = date('Y-m-d', strtotime('-7 days'));
1721 1719
 	$where .= " AND post_date <= '{$start}'";
1722 1720
 
1723 1721
 	return $where;
@@ -1737,13 +1735,13 @@  discard block
 block discarded – undo
1737 1735
  *
1738 1736
  * @return string $form_title Returns the full title if $only_level is false, otherwise returns the levels title.
1739 1737
  */
1740
-function give_get_donation_form_title( $donation, $args = array() ) {
1738
+function give_get_donation_form_title($donation, $args = array()) {
1741 1739
 
1742
-	if ( ! $donation instanceof Give_Payment ) {
1743
-		$donation = new Give_Payment( $donation );
1740
+	if ( ! $donation instanceof Give_Payment) {
1741
+		$donation = new Give_Payment($donation);
1744 1742
 	}
1745 1743
 
1746
-	if( ! $donation->ID ) {
1744
+	if ( ! $donation->ID) {
1747 1745
 		return '';
1748 1746
 	}
1749 1747
 
@@ -1752,7 +1750,7 @@  discard block
 block discarded – undo
1752 1750
 		'separator'  => '',
1753 1751
 	);
1754 1752
 
1755
-	$args = wp_parse_args( $args, $defaults );
1753
+	$args = wp_parse_args($args, $defaults);
1756 1754
 
1757 1755
 	$form_id     = $donation->form_id;
1758 1756
 	$price_id    = $donation->price_id;
@@ -1773,32 +1771,32 @@  discard block
 block discarded – undo
1773 1771
 		, false
1774 1772
 	);
1775 1773
 
1776
-	$form_title_html = Give_Cache::get_db_query( $cache_key );
1774
+	$form_title_html = Give_Cache::get_db_query($cache_key);
1777 1775
 
1778
-	if ( is_null( $form_title_html ) ) {
1779
-		if ( true === $only_level ) {
1776
+	if (is_null($form_title_html)) {
1777
+		if (true === $only_level) {
1780 1778
 			$form_title = '';
1781 1779
 		}
1782 1780
 
1783 1781
 		$form_title_html = $form_title;
1784 1782
 
1785
-		if ( 'custom' === $price_id ) {
1786
-			$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
1787
-			$level_label        = ! empty( $custom_amount_text ) ? $custom_amount_text : __( 'Custom Amount', 'give' );
1788
-		} elseif ( give_has_variable_prices( $form_id ) ) {
1789
-			$level_label = give_get_price_option_name( $form_id, $price_id, $donation->ID, false );
1783
+		if ('custom' === $price_id) {
1784
+			$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
1785
+			$level_label        = ! empty($custom_amount_text) ? $custom_amount_text : __('Custom Amount', 'give');
1786
+		} elseif (give_has_variable_prices($form_id)) {
1787
+			$level_label = give_get_price_option_name($form_id, $price_id, $donation->ID, false);
1790 1788
 		}
1791 1789
 
1792 1790
 		// Only add separator if there is a form title.
1793 1791
 		if (
1794
-			! empty( $form_title_html ) &&
1795
-			! empty( $level_label )
1792
+			! empty($form_title_html) &&
1793
+			! empty($level_label)
1796 1794
 		) {
1797 1795
 			$form_title_html .= " {$separator} ";
1798 1796
 		}
1799 1797
 
1800 1798
 		$form_title_html .= "<span class=\"donation-level-text-wrap\">{$level_label}</span>";
1801
-		Give_Cache::set_db_query( $cache_key, $form_title_html );
1799
+		Give_Cache::set_db_query($cache_key, $form_title_html);
1802 1800
 	}
1803 1801
 
1804 1802
 	/**
@@ -1806,7 +1804,7 @@  discard block
 block discarded – undo
1806 1804
 	 *
1807 1805
 	 * @since 1.0
1808 1806
 	 */
1809
-	return apply_filters( 'give_get_donation_form_title', $form_title_html, $donation->payment_meta, $donation );
1807
+	return apply_filters('give_get_donation_form_title', $form_title_html, $donation->payment_meta, $donation);
1810 1808
 }
1811 1809
 
1812 1810
 /**
@@ -1819,19 +1817,19 @@  discard block
 block discarded – undo
1819 1817
  *
1820 1818
  * @return string $price_id
1821 1819
  */
1822
-function give_get_price_id( $form_id, $price ) {
1820
+function give_get_price_id($form_id, $price) {
1823 1821
 	$price_id = null;
1824 1822
 
1825
-	if ( give_has_variable_prices( $form_id ) ) {
1823
+	if (give_has_variable_prices($form_id)) {
1826 1824
 
1827
-		$levels = give_get_meta( $form_id, '_give_donation_levels', true );
1825
+		$levels = give_get_meta($form_id, '_give_donation_levels', true);
1828 1826
 
1829
-		foreach ( $levels as $level ) {
1827
+		foreach ($levels as $level) {
1830 1828
 
1831
-			$level_amount = give_maybe_sanitize_amount( $level['_give_amount'] );
1829
+			$level_amount = give_maybe_sanitize_amount($level['_give_amount']);
1832 1830
 
1833 1831
 			// Check that this indeed the recurring price.
1834
-			if ( $level_amount == $price ) {
1832
+			if ($level_amount == $price) {
1835 1833
 
1836 1834
 				$price_id = $level['_give_id']['level_id'];
1837 1835
 				break;
@@ -1839,13 +1837,13 @@  discard block
 block discarded – undo
1839 1837
 			}
1840 1838
 		}
1841 1839
 
1842
-		if ( is_null( $price_id ) && give_is_custom_price_mode( $form_id ) ) {
1840
+		if (is_null($price_id) && give_is_custom_price_mode($form_id)) {
1843 1841
 			$price_id = 'custom';
1844 1842
 		}
1845 1843
 	}
1846 1844
 
1847 1845
 	// Price ID must be numeric or string.
1848
-	$price_id = ! is_numeric( $price_id ) && ! is_string( $price_id ) ? 0 : $price_id;
1846
+	$price_id = ! is_numeric($price_id) && ! is_string($price_id) ? 0 : $price_id;
1849 1847
 
1850 1848
 	/**
1851 1849
 	 * Filter the price id
@@ -1855,7 +1853,7 @@  discard block
 block discarded – undo
1855 1853
 	 * @param string $price_id
1856 1854
 	 * @param int    $form_id
1857 1855
 	 */
1858
-	return apply_filters( 'give_get_price_id', $price_id, $form_id );
1856
+	return apply_filters('give_get_price_id', $price_id, $form_id);
1859 1857
 }
1860 1858
 
1861 1859
 /**
@@ -1871,10 +1869,10 @@  discard block
 block discarded – undo
1871 1869
  *
1872 1870
  * @return string
1873 1871
  */
1874
-function give_get_form_dropdown( $args = array(), $echo = false ) {
1875
-	$form_dropdown_html = Give()->html->forms_dropdown( $args );
1872
+function give_get_form_dropdown($args = array(), $echo = false) {
1873
+	$form_dropdown_html = Give()->html->forms_dropdown($args);
1876 1874
 
1877
-	if ( ! $echo ) {
1875
+	if ( ! $echo) {
1878 1876
 		return $form_dropdown_html;
1879 1877
 	}
1880 1878
 
@@ -1891,17 +1889,17 @@  discard block
 block discarded – undo
1891 1889
  *
1892 1890
  * @return string|bool
1893 1891
  */
1894
-function give_get_form_variable_price_dropdown( $args = array(), $echo = false ) {
1892
+function give_get_form_variable_price_dropdown($args = array(), $echo = false) {
1895 1893
 
1896 1894
 	// Check for give form id.
1897
-	if ( empty( $args['id'] ) ) {
1895
+	if (empty($args['id'])) {
1898 1896
 		return false;
1899 1897
 	}
1900 1898
 
1901
-	$form = new Give_Donate_Form( $args['id'] );
1899
+	$form = new Give_Donate_Form($args['id']);
1902 1900
 
1903 1901
 	// Check if form has variable prices or not.
1904
-	if ( ! $form->ID || ! $form->has_variable_prices() ) {
1902
+	if ( ! $form->ID || ! $form->has_variable_prices()) {
1905 1903
 		return false;
1906 1904
 	}
1907 1905
 
@@ -1909,24 +1907,24 @@  discard block
 block discarded – undo
1909 1907
 	$variable_price_options = array();
1910 1908
 
1911 1909
 	// Check if multi donation form support custom donation or not.
1912
-	if ( $form->is_custom_price_mode() ) {
1913
-		$variable_price_options['custom'] = _x( 'Custom', 'custom donation dropdown item', 'give' );
1910
+	if ($form->is_custom_price_mode()) {
1911
+		$variable_price_options['custom'] = _x('Custom', 'custom donation dropdown item', 'give');
1914 1912
 	}
1915 1913
 
1916 1914
 	// Get variable price and ID from variable price array.
1917
-	foreach ( $variable_prices as $variable_price ) {
1918
-		$variable_price_options[ $variable_price['_give_id']['level_id'] ] = ! empty( $variable_price['_give_text'] ) ? $variable_price['_give_text'] : give_currency_filter( give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) ) );
1915
+	foreach ($variable_prices as $variable_price) {
1916
+		$variable_price_options[$variable_price['_give_id']['level_id']] = ! empty($variable_price['_give_text']) ? $variable_price['_give_text'] : give_currency_filter(give_format_amount($variable_price['_give_amount'], array('sanitize' => false)));
1919 1917
 	}
1920 1918
 
1921 1919
 	// Update options.
1922
-	$args = array_merge( $args, array(
1920
+	$args = array_merge($args, array(
1923 1921
 		'options' => $variable_price_options,
1924
-	) );
1922
+	));
1925 1923
 
1926 1924
 	// Generate select html.
1927
-	$form_dropdown_html = Give()->html->select( $args );
1925
+	$form_dropdown_html = Give()->html->select($args);
1928 1926
 
1929
-	if ( ! $echo ) {
1927
+	if ( ! $echo) {
1930 1928
 		return $form_dropdown_html;
1931 1929
 	}
1932 1930
 
@@ -1945,14 +1943,14 @@  discard block
 block discarded – undo
1945 1943
  *
1946 1944
  * @return string
1947 1945
  */
1948
-function give_get_payment_meta_price_id( $payment_meta ) {
1946
+function give_get_payment_meta_price_id($payment_meta) {
1949 1947
 
1950
-	if ( isset( $payment_meta['give_price_id'] ) ) {
1948
+	if (isset($payment_meta['give_price_id'])) {
1951 1949
 		$price_id = $payment_meta['give_price_id'];
1952
-	} elseif ( isset( $payment_meta['price_id'] ) ) {
1950
+	} elseif (isset($payment_meta['price_id'])) {
1953 1951
 		$price_id = $payment_meta['price_id'];
1954 1952
 	} else {
1955
-		$price_id = give_get_price_id( $payment_meta['give_form_id'], $payment_meta['price'] );
1953
+		$price_id = give_get_price_id($payment_meta['give_form_id'], $payment_meta['price']);
1956 1954
 	}
1957 1955
 
1958 1956
 	/**
@@ -1963,6 +1961,6 @@  discard block
 block discarded – undo
1963 1961
 	 * @param string $price_id
1964 1962
 	 * @param array  $payment_meta
1965 1963
 	 */
1966
-	return apply_filters( 'give_get_payment_meta_price_id', $price_id, $payment_meta );
1964
+	return apply_filters('give_get_payment_meta_price_id', $price_id, $payment_meta);
1967 1965
 
1968 1966
 }
Please login to merge, or discard this patch.
give.php 1 patch
Spacing   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
  */
40 40
 
41 41
 // Exit if accessed directly.
42
-if ( ! defined( 'ABSPATH' ) ) {
42
+if ( ! defined('ABSPATH')) {
43 43
 	exit;
44 44
 }
45 45
 
46
-if ( ! class_exists( 'Give' ) ) :
46
+if ( ! class_exists('Give')) :
47 47
 
48 48
 	/**
49 49
 	 * Main Give Class
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 		 * @return    Give
238 238
 		 */
239 239
 		public static function instance() {
240
-			if ( is_null( self::$_instance ) ) {
240
+			if (is_null(self::$_instance)) {
241 241
 				self::$_instance = new self();
242 242
 			}
243 243
 
@@ -249,13 +249,13 @@  discard block
 block discarded – undo
249 249
 		 */
250 250
 		public function __construct() {
251 251
 			// PHP version
252
-			if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) {
253
-				define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' );
252
+			if ( ! defined('GIVE_REQUIRED_PHP_VERSION')) {
253
+				define('GIVE_REQUIRED_PHP_VERSION', '5.3');
254 254
 			}
255 255
 
256 256
 			// Bailout: Need minimum php version to load plugin.
257
-			if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) {
258
-				add_action( 'admin_notices', array( $this, 'minmum_phpversion_notice' ) );
257
+			if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) {
258
+				add_action('admin_notices', array($this, 'minmum_phpversion_notice'));
259 259
 
260 260
 				return;
261 261
 			}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 			$this->includes();
266 266
 			$this->init_hooks();
267 267
 
268
-			do_action( 'give_loaded' );
268
+			do_action('give_loaded');
269 269
 		}
270 270
 
271 271
 		/**
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
 		 * @since  1.8.9
275 275
 		 */
276 276
 		private function init_hooks() {
277
-			register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
278
-			add_action( 'plugins_loaded', array( $this, 'init' ), 0 );
277
+			register_activation_hook(GIVE_PLUGIN_FILE, 'give_install');
278
+			add_action('plugins_loaded', array($this, 'init'), 0);
279 279
 		}
280 280
 
281 281
 		/**
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 			 *
291 291
 			 * @since 1.8.9
292 292
 			 */
293
-			do_action( 'before_give_init' );
293
+			do_action('before_give_init');
294 294
 
295 295
 			// Set up localization.
296 296
 			$this->load_textdomain();
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 			 *
321 321
 			 * @since 1.8.7
322 322
 			 */
323
-			do_action( 'give_init', $this );
323
+			do_action('give_init', $this);
324 324
 
325 325
 		}
326 326
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 		 */
338 338
 		public function __clone() {
339 339
 			// Cloning instances of the class is forbidden.
340
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
340
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
341 341
 		}
342 342
 
343 343
 		/**
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 		 */
351 351
 		public function __wakeup() {
352 352
 			// Unserializing instances of the class is forbidden.
353
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
353
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
354 354
 		}
355 355
 
356 356
 		/**
@@ -364,33 +364,33 @@  discard block
 block discarded – undo
364 364
 		private function setup_constants() {
365 365
 
366 366
 			// Plugin version
367
-			if ( ! defined( 'GIVE_VERSION' ) ) {
368
-				define( 'GIVE_VERSION', '2.0.1' );
367
+			if ( ! defined('GIVE_VERSION')) {
368
+				define('GIVE_VERSION', '2.0.1');
369 369
 			}
370 370
 
371 371
 			// Plugin Root File
372
-			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
373
-				define( 'GIVE_PLUGIN_FILE', __FILE__ );
372
+			if ( ! defined('GIVE_PLUGIN_FILE')) {
373
+				define('GIVE_PLUGIN_FILE', __FILE__);
374 374
 			}
375 375
 
376 376
 			// Plugin Folder Path
377
-			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
378
-				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( GIVE_PLUGIN_FILE ) );
377
+			if ( ! defined('GIVE_PLUGIN_DIR')) {
378
+				define('GIVE_PLUGIN_DIR', plugin_dir_path(GIVE_PLUGIN_FILE));
379 379
 			}
380 380
 
381 381
 			// Plugin Folder URL
382
-			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
383
-				define( 'GIVE_PLUGIN_URL', plugin_dir_url( GIVE_PLUGIN_FILE ) );
382
+			if ( ! defined('GIVE_PLUGIN_URL')) {
383
+				define('GIVE_PLUGIN_URL', plugin_dir_url(GIVE_PLUGIN_FILE));
384 384
 			}
385 385
 
386 386
 			// Plugin Basename aka: "give/give.php"
387
-			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
388
-				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( GIVE_PLUGIN_FILE ) );
387
+			if ( ! defined('GIVE_PLUGIN_BASENAME')) {
388
+				define('GIVE_PLUGIN_BASENAME', plugin_basename(GIVE_PLUGIN_FILE));
389 389
 			}
390 390
 
391 391
 			// Make sure CAL_GREGORIAN is defined
392
-			if ( ! defined( 'CAL_GREGORIAN' ) ) {
393
-				define( 'CAL_GREGORIAN', 1 );
392
+			if ( ! defined('CAL_GREGORIAN')) {
393
+				define('CAL_GREGORIAN', 1);
394 394
 			}
395 395
 		}
396 396
 
@@ -408,152 +408,152 @@  discard block
 block discarded – undo
408 408
 			/**
409 409
 			 * Load libraries.
410 410
 			 */
411
-			if ( ! class_exists( 'WP_Async_Request' ) ) {
412
-				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-async-request.php' );
411
+			if ( ! class_exists('WP_Async_Request')) {
412
+				include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-async-request.php');
413 413
 			}
414 414
 
415
-			if ( ! class_exists( 'WP_Background_Process' ) ) {
416
-				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-background-process.php' );
415
+			if ( ! class_exists('WP_Background_Process')) {
416
+				include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-background-process.php');
417 417
 			}
418 418
 
419 419
 			/**
420 420
 			 * Load plugin files
421 421
 			 */
422
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php';
423
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
422
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php';
423
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php';
424 424
 			$give_options = give_get_settings();
425 425
 
426
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
427
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-async-process.php';
428
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php';
429
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php';
430
-			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
431
-			require_once GIVE_PLUGIN_DIR . 'includes/scripts.php';
432
-			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
433
-			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
434
-			require_once GIVE_PLUGIN_DIR . 'includes/filters.php';
435
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
436
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-tooltips.php';
437
-			require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php';
438
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-translation.php';
439
-
440
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
441
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
442
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
443
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
444
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-meta.php';
445
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php';
446
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php';
447
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php';
448
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
449
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
450
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
451
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
452
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
453
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
454
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-payment-meta.php';
455
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-form-meta.php';
456
-
457
-			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
458
-			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
459
-			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
460
-			require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php';
461
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
462
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
463
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
464
-			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
465
-			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
466
-			require_once GIVE_PLUGIN_DIR . 'includes/currency-functions.php';
467
-			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
468
-			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
469
-			require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php';
470
-			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
471
-			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
472
-			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
473
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php';
474
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php';
475
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php';
476
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php';
477
-
478
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/backward-compatibility.php';
479
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
480
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
481
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
482
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
483
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
484
-
485
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
486
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
487
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
488
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
489
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
490
-
491
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
492
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
493
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notifications.php';
494
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
495
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
496
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
497
-
498
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php';
499
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/backward-compatibility.php';
500
-
501
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php';
502
-
503
-			if ( defined( 'WP_CLI' ) && WP_CLI ) {
504
-				require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
426
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php';
427
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-async-process.php';
428
+			require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php';
429
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php';
430
+			require_once GIVE_PLUGIN_DIR.'includes/post-types.php';
431
+			require_once GIVE_PLUGIN_DIR.'includes/scripts.php';
432
+			require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php';
433
+			require_once GIVE_PLUGIN_DIR.'includes/actions.php';
434
+			require_once GIVE_PLUGIN_DIR.'includes/filters.php';
435
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php';
436
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-tooltips.php';
437
+			require_once GIVE_PLUGIN_DIR.'includes/class-notices.php';
438
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-translation.php';
439
+
440
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php';
441
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php';
442
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php';
443
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php';
444
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-meta.php';
445
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donors.php';
446
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donor-meta.php';
447
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donor.php';
448
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php';
449
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php';
450
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php';
451
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php';
452
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php';
453
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php';
454
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-payment-meta.php';
455
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-form-meta.php';
456
+
457
+			require_once GIVE_PLUGIN_DIR.'includes/country-functions.php';
458
+			require_once GIVE_PLUGIN_DIR.'includes/template-functions.php';
459
+			require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php';
460
+			require_once GIVE_PLUGIN_DIR.'includes/import-functions.php';
461
+			require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php';
462
+			require_once GIVE_PLUGIN_DIR.'includes/forms/template.php';
463
+			require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php';
464
+			require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php';
465
+			require_once GIVE_PLUGIN_DIR.'includes/formatting.php';
466
+			require_once GIVE_PLUGIN_DIR.'includes/currency-functions.php';
467
+			require_once GIVE_PLUGIN_DIR.'includes/price-functions.php';
468
+			require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php';
469
+			require_once GIVE_PLUGIN_DIR.'includes/process-donation.php';
470
+			require_once GIVE_PLUGIN_DIR.'includes/login-register.php';
471
+			require_once GIVE_PLUGIN_DIR.'includes/user-functions.php';
472
+			require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php';
473
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-classes.php';
474
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php';
475
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php';
476
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php';
477
+
478
+			require_once GIVE_PLUGIN_DIR.'includes/payments/backward-compatibility.php';
479
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
480
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
481
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
482
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
483
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php';
484
+
485
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
486
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
487
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
488
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
489
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
490
+
491
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
492
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
493
+			require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notifications.php';
494
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
495
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
496
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
497
+
498
+			require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donors-query.php';
499
+			require_once GIVE_PLUGIN_DIR.'includes/donors/backward-compatibility.php';
500
+
501
+			require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/class-give-updates.php';
502
+
503
+			if (defined('WP_CLI') && WP_CLI) {
504
+				require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php';
505 505
 			}
506 506
 
507
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
508
-
509
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
510
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
511
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
512
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
513
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php';
514
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
515
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php';
516
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
517
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
518
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
519
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php';
520
-
521
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
522
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
523
-
524
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php';
525
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php';
526
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php';
527
-
528
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
529
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php';
530
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
531
-
532
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php';
533
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php';
534
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php';
535
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php';
536
-
537
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php';
538
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php';
539
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php';
540
-
541
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php';
542
-
543
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php';
544
-
545
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
546
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
547
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
548
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
549
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
550
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
551
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
552
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
553
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
507
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
508
+
509
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
510
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
511
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
512
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
513
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php';
514
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
515
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php';
516
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
517
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
518
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
519
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-blank-slate.php';
520
+
521
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
522
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
523
+
524
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donors.php';
525
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-functions.php';
526
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-actions.php';
527
+
528
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
529
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php';
530
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
531
+
532
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php';
533
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php';
534
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php';
535
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php';
536
+
537
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/reports.php';
538
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/class-give-graph.php';
539
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/graphing.php';
540
+
541
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php';
542
+
543
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php';
544
+
545
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
546
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
547
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
548
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
549
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
550
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
551
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
552
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
553
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
554 554
 			}// End if().
555 555
 
556
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
556
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
557 557
 
558 558
 		}
559 559
 
@@ -568,16 +568,16 @@  discard block
 block discarded – undo
568 568
 		public function load_textdomain() {
569 569
 
570 570
 			// Set filter for Give's languages directory
571
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
572
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
571
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
572
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
573 573
 
574 574
 			// Traditional WordPress plugin locale filter.
575
-			$locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
576
-			$locale = apply_filters( 'plugin_locale', $locale, 'give' );
575
+			$locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
576
+			$locale = apply_filters('plugin_locale', $locale, 'give');
577 577
 
578
-			unload_textdomain( 'give' );
579
-			load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' );
580
-			load_plugin_textdomain( 'give', false, $give_lang_dir );
578
+			unload_textdomain('give');
579
+			load_textdomain('give', WP_LANG_DIR.'/give/give-'.$locale.'.mo');
580
+			load_plugin_textdomain('give', false, $give_lang_dir);
581 581
 
582 582
 		}
583 583
 
@@ -590,17 +590,17 @@  discard block
 block discarded – undo
590 590
 		 */
591 591
 		public function minmum_phpversion_notice() {
592 592
 			// Bailout.
593
-			if ( ! is_admin() ) {
593
+			if ( ! is_admin()) {
594 594
 				return;
595 595
 			}
596 596
 
597
-			$notice_desc = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>';
598
-			$notice_desc .= '<p>' . __( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give' ) . '</p>';
599
-			$notice_desc .= '<p>' . __( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give' ) . '</p>';
600
-			$notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>';
601
-			$notice_desc .= '<p>' . __( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give' ) . '</p>';
602
-			$notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>';
603
-			$notice_desc .= '<p>' . sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give' ), sprintf( '<a href="%1$s" target="_blank">', esc_url( 'https://wordpress.org/hosting/' ) ), '</a>' ) . '</p>';
597
+			$notice_desc = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>';
598
+			$notice_desc .= '<p>'.__('Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give').'</p>';
599
+			$notice_desc .= '<p>'.__('Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give').'</p>';
600
+			$notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>';
601
+			$notice_desc .= '<p>'.__('You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give').'</p>';
602
+			$notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>';
603
+			$notice_desc .= '<p>'.sprintf(__('If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give'), sprintf('<a href="%1$s" target="_blank">', esc_url('https://wordpress.org/hosting/')), '</a>').'</p>';
604 604
 
605 605
 			echo sprintf(
606 606
 				'<div class="notice notice-error">%1$s</div>',
Please login to merge, or discard this patch.
includes/class-give-db-form-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->formmeta    = $this->table_name = $wpdb->prefix . 'give_formmeta';
53
+		$wpdb->formmeta    = $this->table_name = $wpdb->prefix.'give_formmeta';
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-logging.php 1 patch
Spacing   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 		 * Setup properties
54 54
 		 */
55 55
 
56
-		require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-logs.php';
57
-		require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-logs-meta.php';
56
+		require_once GIVE_PLUGIN_DIR.'includes/class-give-db-logs.php';
57
+		require_once GIVE_PLUGIN_DIR.'includes/class-give-db-logs-meta.php';
58 58
 		$this->log_db     = new Give_DB_Logs();
59 59
 		$this->logmeta_db = new Give_DB_Log_Meta();
60 60
 
@@ -62,22 +62,22 @@  discard block
 block discarded – undo
62 62
 		 * Setup hooks.
63 63
 		 */
64 64
 
65
-		add_action( 'save_post_give_payment', array( $this, 'background_process_delete_cache' ) );
66
-		add_action( 'save_post_give_forms', array( $this, 'background_process_delete_cache' ) );
67
-		add_action( 'save_post_give_log', array( $this, 'background_process_delete_cache' ) );
68
-		add_action( 'give_delete_log_cache', array( $this, 'delete_cache' ) );
69
-		add_action( 'update_log_metadata', array( $this, 'bc_200_set_payment_as_log_parent' ), 10, 4 );
65
+		add_action('save_post_give_payment', array($this, 'background_process_delete_cache'));
66
+		add_action('save_post_give_forms', array($this, 'background_process_delete_cache'));
67
+		add_action('save_post_give_log', array($this, 'background_process_delete_cache'));
68
+		add_action('give_delete_log_cache', array($this, 'delete_cache'));
69
+		add_action('update_log_metadata', array($this, 'bc_200_set_payment_as_log_parent'), 10, 4);
70 70
 
71 71
 		// Backward compatibility.
72
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
72
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
73 73
 			// Create the log post type
74
-			add_action( 'init', array( $this, 'register_post_type' ), -2 );
74
+			add_action('init', array($this, 'register_post_type'), -2);
75 75
 		}
76 76
 
77 77
 		// Create types taxonomy and default types
78 78
 		// @todo: remove this taxonomy, some addon use this taxonomy with there custom log post type for example: recurring
79 79
 		// Do not use this taxonomy with your log type because we will remove it in future releases.
80
-		add_action( 'init', array( $this, 'register_taxonomy' ), -2 );
80
+		add_action('init', array($this, 'register_taxonomy'), -2);
81 81
 	}
82 82
 
83 83
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 		/* Logs post type */
96 96
 		$log_args = array(
97 97
 			'labels'              => array(
98
-				'name' => esc_html__( 'Logs', 'give' ),
98
+				'name' => esc_html__('Logs', 'give'),
99 99
 			),
100 100
 			'public'              => false,
101 101
 			'exclude_from_search' => true,
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
 			'query_var'           => false,
105 105
 			'rewrite'             => false,
106 106
 			'capability_type'     => 'post',
107
-			'supports'            => array( 'title', 'editor' ),
107
+			'supports'            => array('title', 'editor'),
108 108
 			'can_export'          => true,
109 109
 		);
110 110
 
111
-		register_post_type( 'give_log', $log_args );
111
+		register_post_type('give_log', $log_args);
112 112
 	}
113 113
 
114 114
 	/**
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
 	 * @return void
123 123
 	 */
124 124
 	public function register_taxonomy() {
125
-		register_taxonomy( 'give_log_type', 'give_log', array(
125
+		register_taxonomy('give_log_type', 'give_log', array(
126 126
 			'public' => false,
127
-		) );
127
+		));
128 128
 	}
129 129
 
130 130
 	/**
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			'update',
146 146
 		);
147 147
 
148
-		return apply_filters( 'give_log_types', $terms );
148
+		return apply_filters('give_log_types', $terms);
149 149
 	}
150 150
 
151 151
 	/**
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 	 *
161 161
 	 * @return bool         Whether log type is valid.
162 162
 	 */
163
-	public function valid_type( $type ) {
164
-		return in_array( $type, $this->log_types() );
163
+	public function valid_type($type) {
164
+		return in_array($type, $this->log_types());
165 165
 	}
166 166
 
167 167
 	/**
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 *
181 181
 	 * @return int             Log ID.
182 182
 	 */
183
-	public function add( $title = '', $message = '', $parent = 0, $type = '' ) {
183
+	public function add($title = '', $message = '', $parent = 0, $type = '') {
184 184
 		$log_data = array(
185 185
 			'post_title'   => $title,
186 186
 			'post_content' => $message,
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 			'log_type'     => $type,
189 189
 		);
190 190
 
191
-		return $this->insert_log( $log_data );
191
+		return $this->insert_log($log_data);
192 192
 	}
193 193
 
194 194
 	/**
@@ -205,12 +205,12 @@  discard block
 block discarded – undo
205 205
 	 *
206 206
 	 * @return array             An array of the connected logs.
207 207
 	 */
208
-	public function get_logs( $object_id = 0, $type = '', $paged = null ) {
209
-		return $this->get_connected_logs( array(
208
+	public function get_logs($object_id = 0, $type = '', $paged = null) {
209
+		return $this->get_connected_logs(array(
210 210
 			'log_parent' => $object_id,
211 211
 			'paged'      => $paged,
212 212
 			'log_type'   => $type,
213
-		) );
213
+		));
214 214
 	}
215 215
 
216 216
 	/**
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 	 *
225 225
 	 * @return int             The ID of the newly created log item.
226 226
 	 */
227
-	public function insert_log( $log_data = array(), $log_meta = array() ) {
227
+	public function insert_log($log_data = array(), $log_meta = array()) {
228 228
 		$log_id = 0;
229 229
 
230 230
 		$defaults = array(
@@ -237,28 +237,28 @@  discard block
 block discarded – undo
237 237
 			'post_status' => 'publish',
238 238
 		);
239 239
 
240
-		$args = wp_parse_args( $log_data, $defaults );
241
-		$this->bc_200_validate_params( $args, $log_meta );
240
+		$args = wp_parse_args($log_data, $defaults);
241
+		$this->bc_200_validate_params($args, $log_meta);
242 242
 
243
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
243
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
244 244
 			global $wpdb;
245 245
 
246 246
 			// Backward Compatibility.
247
-			if ( ! $wpdb->get_var( "SELECT ID from {$this->log_db->table_name} ORDER BY id DESC LIMIT 1" ) ) {
248
-				$latest_log_id = $wpdb->get_var( "SELECT ID from $wpdb->posts ORDER BY id DESC LIMIT 1" );
249
-				$latest_log_id = empty( $latest_log_id ) ? 1 : ++ $latest_log_id;
247
+			if ( ! $wpdb->get_var("SELECT ID from {$this->log_db->table_name} ORDER BY id DESC LIMIT 1")) {
248
+				$latest_log_id = $wpdb->get_var("SELECT ID from $wpdb->posts ORDER BY id DESC LIMIT 1");
249
+				$latest_log_id = empty($latest_log_id) ? 1 : ++ $latest_log_id;
250 250
 
251 251
 				$args['ID'] = $latest_log_id;
252
-				$this->log_db->insert( $args );
252
+				$this->log_db->insert($args);
253 253
 			}
254 254
 		}
255 255
 
256
-		$log_id = $this->log_db->add( $args );
256
+		$log_id = $this->log_db->add($args);
257 257
 
258 258
 		// Set log meta, if any
259
-		if ( $log_id && ! empty( $log_meta ) ) {
260
-			foreach ( (array) $log_meta as $key => $meta ) {
261
-				$this->logmeta_db->update_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
259
+		if ($log_id && ! empty($log_meta)) {
260
+			foreach ((array) $log_meta as $key => $meta) {
261
+				$this->logmeta_db->update_meta($log_id, '_give_log_'.sanitize_key($key), $meta);
262 262
 			}
263 263
 		}
264 264
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	 *
281 281
 	 * @return bool|null       True if successful, false otherwise.
282 282
 	 */
283
-	public function update_log( $log_data = array(), $log_meta = array() ) {
283
+	public function update_log($log_data = array(), $log_meta = array()) {
284 284
 		$log_id = 0;
285 285
 
286 286
 		/**
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 		 * @param array $log_data Log entry data.
292 292
 		 * @param array $log_meta Log entry meta.
293 293
 		 */
294
-		do_action( 'give_pre_update_log', $log_data, $log_meta );
294
+		do_action('give_pre_update_log', $log_data, $log_meta);
295 295
 
296 296
 		$defaults = array(
297 297
 			'log_parent'  => 0,
@@ -301,28 +301,28 @@  discard block
 block discarded – undo
301 301
 			'post_status' => 'publish',
302 302
 		);
303 303
 
304
-		$args = wp_parse_args( $log_data, $defaults );
305
-		$this->bc_200_validate_params( $args, $log_meta );
304
+		$args = wp_parse_args($log_data, $defaults);
305
+		$this->bc_200_validate_params($args, $log_meta);
306 306
 
307 307
 		// Store the log entry
308
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
308
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
309 309
 			// Backward compatibility.
310
-			$log_id = wp_update_post( $args );
310
+			$log_id = wp_update_post($args);
311 311
 
312
-			if ( $log_id && ! empty( $log_meta ) ) {
313
-				foreach ( (array) $log_meta as $key => $meta ) {
314
-					if ( ! empty( $meta ) ) {
315
-						give_update_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
312
+			if ($log_id && ! empty($log_meta)) {
313
+				foreach ((array) $log_meta as $key => $meta) {
314
+					if ( ! empty($meta)) {
315
+						give_update_meta($log_id, '_give_log_'.sanitize_key($key), $meta);
316 316
 					}
317 317
 				}
318 318
 			}
319 319
 		} else {
320
-			$log_id = $this->log_db->add( $args );
320
+			$log_id = $this->log_db->add($args);
321 321
 
322
-			if ( $log_id && ! empty( $log_meta ) ) {
323
-				foreach ( (array) $log_meta as $key => $meta ) {
324
-					if ( ! empty( $meta ) ) {
325
-						$this->logmeta_db->update_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta );
322
+			if ($log_id && ! empty($log_meta)) {
323
+				foreach ((array) $log_meta as $key => $meta) {
324
+					if ( ! empty($meta)) {
325
+						$this->logmeta_db->update_meta($log_id, '_give_log_'.sanitize_key($key), $meta);
326 326
 					}
327 327
 				}
328 328
 			}
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 		 * @param array $log_data Log entry data.
338 338
 		 * @param array $log_meta Log entry meta.
339 339
 		 */
340
-		do_action( 'give_post_update_log', $log_id, $log_data, $log_meta );
340
+		do_action('give_post_update_log', $log_id, $log_data, $log_meta);
341 341
 	}
342 342
 
343 343
 	/**
@@ -354,30 +354,30 @@  discard block
 block discarded – undo
354 354
 	 *
355 355
 	 * @return array|false Array if logs were found, false otherwise.
356 356
 	 */
357
-	public function get_connected_logs( $args = array() ) {
357
+	public function get_connected_logs($args = array()) {
358 358
 		$logs = array();
359 359
 
360
-		$defaults   = array(
360
+		$defaults = array(
361 361
 			'number'      => 20,
362
-			'paged'       => get_query_var( 'paged' ),
362
+			'paged'       => get_query_var('paged'),
363 363
 			'log_type'    => false,
364 364
 
365 365
 			// Backward compatibility.
366 366
 			'post_type'   => 'give_log',
367 367
 			'post_status' => 'publish',
368 368
 		);
369
-		$query_args = wp_parse_args( $args, $defaults );
370
-		$this->bc_200_validate_params( $query_args );
369
+		$query_args = wp_parse_args($args, $defaults);
370
+		$this->bc_200_validate_params($query_args);
371 371
 
372
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
372
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
373 373
 			// Backward compatibility.
374
-			$logs = get_posts( $query_args );
375
-			$this->bc_200_add_new_properties( $logs );
374
+			$logs = get_posts($query_args);
375
+			$this->bc_200_add_new_properties($logs);
376 376
 		} else {
377
-			$logs = $this->log_db->get_logs( $query_args );
377
+			$logs = $this->log_db->get_logs($query_args);
378 378
 		}
379 379
 
380
-		return ( ! empty( $logs ) ? $logs : false );
380
+		return ( ! empty($logs) ? $logs : false);
381 381
 	}
382 382
 
383 383
 	/**
@@ -395,41 +395,41 @@  discard block
 block discarded – undo
395 395
 	 *
396 396
 	 * @return int                Log count.
397 397
 	 */
398
-	public function get_log_count( $object_id = 0, $type = '', $meta_query = null, $date_query = null ) {
398
+	public function get_log_count($object_id = 0, $type = '', $meta_query = null, $date_query = null) {
399 399
 		$logs_count = 0;
400 400
 
401 401
 		$query_args = array(
402
-			'number'      => - 1,
402
+			'number'      => -1,
403 403
 
404 404
 			// Backward comatibility.
405 405
 			'post_type'   => 'give_log',
406 406
 			'post_status' => 'publish',
407 407
 		);
408 408
 
409
-		if ( $object_id ) {
409
+		if ($object_id) {
410 410
 			$query_args['log_parent'] = $object_id;
411 411
 		}
412 412
 
413
-		if ( ! empty( $type ) && $this->valid_type( $type ) ) {
413
+		if ( ! empty($type) && $this->valid_type($type)) {
414 414
 			$query_args['log_type'] = $type;
415 415
 		}
416 416
 
417
-		if ( ! empty( $meta_query ) ) {
417
+		if ( ! empty($meta_query)) {
418 418
 			$query_args['meta_query'] = $meta_query;
419 419
 		}
420 420
 
421
-		if ( ! empty( $date_query ) ) {
421
+		if ( ! empty($date_query)) {
422 422
 			$query_args['date_query'] = $date_query;
423 423
 		}
424 424
 
425
-		$this->bc_200_validate_params( $query_args );
425
+		$this->bc_200_validate_params($query_args);
426 426
 
427
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
427
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
428 428
 			// Backward compatibility.
429
-			$logs       = new WP_Query( $query_args );
429
+			$logs       = new WP_Query($query_args);
430 430
 			$logs_count = (int) $logs->post_count;
431 431
 		} else {
432
-			$logs_count = $this->log_db->count( $query_args );
432
+			$logs_count = $this->log_db->count($query_args);
433 433
 		}
434 434
 
435 435
 		return $logs_count;
@@ -449,10 +449,10 @@  discard block
 block discarded – undo
449 449
 	 *
450 450
 	 * @return void
451 451
 	 */
452
-	public function delete_logs( $object_id = 0, $type = '', $meta_query = null ) {
452
+	public function delete_logs($object_id = 0, $type = '', $meta_query = null) {
453 453
 		$query_args = array(
454 454
 			'log_parent'  => $object_id,
455
-			'number'      => - 1,
455
+			'number'      => -1,
456 456
 			'fields'      => 'ID',
457 457
 
458 458
 			// Backward compatibility.
@@ -460,32 +460,32 @@  discard block
 block discarded – undo
460 460
 			'post_status' => 'publish',
461 461
 		);
462 462
 
463
-		if ( ! empty( $type ) && $this->valid_type( $type ) ) {
463
+		if ( ! empty($type) && $this->valid_type($type)) {
464 464
 			$query_args['log_type'] = $type;
465 465
 		}
466 466
 
467
-		if ( ! empty( $meta_query ) ) {
467
+		if ( ! empty($meta_query)) {
468 468
 			$query_args['meta_query'] = $meta_query;
469 469
 		}
470 470
 
471
-		$this->bc_200_validate_params( $query_args );
471
+		$this->bc_200_validate_params($query_args);
472 472
 
473
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
473
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
474 474
 			// Backward compatibility.
475
-			$logs = get_posts( $query_args );
475
+			$logs = get_posts($query_args);
476 476
 
477
-			if ( $logs ) {
478
-				foreach ( $logs as $log ) {
479
-					wp_delete_post( $log, true );
477
+			if ($logs) {
478
+				foreach ($logs as $log) {
479
+					wp_delete_post($log, true);
480 480
 				}
481 481
 			}
482 482
 		} else {
483
-			$logs = $this->log_db->get_logs( $query_args );
483
+			$logs = $this->log_db->get_logs($query_args);
484 484
 
485
-			if ( $logs ) {
486
-				foreach ( $logs as $log ) {
487
-					if ( $this->log_db->delete( $log->ID ) ) {
488
-						$this->logmeta_db->delete_row( $log->ID );
485
+			if ($logs) {
486
+				foreach ($logs as $log) {
487
+					if ($this->log_db->delete($log->ID)) {
488
+						$this->logmeta_db->delete_row($log->ID);
489 489
 					}
490 490
 				}
491 491
 			}
@@ -502,9 +502,9 @@  discard block
 block discarded – undo
502 502
 	 *
503 503
 	 * @param int $post_id
504 504
 	 */
505
-	public function background_process_delete_cache( $post_id ) {
505
+	public function background_process_delete_cache($post_id) {
506 506
 		// Delete log cache immediately
507
-		wp_schedule_single_event( time() - 5, 'give_delete_log_cache' );
507
+		wp_schedule_single_event(time() - 5, 'give_delete_log_cache');
508 508
 	}
509 509
 
510 510
 	/**
@@ -517,17 +517,17 @@  discard block
 block discarded – undo
517 517
 	 */
518 518
 	public function delete_cache() {
519 519
 		// Add log related keys to delete.
520
-		$cache_give_logs      = Give_Cache::get_options_like( 'give_logs' );
521
-		$cache_give_log_count = Give_Cache::get_options_like( 'log_count' );
520
+		$cache_give_logs      = Give_Cache::get_options_like('give_logs');
521
+		$cache_give_log_count = Give_Cache::get_options_like('log_count');
522 522
 
523
-		$cache_option_names = array_merge( $cache_give_logs, $cache_give_log_count );
523
+		$cache_option_names = array_merge($cache_give_logs, $cache_give_log_count);
524 524
 
525 525
 		// Bailout.
526
-		if ( empty( $cache_option_names ) ) {
526
+		if (empty($cache_option_names)) {
527 527
 			return false;
528 528
 		}
529 529
 
530
-		Give_Cache::delete( $cache_option_names );
530
+		Give_Cache::delete($cache_option_names);
531 531
 	}
532 532
 
533 533
 	/**
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 	 * @param array $log_query
540 540
 	 * @param array $log_meta
541 541
 	 */
542
-	private function bc_200_validate_params( &$log_query, &$log_meta = array() ) {
542
+	private function bc_200_validate_params(&$log_query, &$log_meta = array()) {
543 543
 		$query_params = array(
544 544
 			'log_title'    => 'post_title',
545 545
 			'log_parent'   => 'post_parent',
@@ -551,41 +551,41 @@  discard block
 block discarded – undo
551 551
 			'meta_query'   => 'meta_query',
552 552
 		);
553 553
 
554
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
554
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
555 555
 			// Set old params.
556
-			foreach ( $query_params as $new_query_param => $old_query_param ) {
556
+			foreach ($query_params as $new_query_param => $old_query_param) {
557 557
 
558
-				if ( isset( $log_query[ $old_query_param ] ) && empty( $log_query[ $new_query_param ] ) ) {
559
-					$log_query[ $new_query_param ] = $log_query[ $old_query_param ];
558
+				if (isset($log_query[$old_query_param]) && empty($log_query[$new_query_param])) {
559
+					$log_query[$new_query_param] = $log_query[$old_query_param];
560 560
 					continue;
561
-				} elseif ( ! isset( $log_query[ $new_query_param ] ) ) {
561
+				} elseif ( ! isset($log_query[$new_query_param])) {
562 562
 					continue;
563
-				} elseif( empty( $log_query[ $new_query_param ] ) ) {
563
+				} elseif (empty($log_query[$new_query_param])) {
564 564
 					continue;
565 565
 				}
566 566
 
567
-				switch ( $new_query_param ) {
567
+				switch ($new_query_param) {
568 568
 					case 'log_type':
569 569
 						$log_query['tax_query'] = array(
570 570
 							array(
571 571
 								'taxonomy' => 'give_log_type',
572 572
 								'field'    => 'slug',
573
-								'terms'    => $log_query[ $new_query_param ],
573
+								'terms'    => $log_query[$new_query_param],
574 574
 							),
575 575
 						);
576 576
 						break;
577 577
 
578 578
 					case 'meta_query':
579
-						if( ! empty( $log_query['meta_query'] ) && empty( $log_query['post_parent'] ) ) {
580
-							foreach ( $log_query['meta_query'] as $index => $meta_query ){
581
-								if( ! is_array( $meta_query ) || empty( $meta_query['key'] ) ) {
579
+						if ( ! empty($log_query['meta_query']) && empty($log_query['post_parent'])) {
580
+							foreach ($log_query['meta_query'] as $index => $meta_query) {
581
+								if ( ! is_array($meta_query) || empty($meta_query['key'])) {
582 582
 									continue;
583 583
 								}
584 584
 
585
-								switch ( $meta_query['key'] ) {
585
+								switch ($meta_query['key']) {
586 586
 									case '_give_log_form_id':
587 587
 										$log_query['post_parent'] = $meta_query['value'];
588
-										unset( $log_query['meta_query'][$index] );
588
+										unset($log_query['meta_query'][$index]);
589 589
 										break;
590 590
 								}
591 591
 							}
@@ -593,40 +593,40 @@  discard block
 block discarded – undo
593 593
 						break;
594 594
 
595 595
 					default:
596
-						switch( $new_query_param ){
596
+						switch ($new_query_param) {
597 597
 							case 'log_parent':
598 598
 								$log_query['meta_query'][] = array(
599 599
 									'key' => '_give_log_payment_id',
600
-									'value' => $log_query[ $new_query_param ]
600
+									'value' => $log_query[$new_query_param]
601 601
 								);
602 602
 
603 603
 								break;
604 604
 
605 605
 							default:
606
-								$log_query[ $old_query_param ] = $log_query[ $new_query_param ];
606
+								$log_query[$old_query_param] = $log_query[$new_query_param];
607 607
 						}
608 608
 				}
609 609
 			}
610 610
 		} else {
611 611
 			// Set only old params.
612
-			$query_params = array_flip( $query_params );
613
-			foreach ( $query_params as $old_query_param => $new_query_param ) {
614
-				if ( isset( $log_query[ $new_query_param ] ) && empty( $log_query[ $old_query_param ] ) ) {
615
-					$log_query[ $old_query_param ] = $log_query[ $new_query_param ];
612
+			$query_params = array_flip($query_params);
613
+			foreach ($query_params as $old_query_param => $new_query_param) {
614
+				if (isset($log_query[$new_query_param]) && empty($log_query[$old_query_param])) {
615
+					$log_query[$old_query_param] = $log_query[$new_query_param];
616 616
 					continue;
617
-				} elseif ( ! isset( $log_query[ $old_query_param ] ) ) {
617
+				} elseif ( ! isset($log_query[$old_query_param])) {
618 618
 					continue;
619 619
 				}
620 620
 
621
-				switch ( $old_query_param ) {
621
+				switch ($old_query_param) {
622 622
 					case 'tax_query':
623
-						if ( isset( $log_query[ $old_query_param ][0]['terms'] ) ) {
624
-							$log_query[ $new_query_param ] = $log_query[ $old_query_param ][0]['terms'];
623
+						if (isset($log_query[$old_query_param][0]['terms'])) {
624
+							$log_query[$new_query_param] = $log_query[$old_query_param][0]['terms'];
625 625
 						}
626 626
 						break;
627 627
 
628 628
 					default:
629
-						$log_query[ $new_query_param ] = $log_query[ $old_query_param ];
629
+						$log_query[$new_query_param] = $log_query[$old_query_param];
630 630
 				}
631 631
 			}
632 632
 		}
@@ -640,8 +640,8 @@  discard block
 block discarded – undo
640 640
 	 *
641 641
 	 * @param  array $logs
642 642
 	 */
643
-	private function bc_200_add_new_properties( &$logs ) {
644
-		if ( empty( $logs ) ) {
643
+	private function bc_200_add_new_properties(&$logs) {
644
+		if (empty($logs)) {
645 645
 			return;
646 646
 		}
647 647
 
@@ -654,30 +654,30 @@  discard block
 block discarded – undo
654 654
 			'log_type'     => 'give_log_type',
655 655
 		);
656 656
 
657
-		if ( ! give_has_upgrade_completed( 'v20_logs_upgrades' ) ) {
658
-			foreach ( $logs as $index => $log ) {
659
-				foreach ( $query_params as $new_query_param => $old_query_param ) {
660
-					if ( ! property_exists( $log, $old_query_param ) ) {
657
+		if ( ! give_has_upgrade_completed('v20_logs_upgrades')) {
658
+			foreach ($logs as $index => $log) {
659
+				foreach ($query_params as $new_query_param => $old_query_param) {
660
+					if ( ! property_exists($log, $old_query_param)) {
661 661
 						/**
662 662
 						 *  Set unmatched properties.
663 663
 						 */
664 664
 
665 665
 						// 1. log_type
666
-						$term = get_the_terms( $log->ID, 'give_log_type' );
667
-						$term = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array();
666
+						$term = get_the_terms($log->ID, 'give_log_type');
667
+						$term = ! is_wp_error($term) && ! empty($term) ? $term[0] : array();
668 668
 
669
-						$logs[ $index ]->{$new_query_param} = ! empty( $term ) ? $term->slug : '';
669
+						$logs[$index]->{$new_query_param} = ! empty($term) ? $term->slug : '';
670 670
 
671 671
 						continue;
672 672
 					}
673 673
 
674
-					switch ( $old_query_param ) {
674
+					switch ($old_query_param) {
675 675
 						case 'post_parent':
676
-							$logs[ $index ]->{$new_query_param} = give_get_meta( $log->ID, '_give_log_payment_id', true );
676
+							$logs[$index]->{$new_query_param} = give_get_meta($log->ID, '_give_log_payment_id', true);
677 677
 							break;
678 678
 
679 679
 						default:
680
-							$logs[ $index ]->{$new_query_param} = $log->{$old_query_param};
680
+							$logs[$index]->{$new_query_param} = $log->{$old_query_param};
681 681
 					}
682 682
 				}
683 683
 			}
@@ -697,10 +697,10 @@  discard block
 block discarded – undo
697 697
 	 *
698 698
 	 * @return mixed
699 699
 	 */
700
-	public function bc_200_set_payment_as_log_parent( $check, $log_id, $meta_key, $meta_value ) {
700
+	public function bc_200_set_payment_as_log_parent($check, $log_id, $meta_key, $meta_value) {
701 701
 		global $wpdb;
702 702
 		$update_status = false;
703
-		$post_type     = get_post_type( $log_id );
703
+		$post_type     = get_post_type($log_id);
704 704
 
705 705
 		// Bailout.
706 706
 		if (
@@ -720,9 +720,9 @@  discard block
 block discarded – undo
720 720
 			)
721 721
 		);
722 722
 
723
-		if ( $form_id ) {
724
-			$this->logmeta_db->delete_meta( $log_id, '_give_log_payment_id' );
725
-			$this->logmeta_db->update_meta( $log_id, '_give_log_form_id', $form_id );
723
+		if ($form_id) {
724
+			$this->logmeta_db->delete_meta($log_id, '_give_log_payment_id');
725
+			$this->logmeta_db->update_meta($log_id, '_give_log_form_id', $form_id);
726 726
 
727 727
 			$update_status = $wpdb->update(
728 728
 				$this->log_db->table_name,
Please login to merge, or discard this patch.
includes/admin/upgrades/upgrade-functions.php 1 patch
Spacing   +456 added lines, -456 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 // Exit if accessed directly.
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -25,77 +25,77 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_do_automatic_upgrades() {
27 27
 	$did_upgrade  = false;
28
-	$give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) );
28
+	$give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version'));
29 29
 
30
-	if ( ! $give_version ) {
30
+	if ( ! $give_version) {
31 31
 		// 1.0 is the first version to use this option so we must add it.
32 32
 		$give_version = '1.0';
33 33
 	}
34 34
 
35
-	switch ( true ) {
35
+	switch (true) {
36 36
 
37
-		case version_compare( $give_version, '1.6', '<' ) :
37
+		case version_compare($give_version, '1.6', '<') :
38 38
 			give_v16_upgrades();
39 39
 			$did_upgrade = true;
40 40
 
41
-		case version_compare( $give_version, '1.7', '<' ) :
41
+		case version_compare($give_version, '1.7', '<') :
42 42
 			give_v17_upgrades();
43 43
 			$did_upgrade = true;
44 44
 
45
-		case version_compare( $give_version, '1.8', '<' ) :
45
+		case version_compare($give_version, '1.8', '<') :
46 46
 			give_v18_upgrades();
47 47
 			$did_upgrade = true;
48 48
 
49
-		case version_compare( $give_version, '1.8.7', '<' ) :
49
+		case version_compare($give_version, '1.8.7', '<') :
50 50
 			give_v187_upgrades();
51 51
 			$did_upgrade = true;
52 52
 
53
-		case version_compare( $give_version, '1.8.8', '<' ) :
53
+		case version_compare($give_version, '1.8.8', '<') :
54 54
 			give_v188_upgrades();
55 55
 			$did_upgrade = true;
56 56
 
57
-		case version_compare( $give_version, '1.8.9', '<' ) :
57
+		case version_compare($give_version, '1.8.9', '<') :
58 58
 			give_v189_upgrades();
59 59
 			$did_upgrade = true;
60 60
 
61
-		case version_compare( $give_version, '1.8.12', '<' ) :
61
+		case version_compare($give_version, '1.8.12', '<') :
62 62
 			give_v1812_upgrades();
63 63
 			$did_upgrade = true;
64 64
 
65
-		case version_compare( $give_version, '1.8.13', '<' ) :
65
+		case version_compare($give_version, '1.8.13', '<') :
66 66
 			give_v1813_upgrades();
67 67
 			$did_upgrade = true;
68 68
 
69
-		case version_compare( $give_version, '1.8.17', '<' ) :
69
+		case version_compare($give_version, '1.8.17', '<') :
70 70
 			give_v1817_upgrades();
71 71
 			$did_upgrade = true;
72 72
 
73
-		case version_compare( $give_version, '1.8.18', '<' ) :
73
+		case version_compare($give_version, '1.8.18', '<') :
74 74
 			give_v1818_upgrades();
75 75
 			$did_upgrade = true;
76 76
 
77
-		case version_compare( $give_version, '2.0', '<' ) :
77
+		case version_compare($give_version, '2.0', '<') :
78 78
 			give_v20_upgrades();
79 79
 			$did_upgrade = true;
80 80
 
81
-		case version_compare( $give_version, '2.0.1', '<' ) :
81
+		case version_compare($give_version, '2.0.1', '<') :
82 82
 			// Do nothing on fresh install.
83
-			if( ! doing_action( 'give_upgrades' ) ) {
83
+			if ( ! doing_action('give_upgrades')) {
84 84
 				give_v201_create_tables();
85
-				Give_Updates::get_instance()->__health_background_update( Give_Updates::get_instance() );
85
+				Give_Updates::get_instance()->__health_background_update(Give_Updates::get_instance());
86 86
 				Give_Updates::$background_updater->dispatch();
87 87
 			}
88 88
 
89 89
 			$did_upgrade = true;
90 90
 	}
91 91
 
92
-	if ( $did_upgrade ) {
93
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
92
+	if ($did_upgrade) {
93
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
94 94
 	}
95 95
 }
96 96
 
97
-add_action( 'admin_init', 'give_do_automatic_upgrades' );
98
-add_action( 'give_upgrades', 'give_do_automatic_upgrades' );
97
+add_action('admin_init', 'give_do_automatic_upgrades');
98
+add_action('give_upgrades', 'give_do_automatic_upgrades');
99 99
 
100 100
 /**
101 101
  * Display Upgrade Notices.
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
  *
110 110
  * @return void
111 111
  */
112
-function give_show_upgrade_notices( $give_updates ) {
112
+function give_show_upgrade_notices($give_updates) {
113 113
 	// v1.3.2 Upgrades
114 114
 	$give_updates->register(
115 115
 		array(
@@ -175,32 +175,32 @@  discard block
 block discarded – undo
175 175
 	);
176 176
 
177 177
 	// v1.8.17 Upgrades for donations.
178
-	$give_updates->register( array(
178
+	$give_updates->register(array(
179 179
 		'id'       => 'v1817_update_donation_iranian_currency_code',
180 180
 		'version'  => '1.8.17',
181 181
 		'callback' => 'give_v1817_update_donation_iranian_currency_code',
182
-	) );
182
+	));
183 183
 
184 184
 	// v1.8.17 Upgrades for cleanup of user roles.
185
-	$give_updates->register( array(
185
+	$give_updates->register(array(
186 186
 		'id'       => 'v1817_cleanup_user_roles',
187 187
 		'version'  => '1.8.17',
188 188
 		'callback' => 'give_v1817_cleanup_user_roles',
189
-	) );
189
+	));
190 190
 
191 191
 	// v1.8.18 Upgrades for assigning custom amount to existing set donations.
192
-	$give_updates->register( array(
192
+	$give_updates->register(array(
193 193
 		'id'       => 'v1818_assign_custom_amount_set_donation',
194 194
 		'version'  => '1.8.18',
195 195
 		'callback' => 'give_v1818_assign_custom_amount_set_donation',
196
-	) );
196
+	));
197 197
 
198 198
 	// v1.8.18 Cleanup the Give Worker Role Caps.
199
-	$give_updates->register( array(
199
+	$give_updates->register(array(
200 200
 		'id'       => 'v1818_give_worker_role_cleanup',
201 201
 		'version'  => '1.8.18',
202 202
 		'callback' => 'give_v1818_give_worker_role_cleanup',
203
-	) );
203
+	));
204 204
 
205 205
 	// v2.0.0 Upgrades
206 206
 	$give_updates->register(
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 			'id'       => 'v20_move_metadata_into_new_table',
255 255
 			'version'  => '2.0.0',
256 256
 			'callback' => 'give_v20_move_metadata_into_new_table_callback',
257
-			'depend'   => array( 'v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata' ),
257
+			'depend'   => array('v20_upgrades_payment_metadata', 'v20_upgrades_form_metadata'),
258 258
 		)
259 259
 	);
260 260
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 			'id'       => 'v201_move_metadata_into_new_table',
301 301
 			'version'  => '2.0.1',
302 302
 			'callback' => 'give_v201_move_metadata_into_new_table_callback',
303
-			'depend'   => array( 'v201_upgrades_payment_metadata', 'v201_add_missing_donors' ),
303
+			'depend'   => array('v201_upgrades_payment_metadata', 'v201_add_missing_donors'),
304 304
 		)
305 305
 	);
306 306
 
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	);
316 316
 }
317 317
 
318
-add_action( 'give_register_updates', 'give_show_upgrade_notices' );
318
+add_action('give_register_updates', 'give_show_upgrade_notices');
319 319
 
320 320
 /**
321 321
  * Triggers all upgrade functions
@@ -327,29 +327,29 @@  discard block
 block discarded – undo
327 327
  */
328 328
 function give_trigger_upgrades() {
329 329
 
330
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
331
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
330
+	if ( ! current_user_can('manage_give_settings')) {
331
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
332 332
 			'response' => 403,
333
-		) );
333
+		));
334 334
 	}
335 335
 
336
-	$give_version = get_option( 'give_version' );
336
+	$give_version = get_option('give_version');
337 337
 
338
-	if ( ! $give_version ) {
338
+	if ( ! $give_version) {
339 339
 		// 1.0 is the first version to use this option so we must add it.
340 340
 		$give_version = '1.0';
341
-		add_option( 'give_version', $give_version );
341
+		add_option('give_version', $give_version);
342 342
 	}
343 343
 
344
-	update_option( 'give_version', GIVE_VERSION );
345
-	delete_option( 'give_doing_upgrade' );
344
+	update_option('give_version', GIVE_VERSION);
345
+	delete_option('give_doing_upgrade');
346 346
 
347
-	if ( DOING_AJAX ) {
348
-		die( 'complete' );
347
+	if (DOING_AJAX) {
348
+		die('complete');
349 349
 	} // End if().
350 350
 }
351 351
 
352
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
352
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
353 353
 
354 354
 
355 355
 /**
@@ -365,20 +365,20 @@  discard block
 block discarded – undo
365 365
 	/* @var Give_Updates $give_updates */
366 366
 	$give_updates = Give_Updates::get_instance();
367 367
 
368
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
369
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
368
+	if ( ! current_user_can('manage_give_settings')) {
369
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
370 370
 			'response' => 403,
371
-		) );
371
+		));
372 372
 	}
373 373
 
374 374
 	give_ignore_user_abort();
375 375
 
376 376
 	// UPDATE DB METAKEYS.
377 377
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
378
-	$query = $wpdb->query( $sql );
378
+	$query = $wpdb->query($sql);
379 379
 
380 380
 	$give_updates->percentage = 100;
381
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
381
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
382 382
 }
383 383
 
384 384
 
@@ -402,24 +402,24 @@  discard block
 block discarded – undo
402 402
 	$where  .= "AND ( p.post_status = 'abandoned' )";
403 403
 	$where  .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
404 404
 
405
-	$sql            = $select . $join . $where;
406
-	$found_payments = $wpdb->get_col( $sql );
405
+	$sql            = $select.$join.$where;
406
+	$found_payments = $wpdb->get_col($sql);
407 407
 
408
-	foreach ( $found_payments as $payment ) {
408
+	foreach ($found_payments as $payment) {
409 409
 
410 410
 		// Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves.
411
-		$modified_time = get_post_modified_time( 'U', false, $payment );
411
+		$modified_time = get_post_modified_time('U', false, $payment);
412 412
 
413 413
 		// 1450124863 =  12/10/2015 20:42:25.
414
-		if ( $modified_time >= 1450124863 ) {
414
+		if ($modified_time >= 1450124863) {
415 415
 
416
-			give_update_payment_status( $payment, 'pending' );
416
+			give_update_payment_status($payment, 'pending');
417 417
 
418 418
 		}
419 419
 	}
420 420
 
421 421
 	$give_updates->percentage = 100;
422
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
422
+	give_set_upgrade_complete('upgrade_give_offline_status');
423 423
 }
424 424
 
425 425
 
@@ -432,17 +432,17 @@  discard block
 block discarded – undo
432 432
  */
433 433
 function give_v152_cleanup_users() {
434 434
 
435
-	$give_version = get_option( 'give_version' );
435
+	$give_version = get_option('give_version');
436 436
 
437
-	if ( ! $give_version ) {
437
+	if ( ! $give_version) {
438 438
 		// 1.0 is the first version to use this option so we must add it.
439 439
 		$give_version = '1.0';
440 440
 	}
441 441
 
442
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
442
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
443 443
 
444 444
 	// v1.5.2 Upgrades
445
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
445
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
446 446
 
447 447
 		// Delete all caps with "ss".
448 448
 		// Also delete all unused "campaign" roles.
@@ -489,9 +489,9 @@  discard block
 block discarded – undo
489 489
 		);
490 490
 
491 491
 		global $wp_roles;
492
-		foreach ( $delete_caps as $cap ) {
493
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
494
-				$wp_roles->remove_cap( $role, $cap );
492
+		foreach ($delete_caps as $cap) {
493
+			foreach (array_keys($wp_roles->roles) as $role) {
494
+				$wp_roles->remove_cap($role, $cap);
495 495
 			}
496 496
 		}
497 497
 
@@ -501,15 +501,15 @@  discard block
 block discarded – undo
501 501
 		$roles->add_caps();
502 502
 
503 503
 		// The Update Ran.
504
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
505
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
506
-		delete_option( 'give_doing_upgrade' );
504
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
505
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
506
+		delete_option('give_doing_upgrade');
507 507
 
508 508
 	}// End if().
509 509
 
510 510
 }
511 511
 
512
-add_action( 'admin_init', 'give_v152_cleanup_users' );
512
+add_action('admin_init', 'give_v152_cleanup_users');
513 513
 
514 514
 /**
515 515
  * 1.6 Upgrade routine to create the customer meta table.
@@ -552,53 +552,53 @@  discard block
 block discarded – undo
552 552
 
553 553
 	// Get addons license key.
554 554
 	$addons = array();
555
-	foreach ( $give_options as $key => $value ) {
556
-		if ( false !== strpos( $key, '_license_key' ) ) {
557
-			$addons[ $key ] = $value;
555
+	foreach ($give_options as $key => $value) {
556
+		if (false !== strpos($key, '_license_key')) {
557
+			$addons[$key] = $value;
558 558
 		}
559 559
 	}
560 560
 
561 561
 	// Bailout: We do not have any addon license data to upgrade.
562
-	if ( empty( $addons ) ) {
562
+	if (empty($addons)) {
563 563
 		return false;
564 564
 	}
565 565
 
566
-	foreach ( $addons as $key => $addon_license ) {
566
+	foreach ($addons as $key => $addon_license) {
567 567
 
568 568
 		// Get addon shortname.
569
-		$shortname = str_replace( '_license_key', '', $key );
569
+		$shortname = str_replace('_license_key', '', $key);
570 570
 
571 571
 		// Addon license option name.
572
-		$addon_license_option_name = $shortname . '_license_active';
572
+		$addon_license_option_name = $shortname.'_license_active';
573 573
 
574 574
 		// bailout if license is empty.
575
-		if ( empty( $addon_license ) ) {
576
-			delete_option( $addon_license_option_name );
575
+		if (empty($addon_license)) {
576
+			delete_option($addon_license_option_name);
577 577
 			continue;
578 578
 		}
579 579
 
580 580
 		// Get addon name.
581 581
 		$addon_name       = array();
582
-		$addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) );
583
-		foreach ( $addon_name_parts as $name_part ) {
582
+		$addon_name_parts = explode('_', str_replace('give_', '', $shortname));
583
+		foreach ($addon_name_parts as $name_part) {
584 584
 
585 585
 			// Fix addon name
586
-			switch ( $name_part ) {
586
+			switch ($name_part) {
587 587
 				case 'authorizenet' :
588 588
 					$name_part = 'authorize.net';
589 589
 					break;
590 590
 			}
591 591
 
592
-			$addon_name[] = ucfirst( $name_part );
592
+			$addon_name[] = ucfirst($name_part);
593 593
 		}
594 594
 
595
-		$addon_name = implode( ' ', $addon_name );
595
+		$addon_name = implode(' ', $addon_name);
596 596
 
597 597
 		// Data to send to the API.
598 598
 		$api_params = array(
599 599
 			'edd_action' => 'activate_license', // never change from "edd_" to "give_"!
600 600
 			'license'    => $addon_license,
601
-			'item_name'  => urlencode( $addon_name ),
601
+			'item_name'  => urlencode($addon_name),
602 602
 			'url'        => home_url(),
603 603
 		);
604 604
 
@@ -613,17 +613,17 @@  discard block
 block discarded – undo
613 613
 		);
614 614
 
615 615
 		// Make sure there are no errors.
616
-		if ( is_wp_error( $response ) ) {
617
-			delete_option( $addon_license_option_name );
616
+		if (is_wp_error($response)) {
617
+			delete_option($addon_license_option_name);
618 618
 			continue;
619 619
 		}
620 620
 
621 621
 		// Tell WordPress to look for updates.
622
-		set_site_transient( 'update_plugins', null );
622
+		set_site_transient('update_plugins', null);
623 623
 
624 624
 		// Decode license data.
625
-		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
626
-		update_option( $addon_license_option_name, $license_data );
625
+		$license_data = json_decode(wp_remote_retrieve_body($response));
626
+		update_option($addon_license_option_name, $license_data);
627 627
 	}// End foreach().
628 628
 }
629 629
 
@@ -653,9 +653,9 @@  discard block
 block discarded – undo
653 653
 	);
654 654
 
655 655
 	global $wp_roles;
656
-	foreach ( $delete_caps as $cap ) {
657
-		foreach ( array_keys( $wp_roles->roles ) as $role ) {
658
-			$wp_roles->remove_cap( $role, $cap );
656
+	foreach ($delete_caps as $cap) {
657
+		foreach (array_keys($wp_roles->roles) as $role) {
658
+			$wp_roles->remove_cap($role, $cap);
659 659
 		}
660 660
 	}
661 661
 
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
 function give_v18_upgrades_core_setting() {
690 690
 	// Core settings which changes from checkbox to radio.
691 691
 	$core_setting_names = array_merge(
692
-		array_keys( give_v18_renamed_core_settings() ),
692
+		array_keys(give_v18_renamed_core_settings()),
693 693
 		array(
694 694
 			'uninstall_on_delete',
695 695
 			'scripts_footer',
@@ -701,48 +701,48 @@  discard block
 block discarded – undo
701 701
 	);
702 702
 
703 703
 	// Bailout: If not any setting define.
704
-	if ( $give_settings = get_option( 'give_settings' ) ) {
704
+	if ($give_settings = get_option('give_settings')) {
705 705
 
706 706
 		$setting_changed = false;
707 707
 
708 708
 		// Loop: check each setting field.
709
-		foreach ( $core_setting_names as $setting_name ) {
709
+		foreach ($core_setting_names as $setting_name) {
710 710
 			// New setting name.
711
-			$new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name );
711
+			$new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name);
712 712
 
713 713
 			// Continue: If setting already set.
714 714
 			if (
715
-				array_key_exists( $new_setting_name, $give_settings )
716
-				&& in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) )
715
+				array_key_exists($new_setting_name, $give_settings)
716
+				&& in_array($give_settings[$new_setting_name], array('enabled', 'disabled'))
717 717
 			) {
718 718
 				continue;
719 719
 			}
720 720
 
721 721
 			// Set checkbox value to radio value.
722
-			$give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' );
722
+			$give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled');
723 723
 
724 724
 			// @see https://github.com/WordImpress/Give/issues/1063.
725
-			if ( false !== strpos( $setting_name, 'disable_' ) ) {
725
+			if (false !== strpos($setting_name, 'disable_')) {
726 726
 
727
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' );
728
-			} elseif ( false !== strpos( $setting_name, 'enable_' ) ) {
727
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled');
728
+			} elseif (false !== strpos($setting_name, 'enable_')) {
729 729
 
730
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' );
730
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled');
731 731
 			}
732 732
 
733 733
 			// Tell bot to update core setting to db.
734
-			if ( ! $setting_changed ) {
734
+			if ( ! $setting_changed) {
735 735
 				$setting_changed = true;
736 736
 			}
737 737
 		}
738 738
 
739 739
 		// Update setting only if they changed.
740
-		if ( $setting_changed ) {
741
-			update_option( 'give_settings', $give_settings );
740
+		if ($setting_changed) {
741
+			update_option('give_settings', $give_settings);
742 742
 		}
743 743
 	}// End if().
744 744
 
745
-	give_set_upgrade_complete( 'v18_upgrades_core_setting' );
745
+	give_set_upgrade_complete('v18_upgrades_core_setting');
746 746
 }
747 747
 
748 748
 /**
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
 	$give_updates = Give_Updates::get_instance();
757 757
 
758 758
 	// form query
759
-	$forms = new WP_Query( array(
759
+	$forms = new WP_Query(array(
760 760
 			'paged'          => $give_updates->step,
761 761
 			'status'         => 'any',
762 762
 			'order'          => 'ASC',
@@ -765,41 +765,41 @@  discard block
 block discarded – undo
765 765
 		)
766 766
 	);
767 767
 
768
-	if ( $forms->have_posts() ) {
769
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 20 ) );
768
+	if ($forms->have_posts()) {
769
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 20));
770 770
 
771
-		while ( $forms->have_posts() ) {
771
+		while ($forms->have_posts()) {
772 772
 			$forms->the_post();
773 773
 
774 774
 			// Form content.
775 775
 			// Note in version 1.8 display content setting split into display content and content placement setting.
776 776
 			// You can delete _give_content_option in future.
777
-			$show_content = give_get_meta( get_the_ID(), '_give_content_option', true );
778
-			if ( $show_content && ! give_get_meta( get_the_ID(), '_give_display_content', true ) ) {
779
-				$field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' );
780
-				give_update_meta( get_the_ID(), '_give_display_content', $field_value );
777
+			$show_content = give_get_meta(get_the_ID(), '_give_content_option', true);
778
+			if ($show_content && ! give_get_meta(get_the_ID(), '_give_display_content', true)) {
779
+				$field_value = ('none' !== $show_content ? 'enabled' : 'disabled');
780
+				give_update_meta(get_the_ID(), '_give_display_content', $field_value);
781 781
 
782
-				$field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' );
783
-				give_update_meta( get_the_ID(), '_give_content_placement', $field_value );
782
+				$field_value = ('none' !== $show_content ? $show_content : 'give_pre_form');
783
+				give_update_meta(get_the_ID(), '_give_content_placement', $field_value);
784 784
 			}
785 785
 
786 786
 			// "Disable" Guest Donation. Checkbox.
787 787
 			// See: https://github.com/WordImpress/Give/issues/1470.
788
-			$guest_donation        = give_get_meta( get_the_ID(), '_give_logged_in_only', true );
789
-			$guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' );
790
-			give_update_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval );
788
+			$guest_donation        = give_get_meta(get_the_ID(), '_give_logged_in_only', true);
789
+			$guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled');
790
+			give_update_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval);
791 791
 
792 792
 			// Offline Donations.
793 793
 			// See: https://github.com/WordImpress/Give/issues/1579.
794
-			$offline_donation = give_get_meta( get_the_ID(), '_give_customize_offline_donations', true );
795
-			if ( 'no' === $offline_donation ) {
794
+			$offline_donation = give_get_meta(get_the_ID(), '_give_customize_offline_donations', true);
795
+			if ('no' === $offline_donation) {
796 796
 				$offline_donation_newval = 'global';
797
-			} elseif ( 'yes' === $offline_donation ) {
797
+			} elseif ('yes' === $offline_donation) {
798 798
 				$offline_donation_newval = 'enabled';
799 799
 			} else {
800 800
 				$offline_donation_newval = 'disabled';
801 801
 			}
802
-			give_update_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval );
802
+			give_update_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval);
803 803
 
804 804
 			// Convert yes/no setting field to enabled/disabled.
805 805
 			$form_radio_settings = array(
@@ -819,15 +819,15 @@  discard block
 block discarded – undo
819 819
 				'_give_offline_donation_enable_billing_fields_single',
820 820
 			);
821 821
 
822
-			foreach ( $form_radio_settings as $meta_key ) {
822
+			foreach ($form_radio_settings as $meta_key) {
823 823
 				// Get value.
824
-				$field_value = give_get_meta( get_the_ID(), $meta_key, true );
824
+				$field_value = give_get_meta(get_the_ID(), $meta_key, true);
825 825
 
826 826
 				// Convert meta value only if it is in yes/no/none.
827
-				if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) {
827
+				if (in_array($field_value, array('yes', 'on', 'no', 'none'))) {
828 828
 
829
-					$field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' );
830
-					give_update_meta( get_the_ID(), $meta_key, $field_value );
829
+					$field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled');
830
+					give_update_meta(get_the_ID(), $meta_key, $field_value);
831 831
 				}
832 832
 			}
833 833
 		}// End while().
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
 
837 837
 	} else {
838 838
 		// No more forms found, finish up.
839
-		give_set_upgrade_complete( 'v18_upgrades_form_metadata' );
839
+		give_set_upgrade_complete('v18_upgrades_form_metadata');
840 840
 	}
841 841
 }
842 842
 
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
 				'%_transient_give_stats_%',
904 904
 				'give_cache%',
905 905
 				'%_transient_give_add_ons_feed%',
906
-				'%_transient__give_ajax_works' .
906
+				'%_transient__give_ajax_works'.
907 907
 				'%_transient_give_total_api_keys%',
908 908
 				'%_transient_give_i18n_give_promo_hide%',
909 909
 				'%_transient_give_contributors%',
@@ -930,24 +930,24 @@  discard block
 block discarded – undo
930 930
 		ARRAY_A
931 931
 	);
932 932
 
933
-	if ( ! empty( $user_apikey_options ) ) {
934
-		foreach ( $user_apikey_options as $user ) {
935
-			$cached_options[] = '_transient_' . md5( 'give_api_user_' . $user['meta_key'] );
936
-			$cached_options[] = '_transient_' . md5( 'give_api_user_public_key' . $user['user_id'] );
937
-			$cached_options[] = '_transient_' . md5( 'give_api_user_secret_key' . $user['user_id'] );
933
+	if ( ! empty($user_apikey_options)) {
934
+		foreach ($user_apikey_options as $user) {
935
+			$cached_options[] = '_transient_'.md5('give_api_user_'.$user['meta_key']);
936
+			$cached_options[] = '_transient_'.md5('give_api_user_public_key'.$user['user_id']);
937
+			$cached_options[] = '_transient_'.md5('give_api_user_secret_key'.$user['user_id']);
938 938
 		}
939 939
 	}
940 940
 
941
-	if ( ! empty( $cached_options ) ) {
942
-		foreach ( $cached_options as $option ) {
943
-			switch ( true ) {
944
-				case ( false !== strpos( $option, 'transient' ) ):
945
-					$option = str_replace( '_transient_', '', $option );
946
-					delete_transient( $option );
941
+	if ( ! empty($cached_options)) {
942
+		foreach ($cached_options as $option) {
943
+			switch (true) {
944
+				case (false !== strpos($option, 'transient')):
945
+					$option = str_replace('_transient_', '', $option);
946
+					delete_transient($option);
947 947
 					break;
948 948
 
949 949
 				default:
950
-					delete_option( $option );
950
+					delete_option($option);
951 951
 			}
952 952
 		}
953 953
 	}
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
 	global $wp_roles;
966 966
 
967 967
 	// Get the role object.
968
-	$give_worker = get_role( 'give_worker' );
968
+	$give_worker = get_role('give_worker');
969 969
 
970 970
 	// A list of capabilities to add for give workers.
971 971
 	$caps_to_add = array(
@@ -973,9 +973,9 @@  discard block
 block discarded – undo
973 973
 		'edit_pages',
974 974
 	);
975 975
 
976
-	foreach ( $caps_to_add as $cap ) {
976
+	foreach ($caps_to_add as $cap) {
977 977
 		// Add the capability.
978
-		$give_worker->add_cap( $cap );
978
+		$give_worker->add_cap($cap);
979 979
 	}
980 980
 
981 981
 }
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
 	$give_updates = Give_Updates::get_instance();
993 993
 
994 994
 	// form query.
995
-	$donation_forms = new WP_Query( array(
995
+	$donation_forms = new WP_Query(array(
996 996
 			'paged'          => $give_updates->step,
997 997
 			'status'         => 'any',
998 998
 			'order'          => 'ASC',
@@ -1001,10 +1001,10 @@  discard block
 block discarded – undo
1001 1001
 		)
1002 1002
 	);
1003 1003
 
1004
-	if ( $donation_forms->have_posts() ) {
1005
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
1004
+	if ($donation_forms->have_posts()) {
1005
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
1006 1006
 
1007
-		while ( $donation_forms->have_posts() ) {
1007
+		while ($donation_forms->have_posts()) {
1008 1008
 			$donation_forms->the_post();
1009 1009
 			$form_id = get_the_ID();
1010 1010
 
@@ -1012,41 +1012,41 @@  discard block
 block discarded – undo
1012 1012
 			update_post_meta(
1013 1013
 				$form_id,
1014 1014
 				'_give_set_price',
1015
-				give_sanitize_amount( get_post_meta( $form_id, '_give_set_price', true ) )
1015
+				give_sanitize_amount(get_post_meta($form_id, '_give_set_price', true))
1016 1016
 			);
1017 1017
 
1018 1018
 			// Remove formatting from _give_custom_amount_minimum.
1019 1019
 			update_post_meta(
1020 1020
 				$form_id,
1021 1021
 				'_give_custom_amount_minimum',
1022
-				give_sanitize_amount( get_post_meta( $form_id, '_give_custom_amount_minimum', true ) )
1022
+				give_sanitize_amount(get_post_meta($form_id, '_give_custom_amount_minimum', true))
1023 1023
 			);
1024 1024
 
1025 1025
 			// Bailout.
1026
-			if ( 'set' === get_post_meta( $form_id, '_give_price_option', true ) ) {
1026
+			if ('set' === get_post_meta($form_id, '_give_price_option', true)) {
1027 1027
 				continue;
1028 1028
 			}
1029 1029
 
1030
-			$donation_levels = get_post_meta( $form_id, '_give_donation_levels', true );
1030
+			$donation_levels = get_post_meta($form_id, '_give_donation_levels', true);
1031 1031
 
1032
-			if ( ! empty( $donation_levels ) ) {
1032
+			if ( ! empty($donation_levels)) {
1033 1033
 
1034
-				foreach ( $donation_levels as $index => $donation_level ) {
1035
-					if ( isset( $donation_level['_give_amount'] ) ) {
1036
-						$donation_levels[ $index ]['_give_amount'] = give_sanitize_amount( $donation_level['_give_amount'] );
1034
+				foreach ($donation_levels as $index => $donation_level) {
1035
+					if (isset($donation_level['_give_amount'])) {
1036
+						$donation_levels[$index]['_give_amount'] = give_sanitize_amount($donation_level['_give_amount']);
1037 1037
 					}
1038 1038
 				}
1039 1039
 
1040
-				update_post_meta( $form_id, '_give_donation_levels', $donation_levels );
1040
+				update_post_meta($form_id, '_give_donation_levels', $donation_levels);
1041 1041
 
1042
-				$donation_levels_amounts = wp_list_pluck( $donation_levels, '_give_amount' );
1042
+				$donation_levels_amounts = wp_list_pluck($donation_levels, '_give_amount');
1043 1043
 
1044
-				$min_amount = min( $donation_levels_amounts );
1045
-				$max_amount = max( $donation_levels_amounts );
1044
+				$min_amount = min($donation_levels_amounts);
1045
+				$max_amount = max($donation_levels_amounts);
1046 1046
 
1047 1047
 				// Set Minimum and Maximum amount for Multi Level Donation Forms
1048
-				give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount( $min_amount ) : 0 );
1049
-				give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount( $max_amount ) : 0 );
1048
+				give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount($min_amount) : 0);
1049
+				give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount($max_amount) : 0);
1050 1050
 			}
1051 1051
 
1052 1052
 		}
@@ -1055,7 +1055,7 @@  discard block
 block discarded – undo
1055 1055
 		wp_reset_postdata();
1056 1056
 	} else {
1057 1057
 		// The Update Ran.
1058
-		give_set_upgrade_complete( 'v189_upgrades_levels_post_meta' );
1058
+		give_set_upgrade_complete('v189_upgrades_levels_post_meta');
1059 1059
 	}
1060 1060
 
1061 1061
 }
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
  */
1106 1106
 function give_v20_upgrades() {
1107 1107
 	// Update cache setting.
1108
-	give_update_option( 'cache', 'enabled' );
1108
+	give_update_option('cache', 'enabled');
1109 1109
 
1110 1110
 	// Upgrade email settings.
1111 1111
 	give_v20_upgrades_email_setting();
@@ -1124,7 +1124,7 @@  discard block
 block discarded – undo
1124 1124
 	$all_setting = give_get_settings();
1125 1125
 
1126 1126
 	// Bailout on fresh install.
1127
-	if ( empty( $all_setting ) ) {
1127
+	if (empty($all_setting)) {
1128 1128
 		return;
1129 1129
 	}
1130 1130
 
@@ -1143,19 +1143,19 @@  discard block
 block discarded – undo
1143 1143
 		'admin_notices'                 => 'new-donation_notification',
1144 1144
 	);
1145 1145
 
1146
-	foreach ( $settings as $old_setting => $new_setting ) {
1146
+	foreach ($settings as $old_setting => $new_setting) {
1147 1147
 		// Do not update already modified
1148
-		if ( ! is_array( $new_setting ) ) {
1149
-			if ( array_key_exists( $new_setting, $all_setting ) || ! array_key_exists( $old_setting, $all_setting ) ) {
1148
+		if ( ! is_array($new_setting)) {
1149
+			if (array_key_exists($new_setting, $all_setting) || ! array_key_exists($old_setting, $all_setting)) {
1150 1150
 				continue;
1151 1151
 			}
1152 1152
 		}
1153 1153
 
1154
-		switch ( $old_setting ) {
1154
+		switch ($old_setting) {
1155 1155
 			case 'admin_notices':
1156
-				$notification_status = give_get_option( $old_setting, 'enabled' );
1156
+				$notification_status = give_get_option($old_setting, 'enabled');
1157 1157
 
1158
-				give_update_option( $new_setting, $notification_status );
1158
+				give_update_option($new_setting, $notification_status);
1159 1159
 
1160 1160
 				// @todo: Delete this option later ( version > 2.0 ), We need this for per form email addon.
1161 1161
 				// give_delete_option( $old_setting );
@@ -1166,19 +1166,19 @@  discard block
 block discarded – undo
1166 1166
 			case 'admin_notice_emails':
1167 1167
 				$recipients = give_get_admin_notice_emails();
1168 1168
 
1169
-				foreach ( $new_setting as $setting ) {
1169
+				foreach ($new_setting as $setting) {
1170 1170
 					// bailout if setting already exist.
1171
-					if ( array_key_exists( $setting, $all_setting ) ) {
1171
+					if (array_key_exists($setting, $all_setting)) {
1172 1172
 						continue;
1173 1173
 					}
1174 1174
 
1175
-					give_update_option( $setting, $recipients );
1175
+					give_update_option($setting, $recipients);
1176 1176
 				}
1177 1177
 				break;
1178 1178
 
1179 1179
 			default:
1180
-				give_update_option( $new_setting, give_get_option( $old_setting ) );
1181
-				give_delete_option( $old_setting );
1180
+				give_update_option($new_setting, give_get_option($old_setting));
1181
+				give_delete_option($old_setting);
1182 1182
 		}
1183 1183
 	}
1184 1184
 }
@@ -1195,22 +1195,22 @@  discard block
 block discarded – undo
1195 1195
 	$give_settings        = give_get_settings();
1196 1196
 	$give_setting_updated = false;
1197 1197
 
1198
-	if ( $give_settings['thousands_separator'] === $give_settings['decimal_separator'] ) {
1198
+	if ($give_settings['thousands_separator'] === $give_settings['decimal_separator']) {
1199 1199
 		$give_settings['number_decimals']   = 0;
1200 1200
 		$give_settings['decimal_separator'] = '';
1201 1201
 		$give_setting_updated               = true;
1202 1202
 
1203
-	} elseif ( empty( $give_settings['decimal_separator'] ) ) {
1203
+	} elseif (empty($give_settings['decimal_separator'])) {
1204 1204
 		$give_settings['number_decimals'] = 0;
1205 1205
 		$give_setting_updated             = true;
1206 1206
 
1207
-	} elseif ( 6 < absint( $give_settings['number_decimals'] ) ) {
1207
+	} elseif (6 < absint($give_settings['number_decimals'])) {
1208 1208
 		$give_settings['number_decimals'] = 5;
1209 1209
 		$give_setting_updated             = true;
1210 1210
 	}
1211 1211
 
1212
-	if ( $give_setting_updated ) {
1213
-		update_option( 'give_settings', $give_settings );
1212
+	if ($give_setting_updated) {
1213
+		update_option('give_settings', $give_settings);
1214 1214
 	}
1215 1215
 }
1216 1216
 
@@ -1229,69 +1229,69 @@  discard block
 block discarded – undo
1229 1229
 	$give_updates = Give_Updates::get_instance();
1230 1230
 
1231 1231
 	// form query.
1232
-	$donation_forms = new WP_Query( array(
1232
+	$donation_forms = new WP_Query(array(
1233 1233
 			'paged'          => $give_updates->step,
1234 1234
 			'status'         => 'any',
1235 1235
 			'order'          => 'ASC',
1236
-			'post_type'      => array( 'give_forms', 'give_payment' ),
1236
+			'post_type'      => array('give_forms', 'give_payment'),
1237 1237
 			'posts_per_page' => 20,
1238 1238
 		)
1239 1239
 	);
1240
-	if ( $donation_forms->have_posts() ) {
1241
-		$give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) );
1240
+	if ($donation_forms->have_posts()) {
1241
+		$give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20));
1242 1242
 
1243
-		while ( $donation_forms->have_posts() ) {
1243
+		while ($donation_forms->have_posts()) {
1244 1244
 			$donation_forms->the_post();
1245 1245
 			global $post;
1246 1246
 
1247
-			$meta = get_post_meta( $post->ID );
1247
+			$meta = get_post_meta($post->ID);
1248 1248
 
1249
-			switch ( $post->post_type ) {
1249
+			switch ($post->post_type) {
1250 1250
 				case 'give_forms':
1251 1251
 					// _give_set_price.
1252
-					if ( ! empty( $meta['_give_set_price'][0] ) ) {
1253
-						update_post_meta( $post->ID, '_give_set_price', give_sanitize_amount_for_db( $meta['_give_set_price'][0] ) );
1252
+					if ( ! empty($meta['_give_set_price'][0])) {
1253
+						update_post_meta($post->ID, '_give_set_price', give_sanitize_amount_for_db($meta['_give_set_price'][0]));
1254 1254
 					}
1255 1255
 
1256 1256
 					// _give_custom_amount_minimum.
1257
-					if ( ! empty( $meta['_give_custom_amount_minimum'][0] ) ) {
1258
-						update_post_meta( $post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db( $meta['_give_custom_amount_minimum'][0] ) );
1257
+					if ( ! empty($meta['_give_custom_amount_minimum'][0])) {
1258
+						update_post_meta($post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db($meta['_give_custom_amount_minimum'][0]));
1259 1259
 					}
1260 1260
 
1261 1261
 					// _give_levels_minimum_amount.
1262
-					if ( ! empty( $meta['_give_levels_minimum_amount'][0] ) ) {
1263
-						update_post_meta( $post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db( $meta['_give_levels_minimum_amount'][0] ) );
1262
+					if ( ! empty($meta['_give_levels_minimum_amount'][0])) {
1263
+						update_post_meta($post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db($meta['_give_levels_minimum_amount'][0]));
1264 1264
 					}
1265 1265
 
1266 1266
 					// _give_levels_maximum_amount.
1267
-					if ( ! empty( $meta['_give_levels_maximum_amount'][0] ) ) {
1268
-						update_post_meta( $post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db( $meta['_give_levels_maximum_amount'][0] ) );
1267
+					if ( ! empty($meta['_give_levels_maximum_amount'][0])) {
1268
+						update_post_meta($post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db($meta['_give_levels_maximum_amount'][0]));
1269 1269
 					}
1270 1270
 
1271 1271
 					// _give_set_goal.
1272
-					if ( ! empty( $meta['_give_set_goal'][0] ) ) {
1273
-						update_post_meta( $post->ID, '_give_set_goal', give_sanitize_amount_for_db( $meta['_give_set_goal'][0] ) );
1272
+					if ( ! empty($meta['_give_set_goal'][0])) {
1273
+						update_post_meta($post->ID, '_give_set_goal', give_sanitize_amount_for_db($meta['_give_set_goal'][0]));
1274 1274
 					}
1275 1275
 
1276 1276
 					// _give_form_earnings.
1277
-					if ( ! empty( $meta['_give_form_earnings'][0] ) ) {
1278
-						update_post_meta( $post->ID, '_give_form_earnings', give_sanitize_amount_for_db( $meta['_give_form_earnings'][0] ) );
1277
+					if ( ! empty($meta['_give_form_earnings'][0])) {
1278
+						update_post_meta($post->ID, '_give_form_earnings', give_sanitize_amount_for_db($meta['_give_form_earnings'][0]));
1279 1279
 					}
1280 1280
 
1281 1281
 					// _give_custom_amount_minimum.
1282
-					if ( ! empty( $meta['_give_donation_levels'][0] ) ) {
1283
-						$donation_levels = unserialize( $meta['_give_donation_levels'][0] );
1282
+					if ( ! empty($meta['_give_donation_levels'][0])) {
1283
+						$donation_levels = unserialize($meta['_give_donation_levels'][0]);
1284 1284
 
1285
-						foreach ( $donation_levels as $index => $level ) {
1286
-							if ( empty( $level['_give_amount'] ) ) {
1285
+						foreach ($donation_levels as $index => $level) {
1286
+							if (empty($level['_give_amount'])) {
1287 1287
 								continue;
1288 1288
 							}
1289 1289
 
1290
-							$donation_levels[ $index ]['_give_amount'] = give_sanitize_amount_for_db( $level['_give_amount'] );
1290
+							$donation_levels[$index]['_give_amount'] = give_sanitize_amount_for_db($level['_give_amount']);
1291 1291
 						}
1292 1292
 
1293 1293
 						$meta['_give_donation_levels'] = $donation_levels;
1294
-						update_post_meta( $post->ID, '_give_donation_levels', $meta['_give_donation_levels'] );
1294
+						update_post_meta($post->ID, '_give_donation_levels', $meta['_give_donation_levels']);
1295 1295
 					}
1296 1296
 
1297 1297
 
@@ -1299,8 +1299,8 @@  discard block
 block discarded – undo
1299 1299
 
1300 1300
 				case 'give_payment':
1301 1301
 					// _give_payment_total.
1302
-					if ( ! empty( $meta['_give_payment_total'][0] ) ) {
1303
-						update_post_meta( $post->ID, '_give_payment_total', give_sanitize_amount_for_db( $meta['_give_payment_total'][0] ) );
1302
+					if ( ! empty($meta['_give_payment_total'][0])) {
1303
+						update_post_meta($post->ID, '_give_payment_total', give_sanitize_amount_for_db($meta['_give_payment_total'][0]));
1304 1304
 					}
1305 1305
 
1306 1306
 					break;
@@ -1311,7 +1311,7 @@  discard block
 block discarded – undo
1311 1311
 		wp_reset_postdata();
1312 1312
 	} else {
1313 1313
 		// The Update Ran.
1314
-		give_set_upgrade_complete( 'v1812_update_amount_values' );
1314
+		give_set_upgrade_complete('v1812_update_amount_values');
1315 1315
 	}
1316 1316
 }
1317 1317
 
@@ -1331,22 +1331,22 @@  discard block
 block discarded – undo
1331 1331
 	$offset       = 1 === $give_updates->step ? 0 : $give_updates->step * 20;
1332 1332
 
1333 1333
 	// form query.
1334
-	$donors = Give()->donors->get_donors( array(
1334
+	$donors = Give()->donors->get_donors(array(
1335 1335
 			'number' => 20,
1336 1336
 			'offset' => $offset,
1337 1337
 		)
1338 1338
 	);
1339 1339
 
1340
-	if ( ! empty( $donors ) ) {
1341
-		$give_updates->set_percentage( Give()->donors->count(), $offset );
1340
+	if ( ! empty($donors)) {
1341
+		$give_updates->set_percentage(Give()->donors->count(), $offset);
1342 1342
 
1343 1343
 		/* @var Object $donor */
1344
-		foreach ( $donors as $donor ) {
1345
-			Give()->donors->update( $donor->id, array( 'purchase_value' => give_sanitize_amount_for_db( $donor->purchase_value ) ) );
1344
+		foreach ($donors as $donor) {
1345
+			Give()->donors->update($donor->id, array('purchase_value' => give_sanitize_amount_for_db($donor->purchase_value)));
1346 1346
 		}
1347 1347
 	} else {
1348 1348
 		// The Update Ran.
1349
-		give_set_upgrade_complete( 'v1812_update_donor_purchase_values' );
1349
+		give_set_upgrade_complete('v1812_update_donor_purchase_values');
1350 1350
 	}
1351 1351
 }
1352 1352
 
@@ -1361,25 +1361,25 @@  discard block
 block discarded – undo
1361 1361
 	$offset       = 1 === $give_updates->step ? 0 : $give_updates->step * 20;
1362 1362
 
1363 1363
 	// Fetch all the existing donors.
1364
-	$donors = Give()->donors->get_donors( array(
1364
+	$donors = Give()->donors->get_donors(array(
1365 1365
 			'number' => 20,
1366 1366
 			'offset' => $offset,
1367 1367
 		)
1368 1368
 	);
1369 1369
 
1370
-	if ( ! empty( $donors ) ) {
1371
-		$give_updates->set_percentage( Give()->donors->count(), ( $give_updates->step * 20 ) );
1370
+	if ( ! empty($donors)) {
1371
+		$give_updates->set_percentage(Give()->donors->count(), ($give_updates->step * 20));
1372 1372
 
1373 1373
 		/* @var Object $donor */
1374
-		foreach ( $donors as $donor ) {
1374
+		foreach ($donors as $donor) {
1375 1375
 			$user_id = $donor->user_id;
1376 1376
 
1377 1377
 			// Proceed, if donor is attached with user.
1378
-			if ( $user_id ) {
1379
-				$user = get_userdata( $user_id );
1378
+			if ($user_id) {
1379
+				$user = get_userdata($user_id);
1380 1380
 
1381 1381
 				// Update user role, if user has subscriber role.
1382
-				if ( is_array( $user->roles ) && in_array( 'subscriber', $user->roles ) ) {
1382
+				if (is_array($user->roles) && in_array('subscriber', $user->roles)) {
1383 1383
 					wp_update_user(
1384 1384
 						array(
1385 1385
 							'ID'   => $user_id,
@@ -1391,7 +1391,7 @@  discard block
 block discarded – undo
1391 1391
 		}
1392 1392
 	} else {
1393 1393
 		// The Update Ran.
1394
-		give_set_upgrade_complete( 'v1813_update_donor_user_roles' );
1394
+		give_set_upgrade_complete('v1813_update_donor_user_roles');
1395 1395
 	}
1396 1396
 }
1397 1397
 
@@ -1403,7 +1403,7 @@  discard block
 block discarded – undo
1403 1403
  */
1404 1404
 function give_v1813_upgrades() {
1405 1405
 	// Update admin setting.
1406
-	give_update_option( 'donor_default_user_role', 'give_donor' );
1406
+	give_update_option('donor_default_user_role', 'give_donor');
1407 1407
 
1408 1408
 	// Update Give roles.
1409 1409
 	$roles = new Give_Roles();
@@ -1421,33 +1421,33 @@  discard block
 block discarded – undo
1421 1421
 	$give_updates = Give_Updates::get_instance();
1422 1422
 
1423 1423
 	// form query.
1424
-	$payments = new WP_Query( array(
1424
+	$payments = new WP_Query(array(
1425 1425
 			'paged'          => $give_updates->step,
1426 1426
 			'status'         => 'any',
1427 1427
 			'order'          => 'ASC',
1428
-			'post_type'      => array( 'give_payment' ),
1428
+			'post_type'      => array('give_payment'),
1429 1429
 			'posts_per_page' => 100,
1430 1430
 		)
1431 1431
 	);
1432 1432
 
1433
-	if ( $payments->have_posts() ) {
1434
-		$give_updates->set_percentage( $payments->found_posts, ( $give_updates->step * 100 ) );
1433
+	if ($payments->have_posts()) {
1434
+		$give_updates->set_percentage($payments->found_posts, ($give_updates->step * 100));
1435 1435
 
1436
-		while ( $payments->have_posts() ) {
1436
+		while ($payments->have_posts()) {
1437 1437
 			$payments->the_post();
1438 1438
 
1439
-			$payment_meta = give_get_payment_meta( get_the_ID() );
1439
+			$payment_meta = give_get_payment_meta(get_the_ID());
1440 1440
 
1441
-			if ( 'RIAL' === $payment_meta['currency'] ) {
1441
+			if ('RIAL' === $payment_meta['currency']) {
1442 1442
 				$payment_meta['currency'] = 'IRR';
1443
-				give_update_meta( get_the_ID(), '_give_payment_meta', $payment_meta );
1443
+				give_update_meta(get_the_ID(), '_give_payment_meta', $payment_meta);
1444 1444
 			}
1445 1445
 
1446 1446
 		}
1447 1447
 
1448 1448
 	} else {
1449 1449
 		// The Update Ran.
1450
-		give_set_upgrade_complete( 'v1817_update_donation_iranian_currency_code' );
1450
+		give_set_upgrade_complete('v1817_update_donation_iranian_currency_code');
1451 1451
 	}
1452 1452
 }
1453 1453
 
@@ -1460,9 +1460,9 @@  discard block
 block discarded – undo
1460 1460
 function give_v1817_upgrades() {
1461 1461
 	$give_settings = give_get_settings();
1462 1462
 
1463
-	if ( 'RIAL' === $give_settings['currency'] ) {
1463
+	if ('RIAL' === $give_settings['currency']) {
1464 1464
 		$give_settings['currency'] = 'IRR';
1465
-		update_option( 'give_settings', $give_settings );
1465
+		update_option('give_settings', $give_settings);
1466 1466
 	}
1467 1467
 }
1468 1468
 
@@ -1475,7 +1475,7 @@  discard block
 block discarded – undo
1475 1475
 
1476 1476
 	global $wp_roles;
1477 1477
 
1478
-	if( ! ( $wp_roles instanceof  WP_Roles ) ) {
1478
+	if ( ! ($wp_roles instanceof  WP_Roles)) {
1479 1479
 		return;
1480 1480
 	}
1481 1481
 
@@ -1499,15 +1499,15 @@  discard block
 block discarded – undo
1499 1499
 		),
1500 1500
 	);
1501 1501
 
1502
-	foreach ( $add_caps as $role => $caps ) {
1503
-		foreach ( $caps as $cap ) {
1504
-			$wp_roles->add_cap( $role, $cap );
1502
+	foreach ($add_caps as $role => $caps) {
1503
+		foreach ($caps as $cap) {
1504
+			$wp_roles->add_cap($role, $cap);
1505 1505
 		}
1506 1506
 	}
1507 1507
 
1508
-	foreach ( $remove_caps as $role => $caps ) {
1509
-		foreach ( $caps as $cap ) {
1510
-			$wp_roles->remove_cap( $role, $cap );
1508
+	foreach ($remove_caps as $role => $caps) {
1509
+		foreach ($caps as $cap) {
1510
+			$wp_roles->remove_cap($role, $cap);
1511 1511
 		}
1512 1512
 	}
1513 1513
 
@@ -1531,7 +1531,7 @@  discard block
 block discarded – undo
1531 1531
 	$roles->add_roles();
1532 1532
 	$roles->add_caps();
1533 1533
 
1534
-	give_set_upgrade_complete( 'v1817_cleanup_user_roles' );
1534
+	give_set_upgrade_complete('v1817_cleanup_user_roles');
1535 1535
 }
1536 1536
 
1537 1537
 /**
@@ -1542,7 +1542,7 @@  discard block
 block discarded – undo
1542 1542
 function give_v1818_upgrades() {
1543 1543
 
1544 1544
 	// Remove email_access_installed from give_settings.
1545
-	give_delete_option( 'email_access_installed' );
1545
+	give_delete_option('email_access_installed');
1546 1546
 }
1547 1547
 
1548 1548
 /**
@@ -1553,25 +1553,25 @@  discard block
 block discarded – undo
1553 1553
 function give_v1818_assign_custom_amount_set_donation() {
1554 1554
 
1555 1555
 	/* @var Give_Updates $give_updates */
1556
-	$give_updates   = Give_Updates::get_instance();
1556
+	$give_updates = Give_Updates::get_instance();
1557 1557
 
1558
-	$donations = new WP_Query( array(
1558
+	$donations = new WP_Query(array(
1559 1559
 			'paged'          => $give_updates->step,
1560 1560
 			'status'         => 'any',
1561 1561
 			'order'          => 'ASC',
1562
-			'post_type'      => array( 'give_payment' ),
1562
+			'post_type'      => array('give_payment'),
1563 1563
 			'posts_per_page' => 100,
1564 1564
 		)
1565 1565
 	);
1566 1566
 
1567
-	if ( $donations->have_posts() ) {
1568
-		$give_updates->set_percentage( $donations->found_posts, $give_updates->step * 100 );
1567
+	if ($donations->have_posts()) {
1568
+		$give_updates->set_percentage($donations->found_posts, $give_updates->step * 100);
1569 1569
 
1570
-		while ( $donations->have_posts() ) {
1570
+		while ($donations->have_posts()) {
1571 1571
 			$donations->the_post();
1572 1572
 
1573
-			$form          = new Give_Donate_Form( give_get_meta( get_the_ID(), '_give_payment_form_id', true ) );
1574
-			$donation_meta = give_get_payment_meta( get_the_ID() );
1573
+			$form          = new Give_Donate_Form(give_get_meta(get_the_ID(), '_give_payment_form_id', true));
1574
+			$donation_meta = give_get_payment_meta(get_the_ID());
1575 1575
 
1576 1576
 			// Update Donation meta with price_id set as custom, only if it is:
1577 1577
 			// 1. Donation Type = Set Donation.
@@ -1580,19 +1580,19 @@  discard block
 block discarded – undo
1580 1580
 			if (
1581 1581
 				$form->ID &&
1582 1582
 				$form->is_set_type_donation_form() &&
1583
-				( 'custom' !== $donation_meta['price_id'] ) &&
1584
-				$form->is_custom_price( give_get_meta( get_the_ID(), '_give_payment_total', true ) )
1583
+				('custom' !== $donation_meta['price_id']) &&
1584
+				$form->is_custom_price(give_get_meta(get_the_ID(), '_give_payment_total', true))
1585 1585
 			) {
1586 1586
 				$donation_meta['price_id'] = 'custom';
1587
-				give_update_meta( get_the_ID(), '_give_payment_meta', $donation_meta );
1588
-				give_update_meta( get_the_ID(), '_give_payment_price_id', 'custom' );
1587
+				give_update_meta(get_the_ID(), '_give_payment_meta', $donation_meta);
1588
+				give_update_meta(get_the_ID(), '_give_payment_price_id', 'custom');
1589 1589
 			}
1590 1590
 		}
1591 1591
 
1592 1592
 		wp_reset_postdata();
1593 1593
 	} else {
1594 1594
 		// Update Ran Successfully.
1595
-		give_set_upgrade_complete( 'v1818_assign_custom_amount_set_donation' );
1595
+		give_set_upgrade_complete('v1818_assign_custom_amount_set_donation');
1596 1596
 	}
1597 1597
 }
1598 1598
 
@@ -1603,14 +1603,14 @@  discard block
 block discarded – undo
1603 1603
  *
1604 1604
  * @since 1.8.18
1605 1605
  */
1606
-function give_v1818_give_worker_role_cleanup(){
1606
+function give_v1818_give_worker_role_cleanup() {
1607 1607
 
1608 1608
 	/* @var Give_Updates $give_updates */
1609 1609
 	$give_updates = Give_Updates::get_instance();
1610 1610
 
1611 1611
 	global $wp_roles;
1612 1612
 
1613
-	if( ! ( $wp_roles instanceof  WP_Roles ) ) {
1613
+	if ( ! ($wp_roles instanceof  WP_Roles)) {
1614 1614
 		return;
1615 1615
 	}
1616 1616
 
@@ -1628,9 +1628,9 @@  discard block
 block discarded – undo
1628 1628
 		),
1629 1629
 	);
1630 1630
 
1631
-	foreach ( $remove_caps as $role => $caps ) {
1632
-		foreach( $caps as $cap ) {
1633
-			$wp_roles->remove_cap( $role, $cap );
1631
+	foreach ($remove_caps as $role => $caps) {
1632
+		foreach ($caps as $cap) {
1633
+			$wp_roles->remove_cap($role, $cap);
1634 1634
 		}
1635 1635
 	}
1636 1636
 
@@ -1641,7 +1641,7 @@  discard block
 block discarded – undo
1641 1641
 	$roles->add_roles();
1642 1642
 	$roles->add_caps();
1643 1643
 
1644
-	give_set_upgrade_complete( 'v1818_give_worker_role_cleanup' );
1644
+	give_set_upgrade_complete('v1818_give_worker_role_cleanup');
1645 1645
 }
1646 1646
 
1647 1647
 /**
@@ -1655,7 +1655,7 @@  discard block
 block discarded – undo
1655 1655
 	$give_updates = Give_Updates::get_instance();
1656 1656
 
1657 1657
 	// form query
1658
-	$forms = new WP_Query( array(
1658
+	$forms = new WP_Query(array(
1659 1659
 			'paged'          => $give_updates->step,
1660 1660
 			'status'         => 'any',
1661 1661
 			'order'          => 'ASC',
@@ -1664,22 +1664,22 @@  discard block
 block discarded – undo
1664 1664
 		)
1665 1665
 	);
1666 1666
 
1667
-	if ( $forms->have_posts() ) {
1668
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) );
1667
+	if ($forms->have_posts()) {
1668
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100));
1669 1669
 
1670
-		while ( $forms->have_posts() ) {
1670
+		while ($forms->have_posts()) {
1671 1671
 			$forms->the_post();
1672 1672
 			global $post;
1673 1673
 
1674 1674
 			// Update offline instruction email notification status.
1675
-			$offline_instruction_notification_status = get_post_meta( get_the_ID(), '_give_customize_offline_donations', true );
1676
-			$offline_instruction_notification_status = give_is_setting_enabled( $offline_instruction_notification_status, array(
1675
+			$offline_instruction_notification_status = get_post_meta(get_the_ID(), '_give_customize_offline_donations', true);
1676
+			$offline_instruction_notification_status = give_is_setting_enabled($offline_instruction_notification_status, array(
1677 1677
 				'enabled',
1678 1678
 				'global',
1679
-			) )
1679
+			))
1680 1680
 				? $offline_instruction_notification_status
1681 1681
 				: 'global';
1682
-			update_post_meta( get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status );
1682
+			update_post_meta(get_the_ID(), '_give_offline-donation-instruction_notification', $offline_instruction_notification_status);
1683 1683
 
1684 1684
 			// Update offline instruction email message.
1685 1685
 			update_post_meta(
@@ -1711,7 +1711,7 @@  discard block
 block discarded – undo
1711 1711
 		wp_reset_postdata();
1712 1712
 	} else {
1713 1713
 		// No more forms found, finish up.
1714
-		give_set_upgrade_complete( 'v20_upgrades_form_metadata' );
1714
+		give_set_upgrade_complete('v20_upgrades_form_metadata');
1715 1715
 	}
1716 1716
 }
1717 1717
 
@@ -1728,7 +1728,7 @@  discard block
 block discarded – undo
1728 1728
 	$give_updates = Give_Updates::get_instance();
1729 1729
 
1730 1730
 	// form query
1731
-	$forms = new WP_Query( array(
1731
+	$forms = new WP_Query(array(
1732 1732
 			'paged'          => $give_updates->step,
1733 1733
 			'status'         => 'any',
1734 1734
 			'order'          => 'ASC',
@@ -1737,19 +1737,19 @@  discard block
 block discarded – undo
1737 1737
 		)
1738 1738
 	);
1739 1739
 
1740
-	if ( $forms->have_posts() ) {
1741
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) );
1740
+	if ($forms->have_posts()) {
1741
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100));
1742 1742
 
1743
-		while ( $forms->have_posts() ) {
1743
+		while ($forms->have_posts()) {
1744 1744
 			$forms->the_post();
1745 1745
 			global $post;
1746 1746
 
1747 1747
 			// Split _give_payment_meta meta.
1748 1748
 			// @todo Remove _give_payment_meta after releases 2.0
1749
-			$payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true );
1749
+			$payment_meta = give_get_meta($post->ID, '_give_payment_meta', true);
1750 1750
 
1751
-			if ( ! empty( $payment_meta ) ) {
1752
-				_give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta );
1751
+			if ( ! empty($payment_meta)) {
1752
+				_give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta);
1753 1753
 			}
1754 1754
 
1755 1755
 			$deprecated_meta_keys = array(
@@ -1758,9 +1758,9 @@  discard block
 block discarded – undo
1758 1758
 				'_give_payment_user_ip'     => '_give_payment_donor_ip',
1759 1759
 			);
1760 1760
 
1761
-			foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) {
1761
+			foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) {
1762 1762
 				// Do not add new meta key if already exist.
1763
-				if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key ) ) ) {
1763
+				if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key))) {
1764 1764
 					continue;
1765 1765
 				}
1766 1766
 
@@ -1769,25 +1769,25 @@  discard block
 block discarded – undo
1769 1769
 					array(
1770 1770
 						'post_id' => $post->ID,
1771 1771
 						'meta_key' => $new_meta_key,
1772
-						'meta_value' => give_get_meta( $post->ID, $old_meta_key, true )
1772
+						'meta_value' => give_get_meta($post->ID, $old_meta_key, true)
1773 1773
 					)
1774 1774
 				);
1775 1775
 			}
1776 1776
 
1777 1777
 			// Bailout
1778
-			if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) {
1778
+			if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) {
1779 1779
 				/* @var Give_Donor $donor */
1780
-				$donor = new Give_Donor( $donor_id );
1780
+				$donor = new Give_Donor($donor_id);
1781 1781
 
1782
-				$address['line1']   = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' );
1783
-				$address['line2']   = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' );
1784
-				$address['city']    = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' );
1785
-				$address['state']   = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' );
1786
-				$address['zip']     = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' );
1787
-				$address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' );
1782
+				$address['line1']   = give_get_meta($post->ID, '_give_donor_billing_address1', true, '');
1783
+				$address['line2']   = give_get_meta($post->ID, '_give_donor_billing_address2', true, '');
1784
+				$address['city']    = give_get_meta($post->ID, '_give_donor_billing_city', true, '');
1785
+				$address['state']   = give_get_meta($post->ID, '_give_donor_billing_state', true, '');
1786
+				$address['zip']     = give_get_meta($post->ID, '_give_donor_billing_zip', true, '');
1787
+				$address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, '');
1788 1788
 
1789 1789
 				// Save address.
1790
-				$donor->add_address( 'billing[]', $address );
1790
+				$donor->add_address('billing[]', $address);
1791 1791
 			}
1792 1792
 
1793 1793
 		}// End while().
@@ -1798,7 +1798,7 @@  discard block
 block discarded – undo
1798 1798
 		// $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) );
1799 1799
 
1800 1800
 		// No more forms found, finish up.
1801
-		give_set_upgrade_complete( 'v20_upgrades_payment_metadata' );
1801
+		give_set_upgrade_complete('v20_upgrades_payment_metadata');
1802 1802
 	}
1803 1803
 }
1804 1804
 
@@ -1814,7 +1814,7 @@  discard block
 block discarded – undo
1814 1814
 	$give_updates = Give_Updates::get_instance();
1815 1815
 
1816 1816
 	// form query
1817
-	$forms = new WP_Query( array(
1817
+	$forms = new WP_Query(array(
1818 1818
 			'paged'          => $give_updates->step,
1819 1819
 			'order'          => 'DESC',
1820 1820
 			'post_type'      => 'give_log',
@@ -1823,20 +1823,20 @@  discard block
 block discarded – undo
1823 1823
 		)
1824 1824
 	);
1825 1825
 
1826
-	if ( $forms->have_posts() ) {
1827
-		$give_updates->set_percentage( $forms->found_posts, $give_updates->step * 100 );
1826
+	if ($forms->have_posts()) {
1827
+		$give_updates->set_percentage($forms->found_posts, $give_updates->step * 100);
1828 1828
 
1829
-		while ( $forms->have_posts() ) {
1829
+		while ($forms->have_posts()) {
1830 1830
 			$forms->the_post();
1831 1831
 			global $post;
1832 1832
 
1833
-			if( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) {
1833
+			if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) {
1834 1834
 				continue;
1835 1835
 			}
1836 1836
 
1837
-			$term      = get_the_terms( $post->ID, 'give_log_type' );
1838
-			$term      = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array();
1839
-			$term_name = ! empty( $term ) ? $term->slug : '';
1837
+			$term      = get_the_terms($post->ID, 'give_log_type');
1838
+			$term      = ! is_wp_error($term) && ! empty($term) ? $term[0] : array();
1839
+			$term_name = ! empty($term) ? $term->slug : '';
1840 1840
 
1841 1841
 			$log_data = array(
1842 1842
 				'ID'           => $post->ID,
@@ -1849,29 +1849,29 @@  discard block
 block discarded – undo
1849 1849
 			);
1850 1850
 			$log_meta = array();
1851 1851
 
1852
-			if ( $old_log_meta = get_post_meta( $post->ID ) ) {
1853
-				foreach ( $old_log_meta as $meta_key => $meta_value ) {
1854
-					switch ( $meta_key ) {
1852
+			if ($old_log_meta = get_post_meta($post->ID)) {
1853
+				foreach ($old_log_meta as $meta_key => $meta_value) {
1854
+					switch ($meta_key) {
1855 1855
 						case '_give_log_payment_id':
1856
-							$log_data['log_parent']        = current( $meta_value );
1856
+							$log_data['log_parent']        = current($meta_value);
1857 1857
 							$log_meta['_give_log_form_id'] = $post->post_parent;
1858 1858
 							break;
1859 1859
 
1860 1860
 						default:
1861
-							$log_meta[ $meta_key ] = current( $meta_value );
1861
+							$log_meta[$meta_key] = current($meta_value);
1862 1862
 					}
1863 1863
 				}
1864 1864
 			}
1865 1865
 
1866
-			if ( 'api_request' === $term_name ) {
1866
+			if ('api_request' === $term_name) {
1867 1867
 				$log_meta['_give_log_api_query'] = $post->post_excerpt;
1868 1868
 			}
1869 1869
 
1870
-			$wpdb->insert( "{$wpdb->prefix}give_logs", $log_data );
1870
+			$wpdb->insert("{$wpdb->prefix}give_logs", $log_data);
1871 1871
 
1872
-			if ( ! empty( $log_meta ) ) {
1873
-				foreach ( $log_meta as $meta_key => $meta_value ) {
1874
-					Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value );
1872
+			if ( ! empty($log_meta)) {
1873
+				foreach ($log_meta as $meta_key => $meta_value) {
1874
+					Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value);
1875 1875
 				}
1876 1876
 			}
1877 1877
 
@@ -1913,7 +1913,7 @@  discard block
 block discarded – undo
1913 1913
 		Give()->logs->delete_cache();
1914 1914
 
1915 1915
 		// No more forms found, finish up.
1916
-		give_set_upgrade_complete( 'v20_logs_upgrades' );
1916
+		give_set_upgrade_complete('v20_logs_upgrades');
1917 1917
 	}
1918 1918
 }
1919 1919
 
@@ -1929,19 +1929,19 @@  discard block
 block discarded – undo
1929 1929
 	$give_updates = Give_Updates::get_instance();
1930 1930
 
1931 1931
 	// form query
1932
-	$payments = new WP_Query( array(
1932
+	$payments = new WP_Query(array(
1933 1933
 			'paged'          => $give_updates->step,
1934 1934
 			'status'         => 'any',
1935 1935
 			'order'          => 'ASC',
1936
-			'post_type'      => array( 'give_forms', 'give_payment' ),
1936
+			'post_type'      => array('give_forms', 'give_payment'),
1937 1937
 			'posts_per_page' => 100,
1938 1938
 		)
1939 1939
 	);
1940 1940
 
1941
-	if ( $payments->have_posts() ) {
1942
-		$give_updates->set_percentage( $payments->found_posts, $give_updates->step * 100 );
1941
+	if ($payments->have_posts()) {
1942
+		$give_updates->set_percentage($payments->found_posts, $give_updates->step * 100);
1943 1943
 
1944
-		while ( $payments->have_posts() ) {
1944
+		while ($payments->have_posts()) {
1945 1945
 			$payments->the_post();
1946 1946
 			global $post;
1947 1947
 
@@ -1953,19 +1953,19 @@  discard block
 block discarded – undo
1953 1953
 				ARRAY_A
1954 1954
 			);
1955 1955
 
1956
-			if ( ! empty( $meta_data ) ) {
1957
-				foreach ( $meta_data as $index => $data ) {
1956
+			if ( ! empty($meta_data)) {
1957
+				foreach ($meta_data as $index => $data) {
1958 1958
 					// Check for duplicate meta values.
1959
-					if( $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . ( 'give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta ) .  " WHERE meta_id=%d", $data['meta_id'] ), ARRAY_A ) ) {
1959
+					if ($result = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".('give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta)." WHERE meta_id=%d", $data['meta_id']), ARRAY_A)) {
1960 1960
 						continue;
1961 1961
 					}
1962 1962
 					
1963
-					switch ( $post->post_type ) {
1963
+					switch ($post->post_type) {
1964 1964
 						case 'give_forms':
1965 1965
 							$data['form_id'] = $data['post_id'];
1966
-							unset( $data['post_id'] );
1966
+							unset($data['post_id']);
1967 1967
 
1968
-							Give()->form_meta->insert( $data );
1968
+							Give()->form_meta->insert($data);
1969 1969
 							// @todo: delete form meta from post meta table after releases 2.0.
1970 1970
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
1971 1971
 
@@ -1973,9 +1973,9 @@  discard block
 block discarded – undo
1973 1973
 
1974 1974
 						case 'give_payment':
1975 1975
 							$data['payment_id'] = $data['post_id'];
1976
-							unset( $data['post_id'] );
1976
+							unset($data['post_id']);
1977 1977
 
1978
-							Give()->payment_meta->insert( $data );
1978
+							Give()->payment_meta->insert($data);
1979 1979
 
1980 1980
 							// @todo: delete donation meta from post meta table after releases 2.0.
1981 1981
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
@@ -1990,7 +1990,7 @@  discard block
 block discarded – undo
1990 1990
 		wp_reset_postdata();
1991 1991
 	} else {
1992 1992
 		// No more forms found, finish up.
1993
-		give_set_upgrade_complete( 'v20_move_metadata_into_new_table' );
1993
+		give_set_upgrade_complete('v20_move_metadata_into_new_table');
1994 1994
 	}
1995 1995
 
1996 1996
 }
@@ -2006,44 +2006,44 @@  discard block
 block discarded – undo
2006 2006
 	/* @var Give_Updates $give_updates */
2007 2007
 	$give_updates = Give_Updates::get_instance();
2008 2008
 
2009
-	$donors = Give()->donors->get_donors( array(
2009
+	$donors = Give()->donors->get_donors(array(
2010 2010
 		'paged'  => $give_updates->step,
2011 2011
 		'number' => 100,
2012
-	) );
2012
+	));
2013 2013
 
2014
-	if ( $donors ) {
2015
-		$give_updates->set_percentage( count( $donors ), $give_updates->step * 100 );
2014
+	if ($donors) {
2015
+		$give_updates->set_percentage(count($donors), $give_updates->step * 100);
2016 2016
 		// Loop through Donors
2017
-		foreach ( $donors as $donor ) {
2017
+		foreach ($donors as $donor) {
2018 2018
 
2019
-			$donor_name       = explode( ' ', $donor->name, 2 );
2020
-			$donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' );
2021
-			$donor_last_name  = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' );
2019
+			$donor_name       = explode(' ', $donor->name, 2);
2020
+			$donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name');
2021
+			$donor_last_name  = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name');
2022 2022
 
2023 2023
 			// If first name meta of donor is not created, then create it.
2024
-			if ( ! $donor_first_name && isset( $donor_name[0] ) ) {
2025
-				Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] );
2024
+			if ( ! $donor_first_name && isset($donor_name[0])) {
2025
+				Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]);
2026 2026
 			}
2027 2027
 
2028 2028
 			// If last name meta of donor is not created, then create it.
2029
-			if ( ! $donor_last_name && isset( $donor_name[1] ) ) {
2030
-				Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] );
2029
+			if ( ! $donor_last_name && isset($donor_name[1])) {
2030
+				Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]);
2031 2031
 			}
2032 2032
 
2033 2033
 			// If Donor is connected with WP User then update user meta.
2034
-			if ( $donor->user_id ) {
2035
-				if ( isset( $donor_name[0] ) ) {
2036
-					update_user_meta( $donor->user_id, 'first_name', $donor_name[0] );
2034
+			if ($donor->user_id) {
2035
+				if (isset($donor_name[0])) {
2036
+					update_user_meta($donor->user_id, 'first_name', $donor_name[0]);
2037 2037
 				}
2038
-				if ( isset( $donor_name[1] ) ) {
2039
-					update_user_meta( $donor->user_id, 'last_name', $donor_name[1] );
2038
+				if (isset($donor_name[1])) {
2039
+					update_user_meta($donor->user_id, 'last_name', $donor_name[1]);
2040 2040
 				}
2041 2041
 			}
2042 2042
 		}
2043 2043
 
2044 2044
 	} else {
2045 2045
 		// The Update Ran.
2046
-		give_set_upgrade_complete( 'v20_upgrades_donor_name' );
2046
+		give_set_upgrade_complete('v20_upgrades_donor_name');
2047 2047
 	}
2048 2048
 
2049 2049
 }
@@ -2072,15 +2072,15 @@  discard block
 block discarded – undo
2072 2072
 
2073 2073
 	$users = $user_query->get_results();
2074 2074
 
2075
-	if ( $users ) {
2076
-		$give_updates->set_percentage( $user_query->get_total(), $give_updates->step * 100 );
2075
+	if ($users) {
2076
+		$give_updates->set_percentage($user_query->get_total(), $give_updates->step * 100);
2077 2077
 
2078 2078
 		// Loop through Donors
2079
-		foreach ( $users as $user ) {
2079
+		foreach ($users as $user) {
2080 2080
 			/* @var Give_Donor $donor */
2081
-			$donor = new Give_Donor( $user->ID, true );
2081
+			$donor = new Give_Donor($user->ID, true);
2082 2082
 
2083
-			if ( ! $donor->id ) {
2083
+			if ( ! $donor->id) {
2084 2084
 				continue;
2085 2085
 			}
2086 2086
 
@@ -2096,10 +2096,10 @@  discard block
 block discarded – undo
2096 2096
 				)
2097 2097
 			);
2098 2098
 
2099
-			if ( ! empty( $address ) ) {
2100
-				$address = maybe_unserialize( $address );
2101
-				$donor->add_address( 'personal', $address );
2102
-				$donor->add_address( 'billing[]', $address );
2099
+			if ( ! empty($address)) {
2100
+				$address = maybe_unserialize($address);
2101
+				$donor->add_address('personal', $address);
2102
+				$donor->add_address('billing[]', $address);
2103 2103
 
2104 2104
 
2105 2105
 				// @todo: delete _give_user_address from user meta after releases 2.0.
@@ -2109,7 +2109,7 @@  discard block
 block discarded – undo
2109 2109
 
2110 2110
 	} else {
2111 2111
 		// The Update Ran.
2112
-		give_set_upgrade_complete( 'v20_upgrades_user_address' );
2112
+		give_set_upgrade_complete('v20_upgrades_user_address');
2113 2113
 	}
2114 2114
 
2115 2115
 }
@@ -2133,15 +2133,15 @@  discard block
 block discarded – undo
2133 2133
 	);
2134 2134
 
2135 2135
 	// Alter customer table
2136
-	foreach ( $tables as $old_table => $new_table ) {
2136
+	foreach ($tables as $old_table => $new_table) {
2137 2137
 		if (
2138
-			$wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $old_table ) ) &&
2139
-			! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", $new_table ) )
2138
+			$wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $old_table)) &&
2139
+			! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", $new_table))
2140 2140
 		) {
2141
-			$wpdb->query( "ALTER TABLE {$old_table} RENAME TO {$new_table}" );
2141
+			$wpdb->query("ALTER TABLE {$old_table} RENAME TO {$new_table}");
2142 2142
 
2143
-			if ( "{$wpdb->prefix}give_donormeta" === $new_table ) {
2144
-				$wpdb->query( "ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)" );
2143
+			if ("{$wpdb->prefix}give_donormeta" === $new_table) {
2144
+				$wpdb->query("ALTER TABLE {$new_table} CHANGE COLUMN customer_id donor_id bigint(20)");
2145 2145
 			}
2146 2146
 		}
2147 2147
 	}
@@ -2149,7 +2149,7 @@  discard block
 block discarded – undo
2149 2149
 	$give_updates->percentage = 100;
2150 2150
 
2151 2151
 	// No more forms found, finish up.
2152
-	give_set_upgrade_complete( 'v20_rename_donor_tables' );
2152
+	give_set_upgrade_complete('v20_rename_donor_tables');
2153 2153
 
2154 2154
 	// Re initiate donor classes.
2155 2155
 	Give()->donors     = new Give_DB_Donors();
@@ -2164,22 +2164,22 @@  discard block
 block discarded – undo
2164 2164
  * @global wpdb $wpdb
2165 2165
  * @return void
2166 2166
  */
2167
-function give_v201_create_tables(){
2167
+function give_v201_create_tables() {
2168 2168
 	global $wpdb;
2169 2169
 
2170
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta" ) ) ) {
2170
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_paymentmeta"))) {
2171 2171
 		Give()->payment_meta->create_table();
2172 2172
 	}
2173 2173
 
2174
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta" ) ) ) {
2174
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_formmeta"))) {
2175 2175
 		Give()->form_meta->create_table();
2176 2176
 	}
2177 2177
 
2178
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs" ) ) ) {
2178
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logs"))) {
2179 2179
 		Give()->logs->log_db->create_table();
2180 2180
 	}
2181 2181
 
2182
-	if ( ! $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta" ) ) ) {
2182
+	if ( ! $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_logmeta"))) {
2183 2183
 		Give()->logs->logmeta_db->create_table();
2184 2184
 	}
2185 2185
 }
@@ -2196,7 +2196,7 @@  discard block
 block discarded – undo
2196 2196
 	$give_updates = Give_Updates::get_instance();
2197 2197
 
2198 2198
 	// form query
2199
-	$forms = new WP_Query( array(
2199
+	$forms = new WP_Query(array(
2200 2200
 			'paged'          => $give_updates->step,
2201 2201
 			'status'         => 'any',
2202 2202
 			'order'          => 'ASC',
@@ -2213,25 +2213,25 @@  discard block
 block discarded – undo
2213 2213
 		)
2214 2214
 	);
2215 2215
 
2216
-	if ( $forms->have_posts() ) {
2217
-		$give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 100 ) );
2216
+	if ($forms->have_posts()) {
2217
+		$give_updates->set_percentage($forms->found_posts, ($give_updates->step * 100));
2218 2218
 
2219
-		while ( $forms->have_posts() ) {
2219
+		while ($forms->have_posts()) {
2220 2220
 			$forms->the_post();
2221 2221
 			global $post;
2222 2222
 
2223 2223
 			// Do not add new meta keys if already refactored.
2224
-			if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, '_give_payment_donor_id' ) ) ) {
2224
+			if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, '_give_payment_donor_id'))) {
2225 2225
 				continue;
2226 2226
 			}
2227 2227
 
2228 2228
 
2229 2229
 			// Split _give_payment_meta meta.
2230 2230
 			// @todo Remove _give_payment_meta after releases 2.0
2231
-			$payment_meta = give_get_meta( $post->ID, '_give_payment_meta', true );
2231
+			$payment_meta = give_get_meta($post->ID, '_give_payment_meta', true);
2232 2232
 
2233
-			if ( ! empty( $payment_meta ) ) {
2234
-				_give_20_bc_split_and_save_give_payment_meta( $post->ID, $payment_meta );
2233
+			if ( ! empty($payment_meta)) {
2234
+				_give_20_bc_split_and_save_give_payment_meta($post->ID, $payment_meta);
2235 2235
 			}
2236 2236
 
2237 2237
 			$deprecated_meta_keys = array(
@@ -2240,9 +2240,9 @@  discard block
 block discarded – undo
2240 2240
 				'_give_payment_user_ip'     => '_give_payment_donor_ip',
2241 2241
 			);
2242 2242
 
2243
-			foreach ( $deprecated_meta_keys as $old_meta_key => $new_meta_key ) {
2243
+			foreach ($deprecated_meta_keys as $old_meta_key => $new_meta_key) {
2244 2244
 				// Do not add new meta key if already exist.
2245
-				if ( $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key ) ) ) {
2245
+				if ($wpdb->get_var($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id=%d AND meta_key=%s", $post->ID, $new_meta_key))) {
2246 2246
 					continue;
2247 2247
 				}
2248 2248
 
@@ -2251,25 +2251,25 @@  discard block
 block discarded – undo
2251 2251
 					array(
2252 2252
 						'post_id' => $post->ID,
2253 2253
 						'meta_key' => $new_meta_key,
2254
-						'meta_value' => give_get_meta( $post->ID, $old_meta_key, true )
2254
+						'meta_value' => give_get_meta($post->ID, $old_meta_key, true)
2255 2255
 					)
2256 2256
 				);
2257 2257
 			}
2258 2258
 
2259 2259
 			// Bailout
2260
-			if ( $donor_id = give_get_meta( $post->ID, '_give_payment_donor_id', true ) ) {
2260
+			if ($donor_id = give_get_meta($post->ID, '_give_payment_donor_id', true)) {
2261 2261
 				/* @var Give_Donor $donor */
2262
-				$donor = new Give_Donor( $donor_id );
2262
+				$donor = new Give_Donor($donor_id);
2263 2263
 
2264
-				$address['line1']   = give_get_meta( $post->ID, '_give_donor_billing_address1', true, '' );
2265
-				$address['line2']   = give_get_meta( $post->ID, '_give_donor_billing_address2', true, '' );
2266
-				$address['city']    = give_get_meta( $post->ID, '_give_donor_billing_city', true, '' );
2267
-				$address['state']   = give_get_meta( $post->ID, '_give_donor_billing_state', true, '' );
2268
-				$address['zip']     = give_get_meta( $post->ID, '_give_donor_billing_zip', true, '' );
2269
-				$address['country'] = give_get_meta( $post->ID, '_give_donor_billing_country', true, '' );
2264
+				$address['line1']   = give_get_meta($post->ID, '_give_donor_billing_address1', true, '');
2265
+				$address['line2']   = give_get_meta($post->ID, '_give_donor_billing_address2', true, '');
2266
+				$address['city']    = give_get_meta($post->ID, '_give_donor_billing_city', true, '');
2267
+				$address['state']   = give_get_meta($post->ID, '_give_donor_billing_state', true, '');
2268
+				$address['zip']     = give_get_meta($post->ID, '_give_donor_billing_zip', true, '');
2269
+				$address['country'] = give_get_meta($post->ID, '_give_donor_billing_country', true, '');
2270 2270
 
2271 2271
 				// Save address.
2272
-				$donor->add_address( 'billing[]', $address );
2272
+				$donor->add_address('billing[]', $address);
2273 2273
 			}
2274 2274
 
2275 2275
 		}// End while().
@@ -2280,7 +2280,7 @@  discard block
 block discarded – undo
2280 2280
 		// $wpdb->get_var( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key=%s", '_give_payment_user_id' ) );
2281 2281
 
2282 2282
 		// No more forms found, finish up.
2283
-		give_set_upgrade_complete( 'v201_upgrades_payment_metadata' );
2283
+		give_set_upgrade_complete('v201_upgrades_payment_metadata');
2284 2284
 	}
2285 2285
 }
2286 2286
 
@@ -2295,19 +2295,19 @@  discard block
 block discarded – undo
2295 2295
 	$give_updates = Give_Updates::get_instance();
2296 2296
 
2297 2297
 	// form query
2298
-	$payments = new WP_Query( array(
2298
+	$payments = new WP_Query(array(
2299 2299
 			'paged'          => $give_updates->step,
2300 2300
 			'status'         => 'any',
2301 2301
 			'order'          => 'ASC',
2302
-			'post_type'      => array( 'give_forms', 'give_payment' ),
2302
+			'post_type'      => array('give_forms', 'give_payment'),
2303 2303
 			'posts_per_page' => 100,
2304 2304
 		)
2305 2305
 	);
2306 2306
 
2307
-	if ( $payments->have_posts() ) {
2308
-		$give_updates->set_percentage( $payments->found_posts, $give_updates->step * 100 );
2307
+	if ($payments->have_posts()) {
2308
+		$give_updates->set_percentage($payments->found_posts, $give_updates->step * 100);
2309 2309
 
2310
-		while ( $payments->have_posts() ) {
2310
+		while ($payments->have_posts()) {
2311 2311
 			$payments->the_post();
2312 2312
 			global $post;
2313 2313
 
@@ -2319,19 +2319,19 @@  discard block
 block discarded – undo
2319 2319
 				ARRAY_A
2320 2320
 			);
2321 2321
 
2322
-			if ( ! empty( $meta_data ) ) {
2323
-				foreach ( $meta_data as $index => $data ) {
2322
+			if ( ! empty($meta_data)) {
2323
+				foreach ($meta_data as $index => $data) {
2324 2324
 					// Check for duplicate meta values.
2325
-					if( $result = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM " . ( 'give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta ) .  " WHERE meta_id=%d", $data['meta_id'] ), ARRAY_A ) ) {
2325
+					if ($result = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".('give_forms' === $post->post_type ? $wpdb->formmeta : $wpdb->paymentmeta)." WHERE meta_id=%d", $data['meta_id']), ARRAY_A)) {
2326 2326
 						continue;
2327 2327
 					}
2328 2328
 
2329
-					switch ( $post->post_type ) {
2329
+					switch ($post->post_type) {
2330 2330
 						case 'give_forms':
2331 2331
 							$data['form_id'] = $data['post_id'];
2332
-							unset( $data['post_id'] );
2332
+							unset($data['post_id']);
2333 2333
 
2334
-							Give()->form_meta->insert( $data );
2334
+							Give()->form_meta->insert($data);
2335 2335
 							// @todo: delete form meta from post meta table after releases 2.0.
2336 2336
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
2337 2337
 
@@ -2339,9 +2339,9 @@  discard block
 block discarded – undo
2339 2339
 
2340 2340
 						case 'give_payment':
2341 2341
 							$data['payment_id'] = $data['post_id'];
2342
-							unset( $data['post_id'] );
2342
+							unset($data['post_id']);
2343 2343
 
2344
-							Give()->payment_meta->insert( $data );
2344
+							Give()->payment_meta->insert($data);
2345 2345
 
2346 2346
 							// @todo: delete donation meta from post meta table after releases 2.0.
2347 2347
 							/*delete_post_meta( get_the_ID(), $data['meta_key'] );*/
@@ -2356,7 +2356,7 @@  discard block
 block discarded – undo
2356 2356
 		wp_reset_postdata();
2357 2357
 	} else {
2358 2358
 		// No more forms found, finish up.
2359
-		give_set_upgrade_complete( 'v201_move_metadata_into_new_table' );
2359
+		give_set_upgrade_complete('v201_move_metadata_into_new_table');
2360 2360
 	}
2361 2361
 
2362 2362
 }
@@ -2372,7 +2372,7 @@  discard block
 block discarded – undo
2372 2372
 	$give_updates = Give_Updates::get_instance();
2373 2373
 
2374 2374
 	// form query
2375
-	$forms = new WP_Query( array(
2375
+	$forms = new WP_Query(array(
2376 2376
 			'paged'          => $give_updates->step,
2377 2377
 			'order'          => 'DESC',
2378 2378
 			'post_type'      => 'give_log',
@@ -2381,20 +2381,20 @@  discard block
 block discarded – undo
2381 2381
 		)
2382 2382
 	);
2383 2383
 
2384
-	if ( $forms->have_posts() ) {
2385
-		$give_updates->set_percentage( $forms->found_posts, $give_updates->step * 100 );
2384
+	if ($forms->have_posts()) {
2385
+		$give_updates->set_percentage($forms->found_posts, $give_updates->step * 100);
2386 2386
 
2387
-		while ( $forms->have_posts() ) {
2387
+		while ($forms->have_posts()) {
2388 2388
 			$forms->the_post();
2389 2389
 			global $post;
2390 2390
 
2391
-			if( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID ) ) ) {
2391
+			if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_logs WHERE ID=%d", $post->ID))) {
2392 2392
 				continue;
2393 2393
 			}
2394 2394
 
2395
-			$term      = get_the_terms( $post->ID, 'give_log_type' );
2396
-			$term      = ! is_wp_error( $term ) && ! empty( $term ) ? $term[0] : array();
2397
-			$term_name = ! empty( $term ) ? $term->slug : '';
2395
+			$term      = get_the_terms($post->ID, 'give_log_type');
2396
+			$term      = ! is_wp_error($term) && ! empty($term) ? $term[0] : array();
2397
+			$term_name = ! empty($term) ? $term->slug : '';
2398 2398
 
2399 2399
 			$log_data = array(
2400 2400
 				'ID'           => $post->ID,
@@ -2407,29 +2407,29 @@  discard block
 block discarded – undo
2407 2407
 			);
2408 2408
 			$log_meta = array();
2409 2409
 
2410
-			if ( $old_log_meta = get_post_meta( $post->ID ) ) {
2411
-				foreach ( $old_log_meta as $meta_key => $meta_value ) {
2412
-					switch ( $meta_key ) {
2410
+			if ($old_log_meta = get_post_meta($post->ID)) {
2411
+				foreach ($old_log_meta as $meta_key => $meta_value) {
2412
+					switch ($meta_key) {
2413 2413
 						case '_give_log_payment_id':
2414
-							$log_data['log_parent']        = current( $meta_value );
2414
+							$log_data['log_parent']        = current($meta_value);
2415 2415
 							$log_meta['_give_log_form_id'] = $post->post_parent;
2416 2416
 							break;
2417 2417
 
2418 2418
 						default:
2419
-							$log_meta[ $meta_key ] = current( $meta_value );
2419
+							$log_meta[$meta_key] = current($meta_value);
2420 2420
 					}
2421 2421
 				}
2422 2422
 			}
2423 2423
 
2424
-			if ( 'api_request' === $term_name ) {
2424
+			if ('api_request' === $term_name) {
2425 2425
 				$log_meta['_give_log_api_query'] = $post->post_excerpt;
2426 2426
 			}
2427 2427
 
2428
-			$wpdb->insert( "{$wpdb->prefix}give_logs", $log_data );
2428
+			$wpdb->insert("{$wpdb->prefix}give_logs", $log_data);
2429 2429
 
2430
-			if ( ! empty( $log_meta ) ) {
2431
-				foreach ( $log_meta as $meta_key => $meta_value ) {
2432
-					Give()->logs->logmeta_db->update_meta( $post->ID, $meta_key, $meta_value );
2430
+			if ( ! empty($log_meta)) {
2431
+				foreach ($log_meta as $meta_key => $meta_value) {
2432
+					Give()->logs->logmeta_db->update_meta($post->ID, $meta_key, $meta_value);
2433 2433
 				}
2434 2434
 			}
2435 2435
 
@@ -2442,7 +2442,7 @@  discard block
 block discarded – undo
2442 2442
 		Give()->logs->delete_cache();
2443 2443
 
2444 2444
 		// No more forms found, finish up.
2445
-		give_set_upgrade_complete( 'v201_logs_upgrades' );
2445
+		give_set_upgrade_complete('v201_logs_upgrades');
2446 2446
 	}
2447 2447
 }
2448 2448
 
@@ -2453,54 +2453,54 @@  discard block
 block discarded – undo
2453 2453
  * @since  2.0.1
2454 2454
  * @return void
2455 2455
  */
2456
-function give_v201_add_missing_donors_callback(){
2456
+function give_v201_add_missing_donors_callback() {
2457 2457
 	global $wpdb;
2458 2458
 
2459
-	if ( $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers" ) ) ) {
2460
-		$customers  = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_customers" ), 'id' );
2461
-		$donors     = wp_list_pluck( $wpdb->get_results( "SELECT id FROM {$wpdb->prefix}give_donors" ), 'id' );
2459
+	if ($wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customers"))) {
2460
+		$customers  = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_customers"), 'id');
2461
+		$donors     = wp_list_pluck($wpdb->get_results("SELECT id FROM {$wpdb->prefix}give_donors"), 'id');
2462 2462
 		$donor_data = array();
2463 2463
 
2464
-		if ( $missing_donors = array_diff( $customers, $donors ) ) {
2465
-			foreach ( $missing_donors as $donor_id ) {
2464
+		if ($missing_donors = array_diff($customers, $donors)) {
2465
+			foreach ($missing_donors as $donor_id) {
2466 2466
 				$donor_data[] = array(
2467
-					'info' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id ) ),
2468
-					'meta' => $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id ) ),
2467
+					'info' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customers WHERE id=%d", $donor_id)),
2468
+					'meta' => $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_customermeta WHERE customer_id=%d", $donor_id)),
2469 2469
 
2470 2470
 				);
2471 2471
 			}
2472 2472
 		}
2473 2473
 
2474
-		if( ! empty( $donor_data ) ) {
2474
+		if ( ! empty($donor_data)) {
2475 2475
 			$donor_table_name = Give()->donors->table_name;
2476 2476
 			$donor_meta_table_name = Give()->donor_meta->table_name;
2477 2477
 
2478 2478
 			Give()->donors->table_name = "{$wpdb->prefix}give_donors";
2479 2479
 			Give()->donor_meta->table_name = "{$wpdb->prefix}give_donormeta";
2480 2480
 
2481
-			foreach ( $donor_data as $donor ) {
2481
+			foreach ($donor_data as $donor) {
2482 2482
 				$donor['info'][0] = (array) $donor['info'][0];
2483 2483
 
2484 2484
 				// Prevent duplicate meta id issue.
2485
-				if( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id'] ) ) ){
2485
+				if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donors WHERE id=%d", $donor['info'][0]['id']))) {
2486 2486
 					continue;
2487 2487
 				}
2488 2488
 
2489
-				$donor_id = Give()->donors->add( $donor['info'][0] );
2489
+				$donor_id = Give()->donors->add($donor['info'][0]);
2490 2490
 
2491
-				if( ! empty( $donor['meta'] ) ) {
2492
-					foreach ( $donor['meta'] as $donor_meta ) {
2491
+				if ( ! empty($donor['meta'])) {
2492
+					foreach ($donor['meta'] as $donor_meta) {
2493 2493
 						$donor_meta = (array) $donor_meta;
2494 2494
 
2495 2495
 						// Prevent duplicate meta id issue.
2496
-						if( $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id'] ) ) ){
2497
-							unset( $donor_meta['meta_id'] );
2496
+						if ($wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->prefix}give_donormeta WHERE meta_id=%d", $donor_meta['meta_id']))) {
2497
+							unset($donor_meta['meta_id']);
2498 2498
 						}
2499 2499
 
2500 2500
 						$donor_meta['donor_id'] = $donor_meta['customer_id'];
2501
-						unset( $donor_meta['customer_id'] );
2501
+						unset($donor_meta['customer_id']);
2502 2502
 
2503
-						Give()->donor_meta->insert( $donor_meta );
2503
+						Give()->donor_meta->insert($donor_meta);
2504 2504
 					}
2505 2505
 				}
2506 2506
 
@@ -2519,35 +2519,35 @@  discard block
 block discarded – undo
2519 2519
 					)
2520 2520
 				);
2521 2521
 
2522
-				$donor = new Give_Donor( $donor_id );
2522
+				$donor = new Give_Donor($donor_id);
2523 2523
 
2524
-				if ( ! empty( $address ) ) {
2525
-					$address = maybe_unserialize( $address );
2526
-					$donor->add_address( 'personal', $address );
2527
-					$donor->add_address( 'billing[]', $address );
2524
+				if ( ! empty($address)) {
2525
+					$address = maybe_unserialize($address);
2526
+					$donor->add_address('personal', $address);
2527
+					$donor->add_address('billing[]', $address);
2528 2528
 				}
2529 2529
 
2530
-				$donor_name       = explode( ' ', $donor->name, 2 );
2531
-				$donor_first_name = Give()->donor_meta->get_meta( $donor->id, '_give_donor_first_name' );
2532
-				$donor_last_name  = Give()->donor_meta->get_meta( $donor->id, '_give_donor_last_name' );
2530
+				$donor_name       = explode(' ', $donor->name, 2);
2531
+				$donor_first_name = Give()->donor_meta->get_meta($donor->id, '_give_donor_first_name');
2532
+				$donor_last_name  = Give()->donor_meta->get_meta($donor->id, '_give_donor_last_name');
2533 2533
 
2534 2534
 				// If first name meta of donor is not created, then create it.
2535
-				if ( ! $donor_first_name && isset( $donor_name[0] ) ) {
2536
-					Give()->donor_meta->add_meta( $donor->id, '_give_donor_first_name', $donor_name[0] );
2535
+				if ( ! $donor_first_name && isset($donor_name[0])) {
2536
+					Give()->donor_meta->add_meta($donor->id, '_give_donor_first_name', $donor_name[0]);
2537 2537
 				}
2538 2538
 
2539 2539
 				// If last name meta of donor is not created, then create it.
2540
-				if ( ! $donor_last_name && isset( $donor_name[1] ) ) {
2541
-					Give()->donor_meta->add_meta( $donor->id, '_give_donor_last_name', $donor_name[1] );
2540
+				if ( ! $donor_last_name && isset($donor_name[1])) {
2541
+					Give()->donor_meta->add_meta($donor->id, '_give_donor_last_name', $donor_name[1]);
2542 2542
 				}
2543 2543
 
2544 2544
 				// If Donor is connected with WP User then update user meta.
2545
-				if ( $donor->user_id ) {
2546
-					if ( isset( $donor_name[0] ) ) {
2547
-						update_user_meta( $donor->user_id, 'first_name', $donor_name[0] );
2545
+				if ($donor->user_id) {
2546
+					if (isset($donor_name[0])) {
2547
+						update_user_meta($donor->user_id, 'first_name', $donor_name[0]);
2548 2548
 					}
2549
-					if ( isset( $donor_name[1] ) ) {
2550
-						update_user_meta( $donor->user_id, 'last_name', $donor_name[1] );
2549
+					if (isset($donor_name[1])) {
2550
+						update_user_meta($donor->user_id, 'last_name', $donor_name[1]);
2551 2551
 					}
2552 2552
 				}
2553 2553
 			}
@@ -2558,5 +2558,5 @@  discard block
 block discarded – undo
2558 2558
 	}
2559 2559
 
2560 2560
 	Give_Updates::get_instance()->percentage = 100;
2561
-	give_set_upgrade_complete('v201_add_missing_donors' );
2561
+	give_set_upgrade_complete('v201_add_missing_donors');
2562 2562
 }
2563 2563
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/upgrades/views/upgrades.php 1 patch
Spacing   +30 added lines, -31 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
 
@@ -18,48 +18,47 @@  discard block
 block discarded – undo
18 18
 ?>
19 19
 <div class="wrap" id="poststuff">
20 20
 	<div id="give-updates">
21
-		<h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates', 'give' ); ?></h1>
21
+		<h1 id="give-updates-h1"><?php esc_html_e('Give - Updates', 'give'); ?></h1>
22 22
 		<hr class="wp-header-end">
23 23
 
24 24
 		<div class="give-update-panel-content">
25
-			<p><?php printf( __( 'Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons.  Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give' ), 'https://givewp.com/my-account/' ); ?></p>
25
+			<p><?php printf(__('Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons.  Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give'), 'https://givewp.com/my-account/'); ?></p>
26 26
 		</div>
27 27
 
28 28
 		<?php $db_updates = $give_updates->get_pending_db_update_count(); ?>
29
-		<?php if ( ! empty( $db_updates ) ) : ?>
29
+		<?php if ( ! empty($db_updates)) : ?>
30 30
 			<?php
31 31
 			$is_doing_updates = $give_updates->is_doing_updates();
32
-			$db_update_url    = add_query_arg( array( 'type' => 'database', ) );
33
-			$resume_updates   = get_option( 'give_doing_upgrade' );
34
-			$width            = ! empty( $resume_updates ) ? $resume_updates['percentage'] : 0;
32
+			$db_update_url    = add_query_arg(array('type' => 'database',));
33
+			$resume_updates   = get_option('give_doing_upgrade');
34
+			$width            = ! empty($resume_updates) ? $resume_updates['percentage'] : 0;
35 35
 			?>
36
-			<div id="give-db-updates" data-resume-update="<?php echo absint( $give_updates->is_doing_updates() ); ?>">
36
+			<div id="give-db-updates" data-resume-update="<?php echo absint($give_updates->is_doing_updates()); ?>">
37 37
 				<div class="postbox-container">
38 38
 					<div class="postbox">
39
-						<h2 class="hndle"><?php _e( 'Database Updates', 'give' ); ?></h2>
39
+						<h2 class="hndle"><?php _e('Database Updates', 'give'); ?></h2>
40 40
 						<div class="inside">
41 41
 							<div class="panel-content">
42 42
 								<p class="give-update-button">
43
-									<span class="give-doing-update-text-p" <?php echo Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : '';  ?>>
43
+									<span class="give-doing-update-text-p" <?php echo Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>>
44 44
 										<?php echo sprintf(
45
-										__( '%1$s <a href="%2$s" class="%3$s">%4$s</a>', 'give' ),
45
+										__('%1$s <a href="%2$s" class="%3$s">%4$s</a>', 'give'),
46 46
 										$is_doing_updates ?
47
-											__( 'Give is currently updating the database in the background.', 'give' ) :
48
-											__( 'Give needs to update the database.', 'give' ),
47
+											__('Give is currently updating the database in the background.', 'give') : __('Give needs to update the database.', 'give'),
49 48
 										$db_update_url,
50
-										( $is_doing_updates ? 'give-hidden' : '' ),
51
-										__( 'Update now', 'give' )
49
+										($is_doing_updates ? 'give-hidden' : ''),
50
+										__('Update now', 'give')
52 51
 									);
53 52
 									?>
54 53
 									</span>
55
-									<span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process()  ? 'style="display:none;"' : '';  ?>>
54
+									<span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>>
56 55
 										<?php _e('The updates have been paused.', 'give'); ?>
57 56
 									</span>
58 57
 
59
-									<?php if ( Give_Updates::$background_updater->is_paused_process() ) : ?>
60
-										<button id="give-restart-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url( admin_url( '/edit.php?post_type=give_forms&page=give-updates&give-restart-db-upgrades=1' ) ); ?>"><?php _e( 'Restart Upgrades', 'give' ); ?></button>
61
-									<?php elseif( $give_updates->is_doing_updates() ): ?>
62
-										<button id="give-pause-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url( admin_url( '/edit.php?post_type=give_forms&page=give-updates&give-pause-db-upgrades=1' ) ); ?>"><?php _e( 'Pause Upgrades', 'give' ); ?></button>
58
+									<?php if (Give_Updates::$background_updater->is_paused_process()) : ?>
59
+										<button id="give-restart-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url(admin_url('/edit.php?post_type=give_forms&page=give-updates&give-restart-db-upgrades=1')); ?>"><?php _e('Restart Upgrades', 'give'); ?></button>
60
+									<?php elseif ($give_updates->is_doing_updates()): ?>
61
+										<button id="give-pause-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url(admin_url('/edit.php?post_type=give_forms&page=give-updates&give-pause-db-upgrades=1')); ?>"><?php _e('Pause Upgrades', 'give'); ?></button>
63 62
 									<?php endif; ?>
64 63
 
65 64
 									<script type="text/javascript">
@@ -67,7 +66,7 @@  discard block
 block discarded – undo
67 66
 											e.preventDefault();
68 67
 											jQuery('.give-doing-update-text-p').hide();
69 68
 											jQuery('.give-update-paused-text-p').show();
70
-											if (window.confirm('<?php echo esc_js( __( 'Do you want to stop the update process now?', 'give' ) ); ?>')) {
69
+											if (window.confirm('<?php echo esc_js(__('Do you want to stop the update process now?', 'give')); ?>')) {
71 70
 												window.location.assign(jQuery(this).data('redirect-url'));
72 71
 											}
73 72
 										});
@@ -75,7 +74,7 @@  discard block
 block discarded – undo
75 74
 											e.preventDefault();
76 75
 											jQuery('.give-doing-update-text-p').show();
77 76
 											jQuery('.give-update-paused-text-p').hide();
78
-											if (window.confirm('<?php echo esc_js( __( 'Do you want to restart the update process?', 'give' ) ); ?>')) {
77
+											if (window.confirm('<?php echo esc_js(__('Do you want to restart the update process?', 'give')); ?>')) {
79 78
 												window.location.assign(jQuery(this).data('redirect-url'));
80 79
 											}
81 80
 										});
@@ -87,7 +86,7 @@  discard block
 block discarded – undo
87 86
 									<strong>
88 87
 										<?php
89 88
 										echo sprintf(
90
-											__( 'Update %s of %s', 'give' ),
89
+											__('Update %s of %s', 'give'),
91 90
 											$give_updates->get_running_db_update(),
92 91
 											$give_updates->get_total_new_db_update_count()
93 92
 										);
@@ -95,10 +94,10 @@  discard block
 block discarded – undo
95 94
 									</strong>
96 95
 								</p>
97 96
 								<div class="progress-content">
98
-									<?php if ( $is_doing_updates  ) : ?>
97
+									<?php if ($is_doing_updates) : ?>
99 98
 										<div class="notice-wrap give-clearfix">
100 99
 
101
-											<?php if ( ! Give_Updates::$background_updater->is_paused_process() ) :  ?>
100
+											<?php if ( ! Give_Updates::$background_updater->is_paused_process()) :  ?>
102 101
 												<span class="spinner is-active"></span>
103 102
 											<?php endif; ?>
104 103
 
@@ -110,7 +109,7 @@  discard block
 block discarded – undo
110 109
 								</div>
111 110
 							</div>
112 111
 
113
-							<?php if ( ! $is_doing_updates ) : ?>
112
+							<?php if ( ! $is_doing_updates) : ?>
114 113
 								<div class="give-run-database-update"></div>
115 114
 							<?php endif; ?>
116 115
 						</div>
@@ -121,17 +120,17 @@  discard block
 block discarded – undo
121 120
 		<?php endif; ?>
122 121
 
123 122
 		<?php $plugin_updates = $give_updates->get_total_plugin_update_count(); ?>
124
-		<?php if ( ! empty( $plugin_updates ) ) : ?>
125
-			<?php $plugin_update_url = add_query_arg( array(
123
+		<?php if ( ! empty($plugin_updates)) : ?>
124
+			<?php $plugin_update_url = add_query_arg(array(
126 125
 				's' => 'Give',
127
-			), admin_url( '/plugins.php' ) ); ?>
126
+			), admin_url('/plugins.php')); ?>
128 127
 			<div id="give-plugin-updates">
129 128
 				<div class="postbox-container">
130 129
 					<div class="postbox">
131
-						<h2 class="hndle"><?php _e( 'Add-on Updates', 'give' ); ?></h2>
130
+						<h2 class="hndle"><?php _e('Add-on Updates', 'give'); ?></h2>
132 131
 						<div class="inside">
133 132
 							<div class="panel-content">
134
-								<p><?php echo sprintf( __( 'There %1$s %2$s Give %3$s that %4$s to be updated. <a href="%5$s">Update now</a>', 'give' ), _n( 'is', 'are', $plugin_updates, 'give' ), $plugin_updates, _n( 'add-on', 'add-ons', $plugin_updates, 'give' ), _n( 'needs', 'need', $plugin_updates, 'give' ), $plugin_update_url ); ?></p>
133
+								<p><?php echo sprintf(__('There %1$s %2$s Give %3$s that %4$s to be updated. <a href="%5$s">Update now</a>', 'give'), _n('is', 'are', $plugin_updates, 'give'), $plugin_updates, _n('add-on', 'add-ons', $plugin_updates, 'give'), _n('needs', 'need', $plugin_updates, 'give'), $plugin_update_url); ?></p>
135 134
 								<?php include_once 'plugins-update-section.php'; ?>
136 135
 							</div>
137 136
 						</div>
Please login to merge, or discard this patch.
includes/admin/tools/class-settings-logs.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Logs' ) ) :
16
+if ( ! class_exists('Give_Settings_Logs')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Logs.
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		 */
35 35
 		public function __construct() {
36 36
 			$this->id    = 'logs';
37
-			$this->label = __( 'Logs', 'give' );
37
+			$this->label = __('Logs', 'give');
38 38
 
39 39
 			$this->default_tab = 'sales';
40 40
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 		 */
51 51
 		public function get_settings() {
52 52
 			// Get settings.
53
-			$settings = apply_filters( 'give_settings_logs', array(
53
+			$settings = apply_filters('give_settings_logs', array(
54 54
 				array(
55 55
 					'id'         => 'give_tools_logs',
56 56
 					'type'       => 'title',
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 				),
59 59
 				array(
60 60
 					'id'   => 'logs',
61
-					'name' => __( 'Log', 'give' ),
61
+					'name' => __('Log', 'give'),
62 62
 					'type' => 'logs',
63 63
 
64 64
 				),
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 					'type'       => 'sectionend',
68 68
 					'table_html' => false,
69 69
 				),
70
-			) );
70
+			));
71 71
 
72 72
 			/**
73 73
 			 * Filter the settings.
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 			 *
77 77
 			 * @param  array $settings
78 78
 			 */
79
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
79
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
80 80
 
81 81
 			// Output.
82 82
 			return $settings;
@@ -90,15 +90,15 @@  discard block
 block discarded – undo
90 90
 		 */
91 91
 		public function get_sections() {
92 92
 			$sections = array(
93
-				'sales'          => __( 'Donations', 'give' ),
94
-				'gateway_errors' => __( 'Payment Errors', 'give' ),
95
-				'api_requests'   => __( 'API Requests', 'give' ),
96
-				'updates'   => __( 'Updates', 'give' ),
93
+				'sales'          => __('Donations', 'give'),
94
+				'gateway_errors' => __('Payment Errors', 'give'),
95
+				'api_requests'   => __('API Requests', 'give'),
96
+				'updates'   => __('Updates', 'give'),
97 97
 			);
98 98
 
99
-			$sections = apply_filters( 'give_log_views', $sections );
99
+			$sections = apply_filters('give_log_views', $sections);
100 100
 
101
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
101
+			return apply_filters('give_get_sections_'.$this->id, $sections);
102 102
 		}
103 103
 	}
104 104
 
Please login to merge, or discard this patch.
includes/admin/tools/logs/logs.php 1 patch
Spacing   +26 added lines, -26 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
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function give_get_logs_tab() {
24 24
 
25
-	require( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php' );
25
+	require(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php');
26 26
 
27 27
 	// Get current section.
28 28
 	$current_section = $_GET['section'] = give_get_current_setting_section();
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @since 1.0
34 34
 	 */
35
-	do_action( "give_logs_view_{$current_section}" );
35
+	do_action("give_logs_view_{$current_section}");
36 36
 }
37 37
 
38 38
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
  */
47 47
 function give_logs_view_sales() {
48 48
 
49
-	include GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-sales-logs-list-table.php';
49
+	include GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-sales-logs-list-table.php';
50 50
 
51 51
 	$logs_table = new Give_Sales_Log_Table();
52 52
 	$logs_table->prepare_items();
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		 *
60 60
 		 * @since 1.8.12
61 61
 		 */
62
-		do_action( 'give_logs_donations_top' );
62
+		do_action('give_logs_donations_top');
63 63
 
64 64
 		$logs_table->display(); ?>
65 65
 		<input type="hidden" name="post_type" value="give_forms"/>
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
 		 *
74 74
 		 * @since 1.8.12
75 75
 		 */
76
-		do_action( 'give_logs_donations_bottom' );
76
+		do_action('give_logs_donations_bottom');
77 77
 		?>
78 78
 
79 79
 	</div>
80 80
 	<?php
81 81
 }
82 82
 
83
-add_action( 'give_logs_view_sales', 'give_logs_view_sales' );
83
+add_action('give_logs_view_sales', 'give_logs_view_sales');
84 84
 
85 85
 /**
86 86
  * Update Logs
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
  * @return void
91 91
  */
92 92
 function give_logs_view_updates() {
93
-	include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-update-logs-list-table.php' );
93
+	include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-update-logs-list-table.php');
94 94
 
95 95
 	$logs_table = new Give_Update_Log_Table();
96 96
 	$logs_table->prepare_items();
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		 *
104 104
 		 * @since 2.0.1
105 105
 		 */
106
-		do_action( 'give_logs_update_top' );
106
+		do_action('give_logs_update_top');
107 107
 
108 108
 		$logs_table->display(); ?>
109 109
 		<input type="hidden" name="post_type" value="give_forms"/>
@@ -117,14 +117,14 @@  discard block
 block discarded – undo
117 117
 		 *
118 118
 		 * @since 2.0.1
119 119
 		 */
120
-		do_action( 'give_logs_update_bottom' );
120
+		do_action('give_logs_update_bottom');
121 121
 		?>
122 122
 
123 123
 	</div>
124 124
 	<?php
125 125
 }
126 126
 
127
-add_action( 'give_logs_view_updates', 'give_logs_view_updates' );
127
+add_action('give_logs_view_updates', 'give_logs_view_updates');
128 128
 
129 129
 /**
130 130
  * Gateway Error Logs
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
  * @return void
136 136
  */
137 137
 function give_logs_view_gateway_errors() {
138
-	include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-gateway-error-logs-list-table.php' );
138
+	include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-gateway-error-logs-list-table.php');
139 139
 
140 140
 	$logs_table = new Give_Gateway_Error_Log_Table();
141 141
 	$logs_table->prepare_items();
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		 *
149 149
 		 * @since 1.8.12
150 150
 		 */
151
-		do_action( 'give_logs_payment_error_top' );
151
+		do_action('give_logs_payment_error_top');
152 152
 
153 153
 		$logs_table->display(); ?>
154 154
 		<input type="hidden" name="post_type" value="give_forms"/>
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
 		 *
163 163
 		 * @since 1.8.12
164 164
 		 */
165
-		do_action( 'give_logs_payment_error_bottom' );
165
+		do_action('give_logs_payment_error_bottom');
166 166
 		?>
167 167
 
168 168
 	</div>
169 169
 	<?php
170 170
 }
171 171
 
172
-add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' );
172
+add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors');
173 173
 
174 174
 /**
175 175
  * API Request Logs
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
  * @return void
181 181
  */
182 182
 function give_logs_view_api_requests() {
183
-	include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-api-requests-logs-list-table.php' );
183
+	include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-api-requests-logs-list-table.php');
184 184
 
185 185
 	$logs_table = new Give_API_Request_Log_Table();
186 186
 	$logs_table->prepare_items();
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
 	 *
191 191
 	 * @since 1.0
192 192
 	 */
193
-	do_action( 'give_logs_api_requests_top' );
193
+	do_action('give_logs_api_requests_top');
194 194
 
195
-	$logs_table->search_box( esc_html__( 'Search', 'give' ), 'give-api-requests' );
195
+	$logs_table->search_box(esc_html__('Search', 'give'), 'give-api-requests');
196 196
 	$logs_table->display();
197 197
 	?>
198 198
 	<input type="hidden" name="post_type" value="give_forms"/>
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @since 1.0
208 208
 	 */
209
-	do_action( 'give_logs_api_requests_bottom' );
209
+	do_action('give_logs_api_requests_bottom');
210 210
 }
211
-add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' );
211
+add_action('give_logs_view_api_requests', 'give_logs_view_api_requests');
212 212
 
213 213
 /**
214 214
  * Renders the log views drop down.
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
 	$current_section = give_get_current_setting_section();
221 221
 
222 222
 	// If there are not any event attach to action then do not show form.
223
-	if ( ! has_action( 'give_log_view_actions' ) ) {
223
+	if ( ! has_action('give_log_view_actions')) {
224 224
 		return;
225 225
 	}
226 226
 	?>
227
-	<form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs&section=' . $current_section; ?>">
227
+	<form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs&section='.$current_section; ?>">
228 228
 		<?php
229 229
 		/**
230 230
 		 * Fires after displaying the reports page views drop down.
@@ -233,14 +233,14 @@  discard block
 block discarded – undo
233 233
 		 *
234 234
 		 * @since 1.0
235 235
 		 */
236
-		do_action( 'give_log_view_actions' );
236
+		do_action('give_log_view_actions');
237 237
 		?>
238 238
 
239 239
 		<input type="hidden" name="post_type" value="give_forms"/>
240 240
 		<input type="hidden" name="page" value="give-tools"/>
241 241
 		<input type="hidden" name="tab" value="logs"/>
242 242
 
243
-		<?php submit_button( esc_html__( 'Apply', 'give' ), 'secondary', 'submit', false ); ?>
243
+		<?php submit_button(esc_html__('Apply', 'give'), 'secondary', 'submit', false); ?>
244 244
 	</form>
245 245
 	<?php
246 246
 }
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
  *
253 253
  * @return string
254 254
  */
255
-function give_tools_set_form_method( $method ) {
255
+function give_tools_set_form_method($method) {
256 256
 	return 'get';
257 257
 }
258
-add_filter( 'give-tools_form_method_tab_logs', 'give_tools_set_form_method', 10 );
258
+add_filter('give-tools_form_method_tab_logs', 'give_tools_set_form_method', 10);
Please login to merge, or discard this patch.
includes/admin/tools/logs/class-update-logs-list-table.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  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
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 		global $status, $page;
46 46
 
47 47
 		// Set parent defaults
48
-		parent::__construct( array(
49
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
50
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
51
-			'ajax'     => false,// Does this table support ajax?
52
-		) );
48
+		parent::__construct(array(
49
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
50
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
51
+			'ajax'     => false, // Does this table support ajax?
52
+		));
53 53
 	}
54 54
 
55 55
 	/**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @return void
65 65
 	 */
66
-	public function search_box( $text, $input_id ) {
66
+	public function search_box($text, $input_id) {
67 67
 	}
68 68
 
69 69
 	/**
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function get_columns() {
78 78
 		$columns = array(
79
-			'ID'      => __( 'Log ID', 'give' ),
80
-			'date'    => __( 'Date', 'give' ),
81
-			'details' => __( 'Process Details', 'give' ),
79
+			'ID'      => __('Log ID', 'give'),
80
+			'date'    => __('Date', 'give'),
81
+			'details' => __('Process Details', 'give'),
82 82
 		);
83 83
 
84 84
 		return $columns;
@@ -95,17 +95,17 @@  discard block
 block discarded – undo
95 95
 	 *
96 96
 	 * @return string Column Name
97 97
 	 */
98
-	public function column_default( $item, $column_name ) {
99
-		switch ( $column_name ) {
98
+	public function column_default($item, $column_name) {
99
+		switch ($column_name) {
100 100
 			case 'ID':
101 101
 				return sprintf(
102 102
 					'<span class="give-item-label give-item-label-gray">%1$s</span> %2$s',
103
-					esc_attr( $item[ $column_name ] ),
104
-					esc_attr( $item['title'] )
103
+					esc_attr($item[$column_name]),
104
+					esc_attr($item['title'])
105 105
 				);
106 106
 
107 107
 			default:
108
-				return esc_attr( $item[ $column_name ] );
108
+				return esc_attr($item[$column_name]);
109 109
 		}
110 110
 	}
111 111
 
@@ -119,24 +119,24 @@  discard block
 block discarded – undo
119 119
 	 *
120 120
 	 * @return void
121 121
 	 */
122
-	public function column_details( $item ) {
123
-		echo Give()->tooltips->render_link( array(
124
-			'label'       => __( 'View Update Log', 'give' ),
122
+	public function column_details($item) {
123
+		echo Give()->tooltips->render_link(array(
124
+			'label'       => __('View Update Log', 'give'),
125 125
 			'tag_content' => '<span class="dashicons dashicons-visibility"></span>',
126 126
 			'link'        => "#TB_inline?width=640&amp;inlineId=log-details-{$item['ID']}",
127 127
 			'attributes'  => array(
128 128
 				'class' => 'thickbox give-error-log-details-link button button-small',
129 129
 			),
130
-		) );
130
+		));
131 131
 		?>
132 132
 		<div id="log-details-<?php echo $item['ID']; ?>" style="display:none;">
133 133
 			<?php
134 134
 
135 135
 			// Print Log Content, if not empty.
136
-			if ( ! empty( $item['log_content'] ) ) {
136
+			if ( ! empty($item['log_content'])) {
137 137
 				echo sprintf(
138 138
 					'<p><pre>%1$s</pre></div>',
139
-					esc_html( $item['log_content'] )
139
+					esc_html($item['log_content'])
140 140
 				);
141 141
 			}
142 142
 			?>
@@ -157,19 +157,19 @@  discard block
 block discarded – undo
157 157
 	 *
158 158
 	 * @param string $which
159 159
 	 */
160
-	protected function display_tablenav( $which ) {
161
-		if ( 'top' === $which ) {
162
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
160
+	protected function display_tablenav($which) {
161
+		if ('top' === $which) {
162
+			wp_nonce_field('bulk-'.$this->_args['plural']);
163 163
 		}
164 164
 		?>
165
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
165
+		<div class="tablenav <?php echo esc_attr($which); ?>">
166 166
 
167 167
 			<div class="alignleft actions bulkactions">
168
-				<?php $this->bulk_actions( $which ); ?>
168
+				<?php $this->bulk_actions($which); ?>
169 169
 			</div>
170 170
 			<?php
171
-			$this->extra_tablenav( $which );
172
-			$this->pagination( $which );
171
+			$this->extra_tablenav($which);
172
+			$this->pagination($which);
173 173
 			?>
174 174
 
175 175
 			<br class="clear"/>
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 * @return int Current page number
187 187
 	 */
188 188
 	public function get_paged() {
189
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
189
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
190 190
 	}
191 191
 
192 192
 	/**
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @return void
201 201
 	 */
202
-	function bulk_actions( $which = '' ) {
202
+	function bulk_actions($which = '') {
203 203
 	}
204 204
 
205 205
 	/**
@@ -219,10 +219,10 @@  discard block
 block discarded – undo
219 219
 			'posts_per_page' => $this->per_page,
220 220
 		);
221 221
 
222
-		$logs = Give()->logs->get_connected_logs( $log_query );
222
+		$logs = Give()->logs->get_connected_logs($log_query);
223 223
 
224
-		if ( $logs ) {
225
-			foreach ( $logs as $log ) {
224
+		if ($logs) {
225
+			foreach ($logs as $log) {
226 226
 
227 227
 				$logs_data[] = array(
228 228
 					'ID'          => $log->ID,
@@ -254,14 +254,14 @@  discard block
 block discarded – undo
254 254
 		$columns               = $this->get_columns();
255 255
 		$hidden                = array(); // No hidden columns
256 256
 		$sortable              = $this->get_sortable_columns();
257
-		$this->_column_headers = array( $columns, $hidden, $sortable );
257
+		$this->_column_headers = array($columns, $hidden, $sortable);
258 258
 		$this->items           = $this->get_logs();
259
-		$total_items           = Give()->logs->get_log_count( 0, 'update' );
259
+		$total_items           = Give()->logs->get_log_count(0, 'update');
260 260
 
261
-		$this->set_pagination_args( array(
261
+		$this->set_pagination_args(array(
262 262
 				'total_items' => $total_items,
263 263
 				'per_page'    => $this->per_page,
264
-				'total_pages' => ceil( $total_items / $this->per_page ),
264
+				'total_pages' => ceil($total_items / $this->per_page),
265 265
 			)
266 266
 		);
267 267
 	}
Please login to merge, or discard this patch.