Test Failed
Pull Request — master (#3324)
by Devin
07:59
created
includes/emails/class-give-email-tags.php 1 patch
Spacing   +275 added lines, -275 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  */
24 24
 
25 25
 // Exit if accessed directly.
26
-if ( ! defined( 'ABSPATH' ) ) {
26
+if ( ! defined('ABSPATH')) {
27 27
 	exit;
28 28
 }
29 29
 
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 	 * @param callable $func        Hook to run when email tag is found
57 57
 	 * @param string   $context     Email tag category
58 58
 	 */
59
-	public function add( $tag, $description, $func, $context = '' ) {
60
-		if ( is_callable( $func ) ) {
61
-			$this->tags[ $tag ] = array(
59
+	public function add($tag, $description, $func, $context = '') {
60
+		if (is_callable($func)) {
61
+			$this->tags[$tag] = array(
62 62
 				'tag'         => $tag,
63 63
 				'description' => $description,
64 64
 				'func'        => $func,
65
-				'context'     => give_check_variable( $context, 'empty', 'general' ),
65
+				'context'     => give_check_variable($context, 'empty', 'general'),
66 66
 			);
67 67
 		}
68 68
 	}
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 	 *
75 75
 	 * @param string $tag Email tag to remove hook from
76 76
 	 */
77
-	public function remove( $tag ) {
78
-		unset( $this->tags[ $tag ] );
77
+	public function remove($tag) {
78
+		unset($this->tags[$tag]);
79 79
 	}
80 80
 
81 81
 	/**
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 *
88 88
 	 * @return bool
89 89
 	 */
90
-	public function email_tag_exists( $tag ) {
91
-		return array_key_exists( $tag, $this->tags );
90
+	public function email_tag_exists($tag) {
91
+		return array_key_exists($tag, $this->tags);
92 92
 	}
93 93
 
94 94
 	/**
@@ -102,23 +102,23 @@  discard block
 block discarded – undo
102 102
 	 *
103 103
 	 * @return array
104 104
 	 */
105
-	public function get_tags( $context_type = 'all', $field = '' ) {
105
+	public function get_tags($context_type = 'all', $field = '') {
106 106
 		$tags = $this->tags;
107 107
 
108
-		if ( 'all' !== $context_type ) {
108
+		if ('all' !== $context_type) {
109 109
 			$tags = array();
110 110
 
111
-			foreach ( $this->tags as $tag ) {
112
-				if ( empty( $tag['context'] ) || $context_type !== $tag['context'] ) {
111
+			foreach ($this->tags as $tag) {
112
+				if (empty($tag['context']) || $context_type !== $tag['context']) {
113 113
 					continue;
114 114
 				}
115 115
 
116
-				$tags[ $tag['tag'] ] = $tag;
116
+				$tags[$tag['tag']] = $tag;
117 117
 			}
118 118
 		}
119 119
 
120
-		if ( ! empty( $tags ) && ! empty( $field ) ) {
121
-			$tags = wp_list_pluck( $tags, $field );
120
+		if ( ! empty($tags) && ! empty($field)) {
121
+			$tags = wp_list_pluck($tags, $field);
122 122
 		}
123 123
 
124 124
 		return $tags;
@@ -136,16 +136,16 @@  discard block
 block discarded – undo
136 136
 	 *
137 137
 	 * @return string Content with email tags filtered out.
138 138
 	 */
139
-	public function do_tags( $content, $tag_args ) {
139
+	public function do_tags($content, $tag_args) {
140 140
 
141 141
 		// Check if there is at least one tag added.
142
-		if ( empty( $this->tags ) || ! is_array( $this->tags ) ) {
142
+		if (empty($this->tags) || ! is_array($this->tags)) {
143 143
 			return $content;
144 144
 		}
145 145
 
146 146
 		$this->tag_args = $tag_args;
147 147
 
148
-		$new_content = preg_replace_callback( "/{([A-z0-9\-\_]+)}/s", array( $this, 'do_tag' ), $content );
148
+		$new_content = preg_replace_callback("/{([A-z0-9\-\_]+)}/s", array($this, 'do_tag'), $content);
149 149
 
150 150
 		$this->tag_args = null;
151 151
 
@@ -161,17 +161,17 @@  discard block
 block discarded – undo
161 161
 	 *
162 162
 	 * @return mixed
163 163
 	 */
164
-	public function do_tag( $m ) {
164
+	public function do_tag($m) {
165 165
 
166 166
 		// Get tag
167 167
 		$tag = $m[1];
168 168
 
169 169
 		// Return tag if tag not set
170
-		if ( ! $this->email_tag_exists( $tag ) ) {
170
+		if ( ! $this->email_tag_exists($tag)) {
171 171
 			return $m[0];
172 172
 		}
173 173
 
174
-		return call_user_func( $this->tags[ $tag ]['func'], $this->tag_args, $tag );
174
+		return call_user_func($this->tags[$tag]['func'], $this->tag_args, $tag);
175 175
 	}
176 176
 
177 177
 }
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
  * @param callable $func        Hook to run when email tag is found
187 187
  * @param string   $context     Email tag category
188 188
  */
189
-function give_add_email_tag( $tag, $description, $func, $context = '' ) {
190
-	Give()->email_tags->add( $tag, $description, $func, $context );
189
+function give_add_email_tag($tag, $description, $func, $context = '') {
190
+	Give()->email_tags->add($tag, $description, $func, $context);
191 191
 }
192 192
 
193 193
 /**
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
  *
198 198
  * @param string $tag Email tag to remove hook from
199 199
  */
200
-function give_remove_email_tag( $tag ) {
201
-	Give()->email_tags->remove( $tag );
200
+function give_remove_email_tag($tag) {
201
+	Give()->email_tags->remove($tag);
202 202
 }
203 203
 
204 204
 /**
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
  *
211 211
  * @return bool
212 212
  */
213
-function give_email_tag_exists( $tag ) {
214
-	return Give()->email_tags->email_tag_exists( $tag );
213
+function give_email_tag_exists($tag) {
214
+	return Give()->email_tags->email_tag_exists($tag);
215 215
 }
216 216
 
217 217
 /**
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
 	$email_tags = give_get_email_tags();
239 239
 
240 240
 	ob_start();
241
-	if ( count( $email_tags ) > 0 ) : ?>
241
+	if (count($email_tags) > 0) : ?>
242 242
 		<div class="give-email-tags-wrap">
243
-			<?php foreach ( $email_tags as $email_tag ) : ?>
243
+			<?php foreach ($email_tags as $email_tag) : ?>
244 244
 				<span class="give_<?php echo $email_tag['tag']; ?>_tag">
245 245
 					<code>{<?php echo $email_tag['tag']; ?>}</code> - <?php echo $email_tag['description']; ?>
246 246
 				</span>
@@ -264,14 +264,14 @@  discard block
 block discarded – undo
264 264
  *
265 265
  * @return string Content with email tags filtered out.
266 266
  */
267
-function give_do_email_tags( $content, $tag_args ) {
267
+function give_do_email_tags($content, $tag_args) {
268 268
 	// Backward compatibility < 2.0
269
-	if ( ! is_array( $tag_args ) ) {
270
-		$tag_args = array( 'payment_id' => $tag_args );
269
+	if ( ! is_array($tag_args)) {
270
+		$tag_args = array('payment_id' => $tag_args);
271 271
 	}
272 272
 
273 273
 	// Replace all tags
274
-	$content = Give()->email_tags->do_tags( $content, $tag_args );
274
+	$content = Give()->email_tags->do_tags($content, $tag_args);
275 275
 
276 276
 	/**
277 277
 	 * Filter the filtered content text.
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	 * @since 1.0
280 280
 	 * @since 2.0 $payment_meta, $payment_id removed and $tag_args added.
281 281
 	 */
282
-	$content = apply_filters( 'give_email_template_tags', $content, $tag_args );
282
+	$content = apply_filters('give_email_template_tags', $content, $tag_args);
283 283
 
284 284
 	// Return content
285 285
 	return $content;
@@ -298,10 +298,10 @@  discard block
 block discarded – undo
298 298
 	 *
299 299
 	 * @since 1.0
300 300
 	 */
301
-	do_action( 'give_add_email_tags' );
301
+	do_action('give_add_email_tags');
302 302
 }
303 303
 
304
-add_action( 'init', 'give_load_email_tags', - 999 );
304
+add_action('init', 'give_load_email_tags', - 999);
305 305
 
306 306
 
307 307
 /**
@@ -316,67 +316,67 @@  discard block
 block discarded – undo
316 316
 		/*	Donation Payment */
317 317
 		array(
318 318
 			'tag'         => 'donation',
319
-			'description' => esc_html__( 'The donation form name, and the donation level (if applicable).', 'give' ),
319
+			'description' => esc_html__('The donation form name, and the donation level (if applicable).', 'give'),
320 320
 			'function'    => 'give_email_tag_donation',
321 321
 			'context'     => 'donation',
322 322
 		),
323 323
 		array(
324 324
 			'tag'         => 'amount',
325
-			'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ),
325
+			'description' => esc_html__('The total donation amount with currency sign.', 'give'),
326 326
 			'function'    => 'give_email_tag_amount',
327 327
 			'context'     => 'donation',
328 328
 		),
329 329
 		array(
330 330
 			'tag'         => 'price',
331
-			'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ),
331
+			'description' => esc_html__('The total donation amount with currency sign.', 'give'),
332 332
 			'function'    => 'give_email_tag_price',
333 333
 			'context'     => 'donation',
334 334
 		),
335 335
 		array(
336 336
 			'tag'         => 'billing_address',
337
-			'description' => esc_html__( 'The donor\'s billing address.', 'give' ),
337
+			'description' => esc_html__('The donor\'s billing address.', 'give'),
338 338
 			'function'    => 'give_email_tag_billing_address',
339 339
 			'context'     => 'donation',
340 340
 		),
341 341
 		array(
342 342
 			'tag'         => 'date',
343
-			'description' => esc_html__( 'The date of the donation.', 'give' ),
343
+			'description' => esc_html__('The date of the donation.', 'give'),
344 344
 			'function'    => 'give_email_tag_date',
345 345
 			'context'     => 'donation',
346 346
 		),
347 347
 		array(
348 348
 			'tag'         => 'payment_id',
349
-			'description' => esc_html__( 'The unique ID number for this donation.', 'give' ),
349
+			'description' => esc_html__('The unique ID number for this donation.', 'give'),
350 350
 			'function'    => 'give_email_tag_payment_id',
351 351
 			'context'     => 'donation',
352 352
 		),
353 353
 		array(
354 354
 			'tag'         => 'payment_method',
355
-			'description' => esc_html__( 'The method of payment used for this donation.', 'give' ),
355
+			'description' => esc_html__('The method of payment used for this donation.', 'give'),
356 356
 			'function'    => 'give_email_tag_payment_method',
357 357
 			'context'     => 'donation',
358 358
 		),
359 359
 		array(
360 360
 			'tag'         => 'payment_total',
361
-			'description' => esc_html__( 'The payment total for this donation.', 'give' ),
361
+			'description' => esc_html__('The payment total for this donation.', 'give'),
362 362
 			'function'    => 'give_email_tag_payment_total',
363 363
 			'context'     => 'donation',
364 364
 		),
365 365
 		array(
366 366
 			'tag'         => 'receipt_id',
367
-			'description' => esc_html__( 'The unique ID number for this donation receipt.', 'give' ),
367
+			'description' => esc_html__('The unique ID number for this donation receipt.', 'give'),
368 368
 			'function'    => 'give_email_tag_receipt_id',
369 369
 			'context'     => 'donation',
370 370
 		),
371 371
 		array(
372 372
 			'tag'         => 'receipt_link',
373
-			'description' => esc_html__( 'The donation receipt direct link, to view the receipt on the website.', 'give' ),
373
+			'description' => esc_html__('The donation receipt direct link, to view the receipt on the website.', 'give'),
374 374
 			'function'    => 'give_email_tag_receipt_link',
375 375
 			'context'     => 'donation',
376 376
 		),
377 377
 		array(
378 378
 			'tag'         => 'receipt_link_url',
379
-			'description' => esc_html__( 'The donation receipt direct URL, to view the receipt on the website.', 'give' ),
379
+			'description' => esc_html__('The donation receipt direct URL, to view the receipt on the website.', 'give'),
380 380
 			'function'    => 'give_email_tag_receipt_link_url',
381 381
 			'context'     => 'donation',
382 382
 		),
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 		/* Donation Form */
385 385
 		array(
386 386
 			'tag'         => 'form_title',
387
-			'description' => esc_html__( 'The donation form name.', 'give' ),
387
+			'description' => esc_html__('The donation form name.', 'give'),
388 388
 			'function'    => 'give_email_tag_form_title',
389 389
 			'context'     => 'form',
390 390
 		),
@@ -392,37 +392,37 @@  discard block
 block discarded – undo
392 392
 		/* Donor */
393 393
 		array(
394 394
 			'tag'         => 'name',
395
-			'description' => esc_html__( 'The donor\'s first name.', 'give' ),
395
+			'description' => esc_html__('The donor\'s first name.', 'give'),
396 396
 			'function'    => 'give_email_tag_first_name',
397 397
 			'context'     => 'donor',
398 398
 		),
399 399
 		array(
400 400
 			'tag'         => 'fullname',
401
-			'description' => esc_html__( 'The donor\'s full name, first and last.', 'give' ),
401
+			'description' => esc_html__('The donor\'s full name, first and last.', 'give'),
402 402
 			'function'    => 'give_email_tag_fullname',
403 403
 			'context'     => 'donor',
404 404
 		),
405 405
 		array(
406 406
 			'tag'         => 'username',
407
-			'description' => esc_html__( 'The donor\'s user name on the site, if they registered an account.', 'give' ),
407
+			'description' => esc_html__('The donor\'s user name on the site, if they registered an account.', 'give'),
408 408
 			'function'    => 'give_email_tag_username',
409 409
 			'context'     => 'donor',
410 410
 		),
411 411
 		array(
412 412
 			'tag'         => 'company_name',
413
-			'description' => esc_html__( 'Company name.', 'give' ),
413
+			'description' => esc_html__('Company name.', 'give'),
414 414
 			'function'    => 'give_email_tag_company_name',
415 415
 			'context'     => 'donation',
416 416
 		),
417 417
 		array(
418 418
 			'tag'         => 'user_email',
419
-			'description' => esc_html__( 'The donor\'s email address.', 'give' ),
419
+			'description' => esc_html__('The donor\'s email address.', 'give'),
420 420
 			'function'    => 'give_email_tag_user_email',
421 421
 			'context'     => 'donor',
422 422
 		),
423 423
 		array(
424 424
 			'tag'         => 'email_access_link',
425
-			'description' => esc_html__( 'The donor\'s email access link.', 'give' ),
425
+			'description' => esc_html__('The donor\'s email access link.', 'give'),
426 426
 			'function'    => 'give_email_tag_email_access_link',
427 427
 			'context'     => 'donor',
428 428
 		),
@@ -430,14 +430,14 @@  discard block
 block discarded – undo
430 430
 		/* General */
431 431
 		array(
432 432
 			'tag'         => 'sitename',
433
-			'description' => esc_html__( 'The name of your site.', 'give' ),
433
+			'description' => esc_html__('The name of your site.', 'give'),
434 434
 			'function'    => 'give_email_tag_sitename',
435 435
 			'context'     => 'general',
436 436
 		),
437 437
 
438 438
 		array(
439 439
 			'tag'         => 'reset_password_link',
440
-			'description' => esc_html__( 'The reset password link for user.', 'give' ),
440
+			'description' => esc_html__('The reset password link for user.', 'give'),
441 441
 			'function'    => 'give_email_tag_reset_password_link',
442 442
 			'context'     => 'general',
443 443
 		),
@@ -445,21 +445,21 @@  discard block
 block discarded – undo
445 445
 	);
446 446
 
447 447
 	// Apply give_email_tags filter
448
-	$email_tags = apply_filters( 'give_email_tags', $email_tags );
448
+	$email_tags = apply_filters('give_email_tags', $email_tags);
449 449
 
450 450
 	// Add email tags
451
-	foreach ( $email_tags as $email_tag ) {
451
+	foreach ($email_tags as $email_tag) {
452 452
 		give_add_email_tag(
453 453
 			$email_tag['tag'],
454 454
 			$email_tag['description'],
455 455
 			$email_tag['function'],
456
-			( ! empty( $email_tag['context'] ) ? $email_tag['context'] : '' )
456
+			( ! empty($email_tag['context']) ? $email_tag['context'] : '')
457 457
 		);
458 458
 	}
459 459
 
460 460
 }
461 461
 
462
-add_action( 'give_add_email_tags', 'give_setup_email_tags' );
462
+add_action('give_add_email_tags', 'give_setup_email_tags');
463 463
 
464 464
 
465 465
 /**
@@ -471,24 +471,24 @@  discard block
 block discarded – undo
471 471
  *
472 472
  * @return string $firstname
473 473
  */
474
-function give_email_tag_first_name( $tag_args ) {
474
+function give_email_tag_first_name($tag_args) {
475 475
 	$user_info = array();
476 476
 	$firstname = '';
477 477
 
478 478
 	// Backward compatibility.
479
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
479
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
480 480
 
481
-	switch ( true ) {
482
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
483
-			$donor_info  = give_get_payment_meta_user_info( $tag_args['payment_id'] );
484
-			$email_names = give_get_email_names( $donor_info );
481
+	switch (true) {
482
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
483
+			$donor_info  = give_get_payment_meta_user_info($tag_args['payment_id']);
484
+			$email_names = give_get_email_names($donor_info);
485 485
 			$firstname   = $email_names['name'];
486 486
 
487 487
 			break;
488 488
 
489
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
489
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
490 490
 			$firstname = Give()->donor_meta->get_meta(
491
-				Give()->donors->get_column_by( 'id', 'user_id', $tag_args['user_id'] ),
491
+				Give()->donors->get_column_by('id', 'user_id', $tag_args['user_id']),
492 492
 				'_give_donor_first_name',
493 493
 				true
494 494
 			);
@@ -499,8 +499,8 @@  discard block
 block discarded – undo
499 499
 		 *
500 500
 		 * @since 2.0
501 501
 		 */
502
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
503
-			$firstname = Give()->donor_meta->get_meta( $tag_args['donor_id'], '_give_donor_first_name', true );
502
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
503
+			$firstname = Give()->donor_meta->get_meta($tag_args['donor_id'], '_give_donor_first_name', true);
504 504
 			break;
505 505
 	}
506 506
 
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 	 * @param string $firstname
513 513
 	 * @param array  $tag_args
514 514
 	 */
515
-	$firstname = apply_filters( 'give_email_tag_first_name', $firstname, $tag_args );
515
+	$firstname = apply_filters('give_email_tag_first_name', $firstname, $tag_args);
516 516
 
517 517
 	return $firstname;
518 518
 }
@@ -526,21 +526,21 @@  discard block
 block discarded – undo
526 526
  *
527 527
  * @return string $fullname
528 528
  */
529
-function give_email_tag_fullname( $tag_args ) {
529
+function give_email_tag_fullname($tag_args) {
530 530
 	$fullname = '';
531 531
 
532 532
 	// Backward compatibility.
533
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
533
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
534 534
 
535
-	switch ( true ) {
536
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
537
-			$donor_info  = give_get_payment_meta_user_info( $tag_args['payment_id'] );
538
-			$email_names = give_get_email_names( $donor_info );
535
+	switch (true) {
536
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
537
+			$donor_info  = give_get_payment_meta_user_info($tag_args['payment_id']);
538
+			$email_names = give_get_email_names($donor_info);
539 539
 			$fullname    = $email_names['fullname'];
540 540
 			break;
541 541
 
542
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
543
-			$fullname = Give()->donors->get_column_by( 'name', 'user_id', $tag_args['user_id'] );
542
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
543
+			$fullname = Give()->donors->get_column_by('name', 'user_id', $tag_args['user_id']);
544 544
 			break;
545 545
 
546 546
 		/**
@@ -548,8 +548,8 @@  discard block
 block discarded – undo
548 548
 		 *
549 549
 		 * @since 2.0
550 550
 		 */
551
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
552
-			$fullname = Give()->donors->get_column( 'name', $tag_args['donor_id'] );
551
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
552
+			$fullname = Give()->donors->get_column('name', $tag_args['donor_id']);
553 553
 			break;
554 554
 	}
555 555
 
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 	 * @param string $fullname
562 562
 	 * @param array  $tag_args
563 563
 	 */
564
-	$fullname = apply_filters( 'give_email_tag_fullname', $fullname, $tag_args );
564
+	$fullname = apply_filters('give_email_tag_fullname', $fullname, $tag_args);
565 565
 
566 566
 	return $fullname;
567 567
 }
@@ -575,21 +575,21 @@  discard block
 block discarded – undo
575 575
  *
576 576
  * @return string username.
577 577
  */
578
-function give_email_tag_username( $tag_args ) {
578
+function give_email_tag_username($tag_args) {
579 579
 	$username = '';
580 580
 
581 581
 	// Backward compatibility.
582
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
582
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
583 583
 
584
-	switch ( true ) {
585
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
586
-			$donor_info  = give_get_payment_meta_user_info( $tag_args['payment_id'] );
587
-			$email_names = give_get_email_names( $donor_info );
584
+	switch (true) {
585
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
586
+			$donor_info  = give_get_payment_meta_user_info($tag_args['payment_id']);
587
+			$email_names = give_get_email_names($donor_info);
588 588
 			$username    = $email_names['username'];
589 589
 			break;
590 590
 
591
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
592
-			$user_info = get_user_by( 'id', $tag_args['user_id'] );
591
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
592
+			$user_info = get_user_by('id', $tag_args['user_id']);
593 593
 			$username  = $user_info->user_login;
594 594
 			break;
595 595
 
@@ -598,9 +598,9 @@  discard block
 block discarded – undo
598 598
 		 *
599 599
 		 * @since 2.0
600 600
 		 */
601
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
602
-			if ( $user_id = Give()->donors->get_column( 'user_id', $tag_args['donor_id'] ) ) {
603
-				$user_info = get_user_by( 'id', $user_id );
601
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
602
+			if ($user_id = Give()->donors->get_column('user_id', $tag_args['donor_id'])) {
603
+				$user_info = get_user_by('id', $user_id);
604 604
 				$username  = $user_info->user_login;
605 605
 			}
606 606
 			break;
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
 	 * @param string $username
615 615
 	 * @param array  $tag_args
616 616
 	 */
617
-	$username = apply_filters( 'give_email_tag_username', $username, $tag_args );
617
+	$username = apply_filters('give_email_tag_username', $username, $tag_args);
618 618
 
619 619
 	return $username;
620 620
 }
@@ -628,19 +628,19 @@  discard block
 block discarded – undo
628 628
  *
629 629
  * @return string user_email
630 630
  */
631
-function give_email_tag_user_email( $tag_args ) {
631
+function give_email_tag_user_email($tag_args) {
632 632
 	$email = '';
633 633
 
634 634
 	// Backward compatibility.
635
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
635
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
636 636
 
637
-	switch ( true ) {
638
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
639
-			$email = give_get_donation_donor_email( $tag_args['payment_id'] );
637
+	switch (true) {
638
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
639
+			$email = give_get_donation_donor_email($tag_args['payment_id']);
640 640
 			break;
641 641
 
642
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
643
-			$user_info = get_user_by( 'id', $tag_args['user_id'] );
642
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
643
+			$user_info = get_user_by('id', $tag_args['user_id']);
644 644
 			$email     = $user_info->user_email;
645 645
 			break;
646 646
 
@@ -649,8 +649,8 @@  discard block
 block discarded – undo
649 649
 		 *
650 650
 		 * @since 2.0
651 651
 		 */
652
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
653
-			$email = Give()->donors->get_column( 'email', $tag_args['donor_id'] );
652
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
653
+			$email = Give()->donors->get_column('email', $tag_args['donor_id']);
654 654
 			break;
655 655
 	}
656 656
 
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
 	 * @param string $email
663 663
 	 * @param array  $tag_args
664 664
 	 */
665
-	$email = apply_filters( 'give_email_tag_user_email', $email, $tag_args );
665
+	$email = apply_filters('give_email_tag_user_email', $email, $tag_args);
666 666
 
667 667
 	return $email;
668 668
 }
@@ -676,22 +676,22 @@  discard block
 block discarded – undo
676 676
  *
677 677
  * @return string billing_address
678 678
  */
679
-function give_email_tag_billing_address( $tag_args ) {
679
+function give_email_tag_billing_address($tag_args) {
680 680
 	$address = '';
681 681
 
682 682
 	// Backward compatibility.
683
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
683
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
684 684
 
685
-	switch ( true ) {
686
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
687
-			$donation_address = give_get_donation_address( $tag_args['payment_id'] );
688
-			$address  = $donation_address['line1'] . "\n";
685
+	switch (true) {
686
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
687
+			$donation_address = give_get_donation_address($tag_args['payment_id']);
688
+			$address = $donation_address['line1']."\n";
689 689
 
690
-			if ( ! empty( $donation_address['line2'] ) ) {
691
-				$address .= $donation_address['line2'] . "\n";
690
+			if ( ! empty($donation_address['line2'])) {
691
+				$address .= $donation_address['line2']."\n";
692 692
 			}
693 693
 
694
-			$address .= $donation_address['city'] . ' ' . $donation_address['zip'] . ' ' . $donation_address['state'] . "\n";
694
+			$address .= $donation_address['city'].' '.$donation_address['zip'].' '.$donation_address['state']."\n";
695 695
 			$address .= $donation_address['country'];
696 696
 			break;
697 697
 	}
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 	 * @param string $address
705 705
 	 * @param array  $tag_args
706 706
 	 */
707
-	$address = apply_filters( 'give_email_tag_billing_address', $address, $tag_args );
707
+	$address = apply_filters('give_email_tag_billing_address', $address, $tag_args);
708 708
 
709 709
 	return $address;
710 710
 }
@@ -718,15 +718,15 @@  discard block
 block discarded – undo
718 718
  *
719 719
  * @return string $date Post Date.
720 720
  */
721
-function give_email_tag_date( $tag_args ) {
721
+function give_email_tag_date($tag_args) {
722 722
 	$date = '';
723 723
 
724 724
 	// Backward compatibility.
725
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
725
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
726 726
 
727
-	switch ( true ) {
728
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
729
-			$date = date_i18n( give_date_format(), get_the_date( 'U', $tag_args['payment_id'] ) );
727
+	switch (true) {
728
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
729
+			$date = date_i18n(give_date_format(), get_the_date('U', $tag_args['payment_id']));
730 730
 			break;
731 731
 	}
732 732
 
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 	 * @param string $date
739 739
 	 * @param array $tag_args
740 740
 	 */
741
-	$date = apply_filters( 'give_email_tag_date', $date, $tag_args );
741
+	$date = apply_filters('give_email_tag_date', $date, $tag_args);
742 742
 
743 743
 	return $date;
744 744
 }
@@ -752,16 +752,16 @@  discard block
 block discarded – undo
752 752
  *
753 753
  * @return string amount
754 754
  */
755
-function give_email_tag_amount( $tag_args ) {
755
+function give_email_tag_amount($tag_args) {
756 756
 	$amount = '';
757 757
 
758 758
 	// Backward compatibility.
759
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
759
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
760 760
 
761
-	switch ( true ) {
762
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
763
-			$give_amount = give_donation_amount( $tag_args['payment_id'], true );
764
-			$amount      = html_entity_decode( $give_amount, ENT_COMPAT, 'UTF-8' );
761
+	switch (true) {
762
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
763
+			$give_amount = give_donation_amount($tag_args['payment_id'], true);
764
+			$amount      = html_entity_decode($give_amount, ENT_COMPAT, 'UTF-8');
765 765
 			break;
766 766
 	}
767 767
 
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
 	 * @param string $amount
774 774
 	 * @param array  $tag_args
775 775
 	 */
776
-	$amount = apply_filters( 'give_email_tag_amount', $amount, $tag_args );
776
+	$amount = apply_filters('give_email_tag_amount', $amount, $tag_args);
777 777
 
778 778
 	return $amount;
779 779
 }
@@ -787,8 +787,8 @@  discard block
 block discarded – undo
787 787
  *
788 788
  * @return string price
789 789
  */
790
-function give_email_tag_price( $tag_args ) {
791
-	return give_email_tag_amount( $tag_args );
790
+function give_email_tag_price($tag_args) {
791
+	return give_email_tag_amount($tag_args);
792 792
 }
793 793
 
794 794
 /**
@@ -800,15 +800,15 @@  discard block
 block discarded – undo
800 800
  *
801 801
  * @return int payment_id
802 802
  */
803
-function give_email_tag_payment_id( $tag_args ) {
803
+function give_email_tag_payment_id($tag_args) {
804 804
 	$payment_id = '';
805 805
 
806 806
 	// Backward compatibility.
807
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
807
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
808 808
 
809
-	switch ( true ) {
810
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
811
-			$payment_id = Give()->seq_donation_number->get_serial_code( $tag_args['payment_id'] );
809
+	switch (true) {
810
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
811
+			$payment_id = Give()->seq_donation_number->get_serial_code($tag_args['payment_id']);
812 812
 			break;
813 813
 	}
814 814
 
@@ -820,7 +820,7 @@  discard block
 block discarded – undo
820 820
 	 * @param string $payment_id
821 821
 	 * @param array  $tag_args
822 822
 	 */
823
-	return apply_filters( 'give_email_tag_payment_id', $payment_id, $tag_args );
823
+	return apply_filters('give_email_tag_payment_id', $payment_id, $tag_args);
824 824
 }
825 825
 
826 826
 /**
@@ -832,15 +832,15 @@  discard block
 block discarded – undo
832 832
  *
833 833
  * @return string receipt_id
834 834
  */
835
-function give_email_tag_receipt_id( $tag_args ) {
835
+function give_email_tag_receipt_id($tag_args) {
836 836
 	$receipt_id = '';
837 837
 
838 838
 	// Backward compatibility.
839
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
839
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
840 840
 
841
-	switch ( true ) {
842
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
843
-			$receipt_id = give_get_payment_key( $tag_args['payment_id'] );
841
+	switch (true) {
842
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
843
+			$receipt_id = give_get_payment_key($tag_args['payment_id']);
844 844
 			break;
845 845
 	}
846 846
 
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
 	 * @param string $receipt_id
853 853
 	 * @param array  $tag_args
854 854
 	 */
855
-	return apply_filters( 'give_email_tag_receipt_id', $receipt_id, $tag_args );
855
+	return apply_filters('give_email_tag_receipt_id', $receipt_id, $tag_args);
856 856
 }
857 857
 
858 858
 /**
@@ -864,21 +864,21 @@  discard block
 block discarded – undo
864 864
  *
865 865
  * @return string $form_title
866 866
  */
867
-function give_email_tag_donation( $tag_args ) {
867
+function give_email_tag_donation($tag_args) {
868 868
 	$donation_form_title = '';
869 869
 
870 870
 	// Backward compatibility.
871
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
871
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
872 872
 
873
-	switch ( true ) {
874
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
875
-			$level_title         = give_has_variable_prices( give_get_payment_form_id( $tag_args['payment_id'] ) );
873
+	switch (true) {
874
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
875
+			$level_title         = give_has_variable_prices(give_get_payment_form_id($tag_args['payment_id']));
876 876
 			$separator           = $level_title ? '-' : '';
877 877
 			$donation_form_title = strip_tags(
878 878
 				give_check_variable(
879 879
 					give_get_donation_form_title(
880 880
 						$tag_args['payment_id'],
881
-						array( 'separator' => $separator, )
881
+						array('separator' => $separator,)
882 882
 					),
883 883
 					'empty',
884 884
 					''
@@ -911,15 +911,15 @@  discard block
 block discarded – undo
911 911
  *
912 912
  * @return string $form_title
913 913
  */
914
-function give_email_tag_form_title( $tag_args ) {
914
+function give_email_tag_form_title($tag_args) {
915 915
 	$donation_form_title = '';
916 916
 
917 917
 	// Backward compatibility.
918
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
918
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
919 919
 
920
-	switch ( true ) {
921
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
922
-			$donation_form_title = give_get_payment_meta( $tag_args['payment_id'], '_give_payment_form_title' );
920
+	switch (true) {
921
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
922
+			$donation_form_title = give_get_payment_meta($tag_args['payment_id'], '_give_payment_form_title');
923 923
 			break;
924 924
 	}
925 925
 
@@ -948,15 +948,15 @@  discard block
 block discarded – undo
948 948
  *
949 949
  * @return string $company_name
950 950
  */
951
-function give_email_tag_company_name( $tag_args ) {
951
+function give_email_tag_company_name($tag_args) {
952 952
 	$company_name = '';
953 953
 
954 954
 	// Backward compatibility.
955
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
955
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
956 956
 
957
-	switch ( true ) {
958
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
959
-			$company_name = give_get_payment_meta( $tag_args['payment_id'], '_give_donation_company', true );
957
+	switch (true) {
958
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
959
+			$company_name = give_get_payment_meta($tag_args['payment_id'], '_give_donation_company', true);
960 960
 			break;
961 961
 	}
962 962
 
@@ -984,18 +984,18 @@  discard block
 block discarded – undo
984 984
  *
985 985
  * @return string gateway
986 986
  */
987
-function give_email_tag_payment_method( $tag_args ) {
987
+function give_email_tag_payment_method($tag_args) {
988 988
 	$payment_method = '';
989 989
 
990 990
 	// Backward compatibility.
991
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
991
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
992 992
 
993 993
 	// Backward compatibility.
994
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
994
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
995 995
 
996
-	switch ( true ) {
997
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
998
-			$payment_method = give_get_gateway_checkout_label( give_get_payment_gateway( $tag_args['payment_id'] ) );
996
+	switch (true) {
997
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
998
+			$payment_method = give_get_gateway_checkout_label(give_get_payment_gateway($tag_args['payment_id']));
999 999
 			break;
1000 1000
 	}
1001 1001
 
@@ -1026,15 +1026,15 @@  discard block
 block discarded – undo
1026 1026
  *
1027 1027
  * @return string
1028 1028
  */
1029
-function give_email_tag_payment_total( $tag_args ) {
1029
+function give_email_tag_payment_total($tag_args) {
1030 1030
 	$payment_total = '';
1031 1031
 
1032 1032
 	// Backward compatibility.
1033
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1033
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1034 1034
 
1035
-	switch ( true ) {
1036
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
1037
-			$payment_total = give_currency_filter( give_get_payment_total( $tag_args['payment_id'] ) );
1035
+	switch (true) {
1036
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
1037
+			$payment_total = give_currency_filter(give_get_payment_total($tag_args['payment_id']));
1038 1038
 			break;
1039 1039
 	}
1040 1040
 
@@ -1062,11 +1062,11 @@  discard block
 block discarded – undo
1062 1062
  *
1063 1063
  * @return string
1064 1064
  */
1065
-function give_email_tag_sitename( $tag_args = array() ) {
1066
-	$sitename = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES );
1065
+function give_email_tag_sitename($tag_args = array()) {
1066
+	$sitename = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES);
1067 1067
 
1068 1068
 	// Backward compatibility.
1069
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1069
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1070 1070
 
1071 1071
 	/**
1072 1072
 	 * Filter the {sitename} email template tag output.
@@ -1092,26 +1092,26 @@  discard block
 block discarded – undo
1092 1092
  *
1093 1093
  * @return string receipt_link
1094 1094
  */
1095
-function give_email_tag_receipt_link( $tag_args ) {
1095
+function give_email_tag_receipt_link($tag_args) {
1096 1096
 	// Backward compatibility.
1097
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1097
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1098 1098
 
1099
-	$receipt_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) );
1099
+	$receipt_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id'));
1100 1100
 
1101 1101
 	// Bailout.
1102
-	if ( give_get_option( 'email_template' ) === 'none' ) {
1102
+	if (give_get_option('email_template') === 'none') {
1103 1103
 		return $receipt_url;
1104 1104
 	}
1105 1105
 
1106 1106
 
1107
-	$receipt_url = esc_url( add_query_arg( array(
1108
-		'payment_key' => give_get_payment_key( $tag_args['payment_id'] ),
1109
-	), give_get_history_page_uri() ) );
1107
+	$receipt_url = esc_url(add_query_arg(array(
1108
+		'payment_key' => give_get_payment_key($tag_args['payment_id']),
1109
+	), give_get_history_page_uri()));
1110 1110
 
1111 1111
 	$formatted = sprintf(
1112 1112
 		'<a href="%1$s">%2$s</a>',
1113 1113
 		$receipt_url,
1114
-		__( 'View it in your browser &raquo;', 'give' )
1114
+		__('View it in your browser &raquo;', 'give')
1115 1115
 	);
1116 1116
 
1117 1117
 	/**
@@ -1140,11 +1140,11 @@  discard block
 block discarded – undo
1140 1140
  *
1141 1141
  * @return string receipt_url
1142 1142
  */
1143
-function give_email_tag_receipt_link_url( $tag_args ) {
1143
+function give_email_tag_receipt_link_url($tag_args) {
1144 1144
 	// Backward compatibility.
1145
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1145
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1146 1146
 
1147
-	$receipt_link_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) );
1147
+	$receipt_link_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id'));
1148 1148
 
1149 1149
 	/**
1150 1150
 	 * Filter the {receipt_link_url} email template tag output.
@@ -1171,13 +1171,13 @@  discard block
 block discarded – undo
1171 1171
  *
1172 1172
  * @return string
1173 1173
  */
1174
-function give_get_receipt_url( $payment_id ) {
1174
+function give_get_receipt_url($payment_id) {
1175 1175
 	$receipt_url = '';
1176 1176
 
1177
-	if ( $payment_id ) {
1178
-		$receipt_url = esc_url( add_query_arg( array(
1179
-			'payment_key' => give_get_payment_key( $payment_id ),
1180
-		), give_get_history_page_uri() ) );
1177
+	if ($payment_id) {
1178
+		$receipt_url = esc_url(add_query_arg(array(
1179
+			'payment_key' => give_get_payment_key($payment_id),
1180
+		), give_get_history_page_uri()));
1181 1181
 	}
1182 1182
 
1183 1183
 	return $receipt_url;
@@ -1193,22 +1193,22 @@  discard block
 block discarded – undo
1193 1193
  *
1194 1194
  * @return string
1195 1195
  */
1196
-function give_email_tag_email_access_link( $tag_args ) {
1196
+function give_email_tag_email_access_link($tag_args) {
1197 1197
 	$donor_id          = 0;
1198 1198
 	$donor             = array();
1199 1199
 	$email_access_link = '';
1200 1200
 
1201 1201
 	// Backward compatibility.
1202
-	$tag_args = __give_20_bc_str_type_email_tag_param( $tag_args );
1202
+	$tag_args = __give_20_bc_str_type_email_tag_param($tag_args);
1203 1203
 
1204
-	switch ( true ) {
1205
-		case ! empty( $tag_args['donor_id'] ):
1204
+	switch (true) {
1205
+		case ! empty($tag_args['donor_id']):
1206 1206
 			$donor_id = $tag_args['donor_id'];
1207
-			$donor    = Give()->donors->get_by( 'id', $tag_args['donor_id'] );
1207
+			$donor    = Give()->donors->get_by('id', $tag_args['donor_id']);
1208 1208
 			break;
1209 1209
 
1210
-		case ! empty( $tag_args['user_id'] ):
1211
-			$donor    = Give()->donors->get_by( 'user_id', $tag_args['user_id'] );
1210
+		case ! empty($tag_args['user_id']):
1211
+			$donor    = Give()->donors->get_by('user_id', $tag_args['user_id']);
1212 1212
 			$donor_id = $donor->id;
1213 1213
 			break;
1214 1214
 
@@ -1217,11 +1217,11 @@  discard block
 block discarded – undo
1217 1217
 	}
1218 1218
 
1219 1219
 	// Set email access link if donor exist.
1220
-	if ( $donor_id ) {
1221
-		$verify_key = wp_generate_password( 20, false );
1220
+	if ($donor_id) {
1221
+		$verify_key = wp_generate_password(20, false);
1222 1222
 
1223 1223
 		// Generate a new verify key
1224
-		Give()->email_access->set_verify_key( $donor_id, $donor->email, $verify_key );
1224
+		Give()->email_access->set_verify_key($donor_id, $donor->email, $verify_key);
1225 1225
 		// update verify key in email tags.
1226 1226
 		$tag_args['verify_key'] = $verify_key;
1227 1227
 
@@ -1236,28 +1236,28 @@  discard block
 block discarded – undo
1236 1236
 		);
1237 1237
 
1238 1238
 		// Add Payment Key to email access url, if it exists.
1239
-		if ( ! empty( $_GET['payment_key'] ) ) {
1239
+		if ( ! empty($_GET['payment_key'])) {
1240 1240
 			$access_url = add_query_arg(
1241 1241
 				array(
1242
-					'payment_key' => give_clean( $_GET['payment_key'] ),
1242
+					'payment_key' => give_clean($_GET['payment_key']),
1243 1243
 				),
1244 1244
 				$access_url
1245 1245
 			);
1246 1246
 		}
1247 1247
 
1248
-		if ( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) {
1248
+		if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) {
1249 1249
 			$email_access_link = sprintf(
1250 1250
 				'<a href="%1$s" target="_blank">%2$s</a>',
1251
-				esc_url( $access_url ),
1252
-				__( 'View your donation history &raquo;', 'give' )
1251
+				esc_url($access_url),
1252
+				__('View your donation history &raquo;', 'give')
1253 1253
 			);
1254 1254
 
1255 1255
 		} else {
1256 1256
 
1257 1257
 			$email_access_link = sprintf(
1258 1258
 				'%1$s: %2$s',
1259
-				__( 'View your donation history', 'give' ),
1260
-				esc_url( $access_url )
1259
+				__('View your donation history', 'give'),
1260
+				esc_url($access_url)
1261 1261
 			);
1262 1262
 		}
1263 1263
 	}
@@ -1289,23 +1289,23 @@  discard block
 block discarded – undo
1289 1289
  *
1290 1290
  * @return array
1291 1291
  */
1292
-function __give_20_bc_str_type_email_tag_param( $tag_args ) {
1293
-	if ( ! is_array( $tag_args ) ) {
1294
-		switch ( true ) {
1295
-			case ( 'give_payment' === get_post_type( $tag_args ) ):
1296
-				$tag_args = array( 'payment_id' => $tag_args );
1292
+function __give_20_bc_str_type_email_tag_param($tag_args) {
1293
+	if ( ! is_array($tag_args)) {
1294
+		switch (true) {
1295
+			case ('give_payment' === get_post_type($tag_args)):
1296
+				$tag_args = array('payment_id' => $tag_args);
1297 1297
 				break;
1298 1298
 
1299
-			case ( ! is_wp_error( get_user_by( 'id', $tag_args ) ) ):
1300
-				$tag_args = array( 'user_id' => $tag_args );
1299
+			case ( ! is_wp_error(get_user_by('id', $tag_args))):
1300
+				$tag_args = array('user_id' => $tag_args);
1301 1301
 				break;
1302 1302
 
1303
-			case ( Give()->donors->get_by( 'id', $tag_args ) ):
1304
-				$tag_args = array( 'donor_id' => $tag_args );
1303
+			case (Give()->donors->get_by('id', $tag_args)):
1304
+				$tag_args = array('donor_id' => $tag_args);
1305 1305
 				break;
1306 1306
 
1307
-			case ( Give()->donors->get_by( 'user_id', $tag_args ) ):
1308
-				$tag_args = array( 'user_id' => $tag_args );
1307
+			case (Give()->donors->get_by('user_id', $tag_args)):
1308
+				$tag_args = array('user_id' => $tag_args);
1309 1309
 				break;
1310 1310
 		}
1311 1311
 	}
@@ -1323,36 +1323,36 @@  discard block
 block discarded – undo
1323 1323
  *
1324 1324
  * @return array
1325 1325
  */
1326
-function give_email_tag_reset_password_link( $tag_args, $payment_id ) {
1326
+function give_email_tag_reset_password_link($tag_args, $payment_id) {
1327 1327
 
1328 1328
 	$reset_password_url = '';
1329 1329
 
1330
-	switch ( true ) {
1331
-		case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ):
1332
-			$payment_id = Give()->seq_donation_number->get_serial_code( $tag_args['payment_id'] );
1330
+	switch (true) {
1331
+		case give_check_variable($tag_args, 'isset', 0, 'payment_id'):
1332
+			$payment_id = Give()->seq_donation_number->get_serial_code($tag_args['payment_id']);
1333 1333
 			break;
1334 1334
 
1335
-		case give_check_variable( $tag_args, 'isset', 0, 'user_id' ):
1336
-			$reset_password_url = give_get_reset_password_url( $tag_args['user_id'] );
1335
+		case give_check_variable($tag_args, 'isset', 0, 'user_id'):
1336
+			$reset_password_url = give_get_reset_password_url($tag_args['user_id']);
1337 1337
 			break;
1338 1338
 
1339
-		case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ):
1340
-			$reset_password_url = give_get_reset_password_url( Give()->donors->get_column( 'user_id', $tag_args['donor_id'] ) );
1339
+		case give_check_variable($tag_args, 'isset', 0, 'donor_id'):
1340
+			$reset_password_url = give_get_reset_password_url(Give()->donors->get_column('user_id', $tag_args['donor_id']));
1341 1341
 			break;
1342 1342
 	}
1343 1343
 
1344
-	if ( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) {
1344
+	if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) {
1345 1345
 		// Generate link, if Email content type is html.
1346 1346
 		$reset_password_link = sprintf(
1347 1347
 			'<a href="%1$s" target="_blank">%2$s</a>',
1348
-			esc_url( $reset_password_url ),
1349
-			__( 'Reset your password &raquo;', 'give' )
1348
+			esc_url($reset_password_url),
1349
+			__('Reset your password &raquo;', 'give')
1350 1350
 		);
1351 1351
 	} else {
1352 1352
 		$reset_password_link = sprintf(
1353 1353
 			'%1$s: %2$s',
1354
-			__( 'Reset your password', 'give' ),
1355
-			esc_url( $reset_password_url )
1354
+			__('Reset your password', 'give'),
1355
+			esc_url($reset_password_url)
1356 1356
 		);
1357 1357
 	}
1358 1358
 
@@ -1381,21 +1381,21 @@  discard block
 block discarded – undo
1381 1381
  *
1382 1382
  * @return mixed|string
1383 1383
  */
1384
-function give_get_reset_password_url( $user_id ) {
1384
+function give_get_reset_password_url($user_id) {
1385 1385
 	$reset_password_url = '';
1386 1386
 
1387 1387
 	// Proceed further only, if user_id exists.
1388
-	if ( $user_id ) {
1388
+	if ($user_id) {
1389 1389
 
1390 1390
 		// Get User Object Details.
1391
-		$user = get_user_by( 'ID', $user_id );
1391
+		$user = get_user_by('ID', $user_id);
1392 1392
 
1393 1393
 		// Prepare Reset Password URL.
1394
-		$reset_password_url = esc_url( add_query_arg( array(
1394
+		$reset_password_url = esc_url(add_query_arg(array(
1395 1395
 			'action' => 'rp',
1396
-			'key'    => get_password_reset_key( $user ),
1396
+			'key'    => get_password_reset_key($user),
1397 1397
 			'login'  => $user->user_login,
1398
-		), wp_login_url() ) );
1398
+		), wp_login_url()));
1399 1399
 	}
1400 1400
 
1401 1401
 	return $reset_password_url;
@@ -1414,94 +1414,94 @@  discard block
 block discarded – undo
1414 1414
  *
1415 1415
  * @return mixed
1416 1416
  */
1417
-function __give_render_metadata_email_tag( $content, $tag_args ) {
1418
-	preg_match_all( "/{meta_([A-z0-9\-\_\ ]+)}/s", $content, $matches );
1417
+function __give_render_metadata_email_tag($content, $tag_args) {
1418
+	preg_match_all("/{meta_([A-z0-9\-\_\ ]+)}/s", $content, $matches);
1419 1419
 
1420
-	if ( ! empty( $matches[0] ) ) {
1420
+	if ( ! empty($matches[0])) {
1421 1421
 		$search = $replace = array();
1422
-		foreach ( $matches[0] as $index => $meta_tag ) {
1423
-			if ( in_array( $meta_tag, $search ) ) {
1422
+		foreach ($matches[0] as $index => $meta_tag) {
1423
+			if (in_array($meta_tag, $search)) {
1424 1424
 				continue;
1425 1425
 			}
1426 1426
 
1427 1427
 			$search[] = $meta_tag;
1428 1428
 
1429
-			$meta_tag     = str_replace( array( '{', 'meta_', '}' ), '', $meta_tag );
1430
-			$meta_tag_arr = array_map( 'trim', explode( ' ', $meta_tag, 2 ) );
1431
-			$meta_tag     = current( $meta_tag_arr );
1429
+			$meta_tag     = str_replace(array('{', 'meta_', '}'), '', $meta_tag);
1430
+			$meta_tag_arr = array_map('trim', explode(' ', $meta_tag, 2));
1431
+			$meta_tag     = current($meta_tag_arr);
1432 1432
 
1433
-			$meta_tag  = str_replace( array( '{', 'meta_', '}' ), '', $meta_tag );
1434
-			$type      = current( explode( '_', $meta_tag, 2 ) );
1435
-			$meta_name = preg_replace( "/^{$type}_/", '', $meta_tag );
1433
+			$meta_tag  = str_replace(array('{', 'meta_', '}'), '', $meta_tag);
1434
+			$type      = current(explode('_', $meta_tag, 2));
1435
+			$meta_name = preg_replace("/^{$type}_/", '', $meta_tag);
1436 1436
 
1437
-			switch ( $type ) {
1437
+			switch ($type) {
1438 1438
 				case 'donation':
1439 1439
 
1440 1440
 					//Bailout.
1441
-					if ( ! isset( $tag_args['payment_id'] ) ) {
1441
+					if ( ! isset($tag_args['payment_id'])) {
1442 1442
 						$replace[] = '';
1443 1443
 						continue;
1444 1444
 					}
1445 1445
 
1446
-					$meta_data = give_get_meta( absint( $tag_args['payment_id'] ), $meta_name, true, '' );
1446
+					$meta_data = give_get_meta(absint($tag_args['payment_id']), $meta_name, true, '');
1447 1447
 
1448
-					if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) {
1448
+					if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) {
1449 1449
 						$replace[] = $meta_data;
1450
-					} elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) {
1451
-						$replace[] = $meta_data[ $meta_tag_arr[1] ];
1450
+					} elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) {
1451
+						$replace[] = $meta_data[$meta_tag_arr[1]];
1452 1452
 					}
1453 1453
 
1454 1454
 					break;
1455 1455
 
1456 1456
 				case 'form':
1457
-					$form_id = isset( $tag_args['form_id'] ) ? absint( $tag_args['form_id'] ) : 0;
1457
+					$form_id = isset($tag_args['form_id']) ? absint($tag_args['form_id']) : 0;
1458 1458
 
1459 1459
 					// Bailout.
1460
-					if ( ! $form_id && isset( $tag_args['payment_id'] ) ) {
1461
-						$form_id = give_get_payment_form_id( $tag_args['payment_id'] );
1460
+					if ( ! $form_id && isset($tag_args['payment_id'])) {
1461
+						$form_id = give_get_payment_form_id($tag_args['payment_id']);
1462 1462
 					}
1463 1463
 
1464
-					$meta_data = give_get_meta( $form_id, $meta_name, true, '' );
1465
-					if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) {
1464
+					$meta_data = give_get_meta($form_id, $meta_name, true, '');
1465
+					if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) {
1466 1466
 						$replace[] = $meta_data;
1467
-					} elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) {
1468
-						$replace[] = $meta_data[ $meta_tag_arr[1] ];
1467
+					} elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) {
1468
+						$replace[] = $meta_data[$meta_tag_arr[1]];
1469 1469
 					}
1470 1470
 					break;
1471 1471
 
1472 1472
 				case 'donor':
1473
-					$donor_id = isset( $tag_args['donor_id'] ) ? absint( $tag_args['donor_id'] ) : 0;
1473
+					$donor_id = isset($tag_args['donor_id']) ? absint($tag_args['donor_id']) : 0;
1474 1474
 
1475 1475
 					// Bailout.
1476
-					if ( ! $donor_id ) {
1477
-						if ( isset( $tag_args['payment_id'] ) ) {
1478
-							$donor_id = give_get_payment_donor_id( $tag_args['payment_id'] );
1479
-						} elseif ( isset( $tag_args['user_id'] ) ) {
1480
-							$donor_id = Give()->donors->get_column_by( 'id', 'user_id', $tag_args['user_id'] );
1476
+					if ( ! $donor_id) {
1477
+						if (isset($tag_args['payment_id'])) {
1478
+							$donor_id = give_get_payment_donor_id($tag_args['payment_id']);
1479
+						} elseif (isset($tag_args['user_id'])) {
1480
+							$donor_id = Give()->donors->get_column_by('id', 'user_id', $tag_args['user_id']);
1481 1481
 						}
1482 1482
 					}
1483 1483
 
1484
-					$meta_data = Give()->donor_meta->get_meta( $donor_id, $meta_name, true );
1484
+					$meta_data = Give()->donor_meta->get_meta($donor_id, $meta_name, true);
1485 1485
 
1486
-					if( empty( $meta_data ) && in_array( $meta_name, array_keys( Give()->donors->get_columns() ) ) ) {
1487
-						$meta_data = Give()->donors->get_column_by( $meta_name, 'id', $donor_id );
1486
+					if (empty($meta_data) && in_array($meta_name, array_keys(Give()->donors->get_columns()))) {
1487
+						$meta_data = Give()->donors->get_column_by($meta_name, 'id', $donor_id);
1488 1488
 					}
1489 1489
 
1490
-					if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) {
1490
+					if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) {
1491 1491
 						$replace[] = $meta_data;
1492
-					} elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) {
1493
-						$replace[] = $meta_data[ $meta_tag_arr[1] ];
1492
+					} elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) {
1493
+						$replace[] = $meta_data[$meta_tag_arr[1]];
1494 1494
 					}
1495 1495
 
1496 1496
 					break;
1497 1497
 
1498 1498
 				default:
1499
-					$replace[] = end( $search );
1499
+					$replace[] = end($search);
1500 1500
 			}
1501 1501
 		}
1502 1502
 
1503
-		if ( ! empty( $search ) && ! empty( $replace ) ) {
1504
-			$content = str_replace( $search, $replace, $content );
1503
+		if ( ! empty($search) && ! empty($replace)) {
1504
+			$content = str_replace($search, $replace, $content);
1505 1505
 		}
1506 1506
 	}
1507 1507
 
@@ -1509,4 +1509,4 @@  discard block
 block discarded – undo
1509 1509
 	return $content;
1510 1510
 }
1511 1511
 
1512
-add_filter( 'give_email_template_tags', '__give_render_metadata_email_tag', 10, 2 );
1512
+add_filter('give_email_template_tags', '__give_render_metadata_email_tag', 10, 2);
Please login to merge, or discard this patch.
templates/shortcode-goal.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -8,9 +8,9 @@  discard block
 block discarded – undo
8 8
 
9 9
 // Sanity check - ensure form has pass all condition to show goal.
10 10
 if ( ( isset( $args['show_goal'] ) && ! filter_var( $args['show_goal'], FILTER_VALIDATE_BOOLEAN ) )
11
-     || empty( $form->ID )
12
-     || ( is_singular( 'give_forms' ) && ! give_is_setting_enabled( $goal_option ) )
13
-     || ! give_is_setting_enabled( $goal_option ) || 0 === $form->goal ) {
11
+	 || empty( $form->ID )
12
+	 || ( is_singular( 'give_forms' ) && ! give_is_setting_enabled( $goal_option ) )
13
+	 || ! give_is_setting_enabled( $goal_option ) || 0 === $form->goal ) {
14 14
 	return false;
15 15
 }
16 16
 
@@ -97,17 +97,17 @@  discard block
 block discarded – undo
97 97
 				echo sprintf( /* translators: 1: amount of income raised 2: goal target amount. */
98 98
 					__( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> raised', 'give' ), give_currency_filter( $income, array( 'form_id' => $form_id ) ), give_currency_filter( $goal, array( 'form_id' => $form_id ) ) );
99 99
 
100
-            elseif ( 'percentage' === $goal_format ) :
100
+			elseif ( 'percentage' === $goal_format ) :
101 101
 
102 102
 				echo sprintf( /* translators: %s: percentage of the amount raised compared to the goal target */
103 103
 					__( '<span class="give-percentage">%s%%</span> funded', 'give' ), round( $progress ) );
104 104
 
105
-            elseif ( 'donation' === $goal_format ) :
105
+			elseif ( 'donation' === $goal_format ) :
106 106
 
107 107
 				echo sprintf( /* translators: 1: total number of donations completed 2: total number of donations set as goal */
108 108
 					_n( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donations', $goal, 'give' ), $income, $goal );
109 109
 
110
-            elseif ( 'donors' === $goal_format ) :
110
+			elseif ( 'donors' === $goal_format ) :
111 111
 
112 112
 				echo sprintf( /* translators: 1: total number of donors completed 2: total number of donors set as goal */
113 113
 					_n( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donors', $goal, 'give' ), $income, $goal );
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -3,46 +3,46 @@  discard block
 block discarded – undo
3 3
  * This template is used to display the goal with [give_goal]
4 4
  */
5 5
 
6
-$form        = new Give_Donate_Form( $form_id );
7
-$goal_option = give_get_meta( $form->ID, '_give_goal_option', true );
6
+$form        = new Give_Donate_Form($form_id);
7
+$goal_option = give_get_meta($form->ID, '_give_goal_option', true);
8 8
 
9 9
 // Sanity check - ensure form has pass all condition to show goal.
10
-if ( ( isset( $args['show_goal'] ) && ! filter_var( $args['show_goal'], FILTER_VALIDATE_BOOLEAN ) )
11
-     || empty( $form->ID )
12
-     || ( is_singular( 'give_forms' ) && ! give_is_setting_enabled( $goal_option ) )
13
-     || ! give_is_setting_enabled( $goal_option ) || 0 === $form->goal ) {
10
+if ((isset($args['show_goal']) && ! filter_var($args['show_goal'], FILTER_VALIDATE_BOOLEAN))
11
+     || empty($form->ID)
12
+     || (is_singular('give_forms') && ! give_is_setting_enabled($goal_option))
13
+     || ! give_is_setting_enabled($goal_option) || 0 === $form->goal) {
14 14
 	return false;
15 15
 }
16 16
 
17
-$goal_format         = give_get_form_goal_format( $form_id );
18
-$price               = give_get_meta( $form_id, '_give_set_price', true );
19
-$color               = give_get_meta( $form_id, '_give_goal_color', true );
20
-$show_text           = isset( $args['show_text'] ) ? filter_var( $args['show_text'], FILTER_VALIDATE_BOOLEAN ) : true;
21
-$show_bar            = isset( $args['show_bar'] ) ? filter_var( $args['show_bar'], FILTER_VALIDATE_BOOLEAN ) : true;
22
-$goal_progress_stats = give_goal_progress_stats( $form );
17
+$goal_format         = give_get_form_goal_format($form_id);
18
+$price               = give_get_meta($form_id, '_give_set_price', true);
19
+$color               = give_get_meta($form_id, '_give_goal_color', true);
20
+$show_text           = isset($args['show_text']) ? filter_var($args['show_text'], FILTER_VALIDATE_BOOLEAN) : true;
21
+$show_bar            = isset($args['show_bar']) ? filter_var($args['show_bar'], FILTER_VALIDATE_BOOLEAN) : true;
22
+$goal_progress_stats = give_goal_progress_stats($form);
23 23
 
24 24
 $income = $goal_progress_stats['raw_actual'];
25 25
 $goal   = $goal_progress_stats['raw_goal'];
26 26
 
27
-switch ( $goal_format ) {
27
+switch ($goal_format) {
28 28
 
29 29
 	case 'donation':
30
-		$progress           = round( ( $income / $goal ) * 100, 2 );
30
+		$progress           = round(($income / $goal) * 100, 2);
31 31
 		$progress_bar_value = $income >= $goal ? 100 : $progress;
32 32
 		break;
33 33
 
34 34
 	case 'donors':
35
-		$progress_bar_value = round( ( $income / $goal ) * 100, 2 );
35
+		$progress_bar_value = round(($income / $goal) * 100, 2);
36 36
 		$progress           = $progress_bar_value;
37 37
 		break;
38 38
 
39 39
 	case 'percentage':
40
-		$progress           = round( ( $income / $goal ) * 100, 2 );
40
+		$progress           = round(($income / $goal) * 100, 2);
41 41
 		$progress_bar_value = $income >= $goal ? 100 : $progress;
42 42
 		break;
43 43
 
44 44
 	default:
45
-		$progress           = round( ( $income / $goal ) * 100, 2 );
45
+		$progress           = round(($income / $goal) * 100, 2);
46 46
 		$progress_bar_value = $income >= $goal ? 100 : $progress;
47 47
 		break;
48 48
 
@@ -53,64 +53,64 @@  discard block
 block discarded – undo
53 53
  *
54 54
  * @since 1.8.8
55 55
  */
56
-$progress = apply_filters( 'give_goal_amount_funded_percentage_output', $progress, $form_id, $form );
56
+$progress = apply_filters('give_goal_amount_funded_percentage_output', $progress, $form_id, $form);
57 57
 ?>
58 58
 <div class="give-goal-progress">
59
-	<?php if ( ! empty( $show_text ) ) : ?>
59
+	<?php if ( ! empty($show_text)) : ?>
60 60
         <div class="raised">
61 61
 			<?php
62
-			if ( 'amount' === $goal_format ) :
62
+			if ('amount' === $goal_format) :
63 63
 
64 64
 				/**
65 65
 				 * Filter the give currency.
66 66
 				 *
67 67
 				 * @since 1.8.17
68 68
 				 */
69
-				$form_currency = apply_filters( 'give_goal_form_currency', give_get_currency( $form_id ), $form_id );
69
+				$form_currency = apply_filters('give_goal_form_currency', give_get_currency($form_id), $form_id);
70 70
 
71 71
 				/**
72 72
 				 * Filter the income formatting arguments.
73 73
 				 *
74 74
 				 * @since 1.8.17
75 75
 				 */
76
-				$income_format_args = apply_filters( 'give_goal_income_format_args', array(
76
+				$income_format_args = apply_filters('give_goal_income_format_args', array(
77 77
 					'sanitize' => false,
78 78
 					'currency' => $form_currency,
79 79
 					'decimal'  => false,
80
-				), $form_id );
80
+				), $form_id);
81 81
 
82 82
 				/**
83 83
 				 * Filter the goal formatting arguments.
84 84
 				 *
85 85
 				 * @since 1.8.17
86 86
 				 */
87
-				$goal_format_args = apply_filters( 'give_goal_amount_format_args', array(
87
+				$goal_format_args = apply_filters('give_goal_amount_format_args', array(
88 88
 					'sanitize' => false,
89 89
 					'currency' => $form_currency,
90 90
 					'decimal'  => false,
91
-				), $form_id );
91
+				), $form_id);
92 92
 
93 93
 				// Get formatted amount.
94
-				$income = give_human_format_large_amount( give_format_amount( $income, $income_format_args ), array( 'currency' => $form_currency ) );
95
-				$goal   = give_human_format_large_amount( give_format_amount( $goal, $goal_format_args ), array( 'currency' => $form_currency ) );
94
+				$income = give_human_format_large_amount(give_format_amount($income, $income_format_args), array('currency' => $form_currency));
95
+				$goal   = give_human_format_large_amount(give_format_amount($goal, $goal_format_args), array('currency' => $form_currency));
96 96
 
97 97
 				echo sprintf( /* translators: 1: amount of income raised 2: goal target amount. */
98
-					__( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> raised', 'give' ), give_currency_filter( $income, array( 'form_id' => $form_id ) ), give_currency_filter( $goal, array( 'form_id' => $form_id ) ) );
98
+					__('<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> raised', 'give'), give_currency_filter($income, array('form_id' => $form_id)), give_currency_filter($goal, array('form_id' => $form_id)) );
99 99
 
100
-            elseif ( 'percentage' === $goal_format ) :
100
+            elseif ('percentage' === $goal_format) :
101 101
 
102 102
 				echo sprintf( /* translators: %s: percentage of the amount raised compared to the goal target */
103
-					__( '<span class="give-percentage">%s%%</span> funded', 'give' ), round( $progress ) );
103
+					__('<span class="give-percentage">%s%%</span> funded', 'give'), round($progress) );
104 104
 
105
-            elseif ( 'donation' === $goal_format ) :
105
+            elseif ('donation' === $goal_format) :
106 106
 
107 107
 				echo sprintf( /* translators: 1: total number of donations completed 2: total number of donations set as goal */
108
-					_n( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donations', $goal, 'give' ), $income, $goal );
108
+					_n('<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donations', $goal, 'give'), $income, $goal );
109 109
 
110
-            elseif ( 'donors' === $goal_format ) :
110
+            elseif ('donors' === $goal_format) :
111 111
 
112 112
 				echo sprintf( /* translators: 1: total number of donors completed 2: total number of donors set as goal */
113
-					_n( '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donors', $goal, 'give' ), $income, $goal );
113
+					_n('<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donation', '<span class="income">%1$s</span> of <span class="goal-text">%2$s</span> donors', $goal, 'give'), $income, $goal );
114 114
 
115 115
 			endif;
116 116
 			?>
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
 	<?php endif; ?>
119 119
 
120 120
 
121
-	<?php if ( ! empty( $show_bar ) ) : ?>
121
+	<?php if ( ! empty($show_bar)) : ?>
122 122
         <div class="give-progress-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100"
123
-             aria-valuenow="<?php echo esc_attr( $progress_bar_value ); ?>">
124
-			<span style="width: <?php echo esc_attr( $progress_bar_value ); ?>%;<?php if ( ! empty( $color ) ) {
125
-				echo 'background-color:' . $color;
123
+             aria-valuenow="<?php echo esc_attr($progress_bar_value); ?>">
124
+			<span style="width: <?php echo esc_attr($progress_bar_value); ?>%;<?php if ( ! empty($color)) {
125
+				echo 'background-color:'.$color;
126 126
 			} ?>"></span>
127 127
         </div><!-- /.give-progress-bar -->
128 128
 	<?php endif; ?>
Please login to merge, or discard this patch.
templates/email-login-form.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -9,17 +9,17 @@  discard block
 block discarded – undo
9 9
 global $give_access_form_outputted;
10 10
 
11 11
 // Only output the form once.
12
-if ( $give_access_form_outputted ) {
12
+if ($give_access_form_outputted) {
13 13
 	return;
14 14
 }
15 15
 
16
-$recaptcha_key    = give_get_option( 'recaptcha_key' );
17
-$recaptcha_secret = give_get_option( 'recaptcha_secret' );
16
+$recaptcha_key    = give_get_option('recaptcha_key');
17
+$recaptcha_secret = give_get_option('recaptcha_secret');
18 18
 
19
-$enable_recaptcha = ( give_is_setting_enabled( give_get_option( 'enable_recaptcha' ) ) ) && ! empty( $recaptcha_key ) && ! empty( $recaptcha_secret ) ? true : false;
19
+$enable_recaptcha = (give_is_setting_enabled(give_get_option('enable_recaptcha'))) && ! empty($recaptcha_key) && ! empty($recaptcha_secret) ? true : false;
20 20
 
21 21
 // Email already sent?
22
-if ( isset( $_POST['email-access-sent'] ) ) {
22
+if (isset($_POST['email-access-sent'])) {
23 23
 
24 24
 	/**
25 25
 	 * Filter to modify access mail send notice
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 *
31 31
 	 * @return  string $message Send notice message for email access.
32 32
 	 */
33
-	$message = (string) apply_filters( 'give_email_access_mail_send_notice', __( 'Please check your email and click on the link to access your complete donation history.', 'give' ) );
33
+	$message = (string) apply_filters('give_email_access_mail_send_notice', __('Please check your email and click on the link to access your complete donation history.', 'give'));
34 34
 
35 35
 	Give()->notices->print_frontend_notice(
36 36
 		$message,
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	);
40 40
 
41 41
 	return;
42
-} elseif ( isset( $_POST['email-access-exhausted'] ) ) {
42
+} elseif (isset($_POST['email-access-exhausted'])) {
43 43
 
44 44
 	$value = Give()->email_access->verify_throttle / 60;
45 45
 
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	$message = (string) apply_filters(
57 57
 		'give_email_access_requests_exceed_notice',
58 58
 		sprintf(
59
-			__( 'Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give' ),
60
-			sprintf( _n( '%s minute', '%s minutes', $value, 'give' ), $value )
59
+			__('Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give'),
60
+			sprintf(_n('%s minute', '%s minutes', $value, 'give'), $value)
61 61
 		),
62 62
 		$value
63 63
 	);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
  *
79 79
  * @since 1.8.17
80 80
  */
81
-do_action( 'give_email_access_form_login' );
81
+do_action('give_email_access_form_login');
82 82
 
83 83
 // Print any other messages & errors.
84 84
 Give()->notices->render_frontend_notices();
@@ -97,20 +97,20 @@  discard block
 block discarded – undo
97 97
 				 *
98 98
 				 * @return string $message email access welcome message
99 99
 				 */
100
-				echo esc_html( apply_filters( 'give_email_access_welcome_message', __( 'Please verify your email to access your donation history.', 'give' ) ) );
100
+				echo esc_html(apply_filters('give_email_access_welcome_message', __('Please verify your email to access your donation history.', 'give')));
101 101
 				?>
102 102
             </p>
103 103
 
104
-            <label for="give-email"><?php esc_attr_e( 'Donation Email:', 'give' ); ?></label>
104
+            <label for="give-email"><?php esc_attr_e('Donation Email:', 'give'); ?></label>
105 105
             <input id="give-email" type="email" name="give_email" value=""
106
-                   placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>"/>
107
-            <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce( 'give' ); ?>"/>
106
+                   placeholder="<?php esc_attr_e('Email Address', 'give'); ?>"/>
107
+            <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('give'); ?>"/>
108 108
             <input type="hidden" name="give_action" value="email_access_form_login"/>
109 109
             <input type="hidden" name="give_access_page" value="<?php the_ID(); ?>"/>
110 110
 
111 111
 			<?php
112 112
 			// Enable reCAPTCHA?
113
-			if ( $enable_recaptcha ) :
113
+			if ($enable_recaptcha) :
114 114
 				?>
115 115
                 <script>
116 116
                     // IP verify for reCAPTCHA.
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
                 <input type="hidden" name="give_ip" class="give_ip" value=""/>
129 129
 			<?php endif; ?>
130 130
 
131
-            <input type="submit" class="give-submit" value="<?php esc_attr_e( 'Verify Email', 'give' ); ?>"/>
131
+            <input type="submit" class="give-submit" value="<?php esc_attr_e('Verify Email', 'give'); ?>"/>
132 132
         </form>
133 133
     </div>
134 134
 <?php
Please login to merge, or discard this patch.
includes/admin/tools/export/give-export-donations-exporter.php 1 patch
Spacing   +151 added lines, -151 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
 
@@ -85,28 +85,28 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @param array $request The Form Data passed into the batch processing.
87 87
 	 */
88
-	public function set_properties( $request ) {
88
+	public function set_properties($request) {
89 89
 
90 90
 		// Set data from form submission
91
-		if ( isset( $_POST['form'] ) ) {
92
-			$this->data = give_clean( wp_parse_args( $_POST['form'] ) );
91
+		if (isset($_POST['form'])) {
92
+			$this->data = give_clean(wp_parse_args($_POST['form']));
93 93
 		}
94 94
 
95 95
 		$this->form       = $this->data['forms'];
96
-		$this->categories = ! empty( $request['give_forms_categories'] ) ? (array) $request['give_forms_categories'] : array();
97
-		$this->tags       = ! empty( $request['give_forms_tags'] ) ? (array) $request['give_forms_tags'] : array();
98
-		$this->form_id    = $this->get_form_ids( $request );
99
-		$this->price_id   = isset( $request['give_price_option'] ) && ( 'all' !== $request['give_price_option'] && '' !== $request['give_price_option'] ) ? absint( $request['give_price_option'] ) : null;
100
-		$this->start      = isset( $request['start'] ) ? sanitize_text_field( $request['start'] ) : '';
101
-		$this->end        = isset( $request['end'] ) ? sanitize_text_field( $request['end'] ) : '';
102
-		$this->status     = isset( $request['status'] ) ? sanitize_text_field( $request['status'] ) : 'complete';
96
+		$this->categories = ! empty($request['give_forms_categories']) ? (array) $request['give_forms_categories'] : array();
97
+		$this->tags       = ! empty($request['give_forms_tags']) ? (array) $request['give_forms_tags'] : array();
98
+		$this->form_id    = $this->get_form_ids($request);
99
+		$this->price_id   = isset($request['give_price_option']) && ('all' !== $request['give_price_option'] && '' !== $request['give_price_option']) ? absint($request['give_price_option']) : null;
100
+		$this->start      = isset($request['start']) ? sanitize_text_field($request['start']) : '';
101
+		$this->end        = isset($request['end']) ? sanitize_text_field($request['end']) : '';
102
+		$this->status     = isset($request['status']) ? sanitize_text_field($request['status']) : 'complete';
103 103
 
104 104
 		/**
105 105
 		 * Hook to use after setting properties.
106 106
 		 *
107 107
 		 * @since 2.1.3
108 108
 		 */
109
-		do_action( 'give_export_donations_form_data', $this->data );
109
+		do_action('give_export_donations_form_data', $this->data);
110 110
 	}
111 111
 
112 112
 	/**
@@ -118,13 +118,13 @@  discard block
 block discarded – undo
118 118
 	 *
119 119
 	 * @return array|boolean|null $form get all the donation id that need to be exported
120 120
 	 */
121
-	public function get_form_ids( $request = array() ) {
122
-		$form = ! empty( $request['forms'] ) && 0 !== $request['forms'] ? absint( $request['forms'] ) : null;
121
+	public function get_form_ids($request = array()) {
122
+		$form = ! empty($request['forms']) && 0 !== $request['forms'] ? absint($request['forms']) : null;
123 123
 
124
-		$form_ids = ! empty( $request['form_ids'] ) ? sanitize_text_field( $request['form_ids'] ) : null;
124
+		$form_ids = ! empty($request['form_ids']) ? sanitize_text_field($request['form_ids']) : null;
125 125
 
126
-		if ( empty( $form ) && ! empty( $form_ids ) && ( ! empty( $this->categories ) || ! empty( $this->tags ) ) ) {
127
-			$form = explode( ',', $form_ids );
126
+		if (empty($form) && ! empty($form_ids) && ( ! empty($this->categories) || ! empty($this->tags))) {
127
+			$form = explode(',', $form_ids);
128 128
 		}
129 129
 
130 130
 		return $form;
@@ -141,14 +141,14 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	public function csv_cols() {
143 143
 
144
-		$columns = isset( $this->data['give_give_donations_export_option'] ) ? $this->data['give_give_donations_export_option'] : array();
144
+		$columns = isset($this->data['give_give_donations_export_option']) ? $this->data['give_give_donations_export_option'] : array();
145 145
 
146 146
 		// We need columns.
147
-		if ( empty( $columns ) ) {
147
+		if (empty($columns)) {
148 148
 			return false;
149 149
 		}
150 150
 
151
-		$this->cols = $this->get_cols( $columns );
151
+		$this->cols = $this->get_cols($columns);
152 152
 
153 153
 		return $this->cols;
154 154
 	}
@@ -163,83 +163,83 @@  discard block
 block discarded – undo
163 163
 	 *
164 164
 	 * @return array
165 165
 	 */
166
-	private function get_cols( $columns ) {
166
+	private function get_cols($columns) {
167 167
 
168 168
 		$cols = array();
169 169
 
170
-		foreach ( $columns as $key => $value ) {
170
+		foreach ($columns as $key => $value) {
171 171
 
172
-			switch ( $key ) {
172
+			switch ($key) {
173 173
 				case 'donation_id' :
174
-					$cols['donation_id'] = __( 'Donation ID', 'give' );
174
+					$cols['donation_id'] = __('Donation ID', 'give');
175 175
 					break;
176 176
 				case 'seq_id' :
177
-					$cols['seq_id'] = __( 'Donation Number', 'give' );
177
+					$cols['seq_id'] = __('Donation Number', 'give');
178 178
 					break;
179 179
 				case 'first_name' :
180
-					$cols['first_name'] = __( 'First Name', 'give' );
180
+					$cols['first_name'] = __('First Name', 'give');
181 181
 					break;
182 182
 				case 'last_name' :
183
-					$cols['last_name'] = __( 'Last Name', 'give' );
183
+					$cols['last_name'] = __('Last Name', 'give');
184 184
 					break;
185 185
 				case 'email' :
186
-					$cols['email'] = __( 'Email Address', 'give' );
186
+					$cols['email'] = __('Email Address', 'give');
187 187
 					break;
188 188
 				case 'company' :
189
-					$cols['company'] = __( 'Company Name', 'give' );
189
+					$cols['company'] = __('Company Name', 'give');
190 190
 					break;
191 191
 				case 'address' :
192
-					$cols['address_line1']   = __( 'Address 1', 'give' );
193
-					$cols['address_line2']   = __( 'Address 2', 'give' );
194
-					$cols['address_city']    = __( 'City', 'give' );
195
-					$cols['address_state']   = __( 'State', 'give' );
196
-					$cols['address_zip']     = __( 'Zip', 'give' );
197
-					$cols['address_country'] = __( 'Country', 'give' );
192
+					$cols['address_line1']   = __('Address 1', 'give');
193
+					$cols['address_line2']   = __('Address 2', 'give');
194
+					$cols['address_city']    = __('City', 'give');
195
+					$cols['address_state']   = __('State', 'give');
196
+					$cols['address_zip']     = __('Zip', 'give');
197
+					$cols['address_country'] = __('Country', 'give');
198 198
 					break;
199 199
 				case 'donation_total' :
200
-					$cols['donation_total'] = __( 'Donation Total', 'give' );
200
+					$cols['donation_total'] = __('Donation Total', 'give');
201 201
 					break;
202 202
 				case 'currency_code' :
203
-					$cols['currency_code'] = __( 'Currency Code', 'give' );
203
+					$cols['currency_code'] = __('Currency Code', 'give');
204 204
 					break;
205 205
 				case 'currency_symbol' :
206
-					$cols['currency_symbol'] = __( 'Currency Symbol', 'give' );
206
+					$cols['currency_symbol'] = __('Currency Symbol', 'give');
207 207
 					break;
208 208
 				case 'donation_status' :
209
-					$cols['donation_status'] = __( 'Donation Status', 'give' );
209
+					$cols['donation_status'] = __('Donation Status', 'give');
210 210
 					break;
211 211
 				case 'payment_gateway' :
212
-					$cols['payment_gateway'] = __( 'Payment Gateway', 'give' );
212
+					$cols['payment_gateway'] = __('Payment Gateway', 'give');
213 213
 					break;
214 214
 				case 'form_id' :
215
-					$cols['form_id'] = __( 'Form ID', 'give' );
215
+					$cols['form_id'] = __('Form ID', 'give');
216 216
 					break;
217 217
 				case 'form_title' :
218
-					$cols['form_title'] = __( 'Form Title', 'give' );
218
+					$cols['form_title'] = __('Form Title', 'give');
219 219
 					break;
220 220
 				case 'form_level_id' :
221
-					$cols['form_level_id'] = __( 'Level ID', 'give' );
221
+					$cols['form_level_id'] = __('Level ID', 'give');
222 222
 					break;
223 223
 				case 'form_level_title' :
224
-					$cols['form_level_title'] = __( 'Level Title', 'give' );
224
+					$cols['form_level_title'] = __('Level Title', 'give');
225 225
 					break;
226 226
 				case 'donation_date' :
227
-					$cols['donation_date'] = __( 'Donation Date', 'give' );
227
+					$cols['donation_date'] = __('Donation Date', 'give');
228 228
 					break;
229 229
 				case 'donation_time' :
230
-					$cols['donation_time'] = __( 'Donation Time', 'give' );
230
+					$cols['donation_time'] = __('Donation Time', 'give');
231 231
 					break;
232 232
 				case 'userid' :
233
-					$cols['userid'] = __( 'User ID', 'give' );
233
+					$cols['userid'] = __('User ID', 'give');
234 234
 					break;
235 235
 				case 'donorid' :
236
-					$cols['donorid'] = __( 'Donor ID', 'give' );
236
+					$cols['donorid'] = __('Donor ID', 'give');
237 237
 					break;
238 238
 				case 'donor_ip' :
239
-					$cols['donor_ip'] = __( 'Donor IP Address', 'give' );
239
+					$cols['donor_ip'] = __('Donor IP Address', 'give');
240 240
 					break;
241 241
 				default:
242
-					$cols[ $key ] = $key;
242
+					$cols[$key] = $key;
243 243
 
244 244
 			}
245 245
 		}
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 		 * @param array $cols columns name for CSV
253 253
 		 * @param array $columns columns select by admin to export
254 254
 		 */
255
-		return (array) apply_filters( 'give_export_donation_get_columns_name', $cols, $columns );
255
+		return (array) apply_filters('give_export_donation_get_columns_name', $cols, $columns);
256 256
 	}
257 257
 
258 258
 	/**
@@ -264,24 +264,24 @@  discard block
 block discarded – undo
264 264
 	 *
265 265
 	 * @return array $args donation argument
266 266
 	 */
267
-	public function get_donation_argument( $args = array() ) {
267
+	public function get_donation_argument($args = array()) {
268 268
 		$defaults = array(
269 269
 			'number' => 30,
270 270
 			'page'   => $this->step,
271 271
 			'status' => $this->status,
272 272
 		);
273 273
 		// Date query.
274
-		if ( ! empty( $this->start ) || ! empty( $this->end ) ) {
275
-			if ( ! empty( $this->start ) ) {
276
-				$defaults['date_query'][0]['after'] = date( 'Y-n-d 00:00:00', strtotime( $this->start ) );
274
+		if ( ! empty($this->start) || ! empty($this->end)) {
275
+			if ( ! empty($this->start)) {
276
+				$defaults['date_query'][0]['after'] = date('Y-n-d 00:00:00', strtotime($this->start));
277 277
 			}
278
-			if ( ! empty( $this->end ) ) {
279
-				$defaults['date_query'][0]['before'] = date( 'Y-n-d 00:00:00', strtotime( $this->end ) );
278
+			if ( ! empty($this->end)) {
279
+				$defaults['date_query'][0]['before'] = date('Y-n-d 00:00:00', strtotime($this->end));
280 280
 			}
281 281
 		}
282 282
 
283
-		if ( ! empty( $this->form_id ) ) {
284
-			$defaults['give_forms'] = is_array( $this->form_id ) ? $this->form_id : array( $this->form_id );
283
+		if ( ! empty($this->form_id)) {
284
+			$defaults['give_forms'] = is_array($this->form_id) ? $this->form_id : array($this->form_id);
285 285
 		}
286 286
 
287 287
 		/**
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 		 *
291 291
 		 * @since 2.1.3
292 292
 		 */
293
-		return apply_filters( 'give_export_donations_donation_query_args', wp_parse_args( $args, $defaults ) );
293
+		return apply_filters('give_export_donations_donation_query_args', wp_parse_args($args, $defaults));
294 294
 	}
295 295
 
296 296
 	/**
@@ -309,119 +309,119 @@  discard block
 block discarded – undo
309 309
 		$data = array();
310 310
 		$i    = 0;
311 311
 		// Payment query.
312
-		$payments = give_get_payments( $this->get_donation_argument() );
312
+		$payments = give_get_payments($this->get_donation_argument());
313 313
 
314
-		if ( $payments ) {
314
+		if ($payments) {
315 315
 
316
-			foreach ( $payments as $payment ) {
316
+			foreach ($payments as $payment) {
317 317
 
318 318
 				$columns      = $this->csv_cols();
319
-				$payment      = new Give_Payment( $payment->ID );
319
+				$payment      = new Give_Payment($payment->ID);
320 320
 				$payment_meta = $payment->payment_meta;
321 321
 				$address      = $payment->address;
322 322
 
323 323
 				// Set columns
324
-				if ( ! empty( $columns['donation_id'] ) ) {
325
-					$data[ $i ]['donation_id'] = $payment->ID;
324
+				if ( ! empty($columns['donation_id'])) {
325
+					$data[$i]['donation_id'] = $payment->ID;
326 326
 				}
327 327
 
328
-				if ( ! empty( $columns['seq_id'] ) ) {
329
-					$data[ $i ]['seq_id'] = Give()->seq_donation_number->get_serial_code( $payment->ID );
328
+				if ( ! empty($columns['seq_id'])) {
329
+					$data[$i]['seq_id'] = Give()->seq_donation_number->get_serial_code($payment->ID);
330 330
 				}
331 331
 
332
-				if ( ! empty( $columns['first_name'] ) ) {
333
-					$data[ $i ]['first_name'] = isset( $payment->first_name ) ? $payment->first_name : '';
332
+				if ( ! empty($columns['first_name'])) {
333
+					$data[$i]['first_name'] = isset($payment->first_name) ? $payment->first_name : '';
334 334
 				}
335 335
 
336
-				if ( ! empty( $columns['last_name'] ) ) {
337
-					$data[ $i ]['last_name'] = isset( $payment->last_name ) ? $payment->last_name : '';
336
+				if ( ! empty($columns['last_name'])) {
337
+					$data[$i]['last_name'] = isset($payment->last_name) ? $payment->last_name : '';
338 338
 				}
339 339
 
340
-				if ( ! empty( $columns['email'] ) ) {
341
-					$data[ $i ]['email'] = $payment->email;
340
+				if ( ! empty($columns['email'])) {
341
+					$data[$i]['email'] = $payment->email;
342 342
 				}
343 343
 
344
-				if ( ! empty( $columns['company'] ) ) {
345
-					$data[ $i ]['company'] = empty( $payment_meta['_give_donation_company'] ) ? '' : str_replace( "\'", "'", $payment_meta['_give_donation_company'] );
344
+				if ( ! empty($columns['company'])) {
345
+					$data[$i]['company'] = empty($payment_meta['_give_donation_company']) ? '' : str_replace("\'", "'", $payment_meta['_give_donation_company']);
346 346
 				}
347 347
 
348
-				if ( ! empty( $columns['address_line1'] ) ) {
349
-					$data[ $i ]['address_line1']   = isset( $address['line1'] ) ? $address['line1'] : '';
350
-					$data[ $i ]['address_line2']   = isset( $address['line2'] ) ? $address['line2'] : '';
351
-					$data[ $i ]['address_city']    = isset( $address['city'] ) ? $address['city'] : '';
352
-					$data[ $i ]['address_state']   = isset( $address['state'] ) ? $address['state'] : '';
353
-					$data[ $i ]['address_zip']     = isset( $address['zip'] ) ? $address['zip'] : '';
354
-					$data[ $i ]['address_country'] = isset( $address['country'] ) ? $address['country'] : '';
348
+				if ( ! empty($columns['address_line1'])) {
349
+					$data[$i]['address_line1']   = isset($address['line1']) ? $address['line1'] : '';
350
+					$data[$i]['address_line2']   = isset($address['line2']) ? $address['line2'] : '';
351
+					$data[$i]['address_city']    = isset($address['city']) ? $address['city'] : '';
352
+					$data[$i]['address_state']   = isset($address['state']) ? $address['state'] : '';
353
+					$data[$i]['address_zip']     = isset($address['zip']) ? $address['zip'] : '';
354
+					$data[$i]['address_country'] = isset($address['country']) ? $address['country'] : '';
355 355
 				}
356 356
 
357
-				if ( ! empty( $columns['donation_total'] ) ) {
358
-					$data[ $i ]['donation_total'] = give_format_amount( give_donation_amount( $payment->ID ) );
357
+				if ( ! empty($columns['donation_total'])) {
358
+					$data[$i]['donation_total'] = give_format_amount(give_donation_amount($payment->ID));
359 359
 				}
360 360
 
361
-				if ( ! empty( $columns['currency_code'] ) ) {
362
-					$data[ $i ]['currency_code'] = empty( $payment_meta['_give_payment_currency'] ) ? give_get_currency() : $payment_meta['_give_payment_currency'];
361
+				if ( ! empty($columns['currency_code'])) {
362
+					$data[$i]['currency_code'] = empty($payment_meta['_give_payment_currency']) ? give_get_currency() : $payment_meta['_give_payment_currency'];
363 363
 				}
364 364
 
365
-				if ( ! empty( $columns['currency_symbol'] ) ) {
366
-					$currency_code = $data[ $i ]['currency_code'];
367
-					$data[ $i ]['currency_symbol'] =  give_currency_symbol( $currency_code, true );
365
+				if ( ! empty($columns['currency_symbol'])) {
366
+					$currency_code = $data[$i]['currency_code'];
367
+					$data[$i]['currency_symbol'] = give_currency_symbol($currency_code, true);
368 368
 				}
369 369
 
370
-				if ( ! empty( $columns['donation_status'] ) ) {
371
-					$data[ $i ]['donation_status'] = give_get_payment_status( $payment, true );
370
+				if ( ! empty($columns['donation_status'])) {
371
+					$data[$i]['donation_status'] = give_get_payment_status($payment, true);
372 372
 				}
373 373
 
374
-				if ( ! empty( $columns['payment_gateway'] ) ) {
375
-					$data[ $i ]['payment_gateway'] = $payment->gateway;
374
+				if ( ! empty($columns['payment_gateway'])) {
375
+					$data[$i]['payment_gateway'] = $payment->gateway;
376 376
 				}
377 377
 
378
-				if ( ! empty( $columns['form_id'] ) ) {
379
-					$data[ $i ]['form_id'] = $payment->form_id;
378
+				if ( ! empty($columns['form_id'])) {
379
+					$data[$i]['form_id'] = $payment->form_id;
380 380
 				}
381 381
 
382
-				if ( ! empty( $columns['form_title'] ) ) {
383
-					$data[ $i ]['form_title'] = get_the_title( $payment->form_id );
382
+				if ( ! empty($columns['form_title'])) {
383
+					$data[$i]['form_title'] = get_the_title($payment->form_id);
384 384
 				}
385 385
 
386
-				if ( ! empty( $columns['form_level_id'] ) ) {
387
-					$data[ $i ]['form_level_id'] = $payment->price_id;
386
+				if ( ! empty($columns['form_level_id'])) {
387
+					$data[$i]['form_level_id'] = $payment->price_id;
388 388
 				}
389 389
 
390
-				if ( ! empty( $columns['form_level_title'] ) ) {
391
-					$var_prices = give_has_variable_prices( $payment_meta['form_id'] );
392
-					if ( empty( $var_prices ) ) {
393
-						$data[ $i ]['form_level_title'] = '';
390
+				if ( ! empty($columns['form_level_title'])) {
391
+					$var_prices = give_has_variable_prices($payment_meta['form_id']);
392
+					if (empty($var_prices)) {
393
+						$data[$i]['form_level_title'] = '';
394 394
 					} else {
395 395
 						$prices_atts = '';
396
-						if ( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) {
397
-							foreach ( $variable_prices as $variable_price ) {
398
-								$prices_atts[ $variable_price['_give_id']['level_id'] ] = give_format_amount( $variable_price['_give_amount'] );
396
+						if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) {
397
+							foreach ($variable_prices as $variable_price) {
398
+								$prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount']);
399 399
 							}
400 400
 						}
401
-						$data[ $i ]['form_level_title'] = give_get_price_option_name( $payment->form_id, $payment->price_id );
401
+						$data[$i]['form_level_title'] = give_get_price_option_name($payment->form_id, $payment->price_id);
402 402
 					}
403 403
 				}
404 404
 
405
-				if ( ! empty( $columns['donation_date'] ) ) {
406
-					$payment_date                = strtotime( $payment->date );
407
-					$data[ $i ]['donation_date'] = date( give_date_format(), $payment_date );
405
+				if ( ! empty($columns['donation_date'])) {
406
+					$payment_date                = strtotime($payment->date);
407
+					$data[$i]['donation_date'] = date(give_date_format(), $payment_date);
408 408
 				}
409 409
 
410
-				if ( ! empty( $columns['donation_time'] ) ) {
411
-					$payment_date                = strtotime( $payment->date );
412
-					$data[ $i ]['donation_time'] = date_i18n( 'H', $payment_date ) . ':' . date( 'i', $payment_date );
410
+				if ( ! empty($columns['donation_time'])) {
411
+					$payment_date                = strtotime($payment->date);
412
+					$data[$i]['donation_time'] = date_i18n('H', $payment_date).':'.date('i', $payment_date);
413 413
 				}
414 414
 
415
-				if ( ! empty( $columns['userid'] ) ) {
416
-					$data[ $i ]['userid'] = $payment->user_id;
415
+				if ( ! empty($columns['userid'])) {
416
+					$data[$i]['userid'] = $payment->user_id;
417 417
 				}
418 418
 
419
-				if ( ! empty( $columns['donorid'] ) ) {
420
-					$data[ $i ]['donorid'] = $payment->customer_id;
419
+				if ( ! empty($columns['donorid'])) {
420
+					$data[$i]['donorid'] = $payment->customer_id;
421 421
 				}
422 422
 
423
-				if ( ! empty( $columns['donor_ip'] ) ) {
424
-					$data[ $i ]['donor_ip'] = give_get_payment_user_ip( $payment->ID );
423
+				if ( ! empty($columns['donor_ip'])) {
424
+					$data[$i]['donor_ip'] = give_get_payment_user_ip($payment->ID);
425 425
 				}
426 426
 
427 427
 				// Add custom field data.
@@ -452,15 +452,15 @@  discard block
 block discarded – undo
452 452
 				);
453 453
 
454 454
 				// Removing above keys...
455
-				foreach ( $remove_keys as $key ) {
456
-					unset( $columns[ $key ] );
455
+				foreach ($remove_keys as $key) {
456
+					unset($columns[$key]);
457 457
 				}
458 458
 
459 459
 				// Now loop through remaining meta fields.
460
-				foreach ( $columns as $col ) {
461
-					$field_data         = get_post_meta( $payment->ID, $col, true );
462
-					$data[ $i ][ $col ] = $field_data;
463
-					unset( $columns[ $col ] );
460
+				foreach ($columns as $col) {
461
+					$field_data         = get_post_meta($payment->ID, $col, true);
462
+					$data[$i][$col] = $field_data;
463
+					unset($columns[$col]);
464 464
 				}
465 465
 
466 466
 				/**
@@ -475,27 +475,27 @@  discard block
 block discarded – undo
475 475
 				 *
476 476
 				 * @return array Donation data
477 477
 				 */
478
-				$data[ $i ] = apply_filters( 'give_export_donation_data', $data[ $i ], $payment, $columns, $this );
478
+				$data[$i] = apply_filters('give_export_donation_data', $data[$i], $payment, $columns, $this);
479 479
 
480 480
 				$new_data = array();
481
-				$old_data = $data[ $i ];
481
+				$old_data = $data[$i];
482 482
 
483 483
 				// sorting the columns bas on row
484
-				foreach ( $this->csv_cols() as $key => $value ) {
485
-					if ( array_key_exists( $key, $old_data ) ) {
486
-						$new_data[ $key ] = $old_data[ $key ];
484
+				foreach ($this->csv_cols() as $key => $value) {
485
+					if (array_key_exists($key, $old_data)) {
486
+						$new_data[$key] = $old_data[$key];
487 487
 					}
488 488
 				}
489 489
 
490
-				$data[ $i ] = $new_data;
490
+				$data[$i] = $new_data;
491 491
 
492 492
 				// Increment iterator.
493
-				$i ++;
493
+				$i++;
494 494
 
495 495
 			}
496 496
 
497
-			$data = apply_filters( 'give_export_get_data', $data );
498
-			$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
497
+			$data = apply_filters('give_export_get_data', $data);
498
+			$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
499 499
 
500 500
 			return $data;
501 501
 
@@ -513,17 +513,17 @@  discard block
 block discarded – undo
513 513
 	 * @return int
514 514
 	 */
515 515
 	public function get_percentage_complete() {
516
-		$args = $this->get_donation_argument( array( 'number' => - 1 ) );
517
-		if ( isset( $args['page'] ) ) {
518
-			unset( $args['page'] );
516
+		$args = $this->get_donation_argument(array('number' => -1));
517
+		if (isset($args['page'])) {
518
+			unset($args['page']);
519 519
 		}
520
-		$query      = give_get_payments( $args );
521
-		$total      = count( $query );
520
+		$query      = give_get_payments($args);
521
+		$total      = count($query);
522 522
 		$percentage = 100;
523
-		if ( $total > 0 ) {
524
-			$percentage = ( ( 30 * $this->step ) / $total ) * 100;
523
+		if ($total > 0) {
524
+			$percentage = ((30 * $this->step) / $total) * 100;
525 525
 		}
526
-		if ( $percentage > 100 ) {
526
+		if ($percentage > 100) {
527 527
 			$percentage = 100;
528 528
 		}
529 529
 
@@ -545,23 +545,23 @@  discard block
 block discarded – undo
545 545
 		$data     = $this->get_data();
546 546
 		$cols     = $this->get_csv_cols();
547 547
 
548
-		if ( $data ) {
548
+		if ($data) {
549 549
 
550 550
 			// Output each row
551
-			foreach ( $data as $row ) {
551
+			foreach ($data as $row) {
552 552
 				$i = 1;
553
-				foreach ( $row as $col_id => $column ) {
553
+				foreach ($row as $col_id => $column) {
554 554
 					// Make sure the column is valid
555
-					if ( array_key_exists( $col_id, $cols ) ) {
556
-						$row_data .= '"' . preg_replace( '/"/', "'", $column ) . '"';
557
-						$row_data .= $i == count( $cols ) ? '' : ',';
558
-						$i ++;
555
+					if (array_key_exists($col_id, $cols)) {
556
+						$row_data .= '"'.preg_replace('/"/', "'", $column).'"';
557
+						$row_data .= $i == count($cols) ? '' : ',';
558
+						$i++;
559 559
 					}
560 560
 				}
561 561
 				$row_data .= "\r\n";
562 562
 			}
563 563
 
564
-			$this->stash_step_data( $row_data );
564
+			$this->stash_step_data($row_data);
565 565
 
566 566
 			return $row_data;
567 567
 		}
Please login to merge, or discard this patch.
includes/process-donation.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *
25 25
  * @throws ReflectionException Exception Handling.
26 26
  *
27
- * @return mixed
27
+ * @return false|null
28 28
  */
29 29
 function give_process_donation_form() {
30 30
 
@@ -1319,7 +1319,7 @@  discard block
 block discarded – undo
1319 1319
  *
1320 1320
  * @param array $valid_data List of Valid Data.
1321 1321
  *
1322
- * @return bool
1322
+ * @return boolean|null
1323 1323
  */
1324 1324
 function give_validate_donation_amount( $valid_data ) {
1325 1325
 
Please login to merge, or discard this patch.
Spacing   +291 added lines, -292 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -28,18 +28,18 @@  discard block
 block discarded – undo
28 28
  */
29 29
 function give_process_donation_form() {
30 30
 
31
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, CSRF ok.
32
-	$is_ajax   = isset( $post_data['give_ajax'] );
31
+	$post_data = give_clean($_POST); // WPCS: input var ok, CSRF ok.
32
+	$is_ajax   = isset($post_data['give_ajax']);
33 33
 
34 34
 	// Verify donation form nonce.
35
-	if ( ! give_verify_donation_form_nonce( $post_data['give-form-hash'], $post_data['give-form-id'] ) ) {
36
-		if ( $is_ajax ) {
35
+	if ( ! give_verify_donation_form_nonce($post_data['give-form-hash'], $post_data['give-form-id'])) {
36
+		if ($is_ajax) {
37 37
 			/**
38 38
 			 * Fires when AJAX sends back errors from the donation form.
39 39
 			 *
40 40
 			 * @since 1.0
41 41
 			 */
42
-			do_action( 'give_ajax_donation_errors' );
42
+			do_action('give_ajax_donation_errors');
43 43
 			give_die();
44 44
 		} else {
45 45
 			give_send_back_to_checkout();
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 *
52 52
 	 * @since 1.0
53 53
 	 */
54
-	do_action( 'give_pre_process_donation' );
54
+	do_action('give_pre_process_donation');
55 55
 
56 56
 	// Validate the form $_POST data.
57 57
 	$valid_data = give_donation_form_validate_fields();
@@ -67,24 +67,24 @@  discard block
 block discarded – undo
67 67
 	 * @param array $deprecated Deprecated Since 2.0.2. Use $_POST instead.
68 68
 	 */
69 69
 	$deprecated = $post_data;
70
-	do_action( 'give_checkout_error_checks', $valid_data, $deprecated );
70
+	do_action('give_checkout_error_checks', $valid_data, $deprecated);
71 71
 
72 72
 	// Process the login form.
73
-	if ( isset( $post_data['give_login_submit'] ) ) {
73
+	if (isset($post_data['give_login_submit'])) {
74 74
 		give_process_form_login();
75 75
 	}
76 76
 
77 77
 	// Validate the user.
78
-	$user = give_get_donation_form_user( $valid_data );
78
+	$user = give_get_donation_form_user($valid_data);
79 79
 
80
-	if ( false === $valid_data || give_get_errors() || ! $user ) {
81
-		if ( $is_ajax ) {
80
+	if (false === $valid_data || give_get_errors() || ! $user) {
81
+		if ($is_ajax) {
82 82
 			/**
83 83
 			 * Fires when AJAX sends back errors from the donation form.
84 84
 			 *
85 85
 			 * @since 1.0
86 86
 			 */
87
-			do_action( 'give_ajax_donation_errors' );
87
+			do_action('give_ajax_donation_errors');
88 88
 			give_die();
89 89
 		} else {
90 90
 			return false;
@@ -92,17 +92,17 @@  discard block
 block discarded – undo
92 92
 	}
93 93
 
94 94
 	// If AJAX send back success to proceed with form submission.
95
-	if ( $is_ajax ) {
95
+	if ($is_ajax) {
96 96
 		echo 'success';
97 97
 		give_die();
98 98
 	}
99 99
 
100 100
 	// After AJAX: Setup session if not using php_sessions.
101
-	if ( ! Give()->session->use_php_sessions() ) {
101
+	if ( ! Give()->session->use_php_sessions()) {
102 102
 		// Double-check that set_cookie is publicly accessible.
103 103
 		// we're using a slightly modified class-wp-sessions.php.
104
-		$session_reflection = new ReflectionMethod( 'WP_Session', 'set_cookie' );
105
-		if ( $session_reflection->isPublic() ) {
104
+		$session_reflection = new ReflectionMethod('WP_Session', 'set_cookie');
105
+		if ($session_reflection->isPublic()) {
106 106
 			// Manually set the cookie.
107 107
 			Give()->session->init()->set_cookie();
108 108
 		}
@@ -117,20 +117,19 @@  discard block
 block discarded – undo
117 117
 		'address'    => $user['address'],
118 118
 	);
119 119
 
120
-	$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
120
+	$auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
121 121
 
122
-	$price    = isset( $post_data['give-amount'] ) ?
123
-		(float) apply_filters( 'give_donation_total', give_maybe_sanitize_amount( $post_data['give-amount'] ) ) :
124
-		'0.00';
125
-	$purchase_key = strtolower( md5( $user['user_email'] . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );
122
+	$price    = isset($post_data['give-amount']) ?
123
+		(float) apply_filters('give_donation_total', give_maybe_sanitize_amount($post_data['give-amount'])) : '0.00';
124
+	$purchase_key = strtolower(md5($user['user_email'].date('Y-m-d H:i:s').$auth_key.uniqid('give', true)));
126 125
 
127 126
 	// Setup donation information.
128 127
 	$donation_data = array(
129 128
 		'price'         => $price,
130 129
 		'purchase_key'  => $purchase_key,
131 130
 		'user_email'    => $user['user_email'],
132
-		'date'          => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ),
133
-		'user_info'     => stripslashes_deep( $user_info ),
131
+		'date'          => date('Y-m-d H:i:s', current_time('timestamp')),
132
+		'user_info'     => stripslashes_deep($user_info),
134 133
 		'post_data'     => $post_data,
135 134
 		'gateway'       => $valid_data['gateway'],
136 135
 		'card_info'     => $valid_data['cc_info'],
@@ -150,10 +149,10 @@  discard block
 block discarded – undo
150 149
 	 * @param array      $user_info  Array containing basic user information.
151 150
 	 * @param bool|array $valid_data Validate fields.
152 151
 	 */
153
-	do_action( 'give_checkout_before_gateway', $post_data, $user_info, $valid_data );
152
+	do_action('give_checkout_before_gateway', $post_data, $user_info, $valid_data);
154 153
 
155 154
 	// Sanity check for price.
156
-	if ( ! $donation_data['price'] ) {
155
+	if ( ! $donation_data['price']) {
157 156
 		// Revert to manual.
158 157
 		$donation_data['gateway'] = 'manual';
159 158
 		$_POST['give-gateway']    = 'manual';
@@ -164,26 +163,26 @@  discard block
 block discarded – undo
164 163
 	 *
165 164
 	 * @since 1.7
166 165
 	 */
167
-	$donation_data = apply_filters( 'give_donation_data_before_gateway', $donation_data, $valid_data );
166
+	$donation_data = apply_filters('give_donation_data_before_gateway', $donation_data, $valid_data);
168 167
 
169 168
 	// Setup the data we're storing in the donation session.
170 169
 	$session_data = $donation_data;
171 170
 
172 171
 	// Make sure credit card numbers are never stored in sessions.
173
-	unset( $session_data['card_info']['card_number'] );
174
-	unset( $session_data['post_data']['card_number'] );
172
+	unset($session_data['card_info']['card_number']);
173
+	unset($session_data['post_data']['card_number']);
175 174
 
176 175
 	// Used for showing data to non logged-in users after donation, and for other plugins needing donation data.
177
-	give_set_purchase_session( $session_data );
176
+	give_set_purchase_session($session_data);
178 177
 
179 178
 	// Send info to the gateway for payment processing.
180
-	give_send_to_gateway( $donation_data['gateway'], $donation_data );
179
+	give_send_to_gateway($donation_data['gateway'], $donation_data);
181 180
 	give_die();
182 181
 }
183 182
 
184
-add_action( 'give_purchase', 'give_process_donation_form' );
185
-add_action( 'wp_ajax_give_process_donation', 'give_process_donation_form' );
186
-add_action( 'wp_ajax_nopriv_give_process_donation', 'give_process_donation_form' );
183
+add_action('give_purchase', 'give_process_donation_form');
184
+add_action('wp_ajax_give_process_donation', 'give_process_donation_form');
185
+add_action('wp_ajax_nopriv_give_process_donation', 'give_process_donation_form');
187 186
 
188 187
 /**
189 188
  * Verify that when a logged in user makes a donation that the email address used doesn't belong to a different customer.
@@ -194,27 +193,27 @@  discard block
 block discarded – undo
194 193
  *
195 194
  * @return void
196 195
  */
197
-function give_check_logged_in_user_for_existing_email( $valid_data ) {
196
+function give_check_logged_in_user_for_existing_email($valid_data) {
198 197
 
199 198
 	// Verify that the email address belongs to this customer.
200
-	if ( is_user_logged_in() ) {
199
+	if (is_user_logged_in()) {
201 200
 
202 201
 		$submitted_email = $valid_data['logged_in_user']['user_email'];
203
-		$donor           = new Give_Donor( get_current_user_id(), true );
202
+		$donor           = new Give_Donor(get_current_user_id(), true);
204 203
 
205 204
 		// If this email address is not registered with this customer, see if it belongs to any other customer.
206 205
 		if (
207 206
 			$submitted_email !== $donor->email
208
-			&& ( is_array( $donor->emails ) && ! in_array( $submitted_email, $donor->emails, true ) )
207
+			&& (is_array($donor->emails) && ! in_array($submitted_email, $donor->emails, true))
209 208
 		) {
210
-			$found_donor = new Give_Donor( $submitted_email );
209
+			$found_donor = new Give_Donor($submitted_email);
211 210
 
212
-			if ( $found_donor->id > 0 ) {
211
+			if ($found_donor->id > 0) {
213 212
 				give_set_error(
214 213
 					'give-customer-email-exists',
215 214
 					sprintf(
216 215
 						/* translators: 1. Donor Email, 2. Submitted Email */
217
-						__( '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' ),
216
+						__('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'),
218 217
 						$donor->email,
219 218
 						$submitted_email
220 219
 					)
@@ -224,7 +223,7 @@  discard block
 block discarded – undo
224 223
 	}
225 224
 }
226 225
 
227
-add_action( 'give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 1 );
226
+add_action('give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 1);
228 227
 
229 228
 /**
230 229
  * Process the checkout login form
@@ -236,49 +235,49 @@  discard block
 block discarded – undo
236 235
  */
237 236
 function give_process_form_login() {
238 237
 
239
-	$is_ajax   = ! empty( $_POST['give_ajax'] ) ? give_clean( $_POST['give_ajax'] ) : 0; // WPCS: input var ok, sanitization ok, CSRF ok.
238
+	$is_ajax   = ! empty($_POST['give_ajax']) ? give_clean($_POST['give_ajax']) : 0; // WPCS: input var ok, sanitization ok, CSRF ok.
240 239
 	$referrer  = wp_get_referer();
241 240
 	$user_data = give_donation_form_validate_user_login();
242 241
 
243
-	if ( give_get_errors() || $user_data['user_id'] < 1 ) {
244
-		if ( $is_ajax ) {
242
+	if (give_get_errors() || $user_data['user_id'] < 1) {
243
+		if ($is_ajax) {
245 244
 			/**
246 245
 			 * Fires when AJAX sends back errors from the donation form.
247 246
 			 *
248 247
 			 * @since 1.0
249 248
 			 */
250 249
 			ob_start();
251
-			do_action( 'give_ajax_donation_errors' );
250
+			do_action('give_ajax_donation_errors');
252 251
 			$message = ob_get_contents();
253 252
 			ob_end_clean();
254
-			wp_send_json_error( $message );
253
+			wp_send_json_error($message);
255 254
 		} else {
256
-			wp_safe_redirect( $referrer );
255
+			wp_safe_redirect($referrer);
257 256
 			exit;
258 257
 		}
259 258
 	}
260 259
 
261
-	give_log_user_in( $user_data['user_id'], $user_data['user_login'], $user_data['user_pass'] );
260
+	give_log_user_in($user_data['user_id'], $user_data['user_login'], $user_data['user_pass']);
262 261
 
263
-	if ( $is_ajax ) {
262
+	if ($is_ajax) {
264 263
 		$message = Give()->notices->print_frontend_notice(
265 264
 			sprintf(
266 265
 				/* translators: %s: user first name */
267
-				esc_html__( 'Welcome %s! You have successfully logged into your account.', 'give' ),
268
-				( ! empty( $user_data['user_first'] ) ) ? $user_data['user_first'] : $user_data['user_login']
266
+				esc_html__('Welcome %s! You have successfully logged into your account.', 'give'),
267
+				( ! empty($user_data['user_first'])) ? $user_data['user_first'] : $user_data['user_login']
269 268
 			),
270 269
 			false,
271 270
 			'success'
272 271
 		);
273 272
 
274
-		wp_send_json_success( $message );
273
+		wp_send_json_success($message);
275 274
 	} else {
276
-		wp_safe_redirect( $referrer );
275
+		wp_safe_redirect($referrer);
277 276
 	}
278 277
 }
279 278
 
280
-add_action( 'wp_ajax_give_process_donation_login', 'give_process_form_login' );
281
-add_action( 'wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login' );
279
+add_action('wp_ajax_give_process_donation_login', 'give_process_form_login');
280
+add_action('wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login');
282 281
 
283 282
 /**
284 283
  * Donation Form Validate Fields.
@@ -290,49 +289,49 @@  discard block
 block discarded – undo
290 289
  */
291 290
 function give_donation_form_validate_fields() {
292 291
 
293
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
292
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
294 293
 
295 294
 	// Validate Honeypot First.
296
-	if ( ! empty( $post_data['give-honeypot'] ) ) {
297
-		give_set_error( 'invalid_honeypot', esc_html__( 'Honeypot field detected. Go away bad bot!', 'give' ) );
295
+	if ( ! empty($post_data['give-honeypot'])) {
296
+		give_set_error('invalid_honeypot', esc_html__('Honeypot field detected. Go away bad bot!', 'give'));
298 297
 	}
299 298
 
300 299
 	// Check spam detect.
301 300
 	if (
302
-		isset( $post_data['action'] ) &&
303
-		give_is_setting_enabled( give_get_option( 'akismet_spam_protection' ) ) &&
301
+		isset($post_data['action']) &&
302
+		give_is_setting_enabled(give_get_option('akismet_spam_protection')) &&
304 303
 		give_is_spam_donation()
305 304
 	) {
306
-		give_set_error( 'spam_donation', __( 'This donation has been flagged as spam. Please try again.', 'give' ) );
305
+		give_set_error('spam_donation', __('This donation has been flagged as spam. Please try again.', 'give'));
307 306
 	}
308 307
 
309 308
 	// Start an array to collect valid data.
310 309
 	$valid_data = array(
311 310
 		'gateway'          => give_donation_form_validate_gateway(), // Gateway fallback (amount is validated here).
312
-		'need_new_user'    => false,     // New user flag.
313
-		'need_user_login'  => false,     // Login user flag.
314
-		'logged_user_data' => array(),   // Logged user collected data.
315
-		'new_user_data'    => array(),   // New user collected data.
316
-		'login_user_data'  => array(),   // Login user collected data.
317
-		'guest_user_data'  => array(),   // Guest user collected data.
311
+		'need_new_user'    => false, // New user flag.
312
+		'need_user_login'  => false, // Login user flag.
313
+		'logged_user_data' => array(), // Logged user collected data.
314
+		'new_user_data'    => array(), // New user collected data.
315
+		'login_user_data'  => array(), // Login user collected data.
316
+		'guest_user_data'  => array(), // Guest user collected data.
318 317
 		'cc_info'          => give_donation_form_validate_cc(), // Credit card info.
319 318
 	);
320 319
 
321
-	$form_id = intval( $post_data['give-form-id'] );
320
+	$form_id = intval($post_data['give-form-id']);
322 321
 
323 322
 	// Validate agree to terms.
324
-	if ( give_is_terms_enabled( $form_id ) ) {
323
+	if (give_is_terms_enabled($form_id)) {
325 324
 		give_donation_form_validate_agree_to_terms();
326 325
 	}
327 326
 
328
-	if ( is_user_logged_in() ) {
327
+	if (is_user_logged_in()) {
329 328
 
330 329
 		// Collect logged in user data.
331 330
 		$valid_data['logged_in_user'] = give_donation_form_validate_logged_in_user();
332 331
 	} elseif (
333
-		isset( $post_data['give-purchase-var'] ) &&
332
+		isset($post_data['give-purchase-var']) &&
334 333
 		'needs-to-register' === $post_data['give-purchase-var'] &&
335
-		! empty( $post_data['give_create_account'] )
334
+		! empty($post_data['give_create_account'])
336 335
 	) {
337 336
 
338 337
 		// Set new user registration as required.
@@ -341,7 +340,7 @@  discard block
 block discarded – undo
341 340
 		// Validate new user data.
342 341
 		$valid_data['new_user_data'] = give_donation_form_validate_new_user();
343 342
 	} elseif (
344
-		isset( $post_data['give-purchase-var'] ) &&
343
+		isset($post_data['give-purchase-var']) &&
345 344
 		'needs-to-login' === $post_data['give-purchase-var']
346 345
 	) {
347 346
 
@@ -370,14 +369,14 @@  discard block
 block discarded – undo
370 369
 function give_is_spam_donation() {
371 370
 	$spam = false;
372 371
 
373
-	$user_agent = (string) isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '';
372
+	$user_agent = (string) isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
374 373
 
375
-	if ( strlen( $user_agent ) < 2 ) {
374
+	if (strlen($user_agent) < 2) {
376 375
 		$spam = true;
377 376
 	}
378 377
 
379 378
 	// Allow developer to customized Akismet spam detect API call and it's response.
380
-	return apply_filters( 'give_spam', $spam );
379
+	return apply_filters('give_spam', $spam);
381 380
 }
382 381
 
383 382
 /**
@@ -392,33 +391,33 @@  discard block
 block discarded – undo
392 391
  */
393 392
 function give_donation_form_validate_gateway() {
394 393
 
395
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
396
-	$form_id   = ! empty( $post_data['give-form-id'] ) ? $post_data['give-form-id'] : 0;
397
-	$amount    = ! empty( $post_data['give-amount'] ) ? give_maybe_sanitize_amount( $post_data['give-amount'] ) : 0;
398
-	$gateway   = ! empty( $post_data['give-gateway'] ) ? $post_data['give-gateway'] : 0;
394
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
395
+	$form_id   = ! empty($post_data['give-form-id']) ? $post_data['give-form-id'] : 0;
396
+	$amount    = ! empty($post_data['give-amount']) ? give_maybe_sanitize_amount($post_data['give-amount']) : 0;
397
+	$gateway   = ! empty($post_data['give-gateway']) ? $post_data['give-gateway'] : 0;
399 398
 
400 399
 	// Bailout, if payment gateway is not submitted with donation form data.
401
-	if ( empty( $gateway ) ) {
400
+	if (empty($gateway)) {
402 401
 
403
-		give_set_error( 'empty_gateway', __( 'The donation form will process with a valid payment gateway.', 'give' ) );
402
+		give_set_error('empty_gateway', __('The donation form will process with a valid payment gateway.', 'give'));
404 403
 
405
-	} elseif ( ! give_is_gateway_active( $gateway ) ) {
404
+	} elseif ( ! give_is_gateway_active($gateway)) {
406 405
 
407
-		give_set_error( 'invalid_gateway', __( 'The selected payment gateway is not enabled.', 'give' ) );
406
+		give_set_error('invalid_gateway', __('The selected payment gateway is not enabled.', 'give'));
408 407
 
409
-	} elseif ( empty( $amount ) ) {
408
+	} elseif (empty($amount)) {
410 409
 
411
-		give_set_error( 'invalid_donation_amount', __( 'Please insert a valid donation amount.', 'give' ) );
410
+		give_set_error('invalid_donation_amount', __('Please insert a valid donation amount.', 'give'));
412 411
 
413
-	} elseif ( ! give_verify_minimum_price( 'minimum' ) ) {
412
+	} elseif ( ! give_verify_minimum_price('minimum')) {
414 413
 
415 414
 		give_set_error(
416 415
 			'invalid_donation_minimum',
417 416
 			sprintf(
418 417
 				/* translators: %s: minimum donation amount */
419
-				__( 'This form has a minimum donation amount of %s.', 'give' ),
418
+				__('This form has a minimum donation amount of %s.', 'give'),
420 419
 				give_currency_filter(
421
-					give_format_amount( give_get_form_minimum_price( $form_id ),
420
+					give_format_amount(give_get_form_minimum_price($form_id),
422 421
 						array(
423 422
 							'sanitize' => false,
424 423
 						)
@@ -426,15 +425,15 @@  discard block
 block discarded – undo
426 425
 				)
427 426
 			)
428 427
 		);
429
-	} elseif ( ! give_verify_minimum_price( 'maximum' ) ) {
428
+	} elseif ( ! give_verify_minimum_price('maximum')) {
430 429
 
431 430
 		give_set_error(
432 431
 			'invalid_donation_maximum',
433 432
 			sprintf(
434 433
 				/* translators: %s: Maximum donation amount */
435
-				__( 'This form has a maximum donation amount of %s.', 'give' ),
434
+				__('This form has a maximum donation amount of %s.', 'give'),
436 435
 				give_currency_filter(
437
-					give_format_amount( give_get_form_maximum_price( $form_id ),
436
+					give_format_amount(give_get_form_maximum_price($form_id),
438 437
 						array(
439 438
 							'sanitize' => false,
440 439
 						)
@@ -460,33 +459,33 @@  discard block
 block discarded – undo
460 459
  *
461 460
  * @return bool
462 461
  */
463
-function give_verify_minimum_price( $amount_range = 'minimum' ) {
462
+function give_verify_minimum_price($amount_range = 'minimum') {
464 463
 
465
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
466
-	$amount    = ! empty( $post_data['give-amount'] ) ? give_maybe_sanitize_amount( $post_data['give-amount'] ) : 0;
467
-	$form_id   = ! empty( $post_data['give-form-id'] ) ? $post_data['give-form-id'] : 0;
468
-	$price_id  = isset( $post_data['give-price-id'] ) ? absint( $post_data['give-price-id'] ) : '';
464
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
465
+	$amount    = ! empty($post_data['give-amount']) ? give_maybe_sanitize_amount($post_data['give-amount']) : 0;
466
+	$form_id   = ! empty($post_data['give-form-id']) ? $post_data['give-form-id'] : 0;
467
+	$price_id  = isset($post_data['give-price-id']) ? absint($post_data['give-price-id']) : '';
469 468
 
470
-	$variable_prices = give_has_variable_prices( $form_id );
471
-	$price_ids       = array_map( 'absint', give_get_variable_price_ids( $form_id ) );
469
+	$variable_prices = give_has_variable_prices($form_id);
470
+	$price_ids       = array_map('absint', give_get_variable_price_ids($form_id));
472 471
 	$verified_stat   = false;
473 472
 
474
-	if ( $variable_prices && in_array( $price_id, $price_ids, true ) ) {
473
+	if ($variable_prices && in_array($price_id, $price_ids, true)) {
475 474
 
476
-		$price_level_amount = give_get_price_option_amount( $form_id, $price_id );
475
+		$price_level_amount = give_get_price_option_amount($form_id, $price_id);
477 476
 
478
-		if ( $price_level_amount == $amount ) {
477
+		if ($price_level_amount == $amount) {
479 478
 			$verified_stat = true;
480 479
 		}
481 480
 	}
482 481
 
483
-	if ( ! $verified_stat ) {
484
-		switch ( $amount_range ) {
482
+	if ( ! $verified_stat) {
483
+		switch ($amount_range) {
485 484
 			case 'minimum' :
486
-				$verified_stat = ( give_get_form_minimum_price( $form_id ) > $amount ) ? false : true;
485
+				$verified_stat = (give_get_form_minimum_price($form_id) > $amount) ? false : true;
487 486
 				break;
488 487
 			case 'maximum' :
489
-				$verified_stat = ( give_get_form_maximum_price( $form_id ) < $amount ) ? false : true;
488
+				$verified_stat = (give_get_form_maximum_price($form_id) < $amount) ? false : true;
490 489
 				break;
491 490
 		}
492 491
 	}
@@ -500,7 +499,7 @@  discard block
 block discarded – undo
500 499
 	 * @param string  $amount_range  Type of the amount.
501 500
 	 * @param integer $form_id       Give Donation Form ID.
502 501
 	 */
503
-	return apply_filters( 'give_verify_minimum_maximum_price', $verified_stat, $amount_range, $form_id );
502
+	return apply_filters('give_verify_minimum_maximum_price', $verified_stat, $amount_range, $form_id);
504 503
 }
505 504
 
506 505
 /**
@@ -513,13 +512,13 @@  discard block
 block discarded – undo
513 512
  */
514 513
 function give_donation_form_validate_agree_to_terms() {
515 514
 
516
-	$agree_to_terms = ! empty( $_POST['give_agree_to_terms'] ) ? give_clean( $_POST['give_agree_to_terms'] ) : 0; // WPCS: input var ok, sanitization ok, CSRF ok.
515
+	$agree_to_terms = ! empty($_POST['give_agree_to_terms']) ? give_clean($_POST['give_agree_to_terms']) : 0; // WPCS: input var ok, sanitization ok, CSRF ok.
517 516
 
518 517
 	// Proceed only, if donor agreed to terms.
519
-	if ( ! $agree_to_terms ) {
518
+	if ( ! $agree_to_terms) {
520 519
 
521 520
 		// User did not agree.
522
-		give_set_error( 'agree_to_terms', apply_filters( 'give_agree_to_terms_text', __( 'You must agree to the terms and conditions.', 'give' ) ) );
521
+		give_set_error('agree_to_terms', apply_filters('give_agree_to_terms_text', __('You must agree to the terms and conditions.', 'give')));
523 522
 	}
524 523
 }
525 524
 
@@ -533,84 +532,84 @@  discard block
 block discarded – undo
533 532
  *
534 533
  * @return array
535 534
  */
536
-function give_get_required_fields( $form_id ) {
535
+function give_get_required_fields($form_id) {
537 536
 
538
-	$payment_mode = give_get_chosen_gateway( $form_id );
537
+	$payment_mode = give_get_chosen_gateway($form_id);
539 538
 
540 539
 	$required_fields = array(
541 540
 		'give_email' => array(
542 541
 			'error_id'      => 'invalid_email',
543
-			'error_message' => __( 'Please enter a valid email address.', 'give' ),
542
+			'error_message' => __('Please enter a valid email address.', 'give'),
544 543
 		),
545 544
 		'give_first' => array(
546 545
 			'error_id'      => 'invalid_first_name',
547
-			'error_message' => __( 'Please enter your first name.', 'give' ),
546
+			'error_message' => __('Please enter your first name.', 'give'),
548 547
 		),
549 548
 	);
550 549
 
551
-	$require_address = give_require_billing_address( $payment_mode );
550
+	$require_address = give_require_billing_address($payment_mode);
552 551
 
553
-	if ( $require_address ) {
554
-		$required_fields['card_address']    = array(
552
+	if ($require_address) {
553
+		$required_fields['card_address'] = array(
555 554
 			'error_id'      => 'invalid_card_address',
556
-			'error_message' => __( 'Please enter your primary billing address.', 'give' ),
555
+			'error_message' => __('Please enter your primary billing address.', 'give'),
557 556
 		);
558
-		$required_fields['card_zip']        = array(
557
+		$required_fields['card_zip'] = array(
559 558
 			'error_id'      => 'invalid_zip_code',
560
-			'error_message' => __( 'Please enter your zip / postal code.', 'give' ),
559
+			'error_message' => __('Please enter your zip / postal code.', 'give'),
561 560
 		);
562
-		$required_fields['card_city']       = array(
561
+		$required_fields['card_city'] = array(
563 562
 			'error_id'      => 'invalid_city',
564
-			'error_message' => __( 'Please enter your billing city.', 'give' ),
563
+			'error_message' => __('Please enter your billing city.', 'give'),
565 564
 		);
566 565
 		$required_fields['billing_country'] = array(
567 566
 			'error_id'      => 'invalid_country',
568
-			'error_message' => __( 'Please select your billing country.', 'give' ),
567
+			'error_message' => __('Please select your billing country.', 'give'),
569 568
 		);
570 569
 
571 570
 
572 571
 		$required_fields['card_state'] = array(
573 572
 			'error_id'      => 'invalid_state',
574
-			'error_message' => __( 'Please enter billing state / province / County.', 'give' ),
573
+			'error_message' => __('Please enter billing state / province / County.', 'give'),
575 574
 		);
576 575
 
577
-		$country = ! empty( $_POST['billing_country'] ) ? give_clean( $_POST['billing_country'] ) : 0; // WPCS: input var ok, sanitization ok, CSRF ok.
576
+		$country = ! empty($_POST['billing_country']) ? give_clean($_POST['billing_country']) : 0; // WPCS: input var ok, sanitization ok, CSRF ok.
578 577
 
579 578
 		// Check if billing country already exists.
580
-		if ( $country ) {
579
+		if ($country) {
581 580
 
582 581
 			// Get the country list that does not required any states init.
583 582
 			$states_country = give_states_not_required_country_list();
584 583
 
585 584
 			// Check if states is empty or not.
586
-			if ( array_key_exists( $country, $states_country ) ) {
585
+			if (array_key_exists($country, $states_country)) {
587 586
 				// If states is empty remove the required fields of state in billing cart.
588
-				unset( $required_fields['card_state'] );
587
+				unset($required_fields['card_state']);
589 588
 			}
590 589
 		}
591 590
 	} // End if().
592 591
 
593
-	if ( give_is_company_field_enabled( $form_id ) ) {
594
-		$form_option    = give_get_meta( $form_id, '_give_company_field', true );
595
-		$global_setting = give_get_option( 'company_field' );
592
+	if (give_is_company_field_enabled($form_id)) {
593
+		$form_option    = give_get_meta($form_id, '_give_company_field', true);
594
+		$global_setting = give_get_option('company_field');
596 595
 
597 596
 		$is_company_field_required = false;
598 597
 
599
-		if ( ! empty( $form_option ) && give_is_setting_enabled( $form_option, array( 'required' ) ) ) {
598
+		if ( ! empty($form_option) && give_is_setting_enabled($form_option, array('required'))) {
600 599
 			$is_company_field_required = true;
601 600
 
602
-		} elseif ( 'global' === $form_option && give_is_setting_enabled( $global_setting, array( 'required' ) ) ) {
601
+		} elseif ('global' === $form_option && give_is_setting_enabled($global_setting, array('required'))) {
603 602
 			$is_company_field_required = true;
604 603
 
605
-		} elseif ( empty( $form_option ) && give_is_setting_enabled( $global_setting, array( 'required' ) ) ) {
604
+		} elseif (empty($form_option) && give_is_setting_enabled($global_setting, array('required'))) {
606 605
 			$is_company_field_required = true;
607 606
 
608 607
 		}
609 608
 
610
-		if ( $is_company_field_required ) {
609
+		if ($is_company_field_required) {
611 610
 			$required_fields['give_company_name'] = array(
612 611
 				'error_id'      => 'invalid_company',
613
-				'error_message' => __( 'Please enter Company Name.', 'give' ),
612
+				'error_message' => __('Please enter Company Name.', 'give'),
614 613
 			);
615 614
 		}
616 615
 	}
@@ -620,7 +619,7 @@  discard block
 block discarded – undo
620 619
 	 *
621 620
 	 * @since 1.7
622 621
 	 */
623
-	$required_fields = apply_filters( 'give_donation_form_required_fields', $required_fields, $form_id );
622
+	$required_fields = apply_filters('give_donation_form_required_fields', $required_fields, $form_id);
624 623
 
625 624
 	return $required_fields;
626 625
 
@@ -635,17 +634,17 @@  discard block
 block discarded – undo
635 634
  *
636 635
  * @return bool
637 636
  */
638
-function give_require_billing_address( $payment_mode ) {
637
+function give_require_billing_address($payment_mode) {
639 638
 
640 639
 	$return          = false;
641
-	$billing_country = ! empty( $_POST['billing_country'] ) ? give_clean( $_POST['billing_country'] ) : 0; // WPCS: input var ok, sanitization ok, CSRF ok.
640
+	$billing_country = ! empty($_POST['billing_country']) ? give_clean($_POST['billing_country']) : 0; // WPCS: input var ok, sanitization ok, CSRF ok.
642 641
 
643
-	if ( $billing_country || did_action( "give_{$payment_mode}_cc_form" ) || did_action( 'give_cc_form' ) ) {
642
+	if ($billing_country || did_action("give_{$payment_mode}_cc_form") || did_action('give_cc_form')) {
644 643
 		$return = true;
645 644
 	}
646 645
 
647 646
 	// Let payment gateways and other extensions determine if address fields should be required.
648
-	return apply_filters( 'give_require_billing_address', $return );
647
+	return apply_filters('give_require_billing_address', $return);
649 648
 
650 649
 }
651 650
 
@@ -659,47 +658,47 @@  discard block
 block discarded – undo
659 658
  */
660 659
 function give_donation_form_validate_logged_in_user() {
661 660
 
662
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
661
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
663 662
 	$user_id   = get_current_user_id();
664
-	$form_id   = ! empty( $post_data['give-form-id'] ) ? $post_data['give-form-id'] : 0;
663
+	$form_id   = ! empty($post_data['give-form-id']) ? $post_data['give-form-id'] : 0;
665 664
 
666 665
 	// Start empty array to collect valid user data.
667 666
 	$valid_user_data = array(
668 667
 
669 668
 		// Assume there will be errors.
670
-		'user_id' => - 1,
669
+		'user_id' => -1,
671 670
 	);
672 671
 
673 672
 	// Proceed on;y, if valid $user_id found.
674
-	if ( $user_id > 0 ) {
673
+	if ($user_id > 0) {
675 674
 
676 675
 		// Get the logged in user data.
677
-		$user_data = get_userdata( $user_id );
676
+		$user_data = get_userdata($user_id);
678 677
 
679 678
 		// Validate Required Form Fields.
680
-		give_validate_required_form_fields( $form_id );
679
+		give_validate_required_form_fields($form_id);
681 680
 
682 681
 		// Verify data.
683
-		if ( is_object( $user_data ) && $user_data->ID > 0 ) {
682
+		if (is_object($user_data) && $user_data->ID > 0) {
684 683
 
685 684
 			// Collected logged in user data.
686 685
 			$valid_user_data = array(
687 686
 				'user_id'    => $user_id,
688
-				'user_email' => ! empty( $post_data['give_email'] ) ? sanitize_email( $post_data['give_email'] ) : $user_data->user_email,
689
-				'user_first' => ! empty( $post_data['give_first'] ) ? $post_data['give_first'] : $user_data->first_name,
690
-				'user_last'  => ! empty( $post_data['give_last'] ) ? $post_data['give_last'] : $user_data->last_name,
687
+				'user_email' => ! empty($post_data['give_email']) ? sanitize_email($post_data['give_email']) : $user_data->user_email,
688
+				'user_first' => ! empty($post_data['give_first']) ? $post_data['give_first'] : $user_data->first_name,
689
+				'user_last'  => ! empty($post_data['give_last']) ? $post_data['give_last'] : $user_data->last_name,
691 690
 			);
692 691
 
693 692
 			// Validate essential form fields.
694
-			give_donation_form_validate_name_fields( $post_data );
693
+			give_donation_form_validate_name_fields($post_data);
695 694
 
696
-			if ( ! is_email( $valid_user_data['user_email'] ) ) {
697
-				give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) );
695
+			if ( ! is_email($valid_user_data['user_email'])) {
696
+				give_set_error('email_invalid', esc_html__('Invalid email.', 'give'));
698 697
 			}
699 698
 		} else {
700 699
 
701 700
 			// Set invalid user information error.
702
-			give_set_error( 'invalid_user', esc_html__( 'The user information is invalid.', 'give' ) );
701
+			give_set_error('invalid_user', esc_html__('The user information is invalid.', 'give'));
703 702
 		}
704 703
 	}
705 704
 
@@ -717,12 +716,12 @@  discard block
 block discarded – undo
717 716
  */
718 717
 function give_donation_form_validate_new_user() {
719 718
 
720
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
721
-	$nonce     = ! empty( $post_data['give-form-user-register-hash'] ) ? $post_data['give-form-user-register-hash'] : '';
719
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
720
+	$nonce     = ! empty($post_data['give-form-user-register-hash']) ? $post_data['give-form-user-register-hash'] : '';
722 721
 
723 722
 	// Validate user creation nonce.
724
-	if ( ! wp_verify_nonce( $nonce, 'give_form_create_user_nonce' ) ) {
725
-		give_set_error( 'invalid_nonce', __( 'Nonce verification has failed.', 'give' ) );
723
+	if ( ! wp_verify_nonce($nonce, 'give_form_create_user_nonce')) {
724
+		give_set_error('invalid_nonce', __('Nonce verification has failed.', 'give'));
726 725
 	}
727 726
 
728 727
 	$auto_generated_password = wp_generate_password();
@@ -730,7 +729,7 @@  discard block
 block discarded – undo
730 729
 	// Default user data.
731 730
 	$default_user_data = array(
732 731
 		'give-form-id'           => '',
733
-		'user_id'                => - 1, // Assume there will be errors.
732
+		'user_id'                => -1, // Assume there will be errors.
734 733
 		'user_first'             => '',
735 734
 		'user_last'              => '',
736 735
 		'give_user_login'        => false,
@@ -740,17 +739,17 @@  discard block
 block discarded – undo
740 739
 	);
741 740
 
742 741
 	// Get user data.
743
-	$user_data            = wp_parse_args( $post_data, $default_user_data );
742
+	$user_data            = wp_parse_args($post_data, $default_user_data);
744 743
 	$registering_new_user = false;
745
-	$form_id              = absint( $user_data['give-form-id'] );
744
+	$form_id              = absint($user_data['give-form-id']);
746 745
 
747
-	give_donation_form_validate_name_fields( $user_data );
746
+	give_donation_form_validate_name_fields($user_data);
748 747
 
749 748
 	// Start an empty array to collect valid user data.
750 749
 	$valid_user_data = array(
751 750
 
752 751
 		// Assume there will be errors.
753
-		'user_id'    => - 1,
752
+		'user_id'    => -1,
754 753
 
755 754
 		// Get first name.
756 755
 		'user_first' => $user_data['give_first'],
@@ -763,13 +762,13 @@  discard block
 block discarded – undo
763 762
 	);
764 763
 
765 764
 	// Validate Required Form Fields.
766
-	give_validate_required_form_fields( $form_id );
765
+	give_validate_required_form_fields($form_id);
767 766
 
768 767
 	// Set Email as Username.
769 768
 	$valid_user_data['user_login'] = $user_data['give_email'];
770 769
 
771 770
 	// Check if we have an email to verify.
772
-	if ( give_validate_user_email( $user_data['give_email'], $registering_new_user ) ) {
771
+	if (give_validate_user_email($user_data['give_email'], $registering_new_user)) {
773 772
 		$valid_user_data['user_email'] = $user_data['give_email'];
774 773
 	}
775 774
 
@@ -786,47 +785,47 @@  discard block
 block discarded – undo
786 785
  */
787 786
 function give_donation_form_validate_user_login() {
788 787
 
789
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
788
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
790 789
 
791 790
 	// Start an array to collect valid user data.
792 791
 	$valid_user_data = array(
793 792
 
794 793
 		// Assume there will be errors.
795
-		'user_id' => - 1,
794
+		'user_id' => -1,
796 795
 	);
797 796
 
798 797
 	// Bailout, if Username is empty.
799
-	if ( empty( $post_data['give_user_login'] ) ) {
800
-		give_set_error( 'must_log_in', __( 'You must register or login to complete your donation.', 'give' ) );
798
+	if (empty($post_data['give_user_login'])) {
799
+		give_set_error('must_log_in', __('You must register or login to complete your donation.', 'give'));
801 800
 
802 801
 		return $valid_user_data;
803 802
 	}
804 803
 
805 804
 	// Get the user by login.
806
-	$user_data = get_user_by( 'login', strip_tags( $post_data['give_user_login'] ) );
805
+	$user_data = get_user_by('login', strip_tags($post_data['give_user_login']));
807 806
 
808 807
 	// Check if user exists.
809
-	if ( $user_data ) {
808
+	if ($user_data) {
810 809
 
811 810
 		// Get password.
812
-		$user_pass = ! empty( $post_data['give_user_pass'] ) ? $post_data['give_user_pass'] : false;
811
+		$user_pass = ! empty($post_data['give_user_pass']) ? $post_data['give_user_pass'] : false;
813 812
 
814 813
 		// Check user_pass.
815
-		if ( $user_pass ) {
814
+		if ($user_pass) {
816 815
 
817 816
 			// Check if password is valid.
818
-			if ( ! wp_check_password( $user_pass, $user_data->user_pass, $user_data->ID ) ) {
817
+			if ( ! wp_check_password($user_pass, $user_data->user_pass, $user_data->ID)) {
819 818
 
820
-				$current_page_url = site_url() . '/' . get_page_uri();
819
+				$current_page_url = site_url().'/'.get_page_uri();
821 820
 
822 821
 				// Incorrect password.
823 822
 				give_set_error(
824 823
 					'password_incorrect',
825 824
 					sprintf(
826 825
 						'%1$s <a href="%2$s">%3$s</a>',
827
-						__( 'The password you entered is incorrect.', 'give' ),
828
-						wp_lostpassword_url( $current_page_url ),
829
-						__( 'Reset Password', 'give' )
826
+						__('The password you entered is incorrect.', 'give'),
827
+						wp_lostpassword_url($current_page_url),
828
+						__('Reset Password', 'give')
830 829
 					)
831 830
 				);
832 831
 
@@ -844,11 +843,11 @@  discard block
 block discarded – undo
844 843
 			}
845 844
 		} else {
846 845
 			// Empty password.
847
-			give_set_error( 'password_empty', __( 'Enter a password.', 'give' ) );
846
+			give_set_error('password_empty', __('Enter a password.', 'give'));
848 847
 		}
849 848
 	} else {
850 849
 		// No username.
851
-		give_set_error( 'username_incorrect', __( 'The username you entered does not exist.', 'give' ) );
850
+		give_set_error('username_incorrect', __('The username you entered does not exist.', 'give'));
852 851
 	} // End if().
853 852
 
854 853
 	return $valid_user_data;
@@ -864,8 +863,8 @@  discard block
 block discarded – undo
864 863
  */
865 864
 function give_donation_form_validate_guest_user() {
866 865
 
867
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
868
-	$form_id   = ! empty( $post_data['give-form-id'] ) ? $post_data['give-form-id'] : 0;
866
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
867
+	$form_id   = ! empty($post_data['give-form-id']) ? $post_data['give-form-id'] : 0;
869 868
 
870 869
 	// Start an array to collect valid user data.
871 870
 	$valid_user_data = array(
@@ -874,22 +873,22 @@  discard block
 block discarded – undo
874 873
 	);
875 874
 
876 875
 	// Validate name fields.
877
-	give_donation_form_validate_name_fields( $post_data );
876
+	give_donation_form_validate_name_fields($post_data);
878 877
 
879 878
 	// Validate Required Form Fields.
880
-	give_validate_required_form_fields( $form_id );
879
+	give_validate_required_form_fields($form_id);
881 880
 
882 881
 	// Get the guest email.
883
-	$guest_email = ! empty( $post_data['give_email'] ) ? $post_data['give_email'] : false;
882
+	$guest_email = ! empty($post_data['give_email']) ? $post_data['give_email'] : false;
884 883
 
885 884
 	// Check email.
886
-	if ( $guest_email && strlen( $guest_email ) > 0 ) {
885
+	if ($guest_email && strlen($guest_email) > 0) {
887 886
 
888 887
 		// Validate email.
889
-		if ( ! is_email( $guest_email ) ) {
888
+		if ( ! is_email($guest_email)) {
890 889
 
891 890
 			// Invalid email.
892
-			give_set_error( 'email_invalid', __( 'Invalid email.', 'give' ) );
891
+			give_set_error('email_invalid', __('Invalid email.', 'give'));
893 892
 
894 893
 		} else {
895 894
 
@@ -897,15 +896,15 @@  discard block
 block discarded – undo
897 896
 			$valid_user_data['user_email'] = $guest_email;
898 897
 
899 898
 			// Get user_id from donor if exist.
900
-			$donor = new Give_Donor( $guest_email );
899
+			$donor = new Give_Donor($guest_email);
901 900
 
902
-			if ( $donor->id && $donor->user_id ) {
901
+			if ($donor->id && $donor->user_id) {
903 902
 				$valid_user_data['user_id'] = $donor->user_id;
904 903
 			}
905 904
 		}
906 905
 	} else {
907 906
 		// No email.
908
-		give_set_error( 'email_empty', __( 'Enter an email.', 'give' ) );
907
+		give_set_error('email_empty', __('Enter an email.', 'give'));
909 908
 	}
910 909
 
911 910
 	return $valid_user_data;
@@ -921,36 +920,36 @@  discard block
 block discarded – undo
921 920
  *
922 921
  * @return  integer
923 922
  */
924
-function give_register_and_login_new_user( $user_data = array() ) {
923
+function give_register_and_login_new_user($user_data = array()) {
925 924
 	// Verify the array.
926
-	if ( empty( $user_data ) ) {
927
-		return - 1;
925
+	if (empty($user_data)) {
926
+		return -1;
928 927
 	}
929 928
 
930
-	if ( give_get_errors() ) {
931
-		return - 1;
929
+	if (give_get_errors()) {
930
+		return -1;
932 931
 	}
933 932
 
934
-	$user_args = apply_filters( 'give_insert_user_args', array(
935
-		'user_login'      => isset( $user_data['user_login'] ) ? $user_data['user_login'] : '',
936
-		'user_pass'       => isset( $user_data['user_pass'] ) ? $user_data['user_pass'] : '',
937
-		'user_email'      => isset( $user_data['user_email'] ) ? $user_data['user_email'] : '',
938
-		'first_name'      => isset( $user_data['user_first'] ) ? $user_data['user_first'] : '',
939
-		'last_name'       => isset( $user_data['user_last'] ) ? $user_data['user_last'] : '',
940
-		'user_registered' => date( 'Y-m-d H:i:s' ),
941
-		'role'            => give_get_option( 'donor_default_user_role', 'give_donor' ),
942
-	), $user_data );
933
+	$user_args = apply_filters('give_insert_user_args', array(
934
+		'user_login'      => isset($user_data['user_login']) ? $user_data['user_login'] : '',
935
+		'user_pass'       => isset($user_data['user_pass']) ? $user_data['user_pass'] : '',
936
+		'user_email'      => isset($user_data['user_email']) ? $user_data['user_email'] : '',
937
+		'first_name'      => isset($user_data['user_first']) ? $user_data['user_first'] : '',
938
+		'last_name'       => isset($user_data['user_last']) ? $user_data['user_last'] : '',
939
+		'user_registered' => date('Y-m-d H:i:s'),
940
+		'role'            => give_get_option('donor_default_user_role', 'give_donor'),
941
+	), $user_data);
943 942
 
944 943
 	// Insert new user.
945
-	$user_id = wp_insert_user( $user_args );
944
+	$user_id = wp_insert_user($user_args);
946 945
 
947 946
 	// Validate inserted user.
948
-	if ( is_wp_error( $user_id ) ) {
949
-		return - 1;
947
+	if (is_wp_error($user_id)) {
948
+		return -1;
950 949
 	}
951 950
 
952 951
 	// Allow themes and plugins to filter the user data.
953
-	$user_data = apply_filters( 'give_insert_user_data', $user_data, $user_args );
952
+	$user_data = apply_filters('give_insert_user_data', $user_data, $user_args);
954 953
 
955 954
 	/**
956 955
 	 * Fires after inserting user.
@@ -960,7 +959,7 @@  discard block
 block discarded – undo
960 959
 	 * @param int $user_id User id.
961 960
 	 * @param array $user_data Array containing user data.
962 961
 	 */
963
-	do_action( 'give_insert_user', $user_id, $user_data );
962
+	do_action('give_insert_user', $user_id, $user_data);
964 963
 
965 964
 	/**
966 965
 	 * Filter allow user to alter if user when to login or not when user is register for the first time.
@@ -969,9 +968,9 @@  discard block
 block discarded – undo
969 968
 	 *
970 969
 	 * return bool True if login with registration and False if only want to register.
971 970
 	 */
972
-	if ( true === (bool) apply_filters( 'give_log_user_in_on_register', true ) ) {
971
+	if (true === (bool) apply_filters('give_log_user_in_on_register', true)) {
973 972
 		// Login new user.
974
-		give_log_user_in( $user_id, $user_data['user_login'], $user_data['user_pass'] );
973
+		give_log_user_in($user_id, $user_data['user_login'], $user_data['user_pass']);
975 974
 	}
976 975
 
977 976
 	// Return user id.
@@ -988,33 +987,33 @@  discard block
 block discarded – undo
988 987
  *
989 988
  * @return  array|bool
990 989
  */
991
-function give_get_donation_form_user( $valid_data = array() ) {
990
+function give_get_donation_form_user($valid_data = array()) {
992 991
 
993 992
 	// Initialize user.
994 993
 	$user      = false;
995
-	$is_ajax   = defined( 'DOING_AJAX' ) && DOING_AJAX;
996
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
994
+	$is_ajax   = defined('DOING_AJAX') && DOING_AJAX;
995
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
997 996
 
998
-	if ( $is_ajax ) {
997
+	if ($is_ajax) {
999 998
 
1000 999
 		// Do not create or login the user during the ajax submission (check for errors only).
1001 1000
 		return true;
1002
-	} elseif ( is_user_logged_in() ) {
1001
+	} elseif (is_user_logged_in()) {
1003 1002
 
1004 1003
 		// Set the valid user as the logged in collected data.
1005 1004
 		$user = $valid_data['logged_in_user'];
1006
-	} elseif ( true === $valid_data['need_new_user'] || true === $valid_data['need_user_login'] ) {
1005
+	} elseif (true === $valid_data['need_new_user'] || true === $valid_data['need_user_login']) {
1007 1006
 
1008 1007
 		// New user registration.
1009
-		if ( true === $valid_data['need_new_user'] ) {
1008
+		if (true === $valid_data['need_new_user']) {
1010 1009
 
1011 1010
 			// Set user.
1012 1011
 			$user = $valid_data['new_user_data'];
1013 1012
 
1014 1013
 			// Register and login new user.
1015
-			$user['user_id'] = give_register_and_login_new_user( $user );
1014
+			$user['user_id'] = give_register_and_login_new_user($user);
1016 1015
 
1017
-		} elseif ( true === $valid_data['need_user_login'] && ! $is_ajax ) {
1016
+		} elseif (true === $valid_data['need_user_login'] && ! $is_ajax) {
1018 1017
 
1019 1018
 			/**
1020 1019
 			 * The login form is now processed in the give_process_donation_login() function.
@@ -1026,42 +1025,42 @@  discard block
 block discarded – undo
1026 1025
 			$user = $valid_data['login_user_data'];
1027 1026
 
1028 1027
 			// Login user.
1029
-			give_log_user_in( $user['user_id'], $user['user_login'], $user['user_pass'] );
1028
+			give_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']);
1030 1029
 		}
1031 1030
 	} // End if().
1032 1031
 
1033 1032
 	// Check guest checkout.
1034
-	if ( false === $user && false === give_logged_in_only( $post_data['give-form-id'] ) ) {
1033
+	if (false === $user && false === give_logged_in_only($post_data['give-form-id'])) {
1035 1034
 
1036 1035
 		// Set user.
1037 1036
 		$user = $valid_data['guest_user_data'];
1038 1037
 	}
1039 1038
 
1040 1039
 	// Verify we have an user.
1041
-	if ( false === $user || empty( $user ) ) {
1040
+	if (false === $user || empty($user)) {
1042 1041
 		return false;
1043 1042
 	}
1044 1043
 
1045 1044
 	// Get user first name.
1046
-	if ( ! isset( $user['user_first'] ) || strlen( trim( $user['user_first'] ) ) < 1 ) {
1047
-		$user['user_first'] = isset( $post_data['give_first'] ) ? strip_tags( trim( $post_data['give_first'] ) ) : '';
1045
+	if ( ! isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) {
1046
+		$user['user_first'] = isset($post_data['give_first']) ? strip_tags(trim($post_data['give_first'])) : '';
1048 1047
 	}
1049 1048
 
1050 1049
 	// Get user last name.
1051
-	if ( ! isset( $user['user_last'] ) || strlen( trim( $user['user_last'] ) ) < 1 ) {
1052
-		$user['user_last'] = isset( $post_data['give_last'] ) ? strip_tags( trim( $post_data['give_last'] ) ) : '';
1050
+	if ( ! isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) {
1051
+		$user['user_last'] = isset($post_data['give_last']) ? strip_tags(trim($post_data['give_last'])) : '';
1053 1052
 	}
1054 1053
 
1055 1054
 	// Get the user's billing address details.
1056 1055
 	$user['address']            = array();
1057
-	$user['address']['line1']   = ! empty( $post_data['card_address'] ) ? $post_data['card_address'] : false;
1058
-	$user['address']['line2']   = ! empty( $post_data['card_address_2'] ) ? $post_data['card_address_2'] : false;
1059
-	$user['address']['city']    = ! empty( $post_data['card_city'] ) ? $post_data['card_city'] : false;
1060
-	$user['address']['state']   = ! empty( $post_data['card_state'] ) ? $post_data['card_state'] : false;
1061
-	$user['address']['zip']     = ! empty( $post_data['card_zip'] ) ? $post_data['card_zip'] : false;
1062
-	$user['address']['country'] = ! empty( $post_data['billing_country'] ) ? $post_data['billing_country'] : false;
1063
-
1064
-	if ( empty( $user['address']['country'] ) ) {
1056
+	$user['address']['line1']   = ! empty($post_data['card_address']) ? $post_data['card_address'] : false;
1057
+	$user['address']['line2']   = ! empty($post_data['card_address_2']) ? $post_data['card_address_2'] : false;
1058
+	$user['address']['city']    = ! empty($post_data['card_city']) ? $post_data['card_city'] : false;
1059
+	$user['address']['state']   = ! empty($post_data['card_state']) ? $post_data['card_state'] : false;
1060
+	$user['address']['zip']     = ! empty($post_data['card_zip']) ? $post_data['card_zip'] : false;
1061
+	$user['address']['country'] = ! empty($post_data['billing_country']) ? $post_data['billing_country'] : false;
1062
+
1063
+	if (empty($user['address']['country'])) {
1065 1064
 		$user['address'] = false;
1066 1065
 	} // End if().
1067 1066
 
@@ -1082,16 +1081,16 @@  discard block
 block discarded – undo
1082 1081
 	$card_data = give_get_donation_cc_info();
1083 1082
 
1084 1083
 	// Validate the card zip.
1085
-	if ( ! empty( $card_data['card_zip'] ) ) {
1086
-		if ( ! give_donation_form_validate_cc_zip( $card_data['card_zip'], $card_data['card_country'] ) ) {
1087
-			give_set_error( 'invalid_cc_zip', __( 'The zip / postal code you entered for your billing address is invalid.', 'give' ) );
1084
+	if ( ! empty($card_data['card_zip'])) {
1085
+		if ( ! give_donation_form_validate_cc_zip($card_data['card_zip'], $card_data['card_country'])) {
1086
+			give_set_error('invalid_cc_zip', __('The zip / postal code you entered for your billing address is invalid.', 'give'));
1088 1087
 		}
1089 1088
 	}
1090 1089
 
1091 1090
 	// Ensure no spaces.
1092
-	if ( ! empty( $card_data['card_number'] ) ) {
1093
-		$card_data['card_number'] = str_replace( '+', '', $card_data['card_number'] ); // no "+" signs.
1094
-		$card_data['card_number'] = str_replace( ' ', '', $card_data['card_number'] ); // No spaces.
1091
+	if ( ! empty($card_data['card_number'])) {
1092
+		$card_data['card_number'] = str_replace('+', '', $card_data['card_number']); // no "+" signs.
1093
+		$card_data['card_number'] = str_replace(' ', '', $card_data['card_number']); // No spaces.
1095 1094
 	}
1096 1095
 
1097 1096
 	// This should validate card numbers at some point too.
@@ -1109,20 +1108,20 @@  discard block
 block discarded – undo
1109 1108
 function give_get_donation_cc_info() {
1110 1109
 
1111 1110
 	// Sanitize the values submitted with donation form.
1112
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
1111
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
1113 1112
 
1114 1113
 	$cc_info                   = array();
1115
-	$cc_info['card_name']      = ! empty( $post_data['card_name'] ) ? $post_data['card_name'] : '';
1116
-	$cc_info['card_number']    = ! empty( $post_data['card_number'] ) ? $post_data['card_number'] : '';
1117
-	$cc_info['card_cvc']       = ! empty( $post_data['card_cvc'] ) ? $post_data['card_cvc'] : '';
1118
-	$cc_info['card_exp_month'] = ! empty( $post_data['card_exp_month'] ) ? $post_data['card_exp_month'] : '';
1119
-	$cc_info['card_exp_year']  = ! empty( $post_data['card_exp_year'] ) ? $post_data['card_exp_year'] : '';
1120
-	$cc_info['card_address']   = ! empty( $post_data['card_address'] ) ? $post_data['card_address'] : '';
1121
-	$cc_info['card_address_2'] = ! empty( $post_data['card_address_2'] ) ? $post_data['card_address_2'] : '';
1122
-	$cc_info['card_city']      = ! empty( $post_data['card_city'] ) ? $post_data['card_city'] : '';
1123
-	$cc_info['card_state']     = ! empty( $post_data['card_state'] ) ? $post_data['card_state'] : '';
1124
-	$cc_info['card_country']   = ! empty( $post_data['billing_country'] ) ? $post_data['billing_country'] : '';
1125
-	$cc_info['card_zip']       = ! empty( $post_data['card_zip'] ) ? $post_data['card_zip'] : '';
1114
+	$cc_info['card_name']      = ! empty($post_data['card_name']) ? $post_data['card_name'] : '';
1115
+	$cc_info['card_number']    = ! empty($post_data['card_number']) ? $post_data['card_number'] : '';
1116
+	$cc_info['card_cvc']       = ! empty($post_data['card_cvc']) ? $post_data['card_cvc'] : '';
1117
+	$cc_info['card_exp_month'] = ! empty($post_data['card_exp_month']) ? $post_data['card_exp_month'] : '';
1118
+	$cc_info['card_exp_year']  = ! empty($post_data['card_exp_year']) ? $post_data['card_exp_year'] : '';
1119
+	$cc_info['card_address']   = ! empty($post_data['card_address']) ? $post_data['card_address'] : '';
1120
+	$cc_info['card_address_2'] = ! empty($post_data['card_address_2']) ? $post_data['card_address_2'] : '';
1121
+	$cc_info['card_city']      = ! empty($post_data['card_city']) ? $post_data['card_city'] : '';
1122
+	$cc_info['card_state']     = ! empty($post_data['card_state']) ? $post_data['card_state'] : '';
1123
+	$cc_info['card_country']   = ! empty($post_data['billing_country']) ? $post_data['billing_country'] : '';
1124
+	$cc_info['card_zip']       = ! empty($post_data['card_zip']) ? $post_data['card_zip'] : '';
1126 1125
 
1127 1126
 	// Return cc info.
1128 1127
 	return $cc_info;
@@ -1138,14 +1137,14 @@  discard block
 block discarded – undo
1138 1137
  *
1139 1138
  * @return bool|mixed
1140 1139
  */
1141
-function give_donation_form_validate_cc_zip( $zip = 0, $country_code = '' ) {
1140
+function give_donation_form_validate_cc_zip($zip = 0, $country_code = '') {
1142 1141
 	$ret = false;
1143 1142
 
1144
-	if ( empty( $zip ) || empty( $country_code ) ) {
1143
+	if (empty($zip) || empty($country_code)) {
1145 1144
 		return $ret;
1146 1145
 	}
1147 1146
 
1148
-	$country_code = strtoupper( $country_code );
1147
+	$country_code = strtoupper($country_code);
1149 1148
 
1150 1149
 	$zip_regex = array(
1151 1150
 		'AD' => 'AD\d{3}',
@@ -1305,11 +1304,11 @@  discard block
 block discarded – undo
1305 1304
 		'ZM' => '\d{5}',
1306 1305
 	);
1307 1306
 
1308
-	if ( ! isset( $zip_regex[ $country_code ] ) || preg_match( '/' . $zip_regex[ $country_code ] . '/i', $zip ) ) {
1307
+	if ( ! isset($zip_regex[$country_code]) || preg_match('/'.$zip_regex[$country_code].'/i', $zip)) {
1309 1308
 		$ret = true;
1310 1309
 	}
1311 1310
 
1312
-	return apply_filters( 'give_is_zip_valid', $ret, $zip, $country_code );
1311
+	return apply_filters('give_is_zip_valid', $ret, $zip, $country_code);
1313 1312
 }
1314 1313
 
1315 1314
 /**
@@ -1321,57 +1320,57 @@  discard block
 block discarded – undo
1321 1320
  *
1322 1321
  * @return bool
1323 1322
  */
1324
-function give_validate_donation_amount( $valid_data ) {
1323
+function give_validate_donation_amount($valid_data) {
1325 1324
 
1326
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
1325
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
1327 1326
 
1328 1327
 	/* @var Give_Donate_Form $form */
1329
-	$form = new Give_Donate_Form( $post_data['give-form-id'] );
1328
+	$form = new Give_Donate_Form($post_data['give-form-id']);
1330 1329
 
1331 1330
 	$donation_level_matched = false;
1332 1331
 
1333
-	if ( $form->is_set_type_donation_form() ) {
1332
+	if ($form->is_set_type_donation_form()) {
1334 1333
 
1335 1334
 		// Sanitize donation amount.
1336
-		$post_data['give-amount'] = give_maybe_sanitize_amount( $post_data['give-amount'] );
1335
+		$post_data['give-amount'] = give_maybe_sanitize_amount($post_data['give-amount']);
1337 1336
 
1338 1337
 		// Backward compatibility.
1339
-		if ( $form->is_custom_price( $post_data['give-amount'] ) ) {
1338
+		if ($form->is_custom_price($post_data['give-amount'])) {
1340 1339
 			$post_data['give-price-id'] = 'custom';
1341 1340
 		}
1342 1341
 
1343 1342
 		$donation_level_matched = true;
1344 1343
 
1345
-	} elseif ( $form->is_multi_type_donation_form() ) {
1344
+	} elseif ($form->is_multi_type_donation_form()) {
1346 1345
 
1347 1346
 		$variable_prices = $form->get_prices();
1348 1347
 
1349 1348
 		// Bailout.
1350
-		if ( ! $variable_prices ) {
1349
+		if ( ! $variable_prices) {
1351 1350
 			return false;
1352 1351
 		}
1353 1352
 
1354 1353
 		// Sanitize donation amount.
1355
-		$post_data['give-amount']     = give_maybe_sanitize_amount( $post_data['give-amount'] );
1356
-		$variable_price_option_amount = give_maybe_sanitize_amount( give_get_price_option_amount( $post_data['give-form-id'], $post_data['give-price-id'] ) );
1354
+		$post_data['give-amount']     = give_maybe_sanitize_amount($post_data['give-amount']);
1355
+		$variable_price_option_amount = give_maybe_sanitize_amount(give_get_price_option_amount($post_data['give-form-id'], $post_data['give-price-id']));
1357 1356
 		$new_price_id                 = '';
1358 1357
 
1359
-		if ( $post_data['give-amount'] === $variable_price_option_amount ) {
1358
+		if ($post_data['give-amount'] === $variable_price_option_amount) {
1360 1359
 			return true;
1361 1360
 		}
1362 1361
 
1363
-		if ( $form->is_custom_price( $post_data['give-amount'] ) ) {
1362
+		if ($form->is_custom_price($post_data['give-amount'])) {
1364 1363
 			$new_price_id = 'custom';
1365 1364
 		} else {
1366 1365
 
1367 1366
 			// Find correct donation level from all donation levels.
1368
-			foreach ( $variable_prices as $variable_price ) {
1367
+			foreach ($variable_prices as $variable_price) {
1369 1368
 
1370 1369
 				// Sanitize level amount.
1371
-				$variable_price['_give_amount'] = give_maybe_sanitize_amount( $variable_price['_give_amount'] );
1370
+				$variable_price['_give_amount'] = give_maybe_sanitize_amount($variable_price['_give_amount']);
1372 1371
 
1373 1372
 				// Set first match donation level ID.
1374
-				if ( $post_data['give-amount'] === $variable_price['_give_amount'] ) {
1373
+				if ($post_data['give-amount'] === $variable_price['_give_amount']) {
1375 1374
 					$new_price_id = $variable_price['_give_id']['level_id'];
1376 1375
 					break;
1377 1376
 				}
@@ -1380,26 +1379,26 @@  discard block
 block discarded – undo
1380 1379
 
1381 1380
 		// If donation amount is not find in donation levels then check if form has custom donation feature enable or not.
1382 1381
 		// If yes then set price id to custom if amount is greater then custom minimum amount (if any).
1383
-		if ( $post_data['give-price-id'] === $new_price_id ) {
1382
+		if ($post_data['give-price-id'] === $new_price_id) {
1384 1383
 			$donation_level_matched = true;
1385 1384
 		}
1386 1385
 	} // End if().
1387 1386
 
1388
-	if ( ! $donation_level_matched ) {
1387
+	if ( ! $donation_level_matched) {
1389 1388
 		give_set_error(
1390 1389
 			'invalid_donation_amount',
1391 1390
 			sprintf(
1392 1391
 			/* translators: %s: invalid donation amount */
1393
-				__( 'Donation amount %s is invalid.', 'give' ),
1392
+				__('Donation amount %s is invalid.', 'give'),
1394 1393
 				give_currency_filter(
1395
-					give_format_amount( $post_data['give-amount'], array( 'sanitize' => false, ) )
1394
+					give_format_amount($post_data['give-amount'], array('sanitize' => false,))
1396 1395
 				)
1397 1396
 			)
1398 1397
 		);
1399 1398
 	}
1400 1399
 }
1401 1400
 
1402
-add_action( 'give_checkout_error_checks', 'give_validate_donation_amount', 10, 1 );
1401
+add_action('give_checkout_error_checks', 'give_validate_donation_amount', 10, 1);
1403 1402
 
1404 1403
 /**
1405 1404
  * Validate Required Form Fields.
@@ -1408,20 +1407,20 @@  discard block
 block discarded – undo
1408 1407
  *
1409 1408
  * @since 2.0
1410 1409
  */
1411
-function give_validate_required_form_fields( $form_id ) {
1410
+function give_validate_required_form_fields($form_id) {
1412 1411
 
1413 1412
 	// Sanitize values submitted with donation form.
1414
-	$post_data = give_clean( $_POST ); // WPCS: input var ok, sanitization ok, CSRF ok.
1413
+	$post_data = give_clean($_POST); // WPCS: input var ok, sanitization ok, CSRF ok.
1415 1414
 
1416 1415
 	// Loop through required fields and show error messages.
1417
-	foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
1416
+	foreach (give_get_required_fields($form_id) as $field_name => $value) {
1418 1417
 
1419 1418
 		// Clean Up Data of the input fields.
1420
-		$field_value = $post_data[ $field_name ];
1419
+		$field_value = $post_data[$field_name];
1421 1420
 
1422 1421
 		// Check whether the required field is empty, then show the error message.
1423
-		if ( in_array( $value, give_get_required_fields( $form_id ), true ) && empty( $field_value ) ) {
1424
-			give_set_error( $value['error_id'], $value['error_message'] );
1422
+		if (in_array($value, give_get_required_fields($form_id), true) && empty($field_value)) {
1423
+			give_set_error($value['error_id'], $value['error_message']);
1425 1424
 		}
1426 1425
 	}
1427 1426
 }
@@ -1435,12 +1434,12 @@  discard block
 block discarded – undo
1435 1434
  *
1436 1435
  * @return void
1437 1436
  */
1438
-function give_donation_form_validate_name_fields( $post_data ) {
1437
+function give_donation_form_validate_name_fields($post_data) {
1439 1438
 
1440
-	$is_alpha_first_name = ( ! is_email( $post_data['give_first'] ) && ! preg_match( '~[0-9]~', $post_data['give_first'] ) );
1441
-	$is_alpha_last_name  = ( ! is_email( $post_data['give_last'] ) && ! preg_match( '~[0-9]~', $post_data['give_last'] ) );
1439
+	$is_alpha_first_name = ( ! is_email($post_data['give_first']) && ! preg_match('~[0-9]~', $post_data['give_first']));
1440
+	$is_alpha_last_name  = ( ! is_email($post_data['give_last']) && ! preg_match('~[0-9]~', $post_data['give_last']));
1442 1441
 
1443
-	if ( ! $is_alpha_first_name || ( ! empty( $post_data['give_last'] ) && ! $is_alpha_last_name ) ) {
1444
-		give_set_error( 'invalid_name', esc_html__( 'The First Name and Last Name fields cannot contain an email address or numbers.', 'give' ) );
1442
+	if ( ! $is_alpha_first_name || ( ! empty($post_data['give_last']) && ! $is_alpha_last_name)) {
1443
+		give_set_error('invalid_name', esc_html__('The First Name and Last Name fields cannot contain an email address or numbers.', 'give'));
1445 1444
 	}
1446 1445
 }
Please login to merge, or discard this patch.
give.php 1 patch
Spacing   +185 added lines, -185 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
  */
40 40
 
41 41
 // Exit if accessed directly.
42
-if ( ! defined( 'ABSPATH' ) ) {
42
+if ( ! defined('ABSPATH')) {
43 43
 	exit;
44 44
 }
45 45
 
46
-if ( ! class_exists( 'Give' ) ) :
46
+if ( ! class_exists('Give')) :
47 47
 
48 48
 	/**
49 49
 	 * Main Give Class
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 		 * @return    Give
262 262
 		 */
263 263
 		public static function instance() {
264
-			if ( is_null( self::$_instance ) ) {
264
+			if (is_null(self::$_instance)) {
265 265
 				self::$_instance = new self();
266 266
 			}
267 267
 
@@ -273,13 +273,13 @@  discard block
 block discarded – undo
273 273
 		 */
274 274
 		public function __construct() {
275 275
 			// PHP version
276
-			if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) {
277
-				define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' );
276
+			if ( ! defined('GIVE_REQUIRED_PHP_VERSION')) {
277
+				define('GIVE_REQUIRED_PHP_VERSION', '5.3');
278 278
 			}
279 279
 
280 280
 			// Bailout: Need minimum php version to load plugin.
281
-			if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) {
282
-				add_action( 'admin_notices', array( $this, 'minimum_phpversion_notice' ) );
281
+			if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) {
282
+				add_action('admin_notices', array($this, 'minimum_phpversion_notice'));
283 283
 
284 284
 				return;
285 285
 			}
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 			$this->includes();
289 289
 			$this->init_hooks();
290 290
 
291
-			do_action( 'give_loaded' );
291
+			do_action('give_loaded');
292 292
 		}
293 293
 
294 294
 		/**
@@ -297,11 +297,11 @@  discard block
 block discarded – undo
297 297
 		 * @since  1.8.9
298 298
 		 */
299 299
 		private function init_hooks() {
300
-			register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
301
-			add_action( 'plugins_loaded', array( $this, 'init' ), 0 );
300
+			register_activation_hook(GIVE_PLUGIN_FILE, 'give_install');
301
+			add_action('plugins_loaded', array($this, 'init'), 0);
302 302
 
303 303
 			// Set up localization on init Hook.
304
-			add_action( 'init', array( $this, 'load_textdomain' ), 0 );
304
+			add_action('init', array($this, 'load_textdomain'), 0);
305 305
 		}
306 306
 
307 307
 
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 			 *
318 318
 			 * @since 1.8.9
319 319
 			 */
320
-			do_action( 'before_give_init' );
320
+			do_action('before_give_init');
321 321
 
322 322
 			// Set up localization.
323 323
 			$this->load_textdomain();
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 			 *
351 351
 			 * @since 1.8.7
352 352
 			 */
353
-			do_action( 'give_init', $this );
353
+			do_action('give_init', $this);
354 354
 
355 355
 		}
356 356
 
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 		 */
368 368
 		public function __clone() {
369 369
 			// Cloning instances of the class is forbidden.
370
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
370
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
371 371
 		}
372 372
 
373 373
 		/**
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 		 */
381 381
 		public function __wakeup() {
382 382
 			// Unserializing instances of the class is forbidden.
383
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
383
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
384 384
 		}
385 385
 
386 386
 		/**
@@ -394,33 +394,33 @@  discard block
 block discarded – undo
394 394
 		private function setup_constants() {
395 395
 
396 396
 			// Plugin version
397
-			if ( ! defined( 'GIVE_VERSION' ) ) {
398
-				define( 'GIVE_VERSION', '2.1.4' );
397
+			if ( ! defined('GIVE_VERSION')) {
398
+				define('GIVE_VERSION', '2.1.4');
399 399
 			}
400 400
 
401 401
 			// Plugin Root File
402
-			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
403
-				define( 'GIVE_PLUGIN_FILE', __FILE__ );
402
+			if ( ! defined('GIVE_PLUGIN_FILE')) {
403
+				define('GIVE_PLUGIN_FILE', __FILE__);
404 404
 			}
405 405
 
406 406
 			// Plugin Folder Path
407
-			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
408
-				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( GIVE_PLUGIN_FILE ) );
407
+			if ( ! defined('GIVE_PLUGIN_DIR')) {
408
+				define('GIVE_PLUGIN_DIR', plugin_dir_path(GIVE_PLUGIN_FILE));
409 409
 			}
410 410
 
411 411
 			// Plugin Folder URL
412
-			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
413
-				define( 'GIVE_PLUGIN_URL', plugin_dir_url( GIVE_PLUGIN_FILE ) );
412
+			if ( ! defined('GIVE_PLUGIN_URL')) {
413
+				define('GIVE_PLUGIN_URL', plugin_dir_url(GIVE_PLUGIN_FILE));
414 414
 			}
415 415
 
416 416
 			// Plugin Basename aka: "give/give.php"
417
-			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
418
-				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( GIVE_PLUGIN_FILE ) );
417
+			if ( ! defined('GIVE_PLUGIN_BASENAME')) {
418
+				define('GIVE_PLUGIN_BASENAME', plugin_basename(GIVE_PLUGIN_FILE));
419 419
 			}
420 420
 
421 421
 			// Make sure CAL_GREGORIAN is defined
422
-			if ( ! defined( 'CAL_GREGORIAN' ) ) {
423
-				define( 'CAL_GREGORIAN', 1 );
422
+			if ( ! defined('CAL_GREGORIAN')) {
423
+				define('CAL_GREGORIAN', 1);
424 424
 			}
425 425
 		}
426 426
 
@@ -438,161 +438,161 @@  discard block
 block discarded – undo
438 438
 			/**
439 439
 			 * Load libraries.
440 440
 			 */
441
-			if ( ! class_exists( 'WP_Async_Request' ) ) {
442
-				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-async-request.php' );
441
+			if ( ! class_exists('WP_Async_Request')) {
442
+				include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-async-request.php');
443 443
 			}
444 444
 
445
-			if ( ! class_exists( 'WP_Background_Process' ) ) {
446
-				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-background-process.php' );
445
+			if ( ! class_exists('WP_Background_Process')) {
446
+				include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-background-process.php');
447 447
 			}
448 448
 
449 449
 			/**
450 450
 			 * Load plugin files
451 451
 			 */
452
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php';
453
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
452
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php';
453
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php';
454 454
 			$give_options = give_get_settings();
455 455
 
456
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
457
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-async-process.php';
458
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php';
459
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php';
460
-			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
461
-			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
462
-			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
463
-			require_once GIVE_PLUGIN_DIR . 'includes/filters.php';
464
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
465
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api-v2.php';
466
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-tooltips.php';
467
-			require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php';
468
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-translation.php';
469
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-readme-parser.php';
470
-
471
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-scripts.php';
472
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
473
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
474
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
475
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
476
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-meta.php';
477
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php';
478
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php';
479
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php';
480
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
481
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
482
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
483
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
484
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
485
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
486
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-payment-meta.php';
487
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-form-meta.php';
488
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-sequential-ordering.php';
489
-
490
-			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
491
-			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
492
-			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
493
-			require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php';
494
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
495
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
496
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
497
-			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
498
-			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
499
-			require_once GIVE_PLUGIN_DIR . 'includes/currency-functions.php';
500
-			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
501
-			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
502
-			require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php';
503
-			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
504
-			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
505
-			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
506
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php';
507
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php';
508
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php';
509
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php';
510
-
511
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/backward-compatibility.php';
512
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
513
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
514
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
515
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
516
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
517
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-sequential-donation-number.php';
518
-
519
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
520
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
521
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
522
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
523
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
524
-
525
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
526
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
527
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notifications.php';
528
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
529
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
530
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
531
-
532
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php';
533
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/backward-compatibility.php';
534
-
535
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php';
536
-
537
-			require_once GIVE_PLUGIN_DIR . 'blocks/load.php';
538
-
539
-			if ( defined( 'WP_CLI' ) && WP_CLI ) {
540
-				require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
456
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php';
457
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-async-process.php';
458
+			require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php';
459
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php';
460
+			require_once GIVE_PLUGIN_DIR.'includes/post-types.php';
461
+			require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php';
462
+			require_once GIVE_PLUGIN_DIR.'includes/actions.php';
463
+			require_once GIVE_PLUGIN_DIR.'includes/filters.php';
464
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php';
465
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api-v2.php';
466
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-tooltips.php';
467
+			require_once GIVE_PLUGIN_DIR.'includes/class-notices.php';
468
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-translation.php';
469
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-readme-parser.php';
470
+
471
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-scripts.php';
472
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php';
473
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php';
474
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php';
475
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php';
476
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-meta.php';
477
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donors.php';
478
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donor-meta.php';
479
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donor.php';
480
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php';
481
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php';
482
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php';
483
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php';
484
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php';
485
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php';
486
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-payment-meta.php';
487
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-form-meta.php';
488
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-sequential-ordering.php';
489
+
490
+			require_once GIVE_PLUGIN_DIR.'includes/country-functions.php';
491
+			require_once GIVE_PLUGIN_DIR.'includes/template-functions.php';
492
+			require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php';
493
+			require_once GIVE_PLUGIN_DIR.'includes/import-functions.php';
494
+			require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php';
495
+			require_once GIVE_PLUGIN_DIR.'includes/forms/template.php';
496
+			require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php';
497
+			require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php';
498
+			require_once GIVE_PLUGIN_DIR.'includes/formatting.php';
499
+			require_once GIVE_PLUGIN_DIR.'includes/currency-functions.php';
500
+			require_once GIVE_PLUGIN_DIR.'includes/price-functions.php';
501
+			require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php';
502
+			require_once GIVE_PLUGIN_DIR.'includes/process-donation.php';
503
+			require_once GIVE_PLUGIN_DIR.'includes/login-register.php';
504
+			require_once GIVE_PLUGIN_DIR.'includes/user-functions.php';
505
+			require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php';
506
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-classes.php';
507
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php';
508
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php';
509
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php';
510
+
511
+			require_once GIVE_PLUGIN_DIR.'includes/payments/backward-compatibility.php';
512
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
513
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
514
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
515
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
516
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php';
517
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-sequential-donation-number.php';
518
+
519
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
520
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
521
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
522
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
523
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
524
+
525
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
526
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
527
+			require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notifications.php';
528
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
529
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
530
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
531
+
532
+			require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donors-query.php';
533
+			require_once GIVE_PLUGIN_DIR.'includes/donors/backward-compatibility.php';
534
+
535
+			require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/class-give-updates.php';
536
+
537
+			require_once GIVE_PLUGIN_DIR.'blocks/load.php';
538
+
539
+			if (defined('WP_CLI') && WP_CLI) {
540
+				require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php';
541 541
 			}
542 542
 
543
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
544
-
545
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
546
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
547
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
548
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
549
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php';
550
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
551
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php';
552
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
553
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
554
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
555
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php';
556
-
557
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
558
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
559
-
560
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php';
561
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php';
562
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php';
563
-
564
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
565
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php';
566
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
567
-
568
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php';
569
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php';
570
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php';
571
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php';
572
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/give-export-donations-functions.php';
573
-
574
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php';
575
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php';
576
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php';
577
-
578
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php';
579
-
580
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php';
581
-
582
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
583
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
584
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
585
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
586
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
587
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
588
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
589
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-grid.php';
590
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
591
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
592
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-totals.php';
543
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
544
+
545
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
546
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
547
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
548
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
549
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php';
550
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
551
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php';
552
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
553
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
554
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
555
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-blank-slate.php';
556
+
557
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
558
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
559
+
560
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donors.php';
561
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-functions.php';
562
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-actions.php';
563
+
564
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
565
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php';
566
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
567
+
568
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php';
569
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php';
570
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php';
571
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php';
572
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/give-export-donations-functions.php';
573
+
574
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/reports.php';
575
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/class-give-graph.php';
576
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/graphing.php';
577
+
578
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php';
579
+
580
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php';
581
+
582
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
583
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
584
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
585
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
586
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
587
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
588
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
589
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-grid.php';
590
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
591
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
592
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-totals.php';
593 593
 			}// End if().
594 594
 
595
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
595
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
596 596
 
597 597
 		}
598 598
 
@@ -607,16 +607,16 @@  discard block
 block discarded – undo
607 607
 		public function load_textdomain() {
608 608
 
609 609
 			// Set filter for Give's languages directory
610
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
611
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
610
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
611
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
612 612
 
613 613
 			// Traditional WordPress plugin locale filter.
614
-			$locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
615
-			$locale = apply_filters( 'plugin_locale', $locale, 'give' );
614
+			$locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
615
+			$locale = apply_filters('plugin_locale', $locale, 'give');
616 616
 
617
-			unload_textdomain( 'give' );
618
-			load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' );
619
-			load_plugin_textdomain( 'give', false, $give_lang_dir );
617
+			unload_textdomain('give');
618
+			load_textdomain('give', WP_LANG_DIR.'/give/give-'.$locale.'.mo');
619
+			load_plugin_textdomain('give', false, $give_lang_dir);
620 620
 
621 621
 		}
622 622
 
@@ -629,21 +629,21 @@  discard block
 block discarded – undo
629 629
 		 */
630 630
 		public function minimum_phpversion_notice() {
631 631
 			// Bailout.
632
-			if ( ! is_admin() ) {
632
+			if ( ! is_admin()) {
633 633
 				return;
634 634
 			}
635 635
 
636
-			$notice_desc  = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>';
637
-			$notice_desc .= '<p>' . __( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give' ) . '</p>';
638
-			$notice_desc .= '<p>' . __( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give' ) . '</p>';
639
-			$notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>';
640
-			$notice_desc .= '<p>' . __( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give' ) . '</p>';
641
-			$notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>';
642
-			$notice_desc .= '<p>' . sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give' ), sprintf( '<a href="%1$s" target="_blank">', esc_url( 'https://wordpress.org/hosting/' ) ), '</a>' ) . '</p>';
636
+			$notice_desc  = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>';
637
+			$notice_desc .= '<p>'.__('Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give').'</p>';
638
+			$notice_desc .= '<p>'.__('Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give').'</p>';
639
+			$notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>';
640
+			$notice_desc .= '<p>'.__('You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give').'</p>';
641
+			$notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>';
642
+			$notice_desc .= '<p>'.sprintf(__('If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give'), sprintf('<a href="%1$s" target="_blank">', esc_url('https://wordpress.org/hosting/')), '</a>').'</p>';
643 643
 
644 644
 			echo sprintf(
645 645
 				'<div class="notice notice-error">%1$s</div>',
646
-				wp_kses_post( $notice_desc )
646
+				wp_kses_post($notice_desc)
647 647
 			);
648 648
 		}
649 649
 
Please login to merge, or discard this patch.
includes/class-give-scripts.php 1 patch
Spacing   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 	 * @since 2.1.0
38 38
 	 */
39 39
 	public function __construct() {
40
-		$this->direction      = ( is_rtl() || isset( $_GET['d'] ) && 'rtl' === $_GET['d'] ) ? '.rtl' : '';
41
-		$this->scripts_footer = give_is_setting_enabled( give_get_option( 'scripts_footer' ) ) ? true : false;
40
+		$this->direction      = (is_rtl() || isset($_GET['d']) && 'rtl' === $_GET['d']) ? '.rtl' : '';
41
+		$this->scripts_footer = give_is_setting_enabled(give_get_option('scripts_footer')) ? true : false;
42 42
 		$this->init();
43 43
 	}
44 44
 
@@ -49,20 +49,20 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function init() {
51 51
 
52
-		add_action( 'admin_enqueue_scripts', array( $this, 'register_styles' ) );
53
-		add_action( 'admin_enqueue_scripts', array( $this, 'register_scripts' ) );
54
-		add_action( 'wp_enqueue_scripts', array( $this, 'register_styles' ) );
55
-		add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
52
+		add_action('admin_enqueue_scripts', array($this, 'register_styles'));
53
+		add_action('admin_enqueue_scripts', array($this, 'register_scripts'));
54
+		add_action('wp_enqueue_scripts', array($this, 'register_styles'));
55
+		add_action('wp_enqueue_scripts', array($this, 'register_scripts'));
56 56
 
57
-		if ( is_admin() ) {
58
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
59
-			add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_styles' ) );
60
-			add_action( 'enqueue_block_editor_assets', array( $this, 'gutenberg_admin_scripts' ) );
61
-			add_action( 'admin_head', array( $this, 'global_admin_head' ) );
57
+		if (is_admin()) {
58
+			add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
59
+			add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_styles'));
60
+			add_action('enqueue_block_editor_assets', array($this, 'gutenberg_admin_scripts'));
61
+			add_action('admin_head', array($this, 'global_admin_head'));
62 62
 
63 63
 		} else {
64
-			add_action( 'wp_enqueue_scripts', array( $this, 'public_enqueue_styles' ) );
65
-			add_action( 'wp_enqueue_scripts', array( $this, 'public_enqueue_scripts' ) );
64
+			add_action('wp_enqueue_scripts', array($this, 'public_enqueue_styles'));
65
+			add_action('wp_enqueue_scripts', array($this, 'public_enqueue_scripts'));
66 66
 		}
67 67
 	}
68 68
 
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
 	public function register_styles() {
75 75
 
76 76
 		// WP-admin.
77
-		wp_register_style( 'give-admin-styles', GIVE_PLUGIN_URL . 'assets/dist/css/admin' . $this->direction . '.css', array(), GIVE_VERSION );
77
+		wp_register_style('give-admin-styles', GIVE_PLUGIN_URL.'assets/dist/css/admin'.$this->direction.'.css', array(), GIVE_VERSION);
78 78
 
79 79
 		// Frontend.
80
-		if ( give_is_setting_enabled( give_get_option( 'css' ) ) ) {
81
-			wp_register_style( 'give-styles', $this->get_frontend_stylesheet_uri(), array(), GIVE_VERSION, 'all' );
80
+		if (give_is_setting_enabled(give_get_option('css'))) {
81
+			wp_register_style('give-styles', $this->get_frontend_stylesheet_uri(), array(), GIVE_VERSION, 'all');
82 82
 		}
83 83
 	}
84 84
 
@@ -90,15 +90,15 @@  discard block
 block discarded – undo
90 90
 	public function register_scripts() {
91 91
 
92 92
 		// WP-Admin.
93
-		wp_register_script( 'give-admin-scripts', GIVE_PLUGIN_URL . 'assets/dist/js/admin.js', array(
93
+		wp_register_script('give-admin-scripts', GIVE_PLUGIN_URL.'assets/dist/js/admin.js', array(
94 94
 			'jquery',
95 95
 			'jquery-ui-datepicker',
96 96
 			'wp-color-picker',
97 97
 			'jquery-query',
98
-		), GIVE_VERSION );
98
+		), GIVE_VERSION);
99 99
 
100 100
 		// Frontend.
101
-		wp_register_script( 'give', GIVE_PLUGIN_URL . 'assets/dist/js/give.js', array( 'jquery' ), GIVE_VERSION, $this->scripts_footer );
101
+		wp_register_script('give', GIVE_PLUGIN_URL.'assets/dist/js/give.js', array('jquery'), GIVE_VERSION, $this->scripts_footer);
102 102
 	}
103 103
 
104 104
 	/**
@@ -108,20 +108,20 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @param string $hook Page hook.
110 110
 	 */
111
-	public function admin_enqueue_styles( $hook ) {
111
+	public function admin_enqueue_styles($hook) {
112 112
 
113 113
 		// Give Admin Only.
114
-		if ( ! apply_filters( 'give_load_admin_styles', give_is_admin_page(), $hook ) ) {
114
+		if ( ! apply_filters('give_load_admin_styles', give_is_admin_page(), $hook)) {
115 115
 			return;
116 116
 		}
117 117
 
118 118
 		// Give enqueues.
119
-		wp_enqueue_style( 'give-admin-styles' );
120
-		wp_enqueue_style( 'give-admin-bar-notification' );
119
+		wp_enqueue_style('give-admin-styles');
120
+		wp_enqueue_style('give-admin-bar-notification');
121 121
 
122 122
 		// WP Core enqueues.
123
-		wp_enqueue_style( 'wp-color-picker' );
124
-		wp_enqueue_style( 'thickbox' ); // @TODO remove once we have modal API.
123
+		wp_enqueue_style('wp-color-picker');
124
+		wp_enqueue_style('thickbox'); // @TODO remove once we have modal API.
125 125
 
126 126
 	}
127 127
 
@@ -132,21 +132,21 @@  discard block
 block discarded – undo
132 132
 	 *
133 133
 	 * @param string $hook Page hook.
134 134
 	 */
135
-	public function admin_enqueue_scripts( $hook ) {
135
+	public function admin_enqueue_scripts($hook) {
136 136
 
137 137
 		// Give Admin Only.
138
-		if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) {
138
+		if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) {
139 139
 			return;
140 140
 		}
141 141
 
142 142
 		// WP Scripts.
143
-		wp_enqueue_script( 'wp-color-picker' );
144
-		wp_enqueue_script( 'jquery-ui-datepicker' );
145
-		wp_enqueue_script( 'thickbox' );
143
+		wp_enqueue_script('wp-color-picker');
144
+		wp_enqueue_script('jquery-ui-datepicker');
145
+		wp_enqueue_script('thickbox');
146 146
 		wp_enqueue_media();
147 147
 
148 148
 		// Give admin scripts.
149
-		wp_enqueue_script( 'give-admin-scripts' );
149
+		wp_enqueue_script('give-admin-scripts');
150 150
 
151 151
 		// Localize admin scripts
152 152
 		$this->admin_localize_scripts();
@@ -166,112 +166,112 @@  discard block
 block discarded – undo
166 166
 		$decimal_separator  = give_get_price_decimal_separator();
167 167
 
168 168
 		// Localize strings & variables for JS.
169
-		wp_localize_script( 'give-admin-scripts', 'give_vars', array(
170
-			'post_id'                           => isset( $post->ID ) ? $post->ID : null,
169
+		wp_localize_script('give-admin-scripts', 'give_vars', array(
170
+			'post_id'                           => isset($post->ID) ? $post->ID : null,
171 171
 			'give_version'                      => GIVE_VERSION,
172 172
 			'thousands_separator'               => $thousand_separator,
173 173
 			'decimal_separator'                 => $decimal_separator,
174
-			'quick_edit_warning'                => __( 'Not available for variable priced forms.', 'give' ),
175
-			'delete_payment'                    => __( 'Are you sure you want to <strong>permanently</strong> delete this donation?', 'give' ),
176
-			'delete_payment_note'               => __( 'Are you sure you want to delete this note?', 'give' ),
177
-			'revoke_api_key'                    => __( 'Are you sure you want to revoke this API key?', 'give' ),
178
-			'regenerate_api_key'                => __( 'Are you sure you want to regenerate this API key?', 'give' ),
179
-			'resend_receipt'                    => __( 'Are you sure you want to resend the donation receipt?', 'give' ),
180
-			'disconnect_user'                   => __( 'Are you sure you want to disconnect the user from this donor?', 'give' ),
181
-			'one_option'                        => __( 'Choose a form', 'give' ),
182
-			'one_or_more_option'                => __( 'Choose one or more forms', 'give' ),
183
-			'currency_sign'                     => give_currency_filter( '' ),
184
-			'currency_pos'                      => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before',
174
+			'quick_edit_warning'                => __('Not available for variable priced forms.', 'give'),
175
+			'delete_payment'                    => __('Are you sure you want to <strong>permanently</strong> delete this donation?', 'give'),
176
+			'delete_payment_note'               => __('Are you sure you want to delete this note?', 'give'),
177
+			'revoke_api_key'                    => __('Are you sure you want to revoke this API key?', 'give'),
178
+			'regenerate_api_key'                => __('Are you sure you want to regenerate this API key?', 'give'),
179
+			'resend_receipt'                    => __('Are you sure you want to resend the donation receipt?', 'give'),
180
+			'disconnect_user'                   => __('Are you sure you want to disconnect the user from this donor?', 'give'),
181
+			'one_option'                        => __('Choose a form', 'give'),
182
+			'one_or_more_option'                => __('Choose one or more forms', 'give'),
183
+			'currency_sign'                     => give_currency_filter(''),
184
+			'currency_pos'                      => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before',
185 185
 			'currency_decimals'                 => give_get_price_decimals(),
186
-			'ok'                                => __( 'Ok', 'give' ),
187
-			'cancel'                            => __( 'Cancel', 'give' ),
188
-			'close'                             => __( 'Close', 'give' ),
189
-			'confirm'                           => __( 'Confirm', 'give' ),
190
-			'confirm_action'                    => __( 'Confirm Action', 'give' ),
191
-			'confirm_deletion'                  => __( 'Confirm Deletion', 'give' ),
192
-			'confirm_delete_donation'           => __( 'Confirm Delete Donation', 'give' ),
193
-			'confirm_resend'                    => __( 'Confirm re-send', 'give' ),
194
-			'confirm_bulk_action'               => __( 'Confirm bulk action', 'give' ),
195
-			'restart_upgrade'                   => __( 'Do you want to restart the update process?', 'give' ),
196
-			'restart_update'                    => __( 'It is recommended that you backup your database before proceeding. Do you want to run the update now?', 'give' ),
197
-			'stop_upgrade'                      => __( 'Do you want to stop the update process now?', 'give' ),
198
-			'import_failed'                     => __( 'Import failed', 'give' ),
199
-			'flush_success'                     => __( 'Flush success', 'give' ),
200
-			'flush_error'                       => __( 'Flush error', 'give' ),
201
-			'no_form_selected'                  => __( 'No form selected', 'give' ),
202
-			'batch_export_no_class'             => __( 'You must choose a method.', 'give' ),
203
-			'batch_export_no_reqs'              => __( 'Required fields not completed.', 'give' ),
204
-			'reset_stats_warn'                  => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ),
205
-			'delete_test_donor'                 => __( 'Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give' ),
206
-			'delete_import_donor'               => __( 'Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give' ),
207
-			'price_format_guide'                => sprintf( __( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ),
186
+			'ok'                                => __('Ok', 'give'),
187
+			'cancel'                            => __('Cancel', 'give'),
188
+			'close'                             => __('Close', 'give'),
189
+			'confirm'                           => __('Confirm', 'give'),
190
+			'confirm_action'                    => __('Confirm Action', 'give'),
191
+			'confirm_deletion'                  => __('Confirm Deletion', 'give'),
192
+			'confirm_delete_donation'           => __('Confirm Delete Donation', 'give'),
193
+			'confirm_resend'                    => __('Confirm re-send', 'give'),
194
+			'confirm_bulk_action'               => __('Confirm bulk action', 'give'),
195
+			'restart_upgrade'                   => __('Do you want to restart the update process?', 'give'),
196
+			'restart_update'                    => __('It is recommended that you backup your database before proceeding. Do you want to run the update now?', 'give'),
197
+			'stop_upgrade'                      => __('Do you want to stop the update process now?', 'give'),
198
+			'import_failed'                     => __('Import failed', 'give'),
199
+			'flush_success'                     => __('Flush success', 'give'),
200
+			'flush_error'                       => __('Flush error', 'give'),
201
+			'no_form_selected'                  => __('No form selected', 'give'),
202
+			'batch_export_no_class'             => __('You must choose a method.', 'give'),
203
+			'batch_export_no_reqs'              => __('Required fields not completed.', 'give'),
204
+			'reset_stats_warn'                  => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'),
205
+			'delete_test_donor'                 => __('Are you sure you want to delete all the test donors? This process will also delete test donations as well.', 'give'),
206
+			'delete_import_donor'               => __('Are you sure you want to delete all the imported donors? This process will also delete imported donations as well.', 'give'),
207
+			'price_format_guide'                => sprintf(__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator),
208 208
 			/* translators : %s: Donation form options metabox */
209
-			'confirm_before_remove_row_text'    => __( 'Do you want to delete this item?', 'give' ),
210
-			'matched_success_failure_page'      => __( 'You cannot set the success and failed pages to the same page', 'give' ),
211
-			'dismiss_notice_text'               => __( 'Dismiss this notice.', 'give' ),
212
-			'search_placeholder'                => __( 'Type to search all forms', 'give' ),
213
-			'search_placeholder_donor'          => __( 'Type to search all donors', 'give' ),
214
-			'search_placeholder_country'        => __( 'Type to search all countries', 'give' ),
215
-			'search_placeholder_state'          => __( 'Type to search all states/provinces', 'give' ),
216
-			'unlock_donor_fields_title'         => __( 'Action forbidden', 'give' ),
217
-			'unlock_donor_fields_message'               => __( 'To edit first name and last name, please go to user profile of the donor.', 'give' ),
218
-			'remove_from_bulk_delete'           => __( 'Remove from Bulk Delete', 'give' ),
209
+			'confirm_before_remove_row_text'    => __('Do you want to delete this item?', 'give'),
210
+			'matched_success_failure_page'      => __('You cannot set the success and failed pages to the same page', 'give'),
211
+			'dismiss_notice_text'               => __('Dismiss this notice.', 'give'),
212
+			'search_placeholder'                => __('Type to search all forms', 'give'),
213
+			'search_placeholder_donor'          => __('Type to search all donors', 'give'),
214
+			'search_placeholder_country'        => __('Type to search all countries', 'give'),
215
+			'search_placeholder_state'          => __('Type to search all states/provinces', 'give'),
216
+			'unlock_donor_fields_title'         => __('Action forbidden', 'give'),
217
+			'unlock_donor_fields_message'               => __('To edit first name and last name, please go to user profile of the donor.', 'give'),
218
+			'remove_from_bulk_delete'           => __('Remove from Bulk Delete', 'give'),
219 219
 			'donors_bulk_action'                => array(
220 220
 				'no_donor_selected'  => array(
221
-					'title' => __( 'No donors selected', 'give' ),
222
-					'desc'  => __( 'You must choose at least one or more donors to delete.', 'give' )
221
+					'title' => __('No donors selected', 'give'),
222
+					'desc'  => __('You must choose at least one or more donors to delete.', 'give')
223 223
 				),
224 224
 				'no_action_selected' => array(
225
-					'title' => __( 'No action selected', 'give' ),
226
-					'desc'  => __( 'You must select a bulk action to proceed.', 'give' ),
225
+					'title' => __('No action selected', 'give'),
226
+					'desc'  => __('You must select a bulk action to proceed.', 'give'),
227 227
 				),
228 228
 			),
229 229
 			'donations_bulk_action'             => array(
230 230
 				'titles'         => array(
231
-					'zero' => __( 'No payments selected', 'give' ),
231
+					'zero' => __('No payments selected', 'give'),
232 232
 				),
233 233
 				'delete'         => array(
234
-					'zero'     => __( 'You must choose at least one or more donations to delete.', 'give' ),
235
-					'single'   => __( 'Are you sure you want to permanently delete this donation?', 'give' ),
236
-					'multiple' => __( 'Are you sure you want to permanently delete the selected {payment_count} donations?', 'give' ),
234
+					'zero'     => __('You must choose at least one or more donations to delete.', 'give'),
235
+					'single'   => __('Are you sure you want to permanently delete this donation?', 'give'),
236
+					'multiple' => __('Are you sure you want to permanently delete the selected {payment_count} donations?', 'give'),
237 237
 				),
238 238
 				'resend-receipt' => array(
239
-					'zero'     => __( 'You must choose at least one or more recipients to resend the email receipt.', 'give' ),
240
-					'single'   => __( 'Are you sure you want to resend the email receipt to this recipient?', 'give' ),
241
-					'multiple' => __( 'Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give' ),
239
+					'zero'     => __('You must choose at least one or more recipients to resend the email receipt.', 'give'),
240
+					'single'   => __('Are you sure you want to resend the email receipt to this recipient?', 'give'),
241
+					'multiple' => __('Are you sure you want to resend the emails receipt to {payment_count} recipients?', 'give'),
242 242
 				),
243 243
 				'set-to-status'  => array(
244
-					'zero'     => __( 'You must choose at least one or more donations to set status to {status}.', 'give' ),
245
-					'single'   => __( 'Are you sure you want to set status of this donation to {status}?', 'give' ),
246
-					'multiple' => __( 'Are you sure you want to set status of {payment_count} donations to {status}?', 'give' ),
244
+					'zero'     => __('You must choose at least one or more donations to set status to {status}.', 'give'),
245
+					'single'   => __('Are you sure you want to set status of this donation to {status}?', 'give'),
246
+					'multiple' => __('Are you sure you want to set status of {payment_count} donations to {status}?', 'give'),
247 247
 				),
248 248
 			),
249 249
 			'updates'                           => array(
250
-				'ajax_error' => __( 'Please reload this page and try again', 'give' ),
250
+				'ajax_error' => __('Please reload this page and try again', 'give'),
251 251
 			),
252 252
 			'metabox_fields'                    => array(
253 253
 				'media' => array(
254
-					'button_title' => __( 'Choose Image', 'give' ),
254
+					'button_title' => __('Choose Image', 'give'),
255 255
 				),
256 256
 				'file'  => array(
257
-					'button_title' => __( 'Choose File', 'give' ),
257
+					'button_title' => __('Choose File', 'give'),
258 258
 				),
259 259
 			),
260 260
 			'chosen'                            => array(
261
-				'no_results_msg'  => __( 'No results match {search_term}', 'give' ),
262
-				'ajax_search_msg' => __( 'Searching results for match {search_term}', 'give' ),
261
+				'no_results_msg'  => __('No results match {search_term}', 'give'),
262
+				'ajax_search_msg' => __('Searching results for match {search_term}', 'give'),
263 263
 			),
264
-			'db_update_confirmation_msg_button' => __( 'Run Updates', 'give' ),
265
-			'db_update_confirmation_msg'        => __( 'The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give' ),
266
-			'error_message'                     => __( 'Something went wrong kindly try again!', 'give' ),
264
+			'db_update_confirmation_msg_button' => __('Run Updates', 'give'),
265
+			'db_update_confirmation_msg'        => __('The following process will make updates to your site\'s database. Please create a database backup before proceeding with updates.', 'give'),
266
+			'error_message'                     => __('Something went wrong kindly try again!', 'give'),
267 267
 			'give_donation_import'              => 'give_donation_import',
268 268
 			'core_settings_import'              => 'give_core_settings_import',
269
-			'setting_not_save_message'          => __( 'Changes you made may not be saved.', 'give' ),
269
+			'setting_not_save_message'          => __('Changes you made may not be saved.', 'give'),
270 270
 			'give_donation_amounts'             => array(
271
-				'minimum' => apply_filters( 'give_donation_minimum_limit', 1 ),
272
-				'maximum' => apply_filters( 'give_donation_maximum_limit', 999999.99 ),
271
+				'minimum' => apply_filters('give_donation_minimum_limit', 1),
272
+				'maximum' => apply_filters('give_donation_maximum_limit', 999999.99),
273 273
 			),
274
-		) );
274
+		));
275 275
 	}
276 276
 
277 277
 	/**
@@ -282,10 +282,10 @@  discard block
 block discarded – undo
282 282
 		<style type="text/css" media="screen">
283 283
 			@font-face {
284 284
 				font-family: 'give-icomoon';
285
-				src: url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.eot?ngjl88'; ?>');
286
-				src: url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'),
287
-				url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.woff?ngjl88'; ?>') format('woff'),
288
-				url('<?php echo GIVE_PLUGIN_URL . 'assets/dist/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg');
285
+				src: url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.eot?ngjl88'; ?>');
286
+				src: url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.eot?#iefixngjl88'?>') format('embedded-opentype'),
287
+				url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.woff?ngjl88'; ?>') format('woff'),
288
+				url('<?php echo GIVE_PLUGIN_URL.'assets/dist/fonts/icomoon.svg?ngjl88#icomoon'; ?>') format('svg');
289 289
 				font-weight: normal;
290 290
 				font-style: normal;
291 291
 			}
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 	 * @since 2.1.0
309 309
 	 */
310 310
 	public function public_enqueue_styles() {
311
-		wp_enqueue_style( 'give-styles' );
311
+		wp_enqueue_style('give-styles');
312 312
 	}
313 313
 
314 314
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	 * @since 2.1.0
319 319
 	 */
320 320
 	public function public_enqueue_scripts() {
321
-		wp_enqueue_script( 'give' );
321
+		wp_enqueue_script('give');
322 322
 
323 323
 		$this->public_localize_scripts();
324 324
 	}
@@ -337,22 +337,22 @@  discard block
 block discarded – undo
337 337
 		 *
338 338
 		 * @return  string $message Send notice message for email access.
339 339
 		 */
340
-		$message = (string) apply_filters( 'give_email_access_mail_send_notice', __( 'Please check your email and click on the link to access your complete donation history.', 'give' ) );
340
+		$message = (string) apply_filters('give_email_access_mail_send_notice', __('Please check your email and click on the link to access your complete donation history.', 'give'));
341 341
 
342
-		$localize_give_vars = apply_filters( 'give_global_script_vars', array(
342
+		$localize_give_vars = apply_filters('give_global_script_vars', array(
343 343
 			'ajaxurl'                    => give_get_ajax_url(),
344
-			'checkout_nonce'             => wp_create_nonce( 'give_checkout_nonce' ),
344
+			'checkout_nonce'             => wp_create_nonce('give_checkout_nonce'),
345 345
 			// Do not use this nonce. Its deprecated.
346 346
 			'currency'                   => give_get_currency(),
347
-			'currency_sign'              => give_currency_filter( '' ),
347
+			'currency_sign'              => give_currency_filter(''),
348 348
 			'currency_pos'               => give_get_currency_position(),
349 349
 			'thousands_separator'        => give_get_price_thousand_separator(),
350 350
 			'decimal_separator'          => give_get_price_decimal_separator(),
351
-			'no_gateway'                 => __( 'Please select a payment method.', 'give' ),
352
-			'bad_minimum'                => __( 'The minimum custom donation amount for this form is', 'give' ),
353
-			'bad_maximum'                => __( 'The maximum custom donation amount for this form is', 'give' ),
354
-			'general_loading'            => __( 'Loading...', 'give' ),
355
-			'purchase_loading'           => __( 'Please Wait...', 'give' ),
351
+			'no_gateway'                 => __('Please select a payment method.', 'give'),
352
+			'bad_minimum'                => __('The minimum custom donation amount for this form is', 'give'),
353
+			'bad_maximum'                => __('The maximum custom donation amount for this form is', 'give'),
354
+			'general_loading'            => __('Loading...', 'give'),
355
+			'purchase_loading'           => __('Please Wait...', 'give'),
356 356
 			'number_decimals'            => give_get_price_decimals(),
357 357
 			'give_version'               => GIVE_VERSION,
358 358
 			'magnific_options'           => apply_filters(
@@ -366,30 +366,30 @@  discard block
 block discarded – undo
366 366
 				'give_form_translation_js',
367 367
 				array(
368 368
 					// Field name               Validation message.
369
-					'payment-mode'           => __( 'Please select payment mode.', 'give' ),
370
-					'give_first'             => __( 'Please enter your first name.', 'give' ),
371
-					'give_email'             => __( 'Please enter a valid email address.', 'give' ),
372
-					'give_user_login'        => __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ),
373
-					'give_user_pass'         => __( 'Enter a password.', 'give' ),
374
-					'give_user_pass_confirm' => __( 'Enter the password confirmation.', 'give' ),
375
-					'give_agree_to_terms'    => __( 'You must agree to the terms and conditions.', 'give' ),
369
+					'payment-mode'           => __('Please select payment mode.', 'give'),
370
+					'give_first'             => __('Please enter your first name.', 'give'),
371
+					'give_email'             => __('Please enter a valid email address.', 'give'),
372
+					'give_user_login'        => __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'),
373
+					'give_user_pass'         => __('Enter a password.', 'give'),
374
+					'give_user_pass_confirm' => __('Enter the password confirmation.', 'give'),
375
+					'give_agree_to_terms'    => __('You must agree to the terms and conditions.', 'give'),
376 376
 				)
377 377
 			),
378 378
 			'confirm_email_sent_message' => $message,
379
-			'ajax_vars'                  => apply_filters( 'give_global_ajax_vars', array(
379
+			'ajax_vars'                  => apply_filters('give_global_ajax_vars', array(
380 380
 				'ajaxurl'         => give_get_ajax_url(),
381
-				'ajaxNonce'       => wp_create_nonce( 'give_ajax_nonce' ),
382
-				'loading'         => __( 'Loading', 'give' ),
381
+				'ajaxNonce'       => wp_create_nonce('give_ajax_nonce'),
382
+				'loading'         => __('Loading', 'give'),
383 383
 				// General loading message.
384
-				'select_option'   => __( 'Please select an option', 'give' ),
384
+				'select_option'   => __('Please select an option', 'give'),
385 385
 				// Variable pricing error with multi-donation option enabled.
386
-				'default_gateway' => give_get_default_gateway( null ),
387
-				'permalinks'      => get_option( 'permalink_structure' ) ? '1' : '0',
386
+				'default_gateway' => give_get_default_gateway(null),
387
+				'permalinks'      => get_option('permalink_structure') ? '1' : '0',
388 388
 				'number_decimals' => give_get_price_decimals(),
389
-			) ),
390
-		) );
389
+			)),
390
+		));
391 391
 
392
-		wp_localize_script( 'give', 'give_global_vars', $localize_give_vars );
392
+		wp_localize_script('give', 'give_global_vars', $localize_give_vars);
393 393
 
394 394
 	}
395 395
 
@@ -403,15 +403,15 @@  discard block
 block discarded – undo
403 403
 	 */
404 404
 	public function get_frontend_stylesheet_uri() {
405 405
 
406
-		$file          = 'give' . $this->direction . '.css';
406
+		$file          = 'give'.$this->direction.'.css';
407 407
 		$templates_dir = give_get_theme_template_dir_name();
408 408
 
409 409
 		// Directory paths to CSS files to support checking via file_exists().
410
-		$child_theme_style_sheet    = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file;
411
-		$child_theme_style_sheet_2  = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $this->direction . '.css';
412
-		$parent_theme_style_sheet   = trailingslashit( get_template_directory() ) . $templates_dir . $file;
413
-		$parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $this->direction . '.css';
414
-		$give_plugin_style_sheet    = trailingslashit( GIVE_PLUGIN_DIR ) . 'assets/dist/css/' . $file;
410
+		$child_theme_style_sheet    = trailingslashit(get_stylesheet_directory()).$templates_dir.$file;
411
+		$child_theme_style_sheet_2  = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$this->direction.'.css';
412
+		$parent_theme_style_sheet   = trailingslashit(get_template_directory()).$templates_dir.$file;
413
+		$parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$this->direction.'.css';
414
+		$give_plugin_style_sheet    = trailingslashit(GIVE_PLUGIN_DIR).'assets/dist/css/'.$file;
415 415
 		$uri                        = false;
416 416
 
417 417
 		/**
@@ -422,23 +422,23 @@  discard block
 block discarded – undo
422 422
 		 * c. followed by non minified version, even if SCRIPT_DEBUG is not enabled. This allows users to copy just give.css to their theme.
423 423
 		 * d. Finally, fallback to the standard Give version. This is the default styles included within the plugin.
424 424
 		 */
425
-		if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) {
426
-			if ( ! empty( $nonmin ) ) {
427
-				$uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $this->direction . '.css';
425
+		if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) {
426
+			if ( ! empty($nonmin)) {
427
+				$uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$this->direction.'.css';
428 428
 			} else {
429
-				$uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file;
429
+				$uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file;
430 430
 			}
431
-		} elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) {
432
-			if ( ! empty( $nonmin ) ) {
433
-				$uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $this->direction . '.css';
431
+		} elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) {
432
+			if ( ! empty($nonmin)) {
433
+				$uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$this->direction.'.css';
434 434
 			} else {
435
-				$uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file;
435
+				$uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file;
436 436
 			}
437
-		} elseif ( file_exists( $give_plugin_style_sheet ) ) {
438
-			$uri = trailingslashit( GIVE_PLUGIN_URL ) . 'assets/dist/css/' . $file;
437
+		} elseif (file_exists($give_plugin_style_sheet)) {
438
+			$uri = trailingslashit(GIVE_PLUGIN_URL).'assets/dist/css/'.$file;
439 439
 		}
440 440
 
441
-		return apply_filters( 'give_get_stylesheet_uri', $uri );
441
+		return apply_filters('give_get_stylesheet_uri', $uri);
442 442
 
443 443
 	}
444 444
 
@@ -450,19 +450,19 @@  discard block
 block discarded – undo
450 450
 		// Enqueue the bundled block JS file
451 451
 		wp_enqueue_script(
452 452
 			'give-blocks-js',
453
-			GIVE_PLUGIN_URL . 'assets/dist/js/gutenberg.js',
454
-			array( 'wp-i18n', 'wp-element', 'wp-blocks', 'wp-components', 'wp-api' ),
453
+			GIVE_PLUGIN_URL.'assets/dist/js/gutenberg.js',
454
+			array('wp-i18n', 'wp-element', 'wp-blocks', 'wp-components', 'wp-api'),
455 455
 			GIVE_VERSION
456 456
 		);
457 457
 
458 458
 		// Enqueue public styles
459
-		wp_enqueue_style( 'give-styles' );
459
+		wp_enqueue_style('give-styles');
460 460
 
461 461
 		// Enqueue the bundled block css file
462 462
 		wp_enqueue_style(
463 463
 			'give-blocks-css',
464
-			GIVE_PLUGIN_URL . 'assets/dist/css/gutenberg.css',
465
-			array( 'wp-blocks' ),
464
+			GIVE_PLUGIN_URL.'assets/dist/css/gutenberg.css',
465
+			array('wp-blocks'),
466 466
 			GIVE_VERSION
467 467
 		);
468 468
 
Please login to merge, or discard this patch.
includes/actions.php 1 patch
Spacing   +90 added lines, -90 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
 
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_get_actions() {
27 27
 
28
-	$_get_action = ! empty( $_GET['give_action'] ) ? $_GET['give_action'] : null;
28
+	$_get_action = ! empty($_GET['give_action']) ? $_GET['give_action'] : null;
29 29
 
30 30
 	// Add backward compatibility to give-action param ( $_GET )
31
-	if ( empty( $_get_action ) ) {
32
-		$_get_action = ! empty( $_GET['give-action'] ) ? $_GET['give-action'] : null;
31
+	if (empty($_get_action)) {
32
+		$_get_action = ! empty($_GET['give-action']) ? $_GET['give-action'] : null;
33 33
 	}
34 34
 
35
-	if ( isset( $_get_action ) ) {
35
+	if (isset($_get_action)) {
36 36
 		/**
37 37
 		 * Fires in WordPress init or admin init, when give_action is present in $_GET.
38 38
 		 *
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
 		 *
41 41
 		 * @param array $_GET Array of HTTP GET variables.
42 42
 		 */
43
-		do_action( "give_{$_get_action}", $_GET );
43
+		do_action("give_{$_get_action}", $_GET);
44 44
 	}
45 45
 
46 46
 }
47 47
 
48
-add_action( 'init', 'give_get_actions' );
48
+add_action('init', 'give_get_actions');
49 49
 
50 50
 /**
51 51
  * Hooks Give actions, when present in the $_POST super global. Every give_action
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
  */
59 59
 function give_post_actions() {
60 60
 
61
-	$_post_action = ! empty( $_POST['give_action'] ) ? $_POST['give_action'] : null;
61
+	$_post_action = ! empty($_POST['give_action']) ? $_POST['give_action'] : null;
62 62
 
63 63
 	// Add backward compatibility to give-action param ( $_POST ).
64
-	if ( empty( $_post_action ) ) {
65
-		$_post_action = ! empty( $_POST['give-action'] ) ? $_POST['give-action'] : null;
64
+	if (empty($_post_action)) {
65
+		$_post_action = ! empty($_POST['give-action']) ? $_POST['give-action'] : null;
66 66
 	}
67 67
 
68
-	if ( isset( $_post_action ) ) {
68
+	if (isset($_post_action)) {
69 69
 		/**
70 70
 		 * Fires in WordPress init or admin init, when give_action is present in $_POST.
71 71
 		 *
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
 		 *
74 74
 		 * @param array $_POST Array of HTTP POST variables.
75 75
 		 */
76
-		do_action( "give_{$_post_action}", $_POST );
76
+		do_action("give_{$_post_action}", $_POST);
77 77
 	}
78 78
 
79 79
 }
80 80
 
81
-add_action( 'init', 'give_post_actions' );
81
+add_action('init', 'give_post_actions');
82 82
 
83 83
 /**
84 84
  * Connect WordPress user with Donor.
@@ -90,17 +90,17 @@  discard block
 block discarded – undo
90 90
  *
91 91
  * @return void
92 92
  */
93
-function give_connect_donor_to_wpuser( $user_id, $user_data ) {
93
+function give_connect_donor_to_wpuser($user_id, $user_data) {
94 94
 	/* @var Give_Donor $donor */
95
-	$donor = new Give_Donor( $user_data['user_email'] );
95
+	$donor = new Give_Donor($user_data['user_email']);
96 96
 
97 97
 	// Validate donor id and check if do nor is already connect to wp user or not.
98
-	if ( $donor->id && ! $donor->user_id ) {
98
+	if ($donor->id && ! $donor->user_id) {
99 99
 
100 100
 		// Update donor user_id.
101
-		if ( $donor->update( array( 'user_id' => $user_id ) ) ) {
102
-			$donor_note = sprintf( esc_html__( 'WordPress user #%d is connected to #%d', 'give' ), $user_id, $donor->id );
103
-			$donor->add_note( $donor_note );
101
+		if ($donor->update(array('user_id' => $user_id))) {
102
+			$donor_note = sprintf(esc_html__('WordPress user #%d is connected to #%d', 'give'), $user_id, $donor->id);
103
+			$donor->add_note($donor_note);
104 104
 
105 105
 			// Update user_id meta in payments.
106 106
 			// if( ! empty( $donor->payment_ids ) && ( $donations = explode( ',', $donor->payment_ids ) ) ) {
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	}
114 114
 }
115 115
 
116
-add_action( 'give_insert_user', 'give_connect_donor_to_wpuser', 10, 2 );
116
+add_action('give_insert_user', 'give_connect_donor_to_wpuser', 10, 2);
117 117
 
118 118
 
119 119
 /**
@@ -127,45 +127,45 @@  discard block
 block discarded – undo
127 127
  */
128 128
 function give_validate_license_when_site_migrated() {
129 129
 	// Store current site address if not already stored.
130
-	$home_url_parts              = parse_url( home_url() );
131
-	$home_url                    = isset( $home_url_parts['host'] ) ? $home_url_parts['host'] : false;
132
-	$home_url                    .= isset( $home_url_parts['path'] ) ? $home_url_parts['path'] : '';
133
-	$site_address_before_migrate = get_option( 'give_site_address_before_migrate' );
130
+	$home_url_parts              = parse_url(home_url());
131
+	$home_url                    = isset($home_url_parts['host']) ? $home_url_parts['host'] : false;
132
+	$home_url .= isset($home_url_parts['path']) ? $home_url_parts['path'] : '';
133
+	$site_address_before_migrate = get_option('give_site_address_before_migrate');
134 134
 
135 135
 	// Need $home_url to proceed.
136
-	if ( ! $home_url ) {
136
+	if ( ! $home_url) {
137 137
 		return;
138 138
 	}
139 139
 
140 140
 	// Save site address.
141
-	if ( ! $site_address_before_migrate ) {
141
+	if ( ! $site_address_before_migrate) {
142 142
 		// Update site address.
143
-		update_option( 'give_site_address_before_migrate', $home_url );
143
+		update_option('give_site_address_before_migrate', $home_url);
144 144
 
145 145
 		return;
146 146
 	}
147 147
 
148 148
 	// Backwards compat. for before when we were storing URL scheme.
149
-	if ( strpos( $site_address_before_migrate, 'http' ) ) {
150
-		$site_address_before_migrate = parse_url( $site_address_before_migrate );
151
-		$site_address_before_migrate = isset( $site_address_before_migrate['host'] ) ? $site_address_before_migrate['host'] : false;
149
+	if (strpos($site_address_before_migrate, 'http')) {
150
+		$site_address_before_migrate = parse_url($site_address_before_migrate);
151
+		$site_address_before_migrate = isset($site_address_before_migrate['host']) ? $site_address_before_migrate['host'] : false;
152 152
 
153 153
 		// Add path for multisite installs.
154
-		$site_address_before_migrate .= isset( $site_address_before_migrate['path'] ) ? $site_address_before_migrate['path'] : '';
154
+		$site_address_before_migrate .= isset($site_address_before_migrate['path']) ? $site_address_before_migrate['path'] : '';
155 155
 	}
156 156
 
157 157
 	// If the two URLs don't match run CRON.
158
-	if ( $home_url !== $site_address_before_migrate ) {
158
+	if ($home_url !== $site_address_before_migrate) {
159 159
 		// Immediately run cron.
160
-		wp_schedule_single_event( time(), 'give_validate_license_when_site_migrated' );
160
+		wp_schedule_single_event(time(), 'give_validate_license_when_site_migrated');
161 161
 
162 162
 		// Update site address.
163
-		update_option( 'give_site_address_before_migrate', $home_url );
163
+		update_option('give_site_address_before_migrate', $home_url);
164 164
 	}
165 165
 
166 166
 }
167 167
 
168
-add_action( 'admin_init', 'give_validate_license_when_site_migrated' );
168
+add_action('admin_init', 'give_validate_license_when_site_migrated');
169 169
 
170 170
 
171 171
 /**
@@ -175,19 +175,19 @@  discard block
 block discarded – undo
175 175
  *
176 176
  * @param $data
177 177
  */
178
-function give_donor_batch_export_complete( $data ) {
178
+function give_donor_batch_export_complete($data) {
179 179
 	// Remove donor ids cache.
180 180
 	if (
181
-		isset( $data['class'] )
181
+		isset($data['class'])
182 182
 		&& 'Give_Batch_Donors_Export' === $data['class']
183
-		&& ! empty( $data['forms'] )
184
-		&& isset( $data['give_export_option']['query_id'] )
183
+		&& ! empty($data['forms'])
184
+		&& isset($data['give_export_option']['query_id'])
185 185
 	) {
186
-		Give_Cache::delete( Give_Cache::get_key( $data['give_export_option']['query_id'] ) );
186
+		Give_Cache::delete(Give_Cache::get_key($data['give_export_option']['query_id']));
187 187
 	}
188 188
 }
189 189
 
190
-add_action( 'give_file_export_complete', 'give_donor_batch_export_complete' );
190
+add_action('give_file_export_complete', 'give_donor_batch_export_complete');
191 191
 
192 192
 /**
193 193
  * Print css for wordpress setting pages.
@@ -198,12 +198,12 @@  discard block
 block discarded – undo
198 198
 	/* @var WP_Screen $screen */
199 199
 	$screen = get_current_screen();
200 200
 
201
-	if ( ! ( $screen instanceof WP_Screen ) ) {
201
+	if ( ! ($screen instanceof WP_Screen)) {
202 202
 		return false;
203 203
 	}
204 204
 
205
-	switch ( true ) {
206
-		case ( 'plugins' === $screen->base || 'plugins-network' === $screen->base ):
205
+	switch (true) {
206
+		case ('plugins' === $screen->base || 'plugins-network' === $screen->base):
207 207
 			?>
208 208
 			<style>
209 209
 				tr.active.update + tr.give-addon-notice-tr td {
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	}
241 241
 }
242 242
 
243
-add_action( 'admin_head', 'give_admin_quick_css' );
243
+add_action('admin_head', 'give_admin_quick_css');
244 244
 
245 245
 
246 246
 /**
@@ -252,31 +252,31 @@  discard block
 block discarded – undo
252 252
  *
253 253
  * @return void
254 254
  */
255
-function give_set_donation_levels_max_min_amount( $form_id ) {
255
+function give_set_donation_levels_max_min_amount($form_id) {
256 256
 	if (
257
-		( 'set' === $_POST['_give_price_option'] ) ||
258
-		( in_array( '_give_donation_levels', $_POST ) && count( $_POST['_give_donation_levels'] ) <= 0 ) ||
259
-		! ( $donation_levels_amounts = wp_list_pluck( $_POST['_give_donation_levels'], '_give_amount' ) )
257
+		('set' === $_POST['_give_price_option']) ||
258
+		(in_array('_give_donation_levels', $_POST) && count($_POST['_give_donation_levels']) <= 0) ||
259
+		! ($donation_levels_amounts = wp_list_pluck($_POST['_give_donation_levels'], '_give_amount'))
260 260
 	) {
261 261
 		// Delete old meta.
262
-		give_delete_meta( $form_id, '_give_levels_minimum_amount' );
263
-		give_delete_meta( $form_id, '_give_levels_maximum_amount' );
262
+		give_delete_meta($form_id, '_give_levels_minimum_amount');
263
+		give_delete_meta($form_id, '_give_levels_maximum_amount');
264 264
 
265 265
 		return;
266 266
 	}
267 267
 
268 268
 	// Sanitize donation level amounts.
269
-	$donation_levels_amounts = array_map( 'give_maybe_sanitize_amount', $donation_levels_amounts );
269
+	$donation_levels_amounts = array_map('give_maybe_sanitize_amount', $donation_levels_amounts);
270 270
 
271
-	$min_amount = min( $donation_levels_amounts );
272
-	$max_amount = max( $donation_levels_amounts );
271
+	$min_amount = min($donation_levels_amounts);
272
+	$max_amount = max($donation_levels_amounts);
273 273
 
274 274
 	// Set Minimum and Maximum amount for Multi Level Donation Forms.
275
-	give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount_for_db( $min_amount ) : 0 );
276
-	give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount_for_db( $max_amount ) : 0 );
275
+	give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount_for_db($min_amount) : 0);
276
+	give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount_for_db($max_amount) : 0);
277 277
 }
278 278
 
279
-add_action( 'give_pre_process_give_forms_meta', 'give_set_donation_levels_max_min_amount', 30 );
279
+add_action('give_pre_process_give_forms_meta', 'give_set_donation_levels_max_min_amount', 30);
280 280
 
281 281
 
282 282
 /**
@@ -286,23 +286,23 @@  discard block
 block discarded – undo
286 286
  *
287 287
  * @param int $payment_id
288 288
  */
289
-function _give_save_donor_billing_address( $payment_id ) {
290
-	$donor_id  = absint( give_get_payment_donor_id( $payment_id ));
289
+function _give_save_donor_billing_address($payment_id) {
290
+	$donor_id = absint(give_get_payment_donor_id($payment_id));
291 291
 
292 292
 	// Bailout
293
-	if ( ! $donor_id ) {
293
+	if ( ! $donor_id) {
294 294
 		return;
295 295
 	}
296 296
 
297 297
 
298 298
 	/* @var Give_Donor $donor */
299
-	$donor = new Give_Donor( $donor_id );
299
+	$donor = new Give_Donor($donor_id);
300 300
 
301 301
 	// Save address.
302
-	$donor->add_address( 'billing[]', give_get_donation_address( $payment_id ) );
302
+	$donor->add_address('billing[]', give_get_donation_address($payment_id));
303 303
 }
304 304
 
305
-add_action( 'give_complete_donation', '_give_save_donor_billing_address', 9999 );
305
+add_action('give_complete_donation', '_give_save_donor_billing_address', 9999);
306 306
 
307 307
 
308 308
 /**
@@ -312,26 +312,26 @@  discard block
 block discarded – undo
312 312
  *
313 313
  * @param array $args
314 314
  */
315
-function give_update_log_form_id( $args ) {
316
-	$new_form_id = absint( $args[0] );
317
-	$payment_id  = absint( $args[1] );
318
-	$logs        = Give()->logs->get_logs( $payment_id );
315
+function give_update_log_form_id($args) {
316
+	$new_form_id = absint($args[0]);
317
+	$payment_id  = absint($args[1]);
318
+	$logs        = Give()->logs->get_logs($payment_id);
319 319
 
320 320
 	// Bailout.
321
-	if ( empty( $logs ) ) {
321
+	if (empty($logs)) {
322 322
 		return;
323 323
 	}
324 324
 
325 325
 	/* @var object $log */
326
-	foreach ( $logs as $log ) {
327
-		Give()->logs->logmeta_db->update_meta( $log->ID, '_give_log_form_id', $new_form_id );
326
+	foreach ($logs as $log) {
327
+		Give()->logs->logmeta_db->update_meta($log->ID, '_give_log_form_id', $new_form_id);
328 328
 	}
329 329
 
330 330
 	// Delete cache.
331 331
 	Give()->logs->delete_cache();
332 332
 }
333 333
 
334
-add_action( 'give_update_log_form_id', 'give_update_log_form_id' );
334
+add_action('give_update_log_form_id', 'give_update_log_form_id');
335 335
 
336 336
 /**
337 337
  * Verify addon dependency before addon update
@@ -343,22 +343,22 @@  discard block
 block discarded – undo
343 343
  *
344 344
  * @return WP_Error
345 345
  */
346
-function __give_verify_addon_dependency_before_update( $error, $hook_extra ) {
346
+function __give_verify_addon_dependency_before_update($error, $hook_extra) {
347 347
 	// Bailout.
348
-	if ( is_wp_error( $error ) ) {
348
+	if (is_wp_error($error)) {
349 349
 		return $error;
350 350
 	}
351 351
 
352
-	$plugin_base    = strtolower( $hook_extra['plugin'] );
353
-	$licensed_addon = array_map( 'strtolower', Give_License::get_licensed_addons() );
352
+	$plugin_base    = strtolower($hook_extra['plugin']);
353
+	$licensed_addon = array_map('strtolower', Give_License::get_licensed_addons());
354 354
 
355 355
 	// Skip if not a Give addon.
356
-	if ( ! in_array( $plugin_base, $licensed_addon ) ) {
356
+	if ( ! in_array($plugin_base, $licensed_addon)) {
357 357
 		return $error;
358 358
 	}
359 359
 
360
-	$plugin_base = strtolower( $plugin_base );
361
-	$plugin_slug = str_replace( '.php', '', basename( $plugin_base ) );
360
+	$plugin_base = strtolower($plugin_base);
361
+	$plugin_slug = str_replace('.php', '', basename($plugin_base));
362 362
 
363 363
 	/**
364 364
 	 * Filter the addon readme.txt url
@@ -371,15 +371,15 @@  discard block
 block discarded – undo
371 371
 		$plugin_slug
372 372
 	);
373 373
 
374
-	$parser           = new Give_Readme_Parser( $url );
374
+	$parser           = new Give_Readme_Parser($url);
375 375
 	$give_min_version = $parser->requires_at_least();
376 376
 
377 377
 
378
-	if ( version_compare( GIVE_VERSION, $give_min_version, '<' ) ) {
378
+	if (version_compare(GIVE_VERSION, $give_min_version, '<')) {
379 379
 		return new WP_Error(
380 380
 			'Give_Addon_Update_Error',
381 381
 			sprintf(
382
-				__( 'Give version %s is required to update this add-on.', 'give' ),
382
+				__('Give version %s is required to update this add-on.', 'give'),
383 383
 				$give_min_version
384 384
 			)
385 385
 		);
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 	return $error;
389 389
 }
390 390
 
391
-add_filter( 'upgrader_pre_install', '__give_verify_addon_dependency_before_update', 10, 2 );
391
+add_filter('upgrader_pre_install', '__give_verify_addon_dependency_before_update', 10, 2);
392 392
 
393 393
 /**
394 394
  * Function to add suppress_filters param if WPML add-on is activated.
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
  *
400 400
  * @return array WP query argument for Total Goal.
401 401
  */
402
-function __give_wpml_total_goal_shortcode_agrs( $args ) {
402
+function __give_wpml_total_goal_shortcode_agrs($args) {
403 403
 	$args['suppress_filters'] = true;
404 404
 
405 405
 	return $args;
@@ -434,19 +434,19 @@  discard block
 block discarded – undo
434 434
  * @since 2.1.4
435 435
  */
436 436
 function give_add_support_for_wpml() {
437
-	if ( ! function_exists( 'is_plugin_active' ) ) {
438
-		include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
437
+	if ( ! function_exists('is_plugin_active')) {
438
+		include_once(ABSPATH.'wp-admin/includes/plugin.php');
439 439
 	}
440 440
 
441 441
 
442
-	if ( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' ) ) {
442
+	if (is_plugin_active('sitepress-multilingual-cms/sitepress.php')) {
443 443
 
444
-		add_filter( 'give_totals_goal_shortcode_query_args', '__give_wpml_total_goal_shortcode_agrs' );
444
+		add_filter('give_totals_goal_shortcode_query_args', '__give_wpml_total_goal_shortcode_agrs');
445 445
 
446 446
 		// @see https://wpml.org/forums/topic/problem-with-query-filter-in-get_posts-function/#post-271309
447
-		add_action( 'give_totals_goal_shortcode_before_render', '__give_remove_wpml_parse_query_filter', 99 );
448
-		add_action( 'give_totals_goal_shortcode_after_render', '__give_add_wpml_parse_query_filter', 99 );
447
+		add_action('give_totals_goal_shortcode_before_render', '__give_remove_wpml_parse_query_filter', 99);
448
+		add_action('give_totals_goal_shortcode_after_render', '__give_add_wpml_parse_query_filter', 99);
449 449
 	}
450 450
 }
451 451
 
452
-add_action( 'give_init', 'give_add_support_for_wpml', 1000 );
452
+add_action('give_init', 'give_add_support_for_wpml', 1000);
Please login to merge, or discard this patch.
includes/class-give-readme-parser.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @license     https://opensource.org/licenses/gpl-license GNU Public License
9 9
  * @since       2.1.4
10 10
  */
11
-class Give_Readme_Parser{
11
+class Give_Readme_Parser {
12 12
 	/**
13 13
 	 * Readme file url
14 14
 	 *
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @param string $file_url
34 34
 	 */
35
-	function __construct( $file_url ) {
35
+	function __construct($file_url) {
36 36
 		$this->file_url     = $file_url;
37
-		$this->file_content = wp_remote_retrieve_body( wp_remote_get( $this->file_url ) );
37
+		$this->file_content = wp_remote_retrieve_body(wp_remote_get($this->file_url));
38 38
 	}
39 39
 
40 40
 	/**
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public function requires_at_least() {
49 49
 		// Regex to extract Give core minimum version from the readme.txt file.
50
-		preg_match('|Requires Give:(.*)|i', $this->file_content, $_requires_at_least );
50
+		preg_match('|Requires Give:(.*)|i', $this->file_content, $_requires_at_least);
51 51
 
52
-		if( is_array( $_requires_at_least ) && 1 < count( $_requires_at_least ) ) {
53
-			$_requires_at_least = trim( $_requires_at_least[1] );
54
-		}else{
52
+		if (is_array($_requires_at_least) && 1 < count($_requires_at_least)) {
53
+			$_requires_at_least = trim($_requires_at_least[1]);
54
+		} else {
55 55
 			$_requires_at_least = null;
56 56
 		}
57 57
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
 
52 52
 		if( is_array( $_requires_at_least ) && 1 < count( $_requires_at_least ) ) {
53 53
 			$_requires_at_least = trim( $_requires_at_least[1] );
54
-		}else{
54
+		} else{
55 55
 			$_requires_at_least = null;
56 56
 		}
57 57
 
Please login to merge, or discard this patch.