Test Failed
Pull Request — master (#2814)
by Devin
05:29
created
includes/admin/add-ons.php 1 patch
Spacing   +11 added lines, -11 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,13 +26,13 @@  discard block
 block discarded – undo
26 26
 	ob_start(); ?>
27 27
 	<div class="wrap" id="give-add-ons">
28 28
 		<h1><?php echo get_admin_page_title(); ?>
29
-			&nbsp;&mdash;&nbsp;<a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?>
29
+			&nbsp;&mdash;&nbsp;<a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e('View All Add-ons', 'give'); ?>
30 30
 				<span class="dashicons dashicons-external"></span></a>
31 31
 		</h1>
32 32
 
33 33
 		<hr class="wp-header-end">
34 34
 
35
-		<p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p>
35
+		<p><?php esc_html_e('The following Add-ons extend the functionality of Give.', 'give'); ?></p>
36 36
 		<?php echo give_add_ons_get_feed(); ?>
37 37
 	</div>
38 38
 	<?php
@@ -50,20 +50,20 @@  discard block
 block discarded – undo
50 50
 function give_add_ons_get_feed() {
51 51
 
52 52
 	$addons_debug = false; //set to true to debug
53
-	$cache        = Give_Cache::get( 'give_add_ons_feed', true );
53
+	$cache        = Give_Cache::get('give_add_ons_feed', true);
54 54
 
55
-	if ( $cache === false || $addons_debug === true && WP_DEBUG === true ) {
56
-		$feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) );
55
+	if ($cache === false || $addons_debug === true && WP_DEBUG === true) {
56
+		$feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false));
57 57
 
58
-		if ( ! is_wp_error( $feed ) ) {
59
-			if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) {
60
-				$cache = wp_remote_retrieve_body( $feed );
61
-				Give_Cache::set( 'give_add_ons_feed', $cache, HOUR_IN_SECONDS, true );
58
+		if ( ! is_wp_error($feed)) {
59
+			if (isset($feed['body']) && strlen($feed['body']) > 0) {
60
+				$cache = wp_remote_retrieve_body($feed);
61
+				Give_Cache::set('give_add_ons_feed', $cache, HOUR_IN_SECONDS, true);
62 62
 			}
63 63
 		} else {
64 64
 			$cache = sprintf(
65 65
 				'<div class="error"><p>%s</p></div>',
66
-				esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' )
66
+				esc_html__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give')
67 67
 			);
68 68
 		}
69 69
 	}
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.
Doc Comments   +5 added lines, -5 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
 
@@ -1443,7 +1443,7 @@  discard block
 block discarded – undo
1443 1443
  *
1444 1444
  * @param  int $form_id The form ID.
1445 1445
  *
1446
- * @return bool
1446
+ * @return false|null
1447 1447
  */
1448 1448
 function give_terms_agreement( $form_id ) {
1449 1449
 	$form_option = give_get_meta( $form_id, '_give_terms_option', true );
@@ -1621,7 +1621,7 @@  discard block
 block discarded – undo
1621 1621
  * @param  int   $form_id The form ID.
1622 1622
  * @param  array $args    An array of form arguments.
1623 1623
  *
1624
- * @return mixed
1624
+ * @return boolean
1625 1625
  */
1626 1626
 function give_show_goal_progress( $form_id, $args ) {
1627 1627
 
@@ -1646,7 +1646,7 @@  discard block
 block discarded – undo
1646 1646
  *
1647 1647
  * @since  1.8
1648 1648
  *
1649
- * @param  $form_id
1649
+ * @param  integer $form_id
1650 1650
  * @param  $args
1651 1651
  *
1652 1652
  * @return mixed|string
@@ -1687,7 +1687,7 @@  discard block
 block discarded – undo
1687 1687
  * @param  int   $form_id The form ID.
1688 1688
  * @param  array $args    An array of form arguments.
1689 1689
  *
1690
- * @return void|bool
1690
+ * @return false|null
1691 1691
  */
1692 1692
 function give_form_content( $form_id, $args ) {
1693 1693
 
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.
Spacing   +401 added lines, -402 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,50 +23,50 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string Donation form.
25 25
  */
26
-function give_get_donation_form( $args = array() ) {
26
+function give_get_donation_form($args = array()) {
27 27
 
28 28
 	global $post;
29 29
 
30
-	$form_id = is_object( $post ) ? $post->ID : 0;
30
+	$form_id = is_object($post) ? $post->ID : 0;
31 31
 
32
-	if ( isset( $args['id'] ) ) {
32
+	if (isset($args['id'])) {
33 33
 		$form_id = $args['id'];
34 34
 	}
35 35
 
36
-	$defaults = apply_filters( 'give_form_args_defaults', array(
36
+	$defaults = apply_filters('give_form_args_defaults', array(
37 37
 		'form_id' => $form_id,
38
-	) );
38
+	));
39 39
 
40
-	$args = wp_parse_args( $args, $defaults );
40
+	$args = wp_parse_args($args, $defaults);
41 41
 
42
-	$form = new Give_Donate_Form( $args['form_id'] );
42
+	$form = new Give_Donate_Form($args['form_id']);
43 43
 
44 44
 	//bail if no form ID.
45
-	if ( empty( $form->ID ) ) {
45
+	if (empty($form->ID)) {
46 46
 		return false;
47 47
 	}
48 48
 
49
-	$payment_mode = give_get_chosen_gateway( $form->ID );
49
+	$payment_mode = give_get_chosen_gateway($form->ID);
50 50
 
51
-	$form_action = add_query_arg( apply_filters( 'give_form_action_args', array(
51
+	$form_action = add_query_arg(apply_filters('give_form_action_args', array(
52 52
 		'payment-mode' => $payment_mode,
53
-	) ),
53
+	)),
54 54
 		give_get_current_page_url()
55 55
 	);
56 56
 
57 57
 	//Sanity Check: Donation form not published or user doesn't have permission to view drafts.
58 58
 	if (
59
-		( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) )
60
-		|| ( 'trash' === $form->post_status )
59
+		('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID))
60
+		|| ('trash' === $form->post_status)
61 61
 	) {
62 62
 		return false;
63 63
 	}
64 64
 
65 65
 	//Get the form wrap CSS classes.
66
-	$form_wrap_classes = $form->get_form_wrap_classes( $args );
66
+	$form_wrap_classes = $form->get_form_wrap_classes($args);
67 67
 
68 68
 	//Get the <form> tag wrap CSS classes.
69
-	$form_classes = $form->get_form_classes( $args );
69
+	$form_classes = $form->get_form_classes($args);
70 70
 
71 71
 	ob_start();
72 72
 
@@ -78,19 +78,19 @@  discard block
 block discarded – undo
78 78
 	 * @param int   $form_id The form ID.
79 79
 	 * @param array $args    An array of form arguments.
80 80
 	 */
81
-	do_action( 'give_pre_form_output', $form->ID, $args, $form );
81
+	do_action('give_pre_form_output', $form->ID, $args, $form);
82 82
 
83 83
 	?>
84 84
 	<div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>">
85 85
 
86
-		<?php if ( $form->is_close_donation_form() ) {
86
+		<?php if ($form->is_close_donation_form()) {
87 87
 
88 88
 			// Get Goal thank you message.
89
-			$goal_achieved_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true );
90
-			$goal_achieved_message = ! empty( $goal_achieved_message ) ? apply_filters( 'the_content', $goal_achieved_message ) : '';
89
+			$goal_achieved_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true);
90
+			$goal_achieved_message = ! empty($goal_achieved_message) ? apply_filters('the_content', $goal_achieved_message) : '';
91 91
 
92 92
 			// Print thank you message.
93
-			echo apply_filters( 'give_goal_closed_output', $goal_achieved_message, $form->ID, $form );
93
+			echo apply_filters('give_goal_closed_output', $goal_achieved_message, $form->ID, $form);
94 94
 
95 95
 		} else {
96 96
 			/**
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
 			 * 1. if show_title params set to true
99 99
 			 * 2. if admin set form display_style to button
100 100
 			 */
101
-			$form_title = apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' );
101
+			$form_title = apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>');
102 102
 			if (
103 103
 				(
104
-					( isset( $args['show_title'] ) && $args['show_title'] == true )
105
-					|| ( 'button' === get_post_meta( $form_id, '_give_payment_display', true ) )
104
+					(isset($args['show_title']) && $args['show_title'] == true)
105
+					|| ('button' === get_post_meta($form_id, '_give_payment_display', true))
106 106
 				)
107
-				&& ! doing_action( 'give_single_form_summary' )
107
+				&& ! doing_action('give_single_form_summary')
108 108
 			) {
109 109
 				echo $form_title;
110 110
 			}
@@ -118,13 +118,13 @@  discard block
 block discarded – undo
118 118
 			 * @param array            $args    An array of form arguments.
119 119
 			 * @param Give_Donate_Form $form    Form object.
120 120
 			 */
121
-			do_action( 'give_pre_form', $form->ID, $args, $form );
121
+			do_action('give_pre_form', $form->ID, $args, $form);
122 122
 
123 123
 			// Set form html tags.
124 124
 			$form_html_tags = array(
125 125
 				'id'     => "give-form-{$form_id}",
126 126
 				'class'  => $form_classes,
127
-				'action' => esc_url_raw( $form_action ),
127
+				'action' => esc_url_raw($form_action),
128 128
 			);
129 129
 
130 130
 			/**
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 			 * @param array            $form_html_tags Array of form html tags.
136 136
 			 * @param Give_Donate_Form $form           Form object.
137 137
 			 */
138
-			$form_html_tags = apply_filters( 'give_form_html_tags', (array) $form_html_tags, $form );
138
+			$form_html_tags = apply_filters('give_form_html_tags', (array) $form_html_tags, $form);
139 139
 			?>
140
-			<form <?php echo give_get_attribute_str( $form_html_tags ); ?> method="post">
140
+			<form <?php echo give_get_attribute_str($form_html_tags); ?> method="post">
141 141
 
142 142
 				<!-- The following field is for robots only, invisible to humans: -->
143 143
 				<span class="give-hidden" style="display: none !important;">
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 				 * @param array            $args    An array of form arguments.
157 157
 				 * @param Give_Donate_Form $form    Form object.
158 158
 				 */
159
-				do_action( 'give_donation_form_top', $form->ID, $args, $form );
159
+				do_action('give_donation_form_top', $form->ID, $args, $form);
160 160
 
161 161
 				/**
162 162
 				 * Fires while outputting donation form, for payment gateway fields.
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 				 * @param array            $args    An array of form arguments.
168 168
 				 * @param Give_Donate_Form $form    Form object.
169 169
 				 */
170
-				do_action( 'give_payment_mode_select', $form->ID, $args, $form );
170
+				do_action('give_payment_mode_select', $form->ID, $args, $form);
171 171
 
172 172
 				/**
173 173
 				 * Fires while outputting donation form, after all other fields.
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 				 * @param array            $args    An array of form arguments.
179 179
 				 * @param Give_Donate_Form $form    Form object.
180 180
 				 */
181
-				do_action( 'give_donation_form_bottom', $form->ID, $args, $form );
181
+				do_action('give_donation_form_bottom', $form->ID, $args, $form);
182 182
 
183 183
 				?>
184 184
 			</form>
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
 			 * @param array            $args    An array of form arguments.
194 194
 			 * @param Give_Donate_Form $form    Form object.
195 195
 			 */
196
-			do_action( 'give_post_form', $form->ID, $args, $form );
196
+			do_action('give_post_form', $form->ID, $args, $form);
197 197
 
198 198
 		}
199 199
 		?>
200 200
 
201
-	</div><!--end #give-form-<?php echo absint( $form->ID ); ?>-->
201
+	</div><!--end #give-form-<?php echo absint($form->ID); ?>-->
202 202
 	<?php
203 203
 
204 204
 	/**
@@ -209,11 +209,11 @@  discard block
 block discarded – undo
209 209
 	 * @param int   $form_id The form ID.
210 210
 	 * @param array $args    An array of form arguments.
211 211
 	 */
212
-	do_action( 'give_post_form_output', $form->ID, $args );
212
+	do_action('give_post_form_output', $form->ID, $args);
213 213
 
214 214
 	$final_output = ob_get_clean();
215 215
 
216
-	echo apply_filters( 'give_donate_form', $final_output, $args );
216
+	echo apply_filters('give_donate_form', $final_output, $args);
217 217
 }
218 218
 
219 219
 /**
@@ -230,11 +230,11 @@  discard block
 block discarded – undo
230 230
  *
231 231
  * @return string
232 232
  */
233
-function give_show_purchase_form( $form_id ) {
233
+function give_show_purchase_form($form_id) {
234 234
 
235
-	$payment_mode = give_get_chosen_gateway( $form_id );
235
+	$payment_mode = give_get_chosen_gateway($form_id);
236 236
 
237
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
237
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
238 238
 		$form_id = $_POST['give_form_id'];
239 239
 	}
240 240
 
@@ -243,33 +243,33 @@  discard block
 block discarded – undo
243 243
 	 *
244 244
 	 * @since 1.7
245 245
 	 */
246
-	do_action( 'give_payment_fields_top', $form_id );
246
+	do_action('give_payment_fields_top', $form_id);
247 247
 
248
-	if ( give_can_checkout() && isset( $form_id ) ) {
248
+	if (give_can_checkout() && isset($form_id)) {
249 249
 
250 250
 		/**
251 251
 		 * Fires while displaying donation form, before registration login.
252 252
 		 *
253 253
 		 * @since 1.7
254 254
 		 */
255
-		do_action( 'give_donation_form_before_register_login', $form_id );
255
+		do_action('give_donation_form_before_register_login', $form_id);
256 256
 
257 257
 		/**
258 258
 		 * Fire when register/login form fields render.
259 259
 		 *
260 260
 		 * @since 1.7
261 261
 		 */
262
-		do_action( 'give_donation_form_register_login_fields', $form_id );
262
+		do_action('give_donation_form_register_login_fields', $form_id);
263 263
 
264 264
 		/**
265 265
 		 * Fire when credit card form fields render.
266 266
 		 *
267 267
 		 * @since 1.7
268 268
 		 */
269
-		do_action( 'give_donation_form_before_cc_form', $form_id );
269
+		do_action('give_donation_form_before_cc_form', $form_id);
270 270
 
271 271
 		// Load the credit card form and allow gateways to load their own if they wish.
272
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
272
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
273 273
 			/**
274 274
 			 * Fires while displaying donation form, credit card form fields for a given gateway.
275 275
 			 *
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 			 *
278 278
 			 * @param int $form_id The form ID.
279 279
 			 */
280
-			do_action( "give_{$payment_mode}_cc_form", $form_id );
280
+			do_action("give_{$payment_mode}_cc_form", $form_id);
281 281
 		} else {
282 282
 			/**
283 283
 			 * Fires while displaying donation form, credit card form fields.
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 			 *
287 287
 			 * @param int $form_id The form ID.
288 288
 			 */
289
-			do_action( 'give_cc_form', $form_id );
289
+			do_action('give_cc_form', $form_id);
290 290
 		}
291 291
 
292 292
 		/**
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 		 *
295 295
 		 * @since 1.7
296 296
 		 */
297
-		do_action( 'give_donation_form_after_cc_form', $form_id );
297
+		do_action('give_donation_form_after_cc_form', $form_id);
298 298
 
299 299
 	} else {
300 300
 		/**
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 		 *
303 303
 		 * @since 1.7
304 304
 		 */
305
-		do_action( 'give_donation_form_no_access', $form_id );
305
+		do_action('give_donation_form_no_access', $form_id);
306 306
 
307 307
 	}
308 308
 
@@ -311,10 +311,10 @@  discard block
 block discarded – undo
311 311
 	 *
312 312
 	 * @since 1.7
313 313
 	 */
314
-	do_action( 'give_payment_fields_bottom', $form_id );
314
+	do_action('give_payment_fields_bottom', $form_id);
315 315
 }
316 316
 
317
-add_action( 'give_donation_form', 'give_show_purchase_form' );
317
+add_action('give_donation_form', 'give_show_purchase_form');
318 318
 
319 319
 /**
320 320
  * Give Show Login/Register Form Fields.
@@ -325,11 +325,11 @@  discard block
 block discarded – undo
325 325
  *
326 326
  * @return void
327 327
  */
328
-function give_show_register_login_fields( $form_id ) {
328
+function give_show_register_login_fields($form_id) {
329 329
 
330
-	$show_register_form = give_show_login_register_option( $form_id );
330
+	$show_register_form = give_show_login_register_option($form_id);
331 331
 
332
-	if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
332
+	if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) :
333 333
 		?>
334 334
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
335 335
 			<?php
@@ -338,11 +338,11 @@  discard block
 block discarded – undo
338 338
 			 *
339 339
 			 * @since 1.7
340 340
 			 */
341
-			do_action( 'give_donation_form_register_fields', $form_id );
341
+			do_action('give_donation_form_register_fields', $form_id);
342 342
 			?>
343 343
 		</div>
344 344
 		<?php
345
-	elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
345
+	elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) :
346 346
 		?>
347 347
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
348 348
 			<?php
@@ -351,23 +351,23 @@  discard block
 block discarded – undo
351 351
 			 *
352 352
 			 * @since 1.7
353 353
 			 */
354
-			do_action( 'give_donation_form_login_fields', $form_id );
354
+			do_action('give_donation_form_login_fields', $form_id);
355 355
 			?>
356 356
 		</div>
357 357
 		<?php
358 358
 	endif;
359 359
 
360
-	if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) {
360
+	if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) {
361 361
 		/**
362 362
 		 * Fire when user info render.
363 363
 		 *
364 364
 		 * @since 1.7
365 365
 		 */
366
-		do_action( 'give_donation_form_after_user_info', $form_id );
366
+		do_action('give_donation_form_after_user_info', $form_id);
367 367
 	}
368 368
 }
369 369
 
370
-add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' );
370
+add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields');
371 371
 
372 372
 /**
373 373
  * Donation Amount Field.
@@ -382,16 +382,16 @@  discard block
 block discarded – undo
382 382
  *
383 383
  * @return void
384 384
  */
385
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
385
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
386 386
 
387 387
 	$give_options        = give_get_settings();
388
-	$variable_pricing    = give_has_variable_prices( $form_id );
389
-	$allow_custom_amount = give_get_meta( $form_id, '_give_custom_amount', true );
390
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
391
-	$symbol              = give_currency_symbol( give_get_currency( $form_id, $args ) );
392
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
393
-	$default_amount      = give_format_amount( give_get_default_form_amount( $form_id ), array( 'sanitize' => false, 'currency' => give_get_currency( $form_id ) ) );
394
-	$custom_amount_text  = give_get_meta( $form_id, '_give_custom_amount_text', true );
388
+	$variable_pricing    = give_has_variable_prices($form_id);
389
+	$allow_custom_amount = give_get_meta($form_id, '_give_custom_amount', true);
390
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
391
+	$symbol              = give_currency_symbol(give_get_currency($form_id, $args));
392
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
393
+	$default_amount      = give_format_amount(give_get_default_form_amount($form_id), array('sanitize' => false, 'currency' => give_get_currency($form_id)));
394
+	$custom_amount_text  = give_get_meta($form_id, '_give_custom_amount_text', true);
395 395
 
396 396
 	/**
397 397
 	 * Fires while displaying donation form, before donation level fields.
@@ -401,20 +401,20 @@  discard block
 block discarded – undo
401 401
 	 * @param int   $form_id The form ID.
402 402
 	 * @param array $args    An array of form arguments.
403 403
 	 */
404
-	do_action( 'give_before_donation_levels', $form_id, $args );
404
+	do_action('give_before_donation_levels', $form_id, $args);
405 405
 
406 406
 	//Set Price, No Custom Amount Allowed means hidden price field
407
-	if ( ! give_is_setting_enabled( $allow_custom_amount ) ) {
407
+	if ( ! give_is_setting_enabled($allow_custom_amount)) {
408 408
 		?>
409
-		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
409
+		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
410 410
 		<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount"
411 411
 			   value="<?php echo $default_amount; ?>" required aria-required="true"/>
412 412
 		<div class="set-price give-donation-amount form-row-wide">
413
-			<?php if ( $currency_position == 'before' ) {
413
+			<?php if ($currency_position == 'before') {
414 414
 				echo $currency_output;
415 415
 			} ?>
416 416
 			<span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span>
417
-			<?php if ( $currency_position == 'after' ) {
417
+			<?php if ($currency_position == 'after') {
418 418
 				echo $currency_output;
419 419
 			} ?>
420 420
 		</div>
@@ -424,13 +424,13 @@  discard block
 block discarded – undo
424 424
 		?>
425 425
 		<div class="give-total-wrap">
426 426
 			<div class="give-donation-amount form-row-wide">
427
-				<?php if ( $currency_position == 'before' ) {
427
+				<?php if ($currency_position == 'before') {
428 428
 					echo $currency_output;
429 429
 				} ?>
430
-				<label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
430
+				<label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
431 431
 				<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel"
432 432
 					   placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
433
-				<?php if ( $currency_position == 'after' ) {
433
+				<?php if ($currency_position == 'after') {
434 434
 					echo $currency_output;
435 435
 				} ?>
436 436
 			</div>
@@ -445,16 +445,16 @@  discard block
 block discarded – undo
445 445
 	 * @param int   $form_id The form ID.
446 446
 	 * @param array $args    An array of form arguments.
447 447
 	 */
448
-	do_action( 'give_after_donation_amount', $form_id, $args );
448
+	do_action('give_after_donation_amount', $form_id, $args);
449 449
 
450 450
 	//Custom Amount Text
451
-	if ( ! $variable_pricing && give_is_setting_enabled( $allow_custom_amount ) && ! empty( $custom_amount_text ) ) { ?>
451
+	if ( ! $variable_pricing && give_is_setting_enabled($allow_custom_amount) && ! empty($custom_amount_text)) { ?>
452 452
 		<p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
453 453
 	<?php }
454 454
 
455 455
 	//Output Variable Pricing Levels.
456
-	if ( $variable_pricing ) {
457
-		give_output_levels( $form_id );
456
+	if ($variable_pricing) {
457
+		give_output_levels($form_id);
458 458
 	}
459 459
 
460 460
 	/**
@@ -465,10 +465,10 @@  discard block
 block discarded – undo
465 465
 	 * @param int   $form_id The form ID.
466 466
 	 * @param array $args    An array of form arguments.
467 467
 	 */
468
-	do_action( 'give_after_donation_levels', $form_id, $args );
468
+	do_action('give_after_donation_levels', $form_id, $args);
469 469
 }
470 470
 
471
-add_action( 'give_donation_form_top', 'give_output_donation_amount_top', 10, 2 );
471
+add_action('give_donation_form_top', 'give_output_donation_amount_top', 10, 2);
472 472
 
473 473
 /**
474 474
  * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons.
@@ -479,30 +479,30 @@  discard block
 block discarded – undo
479 479
  *
480 480
  * @return string Donation levels.
481 481
  */
482
-function give_output_levels( $form_id ) {
482
+function give_output_levels($form_id) {
483 483
 
484 484
 	//Get variable pricing.
485
-	$prices             = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
486
-	$display_style      = give_get_meta( $form_id, '_give_display_style', true );
487
-	$custom_amount      = give_get_meta( $form_id, '_give_custom_amount', true );
488
-	$custom_amount_text = give_get_meta( $form_id, '_give_custom_amount_text', true );
489
-	if ( empty( $custom_amount_text ) ) {
490
-		$custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' );
485
+	$prices             = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
486
+	$display_style      = give_get_meta($form_id, '_give_display_style', true);
487
+	$custom_amount      = give_get_meta($form_id, '_give_custom_amount', true);
488
+	$custom_amount_text = give_get_meta($form_id, '_give_custom_amount_text', true);
489
+	if (empty($custom_amount_text)) {
490
+		$custom_amount_text = esc_html__('Give a Custom Amount', 'give');
491 491
 	}
492 492
 
493 493
 	$output = '';
494 494
 
495
-	switch ( $display_style ) {
495
+	switch ($display_style) {
496 496
 		case 'buttons':
497 497
 
498 498
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
499 499
 
500
-			foreach ( $prices as $price ) {
501
-				$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 );
502
-				$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 );
500
+			foreach ($prices as $price) {
501
+				$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);
502
+				$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 503
 
504 504
 				$output .= '<li>';
505
-				$output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) . '">';
505
+				$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)).'">';
506 506
 				$output .= $level_text;
507 507
 				$output .= '</button>';
508 508
 				$output .= '</li>';
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 			}
511 511
 
512 512
 			//Custom Amount.
513
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
513
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
514 514
 				$output .= '<li>';
515 515
 				$output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">';
516 516
 				$output .= $custom_amount_text;
@@ -526,22 +526,22 @@  discard block
 block discarded – undo
526 526
 
527 527
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
528 528
 
529
-			foreach ( $prices as $price ) {
530
-				$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 );
531
-				$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 );
529
+			foreach ($prices as $price) {
530
+				$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);
531
+				$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 532
 
533 533
 				$output .= '<li>';
534
-				$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 ) ) . '">';
535
-				$output .= '<label for="give-radio-level-' . $price['_give_id']['level_id'] . '">' . $level_text . '</label>';
534
+				$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)).'">';
535
+				$output .= '<label for="give-radio-level-'.$price['_give_id']['level_id'].'">'.$level_text.'</label>';
536 536
 				$output .= '</li>';
537 537
 
538 538
 			}
539 539
 
540 540
 			//Custom Amount.
541
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
541
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
542 542
 				$output .= '<li>';
543 543
 				$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">';
544
-				$output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>';
544
+				$output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>';
545 545
 				$output .= '</li>';
546 546
 			}
547 547
 
@@ -551,23 +551,23 @@  discard block
 block discarded – undo
551 551
 
552 552
 		case 'dropdown':
553 553
 
554
-			$output .= '<label for="give-donation-level-select-' . $form_id . '" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>';
555
-			$output .= '<select id="give-donation-level-select-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">';
554
+			$output .= '<label for="give-donation-level-select-'.$form_id.'" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>';
555
+			$output .= '<select id="give-donation-level-select-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">';
556 556
 
557 557
 			//first loop through prices.
558
-			foreach ( $prices as $price ) {
559
-				$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 );
560
-				$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 );
558
+			foreach ($prices as $price) {
559
+				$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);
560
+				$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 561
 
562
-				$output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) . '">';
562
+				$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)).'">';
563 563
 				$output .= $level_text;
564 564
 				$output .= '</option>';
565 565
 
566 566
 			}
567 567
 
568 568
 			//Custom Amount.
569
-			if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) {
570
-				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>';
569
+			if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) {
570
+				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>';
571 571
 			}
572 572
 
573 573
 			$output .= '</select>';
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 			break;
576 576
 	}
577 577
 
578
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
578
+	echo apply_filters('give_form_level_output', $output, $form_id);
579 579
 }
580 580
 
581 581
 /**
@@ -590,27 +590,27 @@  discard block
 block discarded – undo
590 590
  *
591 591
  * @return string Checkout button.
592 592
  */
593
-function give_display_checkout_button( $form_id, $args ) {
593
+function give_display_checkout_button($form_id, $args) {
594 594
 
595
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
595
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
596 596
 		? $args['display_style']
597
-		: give_get_meta( $form_id, '_give_payment_display', true );
597
+		: give_get_meta($form_id, '_give_payment_display', true);
598 598
 
599
-	if ( 'button' === $display_option ) {
599
+	if ('button' === $display_option) {
600 600
 		$display_option = 'modal';
601
-	} elseif ( $display_option === 'onpage' ) {
601
+	} elseif ($display_option === 'onpage') {
602 602
 		return '';
603 603
 	}
604 604
 
605
-	$display_label_field = give_get_meta( $form_id, '_give_reveal_label', true );
606
-	$display_label       = ! empty( $args['continue_button_title'] ) ? $args['continue_button_title'] : ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
605
+	$display_label_field = give_get_meta($form_id, '_give_reveal_label', true);
606
+	$display_label       = ! empty($args['continue_button_title']) ? $args['continue_button_title'] : ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
607 607
 
608
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
608
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
609 609
 
610
-	echo apply_filters( 'give_display_checkout_button', $output );
610
+	echo apply_filters('give_display_checkout_button', $output);
611 611
 }
612 612
 
613
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
613
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
614 614
 
615 615
 /**
616 616
  * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided.
@@ -623,55 +623,55 @@  discard block
 block discarded – undo
623 623
  *
624 624
  * @return void
625 625
  */
626
-function give_user_info_fields( $form_id ) {
626
+function give_user_info_fields($form_id) {
627 627
 	// Get user info.
628
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
628
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
629 629
 
630 630
 	/**
631 631
 	 * Fire before user personal information fields
632 632
 	 *
633 633
 	 * @since 1.7
634 634
 	 */
635
-	do_action( 'give_donation_form_before_personal_info', $form_id );
635
+	do_action('give_donation_form_before_personal_info', $form_id);
636 636
 	?>
637 637
 	<fieldset id="give_checkout_user_info">
638
-		<legend><?php echo apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ); ?></legend>
638
+		<legend><?php echo apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give')); ?></legend>
639 639
 		<p id="give-first-name-wrap" class="form-row form-row-first form-row-responsive">
640 640
 			<label class="give-label" for="give-first">
641
-				<?php _e( 'First Name', 'give' ); ?>
642
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?>
641
+				<?php _e('First Name', 'give'); ?>
642
+				<?php if (give_field_is_required('give_first', $form_id)) : ?>
643 643
 					<span class="give-required-indicator">*</span>
644 644
 				<?php endif ?>
645
-				<?php echo Give()->tooltips->render_help( __( 'We will use this to personalize your account experience.', 'give' ) ); ?>
645
+				<?php echo Give()->tooltips->render_help(__('We will use this to personalize your account experience.', 'give')); ?>
646 646
 			</label>
647 647
 			<input
648 648
 					class="give-input required"
649 649
 					type="text"
650 650
 					name="give_first"
651
-					placeholder="<?php _e( 'First Name', 'give' ); ?>"
651
+					placeholder="<?php _e('First Name', 'give'); ?>"
652 652
 					id="give-first"
653
-					value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>"
654
-				<?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
653
+					value="<?php echo isset($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; ?>"
654
+				<?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?>
655 655
 			/>
656 656
 		</p>
657 657
 
658 658
 		<p id="give-last-name-wrap" class="form-row form-row-last form-row-responsive">
659 659
 			<label class="give-label" for="give-last">
660
-				<?php _e( 'Last Name', 'give' ); ?>
661
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?>
660
+				<?php _e('Last Name', 'give'); ?>
661
+				<?php if (give_field_is_required('give_last', $form_id)) : ?>
662 662
 					<span class="give-required-indicator">*</span>
663 663
 				<?php endif ?>
664
-				<?php echo Give()->tooltips->render_help( __( 'We will use this as well to personalize your account experience.', 'give' ) ); ?>
664
+				<?php echo Give()->tooltips->render_help(__('We will use this as well to personalize your account experience.', 'give')); ?>
665 665
 			</label>
666 666
 
667 667
 			<input
668
-					class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>"
668
+					class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>"
669 669
 					type="text"
670 670
 					name="give_last"
671 671
 					id="give-last"
672
-					placeholder="<?php _e( 'Last Name', 'give' ); ?>"
673
-					value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>"
674
-				<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
672
+					placeholder="<?php _e('Last Name', 'give'); ?>"
673
+					value="<?php echo isset($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; ?>"
674
+				<?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?>
675 675
 			/>
676 676
 		</p>
677 677
 
@@ -681,25 +681,25 @@  discard block
 block discarded – undo
681 681
 		 *
682 682
 		 * @since 1.7
683 683
 		 */
684
-		do_action( 'give_donation_form_before_email', $form_id );
684
+		do_action('give_donation_form_before_email', $form_id);
685 685
 		?>
686 686
 		<p id="give-email-wrap" class="form-row form-row-wide">
687 687
 			<label class="give-label" for="give-email">
688
-				<?php _e( 'Email Address', 'give' ); ?>
689
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
688
+				<?php _e('Email Address', 'give'); ?>
689
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
690 690
 					<span class="give-required-indicator">*</span>
691 691
 				<?php } ?>
692
-				<?php echo Give()->tooltips->render_help( __( 'We will send the donation receipt to this address.', 'give' ) ); ?>
692
+				<?php echo Give()->tooltips->render_help(__('We will send the donation receipt to this address.', 'give')); ?>
693 693
 			</label>
694 694
 
695 695
 			<input
696 696
 					class="give-input required"
697 697
 					type="email"
698 698
 					name="give_email"
699
-					placeholder="<?php _e( 'Email Address', 'give' ); ?>"
699
+					placeholder="<?php _e('Email Address', 'give'); ?>"
700 700
 					id="give-email"
701
-					value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>"
702
-				<?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
701
+					value="<?php echo isset($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; ?>"
702
+				<?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?>
703 703
 			/>
704 704
 
705 705
 		</p>
@@ -709,14 +709,14 @@  discard block
 block discarded – undo
709 709
 		 *
710 710
 		 * @since 1.7
711 711
 		 */
712
-		do_action( 'give_donation_form_after_email', $form_id );
712
+		do_action('give_donation_form_after_email', $form_id);
713 713
 
714 714
 		/**
715 715
 		 * Fire after personal email field
716 716
 		 *
717 717
 		 * @since 1.7
718 718
 		 */
719
-		do_action( 'give_donation_form_user_info', $form_id );
719
+		do_action('give_donation_form_user_info', $form_id);
720 720
 		?>
721 721
 	</fieldset>
722 722
 	<?php
@@ -725,11 +725,11 @@  discard block
 block discarded – undo
725 725
 	 *
726 726
 	 * @since 1.7
727 727
 	 */
728
-	do_action( 'give_donation_form_after_personal_info', $form_id );
728
+	do_action('give_donation_form_after_personal_info', $form_id);
729 729
 }
730 730
 
731
-add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' );
732
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
731
+add_action('give_donation_form_after_user_info', 'give_user_info_fields');
732
+add_action('give_register_fields_before', 'give_user_info_fields');
733 733
 
734 734
 /**
735 735
  * Renders the credit card info form.
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
  *
741 741
  * @return void
742 742
  */
743
-function give_get_cc_form( $form_id ) {
743
+function give_get_cc_form($form_id) {
744 744
 
745 745
 	ob_start();
746 746
 
@@ -751,50 +751,50 @@  discard block
 block discarded – undo
751 751
 	 *
752 752
 	 * @param int $form_id The form ID.
753 753
 	 */
754
-	do_action( 'give_before_cc_fields', $form_id );
754
+	do_action('give_before_cc_fields', $form_id);
755 755
 	?>
756 756
 	<fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate">
757
-		<legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend>
758
-		<?php if ( is_ssl() ) : ?>
757
+		<legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend>
758
+		<?php if (is_ssl()) : ?>
759 759
 			<div id="give_secure_site_wrapper-<?php echo $form_id ?>">
760 760
 				<span class="give-icon padlock"></span>
761
-				<span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
761
+				<span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span>
762 762
 			</div>
763 763
 		<?php endif; ?>
764 764
 		<p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive">
765 765
 			<label for="card_number-<?php echo $form_id ?>" class="give-label">
766
-				<?php _e( 'Card Number', 'give' ); ?>
766
+				<?php _e('Card Number', 'give'); ?>
767 767
 				<span class="give-required-indicator">*</span>
768
-				<?php echo Give()->tooltips->render_help( __( 'The (typically) 16 digits on the front of your credit card.', 'give' ) ); ?>
768
+				<?php echo Give()->tooltips->render_help(__('The (typically) 16 digits on the front of your credit card.', 'give')); ?>
769 769
 				<span class="card-type"></span>
770 770
 			</label>
771 771
 
772 772
 			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>"
773
-				   class="card-number give-input required" placeholder="<?php _e( 'Card number', 'give' ); ?>"
773
+				   class="card-number give-input required" placeholder="<?php _e('Card number', 'give'); ?>"
774 774
 				   required aria-required="true"/>
775 775
 		</p>
776 776
 
777 777
 		<p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third form-row-responsive">
778 778
 			<label for="card_cvc-<?php echo $form_id ?>" class="give-label">
779
-				<?php _e( 'CVC', 'give' ); ?>
779
+				<?php _e('CVC', 'give'); ?>
780 780
 				<span class="give-required-indicator">*</span>
781
-				<?php echo Give()->tooltips->render_help( __( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ) ); ?>
781
+				<?php echo Give()->tooltips->render_help(__('The 3 digit (back) or 4 digit (front) value on your card.', 'give')); ?>
782 782
 			</label>
783 783
 
784 784
 			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>"
785
-				   class="card-cvc give-input required" placeholder="<?php _e( 'Security code', 'give' ); ?>"
785
+				   class="card-cvc give-input required" placeholder="<?php _e('Security code', 'give'); ?>"
786 786
 				   required aria-required="true"/>
787 787
 		</p>
788 788
 
789 789
 		<p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive">
790 790
 			<label for="card_name-<?php echo $form_id ?>" class="give-label">
791
-				<?php _e( 'Name on the Card', 'give' ); ?>
791
+				<?php _e('Name on the Card', 'give'); ?>
792 792
 				<span class="give-required-indicator">*</span>
793
-				<?php echo Give()->tooltips->render_help( __( 'The name printed on the front of your credit card.', 'give' ) ); ?>
793
+				<?php echo Give()->tooltips->render_help(__('The name printed on the front of your credit card.', 'give')); ?>
794 794
 			</label>
795 795
 
796 796
 			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>"
797
-				   class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>"
797
+				   class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>"
798 798
 				   required aria-required="true"/>
799 799
 		</p>
800 800
 		<?php
@@ -805,19 +805,19 @@  discard block
 block discarded – undo
805 805
 		 *
806 806
 		 * @param int $form_id The form ID.
807 807
 		 */
808
-		do_action( 'give_before_cc_expiration' );
808
+		do_action('give_before_cc_expiration');
809 809
 		?>
810 810
 		<p class="card-expiration form-row form-row-one-third form-row-responsive">
811 811
 			<label for="card_expiry-<?php echo $form_id ?>" class="give-label">
812
-				<?php _e( 'Expiration', 'give' ); ?>
812
+				<?php _e('Expiration', 'give'); ?>
813 813
 				<span class="give-required-indicator">*</span>
814
-				<?php echo Give()->tooltips->render_help( __( 'The date your credit card expires, typically on the front of the card.', 'give' ) ); ?>
814
+				<?php echo Give()->tooltips->render_help(__('The date your credit card expires, typically on the front of the card.', 'give')); ?>
815 815
 			</label>
816 816
 
817 817
 			<input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/>
818 818
 			<input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/>
819 819
 
820
-			<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"/>
820
+			<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"/>
821 821
 		</p>
822 822
 		<?php
823 823
 		/**
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 		 *
828 828
 		 * @param int $form_id The form ID.
829 829
 		 */
830
-		do_action( 'give_after_cc_expiration', $form_id );
830
+		do_action('give_after_cc_expiration', $form_id);
831 831
 		?>
832 832
 	</fieldset>
833 833
 	<?php
@@ -838,12 +838,12 @@  discard block
 block discarded – undo
838 838
 	 *
839 839
 	 * @param int $form_id The form ID.
840 840
 	 */
841
-	do_action( 'give_after_cc_fields', $form_id );
841
+	do_action('give_after_cc_fields', $form_id);
842 842
 
843 843
 	echo ob_get_clean();
844 844
 }
845 845
 
846
-add_action( 'give_cc_form', 'give_get_cc_form' );
846
+add_action('give_cc_form', 'give_get_cc_form');
847 847
 
848 848
 /**
849 849
  * Outputs the default credit card address fields.
@@ -854,20 +854,20 @@  discard block
 block discarded – undo
854 854
  *
855 855
  * @return void
856 856
  */
857
-function give_default_cc_address_fields( $form_id ) {
857
+function give_default_cc_address_fields($form_id) {
858 858
 	// Get user info.
859
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
859
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
860 860
 
861 861
 	$logged_in = is_user_logged_in();
862 862
 
863
-	if ( $logged_in ) {
864
-		$user_address = give_get_donor_address( get_current_user_id() );
863
+	if ($logged_in) {
864
+		$user_address = give_get_donor_address(get_current_user_id());
865 865
 	}
866 866
 
867 867
 	ob_start();
868 868
 	?>
869 869
 	<fieldset id="give_cc_address" class="cc-address">
870
-		<legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend>
870
+		<legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend>
871 871
 		<?php
872 872
 		/**
873 873
 		 * Fires while rendering credit card billing form, before address fields.
@@ -876,36 +876,36 @@  discard block
 block discarded – undo
876 876
 		 *
877 877
 		 * @param int $form_id The form ID.
878 878
 		 */
879
-		do_action( 'give_cc_billing_top' );
879
+		do_action('give_cc_billing_top');
880 880
 
881 881
 		// For Country.
882 882
 		$selected_country = give_get_country();
883
-		if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) {
883
+		if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) {
884 884
 			$selected_country = $give_user_info['billing_country'];
885 885
 		}
886 886
 		$countries = give_get_country_list();
887 887
 
888 888
 		// For state
889 889
 		$selected_state = '';
890
-		if ( $selected_country === give_get_country() ) {
890
+		if ($selected_country === give_get_country()) {
891 891
 			// Get defalut selected state by admin.
892 892
 			$selected_state = give_get_state();
893 893
 		}
894 894
 		// Get the last payment made by user states.
895
-		if ( ! empty( $give_user_info['card_state'] ) && '*' !== $give_user_info['card_state'] ) {
895
+		if ( ! empty($give_user_info['card_state']) && '*' !== $give_user_info['card_state']) {
896 896
 			$selected_state = $give_user_info['card_state'];
897 897
 		}
898 898
 		// Get the country code
899
-		if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) {
899
+		if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) {
900 900
 			$selected_country = $give_user_info['billing_country'];
901 901
 		}
902
-		$label        = __( 'State', 'give' );
902
+		$label        = __('State', 'give');
903 903
 		$states_label = give_get_states_label();
904 904
 		// Check if $country code exists in the array key for states label.
905
-		if ( array_key_exists( $selected_country, $states_label ) ) {
906
-			$label = $states_label[ $selected_country ];
905
+		if (array_key_exists($selected_country, $states_label)) {
906
+			$label = $states_label[$selected_country];
907 907
 		}
908
-		$states = give_get_states( $selected_country );
908
+		$states = give_get_states($selected_country);
909 909
 		// Get the country list that do not have any states init.
910 910
 		$no_states_country = give_no_states_country_list();
911 911
 		// Get the country list that does not require states.
@@ -913,23 +913,23 @@  discard block
 block discarded – undo
913 913
 		?>
914 914
 	    <p id="give-card-country-wrap" class="form-row form-row-wide">
915 915
 		    <label for="billing_country" class="give-label">
916
-			    <?php esc_html_e( 'Country', 'give' ); ?>
917
-			    <?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?>
916
+			    <?php esc_html_e('Country', 'give'); ?>
917
+			    <?php if (give_field_is_required('billing_country', $form_id)) : ?>
918 918
 				    <span class="give-required-indicator">*</span>
919 919
 			    <?php endif; ?>
920 920
 			    <span class="give-tooltip give-icon give-icon-question"
921
-			          data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span>
921
+			          data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span>
922 922
 		    </label>
923 923
 
924 924
 		    <select
925 925
 				    name="billing_country"
926 926
 				    id="billing_country"
927
-				    class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>"
928
-			    <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
927
+				    class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>"
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>';
931
+			    foreach ($countries as $country_code => $country) {
932
+				    echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
933 933
 			    }
934 934
 			    ?>
935 935
 		    </select>
@@ -937,86 +937,86 @@  discard block
 block discarded – undo
937 937
 
938 938
 		<p id="give-card-address-wrap" class="form-row form-row-wide">
939 939
 			<label for="card_address" class="give-label">
940
-				<?php _e( 'Address 1', 'give' ); ?>
940
+				<?php _e('Address 1', 'give'); ?>
941 941
 				<?php
942
-				if ( give_field_is_required( 'card_address', $form_id ) ) : ?>
942
+				if (give_field_is_required('card_address', $form_id)) : ?>
943 943
 					<span class="give-required-indicator">*</span>
944 944
 				<?php endif; ?>
945
-				<?php echo Give()->tooltips->render_help( __( 'The primary billing address for your credit card.', 'give' ) ); ?>
945
+				<?php echo Give()->tooltips->render_help(__('The primary billing address for your credit card.', 'give')); ?>
946 946
 			</label>
947 947
 
948 948
 			<input
949 949
 					type="text"
950 950
 					id="card_address"
951 951
 					name="card_address"
952
-					class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>"
953
-					placeholder="<?php _e( 'Address line 1', 'give' ); ?>"
954
-					value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>"
955
-				<?php echo( give_field_is_required( 'card_address', $form_id ) ? '  required aria-required="true" ' : '' ); ?>
952
+					class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>"
953
+					placeholder="<?php _e('Address line 1', 'give'); ?>"
954
+					value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>"
955
+				<?php echo(give_field_is_required('card_address', $form_id) ? '  required aria-required="true" ' : ''); ?>
956 956
 			/>
957 957
 		</p>
958 958
 
959 959
 		<p id="give-card-address-2-wrap" class="form-row form-row-wide">
960 960
 			<label for="card_address_2" class="give-label">
961
-				<?php _e( 'Address 2', 'give' ); ?>
962
-				<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?>
961
+				<?php _e('Address 2', 'give'); ?>
962
+				<?php if (give_field_is_required('card_address_2', $form_id)) : ?>
963 963
 					<span class="give-required-indicator">*</span>
964 964
 				<?php endif; ?>
965
-				<?php echo Give()->tooltips->render_help( __( '(optional) The suite, apartment number, post office box (etc) associated with your billing address.', 'give' ) ); ?>
965
+				<?php echo Give()->tooltips->render_help(__('(optional) The suite, apartment number, post office box (etc) associated with your billing address.', 'give')); ?>
966 966
 			</label>
967 967
 
968 968
 			<input
969 969
 					type="text"
970 970
 					id="card_address_2"
971 971
 					name="card_address_2"
972
-					class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>"
973
-					placeholder="<?php _e( 'Address line 2', 'give' ); ?>"
974
-					value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>"
975
-				<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
972
+					class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>"
973
+					placeholder="<?php _e('Address line 2', 'give'); ?>"
974
+					value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>"
975
+				<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?>
976 976
 			/>
977 977
 		</p>
978 978
 
979 979
 		<p id="give-card-city-wrap" class="form-row form-row-wide">
980 980
 			<label for="card_city" class="give-label">
981
-				<?php _e( 'City', 'give' ); ?>
982
-				<?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?>
981
+				<?php _e('City', 'give'); ?>
982
+				<?php if (give_field_is_required('card_city', $form_id)) : ?>
983 983
 					<span class="give-required-indicator">*</span>
984 984
 				<?php endif; ?>
985
-				<?php echo Give()->tooltips->render_help( __( 'The city for your billing address.', 'give' ) ); ?>
985
+				<?php echo Give()->tooltips->render_help(__('The city for your billing address.', 'give')); ?>
986 986
 			</label>
987 987
 			<input
988 988
 					type="text"
989 989
 					id="card_city"
990 990
 					name="card_city"
991
-					class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>"
992
-					placeholder="<?php _e( 'City', 'give' ); ?>"
993
-					value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>"
994
-				<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
991
+					class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>"
992
+					placeholder="<?php _e('City', 'give'); ?>"
993
+					value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>"
994
+				<?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?>
995 995
 			/>
996 996
 		</p>
997 997
 
998 998
 	    <p id="give-card-state-wrap"
999
-	       class="form-row form-row-first form-row-responsive <?php echo ( ! empty( $selected_country ) && array_key_exists( $selected_country, $no_states_country ) ) ? 'give-hidden' : ''; ?> ">
999
+	       class="form-row form-row-first form-row-responsive <?php echo ( ! empty($selected_country) && array_key_exists($selected_country, $no_states_country)) ? 'give-hidden' : ''; ?> ">
1000 1000
 		    <label for="card_state" class="give-label">
1001 1001
 			    <span class="state-label-text"><?php echo $label; ?></span>
1002
-			    <?php if ( give_field_is_required( 'card_state', $form_id ) ) :
1002
+			    <?php if (give_field_is_required('card_state', $form_id)) :
1003 1003
 				    ?>
1004
-				    <span class="give-required-indicator <?php echo( array_key_exists( $selected_country, $states_not_required_country_list ) ? 'give-hidden' : '' ) ?> ">*</span>
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"
1007
-			          data-tooltip="<?php esc_attr_e( 'The state, province, or county for your billing address.', 'give' ); ?>"></span>
1007
+			          data-tooltip="<?php esc_attr_e('The state, province, or county for your billing address.', 'give'); ?>"></span>
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
-					    class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>"
1016
-				    <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>>
1015
+					    class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>"
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>';
1018
+				    foreach ($states as $state_code => $state) {
1019
+					    echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
1020 1020
 				    }
1021 1021
 				    ?>
1022 1022
 			    </select>
@@ -1028,11 +1028,11 @@  discard block
 block discarded – undo
1028 1028
 
1029 1029
 		<p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive">
1030 1030
 			<label for="card_zip" class="give-label">
1031
-				<?php _e( 'Zip / Postal Code', 'give' ); ?>
1032
-				<?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?>
1031
+				<?php _e('Zip / Postal Code', 'give'); ?>
1032
+				<?php if (give_field_is_required('card_zip', $form_id)) : ?>
1033 1033
 					<span class="give-required-indicator">*</span>
1034 1034
 				<?php endif; ?>
1035
-				<?php echo Give()->tooltips->render_help( __( 'The ZIP Code or postal code for your billing address.', 'give' ) ); ?>
1035
+				<?php echo Give()->tooltips->render_help(__('The ZIP Code or postal code for your billing address.', 'give')); ?>
1036 1036
 			</label>
1037 1037
 
1038 1038
 			<input
@@ -1040,10 +1040,10 @@  discard block
 block discarded – undo
1040 1040
 					size="4"
1041 1041
 					id="card_zip"
1042 1042
 					name="card_zip"
1043
-					class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>"
1044
-					placeholder="<?php _e( 'Zip / Postal Code', 'give' ); ?>"
1045
-					value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>"
1046
-				<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
1043
+					class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>"
1044
+					placeholder="<?php _e('Zip / Postal Code', 'give'); ?>"
1045
+					value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>"
1046
+				<?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?>
1047 1047
 			/>
1048 1048
 		</p>
1049 1049
 		<?php
@@ -1054,14 +1054,14 @@  discard block
 block discarded – undo
1054 1054
 		 *
1055 1055
 		 * @param int $form_id The form ID.
1056 1056
 		 */
1057
-		do_action( 'give_cc_billing_bottom' );
1057
+		do_action('give_cc_billing_bottom');
1058 1058
 		?>
1059 1059
 	</fieldset>
1060 1060
 	<?php
1061 1061
 	echo ob_get_clean();
1062 1062
 }
1063 1063
 
1064
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
1064
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
1065 1065
 
1066 1066
 
1067 1067
 /**
@@ -1074,15 +1074,15 @@  discard block
 block discarded – undo
1074 1074
  *
1075 1075
  * @return string
1076 1076
  */
1077
-function give_get_register_fields( $form_id ) {
1077
+function give_get_register_fields($form_id) {
1078 1078
 
1079 1079
 	global $user_ID;
1080 1080
 
1081
-	if ( is_user_logged_in() ) {
1082
-		$user_data = get_userdata( $user_ID );
1081
+	if (is_user_logged_in()) {
1082
+		$user_data = get_userdata($user_ID);
1083 1083
 	}
1084 1084
 
1085
-	$show_register_form = give_show_login_register_option( $form_id );
1085
+	$show_register_form = give_show_login_register_option($form_id);
1086 1086
 
1087 1087
 	ob_start(); ?>
1088 1088
 	<fieldset id="give-register-fields-<?php echo $form_id; ?>">
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
 		 *
1096 1096
 		 * @param int $form_id The form ID.
1097 1097
 		 */
1098
-		do_action( 'give_register_fields_before', $form_id );
1098
+		do_action('give_register_fields_before', $form_id);
1099 1099
 		?>
1100 1100
 
1101 1101
 		<fieldset id="give-register-account-fields-<?php echo $form_id; ?>">
@@ -1107,22 +1107,22 @@  discard block
 block discarded – undo
1107 1107
 			 *
1108 1108
 			 * @param int $form_id The form ID.
1109 1109
 			 */
1110
-			do_action( 'give_register_account_fields_before', $form_id );
1110
+			do_action('give_register_account_fields_before', $form_id);
1111 1111
 			?>
1112 1112
 			<div id="give-create-account-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive">
1113 1113
 				<label for="give-create-account-<?php echo $form_id; ?>">
1114 1114
 					<?php
1115 1115
 					// Add attributes to checkbox, if Guest Checkout is disabled.
1116
-					$is_guest_checkout = give_get_meta( $form_id, '_give_logged_in_only', true );
1117
-					$id                = 'give-create-account-' . $form_id;
1118
-					if ( ! give_is_setting_enabled( $is_guest_checkout ) ) {
1116
+					$is_guest_checkout = give_get_meta($form_id, '_give_logged_in_only', true);
1117
+					$id                = 'give-create-account-'.$form_id;
1118
+					if ( ! give_is_setting_enabled($is_guest_checkout)) {
1119 1119
 						echo Give()->tooltips->render(
1120 1120
 							array(
1121 1121
 								'tag_content' => sprintf(
1122 1122
 									'<input type="checkbox" name="give_create_account" value="on" id="%s" class="give-input give-disabled" checked />',
1123 1123
 									$id
1124 1124
 								),
1125
-								'label'       => __( 'Registration is required to donate.', 'give' ),
1125
+								'label'       => __('Registration is required to donate.', 'give'),
1126 1126
 							) );
1127 1127
 					} else {
1128 1128
 						?>
@@ -1130,16 +1130,16 @@  discard block
 block discarded – undo
1130 1130
 						<?php
1131 1131
 					}
1132 1132
 					?>
1133
-					<?php _e( 'Create an account', 'give' ); ?>
1134
-					<?php echo Give()->tooltips->render_help( __( 'Create an account on the site to see and manage donation history.', 'give' ) ); ?>
1133
+					<?php _e('Create an account', 'give'); ?>
1134
+					<?php echo Give()->tooltips->render_help(__('Create an account on the site to see and manage donation history.', 'give')); ?>
1135 1135
 				</label>
1136 1136
 			</div>
1137 1137
 
1138
-			<?php if ( 'both' === $show_register_form ) { ?>
1138
+			<?php if ('both' === $show_register_form) { ?>
1139 1139
 				<div class="give-login-account-wrap form-row form-row-last form-row-responsive">
1140
-					<p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?>&nbsp;
1141
-						<a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login"
1142
-						   data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a>
1140
+					<p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?>&nbsp;
1141
+						<a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login"
1142
+						   data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a>
1143 1143
 					</p>
1144 1144
 					<p class="give-loading-text">
1145 1145
 						<span class="give-loading-animation"></span>
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
 			 *
1156 1156
 			 * @param int $form_id The form ID.
1157 1157
 			 */
1158
-			do_action( 'give_register_account_fields_after', $form_id );
1158
+			do_action('give_register_account_fields_after', $form_id);
1159 1159
 			?>
1160 1160
 		</fieldset>
1161 1161
 
@@ -1167,7 +1167,7 @@  discard block
 block discarded – undo
1167 1167
 		 *
1168 1168
 		 * @param int $form_id The form ID.
1169 1169
 		 */
1170
-		do_action( 'give_register_fields_after', $form_id );
1170
+		do_action('give_register_fields_after', $form_id);
1171 1171
 		?>
1172 1172
 
1173 1173
 		<input type="hidden" name="give-purchase-var" value="needs-to-register"/>
@@ -1178,7 +1178,7 @@  discard block
 block discarded – undo
1178 1178
 		 *
1179 1179
 		 * @since 1.7
1180 1180
 		 */
1181
-		do_action( 'give_donation_form_user_info', $form_id );
1181
+		do_action('give_donation_form_user_info', $form_id);
1182 1182
 		?>
1183 1183
 
1184 1184
 	</fieldset>
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
 	echo ob_get_clean();
1187 1187
 }
1188 1188
 
1189
-add_action( 'give_donation_form_register_fields', 'give_get_register_fields' );
1189
+add_action('give_donation_form_register_fields', 'give_get_register_fields');
1190 1190
 
1191 1191
 /**
1192 1192
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -1199,28 +1199,28 @@  discard block
 block discarded – undo
1199 1199
  *
1200 1200
  * @return string
1201 1201
  */
1202
-function give_get_login_fields( $form_id ) {
1202
+function give_get_login_fields($form_id) {
1203 1203
 
1204
-	$form_id            = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id;
1205
-	$show_register_form = give_show_login_register_option( $form_id );
1204
+	$form_id            = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id;
1205
+	$show_register_form = give_show_login_register_option($form_id);
1206 1206
 
1207 1207
 	ob_start();
1208 1208
 	?>
1209 1209
 	<fieldset id="give-login-fields-<?php echo $form_id; ?>">
1210
-		<legend><?php echo apply_filters( 'give_account_login_fieldset_heading', __( 'Login to Your Account', 'give' ) );
1211
-			if ( ! give_logged_in_only( $form_id ) ) {
1212
-				echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>';
1210
+		<legend><?php echo apply_filters('give_account_login_fieldset_heading', __('Login to Your Account', 'give'));
1211
+			if ( ! give_logged_in_only($form_id)) {
1212
+				echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>';
1213 1213
 			} ?>
1214 1214
 		</legend>
1215
-		<?php if ( $show_register_form == 'both' ) { ?>
1215
+		<?php if ($show_register_form == 'both') { ?>
1216 1216
 			<p class="give-new-account-link">
1217
-				<?php _e( 'Don\'t have an account?', 'give' ); ?>&nbsp;
1218
-				<a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel"
1217
+				<?php _e('Don\'t have an account?', 'give'); ?>&nbsp;
1218
+				<a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel"
1219 1219
 				   data-action="give_checkout_register">
1220
-					<?php if ( give_logged_in_only( $form_id ) ) {
1221
-					    _e( 'Register as a part of your donation &raquo;', 'give' );
1220
+					<?php if (give_logged_in_only($form_id)) {
1221
+					    _e('Register as a part of your donation &raquo;', 'give');
1222 1222
                     } else {
1223
-						 _e( 'Register or donate as a guest &raquo;', 'give' );
1223
+						 _e('Register or donate as a guest &raquo;', 'give');
1224 1224
 					} ?>
1225 1225
 				</a>
1226 1226
 			</p>
@@ -1236,49 +1236,49 @@  discard block
 block discarded – undo
1236 1236
 		 *
1237 1237
 		 * @param int $form_id The form ID.
1238 1238
 		 */
1239
-		do_action( 'give_checkout_login_fields_before', $form_id );
1239
+		do_action('give_checkout_login_fields_before', $form_id);
1240 1240
 		?>
1241 1241
 		<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive">
1242 1242
 			<label class="give-label" for="give-user-login-<?php echo $form_id; ?>">
1243
-				<?php _e( 'Username', 'give' ); ?>
1244
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1243
+				<?php _e('Username', 'give'); ?>
1244
+				<?php if (give_logged_in_only($form_id)) { ?>
1245 1245
 					<span class="give-required-indicator">*</span>
1246 1246
 				<?php } ?>
1247 1247
 			</label>
1248 1248
 
1249
-			<input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text"
1249
+			<input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text"
1250 1250
 				   name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value=""
1251
-				   placeholder="<?php _e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1251
+				   placeholder="<?php _e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1252 1252
 		</div>
1253 1253
 
1254 1254
 		<div id="give-user-pass-wrap-<?php echo $form_id; ?>"
1255 1255
 			 class="give_login_password form-row form-row-last form-row-responsive">
1256 1256
 			<label class="give-label" for="give-user-pass-<?php echo $form_id; ?>">
1257
-				<?php _e( 'Password', 'give' ); ?>
1258
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1257
+				<?php _e('Password', 'give'); ?>
1258
+				<?php if (give_logged_in_only($form_id)) { ?>
1259 1259
 					<span class="give-required-indicator">*</span>
1260 1260
 				<?php } ?>
1261 1261
 			</label>
1262
-			<input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>"
1262
+			<input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>"
1263 1263
 				   type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>"
1264
-				   placeholder="<?php _e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1264
+				   placeholder="<?php _e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1265 1265
 			<input type="hidden" name="give-purchase-var" value="needs-to-login"/>
1266 1266
 		</div>
1267 1267
 
1268 1268
 		<div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password">
1269 1269
 			 <span class="give-forgot-password ">
1270 1270
 				 <a href="<?php echo wp_lostpassword_url() ?>"
1271
-					target="_blank"><?php _e( 'Reset Password', 'give' ) ?></a>
1271
+					target="_blank"><?php _e('Reset Password', 'give') ?></a>
1272 1272
 			 </span>
1273 1273
 		</div>
1274 1274
 
1275 1275
 		<div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix">
1276 1276
 			<input type="submit" class="give-submit give-btn button" name="give_login_submit"
1277
-				   value="<?php _e( 'Login', 'give' ); ?>"/>
1278
-			<?php if ( $show_register_form !== 'login' ) { ?>
1277
+				   value="<?php _e('Login', 'give'); ?>"/>
1278
+			<?php if ($show_register_form !== 'login') { ?>
1279 1279
 				<input type="button" data-action="give_cancel_login"
1280 1280
 					   class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel"
1281
-					   value="<?php _e( 'Cancel', 'give' ); ?>"/>
1281
+					   value="<?php _e('Cancel', 'give'); ?>"/>
1282 1282
 			<?php } ?>
1283 1283
 			<span class="give-loading-animation"></span>
1284 1284
 		</div>
@@ -1290,14 +1290,14 @@  discard block
 block discarded – undo
1290 1290
 		 *
1291 1291
 		 * @param int $form_id The form ID.
1292 1292
 		 */
1293
-		do_action( 'give_checkout_login_fields_after', $form_id );
1293
+		do_action('give_checkout_login_fields_after', $form_id);
1294 1294
 		?>
1295 1295
 	</fieldset><!--end #give-login-fields-->
1296 1296
 	<?php
1297 1297
 	echo ob_get_clean();
1298 1298
 }
1299 1299
 
1300
-add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 );
1300
+add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1);
1301 1301
 
1302 1302
 /**
1303 1303
  * Payment Mode Select.
@@ -1313,9 +1313,9 @@  discard block
 block discarded – undo
1313 1313
  *
1314 1314
  * @return void
1315 1315
  */
1316
-function give_payment_mode_select( $form_id ) {
1316
+function give_payment_mode_select($form_id) {
1317 1317
 
1318
-	$gateways = give_get_enabled_payment_gateways( $form_id );
1318
+	$gateways = give_get_enabled_payment_gateways($form_id);
1319 1319
 
1320 1320
 	/**
1321 1321
 	 * Fires while selecting payment gateways, before the fields.
@@ -1324,10 +1324,10 @@  discard block
 block discarded – undo
1324 1324
 	 *
1325 1325
 	 * @param int $form_id The form ID.
1326 1326
 	 */
1327
-	do_action( 'give_payment_mode_top', $form_id );
1327
+	do_action('give_payment_mode_top', $form_id);
1328 1328
 	?>
1329 1329
 
1330
-	<fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) {
1330
+	<fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) {
1331 1331
 		echo 'style="display: none;"';
1332 1332
 	} ?>>
1333 1333
 		<?php
@@ -1338,10 +1338,10 @@  discard block
 block discarded – undo
1338 1338
 		 *
1339 1339
 		 * @param int $form_id The form ID.
1340 1340
 		 */
1341
-		do_action( 'give_payment_mode_before_gateways_wrap' );
1341
+		do_action('give_payment_mode_before_gateways_wrap');
1342 1342
 		?>
1343 1343
 		<legend
1344
-				class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?>
1344
+				class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?>
1345 1345
 			<span class="give-loading-text"><span
1346 1346
 						class="give-loading-animation"></span>
1347 1347
             </span>
@@ -1354,26 +1354,26 @@  discard block
 block discarded – undo
1354 1354
 			 *
1355 1355
 			 * @since 1.7
1356 1356
 			 */
1357
-			do_action( 'give_payment_mode_before_gateways' )
1357
+			do_action('give_payment_mode_before_gateways')
1358 1358
 			?>
1359 1359
 			<ul id="give-gateway-radio-list">
1360 1360
 				<?php
1361 1361
 				/**
1362 1362
 				 * Loop through the active payment gateways.
1363 1363
 				 */
1364
-				$selected_gateway  = give_get_chosen_gateway( $form_id );
1364
+				$selected_gateway = give_get_chosen_gateway($form_id);
1365 1365
 
1366
-				foreach ( $gateways as $gateway_id => $gateway ) :
1366
+				foreach ($gateways as $gateway_id => $gateway) :
1367 1367
 					//Determine the default gateway.
1368
-					$checked = checked( $gateway_id, $selected_gateway, false );
1368
+					$checked = checked($gateway_id, $selected_gateway, false);
1369 1369
 					$checked_class = $checked ? ' class="give-gateway-option-selected"' : ''; ?>
1370 1370
 					<li<?php echo $checked_class ?>>
1371 1371
 						<input type="radio" name="payment-mode" class="give-gateway"
1372
-							   id="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>"
1373
-							   value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>>
1374
-						<label for="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>"
1372
+							   id="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>"
1373
+							   value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>>
1374
+						<label for="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>"
1375 1375
 							   class="give-gateway-option"
1376
-							   id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $gateway['checkout_label'] ); ?></label>
1376
+							   id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($gateway['checkout_label']); ?></label>
1377 1377
 					</li>
1378 1378
 					<?php
1379 1379
 				endforeach;
@@ -1385,7 +1385,7 @@  discard block
 block discarded – undo
1385 1385
 			 *
1386 1386
 			 * @since 1.7
1387 1387
 			 */
1388
-			do_action( 'give_payment_mode_after_gateways' );
1388
+			do_action('give_payment_mode_after_gateways');
1389 1389
 			?>
1390 1390
 		</div>
1391 1391
 		<?php
@@ -1396,7 +1396,7 @@  discard block
 block discarded – undo
1396 1396
 		 *
1397 1397
 		 * @param int $form_id The form ID.
1398 1398
 		 */
1399
-		do_action( 'give_payment_mode_after_gateways_wrap' );
1399
+		do_action('give_payment_mode_after_gateways_wrap');
1400 1400
 		?>
1401 1401
 	</fieldset>
1402 1402
 
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
 	 *
1409 1409
 	 * @param int $form_id The form ID.
1410 1410
 	 */
1411
-	do_action( 'give_payment_mode_bottom', $form_id );
1411
+	do_action('give_payment_mode_bottom', $form_id);
1412 1412
 	?>
1413 1413
 
1414 1414
 	<div id="give_purchase_form_wrap">
@@ -1419,7 +1419,7 @@  discard block
 block discarded – undo
1419 1419
 		 *
1420 1420
 		 * @since 1.7
1421 1421
 		 */
1422
-		do_action( 'give_donation_form', $form_id );
1422
+		do_action('give_donation_form', $form_id);
1423 1423
 		?>
1424 1424
 
1425 1425
 	</div>
@@ -1430,10 +1430,10 @@  discard block
 block discarded – undo
1430 1430
 	 *
1431 1431
 	 * @since 1.7
1432 1432
 	 */
1433
-	do_action( 'give_donation_form_wrap_bottom', $form_id );
1433
+	do_action('give_donation_form_wrap_bottom', $form_id);
1434 1434
 }
1435 1435
 
1436
-add_action( 'give_payment_mode_select', 'give_payment_mode_select' );
1436
+add_action('give_payment_mode_select', 'give_payment_mode_select');
1437 1437
 
1438 1438
 /**
1439 1439
  * Renders the Checkout Agree to Terms, this displays a checkbox for users to
@@ -1446,31 +1446,31 @@  discard block
 block discarded – undo
1446 1446
  *
1447 1447
  * @return bool
1448 1448
  */
1449
-function give_terms_agreement( $form_id ) {
1450
-	$form_option = give_get_meta( $form_id, '_give_terms_option', true );
1449
+function give_terms_agreement($form_id) {
1450
+	$form_option = give_get_meta($form_id, '_give_terms_option', true);
1451 1451
 
1452 1452
 	// Bailout if per form and global term and conditions is not setup.
1453 1453
 	if (
1454
-		give_is_setting_enabled( $form_option, 'global' )
1455
-		&& give_is_setting_enabled( give_get_option( 'terms' ) )
1454
+		give_is_setting_enabled($form_option, 'global')
1455
+		&& give_is_setting_enabled(give_get_option('terms'))
1456 1456
 	) {
1457
-		$label         = give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) );
1458
-		$terms         = $terms = give_get_option( 'agreement_text', '' );
1459
-		$edit_term_url = admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=display&section=term-and-conditions' );
1457
+		$label         = give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give'));
1458
+		$terms         = $terms = give_get_option('agreement_text', '');
1459
+		$edit_term_url = admin_url('edit.php?post_type=give_forms&page=give-settings&tab=display&section=term-and-conditions');
1460 1460
 
1461
-	} elseif ( give_is_setting_enabled( $form_option ) ) {
1462
-		$label         = ( $label = give_get_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' );
1463
-		$terms         = give_get_meta( $form_id, '_give_agree_text', true );
1464
-		$edit_term_url = admin_url( 'post.php?post=' . $form_id . '&action=edit#form_terms_options' );
1461
+	} elseif (give_is_setting_enabled($form_option)) {
1462
+		$label         = ($label = give_get_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give');
1463
+		$terms         = give_get_meta($form_id, '_give_agree_text', true);
1464
+		$edit_term_url = admin_url('post.php?post='.$form_id.'&action=edit#form_terms_options');
1465 1465
 
1466 1466
 	} else {
1467 1467
 		return false;
1468 1468
 	}
1469 1469
 
1470 1470
 	// Bailout: Check if term and conditions text is empty or not.
1471
-	if ( empty( $terms ) ) {
1472
-		if ( is_user_logged_in() && current_user_can( 'edit_give_forms' ) ) {
1473
-			echo sprintf( __( 'Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), $edit_term_url );
1471
+	if (empty($terms)) {
1472
+		if (is_user_logged_in() && current_user_can('edit_give_forms')) {
1473
+			echo sprintf(__('Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give'), $edit_term_url);
1474 1474
 		}
1475 1475
 
1476 1476
 		return false;
@@ -1478,7 +1478,7 @@  discard block
 block discarded – undo
1478 1478
 
1479 1479
 	?>
1480 1480
 	<fieldset id="give_terms_agreement">
1481
-		<legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend>
1481
+		<legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend>
1482 1482
 		<div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;">
1483 1483
 			<?php
1484 1484
 			/**
@@ -1486,22 +1486,22 @@  discard block
 block discarded – undo
1486 1486
 			 *
1487 1487
 			 * @since 1.0
1488 1488
 			 */
1489
-			do_action( 'give_before_terms' );
1489
+			do_action('give_before_terms');
1490 1490
 
1491
-			echo wpautop( stripslashes( $terms ) );
1491
+			echo wpautop(stripslashes($terms));
1492 1492
 			/**
1493 1493
 			 * Fires while rendering terms of agreement, after the fields.
1494 1494
 			 *
1495 1495
 			 * @since 1.0
1496 1496
 			 */
1497
-			do_action( 'give_after_terms' );
1497
+			do_action('give_after_terms');
1498 1498
 			?>
1499 1499
 		</div>
1500 1500
 		<div id="give_show_terms">
1501 1501
 			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1502
-			   aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a>
1502
+			   aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a>
1503 1503
 			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1504
-			   aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a>
1504
+			   aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a>
1505 1505
 		</div>
1506 1506
 
1507 1507
 		<input name="give_agree_to_terms" class="required" type="checkbox"
@@ -1512,7 +1512,7 @@  discard block
 block discarded – undo
1512 1512
 	<?php
1513 1513
 }
1514 1514
 
1515
-add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 );
1515
+add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1);
1516 1516
 
1517 1517
 /**
1518 1518
  * Checkout Final Total.
@@ -1525,31 +1525,30 @@  discard block
 block discarded – undo
1525 1525
  *
1526 1526
  * @return void
1527 1527
  */
1528
-function give_checkout_final_total( $form_id ) {
1528
+function give_checkout_final_total($form_id) {
1529 1529
 
1530
-	$total = isset( $_POST['give_total'] ) ?
1531
-		apply_filters( 'give_donation_total', give_maybe_sanitize_amount( $_POST['give_total'] ) ) :
1532
-		give_get_default_form_amount( $form_id );
1530
+	$total = isset($_POST['give_total']) ?
1531
+		apply_filters('give_donation_total', give_maybe_sanitize_amount($_POST['give_total'])) : give_get_default_form_amount($form_id);
1533 1532
 
1534 1533
 
1535 1534
 	// Only proceed if give_total available.
1536
-	if ( empty( $total ) ) {
1535
+	if (empty($total)) {
1537 1536
 		return;
1538 1537
 	}
1539 1538
 	?>
1540 1539
 	<p id="give-final-total-wrap" class="form-wrap ">
1541 1540
 		<span class="give-donation-total-label">
1542
-			<?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?>
1541
+			<?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?>
1543 1542
 		</span>
1544 1543
 		<span class="give-final-total-amount"
1545
-			  data-total="<?php echo give_format_amount( $total, array( 'sanitize' => false ) ); ?>">
1546
-			<?php echo give_currency_filter( give_format_amount( $total, array( 'sanitize' => false ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ); ?>
1544
+			  data-total="<?php echo give_format_amount($total, array('sanitize' => false)); ?>">
1545
+			<?php echo give_currency_filter(give_format_amount($total, array('sanitize' => false)), array('currency_code' => give_get_currency($form_id))); ?>
1547 1546
 		</span>
1548 1547
 	</p>
1549 1548
 	<?php
1550 1549
 }
1551 1550
 
1552
-add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 );
1551
+add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999);
1553 1552
 
1554 1553
 /**
1555 1554
  * Renders the Checkout Submit section.
@@ -1560,7 +1559,7 @@  discard block
 block discarded – undo
1560 1559
  *
1561 1560
  * @return void
1562 1561
  */
1563
-function give_checkout_submit( $form_id ) {
1562
+function give_checkout_submit($form_id) {
1564 1563
 	?>
1565 1564
 	<fieldset id="give_purchase_submit">
1566 1565
 		<?php
@@ -1569,24 +1568,24 @@  discard block
 block discarded – undo
1569 1568
 		 *
1570 1569
 		 * @since 1.7
1571 1570
 		 */
1572
-		do_action( 'give_donation_form_before_submit', $form_id );
1571
+		do_action('give_donation_form_before_submit', $form_id);
1573 1572
 
1574
-		give_checkout_hidden_fields( $form_id );
1573
+		give_checkout_hidden_fields($form_id);
1575 1574
 
1576
-		echo give_get_donation_form_submit_button( $form_id );
1575
+		echo give_get_donation_form_submit_button($form_id);
1577 1576
 
1578 1577
 		/**
1579 1578
 		 * Fire after donation form submit.
1580 1579
 		 *
1581 1580
 		 * @since 1.7
1582 1581
 		 */
1583
-		do_action( 'give_donation_form_after_submit', $form_id );
1582
+		do_action('give_donation_form_after_submit', $form_id);
1584 1583
 		?>
1585 1584
 	</fieldset>
1586 1585
 	<?php
1587 1586
 }
1588 1587
 
1589
-add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 );
1588
+add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999);
1590 1589
 
1591 1590
 /**
1592 1591
  * Give Donation form submit button.
@@ -1597,10 +1596,10 @@  discard block
 block discarded – undo
1597 1596
  *
1598 1597
  * @return string
1599 1598
  */
1600
-function give_get_donation_form_submit_button( $form_id ) {
1599
+function give_get_donation_form_submit_button($form_id) {
1601 1600
 
1602
-	$display_label_field = give_get_meta( $form_id, '_give_checkout_label', true );
1603
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
1601
+	$display_label_field = give_get_meta($form_id, '_give_checkout_label', true);
1602
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
1604 1603
 	ob_start();
1605 1604
 	?>
1606 1605
 	<div class="give-submit-button-wrap give-clearfix">
@@ -1609,7 +1608,7 @@  discard block
 block discarded – undo
1609 1608
 		<span class="give-loading-animation"></span>
1610 1609
 	</div>
1611 1610
 	<?php
1612
-	return apply_filters( 'give_donation_form_submit_button', ob_get_clean(), $form_id );
1611
+	return apply_filters('give_donation_form_submit_button', ob_get_clean(), $form_id);
1613 1612
 }
1614 1613
 
1615 1614
 /**
@@ -1624,22 +1623,22 @@  discard block
 block discarded – undo
1624 1623
  *
1625 1624
  * @return mixed
1626 1625
  */
1627
-function give_show_goal_progress( $form_id, $args ) {
1626
+function give_show_goal_progress($form_id, $args) {
1628 1627
 
1629 1628
 	ob_start();
1630
-	give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) );
1629
+	give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args));
1631 1630
 
1632 1631
 	/**
1633 1632
 	 * Filter progress bar output
1634 1633
 	 *
1635 1634
 	 * @since 2.0
1636 1635
 	 */
1637
-	echo apply_filters( 'give_goal_output', ob_get_clean(), $form_id, $args );
1636
+	echo apply_filters('give_goal_output', ob_get_clean(), $form_id, $args);
1638 1637
 
1639 1638
 	return true;
1640 1639
 }
1641 1640
 
1642
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1641
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1643 1642
 
1644 1643
 
1645 1644
 /**
@@ -1652,10 +1651,10 @@  discard block
 block discarded – undo
1652 1651
  *
1653 1652
  * @return mixed|string
1654 1653
  */
1655
-function give_get_form_content_placement( $form_id, $args ) {
1654
+function give_get_form_content_placement($form_id, $args) {
1656 1655
 	$show_content = '';
1657 1656
 
1658
-	if ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) {
1657
+	if (isset($args['show_content']) && ! empty($args['show_content'])) {
1659 1658
 		// Content positions.
1660 1659
 		$content_placement = array(
1661 1660
 			'above' => 'give_pre_form',
@@ -1663,18 +1662,18 @@  discard block
 block discarded – undo
1663 1662
 		);
1664 1663
 
1665 1664
 		// Check if content position already decoded.
1666
-		if ( in_array( $args['show_content'], $content_placement ) ) {
1665
+		if (in_array($args['show_content'], $content_placement)) {
1667 1666
 			return $args['show_content'];
1668 1667
 		}
1669 1668
 
1670
-		$show_content = ( 'none' !== $args['show_content'] ? $content_placement[ $args['show_content'] ] : '' );
1669
+		$show_content = ('none' !== $args['show_content'] ? $content_placement[$args['show_content']] : '');
1671 1670
 
1672
-	} elseif ( give_is_setting_enabled( give_get_meta( $form_id, '_give_display_content', true ) ) ) {
1673
-		$show_content = give_get_meta( $form_id, '_give_content_placement', true );
1671
+	} elseif (give_is_setting_enabled(give_get_meta($form_id, '_give_display_content', true))) {
1672
+		$show_content = give_get_meta($form_id, '_give_content_placement', true);
1674 1673
 
1675
-	} elseif ( 'none' !== give_get_meta( $form_id, '_give_content_option', true ) ) {
1674
+	} elseif ('none' !== give_get_meta($form_id, '_give_content_option', true)) {
1676 1675
 		// Backward compatibility for _give_content_option for v18.
1677
-		$show_content = give_get_meta( $form_id, '_give_content_option', true );
1676
+		$show_content = give_get_meta($form_id, '_give_content_option', true);
1678 1677
 	}
1679 1678
 
1680 1679
 	return $show_content;
@@ -1690,20 +1689,20 @@  discard block
 block discarded – undo
1690 1689
  *
1691 1690
  * @return void|bool
1692 1691
  */
1693
-function give_form_content( $form_id, $args ) {
1692
+function give_form_content($form_id, $args) {
1694 1693
 
1695
-	$show_content = give_get_form_content_placement( $form_id, $args );
1694
+	$show_content = give_get_form_content_placement($form_id, $args);
1696 1695
 
1697 1696
 	// Bailout.
1698
-	if ( empty( $show_content ) ) {
1697
+	if (empty($show_content)) {
1699 1698
 		return false;
1700 1699
 	}
1701 1700
 
1702 1701
 	// Add action according to value.
1703
-	add_action( $show_content, 'give_form_display_content', 10, 2 );
1702
+	add_action($show_content, 'give_form_display_content', 10, 2);
1704 1703
 }
1705 1704
 
1706
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
1705
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
1707 1706
 
1708 1707
 /**
1709 1708
  * Renders Post Form Content.
@@ -1717,22 +1716,22 @@  discard block
 block discarded – undo
1717 1716
  *
1718 1717
  * @return void
1719 1718
  */
1720
-function give_form_display_content( $form_id, $args ) {
1719
+function give_form_display_content($form_id, $args) {
1721 1720
 
1722
-	$content      = wpautop( give_get_meta( $form_id, '_give_form_content', true ) );
1723
-	$show_content = give_get_form_content_placement( $form_id, $args );
1721
+	$content      = wpautop(give_get_meta($form_id, '_give_form_content', true));
1722
+	$show_content = give_get_form_content_placement($form_id, $args);
1724 1723
 
1725
-	if ( give_is_setting_enabled( give_get_option( 'the_content_filter' ) ) ) {
1726
-		$content = apply_filters( 'the_content', $content );
1724
+	if (give_is_setting_enabled(give_get_option('the_content_filter'))) {
1725
+		$content = apply_filters('the_content', $content);
1727 1726
 	}
1728 1727
 
1729
-	$output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap ' . $show_content . '-content">' . $content . '</div>';
1728
+	$output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap '.$show_content.'-content">'.$content.'</div>';
1730 1729
 
1731
-	echo apply_filters( 'give_form_content_output', $output );
1730
+	echo apply_filters('give_form_content_output', $output);
1732 1731
 
1733 1732
 	// remove action to prevent content output on addition forms on page.
1734 1733
 	// @see: https://github.com/WordImpress/Give/issues/634.
1735
-	remove_action( $show_content, 'give_form_display_content' );
1734
+	remove_action($show_content, 'give_form_display_content');
1736 1735
 }
1737 1736
 
1738 1737
 /**
@@ -1744,7 +1743,7 @@  discard block
 block discarded – undo
1744 1743
  *
1745 1744
  * @return void
1746 1745
  */
1747
-function give_checkout_hidden_fields( $form_id ) {
1746
+function give_checkout_hidden_fields($form_id) {
1748 1747
 
1749 1748
 	/**
1750 1749
 	 * Fires while rendering hidden checkout fields, before the fields.
@@ -1753,13 +1752,13 @@  discard block
 block discarded – undo
1753 1752
 	 *
1754 1753
 	 * @param int $form_id The form ID.
1755 1754
 	 */
1756
-	do_action( 'give_hidden_fields_before', $form_id );
1755
+	do_action('give_hidden_fields_before', $form_id);
1757 1756
 
1758
-	if ( is_user_logged_in() ) { ?>
1757
+	if (is_user_logged_in()) { ?>
1759 1758
 		<input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/>
1760 1759
 	<?php } ?>
1761 1760
 	<input type="hidden" name="give_action" value="purchase"/>
1762
-	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/>
1761
+	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/>
1763 1762
 	<?php
1764 1763
 	/**
1765 1764
 	 * Fires while rendering hidden checkout fields, after the fields.
@@ -1768,7 +1767,7 @@  discard block
 block discarded – undo
1768 1767
 	 *
1769 1768
 	 * @param int $form_id The form ID.
1770 1769
 	 */
1771
-	do_action( 'give_hidden_fields_after', $form_id );
1770
+	do_action('give_hidden_fields_after', $form_id);
1772 1771
 
1773 1772
 }
1774 1773
 
@@ -1783,20 +1782,20 @@  discard block
 block discarded – undo
1783 1782
  *
1784 1783
  * @return string $content Filtered content.
1785 1784
  */
1786
-function give_filter_success_page_content( $content ) {
1785
+function give_filter_success_page_content($content) {
1787 1786
 
1788 1787
 	$give_options = give_get_settings();
1789 1788
 
1790
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
1791
-		if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) {
1792
-			$content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content );
1789
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
1790
+		if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) {
1791
+			$content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content);
1793 1792
 		}
1794 1793
 	}
1795 1794
 
1796 1795
 	return $content;
1797 1796
 }
1798 1797
 
1799
-add_filter( 'the_content', 'give_filter_success_page_content' );
1798
+add_filter('the_content', 'give_filter_success_page_content');
1800 1799
 
1801 1800
 /**
1802 1801
  * Test Mode Frontend Warning.
@@ -1807,12 +1806,12 @@  discard block
 block discarded – undo
1807 1806
  */
1808 1807
 function give_test_mode_frontend_warning() {
1809 1808
 
1810
-	if ( give_is_test_mode() ) {
1811
-		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>';
1809
+	if (give_is_test_mode()) {
1810
+		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>';
1812 1811
 	}
1813 1812
 }
1814 1813
 
1815
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
1814
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
1816 1815
 
1817 1816
 /**
1818 1817
  * Members-only Form.
@@ -1826,21 +1825,21 @@  discard block
 block discarded – undo
1826 1825
  *
1827 1826
  * @return string
1828 1827
  */
1829
-function give_members_only_form( $final_output, $args ) {
1828
+function give_members_only_form($final_output, $args) {
1830 1829
 
1831
-	$form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0;
1830
+	$form_id = isset($args['form_id']) ? $args['form_id'] : 0;
1832 1831
 
1833 1832
 	//Sanity Check: Must have form_id & not be logged in.
1834
-	if ( empty( $form_id ) || is_user_logged_in() ) {
1833
+	if (empty($form_id) || is_user_logged_in()) {
1835 1834
 		return $final_output;
1836 1835
 	}
1837 1836
 
1838 1837
 	//Logged in only and Register / Login set to none.
1839
-	if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) {
1838
+	if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
1840 1839
 
1841
-		$final_output = Give()->notices->print_frontend_notice( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false );
1840
+		$final_output = Give()->notices->print_frontend_notice(esc_html__('Please log in in order to complete your donation.', 'give'), false);
1842 1841
 
1843
-		return apply_filters( 'give_members_only_output', $final_output, $form_id );
1842
+		return apply_filters('give_members_only_output', $final_output, $form_id);
1844 1843
 
1845 1844
 	}
1846 1845
 
@@ -1848,7 +1847,7 @@  discard block
 block discarded – undo
1848 1847
 
1849 1848
 }
1850 1849
 
1851
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 );
1850
+add_filter('give_donate_form', 'give_members_only_form', 10, 2);
1852 1851
 
1853 1852
 
1854 1853
 /**
@@ -1860,28 +1859,28 @@  discard block
 block discarded – undo
1860 1859
  * @param array            $args
1861 1860
  * @param Give_Donate_Form $form
1862 1861
  */
1863
-function __give_form_add_donation_hidden_field( $form_id, $args, $form ) {
1862
+function __give_form_add_donation_hidden_field($form_id, $args, $form) {
1864 1863
 	?>
1865 1864
 	<input type="hidden" name="give-form-id" value="<?php echo $form_id; ?>"/>
1866
-	<input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/>
1865
+	<input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/>
1867 1866
 	<input type="hidden" name="give-current-url"
1868
-		   value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
1869
-	<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
1867
+		   value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
1868
+	<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
1870 1869
 	<input type="hidden" name="give-form-minimum"
1871
-		   value="<?php echo give_format_amount( give_get_form_minimum_price( $form_id ), array( 'sanitize' => false ) ); ?>"/>
1870
+		   value="<?php echo give_format_amount(give_get_form_minimum_price($form_id), array('sanitize' => false)); ?>"/>
1872 1871
 	<?php
1873 1872
 
1874 1873
 	// WP nonce field.
1875
-	wp_nonce_field( "donation_form_nonce_{$form_id}", '_wpnonce', false );
1874
+	wp_nonce_field("donation_form_nonce_{$form_id}", '_wpnonce', false);
1876 1875
 
1877 1876
 	// Price ID hidden field for variable (multi-level) donation forms.
1878
-	if ( give_has_variable_prices( $form_id ) ) {
1877
+	if (give_has_variable_prices($form_id)) {
1879 1878
 		// Get default selected price ID.
1880
-		$prices   = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
1879
+		$prices   = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
1881 1880
 		$price_id = 0;
1882 1881
 		//loop through prices.
1883
-		foreach ( $prices as $price ) {
1884
-			if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
1882
+		foreach ($prices as $price) {
1883
+			if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
1885 1884
 				$price_id = $price['_give_id']['level_id'];
1886 1885
 			};
1887 1886
 		}
@@ -1894,7 +1893,7 @@  discard block
 block discarded – undo
1894 1893
 	}
1895 1894
 }
1896 1895
 
1897
-add_action( 'give_donation_form_top', '__give_form_add_donation_hidden_field', 0, 3 );
1896
+add_action('give_donation_form_top', '__give_form_add_donation_hidden_field', 0, 3);
1898 1897
 
1899 1898
 /**
1900 1899
  * Add currency settings on donation form.
@@ -1906,20 +1905,20 @@  discard block
 block discarded – undo
1906 1905
  *
1907 1906
  * @return array
1908 1907
  */
1909
-function __give_form_add_currency_settings( $form_html_tags, $form ) {
1910
-	$form_currency     = give_get_currency( $form->ID );
1911
-	$currency_settings = give_get_currency_formatting_settings( $form_currency );
1908
+function __give_form_add_currency_settings($form_html_tags, $form) {
1909
+	$form_currency     = give_get_currency($form->ID);
1910
+	$currency_settings = give_get_currency_formatting_settings($form_currency);
1912 1911
 
1913 1912
 	// Check if currency exist.
1914
-	if ( empty( $currency_settings ) ) {
1913
+	if (empty($currency_settings)) {
1915 1914
 		return $form_html_tags;
1916 1915
 	}
1917 1916
 
1918
-	$form_html_tags['data-currency_symbol'] = give_currency_symbol( $form_currency );
1917
+	$form_html_tags['data-currency_symbol'] = give_currency_symbol($form_currency);
1919 1918
 	$form_html_tags['data-currency_code']   = $form_currency;
1920 1919
 
1921
-	if ( ! empty( $currency_settings ) ) {
1922
-		foreach ( $currency_settings as $key => $value ) {
1920
+	if ( ! empty($currency_settings)) {
1921
+		foreach ($currency_settings as $key => $value) {
1923 1922
 			$form_html_tags["data-{$key}"] = $value;
1924 1923
 		}
1925 1924
 	}
@@ -1927,4 +1926,4 @@  discard block
 block discarded – undo
1927 1926
 	return $form_html_tags;
1928 1927
 }
1929 1928
 
1930
-add_filter( 'give_form_html_tags', '__give_form_add_currency_settings', 0, 2 );
1929
+add_filter('give_form_html_tags', '__give_form_add_currency_settings', 0, 2);
Please login to merge, or discard this patch.
includes/process-donation.php 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
 	$is_ajax = isset( $_POST['give_ajax'] );
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
  * @access      private
463 463
  * @since       1.0
464 464
  *
465
- * @param       $form_id
465
+ * @param       integer $form_id
466 466
  *
467 467
  * @return      array
468 468
  */
Please login to merge, or discard this patch.
Spacing   +249 added lines, -250 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,20 +25,20 @@  discard block
 block discarded – undo
25 25
  * @return mixed
26 26
  */
27 27
 function give_process_donation_form() {
28
-	$is_ajax = isset( $_POST['give_ajax'] );
28
+	$is_ajax = isset($_POST['give_ajax']);
29 29
 
30 30
 	// Verify donation form nonce.
31
-	if(  ! give_verify_donation_form_nonce() ) {
32
-		if( $is_ajax ) {
31
+	if ( ! give_verify_donation_form_nonce()) {
32
+		if ($is_ajax) {
33 33
 			/**
34 34
 			 * Fires when AJAX sends back errors from the donation form.
35 35
 			 *
36 36
 			 * @since 1.0
37 37
 			 */
38
-			do_action( 'give_ajax_donation_errors' );
38
+			do_action('give_ajax_donation_errors');
39 39
 			
40 40
 			give_die();
41
-		} else{
41
+		} else {
42 42
 			give_send_back_to_checkout();
43 43
 		}
44 44
 	}
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 *
49 49
 	 * @since 1.0
50 50
 	 */
51
-	do_action( 'give_pre_process_donation' );
51
+	do_action('give_pre_process_donation');
52 52
 
53 53
 	// Validate the form $_POST data.
54 54
 	$valid_data = give_donation_form_validate_fields();
@@ -63,24 +63,24 @@  discard block
 block discarded – undo
63 63
 	 * @param bool|array $valid_data Validate fields.
64 64
 	 * @param array $deprecated Deprecated Since 2.0.2. Use $_POST instead.
65 65
 	 */
66
-	do_action( 'give_checkout_error_checks', $valid_data, $deprecated = $_POST );
66
+	do_action('give_checkout_error_checks', $valid_data, $deprecated = $_POST);
67 67
 
68 68
 	// Process the login form.
69
-	if ( isset( $_POST['give_login_submit'] ) ) {
69
+	if (isset($_POST['give_login_submit'])) {
70 70
 		give_process_form_login();
71 71
 	}
72 72
 
73 73
 	// Validate the user.
74
-	$user = give_get_donation_form_user( $valid_data );
74
+	$user = give_get_donation_form_user($valid_data);
75 75
 
76
-	if ( false === $valid_data || give_get_errors() || ! $user ) {
77
-		if ( $is_ajax ) {
76
+	if (false === $valid_data || give_get_errors() || ! $user) {
77
+		if ($is_ajax) {
78 78
 			/**
79 79
 			 * Fires when AJAX sends back errors from the donation form.
80 80
 			 *
81 81
 			 * @since 1.0
82 82
 			 */
83
-			do_action( 'give_ajax_donation_errors' );
83
+			do_action('give_ajax_donation_errors');
84 84
 			give_die();
85 85
 		} else {
86 86
 			return false;
@@ -88,17 +88,17 @@  discard block
 block discarded – undo
88 88
 	}
89 89
 
90 90
 	// If AJAX send back success to proceed with form submission.
91
-	if ( $is_ajax ) {
91
+	if ($is_ajax) {
92 92
 		echo 'success';
93 93
 		give_die();
94 94
 	}
95 95
 
96 96
 	// After AJAX: Setup session if not using php_sessions.
97
-	if ( ! Give()->session->use_php_sessions() ) {
97
+	if ( ! Give()->session->use_php_sessions()) {
98 98
 		// Double-check that set_cookie is publicly accessible.
99 99
 		// we're using a slightly modified class-wp-sessions.php.
100
-		$session_reflection = new ReflectionMethod( 'WP_Session', 'set_cookie' );
101
-		if ( $session_reflection->isPublic() ) {
100
+		$session_reflection = new ReflectionMethod('WP_Session', 'set_cookie');
101
+		if ($session_reflection->isPublic()) {
102 102
 			// Manually set the cookie.
103 103
 			Give()->session->init()->set_cookie();
104 104
 		}
@@ -113,21 +113,20 @@  discard block
 block discarded – undo
113 113
 		'address'    => $user['address'],
114 114
 	);
115 115
 
116
-	$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
116
+	$auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
117 117
 
118
-	$price        = isset( $_POST['give-amount'] ) ?
119
-		(float) apply_filters( 'give_donation_total', give_maybe_sanitize_amount( $_POST['give-amount'] ) ) :
120
-		'0.00';
121
-	$purchase_key = strtolower( md5( $user['user_email'] . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );
118
+	$price        = isset($_POST['give-amount']) ?
119
+		(float) apply_filters('give_donation_total', give_maybe_sanitize_amount($_POST['give-amount'])) : '0.00';
120
+	$purchase_key = strtolower(md5($user['user_email'].date('Y-m-d H:i:s').$auth_key.uniqid('give', true)));
122 121
 
123 122
 	// Setup donation information.
124 123
 	$donation_data = array(
125 124
 		'price'         => $price,
126 125
 		'purchase_key'  => $purchase_key,
127 126
 		'user_email'    => $user['user_email'],
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 ),
127
+		'date'          => date('Y-m-d H:i:s', current_time('timestamp')),
128
+		'user_info'     => stripslashes_deep($user_info),
129
+		'post_data'     => give_clean($_POST),
131 130
 		'gateway'       => $valid_data['gateway'],
132 131
 		'card_info'     => $valid_data['cc_info'],
133 132
 	);
@@ -146,10 +145,10 @@  discard block
 block discarded – undo
146 145
 	 * @param array $user_info Array containing basic user information.
147 146
 	 * @param bool|array $valid_data Validate fields.
148 147
 	 */
149
-	do_action( 'give_checkout_before_gateway', give_clean( $_POST ), $user_info, $valid_data );
148
+	do_action('give_checkout_before_gateway', give_clean($_POST), $user_info, $valid_data);
150 149
 
151 150
 	// Sanity check for price.
152
-	if ( ! $donation_data['price'] ) {
151
+	if ( ! $donation_data['price']) {
153 152
 		// Revert to manual.
154 153
 		$donation_data['gateway'] = 'manual';
155 154
 		$_POST['give-gateway']    = 'manual';
@@ -160,26 +159,26 @@  discard block
 block discarded – undo
160 159
 	 *
161 160
 	 * @since 1.7
162 161
 	 */
163
-	$donation_data = apply_filters( 'give_donation_data_before_gateway', $donation_data, $valid_data );
162
+	$donation_data = apply_filters('give_donation_data_before_gateway', $donation_data, $valid_data);
164 163
 
165 164
 	// Setup the data we're storing in the donation session.
166 165
 	$session_data = $donation_data;
167 166
 
168 167
 	// Make sure credit card numbers are never stored in sessions.
169
-	unset( $session_data['card_info']['card_number'] );
170
-	unset( $session_data['post_data']['card_number'] );
168
+	unset($session_data['card_info']['card_number']);
169
+	unset($session_data['post_data']['card_number']);
171 170
 
172 171
 	// Used for showing data to non logged-in users after donation, and for other plugins needing donation data.
173
-	give_set_purchase_session( $session_data );
172
+	give_set_purchase_session($session_data);
174 173
 
175 174
 	// Send info to the gateway for payment processing.
176
-	give_send_to_gateway( $donation_data['gateway'], $donation_data );
175
+	give_send_to_gateway($donation_data['gateway'], $donation_data);
177 176
 	give_die();
178 177
 }
179 178
 
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' );
179
+add_action('give_purchase', 'give_process_donation_form');
180
+add_action('wp_ajax_give_process_donation', 'give_process_donation_form');
181
+add_action('wp_ajax_nopriv_give_process_donation', 'give_process_donation_form');
183 182
 
184 183
 /**
185 184
  * Verify that when a logged in user makes a donation that the email address used doesn't belong to a different customer.
@@ -190,29 +189,29 @@  discard block
 block discarded – undo
190 189
  *
191 190
  * @return void
192 191
  */
193
-function give_check_logged_in_user_for_existing_email( $valid_data ) {
192
+function give_check_logged_in_user_for_existing_email($valid_data) {
194 193
 
195 194
 	// Verify that the email address belongs to this customer.
196
-	if ( is_user_logged_in() ) {
195
+	if (is_user_logged_in()) {
197 196
 
198 197
 		$submitted_email = $valid_data['logged_in_user']['user_email'];
199
-		$donor           = new Give_Donor( get_current_user_id(), true );
198
+		$donor           = new Give_Donor(get_current_user_id(), true);
200 199
 
201 200
 		// If this email address is not registered with this customer, see if it belongs to any other customer.
202 201
 		if (
203 202
 			$submitted_email !== $donor->email
204
-			&& ( is_array( $donor->emails ) && ! in_array( $submitted_email, $donor->emails ) )
203
+			&& (is_array($donor->emails) && ! in_array($submitted_email, $donor->emails))
205 204
 		) {
206
-			$found_donor = new Give_Donor( $submitted_email );
205
+			$found_donor = new Give_Donor($submitted_email);
207 206
 
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 ) );
207
+			if ($found_donor->id > 0) {
208
+				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));
210 209
 			}
211 210
 		}
212 211
 	}
213 212
 }
214 213
 
215
-add_action( 'give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 1 );
214
+add_action('give_checkout_error_checks', 'give_check_logged_in_user_for_existing_email', 10, 1);
216 215
 
217 216
 /**
218 217
  * Process the checkout login form
@@ -222,49 +221,49 @@  discard block
 block discarded – undo
222 221
  * @return      void
223 222
  */
224 223
 function give_process_form_login() {
225
-	$is_ajax = isset( $_POST['give_ajax'] );
224
+	$is_ajax = isset($_POST['give_ajax']);
226 225
 
227 226
 	$user_data = give_donation_form_validate_user_login();
228 227
 
229
-	if ( give_get_errors() || $user_data['user_id'] < 1 ) {
230
-		if ( $is_ajax ) {
228
+	if (give_get_errors() || $user_data['user_id'] < 1) {
229
+		if ($is_ajax) {
231 230
 			/**
232 231
 			 * Fires when AJAX sends back errors from the donation form.
233 232
 			 *
234 233
 			 * @since 1.0
235 234
 			 */
236 235
 			ob_start();
237
-			do_action( 'give_ajax_donation_errors' );
236
+			do_action('give_ajax_donation_errors');
238 237
 			$message = ob_get_contents();
239 238
 			ob_end_clean();
240
-			wp_send_json_error( $message );
239
+			wp_send_json_error($message);
241 240
 		} else {
242
-			wp_redirect( $_SERVER['HTTP_REFERER'] );
241
+			wp_redirect($_SERVER['HTTP_REFERER']);
243 242
 			exit;
244 243
 		}
245 244
 	}
246 245
 
247
-	give_log_user_in( $user_data['user_id'], $user_data['user_login'], $user_data['user_pass'] );
246
+	give_log_user_in($user_data['user_id'], $user_data['user_login'], $user_data['user_pass']);
248 247
 
249
-	if ( $is_ajax ) {
248
+	if ($is_ajax) {
250 249
 		$message = Give()->notices->print_frontend_notice(
251 250
 			sprintf(
252 251
 			/* translators: %s: user first name */
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']
252
+				esc_html__('Welcome %s! You have successfully logged into your account.', 'give'),
253
+				( ! empty($user_data['user_first'])) ? $user_data['user_first'] : $user_data['user_login']
255 254
 			),
256 255
 			false,
257 256
 			'success'
258 257
 		);
259 258
 
260
-		wp_send_json_success( $message );
259
+		wp_send_json_success($message);
261 260
 	} else {
262
-		wp_redirect( $_SERVER['HTTP_REFERER'] );
261
+		wp_redirect($_SERVER['HTTP_REFERER']);
263 262
 	}
264 263
 }
265 264
 
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' );
265
+add_action('wp_ajax_give_process_donation_login', 'give_process_form_login');
266
+add_action('wp_ajax_nopriv_give_process_donation_login', 'give_process_form_login');
268 267
 
269 268
 /**
270 269
  * Donation Form Validate Fields.
@@ -276,52 +275,52 @@  discard block
 block discarded – undo
276 275
 function give_donation_form_validate_fields() {
277 276
 
278 277
 	// Check if there is $_POST.
279
-	if ( empty( $_POST ) ) {
278
+	if (empty($_POST)) {
280 279
 		return false;
281 280
 	}
282 281
 
283
-	$form_id = ! empty( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
282
+	$form_id = ! empty($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
284 283
 
285 284
 	// Start an array to collect valid data.
286 285
 	$valid_data = array(
287 286
 		'gateway'          => give_donation_form_validate_gateway(), // Gateway fallback (amount is validated here).
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.
287
+		'need_new_user'    => false, // New user flag.
288
+		'need_user_login'  => false, // Login user flag.
289
+		'logged_user_data' => array(), // Logged user collected data.
290
+		'new_user_data'    => array(), // New user collected data.
291
+		'login_user_data'  => array(), // Login user collected data.
292
+		'guest_user_data'  => array(), // Guest user collected data.
293
+		'cc_info'          => give_donation_form_validate_cc(), // Credit card info.
295 294
 	);
296 295
 
297 296
 	// Validate Honeypot First.
298
-	if ( ! empty( $_POST['give-honeypot'] ) ) {
299
-		give_set_error( 'invalid_honeypot', esc_html__( 'Honeypot field detected. Go away bad bot!', 'give' ) );
297
+	if ( ! empty($_POST['give-honeypot'])) {
298
+		give_set_error('invalid_honeypot', esc_html__('Honeypot field detected. Go away bad bot!', 'give'));
300 299
 	}
301 300
 
302 301
 	// Check spam detect.
303
-	if ( isset( $_POST['action'] )
304
-	     && give_is_setting_enabled( give_get_option( 'akismet_spam_protection' ) )
302
+	if (isset($_POST['action'])
303
+	     && give_is_setting_enabled(give_get_option('akismet_spam_protection'))
305 304
 	     && give_is_spam_donation()
306 305
 	) {
307
-		give_set_error( 'invalid_donation', __( 'This donation has been flagged as spam. Please try again.', 'give' ) );
306
+		give_set_error('invalid_donation', __('This donation has been flagged as spam. Please try again.', 'give'));
308 307
 	}
309 308
 
310 309
 	// Validate agree to terms.
311
-	if ( give_is_terms_enabled( $form_id ) ) {
310
+	if (give_is_terms_enabled($form_id)) {
312 311
 		give_donation_form_validate_agree_to_terms();
313 312
 	}
314 313
 
315
-	if ( is_user_logged_in() ) {
314
+	if (is_user_logged_in()) {
316 315
 		// Collect logged in user data.
317 316
 		$valid_data['logged_in_user'] = give_donation_form_validate_logged_in_user();
318
-	} elseif ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-register' && ! empty( $_POST['give_create_account'] ) ) {
317
+	} elseif (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-register' && ! empty($_POST['give_create_account'])) {
319 318
 		// Set new user registration as required.
320 319
 		$valid_data['need_new_user'] = true;
321 320
 		// Validate new user data.
322 321
 		$valid_data['new_user_data'] = give_donation_form_validate_new_user();
323 322
 		// Check if login validation is needed.
324
-	} elseif ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-login' ) {
323
+	} elseif (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-login') {
325 324
 		// Set user login as required.
326 325
 		$valid_data['need_user_login'] = true;
327 326
 		// Validate users login info.
@@ -345,14 +344,14 @@  discard block
 block discarded – undo
345 344
 function give_is_spam_donation() {
346 345
 	$spam = false;
347 346
 
348
-	$user_agent = (string) isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '';
347
+	$user_agent = (string) isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
349 348
 
350
-	if ( strlen( $user_agent ) < 2 ) {
349
+	if (strlen($user_agent) < 2) {
351 350
 		$spam = true;
352 351
 	}
353 352
 
354 353
 	// Allow developer to customized Akismet spam detect API call and it's response.
355
-	return apply_filters( 'give_spam', $spam );
354
+	return apply_filters('give_spam', $spam);
356 355
 }
357 356
 
358 357
 /**
@@ -366,41 +365,41 @@  discard block
 block discarded – undo
366 365
  */
367 366
 function give_donation_form_validate_gateway() {
368 367
 
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 );
368
+	$form_id = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
369
+	$amount  = isset($_REQUEST['give-amount']) ? give_maybe_sanitize_amount($_REQUEST['give-amount']) : 0;
370
+	$gateway = give_get_default_gateway($form_id);
372 371
 
373 372
 	// Check if a gateway value is present.
374
-	if ( ! empty( $_REQUEST['give-gateway'] ) ) {
373
+	if ( ! empty($_REQUEST['give-gateway'])) {
375 374
 
376
-		$gateway = sanitize_text_field( $_REQUEST['give-gateway'] );
375
+		$gateway = sanitize_text_field($_REQUEST['give-gateway']);
377 376
 
378 377
 		// Is amount being donated in LIVE mode 0.00? If so, error:
379
-		if ( $amount == 0 && ! give_is_test_mode() ) {
378
+		if ($amount == 0 && ! give_is_test_mode()) {
380 379
 
381
-			give_set_error( 'invalid_donation_amount', __( 'Please insert a valid donation amount.', 'give' ) );
380
+			give_set_error('invalid_donation_amount', __('Please insert a valid donation amount.', 'give'));
382 381
 
383 382
 		} // End if().
384
-		elseif ( ! give_verify_minimum_price() ) {
383
+		elseif ( ! give_verify_minimum_price()) {
385 384
 			// translators: %s: minimum donation amount.
386 385
 			give_set_error(
387 386
 				'invalid_donation_minimum',
388 387
 				sprintf(
389 388
 				/* translators: %s: minimum donation amount */
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 ) ) )
389
+					__('This form has a minimum donation amount of %s.', 'give'),
390
+					give_currency_filter(give_format_amount(give_get_form_minimum_price($form_id), array('sanitize' => false)))
392 391
 				)
393 392
 			);
394 393
 
395 394
 		} //Is this test mode zero donation? Let it through but set to manual gateway.
396
-		elseif ( $amount == 0 && give_is_test_mode() ) {
395
+		elseif ($amount == 0 && give_is_test_mode()) {
397 396
 
398 397
 			$gateway = 'manual';
399 398
 
400 399
 		} //Check if this gateway is active.
401
-		elseif ( ! give_is_gateway_active( $gateway ) ) {
400
+		elseif ( ! give_is_gateway_active($gateway)) {
402 401
 
403
-			give_set_error( 'invalid_gateway', __( 'The selected payment gateway is not enabled.', 'give' ) );
402
+			give_set_error('invalid_gateway', __('The selected payment gateway is not enabled.', 'give'));
404 403
 
405 404
 		}
406 405
 	}
@@ -418,21 +417,21 @@  discard block
 block discarded – undo
418 417
  */
419 418
 function give_verify_minimum_price() {
420 419
 
421
-	$amount          = give_maybe_sanitize_amount( $_REQUEST['give-amount'] );
422
-	$form_id         = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
423
-	$price_id        = isset( $_REQUEST['give-price-id'] ) ? $_REQUEST['give-price-id'] : null;
424
-	$variable_prices = give_has_variable_prices( $form_id );
420
+	$amount          = give_maybe_sanitize_amount($_REQUEST['give-amount']);
421
+	$form_id         = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
422
+	$price_id        = isset($_REQUEST['give-price-id']) ? $_REQUEST['give-price-id'] : null;
423
+	$variable_prices = give_has_variable_prices($form_id);
425 424
 
426
-	if ( $variable_prices && in_array( $price_id, give_get_variable_price_ids( $form_id ) ) ) {
425
+	if ($variable_prices && in_array($price_id, give_get_variable_price_ids($form_id))) {
427 426
 
428
-		$price_level_amount = give_get_price_option_amount( $form_id, $price_id );
427
+		$price_level_amount = give_get_price_option_amount($form_id, $price_id);
429 428
 
430
-		if ( $price_level_amount == $amount ) {
429
+		if ($price_level_amount == $amount) {
431 430
 			return true;
432 431
 		}
433 432
 	}
434 433
 
435
-	if ( give_get_form_minimum_price( $form_id ) > $amount ) {
434
+	if (give_get_form_minimum_price($form_id) > $amount) {
436 435
 		return false;
437 436
 	}
438 437
 
@@ -448,9 +447,9 @@  discard block
 block discarded – undo
448 447
  */
449 448
 function give_donation_form_validate_agree_to_terms() {
450 449
 	// Validate agree to terms.
451
-	if ( ! isset( $_POST['give_agree_to_terms'] ) || $_POST['give_agree_to_terms'] != 1 ) {
450
+	if ( ! isset($_POST['give_agree_to_terms']) || $_POST['give_agree_to_terms'] != 1) {
452 451
 		// User did not agree.
453
-		give_set_error( 'agree_to_terms', apply_filters( 'give_agree_to_terms_text', __( 'You must agree to the terms and conditions.', 'give' ) ) );
452
+		give_set_error('agree_to_terms', apply_filters('give_agree_to_terms_text', __('You must agree to the terms and conditions.', 'give')));
454 453
 	}
455 454
 }
456 455
 
@@ -464,59 +463,59 @@  discard block
 block discarded – undo
464 463
  *
465 464
  * @return      array
466 465
  */
467
-function give_get_required_fields( $form_id ) {
466
+function give_get_required_fields($form_id) {
468 467
 
469
-	$payment_mode = give_get_chosen_gateway( $form_id );
468
+	$payment_mode = give_get_chosen_gateway($form_id);
470 469
 
471 470
 	$required_fields = array(
472 471
 		'give_email' => array(
473 472
 			'error_id'      => 'invalid_email',
474
-			'error_message' => __( 'Please enter a valid email address.', 'give' ),
473
+			'error_message' => __('Please enter a valid email address.', 'give'),
475 474
 		),
476 475
 		'give_first' => array(
477 476
 			'error_id'      => 'invalid_first_name',
478
-			'error_message' => __( 'Please enter your first name.', 'give' ),
477
+			'error_message' => __('Please enter your first name.', 'give'),
479 478
 		),
480 479
 	);
481 480
 
482
-	$require_address = give_require_billing_address( $payment_mode );
481
+	$require_address = give_require_billing_address($payment_mode);
483 482
 
484
-	if ( $require_address ) {
485
-		$required_fields['card_address']    = array(
483
+	if ($require_address) {
484
+		$required_fields['card_address'] = array(
486 485
 			'error_id'      => 'invalid_card_address',
487
-			'error_message' => __( 'Please enter your primary billing address.', 'give' ),
486
+			'error_message' => __('Please enter your primary billing address.', 'give'),
488 487
 		);
489
-		$required_fields['card_zip']        = array(
488
+		$required_fields['card_zip'] = array(
490 489
 			'error_id'      => 'invalid_zip_code',
491
-			'error_message' => __( 'Please enter your zip / postal code.', 'give' ),
490
+			'error_message' => __('Please enter your zip / postal code.', 'give'),
492 491
 		);
493
-		$required_fields['card_city']       = array(
492
+		$required_fields['card_city'] = array(
494 493
 			'error_id'      => 'invalid_city',
495
-			'error_message' => __( 'Please enter your billing city.', 'give' ),
494
+			'error_message' => __('Please enter your billing city.', 'give'),
496 495
 		);
497 496
 		$required_fields['billing_country'] = array(
498 497
 			'error_id'      => 'invalid_country',
499
-			'error_message' => __( 'Please select your billing country.', 'give' ),
498
+			'error_message' => __('Please select your billing country.', 'give'),
500 499
 		);
501 500
 
502 501
 
503 502
 		$required_fields['card_state'] = array(
504 503
 			'error_id'      => 'invalid_state',
505
-			'error_message' => __( 'Please enter billing state / province / County.', 'give' ),
504
+			'error_message' => __('Please enter billing state / province / County.', 'give'),
506 505
 		);
507 506
 
508 507
 		// Check if billing country already exists.
509
-		if ( ! empty( $_POST['billing_country'] ) ) {
508
+		if ( ! empty($_POST['billing_country'])) {
510 509
 			// Get the value from $_POST.
511
-			$country = sanitize_text_field( $_POST['billing_country'] );
510
+			$country = sanitize_text_field($_POST['billing_country']);
512 511
 
513 512
 			// Get the country list that does not required any states init.
514 513
 			$states_country = give_states_not_required_country_list();
515 514
 
516 515
 			// Check if states is empty or not.
517
-			if ( array_key_exists( $country, $states_country ) ) {
516
+			if (array_key_exists($country, $states_country)) {
518 517
 				// If states is empty remove the required feilds of state in billing cart.
519
-				unset( $required_fields['card_state'] );
518
+				unset($required_fields['card_state']);
520 519
 			}
521 520
 		}
522 521
 	}
@@ -526,7 +525,7 @@  discard block
 block discarded – undo
526 525
 	 *
527 526
 	 * @since 1.7
528 527
 	 */
529
-	$required_fields = apply_filters( 'give_donation_form_required_fields', $required_fields, $form_id );
528
+	$required_fields = apply_filters('give_donation_form_required_fields', $required_fields, $form_id);
530 529
 
531 530
 	return $required_fields;
532 531
 
@@ -541,16 +540,16 @@  discard block
 block discarded – undo
541 540
  *
542 541
  * @return bool
543 542
  */
544
-function give_require_billing_address( $payment_mode ) {
543
+function give_require_billing_address($payment_mode) {
545 544
 
546 545
 	$return = false;
547 546
 
548
-	if ( isset( $_POST['billing_country'] ) || did_action( "give_{$payment_mode}_cc_form" ) || did_action( 'give_cc_form' ) ) {
547
+	if (isset($_POST['billing_country']) || did_action("give_{$payment_mode}_cc_form") || did_action('give_cc_form')) {
549 548
 		$return = true;
550 549
 	}
551 550
 
552 551
 	// Let payment gateways and other extensions determine if address fields should be required.
553
-	return apply_filters( 'give_require_billing_address', $return );
552
+	return apply_filters('give_require_billing_address', $return);
554 553
 
555 554
 }
556 555
 
@@ -564,38 +563,38 @@  discard block
 block discarded – undo
564 563
 function give_donation_form_validate_logged_in_user() {
565 564
 	global $user_ID;
566 565
 
567
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
566
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
568 567
 
569 568
 	// Start empty array to collect valid user data.
570 569
 	$valid_user_data = array(
571 570
 		// Assume there will be errors.
572
-		'user_id' => - 1,
571
+		'user_id' => -1,
573 572
 	);
574 573
 
575 574
 	// Verify there is a user_ID.
576
-	if ( $user_ID > 0 ) {
575
+	if ($user_ID > 0) {
577 576
 		// Get the logged in user data.
578
-		$user_data = get_userdata( $user_ID );
577
+		$user_data = get_userdata($user_ID);
579 578
 
580 579
 		// Validate Required Form Fields.
581
-		give_validate_required_form_fields( $form_id );
580
+		give_validate_required_form_fields($form_id);
582 581
 
583 582
 		// Verify data.
584
-		if ( $user_data ) {
583
+		if ($user_data) {
585 584
 			// Collected logged in user data.
586 585
 			$valid_user_data = array(
587 586
 				'user_id'    => $user_ID,
588
-				'user_email' => isset( $_POST['give_email'] ) ? sanitize_email( $_POST['give_email'] ) : $user_data->user_email,
589
-				'user_first' => isset( $_POST['give_first'] ) && ! empty( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : $user_data->first_name,
590
-				'user_last'  => isset( $_POST['give_last'] ) && ! empty( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : $user_data->last_name,
587
+				'user_email' => isset($_POST['give_email']) ? sanitize_email($_POST['give_email']) : $user_data->user_email,
588
+				'user_first' => isset($_POST['give_first']) && ! empty($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : $user_data->first_name,
589
+				'user_last'  => isset($_POST['give_last']) && ! empty($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : $user_data->last_name,
591 590
 			);
592 591
 
593
-			if ( ! is_email( $valid_user_data['user_email'] ) ) {
594
-				give_set_error( 'email_invalid', esc_html__( 'Invalid email.', 'give' ) );
592
+			if ( ! is_email($valid_user_data['user_email'])) {
593
+				give_set_error('email_invalid', esc_html__('Invalid email.', 'give'));
595 594
 			}
596 595
 		} else {
597 596
 			// Set invalid user error.
598
-			give_set_error( 'invalid_user', esc_html__( 'The user information is invalid.', 'give' ) );
597
+			give_set_error('invalid_user', esc_html__('The user information is invalid.', 'give'));
599 598
 		}
600 599
 	}
601 600
 
@@ -617,7 +616,7 @@  discard block
 block discarded – undo
617 616
 	// Default user data.
618 617
 	$default_user_data = array(
619 618
 		'give-form-id'           => '',
620
-		'user_id'                => - 1, // Assume there will be errors.
619
+		'user_id'                => -1, // Assume there will be errors.
621 620
 		'user_first'             => '',
622 621
 		'user_last'              => '',
623 622
 		'give_user_login'        => false,
@@ -627,14 +626,14 @@  discard block
 block discarded – undo
627 626
 	);
628 627
 
629 628
 	// Get user data.
630
-	$user_data            = wp_parse_args( give_clean( $_POST ), $default_user_data );
629
+	$user_data            = wp_parse_args(give_clean($_POST), $default_user_data);
631 630
 	$registering_new_user = false;
632
-	$form_id              = absint( $user_data['give-form-id'] );
631
+	$form_id              = absint($user_data['give-form-id']);
633 632
 
634 633
 	// Start an empty array to collect valid user data.
635 634
 	$valid_user_data = array(
636 635
 		// Assume there will be errors.
637
-		'user_id'    => - 1,
636
+		'user_id'    => -1,
638 637
 
639 638
 		// Get first name.
640 639
 		'user_first' => $user_data['give_first'],
@@ -647,13 +646,13 @@  discard block
 block discarded – undo
647 646
 	);
648 647
 
649 648
 	// Validate Required Form Fields.
650
-	give_validate_required_form_fields( $form_id );
649
+	give_validate_required_form_fields($form_id);
651 650
 
652 651
 	// Set Email as Username.
653 652
 	$valid_user_data['user_login'] = $user_data['give_email'];
654 653
 
655 654
 	// Check if we have an email to verify.
656
-	if ( give_validate_user_email( $user_data['give_email'], $registering_new_user ) ) {
655
+	if (give_validate_user_email($user_data['give_email'], $registering_new_user)) {
657 656
 		$valid_user_data['user_email'] = $user_data['give_email'];
658 657
 	}
659 658
 
@@ -672,36 +671,36 @@  discard block
 block discarded – undo
672 671
 	// Start an array to collect valid user data.
673 672
 	$valid_user_data = array(
674 673
 		// Assume there will be errors.
675
-		'user_id' => - 1,
674
+		'user_id' => -1,
676 675
 	);
677 676
 
678 677
 	// Username.
679
-	if ( ! isset( $_POST['give_user_login'] ) || $_POST['give_user_login'] == '' ) {
680
-		give_set_error( 'must_log_in', __( 'You must register or login to complete your donation.', 'give' ) );
678
+	if ( ! isset($_POST['give_user_login']) || $_POST['give_user_login'] == '') {
679
+		give_set_error('must_log_in', __('You must register or login to complete your donation.', 'give'));
681 680
 
682 681
 		return $valid_user_data;
683 682
 	}
684 683
 
685 684
 	// Get the user by login.
686
-	$user_data = get_user_by( 'login', strip_tags( $_POST['give_user_login'] ) );
685
+	$user_data = get_user_by('login', strip_tags($_POST['give_user_login']));
687 686
 
688 687
 	// Check if user exists.
689
-	if ( $user_data ) {
688
+	if ($user_data) {
690 689
 		// Get password.
691
-		$user_pass = isset( $_POST['give_user_pass'] ) ? $_POST['give_user_pass'] : false;
690
+		$user_pass = isset($_POST['give_user_pass']) ? $_POST['give_user_pass'] : false;
692 691
 
693 692
 		// Check user_pass.
694
-		if ( $user_pass ) {
693
+		if ($user_pass) {
695 694
 			// Check if password is valid.
696
-			if ( ! wp_check_password( $user_pass, $user_data->user_pass, $user_data->ID ) ) {
695
+			if ( ! wp_check_password($user_pass, $user_data->user_pass, $user_data->ID)) {
697 696
 				// Incorrect password.
698 697
 				give_set_error(
699 698
 					'password_incorrect',
700 699
 					sprintf(
701 700
 						'%1$s <a href="%2$s">%3$s</a>',
702
-						__( 'The password you entered is incorrect.', 'give' ),
703
-						wp_lostpassword_url( "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" ),
704
-						__( 'Reset Password', 'give' )
701
+						__('The password you entered is incorrect.', 'give'),
702
+						wp_lostpassword_url("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"),
703
+						__('Reset Password', 'give')
705 704
 					)
706 705
 				);
707 706
 				// All is correct.
@@ -719,11 +718,11 @@  discard block
 block discarded – undo
719 718
 			}
720 719
 		} else {
721 720
 			// Empty password.
722
-			give_set_error( 'password_empty', __( 'Enter a password.', 'give' ) );
721
+			give_set_error('password_empty', __('Enter a password.', 'give'));
723 722
 		}
724 723
 	} else {
725 724
 		// No username.
726
-		give_set_error( 'username_incorrect', __( 'The username you entered does not exist.', 'give' ) );
725
+		give_set_error('username_incorrect', __('The username you entered does not exist.', 'give'));
727 726
 	}// End if().
728 727
 
729 728
 	return $valid_user_data;
@@ -738,7 +737,7 @@  discard block
 block discarded – undo
738 737
  */
739 738
 function give_donation_form_validate_guest_user() {
740 739
 
741
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
740
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
742 741
 
743 742
 	// Start an array to collect valid user data.
744 743
 	$valid_user_data = array(
@@ -747,31 +746,31 @@  discard block
 block discarded – undo
747 746
 	);
748 747
 
749 748
 	// Get the guest email.
750
-	$guest_email = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false;
749
+	$guest_email = isset($_POST['give_email']) ? $_POST['give_email'] : false;
751 750
 
752 751
 	// Check email.
753
-	if ( $guest_email && strlen( $guest_email ) > 0 ) {
752
+	if ($guest_email && strlen($guest_email) > 0) {
754 753
 		// Validate email.
755
-		if ( ! is_email( $guest_email ) ) {
754
+		if ( ! is_email($guest_email)) {
756 755
 			// Invalid email.
757
-			give_set_error( 'email_invalid', __( 'Invalid email.', 'give' ) );
756
+			give_set_error('email_invalid', __('Invalid email.', 'give'));
758 757
 		} else {
759 758
 			// All is good to go.
760 759
 			$valid_user_data['user_email'] = $guest_email;
761 760
 
762 761
 			// Get user_id from donor if exist.
763
-			$donor = new Give_Donor( $guest_email );
764
-			if ( $donor->id && $donor->user_id ) {
762
+			$donor = new Give_Donor($guest_email);
763
+			if ($donor->id && $donor->user_id) {
765 764
 				$valid_user_data['user_id'] = $donor->user_id;
766 765
 			}
767 766
 		}
768 767
 	} else {
769 768
 		// No email.
770
-		give_set_error( 'email_empty', __( 'Enter an email.', 'give' ) );
769
+		give_set_error('email_empty', __('Enter an email.', 'give'));
771 770
 	}
772 771
 
773 772
 	// Validate Required Form Fields.
774
-	give_validate_required_form_fields( $form_id );
773
+	give_validate_required_form_fields($form_id);
775 774
 
776 775
 	return $valid_user_data;
777 776
 }
@@ -785,36 +784,36 @@  discard block
 block discarded – undo
785 784
  * @since   1.0
786 785
  * @return  integer
787 786
  */
788
-function give_register_and_login_new_user( $user_data = array() ) {
787
+function give_register_and_login_new_user($user_data = array()) {
789 788
 	// Verify the array.
790
-	if ( empty( $user_data ) ) {
791
-		return - 1;
789
+	if (empty($user_data)) {
790
+		return -1;
792 791
 	}
793 792
 
794
-	if ( give_get_errors() ) {
795
-		return - 1;
793
+	if (give_get_errors()) {
794
+		return -1;
796 795
 	}
797 796
 
798
-	$user_args = apply_filters( 'give_insert_user_args', array(
799
-		'user_login'      => isset( $user_data['user_login'] ) ? $user_data['user_login'] : '',
800
-		'user_pass'       => isset( $user_data['user_pass'] ) ? $user_data['user_pass'] : '',
801
-		'user_email'      => isset( $user_data['user_email'] ) ? $user_data['user_email'] : '',
802
-		'first_name'      => isset( $user_data['user_first'] ) ? $user_data['user_first'] : '',
803
-		'last_name'       => isset( $user_data['user_last'] ) ? $user_data['user_last'] : '',
804
-		'user_registered' => date( 'Y-m-d H:i:s' ),
805
-		'role'            => give_get_option( 'donor_default_user_role', 'give_donor' ),
806
-	), $user_data );
797
+	$user_args = apply_filters('give_insert_user_args', array(
798
+		'user_login'      => isset($user_data['user_login']) ? $user_data['user_login'] : '',
799
+		'user_pass'       => isset($user_data['user_pass']) ? $user_data['user_pass'] : '',
800
+		'user_email'      => isset($user_data['user_email']) ? $user_data['user_email'] : '',
801
+		'first_name'      => isset($user_data['user_first']) ? $user_data['user_first'] : '',
802
+		'last_name'       => isset($user_data['user_last']) ? $user_data['user_last'] : '',
803
+		'user_registered' => date('Y-m-d H:i:s'),
804
+		'role'            => give_get_option('donor_default_user_role', 'give_donor'),
805
+	), $user_data);
807 806
 
808 807
 	// Insert new user.
809
-	$user_id = wp_insert_user( $user_args );
808
+	$user_id = wp_insert_user($user_args);
810 809
 
811 810
 	// Validate inserted user.
812
-	if ( is_wp_error( $user_id ) ) {
813
-		return - 1;
811
+	if (is_wp_error($user_id)) {
812
+		return -1;
814 813
 	}
815 814
 
816 815
 	// Allow themes and plugins to filter the user data.
817
-	$user_data = apply_filters( 'give_insert_user_data', $user_data, $user_args );
816
+	$user_data = apply_filters('give_insert_user_data', $user_data, $user_args);
818 817
 
819 818
 	/**
820 819
 	 * Fires after inserting user.
@@ -824,7 +823,7 @@  discard block
 block discarded – undo
824 823
 	 * @param int $user_id User id.
825 824
 	 * @param array $user_data Array containing user data.
826 825
 	 */
827
-	do_action( 'give_insert_user', $user_id, $user_data );
826
+	do_action('give_insert_user', $user_id, $user_data);
828 827
 
829 828
 	/**
830 829
 	 * Filter allow user to alter if user when to login or not when user is register for the first time.
@@ -833,9 +832,9 @@  discard block
 block discarded – undo
833 832
 	 *
834 833
 	 * return bool True if login with registration and False if only want to register.
835 834
 	 */
836
-	if ( true === (bool) apply_filters( 'give_log_user_in_on_register', true ) ) {
835
+	if (true === (bool) apply_filters('give_log_user_in_on_register', true)) {
837 836
 		// Login new user.
838
-		give_log_user_in( $user_id, $user_data['user_login'], $user_data['user_pass'] );
837
+		give_log_user_in($user_id, $user_data['user_login'], $user_data['user_pass']);
839 838
 	}
840 839
 
841 840
 	// Return user id.
@@ -851,27 +850,27 @@  discard block
 block discarded – undo
851 850
  * @since   1.0
852 851
  * @return  array|bool
853 852
  */
854
-function give_get_donation_form_user( $valid_data = array() ) {
853
+function give_get_donation_form_user($valid_data = array()) {
855 854
 
856 855
 	// Initialize user.
857 856
 	$user    = false;
858
-	$is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
857
+	$is_ajax = defined('DOING_AJAX') && DOING_AJAX;
859 858
 
860
-	if ( $is_ajax ) {
859
+	if ($is_ajax) {
861 860
 		// Do not create or login the user during the ajax submission (check for errors only).
862 861
 		return true;
863
-	} elseif ( is_user_logged_in() ) {
862
+	} elseif (is_user_logged_in()) {
864 863
 		// Set the valid user as the logged in collected data.
865 864
 		$user = $valid_data['logged_in_user'];
866
-	} elseif ( $valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true ) {
865
+	} elseif ($valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true) {
867 866
 		// New user registration.
868
-		if ( $valid_data['need_new_user'] === true ) {
867
+		if ($valid_data['need_new_user'] === true) {
869 868
 			// Set user.
870 869
 			$user = $valid_data['new_user_data'];
871 870
 			// Register and login new user.
872
-			$user['user_id'] = give_register_and_login_new_user( $user );
871
+			$user['user_id'] = give_register_and_login_new_user($user);
873 872
 			// User login
874
-		} elseif ( $valid_data['need_user_login'] === true && ! $is_ajax ) {
873
+		} elseif ($valid_data['need_user_login'] === true && ! $is_ajax) {
875 874
 
876 875
 			/**
877 876
 			 * The login form is now processed in the give_process_donation_login() function.
@@ -883,42 +882,42 @@  discard block
 block discarded – undo
883 882
 			// Set user.
884 883
 			$user = $valid_data['login_user_data'];
885 884
 			// Login user.
886
-			give_log_user_in( $user['user_id'], $user['user_login'], $user['user_pass'] );
885
+			give_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']);
887 886
 		}
888 887
 	}
889 888
 
890 889
 	// Check guest checkout.
891
-	if ( false === $user && false === give_logged_in_only( $_POST['give-form-id'] ) ) {
890
+	if (false === $user && false === give_logged_in_only($_POST['give-form-id'])) {
892 891
 		// Set user
893 892
 		$user = $valid_data['guest_user_data'];
894 893
 	}
895 894
 
896 895
 	// Verify we have an user.
897
-	if ( false === $user || empty( $user ) ) {
896
+	if (false === $user || empty($user)) {
898 897
 		// Return false.
899 898
 		return false;
900 899
 	}
901 900
 
902 901
 	// Get user first name.
903
-	if ( ! isset( $user['user_first'] ) || strlen( trim( $user['user_first'] ) ) < 1 ) {
904
-		$user['user_first'] = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : '';
902
+	if ( ! isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) {
903
+		$user['user_first'] = isset($_POST['give_first']) ? strip_tags(trim($_POST['give_first'])) : '';
905 904
 	}
906 905
 
907 906
 	// Get user last name.
908
-	if ( ! isset( $user['user_last'] ) || strlen( trim( $user['user_last'] ) ) < 1 ) {
909
-		$user['user_last'] = isset( $_POST['give_last'] ) ? strip_tags( trim( $_POST['give_last'] ) ) : '';
907
+	if ( ! isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) {
908
+		$user['user_last'] = isset($_POST['give_last']) ? strip_tags(trim($_POST['give_last'])) : '';
910 909
 	}
911 910
 
912 911
 	// Get the user's billing address details.
913 912
 	$user['address']            = array();
914
-	$user['address']['line1']   = ! empty( $_POST['card_address'] ) ? give_clean( $_POST['card_address'] ) : false;
915
-	$user['address']['line2']   = ! empty( $_POST['card_address_2'] ) ? give_clean( $_POST['card_address_2'] ) : false;
916
-	$user['address']['city']    = ! empty( $_POST['card_city'] ) ? give_clean( $_POST['card_city'] ) : false;
917
-	$user['address']['state']   = ! empty( $_POST['card_state'] ) ? give_clean( $_POST['card_state'] ) : false;
918
-	$user['address']['zip']     = ! empty( $_POST['card_zip'] ) ? give_clean( $_POST['card_zip'] ) : false;
919
-	$user['address']['country'] = ! empty( $_POST['billing_country'] ) ? give_clean( $_POST['billing_country'] ) : false;
920
-
921
-	if ( empty( $user['address']['country'] ) ) {
913
+	$user['address']['line1']   = ! empty($_POST['card_address']) ? give_clean($_POST['card_address']) : false;
914
+	$user['address']['line2']   = ! empty($_POST['card_address_2']) ? give_clean($_POST['card_address_2']) : false;
915
+	$user['address']['city']    = ! empty($_POST['card_city']) ? give_clean($_POST['card_city']) : false;
916
+	$user['address']['state']   = ! empty($_POST['card_state']) ? give_clean($_POST['card_state']) : false;
917
+	$user['address']['zip']     = ! empty($_POST['card_zip']) ? give_clean($_POST['card_zip']) : false;
918
+	$user['address']['country'] = ! empty($_POST['billing_country']) ? give_clean($_POST['billing_country']) : false;
919
+
920
+	if (empty($user['address']['country'])) {
922 921
 		$user['address'] = false;
923 922
 	} // End if().
924 923
 
@@ -938,16 +937,16 @@  discard block
 block discarded – undo
938 937
 	$card_data = give_get_donation_cc_info();
939 938
 
940 939
 	// Validate the card zip.
941
-	if ( ! empty( $card_data['card_zip'] ) ) {
942
-		if ( ! give_donation_form_validate_cc_zip( $card_data['card_zip'], $card_data['card_country'] ) ) {
943
-			give_set_error( 'invalid_cc_zip', __( 'The zip / postal code you entered for your billing address is invalid.', 'give' ) );
940
+	if ( ! empty($card_data['card_zip'])) {
941
+		if ( ! give_donation_form_validate_cc_zip($card_data['card_zip'], $card_data['card_country'])) {
942
+			give_set_error('invalid_cc_zip', __('The zip / postal code you entered for your billing address is invalid.', 'give'));
944 943
 		}
945 944
 	}
946 945
 
947 946
 	// Ensure no spaces.
948
-	if ( ! empty( $card_data['card_number'] ) ) {
949
-		$card_data['card_number'] = str_replace( '+', '', $card_data['card_number'] ); // no "+" signs
950
-		$card_data['card_number'] = str_replace( ' ', '', $card_data['card_number'] ); // No spaces
947
+	if ( ! empty($card_data['card_number'])) {
948
+		$card_data['card_number'] = str_replace('+', '', $card_data['card_number']); // no "+" signs
949
+		$card_data['card_number'] = str_replace(' ', '', $card_data['card_number']); // No spaces
951 950
 	}
952 951
 
953 952
 	// This should validate card numbers at some point too.
@@ -964,17 +963,17 @@  discard block
 block discarded – undo
964 963
 function give_get_donation_cc_info() {
965 964
 
966 965
 	$cc_info                   = array();
967
-	$cc_info['card_name']      = isset( $_POST['card_name'] ) ? sanitize_text_field( $_POST['card_name'] ) : '';
968
-	$cc_info['card_number']    = isset( $_POST['card_number'] ) ? sanitize_text_field( $_POST['card_number'] ) : '';
969
-	$cc_info['card_cvc']       = isset( $_POST['card_cvc'] ) ? sanitize_text_field( $_POST['card_cvc'] ) : '';
970
-	$cc_info['card_exp_month'] = isset( $_POST['card_exp_month'] ) ? sanitize_text_field( $_POST['card_exp_month'] ) : '';
971
-	$cc_info['card_exp_year']  = isset( $_POST['card_exp_year'] ) ? sanitize_text_field( $_POST['card_exp_year'] ) : '';
972
-	$cc_info['card_address']   = isset( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : '';
973
-	$cc_info['card_address_2'] = isset( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : '';
974
-	$cc_info['card_city']      = isset( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : '';
975
-	$cc_info['card_state']     = isset( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : '';
976
-	$cc_info['card_country']   = isset( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : '';
977
-	$cc_info['card_zip']       = isset( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : '';
966
+	$cc_info['card_name']      = isset($_POST['card_name']) ? sanitize_text_field($_POST['card_name']) : '';
967
+	$cc_info['card_number']    = isset($_POST['card_number']) ? sanitize_text_field($_POST['card_number']) : '';
968
+	$cc_info['card_cvc']       = isset($_POST['card_cvc']) ? sanitize_text_field($_POST['card_cvc']) : '';
969
+	$cc_info['card_exp_month'] = isset($_POST['card_exp_month']) ? sanitize_text_field($_POST['card_exp_month']) : '';
970
+	$cc_info['card_exp_year']  = isset($_POST['card_exp_year']) ? sanitize_text_field($_POST['card_exp_year']) : '';
971
+	$cc_info['card_address']   = isset($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : '';
972
+	$cc_info['card_address_2'] = isset($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : '';
973
+	$cc_info['card_city']      = isset($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : '';
974
+	$cc_info['card_state']     = isset($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : '';
975
+	$cc_info['card_country']   = isset($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : '';
976
+	$cc_info['card_zip']       = isset($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : '';
978 977
 
979 978
 	// Return cc info.
980 979
 	return $cc_info;
@@ -990,14 +989,14 @@  discard block
 block discarded – undo
990 989
  *
991 990
  * @return bool|mixed
992 991
  */
993
-function give_donation_form_validate_cc_zip( $zip = 0, $country_code = '' ) {
992
+function give_donation_form_validate_cc_zip($zip = 0, $country_code = '') {
994 993
 	$ret = false;
995 994
 
996
-	if ( empty( $zip ) || empty( $country_code ) ) {
995
+	if (empty($zip) || empty($country_code)) {
997 996
 		return $ret;
998 997
 	}
999 998
 
1000
-	$country_code = strtoupper( $country_code );
999
+	$country_code = strtoupper($country_code);
1001 1000
 
1002 1001
 	$zip_regex = array(
1003 1002
 		'AD' => 'AD\d{3}',
@@ -1157,11 +1156,11 @@  discard block
 block discarded – undo
1157 1156
 		'ZM' => '\d{5}',
1158 1157
 	);
1159 1158
 
1160
-	if ( ! isset( $zip_regex[ $country_code ] ) || preg_match( '/' . $zip_regex[ $country_code ] . '/i', $zip ) ) {
1159
+	if ( ! isset($zip_regex[$country_code]) || preg_match('/'.$zip_regex[$country_code].'/i', $zip)) {
1161 1160
 		$ret = true;
1162 1161
 	}
1163 1162
 
1164
-	return apply_filters( 'give_is_zip_valid', $ret, $zip, $country_code );
1163
+	return apply_filters('give_is_zip_valid', $ret, $zip, $country_code);
1165 1164
 }
1166 1165
 
1167 1166
 /**
@@ -1173,49 +1172,49 @@  discard block
 block discarded – undo
1173 1172
  *
1174 1173
  * @return bool
1175 1174
  */
1176
-function give_validate_donation_amount( $valid_data ) {
1175
+function give_validate_donation_amount($valid_data) {
1177 1176
 	$data = $_POST;
1178 1177
 
1179 1178
 	/* @var Give_Donate_Form $form */
1180
-	$form = new Give_Donate_Form( $data['give-form-id'] );
1179
+	$form = new Give_Donate_Form($data['give-form-id']);
1181 1180
 
1182 1181
 	$donation_level_matched = false;
1183 1182
 
1184
-	if ( $form->is_set_type_donation_form() ) {
1183
+	if ($form->is_set_type_donation_form()) {
1185 1184
 		// Sanitize donation amount.
1186
-		$data['give-amount'] = give_maybe_sanitize_amount( $data['give-amount'] );
1185
+		$data['give-amount'] = give_maybe_sanitize_amount($data['give-amount']);
1187 1186
 
1188 1187
 		// Backward compatibility.
1189
-		if ( $form->is_custom_price( $data['give-amount'] ) ) {
1188
+		if ($form->is_custom_price($data['give-amount'])) {
1190 1189
 			$_POST['give-price-id'] = 'custom';
1191 1190
 		}
1192 1191
 
1193 1192
 		$donation_level_matched = true;
1194 1193
 
1195
-	} elseif ( $form->is_multi_type_donation_form() ) {
1194
+	} elseif ($form->is_multi_type_donation_form()) {
1196 1195
 
1197 1196
 		// Bailout.
1198
-		if ( ! ( $variable_prices = $form->get_prices() ) ) {
1197
+		if ( ! ($variable_prices = $form->get_prices())) {
1199 1198
 			return false;
1200 1199
 		}
1201 1200
 
1202 1201
 		// Sanitize donation amount.
1203
-		$data['give-amount'] = give_maybe_sanitize_amount( $data['give-amount'] );
1202
+		$data['give-amount'] = give_maybe_sanitize_amount($data['give-amount']);
1204 1203
 
1205
-		if ( $data['give-amount'] === give_maybe_sanitize_amount( give_get_price_option_amount( $data['give-form-id'], $data['give-price-id'] ) ) ) {
1204
+		if ($data['give-amount'] === give_maybe_sanitize_amount(give_get_price_option_amount($data['give-form-id'], $data['give-price-id']))) {
1206 1205
 			return true;
1207 1206
 		}
1208 1207
 
1209
-		if ( $form->is_custom_price( $data['give-amount'] ) ) {
1208
+		if ($form->is_custom_price($data['give-amount'])) {
1210 1209
 			$_POST['give-price-id'] = 'custom';
1211 1210
 		} else {
1212 1211
 			// Find correct donation level from all donation levels.
1213
-			foreach ( $variable_prices as $variable_price ) {
1212
+			foreach ($variable_prices as $variable_price) {
1214 1213
 				// Sanitize level amount.
1215
-				$variable_price['_give_amount'] = give_maybe_sanitize_amount( $variable_price['_give_amount'] );
1214
+				$variable_price['_give_amount'] = give_maybe_sanitize_amount($variable_price['_give_amount']);
1216 1215
 
1217 1216
 				// Set first match donation level ID.
1218
-				if ( $data['give-amount'] === $variable_price['_give_amount'] ) {
1217
+				if ($data['give-amount'] === $variable_price['_give_amount']) {
1219 1218
 					$_POST['give-price-id'] = $variable_price['_give_id']['level_id'];
1220 1219
 					break;
1221 1220
 				}
@@ -1224,15 +1223,15 @@  discard block
 block discarded – undo
1224 1223
 
1225 1224
 		// If donation amount is not find in donation levels then check if form has custom donation feature enable or not.
1226 1225
 		// If yes then set price id to custom if amount is greater then custom minimum amount (if any).
1227
-		if ( ! empty( $_POST['give-price-id'] ) ) {
1226
+		if ( ! empty($_POST['give-price-id'])) {
1228 1227
 			$donation_level_matched = true;
1229 1228
 		}
1230 1229
 	}// End if().
1231 1230
 
1232
-	return ( $donation_level_matched ? true : false );
1231
+	return ($donation_level_matched ? true : false);
1233 1232
 }
1234 1233
 
1235
-add_action( 'give_checkout_error_checks', 'give_validate_donation_amount', 10, 1 );
1234
+add_action('give_checkout_error_checks', 'give_validate_donation_amount', 10, 1);
1236 1235
 
1237 1236
 /**
1238 1237
  * Validate Required Form Fields.
@@ -1241,17 +1240,17 @@  discard block
 block discarded – undo
1241 1240
  *
1242 1241
  * @since 2.0
1243 1242
  */
1244
-function give_validate_required_form_fields( $form_id ) {
1243
+function give_validate_required_form_fields($form_id) {
1245 1244
 
1246 1245
 	// Loop through required fields and show error messages.
1247
-	foreach ( give_get_required_fields( $form_id ) as $field_name => $value ) {
1246
+	foreach (give_get_required_fields($form_id) as $field_name => $value) {
1248 1247
 
1249 1248
 		// Clean Up Data of the input fields.
1250
-		$field_value = give_clean( $_POST[ $field_name ] );
1249
+		$field_value = give_clean($_POST[$field_name]);
1251 1250
 
1252 1251
 		// Check whether the required field is empty, then show the error message.
1253
-		if ( in_array( $value, give_get_required_fields( $form_id ) ) && empty( $field_value ) ) {
1254
-			give_set_error( $value['error_id'], $value['error_message'] );
1252
+		if (in_array($value, give_get_required_fields($form_id)) && empty($field_value)) {
1253
+			give_set_error($value['error_id'], $value['error_message']);
1255 1254
 		}
1256 1255
 	}
1257 1256
 }
Please login to merge, or discard this patch.
includes/import-functions.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -666,6 +666,7 @@
 block discarded – undo
666 666
  * Check if Import donation is duplicate
667 667
  *
668 668
  * @since 1.8.13
669
+ * @param Give_Donate_Form $form
669 670
  */
670 671
 function give_check_import_donation_duplicate( $payment_data, $data, $form, $donor_data ) {
671 672
 	$return = false;
Please login to merge, or discard this patch.
Spacing   +252 added lines, -252 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  * @since 1.8.13
21 21
  */
22 22
 function give_import_donation_report() {
23
-	return get_option( 'give_import_donation_report', array() );
23
+	return get_option('give_import_donation_report', array());
24 24
 }
25 25
 
26 26
 
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
  *
30 30
  * @since 1.8.13
31 31
  */
32
-function give_import_donation_report_update( $value = array() ) {
33
-	update_option( 'give_import_donation_report', $value );
32
+function give_import_donation_report_update($value = array()) {
33
+	update_option('give_import_donation_report', $value);
34 34
 }
35 35
 
36 36
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
  * @since 1.8.13
41 41
  */
42 42
 function give_import_donation_report_reset() {
43
-	update_option( 'give_import_donation_report', array() );
43
+	update_option('give_import_donation_report', array());
44 44
 }
45 45
 
46 46
 /**
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
  *
53 53
  * @return array|bool|Give_Donate_Form|int|null|WP_Post
54 54
  */
55
-function give_import_get_form_data_from_csv( $data, $import_setting = array() ) {
55
+function give_import_get_form_data_from_csv($data, $import_setting = array()) {
56 56
 	$new_form = false;
57 57
 
58 58
 	// Get the import report
@@ -61,62 +61,62 @@  discard block
 block discarded – undo
61 61
 	$form = false;
62 62
 	$meta = array();
63 63
 
64
-	if ( ! empty( $data['form_id'] ) ) {
65
-		$form = new Give_Donate_Form( $data['form_id'] );
64
+	if ( ! empty($data['form_id'])) {
65
+		$form = new Give_Donate_Form($data['form_id']);
66 66
 		// Add support to older php version.
67 67
 		$form_id = $form->get_ID();
68
-		if ( empty( $form_id ) ) {
69
-			$report['duplicate_form'] = ( ! empty( $report['duplicate_form'] ) ? ( absint( $report['duplicate_form'] ) + 1 ) : 1 );
68
+		if (empty($form_id)) {
69
+			$report['duplicate_form'] = ( ! empty($report['duplicate_form']) ? (absint($report['duplicate_form']) + 1) : 1);
70 70
 			$form                     = false;
71 71
 		}
72 72
 	}
73 73
 
74
-	if ( false === $form && ! empty( $data['form_title'] ) ) {
75
-		$form = get_page_by_title( $data['form_title'], OBJECT, 'give_forms' );
74
+	if (false === $form && ! empty($data['form_title'])) {
75
+		$form = get_page_by_title($data['form_title'], OBJECT, 'give_forms');
76 76
 
77
-		if ( ! empty( $form->ID ) ) {
77
+		if ( ! empty($form->ID)) {
78 78
 
79
-			$report['duplicate_form'] = ( ! empty( $report['duplicate_form'] ) ? ( absint( $report['duplicate_form'] ) + 1 ) : 1 );
79
+			$report['duplicate_form'] = ( ! empty($report['duplicate_form']) ? (absint($report['duplicate_form']) + 1) : 1);
80 80
 
81
-			$form = new Give_Donate_Form( $form->ID );
81
+			$form = new Give_Donate_Form($form->ID);
82 82
 		} else {
83 83
 			$form                  = new Give_Donate_Form();
84 84
 			$args                  = array(
85 85
 				'post_title'  => $data['form_title'],
86 86
 				'post_status' => 'publish',
87 87
 			);
88
-			$form                  = $form->create( $args );
89
-			$report['create_form'] = ( ! empty( $report['create_form'] ) ? ( absint( $report['create_form'] ) + 1 ) : 1 );
88
+			$form                  = $form->create($args);
89
+			$report['create_form'] = ( ! empty($report['create_form']) ? (absint($report['create_form']) + 1) : 1);
90 90
 			$new_form              = true;
91 91
 
92 92
 		}
93 93
 
94
-		$form = get_page_by_title( $data['form_title'], OBJECT, 'give_forms' );
95
-		$form = new Give_Donate_Form( $form->ID );
94
+		$form = get_page_by_title($data['form_title'], OBJECT, 'give_forms');
95
+		$form = new Give_Donate_Form($form->ID);
96 96
 	}
97 97
 
98
-	if ( ! empty( $form ) && $form->get_ID() ) {
98
+	if ( ! empty($form) && $form->get_ID()) {
99 99
 
100 100
 		$price_option = 'set';
101
-		$form_level = strtolower( preg_replace('/\s+/', '', $data['form_level'] ) );
101
+		$form_level = strtolower(preg_replace('/\s+/', '', $data['form_level']));
102 102
 
103
-		if ( ! empty( $data['form_level'] ) && 'custom' != $form_level ) {
103
+		if ( ! empty($data['form_level']) && 'custom' != $form_level) {
104 104
 			$prices     = (array) $form->get_prices();
105 105
 			$price_text = array();
106
-			foreach ( $prices as $key => $price ) {
107
-				if ( isset( $price['_give_id']['level_id'] ) ) {
108
-					$price_text[ $price['_give_id']['level_id'] ] = ( ! empty( $price['_give_text'] ) ? strtolower( preg_replace('/\s+/', '', $price['_give_text'] ) ) : '' );
106
+			foreach ($prices as $key => $price) {
107
+				if (isset($price['_give_id']['level_id'])) {
108
+					$price_text[$price['_give_id']['level_id']] = ( ! empty($price['_give_text']) ? strtolower(preg_replace('/\s+/', '', $price['_give_text'])) : '');
109 109
 				}
110 110
 			}
111 111
 
112
-			if ( ! in_array( $form_level, $price_text ) ) {
112
+			if ( ! in_array($form_level, $price_text)) {
113 113
 
114 114
 				// For generating unquiet level id.
115 115
 				$count     = 1;
116
-				$new_level = count( $prices ) + $count;
117
-				while ( array_key_exists( $new_level, $price_text ) ) {
118
-					$count ++;
119
-					$new_level = count( $prices ) + $count;
116
+				$new_level = count($prices) + $count;
117
+				while (array_key_exists($new_level, $price_text)) {
118
+					$count++;
119
+					$new_level = count($prices) + $count;
120 120
 				}
121 121
 
122 122
 				$multi_level_donations = array(
@@ -124,42 +124,42 @@  discard block
 block discarded – undo
124 124
 						'_give_id'     => array(
125 125
 							'level_id' => $new_level,
126 126
 						),
127
-						'_give_amount' => give_sanitize_amount_for_db( $data['amount'] ),
127
+						'_give_amount' => give_sanitize_amount_for_db($data['amount']),
128 128
 						'_give_text'   => $data['form_level'],
129 129
 					),
130 130
 				);
131 131
 
132
-				$price_text[ $new_level ] = strtolower( preg_replace('/\s+/', '', $data['form_level'] ) );
132
+				$price_text[$new_level] = strtolower(preg_replace('/\s+/', '', $data['form_level']));
133 133
 
134
-				if ( ! empty( $prices ) && is_array( $prices ) && ! empty( $prices[0] ) ) {
135
-					$prices = wp_parse_args( $multi_level_donations, $prices );
134
+				if ( ! empty($prices) && is_array($prices) && ! empty($prices[0])) {
135
+					$prices = wp_parse_args($multi_level_donations, $prices);
136 136
 
137 137
 					// Sort $prices by amount in ascending order.
138
-					$prices = wp_list_sort( $prices, '_give_amount', 'ASC' );
138
+					$prices = wp_list_sort($prices, '_give_amount', 'ASC');
139 139
 				} else {
140 140
 					$prices = $multi_level_donations;
141 141
 				}
142 142
 
143 143
 				// Unset _give_default key from $prices.
144
-				foreach ( $prices as $key => $price ) {
145
-					if ( isset( $prices[ $key ]['_give_default'] ) ) {
146
-						unset( $prices[ $key ]['_give_default'] );
144
+				foreach ($prices as $key => $price) {
145
+					if (isset($prices[$key]['_give_default'])) {
146
+						unset($prices[$key]['_give_default']);
147 147
 					}
148 148
 				}
149 149
 
150 150
 				// Set the first $price of the $prices as defalut.
151 151
 				$prices[0]['_give_default'] = 'default';
152 152
 			}
153
-			$form->price_id = array_search( $form_level, $price_text );
153
+			$form->price_id = array_search($form_level, $price_text);
154 154
 
155
-			$donation_levels_amounts = wp_list_pluck( $prices, '_give_amount' );
156
-			$min_amount              = min( $donation_levels_amounts );
157
-			$max_amount              = max( $donation_levels_amounts );
155
+			$donation_levels_amounts = wp_list_pluck($prices, '_give_amount');
156
+			$min_amount              = min($donation_levels_amounts);
157
+			$max_amount              = max($donation_levels_amounts);
158 158
 
159 159
 			$meta = array(
160 160
 				'_give_levels_minimum_amount' => $min_amount,
161 161
 				'_give_levels_maximum_amount' => $max_amount,
162
-				'_give_donation_levels'       => array_values( $prices ),
162
+				'_give_donation_levels'       => array_values($prices),
163 163
 			);
164 164
 
165 165
 			$price_option = 'multi';
@@ -168,13 +168,13 @@  discard block
 block discarded – undo
168 168
 		}
169 169
 
170 170
 		$defaults = array(
171
-			'_give_set_price' => give_sanitize_amount_for_db( $data['amount'] ),
171
+			'_give_set_price' => give_sanitize_amount_for_db($data['amount']),
172 172
 		);
173 173
 
174 174
 		// If new form is created.
175
-		if ( ! empty( $new_form ) ) {
175
+		if ( ! empty($new_form)) {
176 176
 			$new_form = array(
177
-				'_give_custom_amount_text' => ( ! empty( $data['form_custom_amount_text'] ) ? $data['form_custom_amount_text'] : 'Custom' ),
177
+				'_give_custom_amount_text' => ( ! empty($data['form_custom_amount_text']) ? $data['form_custom_amount_text'] : 'Custom'),
178 178
 				'_give_logged_in_only'     => 'enabled',
179 179
 				'_give_custom_amount'      => 'enabled',
180 180
 				'_give_payment_import'     => true,
@@ -186,18 +186,18 @@  discard block
 block discarded – undo
186 186
 				'_give_show_register_form' => 'both',
187 187
 				'_give_price_option'       => $price_option,
188 188
 			);
189
-			$defaults = wp_parse_args( $defaults, $new_form );
189
+			$defaults = wp_parse_args($defaults, $new_form);
190 190
 		}
191 191
 
192
-		$meta = wp_parse_args( $meta, $defaults );
192
+		$meta = wp_parse_args($meta, $defaults);
193 193
 
194
-		foreach ( $meta as $key => $value ) {
195
-			give_update_meta( $form->get_ID(), $key, $value );
194
+		foreach ($meta as $key => $value) {
195
+			give_update_meta($form->get_ID(), $key, $value);
196 196
 		}
197 197
 	}
198 198
 
199 199
 	// update the report
200
-	give_import_donation_report_update( $report );
200
+	give_import_donation_report_update($report);
201 201
 
202 202
 	return $form;
203 203
 }
@@ -211,30 +211,30 @@  discard block
 block discarded – undo
211 211
  *
212 212
  * @return bool|false|WP_User
213 213
  */
214
-function give_import_get_user_from_csv( $data, $import_setting = array() ) {
214
+function give_import_get_user_from_csv($data, $import_setting = array()) {
215 215
 	$report     = give_import_donation_report();
216 216
 	$donor_data = false;
217 217
 	$donor_id   = false;
218 218
 
219 219
 	// check if donor id is not empty
220
-	if ( ! empty( $data['donor_id'] ) ) {
221
-		$donor_data = new Give_Donor( (int) $data['donor_id'] );
222
-		if ( ! empty( $donor_data->id ) ) {
223
-			$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
220
+	if ( ! empty($data['donor_id'])) {
221
+		$donor_data = new Give_Donor((int) $data['donor_id']);
222
+		if ( ! empty($donor_data->id)) {
223
+			$report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1);
224 224
 		}
225 225
 	}
226 226
 
227
-	if ( empty( $donor_data->id ) && ! empty( $data['user_id'] ) ) {
227
+	if (empty($donor_data->id) && ! empty($data['user_id'])) {
228 228
 		$user_id    = (int) $data['user_id'];
229
-		$donor_data = new Give_Donor( $user_id, true );
229
+		$donor_data = new Give_Donor($user_id, true);
230 230
 
231 231
 
232
-		if ( empty( $donor_data->id ) ) {
233
-			$donor_data = get_user_by( 'id', $user_id );
234
-			if ( ! empty( $donor_data->ID ) ) {
235
-				$first_name = ( ! empty( $data['first_name'] ) ? $data['first_name'] : $donor_data->user_nicename );
236
-				$last_name  = ( ! empty( $data['last_name'] ) ? $data['last_name'] : ( ( $lastname = get_user_meta( $donor_data->ID, 'last_name', true ) ) ? $lastname : '' ) );
237
-				$name       = $first_name . ' ' . $last_name;
232
+		if (empty($donor_data->id)) {
233
+			$donor_data = get_user_by('id', $user_id);
234
+			if ( ! empty($donor_data->ID)) {
235
+				$first_name = ( ! empty($data['first_name']) ? $data['first_name'] : $donor_data->user_nicename);
236
+				$last_name  = ( ! empty($data['last_name']) ? $data['last_name'] : (($lastname = get_user_meta($donor_data->ID, 'last_name', true)) ? $lastname : ''));
237
+				$name       = $first_name.' '.$last_name;
238 238
 				$user_email = $donor_data->user_email;
239 239
 				$donor_args = array(
240 240
 					'name'    => $name,
@@ -243,45 +243,45 @@  discard block
 block discarded – undo
243 243
 				);
244 244
 
245 245
 				$donor_data = new Give_Donor();
246
-				$donor_data->create( $donor_args );
246
+				$donor_data->create($donor_args);
247 247
 
248 248
 				// Adding notes that donor is being imported from CSV.
249 249
 				$current_user = wp_get_current_user();
250
-				$donor_data->add_note( esc_html( wp_sprintf( __( 'This donor was imported by %s', 'give' ), $current_user->user_email ) ) );
250
+				$donor_data->add_note(esc_html(wp_sprintf(__('This donor was imported by %s', 'give'), $current_user->user_email)));
251 251
 
252 252
 				// Add is used to ensure duplicate emails are not added
253
-				if ( $user_email != $data['email'] && ! empty( $data['email'] ) ) {
254
-					$donor_data->add_meta( 'additional_email', $data['email'] );
253
+				if ($user_email != $data['email'] && ! empty($data['email'])) {
254
+					$donor_data->add_meta('additional_email', $data['email']);
255 255
 				}
256 256
 
257
-				$report['create_donor'] = ( ! empty( $report['create_donor'] ) ? ( absint( $report['create_donor'] ) + 1 ) : 1 );
257
+				$report['create_donor'] = ( ! empty($report['create_donor']) ? (absint($report['create_donor']) + 1) : 1);
258 258
 			}
259 259
 		} else {
260 260
 			// Add is used to ensure duplicate emails are not added
261
-			if ( $donor_data->email != $data['email'] ) {
262
-				$donor_data->add_meta( 'additional_email', ( ! empty( $data['email'] ) ? $data['email'] : $donor_data->email ) );
261
+			if ($donor_data->email != $data['email']) {
262
+				$donor_data->add_meta('additional_email', ( ! empty($data['email']) ? $data['email'] : $donor_data->email));
263 263
 			}
264
-			$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
264
+			$report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1);
265 265
 		}
266 266
 	}
267 267
 
268
-	if ( empty( $donor_data->id ) && ! empty( $data['email'] ) ) {
268
+	if (empty($donor_data->id) && ! empty($data['email'])) {
269 269
 
270
-		$donor_data = new Give_Donor( $data['email'] );
271
-		if ( empty( $donor_data->id ) ) {
272
-			$donor_data = get_user_by( 'email', $data['email'] );
270
+		$donor_data = new Give_Donor($data['email']);
271
+		if (empty($donor_data->id)) {
272
+			$donor_data = get_user_by('email', $data['email']);
273 273
 
274
-			if ( empty( $donor_data->ID ) && isset( $import_setting['create_user'] ) && 1 === absint( $import_setting['create_user'] ) ) {
275
-				$data['first_name'] = ( ! empty( $data['first_name'] ) ? $data['first_name'] : $data['email'] );
276
-				$data['last_name'] = ( ! empty( $data['last_name'] ) ? $data['last_name'] : '' );
277
-				$give_role         = (array) give_get_option( 'donor_default_user_role', get_option( 'default_role', ( ( $give_donor = wp_roles()->is_role( 'give_donor' ) ) && ! empty( $give_donor ) ? 'give_donor' : 'subscriber' ) ) );
274
+			if (empty($donor_data->ID) && isset($import_setting['create_user']) && 1 === absint($import_setting['create_user'])) {
275
+				$data['first_name'] = ( ! empty($data['first_name']) ? $data['first_name'] : $data['email']);
276
+				$data['last_name'] = ( ! empty($data['last_name']) ? $data['last_name'] : '');
277
+				$give_role         = (array) give_get_option('donor_default_user_role', get_option('default_role', (($give_donor = wp_roles()->is_role('give_donor')) && ! empty($give_donor) ? 'give_donor' : 'subscriber')));
278 278
 				$donor_args        = array(
279 279
 					'user_login'      => $data['email'],
280 280
 					'user_email'      => $data['email'],
281
-					'user_registered' => date( 'Y-m-d H:i:s' ),
281
+					'user_registered' => date('Y-m-d H:i:s'),
282 282
 					'user_first'      => $data['first_name'],
283 283
 					'user_last'       => $data['last_name'],
284
-					'user_pass'       => wp_generate_password( 8, true ),
284
+					'user_pass'       => wp_generate_password(8, true),
285 285
 					'role'            => $give_role,
286 286
 				);
287 287
 
@@ -290,55 +290,55 @@  discard block
 block discarded – undo
290 290
 				 *
291 291
 				 * @since 1.8.13
292 292
 				 */
293
-				$donor_args = (array) apply_filters( 'give_import_insert_user_args', $donor_args, $data, $import_setting );
293
+				$donor_args = (array) apply_filters('give_import_insert_user_args', $donor_args, $data, $import_setting);
294 294
 
295 295
 				// This action was added to remove the login when using the give register function.
296
-				add_filter( 'give_log_user_in_on_register', 'give_log_user_in_on_register_callback', 11 );
297
-				$donor_id = give_register_and_login_new_user( $donor_args );
298
-				remove_filter( 'give_log_user_in_on_register', 'give_log_user_in_on_register_callback', 11 );
296
+				add_filter('give_log_user_in_on_register', 'give_log_user_in_on_register_callback', 11);
297
+				$donor_id = give_register_and_login_new_user($donor_args);
298
+				remove_filter('give_log_user_in_on_register', 'give_log_user_in_on_register_callback', 11);
299 299
 
300
-				update_user_meta( $donor_id, '_give_payment_import', true );
301
-				$donor_data = new Give_Donor( $donor_id, true );
300
+				update_user_meta($donor_id, '_give_payment_import', true);
301
+				$donor_data = new Give_Donor($donor_id, true);
302 302
 			} else {
303
-				$donor_id = ( ! empty( $donor_data->ID ) ? $donor_data->ID : false );
303
+				$donor_id = ( ! empty($donor_data->ID) ? $donor_data->ID : false);
304 304
 			}
305 305
 
306
-			if ( ! empty( $donor_id ) || ( isset( $import_setting['create_user'] ) && 0 === absint( $import_setting['create_user'] ) ) ) {
307
-				$donor_data = new Give_Donor( $donor_id, true );
306
+			if ( ! empty($donor_id) || (isset($import_setting['create_user']) && 0 === absint($import_setting['create_user']))) {
307
+				$donor_data = new Give_Donor($donor_id, true);
308 308
 
309
-				if ( empty( $donor_data->id ) ) {
309
+				if (empty($donor_data->id)) {
310 310
 
311
-					if ( ! empty( $data['form_id'] ) ) {
312
-						$form = new Give_Donate_Form( $data['form_id'] );
311
+					if ( ! empty($data['form_id'])) {
312
+						$form = new Give_Donate_Form($data['form_id']);
313 313
 					}
314 314
 
315
-					$payment_title = ( isset( $data['form_title'] ) ? $data['form_title'] : ( isset( $form ) ? $form->get_name() : esc_html__( 'New Form', 'give' ) ) );
315
+					$payment_title = (isset($data['form_title']) ? $data['form_title'] : (isset($form) ? $form->get_name() : esc_html__('New Form', 'give')));
316 316
 					$donor_args    = array(
317
-						'name'  => ! is_email( $payment_title ) ? $data['first_name'] . ' ' . $data['last_name'] : '',
317
+						'name'  => ! is_email($payment_title) ? $data['first_name'].' '.$data['last_name'] : '',
318 318
 						'email' => $data['email'],
319 319
 					);
320 320
 
321
-					if ( ! empty( $donor_id ) ) {
321
+					if ( ! empty($donor_id)) {
322 322
 						$donor_args['user_id'] = $donor_id;
323 323
 					}
324 324
 
325
-					$donor_data->create( $donor_args );
325
+					$donor_data->create($donor_args);
326 326
 
327 327
 					// Adding notes that donor is being imported from CSV.
328 328
 					$current_user = wp_get_current_user();
329
-					$donor_data->add_note( esc_html( wp_sprintf( __( 'This donor was imported by %s', 'give' ), $current_user->user_email ) ) );
329
+					$donor_data->add_note(esc_html(wp_sprintf(__('This donor was imported by %s', 'give'), $current_user->user_email)));
330 330
 
331
-					$report['create_donor'] = ( ! empty( $report['create_donor'] ) ? ( absint( $report['create_donor'] ) + 1 ) : 1 );
331
+					$report['create_donor'] = ( ! empty($report['create_donor']) ? (absint($report['create_donor']) + 1) : 1);
332 332
 				} else {
333
-					$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
333
+					$report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1);
334 334
 				}
335 335
 			}
336 336
 		} else {
337
-			$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
337
+			$report['duplicate_donor'] = ( ! empty($report['duplicate_donor']) ? (absint($report['duplicate_donor']) + 1) : 1);
338 338
 		}
339 339
 	}
340 340
 	// update the report
341
-	give_import_donation_report_update( $report );
341
+	give_import_donation_report_update($report);
342 342
 
343 343
 	return $donor_data;
344 344
 }
@@ -356,9 +356,9 @@  discard block
 block discarded – undo
356 356
 	 *
357 357
 	 * @return array
358 358
 	 */
359
-	return (array) apply_filters( 'give_import_default_options', array(
360
-		'' => __( 'Do not import', 'give' ),
361
-	) );
359
+	return (array) apply_filters('give_import_default_options', array(
360
+		'' => __('Do not import', 'give'),
361
+	));
362 362
 }
363 363
 
364 364
 /**
@@ -374,62 +374,62 @@  discard block
 block discarded – undo
374 374
 	 *
375 375
 	 * @return array
376 376
 	 */
377
-	return (array) apply_filters( 'give_import_donations_options', array(
378
-		'id'          => __( 'Donation ID', 'give' ),
377
+	return (array) apply_filters('give_import_donations_options', array(
378
+		'id'          => __('Donation ID', 'give'),
379 379
 		'amount'      => array(
380
-			__( 'Donation Amount', 'give' ),
381
-			__( 'Amount', 'give' )
380
+			__('Donation Amount', 'give'),
381
+			__('Amount', 'give')
382 382
 		),
383 383
 		'post_date'   => array(
384
-			__( 'Donation Date', 'give' ),
385
-			__( 'Date', 'give' ),
384
+			__('Donation Date', 'give'),
385
+			__('Date', 'give'),
386 386
 		),
387 387
 		'first_name'  => array(
388
-			__( 'Donor First Name', 'give' ),
389
-			__( 'First Name', 'give' ),
390
-			__( 'Name', 'give' ),
388
+			__('Donor First Name', 'give'),
389
+			__('First Name', 'give'),
390
+			__('Name', 'give'),
391 391
 		),
392 392
 		'last_name'   => array(
393
-			__( 'Donor Last Name', 'give' ),
394
-			__( 'Last Name', 'give' ),
393
+			__('Donor Last Name', 'give'),
394
+			__('Last Name', 'give'),
395 395
 		),
396 396
 		'line1'       => array(
397
-			__( 'Address 1', 'give' ),
398
-			__( 'Address', 'give' ),
397
+			__('Address 1', 'give'),
398
+			__('Address', 'give'),
399 399
 		),
400
-		'line2'       => __( 'Address 2', 'give' ),
401
-		'city'        => __( 'City', 'give' ),
400
+		'line2'       => __('Address 2', 'give'),
401
+		'city'        => __('City', 'give'),
402 402
 		'state'       => array(
403
-			__( 'State', 'give' ),
404
-			__( 'Province', 'give' ),
405
-			__( 'County', 'give' ),
406
-			__( 'Region', 'give' ),
403
+			__('State', 'give'),
404
+			__('Province', 'give'),
405
+			__('County', 'give'),
406
+			__('Region', 'give'),
407 407
 		),
408
-		'country'     => __( 'Country', 'give' ),
408
+		'country'     => __('Country', 'give'),
409 409
 		'zip'         => array(
410
-			__( 'Zip', 'give' ),
411
-			__( 'Zip Code', 'give' ),
412
-			__( 'Postal Code', 'give' ),
410
+			__('Zip', 'give'),
411
+			__('Zip Code', 'give'),
412
+			__('Postal Code', 'give'),
413 413
 		),
414 414
 		'email'       => array(
415
-			__( 'Donor Email', 'give' ),
416
-			__( 'Email', 'give' )
415
+			__('Donor Email', 'give'),
416
+			__('Email', 'give')
417 417
 		),
418 418
 		'post_status' => array(
419
-			__( 'Donation Status', 'give' ),
420
-			__( 'Status', 'give' ),
419
+			__('Donation Status', 'give'),
420
+			__('Status', 'give'),
421 421
 		),
422 422
 		'gateway'     => array(
423
-			__( 'Payment Method', 'give' ),
424
-			__( 'Method', 'give' ),
423
+			__('Payment Method', 'give'),
424
+			__('Method', 'give'),
425 425
 		),
426
-		'notes'       => __( 'Notes', 'give' ),
426
+		'notes'       => __('Notes', 'give'),
427 427
 		'mode'        => array(
428
-			__( 'Test Mode', 'give' ),
429
-			__( 'Mode', 'give' ),
428
+			__('Test Mode', 'give'),
429
+			__('Mode', 'give'),
430 430
 		),
431
-		'post_meta'   => __( 'Import as Meta', 'give' ),
432
-	) );
431
+		'post_meta'   => __('Import as Meta', 'give'),
432
+	));
433 433
 }
434 434
 
435 435
 /**
@@ -445,10 +445,10 @@  discard block
 block discarded – undo
445 445
 	 *
446 446
 	 * @return array
447 447
 	 */
448
-	return (array) apply_filters( 'give_import_donor_options', array(
449
-		'donor_id' => __( 'Donor ID', 'give' ),
450
-		'user_id'  => __( 'User ID', 'give' ),
451
-	) );
448
+	return (array) apply_filters('give_import_donor_options', array(
449
+		'donor_id' => __('Donor ID', 'give'),
450
+		'user_id'  => __('User ID', 'give'),
451
+	));
452 452
 }
453 453
 
454 454
 /**
@@ -464,23 +464,23 @@  discard block
 block discarded – undo
464 464
 	 *
465 465
 	 * @return array
466 466
 	 */
467
-	return (array) apply_filters( 'give_import_donation_form_options', array(
467
+	return (array) apply_filters('give_import_donation_form_options', array(
468 468
 		'form_title'              => array(
469
-			__( 'Donation Form Title', 'give' ),
470
-			__( 'Donation Form', 'give' ),
471
-			__( 'Form Name', 'give' ),
472
-			__( 'Title', 'give' ),
469
+			__('Donation Form Title', 'give'),
470
+			__('Donation Form', 'give'),
471
+			__('Form Name', 'give'),
472
+			__('Title', 'give'),
473 473
 		),
474 474
 		'form_id'                 => array(
475
-			__( 'Donation Form ID', 'give' ),
476
-			__( 'Form ID', 'give' )
475
+			__('Donation Form ID', 'give'),
476
+			__('Form ID', 'give')
477 477
 		),
478 478
 		'form_level'              => array(
479
-			__( 'Donation Level', 'give' ),
480
-			__( 'Level', 'give' ),
479
+			__('Donation Level', 'give'),
480
+			__('Level', 'give'),
481 481
 		),
482
-		'form_custom_amount_text' => __( 'Custom Amount Text', 'give' ),
483
-	) );
482
+		'form_custom_amount_text' => __('Custom Amount Text', 'give'),
483
+	));
484 484
 }
485 485
 
486 486
 /**
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
  *
494 494
  * @return array
495 495
  */
496
-function give_get_donation_data_from_csv( $file_id, $start, $end, $delimiter = 'csv' ) {
496
+function give_get_donation_data_from_csv($file_id, $start, $end, $delimiter = 'csv') {
497 497
 	/**
498 498
 	 * Filter to modify delimiter of Import.
499 499
 	 *
@@ -502,19 +502,19 @@  discard block
 block discarded – undo
502 502
 	 *
503 503
 	 * Return string $delimiter.
504 504
 	 */
505
-	$delimiter = (string) apply_filters( 'give_import_delimiter_set', $delimiter );
505
+	$delimiter = (string) apply_filters('give_import_delimiter_set', $delimiter);
506 506
 
507 507
 	$raw_data = array();
508
-	$file_dir = get_attached_file( $file_id );
508
+	$file_dir = get_attached_file($file_id);
509 509
 	$count    = 0;
510
-	if ( false !== ( $handle = fopen( $file_dir, 'r' ) ) ) {
511
-		while ( false !== ( $row = fgetcsv( $handle, 0, $delimiter ) ) ) {
512
-			if ( $count >= $start && $count <= $end ) {
510
+	if (false !== ($handle = fopen($file_dir, 'r'))) {
511
+		while (false !== ($row = fgetcsv($handle, 0, $delimiter))) {
512
+			if ($count >= $start && $count <= $end) {
513 513
 				$raw_data[] = $row;
514 514
 			}
515
-			$count ++;
515
+			$count++;
516 516
 		}
517
-		fclose( $handle );
517
+		fclose($handle);
518 518
 	}
519 519
 
520 520
 	return $raw_data;
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
  *
531 531
  * @return bool
532 532
  */
533
-function give_log_user_in_on_register_callback( $value ) {
533
+function give_log_user_in_on_register_callback($value) {
534 534
 	return false;
535 535
 }
536 536
 
@@ -546,22 +546,22 @@  discard block
 block discarded – undo
546 546
  *
547 547
  * @return bool
548 548
  */
549
-function give_save_import_donation_to_db( $raw_key, $row_data, $main_key = array(), $import_setting = array() ) {
550
-	$data                          = array_combine( $raw_key, $row_data );
549
+function give_save_import_donation_to_db($raw_key, $row_data, $main_key = array(), $import_setting = array()) {
550
+	$data                          = array_combine($raw_key, $row_data);
551 551
 	$price_id                      = false;
552 552
 	$donor_id                      = 0;
553
-	$import_setting['create_user'] = ( isset( $import_setting['create_user'] ) ? $import_setting['create_user'] : 1 );
553
+	$import_setting['create_user'] = (isset($import_setting['create_user']) ? $import_setting['create_user'] : 1);
554 554
 
555
-	$data = (array) apply_filters( 'give_save_import_donation_to_db', $data );
555
+	$data = (array) apply_filters('give_save_import_donation_to_db', $data);
556 556
 
557
-	$data['amount'] = give_maybe_sanitize_amount( $data['amount'] );
557
+	$data['amount'] = give_maybe_sanitize_amount($data['amount']);
558 558
 
559 559
 	// Here come the login function.
560
-	$donor_data = give_import_get_user_from_csv( $data, $import_setting );
561
-	if ( ! empty( $donor_data->id ) ) {
562
-		if ( ! empty( $donor_data->user_id ) ) {
560
+	$donor_data = give_import_get_user_from_csv($data, $import_setting);
561
+	if ( ! empty($donor_data->id)) {
562
+		if ( ! empty($donor_data->user_id)) {
563 563
 			$donor_id = $donor_data->user_id;
564
-		} elseif ( ! empty( $data['user_id'] ) ) {
564
+		} elseif ( ! empty($data['user_id'])) {
565 565
 			$donor_id = $data['user_id'];
566 566
 		}
567 567
 	} else {
@@ -569,24 +569,24 @@  discard block
 block discarded – undo
569 569
 	}
570 570
 
571 571
 	// get form data or register a form data.
572
-	$form = give_import_get_form_data_from_csv( $data, $import_setting );
573
-	if ( false == $form ) {
572
+	$form = give_import_get_form_data_from_csv($data, $import_setting);
573
+	if (false == $form) {
574 574
 		return false;
575 575
 	} else {
576
-		$price_id = ( ! empty( $form->price_id ) ) ? $form->price_id : false;
576
+		$price_id = ( ! empty($form->price_id)) ? $form->price_id : false;
577 577
 	}
578 578
 
579 579
 
580
-	$status = give_import_donation_get_status( $data );
580
+	$status = give_import_donation_get_status($data);
581 581
 
582 582
 
583 583
 	$address = array(
584
-		'line1'   => ( ! empty( $data['line1'] ) ? give_clean( $data['line1'] ) : '' ),
585
-		'line2'   => ( ! empty( $data['line1'] ) ? give_clean( $data['line2'] ) : '' ),
586
-		'city'    => ( ! empty( $data['line1'] ) ? give_clean( $data['city'] ) : '' ),
587
-		'zip'     => ( ! empty( $data['zip'] ) ? give_clean( $data['zip'] ) : '' ),
588
-		'state'   => ( ! empty( $data['state'] ) ? give_clean( $data['state'] ) : '' ),
589
-		'country' => ( ! empty( $data['country'] ) ? ( ( $country_code = array_search( $data['country'], give_get_country_list() ) ) ? $country_code : $data['country'] ) : '' ),
584
+		'line1'   => ( ! empty($data['line1']) ? give_clean($data['line1']) : ''),
585
+		'line2'   => ( ! empty($data['line1']) ? give_clean($data['line2']) : ''),
586
+		'city'    => ( ! empty($data['line1']) ? give_clean($data['city']) : ''),
587
+		'zip'     => ( ! empty($data['zip']) ? give_clean($data['zip']) : ''),
588
+		'state'   => ( ! empty($data['state']) ? give_clean($data['state']) : ''),
589
+		'country' => ( ! empty($data['country']) ? (($country_code = array_search($data['country'], give_get_country_list())) ? $country_code : $data['country']) : ''),
590 590
 	);
591 591
 
592 592
 	//Create payment_data array
@@ -597,72 +597,72 @@  discard block
 block discarded – undo
597 597
 		'currency'        => give_get_currency(),
598 598
 		'user_info'       => array(
599 599
 			'id'         => $donor_id,
600
-			'email'      => ( ! empty( $data['email'] ) ? $data['email'] : ( isset( $donor_data->email ) ? $donor_data->email : false ) ),
601
-			'first_name' => ( ! empty( $data['first_name'] ) ? $data['first_name'] : ( ! empty( $donor_id ) && ( $first_name = get_user_meta( $donor_id, 'first_name', true ) ) ? $first_name : $donor_data->name ) ),
602
-			'last_name'  => ( ! empty( $data['last_name'] ) ? $data['last_name'] : ( ! empty( $donor_id ) && ( $last_name = get_user_meta( $donor_id, 'last_name', true ) ) ? $last_name : $donor_data->name ) ),
600
+			'email'      => ( ! empty($data['email']) ? $data['email'] : (isset($donor_data->email) ? $donor_data->email : false)),
601
+			'first_name' => ( ! empty($data['first_name']) ? $data['first_name'] : ( ! empty($donor_id) && ($first_name = get_user_meta($donor_id, 'first_name', true)) ? $first_name : $donor_data->name)),
602
+			'last_name'  => ( ! empty($data['last_name']) ? $data['last_name'] : ( ! empty($donor_id) && ($last_name = get_user_meta($donor_id, 'last_name', true)) ? $last_name : $donor_data->name)),
603 603
 			'address'    => $address,
604 604
 		),
605
-		'gateway'         => ( ! empty( $data['gateway'] ) && 'offline' != strtolower( $data['gateway'] ) ? strtolower( $data['gateway'] ) : 'manual' ),
606
-		'give_form_title' => ( ! empty( $data['form_title'] ) ? $data['form_title'] : $form->get_name() ),
605
+		'gateway'         => ( ! empty($data['gateway']) && 'offline' != strtolower($data['gateway']) ? strtolower($data['gateway']) : 'manual'),
606
+		'give_form_title' => ( ! empty($data['form_title']) ? $data['form_title'] : $form->get_name()),
607 607
 		'give_form_id'    => (string) $form->get_ID(),
608 608
 		'give_price_id'   => $price_id,
609
-		'purchase_key'    => strtolower( md5( uniqid() ) ),
609
+		'purchase_key'    => strtolower(md5(uniqid())),
610 610
 		'user_email'      => $data['email'],
611
-		'post_date'       => ( ! empty( $data['post_date'] ) ? mysql2date( 'Y-m-d H:i:s', $data['post_date'] ) : current_time( 'mysql' ) ),
612
-		'mode'            => ( ! empty( $data['mode'] ) ? ( 'true' == (string) $data['mode'] || 'TRUE' == (string) $data['mode'] ? 'test' : 'live' ) : ( isset( $import_setting['mode'] ) ? ( true == (bool) $import_setting['mode'] ? 'test' : 'live' ) : ( give_is_test_mode() ? 'test' : 'live' ) ) ),
611
+		'post_date'       => ( ! empty($data['post_date']) ? mysql2date('Y-m-d H:i:s', $data['post_date']) : current_time('mysql')),
612
+		'mode'            => ( ! empty($data['mode']) ? ('true' == (string) $data['mode'] || 'TRUE' == (string) $data['mode'] ? 'test' : 'live') : (isset($import_setting['mode']) ? (true == (bool) $import_setting['mode'] ? 'test' : 'live') : (give_is_test_mode() ? 'test' : 'live'))),
613 613
 	);
614 614
 
615
-	$payment_data = apply_filters( 'give_import_before_import_payment', $payment_data, $data, $donor_data, $form );
615
+	$payment_data = apply_filters('give_import_before_import_payment', $payment_data, $data, $donor_data, $form);
616 616
 
617 617
 	// Get the report
618 618
 	$report = give_import_donation_report();
619 619
 
620 620
 	// Check for duplicate code.
621
-	$donation_duplicate = give_check_import_donation_duplicate( $payment_data, $data, $form, $donor_data );
622
-	if ( false !== $donation_duplicate ) {
623
-		$report['donation_details'][ $import_setting['donation_key'] ]['duplicate'] = $donation_duplicate;
624
-		$report['duplicate_donation'] = ( ! empty( $report['duplicate_donation'] ) ? ( absint( $report['duplicate_donation'] ) + 1 ) : 1 );
621
+	$donation_duplicate = give_check_import_donation_duplicate($payment_data, $data, $form, $donor_data);
622
+	if (false !== $donation_duplicate) {
623
+		$report['donation_details'][$import_setting['donation_key']]['duplicate'] = $donation_duplicate;
624
+		$report['duplicate_donation'] = ( ! empty($report['duplicate_donation']) ? (absint($report['duplicate_donation']) + 1) : 1);
625 625
 	} else {
626
-		add_action( 'give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1, 1 );
627
-		add_filter( 'give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11, 2 );
628
-		add_filter( 'give_update_donor_information', 'give_donation_import_update_donor_information', 11, 3 );
629
-		add_action( 'give_insert_payment', 'give_import_donation_insert_payment', 11, 2 );
630
-		$payment = give_insert_payment( $payment_data );
631
-		remove_action( 'give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1 );
632
-		remove_filter( 'give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11 );
633
-		remove_filter( 'give_update_donor_information', 'give_donation_import_update_donor_information', 11 );
634
-		remove_action( 'give_insert_payment', 'give_import_donation_insert_payment', 11 );
626
+		add_action('give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1, 1);
627
+		add_filter('give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11, 2);
628
+		add_filter('give_update_donor_information', 'give_donation_import_update_donor_information', 11, 3);
629
+		add_action('give_insert_payment', 'give_import_donation_insert_payment', 11, 2);
630
+		$payment = give_insert_payment($payment_data);
631
+		remove_action('give_update_payment_status', 'give_donation_import_insert_default_payment_note', 1);
632
+		remove_filter('give_insert_payment_args', 'give_donation_import_give_insert_payment_args', 11);
633
+		remove_filter('give_update_donor_information', 'give_donation_import_update_donor_information', 11);
634
+		remove_action('give_insert_payment', 'give_import_donation_insert_payment', 11);
635 635
 
636
-		if ( $payment ) {
636
+		if ($payment) {
637 637
 
638
-			$report['create_donation'] = ( ! empty( $report['create_donation'] ) ? ( absint( $report['create_donation'] ) + 1 ) : 1 );
638
+			$report['create_donation'] = ( ! empty($report['create_donation']) ? (absint($report['create_donation']) + 1) : 1);
639 639
 
640
-			update_post_meta( $payment, '_give_payment_import', true );
640
+			update_post_meta($payment, '_give_payment_import', true);
641 641
 
642
-			if ( ! empty( $import_setting['csv'] ) ) {
643
-				update_post_meta( $payment, '_give_payment_import_id', $import_setting['csv'] );
642
+			if ( ! empty($import_setting['csv'])) {
643
+				update_post_meta($payment, '_give_payment_import_id', $import_setting['csv']);
644 644
 			}
645 645
 
646 646
 			// Insert Notes.
647
-			if ( ! empty( $data['notes'] ) ) {
648
-				give_insert_payment_note( $payment, $data['notes'] );
647
+			if ( ! empty($data['notes'])) {
648
+				give_insert_payment_note($payment, $data['notes']);
649 649
 			}
650 650
 
651
-			$meta_exists = array_keys( $raw_key, 'post_meta' );
652
-			if ( ! empty( $main_key ) && ! empty( $meta_exists ) ) {
653
-				foreach ( $meta_exists as $meta_exist ) {
654
-					if ( ! empty( $main_key[ $meta_exist ] ) && ! empty( $row_data[ $meta_exist ] ) ) {
655
-						update_post_meta( $payment, $main_key[ $meta_exist ], $row_data[ $meta_exist ] );
651
+			$meta_exists = array_keys($raw_key, 'post_meta');
652
+			if ( ! empty($main_key) && ! empty($meta_exists)) {
653
+				foreach ($meta_exists as $meta_exist) {
654
+					if ( ! empty($main_key[$meta_exist]) && ! empty($row_data[$meta_exist])) {
655
+						update_post_meta($payment, $main_key[$meta_exist], $row_data[$meta_exist]);
656 656
 					}
657 657
 				}
658 658
 			}
659 659
 		} else {
660
-			$report['failed_donation'] = ( ! empty( $report['failed_donation'] ) ? ( absint( $report['failed_donation'] ) + 1 ) : 1 );
660
+			$report['failed_donation'] = ( ! empty($report['failed_donation']) ? (absint($report['failed_donation']) + 1) : 1);
661 661
 		}
662 662
 	}
663 663
 
664 664
 	// update the report
665
-	give_import_donation_report_update( $report );
665
+	give_import_donation_report_update($report);
666 666
 
667 667
 	return true;
668 668
 }
@@ -676,25 +676,25 @@  discard block
 block discarded – undo
676 676
  *
677 677
  * @return string $status Donation status.
678 678
  */
679
-function give_import_donation_get_status( $data ) {
680
-	if ( empty( $data['post_status'] ) ) {
679
+function give_import_donation_get_status($data) {
680
+	if (empty($data['post_status'])) {
681 681
 		return 'publish';
682 682
 	}
683 683
 
684 684
 	$status = 'publish';
685 685
 
686
-	$donation_status = trim( $data['post_status'] );
687
-	$donation_status_key      = strtolower( preg_replace( '/\s+/', '', $donation_status ) );
686
+	$donation_status = trim($data['post_status']);
687
+	$donation_status_key = strtolower(preg_replace('/\s+/', '', $donation_status));
688 688
 
689
-	foreach ( give_get_payment_statuses() as $key => $value ) {
689
+	foreach (give_get_payment_statuses() as $key => $value) {
690 690
 		$match = false;
691
-		if ( $key === $donation_status_key ) {
691
+		if ($key === $donation_status_key) {
692 692
 			$match = true;
693
-		} else if ( stristr( $donation_status, $value ) ) {
693
+		} else if (stristr($donation_status, $value)) {
694 694
 			$match = true;
695 695
 		}
696 696
 
697
-		if ( ! empty( $match ) ) {
697
+		if ( ! empty($match)) {
698 698
 			$status = $key;
699 699
 			break;
700 700
 		}
@@ -714,12 +714,12 @@  discard block
 block discarded – undo
714 714
  *
715 715
  * @return Give_Donor
716 716
  */
717
-function give_donation_import_update_donor_information( $donor, $payment_id, $payment_data ) {
717
+function give_donation_import_update_donor_information($donor, $payment_id, $payment_data) {
718 718
 	$old_donor = $donor;
719
-	if ( ! empty( $payment_data['donor_id'] ) ) {
720
-		$donor_id = absint( $payment_data['donor_id'] );
721
-		$donor    = new Give_Donor( $donor_id );
722
-		if ( ! empty( $donor->id ) ) {
719
+	if ( ! empty($payment_data['donor_id'])) {
720
+		$donor_id = absint($payment_data['donor_id']);
721
+		$donor    = new Give_Donor($donor_id);
722
+		if ( ! empty($donor->id)) {
723 723
 			return $donor;
724 724
 		}
725 725
 	}
@@ -732,12 +732,12 @@  discard block
 block discarded – undo
732 732
  *
733 733
  * @since 1.8.13
734 734
  */
735
-function give_import_donation_insert_payment( $payment_id, $payment_data ) {
735
+function give_import_donation_insert_payment($payment_id, $payment_data) {
736 736
 	// Update Give Customers purchase_count
737
-	if ( ! empty( $payment_data['status'] ) && ( 'complete' === (string) $payment_data['status'] || 'publish' === (string) $payment_data['status'] ) ) {
738
-		$donor_id = (int) get_post_meta( $payment_id, '_give_payment_customer_id', true );
739
-		if ( ! empty( $donor_id ) ) {
740
-			$donor = new Give_Donor( $donor_id );
737
+	if ( ! empty($payment_data['status']) && ('complete' === (string) $payment_data['status'] || 'publish' === (string) $payment_data['status'])) {
738
+		$donor_id = (int) get_post_meta($payment_id, '_give_payment_customer_id', true);
739
+		if ( ! empty($donor_id)) {
740
+			$donor = new Give_Donor($donor_id);
741 741
 			$donor->increase_purchase_count();
742 742
 		}
743 743
 	}
@@ -748,8 +748,8 @@  discard block
 block discarded – undo
748 748
  *
749 749
  * @since 1.8.13
750 750
  */
751
-function give_donation_import_give_insert_payment_args( $args, $payment_data ) {
752
-	if ( ! empty( $payment_data['user_info']['id'] ) ) {
751
+function give_donation_import_give_insert_payment_args($args, $payment_data) {
752
+	if ( ! empty($payment_data['user_info']['id'])) {
753 753
 		$args['post_author'] = (int) $payment_data['user_info']['id'];
754 754
 	}
755 755
 
@@ -761,11 +761,11 @@  discard block
 block discarded – undo
761 761
  *
762 762
  * @since 1.8.13
763 763
  */
764
-function give_check_import_donation_duplicate( $payment_data, $data, $form, $donor_data ) {
764
+function give_check_import_donation_duplicate($payment_data, $data, $form, $donor_data) {
765 765
 	$return = false;
766
-	if ( ! empty( $data['post_date'] ) ) {
767
-		$post_date = mysql2date( 'Y-m-d-H-i-s', $data['post_date'] );
768
-		$post_date = explode( '-', $post_date );
766
+	if ( ! empty($data['post_date'])) {
767
+		$post_date = mysql2date('Y-m-d-H-i-s', $data['post_date']);
768
+		$post_date = explode('-', $post_date);
769 769
 		$args = array(
770 770
 			'output'                 => 'post',
771 771
 			'cache_results'          => false,
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
 			'meta_query'             => array(
787 787
 				array(
788 788
 					'key'     => '_give_payment_total',
789
-					'value'   => preg_replace( '/[\$,]/', '', $payment_data['price'] ),
789
+					'value'   => preg_replace('/[\$,]/', '', $payment_data['price']),
790 790
 					'compare' => 'LIKE',
791 791
 				),
792 792
 				array(
@@ -808,9 +808,9 @@  discard block
 block discarded – undo
808 808
 			),
809 809
 		);
810 810
 
811
-		$payments  = new Give_Payments_Query( $args );
811
+		$payments  = new Give_Payments_Query($args);
812 812
 		$donations = $payments->get_payments();
813
-		if ( ! empty( $donations ) ) {
813
+		if ( ! empty($donations)) {
814 814
 			$return = $donations;
815 815
 		}
816 816
 	}
@@ -820,7 +820,7 @@  discard block
 block discarded – undo
820 820
 	 *
821 821
 	 * @since 1.8.18
822 822
 	 */
823
-	return apply_filters( 'give_check_import_donation_duplicate', $return, $payment_data, $data, $form, $donor_data );
823
+	return apply_filters('give_check_import_donation_duplicate', $return, $payment_data, $data, $form, $donor_data);
824 824
 }
825 825
 
826 826
 /**
@@ -832,9 +832,9 @@  discard block
 block discarded – undo
832 832
  *
833 833
  * @return void
834 834
  */
835
-function give_donation_import_insert_default_payment_note( $payment_id ) {
835
+function give_donation_import_insert_default_payment_note($payment_id) {
836 836
 	$current_user = wp_get_current_user();
837
-	give_insert_payment_note( $payment_id, esc_html( wp_sprintf( __( 'This donation was imported by %s', 'give' ), $current_user->user_email ) ) );
837
+	give_insert_payment_note($payment_id, esc_html(wp_sprintf(__('This donation was imported by %s', 'give'), $current_user->user_email)));
838 838
 }
839 839
 
840 840
 /**
@@ -846,14 +846,14 @@  discard block
 block discarded – undo
846 846
  *
847 847
  * @return string URL
848 848
  */
849
-function give_import_page_url( $parameter = array() ) {
849
+function give_import_page_url($parameter = array()) {
850 850
 	$defalut_query_arg = array(
851 851
 		'post_type'     => 'give_forms',
852 852
 		'page'          => 'give-tools',
853 853
 		'tab'           => 'import',
854 854
 		'importer-type' => 'import_donations',
855 855
 	);
856
-	$import_query_arg  = wp_parse_args( $parameter, $defalut_query_arg );
856
+	$import_query_arg = wp_parse_args($parameter, $defalut_query_arg);
857 857
 
858
-	return add_query_arg( $import_query_arg, admin_url( 'edit.php' ) );
858
+	return add_query_arg($import_query_arg, admin_url('edit.php'));
859 859
 }
860 860
\ No newline at end of file
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   +91 added lines, -91 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,13 +170,13 @@  discard block
 block discarded – undo
170 170
 	 *
171 171
 	 * @return string
172 172
 	 */
173
-	public function column_name( $donor ) {
174
-		$name     = '#' . $donor['id'] . ' ';
175
-		$name     .= ! empty( $donor['name'] ) ? $donor['name'] : '<em>' . __( 'Unnamed Donor', 'give' ) . '</em>';
176
-		$view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor['id'] );
177
-		$actions  = $this->get_row_actions( $donor );
173
+	public function column_name($donor) {
174
+		$name     = '#'.$donor['id'].' ';
175
+		$name .= ! empty($donor['name']) ? $donor['name'] : '<em>'.__('Unnamed Donor', 'give').'</em>';
176
+		$view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor['id']);
177
+		$actions  = $this->get_row_actions($donor);
178 178
 
179
-		return '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>' . $this->row_actions( $actions );
179
+		return '<a href="'.esc_url($view_url).'">'.$name.'</a>'.$this->row_actions($actions);
180 180
 	}
181 181
 
182 182
 	/**
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
 	public function get_columns() {
191 191
 		$columns = array(
192 192
 			'cb'            => '<input type="checkbox" />', // Render a checkbox instead of text.
193
-			'name'          => __( 'Name', 'give' ),
194
-			'email'         => __( 'Email', 'give' ),
195
-			'num_donations' => __( 'Donations', 'give' ),
196
-			'amount_spent'  => __( 'Total Donated', 'give' ),
197
-			'date_created'  => __( 'Date Created', 'give' ),
193
+			'name'          => __('Name', 'give'),
194
+			'email'         => __('Email', 'give'),
195
+			'num_donations' => __('Donations', 'give'),
196
+			'amount_spent'  => __('Total Donated', 'give'),
197
+			'date_created'  => __('Date Created', 'give'),
198 198
 		);
199 199
 
200
-		return apply_filters( 'give_list_donors_columns', $columns );
200
+		return apply_filters('give_list_donors_columns', $columns);
201 201
 
202 202
 	}
203 203
 
@@ -211,13 +211,13 @@  discard block
 block discarded – undo
211 211
 	public function get_sortable_columns() {
212 212
 
213 213
 		$columns = array(
214
-			'date_created'  => array( 'date_created', true ),
215
-			'name'          => array( 'name', true ),
216
-			'num_donations' => array( 'purchase_count', false ),
217
-			'amount_spent'  => array( 'purchase_value', false ),
214
+			'date_created'  => array('date_created', true),
215
+			'name'          => array('name', true),
216
+			'num_donations' => array('purchase_count', false),
217
+			'amount_spent'  => array('purchase_value', false),
218 218
 		);
219 219
 
220
-		return apply_filters( 'give_list_donors_sortable_columns', $columns );
220
+		return apply_filters('give_list_donors_sortable_columns', $columns);
221 221
 	}
222 222
 
223 223
 	/**
@@ -230,15 +230,15 @@  discard block
 block discarded – undo
230 230
 	 *
231 231
 	 * @return array An array of action links.
232 232
 	 */
233
-	public function get_row_actions( $donor ) {
233
+	public function get_row_actions($donor) {
234 234
 
235 235
 		$actions = array(
236
-			'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' ) ),
237
-			'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' ) ),
238
-			'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' ) ),
236
+			'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')),
237
+			'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')),
238
+			'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')),
239 239
 		);
240 240
 
241
-		return apply_filters( 'give_donor_row_actions', $actions, $donor );
241
+		return apply_filters('give_donor_row_actions', $actions, $donor);
242 242
 
243 243
 	}
244 244
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 * @return int Current page number.
252 252
 	 */
253 253
 	public function get_paged() {
254
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
254
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
255 255
 	}
256 256
 
257 257
 	/**
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 	 * @return mixed string If search is present, false otherwise.
264 264
 	 */
265 265
 	public function get_search() {
266
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
266
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
267 267
 	}
268 268
 
269 269
 	/**
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	 */
277 277
 	public function get_bulk_actions() {
278 278
 		$actions = array(
279
-			'delete' => __( 'Delete', 'give' ),
279
+			'delete' => __('Delete', 'give'),
280 280
 		);
281 281
 		return $actions;
282 282
 	}
@@ -289,19 +289,19 @@  discard block
 block discarded – undo
289 289
 	 * @access protected
290 290
 	 * @since  1.8.16
291 291
 	 */
292
-	protected function display_tablenav( $which ) {
293
-		if ( 'top' === $which ) {
294
-			wp_nonce_field( 'bulk-' . $this->_args['plural'], '_wpnonce', false );
292
+	protected function display_tablenav($which) {
293
+		if ('top' === $which) {
294
+			wp_nonce_field('bulk-'.$this->_args['plural'], '_wpnonce', false);
295 295
 		}
296 296
 		?>
297
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
298
-			<?php if ( $this->has_items() ): ?>
297
+		<div class="tablenav <?php echo esc_attr($which); ?>">
298
+			<?php if ($this->has_items()): ?>
299 299
 				<div class="alignleft actions bulkactions">
300
-					<?php $this->bulk_actions( $which ); ?>
300
+					<?php $this->bulk_actions($which); ?>
301 301
 				</div>
302 302
 			<?php endif;
303
-			$this->extra_tablenav( $which );
304
-			$this->pagination( $which );
303
+			$this->extra_tablenav($which);
304
+			$this->pagination($which);
305 305
 			?>
306 306
 			<br class="clear" />
307 307
 		</div>
@@ -322,13 +322,13 @@  discard block
 block discarded – undo
322 322
 
323 323
 		// Get donor query.
324 324
 		$args   = $this->get_donor_query();
325
-		$donors = Give()->donors->get_donors( $args );
325
+		$donors = Give()->donors->get_donors($args);
326 326
 
327
-		if ( $donors ) {
327
+		if ($donors) {
328 328
 
329
-			foreach ( $donors as $donor ) {
329
+			foreach ($donors as $donor) {
330 330
 
331
-				$user_id = ! empty( $donor->user_id ) ? intval( $donor->user_id ) : 0;
331
+				$user_id = ! empty($donor->user_id) ? intval($donor->user_id) : 0;
332 332
 
333 333
 				$data[] = array(
334 334
 					'id'            => $donor->id,
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 			}
343 343
 		}
344 344
 
345
-		return apply_filters( 'give_donors_column_query_data', $data );
345
+		return apply_filters('give_donors_column_query_data', $data);
346 346
 	}
347 347
 
348 348
 	/**
@@ -357,9 +357,9 @@  discard block
 block discarded – undo
357 357
 
358 358
 		$_donor_query['number'] = - 1;
359 359
 		$_donor_query['offset'] = 0;
360
-		$donors                 = Give()->donors->get_donors( $_donor_query );
360
+		$donors                 = Give()->donors->get_donors($_donor_query);
361 361
 
362
-		return count( $donors );
362
+		return count($donors);
363 363
 	}
364 364
 
365 365
 	/**
@@ -372,10 +372,10 @@  discard block
 block discarded – undo
372 372
 	 */
373 373
 	public function get_donor_query() {
374 374
 		$paged   = $this->get_paged();
375
-		$offset  = $this->per_page * ( $paged - 1 );
375
+		$offset  = $this->per_page * ($paged - 1);
376 376
 		$search  = $this->get_search();
377
-		$order   = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC';
378
-		$orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id';
377
+		$order   = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC';
378
+		$orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id';
379 379
 
380 380
 		$args = array(
381 381
 			'number'  => $this->per_page,
@@ -384,10 +384,10 @@  discard block
 block discarded – undo
384 384
 			'orderby' => $orderby,
385 385
 		);
386 386
 
387
-		if ( $search ) {
388
-			if ( is_email( $search ) ) {
387
+		if ($search) {
388
+			if (is_email($search)) {
389 389
 				$args['email'] = $search;
390
-			} elseif ( is_numeric( $search ) ) {
390
+			} elseif (is_numeric($search)) {
391 391
 				$args['id'] = $search;
392 392
 			} else {
393 393
 				$args['name'] = $search;
@@ -405,9 +405,9 @@  discard block
 block discarded – undo
405 405
 	 * @since  1.8.17
406 406
 	 * @access public
407 407
 	 */
408
-	public function single_row( $item ) {
409
-		echo sprintf( '<tr id="donor-%1$d" data-id="%2$d" data-name="%3$s">', $item['id'], $item['id'], $item['name'] );
410
-		$this->single_row_columns( $item );
408
+	public function single_row($item) {
409
+		echo sprintf('<tr id="donor-%1$d" data-id="%2$d" data-name="%3$s">', $item['id'], $item['id'], $item['name']);
410
+		$this->single_row_columns($item);
411 411
 		echo '</tr>';
412 412
 	}
413 413
 
@@ -420,11 +420,11 @@  discard block
 block discarded – undo
420 420
 	public function display() {
421 421
 		$singular = $this->_args['singular'];
422 422
 
423
-		$this->display_tablenav( 'top' );
423
+		$this->display_tablenav('top');
424 424
 
425
-		$this->screen->render_screen_reader_content( 'heading_list' );
425
+		$this->screen->render_screen_reader_content('heading_list');
426 426
 		?>
427
-		<table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
427
+		<table class="wp-list-table <?php echo implode(' ', $this->get_table_classes()); ?>">
428 428
 			<thead>
429 429
 			<tr>
430 430
 				<?php $this->print_column_headers(); ?>
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 			</thead>
433 433
 
434 434
 			<tbody id="the-list"<?php
435
-			if ( $singular ) {
435
+			if ($singular) {
436 436
 				echo " data-wp-lists='list:$singular'";
437 437
 			} ?>>
438 438
 			<tr class="hidden"></tr>
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 				<td colspan="6" class="colspanchange">
441 441
 
442 442
 					<fieldset class="inline-edit-col-left">
443
-						<legend class="inline-edit-legend"><?php _e( 'BULK DELETE', 'give' ); ?></legend>
443
+						<legend class="inline-edit-legend"><?php _e('BULK DELETE', 'give'); ?></legend>
444 444
 						<div class="inline-edit-col">
445 445
 							<div id="bulk-titles">
446 446
 								<div id="give-bulk-donors" class="give-bulk-donors">
@@ -453,22 +453,22 @@  discard block
 block discarded – undo
453 453
 						<div class="inline-edit-col">
454 454
 							<label>
455 455
 								<input id="give-delete-donor-confirm" type="checkbox" name="give-delete-donor-confirm"/>
456
-								<?php _e( 'Are you sure you want to delete the selected donor(s)?', 'give' ); ?>
456
+								<?php _e('Are you sure you want to delete the selected donor(s)?', 'give'); ?>
457 457
 							</label>
458 458
 							<label>
459 459
 								<input id="give-delete-donor-records" type="checkbox" name="give-delete-donor-records"/>
460
-								<?php _e( 'Delete all associated donations and records?', 'give' ); ?>
460
+								<?php _e('Delete all associated donations and records?', 'give'); ?>
461 461
 							</label>
462 462
 						</div>
463 463
 					</fieldset>
464 464
 
465 465
 					<p class="submit inline-edit-save">
466 466
 						<input type="hidden" name="give_action" value="delete_donor"/>
467
-						<input type="hidden" name="s" value="<?php echo ( ! empty( $_GET['s'] ) ) ? $_GET['s'] : ''; ?>"/>
468
-						<input type="hidden" name="orderby" value="<?php echo ( ! empty( $_GET['orderby'] ) ) ? $_GET['orderby'] : 'id'; ?>"/>
469
-						<input type="hidden" name="order" value="<?php echo ( ! empty( $_GET['order'] ) ) ? $_GET['order'] : 'desc'; ?>"/>
470
-						<button type="button" id="give-bulk-delete-cancel" class="button cancel alignleft"><?php _e( 'Cancel', 'give' ); ?></button>
471
-						<input type="submit" id="give-bulk-delete-button" disabled class="button button-primary alignright" value="<?php _e( 'Delete', 'give' ); ?>">
467
+						<input type="hidden" name="s" value="<?php echo ( ! empty($_GET['s'])) ? $_GET['s'] : ''; ?>"/>
468
+						<input type="hidden" name="orderby" value="<?php echo ( ! empty($_GET['orderby'])) ? $_GET['orderby'] : 'id'; ?>"/>
469
+						<input type="hidden" name="order" value="<?php echo ( ! empty($_GET['order'])) ? $_GET['order'] : 'desc'; ?>"/>
470
+						<button type="button" id="give-bulk-delete-cancel" class="button cancel alignleft"><?php _e('Cancel', 'give'); ?></button>
471
+						<input type="submit" id="give-bulk-delete-button" disabled class="button button-primary alignright" value="<?php _e('Delete', 'give'); ?>">
472 472
 						<br class="clear">
473 473
 					</p>
474 474
 				</td>
@@ -478,13 +478,13 @@  discard block
 block discarded – undo
478 478
 
479 479
 			<tfoot>
480 480
 			<tr>
481
-				<?php $this->print_column_headers( false ); ?>
481
+				<?php $this->print_column_headers(false); ?>
482 482
 			</tr>
483 483
 			</tfoot>
484 484
 
485 485
 		</table>
486 486
 		<?php
487
-		$this->display_tablenav( 'bottom' );
487
+		$this->display_tablenav('bottom');
488 488
 	}
489 489
 
490 490
 	/**
@@ -501,16 +501,16 @@  discard block
 block discarded – undo
501 501
 		$hidden   = array(); // No hidden columns.
502 502
 		$sortable = $this->get_sortable_columns();
503 503
 
504
-		$this->_column_headers = array( $columns, $hidden, $sortable );
504
+		$this->_column_headers = array($columns, $hidden, $sortable);
505 505
 
506 506
 		$this->items = $this->donor_data();
507 507
 
508 508
 		$this->total = $this->get_donor_count();
509 509
 
510
-		$this->set_pagination_args( array(
510
+		$this->set_pagination_args(array(
511 511
 			'total_items' => $this->total,
512 512
 			'per_page'    => $this->per_page,
513
-			'total_pages' => ceil( $this->total / $this->per_page ),
514
-		) );
513
+			'total_pages' => ceil($this->total / $this->per_page),
514
+		));
515 515
 	}
516 516
 }
Please login to merge, or discard this patch.
includes/admin/donors/donor-actions.php 2 patches
Doc Comments   +4 added lines, -4 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 array|bool $output Response messages
24
+ * @return false|null $output Response messages
25 25
  */
26 26
 function give_edit_donor( $args ) {
27 27
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
  *
228 228
  * @since 1.0
229 229
  *
230
- * @return int Whether it was a successful deletion.
230
+ * @return false|null Whether it was a successful deletion.
231 231
  */
232 232
 function give_donor_delete( $args ) {
233 233
 
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
  *
522 522
  * @since  1.7
523 523
  *
524
- * @return bool|null
524
+ * @return false|null
525 525
  */
526 526
 function give_remove_donor_email() {
527 527
 	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
  *
566 566
  * @since  1.7
567 567
  *
568
- * @return bool|null
568
+ * @return false|null
569 569
  */
570 570
 function give_set_donor_primary_email() {
571 571
 	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
Please login to merge, or discard this patch.
Spacing   +204 added lines, -204 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,33 +23,33 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array|bool $output Response messages
25 25
  */
26
-function give_edit_donor( $args ) {
26
+function give_edit_donor($args) {
27 27
 
28
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
28
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
29 29
 
30
-	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
31
-		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
30
+	if ( ! is_admin() || ! current_user_can($donor_edit_role)) {
31
+		wp_die(__('You do not have permission to edit this donor.', 'give'), __('Error', 'give'), array(
32 32
 			'response' => 403,
33
-		) );
33
+		));
34 34
 	}
35 35
 
36
-	if ( empty( $args ) ) {
36
+	if (empty($args)) {
37 37
 		return false;
38 38
 	}
39 39
 
40
-	$donor_info = give_clean( $args['customerinfo'] );
40
+	$donor_info = give_clean($args['customerinfo']);
41 41
 	$donor_id   = (int) $args['customerinfo']['id'];
42 42
 	$nonce      = $args['_wpnonce'];
43 43
 
44
-	if ( ! wp_verify_nonce( $nonce, 'edit-donor' ) ) {
45
-		wp_die( __( 'Cheatin&#8217; uh?', 'give' ), __( 'Error', 'give' ), array(
44
+	if ( ! wp_verify_nonce($nonce, 'edit-donor')) {
45
+		wp_die(__('Cheatin&#8217; uh?', 'give'), __('Error', 'give'), array(
46 46
 			'response' => 400,
47
-		) );
47
+		));
48 48
 	}
49 49
 
50
-	$donor = new Give_Donor( $donor_id );
50
+	$donor = new Give_Donor($donor_id);
51 51
 
52
-	if ( empty( $donor->id ) ) {
52
+	if (empty($donor->id)) {
53 53
 		return false;
54 54
 	}
55 55
 
@@ -64,39 +64,39 @@  discard block
 block discarded – undo
64 64
 		'country' => '',
65 65
 	);
66 66
 
67
-	$donor_info = wp_parse_args( $donor_info, $defaults );
67
+	$donor_info = wp_parse_args($donor_info, $defaults);
68 68
 
69
-	if ( (int) $donor_info['user_id'] !== (int) $donor->user_id ) {
69
+	if ((int) $donor_info['user_id'] !== (int) $donor->user_id) {
70 70
 
71 71
 		// Make sure we don't already have this user attached to a donor.
72
-		if ( ! empty( $donor_info['user_id'] ) && false !== Give()->donors->get_donor_by( 'user_id', $donor_info['user_id'] ) ) {
73
-			give_set_error( 'give-invalid-donor-user_id', sprintf( __( 'The User ID #%d is already associated with a different donor.', 'give' ), $donor_info['user_id'] ) );
72
+		if ( ! empty($donor_info['user_id']) && false !== Give()->donors->get_donor_by('user_id', $donor_info['user_id'])) {
73
+			give_set_error('give-invalid-donor-user_id', sprintf(__('The User ID #%d is already associated with a different donor.', 'give'), $donor_info['user_id']));
74 74
 		}
75 75
 
76 76
 		// Make sure it's actually a user.
77
-		$user = get_user_by( 'id', $donor_info['user_id'] );
78
-		if ( ! empty( $donor_info['user_id'] ) && false === $user ) {
79
-			give_set_error( 'give-invalid-user_id', sprintf( __( 'The User ID #%d does not exist. Please assign an existing user.', 'give' ), $donor_info['user_id'] ) );
77
+		$user = get_user_by('id', $donor_info['user_id']);
78
+		if ( ! empty($donor_info['user_id']) && false === $user) {
79
+			give_set_error('give-invalid-user_id', sprintf(__('The User ID #%d does not exist. Please assign an existing user.', 'give'), $donor_info['user_id']));
80 80
 		}
81 81
 	}
82 82
 
83
-	if ( give_get_errors() ) {
83
+	if (give_get_errors()) {
84 84
 		return false;
85 85
 	}
86 86
 
87 87
 	// If First name of donor is empty, then fetch the current first name of donor.
88
-	if ( empty( $donor_info['first_name'] ) ) {
88
+	if (empty($donor_info['first_name'])) {
89 89
 		$donor_info['first_name'] = $donor->get_first_name();
90 90
 	}
91 91
 
92 92
 	// Sanitize the inputs.
93 93
 	$donor_data               = array();
94
-	$donor_data['name']       = trim( "{$donor_info['first_name']} {$donor_info['last_name']}" );
94
+	$donor_data['name']       = trim("{$donor_info['first_name']} {$donor_info['last_name']}");
95 95
 	$donor_data['first_name'] = $donor_info['first_name'];
96 96
 	$donor_data['last_name']  = $donor_info['last_name'];
97 97
 	$donor_data['user_id']    = $donor_info['user_id'];
98 98
 
99
-	$donor_data             = apply_filters( 'give_edit_donor_info', $donor_data, $donor_id );
99
+	$donor_data = apply_filters('give_edit_donor_info', $donor_data, $donor_id);
100 100
 
101 101
 	/**
102 102
 	 * Filter the address
@@ -104,28 +104,28 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @since 1.0
106 106
 	 */
107
-	$address                = apply_filters( 'give_edit_donor_address', array(), $donor_id );
107
+	$address                = apply_filters('give_edit_donor_address', array(), $donor_id);
108 108
 
109
-	$donor_data             = give_clean( $donor_data );
110
-	$address                = give_clean( $address );
109
+	$donor_data             = give_clean($donor_data);
110
+	$address                = give_clean($address);
111 111
 
112
-	$output = give_connect_user_donor_profile( $donor, $donor_data, $address );
112
+	$output = give_connect_user_donor_profile($donor, $donor_data, $address);
113 113
 
114
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
115
-		header( 'Content-Type: application/json' );
116
-		echo json_encode( $output );
114
+	if (defined('DOING_AJAX') && DOING_AJAX) {
115
+		header('Content-Type: application/json');
116
+		echo json_encode($output);
117 117
 		wp_die();
118 118
 	}
119 119
 
120
-	if ( $output['success'] ) {
121
-		wp_redirect( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}&give-message=profile-updated" ) );
120
+	if ($output['success']) {
121
+		wp_redirect(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}&give-message=profile-updated"));
122 122
 	}
123 123
 
124 124
 	exit;
125 125
 
126 126
 }
127 127
 
128
-add_action( 'give_edit-donor', 'give_edit_donor', 10, 1 );
128
+add_action('give_edit-donor', 'give_edit_donor', 10, 1);
129 129
 
130 130
 /**
131 131
  * Save a donor note.
@@ -136,40 +136,40 @@  discard block
 block discarded – undo
136 136
  *
137 137
  * @return int The Note ID that was saved, or 0 if nothing was saved.
138 138
  */
139
-function give_donor_save_note( $args ) {
139
+function give_donor_save_note($args) {
140 140
 
141
-	$donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' );
141
+	$donor_view_role = apply_filters('give_view_donors_role', 'view_give_reports');
142 142
 
143
-	if ( ! is_admin() || ! current_user_can( $donor_view_role ) ) {
144
-		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
143
+	if ( ! is_admin() || ! current_user_can($donor_view_role)) {
144
+		wp_die(__('You do not have permission to edit this donor.', 'give'), __('Error', 'give'), array(
145 145
 			'response' => 403,
146
-		) );
146
+		));
147 147
 	}
148 148
 
149
-	if ( empty( $args ) ) {
149
+	if (empty($args)) {
150 150
 		return false;
151 151
 	}
152 152
 
153
-	$donor_note = trim( give_clean( $args['donor_note'] ) );
153
+	$donor_note = trim(give_clean($args['donor_note']));
154 154
 	$donor_id   = (int) $args['customer_id'];
155 155
 	$nonce      = $args['add_donor_note_nonce'];
156 156
 
157
-	if ( ! wp_verify_nonce( $nonce, 'add-donor-note' ) ) {
158
-		wp_die( __( 'Cheatin&#8217; uh?', 'give' ), __( 'Error', 'give' ), array(
157
+	if ( ! wp_verify_nonce($nonce, 'add-donor-note')) {
158
+		wp_die(__('Cheatin&#8217; uh?', 'give'), __('Error', 'give'), array(
159 159
 			'response' => 400,
160
-		) );
160
+		));
161 161
 	}
162 162
 
163
-	if ( empty( $donor_note ) ) {
164
-		give_set_error( 'empty-donor-note', __( 'A note is required.', 'give' ) );
163
+	if (empty($donor_note)) {
164
+		give_set_error('empty-donor-note', __('A note is required.', 'give'));
165 165
 	}
166 166
 
167
-	if ( give_get_errors() ) {
167
+	if (give_get_errors()) {
168 168
 		return false;
169 169
 	}
170 170
 
171
-	$donor    = new Give_Donor( $donor_id );
172
-	$new_note = $donor->add_note( $donor_note );
171
+	$donor    = new Give_Donor($donor_id);
172
+	$new_note = $donor->add_note($donor_note);
173 173
 
174 174
 	/**
175 175
 	 * Fires before inserting donor note.
@@ -179,22 +179,22 @@  discard block
 block discarded – undo
179 179
 	 *
180 180
 	 * @since 1.0
181 181
 	 */
182
-	do_action( 'give_pre_insert_donor_note', $donor_id, $new_note );
182
+	do_action('give_pre_insert_donor_note', $donor_id, $new_note);
183 183
 
184
-	if ( ! empty( $new_note ) && ! empty( $donor->id ) ) {
184
+	if ( ! empty($new_note) && ! empty($donor->id)) {
185 185
 
186 186
 		ob_start();
187 187
 		?>
188 188
 		<div class="donor-note-wrapper dashboard-comment-wrap comment-item">
189 189
 			<span class="note-content-wrap">
190
-				<?php echo stripslashes( $new_note ); ?>
190
+				<?php echo stripslashes($new_note); ?>
191 191
 			</span>
192 192
 		</div>
193 193
 		<?php
194 194
 		$output = ob_get_contents();
195 195
 		ob_end_clean();
196 196
 
197
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
197
+		if (defined('DOING_AJAX') && DOING_AJAX) {
198 198
 			echo $output;
199 199
 			exit;
200 200
 		}
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 
208 208
 }
209 209
 
210
-add_action( 'give_add-donor-note', 'give_donor_save_note', 10, 1 );
210
+add_action('give_add-donor-note', 'give_donor_save_note', 10, 1);
211 211
 
212 212
 /**
213 213
  * Delete a donor.
@@ -218,41 +218,41 @@  discard block
 block discarded – undo
218 218
  *
219 219
  * @return int Whether it was a successful deletion.
220 220
  */
221
-function give_donor_delete( $args ) {
221
+function give_donor_delete($args) {
222 222
 
223
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
223
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
224 224
 
225
-	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
226
-		wp_die( __( 'You do not have permission to delete donors.', 'give' ), __( 'Error', 'give' ), array(
225
+	if ( ! is_admin() || ! current_user_can($donor_edit_role)) {
226
+		wp_die(__('You do not have permission to delete donors.', 'give'), __('Error', 'give'), array(
227 227
 			'response' => 403,
228
-		) );
228
+		));
229 229
 	}
230 230
 
231
-	if ( empty( $args ) ) {
231
+	if (empty($args)) {
232 232
 		return false;
233 233
 	}
234 234
 
235 235
 	$donor_id    = (int) $args['customer_id'];
236
-	$confirm     = ! empty( $args['give-donor-delete-confirm'] ) ? true : false;
237
-	$remove_data = ! empty( $args['give-donor-delete-records'] ) ? true : false;
236
+	$confirm     = ! empty($args['give-donor-delete-confirm']) ? true : false;
237
+	$remove_data = ! empty($args['give-donor-delete-records']) ? true : false;
238 238
 	$nonce       = $args['_wpnonce'];
239 239
 
240
-	if ( ! wp_verify_nonce( $nonce, 'delete-donor' ) ) {
241
-		wp_die( __( 'Cheatin&#8217; uh?', 'give' ), __( 'Error', 'give' ), array(
240
+	if ( ! wp_verify_nonce($nonce, 'delete-donor')) {
241
+		wp_die(__('Cheatin&#8217; uh?', 'give'), __('Error', 'give'), array(
242 242
 			'response' => 400,
243
-		) );
243
+		));
244 244
 	}
245 245
 
246
-	if ( ! $confirm ) {
247
-		give_set_error( 'donor-delete-no-confirm', __( 'Please confirm you want to delete this donor.', 'give' ) );
246
+	if ( ! $confirm) {
247
+		give_set_error('donor-delete-no-confirm', __('Please confirm you want to delete this donor.', 'give'));
248 248
 	}
249 249
 
250
-	if ( give_get_errors() ) {
251
-		wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor_id ) );
250
+	if (give_get_errors()) {
251
+		wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor_id));
252 252
 		exit;
253 253
 	}
254 254
 
255
-	$donor = new Give_Donor( $donor_id );
255
+	$donor = new Give_Donor($donor_id);
256 256
 
257 257
 	/**
258 258
 	 * Fires before deleting donor.
@@ -263,50 +263,50 @@  discard block
 block discarded – undo
263 263
 	 *
264 264
 	 * @since 1.0
265 265
 	 */
266
-	do_action( 'give_pre_delete_donor', $donor_id, $confirm, $remove_data );
266
+	do_action('give_pre_delete_donor', $donor_id, $confirm, $remove_data);
267 267
 
268
-	if ( $donor->id > 0 ) {
268
+	if ($donor->id > 0) {
269 269
 
270
-		$payments_array = explode( ',', $donor->payment_ids );
271
-		$success        = Give()->donors->delete( $donor->id );
270
+		$payments_array = explode(',', $donor->payment_ids);
271
+		$success        = Give()->donors->delete($donor->id);
272 272
 
273
-		if ( $success ) {
273
+		if ($success) {
274 274
 
275
-			if ( $remove_data ) {
275
+			if ($remove_data) {
276 276
 
277 277
 				// Remove all donations, logs, etc.
278
-				foreach ( $payments_array as $payment_id ) {
279
-					give_delete_donation( $payment_id );
278
+				foreach ($payments_array as $payment_id) {
279
+					give_delete_donation($payment_id);
280 280
 				}
281 281
 			} else {
282 282
 
283 283
 				// Just set the donations to customer_id of 0.
284
-				foreach ( $payments_array as $payment_id ) {
285
-					give_update_payment_meta( $payment_id, '_give_payment_donor_id', 0 );
284
+				foreach ($payments_array as $payment_id) {
285
+					give_update_payment_meta($payment_id, '_give_payment_donor_id', 0);
286 286
 				}
287 287
 			}
288 288
 
289
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&give-message=donor-deleted' );
289
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&give-message=donor-deleted');
290 290
 
291 291
 		} else {
292 292
 
293
-			give_set_error( 'give-donor-delete-failed', __( 'Error deleting donor.', 'give' ) );
294
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor_id );
293
+			give_set_error('give-donor-delete-failed', __('Error deleting donor.', 'give'));
294
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$donor_id);
295 295
 
296 296
 		}
297 297
 	} else {
298 298
 
299
-		give_set_error( 'give-donor-delete-invalid-id', __( 'Invalid Donor ID.', 'give' ) );
300
-		$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors' );
299
+		give_set_error('give-donor-delete-invalid-id', __('Invalid Donor ID.', 'give'));
300
+		$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors');
301 301
 
302 302
 	}
303 303
 
304
-	wp_redirect( $redirect );
304
+	wp_redirect($redirect);
305 305
 	exit;
306 306
 
307 307
 }
308 308
 
309
-add_action( 'give_delete-donor', 'give_donor_delete', 10, 1 );
309
+add_action('give_delete-donor', 'give_donor_delete', 10, 1);
310 310
 
311 311
 /**
312 312
  * Disconnect a user ID from a donor
@@ -317,17 +317,17 @@  discard block
 block discarded – undo
317 317
  *
318 318
  * @return bool|array If the disconnect was successful.
319 319
  */
320
-function give_disconnect_donor_user_id( $args ) {
320
+function give_disconnect_donor_user_id($args) {
321 321
 
322
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
322
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
323 323
 
324
-	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
325
-		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
324
+	if ( ! is_admin() || ! current_user_can($donor_edit_role)) {
325
+		wp_die(__('You do not have permission to edit this donor.', 'give'), __('Error', 'give'), array(
326 326
 			'response' => 403,
327
-		) );
327
+		));
328 328
 	}
329 329
 
330
-	if ( empty( $args ) ) {
330
+	if (empty($args)) {
331 331
 		return false;
332 332
 	}
333 333
 
@@ -335,14 +335,14 @@  discard block
 block discarded – undo
335 335
 
336 336
 	$nonce = $args['_wpnonce'];
337 337
 
338
-	if ( ! wp_verify_nonce( $nonce, 'edit-donor' ) ) {
339
-		wp_die( __( 'Cheatin&#8217; uh?', 'give' ), __( 'Error', 'give' ), array(
338
+	if ( ! wp_verify_nonce($nonce, 'edit-donor')) {
339
+		wp_die(__('Cheatin&#8217; uh?', 'give'), __('Error', 'give'), array(
340 340
 			'response' => 400,
341
-		) );
341
+		));
342 342
 	}
343 343
 
344
-	$donor = new Give_Donor( $donor_id );
345
-	if ( empty( $donor->id ) ) {
344
+	$donor = new Give_Donor($donor_id);
345
+	if (empty($donor->id)) {
346 346
 		return false;
347 347
 	}
348 348
 
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 	 *
357 357
 	 * @since 1.0
358 358
 	 */
359
-	do_action( 'give_pre_donor_disconnect_user_id', $donor_id, $user_id );
359
+	do_action('give_pre_donor_disconnect_user_id', $donor_id, $user_id);
360 360
 
361 361
 	$output     = array();
362 362
 	$donor_args = array(
@@ -365,19 +365,19 @@  discard block
 block discarded – undo
365 365
 
366 366
 
367 367
 	$output['success'] = true;
368
-	if ( ! $donor->update( $donor_args ) ) {
369
-		update_user_meta( $user_id, '_give_is_donor_disconnected', true );
370
-		update_user_meta( $user_id, '_give_disconnected_donor_id', $donor->id );
371
-		$donor->update_meta( '_give_disconnected_user_id', $user_id );
368
+	if ( ! $donor->update($donor_args)) {
369
+		update_user_meta($user_id, '_give_is_donor_disconnected', true);
370
+		update_user_meta($user_id, '_give_disconnected_donor_id', $donor->id);
371
+		$donor->update_meta('_give_disconnected_user_id', $user_id);
372 372
 
373 373
 		$output['success'] = true;
374 374
 
375 375
 	} else {
376 376
 		$output['success'] = false;
377
-		give_set_error( 'give-disconnect-user-fail', __( 'Failed to disconnect user from donor.', 'give' ) );
377
+		give_set_error('give-disconnect-user-fail', __('Failed to disconnect user from donor.', 'give'));
378 378
 	}
379 379
 
380
-	$output['redirect'] = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' ) . $donor_id;
380
+	$output['redirect'] = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id=').$donor_id;
381 381
 
382 382
 	/**
383 383
 	 * Fires after disconnecting user ID from a donor.
@@ -386,11 +386,11 @@  discard block
 block discarded – undo
386 386
 	 *
387 387
 	 * @since 1.0
388 388
 	 */
389
-	do_action( 'give_post_donor_disconnect_user_id', $donor_id );
389
+	do_action('give_post_donor_disconnect_user_id', $donor_id);
390 390
 
391
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
392
-		header( 'Content-Type: application/json' );
393
-		echo json_encode( $output );
391
+	if (defined('DOING_AJAX') && DOING_AJAX) {
392
+		header('Content-Type: application/json');
393
+		echo json_encode($output);
394 394
 		wp_die();
395 395
 	}
396 396
 
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 
399 399
 }
400 400
 
401
-add_action( 'give_disconnect-userid', 'give_disconnect_donor_user_id', 10, 1 );
401
+add_action('give_disconnect-userid', 'give_disconnect_donor_user_id', 10, 1);
402 402
 
403 403
 /**
404 404
  * Add an email address to the donor from within the admin and log a donor note.
@@ -409,86 +409,86 @@  discard block
 block discarded – undo
409 409
  *
410 410
  * @return mixed If DOING_AJAX echos out JSON, otherwise returns array of success (bool) and message (string).
411 411
  */
412
-function give_add_donor_email( $args ) {
412
+function give_add_donor_email($args) {
413 413
 
414 414
 	$donor_id = '';
415
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
415
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
416 416
 
417
-	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
418
-		wp_die( __( 'You do not have permission to edit this donor.', 'give' ), __( 'Error', 'give' ), array(
417
+	if ( ! is_admin() || ! current_user_can($donor_edit_role)) {
418
+		wp_die(__('You do not have permission to edit this donor.', 'give'), __('Error', 'give'), array(
419 419
 			'response' => 403,
420
-		) );
420
+		));
421 421
 	}
422 422
 
423 423
 	$output = array();
424
-	if ( empty( $args ) || empty( $args['email'] ) || empty( $args['customer_id'] ) ) {
424
+	if (empty($args) || empty($args['email']) || empty($args['customer_id'])) {
425 425
 		$output['success'] = false;
426
-		if ( empty( $args['email'] ) ) {
427
-			$output['message'] = __( 'Email address is required.', 'give' );
428
-		} elseif ( empty( $args['customer_id'] ) ) {
429
-			$output['message'] = __( 'Donor ID is required.', 'give' );
426
+		if (empty($args['email'])) {
427
+			$output['message'] = __('Email address is required.', 'give');
428
+		} elseif (empty($args['customer_id'])) {
429
+			$output['message'] = __('Donor ID is required.', 'give');
430 430
 		} else {
431
-			$output['message'] = __( 'An error has occurred. Please try again.', 'give' );
431
+			$output['message'] = __('An error has occurred. Please try again.', 'give');
432 432
 		}
433
-	} elseif ( ! wp_verify_nonce( $args['_wpnonce'], 'give_add_donor_email' ) ) {
433
+	} elseif ( ! wp_verify_nonce($args['_wpnonce'], 'give_add_donor_email')) {
434 434
 		$output = array(
435 435
 			'success' => false,
436
-			'message' => __( 'Nonce verification failed.', 'give' ),
436
+			'message' => __('Nonce verification failed.', 'give'),
437 437
 		);
438
-	} elseif ( ! is_email( $args['email'] ) ) {
438
+	} elseif ( ! is_email($args['email'])) {
439 439
 		$output = array(
440 440
 			'success' => false,
441
-			'message' => __( 'Invalid email.', 'give' ),
441
+			'message' => __('Invalid email.', 'give'),
442 442
 		);
443 443
 	} else {
444
-		$email    = sanitize_email( $args['email'] );
444
+		$email    = sanitize_email($args['email']);
445 445
 		$donor_id = (int) $args['customer_id'];
446 446
 		$primary  = 'true' === $args['primary'] ? true : false;
447
-		$donor    = new Give_Donor( $donor_id );
448
-		if ( false === $donor->add_email( $email, $primary ) ) {
449
-			if ( in_array( $email, $donor->emails ) ) {
447
+		$donor    = new Give_Donor($donor_id);
448
+		if (false === $donor->add_email($email, $primary)) {
449
+			if (in_array($email, $donor->emails)) {
450 450
 				$output = array(
451 451
 					'success' => false,
452
-					'message' => __( 'Email already associated with this donor.', 'give' ),
452
+					'message' => __('Email already associated with this donor.', 'give'),
453 453
 				);
454 454
 			} else {
455 455
 				$output = array(
456 456
 					'success' => false,
457
-					'message' => __( 'Email address is already associated with another donor.', 'give' ),
457
+					'message' => __('Email address is already associated with another donor.', 'give'),
458 458
 				);
459 459
 			}
460 460
 		} else {
461
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor_id . '&give-message=email-added' );
461
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor_id.'&give-message=email-added');
462 462
 			$output   = array(
463 463
 				'success'  => true,
464
-				'message'  => __( 'Email successfully added to donor.', 'give' ),
464
+				'message'  => __('Email successfully added to donor.', 'give'),
465 465
 				'redirect' => $redirect,
466 466
 			);
467 467
 
468 468
 			$user       = wp_get_current_user();
469
-			$user_login = ! empty( $user->user_login ) ? $user->user_login : __( 'System', 'give' );
470
-			$donor_note = sprintf( __( 'Email address %1$s added by %2$s', 'give' ), $email, $user_login );
471
-			$donor->add_note( $donor_note );
469
+			$user_login = ! empty($user->user_login) ? $user->user_login : __('System', 'give');
470
+			$donor_note = sprintf(__('Email address %1$s added by %2$s', 'give'), $email, $user_login);
471
+			$donor->add_note($donor_note);
472 472
 
473
-			if ( $primary ) {
474
-				$donor_note = sprintf( __( 'Email address %1$s set as primary by %2$s', 'give' ), $email, $user_login );
475
-				$donor->add_note( $donor_note );
473
+			if ($primary) {
474
+				$donor_note = sprintf(__('Email address %1$s set as primary by %2$s', 'give'), $email, $user_login);
475
+				$donor->add_note($donor_note);
476 476
 			}
477 477
 		}
478 478
 	} // End if().
479 479
 
480
-	do_action( 'give_post_add_donor_email', $donor_id, $args );
480
+	do_action('give_post_add_donor_email', $donor_id, $args);
481 481
 
482
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
483
-		header( 'Content-Type: application/json' );
484
-		echo json_encode( $output );
482
+	if (defined('DOING_AJAX') && DOING_AJAX) {
483
+		header('Content-Type: application/json');
484
+		echo json_encode($output);
485 485
 		wp_die();
486 486
 	}
487 487
 
488 488
 	return $output;
489 489
 }
490 490
 
491
-add_action( 'give_add_donor_email', 'give_add_donor_email', 10, 1 );
491
+add_action('give_add_donor_email', 'give_add_donor_email', 10, 1);
492 492
 
493 493
 
494 494
 /**
@@ -499,39 +499,39 @@  discard block
 block discarded – undo
499 499
  * @return bool|null
500 500
  */
501 501
 function give_remove_donor_email() {
502
-	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
502
+	if (empty($_GET['id']) || ! is_numeric($_GET['id'])) {
503 503
 		return false;
504 504
 	}
505
-	if ( empty( $_GET['email'] ) || ! is_email( $_GET['email'] ) ) {
505
+	if (empty($_GET['email']) || ! is_email($_GET['email'])) {
506 506
 		return false;
507 507
 	}
508
-	if ( empty( $_GET['_wpnonce'] ) ) {
508
+	if (empty($_GET['_wpnonce'])) {
509 509
 		return false;
510 510
 	}
511 511
 
512 512
 	$nonce = $_GET['_wpnonce'];
513
-	if ( ! wp_verify_nonce( $nonce, 'give-remove-donor-email' ) ) {
514
-		wp_die( __( 'Nonce verification failed', 'give' ), __( 'Error', 'give' ), array(
513
+	if ( ! wp_verify_nonce($nonce, 'give-remove-donor-email')) {
514
+		wp_die(__('Nonce verification failed', 'give'), __('Error', 'give'), array(
515 515
 			'response' => 403,
516
-		) );
516
+		));
517 517
 	}
518 518
 
519
-	$donor = new Give_Donor( $_GET['id'] );
520
-	if ( $donor->remove_email( $_GET['email'] ) ) {
521
-		$url        = add_query_arg( 'give-message', 'email-removed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) );
519
+	$donor = new Give_Donor($_GET['id']);
520
+	if ($donor->remove_email($_GET['email'])) {
521
+		$url        = add_query_arg('give-message', 'email-removed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id));
522 522
 		$user       = wp_get_current_user();
523
-		$user_login = ! empty( $user->user_login ) ? $user->user_login : __( 'System', 'give' );
524
-		$donor_note = sprintf( __( 'Email address %1$s removed by %2$s', 'give' ), $_GET['email'], $user_login );
525
-		$donor->add_note( $donor_note );
523
+		$user_login = ! empty($user->user_login) ? $user->user_login : __('System', 'give');
524
+		$donor_note = sprintf(__('Email address %1$s removed by %2$s', 'give'), $_GET['email'], $user_login);
525
+		$donor->add_note($donor_note);
526 526
 	} else {
527
-		$url = add_query_arg( 'give-message', 'email-remove-failed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) );
527
+		$url = add_query_arg('give-message', 'email-remove-failed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id));
528 528
 	}
529 529
 
530
-	wp_safe_redirect( $url );
530
+	wp_safe_redirect($url);
531 531
 	exit;
532 532
 }
533 533
 
534
-add_action( 'give_remove_donor_email', 'give_remove_donor_email', 10 );
534
+add_action('give_remove_donor_email', 'give_remove_donor_email', 10);
535 535
 
536 536
 
537 537
 /**
@@ -543,44 +543,44 @@  discard block
 block discarded – undo
543 543
  * @return bool|null
544 544
  */
545 545
 function give_set_donor_primary_email() {
546
-	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
546
+	if (empty($_GET['id']) || ! is_numeric($_GET['id'])) {
547 547
 		return false;
548 548
 	}
549 549
 
550
-	if ( empty( $_GET['email'] ) || ! is_email( $_GET['email'] ) ) {
550
+	if (empty($_GET['email']) || ! is_email($_GET['email'])) {
551 551
 		return false;
552 552
 	}
553 553
 
554
-	if ( empty( $_GET['_wpnonce'] ) ) {
554
+	if (empty($_GET['_wpnonce'])) {
555 555
 		return false;
556 556
 	}
557 557
 
558 558
 	$nonce = $_GET['_wpnonce'];
559 559
 
560
-	if ( ! wp_verify_nonce( $nonce, 'give-set-donor-primary-email' ) ) {
561
-		wp_die( __( 'Nonce verification failed', 'give' ), __( 'Error', 'give' ), array(
560
+	if ( ! wp_verify_nonce($nonce, 'give-set-donor-primary-email')) {
561
+		wp_die(__('Nonce verification failed', 'give'), __('Error', 'give'), array(
562 562
 			'response' => 403,
563
-		) );
563
+		));
564 564
 	}
565 565
 
566
-	$donor = new Give_Donor( $_GET['id'] );
566
+	$donor = new Give_Donor($_GET['id']);
567 567
 
568
-	if ( $donor->set_primary_email( $_GET['email'] ) ) {
569
-		$url        = add_query_arg( 'give-message', 'primary-email-updated', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) );
568
+	if ($donor->set_primary_email($_GET['email'])) {
569
+		$url        = add_query_arg('give-message', 'primary-email-updated', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id));
570 570
 		$user       = wp_get_current_user();
571
-		$user_login = ! empty( $user->user_login ) ? $user->user_login : __( 'System', 'give' );
572
-		$donor_note = sprintf( __( 'Email address %1$s set as primary by %2$s', 'give' ), $_GET['email'], $user_login );
571
+		$user_login = ! empty($user->user_login) ? $user->user_login : __('System', 'give');
572
+		$donor_note = sprintf(__('Email address %1$s set as primary by %2$s', 'give'), $_GET['email'], $user_login);
573 573
 
574
-		$donor->add_note( $donor_note );
574
+		$donor->add_note($donor_note);
575 575
 	} else {
576
-		$url = add_query_arg( 'give-message', 'primary-email-failed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) );
576
+		$url = add_query_arg('give-message', 'primary-email-failed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id));
577 577
 	}
578 578
 
579
-	wp_safe_redirect( $url );
579
+	wp_safe_redirect($url);
580 580
 	exit;
581 581
 }
582 582
 
583
-add_action( 'give_set_donor_primary_email', 'give_set_donor_primary_email', 10 );
583
+add_action('give_set_donor_primary_email', 'give_set_donor_primary_email', 10);
584 584
 
585 585
 /**
586 586
  * Delete Donor using Bulk Actions.
@@ -591,57 +591,57 @@  discard block
 block discarded – undo
591 591
  *
592 592
  * @return void
593 593
  */
594
-function give_delete_donor( $args ) {
594
+function give_delete_donor($args) {
595 595
 
596
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
596
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
597 597
 
598
-	if ( ! is_admin() || ! current_user_can( $donor_edit_role ) ) {
599
-		wp_die( __( 'You do not have permission to delete donors.', 'give' ), __( 'Error', 'give' ), array(
598
+	if ( ! is_admin() || ! current_user_can($donor_edit_role)) {
599
+		wp_die(__('You do not have permission to delete donors.', 'give'), __('Error', 'give'), array(
600 600
 			'response' => 403,
601
-		) );
601
+		));
602 602
 	}
603 603
 
604 604
 	$give_args            = array();
605
-	$donor_ids            = ( ! empty( $_GET['donor'] ) && is_array( $_GET['donor'] ) && count( $_GET['donor'] ) > 0 ) ? $_GET['donor'] : array();
606
-	$delete_donor         = ! empty( $_GET['give-delete-donor-confirm'] ) ? $_GET['give-delete-donor-confirm'] : '';
607
-	$delete_donations     = ! empty( $_GET['give-delete-donor-records'] ) ? $_GET['give-delete-donor-records'] : '';
608
-	$search_keyword       = ! empty( $_GET['s'] ) ? $_GET['s'] : '';
609
-	$give_args['orderby'] = ! empty( $_GET['orderby'] ) ? $_GET['orderby'] : 'id';
610
-	$give_args['order']   = ! empty( $_GET['order'] ) ? $_GET['order'] : 'desc';
605
+	$donor_ids            = ( ! empty($_GET['donor']) && is_array($_GET['donor']) && count($_GET['donor']) > 0) ? $_GET['donor'] : array();
606
+	$delete_donor         = ! empty($_GET['give-delete-donor-confirm']) ? $_GET['give-delete-donor-confirm'] : '';
607
+	$delete_donations     = ! empty($_GET['give-delete-donor-records']) ? $_GET['give-delete-donor-records'] : '';
608
+	$search_keyword       = ! empty($_GET['s']) ? $_GET['s'] : '';
609
+	$give_args['orderby'] = ! empty($_GET['orderby']) ? $_GET['orderby'] : 'id';
610
+	$give_args['order']   = ! empty($_GET['order']) ? $_GET['order'] : 'desc';
611 611
 	$nonce                = $args['_wpnonce'];
612 612
 
613 613
 	// Verify Nonce for deleting bulk donors.
614
-	if ( ! wp_verify_nonce( $nonce, 'bulk-donors' ) ) {
615
-		wp_die( __( 'Cheatin&#8217; uh?', 'give' ), __( 'Error', 'give' ), array(
614
+	if ( ! wp_verify_nonce($nonce, 'bulk-donors')) {
615
+		wp_die(__('Cheatin&#8217; uh?', 'give'), __('Error', 'give'), array(
616 616
 			'response' => 400,
617
-		) );
617
+		));
618 618
 	}
619 619
 
620
-	if( count( $donor_ids ) > 0 ) {
621
-		foreach ( $donor_ids as $donor_id ) {
622
-			$donor = new Give_Donor( $donor_id );
620
+	if (count($donor_ids) > 0) {
621
+		foreach ($donor_ids as $donor_id) {
622
+			$donor = new Give_Donor($donor_id);
623 623
 
624
-			if ( $donor->id > 0 ) {
624
+			if ($donor->id > 0) {
625 625
 
626
-				if( $delete_donor ) {
627
-					$donor_deleted = Give()->donors->delete( $donor->id );
626
+				if ($delete_donor) {
627
+					$donor_deleted = Give()->donors->delete($donor->id);
628 628
 
629
-					if ( $donor_deleted ) {
630
-						$donation_ids  = explode( ',', $donor->payment_ids );
629
+					if ($donor_deleted) {
630
+						$donation_ids = explode(',', $donor->payment_ids);
631 631
 
632
-						if( $delete_donations ) {
632
+						if ($delete_donations) {
633 633
 
634 634
 							// Remove all donations, logs, etc.
635
-							foreach ( $donation_ids as $donation_id ) {
636
-								give_delete_donation( $donation_id );
635
+							foreach ($donation_ids as $donation_id) {
636
+								give_delete_donation($donation_id);
637 637
 							}
638 638
 
639 639
 							$give_args['give-message'] = 'donor-donations-deleted';
640 640
 						} else {
641 641
 
642 642
 							// Just set the donations to customer_id of 0.
643
-							foreach ( $donation_ids as $donation_id ) {
644
-								give_update_payment_meta( $donation_id, '_give_payment_customer_id', 0 );
643
+							foreach ($donation_ids as $donation_id) {
644
+								give_update_payment_meta($donation_id, '_give_payment_customer_id', 0);
645 645
 							}
646 646
 
647 647
 							$give_args['give-message'] = 'donor-deleted';
@@ -658,13 +658,13 @@  discard block
 block discarded – undo
658 658
 		}
659 659
 
660 660
 		// Add Search Keyword on redirection, if it exists.
661
-		if ( ! empty( $search_keyword ) ) {
661
+		if ( ! empty($search_keyword)) {
662 662
 			$give_args['s'] = $search_keyword;
663 663
 		}
664 664
 
665
-		wp_redirect( add_query_arg( $give_args, admin_url( 'edit.php?post_type=give_forms&page=give-donors' ) ) );
665
+		wp_redirect(add_query_arg($give_args, admin_url('edit.php?post_type=give_forms&page=give-donors')));
666 666
 		give_die();
667 667
 	}
668 668
 }
669 669
 
670
-add_action( 'give_delete_donor', 'give_delete_donor' );
671 670
\ No newline at end of file
671
+add_action('give_delete_donor', 'give_delete_donor');
672 672
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/class-addon-activation-banner.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 // Exit if accessed directly.
11
-if ( ! defined( 'ABSPATH' ) ) {
11
+if ( ! defined('ABSPATH')) {
12 12
 	exit;
13 13
 }
14 14
 
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
 	 *                               'testing'           => false, // (required) Never leave as "true" in production!!!
33 33
 	 *                               }
34 34
 	 */
35
-	function __construct( $_banner_details ) {
35
+	function __construct($_banner_details) {
36 36
 		$current_user = wp_get_current_user();
37 37
 
38 38
 		$this->plugin_activate_by   = 0;
39 39
 		$this->banner_details       = $_banner_details;
40
-		$this->test_mode            = ( $this->banner_details['testing'] == 'true' ) ? true : false;
41
-		$this->nag_meta_key         = 'give_addon_activation_ignore_' . sanitize_title( $this->banner_details['name'] );
42
-		$this->activate_by_meta_key = 'give_addon_' . sanitize_title( $this->banner_details['name'] ) . '_active_by_user';
40
+		$this->test_mode            = ($this->banner_details['testing'] == 'true') ? true : false;
41
+		$this->nag_meta_key         = 'give_addon_activation_ignore_'.sanitize_title($this->banner_details['name']);
42
+		$this->activate_by_meta_key = 'give_addon_'.sanitize_title($this->banner_details['name']).'_active_by_user';
43 43
 
44 44
 		//Get current user
45 45
 		$this->user_id = $current_user->ID;
@@ -62,19 +62,19 @@  discard block
 block discarded – undo
62 62
 	public function init() {
63 63
 
64 64
 		//Testing?
65
-		if ( $this->test_mode ) {
66
-			delete_user_meta( $this->user_id, $this->nag_meta_key );
65
+		if ($this->test_mode) {
66
+			delete_user_meta($this->user_id, $this->nag_meta_key);
67 67
 		}
68 68
 
69 69
 		//Get the current page to add the notice to
70
-		add_action( 'current_screen', array( $this, 'give_addon_notice_ignore' ) );
71
-		add_action( 'admin_notices', array( $this, 'give_addon_activation_admin_notice' ) );
70
+		add_action('current_screen', array($this, 'give_addon_notice_ignore'));
71
+		add_action('admin_notices', array($this, 'give_addon_activation_admin_notice'));
72 72
 
73 73
 		// File path of addon must be included in banner detail other addon activate meta will not delete.
74 74
 		$file_name = $this->get_plugin_file_name();
75 75
 
76
-		if ( ! empty( $file_name ) ) {
77
-			add_action( 'deactivate_' . $file_name, array( $this, 'remove_addon_activate_meta' ) );
76
+		if ( ! empty($file_name)) {
77
+			add_action('deactivate_'.$file_name, array($this, 'remove_addon_activate_meta'));
78 78
 		}
79 79
 	}
80 80
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	private function is_plugin_page() {
90 90
 		$screen = get_current_screen();
91 91
 
92
-		return ( $screen->parent_file === 'plugins.php' );
92
+		return ($screen->parent_file === 'plugins.php');
93 93
 	}
94 94
 
95 95
 
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
 	public function give_addon_activation_admin_notice() {
103 103
 
104 104
 		// Bailout.
105
-		if ( ! $this->is_plugin_page() || $this->user_id !== $this->plugin_activate_by ) {
105
+		if ( ! $this->is_plugin_page() || $this->user_id !== $this->plugin_activate_by) {
106 106
 			return;
107 107
 		}
108 108
 
109 109
 		// If the user hasn't already dismissed the alert, output activation banner.
110
-		if ( ! get_user_meta( $this->user_id, $this->nag_meta_key ) ) {
110
+		if ( ! get_user_meta($this->user_id, $this->nag_meta_key)) {
111 111
 
112 112
 			$this->print_css();
113 113
 
@@ -125,44 +125,44 @@  discard block
 block discarded – undo
125 125
 					<h3><?php
126 126
 						printf(
127 127
 						/* translators: %s: Add-on name */
128
-							esc_html__( "Thank you for installing Give's %s Add-on!", 'give' ),
129
-							'<span>' . $this->banner_details['name'] . '</span>'
128
+							esc_html__("Thank you for installing Give's %s Add-on!", 'give'),
129
+							'<span>'.$this->banner_details['name'].'</span>'
130 130
 						);
131 131
 						?></h3>
132 132
 
133 133
 					<a href="<?php
134 134
 					//The Dismiss Button.
135
-					$nag_admin_dismiss_url = 'plugins.php?' . $this->nag_meta_key . '=0';
136
-					echo admin_url( $nag_admin_dismiss_url ); ?>" class="dismiss"><span
135
+					$nag_admin_dismiss_url = 'plugins.php?'.$this->nag_meta_key.'=0';
136
+					echo admin_url($nag_admin_dismiss_url); ?>" class="dismiss"><span
137 137
 							class="dashicons dashicons-dismiss"></span></a>
138 138
 
139 139
 					<div class="alert-actions">
140 140
 
141 141
 						<?php //Point them to your settings page.
142
-						if ( isset( $this->banner_details['settings_url'] ) ) { ?>
142
+						if (isset($this->banner_details['settings_url'])) { ?>
143 143
 							<a href="<?php echo $this->banner_details['settings_url']; ?>">
144
-								<span class="dashicons dashicons-admin-settings"></span><?php esc_html_e( 'Go to Settings', 'give' ); ?>
144
+								<span class="dashicons dashicons-admin-settings"></span><?php esc_html_e('Go to Settings', 'give'); ?>
145 145
 							</a>
146 146
 						<?php } ?>
147 147
 
148 148
 						<?php
149 149
 						// Show them how to configure the Addon.
150
-						if ( isset( $this->banner_details['documentation_url'] ) ) { ?>
150
+						if (isset($this->banner_details['documentation_url'])) { ?>
151 151
 							<a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank">
152 152
 								<span class="dashicons dashicons-media-text"></span><?php
153 153
 								printf(
154 154
 								/* translators: %s: Add-on name */
155
-									esc_html__( 'Documentation: %s Add-on', 'give' ),
155
+									esc_html__('Documentation: %s Add-on', 'give'),
156 156
 									$this->banner_details['name']
157 157
 								);
158 158
 								?></a>
159 159
 						<?php } ?>
160 160
 						<?php
161 161
 						//Let them signup for plugin updates
162
-						if ( isset( $this->banner_details['support_url'] ) ) { ?>
162
+						if (isset($this->banner_details['support_url'])) { ?>
163 163
 
164 164
 							<a href="<?php echo $this->banner_details['support_url'] ?>" target="_blank">
165
-								<span class="dashicons dashicons-sos"></span><?php esc_html_e( 'Get Support', 'give' ); ?>
165
+								<span class="dashicons dashicons-sos"></span><?php esc_html_e('Get Support', 'give'); ?>
166 166
 							</a>
167 167
 
168 168
 						<?php } ?>
@@ -176,12 +176,12 @@  discard block
 block discarded – undo
176 176
 			
177 177
 			
178 178
 			// Register notice.
179
-			Give()->notices->register_notice( array(
180
-				'id'          => 'give_' . sanitize_title( $this->banner_details['name'] ) . '_notice',
179
+			Give()->notices->register_notice(array(
180
+				'id'          => 'give_'.sanitize_title($this->banner_details['name']).'_notice',
181 181
 				'type'        => 'updated',
182 182
 				'description_html' => $notice_html,
183 183
 				'show'        => true,
184
-			) );
184
+			));
185 185
 		}
186 186
 	}
187 187
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 * @since 1.8.16
193 193
 	 * @access private
194 194
 	 */
195
-	private function print_css(){
195
+	private function print_css() {
196 196
 		?>
197 197
 		<style>
198 198
 			div.give-addon-alert.updated {
@@ -280,13 +280,13 @@  discard block
 block discarded – undo
280 280
 		 * If user clicks to ignore the notice, add that to their user meta the banner then checks whether this tag exists already or not.
281 281
 		 * See here: http://codex.wordpress.org/Function_Reference/add_user_meta
282 282
 		 */
283
-		if ( isset( $_GET[ $this->nag_meta_key ] ) && '0' == $_GET[ $this->nag_meta_key ] ) {
283
+		if (isset($_GET[$this->nag_meta_key]) && '0' == $_GET[$this->nag_meta_key]) {
284 284
 
285 285
 			//Get the global user
286 286
 			$current_user = wp_get_current_user();
287 287
 			$user_id      = $current_user->ID;
288 288
 
289
-			add_user_meta( $user_id, $this->nag_meta_key, 'true', true );
289
+			add_user_meta($user_id, $this->nag_meta_key, 'true', true);
290 290
 		}
291 291
 	}
292 292
 
@@ -297,11 +297,11 @@  discard block
 block discarded – undo
297 297
 	 * @access private
298 298
 	 */
299 299
 	private function add_addon_activate_meta() {
300
-		$user_id                  = get_option( $this->activate_by_meta_key );
300
+		$user_id                  = get_option($this->activate_by_meta_key);
301 301
 		$this->plugin_activate_by = (int) $user_id;
302 302
 
303
-		if ( ! $user_id ) {
304
-			add_option( $this->activate_by_meta_key, $this->user_id, '', 'no' );
303
+		if ( ! $user_id) {
304
+			add_option($this->activate_by_meta_key, $this->user_id, '', 'no');
305 305
 			$this->plugin_activate_by = (int) $this->user_id;
306 306
 		}
307 307
 	}
@@ -314,10 +314,10 @@  discard block
 block discarded – undo
314 314
 	 * @access public
315 315
 	 */
316 316
 	public function remove_addon_activate_meta() {
317
-		$user_id = get_option( $this->activate_by_meta_key );
317
+		$user_id = get_option($this->activate_by_meta_key);
318 318
 
319
-		if ( $user_id ) {
320
-			delete_option( $this->activate_by_meta_key );
319
+		if ($user_id) {
320
+			delete_option($this->activate_by_meta_key);
321 321
 		}
322 322
 	}
323 323
 
@@ -330,39 +330,39 @@  discard block
 block discarded – undo
330 330
 	 * @return mixed
331 331
 	 */
332 332
 	private function get_plugin_file_name() {
333
-		$active_plugins = get_option( 'active_plugins' );
333
+		$active_plugins = get_option('active_plugins');
334 334
 		$file_name      = '';
335 335
 
336 336
 		try {
337 337
 
338 338
 			// Check addon file path.
339
-			if ( ! empty( $this->banner_details['file'] ) ) {
339
+			if ( ! empty($this->banner_details['file'])) {
340 340
 				$file_name = '';
341
-				if ( $file_path = explode( '/plugins/', $this->banner_details['file'] ) ) {
342
-					$file_path = array_pop( $file_path );
343
-					$file_name = current( explode( '/', $file_path ) );
341
+				if ($file_path = explode('/plugins/', $this->banner_details['file'])) {
342
+					$file_path = array_pop($file_path);
343
+					$file_name = current(explode('/', $file_path));
344 344
 				}
345 345
 
346
-				if ( empty( $file_name ) ) {
346
+				if (empty($file_name)) {
347 347
 					return false;
348 348
 				}
349 349
 
350
-				foreach ( $active_plugins as $plugin ) {
351
-					if ( false !== strpos( $plugin, $file_name ) ) {
350
+				foreach ($active_plugins as $plugin) {
351
+					if (false !== strpos($plugin, $file_name)) {
352 352
 						$file_name = $plugin;
353 353
 						break;
354 354
 					}
355 355
 				}
356
-			} elseif ( WP_DEBUG ) {
357
-				throw new Exception( __( "File path must be added within the {$this->banner_details['name']} add-on in the banner details.", 'give' ) );
356
+			} elseif (WP_DEBUG) {
357
+				throw new Exception(__("File path must be added within the {$this->banner_details['name']} add-on in the banner details.", 'give'));
358 358
 			}
359 359
 
360 360
 			// Check plugin path calculated by addon file path.
361
-			if ( empty( $file_name ) && WP_DEBUG ) {
362
-				throw new Exception( __( "Empty add-on plugin path for {$this->banner_details['name']} add-on.", 'give' ) );
361
+			if (empty($file_name) && WP_DEBUG) {
362
+				throw new Exception(__("Empty add-on plugin path for {$this->banner_details['name']} add-on.", 'give'));
363 363
 			}
364 364
 
365
-		} catch ( Exception $e ) {
365
+		} catch (Exception $e) {
366 366
 			echo $e->getMessage();
367 367
 		}
368 368
 
Please login to merge, or discard this patch.