Test Failed
Pull Request — master (#3152)
by Devin
07:21
created
includes/admin/tools/data/tools-actions.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -20,10 +20,10 @@  discard block
 block discarded – undo
20 20
  * @since  1.5
21 21
  */
22 22
 function give_register_batch_recount_export_classes() {
23
-	add_action( 'give_batch_export_class_include', 'give_include_batch_export_class', 10, 1 );
23
+	add_action('give_batch_export_class_include', 'give_include_batch_export_class', 10, 1);
24 24
 }
25 25
 
26
-add_action( 'give_register_batch_exporter', 'give_register_batch_recount_export_classes', 10 );
26
+add_action('give_register_batch_exporter', 'give_register_batch_recount_export_classes', 10);
27 27
 
28 28
 
29 29
 /**
@@ -35,39 +35,39 @@  discard block
 block discarded – undo
35 35
  *
36 36
  * @return void
37 37
  */
38
-function give_include_batch_export_class( $class ) {
39
-	switch ( $class ) {
38
+function give_include_batch_export_class($class) {
39
+	switch ($class) {
40 40
 
41 41
 		case 'Give_Tools_Delete_Donors':
42
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-delete-test-donors.php';
42
+			require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/class-give-tools-delete-test-donors.php';
43 43
 			break;
44 44
 
45 45
 		case 'Give_Tools_Import_Donors':
46
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-delete-import-donors.php';
46
+			require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/class-give-tools-delete-import-donors.php';
47 47
 			break;
48 48
 
49 49
 		case 'Give_Tools_Delete_Test_Transactions':
50
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-delete-test-transactions.php';
50
+			require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/class-give-tools-delete-test-transactions.php';
51 51
 			break;
52 52
 
53 53
 		case 'Give_Tools_Recount_Donor_Stats':
54
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-recount-donor-stats.php';
54
+			require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/class-give-tools-recount-donor-stats.php';
55 55
 			break;
56 56
 
57 57
 		case 'Give_Tools_Reset_Stats':
58
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-reset-stats.php';
58
+			require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/class-give-tools-reset-stats.php';
59 59
 			break;
60 60
 
61 61
 		case 'Give_Tools_Recount_All_Stats':
62
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-recount-all-stats.php';
62
+			require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/class-give-tools-recount-all-stats.php';
63 63
 			break;
64 64
 
65 65
 		case 'Give_Tools_Recount_Form_Stats':
66
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-recount-form-stats.php';
66
+			require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/class-give-tools-recount-form-stats.php';
67 67
 			break;
68 68
 
69 69
 		case 'Give_Tools_Recount_Income':
70
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-recount-income.php';
70
+			require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/class-give-tools-recount-income.php';
71 71
 			break;
72 72
 	}
73 73
 }
Please login to merge, or discard this patch.
includes/payments/class-give-payment.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1012,7 +1012,7 @@
 block discarded – undo
1012 1012
 					// Find a match between price_id and level_id.
1013 1013
 					// First verify array keys exists THEN make the match.
1014 1014
 					if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) )
1015
-					     && $args['price_id'] == $price['_give_id']['level_id']
1015
+						 && $args['price_id'] == $price['_give_id']['level_id']
1016 1016
 					) {
1017 1017
 						$donation_amount = $price['_give_amount'];
1018 1018
 					}
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 	 *
392 392
 	 * @param  int|bool $payment_id A given payment
393 393
 	 *
394
-	 * @return mixed void|false
394
+	 * @return false|null void|false
395 395
 	 */
396 396
 	public function __construct( $payment_id = false ) {
397 397
 
@@ -1115,7 +1115,7 @@  discard block
 block discarded – undo
1115 1115
 	 *
1116 1116
 	 * @param  string|bool $note The note to add
1117 1117
 	 *
1118
-	 * @return bool           If the note was specified or not
1118
+	 * @return false|null           If the note was specified or not
1119 1119
 	 */
1120 1120
 	public function add_note( $note = false ) {
1121 1121
 		// Bail if no note specified.
Please login to merge, or discard this patch.
Spacing   +274 added lines, -275 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
 
@@ -395,13 +395,13 @@  discard block
 block discarded – undo
395 395
 	 *
396 396
 	 * @return mixed void|false
397 397
 	 */
398
-	public function __construct( $payment_id = false ) {
398
+	public function __construct($payment_id = false) {
399 399
 
400
-		if ( empty( $payment_id ) ) {
400
+		if (empty($payment_id)) {
401 401
 			return false;
402 402
 		}
403 403
 
404
-		$this->setup_payment( $payment_id );
404
+		$this->setup_payment($payment_id);
405 405
 	}
406 406
 
407 407
 	/**
@@ -414,11 +414,11 @@  discard block
 block discarded – undo
414 414
 	 *
415 415
 	 * @return mixed        The value.
416 416
 	 */
417
-	public function __get( $key ) {
417
+	public function __get($key) {
418 418
 
419
-		if ( method_exists( $this, 'get_' . $key ) ) {
419
+		if (method_exists($this, 'get_'.$key)) {
420 420
 
421
-			$value = call_user_func( array( $this, 'get_' . $key ) );
421
+			$value = call_user_func(array($this, 'get_'.$key));
422 422
 
423 423
 		} else {
424 424
 
@@ -440,18 +440,18 @@  discard block
 block discarded – undo
440 440
 	 * @param  string $key   The property name
441 441
 	 * @param  mixed  $value The value of the property
442 442
 	 */
443
-	public function __set( $key, $value ) {
444
-		$ignore = array( '_ID' );
443
+	public function __set($key, $value) {
444
+		$ignore = array('_ID');
445 445
 
446
-		if ( 'status' === $key ) {
446
+		if ('status' === $key) {
447 447
 			$this->old_status = $this->status;
448 448
 		}
449 449
 
450
-		if ( ! in_array( $key, $ignore ) ) {
451
-			$this->pending[ $key ] = $value;
450
+		if ( ! in_array($key, $ignore)) {
451
+			$this->pending[$key] = $value;
452 452
 		}
453 453
 
454
-		if ( '_ID' !== $key ) {
454
+		if ('_ID' !== $key) {
455 455
 			$this->$key = $value;
456 456
 		}
457 457
 	}
@@ -466,9 +466,9 @@  discard block
 block discarded – undo
466 466
 	 *
467 467
 	 * @return boolean|null       If the item is set or not
468 468
 	 */
469
-	public function __isset( $name ) {
470
-		if ( property_exists( $this, $name ) ) {
471
-			return false === empty( $this->$name );
469
+	public function __isset($name) {
470
+		if (property_exists($this, $name)) {
471
+			return false === empty($this->$name);
472 472
 		} else {
473 473
 			return null;
474 474
 		}
@@ -484,20 +484,20 @@  discard block
 block discarded – undo
484 484
 	 *
485 485
 	 * @return bool            If the setup was successful or not
486 486
 	 */
487
-	private function setup_payment( $payment_id ) {
487
+	private function setup_payment($payment_id) {
488 488
 		$this->pending = array();
489 489
 
490
-		if ( empty( $payment_id ) ) {
490
+		if (empty($payment_id)) {
491 491
 			return false;
492 492
 		}
493 493
 
494
-		$payment = get_post( absint( $payment_id ) );
494
+		$payment = get_post(absint($payment_id));
495 495
 
496
-		if ( ! $payment || is_wp_error( $payment ) ) {
496
+		if ( ! $payment || is_wp_error($payment)) {
497 497
 			return false;
498 498
 		}
499 499
 
500
-		if ( 'give_payment' !== $payment->post_type ) {
500
+		if ('give_payment' !== $payment->post_type) {
501 501
 			return false;
502 502
 		}
503 503
 
@@ -511,17 +511,17 @@  discard block
 block discarded – undo
511 511
 		 * @param Give_Payment $this       Payment object.
512 512
 		 * @param int          $payment_id The ID of the payment.
513 513
 		 */
514
-		do_action( 'give_pre_setup_payment', $this, $payment_id );
514
+		do_action('give_pre_setup_payment', $this, $payment_id);
515 515
 
516 516
 		// Get payment from cache.
517
-		$donation_vars = Give_Cache::get_group( $payment_id, 'give-donations' );
517
+		$donation_vars = Give_Cache::get_group($payment_id, 'give-donations');
518 518
 
519
-		if ( is_null( $donation_vars ) ) {
519
+		if (is_null($donation_vars)) {
520 520
 			// Primary Identifier.
521
-			$this->ID = absint( $payment_id );
521
+			$this->ID = absint($payment_id);
522 522
 
523 523
 			// Protected ID that can never be changed.
524
-			$this->_ID = absint( $payment_id );
524
+			$this->_ID = absint($payment_id);
525 525
 
526 526
 			// We have a payment, get the generic payment_meta item to reduce calls to it.
527 527
 			$this->payment_meta = $this->get_meta();
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 			$this->parent_payment = $payment->post_parent;
538 538
 
539 539
 			$all_payment_statuses  = give_get_payment_statuses();
540
-			$this->status_nicename = array_key_exists( $this->status, $all_payment_statuses ) ? $all_payment_statuses[ $this->status ] : ucfirst( $this->status );
540
+			$this->status_nicename = array_key_exists($this->status, $all_payment_statuses) ? $all_payment_statuses[$this->status] : ucfirst($this->status);
541 541
 
542 542
 			// Currency Based.
543 543
 			$this->total    = $this->setup_total();
@@ -566,10 +566,10 @@  discard block
 block discarded – undo
566 566
 			$this->key        = $this->setup_payment_key();
567 567
 			$this->number     = $this->setup_payment_number();
568 568
 
569
-			Give_Cache::set_group( $this->ID, get_object_vars( $this ), 'give-donations' );
569
+			Give_Cache::set_group($this->ID, get_object_vars($this), 'give-donations');
570 570
 		} else {
571 571
 
572
-			foreach ( $donation_vars as $donation_var => $value ) {
572
+			foreach ($donation_vars as $donation_var => $value) {
573 573
 				$this->$donation_var = $value;
574 574
 			}
575 575
 		}
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 		 * @param Give_Payment $this       Payment object.
585 585
 		 * @param int          $payment_id The ID of the payment.
586 586
 		 */
587
-		do_action( 'give_setup_payment', $this, $payment_id );
587
+		do_action('give_setup_payment', $this, $payment_id);
588 588
 
589 589
 		return true;
590 590
 	}
@@ -603,11 +603,11 @@  discard block
 block discarded – undo
603 603
 	 *
604 604
 	 * @return void
605 605
 	 */
606
-	public function update_payment_setup( $payment_id ) {
606
+	public function update_payment_setup($payment_id) {
607 607
 		// Delete cache.
608
-		Give_Cache::delete_group( $this->ID,'give-donations' );
608
+		Give_Cache::delete_group($this->ID, 'give-donations');
609 609
 
610
-		$this->setup_payment( $payment_id );
610
+		$this->setup_payment($payment_id);
611 611
 	}
612 612
 
613 613
 	/**
@@ -622,24 +622,24 @@  discard block
 block discarded – undo
622 622
 
623 623
 		// Construct the payment title.
624 624
 		$payment_title = '';
625
-		if ( ! empty( $this->first_name ) && ! empty( $this->last_name ) ) {
626
-			$payment_title = $this->first_name . ' ' . $this->last_name;
627
-		} elseif ( ! empty( $this->first_name ) && empty( $this->last_name ) ) {
625
+		if ( ! empty($this->first_name) && ! empty($this->last_name)) {
626
+			$payment_title = $this->first_name.' '.$this->last_name;
627
+		} elseif ( ! empty($this->first_name) && empty($this->last_name)) {
628 628
 			$payment_title = $this->first_name;
629
-		} elseif ( ! empty( $this->email ) && is_email( $this->email ) ) {
629
+		} elseif ( ! empty($this->email) && is_email($this->email)) {
630 630
 			$payment_title = $this->email;
631 631
 		}
632 632
 
633 633
 		// Set Key.
634
-		if ( empty( $this->key ) ) {
634
+		if (empty($this->key)) {
635 635
 
636
-			$auth_key             = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
637
-			$this->key            = strtolower( md5( $this->email . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );  // Unique key
636
+			$auth_key             = defined('AUTH_KEY') ? AUTH_KEY : '';
637
+			$this->key            = strtolower(md5($this->email.date('Y-m-d H:i:s').$auth_key.uniqid('give', true))); // Unique key
638 638
 			$this->pending['key'] = $this->key;
639 639
 		}
640 640
 
641 641
 		// Set IP.
642
-		if ( empty( $this->ip ) ) {
642
+		if (empty($this->ip)) {
643 643
 
644 644
 			$this->ip            = give_get_ip();
645 645
 			$this->pending['ip'] = $this->ip;
@@ -668,19 +668,19 @@  discard block
 block discarded – undo
668 668
 			'status'       => $this->status,
669 669
 		);
670 670
 
671
-		$args = apply_filters( 'give_insert_payment_args', array(
671
+		$args = apply_filters('give_insert_payment_args', array(
672 672
 			'post_title'    => $payment_title,
673 673
 			'post_status'   => $this->status,
674 674
 			'post_type'     => 'give_payment',
675
-			'post_date'     => ! empty( $this->date ) ? $this->date : null,
676
-			'post_date_gmt' => ! empty( $this->date ) ? get_gmt_from_date( $this->date ) : null,
675
+			'post_date'     => ! empty($this->date) ? $this->date : null,
676
+			'post_date_gmt' => ! empty($this->date) ? get_gmt_from_date($this->date) : null,
677 677
 			'post_parent'   => $this->parent_payment,
678
-		), $payment_data );
678
+		), $payment_data);
679 679
 
680 680
 		// Create a blank payment
681
-		$payment_id = wp_insert_post( $args );
681
+		$payment_id = wp_insert_post($args);
682 682
 
683
-		if ( ! empty( $payment_id ) ) {
683
+		if ( ! empty($payment_id)) {
684 684
 
685 685
 			$this->ID  = $payment_id;
686 686
 			$this->_ID = $payment_id;
@@ -692,42 +692,42 @@  discard block
 block discarded – undo
692 692
 			 *
693 693
 			 * @since 1.8.13
694 694
 			 */
695
-			$donor = apply_filters( 'give_update_donor_information', $donor, $payment_id, $payment_data, $args );
695
+			$donor = apply_filters('give_update_donor_information', $donor, $payment_id, $payment_data, $args);
696 696
 
697
-			if ( did_action( 'give_pre_process_donation' ) && is_user_logged_in() ) {
698
-				$donor = new Give_Donor( get_current_user_id(), true );
697
+			if (did_action('give_pre_process_donation') && is_user_logged_in()) {
698
+				$donor = new Give_Donor(get_current_user_id(), true);
699 699
 
700 700
 				// Donor is logged in but used a different email to purchase with so assign to their donor record.
701
-				if ( ! empty( $donor->id ) && $this->email !== $donor->email ) {
702
-					$donor->add_email( $this->email );
701
+				if ( ! empty($donor->id) && $this->email !== $donor->email) {
702
+					$donor->add_email($this->email);
703 703
 				}
704 704
 			}
705 705
 
706
-			if ( empty( $donor->id ) ) {
707
-				$donor = new Give_Donor( $this->email );
706
+			if (empty($donor->id)) {
707
+				$donor = new Give_Donor($this->email);
708 708
 			}
709 709
 
710
-			if ( empty( $donor->id ) ) {
710
+			if (empty($donor->id)) {
711 711
 
712 712
 				$donor_data = array(
713
-					'name'    => ! is_email( $payment_title ) ? $this->first_name . ' ' . $this->last_name : '',
713
+					'name'    => ! is_email($payment_title) ? $this->first_name.' '.$this->last_name : '',
714 714
 					'email'   => $this->email,
715 715
 					'user_id' => $this->user_id,
716 716
 				);
717 717
 
718
-				$donor->create( $donor_data );
718
+				$donor->create($donor_data);
719 719
 
720 720
 			}
721 721
 
722 722
 			// Update Donor Meta once donor is created.
723
-			$donor->update_meta( '_give_donor_first_name', $this->first_name );
724
-			$donor->update_meta( '_give_donor_last_name', $this->last_name );
723
+			$donor->update_meta('_give_donor_first_name', $this->first_name);
724
+			$donor->update_meta('_give_donor_last_name', $this->last_name);
725 725
 
726 726
 			$this->customer_id            = $donor->id;
727 727
 			$this->pending['customer_id'] = $this->customer_id;
728
-			$donor->attach_payment( $this->ID, false );
728
+			$donor->attach_payment($this->ID, false);
729 729
 
730
-			$this->payment_meta = apply_filters( 'give_payment_meta', $this->payment_meta, $payment_data );
730
+			$this->payment_meta = apply_filters('give_payment_meta', $this->payment_meta, $payment_data);
731 731
 
732 732
 			/*
733 733
 			 * _give_payment_meta backward compatibility.
@@ -735,25 +735,25 @@  discard block
 block discarded – undo
735 735
 			 * @since 2.0.1
736 736
 			 */
737 737
 			$custom_payment_meta = array_diff(
738
-				array_map( 'maybe_serialize', $this->payment_meta ),
739
-				array_map( 'maybe_serialize', $payment_data )
738
+				array_map('maybe_serialize', $this->payment_meta),
739
+				array_map('maybe_serialize', $payment_data)
740 740
 			);
741 741
 
742
-			if( ! empty( $custom_payment_meta ) ) {
743
-				give_doing_it_wrong( '_give_payment_meta', __( 'This custom meta key deprecated. We are not using this meta key for storing payment meta but your custom meta data will be store because we added backward compatibility. Please change your logic because in future we can remove it.', 'give' ), '2.0.0' );
742
+			if ( ! empty($custom_payment_meta)) {
743
+				give_doing_it_wrong('_give_payment_meta', __('This custom meta key deprecated. We are not using this meta key for storing payment meta but your custom meta data will be store because we added backward compatibility. Please change your logic because in future we can remove it.', 'give'), '2.0.0');
744 744
 
745
-				$this->update_meta( '_give_payment_meta', array_map( 'maybe_unserialize', $custom_payment_meta ) );
745
+				$this->update_meta('_give_payment_meta', array_map('maybe_unserialize', $custom_payment_meta));
746 746
 			}
747 747
 
748
-			$give_company = ( ! empty( $_REQUEST['give_company_name'] ) ? give_clean( $_REQUEST['give_company_name'] ) : '' );
748
+			$give_company = ( ! empty($_REQUEST['give_company_name']) ? give_clean($_REQUEST['give_company_name']) : '');
749 749
 
750 750
 			// Check $page_url is not empty.
751
-			if ( $give_company ) {
752
-				give_update_meta( $payment_id, '_give_donation_company', $give_company );
751
+			if ($give_company) {
752
+				give_update_meta($payment_id, '_give_donation_company', $give_company);
753 753
 
754
-				$donor_id = absint( $donor->id );
755
-				if ( ! empty( $donor_id ) ) {
756
-					Give()->donor_meta->update_meta( $donor_id, '_give_donor_company', $give_company );
754
+				$donor_id = absint($donor->id);
755
+				if ( ! empty($donor_id)) {
756
+					Give()->donor_meta->update_meta($donor_id, '_give_donor_company', $give_company);
757 757
 				}
758 758
 			}
759 759
 
@@ -777,11 +777,11 @@  discard block
 block discarded – undo
777 777
 		$saved = false;
778 778
 
779 779
 		// Must have an ID.
780
-		if ( empty( $this->ID ) ) {
780
+		if (empty($this->ID)) {
781 781
 
782 782
 			$payment_id = $this->insert_payment();
783 783
 
784
-			if ( false === $payment_id ) {
784
+			if (false === $payment_id) {
785 785
 				$saved = false;
786 786
 			} else {
787 787
 				$this->ID = $payment_id;
@@ -789,42 +789,42 @@  discard block
 block discarded – undo
789 789
 		}
790 790
 
791 791
 		// Set ID if not matching.
792
-		if ( $this->ID !== $this->_ID ) {
792
+		if ($this->ID !== $this->_ID) {
793 793
 			$this->ID = $this->_ID;
794 794
 		}
795 795
 
796 796
 		// If we have something pending, let's save it.
797
-		if ( ! empty( $this->pending ) ) {
797
+		if ( ! empty($this->pending)) {
798 798
 
799 799
 			$total_increase = 0;
800 800
 			$total_decrease = 0;
801 801
 
802
-			foreach ( $this->pending as $key => $value ) {
802
+			foreach ($this->pending as $key => $value) {
803 803
 
804
-				switch ( $key ) {
804
+				switch ($key) {
805 805
 
806 806
 					case 'donations':
807 807
 						// Update totals for pending donations.
808
-						foreach ( $this->pending[ $key ] as $item ) {
808
+						foreach ($this->pending[$key] as $item) {
809 809
 
810
-							$quantity = isset( $item['quantity'] ) ? $item['quantity'] : 1;
811
-							$price_id = isset( $item['price_id'] ) ? $item['price_id'] : 0;
810
+							$quantity = isset($item['quantity']) ? $item['quantity'] : 1;
811
+							$price_id = isset($item['price_id']) ? $item['price_id'] : 0;
812 812
 
813
-							switch ( $item['action'] ) {
813
+							switch ($item['action']) {
814 814
 
815 815
 								case 'add':
816 816
 
817 817
 									$price = $item['price'];
818 818
 
819
-									if ( 'publish' === $this->status || 'complete' === $this->status ) {
819
+									if ('publish' === $this->status || 'complete' === $this->status) {
820 820
 
821 821
 										// Add donation to logs.
822
-										$log_date = date_i18n( 'Y-m-d G:i:s', current_time( 'timestamp' ) );
823
-										give_record_donation_in_log( $item['id'], $this->ID, $price_id, $log_date );
822
+										$log_date = date_i18n('Y-m-d G:i:s', current_time('timestamp'));
823
+										give_record_donation_in_log($item['id'], $this->ID, $price_id, $log_date);
824 824
 
825
-										$form = new Give_Donate_Form( $item['id'] );
826
-										$form->increase_sales( $quantity );
827
-										$form->increase_earnings( $price, $this->ID );
825
+										$form = new Give_Donate_Form($item['id']);
826
+										$form->increase_sales($quantity);
827
+										$form->increase_earnings($price, $this->ID);
828 828
 
829 829
 										$total_increase += $price;
830 830
 									}
@@ -832,10 +832,10 @@  discard block
 block discarded – undo
832 832
 
833 833
 								case 'remove':
834 834
 									$this->delete_sales_logs();
835
-									if ( 'publish' === $this->status || 'complete' === $this->status ) {
836
-										$form = new Give_Donate_Form( $item['id'] );
837
-										$form->decrease_sales( $quantity );
838
-										$form->decrease_earnings( $item['amount'], $this->ID );
835
+									if ('publish' === $this->status || 'complete' === $this->status) {
836
+										$form = new Give_Donate_Form($item['id']);
837
+										$form->decrease_sales($quantity);
838
+										$form->decrease_earnings($item['amount'], $this->ID);
839 839
 
840 840
 										$total_decrease += $item['amount'];
841 841
 									}
@@ -846,27 +846,27 @@  discard block
 block discarded – undo
846 846
 						break;
847 847
 
848 848
 					case 'status':
849
-						$this->update_status( $this->status );
849
+						$this->update_status($this->status);
850 850
 						break;
851 851
 
852 852
 					case 'gateway':
853
-						$this->update_meta( '_give_payment_gateway', $this->gateway );
853
+						$this->update_meta('_give_payment_gateway', $this->gateway);
854 854
 						break;
855 855
 
856 856
 					case 'mode':
857
-						$this->update_meta( '_give_payment_mode', $this->mode );
857
+						$this->update_meta('_give_payment_mode', $this->mode);
858 858
 						break;
859 859
 
860 860
 					case 'transaction_id':
861
-						$this->update_meta( '_give_payment_transaction_id', $this->transaction_id );
861
+						$this->update_meta('_give_payment_transaction_id', $this->transaction_id);
862 862
 						break;
863 863
 
864 864
 					case 'ip':
865
-						$this->update_meta( '_give_payment_donor_ip', $this->ip );
865
+						$this->update_meta('_give_payment_donor_ip', $this->ip);
866 866
 						break;
867 867
 
868 868
 					case 'customer_id':
869
-						$this->update_meta( '_give_payment_donor_id', $this->customer_id );
869
+						$this->update_meta('_give_payment_donor_id', $this->customer_id);
870 870
 						break;
871 871
 
872 872
 					// case 'user_id':
@@ -874,61 +874,61 @@  discard block
 block discarded – undo
874 874
 					// 	break;
875 875
 
876 876
 					case 'form_title':
877
-						$this->update_meta( '_give_payment_form_title', $this->form_title );
877
+						$this->update_meta('_give_payment_form_title', $this->form_title);
878 878
 						break;
879 879
 
880 880
 					case 'form_id':
881
-						$this->update_meta( '_give_payment_form_id', $this->form_id );
881
+						$this->update_meta('_give_payment_form_id', $this->form_id);
882 882
 						break;
883 883
 
884 884
 					case 'price_id':
885
-						$this->update_meta( '_give_payment_price_id', $this->price_id );
885
+						$this->update_meta('_give_payment_price_id', $this->price_id);
886 886
 						break;
887 887
 
888 888
 					case 'first_name':
889
-						$this->update_meta( '_give_donor_billing_first_name', $this->first_name );
889
+						$this->update_meta('_give_donor_billing_first_name', $this->first_name);
890 890
 						break;
891 891
 
892 892
 					case 'last_name':
893
-						$this->update_meta( '_give_donor_billing_last_name', $this->last_name );
893
+						$this->update_meta('_give_donor_billing_last_name', $this->last_name);
894 894
 						break;
895 895
 
896 896
 					case 'currency':
897
-						$this->update_meta( '_give_payment_currency', $this->currency );
897
+						$this->update_meta('_give_payment_currency', $this->currency);
898 898
 						break;
899 899
 
900 900
 					case 'address':
901
-						if ( ! empty( $this->address ) ) {
902
-							foreach ( $this->address as $address_name => $address ) {
903
-								switch ( $address_name ) {
901
+						if ( ! empty($this->address)) {
902
+							foreach ($this->address as $address_name => $address) {
903
+								switch ($address_name) {
904 904
 									case 'line1':
905
-										$this->update_meta( '_give_donor_billing_address1', $address );
905
+										$this->update_meta('_give_donor_billing_address1', $address);
906 906
 										break;
907 907
 
908 908
 									case 'line2':
909
-										$this->update_meta( '_give_donor_billing_address2', $address );
909
+										$this->update_meta('_give_donor_billing_address2', $address);
910 910
 										break;
911 911
 
912 912
 									default:
913
-										$this->update_meta( "_give_donor_billing_{$address_name}", $address );
913
+										$this->update_meta("_give_donor_billing_{$address_name}", $address);
914 914
 								}
915 915
 							}
916 916
 						}
917 917
 						break;
918 918
 
919 919
 					case 'email':
920
-						$this->update_meta( '_give_payment_donor_email', $this->email );
920
+						$this->update_meta('_give_payment_donor_email', $this->email);
921 921
 						break;
922 922
 
923 923
 					case 'key':
924
-						$this->update_meta( '_give_payment_purchase_key', $this->key );
924
+						$this->update_meta('_give_payment_purchase_key', $this->key);
925 925
 						break;
926 926
 
927 927
 					case 'number':
928 928
 						// @todo: remove unused meta data.
929 929
 						// Core is using post_title to store donation serial code ( fi enabled ) instead this meta key.
930 930
 						// Do not use this meta key in your logic, can be remove in future
931
-						$this->update_meta( '_give_payment_number', $this->number );
931
+						$this->update_meta('_give_payment_number', $this->number);
932 932
 						break;
933 933
 
934 934
 					case 'date':
@@ -938,11 +938,11 @@  discard block
 block discarded – undo
938 938
 							'edit_date' => true,
939 939
 						);
940 940
 
941
-						wp_update_post( $args );
941
+						wp_update_post($args);
942 942
 						break;
943 943
 
944 944
 					case 'completed_date':
945
-						$this->update_meta( '_give_completed_date', $this->completed_date );
945
+						$this->update_meta('_give_completed_date', $this->completed_date);
946 946
 						break;
947 947
 
948 948
 					case 'parent_payment':
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 							'post_parent' => $this->parent_payment,
952 952
 						);
953 953
 
954
-						wp_update_post( $args );
954
+						wp_update_post($args);
955 955
 						break;
956 956
 
957 957
 					default:
@@ -962,49 +962,49 @@  discard block
 block discarded – undo
962 962
 						 *
963 963
 						 * @param Give_Payment $this Payment object.
964 964
 						 */
965
-						do_action( 'give_payment_save', $this, $key );
965
+						do_action('give_payment_save', $this, $key);
966 966
 						break;
967 967
 				}// End switch().
968 968
 			}// End foreach().
969 969
 
970
-			if ( 'pending' !== $this->status ) {
970
+			if ('pending' !== $this->status) {
971 971
 
972
-				$donor = new Give_Donor( $this->customer_id );
972
+				$donor = new Give_Donor($this->customer_id);
973 973
 
974 974
 				$total_change = $total_increase - $total_decrease;
975
-				if ( $total_change < 0 ) {
975
+				if ($total_change < 0) {
976 976
 
977
-					$total_change = - ( $total_change );
977
+					$total_change = - ($total_change);
978 978
 
979 979
 					// Decrease the donor's donation stats.
980
-					$donor->decrease_value( $total_change );
981
-					give_decrease_total_earnings( $total_change );
980
+					$donor->decrease_value($total_change);
981
+					give_decrease_total_earnings($total_change);
982 982
 
983 983
 					$donor->decrease_donation_count();
984 984
 
985
-				} elseif ( $total_change > 0 ) {
985
+				} elseif ($total_change > 0) {
986 986
 
987 987
 					// Increase the donor's donation stats.
988
-					$donor->increase_value( $total_change );
989
-					give_increase_total_earnings( $total_change );
988
+					$donor->increase_value($total_change);
989
+					give_increase_total_earnings($total_change);
990 990
 
991 991
 					$donor->increase_purchase_count();
992 992
 
993 993
 				}
994 994
 
995 995
 				// Verify and update form meta based on the form status.
996
-				give_set_form_closed_status( $this->form_id );
996
+				give_set_form_closed_status($this->form_id);
997 997
 
998 998
 			}
999 999
 
1000
-			$this->update_meta( '_give_payment_total', give_sanitize_amount_for_db( $this->total ) );
1000
+			$this->update_meta('_give_payment_total', give_sanitize_amount_for_db($this->total));
1001 1001
 
1002 1002
 			$this->pending = array();
1003 1003
 			$saved         = true;
1004 1004
 		}// End if().
1005 1005
 
1006
-		if ( true === $saved ) {
1007
-			$this->setup_payment( $this->ID );
1006
+		if (true === $saved) {
1007
+			$this->setup_payment($this->ID);
1008 1008
 		}
1009 1009
 
1010 1010
 		return $saved;
@@ -1022,12 +1022,12 @@  discard block
 block discarded – undo
1022 1022
 	 *
1023 1023
 	 * @return bool           True when successful, false otherwise
1024 1024
 	 */
1025
-	public function add_donation( $form_id = 0, $args = array(), $options = array() ) {
1025
+	public function add_donation($form_id = 0, $args = array(), $options = array()) {
1026 1026
 
1027
-		$donation = new Give_Donate_Form( $form_id );
1027
+		$donation = new Give_Donate_Form($form_id);
1028 1028
 
1029 1029
 		// Bail if this post isn't a give donation form.
1030
-		if ( ! $donation || $donation->post_type !== 'give_forms' ) {
1030
+		if ( ! $donation || $donation->post_type !== 'give_forms') {
1031 1031
 			return false;
1032 1032
 		}
1033 1033
 
@@ -1037,59 +1037,59 @@  discard block
 block discarded – undo
1037 1037
 			'price_id' => false,
1038 1038
 		);
1039 1039
 
1040
-		$args = wp_parse_args( apply_filters( 'give_payment_add_donation_args', $args, $donation->ID ), $defaults );
1040
+		$args = wp_parse_args(apply_filters('give_payment_add_donation_args', $args, $donation->ID), $defaults);
1041 1041
 
1042 1042
 		// Allow overriding the price.
1043
-		if ( false !== $args['price'] ) {
1043
+		if (false !== $args['price']) {
1044 1044
 			$donation_amount = $args['price'];
1045 1045
 		} else {
1046 1046
 
1047 1047
 			// Deal with variable pricing.
1048
-			if ( give_has_variable_prices( $donation->ID ) ) {
1049
-				$prices          = give_get_meta( $form_id, '_give_donation_levels', true );
1048
+			if (give_has_variable_prices($donation->ID)) {
1049
+				$prices          = give_get_meta($form_id, '_give_donation_levels', true);
1050 1050
 				$donation_amount = '';
1051 1051
 				// Loop through prices.
1052
-				foreach ( $prices as $price ) {
1052
+				foreach ($prices as $price) {
1053 1053
 					// Find a match between price_id and level_id.
1054 1054
 					// First verify array keys exists THEN make the match.
1055
-					if ( ( isset( $args['price_id'] ) && isset( $price['_give_id']['level_id'] ) )
1055
+					if ((isset($args['price_id']) && isset($price['_give_id']['level_id']))
1056 1056
 					     && $args['price_id'] == $price['_give_id']['level_id']
1057 1057
 					) {
1058 1058
 						$donation_amount = $price['_give_amount'];
1059 1059
 					}
1060 1060
 				}
1061 1061
 				// Fallback to the lowest price point.
1062
-				if ( $donation_amount == '' ) {
1063
-					$donation_amount  = give_get_lowest_price_option( $donation->ID );
1064
-					$args['price_id'] = give_get_lowest_price_id( $donation->ID );
1062
+				if ($donation_amount == '') {
1063
+					$donation_amount  = give_get_lowest_price_option($donation->ID);
1064
+					$args['price_id'] = give_get_lowest_price_id($donation->ID);
1065 1065
 				}
1066 1066
 			} else {
1067 1067
 				// Simple form price.
1068
-				$donation_amount = give_get_form_price( $donation->ID );
1068
+				$donation_amount = give_get_form_price($donation->ID);
1069 1069
 			}
1070 1070
 		}
1071 1071
 
1072 1072
 		// Sanitizing the price here so we don't have a dozen calls later.
1073
-		$donation_amount = give_maybe_sanitize_amount( $donation_amount );
1074
-		$total           = round( $donation_amount, give_get_price_decimals( $this->ID ) );
1073
+		$donation_amount = give_maybe_sanitize_amount($donation_amount);
1074
+		$total           = round($donation_amount, give_get_price_decimals($this->ID));
1075 1075
 
1076 1076
 		// Add Options.
1077 1077
 		$default_options = array();
1078
-		if ( false !== $args['price_id'] ) {
1078
+		if (false !== $args['price_id']) {
1079 1079
 			$default_options['price_id'] = (int) $args['price_id'];
1080 1080
 		}
1081
-		$options = wp_parse_args( $options, $default_options );
1081
+		$options = wp_parse_args($options, $default_options);
1082 1082
 
1083 1083
 		// Do not allow totals to go negative.
1084
-		if ( $total < 0 ) {
1084
+		if ($total < 0) {
1085 1085
 			$total = 0;
1086 1086
 		}
1087 1087
 
1088 1088
 		$donation = array(
1089 1089
 			'name'     => $donation->post_title,
1090 1090
 			'id'       => $donation->ID,
1091
-			'price'    => round( $total, give_get_price_decimals( $this->ID ) ),
1092
-			'subtotal' => round( $total, give_get_price_decimals( $this->ID ) ),
1091
+			'price'    => round($total, give_get_price_decimals($this->ID)),
1092
+			'subtotal' => round($total, give_get_price_decimals($this->ID)),
1093 1093
 			'price_id' => $args['price_id'],
1094 1094
 			'action'   => 'add',
1095 1095
 			'options'  => $options,
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
 
1098 1098
 		$this->pending['donations'][] = $donation;
1099 1099
 
1100
-		$this->increase_subtotal( $total );
1100
+		$this->increase_subtotal($total);
1101 1101
 
1102 1102
 		return true;
1103 1103
 
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
 	 *
1115 1115
 	 * @return bool           If the item was removed or not
1116 1116
 	 */
1117
-	public function remove_donation( $form_id, $args = array() ) {
1117
+	public function remove_donation($form_id, $args = array()) {
1118 1118
 
1119 1119
 		// Set some defaults.
1120 1120
 		$defaults = array(
@@ -1122,12 +1122,12 @@  discard block
 block discarded – undo
1122 1122
 			'price'    => false,
1123 1123
 			'price_id' => false,
1124 1124
 		);
1125
-		$args     = wp_parse_args( $args, $defaults );
1125
+		$args = wp_parse_args($args, $defaults);
1126 1126
 
1127
-		$form = new Give_Donate_Form( $form_id );
1127
+		$form = new Give_Donate_Form($form_id);
1128 1128
 
1129 1129
 		// Bail if this post isn't a valid give donation form.
1130
-		if ( ! $form || $form->post_type !== 'give_forms' ) {
1130
+		if ( ! $form || $form->post_type !== 'give_forms') {
1131 1131
 			return false;
1132 1132
 		}
1133 1133
 
@@ -1140,7 +1140,7 @@  discard block
 block discarded – undo
1140 1140
 
1141 1141
 		$this->pending['donations'][] = $pending_args;
1142 1142
 
1143
-		$this->decrease_subtotal( $this->total );
1143
+		$this->decrease_subtotal($this->total);
1144 1144
 
1145 1145
 		return true;
1146 1146
 	}
@@ -1156,13 +1156,13 @@  discard block
 block discarded – undo
1156 1156
 	 *
1157 1157
 	 * @return bool           If the note was specified or not
1158 1158
 	 */
1159
-	public function add_note( $note = false ) {
1159
+	public function add_note($note = false) {
1160 1160
 		// Bail if no note specified.
1161
-		if ( ! $note ) {
1161
+		if ( ! $note) {
1162 1162
 			return false;
1163 1163
 		}
1164 1164
 
1165
-		give_insert_payment_note( $this->ID, $note );
1165
+		give_insert_payment_note($this->ID, $note);
1166 1166
 	}
1167 1167
 
1168 1168
 	/**
@@ -1175,8 +1175,8 @@  discard block
 block discarded – undo
1175 1175
 	 *
1176 1176
 	 * @return void
1177 1177
 	 */
1178
-	private function increase_subtotal( $amount = 0.00 ) {
1179
-		$amount         = (float) $amount;
1178
+	private function increase_subtotal($amount = 0.00) {
1179
+		$amount = (float) $amount;
1180 1180
 		$this->subtotal += $amount;
1181 1181
 
1182 1182
 		$this->recalculate_total();
@@ -1192,11 +1192,11 @@  discard block
 block discarded – undo
1192 1192
 	 *
1193 1193
 	 * @return void
1194 1194
 	 */
1195
-	private function decrease_subtotal( $amount = 0.00 ) {
1196
-		$amount         = (float) $amount;
1195
+	private function decrease_subtotal($amount = 0.00) {
1196
+		$amount = (float) $amount;
1197 1197
 		$this->subtotal -= $amount;
1198 1198
 
1199
-		if ( $this->subtotal < 0 ) {
1199
+		if ($this->subtotal < 0) {
1200 1200
 			$this->subtotal = 0;
1201 1201
 		}
1202 1202
 
@@ -1225,24 +1225,24 @@  discard block
 block discarded – undo
1225 1225
 	 *
1226 1226
 	 * @return bool   $updated Returns if the status was successfully updated.
1227 1227
 	 */
1228
-	public function update_status( $status = false ) {
1228
+	public function update_status($status = false) {
1229 1229
 
1230 1230
 		// standardize the 'complete(d)' status.
1231
-		if ( $status == 'completed' || $status == 'complete' ) {
1231
+		if ($status == 'completed' || $status == 'complete') {
1232 1232
 			$status = 'publish';
1233 1233
 		}
1234 1234
 
1235
-		$old_status = ! empty( $this->old_status ) ? $this->old_status : false;
1235
+		$old_status = ! empty($this->old_status) ? $this->old_status : false;
1236 1236
 
1237
-		if ( $old_status === $status ) {
1237
+		if ($old_status === $status) {
1238 1238
 			return false; // Don't permit status changes that aren't changes.
1239 1239
 		}
1240 1240
 
1241
-		$do_change = apply_filters( 'give_should_update_payment_status', true, $this->ID, $status, $old_status );
1241
+		$do_change = apply_filters('give_should_update_payment_status', true, $this->ID, $status, $old_status);
1242 1242
 
1243 1243
 		$updated = false;
1244 1244
 
1245
-		if ( $do_change ) {
1245
+		if ($do_change) {
1246 1246
 
1247 1247
 			/**
1248 1248
 			 * Fires before changing payment status.
@@ -1253,21 +1253,21 @@  discard block
 block discarded – undo
1253 1253
 			 * @param string $status     The new status.
1254 1254
 			 * @param string $old_status The old status.
1255 1255
 			 */
1256
-			do_action( 'give_before_payment_status_change', $this->ID, $status, $old_status );
1256
+			do_action('give_before_payment_status_change', $this->ID, $status, $old_status);
1257 1257
 
1258 1258
 			$update_fields = array(
1259 1259
 				'ID'          => $this->ID,
1260 1260
 				'post_status' => $status,
1261
-				'edit_date'   => current_time( 'mysql' ),
1261
+				'edit_date'   => current_time('mysql'),
1262 1262
 			);
1263 1263
 
1264
-			$updated = wp_update_post( apply_filters( 'give_update_payment_status_fields', $update_fields ) );
1264
+			$updated = wp_update_post(apply_filters('give_update_payment_status_fields', $update_fields));
1265 1265
 
1266 1266
 			$all_payment_statuses  = give_get_payment_statuses();
1267
-			$this->status_nicename = array_key_exists( $status, $all_payment_statuses ) ? $all_payment_statuses[ $status ] : ucfirst( $status );
1267
+			$this->status_nicename = array_key_exists($status, $all_payment_statuses) ? $all_payment_statuses[$status] : ucfirst($status);
1268 1268
 
1269 1269
 			// Process any specific status functions.
1270
-			$this->process_status( $status );
1270
+			$this->process_status($status);
1271 1271
 
1272 1272
 			/**
1273 1273
 			 * Fires after changing payment status.
@@ -1278,7 +1278,7 @@  discard block
 block discarded – undo
1278 1278
 			 * @param string $status     The new status.
1279 1279
 			 * @param string $old_status The old status.
1280 1280
 			 */
1281
-			do_action( 'give_update_payment_status', $this->ID, $status, $old_status );
1281
+			do_action('give_update_payment_status', $this->ID, $status, $old_status);
1282 1282
 
1283 1283
 		}// End if().
1284 1284
 
@@ -1313,24 +1313,24 @@  discard block
 block discarded – undo
1313 1313
 	 *
1314 1314
 	 * @return mixed             The value from the post meta
1315 1315
 	 */
1316
-	public function get_meta( $meta_key = '_give_payment_meta', $single = true ) {
1317
-		if( ! has_filter( 'get_post_metadata', 'give_bc_v20_get_payment_meta' ) && ! doing_filter( 'get_post_metadata' ) ) {
1318
-			add_filter( 'get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4 );
1316
+	public function get_meta($meta_key = '_give_payment_meta', $single = true) {
1317
+		if ( ! has_filter('get_post_metadata', 'give_bc_v20_get_payment_meta') && ! doing_filter('get_post_metadata')) {
1318
+			add_filter('get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4);
1319 1319
 		}
1320 1320
 
1321
-		$meta = give_get_meta( $this->ID, $meta_key, $single );
1321
+		$meta = give_get_meta($this->ID, $meta_key, $single);
1322 1322
 
1323 1323
 		/**
1324 1324
 		 * Filter the specific meta key value.
1325 1325
 		 *
1326 1326
 		 * @since 1.5
1327 1327
 		 */
1328
-		$meta = apply_filters( "give_get_payment_meta_{$meta_key}", $meta, $this->ID );
1328
+		$meta = apply_filters("give_get_payment_meta_{$meta_key}", $meta, $this->ID);
1329 1329
 
1330 1330
 		// Security check.
1331
-		if ( is_serialized( $meta ) ) {
1332
-			preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $meta, $matches );
1333
-			if ( ! empty( $matches ) ) {
1331
+		if (is_serialized($meta)) {
1332
+			preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $meta, $matches);
1333
+			if ( ! empty($matches)) {
1334 1334
 				$meta = array();
1335 1335
 			}
1336 1336
 		}
@@ -1340,7 +1340,7 @@  discard block
 block discarded – undo
1340 1340
 		 *
1341 1341
 		 * @since 1.5
1342 1342
 		 */
1343
-		return apply_filters( 'give_get_payment_meta', $meta, $this->ID, $meta_key );
1343
+		return apply_filters('give_get_payment_meta', $meta, $this->ID, $meta_key);
1344 1344
 	}
1345 1345
 
1346 1346
 	/**
@@ -1355,8 +1355,8 @@  discard block
 block discarded – undo
1355 1355
 	 *
1356 1356
 	 * @return int|bool           Meta ID if the key didn't exist, true on successful update, false on failure
1357 1357
 	 */
1358
-	public function update_meta( $meta_key = '', $meta_value = '', $prev_value = '' ) {
1359
-		if ( empty( $meta_key ) ) {
1358
+	public function update_meta($meta_key = '', $meta_value = '', $prev_value = '') {
1359
+		if (empty($meta_key)) {
1360 1360
 			return false;
1361 1361
 		}
1362 1362
 
@@ -1366,9 +1366,9 @@  discard block
 block discarded – undo
1366 1366
 		 *
1367 1367
 		 * @since 1.5
1368 1368
 		 */
1369
-		$meta_value = apply_filters( "give_update_payment_meta_{$meta_key}", $meta_value, $this->ID );
1369
+		$meta_value = apply_filters("give_update_payment_meta_{$meta_key}", $meta_value, $this->ID);
1370 1370
 
1371
-		return give_update_meta( $this->ID, $meta_key, $meta_value, $prev_value );
1371
+		return give_update_meta($this->ID, $meta_key, $meta_value, $prev_value);
1372 1372
 	}
1373 1373
 
1374 1374
 	/**
@@ -1381,7 +1381,7 @@  discard block
 block discarded – undo
1381 1381
 	 *
1382 1382
 	 * @return void
1383 1383
 	 */
1384
-	private function process_status( $status ) {
1384
+	private function process_status($status) {
1385 1385
 		$process = true;
1386 1386
 
1387 1387
 		// Bailout, if changed from completed to preapproval/processing.
@@ -1396,9 +1396,9 @@  discard block
 block discarded – undo
1396 1396
 		}
1397 1397
 
1398 1398
 		// Allow extensions to filter for their own payment types, Example: Recurring Payments.
1399
-		$process = apply_filters( "give_should_process_{$status}", $process, $this );
1399
+		$process = apply_filters("give_should_process_{$status}", $process, $this);
1400 1400
 
1401
-		if ( false === $process ) {
1401
+		if (false === $process) {
1402 1402
 			return;
1403 1403
 		}
1404 1404
 
@@ -1409,13 +1409,13 @@  discard block
 block discarded – undo
1409 1409
 		 *
1410 1410
 		 * @since 1.5
1411 1411
 		 */
1412
-		do_action( "give_pre_{$status}_payment", $this );
1412
+		do_action("give_pre_{$status}_payment", $this);
1413 1413
 
1414
-		$decrease_earnings       = apply_filters( "give_decrease_earnings_on_{$status}", true, $this );
1415
-		$decrease_donor_value    = apply_filters( "give_decrease_donor_value_on_{$status}", true, $this );
1416
-		$decrease_donation_count = apply_filters( "give_decrease_donors_donation_count_on_{$status}", true, $this );
1414
+		$decrease_earnings       = apply_filters("give_decrease_earnings_on_{$status}", true, $this);
1415
+		$decrease_donor_value    = apply_filters("give_decrease_donor_value_on_{$status}", true, $this);
1416
+		$decrease_donation_count = apply_filters("give_decrease_donors_donation_count_on_{$status}", true, $this);
1417 1417
 
1418
-		$this->maybe_alter_stats( $decrease_earnings, $decrease_donor_value, $decrease_donation_count );
1418
+		$this->maybe_alter_stats($decrease_earnings, $decrease_donor_value, $decrease_donation_count);
1419 1419
 		$this->delete_sales_logs();
1420 1420
 
1421 1421
 		// @todo: Refresh only range related stat cache
@@ -1428,7 +1428,7 @@  discard block
 block discarded – undo
1428 1428
 		 *
1429 1429
 		 * @since 1.5
1430 1430
 		 */
1431
-		do_action( "give_post_{$status}_payment", $this );
1431
+		do_action("give_post_{$status}_payment", $this);
1432 1432
 	}
1433 1433
 
1434 1434
 	/**
@@ -1443,25 +1443,25 @@  discard block
 block discarded – undo
1443 1443
 	 *
1444 1444
 	 * @return void
1445 1445
 	 */
1446
-	private function maybe_alter_stats( $alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count ) {
1446
+	private function maybe_alter_stats($alter_store_earnings, $alter_customer_value, $alter_customer_purchase_count) {
1447 1447
 
1448
-		give_undo_donation( $this->ID );
1448
+		give_undo_donation($this->ID);
1449 1449
 
1450 1450
 		// Decrease store earnings.
1451
-		if ( true === $alter_store_earnings ) {
1452
-			give_decrease_total_earnings( $this->total );
1451
+		if (true === $alter_store_earnings) {
1452
+			give_decrease_total_earnings($this->total);
1453 1453
 		}
1454 1454
 
1455 1455
 		// Decrement the stats for the donor.
1456
-		if ( ! empty( $this->customer_id ) ) {
1456
+		if ( ! empty($this->customer_id)) {
1457 1457
 
1458
-			$donor = new Give_Donor( $this->customer_id );
1458
+			$donor = new Give_Donor($this->customer_id);
1459 1459
 
1460
-			if ( true === $alter_customer_value ) {
1461
-				$donor->decrease_value( $this->total );
1460
+			if (true === $alter_customer_value) {
1461
+				$donor->decrease_value($this->total);
1462 1462
 			}
1463 1463
 
1464
-			if ( true === $alter_customer_purchase_count ) {
1464
+			if (true === $alter_customer_purchase_count) {
1465 1465
 				$donor->decrease_donation_count();
1466 1466
 			}
1467 1467
 		}
@@ -1478,7 +1478,7 @@  discard block
 block discarded – undo
1478 1478
 	 */
1479 1479
 	private function delete_sales_logs() {
1480 1480
 		// Remove related sale log entries.
1481
-		Give()->logs->delete_logs( $this->ID );
1481
+		Give()->logs->delete_logs($this->ID);
1482 1482
 	}
1483 1483
 
1484 1484
 	/**
@@ -1499,13 +1499,13 @@  discard block
 block discarded – undo
1499 1499
 	 * @return string The date the payment was completed
1500 1500
 	 */
1501 1501
 	private function setup_completed_date() {
1502
-		$payment = get_post( $this->ID );
1502
+		$payment = get_post($this->ID);
1503 1503
 
1504
-		if ( 'pending' == $payment->post_status || 'preapproved' == $payment->post_status ) {
1504
+		if ('pending' == $payment->post_status || 'preapproved' == $payment->post_status) {
1505 1505
 			return false; // This payment was never completed.
1506 1506
 		}
1507 1507
 
1508
-		$date = ( $date = $this->get_meta( '_give_completed_date', true ) ) ? $date : $payment->modified_date;
1508
+		$date = ($date = $this->get_meta('_give_completed_date', true)) ? $date : $payment->modified_date;
1509 1509
 
1510 1510
 		return $date;
1511 1511
 	}
@@ -1519,7 +1519,7 @@  discard block
 block discarded – undo
1519 1519
 	 * @return string The payment mode
1520 1520
 	 */
1521 1521
 	private function setup_mode() {
1522
-		return $this->get_meta( '_give_payment_mode' );
1522
+		return $this->get_meta('_give_payment_mode');
1523 1523
 	}
1524 1524
 
1525 1525
 	/**
@@ -1531,7 +1531,7 @@  discard block
 block discarded – undo
1531 1531
 	 * @return bool The payment import
1532 1532
 	 */
1533 1533
 	private function setup_import() {
1534
-		return (bool) $this->get_meta( '_give_payment_import' );
1534
+		return (bool) $this->get_meta('_give_payment_import');
1535 1535
 	}
1536 1536
 
1537 1537
 	/**
@@ -1543,9 +1543,9 @@  discard block
 block discarded – undo
1543 1543
 	 * @return float The payment total
1544 1544
 	 */
1545 1545
 	private function setup_total() {
1546
-		$amount = $this->get_meta( '_give_payment_total', true );
1546
+		$amount = $this->get_meta('_give_payment_total', true);
1547 1547
 
1548
-		return round( floatval( $amount ), give_get_price_decimals( $this->ID ) );
1548
+		return round(floatval($amount), give_get_price_decimals($this->ID));
1549 1549
 	}
1550 1550
 
1551 1551
 	/**
@@ -1572,17 +1572,16 @@  discard block
 block discarded – undo
1572 1572
 	 * @return string The currency for the payment
1573 1573
 	 */
1574 1574
 	private function setup_currency() {
1575
-		$currency = $this->get_meta( '_give_payment_currency', true );
1576
-		$currency = ! empty( $currency ) ?
1577
-			$currency :
1578
-			/**
1575
+		$currency = $this->get_meta('_give_payment_currency', true);
1576
+		$currency = ! empty($currency) ?
1577
+			$currency : /**
1579 1578
 			 * Filter the default donation currency
1580 1579
 			 *
1581 1580
 			 * @since 1.5
1582 1581
 			 */
1583 1582
 			apply_filters(
1584 1583
 				'give_payment_currency_default',
1585
-				give_get_currency( $this->form_id, $this ),
1584
+				give_get_currency($this->form_id, $this),
1586 1585
 				$this
1587 1586
 			);
1588 1587
 
@@ -1598,7 +1597,7 @@  discard block
 block discarded – undo
1598 1597
 	 * @return string The gateway
1599 1598
 	 */
1600 1599
 	private function setup_gateway() {
1601
-		$gateway = $this->get_meta( '_give_payment_gateway', true );
1600
+		$gateway = $this->get_meta('_give_payment_gateway', true);
1602 1601
 
1603 1602
 		return $gateway;
1604 1603
 	}
@@ -1612,11 +1611,11 @@  discard block
 block discarded – undo
1612 1611
 	 * @return string The donation ID
1613 1612
 	 */
1614 1613
 	private function setup_transaction_id() {
1615
-		$transaction_id = $this->get_meta( '_give_payment_transaction_id', true );
1614
+		$transaction_id = $this->get_meta('_give_payment_transaction_id', true);
1616 1615
 
1617
-		if ( empty( $transaction_id ) ) {
1616
+		if (empty($transaction_id)) {
1618 1617
 			$gateway        = $this->gateway;
1619
-			$transaction_id = apply_filters( "give_get_payment_transaction_id-{$gateway}", $this->ID );
1618
+			$transaction_id = apply_filters("give_get_payment_transaction_id-{$gateway}", $this->ID);
1620 1619
 		}
1621 1620
 
1622 1621
 		return $transaction_id;
@@ -1632,7 +1631,7 @@  discard block
 block discarded – undo
1632 1631
 	 * @return string The IP address for the payment
1633 1632
 	 */
1634 1633
 	private function setup_ip() {
1635
-		$ip = $this->get_meta( '_give_payment_donor_ip', true );
1634
+		$ip = $this->get_meta('_give_payment_donor_ip', true);
1636 1635
 
1637 1636
 		return $ip;
1638 1637
 	}
@@ -1647,7 +1646,7 @@  discard block
 block discarded – undo
1647 1646
 	 * @return int The Donor ID.
1648 1647
 	 */
1649 1648
 	private function setup_donor_id() {
1650
-		$donor_id = $this->get_meta( '_give_payment_donor_id', true );
1649
+		$donor_id = $this->get_meta('_give_payment_donor_id', true);
1651 1650
 
1652 1651
 		return $donor_id;
1653 1652
 	}
@@ -1664,8 +1663,8 @@  discard block
 block discarded – undo
1664 1663
 	 */
1665 1664
 	private function setup_user_id() {
1666 1665
 
1667
-		$donor   = Give()->customers->get_customer_by( 'id', $this->customer_id );
1668
-		$user_id = $donor ? absint( $donor->user_id ) : 0;
1666
+		$donor   = Give()->customers->get_customer_by('id', $this->customer_id);
1667
+		$user_id = $donor ? absint($donor->user_id) : 0;
1669 1668
 
1670 1669
 
1671 1670
 		return $user_id;
@@ -1682,10 +1681,10 @@  discard block
 block discarded – undo
1682 1681
 	 * @return string The email address for the payment.
1683 1682
 	 */
1684 1683
 	private function setup_email() {
1685
-		$email = $this->get_meta( '_give_payment_donor_email', true );
1684
+		$email = $this->get_meta('_give_payment_donor_email', true);
1686 1685
 
1687
-		if ( empty( $email ) && $this->customer_id ) {
1688
-			$email = Give()->donors->get_column( 'email', $this->customer_id );
1686
+		if (empty($email) && $this->customer_id) {
1687
+			$email = Give()->donors->get_column('email', $this->customer_id);
1689 1688
 		}
1690 1689
 
1691 1690
 		return $email;
@@ -1705,22 +1704,22 @@  discard block
 block discarded – undo
1705 1704
 			'last_name'  => $this->last_name,
1706 1705
 		);
1707 1706
 
1708
-		$user_info = isset( $this->payment_meta['user_info'] ) ? $this->payment_meta['user_info'] : array();
1707
+		$user_info = isset($this->payment_meta['user_info']) ? $this->payment_meta['user_info'] : array();
1709 1708
 
1710
-		if ( is_serialized( $user_info ) ) {
1711
-			preg_match( '/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches );
1712
-			if ( ! empty( $matches ) ) {
1709
+		if (is_serialized($user_info)) {
1710
+			preg_match('/[oO]\s*:\s*\d+\s*:\s*"\s*(?!(?i)(stdClass))/', $user_info, $matches);
1711
+			if ( ! empty($matches)) {
1713 1712
 				$user_info = array();
1714 1713
 			}
1715 1714
 		}
1716 1715
 
1717
-		$user_info = wp_parse_args( $user_info, $defaults );
1716
+		$user_info = wp_parse_args($user_info, $defaults);
1718 1717
 
1719
-		if ( empty( $user_info ) ) {
1718
+		if (empty($user_info)) {
1720 1719
 			// Get the donor, but only if it's been created.
1721
-			$donor = new Give_Donor( $this->customer_id );
1720
+			$donor = new Give_Donor($this->customer_id);
1722 1721
 
1723
-			if ( $donor->id > 0 ) {
1722
+			if ($donor->id > 0) {
1724 1723
 				$user_info = array(
1725 1724
 					'first_name' => $donor->get_first_name(),
1726 1725
 					'last_name'  => $donor->get_last_name(),
@@ -1730,25 +1729,25 @@  discard block
 block discarded – undo
1730 1729
 			}
1731 1730
 		} else {
1732 1731
 			// Get the donor, but only if it's been created.
1733
-			$donor = new Give_Donor( $this->customer_id );
1732
+			$donor = new Give_Donor($this->customer_id);
1734 1733
 
1735
-			if ( $donor->id > 0 ) {
1736
-				foreach ( $user_info as $key => $value ) {
1737
-					if ( ! empty( $value ) ) {
1734
+			if ($donor->id > 0) {
1735
+				foreach ($user_info as $key => $value) {
1736
+					if ( ! empty($value)) {
1738 1737
 						continue;
1739 1738
 					}
1740 1739
 
1741
-					switch ( $key ) {
1740
+					switch ($key) {
1742 1741
 						case 'first_name':
1743
-							$user_info[ $key ] = $donor->get_first_name();
1742
+							$user_info[$key] = $donor->get_first_name();
1744 1743
 							break;
1745 1744
 
1746 1745
 						case 'last_name':
1747
-							$user_info[ $key ] = $donor->get_last_name();
1746
+							$user_info[$key] = $donor->get_last_name();
1748 1747
 							break;
1749 1748
 
1750 1749
 						case 'email':
1751
-							$user_info[ $key ] = $donor->email;
1750
+							$user_info[$key] = $donor->email;
1752 1751
 							break;
1753 1752
 					}
1754 1753
 				}
@@ -1768,12 +1767,12 @@  discard block
 block discarded – undo
1768 1767
 	 * @return array The Address information for the payment.
1769 1768
 	 */
1770 1769
 	private function setup_address() {
1771
-		$address['line1']   = give_get_meta( $this->ID, '_give_donor_billing_address1', true, '' );
1772
-		$address['line2']   = give_get_meta( $this->ID, '_give_donor_billing_address2', true, '' );
1773
-		$address['city']    = give_get_meta( $this->ID, '_give_donor_billing_city', true, '' );
1774
-		$address['state']   = give_get_meta( $this->ID, '_give_donor_billing_state', true, '' );
1775
-		$address['zip']     = give_get_meta( $this->ID, '_give_donor_billing_zip', true, '' );
1776
-		$address['country'] = give_get_meta( $this->ID, '_give_donor_billing_country', true, '' );
1770
+		$address['line1']   = give_get_meta($this->ID, '_give_donor_billing_address1', true, '');
1771
+		$address['line2']   = give_get_meta($this->ID, '_give_donor_billing_address2', true, '');
1772
+		$address['city']    = give_get_meta($this->ID, '_give_donor_billing_city', true, '');
1773
+		$address['state']   = give_get_meta($this->ID, '_give_donor_billing_state', true, '');
1774
+		$address['zip']     = give_get_meta($this->ID, '_give_donor_billing_zip', true, '');
1775
+		$address['country'] = give_get_meta($this->ID, '_give_donor_billing_country', true, '');
1777 1776
 
1778 1777
 		return $address;
1779 1778
 	}
@@ -1788,7 +1787,7 @@  discard block
 block discarded – undo
1788 1787
 	 */
1789 1788
 	private function setup_form_title() {
1790 1789
 
1791
-		$form_id = $this->get_meta( '_give_payment_form_title', true );
1790
+		$form_id = $this->get_meta('_give_payment_form_title', true);
1792 1791
 
1793 1792
 		return $form_id;
1794 1793
 	}
@@ -1803,7 +1802,7 @@  discard block
 block discarded – undo
1803 1802
 	 */
1804 1803
 	private function setup_form_id() {
1805 1804
 
1806
-		$form_id = $this->get_meta( '_give_payment_form_id', true );
1805
+		$form_id = $this->get_meta('_give_payment_form_id', true);
1807 1806
 
1808 1807
 		return $form_id;
1809 1808
 	}
@@ -1817,7 +1816,7 @@  discard block
 block discarded – undo
1817 1816
 	 * @return int The Form Price ID.
1818 1817
 	 */
1819 1818
 	private function setup_price_id() {
1820
-		$price_id = $this->get_meta( '_give_payment_price_id', true );
1819
+		$price_id = $this->get_meta('_give_payment_price_id', true);
1821 1820
 
1822 1821
 		return $price_id;
1823 1822
 	}
@@ -1831,7 +1830,7 @@  discard block
 block discarded – undo
1831 1830
 	 * @return string The Payment Key.
1832 1831
 	 */
1833 1832
 	private function setup_payment_key() {
1834
-		$key = $this->get_meta( '_give_payment_purchase_key', true );
1833
+		$key = $this->get_meta('_give_payment_purchase_key', true);
1835 1834
 
1836 1835
 		return $key;
1837 1836
 	}
@@ -1856,7 +1855,7 @@  discard block
 block discarded – undo
1856 1855
 	 * @return array The payment object as an array.
1857 1856
 	 */
1858 1857
 	public function array_convert() {
1859
-		return get_object_vars( $this );
1858
+		return get_object_vars($this);
1860 1859
 	}
1861 1860
 
1862 1861
 
@@ -1869,7 +1868,7 @@  discard block
 block discarded – undo
1869 1868
 	 * @return bool
1870 1869
 	 */
1871 1870
 	public function is_completed() {
1872
-		return ( 'publish' === $this->status && $this->completed_date );
1871
+		return ('publish' === $this->status && $this->completed_date);
1873 1872
 	}
1874 1873
 
1875 1874
 	/**
@@ -1881,7 +1880,7 @@  discard block
 block discarded – undo
1881 1880
 	 * @return string Date payment was completed.
1882 1881
 	 */
1883 1882
 	private function get_completed_date() {
1884
-		return apply_filters( 'give_payment_completed_date', $this->completed_date, $this->ID, $this );
1883
+		return apply_filters('give_payment_completed_date', $this->completed_date, $this->ID, $this);
1885 1884
 	}
1886 1885
 
1887 1886
 	/**
@@ -1893,7 +1892,7 @@  discard block
 block discarded – undo
1893 1892
 	 * @return float Payment subtotal.
1894 1893
 	 */
1895 1894
 	private function get_subtotal() {
1896
-		return apply_filters( 'give_get_payment_subtotal', $this->subtotal, $this->ID, $this );
1895
+		return apply_filters('give_get_payment_subtotal', $this->subtotal, $this->ID, $this);
1897 1896
 	}
1898 1897
 
1899 1898
 	/**
@@ -1905,7 +1904,7 @@  discard block
 block discarded – undo
1905 1904
 	 * @return string Payment currency code.
1906 1905
 	 */
1907 1906
 	private function get_currency() {
1908
-		return apply_filters( 'give_payment_currency_code', $this->currency, $this->ID, $this );
1907
+		return apply_filters('give_payment_currency_code', $this->currency, $this->ID, $this);
1909 1908
 	}
1910 1909
 
1911 1910
 	/**
@@ -1917,7 +1916,7 @@  discard block
 block discarded – undo
1917 1916
 	 * @return string Gateway used.
1918 1917
 	 */
1919 1918
 	private function get_gateway() {
1920
-		return apply_filters( 'give_payment_gateway', $this->gateway, $this->ID, $this );
1919
+		return apply_filters('give_payment_gateway', $this->gateway, $this->ID, $this);
1921 1920
 	}
1922 1921
 
1923 1922
 	/**
@@ -1929,7 +1928,7 @@  discard block
 block discarded – undo
1929 1928
 	 * @return string Donation ID from merchant processor.
1930 1929
 	 */
1931 1930
 	private function get_transaction_id() {
1932
-		return apply_filters( 'give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this );
1931
+		return apply_filters('give_get_payment_transaction_id', $this->transaction_id, $this->ID, $this);
1933 1932
 	}
1934 1933
 
1935 1934
 	/**
@@ -1941,7 +1940,7 @@  discard block
 block discarded – undo
1941 1940
 	 * @return string Payment IP address
1942 1941
 	 */
1943 1942
 	private function get_ip() {
1944
-		return apply_filters( 'give_payment_user_ip', $this->ip, $this->ID, $this );
1943
+		return apply_filters('give_payment_user_ip', $this->ip, $this->ID, $this);
1945 1944
 	}
1946 1945
 
1947 1946
 	/**
@@ -1953,7 +1952,7 @@  discard block
 block discarded – undo
1953 1952
 	 * @return int Payment donor ID.
1954 1953
 	 */
1955 1954
 	private function get_donor_id() {
1956
-		return apply_filters( 'give_payment_customer_id', $this->customer_id, $this->ID, $this );
1955
+		return apply_filters('give_payment_customer_id', $this->customer_id, $this->ID, $this);
1957 1956
 	}
1958 1957
 
1959 1958
 	/**
@@ -1965,7 +1964,7 @@  discard block
 block discarded – undo
1965 1964
 	 * @return int Payment user ID.
1966 1965
 	 */
1967 1966
 	private function get_user_id() {
1968
-		return apply_filters( 'give_payment_user_id', $this->user_id, $this->ID, $this );
1967
+		return apply_filters('give_payment_user_id', $this->user_id, $this->ID, $this);
1969 1968
 	}
1970 1969
 
1971 1970
 	/**
@@ -1977,7 +1976,7 @@  discard block
 block discarded – undo
1977 1976
 	 * @return string Payment donor email.
1978 1977
 	 */
1979 1978
 	private function get_email() {
1980
-		return apply_filters( 'give_payment_user_email', $this->email, $this->ID, $this );
1979
+		return apply_filters('give_payment_user_email', $this->email, $this->ID, $this);
1981 1980
 	}
1982 1981
 
1983 1982
 	/**
@@ -1989,7 +1988,7 @@  discard block
 block discarded – undo
1989 1988
 	 * @return array Payment user info.
1990 1989
 	 */
1991 1990
 	private function get_user_info() {
1992
-		return apply_filters( 'give_payment_meta_user_info', $this->user_info, $this->ID, $this );
1991
+		return apply_filters('give_payment_meta_user_info', $this->user_info, $this->ID, $this);
1993 1992
 	}
1994 1993
 
1995 1994
 	/**
@@ -2001,7 +2000,7 @@  discard block
 block discarded – undo
2001 2000
 	 * @return array Payment billing address.
2002 2001
 	 */
2003 2002
 	private function get_address() {
2004
-		return apply_filters( 'give_payment_address', $this->address, $this->ID, $this );
2003
+		return apply_filters('give_payment_address', $this->address, $this->ID, $this);
2005 2004
 	}
2006 2005
 
2007 2006
 	/**
@@ -2013,7 +2012,7 @@  discard block
 block discarded – undo
2013 2012
 	 * @return string Payment key.
2014 2013
 	 */
2015 2014
 	private function get_key() {
2016
-		return apply_filters( 'give_payment_key', $this->key, $this->ID, $this );
2015
+		return apply_filters('give_payment_key', $this->key, $this->ID, $this);
2017 2016
 	}
2018 2017
 
2019 2018
 	/**
@@ -2025,7 +2024,7 @@  discard block
 block discarded – undo
2025 2024
 	 * @return string Payment form id
2026 2025
 	 */
2027 2026
 	private function get_form_id() {
2028
-		return apply_filters( 'give_payment_form_id', $this->form_id, $this->ID, $this );
2027
+		return apply_filters('give_payment_form_id', $this->form_id, $this->ID, $this);
2029 2028
 	}
2030 2029
 
2031 2030
 	/**
@@ -2037,7 +2036,7 @@  discard block
 block discarded – undo
2037 2036
 	 * @return int|string Payment number
2038 2037
 	 */
2039 2038
 	private function get_number() {
2040
-		return apply_filters( 'give_payment_number', $this->number, $this->ID, $this );
2039
+		return apply_filters('give_payment_number', $this->number, $this->ID, $this);
2041 2040
 	}
2042 2041
 
2043 2042
 	/**
@@ -2049,7 +2048,7 @@  discard block
 block discarded – undo
2049 2048
 	 *
2050 2049
 	 * @return string
2051 2050
 	 */
2052
-	public function get_serial_code( $args = array() ) {
2053
-		return Give()->seq_donation_number->get_serial_code( $this, $args );
2051
+	public function get_serial_code($args = array()) {
2052
+		return Give()->seq_donation_number->get_serial_code($this, $args);
2054 2053
 	}
2055 2054
 }
Please login to merge, or discard this patch.
includes/admin/reports/class-give-graph.php 1 patch
Spacing   +35 added lines, -35 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
 
@@ -81,15 +81,15 @@  discard block
 block discarded – undo
81 81
 	 * @param array $_data
82 82
 	 * @param array $options
83 83
 	 */
84
-	public function __construct( $_data, $options = array() ) {
84
+	public function __construct($_data, $options = array()) {
85 85
 
86
-		$this->data      = $_data;
86
+		$this->data = $_data;
87 87
 
88 88
 		// Generate unique ID
89
-		$this->id = md5( rand() );
89
+		$this->id = md5(rand());
90 90
 
91 91
 		// Setup default options;
92
-		$this->options = apply_filters( 'give_graph_args', array(
92
+		$this->options = apply_filters('give_graph_args', array(
93 93
 			'y_mode'          => null,
94 94
 			'x_mode'          => null,
95 95
 			'y_decimals'      => 0,
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
 			'lines'           => false,
108 108
 			'points'          => true,
109 109
 			'dataType'        => array()
110
-		) );
110
+		));
111 111
 
112
-		$this->options = wp_parse_args( $options, $this->options );
112
+		$this->options = wp_parse_args($options, $this->options);
113 113
 	}
114 114
 
115 115
 	/**
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
 	 *
121 121
 	 * @since 1.0
122 122
 	 */
123
-	public function set( $key, $value ) {
124
-		$this->options[ $key ] = $value;
123
+	public function set($key, $value) {
124
+		$this->options[$key] = $value;
125 125
 	}
126 126
 
127 127
 	/**
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @since 1.0
133 133
 	 */
134
-	public function get( $key ) {
135
-		return isset( $this->options[ $key ] ) ? $this->options[ $key ] : false;
134
+	public function get($key) {
135
+		return isset($this->options[$key]) ? $this->options[$key] : false;
136 136
 	}
137 137
 
138 138
 	/**
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @since 1.0
142 142
 	 */
143 143
 	public function get_data() {
144
-		return apply_filters( 'give_get_graph_data', $this->data, $this );
144
+		return apply_filters('give_get_graph_data', $this->data, $this);
145 145
 	}
146 146
 
147 147
 	/**
@@ -151,19 +151,19 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	public function load_scripts() {
153 153
 		// Use minified libraries if SCRIPT_DEBUG is turned off
154
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
154
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
155 155
 
156
-		wp_register_script( 'jquery-flot-orderbars', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.orderBars' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION );
157
-		wp_enqueue_script( 'jquery-flot-orderbars' );
156
+		wp_register_script('jquery-flot-orderbars', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.orderBars'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION);
157
+		wp_enqueue_script('jquery-flot-orderbars');
158 158
 
159
-		wp_register_script( 'jquery-flot-time', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.time' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION );
160
-		wp_enqueue_script( 'jquery-flot-time' );
159
+		wp_register_script('jquery-flot-time', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.time'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION);
160
+		wp_enqueue_script('jquery-flot-time');
161 161
 
162
-		wp_register_script( 'jquery-flot-resize', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot.resize' . $suffix . '.js', array('jquery-flot'), GIVE_VERSION );
163
-		wp_enqueue_script( 'jquery-flot-resize' );
162
+		wp_register_script('jquery-flot-resize', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot.resize'.$suffix.'.js', array('jquery-flot'), GIVE_VERSION);
163
+		wp_enqueue_script('jquery-flot-resize');
164 164
 
165
-		wp_register_script( 'jquery-flot', GIVE_PLUGIN_URL . 'assets/js/plugins/jquery.flot' . $suffix . '.js', false, GIVE_VERSION );
166
-		wp_enqueue_script( 'jquery-flot' );
165
+		wp_register_script('jquery-flot', GIVE_PLUGIN_URL.'assets/js/plugins/jquery.flot'.$suffix.'.js', false, GIVE_VERSION);
166
+		wp_enqueue_script('jquery-flot');
167 167
 
168 168
 	}
169 169
 
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
 					[
191 191
 						<?php
192 192
 							$order = 0;
193
-							foreach( $this->get_data() as $label => $data ) :
193
+							foreach ($this->get_data() as $label => $data) :
194 194
 						?>
195 195
 						{
196
-							label : "<?php echo esc_attr( $label ); ?>",
197
-							id    : "<?php echo sanitize_key( $label ); ?>",
198
-							dataType  : '<?php echo ( ! empty( $this->options['dataType'][$order] ) ? $this->options['dataType'][$order] : 'count' ); ?>',
196
+							label : "<?php echo esc_attr($label); ?>",
197
+							id    : "<?php echo sanitize_key($label); ?>",
198
+							dataType  : '<?php echo ( ! empty($this->options['dataType'][$order]) ? $this->options['dataType'][$order] : 'count'); ?>',
199 199
 							// data format is: [ point on x, value on y ]
200
-							data  : [<?php foreach( $data as $point ) { echo '[' . implode( ',', $point ) . '],'; } ?>],
200
+							data  : [<?php foreach ($data as $point) { echo '['.implode(',', $point).'],'; } ?>],
201 201
 							points: {
202 202
 								show: <?php echo $this->options['points'] ? 'true' : 'false'; ?>,
203 203
 							},
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 								fill     : true,
213 213
 								fillColor: {colors: [{opacity: 0.4}, {opacity: 0.1}]}
214 214
 							},
215
-							<?php if( $this->options[ 'multiple_y_axes' ] ) : ?>
215
+							<?php if ($this->options['multiple_y_axes']) : ?>
216 216
 							yaxis : <?php echo $yaxis_count; ?>
217 217
 							<?php endif; ?>
218 218
 
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
 						grid: {
227 227
 							show           : true,
228 228
 							aboveData      : false,
229
-							color          : "<?php echo $this->options[ 'color' ]; ?>",
230
-							backgroundColor: "<?php echo $this->options[ 'bgcolor' ]; ?>",
231
-							borderColor    : "<?php echo $this->options[ 'bordercolor' ]; ?>",
232
-							borderWidth    : <?php echo absint( $this->options[ 'borderwidth' ] ); ?>,
229
+							color          : "<?php echo $this->options['color']; ?>",
230
+							backgroundColor: "<?php echo $this->options['bgcolor']; ?>",
231
+							borderColor    : "<?php echo $this->options['bordercolor']; ?>",
232
+							borderWidth    : <?php echo absint($this->options['borderwidth']); ?>,
233 233
 							clickable      : false,
234 234
 							hoverable      : true
235 235
 						},
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 							mode        : "<?php echo $this->options['x_mode']; ?>",
241 241
 							timeFormat  : "<?php echo $this->options['x_mode'] == 'time' ? $this->options['time_format'] : ''; ?>",
242 242
 							tickSize    : "<?php echo $this->options['x_mode'] == 'time' ? '' : 1; ?>",
243
-							<?php if( $this->options['x_mode'] != 'time' ) : ?>
243
+							<?php if ($this->options['x_mode'] != 'time') : ?>
244 244
 							tickDecimals: <?php echo $this->options['x_decimals']; ?>
245 245
 							<?php endif; ?>
246 246
 						},
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 							min         : 0,
250 250
 							mode        : "<?php echo $this->options['y_mode']; ?>",
251 251
 							timeFormat  : "<?php echo $this->options['y_mode'] == 'time' ? $this->options['time_format'] : ''; ?>",
252
-							<?php if( $this->options['y_mode'] != 'time' ) : ?>
252
+							<?php if ($this->options['y_mode'] != 'time') : ?>
253 253
 							tickDecimals: <?php echo $this->options['y_decimals']; ?>,
254 254
 							<?php endif; ?>
255 255
 							tickFormatter: function(val) {
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 		 *
324 324
 		 * @param Give_Graph $this Graph object.
325 325
 		 */
326
-		do_action( 'give_before_graph', $this );
326
+		do_action('give_before_graph', $this);
327 327
 
328 328
 		// Build the graph.
329 329
 		echo $this->build_graph();
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 		 *
336 336
 		 * @param Give_Graph $this Graph object.
337 337
 		 */
338
-		do_action( 'give_after_graph', $this );
338
+		do_action('give_after_graph', $this);
339 339
 	}
340 340
 
341 341
 }
Please login to merge, or discard this patch.
includes/admin/tools/import/class-give-import-donations.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 
455 455
 		/**
456 456
 		 * @param $option_value
457
-		 * @param $value
457
+		 * @param boolean $value
458 458
 		 *
459 459
 		 * @return string
460 460
 		 */
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 		 *
545 545
 		 * @since 1.8.14
546 546
 		 *
547
-		 * @param $file_id
547
+		 * @param integer $file_id
548 548
 		 *
549 549
 		 * @return bool|int
550 550
 		 */
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -201,13 +201,13 @@  discard block
 block discarded – undo
201 201
 									   id="recount-stats-submit"
202 202
 									   value="
203 203
 									       <?php
204
-								       /**
205
-								        * Filter to modify donation importer submit button text.
206
-								        *
207
-								        * @since 2.1
208
-								        */
209
-								       echo apply_filters( 'give_import_donation_submit_button_text', __( 'Submit', 'give' ) );
210
-								       ?>
204
+									   /**
205
+									    * Filter to modify donation importer submit button text.
206
+									    *
207
+									    * @since 2.1
208
+									    */
209
+									   echo apply_filters( 'give_import_donation_submit_button_text', __( 'Submit', 'give' ) );
210
+									   ?>
211 211
 											"/>
212 212
 							</th>
213 213
 							<th>
@@ -1079,8 +1079,8 @@  discard block
 block discarded – undo
1079 1079
 		 */
1080 1080
 		private function is_donations_import_page() {
1081 1081
 			return 'import' === give_get_current_setting_tab() &&
1082
-			       isset( $_GET['importer-type'] ) &&
1083
-			       $this->importer_type === give_clean( $_GET['importer-type'] );
1082
+				   isset( $_GET['importer-type'] ) &&
1083
+				   $this->importer_type === give_clean( $_GET['importer-type'] );
1084 1084
 		}
1085 1085
 	}
1086 1086
 
Please login to merge, or discard this patch.
Spacing   +229 added lines, -235 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
  * @since       1.8.14
12 12
  */
13 13
 
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit; // Exit if accessed directly
16 16
 }
17 17
 
18
-if ( ! class_exists( 'Give_Import_Donations' ) ) {
18
+if ( ! class_exists('Give_Import_Donations')) {
19 19
 
20 20
 	/**
21 21
 	 * Give_Import_Donations.
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		 * @access private
67 67
 		 */
68 68
 		private function __construct() {
69
-			self::$per_page = ! empty( $_GET['per_page'] ) ? absint( $_GET['per_page'] ) : self::$per_page;
69
+			self::$per_page = ! empty($_GET['per_page']) ? absint($_GET['per_page']) : self::$per_page;
70 70
 		}
71 71
 
72 72
 		/**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		 * @return static
79 79
 		 */
80 80
 		public static function get_instance() {
81
-			if ( null === static::$instance ) {
81
+			if (null === static::$instance) {
82 82
 				self::$instance = new static();
83 83
 			}
84 84
 
@@ -105,27 +105,27 @@  discard block
 block discarded – undo
105 105
 		 * @return void
106 106
 		 */
107 107
 		private function setup_hooks() {
108
-			if ( ! $this->is_donations_import_page() ) {
108
+			if ( ! $this->is_donations_import_page()) {
109 109
 				return;
110 110
 			}
111 111
 
112 112
 			// Do not render main import tools page.
113
-			remove_action( 'give_admin_field_tools_import', array( 'Give_Settings_Import', 'render_import_field', ) );
113
+			remove_action('give_admin_field_tools_import', array('Give_Settings_Import', 'render_import_field',));
114 114
 
115 115
 
116 116
 			// Render donation import page
117
-			add_action( 'give_admin_field_tools_import', array( $this, 'render_page' ) );
117
+			add_action('give_admin_field_tools_import', array($this, 'render_page'));
118 118
 
119 119
 			// Print the HTML.
120
-			add_action( 'give_tools_import_donations_form_start', array( $this, 'html' ), 10 );
120
+			add_action('give_tools_import_donations_form_start', array($this, 'html'), 10);
121 121
 
122 122
 			// Run when form submit.
123
-			add_action( 'give-tools_save_import', array( $this, 'save' ) );
123
+			add_action('give-tools_save_import', array($this, 'save'));
124 124
 
125
-			add_action( 'give-tools_update_notices', array( $this, 'update_notices' ), 11, 1 );
125
+			add_action('give-tools_update_notices', array($this, 'update_notices'), 11, 1);
126 126
 
127 127
 			// Used to add submit button.
128
-			add_action( 'give_tools_import_donations_form_end', array( $this, 'submit' ), 10 );
128
+			add_action('give_tools_import_donations_form_end', array($this, 'submit'), 10);
129 129
 		}
130 130
 
131 131
 		/**
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
 		 *
138 138
 		 * @return mixed
139 139
 		 */
140
-		public function update_notices( $messages ) {
141
-			if ( ! empty( $_GET['tab'] ) && 'import' === give_clean( $_GET['tab'] ) ) {
142
-				unset( $messages['give-setting-updated'] );
140
+		public function update_notices($messages) {
141
+			if ( ! empty($_GET['tab']) && 'import' === give_clean($_GET['tab'])) {
142
+				unset($messages['give-setting-updated']);
143 143
 			}
144 144
 
145 145
 			return $messages;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 		 * @since 1.8.14
152 152
 		 */
153 153
 		public function submit() {
154
-			wp_nonce_field( 'give-save-settings', '_give-save-settings' );
154
+			wp_nonce_field('give-save-settings', '_give-save-settings');
155 155
 			?>
156 156
 			<input type="hidden" class="import-step" id="import-step" name="step"
157 157
 				   value="<?php echo $this->get_step(); ?>"/>
@@ -172,11 +172,11 @@  discard block
 block discarded – undo
172 172
 			?>
173 173
 			<section>
174 174
 				<table
175
-						class="widefat export-options-table give-table <?php echo "step-{$step}"; ?> <?php echo( 1 === $step && ! empty( $this->is_csv_valid ) ? 'give-hidden' : '' ); ?>  "
175
+						class="widefat export-options-table give-table <?php echo "step-{$step}"; ?> <?php echo(1 === $step && ! empty($this->is_csv_valid) ? 'give-hidden' : ''); ?>  "
176 176
 						id="<?php echo "step-{$step}"; ?>">
177 177
 					<tbody>
178 178
 					<?php
179
-					switch ( $step ) {
179
+					switch ($step) {
180 180
 						case 1:
181 181
 							$this->render_media_csv();
182 182
 							break;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 						case 4:
193 193
 							$this->import_success();
194 194
 					}
195
-					if ( false === $this->check_for_dropdown_or_import() ) {
195
+					if (false === $this->check_for_dropdown_or_import()) {
196 196
 						?>
197 197
 						<tr valign="top">
198 198
 							<th>
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 								        *
207 207
 								        * @since 2.1
208 208
 								        */
209
-								       echo apply_filters( 'give_import_donation_submit_button_text', __( 'Submit', 'give' ) );
209
+								       echo apply_filters('give_import_donation_submit_button_text', __('Submit', 'give'));
210 210
 								       ?>
211 211
 											"/>
212 212
 							</th>
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 								 *
218 218
 								 * @since 2.1
219 219
 								 */
220
-								do_action( 'give_import_donation_submit_button' );
220
+								do_action('give_import_donation_submit_button');
221 221
 								?>
222 222
 							</th>
223 223
 						</tr>
@@ -237,70 +237,70 @@  discard block
 block discarded – undo
237 237
 		 */
238 238
 		public function import_success() {
239 239
 
240
-			$delete_csv = ( ! empty( $_GET['delete_csv'] ) ? absint( $_GET['delete_csv'] ) : false );
241
-			$csv        = ( ! empty( $_GET['csv'] ) ? absint( $_GET['csv'] ) : false );
242
-			if ( ! empty( $delete_csv ) && ! empty( $csv ) ) {
243
-				wp_delete_attachment( $csv, true );
240
+			$delete_csv = ( ! empty($_GET['delete_csv']) ? absint($_GET['delete_csv']) : false);
241
+			$csv        = ( ! empty($_GET['csv']) ? absint($_GET['csv']) : false);
242
+			if ( ! empty($delete_csv) && ! empty($csv)) {
243
+				wp_delete_attachment($csv, true);
244 244
 			}
245 245
 
246 246
 			$report = give_import_donation_report();
247 247
 
248 248
 			$report_html = array(
249 249
 				'duplicate_donor'    => array(
250
-					__( '%s duplicate %s detected', 'give' ),
251
-					__( '%s duplicate %s will be detected', 'give' ),
252
-					__( 'donor', 'give' ),
253
-					__( 'donors', 'give' ),
250
+					__('%s duplicate %s detected', 'give'),
251
+					__('%s duplicate %s will be detected', 'give'),
252
+					__('donor', 'give'),
253
+					__('donors', 'give'),
254 254
 				),
255 255
 				'create_donor'       => array(
256
-					__( '%s %s created', 'give' ),
257
-					__( '%s %s will be going to get created', 'give' ),
258
-					__( 'donor', 'give' ),
259
-					__( 'donors', 'give' ),
256
+					__('%s %s created', 'give'),
257
+					__('%s %s will be going to get created', 'give'),
258
+					__('donor', 'give'),
259
+					__('donors', 'give'),
260 260
 				),
261 261
 				'create_form'        => array(
262
-					__( '%s donation %s created', 'give' ),
263
-					__( '%s donation %s will be going to get created', 'give' ),
264
-					__( 'form', 'give' ),
265
-					__( 'forms', 'give' ),
262
+					__('%s donation %s created', 'give'),
263
+					__('%s donation %s will be going to get created', 'give'),
264
+					__('form', 'give'),
265
+					__('forms', 'give'),
266 266
 				),
267 267
 				'duplicate_donation' => array(
268
-					__( '%s duplicate %s detected', 'give' ),
269
-					__( '%s duplicate %s will be detected', 'give' ),
270
-					__( 'donation', 'give' ),
271
-					__( 'donations', 'give' ),
268
+					__('%s duplicate %s detected', 'give'),
269
+					__('%s duplicate %s will be detected', 'give'),
270
+					__('donation', 'give'),
271
+					__('donations', 'give'),
272 272
 				),
273 273
 				'create_donation'    => array(
274
-					__( '%s %s imported', 'give' ),
275
-					__( '%s %s will going to get imported', 'give' ),
276
-					__( 'donation', 'give' ),
277
-					__( 'donations', 'give' ),
274
+					__('%s %s imported', 'give'),
275
+					__('%s %s will going to get imported', 'give'),
276
+					__('donation', 'give'),
277
+					__('donations', 'give'),
278 278
 				),
279 279
 			);
280
-			$total       = (int) $_GET['total'];
281
-			-- $total;
280
+			$total = (int) $_GET['total'];
281
+			--$total;
282 282
 			$success = (bool) $_GET['success'];
283
-			$dry_run = empty( $_GET['dry_run'] ) ? 0 : absint( $_GET['dry_run'] );
283
+			$dry_run = empty($_GET['dry_run']) ? 0 : absint($_GET['dry_run']);
284 284
 			?>
285 285
 			<tr valign="top" class="give-import-dropdown">
286 286
 				<th colspan="2">
287 287
 					<h2>
288 288
 						<?php
289
-						if ( $success ) {
290
-							if ( $dry_run ) {
289
+						if ($success) {
290
+							if ($dry_run) {
291 291
 								printf(
292
-									_n( 'Dry run import complete! %s donation processed', 'Dry run import complete! %s donations processed', $total, 'give' ),
292
+									_n('Dry run import complete! %s donation processed', 'Dry run import complete! %s donations processed', $total, 'give'),
293 293
 									"<strong>{$total}</strong>"
294 294
 								);
295 295
 							} else {
296 296
 								printf(
297
-									_n( 'Import complete! %s donation processed', 'Import complete! %s donations processed', $total, 'give' ),
297
+									_n('Import complete! %s donation processed', 'Import complete! %s donations processed', $total, 'give'),
298 298
 									"<strong>{$total}</strong>"
299 299
 								);
300 300
 							}
301 301
 						} else {
302 302
 							printf(
303
-								_n( 'Failed to import %s donation', 'Failed to import %s donations', $total, 'give' ),
303
+								_n('Failed to import %s donation', 'Failed to import %s donations', $total, 'give'),
304 304
 								"<strong>{$total}</strong>"
305 305
 							);
306 306
 						}
@@ -308,16 +308,16 @@  discard block
 block discarded – undo
308 308
 					</h2>
309 309
 
310 310
 					<?php
311
-					$text      = __( 'Import Donation', 'give' );
311
+					$text      = __('Import Donation', 'give');
312 312
 					$query_arg = array(
313 313
 						'post_type' => 'give_forms',
314 314
 						'page'      => 'give-tools',
315 315
 						'tab'       => 'import',
316 316
 					);
317
-					if ( $success ) {
317
+					if ($success) {
318 318
 
319 319
 
320
-						if ( $dry_run ) {
320
+						if ($dry_run) {
321 321
 							$query_arg = array(
322 322
 								'post_type'     => 'give_forms',
323 323
 								'page'          => 'give-tools',
@@ -325,25 +325,25 @@  discard block
 block discarded – undo
325 325
 								'importer-type' => 'import_donations',
326 326
 							);
327 327
 
328
-							$text = __( 'Start Import', 'give' );
328
+							$text = __('Start Import', 'give');
329 329
 						} else {
330 330
 							$query_arg = array(
331 331
 								'post_type' => 'give_forms',
332 332
 								'page'      => 'give-payment-history',
333 333
 							);
334
-							$text      = __( 'View Donations', 'give' );
334
+							$text = __('View Donations', 'give');
335 335
 						}
336 336
 					}
337 337
 
338
-					foreach ( $report as $key => $value ) {
339
-						if ( array_key_exists( $key, $report_html ) && ! empty( $value ) ) {
340
-							$key_name = $report_html[ $key ][2];
341
-							if ( $value > 1 ) {
342
-								$key_name = $report_html[ $key ][3];
338
+					foreach ($report as $key => $value) {
339
+						if (array_key_exists($key, $report_html) && ! empty($value)) {
340
+							$key_name = $report_html[$key][2];
341
+							if ($value > 1) {
342
+								$key_name = $report_html[$key][3];
343 343
 							}
344 344
 							?>
345 345
 							<p>
346
-								<?php printf( $report_html[ $key ][ $dry_run ], $value, $key_name ); ?>
346
+								<?php printf($report_html[$key][$dry_run], $value, $key_name); ?>
347 347
 							</p>
348 348
 							<?php
349 349
 						}
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 
353 353
 					<p>
354 354
 						<a class="button button-large button-secondary"
355
-						   href="<?php echo add_query_arg( $query_arg, admin_url( 'edit.php' ) ); ?>"><?php echo $text; ?></a>
355
+						   href="<?php echo add_query_arg($query_arg, admin_url('edit.php')); ?>"><?php echo $text; ?></a>
356 356
 					</p>
357 357
 				</th>
358 358
 			</tr>
@@ -369,26 +369,26 @@  discard block
 block discarded – undo
369 369
 			give_import_donation_report_reset();
370 370
 
371 371
 			$csv         = (int) $_REQUEST['csv'];
372
-			$delimiter   = ( ! empty( $_REQUEST['delimiter'] ) ? give_clean( $_REQUEST['delimiter'] ) : 'csv' );
372
+			$delimiter   = ( ! empty($_REQUEST['delimiter']) ? give_clean($_REQUEST['delimiter']) : 'csv');
373 373
 			$index_start = 1;
374 374
 			$index_end   = 1;
375 375
 			$next        = true;
376
-			$total       = self::get_csv_total( $csv );
377
-			if ( self::$per_page < $total ) {
378
-				$total_ajax = ceil( $total / self::$per_page );
376
+			$total       = self::get_csv_total($csv);
377
+			if (self::$per_page < $total) {
378
+				$total_ajax = ceil($total / self::$per_page);
379 379
 				$index_end  = self::$per_page;
380 380
 			} else {
381 381
 				$total_ajax = 1;
382 382
 				$index_end  = $total;
383 383
 				$next       = false;
384 384
 			}
385
-			$current_percentage = 100 / ( $total_ajax + 1 );
385
+			$current_percentage = 100 / ($total_ajax + 1);
386 386
 
387 387
 			?>
388 388
 			<tr valign="top" class="give-import-dropdown">
389 389
 				<th colspan="2">
390
-					<h2 id="give-import-title"><?php _e( 'Importing', 'give' ) ?></h2>
391
-					<p class="give-field-description"><?php _e( 'Your donations are now being imported...', 'give' ) ?></p>
390
+					<h2 id="give-import-title"><?php _e('Importing', 'give') ?></h2>
391
+					<p class="give-field-description"><?php _e('Your donations are now being imported...', 'give') ?></p>
392 392
 				</th>
393 393
 			</tr>
394 394
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 						<div style="width: <?php echo $current_percentage; ?>%"></div>
408 408
 					</div>
409 409
 					<input type="hidden" value="3" name="step">
410
-					<input type="hidden" value='<?php echo maybe_serialize( $_REQUEST['mapto'] ); ?>' name="mapto"
410
+					<input type="hidden" value='<?php echo maybe_serialize($_REQUEST['mapto']); ?>' name="mapto"
411 411
 						   class="mapto">
412 412
 					<input type="hidden" value="<?php echo $_REQUEST['csv']; ?>" name="csv" class="csv">
413 413
 					<input type="hidden" value="<?php echo $_REQUEST['mode']; ?>" name="mode" class="mode">
@@ -416,9 +416,9 @@  discard block
 block discarded – undo
416 416
 					<input type="hidden" value="<?php echo $_REQUEST['delete_csv']; ?>" name="delete_csv"
417 417
 						   class="delete_csv">
418 418
 					<input type="hidden" value="<?php echo $delimiter; ?>" name="delimiter">
419
-					<input type="hidden" value="<?php echo absint( $_REQUEST['dry_run'] ); ?>" name="dry_run">
419
+					<input type="hidden" value="<?php echo absint($_REQUEST['dry_run']); ?>" name="dry_run">
420 420
 					<input type="hidden"
421
-						   value='<?php echo maybe_serialize( self::get_importer( $csv, 0, $delimiter ) ); ?>'
421
+						   value='<?php echo maybe_serialize(self::get_importer($csv, 0, $delimiter)); ?>'
422 422
 						   name="main_key"
423 423
 						   class="main_key">
424 424
 				</th>
@@ -433,20 +433,20 @@  discard block
 block discarded – undo
433 433
 		 */
434 434
 		public function check_for_dropdown_or_import() {
435 435
 			$return = true;
436
-			if ( isset( $_REQUEST['mapto'] ) ) {
436
+			if (isset($_REQUEST['mapto'])) {
437 437
 				$mapto = (array) $_REQUEST['mapto'];
438
-				if ( false === in_array( 'form_title', $mapto ) && false === in_array( 'form_id', $mapto ) ) {
439
-					Give_Admin_Settings::add_error( 'give-import-csv-form', __( 'In order to import donations, a column must be mapped to either the "Donation Form Title" or "Donation Form ID" field. Please map a column to one of those fields.', 'give' ) );
438
+				if (false === in_array('form_title', $mapto) && false === in_array('form_id', $mapto)) {
439
+					Give_Admin_Settings::add_error('give-import-csv-form', __('In order to import donations, a column must be mapped to either the "Donation Form Title" or "Donation Form ID" field. Please map a column to one of those fields.', 'give'));
440 440
 					$return = false;
441 441
 				}
442 442
 
443
-				if ( false === in_array( 'amount', $mapto ) ) {
444
-					Give_Admin_Settings::add_error( 'give-import-csv-amount', __( 'In order to import donations, a column must be mapped to the "Amount" field. Please map a column to that field.', 'give' ) );
443
+				if (false === in_array('amount', $mapto)) {
444
+					Give_Admin_Settings::add_error('give-import-csv-amount', __('In order to import donations, a column must be mapped to the "Amount" field. Please map a column to that field.', 'give'));
445 445
 					$return = false;
446 446
 				}
447 447
 
448
-				if ( false === in_array( 'email', $mapto ) && false === in_array( 'donor_id', $mapto ) ) {
449
-					Give_Admin_Settings::add_error( 'give-import-csv-donor', __( 'In order to import donations, a column must be mapped to either the "Donor Email" or "Donor ID" field. Please map a column to that field.', 'give' ) );
448
+				if (false === in_array('email', $mapto) && false === in_array('donor_id', $mapto)) {
449
+					Give_Admin_Settings::add_error('give-import-csv-donor', __('In order to import donations, a column must be mapped to either the "Donor Email" or "Donor ID" field. Please map a column to that field.', 'give'));
450 450
 					$return = false;
451 451
 				}
452 452
 			} else {
@@ -463,10 +463,10 @@  discard block
 block discarded – undo
463 463
 		 */
464 464
 		public function render_dropdown() {
465 465
 			$csv       = (int) $_GET['csv'];
466
-			$delimiter = ( ! empty( $_GET['delimiter'] ) ? give_clean( $_GET['delimiter'] ) : 'csv' );
466
+			$delimiter = ( ! empty($_GET['delimiter']) ? give_clean($_GET['delimiter']) : 'csv');
467 467
 
468 468
 			// TO check if the CSV files that is being add is valid or not if not then redirect to first step again
469
-			if ( ! $this->is_valid_csv( $csv ) ) {
469
+			if ( ! $this->is_valid_csv($csv)) {
470 470
 				$url = give_import_page_url();
471 471
 				?>
472 472
 				<input type="hidden" name="csv_not_valid" class="csv_not_valid" value="<?php echo $url; ?>"/>
@@ -475,11 +475,11 @@  discard block
 block discarded – undo
475 475
 				?>
476 476
 				<tr valign="top" class="give-import-dropdown">
477 477
 					<th colspan="2">
478
-						<h2 id="give-import-title"><?php _e( 'Map CSV fields to donations', 'give' ) ?></h2>
478
+						<h2 id="give-import-title"><?php _e('Map CSV fields to donations', 'give') ?></h2>
479 479
 
480
-						<p class="give-import-donation-required-fields-title"><?php _e( 'Required Fields' ); ?></p>
480
+						<p class="give-import-donation-required-fields-title"><?php _e('Required Fields'); ?></p>
481 481
 
482
-						<p class="give-field-description"><?php _e( 'These fields are required for the import to submitted' ); ?></p>
482
+						<p class="give-field-description"><?php _e('These fields are required for the import to submitted'); ?></p>
483 483
 
484 484
 						<ul class="give-import-donation-required-fields">
485 485
 							<li class="give-import-donation-required-email"
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 								<span class="give-import-donation-required-symbol dashicons dashicons-no-alt"></span>
488 488
 								<span class="give-import-donation-required-text">
489 489
 									<?php
490
-									_e( 'Email Address', 'give' );
490
+									_e('Email Address', 'give');
491 491
 									?>
492 492
 								</span>
493 493
 							</li>
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 								<span class="give-import-donation-required-symbol dashicons dashicons-no-alt"></span>
498 498
 								<span class="give-import-donation-required-text">
499 499
 									<?php
500
-									_e( 'First Name', 'give' );
500
+									_e('First Name', 'give');
501 501
 									?>
502 502
 								</span>
503 503
 							</li>
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 								<span class="give-import-donation-required-symbol dashicons dashicons-no-alt"></span>
508 508
 								<span class="give-import-donation-required-text">
509 509
 									<?php
510
-									_e( 'Donation Amount', 'give' );
510
+									_e('Donation Amount', 'give');
511 511
 									?>
512 512
 								</span>
513 513
 							</li>
@@ -517,32 +517,32 @@  discard block
 block discarded – undo
517 517
 								<span class="give-import-donation-required-symbol dashicons dashicons-no-alt"></span>
518 518
 								<span class="give-import-donation-required-text">
519 519
 									<?php
520
-									_e( 'Form Title or ID', 'give' );
520
+									_e('Form Title or ID', 'give');
521 521
 									?>
522 522
 								</span>
523 523
 							</li>
524 524
 						</ul>
525 525
 
526
-						<p class="give-field-description"><?php _e( 'Select fields from your CSV file to map against donations fields or to ignore during import.', 'give' ) ?></p>
526
+						<p class="give-field-description"><?php _e('Select fields from your CSV file to map against donations fields or to ignore during import.', 'give') ?></p>
527 527
 					</th>
528 528
 				</tr>
529 529
 
530 530
 				<tr valign="top" class="give-import-dropdown">
531
-					<th><b><?php _e( 'Column name', 'give' ); ?></b></th>
532
-					<th><b><?php _e( 'Map to field', 'give' ); ?></b></th>
531
+					<th><b><?php _e('Column name', 'give'); ?></b></th>
532
+					<th><b><?php _e('Map to field', 'give'); ?></b></th>
533 533
 				</tr>
534 534
 
535 535
 				<?php
536
-				$raw_key = $this->get_importer( $csv, 0, $delimiter );
537
-				$mapto   = (array) ( isset( $_REQUEST['mapto'] ) ? $_REQUEST['mapto'] : array() );
536
+				$raw_key = $this->get_importer($csv, 0, $delimiter);
537
+				$mapto   = (array) (isset($_REQUEST['mapto']) ? $_REQUEST['mapto'] : array());
538 538
 
539
-				foreach ( $raw_key as $index => $value ) {
539
+				foreach ($raw_key as $index => $value) {
540 540
 					?>
541 541
 					<tr valign="top" class="give-import-option">
542 542
 						<th><?php echo $value; ?></th>
543 543
 						<th>
544 544
 							<?php
545
-							$this->get_columns( $index, $value, $mapto );
545
+							$this->get_columns($index, $value, $mapto);
546 546
 							?>
547 547
 						</th>
548 548
 					</tr>
@@ -557,14 +557,14 @@  discard block
 block discarded – undo
557 557
 		 *
558 558
 		 * @return string
559 559
 		 */
560
-		public function selected( $option_value, $value ) {
561
-			$option_value = strtolower( $option_value );
562
-			$value        = strtolower( $value );
560
+		public function selected($option_value, $value) {
561
+			$option_value = strtolower($option_value);
562
+			$value        = strtolower($value);
563 563
 
564 564
 			$selected = '';
565
-			if ( stristr( $value, $option_value ) ) {
565
+			if (stristr($value, $option_value)) {
566 566
 				$selected = 'selected';
567
-			} elseif ( strrpos( $value, 'give_' ) && stristr( $option_value, __( 'Import as Meta', 'give' ) ) ) {
567
+			} elseif (strrpos($value, 'give_') && stristr($option_value, __('Import as Meta', 'give'))) {
568 568
 				$selected = 'selected';
569 569
 			}
570 570
 
@@ -583,28 +583,28 @@  discard block
 block discarded – undo
583 583
 		 *
584 584
 		 * @return void
585 585
 		 */
586
-		private function get_columns( $index, $value = false, $mapto = array() ) {
586
+		private function get_columns($index, $value = false, $mapto = array()) {
587 587
 			$default       = give_import_default_options();
588
-			$current_mapto = (string) ( ! empty( $mapto[ $index ] ) ? $mapto[ $index ] : '' );
588
+			$current_mapto = (string) ( ! empty($mapto[$index]) ? $mapto[$index] : '');
589 589
 			?>
590 590
 			<select name="mapto[<?php echo $index; ?>]">
591
-				<?php $this->get_dropdown_option_html( $default, $current_mapto, $value ); ?>
591
+				<?php $this->get_dropdown_option_html($default, $current_mapto, $value); ?>
592 592
 
593
-				<optgroup label="<?php _e( 'Donations', 'give' ); ?>">
593
+				<optgroup label="<?php _e('Donations', 'give'); ?>">
594 594
 					<?php
595
-					$this->get_dropdown_option_html( give_import_donations_options(), $current_mapto, $value );
595
+					$this->get_dropdown_option_html(give_import_donations_options(), $current_mapto, $value);
596 596
 					?>
597 597
 				</optgroup>
598 598
 
599
-				<optgroup label="<?php _e( 'Donors', 'give' ); ?>">
599
+				<optgroup label="<?php _e('Donors', 'give'); ?>">
600 600
 					<?php
601
-					$this->get_dropdown_option_html( give_import_donor_options(), $current_mapto, $value );
601
+					$this->get_dropdown_option_html(give_import_donor_options(), $current_mapto, $value);
602 602
 					?>
603 603
 				</optgroup>
604 604
 
605
-				<optgroup label="<?php _e( 'Forms', 'give' ); ?>">
605
+				<optgroup label="<?php _e('Forms', 'give'); ?>">
606 606
 					<?php
607
-					$this->get_dropdown_option_html( give_import_donation_form_options(), $current_mapto, $value );
607
+					$this->get_dropdown_option_html(give_import_donation_form_options(), $current_mapto, $value);
608 608
 					?>
609 609
 				</optgroup>
610 610
 
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 				 *
616 616
 				 * @since 1.8.15
617 617
 				 */
618
-				do_action( 'give_import_dropdown_option', $index, $value, $mapto, $current_mapto );
618
+				do_action('give_import_dropdown_option', $index, $value, $mapto, $current_mapto);
619 619
 				?>
620 620
 			</select>
621 621
 			<?php
@@ -633,16 +633,16 @@  discard block
 block discarded – undo
633 633
 		 *
634 634
 		 * @return void
635 635
 		 */
636
-		public function get_dropdown_option_html( $options, $current_mapto, $value = false ) {
637
-			foreach ( $options as $option => $option_value ) {
636
+		public function get_dropdown_option_html($options, $current_mapto, $value = false) {
637
+			foreach ($options as $option => $option_value) {
638 638
 				$option_value_texts = (array) $option_value;
639 639
 				$option_text        = $option_value_texts[0];
640 640
 
641
-				$checked = ( ( $current_mapto === $option ) ? 'selected' : false );
642
-				if ( empty( $checked ) ) {
643
-					foreach ( $option_value_texts as $option_value_text ) {
644
-						$checked = $this->selected( $option_value_text, $value );
645
-						if ( $checked ) {
641
+				$checked = (($current_mapto === $option) ? 'selected' : false);
642
+				if (empty($checked)) {
643
+					foreach ($option_value_texts as $option_value_text) {
644
+						$checked = $this->selected($option_value_text, $value);
645
+						if ($checked) {
646 646
 							break;
647 647
 						}
648 648
 					}
@@ -666,12 +666,12 @@  discard block
 block discarded – undo
666 666
 		 *
667 667
 		 * @return bool|int
668 668
 		 */
669
-		public function get_csv_total( $file_id ) {
669
+		public function get_csv_total($file_id) {
670 670
 			$total = false;
671
-			if ( $file_id ) {
672
-				$file_dir = get_attached_file( $file_id );
673
-				if ( $file_dir ) {
674
-					$total = $this->get_csv_data_from_file_dir( $file_dir );
671
+			if ($file_id) {
672
+				$file_dir = get_attached_file($file_id);
673
+				if ($file_dir) {
674
+					$total = $this->get_csv_data_from_file_dir($file_dir);
675 675
 				}
676 676
 			}
677 677
 
@@ -687,11 +687,11 @@  discard block
 block discarded – undo
687 687
 		 *
688 688
 		 * @return bool|int
689 689
 		 */
690
-		public function get_csv_data_from_file_dir( $file_dir ) {
690
+		public function get_csv_data_from_file_dir($file_dir) {
691 691
 			$total = false;
692
-			if ( $file_dir ) {
693
-				$file = new SplFileObject( $file_dir, 'r' );
694
-				$file->seek( PHP_INT_MAX );
692
+			if ($file_dir) {
693
+				$file = new SplFileObject($file_dir, 'r');
694
+				$file->seek(PHP_INT_MAX);
695 695
 				$total = $file->key() + 1;
696 696
 			}
697 697
 
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 		 *
710 710
 		 * @return array|bool $raw_data title of the CSV file fields
711 711
 		 */
712
-		public function get_importer( $file_id, $index = 0, $delimiter = 'csv' ) {
712
+		public function get_importer($file_id, $index = 0, $delimiter = 'csv') {
713 713
 			/**
714 714
 			 * Filter to modify delimiter of Import.
715 715
 			 *
@@ -717,16 +717,16 @@  discard block
 block discarded – undo
717 717
 			 *
718 718
 			 * Return string $delimiter.
719 719
 			 */
720
-			$delimiter = (string) apply_filters( 'give_import_delimiter_set', $delimiter );
720
+			$delimiter = (string) apply_filters('give_import_delimiter_set', $delimiter);
721 721
 
722 722
 			$raw_data = false;
723
-			$file_dir = get_attached_file( $file_id );
724
-			if ( $file_dir ) {
725
-				if ( false !== ( $handle = fopen( $file_dir, 'r' ) ) ) {
726
-					$raw_data = fgetcsv( $handle, $index, $delimiter );
723
+			$file_dir = get_attached_file($file_id);
724
+			if ($file_dir) {
725
+				if (false !== ($handle = fopen($file_dir, 'r'))) {
726
+					$raw_data = fgetcsv($handle, $index, $delimiter);
727 727
 					// Remove BOM signature from the first item.
728
-					if ( isset( $raw_data[0] ) ) {
729
-						$raw_data[0] = $this->remove_utf8_bom( $raw_data[0] );
728
+					if (isset($raw_data[0])) {
729
+						$raw_data[0] = $this->remove_utf8_bom($raw_data[0]);
730 730
 					}
731 731
 				}
732 732
 			}
@@ -743,9 +743,9 @@  discard block
 block discarded – undo
743 743
 		 *
744 744
 		 * @return string
745 745
 		 */
746
-		public function remove_utf8_bom( $string ) {
747
-			if ( 'efbbbf' === substr( bin2hex( $string ), 0, 6 ) ) {
748
-				$string = substr( $string, 3 );
746
+		public function remove_utf8_bom($string) {
747
+			if ('efbbbf' === substr(bin2hex($string), 0, 6)) {
748
+				$string = substr($string, 3);
749 749
 			}
750 750
 
751 751
 			return $string;
@@ -760,17 +760,17 @@  discard block
 block discarded – undo
760 760
 			$step = $this->get_step();
761 761
 			?>
762 762
 			<ol class="give-progress-steps">
763
-				<li class="<?php echo( 1 === $step ? 'active' : '' ); ?>">
764
-					<?php _e( 'Upload CSV file', 'give' ); ?>
763
+				<li class="<?php echo(1 === $step ? 'active' : ''); ?>">
764
+					<?php _e('Upload CSV file', 'give'); ?>
765 765
 				</li>
766
-				<li class="<?php echo( 2 === $step ? 'active' : '' ); ?>">
767
-					<?php _e( 'Column mapping', 'give' ); ?>
766
+				<li class="<?php echo(2 === $step ? 'active' : ''); ?>">
767
+					<?php _e('Column mapping', 'give'); ?>
768 768
 				</li>
769
-				<li class="<?php echo( 3 === $step ? 'active' : '' ); ?>">
770
-					<?php _e( 'Import', 'give' ); ?>
769
+				<li class="<?php echo(3 === $step ? 'active' : ''); ?>">
770
+					<?php _e('Import', 'give'); ?>
771 771
 				</li>
772
-				<li class="<?php echo( 4 === $step ? 'active' : '' ); ?>">
773
-					<?php _e( 'Done!', 'give' ); ?>
772
+				<li class="<?php echo(4 === $step ? 'active' : ''); ?>">
773
+					<?php _e('Done!', 'give'); ?>
774 774
 				</li>
775 775
 			</ol>
776 776
 			<?php
@@ -784,16 +784,16 @@  discard block
 block discarded – undo
784 784
 		 * @return int $step on which step doest the import is on.
785 785
 		 */
786 786
 		public function get_step() {
787
-			$step    = (int) ( isset( $_REQUEST['step'] ) ? give_clean( $_REQUEST['step'] ) : 0 );
787
+			$step    = (int) (isset($_REQUEST['step']) ? give_clean($_REQUEST['step']) : 0);
788 788
 			$on_step = 1;
789 789
 
790
-			if ( empty( $step ) || 1 === $step ) {
790
+			if (empty($step) || 1 === $step) {
791 791
 				$on_step = 1;
792
-			} elseif ( $this->check_for_dropdown_or_import() ) {
792
+			} elseif ($this->check_for_dropdown_or_import()) {
793 793
 				$on_step = 3;
794
-			} elseif ( 2 === $step ) {
794
+			} elseif (2 === $step) {
795 795
 				$on_step = 2;
796
-			} elseif ( 4 === $step ) {
796
+			} elseif (4 === $step) {
797 797
 				$on_step = 4;
798 798
 			}
799 799
 
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
 		 * @since 1.8.14
807 807
 		 */
808 808
 		public function render_page() {
809
-			include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-import-donations.php';
809
+			include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-import-donations.php';
810 810
 		}
811 811
 
812 812
 		/**
@@ -815,18 +815,18 @@  discard block
 block discarded – undo
815 815
 		 * @since 2.1
816 816
 		 */
817 817
 		public function give_import_donation_submit_button_render_media_csv() {
818
-			$dry_run = isset( $_POST['dry_run'] ) ? absint( $_POST['dry_run'] ) : 1;
818
+			$dry_run = isset($_POST['dry_run']) ? absint($_POST['dry_run']) : 1;
819 819
 			?>
820 820
 			<div>
821 821
 				<label for="dry_run">
822 822
 					<input type="hidden" name="dry_run" value="0"/>
823 823
 					<input type="checkbox" name="dry_run" id="dry_run" class="dry_run"
824
-						   value="1" <?php checked( 1, $dry_run ); ?> >
825
-					<strong><?php _e( 'Dry Run', 'give' ); ?></strong>
824
+						   value="1" <?php checked(1, $dry_run); ?> >
825
+					<strong><?php _e('Dry Run', 'give'); ?></strong>
826 826
 				</label>
827 827
 				<p class="give-field-description">
828 828
 					<?php
829
-					_e( 'Preview what the import would look like without making any default changes to your site or your database.', 'give' );
829
+					_e('Preview what the import would look like without making any default changes to your site or your database.', 'give');
830 830
 					?>
831 831
 				</p>
832 832
 			</div>
@@ -842,8 +842,8 @@  discard block
 block discarded – undo
842 842
 		 *
843 843
 		 * @return string
844 844
 		 */
845
-		function give_import_donation_submit_text_render_media_csv( $text ) {
846
-			return __( 'Begin Import', 'give' );
845
+		function give_import_donation_submit_text_render_media_csv($text) {
846
+			return __('Begin Import', 'give');
847 847
 		}
848 848
 
849 849
 		/**
@@ -855,60 +855,57 @@  discard block
 block discarded – undo
855 855
 		 * @return void
856 856
 		 */
857 857
 		public function render_media_csv() {
858
-			add_filter( 'give_import_donation_submit_button_text', array(
858
+			add_filter('give_import_donation_submit_button_text', array(
859 859
 				$this,
860 860
 				'give_import_donation_submit_text_render_media_csv'
861
-			) );
862
-			add_action( 'give_import_donation_submit_button', array(
861
+			));
862
+			add_action('give_import_donation_submit_button', array(
863 863
 				$this,
864 864
 				'give_import_donation_submit_button_render_media_csv'
865
-			) );
865
+			));
866 866
 			?>
867 867
 			<tr valign="top">
868 868
 				<th colspan="2">
869
-					<h2 id="give-import-title"><?php _e( 'Import donations from a CSV file', 'give' ) ?></h2>
870
-					<p class="give-field-description"><?php _e( 'This tool allows you to import or add donation data to your give form(s) via a CSV file.', 'give' ) ?></p>
869
+					<h2 id="give-import-title"><?php _e('Import donations from a CSV file', 'give') ?></h2>
870
+					<p class="give-field-description"><?php _e('This tool allows you to import or add donation data to your give form(s) via a CSV file.', 'give') ?></p>
871 871
 				</th>
872 872
 			</tr>
873 873
 			<?php
874
-			$csv         = ( isset( $_POST['csv'] ) ? give_clean( $_POST['csv'] ) : '' );
875
-			$csv_id      = ( isset( $_POST['csv_id'] ) ? give_clean( $_POST['csv_id'] ) : '' );
876
-			$delimiter   = ( isset( $_POST['delimiter'] ) ? give_clean( $_POST['delimiter'] ) : 'csv' );
877
-			$mode        = empty( $_POST['mode'] ) ?
878
-				'disabled' :
879
-				( give_is_setting_enabled( give_clean( $_POST['mode'] ) ) ? 'enabled' : 'disabled' );
880
-			$create_user = empty( $_POST['create_user'] ) ?
881
-				'disabled' :
882
-				( give_is_setting_enabled( give_clean( $_POST['create_user'] ) ) ? 'enabled' : 'disabled' );
883
-			$delete_csv  = empty( $_POST['delete_csv'] ) ?
884
-				'enabled' :
885
-				( give_is_setting_enabled( give_clean( $_POST['delete_csv'] ) ) ? 'enabled' : 'disabled' );
874
+			$csv         = (isset($_POST['csv']) ? give_clean($_POST['csv']) : '');
875
+			$csv_id      = (isset($_POST['csv_id']) ? give_clean($_POST['csv_id']) : '');
876
+			$delimiter   = (isset($_POST['delimiter']) ? give_clean($_POST['delimiter']) : 'csv');
877
+			$mode        = empty($_POST['mode']) ?
878
+				'disabled' : (give_is_setting_enabled(give_clean($_POST['mode'])) ? 'enabled' : 'disabled');
879
+			$create_user = empty($_POST['create_user']) ?
880
+				'disabled' : (give_is_setting_enabled(give_clean($_POST['create_user'])) ? 'enabled' : 'disabled');
881
+			$delete_csv  = empty($_POST['delete_csv']) ?
882
+				'enabled' : (give_is_setting_enabled(give_clean($_POST['delete_csv'])) ? 'enabled' : 'disabled');
886 883
 
887 884
 			// Reset csv and csv_id if csv
888
-			if ( empty( $csv_id ) || ! $this->is_valid_csv( $csv_id, $csv ) ) {
885
+			if (empty($csv_id) || ! $this->is_valid_csv($csv_id, $csv)) {
889 886
 				$csv_id = $csv = '';
890 887
 			}
891
-			$per_page = isset( $_POST['per_page'] ) ? absint( $_POST['per_page'] ) : self::$per_page;
888
+			$per_page = isset($_POST['per_page']) ? absint($_POST['per_page']) : self::$per_page;
892 889
 
893 890
 			$sample_file_text = sprintf(
894 891
 				'%s <a href="%s">%s</a>.',
895
-				__( 'Download the sample file', 'give' ),
896
-				esc_url( GIVE_PLUGIN_URL . 'sample-data/sample-data.csv' ),
897
-				__( 'here', 'give' )
892
+				__('Download the sample file', 'give'),
893
+				esc_url(GIVE_PLUGIN_URL.'sample-data/sample-data.csv'),
894
+				__('here', 'give')
898 895
 			);
899 896
 
900 897
 			$csv_description = sprintf(
901 898
 				'%1$s %2$s',
902
-				__( 'The file must be a Comma Seperated Version (CSV) file type only.', 'give' ),
899
+				__('The file must be a Comma Seperated Version (CSV) file type only.', 'give'),
903 900
 				$sample_file_text
904 901
 			);
905 902
 
906 903
 			$settings = array(
907 904
 				array(
908 905
 					'id'          => 'csv',
909
-					'name'        => __( 'Choose a CSV file:', 'give' ),
906
+					'name'        => __('Choose a CSV file:', 'give'),
910 907
 					'type'        => 'file',
911
-					'attributes'  => array( 'editing' => 'false', 'library' => 'text' ),
908
+					'attributes'  => array('editing' => 'false', 'library' => 'text'),
912 909
 					'description' => $csv_description,
913 910
 					'fvalue'      => 'url',
914 911
 					'default'     => $csv,
@@ -920,62 +917,62 @@  discard block
 block discarded – undo
920 917
 				),
921 918
 				array(
922 919
 					'id'          => 'delimiter',
923
-					'name'        => __( 'CSV Delimiter:', 'give' ),
924
-					'description' => __( 'In case your CSV file supports a different type of separator (or delimiter) -- like a tab or space -- you can set that here.', 'give' ),
920
+					'name'        => __('CSV Delimiter:', 'give'),
921
+					'description' => __('In case your CSV file supports a different type of separator (or delimiter) -- like a tab or space -- you can set that here.', 'give'),
925 922
 					'default'     => $delimiter,
926 923
 					'type'        => 'select',
927 924
 					'options'     => array(
928
-						'csv'                  => __( 'Comma', 'give' ),
929
-						'tab-separated-values' => __( 'Tab', 'give' ),
925
+						'csv'                  => __('Comma', 'give'),
926
+						'tab-separated-values' => __('Tab', 'give'),
930 927
 					),
931 928
 				),
932 929
 				array(
933 930
 					'id'          => 'mode',
934
-					'name'        => __( 'Test Mode:', 'give' ),
935
-					'description' => __( 'Select whether you would like these donations to be marked as "test" donations within the database. By default, they will be marked as live donations.', 'give' ),
931
+					'name'        => __('Test Mode:', 'give'),
932
+					'description' => __('Select whether you would like these donations to be marked as "test" donations within the database. By default, they will be marked as live donations.', 'give'),
936 933
 					'default'     => $mode,
937 934
 					'type'        => 'radio_inline',
938 935
 					'options'     => array(
939
-						'enabled'  => __( 'Enabled', 'give' ),
940
-						'disabled' => __( 'Disabled', 'give' ),
936
+						'enabled'  => __('Enabled', 'give'),
937
+						'disabled' => __('Disabled', 'give'),
941 938
 					),
942 939
 				),
943 940
 				array(
944 941
 					'id'          => 'create_user',
945
-					'name'        => __( 'Create WP users for new donors:', 'give' ),
946
-					'description' => __( 'The importer can create WordPress user accounts based on the names and email addresses of the donations in your CSV file. Enable this option if you\'d like the importer to do that.', 'give' ),
942
+					'name'        => __('Create WP users for new donors:', 'give'),
943
+					'description' => __('The importer can create WordPress user accounts based on the names and email addresses of the donations in your CSV file. Enable this option if you\'d like the importer to do that.', 'give'),
947 944
 					'default'     => $create_user,
948 945
 					'type'        => 'radio_inline',
949 946
 					'options'     => array(
950
-						'enabled'  => __( 'Enabled', 'give' ),
951
-						'disabled' => __( 'Disabled', 'give' ),
947
+						'enabled'  => __('Enabled', 'give'),
948
+						'disabled' => __('Disabled', 'give'),
952 949
 					),
953 950
 				),
954 951
 				array(
955 952
 					'id'          => 'delete_csv',
956
-					'name'        => __( 'Delete CSV after import:', 'give' ),
957
-					'description' => __( 'Your CSV file will be uploaded via the WordPress Media Library. It\'s a good idea to delete it after the import is finished so that your sensitive data is not accessible on the web. Disable this only if you plan to delete the file manually later.', 'give' ),
953
+					'name'        => __('Delete CSV after import:', 'give'),
954
+					'description' => __('Your CSV file will be uploaded via the WordPress Media Library. It\'s a good idea to delete it after the import is finished so that your sensitive data is not accessible on the web. Disable this only if you plan to delete the file manually later.', 'give'),
958 955
 					'default'     => $delete_csv,
959 956
 					'type'        => 'radio_inline',
960 957
 					'options'     => array(
961
-						'enabled'  => __( 'Enabled', 'give' ),
962
-						'disabled' => __( 'Disabled', 'give' ),
958
+						'enabled'  => __('Enabled', 'give'),
959
+						'disabled' => __('Disabled', 'give'),
963 960
 					),
964 961
 				),
965 962
 				array(
966 963
 					'id'          => 'per_page',
967
-					'name'        => __( 'Process Rows Per Batch:', 'give' ),
964
+					'name'        => __('Process Rows Per Batch:', 'give'),
968 965
 					'type'        => 'number',
969
-					'description' => __( 'Determine how many rows you would like to import per cycle.', 'give' ),
966
+					'description' => __('Determine how many rows you would like to import per cycle.', 'give'),
970 967
 					'default'     => $per_page,
971 968
 					'class'       => 'give-text-small',
972 969
 				),
973 970
 			);
974 971
 
975
-			$settings = apply_filters( 'give_import_file_upload_html', $settings );
972
+			$settings = apply_filters('give_import_file_upload_html', $settings);
976 973
 
977
-			if ( empty( $this->is_csv_valid ) ) {
978
-				Give_Admin_Settings::output_fields( $settings, 'give_settings' );
974
+			if (empty($this->is_csv_valid)) {
975
+				Give_Admin_Settings::output_fields($settings, 'give_settings');
979 976
 			} else {
980 977
 				?>
981 978
 				<input type="hidden" name="is_csv_valid" class="is_csv_valid"
@@ -994,28 +991,25 @@  discard block
 block discarded – undo
994 991
 			$step = $this->get_step();
995 992
 
996 993
 			// Validation for first step.
997
-			if ( 1 === $step ) {
998
-				$csv_id = absint( $_POST['csv_id'] );
994
+			if (1 === $step) {
995
+				$csv_id = absint($_POST['csv_id']);
999 996
 
1000
-				if ( $this->is_valid_csv( $csv_id, esc_url( $_POST['csv'] ) ) ) {
997
+				if ($this->is_valid_csv($csv_id, esc_url($_POST['csv']))) {
1001 998
 
1002
-					$url = give_import_page_url( (array) apply_filters( 'give_import_step_two_url', array(
999
+					$url = give_import_page_url((array) apply_filters('give_import_step_two_url', array(
1003 1000
 						'step'          => '2',
1004 1001
 						'importer-type' => $this->importer_type,
1005 1002
 						'csv'           => $csv_id,
1006
-						'delimiter'     => isset( $_REQUEST['delimiter'] ) ? give_clean( $_REQUEST['delimiter'] ) : 'csv',
1007
-						'mode'          => empty( $_POST['mode'] ) ?
1008
-							'0' :
1009
-							( give_is_setting_enabled( give_clean( $_POST['mode'] ) ) ? '1' : '0' ),
1010
-						'create_user'   => empty( $_POST['create_user'] ) ?
1011
-							'0' :
1012
-							( give_is_setting_enabled( give_clean( $_POST['create_user'] ) ) ? '1' : '0' ),
1013
-						'delete_csv'    => empty( $_POST['delete_csv'] ) ?
1014
-							'1' :
1015
-							( give_is_setting_enabled( give_clean( $_POST['delete_csv'] ) ) ? '1' : '0' ),
1016
-						'per_page'      => isset( $_POST['per_page'] ) ? absint( $_POST['per_page'] ) : self::$per_page,
1017
-						'dry_run'       => isset( $_POST['dry_run'] ) ? absint( $_POST['dry_run'] ) : 0,
1018
-					) ) );
1003
+						'delimiter'     => isset($_REQUEST['delimiter']) ? give_clean($_REQUEST['delimiter']) : 'csv',
1004
+						'mode'          => empty($_POST['mode']) ?
1005
+							'0' : (give_is_setting_enabled(give_clean($_POST['mode'])) ? '1' : '0'),
1006
+						'create_user'   => empty($_POST['create_user']) ?
1007
+							'0' : (give_is_setting_enabled(give_clean($_POST['create_user'])) ? '1' : '0'),
1008
+						'delete_csv'    => empty($_POST['delete_csv']) ?
1009
+							'1' : (give_is_setting_enabled(give_clean($_POST['delete_csv'])) ? '1' : '0'),
1010
+						'per_page'      => isset($_POST['per_page']) ? absint($_POST['per_page']) : self::$per_page,
1011
+						'dry_run'       => isset($_POST['dry_run']) ? absint($_POST['dry_run']) : 0,
1012
+					)));
1019 1013
 
1020 1014
 					$this->is_csv_valid = $url;
1021 1015
 				}
@@ -1033,25 +1027,25 @@  discard block
 block discarded – undo
1033 1027
 		 *
1034 1028
 		 * @return bool $has_error CSV is valid or not.
1035 1029
 		 */
1036
-		private function is_valid_csv( $csv = false, $match_url = '' ) {
1030
+		private function is_valid_csv($csv = false, $match_url = '') {
1037 1031
 			$is_valid_csv = true;
1038 1032
 
1039
-			if ( $csv ) {
1040
-				$csv_url = wp_get_attachment_url( $csv );
1033
+			if ($csv) {
1034
+				$csv_url = wp_get_attachment_url($csv);
1041 1035
 
1042
-				$delimiter = ( ! empty( $_REQUEST['delimiter'] ) ? give_clean( $_REQUEST['delimiter'] ) : 'csv' );
1036
+				$delimiter = ( ! empty($_REQUEST['delimiter']) ? give_clean($_REQUEST['delimiter']) : 'csv');
1043 1037
 
1044 1038
 				if (
1045 1039
 					! $csv_url ||
1046
-					( ! empty( $match_url ) && ( $csv_url !== $match_url ) ) ||
1047
-					( ( $mime_type = get_post_mime_type( $csv ) ) && ! strpos( $mime_type, $delimiter ) )
1040
+					( ! empty($match_url) && ($csv_url !== $match_url)) ||
1041
+					(($mime_type = get_post_mime_type($csv)) && ! strpos($mime_type, $delimiter))
1048 1042
 				) {
1049 1043
 					$is_valid_csv = false;
1050
-					Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid CSV file.', 'give' ) );
1044
+					Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid CSV file.', 'give'));
1051 1045
 				}
1052 1046
 			} else {
1053 1047
 				$is_valid_csv = false;
1054
-				Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid CSV file.', 'give' ) );
1048
+				Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid CSV file.', 'give'));
1055 1049
 			}
1056 1050
 
1057 1051
 			return $is_valid_csv;
@@ -1067,8 +1061,8 @@  discard block
 block discarded – undo
1067 1061
 		 * @param $field
1068 1062
 		 * @param $option_value
1069 1063
 		 */
1070
-		public function render_import_field( $field, $option_value ) {
1071
-			include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-imports.php';
1064
+		public function render_import_field($field, $option_value) {
1065
+			include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-imports.php';
1072 1066
 		}
1073 1067
 
1074 1068
 		/**
@@ -1079,8 +1073,8 @@  discard block
 block discarded – undo
1079 1073
 		 */
1080 1074
 		private function is_donations_import_page() {
1081 1075
 			return 'import' === give_get_current_setting_tab() &&
1082
-			       isset( $_GET['importer-type'] ) &&
1083
-			       $this->importer_type === give_clean( $_GET['importer-type'] );
1076
+			       isset($_GET['importer-type']) &&
1077
+			       $this->importer_type === give_clean($_GET['importer-type']);
1084 1078
 		}
1085 1079
 	}
1086 1080
 
Please login to merge, or discard this patch.
includes/price-functions.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return bool true if has variable prices, false otherwise
25 25
  */
26
-function give_has_variable_prices( $form_id = 0 ) {
26
+function give_has_variable_prices($form_id = 0) {
27 27
 
28
-	if ( empty( $form_id ) ) {
28
+	if (empty($form_id)) {
29 29
 		return false;
30 30
 	}
31 31
 
32
-	$form = new Give_Donate_Form( $form_id );
32
+	$form = new Give_Donate_Form($form_id);
33 33
 
34 34
 	return $form->has_variable_prices();
35 35
 }
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
  *
45 45
  * @return array|bool Variable prices
46 46
  */
47
-function give_get_variable_prices( $form_id = 0 ) {
47
+function give_get_variable_prices($form_id = 0) {
48 48
 
49
-	if ( empty( $form_id ) ) {
49
+	if (empty($form_id)) {
50 50
 		return false;
51 51
 	}
52 52
 
53
-	$form = new Give_Donate_Form( $form_id );
53
+	$form = new Give_Donate_Form($form_id);
54 54
 
55 55
 	return $form->prices;
56 56
 
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
  *
66 66
  * @return array Variable prices
67 67
  */
68
-function give_get_variable_price_ids( $form_id = 0 ) {
69
-	if( ! ( $prices = give_get_variable_prices( $form_id ) ) ) {
68
+function give_get_variable_price_ids($form_id = 0) {
69
+	if ( ! ($prices = give_get_variable_prices($form_id))) {
70 70
 		return array();
71 71
 	}
72 72
 
73 73
 	$price_ids = array();
74
-	foreach ( $prices as $price ){
74
+	foreach ($prices as $price) {
75 75
 		$price_ids[] = $price['_give_id']['level_id'];
76 76
 	}
77 77
 
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
  *
90 90
  * @return string $default_price
91 91
  */
92
-function give_get_default_multilevel_amount( $form_id ) {
92
+function give_get_default_multilevel_amount($form_id) {
93 93
 	$default_price = '1.00';
94
-	$prices        = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
94
+	$prices        = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
95 95
 
96
-	foreach ( $prices as $price ) {
96
+	foreach ($prices as $price) {
97 97
 
98
-		if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
98
+		if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
99 99
 			$default_price = $price['_give_amount'];
100 100
 		}
101 101
 
@@ -116,19 +116,19 @@  discard block
 block discarded – undo
116 116
  * @return string $default_price
117 117
  * @since      1.0
118 118
  */
119
-function give_get_default_form_amount( $form_id ) {
119
+function give_get_default_form_amount($form_id) {
120 120
 
121
-	if ( give_has_variable_prices( $form_id ) ) {
121
+	if (give_has_variable_prices($form_id)) {
122 122
 
123
-		$default_amount = give_get_default_multilevel_amount( $form_id );
123
+		$default_amount = give_get_default_multilevel_amount($form_id);
124 124
 
125 125
 	} else {
126 126
 
127
-		$default_amount = give_get_meta( $form_id, '_give_set_price', true );
127
+		$default_amount = give_get_meta($form_id, '_give_set_price', true);
128 128
 
129 129
 	}
130 130
 
131
-	return apply_filters( 'give_default_form_amount', $default_amount, $form_id );
131
+	return apply_filters('give_default_form_amount', $default_amount, $form_id);
132 132
 
133 133
 }
134 134
 
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
  *
147 147
  * @return bool
148 148
  */
149
-function give_is_custom_price_mode( $form_id = 0 ) {
149
+function give_is_custom_price_mode($form_id = 0) {
150 150
 
151
-	if ( empty( $form_id ) ) {
151
+	if (empty($form_id)) {
152 152
 		return false;
153 153
 	}
154 154
 
155
-	$form = new Give_Donate_Form( $form_id );
155
+	$form = new Give_Donate_Form($form_id);
156 156
 
157 157
 	return $form->is_custom_price_mode();
158 158
 }
159 159
\ No newline at end of file
Please login to merge, or discard this patch.
includes/forms/template.php 4 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1020,9 +1020,12 @@
 block discarded – undo
1020 1020
 				    }
1021 1021
 				    ?>
1022 1022
 			    </select>
1023
-		    <?php else : ?>
1023
+		    <?php else {
1024
+	: ?>
1024 1025
 			    <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input"
1025
-			           placeholder="<?php echo $label; ?>" value="<?php echo $selected_state; ?>"/>
1026
+			           placeholder="<?php echo $label;
1027
+}
1028
+?>" value="<?php echo $selected_state; ?>"/>
1026 1029
 		    <?php endif; ?>
1027 1030
 	    </p>
1028 1031
 
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -928,10 +928,10 @@  discard block
 block discarded – undo
928 928
 			    <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
929 929
 		    >
930 930
 			    <?php
931
-			    foreach ( $countries as $country_code => $country ) {
932
-				    echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
933
-			    }
934
-			    ?>
931
+				foreach ( $countries as $country_code => $country ) {
932
+					echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
933
+				}
934
+				?>
935 935
 		    </select>
936 936
 	    </p>
937 937
 
@@ -1000,7 +1000,7 @@  discard block
 block discarded – undo
1000 1000
 		    <label for="card_state" class="give-label">
1001 1001
 			    <span class="state-label-text"><?php echo $label; ?></span>
1002 1002
 			    <?php if ( give_field_is_required( 'card_state', $form_id ) ) :
1003
-				    ?>
1003
+					?>
1004 1004
 				    <span class="give-required-indicator <?php echo( array_key_exists( $selected_country, $states_not_required_country_list ) ? 'give-hidden' : '' ) ?> ">*</span>
1005 1005
 			    <?php endif; ?>
1006 1006
 			    <span class="give-tooltip give-icon give-icon-question"
@@ -1008,17 +1008,17 @@  discard block
 block discarded – undo
1008 1008
 		    </label>
1009 1009
 		    <?php
1010 1010
 
1011
-		    if ( ! empty( $states ) ) : ?>
1011
+			if ( ! empty( $states ) ) : ?>
1012 1012
 			    <select
1013 1013
 					    name="card_state"
1014 1014
 					    id="card_state"
1015 1015
 					    class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>"
1016 1016
 				    <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>>
1017 1017
 				    <?php
1018
-				    foreach ( $states as $state_code => $state ) {
1019
-					    echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
1020
-				    }
1021
-				    ?>
1018
+					foreach ( $states as $state_code => $state ) {
1019
+						echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
1020
+					}
1021
+					?>
1022 1022
 			    </select>
1023 1023
 		    <?php else : ?>
1024 1024
 			    <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input"
@@ -1218,8 +1218,8 @@  discard block
 block discarded – undo
1218 1218
 				<a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel"
1219 1219
 				   data-action="give_checkout_register">
1220 1220
 					<?php if ( give_logged_in_only( $form_id ) ) {
1221
-					    _e( 'Register as a part of your donation &raquo;', 'give' );
1222
-                    } else {
1221
+						_e( 'Register as a part of your donation &raquo;', 'give' );
1222
+					} else {
1223 1223
 						 _e( 'Register or donate as a guest &raquo;', 'give' );
1224 1224
 					} ?>
1225 1225
 				</a>
Please login to merge, or discard this patch.
Doc Comments   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @since 1.0
23 23
  *
24
- * @return string Donation form.
24
+ * @return false|null Donation form.
25 25
  */
26 26
 function give_get_donation_form( $args = array() ) {
27 27
 
@@ -1482,7 +1482,7 @@  discard block
 block discarded – undo
1482 1482
  *
1483 1483
  * @param  int $form_id The form ID.
1484 1484
  *
1485
- * @return bool
1485
+ * @return false|null
1486 1486
  */
1487 1487
 function give_terms_agreement( $form_id ) {
1488 1488
 	$form_option = give_get_meta( $form_id, '_give_terms_option', true );
@@ -1676,7 +1676,7 @@  discard block
 block discarded – undo
1676 1676
  * @param  int   $form_id The form ID.
1677 1677
  * @param  array $args    An array of form arguments.
1678 1678
  *
1679
- * @return mixed
1679
+ * @return boolean
1680 1680
  */
1681 1681
 function give_show_goal_progress( $form_id, $args = array() ) {
1682 1682
 
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
  * @param  int $total      Total amount based on shortcode parameter.
1704 1704
  * @param  int $total_goal Total Goal amount passed by Admin.
1705 1705
  *
1706
- * @return mixed
1706
+ * @return boolean
1707 1707
  */
1708 1708
 function give_show_goal_totals_progress( $total, $total_goal ) {
1709 1709
 
@@ -1727,7 +1727,7 @@  discard block
 block discarded – undo
1727 1727
  *
1728 1728
  * @since  1.8
1729 1729
  *
1730
- * @param  $form_id
1730
+ * @param  integer $form_id
1731 1731
  * @param  $args
1732 1732
  *
1733 1733
  * @return mixed|string
@@ -1768,7 +1768,7 @@  discard block
 block discarded – undo
1768 1768
  * @param  int   $form_id The form ID.
1769 1769
  * @param  array $args    An array of form arguments.
1770 1770
  *
1771
- * @return void|bool
1771
+ * @return false|null
1772 1772
  */
1773 1773
 function give_form_content( $form_id, $args ) {
1774 1774
 
@@ -2058,7 +2058,7 @@  discard block
 block discarded – undo
2058 2058
  *
2059 2059
  * @since 2.1
2060 2060
  *
2061
- * @return array
2061
+ * @return string[]
2062 2062
  */
2063 2063
 function add_class_for_form_grid( $class, $id, $args ) {
2064 2064
 	$class[] = 'give-form-grid-wrap';
@@ -2069,7 +2069,6 @@  discard block
 block discarded – undo
2069 2069
 /**
2070 2070
  * Add hidden field to Form Grid page
2071 2071
  *
2072
- * @param int              $form_id The form ID.
2073 2072
  * @param array            $args    An array of form arguments.
2074 2073
  * @param Give_Donate_Form $form    Form object.
2075 2074
  *
Please login to merge, or discard this patch.
Spacing   +437 added lines, -439 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,50 +23,50 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string Donation form.
25 25
  */
26
-function give_get_donation_form( $args = array() ) {
26
+function give_get_donation_form($args = array()) {
27 27
 
28 28
 	global $post;
29 29
 
30
-	$form_id = is_object( $post ) ? $post->ID : 0;
30
+	$form_id = is_object($post) ? $post->ID : 0;
31 31
 
32
-	if ( isset( $args['id'] ) ) {
32
+	if (isset($args['id'])) {
33 33
 		$form_id = $args['id'];
34 34
 	}
35 35
 
36
-	$defaults = apply_filters( 'give_form_args_defaults', array(
36
+	$defaults = apply_filters('give_form_args_defaults', array(
37 37
 		'form_id' => $form_id,
38
-	) );
38
+	));
39 39
 
40
-	$args = wp_parse_args( $args, $defaults );
40
+	$args = wp_parse_args($args, $defaults);
41 41
 
42
-	$form = new Give_Donate_Form( $args['form_id'] );
42
+	$form = new Give_Donate_Form($args['form_id']);
43 43
 
44 44
 	//bail if no form ID.
45
-	if ( empty( $form->ID ) ) {
45
+	if (empty($form->ID)) {
46 46
 		return false;
47 47
 	}
48 48
 
49
-	$payment_mode = give_get_chosen_gateway( $form->ID );
49
+	$payment_mode = give_get_chosen_gateway($form->ID);
50 50
 
51
-	$form_action = add_query_arg( apply_filters( 'give_form_action_args', array(
51
+	$form_action = add_query_arg(apply_filters('give_form_action_args', array(
52 52
 		'payment-mode' => $payment_mode,
53
-	) ),
53
+	)),
54 54
 		give_get_current_page_url()
55 55
 	);
56 56
 
57 57
 	//Sanity Check: Donation form not published or user doesn't have permission to view drafts.
58 58
 	if (
59
-		( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) )
60
-		|| ( 'trash' === $form->post_status )
59
+		('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID))
60
+		|| ('trash' === $form->post_status)
61 61
 	) {
62 62
 		return false;
63 63
 	}
64 64
 
65 65
 	//Get the form wrap CSS classes.
66
-	$form_wrap_classes = $form->get_form_wrap_classes( $args );
66
+	$form_wrap_classes = $form->get_form_wrap_classes($args);
67 67
 
68 68
 	//Get the <form> tag wrap CSS classes.
69
-	$form_classes = $form->get_form_classes( $args );
69
+	$form_classes = $form->get_form_classes($args);
70 70
 
71 71
 	ob_start();
72 72
 
@@ -78,21 +78,21 @@  discard block
 block discarded – undo
78 78
 	 * @param int   $form_id The form ID.
79 79
 	 * @param array $args    An array of form arguments.
80 80
 	 */
81
-	do_action( 'give_pre_form_output', $form->ID, $args, $form );
81
+	do_action('give_pre_form_output', $form->ID, $args, $form);
82 82
 
83 83
 	?>
84 84
 	<div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>">
85 85
 
86
-		<?php if ( $form->is_close_donation_form() ) {
86
+		<?php if ($form->is_close_donation_form()) {
87 87
 
88
-			$form_title = ! is_singular( 'give_forms' ) ? apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ) : '';
88
+			$form_title = ! is_singular('give_forms') ? apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>') : '';
89 89
 
90 90
 			// Get Goal thank you message.
91
-			$goal_achieved_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true );
92
-			$goal_achieved_message = ! empty( $goal_achieved_message ) ? $form_title . apply_filters( 'the_content', $goal_achieved_message ) : '';
91
+			$goal_achieved_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true);
92
+			$goal_achieved_message = ! empty($goal_achieved_message) ? $form_title.apply_filters('the_content', $goal_achieved_message) : '';
93 93
 
94 94
 			// Print thank you message.
95
-			echo apply_filters( 'give_goal_closed_output', $goal_achieved_message, $form->ID, $form );
95
+			echo apply_filters('give_goal_closed_output', $goal_achieved_message, $form->ID, $form);
96 96
 
97 97
 		} else {
98 98
 			/**
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
 			 * 1. if show_title params set to true
101 101
 			 * 2. if admin set form display_style to button
102 102
 			 */
103
-			$form_title = apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' );
103
+			$form_title = apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>');
104 104
 			if (
105 105
 				(
106
-					( isset( $args['show_title'] ) && $args['show_title'] == true )
107
-					|| ( 'button' === get_post_meta( $form_id, '_give_payment_display', true ) )
106
+					(isset($args['show_title']) && $args['show_title'] == true)
107
+					|| ('button' === get_post_meta($form_id, '_give_payment_display', true))
108 108
 				)
109
-				&& ! doing_action( 'give_single_form_summary' )
109
+				&& ! doing_action('give_single_form_summary')
110 110
 			) {
111 111
 				echo $form_title;
112 112
 			}
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
 			 * @param array            $args    An array of form arguments.
121 121
 			 * @param Give_Donate_Form $form    Form object.
122 122
 			 */
123
-			do_action( 'give_pre_form', $form->ID, $args, $form );
123
+			do_action('give_pre_form', $form->ID, $args, $form);
124 124
 
125 125
 			// Set form html tags.
126 126
 			$form_html_tags = array(
127 127
 				'id'     => "give-form-{$form_id}",
128 128
 				'class'  => $form_classes,
129
-				'action' => esc_url_raw( $form_action ),
129
+				'action' => esc_url_raw($form_action),
130 130
 			);
131 131
 
132 132
 			/**
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
 			 * @param array            $form_html_tags Array of form html tags.
138 138
 			 * @param Give_Donate_Form $form           Form object.
139 139
 			 */
140
-			$form_html_tags = apply_filters( 'give_form_html_tags', (array) $form_html_tags, $form );
140
+			$form_html_tags = apply_filters('give_form_html_tags', (array) $form_html_tags, $form);
141 141
 			?>
142
-			<form <?php echo give_get_attribute_str( $form_html_tags ); ?> method="post">
142
+			<form <?php echo give_get_attribute_str($form_html_tags); ?> method="post">
143 143
 
144 144
 				<!-- The following field is for robots only, invisible to humans: -->
145 145
 				<span class="give-hidden" style="display: none !important;">
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 				 * @param array            $args    An array of form arguments.
159 159
 				 * @param Give_Donate_Form $form    Form object.
160 160
 				 */
161
-				do_action( 'give_donation_form_top', $form->ID, $args, $form );
161
+				do_action('give_donation_form_top', $form->ID, $args, $form);
162 162
 
163 163
 				/**
164 164
 				 * Fires while outputting donation form, for payment gateway fields.
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 				 * @param array            $args    An array of form arguments.
170 170
 				 * @param Give_Donate_Form $form    Form object.
171 171
 				 */
172
-				do_action( 'give_payment_mode_select', $form->ID, $args, $form );
172
+				do_action('give_payment_mode_select', $form->ID, $args, $form);
173 173
 
174 174
 				/**
175 175
 				 * Fires while outputting donation form, after all other fields.
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 				 * @param array            $args    An array of form arguments.
181 181
 				 * @param Give_Donate_Form $form    Form object.
182 182
 				 */
183
-				do_action( 'give_donation_form_bottom', $form->ID, $args, $form );
183
+				do_action('give_donation_form_bottom', $form->ID, $args, $form);
184 184
 
185 185
 				?>
186 186
 			</form>
@@ -195,12 +195,12 @@  discard block
 block discarded – undo
195 195
 			 * @param array            $args    An array of form arguments.
196 196
 			 * @param Give_Donate_Form $form    Form object.
197 197
 			 */
198
-			do_action( 'give_post_form', $form->ID, $args, $form );
198
+			do_action('give_post_form', $form->ID, $args, $form);
199 199
 
200 200
 		}
201 201
 		?>
202 202
 
203
-	</div><!--end #give-form-<?php echo absint( $form->ID ); ?>-->
203
+	</div><!--end #give-form-<?php echo absint($form->ID); ?>-->
204 204
 	<?php
205 205
 
206 206
 	/**
@@ -211,11 +211,11 @@  discard block
 block discarded – undo
211 211
 	 * @param int   $form_id The form ID.
212 212
 	 * @param array $args    An array of form arguments.
213 213
 	 */
214
-	do_action( 'give_post_form_output', $form->ID, $args );
214
+	do_action('give_post_form_output', $form->ID, $args);
215 215
 
216 216
 	$final_output = ob_get_clean();
217 217
 
218
-	echo apply_filters( 'give_donate_form', $final_output, $args );
218
+	echo apply_filters('give_donate_form', $final_output, $args);
219 219
 }
220 220
 
221 221
 /**
@@ -232,11 +232,11 @@  discard block
 block discarded – undo
232 232
  *
233 233
  * @return string
234 234
  */
235
-function give_show_purchase_form( $form_id ) {
235
+function give_show_purchase_form($form_id) {
236 236
 
237
-	$payment_mode = give_get_chosen_gateway( $form_id );
237
+	$payment_mode = give_get_chosen_gateway($form_id);
238 238
 
239
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
239
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
240 240
 		$form_id = $_POST['give_form_id'];
241 241
 	}
242 242
 
@@ -245,33 +245,33 @@  discard block
 block discarded – undo
245 245
 	 *
246 246
 	 * @since 1.7
247 247
 	 */
248
-	do_action( 'give_payment_fields_top', $form_id );
248
+	do_action('give_payment_fields_top', $form_id);
249 249
 
250
-	if ( give_can_checkout() && isset( $form_id ) ) {
250
+	if (give_can_checkout() && isset($form_id)) {
251 251
 
252 252
 		/**
253 253
 		 * Fires while displaying donation form, before registration login.
254 254
 		 *
255 255
 		 * @since 1.7
256 256
 		 */
257
-		do_action( 'give_donation_form_before_register_login', $form_id );
257
+		do_action('give_donation_form_before_register_login', $form_id);
258 258
 
259 259
 		/**
260 260
 		 * Fire when register/login form fields render.
261 261
 		 *
262 262
 		 * @since 1.7
263 263
 		 */
264
-		do_action( 'give_donation_form_register_login_fields', $form_id );
264
+		do_action('give_donation_form_register_login_fields', $form_id);
265 265
 
266 266
 		/**
267 267
 		 * Fire when credit card form fields render.
268 268
 		 *
269 269
 		 * @since 1.7
270 270
 		 */
271
-		do_action( 'give_donation_form_before_cc_form', $form_id );
271
+		do_action('give_donation_form_before_cc_form', $form_id);
272 272
 
273 273
 		// Load the credit card form and allow gateways to load their own if they wish.
274
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
274
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
275 275
 			/**
276 276
 			 * Fires while displaying donation form, credit card form fields for a given gateway.
277 277
 			 *
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 			 *
280 280
 			 * @param int $form_id The form ID.
281 281
 			 */
282
-			do_action( "give_{$payment_mode}_cc_form", $form_id );
282
+			do_action("give_{$payment_mode}_cc_form", $form_id);
283 283
 		} else {
284 284
 			/**
285 285
 			 * Fires while displaying donation form, credit card form fields.
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 			 *
289 289
 			 * @param int $form_id The form ID.
290 290
 			 */
291
-			do_action( 'give_cc_form', $form_id );
291
+			do_action('give_cc_form', $form_id);
292 292
 		}
293 293
 
294 294
 		/**
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 		 *
297 297
 		 * @since 1.7
298 298
 		 */
299
-		do_action( 'give_donation_form_after_cc_form', $form_id );
299
+		do_action('give_donation_form_after_cc_form', $form_id);
300 300
 
301 301
 	} else {
302 302
 		/**
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 		 *
305 305
 		 * @since 1.7
306 306
 		 */
307
-		do_action( 'give_donation_form_no_access', $form_id );
307
+		do_action('give_donation_form_no_access', $form_id);
308 308
 
309 309
 	}
310 310
 
@@ -313,10 +313,10 @@  discard block
 block discarded – undo
313 313
 	 *
314 314
 	 * @since 1.7
315 315
 	 */
316
-	do_action( 'give_payment_fields_bottom', $form_id );
316
+	do_action('give_payment_fields_bottom', $form_id);
317 317
 }
318 318
 
319
-add_action( 'give_donation_form', 'give_show_purchase_form' );
319
+add_action('give_donation_form', 'give_show_purchase_form');
320 320
 
321 321
 /**
322 322
  * Give Show Login/Register Form Fields.
@@ -327,11 +327,11 @@  discard block
 block discarded – undo
327 327
  *
328 328
  * @return void
329 329
  */
330
-function give_show_register_login_fields( $form_id ) {
330
+function give_show_register_login_fields($form_id) {
331 331
 
332
-	$show_register_form = give_show_login_register_option( $form_id );
332
+	$show_register_form = give_show_login_register_option($form_id);
333 333
 
334
-	if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
334
+	if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) :
335 335
 		?>
336 336
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
337 337
 			<?php
@@ -340,11 +340,11 @@  discard block
 block discarded – undo
340 340
 			 *
341 341
 			 * @since 1.7
342 342
 			 */
343
-			do_action( 'give_donation_form_register_fields', $form_id );
343
+			do_action('give_donation_form_register_fields', $form_id);
344 344
 			?>
345 345
 		</div>
346 346
 		<?php
347
-	elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
347
+	elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) :
348 348
 		?>
349 349
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
350 350
 			<?php
@@ -353,23 +353,23 @@  discard block
 block discarded – undo
353 353
 			 *
354 354
 			 * @since 1.7
355 355
 			 */
356
-			do_action( 'give_donation_form_login_fields', $form_id );
356
+			do_action('give_donation_form_login_fields', $form_id);
357 357
 			?>
358 358
 		</div>
359 359
 		<?php
360 360
 	endif;
361 361
 
362
-	if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) {
362
+	if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) {
363 363
 		/**
364 364
 		 * Fire when user info render.
365 365
 		 *
366 366
 		 * @since 1.7
367 367
 		 */
368
-		do_action( 'give_donation_form_after_user_info', $form_id );
368
+		do_action('give_donation_form_after_user_info', $form_id);
369 369
 	}
370 370
 }
371 371
 
372
-add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' );
372
+add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields');
373 373
 
374 374
 /**
375 375
  * Donation Amount Field.
@@ -384,16 +384,16 @@  discard block
 block discarded – undo
384 384
  *
385 385
  * @return void
386 386
  */
387
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
387
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
388 388
 
389 389
 	$give_options        = give_get_settings();
390
-	$variable_pricing    = give_has_variable_prices( $form_id );
391
-	$allow_custom_amount = give_get_meta( $form_id, '_give_custom_amount', true );
392
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
393
-	$symbol              = give_currency_symbol( give_get_currency( $form_id, $args ) );
394
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
395
-	$default_amount      = give_format_amount( give_get_default_form_amount( $form_id ), array( 'sanitize' => false, 'currency' => give_get_currency( $form_id ) ) );
396
-	$custom_amount_text  = give_get_meta( $form_id, '_give_custom_amount_text', true );
390
+	$variable_pricing    = give_has_variable_prices($form_id);
391
+	$allow_custom_amount = give_get_meta($form_id, '_give_custom_amount', true);
392
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
393
+	$symbol              = give_currency_symbol(give_get_currency($form_id, $args));
394
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
395
+	$default_amount      = give_format_amount(give_get_default_form_amount($form_id), array('sanitize' => false, 'currency' => give_get_currency($form_id)));
396
+	$custom_amount_text  = give_get_meta($form_id, '_give_custom_amount_text', true);
397 397
 
398 398
 	/**
399 399
 	 * Fires while displaying donation form, before donation level fields.
@@ -403,20 +403,20 @@  discard block
 block discarded – undo
403 403
 	 * @param int   $form_id The form ID.
404 404
 	 * @param array $args    An array of form arguments.
405 405
 	 */
406
-	do_action( 'give_before_donation_levels', $form_id, $args );
406
+	do_action('give_before_donation_levels', $form_id, $args);
407 407
 
408 408
 	//Set Price, No Custom Amount Allowed means hidden price field
409
-	if ( ! give_is_setting_enabled( $allow_custom_amount ) ) {
409
+	if ( ! give_is_setting_enabled($allow_custom_amount)) {
410 410
 		?>
411
-		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
411
+		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
412 412
 		<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount"
413 413
 			   value="<?php echo $default_amount; ?>" required aria-required="true"/>
414 414
 		<div class="set-price give-donation-amount form-row-wide">
415
-			<?php if ( $currency_position == 'before' ) {
415
+			<?php if ($currency_position == 'before') {
416 416
 				echo $currency_output;
417 417
 			} ?>
418 418
 			<span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span>
419
-			<?php if ( $currency_position == 'after' ) {
419
+			<?php if ($currency_position == 'after') {
420 420
 				echo $currency_output;
421 421
 			} ?>
422 422
 		</div>
@@ -426,13 +426,13 @@  discard block
 block discarded – undo
426 426
 		?>
427 427
 		<div class="give-total-wrap">
428 428
 			<div class="give-donation-amount form-row-wide">
429
-				<?php if ( $currency_position == 'before' ) {
429
+				<?php if ($currency_position == 'before') {
430 430
 					echo $currency_output;
431 431
 				} ?>
432
-				<label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
432
+				<label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
433 433
 				<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel"
434 434
 					   placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
435
-				<?php if ( $currency_position == 'after' ) {
435
+				<?php if ($currency_position == 'after') {
436 436
 					echo $currency_output;
437 437
 				} ?>
438 438
 			</div>
@@ -447,16 +447,16 @@  discard block
 block discarded – undo
447 447
 	 * @param int   $form_id The form ID.
448 448
 	 * @param array $args    An array of form arguments.
449 449
 	 */
450
-	do_action( 'give_after_donation_amount', $form_id, $args );
450
+	do_action('give_after_donation_amount', $form_id, $args);
451 451
 
452 452
 	//Custom Amount Text
453
-	if ( ! $variable_pricing && give_is_setting_enabled( $allow_custom_amount ) && ! empty( $custom_amount_text ) ) { ?>
453
+	if ( ! $variable_pricing && give_is_setting_enabled($allow_custom_amount) && ! empty($custom_amount_text)) { ?>
454 454
 		<p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
455 455
 	<?php }
456 456
 
457 457
 	//Output Variable Pricing Levels.
458
-	if ( $variable_pricing ) {
459
-		give_output_levels( $form_id );
458
+	if ($variable_pricing) {
459
+		give_output_levels($form_id);
460 460
 	}
461 461
 
462 462
 	/**
@@ -467,10 +467,10 @@  discard block
 block discarded – undo
467 467
 	 * @param int   $form_id The form ID.
468 468
 	 * @param array $args    An array of form arguments.
469 469
 	 */
470
-	do_action( 'give_after_donation_levels', $form_id, $args );
470
+	do_action('give_after_donation_levels', $form_id, $args);
471 471
 }
472 472
 
473
-add_action( 'give_donation_form_top', 'give_output_donation_amount_top', 10, 2 );
473
+add_action('give_donation_form_top', 'give_output_donation_amount_top', 10, 2);
474 474
 
475 475
 /**
476 476
  * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons.
@@ -481,31 +481,31 @@  discard block
 block discarded – undo
481 481
  *
482 482
  * @return string Donation levels.
483 483
  */
484
-function give_output_levels( $form_id ) {
484
+function give_output_levels($form_id) {
485 485
 
486 486
 	//Get variable pricing.
487
-	$prices             = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
488
-	$display_style      = give_get_meta( $form_id, '_give_display_style', true );
489
-	$custom_amount      = give_get_meta( $form_id, '_give_custom_amount', true );
490
-	$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
487
+	$prices             = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
488
+	$display_style      = give_get_meta($form_id, '_give_display_style', true);
489
+	$custom_amount      = give_get_meta($form_id, '_give_custom_amount', true);
490
+	$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
491 491
 
492
-	if ( empty( $custom_amount_text ) ) {
493
-		$custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' );
492
+	if (empty($custom_amount_text)) {
493
+		$custom_amount_text = esc_html__('Give a Custom Amount', 'give');
494 494
 	}
495 495
 
496 496
 	$output = '';
497 497
 
498
-	switch ( $display_style ) {
498
+	switch ($display_style) {
499 499
 		case 'buttons':
500 500
 
501 501
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
502 502
 
503
-			foreach ( $prices as $price ) {
504
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ), $form_id, $price );
505
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $price['_give_id']['level_id'] . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price );
503
+			foreach ($prices as $price) {
504
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))), $form_id, $price);
505
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$price['_give_id']['level_id'].' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price);
506 506
 
507 507
 				$output .= '<li>';
508
-				$output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) . '">';
508
+				$output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount'], array('sanitize' => false)).'">';
509 509
 				$output .= $level_text;
510 510
 				$output .= '</button>';
511 511
 				$output .= '</li>';
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 			}
514 514
 
515 515
 			//Custom Amount.
516
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
516
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
517 517
 				$output .= '<li>';
518 518
 				$output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">';
519 519
 				$output .= $custom_amount_text;
@@ -529,22 +529,22 @@  discard block
 block discarded – undo
529 529
 
530 530
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
531 531
 
532
-			foreach ( $prices as $price ) {
533
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ), $form_id, $price );
534
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
532
+			foreach ($prices as $price) {
533
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))), $form_id, $price);
534
+				$level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
535 535
 
536 536
 				$output .= '<li>';
537
-				$output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $price['_give_id']['level_id'] . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) . '">';
538
-				$output .= '<label for="give-radio-level-' . $price['_give_id']['level_id'] . '">' . $level_text . '</label>';
537
+				$output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$price['_give_id']['level_id'].'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount'], array('sanitize' => false)).'">';
538
+				$output .= '<label for="give-radio-level-'.$price['_give_id']['level_id'].'">'.$level_text.'</label>';
539 539
 				$output .= '</li>';
540 540
 
541 541
 			}
542 542
 
543 543
 			//Custom Amount.
544
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
544
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
545 545
 				$output .= '<li>';
546 546
 				$output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">';
547
-				$output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>';
547
+				$output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>';
548 548
 				$output .= '</li>';
549 549
 			}
550 550
 
@@ -554,23 +554,23 @@  discard block
 block discarded – undo
554 554
 
555 555
 		case 'dropdown':
556 556
 
557
-			$output .= '<label for="give-donation-level-select-' . $form_id . '" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>';
558
-			$output .= '<select id="give-donation-level-select-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">';
557
+			$output .= '<label for="give-donation-level-select-'.$form_id.'" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>';
558
+			$output .= '<select id="give-donation-level-select-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">';
559 559
 
560 560
 			//first loop through prices.
561
-			foreach ( $prices as $price ) {
562
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ), $form_id, $price );
563
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $price['_give_id']['level_id'] . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
561
+			foreach ($prices as $price) {
562
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))), $form_id, $price);
563
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$price['_give_id']['level_id'].((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
564 564
 
565
-				$output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) . '">';
565
+				$output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount'], array('sanitize' => false)).'">';
566 566
 				$output .= $level_text;
567 567
 				$output .= '</option>';
568 568
 
569 569
 			}
570 570
 
571 571
 			//Custom Amount.
572
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
573
-				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>';
572
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
573
+				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>';
574 574
 			}
575 575
 
576 576
 			$output .= '</select>';
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 			break;
579 579
 	}
580 580
 
581
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
581
+	echo apply_filters('give_form_level_output', $output, $form_id);
582 582
 }
583 583
 
584 584
 /**
@@ -593,27 +593,27 @@  discard block
 block discarded – undo
593 593
  *
594 594
  * @return string Checkout button.
595 595
  */
596
-function give_display_checkout_button( $form_id, $args ) {
596
+function give_display_checkout_button($form_id, $args) {
597 597
 
598
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
598
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
599 599
 		? $args['display_style']
600
-		: give_get_meta( $form_id, '_give_payment_display', true );
600
+		: give_get_meta($form_id, '_give_payment_display', true);
601 601
 
602
-	if ( 'button' === $display_option ) {
602
+	if ('button' === $display_option) {
603 603
 		$display_option = 'modal';
604
-	} elseif ( $display_option === 'onpage' ) {
604
+	} elseif ($display_option === 'onpage') {
605 605
 		return '';
606 606
 	}
607 607
 
608
-	$display_label_field = give_get_meta( $form_id, '_give_reveal_label', true );
609
-	$display_label       = ! empty( $args['continue_button_title'] ) ? $args['continue_button_title'] : ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
608
+	$display_label_field = give_get_meta($form_id, '_give_reveal_label', true);
609
+	$display_label       = ! empty($args['continue_button_title']) ? $args['continue_button_title'] : ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
610 610
 
611
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
611
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
612 612
 
613
-	echo apply_filters( 'give_display_checkout_button', $output );
613
+	echo apply_filters('give_display_checkout_button', $output);
614 614
 }
615 615
 
616
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
616
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
617 617
 
618 618
 /**
619 619
  * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided.
@@ -626,77 +626,77 @@  discard block
 block discarded – undo
626 626
  *
627 627
  * @return void
628 628
  */
629
-function give_user_info_fields( $form_id ) {
629
+function give_user_info_fields($form_id) {
630 630
 	// Get user info.
631
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
631
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
632 632
 
633 633
 	/**
634 634
 	 * Fire before user personal information fields
635 635
 	 *
636 636
 	 * @since 1.7
637 637
 	 */
638
-	do_action( 'give_donation_form_before_personal_info', $form_id );
638
+	do_action('give_donation_form_before_personal_info', $form_id);
639 639
 	?>
640 640
 	<fieldset id="give_checkout_user_info">
641
-		<legend><?php echo apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ); ?></legend>
641
+		<legend><?php echo apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give')); ?></legend>
642 642
 		<p id="give-first-name-wrap" class="form-row form-row-first form-row-responsive">
643 643
 			<label class="give-label" for="give-first">
644
-				<?php _e( 'First Name', 'give' ); ?>
645
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?>
644
+				<?php _e('First Name', 'give'); ?>
645
+				<?php if (give_field_is_required('give_first', $form_id)) : ?>
646 646
 					<span class="give-required-indicator">*</span>
647 647
 				<?php endif ?>
648
-				<?php echo Give()->tooltips->render_help( __( 'We will use this to personalize your account experience.', 'give' ) ); ?>
648
+				<?php echo Give()->tooltips->render_help(__('We will use this to personalize your account experience.', 'give')); ?>
649 649
 			</label>
650 650
 			<input
651 651
 					class="give-input required"
652 652
 					type="text"
653 653
 					name="give_first"
654
-					placeholder="<?php _e( 'First Name', 'give' ); ?>"
654
+					placeholder="<?php _e('First Name', 'give'); ?>"
655 655
 					id="give-first"
656
-					value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>"
657
-				<?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
656
+					value="<?php echo isset($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; ?>"
657
+				<?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?>
658 658
 			/>
659 659
 		</p>
660 660
 
661 661
 		<p id="give-last-name-wrap" class="form-row form-row-last form-row-responsive">
662 662
 			<label class="give-label" for="give-last">
663
-				<?php _e( 'Last Name', 'give' ); ?>
664
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?>
663
+				<?php _e('Last Name', 'give'); ?>
664
+				<?php if (give_field_is_required('give_last', $form_id)) : ?>
665 665
 					<span class="give-required-indicator">*</span>
666 666
 				<?php endif ?>
667
-				<?php echo Give()->tooltips->render_help( __( 'We will use this as well to personalize your account experience.', 'give' ) ); ?>
667
+				<?php echo Give()->tooltips->render_help(__('We will use this as well to personalize your account experience.', 'give')); ?>
668 668
 			</label>
669 669
 
670 670
 			<input
671
-					class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>"
671
+					class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>"
672 672
 					type="text"
673 673
 					name="give_last"
674 674
 					id="give-last"
675
-					placeholder="<?php _e( 'Last Name', 'give' ); ?>"
676
-					value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>"
677
-				<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
675
+					placeholder="<?php _e('Last Name', 'give'); ?>"
676
+					value="<?php echo isset($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; ?>"
677
+				<?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?>
678 678
 			/>
679 679
 		</p>
680 680
 
681
-		<?php if ( give_is_company_field_enabled( $form_id ) ) : ?>
682
-			<?php $give_company = give_field_is_required( 'give_company_name', $form_id ); ?>
681
+		<?php if (give_is_company_field_enabled($form_id)) : ?>
682
+			<?php $give_company = give_field_is_required('give_company_name', $form_id); ?>
683 683
 			<p id="give-company-wrap" class="form-row form-row-wide">
684 684
 				<label class="give-label" for="give-company">
685
-					<?php _e( 'Company Name', 'give' ); ?>
686
-					<?php if ( $give_company ) : ?>
685
+					<?php _e('Company Name', 'give'); ?>
686
+					<?php if ($give_company) : ?>
687 687
 						<span class="give-required-indicator">*</span>
688 688
 					<?php endif; ?>
689
-					<?php echo Give()->tooltips->render_help( __( 'Donate on behalf of Company', 'give' ) ); ?>
689
+					<?php echo Give()->tooltips->render_help(__('Donate on behalf of Company', 'give')); ?>
690 690
 				</label>
691 691
 
692 692
 				<input
693
-					class="give-input<?php echo( $give_company ? ' required' : '' ); ?>"
693
+					class="give-input<?php echo($give_company ? ' required' : ''); ?>"
694 694
 					type="text"
695 695
 					name="give_company_name"
696
-					placeholder="<?php _e( 'Company Name', 'give' ); ?>"
696
+					placeholder="<?php _e('Company Name', 'give'); ?>"
697 697
 					id="give-company"
698
-					value="<?php echo isset( $give_user_info['company_name'] ) ? $give_user_info['company_name'] : ''; ?>"
699
-					<?php echo( $give_company ? ' required aria-required="true" ' : '' ); ?>
698
+					value="<?php echo isset($give_user_info['company_name']) ? $give_user_info['company_name'] : ''; ?>"
699
+					<?php echo($give_company ? ' required aria-required="true" ' : ''); ?>
700 700
 				/>
701 701
 
702 702
 			</p>
@@ -708,25 +708,25 @@  discard block
 block discarded – undo
708 708
 		 *
709 709
 		 * @since 1.7
710 710
 		 */
711
-		do_action( 'give_donation_form_before_email', $form_id );
711
+		do_action('give_donation_form_before_email', $form_id);
712 712
 		?>
713 713
 		<p id="give-email-wrap" class="form-row form-row-wide">
714 714
 			<label class="give-label" for="give-email">
715
-				<?php _e( 'Email Address', 'give' ); ?>
716
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
715
+				<?php _e('Email Address', 'give'); ?>
716
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
717 717
 					<span class="give-required-indicator">*</span>
718 718
 				<?php } ?>
719
-				<?php echo Give()->tooltips->render_help( __( 'We will send the donation receipt to this address.', 'give' ) ); ?>
719
+				<?php echo Give()->tooltips->render_help(__('We will send the donation receipt to this address.', 'give')); ?>
720 720
 			</label>
721 721
 
722 722
 			<input
723 723
 					class="give-input required"
724 724
 					type="email"
725 725
 					name="give_email"
726
-					placeholder="<?php _e( 'Email Address', 'give' ); ?>"
726
+					placeholder="<?php _e('Email Address', 'give'); ?>"
727 727
 					id="give-email"
728
-					value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>"
729
-				<?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
728
+					value="<?php echo isset($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; ?>"
729
+				<?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?>
730 730
 			/>
731 731
 
732 732
 		</p>
@@ -736,14 +736,14 @@  discard block
 block discarded – undo
736 736
 		 *
737 737
 		 * @since 1.7
738 738
 		 */
739
-		do_action( 'give_donation_form_after_email', $form_id );
739
+		do_action('give_donation_form_after_email', $form_id);
740 740
 
741 741
 		/**
742 742
 		 * Fire after personal email field
743 743
 		 *
744 744
 		 * @since 1.7
745 745
 		 */
746
-		do_action( 'give_donation_form_user_info', $form_id );
746
+		do_action('give_donation_form_user_info', $form_id);
747 747
 		?>
748 748
 	</fieldset>
749 749
 	<?php
@@ -752,11 +752,11 @@  discard block
 block discarded – undo
752 752
 	 *
753 753
 	 * @since 1.7
754 754
 	 */
755
-	do_action( 'give_donation_form_after_personal_info', $form_id );
755
+	do_action('give_donation_form_after_personal_info', $form_id);
756 756
 }
757 757
 
758
-add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' );
759
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
758
+add_action('give_donation_form_after_user_info', 'give_user_info_fields');
759
+add_action('give_register_fields_before', 'give_user_info_fields');
760 760
 
761 761
 /**
762 762
  * Renders the credit card info form.
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
  *
768 768
  * @return void
769 769
  */
770
-function give_get_cc_form( $form_id ) {
770
+function give_get_cc_form($form_id) {
771 771
 
772 772
 	ob_start();
773 773
 
@@ -778,50 +778,50 @@  discard block
 block discarded – undo
778 778
 	 *
779 779
 	 * @param int $form_id The form ID.
780 780
 	 */
781
-	do_action( 'give_before_cc_fields', $form_id );
781
+	do_action('give_before_cc_fields', $form_id);
782 782
 	?>
783 783
 	<fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate">
784
-		<legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend>
785
-		<?php if ( is_ssl() ) : ?>
784
+		<legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend>
785
+		<?php if (is_ssl()) : ?>
786 786
 			<div id="give_secure_site_wrapper-<?php echo $form_id ?>">
787 787
 				<span class="give-icon padlock"></span>
788
-				<span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
788
+				<span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span>
789 789
 			</div>
790 790
 		<?php endif; ?>
791 791
 		<p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive">
792 792
 			<label for="card_number-<?php echo $form_id ?>" class="give-label">
793
-				<?php _e( 'Card Number', 'give' ); ?>
793
+				<?php _e('Card Number', 'give'); ?>
794 794
 				<span class="give-required-indicator">*</span>
795
-				<?php echo Give()->tooltips->render_help( __( 'The (typically) 16 digits on the front of your credit card.', 'give' ) ); ?>
795
+				<?php echo Give()->tooltips->render_help(__('The (typically) 16 digits on the front of your credit card.', 'give')); ?>
796 796
 				<span class="card-type"></span>
797 797
 			</label>
798 798
 
799 799
 			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>"
800
-				   class="card-number give-input required" placeholder="<?php _e( 'Card number', 'give' ); ?>"
800
+				   class="card-number give-input required" placeholder="<?php _e('Card number', 'give'); ?>"
801 801
 				   required aria-required="true"/>
802 802
 		</p>
803 803
 
804 804
 		<p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third form-row-responsive">
805 805
 			<label for="card_cvc-<?php echo $form_id ?>" class="give-label">
806
-				<?php _e( 'CVC', 'give' ); ?>
806
+				<?php _e('CVC', 'give'); ?>
807 807
 				<span class="give-required-indicator">*</span>
808
-				<?php echo Give()->tooltips->render_help( __( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ) ); ?>
808
+				<?php echo Give()->tooltips->render_help(__('The 3 digit (back) or 4 digit (front) value on your card.', 'give')); ?>
809 809
 			</label>
810 810
 
811 811
 			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>"
812
-				   class="card-cvc give-input required" placeholder="<?php _e( 'Security code', 'give' ); ?>"
812
+				   class="card-cvc give-input required" placeholder="<?php _e('Security code', 'give'); ?>"
813 813
 				   required aria-required="true"/>
814 814
 		</p>
815 815
 
816 816
 		<p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive">
817 817
 			<label for="card_name-<?php echo $form_id ?>" class="give-label">
818
-				<?php _e( 'Name on the Card', 'give' ); ?>
818
+				<?php _e('Name on the Card', 'give'); ?>
819 819
 				<span class="give-required-indicator">*</span>
820
-				<?php echo Give()->tooltips->render_help( __( 'The name printed on the front of your credit card.', 'give' ) ); ?>
820
+				<?php echo Give()->tooltips->render_help(__('The name printed on the front of your credit card.', 'give')); ?>
821 821
 			</label>
822 822
 
823 823
 			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>"
824
-				   class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>"
824
+				   class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>"
825 825
 				   required aria-required="true"/>
826 826
 		</p>
827 827
 		<?php
@@ -832,19 +832,19 @@  discard block
 block discarded – undo
832 832
 		 *
833 833
 		 * @param int $form_id The form ID.
834 834
 		 */
835
-		do_action( 'give_before_cc_expiration' );
835
+		do_action('give_before_cc_expiration');
836 836
 		?>
837 837
 		<p class="card-expiration form-row form-row-one-third form-row-responsive">
838 838
 			<label for="card_expiry-<?php echo $form_id ?>" class="give-label">
839
-				<?php _e( 'Expiration', 'give' ); ?>
839
+				<?php _e('Expiration', 'give'); ?>
840 840
 				<span class="give-required-indicator">*</span>
841
-				<?php echo Give()->tooltips->render_help( __( 'The date your credit card expires, typically on the front of the card.', 'give' ) ); ?>
841
+				<?php echo Give()->tooltips->render_help(__('The date your credit card expires, typically on the front of the card.', 'give')); ?>
842 842
 			</label>
843 843
 
844 844
 			<input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/>
845 845
 			<input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/>
846 846
 
847
-			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>" required aria-required="true"/>
847
+			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>" required aria-required="true"/>
848 848
 		</p>
849 849
 		<?php
850 850
 		/**
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
 		 *
855 855
 		 * @param int $form_id The form ID.
856 856
 		 */
857
-		do_action( 'give_after_cc_expiration', $form_id );
857
+		do_action('give_after_cc_expiration', $form_id);
858 858
 		?>
859 859
 	</fieldset>
860 860
 	<?php
@@ -865,12 +865,12 @@  discard block
 block discarded – undo
865 865
 	 *
866 866
 	 * @param int $form_id The form ID.
867 867
 	 */
868
-	do_action( 'give_after_cc_fields', $form_id );
868
+	do_action('give_after_cc_fields', $form_id);
869 869
 
870 870
 	echo ob_get_clean();
871 871
 }
872 872
 
873
-add_action( 'give_cc_form', 'give_get_cc_form' );
873
+add_action('give_cc_form', 'give_get_cc_form');
874 874
 
875 875
 /**
876 876
  * Outputs the default credit card address fields.
@@ -881,20 +881,20 @@  discard block
 block discarded – undo
881 881
  *
882 882
  * @return void
883 883
  */
884
-function give_default_cc_address_fields( $form_id ) {
884
+function give_default_cc_address_fields($form_id) {
885 885
 	// Get user info.
886
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
886
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
887 887
 
888 888
 	$logged_in = is_user_logged_in();
889 889
 
890
-	if ( $logged_in ) {
891
-		$user_address = give_get_donor_address( get_current_user_id() );
890
+	if ($logged_in) {
891
+		$user_address = give_get_donor_address(get_current_user_id());
892 892
 	}
893 893
 
894 894
 	ob_start();
895 895
 	?>
896 896
 	<fieldset id="give_cc_address" class="cc-address">
897
-		<legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend>
897
+		<legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend>
898 898
 		<?php
899 899
 		/**
900 900
 		 * Fires while rendering credit card billing form, before address fields.
@@ -903,36 +903,36 @@  discard block
 block discarded – undo
903 903
 		 *
904 904
 		 * @param int $form_id The form ID.
905 905
 		 */
906
-		do_action( 'give_cc_billing_top' );
906
+		do_action('give_cc_billing_top');
907 907
 
908 908
 		// For Country.
909 909
 		$selected_country = give_get_country();
910
-		if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) {
910
+		if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) {
911 911
 			$selected_country = $give_user_info['billing_country'];
912 912
 		}
913 913
 		$countries = give_get_country_list();
914 914
 
915 915
 		// For state
916 916
 		$selected_state = '';
917
-		if ( $selected_country === give_get_country() ) {
917
+		if ($selected_country === give_get_country()) {
918 918
 			// Get defalut selected state by admin.
919 919
 			$selected_state = give_get_state();
920 920
 		}
921 921
 		// Get the last payment made by user states.
922
-		if ( ! empty( $give_user_info['card_state'] ) && '*' !== $give_user_info['card_state'] ) {
922
+		if ( ! empty($give_user_info['card_state']) && '*' !== $give_user_info['card_state']) {
923 923
 			$selected_state = $give_user_info['card_state'];
924 924
 		}
925 925
 		// Get the country code
926
-		if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) {
926
+		if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) {
927 927
 			$selected_country = $give_user_info['billing_country'];
928 928
 		}
929
-		$label        = __( 'State', 'give' );
929
+		$label        = __('State', 'give');
930 930
 		$states_label = give_get_states_label();
931 931
 		// Check if $country code exists in the array key for states label.
932
-		if ( array_key_exists( $selected_country, $states_label ) ) {
933
-			$label = $states_label[ $selected_country ];
932
+		if (array_key_exists($selected_country, $states_label)) {
933
+			$label = $states_label[$selected_country];
934 934
 		}
935
-		$states = give_get_states( $selected_country );
935
+		$states = give_get_states($selected_country);
936 936
 		// Get the country list that do not have any states init.
937 937
 		$no_states_country = give_no_states_country_list();
938 938
 		// Get the country list that does not require states.
@@ -940,23 +940,23 @@  discard block
 block discarded – undo
940 940
 		?>
941 941
 	    <p id="give-card-country-wrap" class="form-row form-row-wide">
942 942
 		    <label for="billing_country" class="give-label">
943
-			    <?php esc_html_e( 'Country', 'give' ); ?>
944
-			    <?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?>
943
+			    <?php esc_html_e('Country', 'give'); ?>
944
+			    <?php if (give_field_is_required('billing_country', $form_id)) : ?>
945 945
 				    <span class="give-required-indicator">*</span>
946 946
 			    <?php endif; ?>
947 947
 			    <span class="give-tooltip give-icon give-icon-question"
948
-			          data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span>
948
+			          data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span>
949 949
 		    </label>
950 950
 
951 951
 		    <select
952 952
 				    name="billing_country"
953 953
 				    id="billing_country"
954
-				    class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>"
955
-			    <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
954
+				    class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>"
955
+			    <?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?>
956 956
 		    >
957 957
 			    <?php
958
-			    foreach ( $countries as $country_code => $country ) {
959
-				    echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
958
+			    foreach ($countries as $country_code => $country) {
959
+				    echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
960 960
 			    }
961 961
 			    ?>
962 962
 		    </select>
@@ -964,86 +964,86 @@  discard block
 block discarded – undo
964 964
 
965 965
 		<p id="give-card-address-wrap" class="form-row form-row-wide">
966 966
 			<label for="card_address" class="give-label">
967
-				<?php _e( 'Address 1', 'give' ); ?>
967
+				<?php _e('Address 1', 'give'); ?>
968 968
 				<?php
969
-				if ( give_field_is_required( 'card_address', $form_id ) ) : ?>
969
+				if (give_field_is_required('card_address', $form_id)) : ?>
970 970
 					<span class="give-required-indicator">*</span>
971 971
 				<?php endif; ?>
972
-				<?php echo Give()->tooltips->render_help( __( 'The primary billing address for your credit card.', 'give' ) ); ?>
972
+				<?php echo Give()->tooltips->render_help(__('The primary billing address for your credit card.', 'give')); ?>
973 973
 			</label>
974 974
 
975 975
 			<input
976 976
 					type="text"
977 977
 					id="card_address"
978 978
 					name="card_address"
979
-					class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>"
980
-					placeholder="<?php _e( 'Address line 1', 'give' ); ?>"
981
-					value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>"
982
-				<?php echo( give_field_is_required( 'card_address', $form_id ) ? '  required aria-required="true" ' : '' ); ?>
979
+					class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>"
980
+					placeholder="<?php _e('Address line 1', 'give'); ?>"
981
+					value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>"
982
+				<?php echo(give_field_is_required('card_address', $form_id) ? '  required aria-required="true" ' : ''); ?>
983 983
 			/>
984 984
 		</p>
985 985
 
986 986
 		<p id="give-card-address-2-wrap" class="form-row form-row-wide">
987 987
 			<label for="card_address_2" class="give-label">
988
-				<?php _e( 'Address 2', 'give' ); ?>
989
-				<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?>
988
+				<?php _e('Address 2', 'give'); ?>
989
+				<?php if (give_field_is_required('card_address_2', $form_id)) : ?>
990 990
 					<span class="give-required-indicator">*</span>
991 991
 				<?php endif; ?>
992
-				<?php echo Give()->tooltips->render_help( __( '(optional) The suite, apartment number, post office box (etc) associated with your billing address.', 'give' ) ); ?>
992
+				<?php echo Give()->tooltips->render_help(__('(optional) The suite, apartment number, post office box (etc) associated with your billing address.', 'give')); ?>
993 993
 			</label>
994 994
 
995 995
 			<input
996 996
 					type="text"
997 997
 					id="card_address_2"
998 998
 					name="card_address_2"
999
-					class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>"
1000
-					placeholder="<?php _e( 'Address line 2', 'give' ); ?>"
1001
-					value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>"
1002
-				<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
999
+					class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>"
1000
+					placeholder="<?php _e('Address line 2', 'give'); ?>"
1001
+					value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>"
1002
+				<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?>
1003 1003
 			/>
1004 1004
 		</p>
1005 1005
 
1006 1006
 		<p id="give-card-city-wrap" class="form-row form-row-wide">
1007 1007
 			<label for="card_city" class="give-label">
1008
-				<?php _e( 'City', 'give' ); ?>
1009
-				<?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?>
1008
+				<?php _e('City', 'give'); ?>
1009
+				<?php if (give_field_is_required('card_city', $form_id)) : ?>
1010 1010
 					<span class="give-required-indicator">*</span>
1011 1011
 				<?php endif; ?>
1012
-				<?php echo Give()->tooltips->render_help( __( 'The city for your billing address.', 'give' ) ); ?>
1012
+				<?php echo Give()->tooltips->render_help(__('The city for your billing address.', 'give')); ?>
1013 1013
 			</label>
1014 1014
 			<input
1015 1015
 					type="text"
1016 1016
 					id="card_city"
1017 1017
 					name="card_city"
1018
-					class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>"
1019
-					placeholder="<?php _e( 'City', 'give' ); ?>"
1020
-					value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>"
1021
-				<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
1018
+					class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>"
1019
+					placeholder="<?php _e('City', 'give'); ?>"
1020
+					value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>"
1021
+				<?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?>
1022 1022
 			/>
1023 1023
 		</p>
1024 1024
 
1025 1025
 	    <p id="give-card-state-wrap"
1026
-	       class="form-row form-row-first form-row-responsive <?php echo ( ! empty( $selected_country ) && array_key_exists( $selected_country, $no_states_country ) ) ? 'give-hidden' : ''; ?> ">
1026
+	       class="form-row form-row-first form-row-responsive <?php echo ( ! empty($selected_country) && array_key_exists($selected_country, $no_states_country)) ? 'give-hidden' : ''; ?> ">
1027 1027
 		    <label for="card_state" class="give-label">
1028 1028
 			    <span class="state-label-text"><?php echo $label; ?></span>
1029
-			    <?php if ( give_field_is_required( 'card_state', $form_id ) ) :
1029
+			    <?php if (give_field_is_required('card_state', $form_id)) :
1030 1030
 				    ?>
1031
-				    <span class="give-required-indicator <?php echo( array_key_exists( $selected_country, $states_not_required_country_list ) ? 'give-hidden' : '' ) ?> ">*</span>
1031
+				    <span class="give-required-indicator <?php echo(array_key_exists($selected_country, $states_not_required_country_list) ? 'give-hidden' : '') ?> ">*</span>
1032 1032
 			    <?php endif; ?>
1033 1033
 			    <span class="give-tooltip give-icon give-icon-question"
1034
-			          data-tooltip="<?php esc_attr_e( 'The state, province, or county for your billing address.', 'give' ); ?>"></span>
1034
+			          data-tooltip="<?php esc_attr_e('The state, province, or county for your billing address.', 'give'); ?>"></span>
1035 1035
 		    </label>
1036 1036
 		    <?php
1037 1037
 
1038
-		    if ( ! empty( $states ) ) : ?>
1038
+		    if ( ! empty($states)) : ?>
1039 1039
 			    <select
1040 1040
 					    name="card_state"
1041 1041
 					    id="card_state"
1042
-					    class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>"
1043
-				    <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>>
1042
+					    class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>"
1043
+				    <?php echo(give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : ''); ?>>
1044 1044
 				    <?php
1045
-				    foreach ( $states as $state_code => $state ) {
1046
-					    echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
1045
+				    foreach ($states as $state_code => $state) {
1046
+					    echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
1047 1047
 				    }
1048 1048
 				    ?>
1049 1049
 			    </select>
@@ -1055,11 +1055,11 @@  discard block
 block discarded – undo
1055 1055
 
1056 1056
 		<p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive">
1057 1057
 			<label for="card_zip" class="give-label">
1058
-				<?php _e( 'Zip / Postal Code', 'give' ); ?>
1059
-				<?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?>
1058
+				<?php _e('Zip / Postal Code', 'give'); ?>
1059
+				<?php if (give_field_is_required('card_zip', $form_id)) : ?>
1060 1060
 					<span class="give-required-indicator">*</span>
1061 1061
 				<?php endif; ?>
1062
-				<?php echo Give()->tooltips->render_help( __( 'The ZIP Code or postal code for your billing address.', 'give' ) ); ?>
1062
+				<?php echo Give()->tooltips->render_help(__('The ZIP Code or postal code for your billing address.', 'give')); ?>
1063 1063
 			</label>
1064 1064
 
1065 1065
 			<input
@@ -1067,10 +1067,10 @@  discard block
 block discarded – undo
1067 1067
 					size="4"
1068 1068
 					id="card_zip"
1069 1069
 					name="card_zip"
1070
-					class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>"
1071
-					placeholder="<?php _e( 'Zip / Postal Code', 'give' ); ?>"
1072
-					value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>"
1073
-				<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
1070
+					class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>"
1071
+					placeholder="<?php _e('Zip / Postal Code', 'give'); ?>"
1072
+					value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>"
1073
+				<?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?>
1074 1074
 			/>
1075 1075
 		</p>
1076 1076
 		<?php
@@ -1081,14 +1081,14 @@  discard block
 block discarded – undo
1081 1081
 		 *
1082 1082
 		 * @param int $form_id The form ID.
1083 1083
 		 */
1084
-		do_action( 'give_cc_billing_bottom' );
1084
+		do_action('give_cc_billing_bottom');
1085 1085
 		?>
1086 1086
 	</fieldset>
1087 1087
 	<?php
1088 1088
 	echo ob_get_clean();
1089 1089
 }
1090 1090
 
1091
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
1091
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
1092 1092
 
1093 1093
 
1094 1094
 /**
@@ -1101,15 +1101,15 @@  discard block
 block discarded – undo
1101 1101
  *
1102 1102
  * @return string
1103 1103
  */
1104
-function give_get_register_fields( $form_id ) {
1104
+function give_get_register_fields($form_id) {
1105 1105
 
1106 1106
 	global $user_ID;
1107 1107
 
1108
-	if ( is_user_logged_in() ) {
1109
-		$user_data = get_userdata( $user_ID );
1108
+	if (is_user_logged_in()) {
1109
+		$user_data = get_userdata($user_ID);
1110 1110
 	}
1111 1111
 
1112
-	$show_register_form = give_show_login_register_option( $form_id );
1112
+	$show_register_form = give_show_login_register_option($form_id);
1113 1113
 
1114 1114
 	ob_start(); ?>
1115 1115
 	<fieldset id="give-register-fields-<?php echo $form_id; ?>">
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
 		 *
1123 1123
 		 * @param int $form_id The form ID.
1124 1124
 		 */
1125
-		do_action( 'give_register_fields_before', $form_id );
1125
+		do_action('give_register_fields_before', $form_id);
1126 1126
 		?>
1127 1127
 
1128 1128
 		<fieldset id="give-register-account-fields-<?php echo $form_id; ?>">
@@ -1134,22 +1134,22 @@  discard block
 block discarded – undo
1134 1134
 			 *
1135 1135
 			 * @param int $form_id The form ID.
1136 1136
 			 */
1137
-			do_action( 'give_register_account_fields_before', $form_id );
1137
+			do_action('give_register_account_fields_before', $form_id);
1138 1138
 			?>
1139 1139
 			<div id="give-create-account-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive">
1140 1140
 				<label for="give-create-account-<?php echo $form_id; ?>">
1141 1141
 					<?php
1142 1142
 					// Add attributes to checkbox, if Guest Checkout is disabled.
1143
-					$is_guest_checkout = give_get_meta( $form_id, '_give_logged_in_only', true );
1144
-					$id                = 'give-create-account-' . $form_id;
1145
-					if ( ! give_is_setting_enabled( $is_guest_checkout ) ) {
1143
+					$is_guest_checkout = give_get_meta($form_id, '_give_logged_in_only', true);
1144
+					$id                = 'give-create-account-'.$form_id;
1145
+					if ( ! give_is_setting_enabled($is_guest_checkout)) {
1146 1146
 						echo Give()->tooltips->render(
1147 1147
 							array(
1148 1148
 								'tag_content' => sprintf(
1149 1149
 									'<input type="checkbox" name="give_create_account" value="on" id="%s" class="give-input give-disabled" checked />',
1150 1150
 									$id
1151 1151
 								),
1152
-								'label'       => __( 'Registration is required to donate.', 'give' ),
1152
+								'label'       => __('Registration is required to donate.', 'give'),
1153 1153
 							) );
1154 1154
 					} else {
1155 1155
 						?>
@@ -1157,16 +1157,16 @@  discard block
 block discarded – undo
1157 1157
 						<?php
1158 1158
 					}
1159 1159
 					?>
1160
-					<?php _e( 'Create an account', 'give' ); ?>
1161
-					<?php echo Give()->tooltips->render_help( __( 'Create an account on the site to see and manage donation history.', 'give' ) ); ?>
1160
+					<?php _e('Create an account', 'give'); ?>
1161
+					<?php echo Give()->tooltips->render_help(__('Create an account on the site to see and manage donation history.', 'give')); ?>
1162 1162
 				</label>
1163 1163
 			</div>
1164 1164
 
1165
-			<?php if ( 'both' === $show_register_form ) { ?>
1165
+			<?php if ('both' === $show_register_form) { ?>
1166 1166
 				<div class="give-login-account-wrap form-row form-row-last form-row-responsive">
1167
-					<p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?>&nbsp;
1168
-						<a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login"
1169
-						   data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a>
1167
+					<p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?>&nbsp;
1168
+						<a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login"
1169
+						   data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a>
1170 1170
 					</p>
1171 1171
 					<p class="give-loading-text">
1172 1172
 						<span class="give-loading-animation"></span>
@@ -1182,7 +1182,7 @@  discard block
 block discarded – undo
1182 1182
 			 *
1183 1183
 			 * @param int $form_id The form ID.
1184 1184
 			 */
1185
-			do_action( 'give_register_account_fields_after', $form_id );
1185
+			do_action('give_register_account_fields_after', $form_id);
1186 1186
 			?>
1187 1187
 		</fieldset>
1188 1188
 
@@ -1194,7 +1194,7 @@  discard block
 block discarded – undo
1194 1194
 		 *
1195 1195
 		 * @param int $form_id The form ID.
1196 1196
 		 */
1197
-		do_action( 'give_register_fields_after', $form_id );
1197
+		do_action('give_register_fields_after', $form_id);
1198 1198
 		?>
1199 1199
 
1200 1200
 		<input type="hidden" name="give-purchase-var" value="needs-to-register"/>
@@ -1205,7 +1205,7 @@  discard block
 block discarded – undo
1205 1205
 		 *
1206 1206
 		 * @since 1.7
1207 1207
 		 */
1208
-		do_action( 'give_donation_form_user_info', $form_id );
1208
+		do_action('give_donation_form_user_info', $form_id);
1209 1209
 		?>
1210 1210
 
1211 1211
 	</fieldset>
@@ -1213,7 +1213,7 @@  discard block
 block discarded – undo
1213 1213
 	echo ob_get_clean();
1214 1214
 }
1215 1215
 
1216
-add_action( 'give_donation_form_register_fields', 'give_get_register_fields' );
1216
+add_action('give_donation_form_register_fields', 'give_get_register_fields');
1217 1217
 
1218 1218
 /**
1219 1219
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -1226,28 +1226,28 @@  discard block
 block discarded – undo
1226 1226
  *
1227 1227
  * @return string
1228 1228
  */
1229
-function give_get_login_fields( $form_id ) {
1229
+function give_get_login_fields($form_id) {
1230 1230
 
1231
-	$form_id            = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id;
1232
-	$show_register_form = give_show_login_register_option( $form_id );
1231
+	$form_id            = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id;
1232
+	$show_register_form = give_show_login_register_option($form_id);
1233 1233
 
1234 1234
 	ob_start();
1235 1235
 	?>
1236 1236
 	<fieldset id="give-login-fields-<?php echo $form_id; ?>">
1237
-		<legend><?php echo apply_filters( 'give_account_login_fieldset_heading', __( 'Login to Your Account', 'give' ) );
1238
-			if ( ! give_logged_in_only( $form_id ) ) {
1239
-				echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>';
1237
+		<legend><?php echo apply_filters('give_account_login_fieldset_heading', __('Login to Your Account', 'give'));
1238
+			if ( ! give_logged_in_only($form_id)) {
1239
+				echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>';
1240 1240
 			} ?>
1241 1241
 		</legend>
1242
-		<?php if ( $show_register_form == 'both' ) { ?>
1242
+		<?php if ($show_register_form == 'both') { ?>
1243 1243
 			<p class="give-new-account-link">
1244
-				<?php _e( 'Don\'t have an account?', 'give' ); ?>&nbsp;
1245
-				<a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel"
1244
+				<?php _e('Don\'t have an account?', 'give'); ?>&nbsp;
1245
+				<a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel"
1246 1246
 				   data-action="give_checkout_register">
1247
-					<?php if ( give_logged_in_only( $form_id ) ) {
1248
-					    _e( 'Register as a part of your donation &raquo;', 'give' );
1247
+					<?php if (give_logged_in_only($form_id)) {
1248
+					    _e('Register as a part of your donation &raquo;', 'give');
1249 1249
                     } else {
1250
-						 _e( 'Register or donate as a guest &raquo;', 'give' );
1250
+						 _e('Register or donate as a guest &raquo;', 'give');
1251 1251
 					} ?>
1252 1252
 				</a>
1253 1253
 			</p>
@@ -1263,49 +1263,49 @@  discard block
 block discarded – undo
1263 1263
 		 *
1264 1264
 		 * @param int $form_id The form ID.
1265 1265
 		 */
1266
-		do_action( 'give_checkout_login_fields_before', $form_id );
1266
+		do_action('give_checkout_login_fields_before', $form_id);
1267 1267
 		?>
1268 1268
 		<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive">
1269 1269
 			<label class="give-label" for="give-user-login-<?php echo $form_id; ?>">
1270
-				<?php _e( 'Username', 'give' ); ?>
1271
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1270
+				<?php _e('Username', 'give'); ?>
1271
+				<?php if (give_logged_in_only($form_id)) { ?>
1272 1272
 					<span class="give-required-indicator">*</span>
1273 1273
 				<?php } ?>
1274 1274
 			</label>
1275 1275
 
1276
-			<input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text"
1276
+			<input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text"
1277 1277
 				   name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value=""
1278
-				   placeholder="<?php _e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1278
+				   placeholder="<?php _e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1279 1279
 		</div>
1280 1280
 
1281 1281
 		<div id="give-user-pass-wrap-<?php echo $form_id; ?>"
1282 1282
 			 class="give_login_password form-row form-row-last form-row-responsive">
1283 1283
 			<label class="give-label" for="give-user-pass-<?php echo $form_id; ?>">
1284
-				<?php _e( 'Password', 'give' ); ?>
1285
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1284
+				<?php _e('Password', 'give'); ?>
1285
+				<?php if (give_logged_in_only($form_id)) { ?>
1286 1286
 					<span class="give-required-indicator">*</span>
1287 1287
 				<?php } ?>
1288 1288
 			</label>
1289
-			<input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>"
1289
+			<input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>"
1290 1290
 				   type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>"
1291
-				   placeholder="<?php _e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1291
+				   placeholder="<?php _e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1292 1292
 			<input type="hidden" name="give-purchase-var" value="needs-to-login"/>
1293 1293
 		</div>
1294 1294
 
1295 1295
 		<div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password">
1296 1296
 			 <span class="give-forgot-password ">
1297 1297
 				 <a href="<?php echo wp_lostpassword_url() ?>"
1298
-					target="_blank"><?php _e( 'Reset Password', 'give' ) ?></a>
1298
+					target="_blank"><?php _e('Reset Password', 'give') ?></a>
1299 1299
 			 </span>
1300 1300
 		</div>
1301 1301
 
1302 1302
 		<div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix">
1303 1303
 			<input type="submit" class="give-submit give-btn button" name="give_login_submit"
1304
-				   value="<?php _e( 'Login', 'give' ); ?>"/>
1305
-			<?php if ( $show_register_form !== 'login' ) { ?>
1304
+				   value="<?php _e('Login', 'give'); ?>"/>
1305
+			<?php if ($show_register_form !== 'login') { ?>
1306 1306
 				<input type="button" data-action="give_cancel_login"
1307 1307
 					   class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel"
1308
-					   value="<?php _e( 'Cancel', 'give' ); ?>"/>
1308
+					   value="<?php _e('Cancel', 'give'); ?>"/>
1309 1309
 			<?php } ?>
1310 1310
 			<span class="give-loading-animation"></span>
1311 1311
 		</div>
@@ -1317,14 +1317,14 @@  discard block
 block discarded – undo
1317 1317
 		 *
1318 1318
 		 * @param int $form_id The form ID.
1319 1319
 		 */
1320
-		do_action( 'give_checkout_login_fields_after', $form_id );
1320
+		do_action('give_checkout_login_fields_after', $form_id);
1321 1321
 		?>
1322 1322
 	</fieldset><!--end #give-login-fields-->
1323 1323
 	<?php
1324 1324
 	echo ob_get_clean();
1325 1325
 }
1326 1326
 
1327
-add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 );
1327
+add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1);
1328 1328
 
1329 1329
 /**
1330 1330
  * Payment Mode Select.
@@ -1340,9 +1340,9 @@  discard block
 block discarded – undo
1340 1340
  *
1341 1341
  * @return void
1342 1342
  */
1343
-function give_payment_mode_select( $form_id ) {
1343
+function give_payment_mode_select($form_id) {
1344 1344
 
1345
-	$gateways = give_get_enabled_payment_gateways( $form_id );
1345
+	$gateways = give_get_enabled_payment_gateways($form_id);
1346 1346
 
1347 1347
 	/**
1348 1348
 	 * Fires while selecting payment gateways, before the fields.
@@ -1351,10 +1351,10 @@  discard block
 block discarded – undo
1351 1351
 	 *
1352 1352
 	 * @param int $form_id The form ID.
1353 1353
 	 */
1354
-	do_action( 'give_payment_mode_top', $form_id );
1354
+	do_action('give_payment_mode_top', $form_id);
1355 1355
 	?>
1356 1356
 
1357
-	<fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) {
1357
+	<fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) {
1358 1358
 		echo 'style="display: none;"';
1359 1359
 	} ?>>
1360 1360
 		<?php
@@ -1365,10 +1365,10 @@  discard block
 block discarded – undo
1365 1365
 		 *
1366 1366
 		 * @param int $form_id The form ID.
1367 1367
 		 */
1368
-		do_action( 'give_payment_mode_before_gateways_wrap' );
1368
+		do_action('give_payment_mode_before_gateways_wrap');
1369 1369
 		?>
1370 1370
 		<legend
1371
-				class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?>
1371
+				class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?>
1372 1372
 			<span class="give-loading-text"><span
1373 1373
 						class="give-loading-animation"></span>
1374 1374
             </span>
@@ -1381,37 +1381,36 @@  discard block
 block discarded – undo
1381 1381
 			 *
1382 1382
 			 * @since 1.7
1383 1383
 			 */
1384
-			do_action( 'give_payment_mode_before_gateways' )
1384
+			do_action('give_payment_mode_before_gateways')
1385 1385
 			?>
1386 1386
 			<ul id="give-gateway-radio-list">
1387 1387
 				<?php
1388 1388
 				/**
1389 1389
 				 * Loop through the active payment gateways.
1390 1390
 				 */
1391
-				$selected_gateway = give_get_chosen_gateway( $form_id );
1391
+				$selected_gateway = give_get_chosen_gateway($form_id);
1392 1392
 				$give_settings    = give_get_settings();
1393
-				$gateways_label   = array_key_exists( 'gateways_label', $give_settings ) ?
1394
-					$give_settings['gateways_label'] :
1395
-					array();
1393
+				$gateways_label   = array_key_exists('gateways_label', $give_settings) ?
1394
+					$give_settings['gateways_label'] : array();
1396 1395
 
1397
-				foreach ( $gateways as $gateway_id => $gateway ) :
1396
+				foreach ($gateways as $gateway_id => $gateway) :
1398 1397
 					//Determine the default gateway.
1399
-					$checked = checked( $gateway_id, $selected_gateway, false );
1398
+					$checked = checked($gateway_id, $selected_gateway, false);
1400 1399
 					$checked_class = $checked ? ' class="give-gateway-option-selected"' : ''; ?>
1401 1400
 					<li<?php echo $checked_class ?>>
1402 1401
 						<input type="radio" name="payment-mode" class="give-gateway"
1403
-							   id="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>"
1404
-							   value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>>
1402
+							   id="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>"
1403
+							   value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>>
1405 1404
 
1406 1405
 						<?php
1407 1406
 						$label = $gateway['checkout_label'];
1408
-						if ( ! empty( $gateways_label[ $gateway_id  ] ) ) {
1409
-							$label = $gateways_label[ $gateway_id ];
1407
+						if ( ! empty($gateways_label[$gateway_id])) {
1408
+							$label = $gateways_label[$gateway_id];
1410 1409
 						}
1411 1410
 						?>
1412
-						<label for="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>"
1411
+						<label for="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>"
1413 1412
 							   class="give-gateway-option"
1414
-							   id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $label ); ?></label>
1413
+							   id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($label); ?></label>
1415 1414
 					</li>
1416 1415
 					<?php
1417 1416
 				endforeach;
@@ -1423,7 +1422,7 @@  discard block
 block discarded – undo
1423 1422
 			 *
1424 1423
 			 * @since 1.7
1425 1424
 			 */
1426
-			do_action( 'give_payment_mode_after_gateways' );
1425
+			do_action('give_payment_mode_after_gateways');
1427 1426
 			?>
1428 1427
 		</div>
1429 1428
 		<?php
@@ -1434,7 +1433,7 @@  discard block
 block discarded – undo
1434 1433
 		 *
1435 1434
 		 * @param int $form_id The form ID.
1436 1435
 		 */
1437
-		do_action( 'give_payment_mode_after_gateways_wrap' );
1436
+		do_action('give_payment_mode_after_gateways_wrap');
1438 1437
 		?>
1439 1438
 	</fieldset>
1440 1439
 
@@ -1446,7 +1445,7 @@  discard block
 block discarded – undo
1446 1445
 	 *
1447 1446
 	 * @param int $form_id The form ID.
1448 1447
 	 */
1449
-	do_action( 'give_payment_mode_bottom', $form_id );
1448
+	do_action('give_payment_mode_bottom', $form_id);
1450 1449
 	?>
1451 1450
 
1452 1451
 	<div id="give_purchase_form_wrap">
@@ -1457,7 +1456,7 @@  discard block
 block discarded – undo
1457 1456
 		 *
1458 1457
 		 * @since 1.7
1459 1458
 		 */
1460
-		do_action( 'give_donation_form', $form_id );
1459
+		do_action('give_donation_form', $form_id);
1461 1460
 		?>
1462 1461
 
1463 1462
 	</div>
@@ -1468,10 +1467,10 @@  discard block
 block discarded – undo
1468 1467
 	 *
1469 1468
 	 * @since 1.7
1470 1469
 	 */
1471
-	do_action( 'give_donation_form_wrap_bottom', $form_id );
1470
+	do_action('give_donation_form_wrap_bottom', $form_id);
1472 1471
 }
1473 1472
 
1474
-add_action( 'give_payment_mode_select', 'give_payment_mode_select' );
1473
+add_action('give_payment_mode_select', 'give_payment_mode_select');
1475 1474
 
1476 1475
 /**
1477 1476
  * Renders the Checkout Agree to Terms, this displays a checkbox for users to
@@ -1484,31 +1483,31 @@  discard block
 block discarded – undo
1484 1483
  *
1485 1484
  * @return bool
1486 1485
  */
1487
-function give_terms_agreement( $form_id ) {
1488
-	$form_option = give_get_meta( $form_id, '_give_terms_option', true );
1486
+function give_terms_agreement($form_id) {
1487
+	$form_option = give_get_meta($form_id, '_give_terms_option', true);
1489 1488
 
1490 1489
 	// Bailout if per form and global term and conditions is not setup.
1491 1490
 	if (
1492
-		give_is_setting_enabled( $form_option, 'global' )
1493
-		&& give_is_setting_enabled( give_get_option( 'terms' ) )
1491
+		give_is_setting_enabled($form_option, 'global')
1492
+		&& give_is_setting_enabled(give_get_option('terms'))
1494 1493
 	) {
1495
-		$label         = give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) );
1496
-		$terms         = $terms = give_get_option( 'agreement_text', '' );
1497
-		$edit_term_url = admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=display&section=term-and-conditions' );
1494
+		$label         = give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give'));
1495
+		$terms         = $terms = give_get_option('agreement_text', '');
1496
+		$edit_term_url = admin_url('edit.php?post_type=give_forms&page=give-settings&tab=display&section=term-and-conditions');
1498 1497
 
1499
-	} elseif ( give_is_setting_enabled( $form_option ) ) {
1500
-		$label         = ( $label = give_get_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' );
1501
-		$terms         = give_get_meta( $form_id, '_give_agree_text', true );
1502
-		$edit_term_url = admin_url( 'post.php?post=' . $form_id . '&action=edit#form_terms_options' );
1498
+	} elseif (give_is_setting_enabled($form_option)) {
1499
+		$label         = ($label = give_get_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give');
1500
+		$terms         = give_get_meta($form_id, '_give_agree_text', true);
1501
+		$edit_term_url = admin_url('post.php?post='.$form_id.'&action=edit#form_terms_options');
1503 1502
 
1504 1503
 	} else {
1505 1504
 		return false;
1506 1505
 	}
1507 1506
 
1508 1507
 	// Bailout: Check if term and conditions text is empty or not.
1509
-	if ( empty( $terms ) ) {
1510
-		if ( is_user_logged_in() && current_user_can( 'edit_give_forms' ) ) {
1511
-			echo sprintf( __( 'Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), $edit_term_url );
1508
+	if (empty($terms)) {
1509
+		if (is_user_logged_in() && current_user_can('edit_give_forms')) {
1510
+			echo sprintf(__('Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give'), $edit_term_url);
1512 1511
 		}
1513 1512
 
1514 1513
 		return false;
@@ -1516,7 +1515,7 @@  discard block
 block discarded – undo
1516 1515
 
1517 1516
 	?>
1518 1517
 	<fieldset id="give_terms_agreement">
1519
-		<legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend>
1518
+		<legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend>
1520 1519
 		<div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;">
1521 1520
 			<?php
1522 1521
 			/**
@@ -1524,22 +1523,22 @@  discard block
 block discarded – undo
1524 1523
 			 *
1525 1524
 			 * @since 1.0
1526 1525
 			 */
1527
-			do_action( 'give_before_terms' );
1526
+			do_action('give_before_terms');
1528 1527
 
1529
-			echo wpautop( stripslashes( $terms ) );
1528
+			echo wpautop(stripslashes($terms));
1530 1529
 			/**
1531 1530
 			 * Fires while rendering terms of agreement, after the fields.
1532 1531
 			 *
1533 1532
 			 * @since 1.0
1534 1533
 			 */
1535
-			do_action( 'give_after_terms' );
1534
+			do_action('give_after_terms');
1536 1535
 			?>
1537 1536
 		</div>
1538 1537
 		<div id="give_show_terms">
1539 1538
 			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1540
-			   aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a>
1539
+			   aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a>
1541 1540
 			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1542
-			   aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a>
1541
+			   aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a>
1543 1542
 		</div>
1544 1543
 
1545 1544
 		<input name="give_agree_to_terms" class="required" type="checkbox"
@@ -1550,7 +1549,7 @@  discard block
 block discarded – undo
1550 1549
 	<?php
1551 1550
 }
1552 1551
 
1553
-add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 );
1552
+add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1);
1554 1553
 
1555 1554
 /**
1556 1555
  * Checkout Final Total.
@@ -1563,15 +1562,14 @@  discard block
 block discarded – undo
1563 1562
  *
1564 1563
  * @return void
1565 1564
  */
1566
-function give_checkout_final_total( $form_id ) {
1565
+function give_checkout_final_total($form_id) {
1567 1566
 
1568
-	$total = isset( $_POST['give_total'] ) ?
1569
-		apply_filters( 'give_donation_total', give_maybe_sanitize_amount( $_POST['give_total'] ) ) :
1570
-		give_get_default_form_amount( $form_id );
1567
+	$total = isset($_POST['give_total']) ?
1568
+		apply_filters('give_donation_total', give_maybe_sanitize_amount($_POST['give_total'])) : give_get_default_form_amount($form_id);
1571 1569
 
1572 1570
 
1573 1571
 	// Only proceed if give_total available.
1574
-	if ( empty( $total ) ) {
1572
+	if (empty($total)) {
1575 1573
 		return;
1576 1574
 	}
1577 1575
 	?>
@@ -1582,14 +1580,14 @@  discard block
 block discarded – undo
1582 1580
 		 *
1583 1581
 		 * @since 2.0.5
1584 1582
 		 */
1585
-		do_action( 'give_donation_final_total_label_before', $form_id );
1583
+		do_action('give_donation_final_total_label_before', $form_id);
1586 1584
 		?>
1587 1585
 		<span class="give-donation-total-label">
1588
-			<?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?>
1586
+			<?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?>
1589 1587
 		</span>
1590 1588
 		<span class="give-final-total-amount"
1591
-			  data-total="<?php echo give_format_amount( $total, array( 'sanitize' => false ) ); ?>">
1592
-			<?php echo give_currency_filter( give_format_amount( $total, array( 'sanitize' => false ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ); ?>
1589
+			  data-total="<?php echo give_format_amount($total, array('sanitize' => false)); ?>">
1590
+			<?php echo give_currency_filter(give_format_amount($total, array('sanitize' => false)), array('currency_code' => give_get_currency($form_id))); ?>
1593 1591
 		</span>
1594 1592
 		<?php
1595 1593
 		/**
@@ -1597,13 +1595,13 @@  discard block
 block discarded – undo
1597 1595
 		 *
1598 1596
 		 * @since 2.0.5
1599 1597
 		 */
1600
-		do_action( 'give_donation_final_total_label_after', $form_id );
1598
+		do_action('give_donation_final_total_label_after', $form_id);
1601 1599
 		?>
1602 1600
 	</p>
1603 1601
 	<?php
1604 1602
 }
1605 1603
 
1606
-add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 );
1604
+add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999);
1607 1605
 
1608 1606
 /**
1609 1607
  * Renders the Checkout Submit section.
@@ -1614,7 +1612,7 @@  discard block
 block discarded – undo
1614 1612
  *
1615 1613
  * @return void
1616 1614
  */
1617
-function give_checkout_submit( $form_id ) {
1615
+function give_checkout_submit($form_id) {
1618 1616
 	?>
1619 1617
 	<fieldset id="give_purchase_submit" class="give-donation-submit">
1620 1618
 		<?php
@@ -1623,24 +1621,24 @@  discard block
 block discarded – undo
1623 1621
 		 *
1624 1622
 		 * @since 1.7
1625 1623
 		 */
1626
-		do_action( 'give_donation_form_before_submit', $form_id );
1624
+		do_action('give_donation_form_before_submit', $form_id);
1627 1625
 
1628
-		give_checkout_hidden_fields( $form_id );
1626
+		give_checkout_hidden_fields($form_id);
1629 1627
 
1630
-		echo give_get_donation_form_submit_button( $form_id );
1628
+		echo give_get_donation_form_submit_button($form_id);
1631 1629
 
1632 1630
 		/**
1633 1631
 		 * Fire after donation form submit.
1634 1632
 		 *
1635 1633
 		 * @since 1.7
1636 1634
 		 */
1637
-		do_action( 'give_donation_form_after_submit', $form_id );
1635
+		do_action('give_donation_form_after_submit', $form_id);
1638 1636
 		?>
1639 1637
 	</fieldset>
1640 1638
 	<?php
1641 1639
 }
1642 1640
 
1643
-add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 );
1641
+add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999);
1644 1642
 
1645 1643
 /**
1646 1644
  * Give Donation form submit button.
@@ -1651,10 +1649,10 @@  discard block
 block discarded – undo
1651 1649
  *
1652 1650
  * @return string
1653 1651
  */
1654
-function give_get_donation_form_submit_button( $form_id ) {
1652
+function give_get_donation_form_submit_button($form_id) {
1655 1653
 
1656
-	$display_label_field = give_get_meta( $form_id, '_give_checkout_label', true );
1657
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
1654
+	$display_label_field = give_get_meta($form_id, '_give_checkout_label', true);
1655
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
1658 1656
 	ob_start();
1659 1657
 	?>
1660 1658
 	<div class="give-submit-button-wrap give-clearfix">
@@ -1663,7 +1661,7 @@  discard block
 block discarded – undo
1663 1661
 		<span class="give-loading-animation"></span>
1664 1662
 	</div>
1665 1663
 	<?php
1666
-	return apply_filters( 'give_donation_form_submit_button', ob_get_clean(), $form_id );
1664
+	return apply_filters('give_donation_form_submit_button', ob_get_clean(), $form_id);
1667 1665
 }
1668 1666
 
1669 1667
 /**
@@ -1678,22 +1676,22 @@  discard block
 block discarded – undo
1678 1676
  *
1679 1677
  * @return mixed
1680 1678
  */
1681
-function give_show_goal_progress( $form_id, $args = array() ) {
1679
+function give_show_goal_progress($form_id, $args = array()) {
1682 1680
 
1683 1681
 	ob_start();
1684
-	give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) );
1682
+	give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args));
1685 1683
 
1686 1684
 	/**
1687 1685
 	 * Filter progress bar output
1688 1686
 	 *
1689 1687
 	 * @since 2.0
1690 1688
 	 */
1691
-	echo apply_filters( 'give_goal_output', ob_get_clean(), $form_id, $args );
1689
+	echo apply_filters('give_goal_output', ob_get_clean(), $form_id, $args);
1692 1690
 
1693 1691
 	return true;
1694 1692
 }
1695 1693
 
1696
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1694
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1697 1695
 
1698 1696
 /**
1699 1697
  * Show Give Totals Progress.
@@ -1705,22 +1703,22 @@  discard block
 block discarded – undo
1705 1703
  *
1706 1704
  * @return mixed
1707 1705
  */
1708
-function give_show_goal_totals_progress( $total, $total_goal ) {
1706
+function give_show_goal_totals_progress($total, $total_goal) {
1709 1707
 
1710 1708
 	// Bail out if total goal is set as an array.
1711
-	if ( isset( $total_goal ) && is_array( $total_goal ) ) {
1709
+	if (isset($total_goal) && is_array($total_goal)) {
1712 1710
 		return false;
1713 1711
 	}
1714 1712
 
1715 1713
 	ob_start();
1716
-	give_get_template( 'shortcode-totals-progress', array( 'total' => $total, 'total_goal' => $total_goal ) );
1714
+	give_get_template('shortcode-totals-progress', array('total' => $total, 'total_goal' => $total_goal));
1717 1715
 
1718
-	echo apply_filters( 'give_total_progress_output', ob_get_clean() );
1716
+	echo apply_filters('give_total_progress_output', ob_get_clean());
1719 1717
 
1720 1718
 	return true;
1721 1719
 }
1722 1720
 
1723
-add_action( 'give_pre_form', 'give_show_goal_totals_progress', 10, 2 );
1721
+add_action('give_pre_form', 'give_show_goal_totals_progress', 10, 2);
1724 1722
 
1725 1723
 /**
1726 1724
  * Get form content position.
@@ -1732,10 +1730,10 @@  discard block
 block discarded – undo
1732 1730
  *
1733 1731
  * @return mixed|string
1734 1732
  */
1735
-function give_get_form_content_placement( $form_id, $args ) {
1733
+function give_get_form_content_placement($form_id, $args) {
1736 1734
 	$show_content = '';
1737 1735
 
1738
-	if ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) {
1736
+	if (isset($args['show_content']) && ! empty($args['show_content'])) {
1739 1737
 		// Content positions.
1740 1738
 		$content_placement = array(
1741 1739
 			'above' => 'give_pre_form',
@@ -1743,18 +1741,18 @@  discard block
 block discarded – undo
1743 1741
 		);
1744 1742
 
1745 1743
 		// Check if content position already decoded.
1746
-		if ( in_array( $args['show_content'], $content_placement ) ) {
1744
+		if (in_array($args['show_content'], $content_placement)) {
1747 1745
 			return $args['show_content'];
1748 1746
 		}
1749 1747
 
1750
-		$show_content = ( 'none' !== $args['show_content'] ? $content_placement[ $args['show_content'] ] : '' );
1748
+		$show_content = ('none' !== $args['show_content'] ? $content_placement[$args['show_content']] : '');
1751 1749
 
1752
-	} elseif ( give_is_setting_enabled( give_get_meta( $form_id, '_give_display_content', true ) ) ) {
1753
-		$show_content = give_get_meta( $form_id, '_give_content_placement', true );
1750
+	} elseif (give_is_setting_enabled(give_get_meta($form_id, '_give_display_content', true))) {
1751
+		$show_content = give_get_meta($form_id, '_give_content_placement', true);
1754 1752
 
1755
-	} elseif ( 'none' !== give_get_meta( $form_id, '_give_content_option', true ) ) {
1753
+	} elseif ('none' !== give_get_meta($form_id, '_give_content_option', true)) {
1756 1754
 		// Backward compatibility for _give_content_option for v18.
1757
-		$show_content = give_get_meta( $form_id, '_give_content_option', true );
1755
+		$show_content = give_get_meta($form_id, '_give_content_option', true);
1758 1756
 	}
1759 1757
 
1760 1758
 	return $show_content;
@@ -1770,20 +1768,20 @@  discard block
 block discarded – undo
1770 1768
  *
1771 1769
  * @return void|bool
1772 1770
  */
1773
-function give_form_content( $form_id, $args ) {
1771
+function give_form_content($form_id, $args) {
1774 1772
 
1775
-	$show_content = give_get_form_content_placement( $form_id, $args );
1773
+	$show_content = give_get_form_content_placement($form_id, $args);
1776 1774
 
1777 1775
 	// Bailout.
1778
-	if ( empty( $show_content ) ) {
1776
+	if (empty($show_content)) {
1779 1777
 		return false;
1780 1778
 	}
1781 1779
 
1782 1780
 	// Add action according to value.
1783
-	add_action( $show_content, 'give_form_display_content', 10, 2 );
1781
+	add_action($show_content, 'give_form_display_content', 10, 2);
1784 1782
 }
1785 1783
 
1786
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
1784
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
1787 1785
 
1788 1786
 /**
1789 1787
  * Renders Post Form Content.
@@ -1797,22 +1795,22 @@  discard block
 block discarded – undo
1797 1795
  *
1798 1796
  * @return void
1799 1797
  */
1800
-function give_form_display_content( $form_id, $args ) {
1798
+function give_form_display_content($form_id, $args) {
1801 1799
 
1802
-	$content      = wpautop( give_get_meta( $form_id, '_give_form_content', true ) );
1803
-	$show_content = give_get_form_content_placement( $form_id, $args );
1800
+	$content      = wpautop(give_get_meta($form_id, '_give_form_content', true));
1801
+	$show_content = give_get_form_content_placement($form_id, $args);
1804 1802
 
1805
-	if ( give_is_setting_enabled( give_get_option( 'the_content_filter' ) ) ) {
1806
-		$content = apply_filters( 'the_content', $content );
1803
+	if (give_is_setting_enabled(give_get_option('the_content_filter'))) {
1804
+		$content = apply_filters('the_content', $content);
1807 1805
 	}
1808 1806
 
1809
-	$output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap ' . $show_content . '-content">' . $content . '</div>';
1807
+	$output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap '.$show_content.'-content">'.$content.'</div>';
1810 1808
 
1811
-	echo apply_filters( 'give_form_content_output', $output );
1809
+	echo apply_filters('give_form_content_output', $output);
1812 1810
 
1813 1811
 	// remove action to prevent content output on addition forms on page.
1814 1812
 	// @see: https://github.com/WordImpress/Give/issues/634.
1815
-	remove_action( $show_content, 'give_form_display_content' );
1813
+	remove_action($show_content, 'give_form_display_content');
1816 1814
 }
1817 1815
 
1818 1816
 /**
@@ -1824,7 +1822,7 @@  discard block
 block discarded – undo
1824 1822
  *
1825 1823
  * @return void
1826 1824
  */
1827
-function give_checkout_hidden_fields( $form_id ) {
1825
+function give_checkout_hidden_fields($form_id) {
1828 1826
 
1829 1827
 	/**
1830 1828
 	 * Fires while rendering hidden checkout fields, before the fields.
@@ -1833,13 +1831,13 @@  discard block
 block discarded – undo
1833 1831
 	 *
1834 1832
 	 * @param int $form_id The form ID.
1835 1833
 	 */
1836
-	do_action( 'give_hidden_fields_before', $form_id );
1834
+	do_action('give_hidden_fields_before', $form_id);
1837 1835
 
1838
-	if ( is_user_logged_in() ) { ?>
1836
+	if (is_user_logged_in()) { ?>
1839 1837
 		<input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/>
1840 1838
 	<?php } ?>
1841 1839
 	<input type="hidden" name="give_action" value="purchase"/>
1842
-	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/>
1840
+	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/>
1843 1841
 	<?php
1844 1842
 	/**
1845 1843
 	 * Fires while rendering hidden checkout fields, after the fields.
@@ -1848,7 +1846,7 @@  discard block
 block discarded – undo
1848 1846
 	 *
1849 1847
 	 * @param int $form_id The form ID.
1850 1848
 	 */
1851
-	do_action( 'give_hidden_fields_after', $form_id );
1849
+	do_action('give_hidden_fields_after', $form_id);
1852 1850
 
1853 1851
 }
1854 1852
 
@@ -1863,20 +1861,20 @@  discard block
 block discarded – undo
1863 1861
  *
1864 1862
  * @return string $content Filtered content.
1865 1863
  */
1866
-function give_filter_success_page_content( $content ) {
1864
+function give_filter_success_page_content($content) {
1867 1865
 
1868 1866
 	$give_options = give_get_settings();
1869 1867
 
1870
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
1871
-		if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) {
1872
-			$content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content );
1868
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
1869
+		if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) {
1870
+			$content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content);
1873 1871
 		}
1874 1872
 	}
1875 1873
 
1876 1874
 	return $content;
1877 1875
 }
1878 1876
 
1879
-add_filter( 'the_content', 'give_filter_success_page_content' );
1877
+add_filter('the_content', 'give_filter_success_page_content');
1880 1878
 
1881 1879
 /**
1882 1880
  * Test Mode Frontend Warning.
@@ -1887,12 +1885,12 @@  discard block
 block discarded – undo
1887 1885
  */
1888 1886
 function give_test_mode_frontend_warning() {
1889 1887
 
1890
-	if ( give_is_test_mode() ) {
1891
-		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>';
1888
+	if (give_is_test_mode()) {
1889
+		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>';
1892 1890
 	}
1893 1891
 }
1894 1892
 
1895
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
1893
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
1896 1894
 
1897 1895
 /**
1898 1896
  * Members-only Form.
@@ -1906,21 +1904,21 @@  discard block
 block discarded – undo
1906 1904
  *
1907 1905
  * @return string
1908 1906
  */
1909
-function give_members_only_form( $final_output, $args ) {
1907
+function give_members_only_form($final_output, $args) {
1910 1908
 
1911
-	$form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0;
1909
+	$form_id = isset($args['form_id']) ? $args['form_id'] : 0;
1912 1910
 
1913 1911
 	//Sanity Check: Must have form_id & not be logged in.
1914
-	if ( empty( $form_id ) || is_user_logged_in() ) {
1912
+	if (empty($form_id) || is_user_logged_in()) {
1915 1913
 		return $final_output;
1916 1914
 	}
1917 1915
 
1918 1916
 	//Logged in only and Register / Login set to none.
1919
-	if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) {
1917
+	if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
1920 1918
 
1921
-		$final_output = Give()->notices->print_frontend_notice( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false );
1919
+		$final_output = Give()->notices->print_frontend_notice(esc_html__('Please log in in order to complete your donation.', 'give'), false);
1922 1920
 
1923
-		return apply_filters( 'give_members_only_output', $final_output, $form_id );
1921
+		return apply_filters('give_members_only_output', $final_output, $form_id);
1924 1922
 
1925 1923
 	}
1926 1924
 
@@ -1928,7 +1926,7 @@  discard block
 block discarded – undo
1928 1926
 
1929 1927
 }
1930 1928
 
1931
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 );
1929
+add_filter('give_donate_form', 'give_members_only_form', 10, 2);
1932 1930
 
1933 1931
 
1934 1932
 /**
@@ -1940,38 +1938,38 @@  discard block
 block discarded – undo
1940 1938
  * @param array            $args
1941 1939
  * @param Give_Donate_Form $form
1942 1940
  */
1943
-function __give_form_add_donation_hidden_field( $form_id, $args, $form ) {
1941
+function __give_form_add_donation_hidden_field($form_id, $args, $form) {
1944 1942
 	?>
1945 1943
 	<input type="hidden" name="give-form-id" value="<?php echo $form_id; ?>"/>
1946
-	<input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/>
1944
+	<input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/>
1947 1945
 	<input type="hidden" name="give-current-url"
1948
-		   value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
1949
-	<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
1946
+		   value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
1947
+	<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
1950 1948
 	<?php
1951 1949
 	// Get the custom option amount.
1952
-	$custom_amount = give_get_meta( $form_id, '_give_custom_amount', true );
1950
+	$custom_amount = give_get_meta($form_id, '_give_custom_amount', true);
1953 1951
 
1954 1952
 	// If custom amount enabled.
1955
-	if ( give_is_setting_enabled( $custom_amount ) ) {
1953
+	if (give_is_setting_enabled($custom_amount)) {
1956 1954
 		?>
1957 1955
 		<input type="hidden" name="give-form-minimum"
1958
-		       value="<?php echo give_maybe_sanitize_amount( give_get_form_minimum_price( $form_id ) ); ?>"/>
1956
+		       value="<?php echo give_maybe_sanitize_amount(give_get_form_minimum_price($form_id)); ?>"/>
1959 1957
 		<input type="hidden" name="give-form-maximum"
1960
-		       value="<?php echo give_maybe_sanitize_amount( give_get_form_maximum_price( $form_id ) ); ?>"/>
1958
+		       value="<?php echo give_maybe_sanitize_amount(give_get_form_maximum_price($form_id)); ?>"/>
1961 1959
 		<?php
1962 1960
 	}
1963 1961
 
1964 1962
 	// WP nonce field.
1965
-	wp_nonce_field( "donation_form_nonce_{$form_id}", '_wpnonce', false );
1963
+	wp_nonce_field("donation_form_nonce_{$form_id}", '_wpnonce', false);
1966 1964
 
1967 1965
 	// Price ID hidden field for variable (multi-level) donation forms.
1968
-	if ( give_has_variable_prices( $form_id ) ) {
1966
+	if (give_has_variable_prices($form_id)) {
1969 1967
 		// Get default selected price ID.
1970
-		$prices   = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
1968
+		$prices   = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
1971 1969
 		$price_id = 0;
1972 1970
 		//loop through prices.
1973
-		foreach ( $prices as $price ) {
1974
-			if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
1971
+		foreach ($prices as $price) {
1972
+			if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
1975 1973
 				$price_id = $price['_give_id']['level_id'];
1976 1974
 			};
1977 1975
 		}
@@ -1984,7 +1982,7 @@  discard block
 block discarded – undo
1984 1982
 	}
1985 1983
 }
1986 1984
 
1987
-add_action( 'give_donation_form_top', '__give_form_add_donation_hidden_field', 0, 3 );
1985
+add_action('give_donation_form_top', '__give_form_add_donation_hidden_field', 0, 3);
1988 1986
 
1989 1987
 /**
1990 1988
  * Add currency settings on donation form.
@@ -1996,20 +1994,20 @@  discard block
 block discarded – undo
1996 1994
  *
1997 1995
  * @return array
1998 1996
  */
1999
-function __give_form_add_currency_settings( $form_html_tags, $form ) {
2000
-	$form_currency     = give_get_currency( $form->ID );
2001
-	$currency_settings = give_get_currency_formatting_settings( $form_currency );
1997
+function __give_form_add_currency_settings($form_html_tags, $form) {
1998
+	$form_currency     = give_get_currency($form->ID);
1999
+	$currency_settings = give_get_currency_formatting_settings($form_currency);
2002 2000
 
2003 2001
 	// Check if currency exist.
2004
-	if ( empty( $currency_settings ) ) {
2002
+	if (empty($currency_settings)) {
2005 2003
 		return $form_html_tags;
2006 2004
 	}
2007 2005
 
2008
-	$form_html_tags['data-currency_symbol'] = give_currency_symbol( $form_currency );
2006
+	$form_html_tags['data-currency_symbol'] = give_currency_symbol($form_currency);
2009 2007
 	$form_html_tags['data-currency_code']   = $form_currency;
2010 2008
 
2011
-	if ( ! empty( $currency_settings ) ) {
2012
-		foreach ( $currency_settings as $key => $value ) {
2009
+	if ( ! empty($currency_settings)) {
2010
+		foreach ($currency_settings as $key => $value) {
2013 2011
 			$form_html_tags["data-{$key}"] = $value;
2014 2012
 		}
2015 2013
 	}
@@ -2017,7 +2015,7 @@  discard block
 block discarded – undo
2017 2015
 	return $form_html_tags;
2018 2016
 }
2019 2017
 
2020
-add_filter( 'give_form_html_tags', '__give_form_add_currency_settings', 0, 2 );
2018
+add_filter('give_form_html_tags', '__give_form_add_currency_settings', 0, 2);
2021 2019
 
2022 2020
 /**
2023 2021
  * Adds classes to progress bar container.
@@ -2028,7 +2026,7 @@  discard block
 block discarded – undo
2028 2026
  *
2029 2027
  * @return string
2030 2028
  */
2031
-function add_give_goal_progress_class( $class_goal ) {
2029
+function add_give_goal_progress_class($class_goal) {
2032 2030
 	$class_goal = 'progress progress-striped active';
2033 2031
 
2034 2032
 	return $class_goal;
@@ -2043,7 +2041,7 @@  discard block
 block discarded – undo
2043 2041
  *
2044 2042
  * @return string
2045 2043
  */
2046
-function add_give_goal_progress_bar_class( $class_bar ) {
2044
+function add_give_goal_progress_bar_class($class_bar) {
2047 2045
 	$class_bar = 'bar';
2048 2046
 
2049 2047
 	return $class_bar;
@@ -2060,7 +2058,7 @@  discard block
 block discarded – undo
2060 2058
  *
2061 2059
  * @return array
2062 2060
  */
2063
-function add_class_for_form_grid( $class, $id, $args ) {
2061
+function add_class_for_form_grid($class, $id, $args) {
2064 2062
 	$class[] = 'give-form-grid-wrap';
2065 2063
 
2066 2064
 	return $class;
@@ -2075,7 +2073,7 @@  discard block
 block discarded – undo
2075 2073
  *
2076 2074
  * @since 2.1
2077 2075
  */
2078
-function give_is_form_grid_page_hidden_field( $id, $args, $form ) {
2076
+function give_is_form_grid_page_hidden_field($id, $args, $form) {
2079 2077
 	echo '<input type="hidden" name="is-form-grid" value="true" />';
2080 2078
 }
2081 2079
 
@@ -2090,28 +2088,28 @@  discard block
 block discarded – undo
2090 2088
  * @since 2.1
2091 2089
  * @return string
2092 2090
  */
2093
-function give_redirect_and_popup_form( $redirect, $args ) {
2091
+function give_redirect_and_popup_form($redirect, $args) {
2094 2092
 
2095 2093
 	// Check the page has Form Grid.
2096
-	$is_form_grid = isset( $_POST['is-form-grid'] ) ? give_clean( $_POST['is-form-grid'] ) : '';
2094
+	$is_form_grid = isset($_POST['is-form-grid']) ? give_clean($_POST['is-form-grid']) : '';
2097 2095
 
2098
-	if ( 'true' === $is_form_grid ) {
2096
+	if ('true' === $is_form_grid) {
2099 2097
 
2100
-		$payment_mode = give_clean( $_POST['payment-mode'] );
2098
+		$payment_mode = give_clean($_POST['payment-mode']);
2101 2099
 		$form_id = $args['form-id'];
2102 2100
 
2103 2101
 		// Get the URL without Query parameters.
2104
-		$redirect = strtok( $redirect, '?' );
2102
+		$redirect = strtok($redirect, '?');
2105 2103
 
2106 2104
 		// Add query parameters 'form-id' and 'payment-mode'.
2107
-		$redirect = add_query_arg( array(
2105
+		$redirect = add_query_arg(array(
2108 2106
 			'form-id'      => $form_id,
2109 2107
 			'payment-mode' => $payment_mode,
2110
-		), $redirect );
2108
+		), $redirect);
2111 2109
 	}
2112 2110
 
2113 2111
 	// Return the modified URL.
2114 2112
 	return $redirect;
2115 2113
 }
2116 2114
 
2117
-add_filter( 'give_send_back_to_checkout', 'give_redirect_and_popup_form', 10, 2 );
2118 2115
\ No newline at end of file
2116
+add_filter('give_send_back_to_checkout', 'give_redirect_and_popup_form', 10, 2);
2119 2117
\ No newline at end of file
Please login to merge, or discard this patch.
includes/process-donation.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -288,8 +288,8 @@
 block discarded – undo
288 288
 
289 289
 	// Check spam detect.
290 290
 	if ( isset( $_POST['action'] )
291
-	     && give_is_setting_enabled( give_get_option( 'akismet_spam_protection' ) )
292
-	     && give_is_spam_donation()
291
+		 && give_is_setting_enabled( give_get_option( 'akismet_spam_protection' ) )
292
+		 && give_is_spam_donation()
293 293
 	) {
294 294
 		give_set_error( 'invalid_donation', __( 'This donation has been flagged as spam. Please try again.', 'give' ) );
295 295
 	}
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  * @access private
23 23
  * @since  1.0
24 24
  *
25
- * @return mixed
25
+ * @return false|null
26 26
  */
27 27
 function give_process_donation_form() {
28 28
 
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
  * @access      private
487 487
  * @since       1.0
488 488
  *
489
- * @param       $form_id
489
+ * @param       integer $form_id
490 490
  *
491 491
  * @return      array
492 492
  */
Please login to merge, or discard this patch.
Spacing   +267 added lines, -268 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
 
@@ -26,20 +26,20 @@  discard block
 block discarded – undo
26 26
  */
27 27
 function give_process_donation_form() {
28 28
 
29
-	$is_ajax = isset( $_POST['give_ajax'] );
29
+	$is_ajax = isset($_POST['give_ajax']);
30 30
 
31 31
 	// Verify donation form nonce.
32
-	if(  ! give_verify_donation_form_nonce() ) {
33
-		if( $is_ajax ) {
32
+	if ( ! give_verify_donation_form_nonce()) {
33
+		if ($is_ajax) {
34 34
 			/**
35 35
 			 * Fires when AJAX sends back errors from the donation form.
36 36
 			 *
37 37
 			 * @since 1.0
38 38
 			 */
39
-			do_action( 'give_ajax_donation_errors' );
39
+			do_action('give_ajax_donation_errors');
40 40
 			
41 41
 			give_die();
42
-		} else{
42
+		} else {
43 43
 			give_send_back_to_checkout();
44 44
 		}
45 45
 	}
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 *
50 50
 	 * @since 1.0
51 51
 	 */
52
-	do_action( 'give_pre_process_donation' );
52
+	do_action('give_pre_process_donation');
53 53
 
54 54
 	// Validate the form $_POST data.
55 55
 	$valid_data = give_donation_form_validate_fields();
@@ -64,24 +64,24 @@  discard block
 block discarded – undo
64 64
 	 * @param bool|array $valid_data Validate fields.
65 65
 	 * @param array $deprecated Deprecated Since 2.0.2. Use $_POST instead.
66 66
 	 */
67
-	do_action( 'give_checkout_error_checks', $valid_data, $deprecated = $_POST );
67
+	do_action('give_checkout_error_checks', $valid_data, $deprecated = $_POST);
68 68
 
69 69
 	// Process the login form.
70
-	if ( isset( $_POST['give_login_submit'] ) ) {
70
+	if (isset($_POST['give_login_submit'])) {
71 71
 		give_process_form_login();
72 72
 	}
73 73
 
74 74
 	// Validate the user.
75
-	$user = give_get_donation_form_user( $valid_data );
75
+	$user = give_get_donation_form_user($valid_data);
76 76
 
77
-	if ( false === $valid_data || give_get_errors() || ! $user ) {
78
-		if ( $is_ajax ) {
77
+	if (false === $valid_data || give_get_errors() || ! $user) {
78
+		if ($is_ajax) {
79 79
 			/**
80 80
 			 * Fires when AJAX sends back errors from the donation form.
81 81
 			 *
82 82
 			 * @since 1.0
83 83
 			 */
84
-			do_action( 'give_ajax_donation_errors' );
84
+			do_action('give_ajax_donation_errors');
85 85
 			give_die();
86 86
 		} else {
87 87
 			return false;
@@ -89,17 +89,17 @@  discard block
 block discarded – undo
89 89
 	}
90 90
 
91 91
 	// If AJAX send back success to proceed with form submission.
92
-	if ( $is_ajax ) {
92
+	if ($is_ajax) {
93 93
 		echo 'success';
94 94
 		give_die();
95 95
 	}
96 96
 
97 97
 	// After AJAX: Setup session if not using php_sessions.
98
-	if ( ! Give()->session->use_php_sessions() ) {
98
+	if ( ! Give()->session->use_php_sessions()) {
99 99
 		// Double-check that set_cookie is publicly accessible.
100 100
 		// we're using a slightly modified class-wp-sessions.php.
101
-		$session_reflection = new ReflectionMethod( 'WP_Session', 'set_cookie' );
102
-		if ( $session_reflection->isPublic() ) {
101
+		$session_reflection = new ReflectionMethod('WP_Session', 'set_cookie');
102
+		if ($session_reflection->isPublic()) {
103 103
 			// Manually set the cookie.
104 104
 			Give()->session->init()->set_cookie();
105 105
 		}
@@ -114,21 +114,20 @@  discard block
 block discarded – undo
114 114
 		'address'    => $user['address'],
115 115
 	);
116 116
 
117
-	$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
117
+	$auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
118 118
 
119
-	$price        = isset( $_POST['give-amount'] ) ?
120
-		(float) apply_filters( 'give_donation_total', give_maybe_sanitize_amount( $_POST['give-amount'] ) ) :
121
-		'0.00';
122
-	$purchase_key = strtolower( md5( $user['user_email'] . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );
119
+	$price        = isset($_POST['give-amount']) ?
120
+		(float) apply_filters('give_donation_total', give_maybe_sanitize_amount($_POST['give-amount'])) : '0.00';
121
+	$purchase_key = strtolower(md5($user['user_email'].date('Y-m-d H:i:s').$auth_key.uniqid('give', true)));
123 122
 
124 123
 	// Setup donation information.
125 124
 	$donation_data = array(
126 125
 		'price'         => $price,
127 126
 		'purchase_key'  => $purchase_key,
128 127
 		'user_email'    => $user['user_email'],
129
-		'date'          => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ),
130
-		'user_info'     => stripslashes_deep( $user_info ),
131
-		'post_data'     => give_clean( $_POST ),
128
+		'date'          => date('Y-m-d H:i:s', current_time('timestamp')),
129
+		'user_info'     => stripslashes_deep($user_info),
130
+		'post_data'     => give_clean($_POST),
132 131
 		'gateway'       => $valid_data['gateway'],
133 132
 		'card_info'     => $valid_data['cc_info'],
134 133
 	);
@@ -147,10 +146,10 @@  discard block
 block discarded – undo
147 146
 	 * @param array $user_info Array containing basic user information.
148 147
 	 * @param bool|array $valid_data Validate fields.
149 148
 	 */
150
-	do_action( 'give_checkout_before_gateway', give_clean( $_POST ), $user_info, $valid_data );
149
+	do_action('give_checkout_before_gateway', give_clean($_POST), $user_info, $valid_data);
151 150
 
152 151
 	// Sanity check for price.
153
-	if ( ! $donation_data['price'] ) {
152
+	if ( ! $donation_data['price']) {
154 153
 		// Revert to manual.
155 154
 		$donation_data['gateway'] = 'manual';
156 155
 		$_POST['give-gateway']    = 'manual';
@@ -161,26 +160,26 @@  discard block
 block discarded – undo
161 160
 	 *
162 161
 	 * @since 1.7
163 162
 	 */
164
-	$donation_data = apply_filters( 'give_donation_data_before_gateway', $donation_data, $valid_data );
163
+	$donation_data = apply_filters('give_donation_data_before_gateway', $donation_data, $valid_data);
165 164
 
166 165
 	// Setup the data we're storing in the donation session.
167 166
 	$session_data = $donation_data;
168 167
 
169 168
 	// Make sure credit card numbers are never stored in sessions.
170
-	unset( $session_data['card_info']['card_number'] );
171
-	unset( $session_data['post_data']['card_number'] );
169
+	unset($session_data['card_info']['card_number']);
170
+	unset($session_data['post_data']['card_number']);
172 171
 
173 172
 	// Used for showing data to non logged-in users after donation, and for other plugins needing donation data.
174
-	give_set_purchase_session( $session_data );
173
+	give_set_purchase_session($session_data);
175 174
 
176 175
 	// Send info to the gateway for payment processing.
177
-	give_send_to_gateway( $donation_data['gateway'], $donation_data );
176
+	give_send_to_gateway($donation_data['gateway'], $donation_data);
178 177
 	give_die();
179 178
 }
180 179
 
181
-add_action( 'give_purchase', 'give_process_donation_form' );
182
-add_action( 'wp_ajax_give_process_donation', 'give_process_donation_form' );
183
-add_action( 'wp_ajax_nopriv_give_process_donation', 'give_process_donation_form' );
180
+add_action('give_purchase', 'give_process_donation_form');
181
+add_action('wp_ajax_give_process_donation', 'give_process_donation_form');
182
+add_action('wp_ajax_nopriv_give_process_donation', 'give_process_donation_form');
184 183
 
185 184
 /**
186 185
  * Verify that when a logged in user makes a donation that the email address used doesn't belong to a different customer.
@@ -191,29 +190,29 @@  discard block
 block discarded – undo
191 190
  *
192 191
  * @return void
193 192
  */
194
-function give_check_logged_in_user_for_existing_email( $valid_data ) {
193
+function give_check_logged_in_user_for_existing_email($valid_data) {
195 194
 
196 195
 	// Verify that the email address belongs to this customer.
197
-	if ( is_user_logged_in() ) {
196
+	if (is_user_logged_in()) {
198 197
 
199 198
 		$submitted_email = $valid_data['logged_in_user']['user_email'];
200
-		$donor           = new Give_Donor( get_current_user_id(), true );
199
+		$donor           = new Give_Donor(get_current_user_id(), true);
201 200
 
202 201
 		// If this email address is not registered with this customer, see if it belongs to any other customer.
203 202
 		if (
204 203
 			$submitted_email !== $donor->email
205
-			&& ( is_array( $donor->emails ) && ! in_array( $submitted_email, $donor->emails ) )
204
+			&& (is_array($donor->emails) && ! in_array($submitted_email, $donor->emails))
206 205
 		) {
207
-			$found_donor = new Give_Donor( $submitted_email );
206
+			$found_donor = new Give_Donor($submitted_email);
208 207
 
209
-			if ( $found_donor->id > 0 ) {
210
-				give_set_error( 'give-customer-email-exists', sprintf( __( 'You are logged in as %1$s, and are submitting a donation as %2$s, which is an existing donor. To ensure that the email address is tied to the correct donor, please submit this donation from a logged-out browser, or choose another email address.', 'give' ), $donor->email, $submitted_email ) );
208
+			if ($found_donor->id > 0) {
209
+				give_set_error('give-customer-email-exists', sprintf(__('You are logged in as %1$s, and are submitting a donation as %2$s, which is an existing donor. To ensure that the email address is tied to the correct donor, please submit this donation from a logged-out browser, or choose another email address.', 'give'), $donor->email, $submitted_email));
211 210
 			}
212 211
 		}
213 212
 	}
214 213
 }
215 214
 
216
-add_action( 'give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 1 );
215
+add_action('give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 1);
217 216
 
218 217
 /**
219 218
  * Process the checkout login form
@@ -223,49 +222,49 @@  discard block
 block discarded – undo
223 222
  * @return      void
224 223
  */
225 224
 function give_process_form_login() {
226
-	$is_ajax = isset( $_POST['give_ajax'] );
225
+	$is_ajax = isset($_POST['give_ajax']);
227 226
 
228 227
 	$user_data = give_donation_form_validate_user_login();
229 228
 
230
-	if ( give_get_errors() || $user_data['user_id'] < 1 ) {
231
-		if ( $is_ajax ) {
229
+	if (give_get_errors() || $user_data['user_id'] < 1) {
230
+		if ($is_ajax) {
232 231
 			/**
233 232
 			 * Fires when AJAX sends back errors from the donation form.
234 233
 			 *
235 234
 			 * @since 1.0
236 235
 			 */
237 236
 			ob_start();
238
-			do_action( 'give_ajax_donation_errors' );
237
+			do_action('give_ajax_donation_errors');
239 238
 			$message = ob_get_contents();
240 239
 			ob_end_clean();
241
-			wp_send_json_error( $message );
240
+			wp_send_json_error($message);
242 241
 		} else {
243
-			wp_redirect( $_SERVER['HTTP_REFERER'] );
242
+			wp_redirect($_SERVER['HTTP_REFERER']);
244 243
 			exit;
245 244
 		}
246 245
 	}
247 246
 
248
-	give_log_user_in( $user_data['user_id'], $user_data['user_login'], $user_data['user_pass'] );
247
+	give_log_user_in($user_data['user_id'], $user_data['user_login'], $user_data['user_pass']);
249 248
 
250
-	if ( $is_ajax ) {
249
+	if ($is_ajax) {
251 250
 		$message = Give()->notices->print_frontend_notice(
252 251
 			sprintf(
253 252
 			/* translators: %s: user first name */
254
-				esc_html__( 'Welcome %s! You have successfully logged into your account.', 'give' ),
255
-				( ! empty( $user_data['user_first'] ) ) ? $user_data['user_first'] : $user_data['user_login']
253
+				esc_html__('Welcome %s! You have successfully logged into your account.', 'give'),
254
+				( ! empty($user_data['user_first'])) ? $user_data['user_first'] : $user_data['user_login']
256 255
 			),
257 256
 			false,
258 257
 			'success'
259 258
 		);
260 259
 
261
-		wp_send_json_success( $message );
260
+		wp_send_json_success($message);
262 261
 	} else {
263
-		wp_redirect( $_SERVER['HTTP_REFERER'] );
262
+		wp_redirect($_SERVER['HTTP_REFERER']);
264 263
 	}
265 264
 }
266 265
 
267
-add_action( 'wp_ajax_give_process_donation_login', 'give_process_form_login' );
268
-add_action( 'wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login' );
266
+add_action('wp_ajax_give_process_donation_login', 'give_process_form_login');
267
+add_action('wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login');
269 268
 
270 269
 /**
271 270
  * Donation Form Validate Fields.
@@ -277,52 +276,52 @@  discard block
 block discarded – undo
277 276
 function give_donation_form_validate_fields() {
278 277
 
279 278
 	// Check if there is $_POST.
280
-	if ( empty( $_POST ) ) {
279
+	if (empty($_POST)) {
281 280
 		return false;
282 281
 	}
283 282
 
284
-	$form_id = ! empty( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
283
+	$form_id = ! empty($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
285 284
 
286 285
 	// Start an array to collect valid data.
287 286
 	$valid_data = array(
288 287
 		'gateway'          => give_donation_form_validate_gateway(), // Gateway fallback (amount is validated here).
289
-		'need_new_user'    => false,     // New user flag.
290
-		'need_user_login'  => false,     // Login user flag.
291
-		'logged_user_data' => array(),   // Logged user collected data.
292
-		'new_user_data'    => array(),   // New user collected data.
293
-		'login_user_data'  => array(),   // Login user collected data.
294
-		'guest_user_data'  => array(),   // Guest user collected data.
295
-		'cc_info'          => give_donation_form_validate_cc(),// Credit card info.
288
+		'need_new_user'    => false, // New user flag.
289
+		'need_user_login'  => false, // Login user flag.
290
+		'logged_user_data' => array(), // Logged user collected data.
291
+		'new_user_data'    => array(), // New user collected data.
292
+		'login_user_data'  => array(), // Login user collected data.
293
+		'guest_user_data'  => array(), // Guest user collected data.
294
+		'cc_info'          => give_donation_form_validate_cc(), // Credit card info.
296 295
 	);
297 296
 
298 297
 	// Validate Honeypot First.
299
-	if ( ! empty( $_POST['give-honeypot'] ) ) {
300
-		give_set_error( 'invalid_honeypot', esc_html__( 'Honeypot field detected. Go away bad bot!', 'give' ) );
298
+	if ( ! empty($_POST['give-honeypot'])) {
299
+		give_set_error('invalid_honeypot', esc_html__('Honeypot field detected. Go away bad bot!', 'give'));
301 300
 	}
302 301
 
303 302
 	// Check spam detect.
304
-	if ( isset( $_POST['action'] )
305
-	     && give_is_setting_enabled( give_get_option( 'akismet_spam_protection' ) )
303
+	if (isset($_POST['action'])
304
+	     && give_is_setting_enabled(give_get_option('akismet_spam_protection'))
306 305
 	     && give_is_spam_donation()
307 306
 	) {
308
-		give_set_error( 'invalid_donation', __( 'This donation has been flagged as spam. Please try again.', 'give' ) );
307
+		give_set_error('invalid_donation', __('This donation has been flagged as spam. Please try again.', 'give'));
309 308
 	}
310 309
 
311 310
 	// Validate agree to terms.
312
-	if ( give_is_terms_enabled( $form_id ) ) {
311
+	if (give_is_terms_enabled($form_id)) {
313 312
 		give_donation_form_validate_agree_to_terms();
314 313
 	}
315 314
 
316
-	if ( is_user_logged_in() ) {
315
+	if (is_user_logged_in()) {
317 316
 		// Collect logged in user data.
318 317
 		$valid_data['logged_in_user'] = give_donation_form_validate_logged_in_user();
319
-	} elseif ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-register' && ! empty( $_POST['give_create_account'] ) ) {
318
+	} elseif (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-register' && ! empty($_POST['give_create_account'])) {
320 319
 		// Set new user registration as required.
321 320
 		$valid_data['need_new_user'] = true;
322 321
 		// Validate new user data.
323 322
 		$valid_data['new_user_data'] = give_donation_form_validate_new_user();
324 323
 		// Check if login validation is needed.
325
-	} elseif ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-login' ) {
324
+	} elseif (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-login') {
326 325
 		// Set user login as required.
327 326
 		$valid_data['need_user_login'] = true;
328 327
 		// Validate users login info.
@@ -346,14 +345,14 @@  discard block
 block discarded – undo
346 345
 function give_is_spam_donation() {
347 346
 	$spam = false;
348 347
 
349
-	$user_agent = (string) isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '';
348
+	$user_agent = (string) isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
350 349
 
351
-	if ( strlen( $user_agent ) < 2 ) {
350
+	if (strlen($user_agent) < 2) {
352 351
 		$spam = true;
353 352
 	}
354 353
 
355 354
 	// Allow developer to customized Akismet spam detect API call and it's response.
356
-	return apply_filters( 'give_spam', $spam );
355
+	return apply_filters('give_spam', $spam);
357 356
 }
358 357
 
359 358
 /**
@@ -367,53 +366,53 @@  discard block
 block discarded – undo
367 366
  */
368 367
 function give_donation_form_validate_gateway() {
369 368
 
370
-	$form_id = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
371
-	$amount  = isset( $_REQUEST['give-amount'] ) ? give_maybe_sanitize_amount( $_REQUEST['give-amount'] ) : 0;
372
-	$gateway = give_get_default_gateway( $form_id );
369
+	$form_id = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
370
+	$amount  = isset($_REQUEST['give-amount']) ? give_maybe_sanitize_amount($_REQUEST['give-amount']) : 0;
371
+	$gateway = give_get_default_gateway($form_id);
373 372
 
374 373
 	// Check if a gateway value is present.
375
-	if ( ! empty( $_REQUEST['give-gateway'] ) ) {
374
+	if ( ! empty($_REQUEST['give-gateway'])) {
376 375
 
377
-		$gateway = sanitize_text_field( $_REQUEST['give-gateway'] );
376
+		$gateway = sanitize_text_field($_REQUEST['give-gateway']);
378 377
 
379 378
 		// Is amount being donated in LIVE mode 0.00? If so, error:
380
-		if ( $amount == 0 && ! give_is_test_mode() ) {
379
+		if ($amount == 0 && ! give_is_test_mode()) {
381 380
 
382
-			give_set_error( 'invalid_donation_amount', __( 'Please insert a valid donation amount.', 'give' ) );
381
+			give_set_error('invalid_donation_amount', __('Please insert a valid donation amount.', 'give'));
383 382
 
384 383
 		} // End if().
385
-		elseif ( ! give_verify_minimum_price( 'minimum' ) ) {
384
+		elseif ( ! give_verify_minimum_price('minimum')) {
386 385
 			// translators: %s: minimum donation amount.
387 386
 			give_set_error(
388 387
 				'invalid_donation_minimum',
389 388
 				sprintf(
390 389
 				/* translators: %s: minimum donation amount */
391
-					__( 'This form has a minimum donation amount of %s.', 'give' ),
392
-					give_currency_filter( give_format_amount( give_get_form_minimum_price( $form_id ), array( 'sanitize' => false ) ) )
390
+					__('This form has a minimum donation amount of %s.', 'give'),
391
+					give_currency_filter(give_format_amount(give_get_form_minimum_price($form_id), array('sanitize' => false)))
393 392
 				)
394 393
 			);
395 394
 
396 395
 		} // End if().
397
-		elseif ( ! give_verify_minimum_price( 'maximum' ) ) {
396
+		elseif ( ! give_verify_minimum_price('maximum')) {
398 397
 			// translators: %s: Maximum donation amount.
399 398
 			give_set_error(
400 399
 				'invalid_donation_maximum',
401 400
 				sprintf(
402 401
 				/* translators: %s: Maximum donation amount */
403
-					__( 'This form has a maximum donation amount of %s.', 'give' ),
404
-					give_currency_filter( give_format_amount( give_get_form_maximum_price( $form_id ), array( 'sanitize' => false ) ) )
402
+					__('This form has a maximum donation amount of %s.', 'give'),
403
+					give_currency_filter(give_format_amount(give_get_form_maximum_price($form_id), array('sanitize' => false)))
405 404
 				)
406 405
 			);
407 406
 
408 407
 		} //Is this test mode zero donation? Let it through but set to manual gateway.
409
-		elseif ( $amount == 0 && give_is_test_mode() ) {
408
+		elseif ($amount == 0 && give_is_test_mode()) {
410 409
 
411 410
 			$gateway = 'manual';
412 411
 
413 412
 		} //Check if this gateway is active.
414
-		elseif ( ! give_is_gateway_active( $gateway ) ) {
413
+		elseif ( ! give_is_gateway_active($gateway)) {
415 414
 
416
-			give_set_error( 'invalid_gateway', __( 'The selected payment gateway is not enabled.', 'give' ) );
415
+			give_set_error('invalid_gateway', __('The selected payment gateway is not enabled.', 'give'));
417 416
 
418 417
 		}
419 418
 	}
@@ -433,30 +432,30 @@  discard block
 block discarded – undo
433 432
  *
434 433
  * @return      bool
435 434
  */
436
-function give_verify_minimum_price( $amount_range = 'minimum' ) {
435
+function give_verify_minimum_price($amount_range = 'minimum') {
437 436
 
438
-	$amount          = give_maybe_sanitize_amount( $_REQUEST['give-amount'] );
439
-	$form_id         = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
440
-	$price_id        = isset( $_REQUEST['give-price-id'] ) ? $_REQUEST['give-price-id'] : null;
441
-	$variable_prices = give_has_variable_prices( $form_id );
437
+	$amount          = give_maybe_sanitize_amount($_REQUEST['give-amount']);
438
+	$form_id         = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
439
+	$price_id        = isset($_REQUEST['give-price-id']) ? $_REQUEST['give-price-id'] : null;
440
+	$variable_prices = give_has_variable_prices($form_id);
442 441
 
443
-	if ( $variable_prices && in_array( $price_id, give_get_variable_price_ids( $form_id ) ) ) {
442
+	if ($variable_prices && in_array($price_id, give_get_variable_price_ids($form_id))) {
444 443
 
445
-		$price_level_amount = give_get_price_option_amount( $form_id, $price_id );
444
+		$price_level_amount = give_get_price_option_amount($form_id, $price_id);
446 445
 
447
-		if ( $price_level_amount == $amount ) {
446
+		if ($price_level_amount == $amount) {
448 447
 			return true;
449 448
 		}
450 449
 	}
451 450
 
452
-	switch ( $amount_range ) {
451
+	switch ($amount_range) {
453 452
 		case 'minimum' :
454
-			if ( give_get_form_minimum_price( $form_id ) > $amount ) {
453
+			if (give_get_form_minimum_price($form_id) > $amount) {
455 454
 				return false;
456 455
 			}
457 456
 			break;
458 457
 		case 'maximum' :
459
-			if ( give_get_form_maximum_price( $form_id ) < $amount ) {
458
+			if (give_get_form_maximum_price($form_id) < $amount) {
460 459
 				return false;
461 460
 			}
462 461
 			break;
@@ -474,9 +473,9 @@  discard block
 block discarded – undo
474 473
  */
475 474
 function give_donation_form_validate_agree_to_terms() {
476 475
 	// Validate agree to terms.
477
-	if ( ! isset( $_POST['give_agree_to_terms'] ) || $_POST['give_agree_to_terms'] != 1 ) {
476
+	if ( ! isset($_POST['give_agree_to_terms']) || $_POST['give_agree_to_terms'] != 1) {
478 477
 		// User did not agree.
479
-		give_set_error( 'agree_to_terms', apply_filters( 'give_agree_to_terms_text', __( 'You must agree to the terms and conditions.', 'give' ) ) );
478
+		give_set_error('agree_to_terms', apply_filters('give_agree_to_terms_text', __('You must agree to the terms and conditions.', 'give')));
480 479
 	}
481 480
 }
482 481
 
@@ -490,84 +489,84 @@  discard block
 block discarded – undo
490 489
  *
491 490
  * @return      array
492 491
  */
493
-function give_get_required_fields( $form_id ) {
492
+function give_get_required_fields($form_id) {
494 493
 
495
-	$payment_mode = give_get_chosen_gateway( $form_id );
494
+	$payment_mode = give_get_chosen_gateway($form_id);
496 495
 
497 496
 	$required_fields = array(
498 497
 		'give_email' => array(
499 498
 			'error_id'      => 'invalid_email',
500
-			'error_message' => __( 'Please enter a valid email address.', 'give' ),
499
+			'error_message' => __('Please enter a valid email address.', 'give'),
501 500
 		),
502 501
 		'give_first' => array(
503 502
 			'error_id'      => 'invalid_first_name',
504
-			'error_message' => __( 'Please enter your first name.', 'give' ),
503
+			'error_message' => __('Please enter your first name.', 'give'),
505 504
 		),
506 505
 	);
507 506
 
508
-	$require_address = give_require_billing_address( $payment_mode );
507
+	$require_address = give_require_billing_address($payment_mode);
509 508
 
510
-	if ( $require_address ) {
511
-		$required_fields['card_address']    = array(
509
+	if ($require_address) {
510
+		$required_fields['card_address'] = array(
512 511
 			'error_id'      => 'invalid_card_address',
513
-			'error_message' => __( 'Please enter your primary billing address.', 'give' ),
512
+			'error_message' => __('Please enter your primary billing address.', 'give'),
514 513
 		);
515
-		$required_fields['card_zip']        = array(
514
+		$required_fields['card_zip'] = array(
516 515
 			'error_id'      => 'invalid_zip_code',
517
-			'error_message' => __( 'Please enter your zip / postal code.', 'give' ),
516
+			'error_message' => __('Please enter your zip / postal code.', 'give'),
518 517
 		);
519
-		$required_fields['card_city']       = array(
518
+		$required_fields['card_city'] = array(
520 519
 			'error_id'      => 'invalid_city',
521
-			'error_message' => __( 'Please enter your billing city.', 'give' ),
520
+			'error_message' => __('Please enter your billing city.', 'give'),
522 521
 		);
523 522
 		$required_fields['billing_country'] = array(
524 523
 			'error_id'      => 'invalid_country',
525
-			'error_message' => __( 'Please select your billing country.', 'give' ),
524
+			'error_message' => __('Please select your billing country.', 'give'),
526 525
 		);
527 526
 
528 527
 
529 528
 		$required_fields['card_state'] = array(
530 529
 			'error_id'      => 'invalid_state',
531
-			'error_message' => __( 'Please enter billing state / province / County.', 'give' ),
530
+			'error_message' => __('Please enter billing state / province / County.', 'give'),
532 531
 		);
533 532
 
534 533
 		// Check if billing country already exists.
535
-		if ( ! empty( $_POST['billing_country'] ) ) {
534
+		if ( ! empty($_POST['billing_country'])) {
536 535
 			// Get the value from $_POST.
537
-			$country = sanitize_text_field( $_POST['billing_country'] );
536
+			$country = sanitize_text_field($_POST['billing_country']);
538 537
 
539 538
 			// Get the country list that does not required any states init.
540 539
 			$states_country = give_states_not_required_country_list();
541 540
 
542 541
 			// Check if states is empty or not.
543
-			if ( array_key_exists( $country, $states_country ) ) {
542
+			if (array_key_exists($country, $states_country)) {
544 543
 				// If states is empty remove the required feilds of state in billing cart.
545
-				unset( $required_fields['card_state'] );
544
+				unset($required_fields['card_state']);
546 545
 			}
547 546
 		}
548 547
 	}
549 548
 
550
-	if ( give_is_company_field_enabled( $form_id ) ) {
551
-		$form_option    = give_get_meta( $form_id, '_give_company_field', true );
552
-		$global_setting = give_get_option( 'company_field' );
549
+	if (give_is_company_field_enabled($form_id)) {
550
+		$form_option    = give_get_meta($form_id, '_give_company_field', true);
551
+		$global_setting = give_get_option('company_field');
553 552
 
554 553
 		$is_company_field_required = false;
555 554
 
556
-		if ( ! empty( $form_option ) && give_is_setting_enabled( $form_option, array( 'required' ) ) ) {
555
+		if ( ! empty($form_option) && give_is_setting_enabled($form_option, array('required'))) {
557 556
 			$is_company_field_required = true;
558 557
 
559
-		} elseif ( 'global' === $form_option && give_is_setting_enabled( $global_setting, array( 'required' ) ) ) {
558
+		} elseif ('global' === $form_option && give_is_setting_enabled($global_setting, array('required'))) {
560 559
 			$is_company_field_required = true;
561 560
 
562
-		} elseif ( empty( $form_option ) && give_is_setting_enabled( $global_setting, array( 'required' ) ) ) {
561
+		} elseif (empty($form_option) && give_is_setting_enabled($global_setting, array('required'))) {
563 562
 			$is_company_field_required = true;
564 563
 
565 564
 		}
566 565
 
567
-		if( $is_company_field_required ) {
566
+		if ($is_company_field_required) {
568 567
 			$required_fields['give_company_name'] = array(
569 568
 				'error_id'      => 'invalid_company',
570
-				'error_message' => __( 'Please enter Company Name.', 'give' ),
569
+				'error_message' => __('Please enter Company Name.', 'give'),
571 570
 			);
572 571
 		}
573 572
 	}
@@ -577,7 +576,7 @@  discard block
 block discarded – undo
577 576
 	 *
578 577
 	 * @since 1.7
579 578
 	 */
580
-	$required_fields = apply_filters( 'give_donation_form_required_fields', $required_fields, $form_id );
579
+	$required_fields = apply_filters('give_donation_form_required_fields', $required_fields, $form_id);
581 580
 
582 581
 	return $required_fields;
583 582
 
@@ -592,16 +591,16 @@  discard block
 block discarded – undo
592 591
  *
593 592
  * @return bool
594 593
  */
595
-function give_require_billing_address( $payment_mode ) {
594
+function give_require_billing_address($payment_mode) {
596 595
 
597 596
 	$return = false;
598 597
 
599
-	if ( isset( $_POST['billing_country'] ) || did_action( "give_{$payment_mode}_cc_form" ) || did_action( 'give_cc_form' ) ) {
598
+	if (isset($_POST['billing_country']) || did_action("give_{$payment_mode}_cc_form") || did_action('give_cc_form')) {
600 599
 		$return = true;
601 600
 	}
602 601
 
603 602
 	// Let payment gateways and other extensions determine if address fields should be required.
604
-	return apply_filters( 'give_require_billing_address', $return );
603
+	return apply_filters('give_require_billing_address', $return);
605 604
 
606 605
 }
607 606
 
@@ -615,40 +614,40 @@  discard block
 block discarded – undo
615 614
 function give_donation_form_validate_logged_in_user() {
616 615
 	global $user_ID;
617 616
 
618
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
617
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
619 618
 
620 619
 	// Start empty array to collect valid user data.
621 620
 	$valid_user_data = array(
622 621
 		// Assume there will be errors.
623
-		'user_id' => - 1,
622
+		'user_id' => -1,
624 623
 	);
625 624
 
626 625
 	// Verify there is a user_ID.
627
-	if ( $user_ID > 0 ) {
626
+	if ($user_ID > 0) {
628 627
 		// Get the logged in user data.
629
-		$user_data = get_userdata( $user_ID );
628
+		$user_data = get_userdata($user_ID);
630 629
 
631 630
 		// Validate Required Form Fields.
632
-		give_validate_required_form_fields( $form_id );
631
+		give_validate_required_form_fields($form_id);
633 632
 
634 633
 		// Verify data.
635
-		if ( $user_data ) {
634
+		if ($user_data) {
636 635
 			// Collected logged in user data.
637 636
 			$valid_user_data = array(
638 637
 				'user_id'    => $user_ID,
639
-				'user_email' => isset( $_POST['give_email'] ) ? sanitize_email( $_POST['give_email'] ) : $user_data->user_email,
640
-				'user_first' => isset( $_POST['give_first'] ) && ! empty( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : $user_data->first_name,
641
-				'user_last'  => isset( $_POST['give_last'] ) && ! empty( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : $user_data->last_name,
638
+				'user_email' => isset($_POST['give_email']) ? sanitize_email($_POST['give_email']) : $user_data->user_email,
639
+				'user_first' => isset($_POST['give_first']) && ! empty($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : $user_data->first_name,
640
+				'user_last'  => isset($_POST['give_last']) && ! empty($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : $user_data->last_name,
642 641
 			);
643 642
 
644 643
 			give_donation_form_validate_name_fields();
645 644
 
646
-			if ( ! is_email( $valid_user_data['user_email'] ) ) {
647
-				give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) );
645
+			if ( ! is_email($valid_user_data['user_email'])) {
646
+				give_set_error('email_invalid', esc_html__('Invalid email.', 'give'));
648 647
 			}
649 648
 		} else {
650 649
 			// Set invalid user error.
651
-			give_set_error( 'invalid_user', esc_html__( 'The user information is invalid.', 'give' ) );
650
+			give_set_error('invalid_user', esc_html__('The user information is invalid.', 'give'));
652 651
 		}
653 652
 	}
654 653
 
@@ -670,7 +669,7 @@  discard block
 block discarded – undo
670 669
 	// Default user data.
671 670
 	$default_user_data = array(
672 671
 		'give-form-id'           => '',
673
-		'user_id'                => - 1, // Assume there will be errors.
672
+		'user_id'                => -1, // Assume there will be errors.
674 673
 		'user_first'             => '',
675 674
 		'user_last'              => '',
676 675
 		'give_user_login'        => false,
@@ -680,16 +679,16 @@  discard block
 block discarded – undo
680 679
 	);
681 680
 
682 681
 	// Get user data.
683
-	$user_data            = wp_parse_args( give_clean( $_POST ), $default_user_data );
682
+	$user_data            = wp_parse_args(give_clean($_POST), $default_user_data);
684 683
 	$registering_new_user = false;
685
-	$form_id              = absint( $user_data['give-form-id'] );
684
+	$form_id              = absint($user_data['give-form-id']);
686 685
 
687 686
 	give_donation_form_validate_name_fields();
688 687
 
689 688
 	// Start an empty array to collect valid user data.
690 689
 	$valid_user_data = array(
691 690
 		// Assume there will be errors.
692
-		'user_id'    => - 1,
691
+		'user_id'    => -1,
693 692
 
694 693
 		// Get first name.
695 694
 		'user_first' => $user_data['give_first'],
@@ -702,13 +701,13 @@  discard block
 block discarded – undo
702 701
 	);
703 702
 
704 703
 	// Validate Required Form Fields.
705
-	give_validate_required_form_fields( $form_id );
704
+	give_validate_required_form_fields($form_id);
706 705
 
707 706
 	// Set Email as Username.
708 707
 	$valid_user_data['user_login'] = $user_data['give_email'];
709 708
 
710 709
 	// Check if we have an email to verify.
711
-	if ( give_validate_user_email( $user_data['give_email'], $registering_new_user ) ) {
710
+	if (give_validate_user_email($user_data['give_email'], $registering_new_user)) {
712 711
 		$valid_user_data['user_email'] = $user_data['give_email'];
713 712
 	}
714 713
 
@@ -727,36 +726,36 @@  discard block
 block discarded – undo
727 726
 	// Start an array to collect valid user data.
728 727
 	$valid_user_data = array(
729 728
 		// Assume there will be errors.
730
-		'user_id' => - 1,
729
+		'user_id' => -1,
731 730
 	);
732 731
 
733 732
 	// Username.
734
-	if ( ! isset( $_POST['give_user_login'] ) || $_POST['give_user_login'] == '' ) {
735
-		give_set_error( 'must_log_in', __( 'You must register or login to complete your donation.', 'give' ) );
733
+	if ( ! isset($_POST['give_user_login']) || $_POST['give_user_login'] == '') {
734
+		give_set_error('must_log_in', __('You must register or login to complete your donation.', 'give'));
736 735
 
737 736
 		return $valid_user_data;
738 737
 	}
739 738
 
740 739
 	// Get the user by login.
741
-	$user_data = get_user_by( 'login', strip_tags( $_POST['give_user_login'] ) );
740
+	$user_data = get_user_by('login', strip_tags($_POST['give_user_login']));
742 741
 
743 742
 	// Check if user exists.
744
-	if ( $user_data ) {
743
+	if ($user_data) {
745 744
 		// Get password.
746
-		$user_pass = isset( $_POST['give_user_pass'] ) ? $_POST['give_user_pass'] : false;
745
+		$user_pass = isset($_POST['give_user_pass']) ? $_POST['give_user_pass'] : false;
747 746
 
748 747
 		// Check user_pass.
749
-		if ( $user_pass ) {
748
+		if ($user_pass) {
750 749
 			// Check if password is valid.
751
-			if ( ! wp_check_password( $user_pass, $user_data->user_pass, $user_data->ID ) ) {
750
+			if ( ! wp_check_password($user_pass, $user_data->user_pass, $user_data->ID)) {
752 751
 				// Incorrect password.
753 752
 				give_set_error(
754 753
 					'password_incorrect',
755 754
 					sprintf(
756 755
 						'%1$s <a href="%2$s">%3$s</a>',
757
-						__( 'The password you entered is incorrect.', 'give' ),
758
-						wp_lostpassword_url( "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" ),
759
-						__( 'Reset Password', 'give' )
756
+						__('The password you entered is incorrect.', 'give'),
757
+						wp_lostpassword_url("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"),
758
+						__('Reset Password', 'give')
760 759
 					)
761 760
 				);
762 761
 				// All is correct.
@@ -774,11 +773,11 @@  discard block
 block discarded – undo
774 773
 			}
775 774
 		} else {
776 775
 			// Empty password.
777
-			give_set_error( 'password_empty', __( 'Enter a password.', 'give' ) );
776
+			give_set_error('password_empty', __('Enter a password.', 'give'));
778 777
 		}
779 778
 	} else {
780 779
 		// No username.
781
-		give_set_error( 'username_incorrect', __( 'The username you entered does not exist.', 'give' ) );
780
+		give_set_error('username_incorrect', __('The username you entered does not exist.', 'give'));
782 781
 	}// End if().
783 782
 
784 783
 	return $valid_user_data;
@@ -793,7 +792,7 @@  discard block
 block discarded – undo
793 792
  */
794 793
 function give_donation_form_validate_guest_user() {
795 794
 
796
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
795
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
797 796
 
798 797
 	// Start an array to collect valid user data.
799 798
 	$valid_user_data = array(
@@ -804,31 +803,31 @@  discard block
 block discarded – undo
804 803
 	give_donation_form_validate_name_fields();
805 804
 
806 805
 	// Get the guest email.
807
-	$guest_email = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false;
806
+	$guest_email = isset($_POST['give_email']) ? $_POST['give_email'] : false;
808 807
 
809 808
 	// Check email.
810
-	if ( $guest_email && strlen( $guest_email ) > 0 ) {
809
+	if ($guest_email && strlen($guest_email) > 0) {
811 810
 		// Validate email.
812
-		if ( ! is_email( $guest_email ) ) {
811
+		if ( ! is_email($guest_email)) {
813 812
 			// Invalid email.
814
-			give_set_error( 'email_invalid', __( 'Invalid email.', 'give' ) );
813
+			give_set_error('email_invalid', __('Invalid email.', 'give'));
815 814
 		} else {
816 815
 			// All is good to go.
817 816
 			$valid_user_data['user_email'] = $guest_email;
818 817
 
819 818
 			// Get user_id from donor if exist.
820
-			$donor = new Give_Donor( $guest_email );
821
-			if ( $donor->id && $donor->user_id ) {
819
+			$donor = new Give_Donor($guest_email);
820
+			if ($donor->id && $donor->user_id) {
822 821
 				$valid_user_data['user_id'] = $donor->user_id;
823 822
 			}
824 823
 		}
825 824
 	} else {
826 825
 		// No email.
827
-		give_set_error( 'email_empty', __( 'Enter an email.', 'give' ) );
826
+		give_set_error('email_empty', __('Enter an email.', 'give'));
828 827
 	}
829 828
 
830 829
 	// Validate Required Form Fields.
831
-	give_validate_required_form_fields( $form_id );
830
+	give_validate_required_form_fields($form_id);
832 831
 
833 832
 	return $valid_user_data;
834 833
 }
@@ -842,36 +841,36 @@  discard block
 block discarded – undo
842 841
  * @since   1.0
843 842
  * @return  integer
844 843
  */
845
-function give_register_and_login_new_user( $user_data = array() ) {
844
+function give_register_and_login_new_user($user_data = array()) {
846 845
 	// Verify the array.
847
-	if ( empty( $user_data ) ) {
848
-		return - 1;
846
+	if (empty($user_data)) {
847
+		return -1;
849 848
 	}
850 849
 
851
-	if ( give_get_errors() ) {
852
-		return - 1;
850
+	if (give_get_errors()) {
851
+		return -1;
853 852
 	}
854 853
 
855
-	$user_args = apply_filters( 'give_insert_user_args', array(
856
-		'user_login'      => isset( $user_data['user_login'] ) ? $user_data['user_login'] : '',
857
-		'user_pass'       => isset( $user_data['user_pass'] ) ? $user_data['user_pass'] : '',
858
-		'user_email'      => isset( $user_data['user_email'] ) ? $user_data['user_email'] : '',
859
-		'first_name'      => isset( $user_data['user_first'] ) ? $user_data['user_first'] : '',
860
-		'last_name'       => isset( $user_data['user_last'] ) ? $user_data['user_last'] : '',
861
-		'user_registered' => date( 'Y-m-d H:i:s' ),
862
-		'role'            => give_get_option( 'donor_default_user_role', 'give_donor' ),
863
-	), $user_data );
854
+	$user_args = apply_filters('give_insert_user_args', array(
855
+		'user_login'      => isset($user_data['user_login']) ? $user_data['user_login'] : '',
856
+		'user_pass'       => isset($user_data['user_pass']) ? $user_data['user_pass'] : '',
857
+		'user_email'      => isset($user_data['user_email']) ? $user_data['user_email'] : '',
858
+		'first_name'      => isset($user_data['user_first']) ? $user_data['user_first'] : '',
859
+		'last_name'       => isset($user_data['user_last']) ? $user_data['user_last'] : '',
860
+		'user_registered' => date('Y-m-d H:i:s'),
861
+		'role'            => give_get_option('donor_default_user_role', 'give_donor'),
862
+	), $user_data);
864 863
 
865 864
 	// Insert new user.
866
-	$user_id = wp_insert_user( $user_args );
865
+	$user_id = wp_insert_user($user_args);
867 866
 
868 867
 	// Validate inserted user.
869
-	if ( is_wp_error( $user_id ) ) {
870
-		return - 1;
868
+	if (is_wp_error($user_id)) {
869
+		return -1;
871 870
 	}
872 871
 
873 872
 	// Allow themes and plugins to filter the user data.
874
-	$user_data = apply_filters( 'give_insert_user_data', $user_data, $user_args );
873
+	$user_data = apply_filters('give_insert_user_data', $user_data, $user_args);
875 874
 
876 875
 	/**
877 876
 	 * Fires after inserting user.
@@ -881,7 +880,7 @@  discard block
 block discarded – undo
881 880
 	 * @param int $user_id User id.
882 881
 	 * @param array $user_data Array containing user data.
883 882
 	 */
884
-	do_action( 'give_insert_user', $user_id, $user_data );
883
+	do_action('give_insert_user', $user_id, $user_data);
885 884
 
886 885
 	/**
887 886
 	 * Filter allow user to alter if user when to login or not when user is register for the first time.
@@ -890,9 +889,9 @@  discard block
 block discarded – undo
890 889
 	 *
891 890
 	 * return bool True if login with registration and False if only want to register.
892 891
 	 */
893
-	if ( true === (bool) apply_filters( 'give_log_user_in_on_register', true ) ) {
892
+	if (true === (bool) apply_filters('give_log_user_in_on_register', true)) {
894 893
 		// Login new user.
895
-		give_log_user_in( $user_id, $user_data['user_login'], $user_data['user_pass'] );
894
+		give_log_user_in($user_id, $user_data['user_login'], $user_data['user_pass']);
896 895
 	}
897 896
 
898 897
 	// Return user id.
@@ -908,27 +907,27 @@  discard block
 block discarded – undo
908 907
  * @since   1.0
909 908
  * @return  array|bool
910 909
  */
911
-function give_get_donation_form_user( $valid_data = array() ) {
910
+function give_get_donation_form_user($valid_data = array()) {
912 911
 
913 912
 	// Initialize user.
914 913
 	$user    = false;
915
-	$is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
914
+	$is_ajax = defined('DOING_AJAX') && DOING_AJAX;
916 915
 
917
-	if ( $is_ajax ) {
916
+	if ($is_ajax) {
918 917
 		// Do not create or login the user during the ajax submission (check for errors only).
919 918
 		return true;
920
-	} elseif ( is_user_logged_in() ) {
919
+	} elseif (is_user_logged_in()) {
921 920
 		// Set the valid user as the logged in collected data.
922 921
 		$user = $valid_data['logged_in_user'];
923
-	} elseif ( $valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true ) {
922
+	} elseif ($valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true) {
924 923
 		// New user registration.
925
-		if ( $valid_data['need_new_user'] === true ) {
924
+		if ($valid_data['need_new_user'] === true) {
926 925
 			// Set user.
927 926
 			$user = $valid_data['new_user_data'];
928 927
 			// Register and login new user.
929
-			$user['user_id'] = give_register_and_login_new_user( $user );
928
+			$user['user_id'] = give_register_and_login_new_user($user);
930 929
 			// User login
931
-		} elseif ( $valid_data['need_user_login'] === true && ! $is_ajax ) {
930
+		} elseif ($valid_data['need_user_login'] === true && ! $is_ajax) {
932 931
 
933 932
 			/**
934 933
 			 * The login form is now processed in the give_process_donation_login() function.
@@ -940,42 +939,42 @@  discard block
 block discarded – undo
940 939
 			// Set user.
941 940
 			$user = $valid_data['login_user_data'];
942 941
 			// Login user.
943
-			give_log_user_in( $user['user_id'], $user['user_login'], $user['user_pass'] );
942
+			give_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']);
944 943
 		}
945 944
 	}
946 945
 
947 946
 	// Check guest checkout.
948
-	if ( false === $user && false === give_logged_in_only( $_POST['give-form-id'] ) ) {
947
+	if (false === $user && false === give_logged_in_only($_POST['give-form-id'])) {
949 948
 		// Set user
950 949
 		$user = $valid_data['guest_user_data'];
951 950
 	}
952 951
 
953 952
 	// Verify we have an user.
954
-	if ( false === $user || empty( $user ) ) {
953
+	if (false === $user || empty($user)) {
955 954
 		// Return false.
956 955
 		return false;
957 956
 	}
958 957
 
959 958
 	// Get user first name.
960
-	if ( ! isset( $user['user_first'] ) || strlen( trim( $user['user_first'] ) ) < 1 ) {
961
-		$user['user_first'] = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : '';
959
+	if ( ! isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) {
960
+		$user['user_first'] = isset($_POST['give_first']) ? strip_tags(trim($_POST['give_first'])) : '';
962 961
 	}
963 962
 
964 963
 	// Get user last name.
965
-	if ( ! isset( $user['user_last'] ) || strlen( trim( $user['user_last'] ) ) < 1 ) {
966
-		$user['user_last'] = isset( $_POST['give_last'] ) ? strip_tags( trim( $_POST['give_last'] ) ) : '';
964
+	if ( ! isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) {
965
+		$user['user_last'] = isset($_POST['give_last']) ? strip_tags(trim($_POST['give_last'])) : '';
967 966
 	}
968 967
 
969 968
 	// Get the user's billing address details.
970 969
 	$user['address']            = array();
971
-	$user['address']['line1']   = ! empty( $_POST['card_address'] ) ? give_clean( $_POST['card_address'] ) : false;
972
-	$user['address']['line2']   = ! empty( $_POST['card_address_2'] ) ? give_clean( $_POST['card_address_2'] ) : false;
973
-	$user['address']['city']    = ! empty( $_POST['card_city'] ) ? give_clean( $_POST['card_city'] ) : false;
974
-	$user['address']['state']   = ! empty( $_POST['card_state'] ) ? give_clean( $_POST['card_state'] ) : false;
975
-	$user['address']['zip']     = ! empty( $_POST['card_zip'] ) ? give_clean( $_POST['card_zip'] ) : false;
976
-	$user['address']['country'] = ! empty( $_POST['billing_country'] ) ? give_clean( $_POST['billing_country'] ) : false;
977
-
978
-	if ( empty( $user['address']['country'] ) ) {
970
+	$user['address']['line1']   = ! empty($_POST['card_address']) ? give_clean($_POST['card_address']) : false;
971
+	$user['address']['line2']   = ! empty($_POST['card_address_2']) ? give_clean($_POST['card_address_2']) : false;
972
+	$user['address']['city']    = ! empty($_POST['card_city']) ? give_clean($_POST['card_city']) : false;
973
+	$user['address']['state']   = ! empty($_POST['card_state']) ? give_clean($_POST['card_state']) : false;
974
+	$user['address']['zip']     = ! empty($_POST['card_zip']) ? give_clean($_POST['card_zip']) : false;
975
+	$user['address']['country'] = ! empty($_POST['billing_country']) ? give_clean($_POST['billing_country']) : false;
976
+
977
+	if (empty($user['address']['country'])) {
979 978
 		$user['address'] = false;
980 979
 	} // End if().
981 980
 
@@ -995,16 +994,16 @@  discard block
 block discarded – undo
995 994
 	$card_data = give_get_donation_cc_info();
996 995
 
997 996
 	// Validate the card zip.
998
-	if ( ! empty( $card_data['card_zip'] ) ) {
999
-		if ( ! give_donation_form_validate_cc_zip( $card_data['card_zip'], $card_data['card_country'] ) ) {
1000
-			give_set_error( 'invalid_cc_zip', __( 'The zip / postal code you entered for your billing address is invalid.', 'give' ) );
997
+	if ( ! empty($card_data['card_zip'])) {
998
+		if ( ! give_donation_form_validate_cc_zip($card_data['card_zip'], $card_data['card_country'])) {
999
+			give_set_error('invalid_cc_zip', __('The zip / postal code you entered for your billing address is invalid.', 'give'));
1001 1000
 		}
1002 1001
 	}
1003 1002
 
1004 1003
 	// Ensure no spaces.
1005
-	if ( ! empty( $card_data['card_number'] ) ) {
1006
-		$card_data['card_number'] = str_replace( '+', '', $card_data['card_number'] ); // no "+" signs
1007
-		$card_data['card_number'] = str_replace( ' ', '', $card_data['card_number'] ); // No spaces
1004
+	if ( ! empty($card_data['card_number'])) {
1005
+		$card_data['card_number'] = str_replace('+', '', $card_data['card_number']); // no "+" signs
1006
+		$card_data['card_number'] = str_replace(' ', '', $card_data['card_number']); // No spaces
1008 1007
 	}
1009 1008
 
1010 1009
 	// This should validate card numbers at some point too.
@@ -1021,17 +1020,17 @@  discard block
 block discarded – undo
1021 1020
 function give_get_donation_cc_info() {
1022 1021
 
1023 1022
 	$cc_info                   = array();
1024
-	$cc_info['card_name']      = isset( $_POST['card_name'] ) ? sanitize_text_field( $_POST['card_name'] ) : '';
1025
-	$cc_info['card_number']    = isset( $_POST['card_number'] ) ? sanitize_text_field( $_POST['card_number'] ) : '';
1026
-	$cc_info['card_cvc']       = isset( $_POST['card_cvc'] ) ? sanitize_text_field( $_POST['card_cvc'] ) : '';
1027
-	$cc_info['card_exp_month'] = isset( $_POST['card_exp_month'] ) ? sanitize_text_field( $_POST['card_exp_month'] ) : '';
1028
-	$cc_info['card_exp_year']  = isset( $_POST['card_exp_year'] ) ? sanitize_text_field( $_POST['card_exp_year'] ) : '';
1029
-	$cc_info['card_address']   = isset( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : '';
1030
-	$cc_info['card_address_2'] = isset( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : '';
1031
-	$cc_info['card_city']      = isset( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : '';
1032
-	$cc_info['card_state']     = isset( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : '';
1033
-	$cc_info['card_country']   = isset( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : '';
1034
-	$cc_info['card_zip']       = isset( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : '';
1023
+	$cc_info['card_name']      = isset($_POST['card_name']) ? sanitize_text_field($_POST['card_name']) : '';
1024
+	$cc_info['card_number']    = isset($_POST['card_number']) ? sanitize_text_field($_POST['card_number']) : '';
1025
+	$cc_info['card_cvc']       = isset($_POST['card_cvc']) ? sanitize_text_field($_POST['card_cvc']) : '';
1026
+	$cc_info['card_exp_month'] = isset($_POST['card_exp_month']) ? sanitize_text_field($_POST['card_exp_month']) : '';
1027
+	$cc_info['card_exp_year']  = isset($_POST['card_exp_year']) ? sanitize_text_field($_POST['card_exp_year']) : '';
1028
+	$cc_info['card_address']   = isset($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : '';
1029
+	$cc_info['card_address_2'] = isset($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : '';
1030
+	$cc_info['card_city']      = isset($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : '';
1031
+	$cc_info['card_state']     = isset($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : '';
1032
+	$cc_info['card_country']   = isset($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : '';
1033
+	$cc_info['card_zip']       = isset($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : '';
1035 1034
 
1036 1035
 	// Return cc info.
1037 1036
 	return $cc_info;
@@ -1047,14 +1046,14 @@  discard block
 block discarded – undo
1047 1046
  *
1048 1047
  * @return bool|mixed
1049 1048
  */
1050
-function give_donation_form_validate_cc_zip( $zip = 0, $country_code = '' ) {
1049
+function give_donation_form_validate_cc_zip($zip = 0, $country_code = '') {
1051 1050
 	$ret = false;
1052 1051
 
1053
-	if ( empty( $zip ) || empty( $country_code ) ) {
1052
+	if (empty($zip) || empty($country_code)) {
1054 1053
 		return $ret;
1055 1054
 	}
1056 1055
 
1057
-	$country_code = strtoupper( $country_code );
1056
+	$country_code = strtoupper($country_code);
1058 1057
 
1059 1058
 	$zip_regex = array(
1060 1059
 		'AD' => 'AD\d{3}',
@@ -1214,11 +1213,11 @@  discard block
 block discarded – undo
1214 1213
 		'ZM' => '\d{5}',
1215 1214
 	);
1216 1215
 
1217
-	if ( ! isset( $zip_regex[ $country_code ] ) || preg_match( '/' . $zip_regex[ $country_code ] . '/i', $zip ) ) {
1216
+	if ( ! isset($zip_regex[$country_code]) || preg_match('/'.$zip_regex[$country_code].'/i', $zip)) {
1218 1217
 		$ret = true;
1219 1218
 	}
1220 1219
 
1221
-	return apply_filters( 'give_is_zip_valid', $ret, $zip, $country_code );
1220
+	return apply_filters('give_is_zip_valid', $ret, $zip, $country_code);
1222 1221
 }
1223 1222
 
1224 1223
 /**
@@ -1230,49 +1229,49 @@  discard block
 block discarded – undo
1230 1229
  *
1231 1230
  * @return bool
1232 1231
  */
1233
-function give_validate_donation_amount( $valid_data ) {
1232
+function give_validate_donation_amount($valid_data) {
1234 1233
 	$data = $_POST;
1235 1234
 
1236 1235
 	/* @var Give_Donate_Form $form */
1237
-	$form = new Give_Donate_Form( $data['give-form-id'] );
1236
+	$form = new Give_Donate_Form($data['give-form-id']);
1238 1237
 
1239 1238
 	$donation_level_matched = false;
1240 1239
 
1241
-	if ( $form->is_set_type_donation_form() ) {
1240
+	if ($form->is_set_type_donation_form()) {
1242 1241
 		// Sanitize donation amount.
1243
-		$data['give-amount'] = give_maybe_sanitize_amount( $data['give-amount'] );
1242
+		$data['give-amount'] = give_maybe_sanitize_amount($data['give-amount']);
1244 1243
 
1245 1244
 		// Backward compatibility.
1246
-		if ( $form->is_custom_price( $data['give-amount'] ) ) {
1245
+		if ($form->is_custom_price($data['give-amount'])) {
1247 1246
 			$_POST['give-price-id'] = 'custom';
1248 1247
 		}
1249 1248
 
1250 1249
 		$donation_level_matched = true;
1251 1250
 
1252
-	} elseif ( $form->is_multi_type_donation_form() ) {
1251
+	} elseif ($form->is_multi_type_donation_form()) {
1253 1252
 
1254 1253
 		// Bailout.
1255
-		if ( ! ( $variable_prices = $form->get_prices() ) ) {
1254
+		if ( ! ($variable_prices = $form->get_prices())) {
1256 1255
 			return false;
1257 1256
 		}
1258 1257
 
1259 1258
 		// Sanitize donation amount.
1260
-		$data['give-amount'] = give_maybe_sanitize_amount( $data['give-amount'] );
1259
+		$data['give-amount'] = give_maybe_sanitize_amount($data['give-amount']);
1261 1260
 
1262
-		if ( $data['give-amount'] === give_maybe_sanitize_amount( give_get_price_option_amount( $data['give-form-id'], $data['give-price-id'] ) ) ) {
1261
+		if ($data['give-amount'] === give_maybe_sanitize_amount(give_get_price_option_amount($data['give-form-id'], $data['give-price-id']))) {
1263 1262
 			return true;
1264 1263
 		}
1265 1264
 
1266
-		if ( $form->is_custom_price( $data['give-amount'] ) ) {
1265
+		if ($form->is_custom_price($data['give-amount'])) {
1267 1266
 			$_POST['give-price-id'] = 'custom';
1268 1267
 		} else {
1269 1268
 			// Find correct donation level from all donation levels.
1270
-			foreach ( $variable_prices as $variable_price ) {
1269
+			foreach ($variable_prices as $variable_price) {
1271 1270
 				// Sanitize level amount.
1272
-				$variable_price['_give_amount'] = give_maybe_sanitize_amount( $variable_price['_give_amount'] );
1271
+				$variable_price['_give_amount'] = give_maybe_sanitize_amount($variable_price['_give_amount']);
1273 1272
 
1274 1273
 				// Set first match donation level ID.
1275
-				if ( $data['give-amount'] === $variable_price['_give_amount'] ) {
1274
+				if ($data['give-amount'] === $variable_price['_give_amount']) {
1276 1275
 					$_POST['give-price-id'] = $variable_price['_give_id']['level_id'];
1277 1276
 					break;
1278 1277
 				}
@@ -1281,15 +1280,15 @@  discard block
 block discarded – undo
1281 1280
 
1282 1281
 		// If donation amount is not find in donation levels then check if form has custom donation feature enable or not.
1283 1282
 		// If yes then set price id to custom if amount is greater then custom minimum amount (if any).
1284
-		if ( ! empty( $_POST['give-price-id'] ) ) {
1283
+		if ( ! empty($_POST['give-price-id'])) {
1285 1284
 			$donation_level_matched = true;
1286 1285
 		}
1287 1286
 	}// End if().
1288 1287
 
1289
-	return ( $donation_level_matched ? true : false );
1288
+	return ($donation_level_matched ? true : false);
1290 1289
 }
1291 1290
 
1292
-add_action( 'give_checkout_error_checks', 'give_validate_donation_amount', 10, 1 );
1291
+add_action('give_checkout_error_checks', 'give_validate_donation_amount', 10, 1);
1293 1292
 
1294 1293
 /**
1295 1294
  * Validate Required Form Fields.
@@ -1298,17 +1297,17 @@  discard block
 block discarded – undo
1298 1297
  *
1299 1298
  * @since 2.0
1300 1299
  */
1301
-function give_validate_required_form_fields( $form_id ) {
1300
+function give_validate_required_form_fields($form_id) {
1302 1301
 
1303 1302
 	// Loop through required fields and show error messages.
1304
-	foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
1303
+	foreach (give_get_required_fields($form_id) as $field_name => $value) {
1305 1304
 
1306 1305
 		// Clean Up Data of the input fields.
1307
-		$field_value = give_clean( $_POST[ $field_name ] );
1306
+		$field_value = give_clean($_POST[$field_name]);
1308 1307
 
1309 1308
 		// Check whether the required field is empty, then show the error message.
1310
-		if ( in_array( $value, give_get_required_fields( $form_id ) ) && empty( $field_value ) ) {
1311
-			give_set_error( $value['error_id'], $value['error_message'] );
1309
+		if (in_array($value, give_get_required_fields($form_id)) && empty($field_value)) {
1310
+			give_set_error($value['error_id'], $value['error_message']);
1312 1311
 		}
1313 1312
 	}
1314 1313
 }
@@ -1320,10 +1319,10 @@  discard block
 block discarded – undo
1320 1319
  * @return void
1321 1320
  */
1322 1321
 function give_donation_form_validate_name_fields() {
1323
-	$is_first_name = is_email( $_POST['give_first'] ) ? true : false;
1324
-	$is_last_name  = is_email( $_POST['give_last'] ) ? true : false;
1322
+	$is_first_name = is_email($_POST['give_first']) ? true : false;
1323
+	$is_last_name  = is_email($_POST['give_last']) ? true : false;
1325 1324
 
1326
-	if ( $is_first_name || $is_last_name ) {
1327
-		give_set_error( 'invalid_name', esc_html__( '<First Name | Last Name> cannot contain email address.', 'give' ) );
1325
+	if ($is_first_name || $is_last_name) {
1326
+		give_set_error('invalid_name', esc_html__('<First Name | Last Name> cannot contain email address.', 'give'));
1328 1327
 	}
1329 1328
 }
Please login to merge, or discard this patch.
includes/gateways/manual.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  * @since 1.0
21 21
  * @return void
22 22
  */
23
-add_action( 'give_manual_cc_form', '__return_false' );
23
+add_action('give_manual_cc_form', '__return_false');
24 24
 
25 25
 /**
26 26
  * Processes the donation data and uses the Manual Payment gateway to record
@@ -32,44 +32,44 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return void
34 34
  */
35
-function give_manual_payment( $purchase_data ) {
35
+function give_manual_payment($purchase_data) {
36 36
 
37
-	if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) {
38
-		wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
37
+	if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) {
38
+		wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
39 39
 	}
40 40
 
41 41
 	//Create payment_data array
42 42
 	$payment_data = array(
43 43
 		'price'           => $purchase_data['price'],
44 44
 		'give_form_title' => $purchase_data['post_data']['give-form-title'],
45
-		'give_form_id'    => intval( $purchase_data['post_data']['give-form-id'] ),
45
+		'give_form_id'    => intval($purchase_data['post_data']['give-form-id']),
46 46
 		'give_price_id'   => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '',
47 47
 		'date'            => $purchase_data['date'],
48 48
 		'user_email'      => $purchase_data['user_email'],
49 49
 		'purchase_key'    => $purchase_data['purchase_key'],
50
-		'currency'        => give_get_currency( $purchase_data['post_data']['give-form-id'], $purchase_data ),
50
+		'currency'        => give_get_currency($purchase_data['post_data']['give-form-id'], $purchase_data),
51 51
 		'user_info'       => $purchase_data['user_info'],
52 52
 		'status'          => 'pending'
53 53
 	);
54 54
 	// Record the pending payment
55
-	$payment = give_insert_payment( $payment_data );
55
+	$payment = give_insert_payment($payment_data);
56 56
 
57
-	if ( $payment ) {
58
-		give_update_payment_status( $payment, 'publish' );
57
+	if ($payment) {
58
+		give_update_payment_status($payment, 'publish');
59 59
 		give_send_to_success_page();
60 60
 	} else {
61 61
 		give_record_gateway_error(
62
-			esc_html__( 'Payment Error', 'give' ),
62
+			esc_html__('Payment Error', 'give'),
63 63
 			sprintf(
64 64
 				/* translators: %s: payment data */
65
-				esc_html__( 'The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give' ),
66
-				json_encode( $payment_data )
65
+				esc_html__('The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give'),
66
+				json_encode($payment_data)
67 67
 			),
68 68
 			$payment
69 69
 		);
70 70
 		// If errors are present, send the user back to the donation page so they can be corrected
71
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
71
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
72 72
 	}
73 73
 }
74 74
 
75
-add_action( 'give_gateway_manual', 'give_manual_payment' );
75
+add_action('give_gateway_manual', 'give_manual_payment');
Please login to merge, or discard this patch.
includes/admin/donors/class-donor-table.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -258,7 +258,7 @@
 block discarded – undo
258 258
 	 * @access public
259 259
 	 * @since  1.0
260 260
 	 *
261
-	 * @return mixed string If search is present, false otherwise.
261
+	 * @return string|false string If search is present, false otherwise.
262 262
 	 */
263 263
 	public function get_search() {
264 264
 		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
Please login to merge, or discard this patch.
Spacing   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@  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
 
19 19
 // Load WP_List_Table if not loaded.
20
-if ( ! class_exists( 'WP_List_Table' ) ) {
21
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
20
+if ( ! class_exists('WP_List_Table')) {
21
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
22 22
 }
23 23
 
24 24
 /**
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
 	public function __construct() {
62 62
 
63 63
 		// Set parent defaults.
64
-		parent::__construct( array(
65
-			'singular' => __( 'Donor', 'give' ), // Singular name of the listed records.
66
-			'plural'   => __( 'Donors', 'give' ), // Plural name of the listed records.
64
+		parent::__construct(array(
65
+			'singular' => __('Donor', 'give'), // Singular name of the listed records.
66
+			'plural'   => __('Donors', 'give'), // Plural name of the listed records.
67 67
 			'ajax'     => false, // Does this table support ajax?.
68
-		) );
68
+		));
69 69
 
70 70
 	}
71 71
 
@@ -80,23 +80,23 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return void
82 82
 	 */
83
-	public function search_box( $text, $input_id ) {
84
-		$input_id = $input_id . '-search-input';
83
+	public function search_box($text, $input_id) {
84
+		$input_id = $input_id.'-search-input';
85 85
 
86
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
87
-			echo sprintf( '<input type="hidden" name="orderby" value="%1$s" />', esc_attr( $_REQUEST['orderby'] ) );
86
+		if ( ! empty($_REQUEST['orderby'])) {
87
+			echo sprintf('<input type="hidden" name="orderby" value="%1$s" />', esc_attr($_REQUEST['orderby']));
88 88
 		}
89 89
 
90
-		if ( ! empty( $_REQUEST['order'] ) ) {
91
-			echo sprintf( '<input type="hidden" name="order" value="%1$s" />', esc_attr( $_REQUEST['order'] ) );
90
+		if ( ! empty($_REQUEST['order'])) {
91
+			echo sprintf('<input type="hidden" name="order" value="%1$s" />', esc_attr($_REQUEST['order']));
92 92
 		}
93 93
 		?>
94 94
 		<p class="search-box" role="search">
95 95
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
96 96
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/>
97
-			<?php submit_button( $text, 'button', false, false, array(
97
+			<?php submit_button($text, 'button', false, false, array(
98 98
 				'ID' => 'search-submit',
99
-			) ); ?>
99
+			)); ?>
100 100
 		</p>
101 101
 		<?php
102 102
 	}
@@ -112,32 +112,32 @@  discard block
 block discarded – undo
112 112
 	 *
113 113
 	 * @return string Column Name.
114 114
 	 */
115
-	public function column_default( $donor, $column_name ) {
115
+	public function column_default($donor, $column_name) {
116 116
 
117
-		switch ( $column_name ) {
117
+		switch ($column_name) {
118 118
 
119 119
 			case 'num_donations' :
120 120
 				$value = sprintf(
121 121
 					'<a href="%s">%s</a>',
122
-					admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( $donor['id'] ) ),
123
-					esc_html( $donor['num_donations'] )
122
+					admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint($donor['id'])),
123
+					esc_html($donor['num_donations'])
124 124
 				);
125 125
 				break;
126 126
 
127 127
 			case 'amount_spent' :
128
-				$value = give_currency_filter( give_format_amount( $donor[ $column_name ], array( 'sanitize' => false ) ) );
128
+				$value = give_currency_filter(give_format_amount($donor[$column_name], array('sanitize' => false)));
129 129
 				break;
130 130
 
131 131
 			case 'date_created' :
132
-				$value = date_i18n( give_date_format(), strtotime( $donor['date_created'] ) );
132
+				$value = date_i18n(give_date_format(), strtotime($donor['date_created']));
133 133
 				break;
134 134
 
135 135
 			default:
136
-				$value = isset( $donor[ $column_name ] ) ? $donor[ $column_name ] : null;
136
+				$value = isset($donor[$column_name]) ? $donor[$column_name] : null;
137 137
 				break;
138 138
 		}
139 139
 
140
-		return apply_filters( "give_donors_column_{$column_name}", $value, $donor['id'] );
140
+		return apply_filters("give_donors_column_{$column_name}", $value, $donor['id']);
141 141
 
142 142
 	}
143 143
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 *
152 152
 	 * @return string
153 153
 	 */
154
-	public function column_cb( $donor ){
154
+	public function column_cb($donor) {
155 155
 		return sprintf(
156 156
 			'<input class="donor-selector" type="checkbox" name="%1$s[]" value="%2$d" data-name="%3$s" />',
157 157
 			$this->_args['singular'],
@@ -170,12 +170,12 @@  discard block
 block discarded – undo
170 170
 	 *
171 171
 	 * @return string
172 172
 	 */
173
-	public function column_name( $donor ) {
174
-		$name     = ! empty( $donor['name'] ) ? $donor['name'] : '<em>' . __( 'Unnamed Donor', 'give' ) . '</em>';
175
-		$view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor['id'] );
176
-		$actions  = $this->get_row_actions( $donor );
173
+	public function column_name($donor) {
174
+		$name     = ! empty($donor['name']) ? $donor['name'] : '<em>'.__('Unnamed Donor', 'give').'</em>';
175
+		$view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor['id']);
176
+		$actions  = $this->get_row_actions($donor);
177 177
 
178
-		return '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>' . $this->row_actions( $actions );
178
+		return '<a href="'.esc_url($view_url).'">'.$name.'</a>'.$this->row_actions($actions);
179 179
 	}
180 180
 
181 181
 	/**
@@ -189,14 +189,14 @@  discard block
 block discarded – undo
189 189
 	public function get_columns() {
190 190
 		$columns = array(
191 191
 			'cb'            => '<input type="checkbox" />', // Render a checkbox instead of text.
192
-			'name'          => __( 'Name', 'give' ),
193
-			'email'         => __( 'Email', 'give' ),
194
-			'num_donations' => __( 'Donations', 'give' ),
195
-			'amount_spent'  => __( 'Total Donated', 'give' ),
196
-			'date_created'  => __( 'Date Created', 'give' ),
192
+			'name'          => __('Name', 'give'),
193
+			'email'         => __('Email', 'give'),
194
+			'num_donations' => __('Donations', 'give'),
195
+			'amount_spent'  => __('Total Donated', 'give'),
196
+			'date_created'  => __('Date Created', 'give'),
197 197
 		);
198 198
 
199
-		return apply_filters( 'give_list_donors_columns', $columns );
199
+		return apply_filters('give_list_donors_columns', $columns);
200 200
 
201 201
 	}
202 202
 
@@ -210,13 +210,13 @@  discard block
 block discarded – undo
210 210
 	public function get_sortable_columns() {
211 211
 
212 212
 		$columns = array(
213
-			'date_created'  => array( 'date_created', true ),
214
-			'name'          => array( 'name', true ),
215
-			'num_donations' => array( 'purchase_count', false ),
216
-			'amount_spent'  => array( 'purchase_value', false ),
213
+			'date_created'  => array('date_created', true),
214
+			'name'          => array('name', true),
215
+			'num_donations' => array('purchase_count', false),
216
+			'amount_spent'  => array('purchase_value', false),
217 217
 		);
218 218
 
219
-		return apply_filters( 'give_list_donors_sortable_columns', $columns );
219
+		return apply_filters('give_list_donors_sortable_columns', $columns);
220 220
 	}
221 221
 
222 222
 	/**
@@ -229,15 +229,15 @@  discard block
 block discarded – undo
229 229
 	 *
230 230
 	 * @return array An array of action links.
231 231
 	 */
232
-	public function get_row_actions( $donor ) {
232
+	public function get_row_actions($donor) {
233 233
 
234 234
 		$actions = array(
235
-			'view'   => sprintf( '<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor['id'] ), sprintf( esc_attr__( 'View "%s"', 'give' ), $donor['name'] ), __( 'View Donor', 'give' ) ),
236
-			'notes'  => sprintf( '<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor['id'] ), sprintf( esc_attr__( 'Notes for "%s"', 'give' ), $donor['name'] ), __( 'Notes', 'give' ) ),
237
-			'delete' => sprintf( '<a class="%1$s" data-id="%2$s" href="#" aria-label="%3$s">%4$s</a>', 'give-single-donor-delete', $donor['id'],sprintf( esc_attr__( 'Delete "%s"', 'give' ), $donor['name'] ), __( 'Delete', 'give' ) ),
235
+			'view'   => sprintf('<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor['id']), sprintf(esc_attr__('View "%s"', 'give'), $donor['name']), __('View Donor', 'give')),
236
+			'notes'  => sprintf('<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor['id']), sprintf(esc_attr__('Notes for "%s"', 'give'), $donor['name']), __('Notes', 'give')),
237
+			'delete' => sprintf('<a class="%1$s" data-id="%2$s" href="#" aria-label="%3$s">%4$s</a>', 'give-single-donor-delete', $donor['id'], sprintf(esc_attr__('Delete "%s"', 'give'), $donor['name']), __('Delete', 'give')),
238 238
 		);
239 239
 
240
-		return apply_filters( 'give_donor_row_actions', $actions, $donor );
240
+		return apply_filters('give_donor_row_actions', $actions, $donor);
241 241
 
242 242
 	}
243 243
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	 * @return int Current page number.
251 251
 	 */
252 252
 	public function get_paged() {
253
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
253
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
254 254
 	}
255 255
 
256 256
 	/**
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	 * @return mixed string If search is present, false otherwise.
263 263
 	 */
264 264
 	public function get_search() {
265
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
265
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
266 266
 	}
267 267
 
268 268
 	/**
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 	 */
276 276
 	public function get_bulk_actions() {
277 277
 		$actions = array(
278
-			'delete' => __( 'Delete', 'give' ),
278
+			'delete' => __('Delete', 'give'),
279 279
 		);
280 280
 		return $actions;
281 281
 	}
@@ -288,19 +288,19 @@  discard block
 block discarded – undo
288 288
 	 * @access protected
289 289
 	 * @since  1.8.16
290 290
 	 */
291
-	protected function display_tablenav( $which ) {
292
-		if ( 'top' === $which ) {
293
-			wp_nonce_field( 'bulk-' . $this->_args['plural'], '_wpnonce', false );
291
+	protected function display_tablenav($which) {
292
+		if ('top' === $which) {
293
+			wp_nonce_field('bulk-'.$this->_args['plural'], '_wpnonce', false);
294 294
 		}
295 295
 		?>
296
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
297
-			<?php if ( $this->has_items() ): ?>
296
+		<div class="tablenav <?php echo esc_attr($which); ?>">
297
+			<?php if ($this->has_items()): ?>
298 298
 				<div class="alignleft actions bulkactions">
299
-					<?php $this->bulk_actions( $which ); ?>
299
+					<?php $this->bulk_actions($which); ?>
300 300
 				</div>
301 301
 			<?php endif;
302
-			$this->extra_tablenav( $which );
303
-			$this->pagination( $which );
302
+			$this->extra_tablenav($which);
303
+			$this->pagination($which);
304 304
 			?>
305 305
 			<br class="clear" />
306 306
 		</div>
@@ -321,13 +321,13 @@  discard block
 block discarded – undo
321 321
 
322 322
 		// Get donor query.
323 323
 		$args   = $this->get_donor_query();
324
-		$donors = Give()->donors->get_donors( $args );
324
+		$donors = Give()->donors->get_donors($args);
325 325
 
326
-		if ( $donors ) {
326
+		if ($donors) {
327 327
 
328
-			foreach ( $donors as $donor ) {
328
+			foreach ($donors as $donor) {
329 329
 
330
-				$user_id = ! empty( $donor->user_id ) ? intval( $donor->user_id ) : 0;
330
+				$user_id = ! empty($donor->user_id) ? intval($donor->user_id) : 0;
331 331
 
332 332
 				$data[] = array(
333 333
 					'id'            => $donor->id,
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 			}
342 342
 		}
343 343
 
344
-		return apply_filters( 'give_donors_column_query_data', $data );
344
+		return apply_filters('give_donors_column_query_data', $data);
345 345
 	}
346 346
 
347 347
 	/**
@@ -356,9 +356,9 @@  discard block
 block discarded – undo
356 356
 
357 357
 		$_donor_query['number'] = - 1;
358 358
 		$_donor_query['offset'] = 0;
359
-		$donors                 = Give()->donors->get_donors( $_donor_query );
359
+		$donors                 = Give()->donors->get_donors($_donor_query);
360 360
 
361
-		return count( $donors );
361
+		return count($donors);
362 362
 	}
363 363
 
364 364
 	/**
@@ -371,10 +371,10 @@  discard block
 block discarded – undo
371 371
 	 */
372 372
 	public function get_donor_query() {
373 373
 		$paged   = $this->get_paged();
374
-		$offset  = $this->per_page * ( $paged - 1 );
374
+		$offset  = $this->per_page * ($paged - 1);
375 375
 		$search  = $this->get_search();
376
-		$order   = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC';
377
-		$orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id';
376
+		$order   = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC';
377
+		$orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id';
378 378
 
379 379
 		$args = array(
380 380
 			'number'  => $this->per_page,
@@ -383,10 +383,10 @@  discard block
 block discarded – undo
383 383
 			'orderby' => $orderby,
384 384
 		);
385 385
 
386
-		if ( $search ) {
387
-			if ( is_email( $search ) ) {
386
+		if ($search) {
387
+			if (is_email($search)) {
388 388
 				$args['email'] = $search;
389
-			} elseif ( is_numeric( $search ) ) {
389
+			} elseif (is_numeric($search)) {
390 390
 				$args['id'] = $search;
391 391
 			} else {
392 392
 				$args['name'] = $search;
@@ -404,9 +404,9 @@  discard block
 block discarded – undo
404 404
 	 * @since  1.8.17
405 405
 	 * @access public
406 406
 	 */
407
-	public function single_row( $item ) {
408
-		echo sprintf( '<tr id="donor-%1$d" data-id="%2$d" data-name="%3$s">', $item['id'], $item['id'], $item['name'] );
409
-		$this->single_row_columns( $item );
407
+	public function single_row($item) {
408
+		echo sprintf('<tr id="donor-%1$d" data-id="%2$d" data-name="%3$s">', $item['id'], $item['id'], $item['name']);
409
+		$this->single_row_columns($item);
410 410
 		echo '</tr>';
411 411
 	}
412 412
 
@@ -419,11 +419,11 @@  discard block
 block discarded – undo
419 419
 	public function display() {
420 420
 		$singular = $this->_args['singular'];
421 421
 
422
-		$this->display_tablenav( 'top' );
422
+		$this->display_tablenav('top');
423 423
 
424
-		$this->screen->render_screen_reader_content( 'heading_list' );
424
+		$this->screen->render_screen_reader_content('heading_list');
425 425
 		?>
426
-		<table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
426
+		<table class="wp-list-table <?php echo implode(' ', $this->get_table_classes()); ?>">
427 427
 			<thead>
428 428
 			<tr>
429 429
 				<?php $this->print_column_headers(); ?>
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 			</thead>
432 432
 
433 433
 			<tbody id="the-list"<?php
434
-			if ( $singular ) {
434
+			if ($singular) {
435 435
 				echo " data-wp-lists='list:$singular'";
436 436
 			} ?>>
437 437
 			<tr class="hidden"></tr>
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 				<td colspan="6" class="colspanchange">
440 440
 
441 441
 					<fieldset class="inline-edit-col-left">
442
-						<legend class="inline-edit-legend"><?php _e( 'BULK DELETE', 'give' ); ?></legend>
442
+						<legend class="inline-edit-legend"><?php _e('BULK DELETE', 'give'); ?></legend>
443 443
 						<div class="inline-edit-col">
444 444
 							<div id="bulk-titles">
445 445
 								<div id="give-bulk-donors" class="give-bulk-donors">
@@ -452,22 +452,22 @@  discard block
 block discarded – undo
452 452
 						<div class="inline-edit-col">
453 453
 							<label>
454 454
 								<input id="give-delete-donor-confirm" type="checkbox" name="give-delete-donor-confirm"/>
455
-								<?php _e( 'Are you sure you want to delete the selected donor(s)?', 'give' ); ?>
455
+								<?php _e('Are you sure you want to delete the selected donor(s)?', 'give'); ?>
456 456
 							</label>
457 457
 							<label>
458 458
 								<input id="give-delete-donor-records" type="checkbox" name="give-delete-donor-records"/>
459
-								<?php _e( 'Delete all associated donations and records?', 'give' ); ?>
459
+								<?php _e('Delete all associated donations and records?', 'give'); ?>
460 460
 							</label>
461 461
 						</div>
462 462
 					</fieldset>
463 463
 
464 464
 					<p class="submit inline-edit-save">
465 465
 						<input type="hidden" name="give_action" value="delete_donor"/>
466
-						<input type="hidden" name="s" value="<?php echo ( ! empty( $_GET['s'] ) ) ? $_GET['s'] : ''; ?>"/>
467
-						<input type="hidden" name="orderby" value="<?php echo ( ! empty( $_GET['orderby'] ) ) ? $_GET['orderby'] : 'id'; ?>"/>
468
-						<input type="hidden" name="order" value="<?php echo ( ! empty( $_GET['order'] ) ) ? $_GET['order'] : 'desc'; ?>"/>
469
-						<button type="button" id="give-bulk-delete-cancel" class="button cancel alignleft"><?php _e( 'Cancel', 'give' ); ?></button>
470
-						<input type="submit" id="give-bulk-delete-button" disabled class="button button-primary alignright" value="<?php _e( 'Delete', 'give' ); ?>">
466
+						<input type="hidden" name="s" value="<?php echo ( ! empty($_GET['s'])) ? $_GET['s'] : ''; ?>"/>
467
+						<input type="hidden" name="orderby" value="<?php echo ( ! empty($_GET['orderby'])) ? $_GET['orderby'] : 'id'; ?>"/>
468
+						<input type="hidden" name="order" value="<?php echo ( ! empty($_GET['order'])) ? $_GET['order'] : 'desc'; ?>"/>
469
+						<button type="button" id="give-bulk-delete-cancel" class="button cancel alignleft"><?php _e('Cancel', 'give'); ?></button>
470
+						<input type="submit" id="give-bulk-delete-button" disabled class="button button-primary alignright" value="<?php _e('Delete', 'give'); ?>">
471 471
 						<br class="clear">
472 472
 					</p>
473 473
 				</td>
@@ -477,13 +477,13 @@  discard block
 block discarded – undo
477 477
 
478 478
 			<tfoot>
479 479
 			<tr>
480
-				<?php $this->print_column_headers( false ); ?>
480
+				<?php $this->print_column_headers(false); ?>
481 481
 			</tr>
482 482
 			</tfoot>
483 483
 
484 484
 		</table>
485 485
 		<?php
486
-		$this->display_tablenav( 'bottom' );
486
+		$this->display_tablenav('bottom');
487 487
 	}
488 488
 
489 489
 	/**
@@ -500,16 +500,16 @@  discard block
 block discarded – undo
500 500
 		$hidden   = array(); // No hidden columns.
501 501
 		$sortable = $this->get_sortable_columns();
502 502
 
503
-		$this->_column_headers = array( $columns, $hidden, $sortable );
503
+		$this->_column_headers = array($columns, $hidden, $sortable);
504 504
 
505 505
 		$this->items = $this->donor_data();
506 506
 
507 507
 		$this->total = $this->get_donor_count();
508 508
 
509
-		$this->set_pagination_args( array(
509
+		$this->set_pagination_args(array(
510 510
 			'total_items' => $this->total,
511 511
 			'per_page'    => $this->per_page,
512
-			'total_pages' => ceil( $this->total / $this->per_page ),
513
-		) );
512
+			'total_pages' => ceil($this->total / $this->per_page),
513
+		));
514 514
 	}
515 515
 }
Please login to merge, or discard this patch.