Test Failed
Pull Request — master (#2551)
by Devin
04:51
created
includes/payments/functions.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
  *
706 706
  * @since 1.0
707 707
  *
708
- * @return int $earnings Earnings
708
+ * @return double $earnings Earnings
709 709
  */
710 710
 function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
711 711
 
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
  *
994 994
  * @since 1.0
995 995
  *
996
- * @return array $user_info User Info Meta Values.
996
+ * @return string $user_info User Info Meta Values.
997 997
  */
998 998
 function give_get_payment_meta_user_info( $payment_id ) {
999 999
 	$payment = new Give_Payment( $payment_id );
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
  *
1011 1011
  * @since 1.0
1012 1012
  *
1013
- * @return int $form_id Form ID.
1013
+ * @return string $form_id Form ID.
1014 1014
  */
1015 1015
 function give_get_payment_form_id( $payment_id ) {
1016 1016
 	$payment = new Give_Payment( $payment_id );
Please login to merge, or discard this patch.
Spacing   +373 added lines, -375 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
 
@@ -43,15 +43,15 @@  discard block
 block discarded – undo
43 43
  *
44 44
  * @return array $payments Payments retrieved from the database
45 45
  */
46
-function give_get_payments( $args = array() ) {
46
+function give_get_payments($args = array()) {
47 47
 
48 48
 	// Fallback to post objects to ensure backwards compatibility.
49
-	if ( ! isset( $args['output'] ) ) {
49
+	if ( ! isset($args['output'])) {
50 50
 		$args['output'] = 'posts';
51 51
 	}
52 52
 
53
-	$args     = apply_filters( 'give_get_payments_args', $args );
54
-	$payments = new Give_Payments_Query( $args );
53
+	$args     = apply_filters('give_get_payments_args', $args);
54
+	$payments = new Give_Payments_Query($args);
55 55
 
56 56
 	return $payments->get_payments();
57 57
 }
@@ -66,48 +66,48 @@  discard block
 block discarded – undo
66 66
  *
67 67
  * @return mixed
68 68
  */
69
-function give_get_payment_by( $field = '', $value = '' ) {
69
+function give_get_payment_by($field = '', $value = '') {
70 70
 
71
-	if ( empty( $field ) || empty( $value ) ) {
71
+	if (empty($field) || empty($value)) {
72 72
 		return false;
73 73
 	}
74 74
 
75
-	switch ( strtolower( $field ) ) {
75
+	switch (strtolower($field)) {
76 76
 
77 77
 		case 'id':
78
-			$payment = new Give_Payment( $value );
78
+			$payment = new Give_Payment($value);
79 79
 			$id      = $payment->ID;
80 80
 
81
-			if ( empty( $id ) ) {
81
+			if (empty($id)) {
82 82
 				return false;
83 83
 			}
84 84
 
85 85
 			break;
86 86
 
87 87
 		case 'key':
88
-			$payment = give_get_payments( array(
88
+			$payment = give_get_payments(array(
89 89
 				'meta_key'       => '_give_payment_purchase_key',
90 90
 				'meta_value'     => $value,
91 91
 				'posts_per_page' => 1,
92 92
 				'fields'         => 'ids',
93
-			) );
93
+			));
94 94
 
95
-			if ( $payment ) {
96
-				$payment = new Give_Payment( $payment[0] );
95
+			if ($payment) {
96
+				$payment = new Give_Payment($payment[0]);
97 97
 			}
98 98
 
99 99
 			break;
100 100
 
101 101
 		case 'payment_number':
102
-			$payment = give_get_payments( array(
102
+			$payment = give_get_payments(array(
103 103
 				'meta_key'       => '_give_payment_number',
104 104
 				'meta_value'     => $value,
105 105
 				'posts_per_page' => 1,
106 106
 				'fields'         => 'ids',
107
-			) );
107
+			));
108 108
 
109
-			if ( $payment ) {
110
-				$payment = new Give_Payment( $payment[0] );
109
+			if ($payment) {
110
+				$payment = new Give_Payment($payment[0]);
111 111
 			}
112 112
 
113 113
 			break;
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 			return false;
117 117
 	}// End switch().
118 118
 
119
-	if ( $payment ) {
119
+	if ($payment) {
120 120
 		return $payment;
121 121
 	}
122 122
 
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
  *
133 133
  * @return int|bool Payment ID if payment is inserted, false otherwise.
134 134
  */
135
-function give_insert_payment( $payment_data = array() ) {
135
+function give_insert_payment($payment_data = array()) {
136 136
 
137
-	if ( empty( $payment_data ) ) {
137
+	if (empty($payment_data)) {
138 138
 		return false;
139 139
 	}
140 140
 
@@ -145,25 +145,25 @@  discard block
 block discarded – undo
145 145
 	 *
146 146
 	 * @param array $payment_data Arguments passed.
147 147
 	 */
148
-	$payment_data = apply_filters( 'give_pre_insert_payment', $payment_data );
148
+	$payment_data = apply_filters('give_pre_insert_payment', $payment_data);
149 149
 
150 150
 	$payment    = new Give_Payment();
151
-	$gateway    = ! empty( $payment_data['gateway'] ) ? $payment_data['gateway'] : '';
152
-	$gateway    = empty( $gateway ) && isset( $_POST['give-gateway'] ) ? $_POST['give-gateway'] : $gateway;
153
-	$form_id    = isset( $payment_data['give_form_id'] ) ? $payment_data['give_form_id'] : 0;
154
-	$price_id   = give_get_payment_meta_price_id( $payment_data );
155
-	$form_title = isset( $payment_data['give_form_title'] ) ? $payment_data['give_form_title'] : get_the_title( $form_id );
151
+	$gateway    = ! empty($payment_data['gateway']) ? $payment_data['gateway'] : '';
152
+	$gateway    = empty($gateway) && isset($_POST['give-gateway']) ? $_POST['give-gateway'] : $gateway;
153
+	$form_id    = isset($payment_data['give_form_id']) ? $payment_data['give_form_id'] : 0;
154
+	$price_id   = give_get_payment_meta_price_id($payment_data);
155
+	$form_title = isset($payment_data['give_form_title']) ? $payment_data['give_form_title'] : get_the_title($form_id);
156 156
 
157 157
 	// Set properties.
158 158
 	$payment->total          = $payment_data['price'];
159
-	$payment->status         = ! empty( $payment_data['status'] ) ? $payment_data['status'] : 'pending';
160
-	$payment->currency       = ! empty( $payment_data['currency'] ) ? $payment_data['currency'] : give_get_currency( $payment_data['give_form_id'], $payment_data );
159
+	$payment->status         = ! empty($payment_data['status']) ? $payment_data['status'] : 'pending';
160
+	$payment->currency       = ! empty($payment_data['currency']) ? $payment_data['currency'] : give_get_currency($payment_data['give_form_id'], $payment_data);
161 161
 	$payment->user_info      = $payment_data['user_info'];
162 162
 	$payment->gateway        = $gateway;
163 163
 	$payment->form_title     = $form_title;
164 164
 	$payment->form_id        = $form_id;
165 165
 	$payment->price_id       = $price_id;
166
-	$payment->donor_id       = ( ! empty( $payment_data['donor_id'] ) ? $payment_data['donor_id'] : '' );
166
+	$payment->donor_id       = ( ! empty($payment_data['donor_id']) ? $payment_data['donor_id'] : '');
167 167
 	$payment->user_id        = $payment_data['user_info']['id'];
168 168
 	$payment->email          = $payment_data['user_email'];
169 169
 	$payment->first_name     = $payment_data['user_info']['first_name'];
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	$payment->email          = $payment_data['user_info']['email'];
172 172
 	$payment->ip             = give_get_ip();
173 173
 	$payment->key            = $payment_data['purchase_key'];
174
-	$payment->mode           = ( ! empty( $payment_data['mode'] ) ? (string) $payment_data['mode'] : ( give_is_test_mode() ? 'test' : 'live' ) );
175
-	$payment->parent_payment = ! empty( $payment_data['parent'] ) ? absint( $payment_data['parent'] ) : '';
174
+	$payment->mode           = ( ! empty($payment_data['mode']) ? (string) $payment_data['mode'] : (give_is_test_mode() ? 'test' : 'live'));
175
+	$payment->parent_payment = ! empty($payment_data['parent']) ? absint($payment_data['parent']) : '';
176 176
 
177 177
 	// Add the donation.
178 178
 	$args = array(
@@ -180,19 +180,19 @@  discard block
 block discarded – undo
180 180
 		'price_id' => $payment->price_id,
181 181
 	);
182 182
 
183
-	$payment->add_donation( $payment->form_id, $args );
183
+	$payment->add_donation($payment->form_id, $args);
184 184
 
185 185
 
186 186
 	// Set date if present.
187
-	if ( isset( $payment_data['post_date'] ) ) {
187
+	if (isset($payment_data['post_date'])) {
188 188
 		$payment->date = $payment_data['post_date'];
189 189
 	}
190 190
 
191 191
 	// Handle sequential payments.
192
-	if ( give_get_option( 'enable_sequential' ) ) {
192
+	if (give_get_option('enable_sequential')) {
193 193
 		$number          = give_get_next_payment_number();
194
-		$payment->number = give_format_payment_number( $number );
195
-		update_option( 'give_last_payment_number', $number );
194
+		$payment->number = give_format_payment_number($number);
195
+		update_option('give_last_payment_number', $number);
196 196
 	}
197 197
 
198 198
 	// Save payment.
@@ -206,10 +206,10 @@  discard block
 block discarded – undo
206 206
 	 * @param int   $payment_id   The payment ID.
207 207
 	 * @param array $payment_data Arguments passed.
208 208
 	 */
209
-	do_action( 'give_insert_payment', $payment->ID, $payment_data );
209
+	do_action('give_insert_payment', $payment->ID, $payment_data);
210 210
 
211 211
 	// Return payment ID upon success.
212
-	if ( ! empty( $payment->ID ) ) {
212
+	if ( ! empty($payment->ID)) {
213 213
 		return $payment->ID;
214 214
 	}
215 215
 
@@ -225,10 +225,10 @@  discard block
 block discarded – undo
225 225
  *
226 226
  * @return bool|int
227 227
  */
228
-function give_create_payment( $payment_data ) {
228
+function give_create_payment($payment_data) {
229 229
 
230
-	$form_id  = intval( $payment_data['post_data']['give-form-id'] );
231
-	$price_id = isset( $payment_data['post_data']['give-price-id'] ) ? $payment_data['post_data']['give-price-id'] : '';
230
+	$form_id  = intval($payment_data['post_data']['give-form-id']);
231
+	$price_id = isset($payment_data['post_data']['give-price-id']) ? $payment_data['post_data']['give-price-id'] : '';
232 232
 
233 233
 	// Collect payment data.
234 234
 	$insert_payment_data = array(
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 		'date'            => $payment_data['date'],
240 240
 		'user_email'      => $payment_data['user_email'],
241 241
 		'purchase_key'    => $payment_data['purchase_key'],
242
-		'currency'        => give_get_currency( $form_id, $payment_data ),
242
+		'currency'        => give_get_currency($form_id, $payment_data),
243 243
 		'user_info'       => $payment_data['user_info'],
244 244
 		'status'          => 'pending',
245 245
 		'gateway'         => 'paypal',
@@ -252,10 +252,10 @@  discard block
 block discarded – undo
252 252
 	 *
253 253
 	 * @param array $insert_payment_data
254 254
 	 */
255
-	$insert_payment_data = apply_filters( 'give_create_payment', $insert_payment_data );
255
+	$insert_payment_data = apply_filters('give_create_payment', $insert_payment_data);
256 256
 
257 257
 	// Record the pending payment.
258
-	return give_insert_payment( $insert_payment_data );
258
+	return give_insert_payment($insert_payment_data);
259 259
 }
260 260
 
261 261
 /**
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
  *
269 269
  * @return bool
270 270
  */
271
-function give_update_payment_status( $payment_id, $new_status = 'publish' ) {
271
+function give_update_payment_status($payment_id, $new_status = 'publish') {
272 272
 
273 273
 	$updated = false;
274
-	$payment = new Give_Payment( $payment_id );
274
+	$payment = new Give_Payment($payment_id);
275 275
 
276
-	if ( $payment && $payment->ID > 0 ) {
276
+	if ($payment && $payment->ID > 0) {
277 277
 
278 278
 		$payment->status = $new_status;
279 279
 		$updated         = $payment->save();
@@ -295,48 +295,48 @@  discard block
 block discarded – undo
295 295
  *
296 296
  * @return void
297 297
  */
298
-function give_delete_donation( $payment_id = 0, $update_donor = true ) {
298
+function give_delete_donation($payment_id = 0, $update_donor = true) {
299 299
 
300 300
 	global $give_logs;
301 301
 
302
-	$payment  = new Give_Payment( $payment_id );
302
+	$payment = new Give_Payment($payment_id);
303 303
 
304 304
 	// Bailout.
305
-	if( ! $payment->ID ) {
305
+	if ( ! $payment->ID) {
306 306
 		return;
307 307
 	}
308 308
 
309
-	$amount   = give_donation_amount( $payment_id );
309
+	$amount   = give_donation_amount($payment_id);
310 310
 	$status   = $payment->post_status;
311
-	$donor_id = give_get_payment_donor_id( $payment_id );
312
-	$donor    = new Give_Donor( $donor_id );
311
+	$donor_id = give_get_payment_donor_id($payment_id);
312
+	$donor    = new Give_Donor($donor_id);
313 313
 
314 314
 	// Only undo donations that aren't these statuses.
315
-	$dont_undo_statuses = apply_filters( 'give_undo_donation_statuses', array(
315
+	$dont_undo_statuses = apply_filters('give_undo_donation_statuses', array(
316 316
 		'pending',
317 317
 		'cancelled',
318
-	) );
318
+	));
319 319
 
320
-	if ( ! in_array( $status, $dont_undo_statuses ) ) {
321
-		give_undo_donation( $payment_id );
320
+	if ( ! in_array($status, $dont_undo_statuses)) {
321
+		give_undo_donation($payment_id);
322 322
 	}
323 323
 
324 324
 	// Only undo donations that aren't these statuses.
325
-	$status_to_decrease_stats = apply_filters( 'give_decrease_donor_statuses', array( 'publish' ) );
325
+	$status_to_decrease_stats = apply_filters('give_decrease_donor_statuses', array('publish'));
326 326
 
327
-	if ( in_array( $status, $status_to_decrease_stats ) ) {
327
+	if (in_array($status, $status_to_decrease_stats)) {
328 328
 
329 329
 		// Only decrease earnings if they haven't already been decreased (or were never increased for this payment).
330
-		give_decrease_total_earnings( $amount );
330
+		give_decrease_total_earnings($amount);
331 331
 
332 332
 		// @todo: Refresh only range related stat cache
333 333
 		give_delete_donation_stats();
334 334
 
335
-		if ( $donor->id && $update_donor ) {
335
+		if ($donor->id && $update_donor) {
336 336
 
337 337
 			// Decrement the stats for the donor.
338 338
 			$donor->decrease_donation_count();
339
-			$donor->decrease_value( $amount );
339
+			$donor->decrease_value($amount);
340 340
 
341 341
 		}
342 342
 	}
@@ -348,23 +348,23 @@  discard block
 block discarded – undo
348 348
 	 *
349 349
 	 * @since 1.0
350 350
 	 */
351
-	do_action( 'give_payment_delete', $payment_id );
351
+	do_action('give_payment_delete', $payment_id);
352 352
 
353
-	if ( $donor->id && $update_donor ) {
353
+	if ($donor->id && $update_donor) {
354 354
 		// Remove the payment ID from the donor.
355
-		$donor->remove_payment( $payment_id );
355
+		$donor->remove_payment($payment_id);
356 356
 	}
357 357
 
358 358
 	// Remove the payment.
359
-	wp_delete_post( $payment_id, true );
359
+	wp_delete_post($payment_id, true);
360 360
 
361 361
 	// Remove related sale log entries.
362
-	$give_logs->delete_logs( null, 'sale', array(
362
+	$give_logs->delete_logs(null, 'sale', array(
363 363
 		array(
364 364
 			'key'   => '_give_log_payment_id',
365 365
 			'value' => $payment_id,
366 366
 		),
367
-	) );
367
+	));
368 368
 
369 369
 	/**
370 370
 	 * Fires after payment deleted.
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 	 *
374 374
 	 * @since 1.0
375 375
 	 */
376
-	do_action( 'give_payment_deleted', $payment_id );
376
+	do_action('give_payment_deleted', $payment_id);
377 377
 }
378 378
 
379 379
 /**
@@ -388,20 +388,20 @@  discard block
 block discarded – undo
388 388
  *
389 389
  * @return void
390 390
  */
391
-function give_undo_donation( $payment_id ) {
391
+function give_undo_donation($payment_id) {
392 392
 
393
-	$payment = new Give_Payment( $payment_id );
393
+	$payment = new Give_Payment($payment_id);
394 394
 
395
-	$maybe_decrease_earnings = apply_filters( 'give_decrease_earnings_on_undo', true, $payment, $payment->form_id );
396
-	if ( true === $maybe_decrease_earnings ) {
395
+	$maybe_decrease_earnings = apply_filters('give_decrease_earnings_on_undo', true, $payment, $payment->form_id);
396
+	if (true === $maybe_decrease_earnings) {
397 397
 		// Decrease earnings.
398
-		give_decrease_form_earnings( $payment->form_id, $payment->total );
398
+		give_decrease_form_earnings($payment->form_id, $payment->total);
399 399
 	}
400 400
 
401
-	$maybe_decrease_donations = apply_filters( 'give_decrease_donations_on_undo', true, $payment, $payment->form_id );
402
-	if ( true === $maybe_decrease_donations ) {
401
+	$maybe_decrease_donations = apply_filters('give_decrease_donations_on_undo', true, $payment, $payment->form_id);
402
+	if (true === $maybe_decrease_donations) {
403 403
 		// Decrease donation count.
404
-		give_decrease_donation_count( $payment->form_id );
404
+		give_decrease_donation_count($payment->form_id);
405 405
 	}
406 406
 
407 407
 }
@@ -418,21 +418,21 @@  discard block
 block discarded – undo
418 418
  *
419 419
  * @return object $stats Contains the number of payments per payment status.
420 420
  */
421
-function give_count_payments( $args = array() ) {
421
+function give_count_payments($args = array()) {
422 422
 	// Backward compatibility.
423
-	if( ! empty( $args['start-date'] ) ) {
423
+	if ( ! empty($args['start-date'])) {
424 424
 		$args['start_date'] = $args['start-date'];
425
-		unset( $args['start-date'] );
425
+		unset($args['start-date']);
426 426
 	}
427 427
 
428
-	if( ! empty( $args['end-date'] ) ) {
428
+	if ( ! empty($args['end-date'])) {
429 429
 		$args['end_date'] = $args['end-date'];
430
-		unset( $args['end-date'] );
430
+		unset($args['end-date']);
431 431
 	}
432 432
 
433
-	if( ! empty( $args['form_id'] ) ) {
433
+	if ( ! empty($args['form_id'])) {
434 434
 		$args['give_forms'] = $args['form_id'];
435
-		unset( $args['form_id'] );
435
+		unset($args['form_id']);
436 436
 	}
437 437
 
438 438
 	// Extract all donations
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	$args['group_by']    = 'post_status';
441 441
 	$args['count']       = 'true';
442 442
 
443
-	$donations_obj = new Give_Payments_Query( $args );
443
+	$donations_obj = new Give_Payments_Query($args);
444 444
 	$donations_count = $donations_obj->get_payment_by_group();
445 445
 
446 446
 	/**
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 	 *
449 449
 	 * @since 1.0
450 450
 	 */
451
-	return (object) apply_filters( 'give_count_payments', $donations_count, $args, $donations_obj );
451
+	return (object) apply_filters('give_count_payments', $donations_count, $args, $donations_obj);
452 452
 }
453 453
 
454 454
 
@@ -461,11 +461,11 @@  discard block
 block discarded – undo
461 461
  *
462 462
  * @return bool $exists True if payment exists, false otherwise.
463 463
  */
464
-function give_check_for_existing_payment( $payment_id ) {
464
+function give_check_for_existing_payment($payment_id) {
465 465
 	$exists  = false;
466
-	$payment = new Give_Payment( $payment_id );
466
+	$payment = new Give_Payment($payment_id);
467 467
 
468
-	if ( $payment_id === $payment->ID && 'publish' === $payment->status ) {
468
+	if ($payment_id === $payment->ID && 'publish' === $payment->status) {
469 469
 		$exists = true;
470 470
 	}
471 471
 
@@ -482,41 +482,41 @@  discard block
 block discarded – undo
482 482
  *
483 483
  * @return bool|mixed True if payment status exists, false otherwise.
484 484
  */
485
-function give_get_payment_status( $payment, $return_label = false ) {
485
+function give_get_payment_status($payment, $return_label = false) {
486 486
 
487
-	if ( is_numeric( $payment ) ) {
487
+	if (is_numeric($payment)) {
488 488
 
489
-		$payment = new Give_Payment( $payment );
489
+		$payment = new Give_Payment($payment);
490 490
 
491
-		if ( ! $payment->ID > 0 ) {
491
+		if ( ! $payment->ID > 0) {
492 492
 			return false;
493 493
 		}
494 494
 
495 495
 	}
496 496
 
497
-	if ( ! is_object( $payment ) || ! isset( $payment->post_status ) ) {
497
+	if ( ! is_object($payment) || ! isset($payment->post_status)) {
498 498
 		return false;
499 499
 	}
500 500
 
501 501
 	$statuses = give_get_payment_statuses();
502 502
 
503
-	if ( ! is_array( $statuses ) || empty( $statuses ) ) {
503
+	if ( ! is_array($statuses) || empty($statuses)) {
504 504
 		return false;
505 505
 	}
506 506
 
507 507
 	// Get payment object if not already given.
508
-	$payment = $payment instanceof Give_Payment ? $payment : new Give_Payment( $payment->ID );
508
+	$payment = $payment instanceof Give_Payment ? $payment : new Give_Payment($payment->ID);
509 509
 
510
-	if ( array_key_exists( $payment->status, $statuses ) ) {
511
-		if ( true === $return_label ) {
510
+	if (array_key_exists($payment->status, $statuses)) {
511
+		if (true === $return_label) {
512 512
 			// Return translated status label.
513
-			return $statuses[ $payment->status ];
513
+			return $statuses[$payment->status];
514 514
 		} else {
515 515
 			// Account that our 'publish' status is labeled 'Complete'
516 516
 			$post_status = 'publish' === $payment->status ? 'Complete' : $payment->post_status;
517 517
 
518 518
 			// Make sure we're matching cases, since they matter
519
-			return array_search( strtolower( $post_status ), array_map( 'strtolower', $statuses ) );
519
+			return array_search(strtolower($post_status), array_map('strtolower', $statuses));
520 520
 		}
521 521
 	}
522 522
 
@@ -532,18 +532,18 @@  discard block
 block discarded – undo
532 532
  */
533 533
 function give_get_payment_statuses() {
534 534
 	$payment_statuses = array(
535
-		'pending'     => __( 'Pending', 'give' ),
536
-		'publish'     => __( 'Complete', 'give' ),
537
-		'refunded'    => __( 'Refunded', 'give' ),
538
-		'failed'      => __( 'Failed', 'give' ),
539
-		'cancelled'   => __( 'Cancelled', 'give' ),
540
-		'abandoned'   => __( 'Abandoned', 'give' ),
541
-		'preapproval' => __( 'Pre-Approved', 'give' ),
542
-		'processing'  => __( 'Processing', 'give' ),
543
-		'revoked'     => __( 'Revoked', 'give' ),
535
+		'pending'     => __('Pending', 'give'),
536
+		'publish'     => __('Complete', 'give'),
537
+		'refunded'    => __('Refunded', 'give'),
538
+		'failed'      => __('Failed', 'give'),
539
+		'cancelled'   => __('Cancelled', 'give'),
540
+		'abandoned'   => __('Abandoned', 'give'),
541
+		'preapproval' => __('Pre-Approved', 'give'),
542
+		'processing'  => __('Processing', 'give'),
543
+		'revoked'     => __('Revoked', 'give'),
544 544
 	);
545 545
 
546
-	return apply_filters( 'give_payment_statuses', $payment_statuses );
546
+	return apply_filters('give_payment_statuses', $payment_statuses);
547 547
 }
548 548
 
549 549
 /**
@@ -556,10 +556,10 @@  discard block
 block discarded – undo
556 556
  * @return array $payment_status All the available payment statuses.
557 557
  */
558 558
 function give_get_payment_status_keys() {
559
-	$statuses = array_keys( give_get_payment_statuses() );
560
-	asort( $statuses );
559
+	$statuses = array_keys(give_get_payment_statuses());
560
+	asort($statuses);
561 561
 
562
-	return array_values( $statuses );
562
+	return array_values($statuses);
563 563
 }
564 564
 
565 565
 /**
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
  *
575 575
  * @return int $earnings Earnings
576 576
  */
577
-function give_get_earnings_by_date( $day = null, $month_num, $year = null, $hour = null ) {
577
+function give_get_earnings_by_date($day = null, $month_num, $year = null, $hour = null) {
578 578
 
579 579
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_earnings() method instead.
580 580
 	global $wpdb;
@@ -584,33 +584,33 @@  discard block
 block discarded – undo
584 584
 		'nopaging'               => true,
585 585
 		'year'                   => $year,
586 586
 		'monthnum'               => $month_num,
587
-		'post_status'            => array( 'publish' ),
587
+		'post_status'            => array('publish'),
588 588
 		'fields'                 => 'ids',
589 589
 		'update_post_term_cache' => false,
590 590
 	);
591
-	if ( ! empty( $day ) ) {
591
+	if ( ! empty($day)) {
592 592
 		$args['day'] = $day;
593 593
 	}
594 594
 
595
-	if ( isset( $hour ) ) {
595
+	if (isset($hour)) {
596 596
 		$args['hour'] = $hour;
597 597
 	}
598 598
 
599
-	$args = apply_filters( 'give_get_earnings_by_date_args', $args );
600
-	$key  = Give_Cache::get_key( 'give_stats', $args );
599
+	$args = apply_filters('give_get_earnings_by_date_args', $args);
600
+	$key  = Give_Cache::get_key('give_stats', $args);
601 601
 
602
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
602
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
603 603
 		$earnings = false;
604 604
 	} else {
605
-		$earnings = Give_Cache::get( $key );
605
+		$earnings = Give_Cache::get($key);
606 606
 	}
607 607
 
608
-	if ( false === $earnings ) {
609
-		$donations = get_posts( $args );
608
+	if (false === $earnings) {
609
+		$donations = get_posts($args);
610 610
 		$earnings  = 0;
611
-		if ( $donations ) {
612
-			$donations      = implode( ',', $donations );
613
-			$earning_totals = $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$donations})" );
611
+		if ($donations) {
612
+			$donations      = implode(',', $donations);
613
+			$earning_totals = $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN ({$donations})");
614 614
 
615 615
 			/**
616 616
 			 * Filter The earnings by dates.
@@ -621,13 +621,13 @@  discard block
 block discarded – undo
621 621
 			 * @param array $donations      Donations lists.
622 622
 			 * @param array $args           Donation query args.
623 623
 			 */
624
-			$earnings = apply_filters( 'give_get_earnings_by_date', $earning_totals, $donations, $args );
624
+			$earnings = apply_filters('give_get_earnings_by_date', $earning_totals, $donations, $args);
625 625
 		}
626 626
 		// Cache the results for one hour.
627
-		Give_Cache::set( $key, $earnings, HOUR_IN_SECONDS );
627
+		Give_Cache::set($key, $earnings, HOUR_IN_SECONDS);
628 628
 	}
629 629
 
630
-	return round( $earnings, 2 );
630
+	return round($earnings, 2);
631 631
 }
632 632
 
633 633
 /**
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
  *
643 643
  * @return int $count Sales
644 644
  */
645
-function give_get_sales_by_date( $day = null, $month_num = null, $year = null, $hour = null ) {
645
+function give_get_sales_by_date($day = null, $month_num = null, $year = null, $hour = null) {
646 646
 
647 647
 	// This is getting deprecated soon. Use Give_Payment_Stats with the get_sales() method instead.
648 648
 	$args = array(
@@ -650,14 +650,14 @@  discard block
 block discarded – undo
650 650
 		'nopaging'               => true,
651 651
 		'year'                   => $year,
652 652
 		'fields'                 => 'ids',
653
-		'post_status'            => array( 'publish' ),
653
+		'post_status'            => array('publish'),
654 654
 		'update_post_meta_cache' => false,
655 655
 		'update_post_term_cache' => false,
656 656
 	);
657 657
 
658
-	$show_free = apply_filters( 'give_sales_by_date_show_free', true, $args );
658
+	$show_free = apply_filters('give_sales_by_date_show_free', true, $args);
659 659
 
660
-	if ( false === $show_free ) {
660
+	if (false === $show_free) {
661 661
 		$args['meta_query'] = array(
662 662
 			array(
663 663
 				'key'     => '_give_payment_total',
@@ -668,33 +668,33 @@  discard block
 block discarded – undo
668 668
 		);
669 669
 	}
670 670
 
671
-	if ( ! empty( $month_num ) ) {
671
+	if ( ! empty($month_num)) {
672 672
 		$args['monthnum'] = $month_num;
673 673
 	}
674 674
 
675
-	if ( ! empty( $day ) ) {
675
+	if ( ! empty($day)) {
676 676
 		$args['day'] = $day;
677 677
 	}
678 678
 
679
-	if ( isset( $hour ) ) {
679
+	if (isset($hour)) {
680 680
 		$args['hour'] = $hour;
681 681
 	}
682 682
 
683
-	$args = apply_filters( 'give_get_sales_by_date_args', $args );
683
+	$args = apply_filters('give_get_sales_by_date_args', $args);
684 684
 
685
-	$key = Give_Cache::get_key( 'give_stats', $args );
685
+	$key = Give_Cache::get_key('give_stats', $args);
686 686
 
687
-	if ( ! empty( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'give-refresh-reports' ) ) {
687
+	if ( ! empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'give-refresh-reports')) {
688 688
 		$count = false;
689 689
 	} else {
690
-		$count = Give_Cache::get( $key );
690
+		$count = Give_Cache::get($key);
691 691
 	}
692 692
 
693
-	if ( false === $count ) {
694
-		$donations = new WP_Query( $args );
693
+	if (false === $count) {
694
+		$donations = new WP_Query($args);
695 695
 		$count     = (int) $donations->post_count;
696 696
 		// Cache the results for one hour.
697
-		Give_Cache::set( $key, $count, HOUR_IN_SECONDS );
697
+		Give_Cache::set($key, $count, HOUR_IN_SECONDS);
698 698
 	}
699 699
 
700 700
 	return $count;
@@ -709,19 +709,19 @@  discard block
 block discarded – undo
709 709
  *
710 710
  * @return bool $ret True if complete, false otherwise.
711 711
  */
712
-function give_is_payment_complete( $payment_id ) {
713
-	$payment = new Give_Payment( $payment_id );
712
+function give_is_payment_complete($payment_id) {
713
+	$payment = new Give_Payment($payment_id);
714 714
 
715 715
 	$ret = false;
716 716
 
717
-	if ( $payment->ID > 0 ) {
717
+	if ($payment->ID > 0) {
718 718
 
719
-		if ( (int) $payment_id === (int) $payment->ID && 'publish' == $payment->status ) {
719
+		if ((int) $payment_id === (int) $payment->ID && 'publish' == $payment->status) {
720 720
 			$ret = true;
721 721
 		}
722 722
 	}
723 723
 
724
-	return apply_filters( 'give_is_payment_complete', $ret, $payment_id, $payment->post_status );
724
+	return apply_filters('give_is_payment_complete', $ret, $payment_id, $payment->post_status);
725 725
 }
726 726
 
727 727
 /**
@@ -747,49 +747,49 @@  discard block
 block discarded – undo
747 747
  *
748 748
  * @return float $total Total earnings.
749 749
  */
750
-function give_get_total_earnings( $recalculate = false ) {
750
+function give_get_total_earnings($recalculate = false) {
751 751
 
752
-	$total = get_option( 'give_earnings_total', 0 );
752
+	$total = get_option('give_earnings_total', 0);
753 753
 
754 754
 	// Calculate total earnings.
755
-	if ( ! $total || $recalculate ) {
755
+	if ( ! $total || $recalculate) {
756 756
 		global $wpdb;
757 757
 
758 758
 		$total = (float) 0;
759 759
 
760
-		$args = apply_filters( 'give_get_total_earnings_args', array(
760
+		$args = apply_filters('give_get_total_earnings_args', array(
761 761
 			'offset' => 0,
762
-			'number' => - 1,
763
-			'status' => array( 'publish' ),
762
+			'number' => -1,
763
+			'status' => array('publish'),
764 764
 			'fields' => 'ids',
765
-		) );
765
+		));
766 766
 
767
-		$payments = give_get_payments( $args );
768
-		if ( $payments ) {
767
+		$payments = give_get_payments($args);
768
+		if ($payments) {
769 769
 
770 770
 			/**
771 771
 			 * If performing a donation, we need to skip the very last payment in the database,
772 772
 			 * since it calls give_increase_total_earnings() on completion,
773 773
 			 * which results in duplicated earnings for the very first donation.
774 774
 			 */
775
-			if ( did_action( 'give_update_payment_status' ) ) {
776
-				array_pop( $payments );
775
+			if (did_action('give_update_payment_status')) {
776
+				array_pop($payments);
777 777
 			}
778 778
 
779
-			if ( ! empty( $payments ) ) {
780
-				$payments = implode( ',', $payments );
781
-				$total    += $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$payments})" );
779
+			if ( ! empty($payments)) {
780
+				$payments = implode(',', $payments);
781
+				$total += $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$payments})");
782 782
 			}
783 783
 		}
784 784
 
785
-		update_option( 'give_earnings_total', $total, 'no' );
785
+		update_option('give_earnings_total', $total, 'no');
786 786
 	}
787 787
 
788
-	if ( $total < 0 ) {
788
+	if ($total < 0) {
789 789
 		$total = 0; // Don't ever show negative earnings.
790 790
 	}
791 791
 
792
-	return apply_filters( 'give_total_earnings', round( $total, give_get_price_decimals() ), $total );
792
+	return apply_filters('give_total_earnings', round($total, give_get_price_decimals()), $total);
793 793
 }
794 794
 
795 795
 /**
@@ -801,10 +801,10 @@  discard block
 block discarded – undo
801 801
  *
802 802
  * @return float $total Total earnings.
803 803
  */
804
-function give_increase_total_earnings( $amount = 0 ) {
804
+function give_increase_total_earnings($amount = 0) {
805 805
 	$total = give_get_total_earnings();
806 806
 	$total += $amount;
807
-	update_option( 'give_earnings_total', $total );
807
+	update_option('give_earnings_total', $total);
808 808
 
809 809
 	return $total;
810 810
 }
@@ -818,13 +818,13 @@  discard block
 block discarded – undo
818 818
  *
819 819
  * @return float $total Total earnings.
820 820
  */
821
-function give_decrease_total_earnings( $amount = 0 ) {
821
+function give_decrease_total_earnings($amount = 0) {
822 822
 	$total = give_get_total_earnings();
823 823
 	$total -= $amount;
824
-	if ( $total < 0 ) {
824
+	if ($total < 0) {
825 825
 		$total = 0;
826 826
 	}
827
-	update_option( 'give_earnings_total', $total );
827
+	update_option('give_earnings_total', $total);
828 828
 
829 829
 	return $total;
830 830
 }
@@ -840,10 +840,10 @@  discard block
 block discarded – undo
840 840
  *
841 841
  * @return mixed $meta Payment Meta.
842 842
  */
843
-function give_get_payment_meta( $payment_id = 0, $meta_key = '_give_payment_meta', $single = true ) {
844
-	$payment = new Give_Payment( $payment_id );
843
+function give_get_payment_meta($payment_id = 0, $meta_key = '_give_payment_meta', $single = true) {
844
+	$payment = new Give_Payment($payment_id);
845 845
 
846
-	return $payment->get_meta( $meta_key, $single );
846
+	return $payment->get_meta($meta_key, $single);
847 847
 }
848 848
 
849 849
 /**
@@ -856,10 +856,10 @@  discard block
 block discarded – undo
856 856
  *
857 857
  * @return mixed Meta ID if successful, false if unsuccessful.
858 858
  */
859
-function give_update_payment_meta( $payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '' ) {
860
-	$payment = new Give_Payment( $payment_id );
859
+function give_update_payment_meta($payment_id = 0, $meta_key = '', $meta_value = '', $prev_value = '') {
860
+	$payment = new Give_Payment($payment_id);
861 861
 
862
-	return $payment->update_meta( $meta_key, $meta_value, $prev_value );
862
+	return $payment->update_meta($meta_key, $meta_value, $prev_value);
863 863
 }
864 864
 
865 865
 /**
@@ -871,8 +871,8 @@  discard block
 block discarded – undo
871 871
  *
872 872
  * @return array $user_info User Info Meta Values.
873 873
  */
874
-function give_get_payment_meta_user_info( $payment_id ) {
875
-	$payment = new Give_Payment( $payment_id );
874
+function give_get_payment_meta_user_info($payment_id) {
875
+	$payment = new Give_Payment($payment_id);
876 876
 
877 877
 	return $payment->user_info;
878 878
 }
@@ -888,8 +888,8 @@  discard block
 block discarded – undo
888 888
  *
889 889
  * @return int $form_id Form ID.
890 890
  */
891
-function give_get_payment_form_id( $payment_id ) {
892
-	$payment = new Give_Payment( $payment_id );
891
+function give_get_payment_form_id($payment_id) {
892
+	$payment = new Give_Payment($payment_id);
893 893
 
894 894
 	return $payment->form_id;
895 895
 }
@@ -903,8 +903,8 @@  discard block
 block discarded – undo
903 903
  *
904 904
  * @return string $email User email.
905 905
  */
906
-function give_get_payment_user_email( $payment_id ) {
907
-	$payment = new Give_Payment( $payment_id );
906
+function give_get_payment_user_email($payment_id) {
907
+	$payment = new Give_Payment($payment_id);
908 908
 
909 909
 	return $payment->email;
910 910
 }
@@ -918,11 +918,11 @@  discard block
 block discarded – undo
918 918
  *
919 919
  * @return bool $is_guest_payment If the payment is associated with a user (false) or not (true)
920 920
  */
921
-function give_is_guest_payment( $payment_id ) {
922
-	$payment_user_id  = give_get_payment_user_id( $payment_id );
923
-	$is_guest_payment = ! empty( $payment_user_id ) && $payment_user_id > 0 ? false : true;
921
+function give_is_guest_payment($payment_id) {
922
+	$payment_user_id  = give_get_payment_user_id($payment_id);
923
+	$is_guest_payment = ! empty($payment_user_id) && $payment_user_id > 0 ? false : true;
924 924
 
925
-	return (bool) apply_filters( 'give_is_guest_payment', $is_guest_payment, $payment_id );
925
+	return (bool) apply_filters('give_is_guest_payment', $is_guest_payment, $payment_id);
926 926
 }
927 927
 
928 928
 /**
@@ -934,8 +934,8 @@  discard block
 block discarded – undo
934 934
  *
935 935
  * @return int $user_id User ID.
936 936
  */
937
-function give_get_payment_user_id( $payment_id ) {
938
-	$payment = new Give_Payment( $payment_id );
937
+function give_get_payment_user_id($payment_id) {
938
+	$payment = new Give_Payment($payment_id);
939 939
 
940 940
 	return $payment->user_id;
941 941
 }
@@ -949,8 +949,8 @@  discard block
 block discarded – undo
949 949
  *
950 950
  * @return int $payment->customer_id Donor ID.
951 951
  */
952
-function give_get_payment_donor_id( $payment_id ) {
953
-	$payment = new Give_Payment( $payment_id );
952
+function give_get_payment_donor_id($payment_id) {
953
+	$payment = new Give_Payment($payment_id);
954 954
 
955 955
 	return $payment->customer_id;
956 956
 }
@@ -964,8 +964,8 @@  discard block
 block discarded – undo
964 964
  *
965 965
  * @return string $ip User IP.
966 966
  */
967
-function give_get_payment_user_ip( $payment_id ) {
968
-	$payment = new Give_Payment( $payment_id );
967
+function give_get_payment_user_ip($payment_id) {
968
+	$payment = new Give_Payment($payment_id);
969 969
 
970 970
 	return $payment->ip;
971 971
 }
@@ -979,8 +979,8 @@  discard block
 block discarded – undo
979 979
  *
980 980
  * @return string $date The date the payment was completed.
981 981
  */
982
-function give_get_payment_completed_date( $payment_id = 0 ) {
983
-	$payment = new Give_Payment( $payment_id );
982
+function give_get_payment_completed_date($payment_id = 0) {
983
+	$payment = new Give_Payment($payment_id);
984 984
 
985 985
 	return $payment->completed_date;
986 986
 }
@@ -994,8 +994,8 @@  discard block
 block discarded – undo
994 994
  *
995 995
  * @return string $gateway Gateway.
996 996
  */
997
-function give_get_payment_gateway( $payment_id ) {
998
-	$payment = new Give_Payment( $payment_id );
997
+function give_get_payment_gateway($payment_id) {
998
+	$payment = new Give_Payment($payment_id);
999 999
 
1000 1000
 	return $payment->gateway;
1001 1001
 }
@@ -1009,8 +1009,8 @@  discard block
 block discarded – undo
1009 1009
  *
1010 1010
  * @return string $currency The currency code.
1011 1011
  */
1012
-function give_get_payment_currency_code( $payment_id = 0 ) {
1013
-	$payment = new Give_Payment( $payment_id );
1012
+function give_get_payment_currency_code($payment_id = 0) {
1013
+	$payment = new Give_Payment($payment_id);
1014 1014
 
1015 1015
 	return $payment->currency;
1016 1016
 }
@@ -1024,10 +1024,10 @@  discard block
 block discarded – undo
1024 1024
  *
1025 1025
  * @return string $currency The currency name.
1026 1026
  */
1027
-function give_get_payment_currency( $payment_id = 0 ) {
1028
-	$currency = give_get_payment_currency_code( $payment_id );
1027
+function give_get_payment_currency($payment_id = 0) {
1028
+	$currency = give_get_payment_currency_code($payment_id);
1029 1029
 
1030
-	return apply_filters( 'give_payment_currency', give_get_currency_name( $currency ), $payment_id );
1030
+	return apply_filters('give_payment_currency', give_get_currency_name($currency), $payment_id);
1031 1031
 }
1032 1032
 
1033 1033
 /**
@@ -1039,8 +1039,8 @@  discard block
 block discarded – undo
1039 1039
  *
1040 1040
  * @return string $key Donation key.
1041 1041
  */
1042
-function give_get_payment_key( $payment_id = 0 ) {
1043
-	$payment = new Give_Payment( $payment_id );
1042
+function give_get_payment_key($payment_id = 0) {
1043
+	$payment = new Give_Payment($payment_id);
1044 1044
 
1045 1045
 	return $payment->key;
1046 1046
 }
@@ -1056,8 +1056,8 @@  discard block
 block discarded – undo
1056 1056
  *
1057 1057
  * @return string $number Payment order number.
1058 1058
  */
1059
-function give_get_payment_number( $payment_id = 0 ) {
1060
-	$payment = new Give_Payment( $payment_id );
1059
+function give_get_payment_number($payment_id = 0) {
1060
+	$payment = new Give_Payment($payment_id);
1061 1061
 
1062 1062
 	return $payment->number;
1063 1063
 }
@@ -1071,23 +1071,23 @@  discard block
 block discarded – undo
1071 1071
  *
1072 1072
  * @return string      The formatted payment number.
1073 1073
  */
1074
-function give_format_payment_number( $number ) {
1074
+function give_format_payment_number($number) {
1075 1075
 
1076
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1076
+	if ( ! give_get_option('enable_sequential')) {
1077 1077
 		return $number;
1078 1078
 	}
1079 1079
 
1080
-	if ( ! is_numeric( $number ) ) {
1080
+	if ( ! is_numeric($number)) {
1081 1081
 		return $number;
1082 1082
 	}
1083 1083
 
1084
-	$prefix  = give_get_option( 'sequential_prefix' );
1085
-	$number  = absint( $number );
1086
-	$postfix = give_get_option( 'sequential_postfix' );
1084
+	$prefix  = give_get_option('sequential_prefix');
1085
+	$number  = absint($number);
1086
+	$postfix = give_get_option('sequential_postfix');
1087 1087
 
1088
-	$formatted_number = $prefix . $number . $postfix;
1088
+	$formatted_number = $prefix.$number.$postfix;
1089 1089
 
1090
-	return apply_filters( 'give_format_payment_number', $formatted_number, $prefix, $number, $postfix );
1090
+	return apply_filters('give_format_payment_number', $formatted_number, $prefix, $number, $postfix);
1091 1091
 }
1092 1092
 
1093 1093
 /**
@@ -1101,17 +1101,17 @@  discard block
 block discarded – undo
1101 1101
  */
1102 1102
 function give_get_next_payment_number() {
1103 1103
 
1104
-	if ( ! give_get_option( 'enable_sequential' ) ) {
1104
+	if ( ! give_get_option('enable_sequential')) {
1105 1105
 		return false;
1106 1106
 	}
1107 1107
 
1108
-	$number           = get_option( 'give_last_payment_number' );
1109
-	$start            = give_get_option( 'sequential_start', 1 );
1108
+	$number           = get_option('give_last_payment_number');
1109
+	$start            = give_get_option('sequential_start', 1);
1110 1110
 	$increment_number = true;
1111 1111
 
1112
-	if ( false !== $number ) {
1112
+	if (false !== $number) {
1113 1113
 
1114
-		if ( empty( $number ) ) {
1114
+		if (empty($number)) {
1115 1115
 
1116 1116
 			$number           = $start;
1117 1117
 			$increment_number = false;
@@ -1120,24 +1120,24 @@  discard block
 block discarded – undo
1120 1120
 	} else {
1121 1121
 
1122 1122
 		// This case handles the first addition of the new option, as well as if it get's deleted for any reason.
1123
-		$payments     = new Give_Payments_Query( array(
1123
+		$payments = new Give_Payments_Query(array(
1124 1124
 			'number'  => 1,
1125 1125
 			'order'   => 'DESC',
1126 1126
 			'orderby' => 'ID',
1127 1127
 			'output'  => 'posts',
1128 1128
 			'fields'  => 'ids',
1129
-		) );
1129
+		));
1130 1130
 		$last_payment = $payments->get_payments();
1131 1131
 
1132
-		if ( ! empty( $last_payment ) ) {
1132
+		if ( ! empty($last_payment)) {
1133 1133
 
1134
-			$number = give_get_payment_number( $last_payment[0] );
1134
+			$number = give_get_payment_number($last_payment[0]);
1135 1135
 
1136 1136
 		}
1137 1137
 
1138
-		if ( ! empty( $number ) && $number !== (int) $last_payment[0] ) {
1138
+		if ( ! empty($number) && $number !== (int) $last_payment[0]) {
1139 1139
 
1140
-			$number = give_remove_payment_prefix_postfix( $number );
1140
+			$number = give_remove_payment_prefix_postfix($number);
1141 1141
 
1142 1142
 		} else {
1143 1143
 
@@ -1146,13 +1146,13 @@  discard block
 block discarded – undo
1146 1146
 		}
1147 1147
 	}// End if().
1148 1148
 
1149
-	$increment_number = apply_filters( 'give_increment_payment_number', $increment_number, $number );
1149
+	$increment_number = apply_filters('give_increment_payment_number', $increment_number, $number);
1150 1150
 
1151
-	if ( $increment_number ) {
1152
-		$number ++;
1151
+	if ($increment_number) {
1152
+		$number++;
1153 1153
 	}
1154 1154
 
1155
-	return apply_filters( 'give_get_next_payment_number', $number );
1155
+	return apply_filters('give_get_next_payment_number', $number);
1156 1156
 }
1157 1157
 
1158 1158
 /**
@@ -1164,25 +1164,25 @@  discard block
 block discarded – undo
1164 1164
  *
1165 1165
  * @return string The new Payment number without prefix and postfix.
1166 1166
  */
1167
-function give_remove_payment_prefix_postfix( $number ) {
1167
+function give_remove_payment_prefix_postfix($number) {
1168 1168
 
1169
-	$prefix  = give_get_option( 'sequential_prefix' );
1170
-	$postfix = give_get_option( 'sequential_postfix' );
1169
+	$prefix  = give_get_option('sequential_prefix');
1170
+	$postfix = give_get_option('sequential_postfix');
1171 1171
 
1172 1172
 	// Remove prefix.
1173
-	$number = preg_replace( '/' . $prefix . '/', '', $number, 1 );
1173
+	$number = preg_replace('/'.$prefix.'/', '', $number, 1);
1174 1174
 
1175 1175
 	// Remove the postfix.
1176
-	$length      = strlen( $number );
1177
-	$postfix_pos = strrpos( $number, $postfix );
1178
-	if ( false !== $postfix_pos ) {
1179
-		$number = substr_replace( $number, '', $postfix_pos, $length );
1176
+	$length      = strlen($number);
1177
+	$postfix_pos = strrpos($number, $postfix);
1178
+	if (false !== $postfix_pos) {
1179
+		$number = substr_replace($number, '', $postfix_pos, $length);
1180 1180
 	}
1181 1181
 
1182 1182
 	// Ensure it's a whole number.
1183
-	$number = intval( $number );
1183
+	$number = intval($number);
1184 1184
 
1185
-	return apply_filters( 'give_remove_payment_prefix_postfix', $number, $prefix, $postfix );
1185
+	return apply_filters('give_remove_payment_prefix_postfix', $number, $prefix, $postfix);
1186 1186
 
1187 1187
 }
1188 1188
 
@@ -1200,16 +1200,16 @@  discard block
 block discarded – undo
1200 1200
  *
1201 1201
  * @return string $amount Fully formatted donation amount.
1202 1202
  */
1203
-function give_donation_amount( $donation, $format_args = array() ) {
1203
+function give_donation_amount($donation, $format_args = array()) {
1204 1204
 	/* @var Give_Payment $donation */
1205
-	if ( ! ( $donation instanceof Give_Payment ) ) {
1206
-		$donation = new Give_Payment( absint( $donation ) );
1205
+	if ( ! ($donation instanceof Give_Payment)) {
1206
+		$donation = new Give_Payment(absint($donation));
1207 1207
 	}
1208 1208
 
1209 1209
 	$amount           = $donation->total;
1210 1210
 	$formatted_amount = $amount;
1211 1211
 
1212
-	if ( is_bool( $format_args ) ) {
1212
+	if (is_bool($format_args)) {
1213 1213
 		$format_args = array(
1214 1214
 			'currency' => (bool) $format_args,
1215 1215
 			'amount'   => (bool) $format_args,
@@ -1232,27 +1232,25 @@  discard block
 block discarded – undo
1232 1232
 		)
1233 1233
 	);
1234 1234
 
1235
-	if ( $format_args['amount'] || $format_args['currency'] ) {
1235
+	if ($format_args['amount'] || $format_args['currency']) {
1236 1236
 
1237
-		if ( $format_args['amount'] ) {
1237
+		if ($format_args['amount']) {
1238 1238
 
1239 1239
 			$formatted_amount = give_format_amount(
1240 1240
 				$amount,
1241
-				! is_array( $format_args['amount'] ) ?
1241
+				! is_array($format_args['amount']) ?
1242 1242
 					array(
1243 1243
 						'sanitize' => false,
1244 1244
 						'currency' => $donation->currency,
1245
-					) :
1246
-					$format_args['amount']
1245
+					) : $format_args['amount']
1247 1246
 			);
1248 1247
 		}
1249 1248
 
1250
-		if ( $format_args['currency'] ) {
1249
+		if ($format_args['currency']) {
1251 1250
 			$formatted_amount = give_currency_filter(
1252 1251
 				$formatted_amount,
1253
-				! is_array( $format_args['currency'] ) ?
1254
-					array( 'currency_code' => $donation->currency ) :
1255
-					$format_args['currency']
1252
+				! is_array($format_args['currency']) ?
1253
+					array('currency_code' => $donation->currency) : $format_args['currency']
1256 1254
 			);
1257 1255
 		}
1258 1256
 	}
@@ -1267,7 +1265,7 @@  discard block
 block discarded – undo
1267 1265
 	 * @param int    $donation_id      Donation ID.
1268 1266
 	 * @param string $type             Donation amount type.
1269 1267
 	 */
1270
-	return apply_filters( 'give_donation_amount', (string) $formatted_amount, $amount, $donation, $format_args );
1268
+	return apply_filters('give_donation_amount', (string) $formatted_amount, $amount, $donation, $format_args);
1271 1269
 }
1272 1270
 
1273 1271
 /**
@@ -1284,10 +1282,10 @@  discard block
 block discarded – undo
1284 1282
  *
1285 1283
  * @return array Fully formatted payment subtotal.
1286 1284
  */
1287
-function give_payment_subtotal( $payment_id = 0 ) {
1288
-	$subtotal = give_get_payment_subtotal( $payment_id );
1285
+function give_payment_subtotal($payment_id = 0) {
1286
+	$subtotal = give_get_payment_subtotal($payment_id);
1289 1287
 
1290
-	return give_currency_filter( give_format_amount( $subtotal, array( 'sanitize' => false ) ), array( 'currency_code' => give_get_payment_currency_code( $payment_id ) ) );
1288
+	return give_currency_filter(give_format_amount($subtotal, array('sanitize' => false)), array('currency_code' => give_get_payment_currency_code($payment_id)));
1291 1289
 }
1292 1290
 
1293 1291
 /**
@@ -1301,8 +1299,8 @@  discard block
 block discarded – undo
1301 1299
  *
1302 1300
  * @return float $subtotal Subtotal for payment (non formatted).
1303 1301
  */
1304
-function give_get_payment_subtotal( $payment_id = 0 ) {
1305
-	$payment = new Give_Payment( $payment_id );
1302
+function give_get_payment_subtotal($payment_id = 0) {
1303
+	$payment = new Give_Payment($payment_id);
1306 1304
 
1307 1305
 	return $payment->subtotal;
1308 1306
 }
@@ -1316,8 +1314,8 @@  discard block
 block discarded – undo
1316 1314
  *
1317 1315
  * @return string The donation ID.
1318 1316
  */
1319
-function give_get_payment_transaction_id( $payment_id = 0 ) {
1320
-	$payment = new Give_Payment( $payment_id );
1317
+function give_get_payment_transaction_id($payment_id = 0) {
1318
+	$payment = new Give_Payment($payment_id);
1321 1319
 
1322 1320
 	return $payment->transaction_id;
1323 1321
 }
@@ -1332,15 +1330,15 @@  discard block
 block discarded – undo
1332 1330
  *
1333 1331
  * @return bool|mixed
1334 1332
  */
1335
-function give_set_payment_transaction_id( $payment_id = 0, $transaction_id = '' ) {
1333
+function give_set_payment_transaction_id($payment_id = 0, $transaction_id = '') {
1336 1334
 
1337
-	if ( empty( $payment_id ) || empty( $transaction_id ) ) {
1335
+	if (empty($payment_id) || empty($transaction_id)) {
1338 1336
 		return false;
1339 1337
 	}
1340 1338
 
1341
-	$transaction_id = apply_filters( 'give_set_payment_transaction_id', $transaction_id, $payment_id );
1339
+	$transaction_id = apply_filters('give_set_payment_transaction_id', $transaction_id, $payment_id);
1342 1340
 
1343
-	return give_update_payment_meta( $payment_id, '_give_payment_transaction_id', $transaction_id );
1341
+	return give_update_payment_meta($payment_id, '_give_payment_transaction_id', $transaction_id);
1344 1342
 }
1345 1343
 
1346 1344
 /**
@@ -1353,7 +1351,7 @@  discard block
 block discarded – undo
1353 1351
  *
1354 1352
  * @return int $purchase Donation ID.
1355 1353
  */
1356
-function give_get_donation_id_by_key( $key ) {
1354
+function give_get_donation_id_by_key($key) {
1357 1355
 	global $wpdb;
1358 1356
 
1359 1357
 	$purchase = $wpdb->get_var(
@@ -1370,7 +1368,7 @@  discard block
 block discarded – undo
1370 1368
 		)
1371 1369
 	);
1372 1370
 
1373
-	if ( $purchase != null ) {
1371
+	if ($purchase != null) {
1374 1372
 		return $purchase;
1375 1373
 	}
1376 1374
 
@@ -1388,12 +1386,12 @@  discard block
 block discarded – undo
1388 1386
  *
1389 1387
  * @return int $purchase Donation ID.
1390 1388
  */
1391
-function give_get_purchase_id_by_transaction_id( $key ) {
1389
+function give_get_purchase_id_by_transaction_id($key) {
1392 1390
 	global $wpdb;
1393 1391
 
1394
-	$purchase = $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key ) );
1392
+	$purchase = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_give_payment_transaction_id' AND meta_value = %s LIMIT 1", $key));
1395 1393
 
1396
-	if ( $purchase != null ) {
1394
+	if ($purchase != null) {
1397 1395
 		return $purchase;
1398 1396
 	}
1399 1397
 
@@ -1410,23 +1408,23 @@  discard block
 block discarded – undo
1410 1408
  *
1411 1409
  * @return array $notes Donation Notes
1412 1410
  */
1413
-function give_get_payment_notes( $payment_id = 0, $search = '' ) {
1411
+function give_get_payment_notes($payment_id = 0, $search = '') {
1414 1412
 
1415
-	if ( empty( $payment_id ) && empty( $search ) ) {
1413
+	if (empty($payment_id) && empty($search)) {
1416 1414
 		return false;
1417 1415
 	}
1418 1416
 
1419
-	remove_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1420
-	remove_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10 );
1417
+	remove_action('pre_get_comments', 'give_hide_payment_notes', 10);
1418
+	remove_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10);
1421 1419
 
1422
-	$notes = get_comments( array(
1420
+	$notes = get_comments(array(
1423 1421
 		'post_id' => $payment_id,
1424 1422
 		'order'   => 'ASC',
1425 1423
 		'search'  => $search,
1426
-	) );
1424
+	));
1427 1425
 
1428
-	add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1429
-	add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1426
+	add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1427
+	add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1430 1428
 
1431 1429
 	return $notes;
1432 1430
 }
@@ -1442,8 +1440,8 @@  discard block
 block discarded – undo
1442 1440
  *
1443 1441
  * @return int The new note ID
1444 1442
  */
1445
-function give_insert_payment_note( $payment_id = 0, $note = '' ) {
1446
-	if ( empty( $payment_id ) ) {
1443
+function give_insert_payment_note($payment_id = 0, $note = '') {
1444
+	if (empty($payment_id)) {
1447 1445
 		return false;
1448 1446
 	}
1449 1447
 
@@ -1455,14 +1453,14 @@  discard block
 block discarded – undo
1455 1453
 	 *
1456 1454
 	 * @since 1.0
1457 1455
 	 */
1458
-	do_action( 'give_pre_insert_payment_note', $payment_id, $note );
1456
+	do_action('give_pre_insert_payment_note', $payment_id, $note);
1459 1457
 
1460
-	$note_id = wp_insert_comment( wp_filter_comment( array(
1458
+	$note_id = wp_insert_comment(wp_filter_comment(array(
1461 1459
 		'comment_post_ID'      => $payment_id,
1462 1460
 		'comment_content'      => $note,
1463 1461
 		'user_id'              => is_admin() ? get_current_user_id() : 0,
1464
-		'comment_date'         => current_time( 'mysql' ),
1465
-		'comment_date_gmt'     => current_time( 'mysql', 1 ),
1462
+		'comment_date'         => current_time('mysql'),
1463
+		'comment_date_gmt'     => current_time('mysql', 1),
1466 1464
 		'comment_approved'     => 1,
1467 1465
 		'comment_parent'       => 0,
1468 1466
 		'comment_author'       => '',
@@ -1471,7 +1469,7 @@  discard block
 block discarded – undo
1471 1469
 		'comment_author_email' => '',
1472 1470
 		'comment_type'         => 'give_payment_note',
1473 1471
 
1474
-	) ) );
1472
+	)));
1475 1473
 
1476 1474
 	/**
1477 1475
 	 * Fires after payment note inserted.
@@ -1482,7 +1480,7 @@  discard block
 block discarded – undo
1482 1480
 	 *
1483 1481
 	 * @since 1.0
1484 1482
 	 */
1485
-	do_action( 'give_insert_payment_note', $note_id, $payment_id, $note );
1483
+	do_action('give_insert_payment_note', $note_id, $payment_id, $note);
1486 1484
 
1487 1485
 	return $note_id;
1488 1486
 }
@@ -1497,8 +1495,8 @@  discard block
 block discarded – undo
1497 1495
  *
1498 1496
  * @return bool True on success, false otherwise.
1499 1497
  */
1500
-function give_delete_payment_note( $comment_id = 0, $payment_id = 0 ) {
1501
-	if ( empty( $comment_id ) ) {
1498
+function give_delete_payment_note($comment_id = 0, $payment_id = 0) {
1499
+	if (empty($comment_id)) {
1502 1500
 		return false;
1503 1501
 	}
1504 1502
 
@@ -1510,9 +1508,9 @@  discard block
 block discarded – undo
1510 1508
 	 *
1511 1509
 	 * @since 1.0
1512 1510
 	 */
1513
-	do_action( 'give_pre_delete_payment_note', $comment_id, $payment_id );
1511
+	do_action('give_pre_delete_payment_note', $comment_id, $payment_id);
1514 1512
 
1515
-	$ret = wp_delete_comment( $comment_id, true );
1513
+	$ret = wp_delete_comment($comment_id, true);
1516 1514
 
1517 1515
 	/**
1518 1516
 	 * Fires after donation note deleted.
@@ -1522,7 +1520,7 @@  discard block
 block discarded – undo
1522 1520
 	 *
1523 1521
 	 * @since 1.0
1524 1522
 	 */
1525
-	do_action( 'give_post_delete_payment_note', $comment_id, $payment_id );
1523
+	do_action('give_post_delete_payment_note', $comment_id, $payment_id);
1526 1524
 
1527 1525
 	return $ret;
1528 1526
 }
@@ -1537,32 +1535,32 @@  discard block
 block discarded – undo
1537 1535
  *
1538 1536
  * @return string
1539 1537
  */
1540
-function give_get_payment_note_html( $note, $payment_id = 0 ) {
1538
+function give_get_payment_note_html($note, $payment_id = 0) {
1541 1539
 
1542
-	if ( is_numeric( $note ) ) {
1543
-		$note = get_comment( $note );
1540
+	if (is_numeric($note)) {
1541
+		$note = get_comment($note);
1544 1542
 	}
1545 1543
 
1546
-	if ( ! empty( $note->user_id ) ) {
1547
-		$user = get_userdata( $note->user_id );
1544
+	if ( ! empty($note->user_id)) {
1545
+		$user = get_userdata($note->user_id);
1548 1546
 		$user = $user->display_name;
1549 1547
 	} else {
1550
-		$user = __( 'System', 'give' );
1548
+		$user = __('System', 'give');
1551 1549
 	}
1552 1550
 
1553
-	$date_format = give_date_format() . ', ' . get_option( 'time_format' );
1551
+	$date_format = give_date_format().', '.get_option('time_format');
1554 1552
 
1555
-	$delete_note_url = wp_nonce_url( add_query_arg( array(
1553
+	$delete_note_url = wp_nonce_url(add_query_arg(array(
1556 1554
 		'give-action' => 'delete_payment_note',
1557 1555
 		'note_id'     => $note->comment_ID,
1558 1556
 		'payment_id'  => $payment_id,
1559
-	) ), 'give_delete_payment_note_' . $note->comment_ID );
1557
+	)), 'give_delete_payment_note_'.$note->comment_ID);
1560 1558
 
1561
-	$note_html = '<div class="give-payment-note" id="give-payment-note-' . $note->comment_ID . '">';
1559
+	$note_html = '<div class="give-payment-note" id="give-payment-note-'.$note->comment_ID.'">';
1562 1560
 	$note_html .= '<p>';
1563
-	$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/>';
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/>';
1564 1562
 	$note_html .= $note->comment_content;
1565
-	$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>';
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>';
1566 1564
 	$note_html .= '</p>';
1567 1565
 	$note_html .= '</div>';
1568 1566
 
@@ -1580,18 +1578,18 @@  discard block
 block discarded – undo
1580 1578
  *
1581 1579
  * @return void
1582 1580
  */
1583
-function give_hide_payment_notes( $query ) {
1584
-	if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '>=' ) ) {
1585
-		$types = isset( $query->query_vars['type__not_in'] ) ? $query->query_vars['type__not_in'] : array();
1586
-		if ( ! is_array( $types ) ) {
1587
-			$types = array( $types );
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);
1588 1586
 		}
1589 1587
 		$types[]                           = 'give_payment_note';
1590 1588
 		$query->query_vars['type__not_in'] = $types;
1591 1589
 	}
1592 1590
 }
1593 1591
 
1594
-add_action( 'pre_get_comments', 'give_hide_payment_notes', 10 );
1592
+add_action('pre_get_comments', 'give_hide_payment_notes', 10);
1595 1593
 
1596 1594
 /**
1597 1595
  * Exclude notes (comments) on give_payment post type from showing in Recent Comments widgets
@@ -1603,15 +1601,15 @@  discard block
 block discarded – undo
1603 1601
  *
1604 1602
  * @return array $clauses Updated comment clauses.
1605 1603
  */
1606
-function give_hide_payment_notes_pre_41( $clauses, $wp_comment_query ) {
1607
-	if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.1', '<' ) ) {
1604
+function give_hide_payment_notes_pre_41($clauses, $wp_comment_query) {
1605
+	if (version_compare(floatval(get_bloginfo('version')), '4.1', '<')) {
1608 1606
 		$clauses['where'] .= ' AND comment_type != "give_payment_note"';
1609 1607
 	}
1610 1608
 
1611 1609
 	return $clauses;
1612 1610
 }
1613 1611
 
1614
-add_filter( 'comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2 );
1612
+add_filter('comments_clauses', 'give_hide_payment_notes_pre_41', 10, 2);
1615 1613
 
1616 1614
 
1617 1615
 /**
@@ -1624,15 +1622,15 @@  discard block
 block discarded – undo
1624 1622
  *
1625 1623
  * @return string $where
1626 1624
  */
1627
-function give_hide_payment_notes_from_feeds( $where, $wp_comment_query ) {
1625
+function give_hide_payment_notes_from_feeds($where, $wp_comment_query) {
1628 1626
 	global $wpdb;
1629 1627
 
1630
-	$where .= $wpdb->prepare( ' AND comment_type != %s', 'give_payment_note' );
1628
+	$where .= $wpdb->prepare(' AND comment_type != %s', 'give_payment_note');
1631 1629
 
1632 1630
 	return $where;
1633 1631
 }
1634 1632
 
1635
-add_filter( 'comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2 );
1633
+add_filter('comment_feed_where', 'give_hide_payment_notes_from_feeds', 10, 2);
1636 1634
 
1637 1635
 
1638 1636
 /**
@@ -1646,32 +1644,32 @@  discard block
 block discarded – undo
1646 1644
  *
1647 1645
  * @return array|object Array of comment counts.
1648 1646
  */
1649
-function give_remove_payment_notes_in_comment_counts( $stats, $post_id ) {
1647
+function give_remove_payment_notes_in_comment_counts($stats, $post_id) {
1650 1648
 	global $wpdb, $pagenow;
1651 1649
 
1652
-	if ( 'index.php' != $pagenow ) {
1650
+	if ('index.php' != $pagenow) {
1653 1651
 		return $stats;
1654 1652
 	}
1655 1653
 
1656 1654
 	$post_id = (int) $post_id;
1657 1655
 
1658
-	if ( apply_filters( 'give_count_payment_notes_in_comments', false ) ) {
1656
+	if (apply_filters('give_count_payment_notes_in_comments', false)) {
1659 1657
 		return $stats;
1660 1658
 	}
1661 1659
 
1662
-	$stats = wp_cache_get( "comments-{$post_id}", 'counts' );
1660
+	$stats = wp_cache_get("comments-{$post_id}", 'counts');
1663 1661
 
1664
-	if ( false !== $stats ) {
1662
+	if (false !== $stats) {
1665 1663
 		return $stats;
1666 1664
 	}
1667 1665
 
1668 1666
 	$where = 'WHERE comment_type != "give_payment_note"';
1669 1667
 
1670
-	if ( $post_id > 0 ) {
1671
-		$where .= $wpdb->prepare( ' AND comment_post_ID = %d', $post_id );
1668
+	if ($post_id > 0) {
1669
+		$where .= $wpdb->prepare(' AND comment_post_ID = %d', $post_id);
1672 1670
 	}
1673 1671
 
1674
-	$count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A );
1672
+	$count = $wpdb->get_results("SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A);
1675 1673
 
1676 1674
 	$total    = 0;
1677 1675
 	$approved = array(
@@ -1681,30 +1679,30 @@  discard block
 block discarded – undo
1681 1679
 		'trash'        => 'trash',
1682 1680
 		'post-trashed' => 'post-trashed',
1683 1681
 	);
1684
-	foreach ( (array) $count as $row ) {
1682
+	foreach ((array) $count as $row) {
1685 1683
 		// Don't count post-trashed toward totals.
1686
-		if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) {
1684
+		if ('post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved']) {
1687 1685
 			$total += $row['num_comments'];
1688 1686
 		}
1689
-		if ( isset( $approved[ $row['comment_approved'] ] ) ) {
1690
-			$stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments'];
1687
+		if (isset($approved[$row['comment_approved']])) {
1688
+			$stats[$approved[$row['comment_approved']]] = $row['num_comments'];
1691 1689
 		}
1692 1690
 	}
1693 1691
 
1694 1692
 	$stats['total_comments'] = $total;
1695
-	foreach ( $approved as $key ) {
1696
-		if ( empty( $stats[ $key ] ) ) {
1697
-			$stats[ $key ] = 0;
1693
+	foreach ($approved as $key) {
1694
+		if (empty($stats[$key])) {
1695
+			$stats[$key] = 0;
1698 1696
 		}
1699 1697
 	}
1700 1698
 
1701 1699
 	$stats = (object) $stats;
1702
-	wp_cache_set( "comments-{$post_id}", $stats, 'counts' );
1700
+	wp_cache_set("comments-{$post_id}", $stats, 'counts');
1703 1701
 
1704 1702
 	return $stats;
1705 1703
 }
1706 1704
 
1707
-add_filter( 'wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2 );
1705
+add_filter('wp_count_comments', 'give_remove_payment_notes_in_comment_counts', 10, 2);
1708 1706
 
1709 1707
 
1710 1708
 /**
@@ -1717,9 +1715,9 @@  discard block
 block discarded – undo
1717 1715
  *
1718 1716
  * @return string $where Modified where clause.
1719 1717
  */
1720
-function give_filter_where_older_than_week( $where = '' ) {
1718
+function give_filter_where_older_than_week($where = '') {
1721 1719
 	// Payments older than one week.
1722
-	$start = date( 'Y-m-d', strtotime( '-7 days' ) );
1720
+	$start = date('Y-m-d', strtotime('-7 days'));
1723 1721
 	$where .= " AND post_date <= '{$start}'";
1724 1722
 
1725 1723
 	return $where;
@@ -1739,35 +1737,35 @@  discard block
 block discarded – undo
1739 1737
  *
1740 1738
  * @return string $form_title Returns the full title if $only_level is false, otherwise returns the levels title.
1741 1739
  */
1742
-function give_get_payment_form_title( $payment_meta, $only_level = false, $separator = '' ) {
1740
+function give_get_payment_form_title($payment_meta, $only_level = false, $separator = '') {
1743 1741
 
1744
-	$form_id     = isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : 0;
1745
-	$price_id    = isset( $payment_meta['price_id'] ) ? $payment_meta['price_id'] : null;
1746
-	$form_title  = isset( $payment_meta['form_title'] ) ? $payment_meta['form_title'] : '';
1742
+	$form_id     = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : 0;
1743
+	$price_id    = isset($payment_meta['price_id']) ? $payment_meta['price_id'] : null;
1744
+	$form_title  = isset($payment_meta['form_title']) ? $payment_meta['form_title'] : '';
1747 1745
 	$level_label = '';
1748 1746
 
1749
-	if ( $only_level == true ) {
1747
+	if ($only_level == true) {
1750 1748
 		$form_title = '';
1751 1749
 	}
1752 1750
 
1753
-	if ( 'custom' === $price_id ) {
1754
-		$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
1755
-		$level_label        = ! empty( $custom_amount_text ) ? $custom_amount_text : __( 'Custom Amount', 'give' );
1756
-	} elseif ( give_has_variable_prices( $form_id ) ) {
1757
-		$level_label = give_get_price_option_name( $form_id, $price_id );
1751
+	if ('custom' === $price_id) {
1752
+		$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
1753
+		$level_label        = ! empty($custom_amount_text) ? $custom_amount_text : __('Custom Amount', 'give');
1754
+	} elseif (give_has_variable_prices($form_id)) {
1755
+		$level_label = give_get_price_option_name($form_id, $price_id);
1758 1756
 	}
1759 1757
 
1760 1758
 	// Only add separator if there is a form title.
1761 1759
 	if (
1762
-		! empty( $form_title ) &&
1763
-		! empty( $level_label )
1760
+		! empty($form_title) &&
1761
+		! empty($level_label)
1764 1762
 	) {
1765
-		$form_title .= ' ' . $separator . ' ';
1763
+		$form_title .= ' '.$separator.' ';
1766 1764
 	}
1767 1765
 
1768 1766
 	$form_title .= "<span class=\"donation-level-text-wrap\">{$level_label}</span>";
1769 1767
 
1770
-	return apply_filters( 'give_get_payment_form_title', $form_title, $payment_meta );
1768
+	return apply_filters('give_get_payment_form_title', $form_title, $payment_meta);
1771 1769
 
1772 1770
 }
1773 1771
 
@@ -1781,19 +1779,19 @@  discard block
 block discarded – undo
1781 1779
  *
1782 1780
  * @return string $price_id
1783 1781
  */
1784
-function give_get_price_id( $form_id, $price ) {
1782
+function give_get_price_id($form_id, $price) {
1785 1783
 	$price_id = null;
1786 1784
 
1787
-	if ( give_has_variable_prices( $form_id ) ) {
1785
+	if (give_has_variable_prices($form_id)) {
1788 1786
 
1789
-		$levels = give_get_meta( $form_id, '_give_donation_levels', true );
1787
+		$levels = give_get_meta($form_id, '_give_donation_levels', true);
1790 1788
 
1791
-		foreach ( $levels as $level ) {
1789
+		foreach ($levels as $level) {
1792 1790
 
1793
-			$level_amount = give_maybe_sanitize_amount( $level['_give_amount'] );
1791
+			$level_amount = give_maybe_sanitize_amount($level['_give_amount']);
1794 1792
 
1795 1793
 			// Check that this indeed the recurring price.
1796
-			if ( $level_amount == $price ) {
1794
+			if ($level_amount == $price) {
1797 1795
 
1798 1796
 				$price_id = $level['_give_id']['level_id'];
1799 1797
 				break;
@@ -1801,13 +1799,13 @@  discard block
 block discarded – undo
1801 1799
 			}
1802 1800
 		}
1803 1801
 
1804
-		if ( is_null( $price_id ) && give_is_custom_price_mode( $form_id ) ) {
1802
+		if (is_null($price_id) && give_is_custom_price_mode($form_id)) {
1805 1803
 			$price_id = 'custom';
1806 1804
 		}
1807 1805
 	}
1808 1806
 
1809 1807
 	// Price ID must be numeric or string.
1810
-	$price_id = ! is_numeric( $price_id ) && ! is_string( $price_id ) ? 0 : $price_id;
1808
+	$price_id = ! is_numeric($price_id) && ! is_string($price_id) ? 0 : $price_id;
1811 1809
 
1812 1810
 	return $price_id;
1813 1811
 }
@@ -1825,10 +1823,10 @@  discard block
 block discarded – undo
1825 1823
  *
1826 1824
  * @return string
1827 1825
  */
1828
-function give_get_form_dropdown( $args = array(), $echo = false ) {
1829
-	$form_dropdown_html = Give()->html->forms_dropdown( $args );
1826
+function give_get_form_dropdown($args = array(), $echo = false) {
1827
+	$form_dropdown_html = Give()->html->forms_dropdown($args);
1830 1828
 
1831
-	if ( ! $echo ) {
1829
+	if ( ! $echo) {
1832 1830
 		return $form_dropdown_html;
1833 1831
 	}
1834 1832
 
@@ -1845,17 +1843,17 @@  discard block
 block discarded – undo
1845 1843
  *
1846 1844
  * @return string|bool
1847 1845
  */
1848
-function give_get_form_variable_price_dropdown( $args = array(), $echo = false ) {
1846
+function give_get_form_variable_price_dropdown($args = array(), $echo = false) {
1849 1847
 
1850 1848
 	// Check for give form id.
1851
-	if ( empty( $args['id'] ) ) {
1849
+	if (empty($args['id'])) {
1852 1850
 		return false;
1853 1851
 	}
1854 1852
 
1855
-	$form = new Give_Donate_Form( $args['id'] );
1853
+	$form = new Give_Donate_Form($args['id']);
1856 1854
 
1857 1855
 	// Check if form has variable prices or not.
1858
-	if ( ! $form->ID || ! $form->has_variable_prices() ) {
1856
+	if ( ! $form->ID || ! $form->has_variable_prices()) {
1859 1857
 		return false;
1860 1858
 	}
1861 1859
 
@@ -1863,24 +1861,24 @@  discard block
 block discarded – undo
1863 1861
 	$variable_price_options = array();
1864 1862
 
1865 1863
 	// Check if multi donation form support custom donation or not.
1866
-	if ( $form->is_custom_price_mode() ) {
1867
-		$variable_price_options['custom'] = _x( 'Custom', 'custom donation dropdown item', 'give' );
1864
+	if ($form->is_custom_price_mode()) {
1865
+		$variable_price_options['custom'] = _x('Custom', 'custom donation dropdown item', 'give');
1868 1866
 	}
1869 1867
 
1870 1868
 	// Get variable price and ID from variable price array.
1871
-	foreach ( $variable_prices as $variable_price ) {
1872
-		$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 ) ) );
1869
+	foreach ($variable_prices as $variable_price) {
1870
+		$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)));
1873 1871
 	}
1874 1872
 
1875 1873
 	// Update options.
1876
-	$args = array_merge( $args, array(
1874
+	$args = array_merge($args, array(
1877 1875
 		'options' => $variable_price_options,
1878
-	) );
1876
+	));
1879 1877
 
1880 1878
 	// Generate select html.
1881
-	$form_dropdown_html = Give()->html->select( $args );
1879
+	$form_dropdown_html = Give()->html->select($args);
1882 1880
 
1883
-	if ( ! $echo ) {
1881
+	if ( ! $echo) {
1884 1882
 		return $form_dropdown_html;
1885 1883
 	}
1886 1884
 
@@ -1899,16 +1897,16 @@  discard block
 block discarded – undo
1899 1897
  *
1900 1898
  * @return string
1901 1899
  */
1902
-function give_get_payment_meta_price_id( $payment_meta ) {
1900
+function give_get_payment_meta_price_id($payment_meta) {
1903 1901
 
1904
-	if ( isset( $payment_meta['give_price_id'] ) ) {
1902
+	if (isset($payment_meta['give_price_id'])) {
1905 1903
 		$price_id = $payment_meta['give_price_id'];
1906
-	} elseif ( isset( $payment_meta['price_id'] ) ) {
1904
+	} elseif (isset($payment_meta['price_id'])) {
1907 1905
 		$price_id = $payment_meta['price_id'];
1908 1906
 	} else {
1909
-		$price_id = give_get_price_id( $payment_meta['give_form_id'], $payment_meta['price'] );
1907
+		$price_id = give_get_price_id($payment_meta['give_form_id'], $payment_meta['price']);
1910 1908
 	}
1911 1909
 
1912
-	return apply_filters( 'give_get_payment_meta_price_id', $price_id );
1910
+	return apply_filters('give_get_payment_meta_price_id', $price_id);
1913 1911
 
1914 1912
 }
Please login to merge, or discard this patch.
includes/import-functions.php 1 patch
Spacing   +243 added lines, -243 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
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  * @since 1.8.13
21 21
  */
22 22
 function give_import_donation_report() {
23
-	return get_option( 'give_import_donation_report', array() );
23
+	return get_option('give_import_donation_report', array());
24 24
 }
25 25
 
26 26
 
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
  *
30 30
  * @since 1.8.13
31 31
  */
32
-function give_import_donation_report_update( $value = array() ) {
33
-	update_option( 'give_import_donation_report', $value );
32
+function give_import_donation_report_update($value = array()) {
33
+	update_option('give_import_donation_report', $value);
34 34
 }
35 35
 
36 36
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
  * @since 1.8.13
41 41
  */
42 42
 function give_import_donation_report_reset() {
43
-	update_option( 'give_import_donation_report', array() );
43
+	update_option('give_import_donation_report', array());
44 44
 }
45 45
 
46 46
 /**
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
  *
53 53
  * @return array|bool|Give_Donate_Form|int|null|WP_Post
54 54
  */
55
-function give_import_get_form_data_from_csv( $data, $import_setting = array() ) {
55
+function give_import_get_form_data_from_csv($data, $import_setting = array()) {
56 56
 	$new_form = false;
57 57
 
58 58
 	// Get the import report
@@ -61,58 +61,58 @@  discard block
 block discarded – undo
61 61
 	$form = false;
62 62
 	$meta = array();
63 63
 
64
-	if ( ! empty( $data['form_id'] ) ) {
65
-		$form = new Give_Donate_Form( $data['form_id'] );
64
+	if ( ! empty($data['form_id'])) {
65
+		$form = new Give_Donate_Form($data['form_id']);
66 66
 		// Add support to older php version.
67 67
 		$form_id = $form->get_ID();
68
-		if ( empty( $form_id ) ) {
69
-			$report['duplicate_form'] = ( ! empty( $report['duplicate_form'] ) ? ( absint( $report['duplicate_form'] ) + 1 ) : 1 );
68
+		if (empty($form_id)) {
69
+			$report['duplicate_form'] = ( ! empty($report['duplicate_form']) ? (absint($report['duplicate_form']) + 1) : 1);
70 70
 			$form                     = false;
71 71
 		}
72 72
 	}
73 73
 
74
-	if ( false === $form && ! empty( $data['form_title'] ) ) {
75
-		$form = get_page_by_title( $data['form_title'], OBJECT, 'give_forms' );
74
+	if (false === $form && ! empty($data['form_title'])) {
75
+		$form = get_page_by_title($data['form_title'], OBJECT, 'give_forms');
76 76
 
77
-		if ( ! empty( $form->ID ) ) {
77
+		if ( ! empty($form->ID)) {
78 78
 
79
-			$report['duplicate_form'] = ( ! empty( $report['duplicate_form'] ) ? ( absint( $report['duplicate_form'] ) + 1 ) : 1 );
79
+			$report['duplicate_form'] = ( ! empty($report['duplicate_form']) ? (absint($report['duplicate_form']) + 1) : 1);
80 80
 
81
-			$form = new Give_Donate_Form( $form->ID );
81
+			$form = new Give_Donate_Form($form->ID);
82 82
 		} else {
83 83
 			$form                  = new Give_Donate_Form();
84 84
 			$args                  = array(
85 85
 				'post_title'  => $data['form_title'],
86 86
 				'post_status' => 'publish',
87 87
 			);
88
-			$form                  = $form->create( $args );
89
-			$report['create_form'] = ( ! empty( $report['create_form'] ) ? ( absint( $report['create_form'] ) + 1 ) : 1 );
88
+			$form                  = $form->create($args);
89
+			$report['create_form'] = ( ! empty($report['create_form']) ? (absint($report['create_form']) + 1) : 1);
90 90
 			$new_form              = true;
91 91
 
92 92
 		}
93 93
 
94
-		$form = get_page_by_title( $data['form_title'], OBJECT, 'give_forms' );
95
-		$form = new Give_Donate_Form( $form->ID );
94
+		$form = get_page_by_title($data['form_title'], OBJECT, 'give_forms');
95
+		$form = new Give_Donate_Form($form->ID);
96 96
 	}
97 97
 
98
-	if ( ! empty( $form ) && $form->get_ID() ) {
99
-		if ( ! empty( $data['form_level'] ) && 'custom' != (string) strtolower( $data['form_level'] ) ) {
98
+	if ( ! empty($form) && $form->get_ID()) {
99
+		if ( ! empty($data['form_level']) && 'custom' != (string) strtolower($data['form_level'])) {
100 100
 			$prices     = (array) $form->get_prices();
101 101
 			$price_text = array();
102
-			foreach ( $prices as $key => $price ) {
103
-				if ( isset( $price['_give_id']['level_id'] ) ) {
104
-					$price_text[ $price['_give_id']['level_id'] ] = ( ! empty( $price['_give_text'] ) ? $price['_give_text'] : '' );
102
+			foreach ($prices as $key => $price) {
103
+				if (isset($price['_give_id']['level_id'])) {
104
+					$price_text[$price['_give_id']['level_id']] = ( ! empty($price['_give_text']) ? $price['_give_text'] : '');
105 105
 				}
106 106
 			}
107 107
 
108
-			if ( ! in_array( $data['form_level'], $price_text ) ) {
108
+			if ( ! in_array($data['form_level'], $price_text)) {
109 109
 
110 110
 				// For generating unquiet level id.
111 111
 				$count     = 1;
112
-				$new_level = count( $prices ) + $count;
113
-				while ( array_key_exists( $new_level, $price_text ) ) {
114
-					$count ++;
115
-					$new_level = count( $prices ) + $count;
112
+				$new_level = count($prices) + $count;
113
+				while (array_key_exists($new_level, $price_text)) {
114
+					$count++;
115
+					$new_level = count($prices) + $count;
116 116
 				}
117 117
 
118 118
 				$multi_level_donations = array(
@@ -120,57 +120,57 @@  discard block
 block discarded – undo
120 120
 						'_give_id'     => array(
121 121
 							'level_id' => $new_level,
122 122
 						),
123
-						'_give_amount' => give_sanitize_amount_for_db( $data['amount'] ),
123
+						'_give_amount' => give_sanitize_amount_for_db($data['amount']),
124 124
 						'_give_text'   => $data['form_level'],
125 125
 					),
126 126
 				);
127 127
 
128
-				$price_text[ $new_level ] = $data['form_level'];
128
+				$price_text[$new_level] = $data['form_level'];
129 129
 
130
-				if ( ! empty( $prices ) && is_array( $prices ) && ! empty( $prices[0] ) ) {
131
-					$prices = wp_parse_args( $multi_level_donations, $prices );
130
+				if ( ! empty($prices) && is_array($prices) && ! empty($prices[0])) {
131
+					$prices = wp_parse_args($multi_level_donations, $prices);
132 132
 
133 133
 					// Sort $prices by amount in ascending order.
134
-					$prices = wp_list_sort( $prices, '_give_amount', 'ASC' );
134
+					$prices = wp_list_sort($prices, '_give_amount', 'ASC');
135 135
 				} else {
136 136
 					$prices = $multi_level_donations;
137 137
 				}
138 138
 
139 139
 				// Unset _give_default key from $prices.
140
-				foreach ( $prices as $key => $price ) {
141
-					if ( isset( $prices[ $key ]['_give_default'] ) ) {
142
-						unset( $prices[ $key ]['_give_default'] );
140
+				foreach ($prices as $key => $price) {
141
+					if (isset($prices[$key]['_give_default'])) {
142
+						unset($prices[$key]['_give_default']);
143 143
 					}
144 144
 				}
145 145
 
146 146
 				// Set the first $price of the $prices as defalut.
147 147
 				$prices[0]['_give_default'] = 'default';
148 148
 			}
149
-			$form->price_id = array_search( $data['form_level'], $price_text );
149
+			$form->price_id = array_search($data['form_level'], $price_text);
150 150
 
151
-			$donation_levels_amounts = wp_list_pluck( $prices, '_give_amount' );
152
-			$min_amount              = min( $donation_levels_amounts );
153
-			$max_amount              = max( $donation_levels_amounts );
151
+			$donation_levels_amounts = wp_list_pluck($prices, '_give_amount');
152
+			$min_amount              = min($donation_levels_amounts);
153
+			$max_amount              = max($donation_levels_amounts);
154 154
 
155 155
 			$meta = array(
156 156
 				'_give_levels_minimum_amount' => $min_amount,
157 157
 				'_give_levels_maximum_amount' => $max_amount,
158 158
 				'_give_price_option'          => 'multi',
159
-				'_give_donation_levels'       => array_values( $prices ),
159
+				'_give_donation_levels'       => array_values($prices),
160 160
 			);
161 161
 		} else {
162 162
 			$form->price_id = 'custom';
163 163
 		}
164 164
 
165 165
 		$defaults = array(
166
-			'_give_set_price'    => give_sanitize_amount_for_db( $data['amount'] ),
166
+			'_give_set_price'    => give_sanitize_amount_for_db($data['amount']),
167 167
 			'_give_price_option' => 'set',
168 168
 		);
169 169
 
170 170
 		// If new form is created.
171
-		if ( ! empty( $new_form ) ) {
171
+		if ( ! empty($new_form)) {
172 172
 			$new_form = array(
173
-				'_give_custom_amount_text' => ( ! empty( $data['form_custom_amount_text'] ) ? $data['form_custom_amount_text'] : 'Custom' ),
173
+				'_give_custom_amount_text' => ( ! empty($data['form_custom_amount_text']) ? $data['form_custom_amount_text'] : 'Custom'),
174 174
 				'_give_logged_in_only'     => 'enabled',
175 175
 				'_give_custom_amount'      => 'enabled',
176 176
 				'_give_payment_import'     => true,
@@ -181,18 +181,18 @@  discard block
 block discarded – undo
181 181
 				'_give_default_gateway'    => 'global',
182 182
 				'_give_show_register_form' => 'both',
183 183
 			);
184
-			$defaults = wp_parse_args( $defaults, $new_form );
184
+			$defaults = wp_parse_args($defaults, $new_form);
185 185
 		}
186 186
 
187
-		$meta = wp_parse_args( $meta, $defaults );
187
+		$meta = wp_parse_args($meta, $defaults);
188 188
 
189
-		foreach ( $meta as $key => $value ) {
190
-			give_update_meta( $form->get_ID(), $key, $value );
189
+		foreach ($meta as $key => $value) {
190
+			give_update_meta($form->get_ID(), $key, $value);
191 191
 		}
192 192
 	}
193 193
 
194 194
 	// update the report
195
-	give_import_donation_report_update( $report );
195
+	give_import_donation_report_update($report);
196 196
 
197 197
 	return $form;
198 198
 }
@@ -206,30 +206,30 @@  discard block
 block discarded – undo
206 206
  *
207 207
  * @return bool|false|WP_User
208 208
  */
209
-function give_import_get_user_from_csv( $data, $import_setting = array() ) {
209
+function give_import_get_user_from_csv($data, $import_setting = array()) {
210 210
 	$report      = give_import_donation_report();
211 211
 	$donor_data  = false;
212 212
 	$customer_id = false;
213 213
 
214 214
 	// check if donor id is not empty
215
-	if ( ! empty( $data['donor_id'] ) ) {
216
-		$donor_data = new Give_Donor( (int) $data['donor_id'] );
217
-		if ( ! empty( $donor_data->id ) ) {
218
-			$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
215
+	if ( ! empty($data['donor_id'])) {
216
+		$donor_data = new Give_Donor((int) $data['donor_id']);
217
+		if ( ! empty($donor_data->id)) {
218
+			$report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1);
219 219
 		}
220 220
 	}
221 221
 
222
-	if ( empty( $donor_data->id ) && ! empty( $data['user_id'] ) ) {
222
+	if (empty($donor_data->id) && ! empty($data['user_id'])) {
223 223
 		$user_id    = (int) $data['user_id'];
224
-		$donor_data = new Give_Donor( $user_id, true );
224
+		$donor_data = new Give_Donor($user_id, true);
225 225
 
226 226
 
227
-		if ( empty( $donor_data->id ) ) {
228
-			$donor_data = get_user_by( 'id', $user_id );
229
-			if ( ! empty( $donor_data->ID ) ) {
230
-				$first_name = ( ! empty( $data['first_name'] ) ? $data['first_name'] : $donor_data->user_nicename );
231
-				$last_name  = ( ! empty( $data['last_name'] ) ? $data['last_name'] : ( ( $lastname = get_user_meta( $donor_data->ID, 'last_name', true ) ) ? $lastname : '' ) );
232
-				$name       = $first_name . ' ' . $last_name;
227
+		if (empty($donor_data->id)) {
228
+			$donor_data = get_user_by('id', $user_id);
229
+			if ( ! empty($donor_data->ID)) {
230
+				$first_name = ( ! empty($data['first_name']) ? $data['first_name'] : $donor_data->user_nicename);
231
+				$last_name  = ( ! empty($data['last_name']) ? $data['last_name'] : (($lastname = get_user_meta($donor_data->ID, 'last_name', true)) ? $lastname : ''));
232
+				$name       = $first_name.' '.$last_name;
233 233
 				$user_email = $donor_data->user_email;
234 234
 				$donor_args = array(
235 235
 					'name'    => $name,
@@ -238,45 +238,45 @@  discard block
 block discarded – undo
238 238
 				);
239 239
 
240 240
 				$donor_data = new Give_Donor();
241
-				$donor_data->create( $donor_args );
241
+				$donor_data->create($donor_args);
242 242
 
243 243
 				// Adding notes that donor is being imported from CSV.
244 244
 				$current_user = wp_get_current_user();
245
-				$donor_data->add_note( esc_html( wp_sprintf( __( 'This donor was imported by %s', 'give' ), $current_user->user_email ) ) );
245
+				$donor_data->add_note(esc_html(wp_sprintf(__('This donor was imported by %s', 'give'), $current_user->user_email)));
246 246
 
247 247
 				// Add is used to ensure duplicate emails are not added
248
-				if ( $user_email != $data['email'] && ! empty( $data['email'] ) ) {
249
-					$donor_data->add_meta( 'additional_email', $data['email'] );
248
+				if ($user_email != $data['email'] && ! empty($data['email'])) {
249
+					$donor_data->add_meta('additional_email', $data['email']);
250 250
 				}
251 251
 
252
-				$report['create_donor'] = ( ! empty( $report['create_donor'] ) ? ( absint( $report['create_donor'] ) + 1 ) : 1 );
252
+				$report['create_donor'] = ( ! empty($report['create_donor']) ? (absint($report['create_donor']) + 1) : 1);
253 253
 			}
254 254
 		} else {
255 255
 			// Add is used to ensure duplicate emails are not added
256
-			if ( $donor_data->email != $data['email'] ) {
257
-				$donor_data->add_meta( 'additional_email', ( ! empty( $data['email'] ) ? $data['email'] : $donor_data->email ) );
256
+			if ($donor_data->email != $data['email']) {
257
+				$donor_data->add_meta('additional_email', ( ! empty($data['email']) ? $data['email'] : $donor_data->email));
258 258
 			}
259
-			$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
259
+			$report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1);
260 260
 		}
261 261
 	}
262 262
 
263
-	if ( empty( $donor_data->id ) && ! empty( $data['email'] ) ) {
263
+	if (empty($donor_data->id) && ! empty($data['email'])) {
264 264
 
265
-		$donor_data = new Give_Donor( $data['email'] );
266
-		if ( empty( $donor_data->id ) ) {
267
-			$donor_data = get_user_by( 'email', $data['email'] );
265
+		$donor_data = new Give_Donor($data['email']);
266
+		if (empty($donor_data->id)) {
267
+			$donor_data = get_user_by('email', $data['email']);
268 268
 
269
-			if ( empty( $donor_data->ID ) && isset( $import_setting['create_user'] ) && 1 === absint( $import_setting['create_user'] ) ) {
270
-				$data['first_name'] = ( ! empty( $data['first_name'] ) ? $data['first_name'] : $data['email'] );
271
-				$data['last_name'] = ( ! empty( $data['last_name'] ) ? $data['last_name'] : '' );
272
-				$give_role         = (array) give_get_option( 'donor_default_user_role', get_option( 'default_role', ( ( $give_donor = wp_roles()->is_role( 'give_donor' ) ) && ! empty( $give_donor ) ? 'give_donor' : 'subscriber' ) ) );
269
+			if (empty($donor_data->ID) && isset($import_setting['create_user']) && 1 === absint($import_setting['create_user'])) {
270
+				$data['first_name'] = ( ! empty($data['first_name']) ? $data['first_name'] : $data['email']);
271
+				$data['last_name'] = ( ! empty($data['last_name']) ? $data['last_name'] : '');
272
+				$give_role         = (array) give_get_option('donor_default_user_role', get_option('default_role', (($give_donor = wp_roles()->is_role('give_donor')) && ! empty($give_donor) ? 'give_donor' : 'subscriber')));
273 273
 				$donor_args        = array(
274 274
 					'user_login'      => $data['email'],
275 275
 					'user_email'      => $data['email'],
276
-					'user_registered' => date( 'Y-m-d H:i:s' ),
276
+					'user_registered' => date('Y-m-d H:i:s'),
277 277
 					'user_first'      => $data['first_name'],
278 278
 					'user_last'       => $data['last_name'],
279
-					'user_pass'       => wp_generate_password( 8, true ),
279
+					'user_pass'       => wp_generate_password(8, true),
280 280
 					'role'            => $give_role,
281 281
 				);
282 282
 
@@ -285,55 +285,55 @@  discard block
 block discarded – undo
285 285
 				 *
286 286
 				 * @since 1.8.13
287 287
 				 */
288
-				$donor_args = (array) apply_filters( 'give_import_insert_user_args', $donor_args, $data, $import_setting );
288
+				$donor_args = (array) apply_filters('give_import_insert_user_args', $donor_args, $data, $import_setting);
289 289
 
290 290
 				// This action was added to remove the login when using the give register function.
291
-				add_filter( 'give_log_user_in_on_register', 'give_log_user_in_on_register_callback', 11 );
292
-				$customer_id = give_register_and_login_new_user( $donor_args );
293
-				remove_filter( 'give_log_user_in_on_register', 'give_log_user_in_on_register_callback', 11 );
291
+				add_filter('give_log_user_in_on_register', 'give_log_user_in_on_register_callback', 11);
292
+				$customer_id = give_register_and_login_new_user($donor_args);
293
+				remove_filter('give_log_user_in_on_register', 'give_log_user_in_on_register_callback', 11);
294 294
 
295
-				update_user_meta( $customer_id, '_give_payment_import', true );
296
-				$donor_data = new Give_Donor( $customer_id, true );
295
+				update_user_meta($customer_id, '_give_payment_import', true);
296
+				$donor_data = new Give_Donor($customer_id, true);
297 297
 			} else {
298
-				$customer_id = ( ! empty( $donor_data->ID ) ? $donor_data->ID : false );
298
+				$customer_id = ( ! empty($donor_data->ID) ? $donor_data->ID : false);
299 299
 			}
300 300
 
301
-			if ( ! empty( $customer_id ) || ( isset( $import_setting['create_user'] ) && 0 === absint( $import_setting['create_user'] ) ) ) {
302
-				$donor_data = new Give_Donor( $customer_id, true );
301
+			if ( ! empty($customer_id) || (isset($import_setting['create_user']) && 0 === absint($import_setting['create_user']))) {
302
+				$donor_data = new Give_Donor($customer_id, true);
303 303
 
304
-				if ( empty( $donor_data->id ) ) {
304
+				if (empty($donor_data->id)) {
305 305
 
306
-					if ( ! empty( $data['form_id'] ) ) {
307
-						$form = new Give_Donate_Form( $data['form_id'] );
306
+					if ( ! empty($data['form_id'])) {
307
+						$form = new Give_Donate_Form($data['form_id']);
308 308
 					}
309 309
 
310
-					$payment_title = ( isset( $data['form_title'] ) ? $data['form_title'] : ( isset( $form ) ? $form->get_name() : esc_html__( 'New Form', 'give' ) ) );
310
+					$payment_title = (isset($data['form_title']) ? $data['form_title'] : (isset($form) ? $form->get_name() : esc_html__('New Form', 'give')));
311 311
 					$donor_args    = array(
312
-						'name'  => ! is_email( $payment_title ) ? $data['first_name'] . ' ' . $data['last_name'] : '',
312
+						'name'  => ! is_email($payment_title) ? $data['first_name'].' '.$data['last_name'] : '',
313 313
 						'email' => $data['email'],
314 314
 					);
315 315
 
316
-					if ( ! empty( $customer_id ) ) {
316
+					if ( ! empty($customer_id)) {
317 317
 						$donor_args['user_id'] = $customer_id;
318 318
 					}
319 319
 
320
-					$donor_data->create( $donor_args );
320
+					$donor_data->create($donor_args);
321 321
 
322 322
 					// Adding notes that donor is being imported from CSV.
323 323
 					$current_user = wp_get_current_user();
324
-					$donor_data->add_note( esc_html( wp_sprintf( __( 'This donor was imported by %s', 'give' ), $current_user->user_email ) ) );
324
+					$donor_data->add_note(esc_html(wp_sprintf(__('This donor was imported by %s', 'give'), $current_user->user_email)));
325 325
 
326
-					$report['create_donor'] = ( ! empty( $report['create_donor'] ) ? ( absint( $report['create_donor'] ) + 1 ) : 1 );
326
+					$report['create_donor'] = ( ! empty($report['create_donor']) ? (absint($report['create_donor']) + 1) : 1);
327 327
 				} else {
328
-					$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
328
+					$report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1);
329 329
 				}
330 330
 			}
331 331
 		} else {
332
-			$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
332
+			$report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1);
333 333
 		}
334 334
 	}
335 335
 	// update the report
336
-	give_import_donation_report_update( $report );
336
+	give_import_donation_report_update($report);
337 337
 
338 338
 	return $donor_data;
339 339
 }
@@ -351,9 +351,9 @@  discard block
 block discarded – undo
351 351
 	 *
352 352
 	 * @return array
353 353
 	 */
354
-	return (array) apply_filters( 'give_import_default_options', array(
355
-		'' => __( 'Do not import', 'give' ),
356
-	) );
354
+	return (array) apply_filters('give_import_default_options', array(
355
+		'' => __('Do not import', 'give'),
356
+	));
357 357
 }
358 358
 
359 359
 /**
@@ -369,62 +369,62 @@  discard block
 block discarded – undo
369 369
 	 *
370 370
 	 * @return array
371 371
 	 */
372
-	return (array) apply_filters( 'give_import_donations_options', array(
373
-		'id'          => __( 'Donation ID', 'give' ),
372
+	return (array) apply_filters('give_import_donations_options', array(
373
+		'id'          => __('Donation ID', 'give'),
374 374
 		'amount'      => array(
375
-			__( 'Donation Amount', 'give' ),
376
-			__( 'Amount', 'give' )
375
+			__('Donation Amount', 'give'),
376
+			__('Amount', 'give')
377 377
 		),
378 378
 		'post_date'   => array(
379
-			__( 'Donation Date', 'give' ),
380
-			__( 'Date', 'give' ),
379
+			__('Donation Date', 'give'),
380
+			__('Date', 'give'),
381 381
 		),
382 382
 		'first_name'  => array(
383
-			__( 'Donor First Name', 'give' ),
384
-			__( 'First Name', 'give' ),
385
-			__( 'Name', 'give' ),
383
+			__('Donor First Name', 'give'),
384
+			__('First Name', 'give'),
385
+			__('Name', 'give'),
386 386
 		),
387 387
 		'last_name'   => array(
388
-			__( 'Donor Last Name', 'give' ),
389
-			__( 'Last Name', 'give' ),
388
+			__('Donor Last Name', 'give'),
389
+			__('Last Name', 'give'),
390 390
 		),
391 391
 		'line1'       => array(
392
-			__( 'Address 1', 'give' ),
393
-			__( 'Address', 'give' ),
392
+			__('Address 1', 'give'),
393
+			__('Address', 'give'),
394 394
 		),
395
-		'line2'       => __( 'Address 2', 'give' ),
396
-		'city'        => __( 'City', 'give' ),
395
+		'line2'       => __('Address 2', 'give'),
396
+		'city'        => __('City', 'give'),
397 397
 		'state'       => array(
398
-			__( 'State', 'give' ),
399
-			__( 'Province', 'give' ),
400
-			__( 'County', 'give' ),
401
-			__( 'Region', 'give' ),
398
+			__('State', 'give'),
399
+			__('Province', 'give'),
400
+			__('County', 'give'),
401
+			__('Region', 'give'),
402 402
 		),
403
-		'country'     => __( 'Country', 'give' ),
403
+		'country'     => __('Country', 'give'),
404 404
 		'zip'         => array(
405
-			__( 'Zip', 'give' ),
406
-			__( 'Zip Code', 'give' ),
407
-			__( 'Postal Code', 'give' ),
405
+			__('Zip', 'give'),
406
+			__('Zip Code', 'give'),
407
+			__('Postal Code', 'give'),
408 408
 		),
409 409
 		'email'       => array(
410
-			__( 'Donor Email', 'give' ),
411
-			__( 'Email', 'give' )
410
+			__('Donor Email', 'give'),
411
+			__('Email', 'give')
412 412
 		),
413 413
 		'post_status' => array(
414
-			__( 'Donation Status', 'give' ),
415
-			__( 'Status', 'give' ),
414
+			__('Donation Status', 'give'),
415
+			__('Status', 'give'),
416 416
 		),
417 417
 		'gateway'     => array(
418
-			__( 'Payment Method', 'give' ),
419
-			__( 'Method', 'give' ),
418
+			__('Payment Method', 'give'),
419
+			__('Method', 'give'),
420 420
 		),
421
-		'notes'       => __( 'Notes', 'give' ),
421
+		'notes'       => __('Notes', 'give'),
422 422
 		'mode'        => array(
423
-			__( 'Test Mode', 'give' ),
424
-			__( 'Mode', 'give' ),
423
+			__('Test Mode', 'give'),
424
+			__('Mode', 'give'),
425 425
 		),
426
-		'post_meta'   => __( 'Import as Meta', 'give' ),
427
-	) );
426
+		'post_meta'   => __('Import as Meta', 'give'),
427
+	));
428 428
 }
429 429
 
430 430
 /**
@@ -440,10 +440,10 @@  discard block
 block discarded – undo
440 440
 	 *
441 441
 	 * @return array
442 442
 	 */
443
-	return (array) apply_filters( 'give_import_donor_options', array(
444
-		'donor_id' => __( 'Donor ID', 'give' ),
445
-		'user_id'  => __( 'User ID', 'give' ),
446
-	) );
443
+	return (array) apply_filters('give_import_donor_options', array(
444
+		'donor_id' => __('Donor ID', 'give'),
445
+		'user_id'  => __('User ID', 'give'),
446
+	));
447 447
 }
448 448
 
449 449
 /**
@@ -459,23 +459,23 @@  discard block
 block discarded – undo
459 459
 	 *
460 460
 	 * @return array
461 461
 	 */
462
-	return (array) apply_filters( 'give_import_donation_form_options', array(
462
+	return (array) apply_filters('give_import_donation_form_options', array(
463 463
 		'form_title'              => array(
464
-			__( 'Donation Form Title', 'give' ),
465
-			__( 'Donation Form', 'give' ),
466
-			__( 'Form Name', 'give' ),
467
-			__( 'Title', 'give' ),
464
+			__('Donation Form Title', 'give'),
465
+			__('Donation Form', 'give'),
466
+			__('Form Name', 'give'),
467
+			__('Title', 'give'),
468 468
 		),
469 469
 		'form_id'                 => array(
470
-			__( 'Donation Form ID', 'give' ),
471
-			__( 'Form ID', 'give' )
470
+			__('Donation Form ID', 'give'),
471
+			__('Form ID', 'give')
472 472
 		),
473 473
 		'form_level'              => array(
474
-			__( 'Donation Level', 'give' ),
475
-			__( 'Level', 'give' ),
474
+			__('Donation Level', 'give'),
475
+			__('Level', 'give'),
476 476
 		),
477
-		'form_custom_amount_text' => __( 'Custom Amount Text', 'give' ),
478
-	) );
477
+		'form_custom_amount_text' => __('Custom Amount Text', 'give'),
478
+	));
479 479
 }
480 480
 
481 481
 /**
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
  *
489 489
  * @return array
490 490
  */
491
-function give_get_donation_data_from_csv( $file_id, $start, $end, $delimiter = 'csv' ) {
491
+function give_get_donation_data_from_csv($file_id, $start, $end, $delimiter = 'csv') {
492 492
 	/**
493 493
 	 * Filter to modify delimiter of Import.
494 494
 	 *
@@ -497,19 +497,19 @@  discard block
 block discarded – undo
497 497
 	 *
498 498
 	 * Return string $delimiter.
499 499
 	 */
500
-	$delimiter = (string) apply_filters( 'give_import_delimiter_set', $delimiter );
500
+	$delimiter = (string) apply_filters('give_import_delimiter_set', $delimiter);
501 501
 
502 502
 	$raw_data = array();
503
-	$file_dir = get_attached_file( $file_id );
503
+	$file_dir = get_attached_file($file_id);
504 504
 	$count    = 0;
505
-	if ( false !== ( $handle = fopen( $file_dir, 'r' ) ) ) {
506
-		while ( false !== ( $row = fgetcsv( $handle, 0, $delimiter ) ) ) {
507
-			if ( $count >= $start && $count <= $end ) {
505
+	if (false !== ($handle = fopen($file_dir, 'r'))) {
506
+		while (false !== ($row = fgetcsv($handle, 0, $delimiter))) {
507
+			if ($count >= $start && $count <= $end) {
508 508
 				$raw_data[] = $row;
509 509
 			}
510
-			$count ++;
510
+			$count++;
511 511
 		}
512
-		fclose( $handle );
512
+		fclose($handle);
513 513
 	}
514 514
 
515 515
 	return $raw_data;
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
  *
526 526
  * @return bool
527 527
  */
528
-function give_log_user_in_on_register_callback( $value ) {
528
+function give_log_user_in_on_register_callback($value) {
529 529
 	return false;
530 530
 }
531 531
 
@@ -541,22 +541,22 @@  discard block
 block discarded – undo
541 541
  *
542 542
  * @return bool
543 543
  */
544
-function give_save_import_donation_to_db( $raw_key, $row_data, $main_key = array(), $import_setting = array() ) {
545
-	$data                          = array_combine( $raw_key, $row_data );
544
+function give_save_import_donation_to_db($raw_key, $row_data, $main_key = array(), $import_setting = array()) {
545
+	$data                          = array_combine($raw_key, $row_data);
546 546
 	$price_id                      = false;
547 547
 	$customer_id                   = 0;
548
-	$import_setting['create_user'] = ( isset( $import_setting['create_user'] ) ? $import_setting['create_user'] : 1 );
548
+	$import_setting['create_user'] = (isset($import_setting['create_user']) ? $import_setting['create_user'] : 1);
549 549
 
550
-	$data = (array) apply_filters( 'give_save_import_donation_to_db', $data );
550
+	$data = (array) apply_filters('give_save_import_donation_to_db', $data);
551 551
 
552
-	$data['amount'] = give_maybe_sanitize_amount( $data['amount'] );
552
+	$data['amount'] = give_maybe_sanitize_amount($data['amount']);
553 553
 
554 554
 	// Here come the login function.
555
-	$donor_data = give_import_get_user_from_csv( $data, $import_setting );
556
-	if ( ! empty( $donor_data->id ) ) {
557
-		if ( ! empty( $donor_data->user_id ) ) {
555
+	$donor_data = give_import_get_user_from_csv($data, $import_setting);
556
+	if ( ! empty($donor_data->id)) {
557
+		if ( ! empty($donor_data->user_id)) {
558 558
 			$customer_id = $donor_data->user_id;
559
-		} elseif ( ! empty( $data['user_id'] ) ) {
559
+		} elseif ( ! empty($data['user_id'])) {
560 560
 			$customer_id = $data['user_id'];
561 561
 		}
562 562
 	} else {
@@ -564,97 +564,97 @@  discard block
 block discarded – undo
564 564
 	}
565 565
 
566 566
 	// get form data or register a form data.
567
-	$form = give_import_get_form_data_from_csv( $data, $import_setting );
568
-	if ( false == $form ) {
567
+	$form = give_import_get_form_data_from_csv($data, $import_setting);
568
+	if (false == $form) {
569 569
 		return false;
570 570
 	} else {
571
-		$price_id = ( ! empty( $form->price_id ) ) ? $form->price_id : false;
571
+		$price_id = ( ! empty($form->price_id)) ? $form->price_id : false;
572 572
 	}
573 573
 
574 574
 
575 575
 	$address = array(
576
-		'line1'   => ( ! empty( $data['line1'] ) ? give_clean( $data['line1'] ) : '' ),
577
-		'line2'   => ( ! empty( $data['line1'] ) ? give_clean( $data['line2'] ) : '' ),
578
-		'city'    => ( ! empty( $data['line1'] ) ? give_clean( $data['city'] ) : '' ),
579
-		'zip'     => ( ! empty( $data['zip'] ) ? give_clean( $data['zip'] ) : '' ),
580
-		'state'   => ( ! empty( $data['state'] ) ? give_clean( $data['state'] ) : '' ),
581
-		'country' => ( ! empty( $data['country'] ) ? ( ( $country_code = array_search( $data['country'], give_get_country_list() ) ) ? $country_code : $data['country'] ) : '' ),
576
+		'line1'   => ( ! empty($data['line1']) ? give_clean($data['line1']) : ''),
577
+		'line2'   => ( ! empty($data['line1']) ? give_clean($data['line2']) : ''),
578
+		'city'    => ( ! empty($data['line1']) ? give_clean($data['city']) : ''),
579
+		'zip'     => ( ! empty($data['zip']) ? give_clean($data['zip']) : ''),
580
+		'state'   => ( ! empty($data['state']) ? give_clean($data['state']) : ''),
581
+		'country' => ( ! empty($data['country']) ? (($country_code = array_search($data['country'], give_get_country_list())) ? $country_code : $data['country']) : ''),
582 582
 	);
583 583
 
584 584
 	//Create payment_data array
585 585
 	$payment_data = array(
586 586
 		'donor_id'        => $donor_data->id,
587 587
 		'price'           => $data['amount'],
588
-		'status'          => ( ! empty( $data['post_status'] ) ? $data['post_status'] : 'publish' ),
588
+		'status'          => ( ! empty($data['post_status']) ? $data['post_status'] : 'publish'),
589 589
 		'currency'        => give_get_currency(),
590 590
 		'user_info'       => array(
591 591
 			'id'         => $customer_id,
592
-			'email'      => ( ! empty( $data['email'] ) ? $data['email'] : ( isset( $donor_data->email ) ? $donor_data->email : false ) ),
593
-			'first_name' => ( ! empty( $data['first_name'] ) ? $data['first_name'] : ( ! empty( $customer_id ) && ( $first_name = get_user_meta( $customer_id, 'first_name', true ) ) ? $first_name : $donor_data->name ) ),
594
-			'last_name'  => ( ! empty( $data['last_name'] ) ? $data['last_name'] : ( ! empty( $customer_id ) && ( $last_name = get_user_meta( $customer_id, 'last_name', true ) ) ? $last_name : $donor_data->name ) ),
592
+			'email'      => ( ! empty($data['email']) ? $data['email'] : (isset($donor_data->email) ? $donor_data->email : false)),
593
+			'first_name' => ( ! empty($data['first_name']) ? $data['first_name'] : ( ! empty($customer_id) && ($first_name = get_user_meta($customer_id, 'first_name', true)) ? $first_name : $donor_data->name)),
594
+			'last_name'  => ( ! empty($data['last_name']) ? $data['last_name'] : ( ! empty($customer_id) && ($last_name = get_user_meta($customer_id, 'last_name', true)) ? $last_name : $donor_data->name)),
595 595
 			'address'    => $address,
596 596
 		),
597
-		'gateway'         => ( ! empty( $data['gateway'] ) && 'offline' != strtolower( $data['gateway'] ) ? strtolower( $data['gateway'] ) : 'manual' ),
598
-		'give_form_title' => ( ! empty( $data['form_title'] ) ? $data['form_title'] : $form->get_name() ),
597
+		'gateway'         => ( ! empty($data['gateway']) && 'offline' != strtolower($data['gateway']) ? strtolower($data['gateway']) : 'manual'),
598
+		'give_form_title' => ( ! empty($data['form_title']) ? $data['form_title'] : $form->get_name()),
599 599
 		'give_form_id'    => (string) $form->get_ID(),
600 600
 		'give_price_id'   => $price_id,
601
-		'purchase_key'    => strtolower( md5( uniqid() ) ),
601
+		'purchase_key'    => strtolower(md5(uniqid())),
602 602
 		'user_email'      => $data['email'],
603
-		'post_date'       => ( ! empty( $data['post_date'] ) ? mysql2date( 'Y-m-d H:i:s', $data['post_date'] ) : current_time( 'mysql' ) ),
604
-		'mode'            => ( ! empty( $data['mode'] ) ? ( 'true' == (string) $data['mode'] || 'TRUE' == (string) $data['mode'] ? 'test' : 'live' ) : ( isset( $import_setting['mode'] ) ? ( true == (bool) $import_setting['mode'] ? 'test' : 'live' ) : ( give_is_test_mode() ? 'test' : 'live' ) ) ),
603
+		'post_date'       => ( ! empty($data['post_date']) ? mysql2date('Y-m-d H:i:s', $data['post_date']) : current_time('mysql')),
604
+		'mode'            => ( ! empty($data['mode']) ? ('true' == (string) $data['mode'] || 'TRUE' == (string) $data['mode'] ? 'test' : 'live') : (isset($import_setting['mode']) ? (true == (bool) $import_setting['mode'] ? 'test' : 'live') : (give_is_test_mode() ? 'test' : 'live'))),
605 605
 	);
606 606
 
607
-	$payment_data = apply_filters( 'give_import_before_import_payment', $payment_data, $data, $donor_data, $form );
607
+	$payment_data = apply_filters('give_import_before_import_payment', $payment_data, $data, $donor_data, $form);
608 608
 
609 609
 	// Get the report
610 610
 	$report = give_import_donation_report();
611 611
 
612 612
 	// Check for duplicate code.
613
-	$donation_duplicate = give_check_import_donation_duplicate( $payment_data, $data, $form, $donor_data );
614
-	if ( false !== $donation_duplicate ) {
615
-		$report['donation_details'][ $import_setting['donation_key'] ]['duplicate'] = $donation_duplicate;
616
-		$report['duplicate_donation'] = ( ! empty( $report['duplicate_donation'] ) ? ( absint( $report['duplicate_donation'] ) + 1 ) : 1 );
613
+	$donation_duplicate = give_check_import_donation_duplicate($payment_data, $data, $form, $donor_data);
614
+	if (false !== $donation_duplicate) {
615
+		$report['donation_details'][$import_setting['donation_key']]['duplicate'] = $donation_duplicate;
616
+		$report['duplicate_donation'] = ( ! empty($report['duplicate_donation']) ? (absint($report['duplicate_donation']) + 1) : 1);
617 617
 	} else {
618
-		add_action( 'give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1, 1 );
619
-		add_filter( 'give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11, 2 );
620
-		add_filter( 'give_update_donor_information', 'give_donation_import_update_donor_information', 11, 3 );
621
-		add_action( 'give_insert_payment', 'give_import_donation_insert_payment', 11, 2 );
622
-		$payment = give_insert_payment( $payment_data );
623
-		remove_action( 'give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1 );
624
-		remove_filter( 'give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11 );
625
-		remove_filter( 'give_update_donor_information', 'give_donation_import_update_donor_information', 11 );
626
-		remove_action( 'give_insert_payment', 'give_import_donation_insert_payment', 11 );
618
+		add_action('give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1, 1);
619
+		add_filter('give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11, 2);
620
+		add_filter('give_update_donor_information', 'give_donation_import_update_donor_information', 11, 3);
621
+		add_action('give_insert_payment', 'give_import_donation_insert_payment', 11, 2);
622
+		$payment = give_insert_payment($payment_data);
623
+		remove_action('give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1);
624
+		remove_filter('give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11);
625
+		remove_filter('give_update_donor_information', 'give_donation_import_update_donor_information', 11);
626
+		remove_action('give_insert_payment', 'give_import_donation_insert_payment', 11);
627 627
 
628
-		if ( $payment ) {
628
+		if ($payment) {
629 629
 
630
-			$report['create_donation'] = ( ! empty( $report['create_donation'] ) ? ( absint( $report['create_donation'] ) + 1 ) : 1 );
630
+			$report['create_donation'] = ( ! empty($report['create_donation']) ? (absint($report['create_donation']) + 1) : 1);
631 631
 
632
-			update_post_meta( $payment, '_give_payment_import', true );
632
+			update_post_meta($payment, '_give_payment_import', true);
633 633
 
634
-			if ( ! empty( $import_setting['csv'] ) ) {
635
-				update_post_meta( $payment, '_give_payment_import_id', $import_setting['csv'] );
634
+			if ( ! empty($import_setting['csv'])) {
635
+				update_post_meta($payment, '_give_payment_import_id', $import_setting['csv']);
636 636
 			}
637 637
 
638 638
 			// Insert Notes.
639
-			if ( ! empty( $data['notes'] ) ) {
640
-				give_insert_payment_note( $payment, $data['notes'] );
639
+			if ( ! empty($data['notes'])) {
640
+				give_insert_payment_note($payment, $data['notes']);
641 641
 			}
642 642
 
643
-			$meta_exists = array_keys( $raw_key, 'post_meta' );
644
-			if ( ! empty( $main_key ) && ! empty( $meta_exists ) ) {
645
-				foreach ( $meta_exists as $meta_exist ) {
646
-					if ( ! empty( $main_key[ $meta_exist ] ) && ! empty( $row_data[ $meta_exist ] ) ) {
647
-						update_post_meta( $payment, $main_key[ $meta_exist ], $row_data[ $meta_exist ] );
643
+			$meta_exists = array_keys($raw_key, 'post_meta');
644
+			if ( ! empty($main_key) && ! empty($meta_exists)) {
645
+				foreach ($meta_exists as $meta_exist) {
646
+					if ( ! empty($main_key[$meta_exist]) && ! empty($row_data[$meta_exist])) {
647
+						update_post_meta($payment, $main_key[$meta_exist], $row_data[$meta_exist]);
648 648
 					}
649 649
 				}
650 650
 			}
651 651
 		} else {
652
-			$report['failed_donation'] = ( ! empty( $report['failed_donation'] ) ? ( absint( $report['failed_donation'] ) + 1 ) : 1 );
652
+			$report['failed_donation'] = ( ! empty($report['failed_donation']) ? (absint($report['failed_donation']) + 1) : 1);
653 653
 		}
654 654
 	}
655 655
 
656 656
 	// update the report
657
-	give_import_donation_report_update( $report );
657
+	give_import_donation_report_update($report);
658 658
 
659 659
 	return true;
660 660
 }
@@ -670,12 +670,12 @@  discard block
 block discarded – undo
670 670
  *
671 671
  * @return Give_Donor
672 672
  */
673
-function give_donation_import_update_donor_information( $donor, $payment_id, $payment_data ) {
673
+function give_donation_import_update_donor_information($donor, $payment_id, $payment_data) {
674 674
 	$old_donor = $donor;
675
-	if ( ! empty( $payment_data['donor_id'] ) ) {
676
-		$donor_id = absint( $payment_data['donor_id'] );
677
-		$donor    = new Give_Donor( $donor_id );
678
-		if ( ! empty( $donor->id ) ) {
675
+	if ( ! empty($payment_data['donor_id'])) {
676
+		$donor_id = absint($payment_data['donor_id']);
677
+		$donor    = new Give_Donor($donor_id);
678
+		if ( ! empty($donor->id)) {
679 679
 			return $donor;
680 680
 		}
681 681
 	}
@@ -688,12 +688,12 @@  discard block
 block discarded – undo
688 688
  *
689 689
  * @since 1.8.13
690 690
  */
691
-function give_import_donation_insert_payment( $payment_id, $payment_data ) {
691
+function give_import_donation_insert_payment($payment_id, $payment_data) {
692 692
 	// Update Give Customers purchase_count
693
-	if ( ! empty( $payment_data['status'] ) && ( 'complete' === (string) $payment_data['status'] || 'publish' === (string) $payment_data['status'] ) ) {
694
-		$donor_id = (int) get_post_meta( $payment_id, '_give_payment_customer_id', true );
695
-		if ( ! empty( $donor_id ) ) {
696
-			$donor = new Give_Donor( $donor_id );
693
+	if ( ! empty($payment_data['status']) && ('complete' === (string) $payment_data['status'] || 'publish' === (string) $payment_data['status'])) {
694
+		$donor_id = (int) get_post_meta($payment_id, '_give_payment_customer_id', true);
695
+		if ( ! empty($donor_id)) {
696
+			$donor = new Give_Donor($donor_id);
697 697
 			$donor->increase_purchase_count();
698 698
 		}
699 699
 	}
@@ -704,8 +704,8 @@  discard block
 block discarded – undo
704 704
  *
705 705
  * @since 1.8.13
706 706
  */
707
-function give_donation_import_give_insert_payment_args( $args, $payment_data ) {
708
-	if ( ! empty( $payment_data['user_info']['id'] ) ) {
707
+function give_donation_import_give_insert_payment_args($args, $payment_data) {
708
+	if ( ! empty($payment_data['user_info']['id'])) {
709 709
 		$args['post_author'] = (int) $payment_data['user_info']['id'];
710 710
 	}
711 711
 
@@ -717,11 +717,11 @@  discard block
 block discarded – undo
717 717
  *
718 718
  * @since 1.8.13
719 719
  */
720
-function give_check_import_donation_duplicate( $payment_data, $data, $form, $donor_data ) {
720
+function give_check_import_donation_duplicate($payment_data, $data, $form, $donor_data) {
721 721
 	$return = false;
722
-	if ( ! empty( $data['post_date'] ) ) {
723
-		$post_date = mysql2date( 'Y-m-d-H-i-s', $data['post_date'] );
724
-		$post_date = explode( '-', $post_date );
722
+	if ( ! empty($data['post_date'])) {
723
+		$post_date = mysql2date('Y-m-d-H-i-s', $data['post_date']);
724
+		$post_date = explode('-', $post_date);
725 725
 		$args = array(
726 726
 			'output'                 => 'post',
727 727
 			'cache_results'          => false,
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 			'meta_query'             => array(
743 743
 				array(
744 744
 					'key'     => '_give_payment_total',
745
-					'value'   => preg_replace( '/[\$,]/', '', $payment_data['price'] ),
745
+					'value'   => preg_replace('/[\$,]/', '', $payment_data['price']),
746 746
 					'compare' => 'LIKE',
747 747
 				),
748 748
 				array(
@@ -764,9 +764,9 @@  discard block
 block discarded – undo
764 764
 			),
765 765
 		);
766 766
 
767
-		$payments  = new Give_Payments_Query( $args );
767
+		$payments  = new Give_Payments_Query($args);
768 768
 		$donations = $payments->get_payments();
769
-		if ( ! empty( $donations ) ) {
769
+		if ( ! empty($donations)) {
770 770
 			$return = $donations;
771 771
 		}
772 772
 	}
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 	 *
777 777
 	 * @since 1.8.18
778 778
 	 */
779
-	return apply_filters( 'give_check_import_donation_duplicate', $return, $payment_data, $data, $form, $donor_data );
779
+	return apply_filters('give_check_import_donation_duplicate', $return, $payment_data, $data, $form, $donor_data);
780 780
 }
781 781
 
782 782
 /**
@@ -788,9 +788,9 @@  discard block
 block discarded – undo
788 788
  *
789 789
  * @return void
790 790
  */
791
-function give_donation_import_insert_default_payment_note( $payment_id ) {
791
+function give_donation_import_insert_default_payment_note($payment_id) {
792 792
 	$current_user = wp_get_current_user();
793
-	give_insert_payment_note( $payment_id, esc_html( wp_sprintf( __( 'This donation was imported by %s', 'give' ), $current_user->user_email ) ) );
793
+	give_insert_payment_note($payment_id, esc_html(wp_sprintf(__('This donation was imported by %s', 'give'), $current_user->user_email)));
794 794
 }
795 795
 
796 796
 /**
@@ -802,14 +802,14 @@  discard block
 block discarded – undo
802 802
  *
803 803
  * @return string URL
804 804
  */
805
-function give_import_page_url( $parameter = array() ) {
805
+function give_import_page_url($parameter = array()) {
806 806
 	$defalut_query_arg = array(
807 807
 		'post_type'     => 'give_forms',
808 808
 		'page'          => 'give-tools',
809 809
 		'tab'           => 'import',
810 810
 		'importer-type' => 'import_donations',
811 811
 	);
812
-	$import_query_arg  = wp_parse_args( $parameter, $defalut_query_arg );
812
+	$import_query_arg = wp_parse_args($parameter, $defalut_query_arg);
813 813
 
814
-	return add_query_arg( $import_query_arg, admin_url( 'edit.php' ) );
814
+	return add_query_arg($import_query_arg, admin_url('edit.php'));
815 815
 }
816 816
\ No newline at end of file
Please login to merge, or discard this patch.
includes/forms/functions.php 1 patch
Spacing   +218 added lines, -220 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
 
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
 
24 24
 	global $typenow;
25 25
 
26
-	if ( $typenow != 'give_forms' ) {
26
+	if ($typenow != 'give_forms') {
27 27
 		return true;
28 28
 	}
29 29
 
30 30
 	return false;
31 31
 }
32 32
 
33
-add_filter( 'give_shortcode_button_condition', 'give_shortcode_button_condition' );
33
+add_filter('give_shortcode_button_condition', 'give_shortcode_button_condition');
34 34
 
35 35
 
36 36
 /**
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @return int|false
42 42
  */
43
-function get_form_id_from_args( $args ) {
43
+function get_form_id_from_args($args) {
44 44
 
45
-	if ( isset( $args['form_id'] ) && $args['form_id'] != 0 ) {
45
+	if (isset($args['form_id']) && $args['form_id'] != 0) {
46 46
 
47
-		return intval( $args['form_id'] );
47
+		return intval($args['form_id']);
48 48
 	}
49 49
 
50 50
 	return false;
@@ -59,23 +59,23 @@  discard block
 block discarded – undo
59 59
  *
60 60
  * @return bool
61 61
  */
62
-function give_is_float_labels_enabled( $args ) {
62
+function give_is_float_labels_enabled($args) {
63 63
 
64 64
 	$float_labels = '';
65 65
 
66
-	if ( ! empty( $args['float_labels'] ) ) {
66
+	if ( ! empty($args['float_labels'])) {
67 67
 		$float_labels = $args['float_labels'];
68 68
 	}
69 69
 
70
-	if ( empty( $float_labels ) ) {
71
-		$float_labels = give_get_meta( $args['form_id'], '_give_form_floating_labels', true );
70
+	if (empty($float_labels)) {
71
+		$float_labels = give_get_meta($args['form_id'], '_give_form_floating_labels', true);
72 72
 	}
73 73
 
74
-	if ( empty( $float_labels ) || ( 'global' === $float_labels ) ) {
75
-		$float_labels = give_get_option( 'floatlabels', 'disabled' );
74
+	if (empty($float_labels) || ('global' === $float_labels)) {
75
+		$float_labels = give_get_option('floatlabels', 'disabled');
76 76
 	}
77 77
 
78
-	return give_is_setting_enabled( $float_labels );
78
+	return give_is_setting_enabled($float_labels);
79 79
 }
80 80
 
81 81
 /**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 	$can_checkout = true;
93 93
 
94
-	return (bool) apply_filters( 'give_can_checkout', $can_checkout );
94
+	return (bool) apply_filters('give_can_checkout', $can_checkout);
95 95
 }
96 96
 
97 97
 /**
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 function give_get_success_page_uri() {
106 106
 	$give_options = give_get_settings();
107 107
 
108
-	$success_page = isset( $give_options['success_page'] ) ? get_permalink( absint( $give_options['success_page'] ) ) : get_bloginfo( 'url' );
108
+	$success_page = isset($give_options['success_page']) ? get_permalink(absint($give_options['success_page'])) : get_bloginfo('url');
109 109
 
110
-	return apply_filters( 'give_get_success_page_uri', $success_page );
110
+	return apply_filters('give_get_success_page_uri', $success_page);
111 111
 }
112 112
 
113 113
 /**
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
  */
120 120
 function give_is_success_page() {
121 121
 	$give_options    = give_get_settings();
122
-	$is_success_page = isset( $give_options['success_page'] ) ? is_page( $give_options['success_page'] ) : false;
122
+	$is_success_page = isset($give_options['success_page']) ? is_page($give_options['success_page']) : false;
123 123
 
124
-	return apply_filters( 'give_is_success_page', $is_success_page );
124
+	return apply_filters('give_is_success_page', $is_success_page);
125 125
 }
126 126
 
127 127
 /**
@@ -135,17 +135,17 @@  discard block
 block discarded – undo
135 135
  * @since       1.0
136 136
  * @return      void
137 137
  */
138
-function give_send_to_success_page( $query_string = null ) {
138
+function give_send_to_success_page($query_string = null) {
139 139
 
140 140
 	$redirect = give_get_success_page_uri();
141 141
 
142
-	if ( $query_string ) {
142
+	if ($query_string) {
143 143
 		$redirect .= $query_string;
144 144
 	}
145 145
 
146
-	$gateway = isset( $_REQUEST['give-gateway'] ) ? $_REQUEST['give-gateway'] : '';
146
+	$gateway = isset($_REQUEST['give-gateway']) ? $_REQUEST['give-gateway'] : '';
147 147
 
148
-	wp_redirect( apply_filters( 'give_success_page_redirect', $redirect, $gateway, $query_string ) );
148
+	wp_redirect(apply_filters('give_success_page_redirect', $redirect, $gateway, $query_string));
149 149
 	give_die();
150 150
 }
151 151
 
@@ -161,19 +161,19 @@  discard block
 block discarded – undo
161 161
  * @since  1.0
162 162
  * @return Void
163 163
  */
164
-function give_send_back_to_checkout( $args = array() ) {
164
+function give_send_back_to_checkout($args = array()) {
165 165
 
166
-	$url     = isset( $_POST['give-current-url'] ) ? sanitize_text_field( $_POST['give-current-url'] ) : '';
166
+	$url     = isset($_POST['give-current-url']) ? sanitize_text_field($_POST['give-current-url']) : '';
167 167
 	$form_id = 0;
168 168
 
169 169
 	// Set the form_id.
170
-	if ( isset( $_POST['give-form-id'] ) ) {
171
-		$form_id = sanitize_text_field( $_POST['give-form-id'] );
170
+	if (isset($_POST['give-form-id'])) {
171
+		$form_id = sanitize_text_field($_POST['give-form-id']);
172 172
 	}
173 173
 
174 174
 	// Need a URL to continue. If none, redirect back to single form.
175
-	if ( empty( $url ) ) {
176
-		wp_safe_redirect( get_permalink( $form_id ) );
175
+	if (empty($url)) {
176
+		wp_safe_redirect(get_permalink($form_id));
177 177
 		give_die();
178 178
 	}
179 179
 
@@ -182,41 +182,41 @@  discard block
 block discarded – undo
182 182
 	);
183 183
 
184 184
 	// Set the $level_id.
185
-	if ( isset( $_POST['give-price-id'] ) ) {
186
-		$defaults['level-id'] = sanitize_text_field( $_POST['give-price-id'] );
185
+	if (isset($_POST['give-price-id'])) {
186
+		$defaults['level-id'] = sanitize_text_field($_POST['give-price-id']);
187 187
 	}
188 188
 
189 189
 	// Check for backward compatibility.
190
-	if ( is_string( $args ) ) {
191
-		$args = str_replace( '?', '', $args );
190
+	if (is_string($args)) {
191
+		$args = str_replace('?', '', $args);
192 192
 	}
193 193
 
194
-	$args = wp_parse_args( $args, $defaults );
194
+	$args = wp_parse_args($args, $defaults);
195 195
 
196 196
 	// Merge URL query with $args to maintain third-party URL parameters after redirect.
197
-	$url_data = wp_parse_url( $url );
197
+	$url_data = wp_parse_url($url);
198 198
 
199 199
 	// Check if an array to prevent notices before parsing.
200
-	if ( isset( $url_data['query'] ) && ! empty( $url_data['query'] ) ) {
201
-		parse_str( $url_data['query'], $query );
200
+	if (isset($url_data['query']) && ! empty($url_data['query'])) {
201
+		parse_str($url_data['query'], $query);
202 202
 
203 203
 		// Precaution: don't allow any CC info.
204
-		unset( $query['card_number'] );
205
-		unset( $query['card_cvc'] );
204
+		unset($query['card_number']);
205
+		unset($query['card_cvc']);
206 206
 
207 207
 	} else {
208 208
 		// No $url_data so pass empty array.
209 209
 		$query = array();
210 210
 	}
211 211
 
212
-	$new_query        = array_merge( $args, $query );
213
-	$new_query_string = http_build_query( $new_query );
212
+	$new_query        = array_merge($args, $query);
213
+	$new_query_string = http_build_query($new_query);
214 214
 
215 215
 	// Assemble URL parts.
216
-	$redirect = home_url( '/' . $url_data['path'] . '?' . $new_query_string . '#give-form-' . $form_id . '-wrap' );
216
+	$redirect = home_url('/'.$url_data['path'].'?'.$new_query_string.'#give-form-'.$form_id.'-wrap');
217 217
 
218 218
 	// Redirect them.
219
-	wp_safe_redirect( apply_filters( 'give_send_back_to_checkout', $redirect, $args ) );
219
+	wp_safe_redirect(apply_filters('give_send_back_to_checkout', $redirect, $args));
220 220
 	give_die();
221 221
 
222 222
 }
@@ -232,16 +232,16 @@  discard block
 block discarded – undo
232 232
  * @since       1.0
233 233
  * @return      string
234 234
  */
235
-function give_get_success_page_url( $query_string = null ) {
235
+function give_get_success_page_url($query_string = null) {
236 236
 
237
-	$success_page = give_get_option( 'success_page', 0 );
238
-	$success_page = get_permalink( $success_page );
237
+	$success_page = give_get_option('success_page', 0);
238
+	$success_page = get_permalink($success_page);
239 239
 
240
-	if ( $query_string ) {
240
+	if ($query_string) {
241 241
 		$success_page .= $query_string;
242 242
 	}
243 243
 
244
-	return apply_filters( 'give_success_page_url', $success_page );
244
+	return apply_filters('give_success_page_url', $success_page);
245 245
 
246 246
 }
247 247
 
@@ -254,32 +254,31 @@  discard block
 block discarded – undo
254 254
  *
255 255
  * @return mixed Full URL to the Failed Donation Page, if present, home page if it doesn't exist.
256 256
  */
257
-function give_get_failed_transaction_uri( $extras = false ) {
257
+function give_get_failed_transaction_uri($extras = false) {
258 258
 	$give_options = give_get_settings();
259 259
 
260 260
 	// Remove question mark.
261
-	if ( 0 === strpos( $extras, '?' ) ) {
262
-		$extras = substr( $extras, 1 );
261
+	if (0 === strpos($extras, '?')) {
262
+		$extras = substr($extras, 1);
263 263
 	}
264 264
 
265
-	$extras_args = wp_parse_args( $extras );
265
+	$extras_args = wp_parse_args($extras);
266 266
 
267 267
 	// Set nonce if payment id exist in extra params.
268
-	if ( array_key_exists( 'payment-id', $extras_args ) ) {
269
-		$extras_args['_wpnonce'] = wp_create_nonce( "give-failed-donation-{$extras_args['payment-id']}" );
270
-		$extras                  = http_build_query( $extras_args );
268
+	if (array_key_exists('payment-id', $extras_args)) {
269
+		$extras_args['_wpnonce'] = wp_create_nonce("give-failed-donation-{$extras_args['payment-id']}");
270
+		$extras                  = http_build_query($extras_args);
271 271
 	}
272 272
 
273
-	$uri = ! empty( $give_options['failure_page'] ) ?
274
-		trailingslashit( get_permalink( $give_options['failure_page'] ) ) :
275
-		home_url();
273
+	$uri = ! empty($give_options['failure_page']) ?
274
+		trailingslashit(get_permalink($give_options['failure_page'])) : home_url();
276 275
 
277 276
 
278
-	if ( $extras ) {
277
+	if ($extras) {
279 278
 		$uri .= "?{$extras}";
280 279
 	}
281 280
 
282
-	return apply_filters( 'give_get_failed_transaction_uri', $uri );
281
+	return apply_filters('give_get_failed_transaction_uri', $uri);
283 282
 }
284 283
 
285 284
 /**
@@ -290,9 +289,9 @@  discard block
 block discarded – undo
290 289
  */
291 290
 function give_is_failed_transaction_page() {
292 291
 	$give_options = give_get_settings();
293
-	$ret          = isset( $give_options['failure_page'] ) ? is_page( $give_options['failure_page'] ) : false;
292
+	$ret          = isset($give_options['failure_page']) ? is_page($give_options['failure_page']) : false;
294 293
 
295
-	return apply_filters( 'give_is_failure_page', $ret );
294
+	return apply_filters('give_is_failure_page', $ret);
296 295
 }
297 296
 
298 297
 /**
@@ -305,25 +304,25 @@  discard block
 block discarded – undo
305 304
  */
306 305
 function give_listen_for_failed_payments() {
307 306
 
308
-	$failed_page = give_get_option( 'failure_page', 0 );
309
-	$payment_id  = ! empty( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : 0;
310
-	$nonce       = ! empty( $_GET['_wpnonce'] ) ? give_clean( $_GET['_wpnonce'] ) : false;
307
+	$failed_page = give_get_option('failure_page', 0);
308
+	$payment_id  = ! empty($_GET['payment-id']) ? absint($_GET['payment-id']) : 0;
309
+	$nonce       = ! empty($_GET['_wpnonce']) ? give_clean($_GET['_wpnonce']) : false;
311 310
 
312 311
 	// Bailout.
313
-	if ( ! $failed_page || ! is_page( $failed_page ) || ! $payment_id || ! $nonce ) {
312
+	if ( ! $failed_page || ! is_page($failed_page) || ! $payment_id || ! $nonce) {
314 313
 		return false;
315 314
 	}
316 315
 
317 316
 	// Security check.
318
-	if ( ! wp_verify_nonce( $nonce, "give-failed-donation-{$payment_id}" ) ) {
319
-		wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ) );
317
+	if ( ! wp_verify_nonce($nonce, "give-failed-donation-{$payment_id}")) {
318
+		wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'));
320 319
 	}
321 320
 
322 321
 	// Set payment status to failure
323
-	give_update_payment_status( $payment_id, 'failed' );
322
+	give_update_payment_status($payment_id, 'failed');
324 323
 }
325 324
 
326
-add_action( 'template_redirect', 'give_listen_for_failed_payments' );
325
+add_action('template_redirect', 'give_listen_for_failed_payments');
327 326
 
328 327
 /**
329 328
  * Retrieve the Donation History page URI
@@ -336,9 +335,9 @@  discard block
 block discarded – undo
336 335
 function give_get_history_page_uri() {
337 336
 	$give_options = give_get_settings();
338 337
 
339
-	$history_page = isset( $give_options['history_page'] ) ? get_permalink( absint( $give_options['history_page'] ) ) : get_bloginfo( 'url' );
338
+	$history_page = isset($give_options['history_page']) ? get_permalink(absint($give_options['history_page'])) : get_bloginfo('url');
340 339
 
341
-	return apply_filters( 'give_get_history_page_uri', $history_page );
340
+	return apply_filters('give_get_history_page_uri', $history_page);
342 341
 }
343 342
 
344 343
 /**
@@ -351,11 +350,11 @@  discard block
 block discarded – undo
351 350
  * @since       1.0
352 351
  * @return      bool
353 352
  */
354
-function give_field_is_required( $field = '', $form_id ) {
353
+function give_field_is_required($field = '', $form_id) {
355 354
 
356
-	$required_fields = give_get_required_fields( $form_id );
355
+	$required_fields = give_get_required_fields($form_id);
357 356
 
358
-	return array_key_exists( $field, $required_fields );
357
+	return array_key_exists($field, $required_fields);
359 358
 }
360 359
 
361 360
 /**
@@ -373,14 +372,14 @@  discard block
 block discarded – undo
373 372
  *
374 373
  * @return void
375 374
  */
376
-function give_record_donation_in_log( $give_form_id = 0, $payment_id, $price_id = false, $donation_date = null ) {
375
+function give_record_donation_in_log($give_form_id = 0, $payment_id, $price_id = false, $donation_date = null) {
377 376
 	global $give_logs;
378 377
 
379 378
 	$log_data = array(
380 379
 		'post_parent'   => $give_form_id,
381 380
 		'log_type'      => 'sale',
382
-		'post_date'     => isset( $donation_date ) ? $donation_date : null,
383
-		'post_date_gmt' => isset( $donation_date ) ? $donation_date : null,
381
+		'post_date'     => isset($donation_date) ? $donation_date : null,
382
+		'post_date_gmt' => isset($donation_date) ? $donation_date : null,
384 383
 	);
385 384
 
386 385
 	$log_meta = array(
@@ -388,7 +387,7 @@  discard block
 block discarded – undo
388 387
 		'price_id'   => (int) $price_id,
389 388
 	);
390 389
 
391
-	$give_logs->insert_log( $log_data, $log_meta );
390
+	$give_logs->insert_log($log_data, $log_meta);
392 391
 }
393 392
 
394 393
 
@@ -402,11 +401,11 @@  discard block
 block discarded – undo
402 401
  *
403 402
  * @return bool|int
404 403
  */
405
-function give_increase_donation_count( $form_id = 0, $quantity = 1 ) {
404
+function give_increase_donation_count($form_id = 0, $quantity = 1) {
406 405
 	$quantity = (int) $quantity;
407
-	$form     = new Give_Donate_Form( $form_id );
406
+	$form     = new Give_Donate_Form($form_id);
408 407
 
409
-	return $form->increase_sales( $quantity );
408
+	return $form->increase_sales($quantity);
410 409
 }
411 410
 
412 411
 /**
@@ -419,11 +418,11 @@  discard block
 block discarded – undo
419 418
  *
420 419
  * @return bool|int
421 420
  */
422
-function give_decrease_donation_count( $form_id = 0, $quantity = 1 ) {
421
+function give_decrease_donation_count($form_id = 0, $quantity = 1) {
423 422
 	$quantity = (int) $quantity;
424
-	$form     = new Give_Donate_Form( $form_id );
423
+	$form     = new Give_Donate_Form($form_id);
425 424
 
426
-	return $form->decrease_sales( $quantity );
425
+	return $form->decrease_sales($quantity);
427 426
 }
428 427
 
429 428
 /**
@@ -436,10 +435,10 @@  discard block
 block discarded – undo
436 435
  *
437 436
  * @return bool|int
438 437
  */
439
-function give_increase_earnings( $give_form_id = 0, $amount ) {
440
-	$form = new Give_Donate_Form( $give_form_id );
438
+function give_increase_earnings($give_form_id = 0, $amount) {
439
+	$form = new Give_Donate_Form($give_form_id);
441 440
 
442
-	return $form->increase_earnings( $amount );
441
+	return $form->increase_earnings($amount);
443 442
 }
444 443
 
445 444
 /**
@@ -454,11 +453,11 @@  discard block
 block discarded – undo
454 453
  *
455 454
  * @return bool|int
456 455
  */
457
-function give_decrease_form_earnings( $form_id = 0, $amount ) {
456
+function give_decrease_form_earnings($form_id = 0, $amount) {
458 457
 
459
-	$form = new Give_Donate_Form( $form_id );
458
+	$form = new Give_Donate_Form($form_id);
460 459
 
461
-	return $form->decrease_earnings( $amount );
460
+	return $form->decrease_earnings($amount);
462 461
 }
463 462
 
464 463
 
@@ -471,15 +470,15 @@  discard block
 block discarded – undo
471 470
  *
472 471
  * @return int $earnings Earnings for a certain form
473 472
  */
474
-function give_get_form_earnings_stats( $form_id = 0 ) {
475
-	$give_form = new Give_Donate_Form( $form_id );
473
+function give_get_form_earnings_stats($form_id = 0) {
474
+	$give_form = new Give_Donate_Form($form_id);
476 475
 
477 476
 	/**
478 477
 	 * Filter the form earnings
479 478
 	 *
480 479
 	 * @since 1.8.17
481 480
 	 */
482
-	return apply_filters( 'give_get_form_earnings_stats', $give_form->earnings, $form_id, $give_form );
481
+	return apply_filters('give_get_form_earnings_stats', $give_form->earnings, $form_id, $give_form);
483 482
 }
484 483
 
485 484
 
@@ -492,8 +491,8 @@  discard block
 block discarded – undo
492 491
  *
493 492
  * @return int $sales Amount of sales for a certain form
494 493
  */
495
-function give_get_form_sales_stats( $give_form_id = 0 ) {
496
-	$give_form = new Give_Donate_Form( $give_form_id );
494
+function give_get_form_sales_stats($give_form_id = 0) {
495
+	$give_form = new Give_Donate_Form($give_form_id);
497 496
 
498 497
 	return $give_form->sales;
499 498
 }
@@ -508,16 +507,16 @@  discard block
 block discarded – undo
508 507
  *
509 508
  * @return float $sales Average monthly sales
510 509
  */
511
-function give_get_average_monthly_form_sales( $form_id = 0 ) {
512
-	$sales        = give_get_form_sales_stats( $form_id );
513
-	$release_date = get_post_field( 'post_date', $form_id );
510
+function give_get_average_monthly_form_sales($form_id = 0) {
511
+	$sales        = give_get_form_sales_stats($form_id);
512
+	$release_date = get_post_field('post_date', $form_id);
514 513
 
515
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
514
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
516 515
 
517
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
516
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
518 517
 
519
-	if ( $months > 0 ) {
520
-		$sales = ( $sales / $months );
518
+	if ($months > 0) {
519
+		$sales = ($sales / $months);
521 520
 	}
522 521
 
523 522
 	return $sales;
@@ -533,16 +532,16 @@  discard block
 block discarded – undo
533 532
  *
534 533
  * @return float $earnings Average monthly earnings
535 534
  */
536
-function give_get_average_monthly_form_earnings( $form_id = 0 ) {
537
-	$earnings     = give_get_form_earnings_stats( $form_id );
538
-	$release_date = get_post_field( 'post_date', $form_id );
535
+function give_get_average_monthly_form_earnings($form_id = 0) {
536
+	$earnings     = give_get_form_earnings_stats($form_id);
537
+	$release_date = get_post_field('post_date', $form_id);
539 538
 
540
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
539
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
541 540
 
542
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
541
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
543 542
 
544
-	if ( $months > 0 ) {
545
-		$earnings = ( $earnings / $months );
543
+	if ($months > 0) {
544
+		$earnings = ($earnings / $months);
546 545
 	}
547 546
 
548 547
 	return $earnings < 0 ? 0 : $earnings;
@@ -563,35 +562,34 @@  discard block
 block discarded – undo
563 562
  *
564 563
  * @return string $price_name Name of the price option
565 564
  */
566
-function give_get_price_option_name( $form_id = 0, $price_id = 0, $payment_id = 0, $use_fallback = true ) {
565
+function give_get_price_option_name($form_id = 0, $price_id = 0, $payment_id = 0, $use_fallback = true) {
567 566
 
568
-	$prices     = give_get_variable_prices( $form_id );
567
+	$prices     = give_get_variable_prices($form_id);
569 568
 	$price_name = '';
570 569
 
571
-	if ( false === $prices ) {
570
+	if (false === $prices) {
572 571
 		return $price_name;
573 572
 	}
574 573
 
575
-	foreach ( $prices as $price ) {
574
+	foreach ($prices as $price) {
576 575
 
577
-		if ( intval( $price['_give_id']['level_id'] ) == intval( $price_id ) ) {
576
+		if (intval($price['_give_id']['level_id']) == intval($price_id)) {
578 577
 
579
-			$price_text     = isset( $price['_give_text'] ) ? $price['_give_text'] : '';
578
+			$price_text     = isset($price['_give_text']) ? $price['_give_text'] : '';
580 579
 			$price_fallback = $use_fallback ?
581 580
 				give_currency_filter(
582 581
 					give_format_amount(
583 582
 						$price['_give_amount'],
584
-						array( 'sanitize' => false )
583
+						array('sanitize' => false)
585 584
 					),
586
-					array( 'decode_currency' => true )
587
-				) :
588
-				'';
589
-			$price_name     = ! empty( $price_text ) ? $price_text : $price_fallback;
585
+					array('decode_currency' => true)
586
+				) : '';
587
+			$price_name = ! empty($price_text) ? $price_text : $price_fallback;
590 588
 
591 589
 		}
592 590
 	}
593 591
 
594
-	return apply_filters( 'give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id );
592
+	return apply_filters('give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id);
595 593
 }
596 594
 
597 595
 
@@ -605,25 +603,25 @@  discard block
 block discarded – undo
605 603
  *
606 604
  * @return string $range A fully formatted price range
607 605
  */
608
-function give_price_range( $form_id = 0, $formatted = true ) {
609
-	$low        = give_get_lowest_price_option( $form_id );
610
-	$high       = give_get_highest_price_option( $form_id );
611
-	$order_type = ! empty( $_REQUEST['order'] ) ? $_REQUEST['order'] : 'asc';
606
+function give_price_range($form_id = 0, $formatted = true) {
607
+	$low        = give_get_lowest_price_option($form_id);
608
+	$high       = give_get_highest_price_option($form_id);
609
+	$order_type = ! empty($_REQUEST['order']) ? $_REQUEST['order'] : 'asc';
612 610
 
613 611
 	$range = sprintf(
614 612
 		'<span class="give_price_range_%1$s">%2$s</span><span class="give_price_range_sep">&nbsp;&ndash;&nbsp;</span><span class="give_price_range_%3$s">%4$s</span>',
615 613
 		'asc' === $order_type ? 'low' : 'high',
616
-		'asc' === $order_type ? give_currency_filter( give_format_amount( $low, array( 'sanitize' => false ) ) ) : give_currency_filter( give_format_amount( $high, array( 'sanitize' => false ) ) ),
614
+		'asc' === $order_type ? give_currency_filter(give_format_amount($low, array('sanitize' => false))) : give_currency_filter(give_format_amount($high, array('sanitize' => false))),
617 615
 		'asc' === $order_type ? 'high' : 'low',
618
-		'asc' === $order_type ? give_currency_filter( give_format_amount( $high, array( 'sanitize' => false ) ) ) : give_currency_filter( give_format_amount( $low, array( 'sanitize' => false ) ) )
616
+		'asc' === $order_type ? give_currency_filter(give_format_amount($high, array('sanitize' => false))) : give_currency_filter(give_format_amount($low, array('sanitize' => false)))
619 617
 
620 618
 	);
621 619
 
622
-	if ( ! $formatted ) {
623
-		$range = wp_strip_all_tags( $range );
620
+	if ( ! $formatted) {
621
+		$range = wp_strip_all_tags($range);
624 622
 	}
625 623
 
626
-	return apply_filters( 'give_price_range', $range, $form_id, $low, $high );
624
+	return apply_filters('give_price_range', $range, $form_id, $low, $high);
627 625
 }
628 626
 
629 627
 
@@ -638,35 +636,35 @@  discard block
 block discarded – undo
638 636
  *
639 637
  * @return int ID of the lowest price
640 638
  */
641
-function give_get_lowest_price_id( $form_id = 0 ) {
639
+function give_get_lowest_price_id($form_id = 0) {
642 640
 
643
-	if ( empty( $form_id ) ) {
641
+	if (empty($form_id)) {
644 642
 		$form_id = get_the_ID();
645 643
 	}
646 644
 
647
-	if ( ! give_has_variable_prices( $form_id ) ) {
648
-		return give_get_form_price( $form_id );
645
+	if ( ! give_has_variable_prices($form_id)) {
646
+		return give_get_form_price($form_id);
649 647
 	}
650 648
 
651
-	$prices = give_get_variable_prices( $form_id );
649
+	$prices = give_get_variable_prices($form_id);
652 650
 
653 651
 	$min = $min_id = 0;
654 652
 
655
-	if ( ! empty( $prices ) ) {
653
+	if ( ! empty($prices)) {
656 654
 
657
-		foreach ( $prices as $key => $price ) {
655
+		foreach ($prices as $key => $price) {
658 656
 
659
-			if ( empty( $price['_give_amount'] ) ) {
657
+			if (empty($price['_give_amount'])) {
660 658
 				continue;
661 659
 			}
662 660
 
663
-			if ( ! isset( $min ) ) {
661
+			if ( ! isset($min)) {
664 662
 				$min = $price['_give_amount'];
665 663
 			} else {
666
-				$min = min( $min, $price['_give_amount'] );
664
+				$min = min($min, $price['_give_amount']);
667 665
 			}
668 666
 
669
-			if ( $price['_give_amount'] == $min ) {
667
+			if ($price['_give_amount'] == $min) {
670 668
 				$min_id = $price['_give_id']['level_id'];
671 669
 			}
672 670
 		}
@@ -684,22 +682,22 @@  discard block
 block discarded – undo
684 682
  *
685 683
  * @return float Amount of the lowest price
686 684
  */
687
-function give_get_lowest_price_option( $form_id = 0 ) {
688
-	if ( empty( $form_id ) ) {
685
+function give_get_lowest_price_option($form_id = 0) {
686
+	if (empty($form_id)) {
689 687
 		$form_id = get_the_ID();
690 688
 	}
691 689
 
692
-	if ( ! give_has_variable_prices( $form_id ) ) {
693
-		return give_get_form_price( $form_id );
690
+	if ( ! give_has_variable_prices($form_id)) {
691
+		return give_get_form_price($form_id);
694 692
 	}
695 693
 
696
-	if ( ! ( $low = get_post_meta( $form_id, '_give_levels_minimum_amount', true ) ) ) {
694
+	if ( ! ($low = get_post_meta($form_id, '_give_levels_minimum_amount', true))) {
697 695
 		// Backward compatibility.
698
-		$prices = wp_list_pluck( give_get_variable_prices( $form_id ), '_give_amount' );
699
-		$low    = ! empty( $prices ) ? min( $prices ) : 0;
696
+		$prices = wp_list_pluck(give_get_variable_prices($form_id), '_give_amount');
697
+		$low    = ! empty($prices) ? min($prices) : 0;
700 698
 	}
701 699
 
702
-	return give_maybe_sanitize_amount( $low );
700
+	return give_maybe_sanitize_amount($low);
703 701
 }
704 702
 
705 703
 /**
@@ -711,23 +709,23 @@  discard block
 block discarded – undo
711 709
  *
712 710
  * @return float Amount of the highest price
713 711
  */
714
-function give_get_highest_price_option( $form_id = 0 ) {
712
+function give_get_highest_price_option($form_id = 0) {
715 713
 
716
-	if ( empty( $form_id ) ) {
714
+	if (empty($form_id)) {
717 715
 		$form_id = get_the_ID();
718 716
 	}
719 717
 
720
-	if ( ! give_has_variable_prices( $form_id ) ) {
721
-		return give_get_form_price( $form_id );
718
+	if ( ! give_has_variable_prices($form_id)) {
719
+		return give_get_form_price($form_id);
722 720
 	}
723 721
 
724
-	if ( ! ( $high = get_post_meta( $form_id, '_give_levels_maximum_amount', true ) ) ) {
722
+	if ( ! ($high = get_post_meta($form_id, '_give_levels_maximum_amount', true))) {
725 723
 		// Backward compatibility.
726
-		$prices = wp_list_pluck( give_get_variable_prices( $form_id ), '_give_amount' );
727
-		$high   = ! empty( $prices ) ? max( $prices ) : 0;
724
+		$prices = wp_list_pluck(give_get_variable_prices($form_id), '_give_amount');
725
+		$high   = ! empty($prices) ? max($prices) : 0;
728 726
 	}
729 727
 
730
-	return give_maybe_sanitize_amount( $high );
728
+	return give_maybe_sanitize_amount($high);
731 729
 }
732 730
 
733 731
 /**
@@ -739,15 +737,15 @@  discard block
 block discarded – undo
739 737
  *
740 738
  * @return mixed string|int Price of the form
741 739
  */
742
-function give_get_form_price( $form_id = 0 ) {
740
+function give_get_form_price($form_id = 0) {
743 741
 
744
-	if ( empty( $form_id ) ) {
742
+	if (empty($form_id)) {
745 743
 		return false;
746 744
 	}
747 745
 
748
-	$form = new Give_Donate_Form( $form_id );
746
+	$form = new Give_Donate_Form($form_id);
749 747
 
750
-	return $form->__get( 'price' );
748
+	return $form->__get('price');
751 749
 }
752 750
 
753 751
 /**
@@ -759,13 +757,13 @@  discard block
 block discarded – undo
759 757
  *
760 758
  * @return mixed string|int Minimum price of the form
761 759
  */
762
-function give_get_form_minimum_price( $form_id = 0 ) {
760
+function give_get_form_minimum_price($form_id = 0) {
763 761
 
764
-	if ( empty( $form_id ) ) {
762
+	if (empty($form_id)) {
765 763
 		return false;
766 764
 	}
767 765
 
768
-	$form = new Give_Donate_Form( $form_id );
766
+	$form = new Give_Donate_Form($form_id);
769 767
 
770 768
 	return $form->get_minimum_price();
771 769
 
@@ -782,48 +780,48 @@  discard block
 block discarded – undo
782 780
  *
783 781
  * @return int $formatted_price
784 782
  */
785
-function give_price( $form_id = 0, $echo = true, $price_id = false ) {
783
+function give_price($form_id = 0, $echo = true, $price_id = false) {
786 784
 	$price = 0;
787 785
 
788
-	if ( empty( $form_id ) ) {
786
+	if (empty($form_id)) {
789 787
 		$form_id = get_the_ID();
790 788
 	}
791 789
 
792
-	if ( give_has_variable_prices( $form_id ) ) {
790
+	if (give_has_variable_prices($form_id)) {
793 791
 
794
-		$prices = give_get_variable_prices( $form_id );
792
+		$prices = give_get_variable_prices($form_id);
795 793
 
796
-		if ( false !== $price_id ) {
794
+		if (false !== $price_id) {
797 795
 
798 796
 			// loop through multi-prices to see which is default
799
-			foreach ( $prices as $price ) {
797
+			foreach ($prices as $price) {
800 798
 				// this is the default price
801
-				if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
799
+				if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
802 800
 					$price = (float) $price['_give_amount'];
803 801
 				};
804 802
 			}
805 803
 		} else {
806 804
 
807
-			$price = give_get_lowest_price_option( $form_id );
805
+			$price = give_get_lowest_price_option($form_id);
808 806
 		}
809 807
 	} else {
810 808
 
811
-		$price = give_get_form_price( $form_id );
809
+		$price = give_get_form_price($form_id);
812 810
 	}
813 811
 
814
-	$price           = apply_filters( 'give_form_price', give_maybe_sanitize_amount( $price ), $form_id );
815
-	$formatted_price = '<span class="give_price" id="give_price_' . $form_id . '">' . $price . '</span>';
816
-	$formatted_price = apply_filters( 'give_form_price_after_html', $formatted_price, $form_id, $price );
812
+	$price           = apply_filters('give_form_price', give_maybe_sanitize_amount($price), $form_id);
813
+	$formatted_price = '<span class="give_price" id="give_price_'.$form_id.'">'.$price.'</span>';
814
+	$formatted_price = apply_filters('give_form_price_after_html', $formatted_price, $form_id, $price);
817 815
 
818
-	if ( $echo ) {
816
+	if ($echo) {
819 817
 		echo $formatted_price;
820 818
 	} else {
821 819
 		return $formatted_price;
822 820
 	}
823 821
 }
824 822
 
825
-add_filter( 'give_form_price', 'give_format_amount', 10 );
826
-add_filter( 'give_form_price', 'give_currency_filter', 20 );
823
+add_filter('give_form_price', 'give_format_amount', 10);
824
+add_filter('give_form_price', 'give_currency_filter', 20);
827 825
 
828 826
 
829 827
 /**
@@ -836,19 +834,19 @@  discard block
 block discarded – undo
836 834
  *
837 835
  * @return float $amount Amount of the price option
838 836
  */
839
-function give_get_price_option_amount( $form_id = 0, $price_id = 0 ) {
840
-	$prices = give_get_variable_prices( $form_id );
837
+function give_get_price_option_amount($form_id = 0, $price_id = 0) {
838
+	$prices = give_get_variable_prices($form_id);
841 839
 
842 840
 	$amount = 0.00;
843 841
 
844
-	foreach ( $prices as $price ) {
845
-		if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] == $price_id ) {
846
-			$amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00;
842
+	foreach ($prices as $price) {
843
+		if (isset($price['_give_id']['level_id']) && $price['_give_id']['level_id'] == $price_id) {
844
+			$amount = isset($price['_give_amount']) ? $price['_give_amount'] : 0.00;
847 845
 			break;
848 846
 		};
849 847
 	}
850 848
 
851
-	return apply_filters( 'give_get_price_option_amount', give_maybe_sanitize_amount( $amount ), $form_id, $price_id );
849
+	return apply_filters('give_get_price_option_amount', give_maybe_sanitize_amount($amount), $form_id, $price_id);
852 850
 }
853 851
 
854 852
 /**
@@ -860,13 +858,13 @@  discard block
 block discarded – undo
860 858
  *
861 859
  * @return mixed string|int Goal of the form
862 860
  */
863
-function give_get_form_goal( $form_id = 0 ) {
861
+function give_get_form_goal($form_id = 0) {
864 862
 
865
-	if ( empty( $form_id ) ) {
863
+	if (empty($form_id)) {
866 864
 		return false;
867 865
 	}
868 866
 
869
-	$form = new Give_Donate_Form( $form_id );
867
+	$form = new Give_Donate_Form($form_id);
870 868
 
871 869
 	return $form->goal;
872 870
 
@@ -882,27 +880,27 @@  discard block
 block discarded – undo
882 880
  *
883 881
  * @return string $formatted_goal
884 882
  */
885
-function give_goal( $form_id = 0, $echo = true ) {
883
+function give_goal($form_id = 0, $echo = true) {
886 884
 
887
-	if ( empty( $form_id ) ) {
885
+	if (empty($form_id)) {
888 886
 		$form_id = get_the_ID();
889 887
 	}
890 888
 
891
-	$goal = give_get_form_goal( $form_id );
889
+	$goal = give_get_form_goal($form_id);
892 890
 
893
-	$goal           = apply_filters( 'give_form_goal', give_maybe_sanitize_amount( $goal ), $form_id );
894
-	$formatted_goal = '<span class="give_price" id="give_price_' . $form_id . '">' . $goal . '</span>';
895
-	$formatted_goal = apply_filters( 'give_form_price_after_html', $formatted_goal, $form_id, $goal );
891
+	$goal           = apply_filters('give_form_goal', give_maybe_sanitize_amount($goal), $form_id);
892
+	$formatted_goal = '<span class="give_price" id="give_price_'.$form_id.'">'.$goal.'</span>';
893
+	$formatted_goal = apply_filters('give_form_price_after_html', $formatted_goal, $form_id, $goal);
896 894
 
897
-	if ( $echo ) {
895
+	if ($echo) {
898 896
 		echo $formatted_goal;
899 897
 	} else {
900 898
 		return $formatted_goal;
901 899
 	}
902 900
 }
903 901
 
904
-add_filter( 'give_form_goal', 'give_format_amount', 10 );
905
-add_filter( 'give_form_goal', 'give_currency_filter', 20 );
902
+add_filter('give_form_goal', 'give_format_amount', 10);
903
+add_filter('give_form_goal', 'give_currency_filter', 20);
906 904
 
907 905
 
908 906
 /**
@@ -914,15 +912,15 @@  discard block
 block discarded – undo
914 912
  *
915 913
  * @return bool  $ret Whether or not the logged_in_only setting is set
916 914
  */
917
-function give_logged_in_only( $form_id ) {
915
+function give_logged_in_only($form_id) {
918 916
 	// If _give_logged_in_only is set to enable then guest can donate from that specific form.
919 917
 	// Otherwise it is member only donation form.
920
-	$val = give_get_meta( $form_id, '_give_logged_in_only', true );
921
-	$val = ! empty( $val ) ? $val : 'enabled';
918
+	$val = give_get_meta($form_id, '_give_logged_in_only', true);
919
+	$val = ! empty($val) ? $val : 'enabled';
922 920
 
923
-	$ret = ! give_is_setting_enabled( $val );
921
+	$ret = ! give_is_setting_enabled($val);
924 922
 
925
-	return (bool) apply_filters( 'give_logged_in_only', $ret, $form_id );
923
+	return (bool) apply_filters('give_logged_in_only', $ret, $form_id);
926 924
 }
927 925
 
928 926
 
@@ -935,11 +933,11 @@  discard block
 block discarded – undo
935 933
  *
936 934
  * @return string
937 935
  */
938
-function give_show_login_register_option( $form_id ) {
936
+function give_show_login_register_option($form_id) {
939 937
 
940
-	$show_register_form = give_get_meta( $form_id, '_give_show_register_form', true );
938
+	$show_register_form = give_get_meta($form_id, '_give_show_register_form', true);
941 939
 
942
-	return apply_filters( 'give_show_register_form', $show_register_form, $form_id );
940
+	return apply_filters('give_show_register_form', $show_register_form, $form_id);
943 941
 
944 942
 }
945 943
 
@@ -955,12 +953,12 @@  discard block
 block discarded – undo
955 953
  *
956 954
  * @return array
957 955
  */
958
-function _give_get_prefill_form_field_values( $form_id ) {
956
+function _give_get_prefill_form_field_values($form_id) {
959 957
 	$logged_in_donor_info = array();
960 958
 
961
-	if ( is_user_logged_in() ) :
962
-		$donor_data    = get_userdata( get_current_user_id() );
963
-		$donor_address = get_user_meta( get_current_user_id(), '_give_user_address', true );
959
+	if (is_user_logged_in()) :
960
+		$donor_data    = get_userdata(get_current_user_id());
961
+		$donor_address = get_user_meta(get_current_user_id(), '_give_user_address', true);
964 962
 
965 963
 		$logged_in_donor_info = array(
966 964
 			// First name.
@@ -973,42 +971,42 @@  discard block
 block discarded – undo
973 971
 			'give_email'      => $donor_data->user_email,
974 972
 
975 973
 			// Street address 1.
976
-			'card_address'    => ( ! empty( $donor_address['line1'] ) ? $donor_address['line1'] : '' ),
974
+			'card_address'    => ( ! empty($donor_address['line1']) ? $donor_address['line1'] : ''),
977 975
 
978 976
 			// Street address 2.
979
-			'card_address_2'  => ( ! empty( $donor_address['line2'] ) ? $donor_address['line2'] : '' ),
977
+			'card_address_2'  => ( ! empty($donor_address['line2']) ? $donor_address['line2'] : ''),
980 978
 
981 979
 			// Country.
982
-			'billing_country' => ( ! empty( $donor_address['country'] ) ? $donor_address['country'] : '' ),
980
+			'billing_country' => ( ! empty($donor_address['country']) ? $donor_address['country'] : ''),
983 981
 
984 982
 			// State.
985
-			'card_state'      => ( ! empty( $donor_address['state'] ) ? $donor_address['state'] : '' ),
983
+			'card_state'      => ( ! empty($donor_address['state']) ? $donor_address['state'] : ''),
986 984
 
987 985
 			// City.
988
-			'card_city'       => ( ! empty( $donor_address['city'] ) ? $donor_address['city'] : '' ),
986
+			'card_city'       => ( ! empty($donor_address['city']) ? $donor_address['city'] : ''),
989 987
 
990 988
 			// Zipcode
991
-			'card_zip'        => ( ! empty( $donor_address['zip'] ) ? $donor_address['zip'] : '' ),
989
+			'card_zip'        => ( ! empty($donor_address['zip']) ? $donor_address['zip'] : ''),
992 990
 		);
993 991
 	endif;
994 992
 
995 993
 	// Bailout: Auto fill form field values only form form which donor is donating.
996 994
 	if (
997
-		empty( $_GET['form-id'] )
995
+		empty($_GET['form-id'])
998 996
 		|| ! $form_id
999
-		|| ( $form_id !== absint( $_GET['form-id'] ) )
997
+		|| ($form_id !== absint($_GET['form-id']))
1000 998
 	) {
1001 999
 		return $logged_in_donor_info;
1002 1000
 	}
1003 1001
 
1004 1002
 	// Get purchase data.
1005
-	$give_purchase_data = Give()->session->get( 'give_purchase' );
1003
+	$give_purchase_data = Give()->session->get('give_purchase');
1006 1004
 
1007 1005
 	// Get donor info from form data.
1008
-	$give_donor_info_in_session = empty( $give_purchase_data['post_data'] )
1006
+	$give_donor_info_in_session = empty($give_purchase_data['post_data'])
1009 1007
 		? array()
1010 1008
 		: $give_purchase_data['post_data'];
1011 1009
 
1012 1010
 	// Output.
1013
-	return wp_parse_args( $give_donor_info_in_session, $logged_in_donor_info );
1011
+	return wp_parse_args($give_donor_info_in_session, $logged_in_donor_info);
1014 1012
 }
Please login to merge, or discard this patch.
includes/forms/template.php 1 patch
Spacing   +415 added lines, -416 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
 
@@ -23,50 +23,50 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string Donation form.
25 25
  */
26
-function give_get_donation_form( $args = array() ) {
26
+function give_get_donation_form($args = array()) {
27 27
 
28 28
 	global $post;
29 29
 
30
-	$form_id = is_object( $post ) ? $post->ID : 0;
30
+	$form_id = is_object($post) ? $post->ID : 0;
31 31
 
32
-	if ( isset( $args['id'] ) ) {
32
+	if (isset($args['id'])) {
33 33
 		$form_id = $args['id'];
34 34
 	}
35 35
 
36
-	$defaults = apply_filters( 'give_form_args_defaults', array(
36
+	$defaults = apply_filters('give_form_args_defaults', array(
37 37
 		'form_id' => $form_id,
38
-	) );
38
+	));
39 39
 
40
-	$args = wp_parse_args( $args, $defaults );
40
+	$args = wp_parse_args($args, $defaults);
41 41
 
42
-	$form = new Give_Donate_Form( $args['form_id'] );
42
+	$form = new Give_Donate_Form($args['form_id']);
43 43
 
44 44
 	//bail if no form ID.
45
-	if ( empty( $form->ID ) ) {
45
+	if (empty($form->ID)) {
46 46
 		return false;
47 47
 	}
48 48
 
49
-	$payment_mode = give_get_chosen_gateway( $form->ID );
49
+	$payment_mode = give_get_chosen_gateway($form->ID);
50 50
 
51
-	$form_action = add_query_arg( apply_filters( 'give_form_action_args', array(
51
+	$form_action = add_query_arg(apply_filters('give_form_action_args', array(
52 52
 		'payment-mode' => $payment_mode,
53
-	) ),
53
+	)),
54 54
 		give_get_current_page_url()
55 55
 	);
56 56
 
57 57
 	//Sanity Check: Donation form not published or user doesn't have permission to view drafts.
58 58
 	if (
59
-		( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) )
60
-		|| ( 'trash' === $form->post_status )
59
+		('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID))
60
+		|| ('trash' === $form->post_status)
61 61
 	) {
62 62
 		return false;
63 63
 	}
64 64
 
65 65
 	//Get the form wrap CSS classes.
66
-	$form_wrap_classes = $form->get_form_wrap_classes( $args );
66
+	$form_wrap_classes = $form->get_form_wrap_classes($args);
67 67
 
68 68
 	//Get the <form> tag wrap CSS classes.
69
-	$form_classes = $form->get_form_classes( $args );
69
+	$form_classes = $form->get_form_classes($args);
70 70
 
71 71
 	ob_start();
72 72
 
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
 	 * @param int   $form_id The form ID.
79 79
 	 * @param array $args    An array of form arguments.
80 80
 	 */
81
-	do_action( 'give_pre_form_output', $form->ID, $args, $form );
81
+	do_action('give_pre_form_output', $form->ID, $args, $form);
82 82
 
83 83
 	?>
84 84
 	<div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>">
85 85
 
86
-		<?php if ( $form->is_close_donation_form() ) {
86
+		<?php if ($form->is_close_donation_form()) {
87 87
 
88 88
 			// Get Goal thank you message.
89
-			$goal_achieved_message = give_get_meta( $form->ID, '_give_form_goal_achieved_message', true );
90
-			$goal_achieved_message = ! empty( $goal_achieved_message ) ? apply_filters( 'the_content', $goal_achieved_message ) : '';
89
+			$goal_achieved_message = give_get_meta($form->ID, '_give_form_goal_achieved_message', true);
90
+			$goal_achieved_message = ! empty($goal_achieved_message) ? apply_filters('the_content', $goal_achieved_message) : '';
91 91
 
92 92
 			// Print thank you message.
93
-			echo apply_filters( 'give_goal_closed_output', $goal_achieved_message, $form->ID, $form );
93
+			echo apply_filters('give_goal_closed_output', $goal_achieved_message, $form->ID, $form);
94 94
 
95 95
 		} else {
96 96
 			/**
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
 			 * 1. if show_title params set to true
99 99
 			 * 2. if admin set form display_style to button
100 100
 			 */
101
-			$form_title = apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' );
101
+			$form_title = apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>');
102 102
 			if (
103
-				( isset( $args['show_title'] ) && $args['show_title'] == true )
104
-				&& ! doing_action( 'give_single_form_summary' )
103
+				(isset($args['show_title']) && $args['show_title'] == true)
104
+				&& ! doing_action('give_single_form_summary')
105 105
 			) {
106 106
 				echo $form_title;
107 107
 			}
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
 			 * @param array            $args    An array of form arguments.
116 116
 			 * @param Give_Donate_Form $form    Form object.
117 117
 			 */
118
-			do_action( 'give_pre_form', $form->ID, $args, $form );
118
+			do_action('give_pre_form', $form->ID, $args, $form);
119 119
 
120 120
 			// Set form html tags.
121 121
 			$form_html_tags = array(
122 122
 				'id'     => "give-form-{$form_id}",
123 123
 				'class'  => $form_classes,
124
-				'action' => esc_url_raw( $form_action ),
124
+				'action' => esc_url_raw($form_action),
125 125
 			);
126 126
 
127 127
 			/**
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
 			 * @param array            $form_html_tags Array of form html tags.
133 133
 			 * @param Give_Donate_Form $form           Form object.
134 134
 			 */
135
-			$form_html_tags = apply_filters( 'give_form_html_tags', (array) $form_html_tags, $form );
135
+			$form_html_tags = apply_filters('give_form_html_tags', (array) $form_html_tags, $form);
136 136
 			?>
137 137
 
138
-			<form <?php echo give_get_attribute_str( $form_html_tags ); ?> method="post">
138
+			<form <?php echo give_get_attribute_str($form_html_tags); ?> method="post">
139 139
 
140 140
 				<!-- The following field is for robots only, invisible to humans: -->
141 141
 				<span class="give-hidden" style="display: none !important;">
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 				 * @param array            $args    An array of form arguments.
156 156
 				 * @param Give_Donate_Form $form    Form object.
157 157
 				 */
158
-				do_action( 'give_donation_form_top', $form->ID, $args, $form );
158
+				do_action('give_donation_form_top', $form->ID, $args, $form);
159 159
 
160 160
 				/**
161 161
 				 * Fires while outputting donation form, for payment gateway fields.
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 				 * @param array            $args    An array of form arguments.
167 167
 				 * @param Give_Donate_Form $form    Form object.
168 168
 				 */
169
-				do_action( 'give_payment_mode_select', $form->ID, $args, $form );
169
+				do_action('give_payment_mode_select', $form->ID, $args, $form);
170 170
 
171 171
 				/**
172 172
 				 * Fires while outputting donation form, after all other fields.
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 				 * @param array            $args    An array of form arguments.
178 178
 				 * @param Give_Donate_Form $form    Form object.
179 179
 				 */
180
-				do_action( 'give_donation_form_bottom', $form->ID, $args, $form );
180
+				do_action('give_donation_form_bottom', $form->ID, $args, $form);
181 181
 
182 182
 				?>
183 183
 			</form>
@@ -192,12 +192,12 @@  discard block
 block discarded – undo
192 192
 			 * @param array            $args    An array of form arguments.
193 193
 			 * @param Give_Donate_Form $form    Form object.
194 194
 			 */
195
-			do_action( 'give_post_form', $form->ID, $args, $form );
195
+			do_action('give_post_form', $form->ID, $args, $form);
196 196
 
197 197
 		}
198 198
 		?>
199 199
 
200
-	</div><!--end #give-form-<?php echo absint( $form->ID ); ?>-->
200
+	</div><!--end #give-form-<?php echo absint($form->ID); ?>-->
201 201
 	<?php
202 202
 
203 203
 	/**
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
 	 * @param int   $form_id The form ID.
209 209
 	 * @param array $args    An array of form arguments.
210 210
 	 */
211
-	do_action( 'give_post_form_output', $form->ID, $args );
211
+	do_action('give_post_form_output', $form->ID, $args);
212 212
 
213 213
 	$final_output = ob_get_clean();
214 214
 
215
-	echo apply_filters( 'give_donate_form', $final_output, $args );
215
+	echo apply_filters('give_donate_form', $final_output, $args);
216 216
 }
217 217
 
218 218
 /**
@@ -229,11 +229,11 @@  discard block
 block discarded – undo
229 229
  *
230 230
  * @return string
231 231
  */
232
-function give_show_purchase_form( $form_id ) {
232
+function give_show_purchase_form($form_id) {
233 233
 
234
-	$payment_mode = give_get_chosen_gateway( $form_id );
234
+	$payment_mode = give_get_chosen_gateway($form_id);
235 235
 
236
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
236
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
237 237
 		$form_id = $_POST['give_form_id'];
238 238
 	}
239 239
 
@@ -242,33 +242,33 @@  discard block
 block discarded – undo
242 242
 	 *
243 243
 	 * @since 1.7
244 244
 	 */
245
-	do_action( 'give_payment_fields_top', $form_id );
245
+	do_action('give_payment_fields_top', $form_id);
246 246
 
247
-	if ( give_can_checkout() && isset( $form_id ) ) {
247
+	if (give_can_checkout() && isset($form_id)) {
248 248
 
249 249
 		/**
250 250
 		 * Fires while displaying donation form, before registration login.
251 251
 		 *
252 252
 		 * @since 1.7
253 253
 		 */
254
-		do_action( 'give_donation_form_before_register_login', $form_id );
254
+		do_action('give_donation_form_before_register_login', $form_id);
255 255
 
256 256
 		/**
257 257
 		 * Fire when register/login form fields render.
258 258
 		 *
259 259
 		 * @since 1.7
260 260
 		 */
261
-		do_action( 'give_donation_form_register_login_fields', $form_id );
261
+		do_action('give_donation_form_register_login_fields', $form_id);
262 262
 
263 263
 		/**
264 264
 		 * Fire when credit card form fields render.
265 265
 		 *
266 266
 		 * @since 1.7
267 267
 		 */
268
-		do_action( 'give_donation_form_before_cc_form', $form_id );
268
+		do_action('give_donation_form_before_cc_form', $form_id);
269 269
 
270 270
 		// Load the credit card form and allow gateways to load their own if they wish.
271
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
271
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
272 272
 			/**
273 273
 			 * Fires while displaying donation form, credit card form fields for a given gateway.
274 274
 			 *
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 			 *
277 277
 			 * @param int $form_id The form ID.
278 278
 			 */
279
-			do_action( "give_{$payment_mode}_cc_form", $form_id );
279
+			do_action("give_{$payment_mode}_cc_form", $form_id);
280 280
 		} else {
281 281
 			/**
282 282
 			 * Fires while displaying donation form, credit card form fields.
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 			 *
286 286
 			 * @param int $form_id The form ID.
287 287
 			 */
288
-			do_action( 'give_cc_form', $form_id );
288
+			do_action('give_cc_form', $form_id);
289 289
 		}
290 290
 
291 291
 		/**
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 		 *
294 294
 		 * @since 1.7
295 295
 		 */
296
-		do_action( 'give_donation_form_after_cc_form', $form_id );
296
+		do_action('give_donation_form_after_cc_form', $form_id);
297 297
 
298 298
 	} else {
299 299
 		/**
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 		 *
302 302
 		 * @since 1.7
303 303
 		 */
304
-		do_action( 'give_donation_form_no_access', $form_id );
304
+		do_action('give_donation_form_no_access', $form_id);
305 305
 
306 306
 	}
307 307
 
@@ -310,10 +310,10 @@  discard block
 block discarded – undo
310 310
 	 *
311 311
 	 * @since 1.7
312 312
 	 */
313
-	do_action( 'give_payment_fields_bottom', $form_id );
313
+	do_action('give_payment_fields_bottom', $form_id);
314 314
 }
315 315
 
316
-add_action( 'give_donation_form', 'give_show_purchase_form' );
316
+add_action('give_donation_form', 'give_show_purchase_form');
317 317
 
318 318
 /**
319 319
  * Give Show Login/Register Form Fields.
@@ -324,11 +324,11 @@  discard block
 block discarded – undo
324 324
  *
325 325
  * @return void
326 326
  */
327
-function give_show_register_login_fields( $form_id ) {
327
+function give_show_register_login_fields($form_id) {
328 328
 
329
-	$show_register_form = give_show_login_register_option( $form_id );
329
+	$show_register_form = give_show_login_register_option($form_id);
330 330
 
331
-	if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
331
+	if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) :
332 332
 		?>
333 333
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
334 334
 			<?php
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
 			 *
338 338
 			 * @since 1.7
339 339
 			 */
340
-			do_action( 'give_donation_form_register_fields', $form_id );
340
+			do_action('give_donation_form_register_fields', $form_id);
341 341
 			?>
342 342
 		</div>
343 343
 		<?php
344
-	elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
344
+	elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) :
345 345
 		?>
346 346
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
347 347
 			<?php
@@ -350,23 +350,23 @@  discard block
 block discarded – undo
350 350
 			 *
351 351
 			 * @since 1.7
352 352
 			 */
353
-			do_action( 'give_donation_form_login_fields', $form_id );
353
+			do_action('give_donation_form_login_fields', $form_id);
354 354
 			?>
355 355
 		</div>
356 356
 		<?php
357 357
 	endif;
358 358
 
359
-	if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) {
359
+	if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) {
360 360
 		/**
361 361
 		 * Fire when user info render.
362 362
 		 *
363 363
 		 * @since 1.7
364 364
 		 */
365
-		do_action( 'give_donation_form_after_user_info', $form_id );
365
+		do_action('give_donation_form_after_user_info', $form_id);
366 366
 	}
367 367
 }
368 368
 
369
-add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' );
369
+add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields');
370 370
 
371 371
 /**
372 372
  * Donation Amount Field.
@@ -381,16 +381,16 @@  discard block
 block discarded – undo
381 381
  *
382 382
  * @return void
383 383
  */
384
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
384
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
385 385
 
386 386
 	$give_options        = give_get_settings();
387
-	$variable_pricing    = give_has_variable_prices( $form_id );
388
-	$allow_custom_amount = give_get_meta( $form_id, '_give_custom_amount', true );
389
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
390
-	$symbol              = give_currency_symbol( give_get_currency( $form_id, $args ) );
391
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
392
-	$default_amount      = give_format_amount( give_get_default_form_amount( $form_id ), array( 'sanitize' => false, 'currency' => give_get_currency( $form_id ) ) );
393
-	$custom_amount_text  = give_get_meta( $form_id, '_give_custom_amount_text', true );
387
+	$variable_pricing    = give_has_variable_prices($form_id);
388
+	$allow_custom_amount = give_get_meta($form_id, '_give_custom_amount', true);
389
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
390
+	$symbol              = give_currency_symbol(give_get_currency($form_id, $args));
391
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
392
+	$default_amount      = give_format_amount(give_get_default_form_amount($form_id), array('sanitize' => false, 'currency' => give_get_currency($form_id)));
393
+	$custom_amount_text  = give_get_meta($form_id, '_give_custom_amount_text', true);
394 394
 
395 395
 	/**
396 396
 	 * Fires while displaying donation form, before donation level fields.
@@ -400,20 +400,20 @@  discard block
 block discarded – undo
400 400
 	 * @param int   $form_id The form ID.
401 401
 	 * @param array $args    An array of form arguments.
402 402
 	 */
403
-	do_action( 'give_before_donation_levels', $form_id, $args );
403
+	do_action('give_before_donation_levels', $form_id, $args);
404 404
 
405 405
 	//Set Price, No Custom Amount Allowed means hidden price field
406
-	if ( ! give_is_setting_enabled( $allow_custom_amount ) ) {
406
+	if ( ! give_is_setting_enabled($allow_custom_amount)) {
407 407
 		?>
408
-		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
408
+		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
409 409
 		<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount"
410 410
 			   value="<?php echo $default_amount; ?>" required aria-required="true"/>
411 411
 		<div class="set-price give-donation-amount form-row-wide">
412
-			<?php if ( $currency_position == 'before' ) {
412
+			<?php if ($currency_position == 'before') {
413 413
 				echo $currency_output;
414 414
 			} ?>
415 415
 			<span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span>
416
-			<?php if ( $currency_position == 'after' ) {
416
+			<?php if ($currency_position == 'after') {
417 417
 				echo $currency_output;
418 418
 			} ?>
419 419
 		</div>
@@ -423,13 +423,13 @@  discard block
 block discarded – undo
423 423
 		?>
424 424
 		<div class="give-total-wrap">
425 425
 			<div class="give-donation-amount form-row-wide">
426
-				<?php if ( $currency_position == 'before' ) {
426
+				<?php if ($currency_position == 'before') {
427 427
 					echo $currency_output;
428 428
 				} ?>
429
-				<label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
429
+				<label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
430 430
 				<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel"
431 431
 					   placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
432
-				<?php if ( $currency_position == 'after' ) {
432
+				<?php if ($currency_position == 'after') {
433 433
 					echo $currency_output;
434 434
 				} ?>
435 435
 			</div>
@@ -444,16 +444,16 @@  discard block
 block discarded – undo
444 444
 	 * @param int   $form_id The form ID.
445 445
 	 * @param array $args    An array of form arguments.
446 446
 	 */
447
-	do_action( 'give_after_donation_amount', $form_id, $args );
447
+	do_action('give_after_donation_amount', $form_id, $args);
448 448
 
449 449
 	//Custom Amount Text
450
-	if ( ! $variable_pricing && give_is_setting_enabled( $allow_custom_amount ) && ! empty( $custom_amount_text ) ) { ?>
450
+	if ( ! $variable_pricing && give_is_setting_enabled($allow_custom_amount) && ! empty($custom_amount_text)) { ?>
451 451
 		<p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
452 452
 	<?php }
453 453
 
454 454
 	//Output Variable Pricing Levels.
455
-	if ( $variable_pricing ) {
456
-		give_output_levels( $form_id );
455
+	if ($variable_pricing) {
456
+		give_output_levels($form_id);
457 457
 	}
458 458
 
459 459
 	/**
@@ -464,10 +464,10 @@  discard block
 block discarded – undo
464 464
 	 * @param int   $form_id The form ID.
465 465
 	 * @param array $args    An array of form arguments.
466 466
 	 */
467
-	do_action( 'give_after_donation_levels', $form_id, $args );
467
+	do_action('give_after_donation_levels', $form_id, $args);
468 468
 }
469 469
 
470
-add_action( 'give_donation_form_top', 'give_output_donation_amount_top', 10, 2 );
470
+add_action('give_donation_form_top', 'give_output_donation_amount_top', 10, 2);
471 471
 
472 472
 /**
473 473
  * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons.
@@ -478,30 +478,30 @@  discard block
 block discarded – undo
478 478
  *
479 479
  * @return string Donation levels.
480 480
  */
481
-function give_output_levels( $form_id ) {
481
+function give_output_levels($form_id) {
482 482
 
483 483
 	//Get variable pricing.
484
-	$prices             = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
485
-	$display_style      = give_get_meta( $form_id, '_give_display_style', true );
486
-	$custom_amount      = give_get_meta( $form_id, '_give_custom_amount', true );
487
-	$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
488
-	if ( empty( $custom_amount_text ) ) {
489
-		$custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' );
484
+	$prices             = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
485
+	$display_style      = give_get_meta($form_id, '_give_display_style', true);
486
+	$custom_amount      = give_get_meta($form_id, '_give_custom_amount', true);
487
+	$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
488
+	if (empty($custom_amount_text)) {
489
+		$custom_amount_text = esc_html__('Give a Custom Amount', 'give');
490 490
 	}
491 491
 
492 492
 	$output = '';
493 493
 
494
-	switch ( $display_style ) {
494
+	switch ($display_style) {
495 495
 		case 'buttons':
496 496
 
497 497
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
498 498
 
499
-			foreach ( $prices as $price ) {
500
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ), $form_id, $price );
501
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $price['_give_id']['level_id'] . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price );
499
+			foreach ($prices as $price) {
500
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))), $form_id, $price);
501
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$price['_give_id']['level_id'].' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price);
502 502
 
503 503
 				$output .= '<li>';
504
-				$output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) . '">';
504
+				$output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount'], array('sanitize' => false)).'">';
505 505
 				$output .= $level_text;
506 506
 				$output .= '</button>';
507 507
 				$output .= '</li>';
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 			}
510 510
 
511 511
 			//Custom Amount.
512
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
512
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
513 513
 				$output .= '<li>';
514 514
 				$output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">';
515 515
 				$output .= $custom_amount_text;
@@ -525,22 +525,22 @@  discard block
 block discarded – undo
525 525
 
526 526
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
527 527
 
528
-			foreach ( $prices as $price ) {
529
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ), $form_id, $price );
530
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
528
+			foreach ($prices as $price) {
529
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))), $form_id, $price);
530
+				$level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
531 531
 
532 532
 				$output .= '<li>';
533
-				$output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $price['_give_id']['level_id'] . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) . '">';
534
-				$output .= '<label for="give-radio-level-' . $price['_give_id']['level_id'] . '">' . $level_text . '</label>';
533
+				$output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$price['_give_id']['level_id'].'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount'], array('sanitize' => false)).'">';
534
+				$output .= '<label for="give-radio-level-'.$price['_give_id']['level_id'].'">'.$level_text.'</label>';
535 535
 				$output .= '</li>';
536 536
 
537 537
 			}
538 538
 
539 539
 			//Custom Amount.
540
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
540
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
541 541
 				$output .= '<li>';
542 542
 				$output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">';
543
-				$output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>';
543
+				$output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>';
544 544
 				$output .= '</li>';
545 545
 			}
546 546
 
@@ -550,23 +550,23 @@  discard block
 block discarded – undo
550 550
 
551 551
 		case 'dropdown':
552 552
 
553
-			$output .= '<label for="give-donation-level-select-' . $form_id . '" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>';
554
-			$output .= '<select id="give-donation-level-select-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">';
553
+			$output .= '<label for="give-donation-level-select-'.$form_id.'" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>';
554
+			$output .= '<select id="give-donation-level-select-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">';
555 555
 
556 556
 			//first loop through prices.
557
-			foreach ( $prices as $price ) {
558
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ), $form_id, $price );
559
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
557
+			foreach ($prices as $price) {
558
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))), $form_id, $price);
559
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
560 560
 
561
-				$output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) . '">';
561
+				$output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount'], array('sanitize' => false)).'">';
562 562
 				$output .= $level_text;
563 563
 				$output .= '</option>';
564 564
 
565 565
 			}
566 566
 
567 567
 			//Custom Amount.
568
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
569
-				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>';
568
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
569
+				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>';
570 570
 			}
571 571
 
572 572
 			$output .= '</select>';
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 			break;
575 575
 	}
576 576
 
577
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
577
+	echo apply_filters('give_form_level_output', $output, $form_id);
578 578
 }
579 579
 
580 580
 /**
@@ -589,27 +589,27 @@  discard block
 block discarded – undo
589 589
  *
590 590
  * @return string Checkout button.
591 591
  */
592
-function give_display_checkout_button( $form_id, $args ) {
592
+function give_display_checkout_button($form_id, $args) {
593 593
 
594
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
594
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
595 595
 		? $args['display_style']
596
-		: give_get_meta( $form_id, '_give_payment_display', true );
596
+		: give_get_meta($form_id, '_give_payment_display', true);
597 597
 
598
-	if ( 'button' === $display_option ) {
598
+	if ('button' === $display_option) {
599 599
 		$display_option = 'modal';
600
-	} elseif ( $display_option === 'onpage' ) {
600
+	} elseif ($display_option === 'onpage') {
601 601
 		return '';
602 602
 	}
603 603
 
604
-	$display_label_field = give_get_meta( $form_id, '_give_reveal_label', true );
605
-	$display_label       = ! empty( $args['continue_button_title'] ) ? $args['continue_button_title'] : ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
604
+	$display_label_field = give_get_meta($form_id, '_give_reveal_label', true);
605
+	$display_label       = ! empty($args['continue_button_title']) ? $args['continue_button_title'] : ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
606 606
 
607
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
607
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
608 608
 
609
-	echo apply_filters( 'give_display_checkout_button', $output );
609
+	echo apply_filters('give_display_checkout_button', $output);
610 610
 }
611 611
 
612
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
612
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
613 613
 
614 614
 /**
615 615
  * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided.
@@ -620,57 +620,57 @@  discard block
 block discarded – undo
620 620
  *
621 621
  * @return void
622 622
  */
623
-function give_user_info_fields( $form_id ) {
623
+function give_user_info_fields($form_id) {
624 624
 	// Get user info.
625
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
625
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
626 626
 
627 627
 	/**
628 628
 	 * Fire before user personal information fields
629 629
 	 *
630 630
 	 * @since 1.7
631 631
 	 */
632
-	do_action( 'give_donation_form_before_personal_info', $form_id );
632
+	do_action('give_donation_form_before_personal_info', $form_id);
633 633
 	?>
634 634
 	<fieldset id="give_checkout_user_info">
635
-		<legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend>
635
+		<legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend>
636 636
 		<p id="give-first-name-wrap" class="form-row form-row-first form-row-responsive">
637 637
 			<label class="give-label" for="give-first">
638
-				<?php esc_html_e( 'First Name', 'give' ); ?>
639
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?>
638
+				<?php esc_html_e('First Name', 'give'); ?>
639
+				<?php if (give_field_is_required('give_first', $form_id)) : ?>
640 640
 					<span class="give-required-indicator">*</span>
641 641
 				<?php endif ?>
642 642
 				<span class="give-tooltip give-icon give-icon-question"
643
-					  data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span>
643
+					  data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span>
644 644
 			</label>
645 645
 			<input
646 646
 					class="give-input required"
647 647
 					type="text"
648 648
 					name="give_first"
649
-					placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>"
649
+					placeholder="<?php esc_attr_e('First Name', 'give'); ?>"
650 650
 					id="give-first"
651
-					value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>"
652
-				<?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
651
+					value="<?php echo isset($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; ?>"
652
+				<?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?>
653 653
 			/>
654 654
 		</p>
655 655
 
656 656
 		<p id="give-last-name-wrap" class="form-row form-row-last form-row-responsive">
657 657
 			<label class="give-label" for="give-last">
658
-				<?php esc_html_e( 'Last Name', 'give' ); ?>
659
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?>
658
+				<?php esc_html_e('Last Name', 'give'); ?>
659
+				<?php if (give_field_is_required('give_last', $form_id)) : ?>
660 660
 					<span class="give-required-indicator">*</span>
661 661
 				<?php endif ?>
662 662
 				<span class="give-tooltip give-icon give-icon-question"
663
-					  data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span>
663
+					  data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span>
664 664
 			</label>
665 665
 
666 666
 			<input
667
-					class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>"
667
+					class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>"
668 668
 					type="text"
669 669
 					name="give_last"
670 670
 					id="give-last"
671
-					placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>"
672
-					value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>"
673
-				<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
671
+					placeholder="<?php esc_attr_e('Last Name', 'give'); ?>"
672
+					value="<?php echo isset($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; ?>"
673
+				<?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?>
674 674
 			/>
675 675
 		</p>
676 676
 
@@ -680,26 +680,26 @@  discard block
 block discarded – undo
680 680
 		 *
681 681
 		 * @since 1.7
682 682
 		 */
683
-		do_action( 'give_donation_form_before_email', $form_id );
683
+		do_action('give_donation_form_before_email', $form_id);
684 684
 		?>
685 685
 		<p id="give-email-wrap" class="form-row form-row-wide">
686 686
 			<label class="give-label" for="give-email">
687
-				<?php esc_html_e( 'Email Address', 'give' ); ?>
688
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
687
+				<?php esc_html_e('Email Address', 'give'); ?>
688
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
689 689
 					<span class="give-required-indicator">*</span>
690 690
 				<?php } ?>
691 691
 				<span class="give-tooltip give-icon give-icon-question"
692
-					  data-tooltip="<?php esc_attr_e( 'We will send the donation receipt to this address.', 'give' ); ?>"></span>
692
+					  data-tooltip="<?php esc_attr_e('We will send the donation receipt to this address.', 'give'); ?>"></span>
693 693
 			</label>
694 694
 
695 695
 			<input
696 696
 					class="give-input required"
697 697
 					type="email"
698 698
 					name="give_email"
699
-					placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>"
699
+					placeholder="<?php esc_attr_e('Email Address', 'give'); ?>"
700 700
 					id="give-email"
701
-					value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>"
702
-				<?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
701
+					value="<?php echo isset($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; ?>"
702
+				<?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?>
703 703
 			/>
704 704
 
705 705
 		</p>
@@ -709,14 +709,14 @@  discard block
 block discarded – undo
709 709
 		 *
710 710
 		 * @since 1.7
711 711
 		 */
712
-		do_action( 'give_donation_form_after_email', $form_id );
712
+		do_action('give_donation_form_after_email', $form_id);
713 713
 
714 714
 		/**
715 715
 		 * Fire after personal email field
716 716
 		 *
717 717
 		 * @since 1.7
718 718
 		 */
719
-		do_action( 'give_donation_form_user_info', $form_id );
719
+		do_action('give_donation_form_user_info', $form_id);
720 720
 		?>
721 721
 	</fieldset>
722 722
 	<?php
@@ -725,11 +725,11 @@  discard block
 block discarded – undo
725 725
 	 *
726 726
 	 * @since 1.7
727 727
 	 */
728
-	do_action( 'give_donation_form_after_personal_info', $form_id );
728
+	do_action('give_donation_form_after_personal_info', $form_id);
729 729
 }
730 730
 
731
-add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' );
732
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
731
+add_action('give_donation_form_after_user_info', 'give_user_info_fields');
732
+add_action('give_register_fields_before', 'give_user_info_fields');
733 733
 
734 734
 /**
735 735
  * Renders the credit card info form.
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
  *
741 741
  * @return void
742 742
  */
743
-function give_get_cc_form( $form_id ) {
743
+function give_get_cc_form($form_id) {
744 744
 
745 745
 	ob_start();
746 746
 
@@ -751,53 +751,53 @@  discard block
 block discarded – undo
751 751
 	 *
752 752
 	 * @param int $form_id The form ID.
753 753
 	 */
754
-	do_action( 'give_before_cc_fields', $form_id );
754
+	do_action('give_before_cc_fields', $form_id);
755 755
 	?>
756 756
 	<fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate">
757
-		<legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend>
758
-		<?php if ( is_ssl() ) : ?>
757
+		<legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend>
758
+		<?php if (is_ssl()) : ?>
759 759
 			<div id="give_secure_site_wrapper-<?php echo $form_id ?>">
760 760
 				<span class="give-icon padlock"></span>
761
-				<span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
761
+				<span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span>
762 762
 			</div>
763 763
 		<?php endif; ?>
764 764
 		<p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive">
765 765
 			<label for="card_number-<?php echo $form_id ?>" class="give-label">
766
-				<?php esc_html_e( 'Card Number', 'give' ); ?>
766
+				<?php esc_html_e('Card Number', 'give'); ?>
767 767
 				<span class="give-required-indicator">*</span>
768 768
 				<span class="give-tooltip give-icon give-icon-question"
769
-					  data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span>
769
+					  data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span>
770 770
 				<span class="card-type"></span>
771 771
 			</label>
772 772
 
773 773
 			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>"
774
-				   class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>"
774
+				   class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>"
775 775
 				   required aria-required="true"/>
776 776
 		</p>
777 777
 
778 778
 		<p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third form-row-responsive">
779 779
 			<label for="card_cvc-<?php echo $form_id ?>" class="give-label">
780
-				<?php esc_html_e( 'CVC', 'give' ); ?>
780
+				<?php esc_html_e('CVC', 'give'); ?>
781 781
 				<span class="give-required-indicator">*</span>
782 782
 				<span class="give-tooltip give-icon give-icon-question"
783
-					  data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span>
783
+					  data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span>
784 784
 			</label>
785 785
 
786 786
 			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>"
787
-				   class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>"
787
+				   class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>"
788 788
 				   required aria-required="true"/>
789 789
 		</p>
790 790
 
791 791
 		<p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive">
792 792
 			<label for="card_name-<?php echo $form_id ?>" class="give-label">
793
-				<?php esc_html_e( 'Name on the Card', 'give' ); ?>
793
+				<?php esc_html_e('Name on the Card', 'give'); ?>
794 794
 				<span class="give-required-indicator">*</span>
795 795
 				<span class="give-tooltip give-icon give-icon-question"
796
-					  data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span>
796
+					  data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span>
797 797
 			</label>
798 798
 
799 799
 			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>"
800
-				   class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>"
800
+				   class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>"
801 801
 				   required aria-required="true"/>
802 802
 		</p>
803 803
 		<?php
@@ -808,14 +808,14 @@  discard block
 block discarded – undo
808 808
 		 *
809 809
 		 * @param int $form_id The form ID.
810 810
 		 */
811
-		do_action( 'give_before_cc_expiration' );
811
+		do_action('give_before_cc_expiration');
812 812
 		?>
813 813
 		<p class="card-expiration form-row form-row-one-third form-row-responsive">
814 814
 			<label for="card_expiry-<?php echo $form_id ?>" class="give-label">
815
-				<?php esc_html_e( 'Expiration', 'give' ); ?>
815
+				<?php esc_html_e('Expiration', 'give'); ?>
816 816
 				<span class="give-required-indicator">*</span>
817 817
 				<span class="give-tooltip give-icon give-icon-question"
818
-					  data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span>
818
+					  data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span>
819 819
 			</label>
820 820
 
821 821
 			<input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month"
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
 				   class="card-expiry-year"/>
825 825
 
826 826
 			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>"
827
-				   class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>"
827
+				   class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>"
828 828
 				   required aria-required="true"/>
829 829
 		</p>
830 830
 		<?php
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
 		 *
836 836
 		 * @param int $form_id The form ID.
837 837
 		 */
838
-		do_action( 'give_after_cc_expiration', $form_id );
838
+		do_action('give_after_cc_expiration', $form_id);
839 839
 		?>
840 840
 	</fieldset>
841 841
 	<?php
@@ -846,12 +846,12 @@  discard block
 block discarded – undo
846 846
 	 *
847 847
 	 * @param int $form_id The form ID.
848 848
 	 */
849
-	do_action( 'give_after_cc_fields', $form_id );
849
+	do_action('give_after_cc_fields', $form_id);
850 850
 
851 851
 	echo ob_get_clean();
852 852
 }
853 853
 
854
-add_action( 'give_cc_form', 'give_get_cc_form' );
854
+add_action('give_cc_form', 'give_get_cc_form');
855 855
 
856 856
 /**
857 857
  * Outputs the default credit card address fields.
@@ -862,24 +862,24 @@  discard block
 block discarded – undo
862 862
  *
863 863
  * @return void
864 864
  */
865
-function give_default_cc_address_fields( $form_id ) {
865
+function give_default_cc_address_fields($form_id) {
866 866
 	// Get user info.
867
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
867
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
868 868
 
869 869
 	$logged_in = is_user_logged_in();
870 870
 
871
-	if ( $logged_in ) {
872
-		$user_address = get_user_meta( get_current_user_id(), '_give_user_address', true );
871
+	if ($logged_in) {
872
+		$user_address = get_user_meta(get_current_user_id(), '_give_user_address', true);
873 873
 	}
874
-	$line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : '';
875
-	$line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : '';
876
-	$city  = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : '';
877
-	$zip   = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : '';
874
+	$line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : '';
875
+	$line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : '';
876
+	$city  = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : '';
877
+	$zip   = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : '';
878 878
 
879 879
 	ob_start();
880 880
 	?>
881 881
 	<fieldset id="give_cc_address" class="cc-address">
882
-		<legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend>
882
+		<legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend>
883 883
 		<?php
884 884
 		/**
885 885
 		 * Fires while rendering credit card billing form, before address fields.
@@ -888,36 +888,36 @@  discard block
 block discarded – undo
888 888
 		 *
889 889
 		 * @param int $form_id The form ID.
890 890
 		 */
891
-		do_action( 'give_cc_billing_top' );
891
+		do_action('give_cc_billing_top');
892 892
 
893 893
 		// For Country.
894 894
 		$selected_country = give_get_country();
895
-		if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) {
895
+		if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) {
896 896
 			$selected_country = $give_user_info['billing_country'];
897 897
 		}
898 898
 		$countries = give_get_country_list();
899 899
 
900 900
 		// For state
901 901
 		$selected_state = '';
902
-		if ( $selected_country === give_get_country() ) {
902
+		if ($selected_country === give_get_country()) {
903 903
 			// Get defalut selected state by admin.
904 904
 			$selected_state = give_get_state();
905 905
 		}
906 906
 		// Get the last payment made by user states.
907
-		if ( ! empty( $give_user_info['card_state'] ) && '*' !== $give_user_info['card_state'] ) {
907
+		if ( ! empty($give_user_info['card_state']) && '*' !== $give_user_info['card_state']) {
908 908
 			$selected_state = $give_user_info['card_state'];
909 909
 		}
910 910
 		// Get the country code
911
-		if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) {
911
+		if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) {
912 912
 			$selected_country = $give_user_info['billing_country'];
913 913
 		}
914
-		$label        = __( 'State', 'give' );
914
+		$label        = __('State', 'give');
915 915
 		$states_label = give_get_states_label();
916 916
 		// Check if $country code exists in the array key for states label.
917
-		if ( array_key_exists( $selected_country, $states_label ) ) {
918
-			$label = $states_label[ $selected_country ];
917
+		if (array_key_exists($selected_country, $states_label)) {
918
+			$label = $states_label[$selected_country];
919 919
 		}
920
-		$states = give_get_states( $selected_country );
920
+		$states = give_get_states($selected_country);
921 921
 		// Get the country list that do not have any states init.
922 922
 		$no_states_country = give_no_states_country_list();
923 923
 		// Get the country list that does not require states.
@@ -926,23 +926,23 @@  discard block
 block discarded – undo
926 926
 		?>
927 927
 	    <p id="give-card-country-wrap" class="form-row form-row-wide">
928 928
 		    <label for="billing_country" class="give-label">
929
-			    <?php esc_html_e( 'Country', 'give' ); ?>
930
-			    <?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?>
929
+			    <?php esc_html_e('Country', 'give'); ?>
930
+			    <?php if (give_field_is_required('billing_country', $form_id)) : ?>
931 931
 				    <span class="give-required-indicator">*</span>
932 932
 			    <?php endif; ?>
933 933
 			    <span class="give-tooltip give-icon give-icon-question"
934
-			          data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span>
934
+			          data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span>
935 935
 		    </label>
936 936
 
937 937
 		    <select
938 938
 				    name="billing_country"
939 939
 				    id="billing_country"
940
-				    class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>"
941
-			    <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
940
+				    class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>"
941
+			    <?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?>
942 942
 		    >
943 943
 			    <?php
944
-			    foreach ( $countries as $country_code => $country ) {
945
-				    echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
944
+			    foreach ($countries as $country_code => $country) {
945
+				    echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
946 946
 			    }
947 947
 			    ?>
948 948
 		    </select>
@@ -950,89 +950,89 @@  discard block
 block discarded – undo
950 950
 
951 951
 	    <p id="give-card-address-wrap" class="form-row form-row-wide">
952 952
 		    <label for="card_address" class="give-label">
953
-			    <?php esc_html_e( 'Address 1', 'give' ); ?>
953
+			    <?php esc_html_e('Address 1', 'give'); ?>
954 954
 			    <?php
955
-			    if ( give_field_is_required( 'card_address', $form_id ) ) : ?>
955
+			    if (give_field_is_required('card_address', $form_id)) : ?>
956 956
 				    <span class="give-required-indicator">*</span>
957 957
 			    <?php endif; ?>
958 958
 			    <span class="give-tooltip give-icon give-icon-question"
959
-			          data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span>
959
+			          data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span>
960 960
 		    </label>
961 961
 
962 962
 		    <input
963 963
 				    type="text"
964 964
 				    id="card_address"
965 965
 				    name="card_address"
966
-				    class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>"
967
-				    placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>"
968
-				    value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>"
969
-			    <?php echo( give_field_is_required( 'card_address', $form_id ) ? '  required aria-required="true" ' : '' ); ?>
966
+				    class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>"
967
+				    placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>"
968
+				    value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>"
969
+			    <?php echo(give_field_is_required('card_address', $form_id) ? '  required aria-required="true" ' : ''); ?>
970 970
 		    />
971 971
 	    </p>
972 972
 
973 973
 	    <p id="give-card-address-2-wrap" class="form-row form-row-wide">
974 974
 		    <label for="card_address_2" class="give-label">
975
-			    <?php esc_html_e( 'Address 2', 'give' ); ?>
976
-			    <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?>
975
+			    <?php esc_html_e('Address 2', 'give'); ?>
976
+			    <?php if (give_field_is_required('card_address_2', $form_id)) : ?>
977 977
 				    <span class="give-required-indicator">*</span>
978 978
 			    <?php endif; ?>
979 979
 			    <span class="give-tooltip give-icon give-icon-question"
980
-			          data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span>
980
+			          data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span>
981 981
 		    </label>
982 982
 
983 983
 		    <input
984 984
 				    type="text"
985 985
 				    id="card_address_2"
986 986
 				    name="card_address_2"
987
-				    class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>"
988
-				    placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>"
989
-				    value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>"
990
-			    <?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
987
+				    class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>"
988
+				    placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>"
989
+				    value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>"
990
+			    <?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?>
991 991
 		    />
992 992
 	    </p>
993 993
 
994 994
 	    <p id="give-card-city-wrap" class="form-row form-row-wide">
995 995
 		    <label for="card_city" class="give-label">
996
-			    <?php esc_html_e( 'City', 'give' ); ?>
997
-			    <?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?>
996
+			    <?php esc_html_e('City', 'give'); ?>
997
+			    <?php if (give_field_is_required('card_city', $form_id)) : ?>
998 998
 				    <span class="give-required-indicator">*</span>
999 999
 			    <?php endif; ?>
1000 1000
 			    <span class="give-tooltip give-icon give-icon-question"
1001
-			          data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span>
1001
+			          data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span>
1002 1002
 		    </label>
1003 1003
 		    <input
1004 1004
 				    type="text"
1005 1005
 				    id="card_city"
1006 1006
 				    name="card_city"
1007
-				    class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>"
1008
-				    placeholder="<?php esc_attr_e( 'City', 'give' ); ?>"
1009
-				    value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>"
1010
-			    <?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
1007
+				    class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>"
1008
+				    placeholder="<?php esc_attr_e('City', 'give'); ?>"
1009
+				    value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>"
1010
+			    <?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?>
1011 1011
 		    />
1012 1012
 	    </p>
1013 1013
 
1014 1014
 	    <p id="give-card-state-wrap"
1015
-	       class="form-row form-row-first form-row-responsive <?php echo ( ! empty( $selected_country ) && array_key_exists( $selected_country, $no_states_country ) ) ? 'give-hidden' : ''; ?>">
1015
+	       class="form-row form-row-first form-row-responsive <?php echo ( ! empty($selected_country) && array_key_exists($selected_country, $no_states_country)) ? 'give-hidden' : ''; ?>">
1016 1016
 		    <label for="card_state" class="give-label">
1017 1017
 			    <span class="state-label-text"><?php echo $label; ?></span>
1018
-			    <?php if ( give_field_is_required( 'card_state', $form_id ) ) :
1018
+			    <?php if (give_field_is_required('card_state', $form_id)) :
1019 1019
 				    ?>
1020
-				    <span class="give-required-indicator <?php echo( array_key_exists( $selected_country, $states_not_required_country_list ) ? 'give-hidden' : '' ) ?> ">*</span>
1020
+				    <span class="give-required-indicator <?php echo(array_key_exists($selected_country, $states_not_required_country_list) ? 'give-hidden' : '') ?> ">*</span>
1021 1021
 			    <?php endif; ?>
1022 1022
 			    <span class="give-tooltip give-icon give-icon-question"
1023
-			          data-tooltip="<?php esc_attr_e( 'The state, province, or county for your billing address.', 'give' ); ?>"></span>
1023
+			          data-tooltip="<?php esc_attr_e('The state, province, or county for your billing address.', 'give'); ?>"></span>
1024 1024
 		    </label>
1025 1025
 		    <?php
1026 1026
 
1027
-		    if ( ! empty( $states ) ) : ?>
1027
+		    if ( ! empty($states)) : ?>
1028 1028
 			    <select
1029 1029
 				    name="card_state"
1030 1030
 				    id="card_state"
1031
-				    class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>"
1032
-				    <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>>
1031
+				    class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>"
1032
+				    <?php echo(give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : ''); ?>>
1033 1033
 				    <?php
1034
-				    foreach ( $states as $state_code => $state ) {
1035
-					    echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
1034
+				    foreach ($states as $state_code => $state) {
1035
+					    echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
1036 1036
 				    }
1037 1037
 				    ?>
1038 1038
 			    </select>
@@ -1042,14 +1042,14 @@  discard block
 block discarded – undo
1042 1042
 		    <?php endif; ?>
1043 1043
 	    </p>
1044 1044
 
1045
-	    <p id="give-card-zip-wrap" class="form-row <?php echo ( ! empty( $selected_country ) && array_key_exists( $selected_country, $no_states_country ) ) ? 'form-row-wide' : 'form-row-last'; ?> form-row-responsive">
1045
+	    <p id="give-card-zip-wrap" class="form-row <?php echo ( ! empty($selected_country) && array_key_exists($selected_country, $no_states_country)) ? 'form-row-wide' : 'form-row-last'; ?> form-row-responsive">
1046 1046
 		    <label for="card_zip" class="give-label">
1047
-			    <?php esc_html_e( 'Zip / Postal Code', 'give' ); ?>
1048
-			    <?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?>
1047
+			    <?php esc_html_e('Zip / Postal Code', 'give'); ?>
1048
+			    <?php if (give_field_is_required('card_zip', $form_id)) : ?>
1049 1049
 				    <span class="give-required-indicator">*</span>
1050 1050
 			    <?php endif; ?>
1051 1051
 			    <span class="give-tooltip give-icon give-icon-question"
1052
-			          data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span>
1052
+			          data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span>
1053 1053
 		    </label>
1054 1054
 
1055 1055
 		    <input
@@ -1057,10 +1057,10 @@  discard block
 block discarded – undo
1057 1057
 				    size="4"
1058 1058
 				    id="card_zip"
1059 1059
 				    name="card_zip"
1060
-				    class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>"
1061
-				    placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>"
1062
-				    value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>"
1063
-			    <?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
1060
+				    class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>"
1061
+				    placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>"
1062
+				    value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>"
1063
+			    <?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?>
1064 1064
 		    />
1065 1065
 	    </p>
1066 1066
 
@@ -1072,14 +1072,14 @@  discard block
 block discarded – undo
1072 1072
 		 *
1073 1073
 		 * @param int $form_id The form ID.
1074 1074
 		 */
1075
-		do_action( 'give_cc_billing_bottom' );
1075
+		do_action('give_cc_billing_bottom');
1076 1076
 		?>
1077 1077
 	</fieldset>
1078 1078
 	<?php
1079 1079
 	echo ob_get_clean();
1080 1080
 }
1081 1081
 
1082
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
1082
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
1083 1083
 
1084 1084
 
1085 1085
 /**
@@ -1092,24 +1092,24 @@  discard block
 block discarded – undo
1092 1092
  *
1093 1093
  * @return string
1094 1094
  */
1095
-function give_get_register_fields( $form_id ) {
1095
+function give_get_register_fields($form_id) {
1096 1096
 
1097 1097
 	global $user_ID;
1098 1098
 
1099
-	if ( is_user_logged_in() ) {
1100
-		$user_data = get_userdata( $user_ID );
1099
+	if (is_user_logged_in()) {
1100
+		$user_data = get_userdata($user_ID);
1101 1101
 	}
1102 1102
 
1103
-	$show_register_form = give_show_login_register_option( $form_id );
1103
+	$show_register_form = give_show_login_register_option($form_id);
1104 1104
 
1105 1105
 	ob_start(); ?>
1106 1106
 	<fieldset id="give-register-fields-<?php echo $form_id; ?>">
1107 1107
 
1108
-		<?php if ( $show_register_form == 'both' ) { ?>
1108
+		<?php if ($show_register_form == 'both') { ?>
1109 1109
 			<div class="give-login-account-wrap">
1110
-				<p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?>&nbsp;
1111
-					<a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login"
1112
-					   data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a>
1110
+				<p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?>&nbsp;
1111
+					<a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login"
1112
+					   data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a>
1113 1113
 				</p>
1114 1114
 				<p class="give-loading-text">
1115 1115
 					<span class="give-loading-animation"></span>
@@ -1125,15 +1125,15 @@  discard block
 block discarded – undo
1125 1125
 		 *
1126 1126
 		 * @param int $form_id The form ID.
1127 1127
 		 */
1128
-		do_action( 'give_register_fields_before', $form_id );
1128
+		do_action('give_register_fields_before', $form_id);
1129 1129
 		?>
1130 1130
 
1131 1131
 		<fieldset id="give-register-account-fields-<?php echo $form_id; ?>">
1132 1132
 			<legend>
1133 1133
 				<?php
1134
-				echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) );
1135
-				if ( ! give_logged_in_only( $form_id ) ) {
1136
-					echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>';
1134
+				echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give'));
1135
+				if ( ! give_logged_in_only($form_id)) {
1136
+					echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>';
1137 1137
 				}
1138 1138
 				?>
1139 1139
 			</legend>
@@ -1145,54 +1145,54 @@  discard block
 block discarded – undo
1145 1145
 			 *
1146 1146
 			 * @param int $form_id The form ID.
1147 1147
 			 */
1148
-			do_action( 'give_register_account_fields_before', $form_id );
1148
+			do_action('give_register_account_fields_before', $form_id);
1149 1149
 			?>
1150 1150
 			<div id="give-user-login-wrap-<?php echo $form_id; ?>"
1151 1151
 				 class="form-row form-row-one-third form-row-first form-row-responsive">
1152 1152
 				<label for="give-user-login-<?php echo $form_id; ?>">
1153
-					<?php esc_html_e( 'Username', 'give' ); ?>
1154
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1153
+					<?php esc_html_e('Username', 'give'); ?>
1154
+					<?php if (give_logged_in_only($form_id)) { ?>
1155 1155
 						<span class="give-required-indicator">*</span>
1156 1156
 					<?php } ?>
1157 1157
 					<span class="give-tooltip give-icon give-icon-question"
1158
-						  data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span>
1158
+						  data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span>
1159 1159
 				</label>
1160 1160
 
1161 1161
 				<input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input"
1162 1162
 					   type="text"
1163
-					   placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1163
+					   placeholder="<?php esc_attr_e('Username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1164 1164
 			</div>
1165 1165
 
1166 1166
 			<div id="give-user-pass-wrap-<?php echo $form_id; ?>"
1167 1167
 				 class="form-row form-row-one-third form-row-responsive">
1168 1168
 				<label for="give-user-pass-<?php echo $form_id; ?>">
1169
-					<?php esc_html_e( 'Password', 'give' ); ?>
1170
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1169
+					<?php esc_html_e('Password', 'give'); ?>
1170
+					<?php if (give_logged_in_only($form_id)) { ?>
1171 1171
 						<span class="give-required-indicator">*</span>
1172 1172
 					<?php } ?>
1173 1173
 					<span class="give-tooltip give-icon give-icon-question"
1174
-						  data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span>
1174
+						  data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span>
1175 1175
 				</label>
1176 1176
 
1177 1177
 				<input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input"
1178
-					   placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>"
1179
-					   type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1178
+					   placeholder="<?php esc_attr_e('Password', 'give'); ?>"
1179
+					   type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1180 1180
 			</div>
1181 1181
 
1182 1182
 			<div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>"
1183 1183
 				 class="give-register-password form-row form-row-one-third form-row-responsive">
1184 1184
 				<label for="give-user-pass-confirm-<?php echo $form_id; ?>">
1185
-					<?php esc_html_e( 'Confirm PW', 'give' ); ?>
1186
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1185
+					<?php esc_html_e('Confirm PW', 'give'); ?>
1186
+					<?php if (give_logged_in_only($form_id)) { ?>
1187 1187
 						<span class="give-required-indicator">*</span>
1188 1188
 					<?php } ?>
1189 1189
 					<span class="give-tooltip give-icon give-icon-question"
1190
-						  data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span>
1190
+						  data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span>
1191 1191
 				</label>
1192 1192
 
1193 1193
 				<input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>"
1194
-					   class="give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>"
1195
-					   type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1194
+					   class="give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>"
1195
+					   type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1196 1196
 			</div>
1197 1197
 			<?php
1198 1198
 			/**
@@ -1202,7 +1202,7 @@  discard block
 block discarded – undo
1202 1202
 			 *
1203 1203
 			 * @param int $form_id The form ID.
1204 1204
 			 */
1205
-			do_action( 'give_register_account_fields_after', $form_id );
1205
+			do_action('give_register_account_fields_after', $form_id);
1206 1206
 			?>
1207 1207
 		</fieldset>
1208 1208
 
@@ -1214,7 +1214,7 @@  discard block
 block discarded – undo
1214 1214
 		 *
1215 1215
 		 * @param int $form_id The form ID.
1216 1216
 		 */
1217
-		do_action( 'give_register_fields_after', $form_id );
1217
+		do_action('give_register_fields_after', $form_id);
1218 1218
 		?>
1219 1219
 
1220 1220
 		<input type="hidden" name="give-purchase-var" value="needs-to-register"/>
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
 		 *
1226 1226
 		 * @since 1.7
1227 1227
 		 */
1228
-		do_action( 'give_donation_form_user_info', $form_id );
1228
+		do_action('give_donation_form_user_info', $form_id);
1229 1229
 		?>
1230 1230
 
1231 1231
 	</fieldset>
@@ -1233,7 +1233,7 @@  discard block
 block discarded – undo
1233 1233
 	echo ob_get_clean();
1234 1234
 }
1235 1235
 
1236
-add_action( 'give_donation_form_register_fields', 'give_get_register_fields' );
1236
+add_action('give_donation_form_register_fields', 'give_get_register_fields');
1237 1237
 
1238 1238
 /**
1239 1239
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -1246,27 +1246,27 @@  discard block
 block discarded – undo
1246 1246
  *
1247 1247
  * @return string
1248 1248
  */
1249
-function give_get_login_fields( $form_id ) {
1249
+function give_get_login_fields($form_id) {
1250 1250
 
1251
-	$form_id            = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id;
1252
-	$show_register_form = give_show_login_register_option( $form_id );
1251
+	$form_id            = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id;
1252
+	$show_register_form = give_show_login_register_option($form_id);
1253 1253
 
1254 1254
 	ob_start();
1255 1255
 	?>
1256 1256
 	<fieldset id="give-login-fields-<?php echo $form_id; ?>">
1257
-		<legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) );
1258
-			if ( ! give_logged_in_only( $form_id ) ) {
1259
-				echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>';
1257
+		<legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give'));
1258
+			if ( ! give_logged_in_only($form_id)) {
1259
+				echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>';
1260 1260
 			} ?>
1261 1261
 		</legend>
1262
-		<?php if ( $show_register_form == 'both' ) { ?>
1262
+		<?php if ($show_register_form == 'both') { ?>
1263 1263
 			<p class="give-new-account-link">
1264
-				<?php esc_html_e( 'Need to create an account?', 'give' ); ?>&nbsp;
1265
-				<a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel"
1264
+				<?php esc_html_e('Need to create an account?', 'give'); ?>&nbsp;
1265
+				<a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel"
1266 1266
 				   data-action="give_checkout_register">
1267
-					<?php esc_html_e( 'Register', 'give' );
1268
-					if ( ! give_logged_in_only( $form_id ) ) {
1269
-						echo ' ' . esc_html__( 'and donate as a guest &raquo;', 'give' );
1267
+					<?php esc_html_e('Register', 'give');
1268
+					if ( ! give_logged_in_only($form_id)) {
1269
+						echo ' '.esc_html__('and donate as a guest &raquo;', 'give');
1270 1270
 					} ?>
1271 1271
 				</a>
1272 1272
 			</p>
@@ -1282,49 +1282,49 @@  discard block
 block discarded – undo
1282 1282
 		 *
1283 1283
 		 * @param int $form_id The form ID.
1284 1284
 		 */
1285
-		do_action( 'give_checkout_login_fields_before', $form_id );
1285
+		do_action('give_checkout_login_fields_before', $form_id);
1286 1286
 		?>
1287 1287
 		<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive">
1288 1288
 			<label class="give-label" for="give-user-login-<?php echo $form_id; ?>">
1289
-				<?php esc_html_e( 'Username', 'give' ); ?>
1290
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1289
+				<?php esc_html_e('Username', 'give'); ?>
1290
+				<?php if (give_logged_in_only($form_id)) { ?>
1291 1291
 					<span class="give-required-indicator">*</span>
1292 1292
 				<?php } ?>
1293 1293
 			</label>
1294 1294
 
1295
-			<input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text"
1295
+			<input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text"
1296 1296
 				   name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value=""
1297
-				   placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1297
+				   placeholder="<?php esc_attr_e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1298 1298
 		</div>
1299 1299
 
1300 1300
 		<div id="give-user-pass-wrap-<?php echo $form_id; ?>"
1301 1301
 			 class="give_login_password form-row form-row-last form-row-responsive">
1302 1302
 			<label class="give-label" for="give-user-pass-<?php echo $form_id; ?>">
1303
-				<?php esc_html_e( 'Password', 'give' ); ?>
1304
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1303
+				<?php esc_html_e('Password', 'give'); ?>
1304
+				<?php if (give_logged_in_only($form_id)) { ?>
1305 1305
 					<span class="give-required-indicator">*</span>
1306 1306
 				<?php } ?>
1307 1307
 			</label>
1308
-			<input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>"
1308
+			<input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>"
1309 1309
 				   type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>"
1310
-				   placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1310
+				   placeholder="<?php esc_attr_e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1311 1311
 			<input type="hidden" name="give-purchase-var" value="needs-to-login"/>
1312 1312
 		</div>
1313 1313
 
1314 1314
 		<div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password">
1315 1315
 			 <span class="give-forgot-password ">
1316 1316
 				 <a href="<?php echo wp_lostpassword_url() ?>"
1317
-					target="_blank"><?php esc_html_e( 'Reset Password', 'give' ) ?></a>
1317
+					target="_blank"><?php esc_html_e('Reset Password', 'give') ?></a>
1318 1318
 			 </span>
1319 1319
 		</div>
1320 1320
 
1321 1321
 		<div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix">
1322 1322
 			<input type="submit" class="give-submit give-btn button" name="give_login_submit"
1323
-				   value="<?php esc_attr_e( 'Login', 'give' ); ?>"/>
1324
-			<?php if ( $show_register_form !== 'login' ) { ?>
1323
+				   value="<?php esc_attr_e('Login', 'give'); ?>"/>
1324
+			<?php if ($show_register_form !== 'login') { ?>
1325 1325
 				<input type="button" data-action="give_cancel_login"
1326 1326
 					   class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel"
1327
-					   value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/>
1327
+					   value="<?php esc_attr_e('Cancel', 'give'); ?>"/>
1328 1328
 			<?php } ?>
1329 1329
 			<span class="give-loading-animation"></span>
1330 1330
 		</div>
@@ -1336,14 +1336,14 @@  discard block
 block discarded – undo
1336 1336
 		 *
1337 1337
 		 * @param int $form_id The form ID.
1338 1338
 		 */
1339
-		do_action( 'give_checkout_login_fields_after', $form_id );
1339
+		do_action('give_checkout_login_fields_after', $form_id);
1340 1340
 		?>
1341 1341
 	</fieldset><!--end #give-login-fields-->
1342 1342
 	<?php
1343 1343
 	echo ob_get_clean();
1344 1344
 }
1345 1345
 
1346
-add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 );
1346
+add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1);
1347 1347
 
1348 1348
 /**
1349 1349
  * Payment Mode Select.
@@ -1359,9 +1359,9 @@  discard block
 block discarded – undo
1359 1359
  *
1360 1360
  * @return void
1361 1361
  */
1362
-function give_payment_mode_select( $form_id ) {
1362
+function give_payment_mode_select($form_id) {
1363 1363
 
1364
-	$gateways = give_get_enabled_payment_gateways( $form_id );
1364
+	$gateways = give_get_enabled_payment_gateways($form_id);
1365 1365
 
1366 1366
 	/**
1367 1367
 	 * Fires while selecting payment gateways, before the fields.
@@ -1370,10 +1370,10 @@  discard block
 block discarded – undo
1370 1370
 	 *
1371 1371
 	 * @param int $form_id The form ID.
1372 1372
 	 */
1373
-	do_action( 'give_payment_mode_top', $form_id );
1373
+	do_action('give_payment_mode_top', $form_id);
1374 1374
 	?>
1375 1375
 
1376
-	<fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) {
1376
+	<fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) {
1377 1377
 		echo 'style="display: none;"';
1378 1378
 	} ?>>
1379 1379
 		<?php
@@ -1384,10 +1384,10 @@  discard block
 block discarded – undo
1384 1384
 		 *
1385 1385
 		 * @param int $form_id The form ID.
1386 1386
 		 */
1387
-		do_action( 'give_payment_mode_before_gateways_wrap' );
1387
+		do_action('give_payment_mode_before_gateways_wrap');
1388 1388
 		?>
1389 1389
 		<legend
1390
-				class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?>
1390
+				class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?>
1391 1391
 			<span class="give-loading-text"><span
1392 1392
 						class="give-loading-animation"></span>
1393 1393
             </span>
@@ -1400,26 +1400,26 @@  discard block
 block discarded – undo
1400 1400
 			 *
1401 1401
 			 * @since 1.7
1402 1402
 			 */
1403
-			do_action( 'give_payment_mode_before_gateways' )
1403
+			do_action('give_payment_mode_before_gateways')
1404 1404
 			?>
1405 1405
 			<ul id="give-gateway-radio-list">
1406 1406
 				<?php
1407 1407
 				/**
1408 1408
 				 * Loop through the active payment gateways.
1409 1409
 				 */
1410
-				$selected_gateway  = give_get_chosen_gateway( $form_id );
1410
+				$selected_gateway = give_get_chosen_gateway($form_id);
1411 1411
 
1412
-				foreach ( $gateways as $gateway_id => $gateway ) :
1412
+				foreach ($gateways as $gateway_id => $gateway) :
1413 1413
 					//Determine the default gateway.
1414
-					$checked = checked( $gateway_id, $selected_gateway, false );
1414
+					$checked = checked($gateway_id, $selected_gateway, false);
1415 1415
 					$checked_class = $checked ? ' class="give-gateway-option-selected"' : ''; ?>
1416 1416
 					<li<?php echo $checked_class ?>>
1417 1417
 						<input type="radio" name="payment-mode" class="give-gateway"
1418
-							   id="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>"
1419
-							   value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>>
1420
-						<label for="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>"
1418
+							   id="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>"
1419
+							   value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>>
1420
+						<label for="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>"
1421 1421
 							   class="give-gateway-option"
1422
-							   id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $gateway['checkout_label'] ); ?></label>
1422
+							   id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($gateway['checkout_label']); ?></label>
1423 1423
 					</li>
1424 1424
 					<?php
1425 1425
 				endforeach;
@@ -1431,7 +1431,7 @@  discard block
 block discarded – undo
1431 1431
 			 *
1432 1432
 			 * @since 1.7
1433 1433
 			 */
1434
-			do_action( 'give_payment_mode_after_gateways' );
1434
+			do_action('give_payment_mode_after_gateways');
1435 1435
 			?>
1436 1436
 		</div>
1437 1437
 		<?php
@@ -1442,7 +1442,7 @@  discard block
 block discarded – undo
1442 1442
 		 *
1443 1443
 		 * @param int $form_id The form ID.
1444 1444
 		 */
1445
-		do_action( 'give_payment_mode_after_gateways_wrap' );
1445
+		do_action('give_payment_mode_after_gateways_wrap');
1446 1446
 		?>
1447 1447
 	</fieldset>
1448 1448
 
@@ -1454,7 +1454,7 @@  discard block
 block discarded – undo
1454 1454
 	 *
1455 1455
 	 * @param int $form_id The form ID.
1456 1456
 	 */
1457
-	do_action( 'give_payment_mode_bottom', $form_id );
1457
+	do_action('give_payment_mode_bottom', $form_id);
1458 1458
 	?>
1459 1459
 
1460 1460
 	<div id="give_purchase_form_wrap">
@@ -1465,7 +1465,7 @@  discard block
 block discarded – undo
1465 1465
 		 *
1466 1466
 		 * @since 1.7
1467 1467
 		 */
1468
-		do_action( 'give_donation_form', $form_id );
1468
+		do_action('give_donation_form', $form_id);
1469 1469
 		?>
1470 1470
 
1471 1471
 	</div>
@@ -1476,10 +1476,10 @@  discard block
 block discarded – undo
1476 1476
 	 *
1477 1477
 	 * @since 1.7
1478 1478
 	 */
1479
-	do_action( 'give_donation_form_wrap_bottom', $form_id );
1479
+	do_action('give_donation_form_wrap_bottom', $form_id);
1480 1480
 }
1481 1481
 
1482
-add_action( 'give_payment_mode_select', 'give_payment_mode_select' );
1482
+add_action('give_payment_mode_select', 'give_payment_mode_select');
1483 1483
 
1484 1484
 /**
1485 1485
  * Renders the Checkout Agree to Terms, this displays a checkbox for users to
@@ -1492,31 +1492,31 @@  discard block
 block discarded – undo
1492 1492
  *
1493 1493
  * @return bool
1494 1494
  */
1495
-function give_terms_agreement( $form_id ) {
1496
-	$form_option = give_get_meta( $form_id, '_give_terms_option', true );
1495
+function give_terms_agreement($form_id) {
1496
+	$form_option = give_get_meta($form_id, '_give_terms_option', true);
1497 1497
 
1498 1498
 	// Bailout if per form and global term and conditions is not setup.
1499 1499
 	if (
1500
-		give_is_setting_enabled( $form_option, 'global' )
1501
-		&& give_is_setting_enabled( give_get_option( 'terms' ) )
1500
+		give_is_setting_enabled($form_option, 'global')
1501
+		&& give_is_setting_enabled(give_get_option('terms'))
1502 1502
 	) {
1503
-		$label         = give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) );
1504
-		$terms         = $terms = give_get_option( 'agreement_text', '' );
1505
-		$edit_term_url = admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=display&section=term-and-conditions' );
1503
+		$label         = give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give'));
1504
+		$terms         = $terms = give_get_option('agreement_text', '');
1505
+		$edit_term_url = admin_url('edit.php?post_type=give_forms&page=give-settings&tab=display&section=term-and-conditions');
1506 1506
 
1507
-	} elseif ( give_is_setting_enabled( $form_option ) ) {
1508
-		$label         = ( $label = give_get_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' );
1509
-		$terms         = give_get_meta( $form_id, '_give_agree_text', true );
1510
-		$edit_term_url = admin_url( 'post.php?post=' . $form_id . '&action=edit#form_terms_options' );
1507
+	} elseif (give_is_setting_enabled($form_option)) {
1508
+		$label         = ($label = give_get_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give');
1509
+		$terms         = give_get_meta($form_id, '_give_agree_text', true);
1510
+		$edit_term_url = admin_url('post.php?post='.$form_id.'&action=edit#form_terms_options');
1511 1511
 
1512 1512
 	} else {
1513 1513
 		return false;
1514 1514
 	}
1515 1515
 
1516 1516
 	// Bailout: Check if term and conditions text is empty or not.
1517
-	if ( empty( $terms ) ) {
1518
-		if ( is_user_logged_in() && current_user_can( 'edit_give_forms' ) ) {
1519
-			echo sprintf( __( 'Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), $edit_term_url );
1517
+	if (empty($terms)) {
1518
+		if (is_user_logged_in() && current_user_can('edit_give_forms')) {
1519
+			echo sprintf(__('Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give'), $edit_term_url);
1520 1520
 		}
1521 1521
 
1522 1522
 		return false;
@@ -1524,7 +1524,7 @@  discard block
 block discarded – undo
1524 1524
 
1525 1525
 	?>
1526 1526
 	<fieldset id="give_terms_agreement">
1527
-		<legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend>
1527
+		<legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend>
1528 1528
 		<div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;">
1529 1529
 			<?php
1530 1530
 			/**
@@ -1532,22 +1532,22 @@  discard block
 block discarded – undo
1532 1532
 			 *
1533 1533
 			 * @since 1.0
1534 1534
 			 */
1535
-			do_action( 'give_before_terms' );
1535
+			do_action('give_before_terms');
1536 1536
 
1537
-			echo wpautop( stripslashes( $terms ) );
1537
+			echo wpautop(stripslashes($terms));
1538 1538
 			/**
1539 1539
 			 * Fires while rendering terms of agreement, after the fields.
1540 1540
 			 *
1541 1541
 			 * @since 1.0
1542 1542
 			 */
1543
-			do_action( 'give_after_terms' );
1543
+			do_action('give_after_terms');
1544 1544
 			?>
1545 1545
 		</div>
1546 1546
 		<div id="give_show_terms">
1547 1547
 			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1548
-			   aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a>
1548
+			   aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a>
1549 1549
 			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1550
-			   aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a>
1550
+			   aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a>
1551 1551
 		</div>
1552 1552
 
1553 1553
 		<input name="give_agree_to_terms" class="required" type="checkbox"
@@ -1558,7 +1558,7 @@  discard block
 block discarded – undo
1558 1558
 	<?php
1559 1559
 }
1560 1560
 
1561
-add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 );
1561
+add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1);
1562 1562
 
1563 1563
 /**
1564 1564
  * Checkout Final Total.
@@ -1571,31 +1571,30 @@  discard block
 block discarded – undo
1571 1571
  *
1572 1572
  * @return void
1573 1573
  */
1574
-function give_checkout_final_total( $form_id ) {
1574
+function give_checkout_final_total($form_id) {
1575 1575
 
1576
-	$total = isset( $_POST['give_total'] ) ?
1577
-		apply_filters( 'give_donation_total', give_maybe_sanitize_amount( $_POST['give_total'] ) ) :
1578
-		give_get_default_form_amount( $form_id );
1576
+	$total = isset($_POST['give_total']) ?
1577
+		apply_filters('give_donation_total', give_maybe_sanitize_amount($_POST['give_total'])) : give_get_default_form_amount($form_id);
1579 1578
 
1580 1579
 
1581 1580
 	//Only proceed if give_total available.
1582
-	if ( empty( $total ) ) {
1581
+	if (empty($total)) {
1583 1582
 		return;
1584 1583
 	}
1585 1584
 	?>
1586 1585
 	<p id="give-final-total-wrap" class="form-wrap ">
1587 1586
 		<span class="give-donation-total-label">
1588
-			<?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?>
1587
+			<?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?>
1589 1588
 		</span>
1590 1589
 		<span class="give-final-total-amount"
1591
-			  data-total="<?php echo give_format_amount( $total, array( 'sanitize' => false ) ); ?>">
1592
-			<?php echo give_currency_filter( give_format_amount( $total, array( 'sanitize' => false ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ); ?>
1590
+			  data-total="<?php echo give_format_amount($total, array('sanitize' => false)); ?>">
1591
+			<?php echo give_currency_filter(give_format_amount($total, array('sanitize' => false)), array('currency_code' => give_get_currency($form_id))); ?>
1593 1592
 		</span>
1594 1593
 	</p>
1595 1594
 	<?php
1596 1595
 }
1597 1596
 
1598
-add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 );
1597
+add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999);
1599 1598
 
1600 1599
 /**
1601 1600
  * Renders the Checkout Submit section.
@@ -1606,7 +1605,7 @@  discard block
 block discarded – undo
1606 1605
  *
1607 1606
  * @return void
1608 1607
  */
1609
-function give_checkout_submit( $form_id ) {
1608
+function give_checkout_submit($form_id) {
1610 1609
 	?>
1611 1610
 	<fieldset id="give_purchase_submit">
1612 1611
 		<?php
@@ -1615,24 +1614,24 @@  discard block
 block discarded – undo
1615 1614
 		 *
1616 1615
 		 * @since 1.7
1617 1616
 		 */
1618
-		do_action( 'give_donation_form_before_submit', $form_id );
1617
+		do_action('give_donation_form_before_submit', $form_id);
1619 1618
 
1620
-		give_checkout_hidden_fields( $form_id );
1619
+		give_checkout_hidden_fields($form_id);
1621 1620
 
1622
-		echo give_get_donation_form_submit_button( $form_id );
1621
+		echo give_get_donation_form_submit_button($form_id);
1623 1622
 
1624 1623
 		/**
1625 1624
 		 * Fire after donation form submit.
1626 1625
 		 *
1627 1626
 		 * @since 1.7
1628 1627
 		 */
1629
-		do_action( 'give_donation_form_after_submit', $form_id );
1628
+		do_action('give_donation_form_after_submit', $form_id);
1630 1629
 		?>
1631 1630
 	</fieldset>
1632 1631
 	<?php
1633 1632
 }
1634 1633
 
1635
-add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 );
1634
+add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999);
1636 1635
 
1637 1636
 /**
1638 1637
  * Give Donation form submit button.
@@ -1643,10 +1642,10 @@  discard block
 block discarded – undo
1643 1642
  *
1644 1643
  * @return string
1645 1644
  */
1646
-function give_get_donation_form_submit_button( $form_id ) {
1645
+function give_get_donation_form_submit_button($form_id) {
1647 1646
 
1648
-	$display_label_field = give_get_meta( $form_id, '_give_checkout_label', true );
1649
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
1647
+	$display_label_field = give_get_meta($form_id, '_give_checkout_label', true);
1648
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
1650 1649
 	ob_start();
1651 1650
 	?>
1652 1651
 	<div class="give-submit-button-wrap give-clearfix">
@@ -1655,7 +1654,7 @@  discard block
 block discarded – undo
1655 1654
 		<span class="give-loading-animation"></span>
1656 1655
 	</div>
1657 1656
 	<?php
1658
-	return apply_filters( 'give_donation_form_submit_button', ob_get_clean(), $form_id );
1657
+	return apply_filters('give_donation_form_submit_button', ob_get_clean(), $form_id);
1659 1658
 }
1660 1659
 
1661 1660
 /**
@@ -1670,17 +1669,17 @@  discard block
 block discarded – undo
1670 1669
  *
1671 1670
  * @return mixed
1672 1671
  */
1673
-function give_show_goal_progress( $form_id, $args ) {
1672
+function give_show_goal_progress($form_id, $args) {
1674 1673
 
1675 1674
 	ob_start();
1676
-	give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) );
1675
+	give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args));
1677 1676
 
1678
-	echo apply_filters( 'give_goal_output', ob_get_clean() );
1677
+	echo apply_filters('give_goal_output', ob_get_clean());
1679 1678
 
1680 1679
 	return true;
1681 1680
 }
1682 1681
 
1683
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1682
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1684 1683
 
1685 1684
 
1686 1685
 /**
@@ -1693,10 +1692,10 @@  discard block
 block discarded – undo
1693 1692
  *
1694 1693
  * @return mixed|string
1695 1694
  */
1696
-function give_get_form_content_placement( $form_id, $args ) {
1695
+function give_get_form_content_placement($form_id, $args) {
1697 1696
 	$show_content = '';
1698 1697
 
1699
-	if ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) {
1698
+	if (isset($args['show_content']) && ! empty($args['show_content'])) {
1700 1699
 		// Content positions.
1701 1700
 		$content_placement = array(
1702 1701
 			'above' => 'give_pre_form',
@@ -1704,18 +1703,18 @@  discard block
 block discarded – undo
1704 1703
 		);
1705 1704
 
1706 1705
 		// Check if content position already decoded.
1707
-		if ( in_array( $args['show_content'], $content_placement ) ) {
1706
+		if (in_array($args['show_content'], $content_placement)) {
1708 1707
 			return $args['show_content'];
1709 1708
 		}
1710 1709
 
1711
-		$show_content = ( 'none' !== $args['show_content'] ? $content_placement[ $args['show_content'] ] : '' );
1710
+		$show_content = ('none' !== $args['show_content'] ? $content_placement[$args['show_content']] : '');
1712 1711
 
1713
-	} elseif ( give_is_setting_enabled( give_get_meta( $form_id, '_give_display_content', true ) ) ) {
1714
-		$show_content = give_get_meta( $form_id, '_give_content_placement', true );
1712
+	} elseif (give_is_setting_enabled(give_get_meta($form_id, '_give_display_content', true))) {
1713
+		$show_content = give_get_meta($form_id, '_give_content_placement', true);
1715 1714
 
1716
-	} elseif ( 'none' !== give_get_meta( $form_id, '_give_content_option', true ) ) {
1715
+	} elseif ('none' !== give_get_meta($form_id, '_give_content_option', true)) {
1717 1716
 		// Backward compatibility for _give_content_option for v18.
1718
-		$show_content = give_get_meta( $form_id, '_give_content_option', true );
1717
+		$show_content = give_get_meta($form_id, '_give_content_option', true);
1719 1718
 	}
1720 1719
 
1721 1720
 	return $show_content;
@@ -1731,20 +1730,20 @@  discard block
 block discarded – undo
1731 1730
  *
1732 1731
  * @return void|bool
1733 1732
  */
1734
-function give_form_content( $form_id, $args ) {
1733
+function give_form_content($form_id, $args) {
1735 1734
 
1736
-	$show_content = give_get_form_content_placement( $form_id, $args );
1735
+	$show_content = give_get_form_content_placement($form_id, $args);
1737 1736
 
1738 1737
 	// Bailout.
1739
-	if ( empty( $show_content ) ) {
1738
+	if (empty($show_content)) {
1740 1739
 		return false;
1741 1740
 	}
1742 1741
 
1743 1742
 	// Add action according to value.
1744
-	add_action( $show_content, 'give_form_display_content', 10, 2 );
1743
+	add_action($show_content, 'give_form_display_content', 10, 2);
1745 1744
 }
1746 1745
 
1747
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
1746
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
1748 1747
 
1749 1748
 /**
1750 1749
  * Renders Post Form Content.
@@ -1758,22 +1757,22 @@  discard block
 block discarded – undo
1758 1757
  *
1759 1758
  * @return void
1760 1759
  */
1761
-function give_form_display_content( $form_id, $args ) {
1760
+function give_form_display_content($form_id, $args) {
1762 1761
 
1763
-	$content      = wpautop( give_get_meta( $form_id, '_give_form_content', true ) );
1764
-	$show_content = give_get_form_content_placement( $form_id, $args );
1762
+	$content      = wpautop(give_get_meta($form_id, '_give_form_content', true));
1763
+	$show_content = give_get_form_content_placement($form_id, $args);
1765 1764
 
1766
-	if ( give_is_setting_enabled( give_get_option( 'the_content_filter' ) ) ) {
1767
-		$content = apply_filters( 'the_content', $content );
1765
+	if (give_is_setting_enabled(give_get_option('the_content_filter'))) {
1766
+		$content = apply_filters('the_content', $content);
1768 1767
 	}
1769 1768
 
1770
-	$output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap ' . $show_content . '-content">' . $content . '</div>';
1769
+	$output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap '.$show_content.'-content">'.$content.'</div>';
1771 1770
 
1772
-	echo apply_filters( 'give_form_content_output', $output );
1771
+	echo apply_filters('give_form_content_output', $output);
1773 1772
 
1774 1773
 	//remove action to prevent content output on addition forms on page.
1775 1774
 	//@see: https://github.com/WordImpress/Give/issues/634.
1776
-	remove_action( $show_content, 'give_form_display_content' );
1775
+	remove_action($show_content, 'give_form_display_content');
1777 1776
 }
1778 1777
 
1779 1778
 /**
@@ -1785,7 +1784,7 @@  discard block
 block discarded – undo
1785 1784
  *
1786 1785
  * @return void
1787 1786
  */
1788
-function give_checkout_hidden_fields( $form_id ) {
1787
+function give_checkout_hidden_fields($form_id) {
1789 1788
 
1790 1789
 	/**
1791 1790
 	 * Fires while rendering hidden checkout fields, before the fields.
@@ -1794,13 +1793,13 @@  discard block
 block discarded – undo
1794 1793
 	 *
1795 1794
 	 * @param int $form_id The form ID.
1796 1795
 	 */
1797
-	do_action( 'give_hidden_fields_before', $form_id );
1796
+	do_action('give_hidden_fields_before', $form_id);
1798 1797
 
1799
-	if ( is_user_logged_in() ) { ?>
1798
+	if (is_user_logged_in()) { ?>
1800 1799
 		<input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/>
1801 1800
 	<?php } ?>
1802 1801
 	<input type="hidden" name="give_action" value="purchase"/>
1803
-	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/>
1802
+	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/>
1804 1803
 	<?php
1805 1804
 	/**
1806 1805
 	 * Fires while rendering hidden checkout fields, after the fields.
@@ -1809,7 +1808,7 @@  discard block
 block discarded – undo
1809 1808
 	 *
1810 1809
 	 * @param int $form_id The form ID.
1811 1810
 	 */
1812
-	do_action( 'give_hidden_fields_after', $form_id );
1811
+	do_action('give_hidden_fields_after', $form_id);
1813 1812
 
1814 1813
 }
1815 1814
 
@@ -1824,20 +1823,20 @@  discard block
 block discarded – undo
1824 1823
  *
1825 1824
  * @return string $content Filtered content.
1826 1825
  */
1827
-function give_filter_success_page_content( $content ) {
1826
+function give_filter_success_page_content($content) {
1828 1827
 
1829 1828
 	$give_options = give_get_settings();
1830 1829
 
1831
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
1832
-		if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) {
1833
-			$content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content );
1830
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
1831
+		if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) {
1832
+			$content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content);
1834 1833
 		}
1835 1834
 	}
1836 1835
 
1837 1836
 	return $content;
1838 1837
 }
1839 1838
 
1840
-add_filter( 'the_content', 'give_filter_success_page_content' );
1839
+add_filter('the_content', 'give_filter_success_page_content');
1841 1840
 
1842 1841
 /**
1843 1842
  * Test Mode Frontend Warning.
@@ -1848,12 +1847,12 @@  discard block
 block discarded – undo
1848 1847
  */
1849 1848
 function give_test_mode_frontend_warning() {
1850 1849
 
1851
-	if ( give_is_test_mode() ) {
1852
-		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>';
1850
+	if (give_is_test_mode()) {
1851
+		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>';
1853 1852
 	}
1854 1853
 }
1855 1854
 
1856
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
1855
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
1857 1856
 
1858 1857
 /**
1859 1858
  * Members-only Form.
@@ -1867,21 +1866,21 @@  discard block
 block discarded – undo
1867 1866
  *
1868 1867
  * @return string
1869 1868
  */
1870
-function give_members_only_form( $final_output, $args ) {
1869
+function give_members_only_form($final_output, $args) {
1871 1870
 
1872
-	$form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0;
1871
+	$form_id = isset($args['form_id']) ? $args['form_id'] : 0;
1873 1872
 
1874 1873
 	//Sanity Check: Must have form_id & not be logged in.
1875
-	if ( empty( $form_id ) || is_user_logged_in() ) {
1874
+	if (empty($form_id) || is_user_logged_in()) {
1876 1875
 		return $final_output;
1877 1876
 	}
1878 1877
 
1879 1878
 	//Logged in only and Register / Login set to none.
1880
-	if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) {
1879
+	if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
1881 1880
 
1882
-		$final_output = Give()->notices->print_frontend_notice( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false );
1881
+		$final_output = Give()->notices->print_frontend_notice(esc_html__('Please log in in order to complete your donation.', 'give'), false);
1883 1882
 
1884
-		return apply_filters( 'give_members_only_output', $final_output, $form_id );
1883
+		return apply_filters('give_members_only_output', $final_output, $form_id);
1885 1884
 
1886 1885
 	}
1887 1886
 
@@ -1889,7 +1888,7 @@  discard block
 block discarded – undo
1889 1888
 
1890 1889
 }
1891 1890
 
1892
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 );
1891
+add_filter('give_donate_form', 'give_members_only_form', 10, 2);
1893 1892
 
1894 1893
 
1895 1894
 /**
@@ -1901,25 +1900,25 @@  discard block
 block discarded – undo
1901 1900
  * @param array            $args
1902 1901
  * @param Give_Donate_Form $form
1903 1902
  */
1904
-function __give_form_add_donation_hidden_field( $form_id, $args, $form ) {
1903
+function __give_form_add_donation_hidden_field($form_id, $args, $form) {
1905 1904
 	?>
1906 1905
 	<input type="hidden" name="give-form-id" value="<?php echo $form_id; ?>"/>
1907
-	<input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/>
1906
+	<input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/>
1908 1907
 	<input type="hidden" name="give-current-url"
1909
-		   value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
1910
-	<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
1908
+		   value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
1909
+	<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
1911 1910
 	<input type="hidden" name="give-form-minimum"
1912
-		   value="<?php echo give_format_amount( give_get_form_minimum_price( $form_id ), array( 'sanitize' => false ) ); ?>"/>
1911
+		   value="<?php echo give_format_amount(give_get_form_minimum_price($form_id), array('sanitize' => false)); ?>"/>
1913 1912
 	<?php
1914 1913
 
1915 1914
 	// Price ID hidden field for variable (multi-level) donation forms.
1916
-	if ( give_has_variable_prices( $form_id ) ) {
1915
+	if (give_has_variable_prices($form_id)) {
1917 1916
 		// Get default selected price ID.
1918
-		$prices   = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
1917
+		$prices   = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
1919 1918
 		$price_id = 0;
1920 1919
 		//loop through prices.
1921
-		foreach ( $prices as $price ) {
1922
-			if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
1920
+		foreach ($prices as $price) {
1921
+			if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
1923 1922
 				$price_id = $price['_give_id']['level_id'];
1924 1923
 			};
1925 1924
 		}
@@ -1932,7 +1931,7 @@  discard block
 block discarded – undo
1932 1931
 	}
1933 1932
 }
1934 1933
 
1935
-add_action( 'give_donation_form_top', '__give_form_add_donation_hidden_field', 0, 3 );
1934
+add_action('give_donation_form_top', '__give_form_add_donation_hidden_field', 0, 3);
1936 1935
 
1937 1936
 /**
1938 1937
  * Add currency settings on donation form.
@@ -1944,20 +1943,20 @@  discard block
 block discarded – undo
1944 1943
  *
1945 1944
  * @return array
1946 1945
  */
1947
-function __give_form_add_currency_settings( $form_html_tags, $form ) {
1948
-	$form_currency     = give_get_currency( $form->ID );
1949
-	$currency_settings = give_get_currency_formatting_settings( $form_currency );
1946
+function __give_form_add_currency_settings($form_html_tags, $form) {
1947
+	$form_currency     = give_get_currency($form->ID);
1948
+	$currency_settings = give_get_currency_formatting_settings($form_currency);
1950 1949
 
1951 1950
 	// Check if currency exist.
1952
-	if ( empty( $currency_settings ) ) {
1951
+	if (empty($currency_settings)) {
1953 1952
 		return $form_html_tags;
1954 1953
 	}
1955 1954
 
1956
-	$form_html_tags['data-currency_symbol'] = give_currency_symbol( $form_currency );
1955
+	$form_html_tags['data-currency_symbol'] = give_currency_symbol($form_currency);
1957 1956
 	$form_html_tags['data-currency_code']   = $form_currency;
1958 1957
 
1959
-	if ( ! empty( $currency_settings ) ) {
1960
-		foreach ( $currency_settings as $key => $value ) {
1958
+	if ( ! empty($currency_settings)) {
1959
+		foreach ($currency_settings as $key => $value) {
1961 1960
 			$form_html_tags["data-{$key}"] = $value;
1962 1961
 		}
1963 1962
 	}
@@ -1965,4 +1964,4 @@  discard block
 block discarded – undo
1965 1964
 	return $form_html_tags;
1966 1965
 }
1967 1966
 
1968
-add_filter( 'give_form_html_tags', '__give_form_add_currency_settings', 0, 2 );
1967
+add_filter('give_form_html_tags', '__give_form_add_currency_settings', 0, 2);
Please login to merge, or discard this patch.
includes/process-donation.php 1 patch
Spacing   +256 added lines, -257 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
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 *
31 31
 	 * @since 1.0
32 32
 	 */
33
-	do_action( 'give_pre_process_donation' );
33
+	do_action('give_pre_process_donation');
34 34
 
35 35
 	// Validate the form $_POST data.
36 36
 	$valid_data = give_donation_form_validate_fields();
@@ -45,26 +45,26 @@  discard block
 block discarded – undo
45 45
 	 * @param bool|array $valid_data Validate fields.
46 46
 	 * @param array $_POST Array of variables passed via the HTTP POST.
47 47
 	 */
48
-	do_action( 'give_checkout_error_checks', $valid_data, $_POST );
48
+	do_action('give_checkout_error_checks', $valid_data, $_POST);
49 49
 
50
-	$is_ajax = isset( $_POST['give_ajax'] );
50
+	$is_ajax = isset($_POST['give_ajax']);
51 51
 
52 52
 	// Process the login form.
53
-	if ( isset( $_POST['give_login_submit'] ) ) {
53
+	if (isset($_POST['give_login_submit'])) {
54 54
 		give_process_form_login();
55 55
 	}
56 56
 
57 57
 	// Validate the user.
58
-	$user = give_get_donation_form_user( $valid_data );
58
+	$user = give_get_donation_form_user($valid_data);
59 59
 
60
-	if ( false === $valid_data || give_get_errors() || ! $user ) {
61
-		if ( $is_ajax ) {
60
+	if (false === $valid_data || give_get_errors() || ! $user) {
61
+		if ($is_ajax) {
62 62
 			/**
63 63
 			 * Fires when AJAX sends back errors from the donation form.
64 64
 			 *
65 65
 			 * @since 1.0
66 66
 			 */
67
-			do_action( 'give_ajax_donation_errors' );
67
+			do_action('give_ajax_donation_errors');
68 68
 			give_die();
69 69
 		} else {
70 70
 			return false;
@@ -72,17 +72,17 @@  discard block
 block discarded – undo
72 72
 	}
73 73
 
74 74
 	// If AJAX send back success to proceed with form submission.
75
-	if ( $is_ajax ) {
75
+	if ($is_ajax) {
76 76
 		echo 'success';
77 77
 		give_die();
78 78
 	}
79 79
 
80 80
 	// After AJAX: Setup session if not using php_sessions.
81
-	if ( ! Give()->session->use_php_sessions() ) {
81
+	if ( ! Give()->session->use_php_sessions()) {
82 82
 		// Double-check that set_cookie is publicly accessible.
83 83
 		// we're using a slightly modified class-wp-sessions.php.
84
-		$session_reflection = new ReflectionMethod( 'WP_Session', 'set_cookie' );
85
-		if ( $session_reflection->isPublic() ) {
84
+		$session_reflection = new ReflectionMethod('WP_Session', 'set_cookie');
85
+		if ($session_reflection->isPublic()) {
86 86
 			// Manually set the cookie.
87 87
 			Give()->session->init()->set_cookie();
88 88
 		}
@@ -97,21 +97,20 @@  discard block
 block discarded – undo
97 97
 		'address'    => $user['address'],
98 98
 	);
99 99
 
100
-	$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
100
+	$auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
101 101
 
102
-	$price        = isset( $_POST['give-amount'] ) ?
103
-		(float) apply_filters( 'give_donation_total', give_maybe_sanitize_amount( $_POST['give-amount'] ) ) :
104
-		'0.00';
105
-	$purchase_key = strtolower( md5( $user['user_email'] . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );
102
+	$price        = isset($_POST['give-amount']) ?
103
+		(float) apply_filters('give_donation_total', give_maybe_sanitize_amount($_POST['give-amount'])) : '0.00';
104
+	$purchase_key = strtolower(md5($user['user_email'].date('Y-m-d H:i:s').$auth_key.uniqid('give', true)));
106 105
 
107 106
 	// Setup donation information.
108 107
 	$donation_data = array(
109 108
 		'price'         => $price,
110 109
 		'purchase_key'  => $purchase_key,
111 110
 		'user_email'    => $user['user_email'],
112
-		'date'          => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ),
113
-		'user_info'     => stripslashes_deep( $user_info ),
114
-		'post_data'     => give_clean( $_POST ),
111
+		'date'          => date('Y-m-d H:i:s', current_time('timestamp')),
112
+		'user_info'     => stripslashes_deep($user_info),
113
+		'post_data'     => give_clean($_POST),
115 114
 		'gateway'       => $valid_data['gateway'],
116 115
 		'card_info'     => $valid_data['cc_info'],
117 116
 	);
@@ -130,10 +129,10 @@  discard block
 block discarded – undo
130 129
 	 * @param array $user_info Array containing basic user information.
131 130
 	 * @param bool|array $valid_data Validate fields.
132 131
 	 */
133
-	do_action( 'give_checkout_before_gateway', give_clean( $_POST ), $user_info, $valid_data );
132
+	do_action('give_checkout_before_gateway', give_clean($_POST), $user_info, $valid_data);
134 133
 
135 134
 	// Sanity check for price.
136
-	if ( ! $donation_data['price'] ) {
135
+	if ( ! $donation_data['price']) {
137 136
 		// Revert to manual.
138 137
 		$donation_data['gateway'] = 'manual';
139 138
 		$_POST['give-gateway']    = 'manual';
@@ -144,27 +143,27 @@  discard block
 block discarded – undo
144 143
 	 *
145 144
 	 * @since 1.7
146 145
 	 */
147
-	$donation_data = apply_filters( 'give_donation_data_before_gateway', $donation_data, $valid_data );
146
+	$donation_data = apply_filters('give_donation_data_before_gateway', $donation_data, $valid_data);
148 147
 
149 148
 	// Setup the data we're storing in the donation session.
150 149
 	$session_data = $donation_data;
151 150
 
152 151
 	// Make sure credit card numbers are never stored in sessions.
153
-	unset( $session_data['card_info']['card_number'] );
154
-	unset( $session_data['post_data']['card_number'] );
152
+	unset($session_data['card_info']['card_number']);
153
+	unset($session_data['post_data']['card_number']);
155 154
 
156 155
 	// Used for showing data to non logged-in users after donation, and for other plugins needing donation data.
157
-	give_set_purchase_session( $session_data );
156
+	give_set_purchase_session($session_data);
158 157
 
159 158
 	// Send info to the gateway for payment processing.
160
-	give_send_to_gateway( $donation_data['gateway'], $donation_data );
159
+	give_send_to_gateway($donation_data['gateway'], $donation_data);
161 160
 	give_die();
162 161
 
163 162
 }
164 163
 
165
-add_action( 'give_purchase', 'give_process_donation_form' );
166
-add_action( 'wp_ajax_give_process_donation', 'give_process_donation_form' );
167
-add_action( 'wp_ajax_nopriv_give_process_donation', 'give_process_donation_form' );
164
+add_action('give_purchase', 'give_process_donation_form');
165
+add_action('wp_ajax_give_process_donation', 'give_process_donation_form');
166
+add_action('wp_ajax_nopriv_give_process_donation', 'give_process_donation_form');
168 167
 
169 168
 
170 169
 /**
@@ -177,29 +176,29 @@  discard block
 block discarded – undo
177 176
  *
178 177
  * @return void
179 178
  */
180
-function give_check_logged_in_user_for_existing_email( $valid_data, $post ) {
179
+function give_check_logged_in_user_for_existing_email($valid_data, $post) {
181 180
 
182 181
 	// Verify that the email address belongs to this customer.
183
-	if ( is_user_logged_in() ) {
182
+	if (is_user_logged_in()) {
184 183
 
185 184
 		$submitted_email = $valid_data['logged_in_user']['user_email'];
186
-		$donor           = new Give_Donor( get_current_user_id(), true );
185
+		$donor           = new Give_Donor(get_current_user_id(), true);
187 186
 
188 187
 		// If this email address is not registered with this customer, see if it belongs to any other customer.
189 188
 		if (
190 189
 			$submitted_email !== $donor->email
191
-			&& ( is_array( $donor->emails ) && ! in_array( $submitted_email, $donor->emails ) )
190
+			&& (is_array($donor->emails) && ! in_array($submitted_email, $donor->emails))
192 191
 		) {
193
-			$found_donor = new Give_Donor( $submitted_email );
192
+			$found_donor = new Give_Donor($submitted_email);
194 193
 
195
-			if ( $found_donor->id > 0 ) {
196
-				give_set_error( 'give-customer-email-exists', sprintf( __( 'You are logged in as %1$s, and are submitting a donation as %2$s, which is an existing donor. To ensure that the email address is tied to the correct donor, please submit this donation from a logged-out browser, or choose another email address.', 'give' ), $donor->email, $submitted_email ) );
194
+			if ($found_donor->id > 0) {
195
+				give_set_error('give-customer-email-exists', sprintf(__('You are logged in as %1$s, and are submitting a donation as %2$s, which is an existing donor. To ensure that the email address is tied to the correct donor, please submit this donation from a logged-out browser, or choose another email address.', 'give'), $donor->email, $submitted_email));
197 196
 			}
198 197
 		}
199 198
 	}
200 199
 }
201 200
 
202
-add_action( 'give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 2 );
201
+add_action('give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 2);
203 202
 
204 203
 /**
205 204
  * Process the checkout login form
@@ -209,49 +208,49 @@  discard block
 block discarded – undo
209 208
  * @return      void
210 209
  */
211 210
 function give_process_form_login() {
212
-	$is_ajax = isset( $_POST['give_ajax'] );
211
+	$is_ajax = isset($_POST['give_ajax']);
213 212
 
214 213
 	$user_data = give_donation_form_validate_user_login();
215 214
 
216
-	if ( give_get_errors() || $user_data['user_id'] < 1 ) {
217
-		if ( $is_ajax ) {
215
+	if (give_get_errors() || $user_data['user_id'] < 1) {
216
+		if ($is_ajax) {
218 217
 			/**
219 218
 			 * Fires when AJAX sends back errors from the donation form.
220 219
 			 *
221 220
 			 * @since 1.0
222 221
 			 */
223 222
 			ob_start();
224
-			do_action( 'give_ajax_donation_errors' );
223
+			do_action('give_ajax_donation_errors');
225 224
 			$message = ob_get_contents();
226 225
 			ob_end_clean();
227
-			wp_send_json_error( $message );
226
+			wp_send_json_error($message);
228 227
 		} else {
229
-			wp_redirect( $_SERVER['HTTP_REFERER'] );
228
+			wp_redirect($_SERVER['HTTP_REFERER']);
230 229
 			exit;
231 230
 		}
232 231
 	}
233 232
 
234
-	give_log_user_in( $user_data['user_id'], $user_data['user_login'], $user_data['user_pass'] );
233
+	give_log_user_in($user_data['user_id'], $user_data['user_login'], $user_data['user_pass']);
235 234
 
236
-	if ( $is_ajax ) {
235
+	if ($is_ajax) {
237 236
 		$message = Give()->notices->print_frontend_notice(
238 237
 			sprintf(
239 238
 			/* translators: %s: user first name */
240
-				esc_html__( 'Welcome %s! You have successfully logged into your account.', 'give' ),
241
-				( ! empty( $user_data['user_first'] ) ) ? $user_data['user_first'] : $user_data['user_login']
239
+				esc_html__('Welcome %s! You have successfully logged into your account.', 'give'),
240
+				( ! empty($user_data['user_first'])) ? $user_data['user_first'] : $user_data['user_login']
242 241
 			),
243 242
 			false,
244 243
 			'success'
245 244
 		);
246 245
 
247
-		wp_send_json_success( $message );
246
+		wp_send_json_success($message);
248 247
 	} else {
249
-		wp_redirect( $_SERVER['HTTP_REFERER'] );
248
+		wp_redirect($_SERVER['HTTP_REFERER']);
250 249
 	}
251 250
 }
252 251
 
253
-add_action( 'wp_ajax_give_process_donation_login', 'give_process_form_login' );
254
-add_action( 'wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login' );
252
+add_action('wp_ajax_give_process_donation_login', 'give_process_form_login');
253
+add_action('wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login');
255 254
 
256 255
 /**
257 256
  * Donation Form Validate Fields.
@@ -263,63 +262,63 @@  discard block
 block discarded – undo
263 262
 function give_donation_form_validate_fields() {
264 263
 
265 264
 	// Check if there is $_POST.
266
-	if ( empty( $_POST ) ) {
265
+	if (empty($_POST)) {
267 266
 		return false;
268 267
 	}
269 268
 
270
-	$form_id = ! empty( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
269
+	$form_id = ! empty($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
271 270
 
272 271
 	// Start an array to collect valid data.
273 272
 	$valid_data = array(
274 273
 		'gateway'          => give_donation_form_validate_gateway(), // Gateway fallback (amount is validated here).
275
-		'need_new_user'    => false,     // New user flag.
276
-		'need_user_login'  => false,     // Login user flag.
277
-		'logged_user_data' => array(),   // Logged user collected data.
278
-		'new_user_data'    => array(),   // New user collected data.
279
-		'login_user_data'  => array(),   // Login user collected data.
280
-		'guest_user_data'  => array(),   // Guest user collected data.
281
-		'cc_info'          => give_donation_form_validate_cc(),// Credit card info.
274
+		'need_new_user'    => false, // New user flag.
275
+		'need_user_login'  => false, // Login user flag.
276
+		'logged_user_data' => array(), // Logged user collected data.
277
+		'new_user_data'    => array(), // New user collected data.
278
+		'login_user_data'  => array(), // Login user collected data.
279
+		'guest_user_data'  => array(), // Guest user collected data.
280
+		'cc_info'          => give_donation_form_validate_cc(), // Credit card info.
282 281
 	);
283 282
 
284 283
 	// Validate Honeypot First.
285
-	if ( ! empty( $_POST['give-honeypot'] ) ) {
286
-		give_set_error( 'invalid_honeypot', esc_html__( 'Honeypot field detected. Go away bad bot!', 'give' ) );
284
+	if ( ! empty($_POST['give-honeypot'])) {
285
+		give_set_error('invalid_honeypot', esc_html__('Honeypot field detected. Go away bad bot!', 'give'));
287 286
 	}
288 287
 
289 288
 	// Check spam detect.
290
-	if ( isset( $_POST['action'] )
291
-	     && give_is_setting_enabled( give_get_option( 'akismet_spam_protection' ) )
289
+	if (isset($_POST['action'])
290
+	     && give_is_setting_enabled(give_get_option('akismet_spam_protection'))
292 291
 	     && give_is_spam_donation()
293 292
 	) {
294
-		give_set_error( 'invalid_donation', __( 'This donation has been flagged as spam. Please try again.', 'give' ) );
293
+		give_set_error('invalid_donation', __('This donation has been flagged as spam. Please try again.', 'give'));
295 294
 	}
296 295
 
297 296
 	// Validate agree to terms.
298
-	if ( give_is_terms_enabled( $form_id ) ) {
297
+	if (give_is_terms_enabled($form_id)) {
299 298
 		give_donation_form_validate_agree_to_terms();
300 299
 	}
301 300
 
302 301
 	// Stop processing donor registration, if donor registration is optional and donor can do guest checkout.
303 302
 	// If registration form username field is empty that means donor does want to registration instead wants guest checkout.
304 303
 	if (
305
-		! give_logged_in_only( $form_id )
306
-		&& isset( $_POST['give-purchase-var'] )
304
+		! give_logged_in_only($form_id)
305
+		&& isset($_POST['give-purchase-var'])
307 306
 		&& $_POST['give-purchase-var'] == 'needs-to-register'
308
-		&& empty( $_POST['give_user_login'] )
307
+		&& empty($_POST['give_user_login'])
309 308
 	) {
310
-		unset( $_POST['give-purchase-var'] );
309
+		unset($_POST['give-purchase-var']);
311 310
 	}
312 311
 
313
-	if ( is_user_logged_in() ) {
312
+	if (is_user_logged_in()) {
314 313
 		// Collect logged in user data.
315 314
 		$valid_data['logged_in_user'] = give_donation_form_validate_logged_in_user();
316
-	} elseif ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-register' ) {
315
+	} elseif (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-register') {
317 316
 		// Set new user registration as required.
318 317
 		$valid_data['need_new_user'] = true;
319 318
 		// Validate new user data.
320 319
 		$valid_data['new_user_data'] = give_donation_form_validate_new_user();
321 320
 		// Check if login validation is needed.
322
-	} elseif ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-login' ) {
321
+	} elseif (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-login') {
323 322
 		// Set user login as required.
324 323
 		$valid_data['need_user_login'] = true;
325 324
 		// Validate users login info.
@@ -343,14 +342,14 @@  discard block
 block discarded – undo
343 342
 function give_is_spam_donation() {
344 343
 	$spam = false;
345 344
 
346
-	$user_agent = (string) isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '';
345
+	$user_agent = (string) isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
347 346
 
348
-	if ( strlen( $user_agent ) < 2 ) {
347
+	if (strlen($user_agent) < 2) {
349 348
 		$spam = true;
350 349
 	}
351 350
 
352 351
 	// Allow developer to customized Akismet spam detect API call and it's response.
353
-	return apply_filters( 'give_spam', $spam );
352
+	return apply_filters('give_spam', $spam);
354 353
 }
355 354
 
356 355
 /**
@@ -364,41 +363,41 @@  discard block
 block discarded – undo
364 363
  */
365 364
 function give_donation_form_validate_gateway() {
366 365
 
367
-	$form_id = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
368
-	$amount  = isset( $_REQUEST['give-amount'] ) ? give_maybe_sanitize_amount( $_REQUEST['give-amount'] ) : 0;
369
-	$gateway = give_get_default_gateway( $form_id );
366
+	$form_id = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
367
+	$amount  = isset($_REQUEST['give-amount']) ? give_maybe_sanitize_amount($_REQUEST['give-amount']) : 0;
368
+	$gateway = give_get_default_gateway($form_id);
370 369
 
371 370
 	// Check if a gateway value is present.
372
-	if ( ! empty( $_REQUEST['give-gateway'] ) ) {
371
+	if ( ! empty($_REQUEST['give-gateway'])) {
373 372
 
374
-		$gateway = sanitize_text_field( $_REQUEST['give-gateway'] );
373
+		$gateway = sanitize_text_field($_REQUEST['give-gateway']);
375 374
 
376 375
 		// Is amount being donated in LIVE mode 0.00? If so, error:
377
-		if ( $amount == 0 && ! give_is_test_mode() ) {
376
+		if ($amount == 0 && ! give_is_test_mode()) {
378 377
 
379
-			give_set_error( 'invalid_donation_amount', __( 'Please insert a valid donation amount.', 'give' ) );
378
+			give_set_error('invalid_donation_amount', __('Please insert a valid donation amount.', 'give'));
380 379
 
381 380
 		} // End if().
382
-		elseif ( ! give_verify_minimum_price() ) {
381
+		elseif ( ! give_verify_minimum_price()) {
383 382
 			// translators: %s: minimum donation amount.
384 383
 			give_set_error(
385 384
 				'invalid_donation_minimum',
386 385
 				sprintf(
387 386
 				/* translators: %s: minimum donation amount */
388
-					__( 'This form has a minimum donation amount of %s.', 'give' ),
389
-					give_currency_filter( give_format_amount( give_get_form_minimum_price( $form_id ), array( 'sanitize' => false ) ) )
387
+					__('This form has a minimum donation amount of %s.', 'give'),
388
+					give_currency_filter(give_format_amount(give_get_form_minimum_price($form_id), array('sanitize' => false)))
390 389
 				)
391 390
 			);
392 391
 
393 392
 		} //Is this test mode zero donation? Let it through but set to manual gateway.
394
-		elseif ( $amount == 0 && give_is_test_mode() ) {
393
+		elseif ($amount == 0 && give_is_test_mode()) {
395 394
 
396 395
 			$gateway = 'manual';
397 396
 
398 397
 		} //Check if this gateway is active.
399
-		elseif ( ! give_is_gateway_active( $gateway ) ) {
398
+		elseif ( ! give_is_gateway_active($gateway)) {
400 399
 
401
-			give_set_error( 'invalid_gateway', __( 'The selected payment gateway is not enabled.', 'give' ) );
400
+			give_set_error('invalid_gateway', __('The selected payment gateway is not enabled.', 'give'));
402 401
 
403 402
 		}
404 403
 	}
@@ -416,21 +415,21 @@  discard block
 block discarded – undo
416 415
  */
417 416
 function give_verify_minimum_price() {
418 417
 
419
-	$amount          = give_maybe_sanitize_amount( $_REQUEST['give-amount'] );
420
-	$form_id         = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
421
-	$price_id        = isset( $_REQUEST['give-price-id'] ) ? $_REQUEST['give-price-id'] : null;
422
-	$variable_prices = give_has_variable_prices( $form_id );
418
+	$amount          = give_maybe_sanitize_amount($_REQUEST['give-amount']);
419
+	$form_id         = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
420
+	$price_id        = isset($_REQUEST['give-price-id']) ? $_REQUEST['give-price-id'] : null;
421
+	$variable_prices = give_has_variable_prices($form_id);
423 422
 
424
-	if ( $variable_prices && in_array( $price_id, give_get_variable_price_ids( $form_id ) ) ) {
423
+	if ($variable_prices && in_array($price_id, give_get_variable_price_ids($form_id))) {
425 424
 
426
-		$price_level_amount = give_get_price_option_amount( $form_id, $price_id );
425
+		$price_level_amount = give_get_price_option_amount($form_id, $price_id);
427 426
 
428
-		if ( $price_level_amount == $amount ) {
427
+		if ($price_level_amount == $amount) {
429 428
 			return true;
430 429
 		}
431 430
 	}
432 431
 
433
-	if ( give_get_form_minimum_price( $form_id ) > $amount ) {
432
+	if (give_get_form_minimum_price($form_id) > $amount) {
434 433
 		return false;
435 434
 	}
436 435
 
@@ -446,9 +445,9 @@  discard block
 block discarded – undo
446 445
  */
447 446
 function give_donation_form_validate_agree_to_terms() {
448 447
 	// Validate agree to terms.
449
-	if ( ! isset( $_POST['give_agree_to_terms'] ) || $_POST['give_agree_to_terms'] != 1 ) {
448
+	if ( ! isset($_POST['give_agree_to_terms']) || $_POST['give_agree_to_terms'] != 1) {
450 449
 		// User did not agree.
451
-		give_set_error( 'agree_to_terms', apply_filters( 'give_agree_to_terms_text', __( 'You must agree to the terms and conditions.', 'give' ) ) );
450
+		give_set_error('agree_to_terms', apply_filters('give_agree_to_terms_text', __('You must agree to the terms and conditions.', 'give')));
452 451
 	}
453 452
 }
454 453
 
@@ -462,59 +461,59 @@  discard block
 block discarded – undo
462 461
  *
463 462
  * @return      array
464 463
  */
465
-function give_get_required_fields( $form_id ) {
464
+function give_get_required_fields($form_id) {
466 465
 
467
-	$payment_mode = give_get_chosen_gateway( $form_id );
466
+	$payment_mode = give_get_chosen_gateway($form_id);
468 467
 
469 468
 	$required_fields = array(
470 469
 		'give_email' => array(
471 470
 			'error_id'      => 'invalid_email',
472
-			'error_message' => __( 'Please enter a valid email address.', 'give' ),
471
+			'error_message' => __('Please enter a valid email address.', 'give'),
473 472
 		),
474 473
 		'give_first' => array(
475 474
 			'error_id'      => 'invalid_first_name',
476
-			'error_message' => __( 'Please enter your first name.', 'give' ),
475
+			'error_message' => __('Please enter your first name.', 'give'),
477 476
 		),
478 477
 	);
479 478
 
480
-	$require_address = give_require_billing_address( $payment_mode );
479
+	$require_address = give_require_billing_address($payment_mode);
481 480
 
482
-	if ( $require_address ) {
483
-		$required_fields['card_address']    = array(
481
+	if ($require_address) {
482
+		$required_fields['card_address'] = array(
484 483
 			'error_id'      => 'invalid_card_address',
485
-			'error_message' => __( 'Please enter your primary billing address.', 'give' ),
484
+			'error_message' => __('Please enter your primary billing address.', 'give'),
486 485
 		);
487
-		$required_fields['card_zip']        = array(
486
+		$required_fields['card_zip'] = array(
488 487
 			'error_id'      => 'invalid_zip_code',
489
-			'error_message' => __( 'Please enter your zip / postal code.', 'give' ),
488
+			'error_message' => __('Please enter your zip / postal code.', 'give'),
490 489
 		);
491
-		$required_fields['card_city']       = array(
490
+		$required_fields['card_city'] = array(
492 491
 			'error_id'      => 'invalid_city',
493
-			'error_message' => __( 'Please enter your billing city.', 'give' ),
492
+			'error_message' => __('Please enter your billing city.', 'give'),
494 493
 		);
495 494
 		$required_fields['billing_country'] = array(
496 495
 			'error_id'      => 'invalid_country',
497
-			'error_message' => __( 'Please select your billing country.', 'give' ),
496
+			'error_message' => __('Please select your billing country.', 'give'),
498 497
 		);
499 498
 
500 499
 
501 500
 		$required_fields['card_state'] = array(
502 501
 			'error_id'      => 'invalid_state',
503
-			'error_message' => __( 'Please enter billing state / province / County.', 'give' ),
502
+			'error_message' => __('Please enter billing state / province / County.', 'give'),
504 503
 		);
505 504
 
506 505
 		// Check if billing country already exists.
507
-		if ( ! empty( $_POST['billing_country'] ) ) {
506
+		if ( ! empty($_POST['billing_country'])) {
508 507
 			// Get the value from $_POST.
509
-			$country = sanitize_text_field( $_POST['billing_country'] );
508
+			$country = sanitize_text_field($_POST['billing_country']);
510 509
 
511 510
 			// Get the country list that does not required any states init.
512 511
 			$states_country = give_states_not_required_country_list();
513 512
 
514 513
 			// Check if states is empty or not.
515
-			if ( array_key_exists( $country, $states_country ) ) {
514
+			if (array_key_exists($country, $states_country)) {
516 515
 				// If states is empty remove the required feilds of state in billing cart.
517
-				unset( $required_fields['card_state'] );
516
+				unset($required_fields['card_state']);
518 517
 			}
519 518
 		}
520 519
 	}
@@ -524,7 +523,7 @@  discard block
 block discarded – undo
524 523
 	 *
525 524
 	 * @since 1.7
526 525
 	 */
527
-	$required_fields = apply_filters( 'give_donation_form_required_fields', $required_fields, $form_id );
526
+	$required_fields = apply_filters('give_donation_form_required_fields', $required_fields, $form_id);
528 527
 
529 528
 	return $required_fields;
530 529
 
@@ -539,16 +538,16 @@  discard block
 block discarded – undo
539 538
  *
540 539
  * @return bool
541 540
  */
542
-function give_require_billing_address( $payment_mode ) {
541
+function give_require_billing_address($payment_mode) {
543 542
 
544 543
 	$return = false;
545 544
 
546
-	if ( isset( $_POST['billing_country'] ) || did_action( "give_{$payment_mode}_cc_form" ) || did_action( 'give_cc_form' ) ) {
545
+	if (isset($_POST['billing_country']) || did_action("give_{$payment_mode}_cc_form") || did_action('give_cc_form')) {
547 546
 		$return = true;
548 547
 	}
549 548
 
550 549
 	// Let payment gateways and other extensions determine if address fields should be required.
551
-	return apply_filters( 'give_require_billing_address', $return );
550
+	return apply_filters('give_require_billing_address', $return);
552 551
 
553 552
 }
554 553
 
@@ -562,42 +561,42 @@  discard block
 block discarded – undo
562 561
 function give_donation_form_validate_logged_in_user() {
563 562
 	global $user_ID;
564 563
 
565
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
564
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
566 565
 
567 566
 	// Start empty array to collect valid user data.
568 567
 	$valid_user_data = array(
569 568
 		// Assume there will be errors.
570
-		'user_id' => - 1,
569
+		'user_id' => -1,
571 570
 	);
572 571
 
573 572
 	// Verify there is a user_ID.
574
-	if ( $user_ID > 0 ) {
573
+	if ($user_ID > 0) {
575 574
 		// Get the logged in user data.
576
-		$user_data = get_userdata( $user_ID );
575
+		$user_data = get_userdata($user_ID);
577 576
 
578 577
 		// Loop through required fields and show error messages.
579
-		foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
580
-			if ( in_array( $value, give_get_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
581
-				give_set_error( $value['error_id'], $value['error_message'] );
578
+		foreach (give_get_required_fields($form_id) as $field_name => $value) {
579
+			if (in_array($value, give_get_required_fields($form_id)) && empty($_POST[$field_name])) {
580
+				give_set_error($value['error_id'], $value['error_message']);
582 581
 			}
583 582
 		}
584 583
 
585 584
 		// Verify data.
586
-		if ( $user_data ) {
585
+		if ($user_data) {
587 586
 			// Collected logged in user data.
588 587
 			$valid_user_data = array(
589 588
 				'user_id'    => $user_ID,
590
-				'user_email' => isset( $_POST['give_email'] ) ? sanitize_email( $_POST['give_email'] ) : $user_data->user_email,
591
-				'user_first' => isset( $_POST['give_first'] ) && ! empty( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : $user_data->first_name,
592
-				'user_last'  => isset( $_POST['give_last'] ) && ! empty( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : $user_data->last_name,
589
+				'user_email' => isset($_POST['give_email']) ? sanitize_email($_POST['give_email']) : $user_data->user_email,
590
+				'user_first' => isset($_POST['give_first']) && ! empty($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : $user_data->first_name,
591
+				'user_last'  => isset($_POST['give_last']) && ! empty($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : $user_data->last_name,
593 592
 			);
594 593
 
595
-			if ( ! is_email( $valid_user_data['user_email'] ) ) {
596
-				give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) );
594
+			if ( ! is_email($valid_user_data['user_email'])) {
595
+				give_set_error('email_invalid', esc_html__('Invalid email.', 'give'));
597 596
 			}
598 597
 		} else {
599 598
 			// Set invalid user error.
600
-			give_set_error( 'invalid_user', esc_html__( 'The user information is invalid.', 'give' ) );
599
+			give_set_error('invalid_user', esc_html__('The user information is invalid.', 'give'));
601 600
 		}
602 601
 	}
603 602
 
@@ -616,7 +615,7 @@  discard block
 block discarded – undo
616 615
 	// Default user data.
617 616
 	$default_user_data = array(
618 617
 		'give-form-id'           => '',
619
-		'user_id'                => - 1, // Assume there will be errors.
618
+		'user_id'                => -1, // Assume there will be errors.
620 619
 		'user_first'             => '',
621 620
 		'user_last'              => '',
622 621
 		'give_user_login'        => false,
@@ -626,14 +625,14 @@  discard block
 block discarded – undo
626 625
 	);
627 626
 
628 627
 	// Get user data.
629
-	$user_data            = wp_parse_args( give_clean( $_POST ), $default_user_data );
628
+	$user_data            = wp_parse_args(give_clean($_POST), $default_user_data);
630 629
 	$registering_new_user = false;
631
-	$form_id              = absint( $user_data['give-form-id'] );
630
+	$form_id              = absint($user_data['give-form-id']);
632 631
 
633 632
 	// Start an empty array to collect valid user data.
634 633
 	$valid_user_data = array(
635 634
 		// Assume there will be errors.
636
-		'user_id'    => - 1,
635
+		'user_id'    => -1,
637 636
 
638 637
 		// Get first name.
639 638
 		'user_first' => $user_data['give_first'],
@@ -643,25 +642,25 @@  discard block
 block discarded – undo
643 642
 	);
644 643
 
645 644
 	// Loop through required fields and show error messages.
646
-	foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
647
-		if ( in_array( $value, give_get_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
648
-			give_set_error( $value['error_id'], $value['error_message'] );
645
+	foreach (give_get_required_fields($form_id) as $field_name => $value) {
646
+		if (in_array($value, give_get_required_fields($form_id)) && empty($_POST[$field_name])) {
647
+			give_set_error($value['error_id'], $value['error_message']);
649 648
 		}
650 649
 	}
651 650
 
652 651
 	// Check if we have an username to register.
653
-	if ( give_validate_username( $user_data['give_user_login'] ) ) {
652
+	if (give_validate_username($user_data['give_user_login'])) {
654 653
 		$registering_new_user          = true;
655 654
 		$valid_user_data['user_login'] = $user_data['give_user_login'];
656 655
 	}
657 656
 
658 657
 	// Check if we have an email to verify.
659
-	if ( give_validate_user_email( $user_data['give_email'], $registering_new_user ) ) {
658
+	if (give_validate_user_email($user_data['give_email'], $registering_new_user)) {
660 659
 		$valid_user_data['user_email'] = $user_data['give_email'];
661 660
 	}
662 661
 
663 662
 	// Check password.
664
-	if ( give_validate_user_password( $user_data['give_user_pass'], $user_data['give_user_pass_confirm'], $registering_new_user ) ) {
663
+	if (give_validate_user_password($user_data['give_user_pass'], $user_data['give_user_pass_confirm'], $registering_new_user)) {
665 664
 		// All is good to go.
666 665
 		$valid_user_data['user_pass'] = $user_data['give_user_pass'];
667 666
 	}
@@ -681,36 +680,36 @@  discard block
 block discarded – undo
681 680
 	// Start an array to collect valid user data.
682 681
 	$valid_user_data = array(
683 682
 		// Assume there will be errors.
684
-		'user_id' => - 1,
683
+		'user_id' => -1,
685 684
 	);
686 685
 
687 686
 	// Username.
688
-	if ( ! isset( $_POST['give_user_login'] ) || $_POST['give_user_login'] == '' ) {
689
-		give_set_error( 'must_log_in', __( 'You must register or login to complete your donation.', 'give' ) );
687
+	if ( ! isset($_POST['give_user_login']) || $_POST['give_user_login'] == '') {
688
+		give_set_error('must_log_in', __('You must register or login to complete your donation.', 'give'));
690 689
 
691 690
 		return $valid_user_data;
692 691
 	}
693 692
 
694 693
 	// Get the user by login.
695
-	$user_data = get_user_by( 'login', strip_tags( $_POST['give_user_login'] ) );
694
+	$user_data = get_user_by('login', strip_tags($_POST['give_user_login']));
696 695
 
697 696
 	// Check if user exists.
698
-	if ( $user_data ) {
697
+	if ($user_data) {
699 698
 		// Get password.
700
-		$user_pass = isset( $_POST['give_user_pass'] ) ? $_POST['give_user_pass'] : false;
699
+		$user_pass = isset($_POST['give_user_pass']) ? $_POST['give_user_pass'] : false;
701 700
 
702 701
 		// Check user_pass.
703
-		if ( $user_pass ) {
702
+		if ($user_pass) {
704 703
 			// Check if password is valid.
705
-			if ( ! wp_check_password( $user_pass, $user_data->user_pass, $user_data->ID ) ) {
704
+			if ( ! wp_check_password($user_pass, $user_data->user_pass, $user_data->ID)) {
706 705
 				// Incorrect password.
707 706
 				give_set_error(
708 707
 					'password_incorrect',
709 708
 					sprintf(
710 709
 						'%1$s <a href="%2$s">%3$s</a>',
711
-						__( 'The password you entered is incorrect.', 'give' ),
712
-						wp_lostpassword_url( "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" ),
713
-						__( 'Reset Password', 'give' )
710
+						__('The password you entered is incorrect.', 'give'),
711
+						wp_lostpassword_url("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"),
712
+						__('Reset Password', 'give')
714 713
 					)
715 714
 				);
716 715
 				// All is correct.
@@ -728,11 +727,11 @@  discard block
 block discarded – undo
728 727
 			}
729 728
 		} else {
730 729
 			// Empty password.
731
-			give_set_error( 'password_empty', __( 'Enter a password.', 'give' ) );
730
+			give_set_error('password_empty', __('Enter a password.', 'give'));
732 731
 		}
733 732
 	} else {
734 733
 		// No username.
735
-		give_set_error( 'username_incorrect', __( 'The username you entered does not exist.', 'give' ) );
734
+		give_set_error('username_incorrect', __('The username you entered does not exist.', 'give'));
736 735
 	}// End if().
737 736
 
738 737
 	return $valid_user_data;
@@ -747,7 +746,7 @@  discard block
 block discarded – undo
747 746
  */
748 747
 function give_donation_form_validate_guest_user() {
749 748
 
750
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
749
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
751 750
 
752 751
 	// Start an array to collect valid user data.
753 752
 	$valid_user_data = array(
@@ -756,38 +755,38 @@  discard block
 block discarded – undo
756 755
 	);
757 756
 
758 757
 	// Show error message if user must be logged in.
759
-	if ( give_logged_in_only( $form_id ) ) {
760
-		give_set_error( 'logged_in_only', __( 'You must be logged in to donate.', 'give' ) );
758
+	if (give_logged_in_only($form_id)) {
759
+		give_set_error('logged_in_only', __('You must be logged in to donate.', 'give'));
761 760
 	}
762 761
 
763 762
 	// Get the guest email.
764
-	$guest_email = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false;
763
+	$guest_email = isset($_POST['give_email']) ? $_POST['give_email'] : false;
765 764
 
766 765
 	// Check email.
767
-	if ( $guest_email && strlen( $guest_email ) > 0 ) {
766
+	if ($guest_email && strlen($guest_email) > 0) {
768 767
 		// Validate email.
769
-		if ( ! is_email( $guest_email ) ) {
768
+		if ( ! is_email($guest_email)) {
770 769
 			// Invalid email.
771
-			give_set_error( 'email_invalid', __( 'Invalid email.', 'give' ) );
770
+			give_set_error('email_invalid', __('Invalid email.', 'give'));
772 771
 		} else {
773 772
 			// All is good to go.
774 773
 			$valid_user_data['user_email'] = $guest_email;
775 774
 
776 775
 			// Get user_id from donor if exist.
777
-			$donor = new Give_Donor( $guest_email );
778
-			if ( $donor->id && $donor->user_id ) {
776
+			$donor = new Give_Donor($guest_email);
777
+			if ($donor->id && $donor->user_id) {
779 778
 				$valid_user_data['user_id'] = $donor->user_id;
780 779
 			}
781 780
 		}
782 781
 	} else {
783 782
 		// No email.
784
-		give_set_error( 'email_empty', __( 'Enter an email.', 'give' ) );
783
+		give_set_error('email_empty', __('Enter an email.', 'give'));
785 784
 	}
786 785
 
787 786
 	// Loop through required fields and show error messages.
788
-	foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
789
-		if ( in_array( $value, give_get_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
790
-			give_set_error( $value['error_id'], $value['error_message'] );
787
+	foreach (give_get_required_fields($form_id) as $field_name => $value) {
788
+		if (in_array($value, give_get_required_fields($form_id)) && empty($_POST[$field_name])) {
789
+			give_set_error($value['error_id'], $value['error_message']);
791 790
 		}
792 791
 	}
793 792
 
@@ -803,36 +802,36 @@  discard block
 block discarded – undo
803 802
  * @since   1.0
804 803
  * @return  integer
805 804
  */
806
-function give_register_and_login_new_user( $user_data = array() ) {
805
+function give_register_and_login_new_user($user_data = array()) {
807 806
 	// Verify the array.
808
-	if ( empty( $user_data ) ) {
809
-		return - 1;
807
+	if (empty($user_data)) {
808
+		return -1;
810 809
 	}
811 810
 
812
-	if ( give_get_errors() ) {
813
-		return - 1;
811
+	if (give_get_errors()) {
812
+		return -1;
814 813
 	}
815 814
 
816
-	$user_args = apply_filters( 'give_insert_user_args', array(
817
-		'user_login'      => isset( $user_data['user_login'] ) ? $user_data['user_login'] : '',
818
-		'user_pass'       => isset( $user_data['user_pass'] ) ? $user_data['user_pass'] : '',
819
-		'user_email'      => isset( $user_data['user_email'] ) ? $user_data['user_email'] : '',
820
-		'first_name'      => isset( $user_data['user_first'] ) ? $user_data['user_first'] : '',
821
-		'last_name'       => isset( $user_data['user_last'] ) ? $user_data['user_last'] : '',
822
-		'user_registered' => date( 'Y-m-d H:i:s' ),
823
-		'role'            => give_get_option( 'donor_default_user_role', 'give_donor' ),
824
-	), $user_data );
815
+	$user_args = apply_filters('give_insert_user_args', array(
816
+		'user_login'      => isset($user_data['user_login']) ? $user_data['user_login'] : '',
817
+		'user_pass'       => isset($user_data['user_pass']) ? $user_data['user_pass'] : '',
818
+		'user_email'      => isset($user_data['user_email']) ? $user_data['user_email'] : '',
819
+		'first_name'      => isset($user_data['user_first']) ? $user_data['user_first'] : '',
820
+		'last_name'       => isset($user_data['user_last']) ? $user_data['user_last'] : '',
821
+		'user_registered' => date('Y-m-d H:i:s'),
822
+		'role'            => give_get_option('donor_default_user_role', 'give_donor'),
823
+	), $user_data);
825 824
 
826 825
 	// Insert new user.
827
-	$user_id = wp_insert_user( $user_args );
826
+	$user_id = wp_insert_user($user_args);
828 827
 
829 828
 	// Validate inserted user.
830
-	if ( is_wp_error( $user_id ) ) {
831
-		return - 1;
829
+	if (is_wp_error($user_id)) {
830
+		return -1;
832 831
 	}
833 832
 
834 833
 	// Allow themes and plugins to filter the user data.
835
-	$user_data = apply_filters( 'give_insert_user_data', $user_data, $user_args );
834
+	$user_data = apply_filters('give_insert_user_data', $user_data, $user_args);
836 835
 
837 836
 	/**
838 837
 	 * Fires after inserting user.
@@ -842,7 +841,7 @@  discard block
 block discarded – undo
842 841
 	 * @param int $user_id User id.
843 842
 	 * @param array $user_data Array containing user data.
844 843
 	 */
845
-	do_action( 'give_insert_user', $user_id, $user_data );
844
+	do_action('give_insert_user', $user_id, $user_data);
846 845
 
847 846
 	/**
848 847
 	 * Filter allow user to alter if user when to login or not when user is register for the first time.
@@ -851,9 +850,9 @@  discard block
 block discarded – undo
851 850
 	 *
852 851
 	 * return bool True if login with registration and False if only want to register.
853 852
 	 */
854
-	if ( true === (bool) apply_filters( 'give_log_user_in_on_register', true ) ) {
853
+	if (true === (bool) apply_filters('give_log_user_in_on_register', true)) {
855 854
 		// Login new user.
856
-		give_log_user_in( $user_id, $user_data['user_login'], $user_data['user_pass'] );
855
+		give_log_user_in($user_id, $user_data['user_login'], $user_data['user_pass']);
857 856
 	}
858 857
 
859 858
 	// Return user id.
@@ -869,27 +868,27 @@  discard block
 block discarded – undo
869 868
  * @since   1.0
870 869
  * @return  array|bool
871 870
  */
872
-function give_get_donation_form_user( $valid_data = array() ) {
871
+function give_get_donation_form_user($valid_data = array()) {
873 872
 
874 873
 	// Initialize user.
875 874
 	$user    = false;
876
-	$is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
875
+	$is_ajax = defined('DOING_AJAX') && DOING_AJAX;
877 876
 
878
-	if ( $is_ajax ) {
877
+	if ($is_ajax) {
879 878
 		// Do not create or login the user during the ajax submission (check for errors only).
880 879
 		return true;
881
-	} elseif ( is_user_logged_in() ) {
880
+	} elseif (is_user_logged_in()) {
882 881
 		// Set the valid user as the logged in collected data.
883 882
 		$user = $valid_data['logged_in_user'];
884
-	} elseif ( $valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true ) {
883
+	} elseif ($valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true) {
885 884
 		// New user registration.
886
-		if ( $valid_data['need_new_user'] === true ) {
885
+		if ($valid_data['need_new_user'] === true) {
887 886
 			// Set user.
888 887
 			$user = $valid_data['new_user_data'];
889 888
 			// Register and login new user.
890
-			$user['user_id'] = give_register_and_login_new_user( $user );
889
+			$user['user_id'] = give_register_and_login_new_user($user);
891 890
 			// User login
892
-		} elseif ( $valid_data['need_user_login'] === true && ! $is_ajax ) {
891
+		} elseif ($valid_data['need_user_login'] === true && ! $is_ajax) {
893 892
 
894 893
 			/**
895 894
 			 * The login form is now processed in the give_process_donation_login() function.
@@ -901,48 +900,48 @@  discard block
 block discarded – undo
901 900
 			// Set user.
902 901
 			$user = $valid_data['login_user_data'];
903 902
 			// Login user.
904
-			give_log_user_in( $user['user_id'], $user['user_login'], $user['user_pass'] );
903
+			give_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']);
905 904
 		}
906 905
 	}
907 906
 
908 907
 	// Check guest checkout.
909
-	if ( false === $user && false === give_logged_in_only( $_POST['give-form-id'] ) ) {
908
+	if (false === $user && false === give_logged_in_only($_POST['give-form-id'])) {
910 909
 		// Set user
911 910
 		$user = $valid_data['guest_user_data'];
912 911
 	}
913 912
 
914 913
 	// Verify we have an user.
915
-	if ( false === $user || empty( $user ) ) {
914
+	if (false === $user || empty($user)) {
916 915
 		// Return false.
917 916
 		return false;
918 917
 	}
919 918
 
920 919
 	// Get user first name.
921
-	if ( ! isset( $user['user_first'] ) || strlen( trim( $user['user_first'] ) ) < 1 ) {
922
-		$user['user_first'] = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : '';
920
+	if ( ! isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) {
921
+		$user['user_first'] = isset($_POST['give_first']) ? strip_tags(trim($_POST['give_first'])) : '';
923 922
 	}
924 923
 
925 924
 	// Get user last name.
926
-	if ( ! isset( $user['user_last'] ) || strlen( trim( $user['user_last'] ) ) < 1 ) {
927
-		$user['user_last'] = isset( $_POST['give_last'] ) ? strip_tags( trim( $_POST['give_last'] ) ) : '';
925
+	if ( ! isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) {
926
+		$user['user_last'] = isset($_POST['give_last']) ? strip_tags(trim($_POST['give_last'])) : '';
928 927
 	}
929 928
 
930 929
 	// Get the user's billing address details.
931 930
 	$user['address']            = array();
932
-	$user['address']['line1']   = ! empty( $_POST['card_address'] ) ? give_clean( $_POST['card_address'] ) : false;
933
-	$user['address']['line2']   = ! empty( $_POST['card_address_2'] ) ? give_clean( $_POST['card_address_2'] ) : false;
934
-	$user['address']['city']    = ! empty( $_POST['card_city'] ) ? give_clean( $_POST['card_city'] ) : false;
935
-	$user['address']['state']   = ! empty( $_POST['card_state'] ) ? give_clean( $_POST['card_state'] ) : false;
936
-	$user['address']['zip']     = ! empty( $_POST['card_zip'] ) ? give_clean( $_POST['card_zip'] ) : false;
937
-	$user['address']['country'] = ! empty( $_POST['billing_country'] ) ? give_clean( $_POST['billing_country'] ) : false;
938
-
939
-	if ( empty( $user['address']['country'] ) ) {
931
+	$user['address']['line1']   = ! empty($_POST['card_address']) ? give_clean($_POST['card_address']) : false;
932
+	$user['address']['line2']   = ! empty($_POST['card_address_2']) ? give_clean($_POST['card_address_2']) : false;
933
+	$user['address']['city']    = ! empty($_POST['card_city']) ? give_clean($_POST['card_city']) : false;
934
+	$user['address']['state']   = ! empty($_POST['card_state']) ? give_clean($_POST['card_state']) : false;
935
+	$user['address']['zip']     = ! empty($_POST['card_zip']) ? give_clean($_POST['card_zip']) : false;
936
+	$user['address']['country'] = ! empty($_POST['billing_country']) ? give_clean($_POST['billing_country']) : false;
937
+
938
+	if (empty($user['address']['country'])) {
940 939
 		$user['address'] = false;
941 940
 	} // End if().
942 941
 
943
-	if ( ! empty( $user['user_id'] ) && $user['user_id'] > 0 && ! empty( $user['address'] ) ) {
942
+	if ( ! empty($user['user_id']) && $user['user_id'] > 0 && ! empty($user['address'])) {
944 943
 		// Store the address in the user's meta so the donation form can be pre-populated with it on return donation.
945
-		update_user_meta( $user['user_id'], '_give_user_address', $user['address'] );
944
+		update_user_meta($user['user_id'], '_give_user_address', $user['address']);
946 945
 	}
947 946
 
948 947
 	// Return valid user.
@@ -961,16 +960,16 @@  discard block
 block discarded – undo
961 960
 	$card_data = give_get_donation_cc_info();
962 961
 
963 962
 	// Validate the card zip.
964
-	if ( ! empty( $card_data['card_zip'] ) ) {
965
-		if ( ! give_donation_form_validate_cc_zip( $card_data['card_zip'], $card_data['card_country'] ) ) {
966
-			give_set_error( 'invalid_cc_zip', __( 'The zip / postal code you entered for your billing address is invalid.', 'give' ) );
963
+	if ( ! empty($card_data['card_zip'])) {
964
+		if ( ! give_donation_form_validate_cc_zip($card_data['card_zip'], $card_data['card_country'])) {
965
+			give_set_error('invalid_cc_zip', __('The zip / postal code you entered for your billing address is invalid.', 'give'));
967 966
 		}
968 967
 	}
969 968
 
970 969
 	// Ensure no spaces.
971
-	if ( ! empty( $card_data['card_number'] ) ) {
972
-		$card_data['card_number'] = str_replace( '+', '', $card_data['card_number'] ); // no "+" signs
973
-		$card_data['card_number'] = str_replace( ' ', '', $card_data['card_number'] ); // No spaces
970
+	if ( ! empty($card_data['card_number'])) {
971
+		$card_data['card_number'] = str_replace('+', '', $card_data['card_number']); // no "+" signs
972
+		$card_data['card_number'] = str_replace(' ', '', $card_data['card_number']); // No spaces
974 973
 	}
975 974
 
976 975
 	// This should validate card numbers at some point too.
@@ -987,17 +986,17 @@  discard block
 block discarded – undo
987 986
 function give_get_donation_cc_info() {
988 987
 
989 988
 	$cc_info                   = array();
990
-	$cc_info['card_name']      = isset( $_POST['card_name'] ) ? sanitize_text_field( $_POST['card_name'] ) : '';
991
-	$cc_info['card_number']    = isset( $_POST['card_number'] ) ? sanitize_text_field( $_POST['card_number'] ) : '';
992
-	$cc_info['card_cvc']       = isset( $_POST['card_cvc'] ) ? sanitize_text_field( $_POST['card_cvc'] ) : '';
993
-	$cc_info['card_exp_month'] = isset( $_POST['card_exp_month'] ) ? sanitize_text_field( $_POST['card_exp_month'] ) : '';
994
-	$cc_info['card_exp_year']  = isset( $_POST['card_exp_year'] ) ? sanitize_text_field( $_POST['card_exp_year'] ) : '';
995
-	$cc_info['card_address']   = isset( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : '';
996
-	$cc_info['card_address_2'] = isset( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : '';
997
-	$cc_info['card_city']      = isset( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : '';
998
-	$cc_info['card_state']     = isset( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : '';
999
-	$cc_info['card_country']   = isset( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : '';
1000
-	$cc_info['card_zip']       = isset( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : '';
989
+	$cc_info['card_name']      = isset($_POST['card_name']) ? sanitize_text_field($_POST['card_name']) : '';
990
+	$cc_info['card_number']    = isset($_POST['card_number']) ? sanitize_text_field($_POST['card_number']) : '';
991
+	$cc_info['card_cvc']       = isset($_POST['card_cvc']) ? sanitize_text_field($_POST['card_cvc']) : '';
992
+	$cc_info['card_exp_month'] = isset($_POST['card_exp_month']) ? sanitize_text_field($_POST['card_exp_month']) : '';
993
+	$cc_info['card_exp_year']  = isset($_POST['card_exp_year']) ? sanitize_text_field($_POST['card_exp_year']) : '';
994
+	$cc_info['card_address']   = isset($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : '';
995
+	$cc_info['card_address_2'] = isset($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : '';
996
+	$cc_info['card_city']      = isset($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : '';
997
+	$cc_info['card_state']     = isset($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : '';
998
+	$cc_info['card_country']   = isset($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : '';
999
+	$cc_info['card_zip']       = isset($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : '';
1001 1000
 
1002 1001
 	// Return cc info.
1003 1002
 	return $cc_info;
@@ -1013,14 +1012,14 @@  discard block
 block discarded – undo
1013 1012
  *
1014 1013
  * @return bool|mixed
1015 1014
  */
1016
-function give_donation_form_validate_cc_zip( $zip = 0, $country_code = '' ) {
1015
+function give_donation_form_validate_cc_zip($zip = 0, $country_code = '') {
1017 1016
 	$ret = false;
1018 1017
 
1019
-	if ( empty( $zip ) || empty( $country_code ) ) {
1018
+	if (empty($zip) || empty($country_code)) {
1020 1019
 		return $ret;
1021 1020
 	}
1022 1021
 
1023
-	$country_code = strtoupper( $country_code );
1022
+	$country_code = strtoupper($country_code);
1024 1023
 
1025 1024
 	$zip_regex = array(
1026 1025
 		'AD' => 'AD\d{3}',
@@ -1180,11 +1179,11 @@  discard block
 block discarded – undo
1180 1179
 		'ZM' => '\d{5}',
1181 1180
 	);
1182 1181
 
1183
-	if ( ! isset( $zip_regex[ $country_code ] ) || preg_match( '/' . $zip_regex[ $country_code ] . '/i', $zip ) ) {
1182
+	if ( ! isset($zip_regex[$country_code]) || preg_match('/'.$zip_regex[$country_code].'/i', $zip)) {
1184 1183
 		$ret = true;
1185 1184
 	}
1186 1185
 
1187
-	return apply_filters( 'give_is_zip_valid', $ret, $zip, $country_code );
1186
+	return apply_filters('give_is_zip_valid', $ret, $zip, $country_code);
1188 1187
 }
1189 1188
 
1190 1189
 
@@ -1198,47 +1197,47 @@  discard block
 block discarded – undo
1198 1197
  *
1199 1198
  * @return bool
1200 1199
  */
1201
-function give_validate_donation_amount( $valid_data, $data ) {
1200
+function give_validate_donation_amount($valid_data, $data) {
1202 1201
 	/* @var Give_Donate_Form $form */
1203
-	$form = new Give_Donate_Form( $data['give-form-id'] );
1202
+	$form = new Give_Donate_Form($data['give-form-id']);
1204 1203
 
1205 1204
 	$donation_level_matched = false;
1206 1205
 
1207
-	if ( $form->is_set_type_donation_form() ) {
1206
+	if ($form->is_set_type_donation_form()) {
1208 1207
 		// Sanitize donation amount.
1209
-		$data['give-amount'] = give_maybe_sanitize_amount( $data['give-amount'] );
1208
+		$data['give-amount'] = give_maybe_sanitize_amount($data['give-amount']);
1210 1209
 
1211 1210
 		// Backward compatibility.
1212
-		if ( $form->is_custom_price( $data['give-amount'] ) ) {
1211
+		if ($form->is_custom_price($data['give-amount'])) {
1213 1212
 			$_POST['give-price-id'] = 'custom';
1214 1213
 		}
1215 1214
 
1216 1215
 		$donation_level_matched = true;
1217 1216
 
1218
-	} elseif ( $form->is_multi_type_donation_form() ) {
1217
+	} elseif ($form->is_multi_type_donation_form()) {
1219 1218
 
1220 1219
 		// Bailout.
1221
-		if ( ! ( $variable_prices = $form->get_prices() ) ) {
1220
+		if ( ! ($variable_prices = $form->get_prices())) {
1222 1221
 			return false;
1223 1222
 		}
1224 1223
 
1225 1224
 		// Sanitize donation amount.
1226
-		$data['give-amount'] = give_maybe_sanitize_amount( $data['give-amount'] );
1225
+		$data['give-amount'] = give_maybe_sanitize_amount($data['give-amount']);
1227 1226
 
1228
-		if ( $data['give-amount'] === give_maybe_sanitize_amount( give_get_price_option_amount( $data['give-form-id'], $data['give-price-id'] ) ) ) {
1227
+		if ($data['give-amount'] === give_maybe_sanitize_amount(give_get_price_option_amount($data['give-form-id'], $data['give-price-id']))) {
1229 1228
 			return true;
1230 1229
 		}
1231 1230
 
1232
-		if ( $form->is_custom_price( $data['give-amount'] ) ) {
1231
+		if ($form->is_custom_price($data['give-amount'])) {
1233 1232
 			$_POST['give-price-id'] = 'custom';
1234 1233
 		} else {
1235 1234
 			// Find correct donation level from all donation levels.
1236
-			foreach ( $variable_prices as $variable_price ) {
1235
+			foreach ($variable_prices as $variable_price) {
1237 1236
 				// Sanitize level amount.
1238
-				$variable_price['_give_amount'] = give_maybe_sanitize_amount( $variable_price['_give_amount'] );
1237
+				$variable_price['_give_amount'] = give_maybe_sanitize_amount($variable_price['_give_amount']);
1239 1238
 
1240 1239
 				// Set first match donation level ID.
1241
-				if ( $data['give-amount'] === $variable_price['_give_amount'] ) {
1240
+				if ($data['give-amount'] === $variable_price['_give_amount']) {
1242 1241
 					$_POST['give-price-id'] = $variable_price['_give_id']['level_id'];
1243 1242
 					break;
1244 1243
 				}
@@ -1247,12 +1246,12 @@  discard block
 block discarded – undo
1247 1246
 
1248 1247
 		// If donation amount is not find in donation levels then check if form has custom donation feature enable or not.
1249 1248
 		// If yes then set price id to custom if amount is greater then custom minimum amount (if any).
1250
-		if ( ! empty( $_POST['give-price-id'] ) ) {
1249
+		if ( ! empty($_POST['give-price-id'])) {
1251 1250
 			$donation_level_matched = true;
1252 1251
 		}
1253 1252
 	}// End if().
1254 1253
 
1255
-	return ( $donation_level_matched ? true : false );
1254
+	return ($donation_level_matched ? true : false);
1256 1255
 }
1257 1256
 
1258
-add_action( 'give_checkout_error_checks', 'give_validate_donation_amount', 10, 2 );
1257
+add_action('give_checkout_error_checks', 'give_validate_donation_amount', 10, 2);
Please login to merge, or discard this patch.
includes/class-give-email-access.php 1 patch
Spacing   +71 added lines, -71 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
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	public function __construct() {
107 107
 
108 108
 		// get it started
109
-		add_action( 'init', array( $this, 'init' ) );
109
+		add_action('init', array($this, 'init'));
110 110
 	}
111 111
 
112 112
 	/**
@@ -122,28 +122,28 @@  discard block
 block discarded – undo
122 122
 	public function init() {
123 123
 
124 124
 		// Bail Out, if user is logged in.
125
-		if ( is_user_logged_in() ) {
125
+		if (is_user_logged_in()) {
126 126
 			return;
127 127
 		}
128 128
 
129 129
 		// Are db columns setup?
130
-		$column_exists = Give()->donors->does_column_exist( 'token' );
131
-		if ( ! $column_exists ) {
130
+		$column_exists = Give()->donors->does_column_exist('token');
131
+		if ( ! $column_exists) {
132 132
 			$this->create_columns();
133 133
 		}
134 134
 
135 135
 		// Timeouts.
136
-		$this->verify_throttle  = apply_filters( 'give_nl_verify_throttle', 300 );
137
-		$this->limit_throttle   = apply_filters( 'give_nl_limit_throttle', 3 );
138
-		$this->token_expiration = apply_filters( 'give_nl_token_expiration', 7200 );
136
+		$this->verify_throttle  = apply_filters('give_nl_verify_throttle', 300);
137
+		$this->limit_throttle   = apply_filters('give_nl_limit_throttle', 3);
138
+		$this->token_expiration = apply_filters('give_nl_token_expiration', 7200);
139 139
 
140 140
 		// Setup login.
141 141
 		$this->check_for_token();
142 142
 
143
-		if ( $this->token_exists ) {
144
-			add_filter( 'give_can_view_receipt', '__return_true' );
145
-			add_filter( 'give_user_pending_verification', '__return_false' );
146
-			add_filter( 'give_get_users_donations_args', array( $this, 'users_donations_args' ) );
143
+		if ($this->token_exists) {
144
+			add_filter('give_can_view_receipt', '__return_true');
145
+			add_filter('give_user_pending_verification', '__return_false');
146
+			add_filter('give_get_users_donations_args', array($this, 'users_donations_args'));
147 147
 		}
148 148
 
149 149
 	}
@@ -158,23 +158,23 @@  discard block
 block discarded – undo
158 158
 	 *
159 159
 	 * @return bool
160 160
 	 */
161
-	public function can_send_email( $donor_id ) {
161
+	public function can_send_email($donor_id) {
162 162
 
163
-		$donor = Give()->donors->get_donor_by( 'id', $donor_id );
163
+		$donor = Give()->donors->get_donor_by('id', $donor_id);
164 164
 
165
-		if ( is_object( $donor ) && count( $donor ) > 0 ) {
165
+		if (is_object($donor) && count($donor) > 0) {
166 166
 
167
-			$email_throttle_count = (int) give_get_meta( $donor_id, '_give_email_throttle_count', true );
167
+			$email_throttle_count = (int) give_get_meta($donor_id, '_give_email_throttle_count', true);
168 168
 
169 169
 			$cache_key = "give_cache_email_throttle_limit_exhausted_{$donor_id}";
170 170
 			if (
171 171
 				$email_throttle_count < $this->limit_throttle &&
172
-				true !== Give_Cache::get( $cache_key )
172
+				true !== Give_Cache::get($cache_key)
173 173
 			) {
174
-				give_update_meta( $donor_id, '_give_email_throttle_count', $email_throttle_count + 1 );
174
+				give_update_meta($donor_id, '_give_email_throttle_count', $email_throttle_count + 1);
175 175
 			} else {
176
-				give_update_meta( $donor_id, '_give_email_throttle_count', 0 );
177
-				Give_Cache::set( $cache_key, true, $this->verify_throttle );
176
+				give_update_meta($donor_id, '_give_email_throttle_count', 0);
177
+				Give_Cache::set($cache_key, true, $this->verify_throttle);
178 178
 				return false;
179 179
 			}
180 180
 
@@ -194,45 +194,45 @@  discard block
 block discarded – undo
194 194
 	 *
195 195
 	 * @return bool
196 196
 	 */
197
-	public function send_email( $customer_id, $email ) {
197
+	public function send_email($customer_id, $email) {
198 198
 
199
-		$verify_key = wp_generate_password( 20, false );
199
+		$verify_key = wp_generate_password(20, false);
200 200
 
201 201
 		// Generate a new verify key
202
-		$this->set_verify_key( $customer_id, $email, $verify_key );
202
+		$this->set_verify_key($customer_id, $email, $verify_key);
203 203
 
204
-		$access_url = add_query_arg( array(
204
+		$access_url = add_query_arg(array(
205 205
 			'give_nl' => $verify_key,
206
-		), give_get_history_page_uri() );
206
+		), give_get_history_page_uri());
207 207
 
208
-		if ( ! empty( $_GET['payment_key'] ) ) {
209
-			$access_url = add_query_arg( array(
210
-				'payment_key' => give_clean( $_GET['payment_key'] ),
211
-			), $access_url );
208
+		if ( ! empty($_GET['payment_key'])) {
209
+			$access_url = add_query_arg(array(
210
+				'payment_key' => give_clean($_GET['payment_key']),
211
+			), $access_url);
212 212
 		}
213 213
 
214 214
 		// Nice subject and message.
215
-		$subject = apply_filters( 'give_email_access_token_subject', sprintf( __( 'Please confirm your email for %s', 'give' ), get_bloginfo( 'url' ) ) );
215
+		$subject = apply_filters('give_email_access_token_subject', sprintf(__('Please confirm your email for %s', 'give'), get_bloginfo('url')));
216 216
 
217 217
 		$message = sprintf(
218
-			__( 'Please click the link to access your donation history on <a target="_blank" href="%1$s">%1$s</a>. If you did not request this email, please contact <a href="mailto:%2$s">%2$s</a>.', 'give' ),
219
-			get_bloginfo( 'url' ),
220
-			get_bloginfo( 'admin_email' )
221
-		) . "\n\n";
218
+			__('Please click the link to access your donation history on <a target="_blank" href="%1$s">%1$s</a>. If you did not request this email, please contact <a href="mailto:%2$s">%2$s</a>.', 'give'),
219
+			get_bloginfo('url'),
220
+			get_bloginfo('admin_email')
221
+		)."\n\n";
222 222
 		$message .= sprintf(
223
-			__( '<a href="%s" target="_blank">%s</a>', 'give' ),
224
-			esc_url( $access_url ),
225
-			__( 'View your donation history &raquo;', 'give' )
226
-		) . "\n\n";
223
+			__('<a href="%s" target="_blank">%s</a>', 'give'),
224
+			esc_url($access_url),
225
+			__('View your donation history &raquo;', 'give')
226
+		)."\n\n";
227 227
 		$message .= "\n\n";
228
-		$message .= __( 'Sincerely,', 'give' ) . "\n";
229
-		$message .= get_bloginfo( 'name' ) . "\n";
228
+		$message .= __('Sincerely,', 'give')."\n";
229
+		$message .= get_bloginfo('name')."\n";
230 230
 
231
-		$message = apply_filters( 'give_email_access_token_message', $message );
231
+		$message = apply_filters('give_email_access_token_message', $message);
232 232
 
233 233
 		// Send the email.
234
-		Give()->emails->__set( 'heading', apply_filters( 'give_email_access_token_heading', __( 'Confirm Email', 'give' ) ) );
235
-		return Give()->emails->send( $email, $subject, $message );
234
+		Give()->emails->__set('heading', apply_filters('give_email_access_token_heading', __('Confirm Email', 'give')));
235
+		return Give()->emails->send($email, $subject, $message);
236 236
 
237 237
 	}
238 238
 
@@ -246,28 +246,28 @@  discard block
 block discarded – undo
246 246
 	 */
247 247
 	public function check_for_token() {
248 248
 
249
-		$token = isset( $_GET['give_nl'] ) ? $_GET['give_nl'] : '';
249
+		$token = isset($_GET['give_nl']) ? $_GET['give_nl'] : '';
250 250
 
251 251
 		// Check for cookie.
252
-		if ( empty( $token ) ) {
253
-			$token = isset( $_COOKIE['give_nl'] ) ? $_COOKIE['give_nl'] : '';
252
+		if (empty($token)) {
253
+			$token = isset($_COOKIE['give_nl']) ? $_COOKIE['give_nl'] : '';
254 254
 		}
255 255
 
256 256
 		// Must have a token.
257
-		if ( ! empty( $token ) ) {
257
+		if ( ! empty($token)) {
258 258
 
259
-			if ( ! $this->is_valid_token( $token ) ) {
260
-				if ( ! $this->is_valid_verify_key( $token ) ) {
259
+			if ( ! $this->is_valid_token($token)) {
260
+				if ( ! $this->is_valid_verify_key($token)) {
261 261
 					return false;
262 262
 				}
263 263
 			}
264 264
 
265 265
 			// Set Receipt Access Session.
266
-			Give()->session->set( 'receipt_access', true );
266
+			Give()->session->set('receipt_access', true);
267 267
 			$this->token_exists = true;
268 268
 			// Set cookie.
269
-			$lifetime = current_time( 'timestamp' ) + Give()->session->set_expiration_time();
270
-			@setcookie( 'give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false );
269
+			$lifetime = current_time('timestamp') + Give()->session->set_expiration_time();
270
+			@setcookie('give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false);
271 271
 
272 272
 			return true;
273 273
 		}
@@ -283,26 +283,26 @@  discard block
 block discarded – undo
283 283
 	 *
284 284
 	 * @return bool
285 285
 	 */
286
-	public function is_valid_token( $token ) {
286
+	public function is_valid_token($token) {
287 287
 
288 288
 		global $wpdb;
289 289
 
290 290
 		// Make sure token isn't expired.
291
-		$expires = date( 'Y-m-d H:i:s', time() - $this->token_expiration );
291
+		$expires = date('Y-m-d H:i:s', time() - $this->token_expiration);
292 292
 
293 293
 		$email = $wpdb->get_var(
294
-			$wpdb->prepare( "SELECT email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s AND verify_throttle >= %s LIMIT 1", $token, $expires )
294
+			$wpdb->prepare("SELECT email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s AND verify_throttle >= %s LIMIT 1", $token, $expires)
295 295
 		);
296 296
 
297
-		if ( ! empty( $email ) ) {
297
+		if ( ! empty($email)) {
298 298
 			$this->token_email = $email;
299 299
 			$this->token       = $token;
300 300
 			return true;
301 301
 		}
302 302
 
303 303
 		// Set error only if email access form isn't being submitted.
304
-		if ( ! isset( $_POST['give_email'] ) && ! isset( $_POST['_wpnonce'] ) ) {
305
-			give_set_error( 'give_email_token_expired', apply_filters( 'give_email_token_expired_message', __( 'Your access token has expired. Please request a new one below:', 'give' ) ) );
304
+		if ( ! isset($_POST['give_email']) && ! isset($_POST['_wpnonce'])) {
305
+			give_set_error('give_email_token_expired', apply_filters('give_email_token_expired_message', __('Your access token has expired. Please request a new one below:', 'give')));
306 306
 		}
307 307
 
308 308
 		return false;
@@ -321,25 +321,25 @@  discard block
 block discarded – undo
321 321
 	 *
322 322
 	 * @return void
323 323
 	 */
324
-	public function set_verify_key( $customer_id, $email, $verify_key ) {
324
+	public function set_verify_key($customer_id, $email, $verify_key) {
325 325
 		global $wpdb;
326 326
 
327
-		$now = date( 'Y-m-d H:i:s' );
327
+		$now = date('Y-m-d H:i:s');
328 328
 
329 329
 		// Insert or update?
330 330
 		$row_id = (int) $wpdb->get_var(
331
-			$wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id )
331
+			$wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id)
332 332
 		);
333 333
 
334 334
 		// Update.
335
-		if ( ! empty( $row_id ) ) {
335
+		if ( ! empty($row_id)) {
336 336
 			$wpdb->query(
337
-				$wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id )
337
+				$wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id)
338 338
 			);
339 339
 		} // Insert.
340 340
 		else {
341 341
 			$wpdb->query(
342
-				$wpdb->prepare( "INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now )
342
+				$wpdb->prepare("INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now)
343 343
 			);
344 344
 		}
345 345
 	}
@@ -354,21 +354,21 @@  discard block
 block discarded – undo
354 354
 	 *
355 355
 	 * @return bool
356 356
 	 */
357
-	public function is_valid_verify_key( $token ) {
357
+	public function is_valid_verify_key($token) {
358 358
 		/* @var WPDB $wpdb */
359 359
 		global $wpdb;
360 360
 
361 361
 		// See if the verify_key exists.
362 362
 		$row = $wpdb->get_row(
363
-			$wpdb->prepare( "SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token )
363
+			$wpdb->prepare("SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token)
364 364
 		);
365 365
 
366
-		$now = date( 'Y-m-d H:i:s' );
366
+		$now = date('Y-m-d H:i:s');
367 367
 
368 368
 		// Set token and remove verify key.
369
-		if ( ! empty( $row ) ) {
369
+		if ( ! empty($row)) {
370 370
 			$wpdb->query(
371
-				$wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id )
371
+				$wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id)
372 372
 			);
373 373
 
374 374
 			$this->token_email = $row->email;
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 	 *
393 393
 	 * @return mixed
394 394
 	 */
395
-	public function users_donations_args( $args ) {
395
+	public function users_donations_args($args) {
396 396
 		$args['user'] = $this->token_email;
397 397
 
398 398
 		return $args;
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 		global $wpdb;
414 414
 
415 415
 		// Create columns in customers table.
416
-		$wpdb->query( "ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`" );
416
+		$wpdb->query("ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`");
417 417
 
418 418
 	}
419 419
 
Please login to merge, or discard this patch.
includes/admin/shortcodes/class-shortcode-button.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
 	 */
34 34
 	public function __construct() {
35 35
 
36
-		if ( is_admin() ) {
37
-			add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 15 );
36
+		if (is_admin()) {
37
+			add_filter('mce_external_plugins', array($this, 'mce_external_plugins'), 15);
38 38
 
39
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_assets' ) );
40
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_localize_scripts' ), 13 );
41
-			add_action( 'media_buttons', array( $this, 'shortcode_button' ) );
39
+			add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_assets'));
40
+			add_action('admin_enqueue_scripts', array($this, 'admin_localize_scripts'), 13);
41
+			add_action('media_buttons', array($this, 'shortcode_button'));
42 42
 		}
43 43
 
44
-		add_action( "wp_ajax_give_shortcode", array( $this, 'shortcode_ajax' ) );
45
-		add_action( "wp_ajax_nopriv_give_shortcode", array( $this, 'shortcode_ajax' ) );
44
+		add_action("wp_ajax_give_shortcode", array($this, 'shortcode_ajax'));
45
+		add_action("wp_ajax_nopriv_give_shortcode", array($this, 'shortcode_ajax'));
46 46
 	}
47 47
 
48 48
 	/**
@@ -54,15 +54,15 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @since 1.0
56 56
 	 */
57
-	public function mce_external_plugins( $plugin_array ) {
57
+	public function mce_external_plugins($plugin_array) {
58 58
 
59
-		if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) {
59
+		if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages')) {
60 60
 			return false;
61 61
 		}
62 62
 
63
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
63
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
64 64
 
65
-		$plugin_array['give_shortcode'] = GIVE_PLUGIN_URL . 'assets/js/admin/tinymce/mce-plugin' . $suffix . '.js';
65
+		$plugin_array['give_shortcode'] = GIVE_PLUGIN_URL.'assets/js/admin/tinymce/mce-plugin'.$suffix.'.js';
66 66
 
67 67
 		return $plugin_array;
68 68
 	}
@@ -76,12 +76,12 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function admin_enqueue_assets() {
78 78
 
79
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
79
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
80 80
 
81 81
 		wp_enqueue_script(
82 82
 			'give_shortcode',
83
-			GIVE_PLUGIN_URL . 'assets/js/admin/admin-shortcodes' . $suffix . '.js',
84
-			array( 'jquery' ),
83
+			GIVE_PLUGIN_URL.'assets/js/admin/admin-shortcodes'.$suffix.'.js',
84
+			array('jquery'),
85 85
 			GIVE_VERSION,
86 86
 			true
87 87
 		);
@@ -96,17 +96,17 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public function admin_localize_scripts() {
98 98
 
99
-		if ( ! empty( self::$shortcodes ) ) {
99
+		if ( ! empty(self::$shortcodes)) {
100 100
 
101 101
 			$variables = array();
102 102
 
103
-			foreach ( self::$shortcodes as $shortcode => $values ) {
104
-				if ( ! empty( $values['required'] ) ) {
105
-					$variables[ $shortcode ] = $values['required'];
103
+			foreach (self::$shortcodes as $shortcode => $values) {
104
+				if ( ! empty($values['required'])) {
105
+					$variables[$shortcode] = $values['required'];
106 106
 				}
107 107
 			}
108 108
 
109
-			wp_localize_script( 'give_shortcode', 'scShortcodes', $variables );
109
+			wp_localize_script('give_shortcode', 'scShortcodes', $variables);
110 110
 		}
111 111
 	}
112 112
 
@@ -123,37 +123,37 @@  discard block
 block discarded – undo
123 123
 
124 124
 		// If we load wp editor by ajax then $screen will be empty which generate notice if we treat $screen as WP_Screen object.
125 125
 		// For example we are loading wp editor by ajax in repeater field.
126
-		if ( ! ( $screen instanceof WP_Screen ) ) {
126
+		if ( ! ($screen instanceof WP_Screen)) {
127 127
 			return false;
128 128
 		}
129 129
 
130
-		$shortcode_button_pages = apply_filters( 'give_shortcode_button_pages', array(
130
+		$shortcode_button_pages = apply_filters('give_shortcode_button_pages', array(
131 131
 			'post.php',
132 132
 			'page.php',
133 133
 			'post-new.php',
134 134
 			'post-edit.php',
135 135
 			'edit.php',
136 136
 			'edit.php?post_type=page',
137
-		) );
137
+		));
138 138
 
139 139
 		// Only run in admin post/page creation and edit screens
140
-		if ( in_array( $screen->parent_file, $shortcode_button_pages )
141
-		     && apply_filters( 'give_shortcode_button_condition', true )
142
-		     && ! empty( self::$shortcodes )
140
+		if (in_array($screen->parent_file, $shortcode_button_pages)
141
+		     && apply_filters('give_shortcode_button_condition', true)
142
+		     && ! empty(self::$shortcodes)
143 143
 		) {
144 144
 
145 145
 			$shortcodes = array();
146 146
 
147
-			foreach ( self::$shortcodes as $shortcode => $values ) {
147
+			foreach (self::$shortcodes as $shortcode => $values) {
148 148
 
149 149
 				/**
150 150
 				 * Filters the condition for including the current shortcode
151 151
 				 *
152 152
 				 * @since 1.0
153 153
 				 */
154
-				if ( apply_filters( sanitize_title( $shortcode ) . '_condition', true ) ) {
154
+				if (apply_filters(sanitize_title($shortcode).'_condition', true)) {
155 155
 
156
-					$shortcodes[ $shortcode ] = sprintf(
156
+					$shortcodes[$shortcode] = sprintf(
157 157
 						'<div class="sc-shortcode mce-menu-item give-shortcode-item-%1$s" data-shortcode="%2$s">%3$s</div>',
158 158
 						$shortcode,
159 159
 						$shortcode,
@@ -162,37 +162,37 @@  discard block
 block discarded – undo
162 162
 				}
163 163
 			}
164 164
 
165
-			if ( ! empty( $shortcodes ) ) {
165
+			if ( ! empty($shortcodes)) {
166 166
 
167 167
 				// check current WP version
168
-				$img = ( version_compare( get_bloginfo( 'version' ), '3.5', '<' ) )
169
-					? '<img src="' . GIVE_PLUGIN_URL . 'assets/images/give-media.png" />'
170
-					: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url(' . give_svg_icons( 'give_grey' ) . ');"></span>';
168
+				$img = (version_compare(get_bloginfo('version'), '3.5', '<'))
169
+					? '<img src="'.GIVE_PLUGIN_URL.'assets/images/give-media.png" />'
170
+					: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url('.give_svg_icons('give_grey').');"></span>';
171 171
 
172
-				reset( $shortcodes );
172
+				reset($shortcodes);
173 173
 
174
-				if ( 1 === count( $shortcodes ) ) {
174
+				if (1 === count($shortcodes)) {
175 175
 
176
-					$shortcode = key( $shortcodes );
176
+					$shortcode = key($shortcodes);
177 177
 
178 178
 					printf(
179 179
 						'<button type="button" class="button sc-shortcode" data-shortcode="%s">%s</button>',
180 180
 						$shortcode,
181
-						sprintf( '%s %s %s',
181
+						sprintf('%s %s %s',
182 182
 							$img,
183
-							__( 'Insert', 'give' ),
184
-							self::$shortcodes[ $shortcode ]['label']
183
+							__('Insert', 'give'),
184
+							self::$shortcodes[$shortcode]['label']
185 185
 						)
186 186
 					);
187 187
 				} else {
188 188
 					printf(
189
-						'<div class="sc-wrap">' .
190
-						'<button class="button sc-button" type="button">%s %s</button>' .
191
-						'<div class="sc-menu mce-menu">%s</div>' .
189
+						'<div class="sc-wrap">'.
190
+						'<button class="button sc-button" type="button">%s %s</button>'.
191
+						'<div class="sc-menu mce-menu">%s</div>'.
192 192
 						'</div>',
193 193
 						$img,
194
-						__( 'Give Shortcodes', 'give' ),
195
-						implode( '', array_values( $shortcodes ) )
194
+						__('Give Shortcodes', 'give'),
195
+						implode('', array_values($shortcodes))
196 196
 					);
197 197
 				}
198 198
 			}
@@ -208,15 +208,15 @@  discard block
 block discarded – undo
208 208
 	 */
209 209
 	public function shortcode_ajax() {
210 210
 
211
-		$shortcode = isset( $_POST['shortcode'] ) ? $_POST['shortcode'] : false;
211
+		$shortcode = isset($_POST['shortcode']) ? $_POST['shortcode'] : false;
212 212
 		$response  = false;
213 213
 
214
-		if ( $shortcode && array_key_exists( $shortcode, self::$shortcodes ) ) {
214
+		if ($shortcode && array_key_exists($shortcode, self::$shortcodes)) {
215 215
 
216
-			$data = self::$shortcodes[ $shortcode ];
216
+			$data = self::$shortcodes[$shortcode];
217 217
 
218
-			if ( ! empty( $data['errors'] ) ) {
219
-				$data['btn_okay'] = array( esc_html__( 'Okay', 'give' ) );
218
+			if ( ! empty($data['errors'])) {
219
+				$data['btn_okay'] = array(esc_html__('Okay', 'give'));
220 220
 			}
221 221
 
222 222
 			$response = array(
@@ -228,10 +228,10 @@  discard block
 block discarded – undo
228 228
 			);
229 229
 		} else {
230 230
 			// todo: handle error
231
-			error_log( print_r( 'AJAX error!', 1 ) );
231
+			error_log(print_r('AJAX error!', 1));
232 232
 		}
233 233
 
234
-		wp_send_json( $response );
234
+		wp_send_json($response);
235 235
 	}
236 236
 }
237 237
 
Please login to merge, or discard this patch.
includes/admin/forms/class-metabox-form-data.php 1 patch
Spacing   +297 added lines, -301 removed lines patch added patch discarded remove patch
@@ -46,24 +46,24 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	function __construct() {
48 48
 		$this->metabox_id    = 'give-metabox-form-data';
49
-		$this->metabox_label = __( 'Donation Form Options', 'give' );
49
+		$this->metabox_label = __('Donation Form Options', 'give');
50 50
 
51 51
 		// Setup.
52
-		add_action( 'admin_init', array( $this, 'setup' ) );
52
+		add_action('admin_init', array($this, 'setup'));
53 53
 
54 54
 		// Add metabox.
55
-		add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ), 10 );
55
+		add_action('add_meta_boxes', array($this, 'add_meta_box'), 10);
56 56
 
57 57
 		// Save form meta.
58
-		add_action( 'save_post_give_forms', array( $this, 'save' ), 10, 2 );
58
+		add_action('save_post_give_forms', array($this, 'save'), 10, 2);
59 59
 
60 60
 		// cmb2 old setting loaders.
61 61
 		// add_filter( 'give_metabox_form_data_settings', array( $this, 'cmb2_metabox_settings' ) );
62 62
 		// Add offline donations options.
63
-		add_filter( 'give_metabox_form_data_settings', array( $this, 'add_offline_donations_setting_tab' ), 0, 1 );
63
+		add_filter('give_metabox_form_data_settings', array($this, 'add_offline_donations_setting_tab'), 0, 1);
64 64
 
65 65
 		// Maintain active tab query parameter after save.
66
-		add_filter( 'redirect_post_location', array( $this, 'maintain_active_tab' ), 10, 2 );
66
+		add_filter('redirect_post_location', array($this, 'maintain_active_tab'), 10, 2);
67 67
 	}
68 68
 
69 69
 	/**
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	function get_settings() {
89 89
 		$post_id           = give_get_admin_post_id();
90
-		$price_placeholder = give_format_decimal( '1.00', false, false );
90
+		$price_placeholder = give_format_decimal('1.00', false, false);
91 91
 
92 92
 		// Start with an underscore to hide fields from custom fields list
93 93
 		$prefix = '_give_';
@@ -96,27 +96,27 @@  discard block
 block discarded – undo
96 96
 			/**
97 97
 			 * Repeatable Field Groups
98 98
 			 */
99
-			'form_field_options'    => apply_filters( 'give_forms_field_options', array(
99
+			'form_field_options'    => apply_filters('give_forms_field_options', array(
100 100
 				'id'        => 'form_field_options',
101
-				'title'     => __( 'Donation Options', 'give' ),
101
+				'title'     => __('Donation Options', 'give'),
102 102
 				'icon-html' => '<span class="give-icon give-icon-heart"></span>',
103
-				'fields'    => apply_filters( 'give_forms_donation_form_metabox_fields', array(
103
+				'fields'    => apply_filters('give_forms_donation_form_metabox_fields', array(
104 104
 					// Donation Option.
105 105
 					array(
106
-						'name'        => __( 'Donation Option', 'give' ),
107
-						'description' => __( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ),
108
-						'id'          => $prefix . 'price_option',
106
+						'name'        => __('Donation Option', 'give'),
107
+						'description' => __('Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'),
108
+						'id'          => $prefix.'price_option',
109 109
 						'type'        => 'radio_inline',
110 110
 						'default'     => 'multi',
111
-						'options'     => apply_filters( 'give_forms_price_options', array(
112
-							'multi' => __( 'Multi-level Donation', 'give' ),
113
-							'set'   => __( 'Set Donation', 'give' ),
114
-						) ),
111
+						'options'     => apply_filters('give_forms_price_options', array(
112
+							'multi' => __('Multi-level Donation', 'give'),
113
+							'set'   => __('Set Donation', 'give'),
114
+						)),
115 115
 					),
116 116
 					array(
117
-						'name'        => __( 'Set Donation', 'give' ),
118
-						'description' => __( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ),
119
-						'id'          => $prefix . 'set_price',
117
+						'name'        => __('Set Donation', 'give'),
118
+						'description' => __('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'),
119
+						'id'          => $prefix.'set_price',
120 120
 						'type'        => 'text_small',
121 121
 						'data_type'   => 'price',
122 122
 						'attributes'  => array(
@@ -126,34 +126,34 @@  discard block
 block discarded – undo
126 126
 					),
127 127
 					// Display Style.
128 128
 					array(
129
-						'name'          => __( 'Display Style', 'give' ),
130
-						'description'   => __( 'Set how the donations levels will display on the form.', 'give' ),
131
-						'id'            => $prefix . 'display_style',
129
+						'name'          => __('Display Style', 'give'),
130
+						'description'   => __('Set how the donations levels will display on the form.', 'give'),
131
+						'id'            => $prefix.'display_style',
132 132
 						'type'          => 'radio_inline',
133 133
 						'default'       => 'buttons',
134 134
 						'options'       => array(
135
-							'buttons'  => __( 'Buttons', 'give' ),
136
-							'radios'   => __( 'Radios', 'give' ),
137
-							'dropdown' => __( 'Dropdown', 'give' ),
135
+							'buttons'  => __('Buttons', 'give'),
136
+							'radios'   => __('Radios', 'give'),
137
+							'dropdown' => __('Dropdown', 'give'),
138 138
 						),
139 139
 						'wrapper_class' => 'give-hidden',
140 140
 					),
141 141
 					// Custom Amount.
142 142
 					array(
143
-						'name'        => __( 'Custom Amount', 'give' ),
144
-						'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ),
145
-						'id'          => $prefix . 'custom_amount',
143
+						'name'        => __('Custom Amount', 'give'),
144
+						'description' => __('Do you want the user to be able to input their own donation amount?', 'give'),
145
+						'id'          => $prefix.'custom_amount',
146 146
 						'type'        => 'radio_inline',
147 147
 						'default'     => 'disabled',
148 148
 						'options'     => array(
149
-							'enabled'  => __( 'Enabled', 'give' ),
150
-							'disabled' => __( 'Disabled', 'give' ),
149
+							'enabled'  => __('Enabled', 'give'),
150
+							'disabled' => __('Disabled', 'give'),
151 151
 						),
152 152
 					),
153 153
 					array(
154
-						'name'          => __( 'Minimum Amount', 'give' ),
155
-						'description'   => __( 'Enter the minimum custom donation amount.', 'give' ),
156
-						'id'            => $prefix . 'custom_amount_minimum',
154
+						'name'          => __('Minimum Amount', 'give'),
155
+						'description'   => __('Enter the minimum custom donation amount.', 'give'),
156
+						'id'            => $prefix.'custom_amount_minimum',
157 157
 						'type'          => 'text_small',
158 158
 						'data_type'     => 'price',
159 159
 						'attributes'    => array(
@@ -163,37 +163,37 @@  discard block
 block discarded – undo
163 163
 						'wrapper_class' => 'give-hidden',
164 164
 					),
165 165
 					array(
166
-						'name'          => __( 'Custom Amount Text', 'give' ),
167
-						'description'   => __( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ),
168
-						'id'            => $prefix . 'custom_amount_text',
166
+						'name'          => __('Custom Amount Text', 'give'),
167
+						'description'   => __('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'),
168
+						'id'            => $prefix.'custom_amount_text',
169 169
 						'type'          => 'text_medium',
170 170
 						'attributes'    => array(
171 171
 							'rows'        => 3,
172
-							'placeholder' => __( 'Give a Custom Amount', 'give' ),
172
+							'placeholder' => __('Give a Custom Amount', 'give'),
173 173
 						),
174 174
 						'wrapper_class' => 'give-hidden',
175 175
 					),
176 176
 					// Donation Levels.
177 177
 					array(
178
-						'id'            => $prefix . 'donation_levels',
178
+						'id'            => $prefix.'donation_levels',
179 179
 						'type'          => 'group',
180 180
 						'options'       => array(
181
-							'add_button'    => __( 'Add Level', 'give' ),
182
-							'header_title'  => __( 'Donation Level', 'give' ),
181
+							'add_button'    => __('Add Level', 'give'),
182
+							'header_title'  => __('Donation Level', 'give'),
183 183
 							'remove_button' => '<span class="dashicons dashicons-no"></span>',
184 184
 						),
185 185
 						'wrapper_class' => 'give-hidden',
186 186
 						// Fields array works the same, except id's only need to be unique for this group.
187 187
 						// Prefix is not needed.
188
-						'fields'        => apply_filters( 'give_donation_levels_table_row', array(
188
+						'fields'        => apply_filters('give_donation_levels_table_row', array(
189 189
 							array(
190
-								'name' => __( 'ID', 'give' ),
191
-								'id'   => $prefix . 'id',
190
+								'name' => __('ID', 'give'),
191
+								'id'   => $prefix.'id',
192 192
 								'type' => 'levels_id',
193 193
 							),
194 194
 							array(
195
-								'name'       => __( 'Amount', 'give' ),
196
-								'id'         => $prefix . 'amount',
195
+								'name'       => __('Amount', 'give'),
196
+								'id'         => $prefix.'amount',
197 197
 								'type'       => 'text_small',
198 198
 								'data_type'  => 'price',
199 199
 								'attributes' => array(
@@ -202,112 +202,112 @@  discard block
 block discarded – undo
202 202
 								),
203 203
 							),
204 204
 							array(
205
-								'name'       => __( 'Text', 'give' ),
206
-								'id'         => $prefix . 'text',
205
+								'name'       => __('Text', 'give'),
206
+								'id'         => $prefix.'text',
207 207
 								'type'       => 'text',
208 208
 								'attributes' => array(
209
-									'placeholder' => __( 'Donation Level', 'give' ),
209
+									'placeholder' => __('Donation Level', 'give'),
210 210
 									'class'       => 'give-multilevel-text-field',
211 211
 								),
212 212
 							),
213 213
 							array(
214
-								'name' => __( 'Default', 'give' ),
215
-								'id'   => $prefix . 'default',
214
+								'name' => __('Default', 'give'),
215
+								'id'   => $prefix.'default',
216 216
 								'type' => 'give_default_radio_inline',
217 217
 							),
218
-						) ),
218
+						)),
219 219
 					),
220 220
 					array(
221 221
 						'name'  => 'donation_options_docs',
222 222
 						'type'  => 'docs_link',
223 223
 						'url'   => 'http://docs.givewp.com/form-donation-options',
224
-						'title' => __( 'Donation Options', 'give' ),
224
+						'title' => __('Donation Options', 'give'),
225 225
 					),
226 226
 				),
227 227
 					$post_id
228 228
 				),
229
-			) ),
229
+			)),
230 230
 
231 231
 			/**
232 232
 			 * Display Options
233 233
 			 */
234
-			'form_display_options'  => apply_filters( 'give_form_display_options', array(
234
+			'form_display_options'  => apply_filters('give_form_display_options', array(
235 235
 					'id'        => 'form_display_options',
236
-					'title'     => __( 'Form Display', 'give' ),
236
+					'title'     => __('Form Display', 'give'),
237 237
 					'icon-html' => '<span class="give-icon give-icon-display"></span>',
238
-					'fields'    => apply_filters( 'give_forms_display_options_metabox_fields', array(
238
+					'fields'    => apply_filters('give_forms_display_options_metabox_fields', array(
239 239
 						array(
240
-							'name'    => __( 'Display Options', 'give' ),
241
-							'desc'    => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ),
242
-							'id'      => $prefix . 'payment_display',
240
+							'name'    => __('Display Options', 'give'),
241
+							'desc'    => sprintf(__('How would you like to display donation information for this form?', 'give'), '#'),
242
+							'id'      => $prefix.'payment_display',
243 243
 							'type'    => 'radio_inline',
244 244
 							'options' => array(
245
-								'onpage' => __( 'All Fields', 'give' ),
246
-								'modal'  => __( 'Modal', 'give' ),
247
-								'reveal' => __( 'Reveal', 'give' ),
248
-								'button' => __( 'Button', 'give' ),
245
+								'onpage' => __('All Fields', 'give'),
246
+								'modal'  => __('Modal', 'give'),
247
+								'reveal' => __('Reveal', 'give'),
248
+								'button' => __('Button', 'give'),
249 249
 							),
250 250
 							'default' => 'onpage',
251 251
 						),
252 252
 						array(
253
-							'id'            => $prefix . 'reveal_label',
254
-							'name'          => __( 'Continue Button', 'give' ),
255
-							'desc'          => __( 'The button label for displaying the additional payment fields.', 'give' ),
253
+							'id'            => $prefix.'reveal_label',
254
+							'name'          => __('Continue Button', 'give'),
255
+							'desc'          => __('The button label for displaying the additional payment fields.', 'give'),
256 256
 							'type'          => 'text_small',
257 257
 							'attributes'    => array(
258
-								'placeholder' => __( 'Donate Now', 'give' ),
258
+								'placeholder' => __('Donate Now', 'give'),
259 259
 							),
260 260
 							'wrapper_class' => 'give-hidden',
261 261
 						),
262 262
 						array(
263
-							'id'         => $prefix . 'checkout_label',
264
-							'name'       => __( 'Submit Button', 'give' ),
265
-							'desc'       => __( 'The button label for completing a donation.', 'give' ),
263
+							'id'         => $prefix.'checkout_label',
264
+							'name'       => __('Submit Button', 'give'),
265
+							'desc'       => __('The button label for completing a donation.', 'give'),
266 266
 							'type'       => 'text_small',
267 267
 							'attributes' => array(
268
-								'placeholder' => __( 'Donate Now', 'give' ),
268
+								'placeholder' => __('Donate Now', 'give'),
269 269
 							),
270 270
 						),
271 271
 						array(
272
-							'name' => __( 'Default Gateway', 'give' ),
273
-							'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ),
274
-							'id'   => $prefix . 'default_gateway',
272
+							'name' => __('Default Gateway', 'give'),
273
+							'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'),
274
+							'id'   => $prefix.'default_gateway',
275 275
 							'type' => 'default_gateway',
276 276
 						),
277 277
 						array(
278
-							'name'    => __( 'Guest Donations', 'give' ),
279
-							'desc'    => __( 'Do you want to allow non-logged-in users to make donations?', 'give' ),
280
-							'id'      => $prefix . 'logged_in_only',
278
+							'name'    => __('Guest Donations', 'give'),
279
+							'desc'    => __('Do you want to allow non-logged-in users to make donations?', 'give'),
280
+							'id'      => $prefix.'logged_in_only',
281 281
 							'type'    => 'radio_inline',
282 282
 							'default' => 'enabled',
283 283
 							'options' => array(
284
-								'enabled'  => __( 'Enabled', 'give' ),
285
-								'disabled' => __( 'Disabled', 'give' ),
284
+								'enabled'  => __('Enabled', 'give'),
285
+								'disabled' => __('Disabled', 'give'),
286 286
 							),
287 287
 						),
288 288
 						array(
289
-							'name'    => __( 'Registration', 'give' ),
290
-							'desc'    => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ),
291
-							'id'      => $prefix . 'show_register_form',
289
+							'name'    => __('Registration', 'give'),
290
+							'desc'    => __('Display the registration and login forms in the payment section for non-logged-in users.', 'give'),
291
+							'id'      => $prefix.'show_register_form',
292 292
 							'type'    => 'radio',
293 293
 							'options' => array(
294
-								'none'         => __( 'None', 'give' ),
295
-								'registration' => __( 'Registration', 'give' ),
296
-								'login'        => __( 'Login', 'give' ),
297
-								'both'         => __( 'Registration + Login', 'give' ),
294
+								'none'         => __('None', 'give'),
295
+								'registration' => __('Registration', 'give'),
296
+								'login'        => __('Login', 'give'),
297
+								'both'         => __('Registration + Login', 'give'),
298 298
 							),
299 299
 							'default' => 'none',
300 300
 						),
301 301
 						array(
302
-							'name'    => __( 'Floating Labels', 'give' ),
302
+							'name'    => __('Floating Labels', 'give'),
303 303
 							/* translators: %s: forms http://docs.givewp.com/form-floating-labels */
304
-							'desc'    => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ),
305
-							'id'      => $prefix . 'form_floating_labels',
304
+							'desc'    => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('http://docs.givewp.com/form-floating-labels')),
305
+							'id'      => $prefix.'form_floating_labels',
306 306
 							'type'    => 'radio_inline',
307 307
 							'options' => array(
308
-								'global'   => __( 'Global Option', 'give' ),
309
-								'enabled'  => __( 'Enabled', 'give' ),
310
-								'disabled' => __( 'Disabled', 'give' ),
308
+								'global'   => __('Global Option', 'give'),
309
+								'enabled'  => __('Enabled', 'give'),
310
+								'disabled' => __('Disabled', 'give'),
311 311
 							),
312 312
 							'default' => 'global',
313 313
 						),
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 							'name'  => 'form_display_docs',
316 316
 							'type'  => 'docs_link',
317 317
 							'url'   => 'http://docs.givewp.com/form-display-options',
318
-							'title' => __( 'Form Display', 'give' ),
318
+							'title' => __('Form Display', 'give'),
319 319
 						),
320 320
 					),
321 321
 						$post_id
@@ -326,27 +326,27 @@  discard block
 block discarded – undo
326 326
 			/**
327 327
 			 * Donation Goals
328 328
 			 */
329
-			'donation_goal_options' => apply_filters( 'give_donation_goal_options', array(
329
+			'donation_goal_options' => apply_filters('give_donation_goal_options', array(
330 330
 				'id'        => 'donation_goal_options',
331
-				'title'     => __( 'Donation Goal', 'give' ),
331
+				'title'     => __('Donation Goal', 'give'),
332 332
 				'icon-html' => '<span class="give-icon give-icon-target"></span>',
333
-				'fields'    => apply_filters( 'give_forms_donation_goal_metabox_fields', array(
333
+				'fields'    => apply_filters('give_forms_donation_goal_metabox_fields', array(
334 334
 					// Goals
335 335
 					array(
336
-						'name'        => __( 'Donation Goal', 'give' ),
337
-						'description' => __( 'Do you want to set a donation goal for this form?', 'give' ),
338
-						'id'          => $prefix . 'goal_option',
336
+						'name'        => __('Donation Goal', 'give'),
337
+						'description' => __('Do you want to set a donation goal for this form?', 'give'),
338
+						'id'          => $prefix.'goal_option',
339 339
 						'type'        => 'radio_inline',
340 340
 						'default'     => 'disabled',
341 341
 						'options'     => array(
342
-							'enabled'  => __( 'Enabled', 'give' ),
343
-							'disabled' => __( 'Disabled', 'give' ),
342
+							'enabled'  => __('Enabled', 'give'),
343
+							'disabled' => __('Disabled', 'give'),
344 344
 						),
345 345
 					),
346 346
 					array(
347
-						'name'          => __( 'Goal Amount', 'give' ),
348
-						'description'   => __( 'This is the monetary goal amount you want to reach for this form.', 'give' ),
349
-						'id'            => $prefix . 'set_goal',
347
+						'name'          => __('Goal Amount', 'give'),
348
+						'description'   => __('This is the monetary goal amount you want to reach for this form.', 'give'),
349
+						'id'            => $prefix.'set_goal',
350 350
 						'type'          => 'text_small',
351 351
 						'data_type'     => 'price',
352 352
 						'attributes'    => array(
@@ -357,97 +357,97 @@  discard block
 block discarded – undo
357 357
 					),
358 358
 
359 359
 					array(
360
-						'name'          => __( 'Goal Format', 'give' ),
361
-						'description'   => __( 'Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ),
362
-						'id'            => $prefix . 'goal_format',
360
+						'name'          => __('Goal Format', 'give'),
361
+						'description'   => __('Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'),
362
+						'id'            => $prefix.'goal_format',
363 363
 						'type'          => 'radio_inline',
364 364
 						'default'       => 'amount',
365 365
 						'options'       => array(
366
-							'amount'     => __( 'Amount', 'give' ),
367
-							'percentage' => __( 'Percentage', 'give' ),
366
+							'amount'     => __('Amount', 'give'),
367
+							'percentage' => __('Percentage', 'give'),
368 368
 						),
369 369
 						'wrapper_class' => 'give-hidden',
370 370
 					),
371 371
 					array(
372
-						'name'          => __( 'Progress Bar Color', 'give' ),
373
-						'desc'          => __( 'Customize the color of the goal progress bar.', 'give' ),
374
-						'id'            => $prefix . 'goal_color',
372
+						'name'          => __('Progress Bar Color', 'give'),
373
+						'desc'          => __('Customize the color of the goal progress bar.', 'give'),
374
+						'id'            => $prefix.'goal_color',
375 375
 						'type'          => 'colorpicker',
376 376
 						'default'       => '#2bc253',
377 377
 						'wrapper_class' => 'give-hidden',
378 378
 					),
379 379
 
380 380
 					array(
381
-						'name'          => __( 'Close Form', 'give' ),
382
-						'desc'          => __( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ),
383
-						'id'            => $prefix . 'close_form_when_goal_achieved',
381
+						'name'          => __('Close Form', 'give'),
382
+						'desc'          => __('Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give'),
383
+						'id'            => $prefix.'close_form_when_goal_achieved',
384 384
 						'type'          => 'radio_inline',
385 385
 						'default'       => 'disabled',
386 386
 						'options'       => array(
387
-							'enabled'  => __( 'Enabled', 'give' ),
388
-							'disabled' => __( 'Disabled', 'give' ),
387
+							'enabled'  => __('Enabled', 'give'),
388
+							'disabled' => __('Disabled', 'give'),
389 389
 						),
390 390
 						'wrapper_class' => 'give-hidden',
391 391
 					),
392 392
 					array(
393
-						'name'          => __( 'Goal Achieved Message', 'give' ),
394
-						'desc'          => __( 'Do you want to display a custom message when the goal is closed?', 'give' ),
395
-						'id'            => $prefix . 'form_goal_achieved_message',
393
+						'name'          => __('Goal Achieved Message', 'give'),
394
+						'desc'          => __('Do you want to display a custom message when the goal is closed?', 'give'),
395
+						'id'            => $prefix.'form_goal_achieved_message',
396 396
 						'type'          => 'wysiwyg',
397
-						'default'       => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ),
397
+						'default'       => __('Thank you to all our donors, we have met our fundraising goal.', 'give'),
398 398
 						'wrapper_class' => 'give-hidden',
399 399
 					),
400 400
 					array(
401 401
 						'name'  => 'donation_goal_docs',
402 402
 						'type'  => 'docs_link',
403 403
 						'url'   => 'http://docs.givewp.com/form-donation-goal',
404
-						'title' => __( 'Donation Goal', 'give' ),
404
+						'title' => __('Donation Goal', 'give'),
405 405
 					),
406 406
 				),
407 407
 					$post_id
408 408
 				),
409
-			) ),
409
+			)),
410 410
 
411 411
 			/**
412 412
 			 * Content Field
413 413
 			 */
414
-			'form_content_options'  => apply_filters( 'give_forms_content_options', array(
414
+			'form_content_options'  => apply_filters('give_forms_content_options', array(
415 415
 				'id'        => 'form_content_options',
416
-				'title'     => __( 'Form Content', 'give' ),
416
+				'title'     => __('Form Content', 'give'),
417 417
 				'icon-html' => '<span class="give-icon give-icon-edit"></span>',
418
-				'fields'    => apply_filters( 'give_forms_content_options_metabox_fields', array(
418
+				'fields'    => apply_filters('give_forms_content_options_metabox_fields', array(
419 419
 
420 420
 					// Donation content.
421 421
 					array(
422
-						'name'        => __( 'Display Content', 'give' ),
423
-						'description' => __( 'Do you want to add custom content to this form?', 'give' ),
424
-						'id'          => $prefix . 'display_content',
422
+						'name'        => __('Display Content', 'give'),
423
+						'description' => __('Do you want to add custom content to this form?', 'give'),
424
+						'id'          => $prefix.'display_content',
425 425
 						'type'        => 'radio_inline',
426 426
 						'options'     => array(
427
-							'enabled'  => __( 'Enabled', 'give' ),
428
-							'disabled' => __( 'Disabled', 'give' ),
427
+							'enabled'  => __('Enabled', 'give'),
428
+							'disabled' => __('Disabled', 'give'),
429 429
 						),
430 430
 						'default'     => 'disabled',
431 431
 					),
432 432
 
433 433
 					// Content placement.
434 434
 					array(
435
-						'name'          => __( 'Content Placement', 'give' ),
436
-						'description'   => __( 'This option controls where the content appears within the donation form.', 'give' ),
437
-						'id'            => $prefix . 'content_placement',
435
+						'name'          => __('Content Placement', 'give'),
436
+						'description'   => __('This option controls where the content appears within the donation form.', 'give'),
437
+						'id'            => $prefix.'content_placement',
438 438
 						'type'          => 'radio_inline',
439
-						'options'       => apply_filters( 'give_forms_content_options_select', array(
440
-								'give_pre_form'  => __( 'Above fields', 'give' ),
441
-								'give_post_form' => __( 'Below fields', 'give' ),
439
+						'options'       => apply_filters('give_forms_content_options_select', array(
440
+								'give_pre_form'  => __('Above fields', 'give'),
441
+								'give_post_form' => __('Below fields', 'give'),
442 442
 							)
443 443
 						),
444 444
 						'default'       => 'give_pre_form',
445 445
 						'wrapper_class' => 'give-hidden',
446 446
 					),
447 447
 					array(
448
-						'name'          => __( 'Content', 'give' ),
449
-						'description'   => __( 'This content will display on the single give form page.', 'give' ),
450
-						'id'            => $prefix . 'form_content',
448
+						'name'          => __('Content', 'give'),
449
+						'description'   => __('This content will display on the single give form page.', 'give'),
450
+						'id'            => $prefix.'form_content',
451 451
 						'type'          => 'wysiwyg',
452 452
 						'wrapper_class' => 'give-hidden',
453 453
 					),
@@ -455,51 +455,51 @@  discard block
 block discarded – undo
455 455
 						'name'  => 'form_content_docs',
456 456
 						'type'  => 'docs_link',
457 457
 						'url'   => 'http://docs.givewp.com/form-content',
458
-						'title' => __( 'Form Content', 'give' ),
458
+						'title' => __('Form Content', 'give'),
459 459
 					),
460 460
 				),
461 461
 					$post_id
462 462
 				),
463
-			) ),
463
+			)),
464 464
 
465 465
 			/**
466 466
 			 * Terms & Conditions
467 467
 			 */
468
-			'form_terms_options'    => apply_filters( 'give_forms_terms_options', array(
468
+			'form_terms_options'    => apply_filters('give_forms_terms_options', array(
469 469
 				'id'        => 'form_terms_options',
470
-				'title'     => __( 'Terms & Conditions', 'give' ),
470
+				'title'     => __('Terms & Conditions', 'give'),
471 471
 				'icon-html' => '<span class="give-icon give-icon-checklist"></span>',
472
-				'fields'    => apply_filters( 'give_forms_terms_options_metabox_fields', array(
472
+				'fields'    => apply_filters('give_forms_terms_options_metabox_fields', array(
473 473
 					// Donation Option
474 474
 					array(
475
-						'name'        => __( 'Terms and Conditions', 'give' ),
476
-						'description' => __( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ),
477
-						'id'          => $prefix . 'terms_option',
475
+						'name'        => __('Terms and Conditions', 'give'),
476
+						'description' => __('Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give'),
477
+						'id'          => $prefix.'terms_option',
478 478
 						'type'        => 'radio_inline',
479
-						'options'     => apply_filters( 'give_forms_content_options_select', array(
480
-								'global'   => __( 'Global Option', 'give' ),
481
-								'enabled'  => __( 'Customize', 'give' ),
482
-								'disabled' => __( 'Disable', 'give' ),
479
+						'options'     => apply_filters('give_forms_content_options_select', array(
480
+								'global'   => __('Global Option', 'give'),
481
+								'enabled'  => __('Customize', 'give'),
482
+								'disabled' => __('Disable', 'give'),
483 483
 							)
484 484
 						),
485 485
 						'default'     => 'global',
486 486
 					),
487 487
 					array(
488
-						'id'            => $prefix . 'agree_label',
489
-						'name'          => __( 'Agreement Label', 'give' ),
490
-						'desc'          => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ),
488
+						'id'            => $prefix.'agree_label',
489
+						'name'          => __('Agreement Label', 'give'),
490
+						'desc'          => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'),
491 491
 						'type'          => 'text',
492 492
 						'size'          => 'regular',
493 493
 						'attributes'    => array(
494
-							'placeholder' => __( 'Agree to Terms?', 'give' ),
494
+							'placeholder' => __('Agree to Terms?', 'give'),
495 495
 						),
496 496
 						'wrapper_class' => 'give-hidden',
497 497
 					),
498 498
 					array(
499
-						'id'            => $prefix . 'agree_text',
500
-						'name'          => __( 'Agreement Text', 'give' ),
501
-						'desc'          => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ),
502
-						'default'       => give_get_option( 'agreement_text' ),
499
+						'id'            => $prefix.'agree_text',
500
+						'name'          => __('Agreement Text', 'give'),
501
+						'desc'          => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'),
502
+						'default'       => give_get_option('agreement_text'),
503 503
 						'type'          => 'wysiwyg',
504 504
 						'wrapper_class' => 'give-hidden',
505 505
 					),
@@ -507,18 +507,18 @@  discard block
 block discarded – undo
507 507
 						'name'  => 'terms_docs',
508 508
 						'type'  => 'docs_link',
509 509
 						'url'   => 'http://docs.givewp.com/form-terms',
510
-						'title' => __( 'Terms and Conditions', 'give' ),
510
+						'title' => __('Terms and Conditions', 'give'),
511 511
 					),
512 512
 				),
513 513
 					$post_id
514 514
 				),
515
-			) ),
515
+			)),
516 516
 		);
517 517
 
518 518
 		/**
519 519
 		 * Filter the metabox tabbed panel settings.
520 520
 		 */
521
-		$settings = apply_filters( 'give_metabox_form_data_settings', $settings, $post_id );
521
+		$settings = apply_filters('give_metabox_form_data_settings', $settings, $post_id);
522 522
 
523 523
 		// Output.
524 524
 		return $settings;
@@ -535,8 +535,8 @@  discard block
 block discarded – undo
535 535
 		add_meta_box(
536 536
 			$this->get_metabox_ID(),
537 537
 			$this->get_metabox_label(),
538
-			array( $this, 'output' ),
539
-			array( 'give_forms' ),
538
+			array($this, 'output'),
539
+			array('give_forms'),
540 540
 			'normal',
541 541
 			'high'
542 542
 		);
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 	function enqueue_script() {
554 554
 		global $post;
555 555
 
556
-		if ( is_object( $post ) && 'give_forms' === $post->post_type ) {
556
+		if (is_object($post) && 'give_forms' === $post->post_type) {
557 557
 
558 558
 		}
559 559
 	}
@@ -591,32 +591,32 @@  discard block
 block discarded – undo
591 591
 	public function get_tabs() {
592 592
 		$tabs = array();
593 593
 
594
-		if ( ! empty( $this->settings ) ) {
595
-			foreach ( $this->settings as $setting ) {
596
-				if ( ! isset( $setting['id'] ) || ! isset( $setting['title'] ) ) {
594
+		if ( ! empty($this->settings)) {
595
+			foreach ($this->settings as $setting) {
596
+				if ( ! isset($setting['id']) || ! isset($setting['title'])) {
597 597
 					continue;
598 598
 				}
599 599
 				$tab = array(
600 600
 					'id'        => $setting['id'],
601 601
 					'label'     => $setting['title'],
602
-					'icon-html' => ( ! empty( $setting['icon-html'] ) ? $setting['icon-html'] : '' ),
602
+					'icon-html' => ( ! empty($setting['icon-html']) ? $setting['icon-html'] : ''),
603 603
 				);
604 604
 
605
-				if ( $this->has_sub_tab( $setting ) ) {
606
-					if ( empty( $setting['sub-fields'] ) ) {
605
+				if ($this->has_sub_tab($setting)) {
606
+					if (empty($setting['sub-fields'])) {
607 607
 						$tab = array();
608 608
 					} else {
609
-						foreach ( $setting['sub-fields'] as $sub_fields ) {
609
+						foreach ($setting['sub-fields'] as $sub_fields) {
610 610
 							$tab['sub-fields'][] = array(
611 611
 								'id'        => $sub_fields['id'],
612 612
 								'label'     => $sub_fields['title'],
613
-								'icon-html' => ( ! empty( $sub_fields['icon-html'] ) ? $sub_fields['icon-html'] : '' ),
613
+								'icon-html' => ( ! empty($sub_fields['icon-html']) ? $sub_fields['icon-html'] : ''),
614 614
 							);
615 615
 						}
616 616
 					}
617 617
 				}
618 618
 
619
-				if ( ! empty( $tab ) ) {
619
+				if ( ! empty($tab)) {
620 620
 					$tabs[] = $tab;
621 621
 				}
622 622
 			}
@@ -634,33 +634,33 @@  discard block
 block discarded – undo
634 634
 	 */
635 635
 	public function output() {
636 636
 		// Bailout.
637
-		if ( $form_data_tabs = $this->get_tabs() ) :
638
-			$active_tab = ! empty( $_GET['give_tab'] ) ? give_clean( $_GET['give_tab'] ) : 'form_field_options';
639
-			wp_nonce_field( 'give_save_form_meta', 'give_form_meta_nonce' );
637
+		if ($form_data_tabs = $this->get_tabs()) :
638
+			$active_tab = ! empty($_GET['give_tab']) ? give_clean($_GET['give_tab']) : 'form_field_options';
639
+			wp_nonce_field('give_save_form_meta', 'give_form_meta_nonce');
640 640
 			?>
641 641
 			<input id="give_form_active_tab" type="hidden" name="give_form_active_tab">
642 642
 			<div class="give-metabox-panel-wrap">
643 643
 				<ul class="give-form-data-tabs give-metabox-tabs">
644
-					<?php foreach ( $form_data_tabs as $index => $form_data_tab ) : ?>
644
+					<?php foreach ($form_data_tabs as $index => $form_data_tab) : ?>
645 645
 						<?php
646 646
 						// Determine if current tab is active.
647 647
 						$is_active = $active_tab === $form_data_tab['id'] ? true : false;
648 648
 						?>
649
-						<li class="<?php echo "{$form_data_tab['id']}_tab" . ( $is_active ? ' active' : '' ) . ( $this->has_sub_tab( $form_data_tab ) ? ' has-sub-fields' : '' ); ?>">
649
+						<li class="<?php echo "{$form_data_tab['id']}_tab".($is_active ? ' active' : '').($this->has_sub_tab($form_data_tab) ? ' has-sub-fields' : ''); ?>">
650 650
 							<a href="#<?php echo $form_data_tab['id']; ?>" data-tab-id="<?php echo $form_data_tab['id']; ?>">
651
-								<?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?>
651
+								<?php if ( ! empty($form_data_tab['icon-html'])) : ?>
652 652
 									<?php echo $form_data_tab['icon-html']; ?>
653 653
 								<?php else : ?>
654 654
 									<span class="give-icon give-icon-default"></span>
655 655
 								<?php endif; ?>
656 656
 								<span class="give-label"><?php echo $form_data_tab['label']; ?></span>
657 657
 							</a>
658
-							<?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?>
658
+							<?php if ($this->has_sub_tab($form_data_tab)) : ?>
659 659
 								<ul class="give-metabox-sub-tabs give-hidden">
660
-									<?php foreach ( $form_data_tab['sub-fields'] as $sub_tab ) : ?>
660
+									<?php foreach ($form_data_tab['sub-fields'] as $sub_tab) : ?>
661 661
 										<li class="<?php echo "{$sub_tab['id']}_tab"; ?>">
662 662
 											<a href="#<?php echo $sub_tab['id']; ?>" data-tab-id="<?php echo $sub_tab['id']; ?>">
663
-												<?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?>
663
+												<?php if ( ! empty($sub_tab['icon-html'])) : ?>
664 664
 													<?php echo $sub_tab['icon-html']; ?>
665 665
 												<?php else : ?>
666 666
 													<span class="give-icon give-icon-default"></span>
@@ -675,30 +675,30 @@  discard block
 block discarded – undo
675 675
 					<?php endforeach; ?>
676 676
 				</ul>
677 677
 
678
-				<?php foreach ( $this->settings as $setting ) : ?>
679
-					<?php if ( ! $this->has_sub_tab( $setting ) ) : ?>
680
-						<?php do_action( "give_before_{$setting['id']}_settings" ); ?>
678
+				<?php foreach ($this->settings as $setting) : ?>
679
+					<?php if ( ! $this->has_sub_tab($setting)) : ?>
680
+						<?php do_action("give_before_{$setting['id']}_settings"); ?>
681 681
 						<?php
682 682
 						// Determine if current panel is active.
683 683
 						$is_active = $active_tab === $setting['id'] ? true : false;
684 684
 						?>
685
-						<div id="<?php echo $setting['id']; ?>" class="panel give_options_panel<?php echo( $is_active ? ' active' : '' ); ?>">
686
-							<?php if ( ! empty( $setting['fields'] ) ) : ?>
687
-								<?php foreach ( $setting['fields'] as $field ) : ?>
688
-									<?php give_render_field( $field ); ?>
685
+						<div id="<?php echo $setting['id']; ?>" class="panel give_options_panel<?php echo($is_active ? ' active' : ''); ?>">
686
+							<?php if ( ! empty($setting['fields'])) : ?>
687
+								<?php foreach ($setting['fields'] as $field) : ?>
688
+									<?php give_render_field($field); ?>
689 689
 								<?php endforeach; ?>
690 690
 							<?php endif; ?>
691 691
 						</div>
692 692
 
693
-						<?php do_action( "give_after_{$setting['id']}_settings" ); ?>
693
+						<?php do_action("give_after_{$setting['id']}_settings"); ?>
694 694
 					<?php else : ?>
695
-						<?php if ( $this->has_sub_tab( $setting ) ) : ?>
696
-							<?php if ( ! empty( $setting['sub-fields'] ) ) : ?>
697
-								<?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?>
695
+						<?php if ($this->has_sub_tab($setting)) : ?>
696
+							<?php if ( ! empty($setting['sub-fields'])) : ?>
697
+								<?php foreach ($setting['sub-fields'] as $index => $sub_fields) : ?>
698 698
 									<div id="<?php echo $sub_fields['id']; ?>" class="panel give_options_panel give-hidden">
699
-										<?php if ( ! empty( $sub_fields['fields'] ) ) : ?>
700
-											<?php foreach ( $sub_fields['fields'] as $sub_field ) : ?>
701
-												<?php give_render_field( $sub_field ); ?>
699
+										<?php if ( ! empty($sub_fields['fields'])) : ?>
700
+											<?php foreach ($sub_fields['fields'] as $sub_field) : ?>
701
+												<?php give_render_field($sub_field); ?>
702 702
 											<?php endforeach; ?>
703 703
 										<?php endif; ?>
704 704
 									</div>
@@ -722,9 +722,9 @@  discard block
 block discarded – undo
722 722
 	 *
723 723
 	 * @return bool
724 724
 	 */
725
-	private function has_sub_tab( $field_setting ) {
725
+	private function has_sub_tab($field_setting) {
726 726
 		$has_sub_tab = false;
727
-		if ( array_key_exists( 'sub-fields', $field_setting ) ) {
727
+		if (array_key_exists('sub-fields', $field_setting)) {
728 728
 			$has_sub_tab = true;
729 729
 		}
730 730
 
@@ -739,13 +739,13 @@  discard block
 block discarded – undo
739 739
 	 * @return array
740 740
 	 */
741 741
 	function cmb2_metabox_settings() {
742
-		$all_cmb2_settings   = apply_filters( 'cmb2_meta_boxes', array() );
742
+		$all_cmb2_settings   = apply_filters('cmb2_meta_boxes', array());
743 743
 		$give_forms_settings = $all_cmb2_settings;
744 744
 
745 745
 		// Filter settings: Use only give forms related settings.
746
-		foreach ( $all_cmb2_settings as $index => $setting ) {
747
-			if ( ! in_array( 'give_forms', $setting['object_types'] ) ) {
748
-				unset( $give_forms_settings[ $index ] );
746
+		foreach ($all_cmb2_settings as $index => $setting) {
747
+			if ( ! in_array('give_forms', $setting['object_types'])) {
748
+				unset($give_forms_settings[$index]);
749 749
 			}
750 750
 		}
751 751
 
@@ -763,96 +763,96 @@  discard block
 block discarded – undo
763 763
 	 *
764 764
 	 * @return void
765 765
 	 */
766
-	public function save( $post_id, $post ) {
766
+	public function save($post_id, $post) {
767 767
 
768 768
 		// $post_id and $post are required.
769
-		if ( empty( $post_id ) || empty( $post ) ) {
769
+		if (empty($post_id) || empty($post)) {
770 770
 			return;
771 771
 		}
772 772
 
773 773
 		// Don't save meta boxes for revisions or autosaves.
774
-		if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) {
774
+		if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) {
775 775
 			return;
776 776
 		}
777 777
 
778 778
 		// Check the nonce.
779
-		if ( empty( $_POST['give_form_meta_nonce'] ) || ! wp_verify_nonce( $_POST['give_form_meta_nonce'], 'give_save_form_meta' ) ) {
779
+		if (empty($_POST['give_form_meta_nonce']) || ! wp_verify_nonce($_POST['give_form_meta_nonce'], 'give_save_form_meta')) {
780 780
 			return;
781 781
 		}
782 782
 
783 783
 		// Check the post being saved == the $post_id to prevent triggering this call for other save_post events.
784
-		if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) {
784
+		if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) {
785 785
 			return;
786 786
 		}
787 787
 
788 788
 		// Check user has permission to edit.
789
-		if ( ! current_user_can( 'edit_post', $post_id ) ) {
789
+		if ( ! current_user_can('edit_post', $post_id)) {
790 790
 			return;
791 791
 		}
792 792
 
793 793
 		// Fire action before saving form meta.
794
-		do_action( 'give_pre_process_give_forms_meta', $post_id, $post );
794
+		do_action('give_pre_process_give_forms_meta', $post_id, $post);
795 795
 
796 796
 		/**
797 797
 		 * Filter the meta key to save.
798 798
 		 * Third party addon developer can remove there meta keys from this array to handle saving data on there own.
799 799
 		 */
800
-		$form_meta_keys = apply_filters( 'give_process_form_meta_keys', $this->get_meta_keys_from_settings() );
800
+		$form_meta_keys = apply_filters('give_process_form_meta_keys', $this->get_meta_keys_from_settings());
801 801
 
802 802
 		// Save form meta data.
803
-		if ( ! empty( $form_meta_keys ) ) {
804
-			foreach ( $form_meta_keys as $form_meta_key ) {
803
+		if ( ! empty($form_meta_keys)) {
804
+			foreach ($form_meta_keys as $form_meta_key) {
805 805
 
806 806
 				// Set default value for checkbox fields.
807 807
 				if (
808
-					! isset( $_POST[ $form_meta_key ] )
809
-					&& ( 'checkbox' === $this->get_field_type( $form_meta_key ) )
808
+					! isset($_POST[$form_meta_key])
809
+					&& ('checkbox' === $this->get_field_type($form_meta_key))
810 810
 				) {
811
-					$_POST[ $form_meta_key ] = '';
811
+					$_POST[$form_meta_key] = '';
812 812
 				}
813 813
 
814
-				if ( isset( $_POST[ $form_meta_key ] ) ) {
815
-					$setting_field = $this->get_setting_field( $form_meta_key );
816
-					if ( ! empty( $setting_field['type'] ) ) {
817
-						switch ( $setting_field['type'] ) {
814
+				if (isset($_POST[$form_meta_key])) {
815
+					$setting_field = $this->get_setting_field($form_meta_key);
816
+					if ( ! empty($setting_field['type'])) {
817
+						switch ($setting_field['type']) {
818 818
 							case 'textarea':
819 819
 							case 'wysiwyg':
820
-								$form_meta_value = wp_kses_post( $_POST[ $form_meta_key ] );
820
+								$form_meta_value = wp_kses_post($_POST[$form_meta_key]);
821 821
 								break;
822 822
 
823 823
 							case 'group':
824 824
 								$form_meta_value = array();
825 825
 
826
-								foreach ( $_POST[ $form_meta_key ] as $index => $group ) {
826
+								foreach ($_POST[$form_meta_key] as $index => $group) {
827 827
 
828 828
 									// Do not save template input field values.
829
-									if ( '{{row-count-placeholder}}' === $index ) {
829
+									if ('{{row-count-placeholder}}' === $index) {
830 830
 										continue;
831 831
 									}
832 832
 
833 833
 									$group_meta_value = array();
834
-									foreach ( $group as $field_id => $field_value ) {
835
-										switch ( $this->get_field_type( $field_id, $form_meta_key ) ) {
834
+									foreach ($group as $field_id => $field_value) {
835
+										switch ($this->get_field_type($field_id, $form_meta_key)) {
836 836
 											case 'wysiwyg':
837
-												$group_meta_value[ $field_id ] = wp_kses_post( $field_value );
837
+												$group_meta_value[$field_id] = wp_kses_post($field_value);
838 838
 												break;
839 839
 
840 840
 											default:
841
-												$group_meta_value[ $field_id ] = give_clean( $field_value );
841
+												$group_meta_value[$field_id] = give_clean($field_value);
842 842
 										}
843 843
 									}
844 844
 
845
-									if ( ! empty( $group_meta_value ) ) {
846
-										$form_meta_value[ $index ] = $group_meta_value;
845
+									if ( ! empty($group_meta_value)) {
846
+										$form_meta_value[$index] = $group_meta_value;
847 847
 									}
848 848
 								}
849 849
 
850 850
 								// Arrange repeater field keys in order.
851
-								$form_meta_value = array_values( $form_meta_value );
851
+								$form_meta_value = array_values($form_meta_value);
852 852
 								break;
853 853
 
854 854
 							default:
855
-								$form_meta_value = give_clean( $_POST[ $form_meta_key ] );
855
+								$form_meta_value = give_clean($_POST[$form_meta_key]);
856 856
 						}// End switch().
857 857
 
858 858
 						/**
@@ -862,24 +862,24 @@  discard block
 block discarded – undo
862 862
 						 */
863 863
 						$form_meta_value = apply_filters(
864 864
 							'give_pre_save_form_meta_value',
865
-							$this->sanitize_form_meta( $form_meta_value, $setting_field ),
865
+							$this->sanitize_form_meta($form_meta_value, $setting_field),
866 866
 							$form_meta_key,
867 867
 							$this,
868 868
 							$post_id
869 869
 						);
870 870
 
871 871
 						// Save data.
872
-						give_update_meta( $post_id, $form_meta_key, $form_meta_value );
872
+						give_update_meta($post_id, $form_meta_key, $form_meta_value);
873 873
 
874 874
 						// Fire after saving form meta key.
875
-						do_action( "give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post );
875
+						do_action("give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post);
876 876
 					}// End if().
877 877
 				}// End if().
878 878
 			}// End foreach().
879 879
 		}// End if().
880 880
 
881 881
 		// Fire action after saving form meta.
882
-		do_action( 'give_post_process_give_forms_meta', $post_id, $post );
882
+		do_action('give_post_process_give_forms_meta', $post_id, $post);
883 883
 	}
884 884
 
885 885
 
@@ -892,10 +892,10 @@  discard block
 block discarded – undo
892 892
 	 *
893 893
 	 * @return string
894 894
 	 */
895
-	private function get_field_id( $field ) {
895
+	private function get_field_id($field) {
896 896
 		$field_id = '';
897 897
 
898
-		if ( array_key_exists( 'id', $field ) ) {
898
+		if (array_key_exists('id', $field)) {
899 899
 			$field_id = $field['id'];
900 900
 
901 901
 		}
@@ -912,12 +912,12 @@  discard block
 block discarded – undo
912 912
 	 *
913 913
 	 * @return array
914 914
 	 */
915
-	private function get_fields_id( $setting ) {
915
+	private function get_fields_id($setting) {
916 916
 		$meta_keys = array();
917 917
 
918
-		if ( ! empty( $setting ) ) {
919
-			foreach ( $setting['fields'] as $field ) {
920
-				if ( $field_id = $this->get_field_id( $field ) ) {
918
+		if ( ! empty($setting)) {
919
+			foreach ($setting['fields'] as $field) {
920
+				if ($field_id = $this->get_field_id($field)) {
921 921
 					$meta_keys[] = $field_id;
922 922
 				}
923 923
 			}
@@ -935,14 +935,14 @@  discard block
 block discarded – undo
935 935
 	 *
936 936
 	 * @return array
937 937
 	 */
938
-	private function get_sub_fields_id( $setting ) {
938
+	private function get_sub_fields_id($setting) {
939 939
 		$meta_keys = array();
940 940
 
941
-		if ( $this->has_sub_tab( $setting ) && ! empty( $setting['sub-fields'] ) ) {
942
-			foreach ( $setting['sub-fields'] as $fields ) {
943
-				if ( ! empty( $fields['fields'] ) ) {
944
-					foreach ( $fields['fields'] as $field ) {
945
-						if ( $field_id = $this->get_field_id( $field ) ) {
941
+		if ($this->has_sub_tab($setting) && ! empty($setting['sub-fields'])) {
942
+			foreach ($setting['sub-fields'] as $fields) {
943
+				if ( ! empty($fields['fields'])) {
944
+					foreach ($fields['fields'] as $field) {
945
+						if ($field_id = $this->get_field_id($field)) {
946 946
 							$meta_keys[] = $field_id;
947 947
 						}
948 948
 					}
@@ -964,14 +964,14 @@  discard block
 block discarded – undo
964 964
 	private function get_meta_keys_from_settings() {
965 965
 		$meta_keys = array();
966 966
 
967
-		foreach ( $this->settings as $setting ) {
968
-			if ( $this->has_sub_tab( $setting ) ) {
969
-				$meta_key = $this->get_sub_fields_id( $setting );
967
+		foreach ($this->settings as $setting) {
968
+			if ($this->has_sub_tab($setting)) {
969
+				$meta_key = $this->get_sub_fields_id($setting);
970 970
 			} else {
971
-				$meta_key = $this->get_fields_id( $setting );
971
+				$meta_key = $this->get_fields_id($setting);
972 972
 			}
973 973
 
974
-			$meta_keys = array_merge( $meta_keys, $meta_key );
974
+			$meta_keys = array_merge($meta_keys, $meta_key);
975 975
 		}
976 976
 
977 977
 		return $meta_keys;
@@ -988,10 +988,10 @@  discard block
 block discarded – undo
988 988
 	 *
989 989
 	 * @return string
990 990
 	 */
991
-	function get_field_type( $field_id, $group_id = '' ) {
992
-		$field = $this->get_setting_field( $field_id, $group_id );
991
+	function get_field_type($field_id, $group_id = '') {
992
+		$field = $this->get_setting_field($field_id, $group_id);
993 993
 
994
-		$type = array_key_exists( 'type', $field )
994
+		$type = array_key_exists('type', $field)
995 995
 			? $field['type']
996 996
 			: '';
997 997
 
@@ -1009,12 +1009,12 @@  discard block
 block discarded – undo
1009 1009
 	 *
1010 1010
 	 * @return array
1011 1011
 	 */
1012
-	private function get_field( $setting, $field_id ) {
1012
+	private function get_field($setting, $field_id) {
1013 1013
 		$setting_field = array();
1014 1014
 
1015
-		if ( ! empty( $setting['fields'] ) ) {
1016
-			foreach ( $setting['fields'] as $field ) {
1017
-				if ( array_key_exists( 'id', $field ) && $field['id'] === $field_id ) {
1015
+		if ( ! empty($setting['fields'])) {
1016
+			foreach ($setting['fields'] as $field) {
1017
+				if (array_key_exists('id', $field) && $field['id'] === $field_id) {
1018 1018
 					$setting_field = $field;
1019 1019
 					break;
1020 1020
 				}
@@ -1034,12 +1034,12 @@  discard block
 block discarded – undo
1034 1034
 	 *
1035 1035
 	 * @return array
1036 1036
 	 */
1037
-	private function get_sub_field( $setting, $field_id ) {
1037
+	private function get_sub_field($setting, $field_id) {
1038 1038
 		$setting_field = array();
1039 1039
 
1040
-		if ( ! empty( $setting['sub-fields'] ) ) {
1041
-			foreach ( $setting['sub-fields'] as $fields ) {
1042
-				if ( $field = $this->get_field( $fields, $field_id ) ) {
1040
+		if ( ! empty($setting['sub-fields'])) {
1041
+			foreach ($setting['sub-fields'] as $fields) {
1042
+				if ($field = $this->get_field($fields, $field_id)) {
1043 1043
 					$setting_field = $field;
1044 1044
 					break;
1045 1045
 				}
@@ -1059,17 +1059,17 @@  discard block
 block discarded – undo
1059 1059
 	 *
1060 1060
 	 * @return array
1061 1061
 	 */
1062
-	function get_setting_field( $field_id, $group_id = '' ) {
1062
+	function get_setting_field($field_id, $group_id = '') {
1063 1063
 		$setting_field = array();
1064 1064
 
1065 1065
 		$_field_id = $field_id;
1066
-		$field_id  = empty( $group_id ) ? $field_id : $group_id;
1066
+		$field_id  = empty($group_id) ? $field_id : $group_id;
1067 1067
 
1068
-		if ( ! empty( $this->settings ) ) {
1069
-			foreach ( $this->settings as $setting ) {
1068
+		if ( ! empty($this->settings)) {
1069
+			foreach ($this->settings as $setting) {
1070 1070
 				if (
1071
-					( $this->has_sub_tab( $setting ) && ( $setting_field = $this->get_sub_field( $setting, $field_id ) ) )
1072
-					|| ( $setting_field = $this->get_field( $setting, $field_id ) )
1071
+					($this->has_sub_tab($setting) && ($setting_field = $this->get_sub_field($setting, $field_id)))
1072
+					|| ($setting_field = $this->get_field($setting, $field_id))
1073 1073
 				) {
1074 1074
 					break;
1075 1075
 				}
@@ -1077,9 +1077,9 @@  discard block
 block discarded – undo
1077 1077
 		}
1078 1078
 
1079 1079
 		// Get field from group.
1080
-		if ( ! empty( $group_id ) ) {
1081
-			foreach ( $setting_field['fields'] as $field ) {
1082
-				if ( array_key_exists( 'id', $field ) && $field['id'] === $_field_id ) {
1080
+		if ( ! empty($group_id)) {
1081
+			foreach ($setting_field['fields'] as $field) {
1082
+				if (array_key_exists('id', $field) && $field['id'] === $_field_id) {
1083 1083
 					$setting_field = $field;
1084 1084
 				}
1085 1085
 			}
@@ -1098,14 +1098,14 @@  discard block
 block discarded – undo
1098 1098
 	 *
1099 1099
 	 * @return mixed
1100 1100
 	 */
1101
-	function add_offline_donations_setting_tab( $settings ) {
1102
-		if ( give_is_gateway_active( 'offline' ) ) {
1103
-			$settings['offline_donations_options'] = apply_filters( 'give_forms_offline_donations_options', array(
1101
+	function add_offline_donations_setting_tab($settings) {
1102
+		if (give_is_gateway_active('offline')) {
1103
+			$settings['offline_donations_options'] = apply_filters('give_forms_offline_donations_options', array(
1104 1104
 				'id'        => 'offline_donations_options',
1105
-				'title'     => __( 'Offline Donations', 'give' ),
1105
+				'title'     => __('Offline Donations', 'give'),
1106 1106
 				'icon-html' => '<span class="give-icon give-icon-purse"></span>',
1107
-				'fields'    => apply_filters( 'give_forms_offline_donations_metabox_fields', array() ),
1108
-			) );
1107
+				'fields'    => apply_filters('give_forms_offline_donations_metabox_fields', array()),
1108
+			));
1109 1109
 		}
1110 1110
 
1111 1111
 		return $settings;
@@ -1123,37 +1123,33 @@  discard block
 block discarded – undo
1123 1123
 	 *
1124 1124
 	 * @return mixed
1125 1125
 	 */
1126
-	function sanitize_form_meta( $meta_value, $setting_field ) {
1127
-		switch ( $setting_field['type'] ) {
1126
+	function sanitize_form_meta($meta_value, $setting_field) {
1127
+		switch ($setting_field['type']) {
1128 1128
 			case 'group':
1129
-				if ( ! empty( $setting_field['fields'] ) ) {
1130
-					foreach ( $setting_field['fields'] as $field ) {
1131
-						if ( empty( $field['data_type'] ) || 'price' !== $field['data_type'] ) {
1129
+				if ( ! empty($setting_field['fields'])) {
1130
+					foreach ($setting_field['fields'] as $field) {
1131
+						if (empty($field['data_type']) || 'price' !== $field['data_type']) {
1132 1132
 							continue;
1133 1133
 						}
1134 1134
 
1135
-						foreach ( $meta_value as $index => $meta_data ) {
1136
-							if ( ! isset( $meta_value[ $index ][ $field['id'] ] ) ) {
1135
+						foreach ($meta_value as $index => $meta_data) {
1136
+							if ( ! isset($meta_value[$index][$field['id']])) {
1137 1137
 								continue;
1138 1138
 							}
1139 1139
 
1140
-							$meta_value[ $index ][ $field['id'] ] = ! empty( $meta_value[ $index ][ $field['id'] ] ) ?
1141
-								give_sanitize_amount_for_db( $meta_value[ $index ][ $field['id'] ] ) :
1142
-								( ( '_give_amount' === $field['id'] && empty( $field_value ) ) ?
1143
-									give_sanitize_amount_for_db( '1.00' ) :
1144
-									0 );
1140
+							$meta_value[$index][$field['id']] = ! empty($meta_value[$index][$field['id']]) ?
1141
+								give_sanitize_amount_for_db($meta_value[$index][$field['id']]) : (('_give_amount' === $field['id'] && empty($field_value)) ?
1142
+									give_sanitize_amount_for_db('1.00') : 0);
1145 1143
 						}
1146 1144
 					}
1147 1145
 				}
1148 1146
 				break;
1149 1147
 
1150 1148
 			default:
1151
-				if ( ! empty( $setting_field['data_type'] ) && 'price' === $setting_field['data_type'] ) {
1149
+				if ( ! empty($setting_field['data_type']) && 'price' === $setting_field['data_type']) {
1152 1150
 					$meta_value = $meta_value ?
1153
-						give_sanitize_amount_for_db( $meta_value ) :
1154
-						( in_array( $setting_field['id'], array( '_give_set_price', '_give_custom_amount_minimum', '_give_set_goal' ) ) ?
1155
-							give_sanitize_amount_for_db( '1.00' ) :
1156
-							0 );
1151
+						give_sanitize_amount_for_db($meta_value) : (in_array($setting_field['id'], array('_give_set_price', '_give_custom_amount_minimum', '_give_set_goal')) ?
1152
+							give_sanitize_amount_for_db('1.00') : 0);
1157 1153
 				}
1158 1154
 		}
1159 1155
 
@@ -1171,12 +1167,12 @@  discard block
 block discarded – undo
1171 1167
 	 *
1172 1168
 	 * @return string The URL after redirect.
1173 1169
 	 */
1174
-	public function maintain_active_tab( $location, $post_id ) {
1170
+	public function maintain_active_tab($location, $post_id) {
1175 1171
 		if (
1176
-			'give_forms' === get_post_type( $post_id ) &&
1177
-			! empty( $_POST['give_form_active_tab'] )
1172
+			'give_forms' === get_post_type($post_id) &&
1173
+			! empty($_POST['give_form_active_tab'])
1178 1174
 		) {
1179
-			$location = add_query_arg( 'give_tab', give_clean( $_POST['give_form_active_tab'] ), $location );
1175
+			$location = add_query_arg('give_tab', give_clean($_POST['give_form_active_tab']), $location);
1180 1176
 		}
1181 1177
 
1182 1178
 		return $location;
Please login to merge, or discard this patch.
includes/admin/reports/class-gateways-reports-table.php 1 patch
Spacing   +48 added lines, -51 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
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 51
 			'ajax'     => false                        // Does this table support ajax?
52
-		) );
52
+		));
53 53
 
54 54
 	}
55 55
 
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return string Column Name
66 66
 	 */
67
-	public function column_default( $item, $column_name ) {
68
-		$donation_list_page_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
67
+	public function column_default($item, $column_name) {
68
+		$donation_list_page_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history');
69 69
 
70
-		switch ( $column_name ) {
70
+		switch ($column_name) {
71 71
 			case 'complete_sales':
72
-				$value = $item[ $column_name ] ?
72
+				$value = $item[$column_name] ?
73 73
 					sprintf(
74 74
 						'<a href="%s">%s</a>',
75 75
 						add_query_arg(
@@ -79,13 +79,12 @@  discard block
 block discarded – undo
79 79
 							),
80 80
 							$donation_list_page_url
81 81
 						),
82
-						$item[ $column_name ]
83
-					) :
84
-					$item[ $column_name ];
82
+						$item[$column_name]
83
+					) : $item[$column_name];
85 84
 				break;
86 85
 
87 86
 			case 'pending_sales':
88
-				$value = $item[ $column_name ] ?
87
+				$value = $item[$column_name] ?
89 88
 					sprintf(
90 89
 						'<a href="%s">%s</a>',
91 90
 						add_query_arg(
@@ -95,13 +94,12 @@  discard block
 block discarded – undo
95 94
 							),
96 95
 							$donation_list_page_url
97 96
 						),
98
-						$item[ $column_name ]
99
-					) :
100
-					$item[ $column_name ];
97
+						$item[$column_name]
98
+					) : $item[$column_name];
101 99
 				break;
102 100
 
103 101
 			case 'total_sales':
104
-				$value = $item[ $column_name ] ?
102
+				$value = $item[$column_name] ?
105 103
 					sprintf(
106 104
 						'<a href="%s">%s</a>',
107 105
 						add_query_arg(
@@ -110,14 +108,13 @@  discard block
 block discarded – undo
110 108
 							),
111 109
 							$donation_list_page_url
112 110
 						),
113
-						$item[ $column_name ]
114
-					) :
115
-					$item[ $column_name ];
111
+						$item[$column_name]
112
+					) : $item[$column_name];
116 113
 
117 114
 				break;
118 115
 
119 116
 			default:
120
-				$value = $item[ $column_name ];
117
+				$value = $item[$column_name];
121 118
 		}
122 119
 
123 120
 		return $value;
@@ -132,11 +129,11 @@  discard block
 block discarded – undo
132 129
 	 */
133 130
 	public function get_columns() {
134 131
 		$columns = array(
135
-			'label'           => esc_attr__( 'Gateway', 'give' ),
136
-			'complete_sales'  => esc_attr__( 'Complete Payments', 'give' ),
137
-			'pending_sales'   => esc_attr__( 'Pending / Failed Payments', 'give' ),
138
-			'total_sales'     => esc_attr__( 'Total Payments', 'give' ),
139
-			'total_donations' => esc_attr__( 'Total Donated', 'give' )
132
+			'label'           => esc_attr__('Gateway', 'give'),
133
+			'complete_sales'  => esc_attr__('Complete Payments', 'give'),
134
+			'pending_sales'   => esc_attr__('Pending / Failed Payments', 'give'),
135
+			'total_sales'     => esc_attr__('Total Payments', 'give'),
136
+			'total_donations' => esc_attr__('Total Donated', 'give')
140 137
 		);
141 138
 
142 139
 		return $columns;
@@ -151,7 +148,7 @@  discard block
 block discarded – undo
151 148
 	 */
152 149
 	public function get_sortable_columns() {
153 150
 		return array(
154
-			'total_donations' => array( 'total_donations', false )
151
+			'total_donations' => array('total_donations', false)
155 152
 		);
156 153
 	}
157 154
 
@@ -164,7 +161,7 @@  discard block
 block discarded – undo
164 161
 	 * @return int Current page number
165 162
 	 */
166 163
 	public function get_paged() {
167
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
164
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
168 165
 	}
169 166
 
170 167
 
@@ -175,7 +172,7 @@  discard block
 block discarded – undo
175 172
 	 * @since  1.0
176 173
 	 * @return void
177 174
 	 */
178
-	public function bulk_actions( $which = '' ) {
175
+	public function bulk_actions($which = '') {
179 176
 
180 177
 	}
181 178
 
@@ -187,27 +184,27 @@  discard block
 block discarded – undo
187 184
 	 *
188 185
 	 * @param string $which
189 186
 	 */
190
-	protected function display_tablenav( $which ) {
187
+	protected function display_tablenav($which) {
191 188
 
192
-		if ( 'top' === $which ) {
193
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
189
+		if ('top' === $which) {
190
+			wp_nonce_field('bulk-'.$this->_args['plural']);
194 191
 		}
195 192
 		?>
196
-		<div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr( $which ); ?>">
193
+		<div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr($which); ?>">
197 194
 
198
-			<?php if ( 'top' === $which ) { ?>
195
+			<?php if ('top' === $which) { ?>
199 196
 				<h2 class="alignleft reports-earnings-title screen-reader-text">
200
-					<?php _e( 'Donation Methods Report', 'give' ); ?>
197
+					<?php _e('Donation Methods Report', 'give'); ?>
201 198
 				</h2>
202 199
 			<?php } ?>
203 200
 
204 201
 			<div class="alignright tablenav-right">
205 202
 				<div class="actions bulkactions">
206
-					<?php $this->bulk_actions( $which ); ?>
203
+					<?php $this->bulk_actions($which); ?>
207 204
 				</div>
208 205
 				<?php
209
-				$this->extra_tablenav( $which );
210
-				$this->pagination( $which );
206
+				$this->extra_tablenav($which);
207
+				$this->pagination($which);
211 208
 				?>
212 209
 			</div>
213 210
 
@@ -229,17 +226,17 @@  discard block
 block discarded – undo
229 226
 	 *
230 227
 	 * @return int
231 228
 	 */
232
-	public function give_sort_total_donations( $old_value, $new_value ) {
229
+	public function give_sort_total_donations($old_value, $new_value) {
233 230
 		// If no sort, default to label.
234
-		$orderby = ( ! empty( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : 'label';
231
+		$orderby = ( ! empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'label';
235 232
 
236 233
 		//If no order, default to asc.
237
-		$order = ( ! empty( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : 'asc';
234
+		$order = ( ! empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'asc';
238 235
 
239 236
 		//Determine sort order.
240
-		$result = strcmp( $old_value[ $orderby ], $new_value[ $orderby ] );
237
+		$result = strcmp($old_value[$orderby], $new_value[$orderby]);
241 238
 
242
-		return ( $order === 'asc' ) ? $result : -$result;
239
+		return ($order === 'asc') ? $result : -$result;
243 240
 	}
244 241
 
245 242
 
@@ -256,10 +253,10 @@  discard block
 block discarded – undo
256 253
 		$gateways     = give_get_payment_gateways();
257 254
 		$stats        = new Give_Payment_Stats();
258 255
 
259
-		foreach ( $gateways as $gateway_id => $gateway ) {
256
+		foreach ($gateways as $gateway_id => $gateway) {
260 257
 
261
-			$complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' );
262
-			$pending_count  = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) );
258
+			$complete_count = give_count_sales_by_gateway($gateway_id, 'publish');
259
+			$pending_count  = give_count_sales_by_gateway($gateway_id, array('pending', 'failed'));
263 260
 
264 261
 			$reports_data[] = array(
265 262
 				'ID'              => $gateway_id,
@@ -267,7 +264,7 @@  discard block
 block discarded – undo
267 264
 				'complete_sales'  => $complete_count,
268 265
 				'pending_sales'   => $pending_count,
269 266
 				'total_sales'     => $complete_count + $pending_count,
270
-				'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, strtotime('04/13/2015' ), current_time('timestamp' ), $gateway_id ), array( 'sanitize' => false ) ) ),
267
+				'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, strtotime('04/13/2015'), current_time('timestamp'), $gateway_id), array('sanitize' => false))),
271 268
 			);
272 269
 		}
273 270
 
@@ -288,11 +285,11 @@  discard block
 block discarded – undo
288 285
 		$columns               = $this->get_columns();
289 286
 		$hidden                = array(); // No hidden columns
290 287
 		$sortable              = $this->get_sortable_columns();
291
-		$this->_column_headers = array( $columns, $hidden, $sortable );
288
+		$this->_column_headers = array($columns, $hidden, $sortable);
292 289
 		$this->items           = $this->reports_data();
293 290
 
294 291
 		// Sort Array when we are sorting data in array.
295
-		usort( $this->items, array( $this, 'give_sort_total_donations' ) );
292
+		usort($this->items, array($this, 'give_sort_total_donations'));
296 293
 
297 294
 	}
298 295
 }
Please login to merge, or discard this patch.