Completed
Pull Request — master (#753)
by
unknown
19:18 queued 17s
created
includes/payments/actions.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -28,21 +28,21 @@  discard block
 block discarded – undo
28 28
  *
29 29
  * @return void
30 30
  */
31
-function give_complete_purchase( $payment_id, $new_status, $old_status ) {
31
+function give_complete_purchase($payment_id, $new_status, $old_status) {
32 32
 
33 33
 	// Make sure that payments are only completed once
34
-	if ( $old_status == 'publish' || $old_status == 'complete' ) {
34
+	if ($old_status == 'publish' || $old_status == 'complete') {
35 35
 		return;
36 36
 	}
37 37
 
38 38
 	// Make sure the payment completion is only processed when new status is complete
39
-	if ( $new_status != 'publish' && $new_status != 'complete' ) {
39
+	if ($new_status != 'publish' && $new_status != 'complete') {
40 40
 		return;
41 41
 	}
42 42
 	
43
-	$payment = new Give_Payment( $payment_id );
43
+	$payment = new Give_Payment($payment_id);
44 44
 
45
-	$creation_date  = get_post_field( 'post_date', $payment_id, 'raw' );
45
+	$creation_date  = get_post_field('post_date', $payment_id, 'raw');
46 46
 	$payment_meta   = $payment->payment_meta;
47 47
 	$completed_date = $payment->completed_date;
48 48
 	$user_info      = $payment->user_info;
@@ -51,45 +51,45 @@  discard block
 block discarded – undo
51 51
 	$price_id       = $payment->price_id;
52 52
 	$form_id        = $payment->form_id;
53 53
 
54
-	do_action( 'give_pre_complete_purchase', $payment_id );
54
+	do_action('give_pre_complete_purchase', $payment_id);
55 55
 
56 56
 	// Ensure these actions only run once, ever
57
-	if ( empty( $completed_date ) ) {
57
+	if (empty($completed_date)) {
58 58
 
59
-		give_record_sale_in_log( $form_id, $payment_id, $price_id, $creation_date );
60
-		do_action( 'give_complete_form_donation', $form_id, $payment_id, $payment_meta );
59
+		give_record_sale_in_log($form_id, $payment_id, $price_id, $creation_date);
60
+		do_action('give_complete_form_donation', $form_id, $payment_id, $payment_meta);
61 61
 
62 62
 	}
63 63
 
64 64
 	// Increase the earnings for this form ID
65
-	give_increase_earnings( $form_id, $amount );
66
-	give_increase_purchase_count( $form_id );
65
+	give_increase_earnings($form_id, $amount);
66
+	give_increase_purchase_count($form_id);
67 67
 
68 68
 	// Clear the total earnings cache
69
-	delete_transient( 'give_earnings_total' );
69
+	delete_transient('give_earnings_total');
70 70
 	// Clear the This Month earnings (this_monththis_month is NOT a typo)
71
-	delete_transient( md5( 'give_earnings_this_monththis_month' ) );
72
-	delete_transient( md5( 'give_earnings_todaytoday' ) );
71
+	delete_transient(md5('give_earnings_this_monththis_month'));
72
+	delete_transient(md5('give_earnings_todaytoday'));
73 73
 	
74 74
 	// Increase the donor's purchase stats
75
-	$customer = new Give_Customer( $customer_id );
75
+	$customer = new Give_Customer($customer_id);
76 76
 	$customer->increase_purchase_count();
77
-	$customer->increase_value( $amount );
77
+	$customer->increase_value($amount);
78 78
 
79
-	give_increase_total_earnings( $amount );
79
+	give_increase_total_earnings($amount);
80 80
 
81 81
 	// Ensure this action only runs once ever
82
-	if ( empty( $completed_date ) ) {
82
+	if (empty($completed_date)) {
83 83
 
84 84
 		// Save the completed date
85
-		$payment->completed_date = current_time( 'mysql' );
85
+		$payment->completed_date = current_time('mysql');
86 86
 		$payment->save();
87
-		do_action( 'give_complete_purchase', $payment_id );
87
+		do_action('give_complete_purchase', $payment_id);
88 88
 	}
89 89
 
90 90
 }
91 91
 
92
-add_action( 'give_update_payment_status', 'give_complete_purchase', 100, 3 );
92
+add_action('give_update_payment_status', 'give_complete_purchase', 100, 3);
93 93
 
94 94
 
95 95
 /**
@@ -103,24 +103,24 @@  discard block
 block discarded – undo
103 103
  *
104 104
  * @return void
105 105
  */
106
-function give_record_status_change( $payment_id, $new_status, $old_status ) {
106
+function give_record_status_change($payment_id, $new_status, $old_status) {
107 107
 
108 108
 	// Get the list of statuses so that status in the payment note can be translated
109 109
 	$stati      = give_get_payment_statuses();
110
-	$old_status = isset( $stati[ $old_status ] ) ? $stati[ $old_status ] : $old_status;
111
-	$new_status = isset( $stati[ $new_status ] ) ? $stati[ $new_status ] : $new_status;
110
+	$old_status = isset($stati[$old_status]) ? $stati[$old_status] : $old_status;
111
+	$new_status = isset($stati[$new_status]) ? $stati[$new_status] : $new_status;
112 112
 
113 113
 	$status_change = sprintf(
114 114
 		/* translators: 1: old status 2: new status */
115
-		__( 'Status changed from %1$s to %2$s.', 'give' ),
115
+		__('Status changed from %1$s to %2$s.', 'give'),
116 116
 		$old_status,
117 117
 		$new_status
118 118
 	);
119 119
 
120
-	give_insert_payment_note( $payment_id, $status_change );
120
+	give_insert_payment_note($payment_id, $status_change);
121 121
 }
122 122
 
123
-add_action( 'give_update_payment_status', 'give_record_status_change', 100, 3 );
123
+add_action('give_update_payment_status', 'give_record_status_change', 100, 3);
124 124
 
125 125
 
126 126
 /**
@@ -133,17 +133,17 @@  discard block
 block discarded – undo
133 133
  * @param $new_status the status of the payment, probably "publish"
134 134
  * @param $old_status the status of the payment prior to being marked as "complete", probably "pending"
135 135
  */
136
-function give_clear_user_history_cache( $payment_id, $new_status, $old_status ) {
136
+function give_clear_user_history_cache($payment_id, $new_status, $old_status) {
137 137
 
138
-	$payment = new Give_Payment( $payment_id );
138
+	$payment = new Give_Payment($payment_id);
139 139
 
140
-	if ( ! empty( $payment->user_id ) ) {
141
-		delete_transient( 'give_user_' . $payment->user_id . '_purchases' );
140
+	if ( ! empty($payment->user_id)) {
141
+		delete_transient('give_user_'.$payment->user_id.'_purchases');
142 142
 	}
143 143
 
144 144
 }
145 145
 
146
-add_action( 'give_update_payment_status', 'give_clear_user_history_cache', 10, 3 );
146
+add_action('give_update_payment_status', 'give_clear_user_history_cache', 10, 3);
147 147
 
148 148
 /**
149 149
  * Updates all old payments, prior to 1.2, with new
@@ -157,25 +157,25 @@  discard block
 block discarded – undo
157 157
  *
158 158
  * @return void
159 159
  */
160
-function give_update_old_payments_with_totals( $data ) {
161
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_upgrade_payments_nonce' ) ) {
160
+function give_update_old_payments_with_totals($data) {
161
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give_upgrade_payments_nonce')) {
162 162
 		return;
163 163
 	}
164 164
 
165
-	if ( get_option( 'give_payment_totals_upgraded' ) ) {
165
+	if (get_option('give_payment_totals_upgraded')) {
166 166
 		return;
167 167
 	}
168 168
 
169
-	$payments = give_get_payments( array(
169
+	$payments = give_get_payments(array(
170 170
 		'offset' => 0,
171
-		'number' => - 1,
171
+		'number' => -1,
172 172
 		'mode'   => 'all'
173
-	) );
173
+	));
174 174
 
175
-	if ( $payments ) {
176
-		foreach ( $payments as $payment ) {
175
+	if ($payments) {
176
+		foreach ($payments as $payment) {
177 177
 
178
-			$payment = new Give_Payment( $payment->ID );
178
+			$payment = new Give_Payment($payment->ID);
179 179
 			$meta    = $payment->get_meta();
180 180
 
181 181
 			$payment->total = $meta['amount'];
@@ -184,10 +184,10 @@  discard block
 block discarded – undo
184 184
 		}
185 185
 	}
186 186
 
187
-	add_option( 'give_payment_totals_upgraded', 1 );
187
+	add_option('give_payment_totals_upgraded', 1);
188 188
 }
189 189
 
190
-add_action( 'give_upgrade_payments', 'give_update_old_payments_with_totals' );
190
+add_action('give_upgrade_payments', 'give_update_old_payments_with_totals');
191 191
 
192 192
 /**
193 193
  * Updates week-old+ 'pending' orders to 'abandoned'
@@ -198,21 +198,21 @@  discard block
 block discarded – undo
198 198
 function give_mark_abandoned_donations() {
199 199
 	$args = array(
200 200
 		'status' => 'pending',
201
-		'number' => - 1,
201
+		'number' => -1,
202 202
 		'output' => 'give_payments',
203 203
 	);
204 204
 
205
-	add_filter( 'posts_where', 'give_filter_where_older_than_week' );
205
+	add_filter('posts_where', 'give_filter_where_older_than_week');
206 206
 
207
-	$payments = give_get_payments( $args );
207
+	$payments = give_get_payments($args);
208 208
 
209
-	remove_filter( 'posts_where', 'give_filter_where_older_than_week' );
209
+	remove_filter('posts_where', 'give_filter_where_older_than_week');
210 210
 
211
-	if ( $payments ) {
212
-		foreach ( $payments as $payment ) {
213
-			$gateway = give_get_payment_gateway( $payment );
211
+	if ($payments) {
212
+		foreach ($payments as $payment) {
213
+			$gateway = give_get_payment_gateway($payment);
214 214
 			//Skip offline gateway payments
215
-			if ( $gateway == 'offline' ) {
215
+			if ($gateway == 'offline') {
216 216
 				continue;
217 217
 			}
218 218
 			$payment->status = 'abandoned';
@@ -221,4 +221,4 @@  discard block
 block discarded – undo
221 221
 	}
222 222
 }
223 223
 
224
-add_action( 'give_weekly_scheduled_events', 'give_mark_abandoned_donations' );
225 224
\ No newline at end of file
225
+add_action('give_weekly_scheduled_events', 'give_mark_abandoned_donations');
226 226
\ No newline at end of file
Please login to merge, or discard this patch.
includes/process-purchase.php 1 patch
Spacing   +234 added lines, -234 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,27 +25,27 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_process_purchase_form() {
27 27
 
28
-	do_action( 'give_pre_process_purchase' );
28
+	do_action('give_pre_process_purchase');
29 29
 
30 30
 	// Validate the form $_POST data
31 31
 	$valid_data = give_purchase_form_validate_fields();
32 32
 
33 33
 	// Allow themes and plugins to hook to errors
34
-	do_action( 'give_checkout_error_checks', $valid_data, $_POST );
34
+	do_action('give_checkout_error_checks', $valid_data, $_POST);
35 35
 
36
-	$is_ajax = isset( $_POST['give_ajax'] );
36
+	$is_ajax = isset($_POST['give_ajax']);
37 37
 
38 38
 	// Process the login form
39
-	if ( isset( $_POST['give_login_submit'] ) ) {
39
+	if (isset($_POST['give_login_submit'])) {
40 40
 		give_process_form_login();
41 41
 	}
42 42
 
43 43
 	// Validate the user
44
-	$user = give_get_purchase_form_user( $valid_data );
44
+	$user = give_get_purchase_form_user($valid_data);
45 45
 
46
-	if ( false === $valid_data || give_get_errors() || ! $user ) {
47
-		if ( $is_ajax ) {
48
-			do_action( 'give_ajax_checkout_errors' );
46
+	if (false === $valid_data || give_get_errors() || ! $user) {
47
+		if ($is_ajax) {
48
+			do_action('give_ajax_checkout_errors');
49 49
 			give_die();
50 50
 		} else {
51 51
 			return false;
@@ -53,17 +53,17 @@  discard block
 block discarded – undo
53 53
 	}
54 54
 
55 55
 	//If AJAX send back success to proceed with form submission
56
-	if ( $is_ajax ) {
56
+	if ($is_ajax) {
57 57
 		echo 'success';
58 58
 		give_die();
59 59
 	}
60 60
 
61 61
 	//After AJAX: Setup session if not using php_sessions
62
-	if ( ! Give()->session->use_php_sessions() ) {
62
+	if ( ! Give()->session->use_php_sessions()) {
63 63
 		//Double-check that set_cookie is publicly accessible;
64 64
 		// we're using a slightly modified class-wp-sessions.php
65
-		$session_reflection = new ReflectionMethod( 'WP_Session', 'set_cookie' );
66
-		if ( $session_reflection->isPublic() ) {
65
+		$session_reflection = new ReflectionMethod('WP_Session', 'set_cookie');
66
+		if ($session_reflection->isPublic()) {
67 67
 			// Manually set the cookie.
68 68
 			Give()->session->init()->set_cookie();
69 69
 		}
@@ -78,18 +78,18 @@  discard block
 block discarded – undo
78 78
 		'address'    => $user['address']
79 79
 	);
80 80
 
81
-	$auth_key = defined( 'AUTH_KEY' ) ? AUTH_KEY : '';
81
+	$auth_key = defined('AUTH_KEY') ? AUTH_KEY : '';
82 82
 
83
-	$price        = isset( $_POST['give-amount'] ) ? (float) apply_filters( 'give_donation_total', give_sanitize_amount( give_format_amount( $_POST['give-amount'] ) ) ) : '0.00';
84
-	$purchase_key = strtolower( md5( $user['user_email'] . date( 'Y-m-d H:i:s' ) . $auth_key . uniqid( 'give', true ) ) );
83
+	$price        = isset($_POST['give-amount']) ? (float) apply_filters('give_donation_total', give_sanitize_amount(give_format_amount($_POST['give-amount']))) : '0.00';
84
+	$purchase_key = strtolower(md5($user['user_email'].date('Y-m-d H:i:s').$auth_key.uniqid('give', true)));
85 85
 
86 86
 	// Setup purchase information
87 87
 	$purchase_data = array(
88 88
 		'price'        => $price,
89 89
 		'purchase_key' => $purchase_key,
90 90
 		'user_email'   => $user['user_email'],
91
-		'date'         => date( 'Y-m-d H:i:s', current_time( 'timestamp' ) ),
92
-		'user_info'    => stripslashes_deep( $user_info ),
91
+		'date'         => date('Y-m-d H:i:s', current_time('timestamp')),
92
+		'user_info'    => stripslashes_deep($user_info),
93 93
 		'post_data'    => $_POST,
94 94
 		'gateway'      => $valid_data['gateway'],
95 95
 		'card_info'    => $valid_data['cc_info']
@@ -99,37 +99,37 @@  discard block
 block discarded – undo
99 99
 	$valid_data['user'] = $user;
100 100
 
101 101
 	// Allow themes and plugins to hook before the gateway
102
-	do_action( 'give_checkout_before_gateway', $_POST, $user_info, $valid_data );
102
+	do_action('give_checkout_before_gateway', $_POST, $user_info, $valid_data);
103 103
 
104 104
 	//Sanity check for price
105
-	if ( ! $purchase_data['price'] ) {
105
+	if ( ! $purchase_data['price']) {
106 106
 		// Revert to manual
107 107
 		$purchase_data['gateway'] = 'manual';
108 108
 		$_POST['give-gateway']    = 'manual';
109 109
 	}
110 110
 
111 111
 	// Allow the purchase data to be modified before it is sent to the gateway
112
-	$purchase_data = apply_filters( 'give_purchase_data_before_gateway', $purchase_data, $valid_data );
112
+	$purchase_data = apply_filters('give_purchase_data_before_gateway', $purchase_data, $valid_data);
113 113
 
114 114
 	// Setup the data we're storing in the purchase session
115 115
 	$session_data = $purchase_data;
116 116
 
117 117
 	// Make sure credit card numbers are never stored in sessions
118
-	unset( $session_data['card_info']['card_number'] );
119
-	unset( $session_data['post_data']['card_number'] );
118
+	unset($session_data['card_info']['card_number']);
119
+	unset($session_data['post_data']['card_number']);
120 120
 
121 121
 	// Used for showing data to non logged-in users after purchase, and for other plugins needing purchase data.
122
-	give_set_purchase_session( $session_data );
122
+	give_set_purchase_session($session_data);
123 123
 
124 124
 	// Send info to the gateway for payment processing
125
-	give_send_to_gateway( $purchase_data['gateway'], $purchase_data );
125
+	give_send_to_gateway($purchase_data['gateway'], $purchase_data);
126 126
 	give_die();
127 127
 
128 128
 }
129 129
 
130
-add_action( 'give_purchase', 'give_process_purchase_form' );
131
-add_action( 'wp_ajax_give_process_checkout', 'give_process_purchase_form' );
132
-add_action( 'wp_ajax_nopriv_give_process_checkout', 'give_process_purchase_form' );
130
+add_action('give_purchase', 'give_process_purchase_form');
131
+add_action('wp_ajax_give_process_checkout', 'give_process_purchase_form');
132
+add_action('wp_ajax_nopriv_give_process_checkout', 'give_process_purchase_form');
133 133
 
134 134
 /**
135 135
  * Process the checkout login form
@@ -140,32 +140,32 @@  discard block
 block discarded – undo
140 140
  */
141 141
 function give_process_form_login() {
142 142
 
143
-	$is_ajax = isset( $_POST['give_ajax'] );
143
+	$is_ajax = isset($_POST['give_ajax']);
144 144
 
145 145
 	$user_data = give_purchase_form_validate_user_login();
146 146
 
147
-	if ( give_get_errors() || $user_data['user_id'] < 1 ) {
148
-		if ( $is_ajax ) {
149
-			do_action( 'give_ajax_checkout_errors' );
147
+	if (give_get_errors() || $user_data['user_id'] < 1) {
148
+		if ($is_ajax) {
149
+			do_action('give_ajax_checkout_errors');
150 150
 			give_die();
151 151
 		} else {
152
-			wp_redirect( $_SERVER['HTTP_REFERER'] );
152
+			wp_redirect($_SERVER['HTTP_REFERER']);
153 153
 			exit;
154 154
 		}
155 155
 	}
156 156
 
157
-	give_log_user_in( $user_data['user_id'], $user_data['user_login'], $user_data['user_pass'] );
157
+	give_log_user_in($user_data['user_id'], $user_data['user_login'], $user_data['user_pass']);
158 158
 
159
-	if ( $is_ajax ) {
159
+	if ($is_ajax) {
160 160
 		echo 'success';
161 161
 		give_die();
162 162
 	} else {
163
-		wp_redirect( $_SERVER['HTTP_REFERER'] );
163
+		wp_redirect($_SERVER['HTTP_REFERER']);
164 164
 	}
165 165
 }
166 166
 
167
-add_action( 'wp_ajax_give_process_checkout_login', 'give_process_form_login' );
168
-add_action( 'wp_ajax_nopriv_give_process_checkout_login', 'give_process_form_login' );
167
+add_action('wp_ajax_give_process_checkout_login', 'give_process_form_login');
168
+add_action('wp_ajax_nopriv_give_process_checkout_login', 'give_process_form_login');
169 169
 
170 170
 /**
171 171
  * Purchase Form Validate Fields
@@ -177,45 +177,45 @@  discard block
 block discarded – undo
177 177
 function give_purchase_form_validate_fields() {
178 178
 
179 179
 	// Check if there is $_POST
180
-	if ( empty( $_POST ) ) {
180
+	if (empty($_POST)) {
181 181
 		return false;
182 182
 	}
183 183
 
184
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
184
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
185 185
 
186 186
 	// Start an array to collect valid data
187 187
 	$valid_data = array(
188 188
 		'gateway'          => give_purchase_form_validate_gateway(), // Gateway fallback (amount is validated here)
189
-		'need_new_user'    => false,     // New user flag
190
-		'need_user_login'  => false,     // Login user flag
191
-		'logged_user_data' => array(),   // Logged user collected data
192
-		'new_user_data'    => array(),   // New user collected data
193
-		'login_user_data'  => array(),   // Login user collected data
194
-		'guest_user_data'  => array(),   // Guest user collected data
189
+		'need_new_user'    => false, // New user flag
190
+		'need_user_login'  => false, // Login user flag
191
+		'logged_user_data' => array(), // Logged user collected data
192
+		'new_user_data'    => array(), // New user collected data
193
+		'login_user_data'  => array(), // Login user collected data
194
+		'guest_user_data'  => array(), // Guest user collected data
195 195
 		'cc_info'          => give_purchase_form_validate_cc()    // Credit card info
196 196
 	);
197 197
 
198 198
 	//Validate Honeypot First
199
-	if ( ! empty( $_POST['give-honeypot'] ) ) {
200
-		give_set_error( 'invalid_honeypot', __( 'Honeypot field detected. Go away bad bot!', 'give' ) );
199
+	if ( ! empty($_POST['give-honeypot'])) {
200
+		give_set_error('invalid_honeypot', __('Honeypot field detected. Go away bad bot!', 'give'));
201 201
 	}
202 202
 
203 203
 	// Validate agree to terms
204
-	$terms_option = get_post_meta( $form_id, '_give_terms_option', true );
205
-	if ( isset( $terms_option ) && $terms_option === 'yes' ) {
204
+	$terms_option = get_post_meta($form_id, '_give_terms_option', true);
205
+	if (isset($terms_option) && $terms_option === 'yes') {
206 206
 		give_purchase_form_validate_agree_to_terms();
207 207
 	}
208 208
 
209
-	if ( is_user_logged_in() ) {
209
+	if (is_user_logged_in()) {
210 210
 		// Collect logged in user data
211 211
 		$valid_data['logged_in_user'] = give_purchase_form_validate_logged_in_user();
212
-	} else if ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-register' ) {
212
+	} else if (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-register') {
213 213
 		// Set new user registration as required
214 214
 		$valid_data['need_new_user'] = true;
215 215
 		// Validate new user data
216 216
 		$valid_data['new_user_data'] = give_purchase_form_validate_new_user();
217 217
 		// Check if login validation is needed
218
-	} else if ( isset( $_POST['give-purchase-var'] ) && $_POST['give-purchase-var'] == 'needs-to-login' ) {
218
+	} else if (isset($_POST['give-purchase-var']) && $_POST['give-purchase-var'] == 'needs-to-login') {
219 219
 		// Set user login as required
220 220
 		$valid_data['need_user_login'] = true;
221 221
 		// Validate users login info
@@ -240,41 +240,41 @@  discard block
 block discarded – undo
240 240
  */
241 241
 function give_purchase_form_validate_gateway() {
242 242
 
243
-	$form_id = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
244
-	$amount  = isset( $_REQUEST['give-amount'] ) ? give_sanitize_amount( $_REQUEST['give-amount'] ) : 0;
245
-	$gateway = give_get_default_gateway( $form_id );
243
+	$form_id = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
244
+	$amount  = isset($_REQUEST['give-amount']) ? give_sanitize_amount($_REQUEST['give-amount']) : 0;
245
+	$gateway = give_get_default_gateway($form_id);
246 246
 
247 247
 	// Check if a gateway value is present
248
-	if ( ! empty( $_REQUEST['give-gateway'] ) ) {
248
+	if ( ! empty($_REQUEST['give-gateway'])) {
249 249
 
250
-		$gateway = sanitize_text_field( $_REQUEST['give-gateway'] );
250
+		$gateway = sanitize_text_field($_REQUEST['give-gateway']);
251 251
 
252 252
 		//Is amount being donated in LIVE mode 0.00? If so, error:
253
-		if ( $amount == 0 && ! give_is_test_mode() ) {
253
+		if ($amount == 0 && ! give_is_test_mode()) {
254 254
 
255
-			give_set_error( 'invalid_donation_amount', __( 'Please insert a valid donation amount.', 'give' ) );
255
+			give_set_error('invalid_donation_amount', __('Please insert a valid donation amount.', 'give'));
256 256
 
257 257
 		} //Check for a minimum custom amount
258
-		elseif ( ! give_verify_minimum_price() ) {
258
+		elseif ( ! give_verify_minimum_price()) {
259 259
 
260 260
 			give_set_error(
261 261
 				'invalid_donation_minimum',
262 262
 				sprintf(
263 263
 					/* translators: %s: minimum donation amount */
264
-					__( 'This form has a minimum donation amount of %s.', 'give' ),
265
-					give_currency_filter( give_format_amount( give_get_form_minimum_price( $form_id ) ) )
264
+					__('This form has a minimum donation amount of %s.', 'give'),
265
+					give_currency_filter(give_format_amount(give_get_form_minimum_price($form_id)))
266 266
 				)
267 267
 			);
268 268
 
269 269
 		} //Is this test mode zero donation? Let it through but set to manual gateway
270
-		elseif ( $amount == 0 && give_is_test_mode() ) {
270
+		elseif ($amount == 0 && give_is_test_mode()) {
271 271
 
272 272
 			$gateway = 'manual';
273 273
 
274 274
 		} //Check if this gateway is active
275
-		elseif ( ! give_is_gateway_active( $gateway ) ) {
275
+		elseif ( ! give_is_gateway_active($gateway)) {
276 276
 
277
-			give_set_error( 'invalid_gateway', __( 'The selected payment gateway is not enabled.', 'give' ) );
277
+			give_set_error('invalid_gateway', __('The selected payment gateway is not enabled.', 'give'));
278 278
 
279 279
 		}
280 280
 
@@ -293,23 +293,23 @@  discard block
 block discarded – undo
293 293
  */
294 294
 function give_verify_minimum_price() {
295 295
 
296
-	$amount          = give_sanitize_amount( $_REQUEST['give-amount'] );
297
-	$form_id         = isset( $_REQUEST['give-form-id'] ) ? $_REQUEST['give-form-id'] : 0;
298
-	$price_id        = isset( $_REQUEST['give-price-id'] ) ? $_REQUEST['give-price-id'] : 0;
299
-	$variable_prices = give_has_variable_prices( $form_id );
296
+	$amount          = give_sanitize_amount($_REQUEST['give-amount']);
297
+	$form_id         = isset($_REQUEST['give-form-id']) ? $_REQUEST['give-form-id'] : 0;
298
+	$price_id        = isset($_REQUEST['give-price-id']) ? $_REQUEST['give-price-id'] : 0;
299
+	$variable_prices = give_has_variable_prices($form_id);
300 300
 
301
-	if ( $variable_prices && ! empty( $price_id ) ) {
301
+	if ($variable_prices && ! empty($price_id)) {
302 302
 
303
-		$price_level_amount = give_get_price_option_amount( $form_id, $price_id );
303
+		$price_level_amount = give_get_price_option_amount($form_id, $price_id);
304 304
 
305
-		if ( $price_level_amount == $amount ) {
305
+		if ($price_level_amount == $amount) {
306 306
 			return true;
307 307
 		}
308 308
 	}
309 309
 
310
-	$minimum = give_get_form_minimum_price( $form_id );
310
+	$minimum = give_get_form_minimum_price($form_id);
311 311
 
312
-	if ( $minimum > $amount ) {
312
+	if ($minimum > $amount) {
313 313
 		return false;
314 314
 	}
315 315
 
@@ -325,9 +325,9 @@  discard block
 block discarded – undo
325 325
  */
326 326
 function give_purchase_form_validate_agree_to_terms() {
327 327
 	// Validate agree to terms
328
-	if ( ! isset( $_POST['give_agree_to_terms'] ) || $_POST['give_agree_to_terms'] != 1 ) {
328
+	if ( ! isset($_POST['give_agree_to_terms']) || $_POST['give_agree_to_terms'] != 1) {
329 329
 		// User did not agree
330
-		give_set_error( 'agree_to_terms', apply_filters( 'give_agree_to_terms_text', __( 'You must agree to the terms of use.', 'give' ) ) );
330
+		give_set_error('agree_to_terms', apply_filters('give_agree_to_terms_text', __('You must agree to the terms of use.', 'give')));
331 331
 	}
332 332
 }
333 333
 
@@ -341,47 +341,47 @@  discard block
 block discarded – undo
341 341
  *
342 342
  * @return      array
343 343
  */
344
-function give_purchase_form_required_fields( $form_id ) {
344
+function give_purchase_form_required_fields($form_id) {
345 345
 
346
-	$payment_mode = give_get_chosen_gateway( $form_id );
346
+	$payment_mode = give_get_chosen_gateway($form_id);
347 347
 
348 348
 	$required_fields = array(
349 349
 		'give_email' => array(
350 350
 			'error_id'      => 'invalid_email',
351
-			'error_message' => __( 'Please enter a valid email address.', 'give' )
351
+			'error_message' => __('Please enter a valid email address.', 'give')
352 352
 		),
353 353
 		'give_first' => array(
354 354
 			'error_id'      => 'invalid_first_name',
355
-			'error_message' => __( 'Please enter your first name.', 'give' )
355
+			'error_message' => __('Please enter your first name.', 'give')
356 356
 		)
357 357
 	);
358 358
 
359
-	$require_address = give_require_billing_address( $payment_mode );
359
+	$require_address = give_require_billing_address($payment_mode);
360 360
 
361
-	if ( $require_address ) {
362
-		$required_fields['card_address']    = array(
361
+	if ($require_address) {
362
+		$required_fields['card_address'] = array(
363 363
 			'error_id'      => 'invalid_card_address',
364
-			'error_message' => __( 'Please enter your primary billing address.', 'give' )
364
+			'error_message' => __('Please enter your primary billing address.', 'give')
365 365
 		);
366
-		$required_fields['card_zip']        = array(
366
+		$required_fields['card_zip'] = array(
367 367
 			'error_id'      => 'invalid_zip_code',
368
-			'error_message' => __( 'Please enter your zip / postal code.', 'give' )
368
+			'error_message' => __('Please enter your zip / postal code.', 'give')
369 369
 		);
370
-		$required_fields['card_city']       = array(
370
+		$required_fields['card_city'] = array(
371 371
 			'error_id'      => 'invalid_city',
372
-			'error_message' => __( 'Please enter your billing city.', 'give' )
372
+			'error_message' => __('Please enter your billing city.', 'give')
373 373
 		);
374 374
 		$required_fields['billing_country'] = array(
375 375
 			'error_id'      => 'invalid_country',
376
-			'error_message' => __( 'Please select your billing country.', 'give' )
376
+			'error_message' => __('Please select your billing country.', 'give')
377 377
 		);
378
-		$required_fields['card_state']      = array(
378
+		$required_fields['card_state'] = array(
379 379
 			'error_id'      => 'invalid_state',
380
-			'error_message' => __( 'Please enter billing state / province.', 'give' )
380
+			'error_message' => __('Please enter billing state / province.', 'give')
381 381
 		);
382 382
 	}
383 383
 
384
-	return apply_filters( 'give_purchase_form_required_fields', $required_fields, $form_id );
384
+	return apply_filters('give_purchase_form_required_fields', $required_fields, $form_id);
385 385
 
386 386
 }
387 387
 
@@ -394,16 +394,16 @@  discard block
 block discarded – undo
394 394
  *
395 395
  * @return mixed|void
396 396
  */
397
-function give_require_billing_address( $payment_mode ) {
397
+function give_require_billing_address($payment_mode) {
398 398
 
399 399
 	$return = false;
400 400
 
401
-	if ( isset( $_POST['billing_country'] ) || did_action( "give_{$payment_mode}_cc_form" ) || did_action( 'give_cc_form' ) ) {
401
+	if (isset($_POST['billing_country']) || did_action("give_{$payment_mode}_cc_form") || did_action('give_cc_form')) {
402 402
 		$return = true;
403 403
 	}
404 404
 
405 405
 	// Let payment gateways and other extensions determine if address fields should be required
406
-	return apply_filters( 'give_require_billing_address', $return );
406
+	return apply_filters('give_require_billing_address', $return);
407 407
 
408 408
 }
409 409
 
@@ -417,43 +417,43 @@  discard block
 block discarded – undo
417 417
 function give_purchase_form_validate_logged_in_user() {
418 418
 	global $user_ID;
419 419
 
420
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
420
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
421 421
 
422 422
 	// Start empty array to collect valid user data
423 423
 	$valid_user_data = array(
424 424
 		// Assume there will be errors
425
-		'user_id' => - 1
425
+		'user_id' => -1
426 426
 	);
427 427
 
428 428
 	// Verify there is a user_ID
429
-	if ( $user_ID > 0 ) {
429
+	if ($user_ID > 0) {
430 430
 		// Get the logged in user data
431
-		$user_data = get_userdata( $user_ID );
431
+		$user_data = get_userdata($user_ID);
432 432
 
433 433
 		// Loop through required fields and show error messages
434
-		foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) {
435
-			if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
436
-				give_set_error( $value['error_id'], $value['error_message'] );
434
+		foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) {
435
+			if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) {
436
+				give_set_error($value['error_id'], $value['error_message']);
437 437
 			}
438 438
 		}
439 439
 
440 440
 		// Verify data
441
-		if ( $user_data ) {
441
+		if ($user_data) {
442 442
 			// Collected logged in user data
443 443
 			$valid_user_data = array(
444 444
 				'user_id'    => $user_ID,
445
-				'user_email' => isset( $_POST['give_email'] ) ? sanitize_email( $_POST['give_email'] ) : $user_data->user_email,
446
-				'user_first' => isset( $_POST['give_first'] ) && ! empty( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : $user_data->first_name,
447
-				'user_last'  => isset( $_POST['give_last'] ) && ! empty( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : $user_data->last_name,
445
+				'user_email' => isset($_POST['give_email']) ? sanitize_email($_POST['give_email']) : $user_data->user_email,
446
+				'user_first' => isset($_POST['give_first']) && ! empty($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : $user_data->first_name,
447
+				'user_last'  => isset($_POST['give_last']) && ! empty($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : $user_data->last_name,
448 448
 			);
449 449
 
450
-			if ( ! is_email( $valid_user_data['user_email'] ) ) {
451
-				give_set_error( 'email_invalid', __( 'Invalid email', 'give' ) );
450
+			if ( ! is_email($valid_user_data['user_email'])) {
451
+				give_set_error('email_invalid', __('Invalid email', 'give'));
452 452
 			}
453 453
 
454 454
 		} else {
455 455
 			// Set invalid user error
456
-			give_set_error( 'invalid_user', __( 'The user information is invalid.', 'give' ) );
456
+			give_set_error('invalid_user', __('The user information is invalid.', 'give'));
457 457
 		}
458 458
 	}
459 459
 
@@ -471,90 +471,90 @@  discard block
 block discarded – undo
471 471
 function give_purchase_form_validate_new_user() {
472 472
 
473 473
 	$registering_new_user = false;
474
-	$form_id              = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
474
+	$form_id              = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
475 475
 
476 476
 	// Start an empty array to collect valid user data
477 477
 	$valid_user_data = array(
478 478
 		// Assume there will be errors
479
-		'user_id'    => - 1,
479
+		'user_id'    => -1,
480 480
 		// Get first name
481
-		'user_first' => isset( $_POST['give_first'] ) ? sanitize_text_field( $_POST['give_first'] ) : '',
481
+		'user_first' => isset($_POST['give_first']) ? sanitize_text_field($_POST['give_first']) : '',
482 482
 		// Get last name
483
-		'user_last'  => isset( $_POST['give_last'] ) ? sanitize_text_field( $_POST['give_last'] ) : '',
483
+		'user_last'  => isset($_POST['give_last']) ? sanitize_text_field($_POST['give_last']) : '',
484 484
 	);
485 485
 
486 486
 	// Check the new user's credentials against existing ones
487
-	$user_login   = isset( $_POST['give_user_login'] ) ? trim( $_POST['give_user_login'] ) : false;
488
-	$user_email   = isset( $_POST['give_email'] ) ? trim( $_POST['give_email'] ) : false;
489
-	$user_pass    = isset( $_POST['give_user_pass'] ) ? trim( $_POST['give_user_pass'] ) : false;
490
-	$pass_confirm = isset( $_POST['give_user_pass_confirm'] ) ? trim( $_POST['give_user_pass_confirm'] ) : false;
487
+	$user_login   = isset($_POST['give_user_login']) ? trim($_POST['give_user_login']) : false;
488
+	$user_email   = isset($_POST['give_email']) ? trim($_POST['give_email']) : false;
489
+	$user_pass    = isset($_POST['give_user_pass']) ? trim($_POST['give_user_pass']) : false;
490
+	$pass_confirm = isset($_POST['give_user_pass_confirm']) ? trim($_POST['give_user_pass_confirm']) : false;
491 491
 
492 492
 	// Loop through required fields and show error messages
493
-	foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) {
494
-		if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
495
-			give_set_error( $value['error_id'], $value['error_message'] );
493
+	foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) {
494
+		if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) {
495
+			give_set_error($value['error_id'], $value['error_message']);
496 496
 		}
497 497
 	}
498 498
 
499 499
 	// Check if we have an username to register
500
-	if ( $user_login && strlen( $user_login ) > 0 ) {
500
+	if ($user_login && strlen($user_login) > 0) {
501 501
 		$registering_new_user = true;
502 502
 
503 503
 		// We have an user name, check if it already exists
504
-		if ( username_exists( $user_login ) ) {
504
+		if (username_exists($user_login)) {
505 505
 			// Username already registered
506
-			give_set_error( 'username_unavailable', __( 'Username already taken.', 'give' ) );
506
+			give_set_error('username_unavailable', __('Username already taken.', 'give'));
507 507
 			// Check if it's valid
508
-		} else if ( ! give_validate_username( $user_login ) ) {
508
+		} else if ( ! give_validate_username($user_login)) {
509 509
 			// Invalid username
510
-			if ( is_multisite() ) {
511
-				give_set_error( 'username_invalid', __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ) );
510
+			if (is_multisite()) {
511
+				give_set_error('username_invalid', __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'));
512 512
 			} else {
513
-				give_set_error( 'username_invalid', __( 'Invalid username.', 'give' ) );
513
+				give_set_error('username_invalid', __('Invalid username.', 'give'));
514 514
 			}
515 515
 		} else {
516 516
 			// All the checks have run and it's good to go
517 517
 			$valid_user_data['user_login'] = $user_login;
518 518
 		}
519
-	} elseif ( give_logged_in_only( $form_id ) ) {
520
-		give_set_error( 'registration_required', esc_html__( 'You must register or login to complete your donation.', 'give' ) );
519
+	} elseif (give_logged_in_only($form_id)) {
520
+		give_set_error('registration_required', esc_html__('You must register or login to complete your donation.', 'give'));
521 521
 	}
522 522
 
523 523
 	// Check if we have an email to verify
524
-	if ( $user_email && strlen( $user_email ) > 0 ) {
524
+	if ($user_email && strlen($user_email) > 0) {
525 525
 		// Validate email
526
-		if ( ! is_email( $user_email ) ) {
527
-			give_set_error( 'email_invalid', __( 'Sorry, that email is invalid.', 'give' ) );
526
+		if ( ! is_email($user_email)) {
527
+			give_set_error('email_invalid', __('Sorry, that email is invalid.', 'give'));
528 528
 			// Check if email exists
529
-		} else if ( email_exists( $user_email ) && $registering_new_user ) {
530
-			give_set_error( 'email_used', __( 'Sorry, that email already active for another user.', 'give' ) );
529
+		} else if (email_exists($user_email) && $registering_new_user) {
530
+			give_set_error('email_used', __('Sorry, that email already active for another user.', 'give'));
531 531
 		} else {
532 532
 			// All the checks have run and it's good to go
533 533
 			$valid_user_data['user_email'] = $user_email;
534 534
 		}
535 535
 	} else {
536 536
 		// No email
537
-		give_set_error( 'email_empty', __( 'Enter an email.', 'give' ) );
537
+		give_set_error('email_empty', __('Enter an email.', 'give'));
538 538
 	}
539 539
 
540 540
 	// Check password
541
-	if ( $user_pass && $pass_confirm ) {
541
+	if ($user_pass && $pass_confirm) {
542 542
 		// Verify confirmation matches
543
-		if ( $user_pass != $pass_confirm ) {
543
+		if ($user_pass != $pass_confirm) {
544 544
 			// Passwords do not match
545
-			give_set_error( 'password_mismatch', __( 'Passwords don\'t match.', 'give' ) );
545
+			give_set_error('password_mismatch', __('Passwords don\'t match.', 'give'));
546 546
 		} else {
547 547
 			// All is good to go
548 548
 			$valid_user_data['user_pass'] = $user_pass;
549 549
 		}
550 550
 	} else {
551 551
 		// Password or confirmation missing
552
-		if ( ! $user_pass && $registering_new_user ) {
552
+		if ( ! $user_pass && $registering_new_user) {
553 553
 			// The password is invalid
554
-			give_set_error( 'password_empty', __( 'Enter a password.', 'give' ) );
555
-		} else if ( ! $pass_confirm && $registering_new_user ) {
554
+			give_set_error('password_empty', __('Enter a password.', 'give'));
555
+		} else if ( ! $pass_confirm && $registering_new_user) {
556 556
 			// Confirmation password is invalid
557
-			give_set_error( 'confirmation_empty', __( 'Enter the password confirmation.', 'give' ) );
557
+			give_set_error('confirmation_empty', __('Enter the password confirmation.', 'give'));
558 558
 		}
559 559
 	}
560 560
 
@@ -573,36 +573,36 @@  discard block
 block discarded – undo
573 573
 	// Start an array to collect valid user data
574 574
 	$valid_user_data = array(
575 575
 		// Assume there will be errors
576
-		'user_id' => - 1
576
+		'user_id' => -1
577 577
 	);
578 578
 
579 579
 	// Username
580
-	if ( ! isset( $_POST['give_user_login'] ) || $_POST['give_user_login'] == '' ) {
581
-		give_set_error( 'must_log_in', __( 'You must login or register to complete your donation.', 'give' ) );
580
+	if ( ! isset($_POST['give_user_login']) || $_POST['give_user_login'] == '') {
581
+		give_set_error('must_log_in', __('You must login or register to complete your donation.', 'give'));
582 582
 
583 583
 		return $valid_user_data;
584 584
 	}
585 585
 
586 586
 	// Get the user by login
587
-	$user_data = get_user_by( 'login', strip_tags( $_POST['give_user_login'] ) );
587
+	$user_data = get_user_by('login', strip_tags($_POST['give_user_login']));
588 588
 
589 589
 	// Check if user exists
590
-	if ( $user_data ) {
590
+	if ($user_data) {
591 591
 		// Get password
592
-		$user_pass = isset( $_POST['give_user_pass'] ) ? $_POST['give_user_pass'] : false;
592
+		$user_pass = isset($_POST['give_user_pass']) ? $_POST['give_user_pass'] : false;
593 593
 
594 594
 		// Check user_pass
595
-		if ( $user_pass ) {
595
+		if ($user_pass) {
596 596
 			// Check if password is valid
597
-			if ( ! wp_check_password( $user_pass, $user_data->user_pass, $user_data->ID ) ) {
597
+			if ( ! wp_check_password($user_pass, $user_data->user_pass, $user_data->ID)) {
598 598
 				// Incorrect password
599 599
 				give_set_error(
600 600
 					'password_incorrect',
601 601
 					sprintf(
602 602
 						'%1$s <a href="%2$s">%3$s</a>',
603
-						__( 'The password you entered is incorrect.', 'give' ),
604
-						wp_lostpassword_url( "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" ),
605
-						__( 'Reset Password', 'give' )
603
+						__('The password you entered is incorrect.', 'give'),
604
+						wp_lostpassword_url("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"),
605
+						__('Reset Password', 'give')
606 606
 					)
607 607
 				);
608 608
 				// All is correct
@@ -619,11 +619,11 @@  discard block
 block discarded – undo
619 619
 			}
620 620
 		} else {
621 621
 			// Empty password
622
-			give_set_error( 'password_empty', __( 'Enter a password.', 'give' ) );
622
+			give_set_error('password_empty', __('Enter a password.', 'give'));
623 623
 		}
624 624
 	} else {
625 625
 		// no username
626
-		give_set_error( 'username_incorrect', __( 'The username you entered does not exist.', 'give' ) );
626
+		give_set_error('username_incorrect', __('The username you entered does not exist.', 'give'));
627 627
 	}
628 628
 
629 629
 	return $valid_user_data;
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
  */
639 639
 function give_purchase_form_validate_guest_user() {
640 640
 
641
-	$form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : '';
641
+	$form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : '';
642 642
 
643 643
 	// Start an array to collect valid user data
644 644
 	$valid_user_data = array(
@@ -647,32 +647,32 @@  discard block
 block discarded – undo
647 647
 	);
648 648
 
649 649
 	// Show error message if user must be logged in
650
-	if ( give_logged_in_only( $form_id ) ) {
651
-		give_set_error( 'logged_in_only', __( 'You must be logged into to donate.', 'give' ) );
650
+	if (give_logged_in_only($form_id)) {
651
+		give_set_error('logged_in_only', __('You must be logged into to donate.', 'give'));
652 652
 	}
653 653
 
654 654
 	// Get the guest email
655
-	$guest_email = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false;
655
+	$guest_email = isset($_POST['give_email']) ? $_POST['give_email'] : false;
656 656
 
657 657
 	// Check email
658
-	if ( $guest_email && strlen( $guest_email ) > 0 ) {
658
+	if ($guest_email && strlen($guest_email) > 0) {
659 659
 		// Validate email
660
-		if ( ! is_email( $guest_email ) ) {
660
+		if ( ! is_email($guest_email)) {
661 661
 			// Invalid email
662
-			give_set_error( 'email_invalid', __( 'Invalid email.', 'give' ) );
662
+			give_set_error('email_invalid', __('Invalid email.', 'give'));
663 663
 		} else {
664 664
 			// All is good to go
665 665
 			$valid_user_data['user_email'] = $guest_email;
666 666
 		}
667 667
 	} else {
668 668
 		// No email
669
-		give_set_error( 'email_empty', __( 'Enter an email.', 'give' ) );
669
+		give_set_error('email_empty', __('Enter an email.', 'give'));
670 670
 	}
671 671
 
672 672
 	// Loop through required fields and show error messages
673
-	foreach ( give_purchase_form_required_fields( $form_id ) as $field_name => $value ) {
674
-		if ( in_array( $value, give_purchase_form_required_fields( $form_id ) ) && empty( $_POST[ $field_name ] ) ) {
675
-			give_set_error( $value['error_id'], $value['error_message'] );
673
+	foreach (give_purchase_form_required_fields($form_id) as $field_name => $value) {
674
+		if (in_array($value, give_purchase_form_required_fields($form_id)) && empty($_POST[$field_name])) {
675
+			give_set_error($value['error_id'], $value['error_message']);
676 676
 		}
677 677
 	}
678 678
 
@@ -688,42 +688,42 @@  discard block
 block discarded – undo
688 688
  * @since   1.0
689 689
  * @return  integer
690 690
  */
691
-function give_register_and_login_new_user( $user_data = array() ) {
691
+function give_register_and_login_new_user($user_data = array()) {
692 692
 	// Verify the array
693
-	if ( empty( $user_data ) ) {
694
-		return - 1;
693
+	if (empty($user_data)) {
694
+		return -1;
695 695
 	}
696 696
 
697
-	if ( give_get_errors() ) {
698
-		return - 1;
697
+	if (give_get_errors()) {
698
+		return -1;
699 699
 	}
700 700
 
701
-	$user_args = apply_filters( 'give_insert_user_args', array(
702
-		'user_login'      => isset( $user_data['user_login'] ) ? $user_data['user_login'] : '',
703
-		'user_pass'       => isset( $user_data['user_pass'] ) ? $user_data['user_pass'] : '',
704
-		'user_email'      => isset( $user_data['user_email'] ) ? $user_data['user_email'] : '',
705
-		'first_name'      => isset( $user_data['user_first'] ) ? $user_data['user_first'] : '',
706
-		'last_name'       => isset( $user_data['user_last'] ) ? $user_data['user_last'] : '',
707
-		'user_registered' => date( 'Y-m-d H:i:s' ),
708
-		'role'            => get_option( 'default_role' )
709
-	), $user_data );
701
+	$user_args = apply_filters('give_insert_user_args', array(
702
+		'user_login'      => isset($user_data['user_login']) ? $user_data['user_login'] : '',
703
+		'user_pass'       => isset($user_data['user_pass']) ? $user_data['user_pass'] : '',
704
+		'user_email'      => isset($user_data['user_email']) ? $user_data['user_email'] : '',
705
+		'first_name'      => isset($user_data['user_first']) ? $user_data['user_first'] : '',
706
+		'last_name'       => isset($user_data['user_last']) ? $user_data['user_last'] : '',
707
+		'user_registered' => date('Y-m-d H:i:s'),
708
+		'role'            => get_option('default_role')
709
+	), $user_data);
710 710
 
711 711
 	// Insert new user
712
-	$user_id = wp_insert_user( $user_args );
712
+	$user_id = wp_insert_user($user_args);
713 713
 
714 714
 	// Validate inserted user
715
-	if ( is_wp_error( $user_id ) ) {
716
-		return - 1;
715
+	if (is_wp_error($user_id)) {
716
+		return -1;
717 717
 	}
718 718
 
719 719
 	// Allow themes and plugins to filter the user data
720
-	$user_data = apply_filters( 'give_insert_user_data', $user_data, $user_args );
720
+	$user_data = apply_filters('give_insert_user_data', $user_data, $user_args);
721 721
 
722 722
 	// Allow themes and plugins to hook
723
-	do_action( 'give_insert_user', $user_id, $user_data );
723
+	do_action('give_insert_user', $user_id, $user_data);
724 724
 
725 725
 	// Login new user
726
-	give_log_user_in( $user_id, $user_data['user_login'], $user_data['user_pass'] );
726
+	give_log_user_in($user_id, $user_data['user_login'], $user_data['user_pass']);
727 727
 
728 728
 	// Return user id
729 729
 	return $user_id;
@@ -738,27 +738,27 @@  discard block
 block discarded – undo
738 738
  * @since   1.0
739 739
  * @return  array
740 740
  */
741
-function give_get_purchase_form_user( $valid_data = array() ) {
741
+function give_get_purchase_form_user($valid_data = array()) {
742 742
 
743 743
 	// Initialize user
744 744
 	$user    = false;
745
-	$is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
745
+	$is_ajax = defined('DOING_AJAX') && DOING_AJAX;
746 746
 
747
-	if ( $is_ajax ) {
747
+	if ($is_ajax) {
748 748
 		// Do not create or login the user during the ajax submission (check for errors only)
749 749
 		return true;
750
-	} else if ( is_user_logged_in() ) {
750
+	} else if (is_user_logged_in()) {
751 751
 		// Set the valid user as the logged in collected data
752 752
 		$user = $valid_data['logged_in_user'];
753
-	} else if ( $valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true ) {
753
+	} else if ($valid_data['need_new_user'] === true || $valid_data['need_user_login'] === true) {
754 754
 		// New user registration
755
-		if ( $valid_data['need_new_user'] === true ) {
755
+		if ($valid_data['need_new_user'] === true) {
756 756
 			// Set user
757 757
 			$user = $valid_data['new_user_data'];
758 758
 			// Register and login new user
759
-			$user['user_id'] = give_register_and_login_new_user( $user );
759
+			$user['user_id'] = give_register_and_login_new_user($user);
760 760
 			// User login
761
-		} else if ( $valid_data['need_user_login'] === true && ! $is_ajax ) {
761
+		} else if ($valid_data['need_user_login'] === true && ! $is_ajax) {
762 762
 
763 763
 			/*
764 764
 			 * The login form is now processed in the give_process_purchase_login() function.
@@ -773,48 +773,48 @@  discard block
 block discarded – undo
773 773
 			// Set user
774 774
 			$user = $valid_data['login_user_data'];
775 775
 			// Login user
776
-			give_log_user_in( $user['user_id'], $user['user_login'], $user['user_pass'] );
776
+			give_log_user_in($user['user_id'], $user['user_login'], $user['user_pass']);
777 777
 		}
778 778
 	}
779 779
 
780 780
 	// Check guest checkout
781
-	if ( false === $user && false === give_logged_in_only( $_POST['give-form-id'] ) ) {
781
+	if (false === $user && false === give_logged_in_only($_POST['give-form-id'])) {
782 782
 		// Set user
783 783
 		$user = $valid_data['guest_user_data'];
784 784
 	}
785 785
 
786 786
 	// Verify we have an user
787
-	if ( false === $user || empty( $user ) ) {
787
+	if (false === $user || empty($user)) {
788 788
 		// Return false
789 789
 		return false;
790 790
 	}
791 791
 
792 792
 	// Get user first name
793
-	if ( ! isset( $user['user_first'] ) || strlen( trim( $user['user_first'] ) ) < 1 ) {
794
-		$user['user_first'] = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : '';
793
+	if ( ! isset($user['user_first']) || strlen(trim($user['user_first'])) < 1) {
794
+		$user['user_first'] = isset($_POST['give_first']) ? strip_tags(trim($_POST['give_first'])) : '';
795 795
 	}
796 796
 
797 797
 	// Get user last name
798
-	if ( ! isset( $user['user_last'] ) || strlen( trim( $user['user_last'] ) ) < 1 ) {
799
-		$user['user_last'] = isset( $_POST['give_last'] ) ? strip_tags( trim( $_POST['give_last'] ) ) : '';
798
+	if ( ! isset($user['user_last']) || strlen(trim($user['user_last'])) < 1) {
799
+		$user['user_last'] = isset($_POST['give_last']) ? strip_tags(trim($_POST['give_last'])) : '';
800 800
 	}
801 801
 
802 802
 	// Get the user's billing address details
803 803
 	$user['address']            = array();
804
-	$user['address']['line1']   = ! empty( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : false;
805
-	$user['address']['line2']   = ! empty( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : false;
806
-	$user['address']['city']    = ! empty( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : false;
807
-	$user['address']['state']   = ! empty( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : false;
808
-	$user['address']['country'] = ! empty( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : false;
809
-	$user['address']['zip']     = ! empty( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : false;
810
-
811
-	if ( empty( $user['address']['country'] ) ) {
804
+	$user['address']['line1']   = ! empty($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : false;
805
+	$user['address']['line2']   = ! empty($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : false;
806
+	$user['address']['city']    = ! empty($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : false;
807
+	$user['address']['state']   = ! empty($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : false;
808
+	$user['address']['country'] = ! empty($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : false;
809
+	$user['address']['zip']     = ! empty($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : false;
810
+
811
+	if (empty($user['address']['country'])) {
812 812
 		$user['address'] = false;
813 813
 	} // Country will always be set if address fields are present
814 814
 
815
-	if ( ! empty( $user['user_id'] ) && $user['user_id'] > 0 && ! empty( $user['address'] ) ) {
815
+	if ( ! empty($user['user_id']) && $user['user_id'] > 0 && ! empty($user['address'])) {
816 816
 		// Store the address in the user's meta so the donation form can be pre-populated with it on return purchases
817
-		update_user_meta( $user['user_id'], '_give_user_address', $user['address'] );
817
+		update_user_meta($user['user_id'], '_give_user_address', $user['address']);
818 818
 	}
819 819
 
820 820
 	// Return valid user
@@ -833,16 +833,16 @@  discard block
 block discarded – undo
833 833
 	$card_data = give_get_purchase_cc_info();
834 834
 
835 835
 	// Validate the card zip
836
-	if ( ! empty( $card_data['card_zip'] ) ) {
837
-		if ( ! give_purchase_form_validate_cc_zip( $card_data['card_zip'], $card_data['card_country'] ) ) {
838
-			give_set_error( 'invalid_cc_zip', __( 'The zip / postal code you entered for your billing address is invalid.', 'give' ) );
836
+	if ( ! empty($card_data['card_zip'])) {
837
+		if ( ! give_purchase_form_validate_cc_zip($card_data['card_zip'], $card_data['card_country'])) {
838
+			give_set_error('invalid_cc_zip', __('The zip / postal code you entered for your billing address is invalid.', 'give'));
839 839
 		}
840 840
 	}
841 841
 
842 842
 	//Ensure no spaces
843
-	if ( ! empty( $card_data['card_number'] ) ) {
844
-		$card_data['card_number'] = str_replace( '+', '', $card_data['card_number'] ); //no "+" signs
845
-		$card_data['card_number'] = str_replace( ' ', '', $card_data['card_number'] ); // No spaces
843
+	if ( ! empty($card_data['card_number'])) {
844
+		$card_data['card_number'] = str_replace('+', '', $card_data['card_number']); //no "+" signs
845
+		$card_data['card_number'] = str_replace(' ', '', $card_data['card_number']); // No spaces
846 846
 	}
847 847
 
848 848
 	// This should validate card numbers at some point too
@@ -858,17 +858,17 @@  discard block
 block discarded – undo
858 858
  */
859 859
 function give_get_purchase_cc_info() {
860 860
 	$cc_info                   = array();
861
-	$cc_info['card_name']      = isset( $_POST['card_name'] ) ? sanitize_text_field( $_POST['card_name'] ) : '';
862
-	$cc_info['card_number']    = isset( $_POST['card_number'] ) ? sanitize_text_field( $_POST['card_number'] ) : '';
863
-	$cc_info['card_cvc']       = isset( $_POST['card_cvc'] ) ? sanitize_text_field( $_POST['card_cvc'] ) : '';
864
-	$cc_info['card_exp_month'] = isset( $_POST['card_exp_month'] ) ? sanitize_text_field( $_POST['card_exp_month'] ) : '';
865
-	$cc_info['card_exp_year']  = isset( $_POST['card_exp_year'] ) ? sanitize_text_field( $_POST['card_exp_year'] ) : '';
866
-	$cc_info['card_address']   = isset( $_POST['card_address'] ) ? sanitize_text_field( $_POST['card_address'] ) : '';
867
-	$cc_info['card_address_2'] = isset( $_POST['card_address_2'] ) ? sanitize_text_field( $_POST['card_address_2'] ) : '';
868
-	$cc_info['card_city']      = isset( $_POST['card_city'] ) ? sanitize_text_field( $_POST['card_city'] ) : '';
869
-	$cc_info['card_state']     = isset( $_POST['card_state'] ) ? sanitize_text_field( $_POST['card_state'] ) : '';
870
-	$cc_info['card_country']   = isset( $_POST['billing_country'] ) ? sanitize_text_field( $_POST['billing_country'] ) : '';
871
-	$cc_info['card_zip']       = isset( $_POST['card_zip'] ) ? sanitize_text_field( $_POST['card_zip'] ) : '';
861
+	$cc_info['card_name']      = isset($_POST['card_name']) ? sanitize_text_field($_POST['card_name']) : '';
862
+	$cc_info['card_number']    = isset($_POST['card_number']) ? sanitize_text_field($_POST['card_number']) : '';
863
+	$cc_info['card_cvc']       = isset($_POST['card_cvc']) ? sanitize_text_field($_POST['card_cvc']) : '';
864
+	$cc_info['card_exp_month'] = isset($_POST['card_exp_month']) ? sanitize_text_field($_POST['card_exp_month']) : '';
865
+	$cc_info['card_exp_year']  = isset($_POST['card_exp_year']) ? sanitize_text_field($_POST['card_exp_year']) : '';
866
+	$cc_info['card_address']   = isset($_POST['card_address']) ? sanitize_text_field($_POST['card_address']) : '';
867
+	$cc_info['card_address_2'] = isset($_POST['card_address_2']) ? sanitize_text_field($_POST['card_address_2']) : '';
868
+	$cc_info['card_city']      = isset($_POST['card_city']) ? sanitize_text_field($_POST['card_city']) : '';
869
+	$cc_info['card_state']     = isset($_POST['card_state']) ? sanitize_text_field($_POST['card_state']) : '';
870
+	$cc_info['card_country']   = isset($_POST['billing_country']) ? sanitize_text_field($_POST['billing_country']) : '';
871
+	$cc_info['card_zip']       = isset($_POST['card_zip']) ? sanitize_text_field($_POST['card_zip']) : '';
872 872
 
873 873
 	// Return cc info
874 874
 	return $cc_info;
@@ -884,14 +884,14 @@  discard block
 block discarded – undo
884 884
  *
885 885
  * @return bool|mixed|void
886 886
  */
887
-function give_purchase_form_validate_cc_zip( $zip = 0, $country_code = '' ) {
887
+function give_purchase_form_validate_cc_zip($zip = 0, $country_code = '') {
888 888
 	$ret = false;
889 889
 
890
-	if ( empty( $zip ) || empty( $country_code ) ) {
890
+	if (empty($zip) || empty($country_code)) {
891 891
 		return $ret;
892 892
 	}
893 893
 
894
-	$country_code = strtoupper( $country_code );
894
+	$country_code = strtoupper($country_code);
895 895
 
896 896
 	$zip_regex = array(
897 897
 		"AD" => "AD\d{3}",
@@ -1051,9 +1051,9 @@  discard block
 block discarded – undo
1051 1051
 		"ZM" => "\d{5}"
1052 1052
 	);
1053 1053
 
1054
-	if ( ! isset ( $zip_regex[ $country_code ] ) || preg_match( "/" . $zip_regex[ $country_code ] . "/i", $zip ) ) {
1054
+	if ( ! isset ($zip_regex[$country_code]) || preg_match("/".$zip_regex[$country_code]."/i", $zip)) {
1055 1055
 		$ret = true;
1056 1056
 	}
1057 1057
 
1058
-	return apply_filters( 'give_is_zip_valid', $ret, $zip, $country_code );
1058
+	return apply_filters('give_is_zip_valid', $ret, $zip, $country_code);
1059 1059
 }
1060 1060
\ No newline at end of file
Please login to merge, or discard this patch.
includes/class-give-license-handler.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@  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
 
15
-if ( ! class_exists( 'Give_License' ) ) :
15
+if ( ! class_exists('Give_License')) :
16 16
 
17 17
 	/**
18 18
 	 * Give_License Class
@@ -38,16 +38,16 @@  discard block
 block discarded – undo
38 38
 		 * @param string  $_optname
39 39
 		 * @param string  $_api_url
40 40
 		 */
41
-		public function __construct( $_file, $_item_name, $_version, $_author, $_optname = null, $_api_url = null ) {
41
+		public function __construct($_file, $_item_name, $_version, $_author, $_optname = null, $_api_url = null) {
42 42
 			global $give_options;
43 43
 
44 44
 			$this->file           = $_file;
45 45
 			$this->item_name      = $_item_name;
46
-			$this->item_shortname = 'give_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $this->item_name ) ) );
46
+			$this->item_shortname = 'give_'.preg_replace('/[^a-zA-Z0-9_\s]/', '', str_replace(' ', '_', strtolower($this->item_name)));
47 47
 			$this->version        = $_version;
48
-			$this->license        = isset( $give_options[ $this->item_shortname . '_license_key' ] ) ? trim( $give_options[ $this->item_shortname . '_license_key' ] ) : '';
48
+			$this->license        = isset($give_options[$this->item_shortname.'_license_key']) ? trim($give_options[$this->item_shortname.'_license_key']) : '';
49 49
 			$this->author         = $_author;
50
-			$this->api_url        = is_null( $_api_url ) ? $this->api_url : $_api_url;
50
+			$this->api_url        = is_null($_api_url) ? $this->api_url : $_api_url;
51 51
 
52 52
 
53 53
 			// Setup hooks
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 		 * @return  void
64 64
 		 */
65 65
 		private function includes() {
66
-			if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) {
66
+			if ( ! class_exists('EDD_SL_Plugin_Updater')) {
67 67
 				require_once 'admin/EDD_SL_Plugin_Updater.php';
68 68
 			}
69 69
 		}
@@ -77,18 +77,18 @@  discard block
 block discarded – undo
77 77
 		private function hooks() {
78 78
 
79 79
 			// Register settings
80
-			add_filter( 'give_settings_licenses', array( $this, 'settings' ), 1 );
80
+			add_filter('give_settings_licenses', array($this, 'settings'), 1);
81 81
 
82 82
 			// Activate license key on settings save
83
-			add_action( 'admin_init', array( $this, 'activate_license' ) );
83
+			add_action('admin_init', array($this, 'activate_license'));
84 84
 
85 85
 			// Deactivate license key
86
-			add_action( 'admin_init', array( $this, 'deactivate_license' ) );
86
+			add_action('admin_init', array($this, 'deactivate_license'));
87 87
 
88 88
 			// Updater
89
-			add_action( 'admin_init', array( $this, 'auto_updater' ), 0 );
89
+			add_action('admin_init', array($this, 'auto_updater'), 0);
90 90
 
91
-			add_action( 'admin_notices', array( $this, 'notices' ) );
91
+			add_action('admin_notices', array($this, 'notices'));
92 92
 		}
93 93
 
94 94
 		/**
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 		 */
101 101
 		public function auto_updater() {
102 102
 
103
-			if ( 'valid' !== get_option( $this->item_shortname . '_license_active' ) ) {
103
+			if ('valid' !== get_option($this->item_shortname.'_license_active')) {
104 104
 				return;
105 105
 			}
106 106
 
@@ -127,20 +127,20 @@  discard block
 block discarded – undo
127 127
 		 *
128 128
 		 * @return  array
129 129
 		 */
130
-		public function settings( $settings ) {
130
+		public function settings($settings) {
131 131
 
132 132
 			$give_license_settings = array(
133 133
 				array(
134 134
 					'name'    => $this->item_name,
135
-					'id'      => $this->item_shortname . '_license_key',
135
+					'id'      => $this->item_shortname.'_license_key',
136 136
 					'desc'    => '',
137 137
 					'type'    => 'license_key',
138
-					'options' => array( 'is_valid_license_option' => $this->item_shortname . '_license_active' ),
138
+					'options' => array('is_valid_license_option' => $this->item_shortname.'_license_active'),
139 139
 					'size'    => 'regular'
140 140
 				)
141 141
 			);
142 142
 
143
-			return array_merge( $settings, $give_license_settings );
143
+			return array_merge($settings, $give_license_settings);
144 144
 		}
145 145
 
146 146
 		/**
@@ -152,18 +152,18 @@  discard block
 block discarded – undo
152 152
 		 *
153 153
 		 * @return  array
154 154
 		 */
155
-		public function license_settings_content( $settings ) {
155
+		public function license_settings_content($settings) {
156 156
 
157 157
 			$give_license_settings = array(
158 158
 				array(
159
-					'name' => __( 'Add-on Licenses', 'give' ),
159
+					'name' => __('Add-on Licenses', 'give'),
160 160
 					'desc' => '<hr>',
161 161
 					'type' => 'give_title',
162 162
 					'id'   => 'give_title'
163 163
 				),
164 164
 			);
165 165
 
166
-			return array_merge( $settings, $give_license_settings );
166
+			return array_merge($settings, $give_license_settings);
167 167
 		}
168 168
 
169 169
 
@@ -175,34 +175,34 @@  discard block
 block discarded – undo
175 175
 		 */
176 176
 		public function activate_license() {
177 177
 
178
-			if ( ! isset( $_POST[ $this->item_shortname . '_license_key' ] ) ) {
178
+			if ( ! isset($_POST[$this->item_shortname.'_license_key'])) {
179 179
 				return;
180 180
 			}
181 181
 
182
-			foreach ( $_POST as $key => $value ) {
183
-				if ( false !== strpos( $key, 'license_key_deactivate' ) ) {
182
+			foreach ($_POST as $key => $value) {
183
+				if (false !== strpos($key, 'license_key_deactivate')) {
184 184
 					// Don't activate a key when deactivating a different key
185 185
 					return;
186 186
 				}
187 187
 			}
188 188
 
189
-			if ( ! wp_verify_nonce( $_REQUEST[ $this->item_shortname . '_license_key-nonce' ], $this->item_shortname . '_license_key-nonce' ) ) {
189
+			if ( ! wp_verify_nonce($_REQUEST[$this->item_shortname.'_license_key-nonce'], $this->item_shortname.'_license_key-nonce')) {
190 190
 
191
-				wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
191
+				wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'), array('response' => 403));
192 192
 
193 193
 			}
194 194
 
195
-			if ( ! current_user_can( 'manage_give_settings' ) ) {
195
+			if ( ! current_user_can('manage_give_settings')) {
196 196
 				return;
197 197
 			}
198 198
 
199
-			if ( 'valid' === get_option( $this->item_shortname . '_license_active' ) ) {
199
+			if ('valid' === get_option($this->item_shortname.'_license_active')) {
200 200
 				return;
201 201
 			}
202 202
 
203
-			$license = sanitize_text_field( $_POST[ $this->item_shortname . '_license_key' ] );
203
+			$license = sanitize_text_field($_POST[$this->item_shortname.'_license_key']);
204 204
 
205
-			if ( empty( $license ) ) {
205
+			if (empty($license)) {
206 206
 				return;
207 207
 			}
208 208
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 			$api_params = array(
211 211
 				'edd_action' => 'activate_license', //never change from "edd_" to "give_"!
212 212
 				'license'    => $license,
213
-				'item_name'  => urlencode( $this->item_name ),
213
+				'item_name'  => urlencode($this->item_name),
214 214
 				'url'        => home_url()
215 215
 			);
216 216
 
@@ -225,22 +225,22 @@  discard block
 block discarded – undo
225 225
 			);
226 226
 
227 227
 			// Make sure there are no errors
228
-			if ( is_wp_error( $response ) ) {
228
+			if (is_wp_error($response)) {
229 229
 				return;
230 230
 			}
231 231
 
232 232
 			// Tell WordPress to look for updates
233
-			set_site_transient( 'update_plugins', null );
233
+			set_site_transient('update_plugins', null);
234 234
 
235 235
 			// Decode license data
236
-			$license_data = json_decode( wp_remote_retrieve_body( $response ) );
236
+			$license_data = json_decode(wp_remote_retrieve_body($response));
237 237
 
238
-			update_option( $this->item_shortname . '_license_active', $license_data->license );
238
+			update_option($this->item_shortname.'_license_active', $license_data->license);
239 239
 
240
-			if ( ! (bool) $license_data->success ) {
241
-				set_transient( 'give_license_error', $license_data, 1000 );
240
+			if ( ! (bool) $license_data->success) {
241
+				set_transient('give_license_error', $license_data, 1000);
242 242
 			} else {
243
-				delete_transient( 'give_license_error' );
243
+				delete_transient('give_license_error');
244 244
 			}
245 245
 		}
246 246
 
@@ -253,28 +253,28 @@  discard block
 block discarded – undo
253 253
 		 */
254 254
 		public function deactivate_license() {
255 255
 
256
-			if ( ! isset( $_POST[ $this->item_shortname . '_license_key' ] ) ) {
256
+			if ( ! isset($_POST[$this->item_shortname.'_license_key'])) {
257 257
 				return;
258 258
 			}
259 259
 
260
-			if ( ! wp_verify_nonce( $_REQUEST[ $this->item_shortname . '_license_key-nonce' ], $this->item_shortname . '_license_key-nonce' ) ) {
260
+			if ( ! wp_verify_nonce($_REQUEST[$this->item_shortname.'_license_key-nonce'], $this->item_shortname.'_license_key-nonce')) {
261 261
 
262
-				wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
262
+				wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'), array('response' => 403));
263 263
 
264 264
 			}
265 265
 
266
-			if ( ! current_user_can( 'manage_give_settings' ) ) {
266
+			if ( ! current_user_can('manage_give_settings')) {
267 267
 				return;
268 268
 			}
269 269
 
270 270
 			// Run on deactivate button press
271
-			if ( isset( $_POST[ $this->item_shortname . '_license_key_deactivate' ] ) ) {
271
+			if (isset($_POST[$this->item_shortname.'_license_key_deactivate'])) {
272 272
 
273 273
 				// Data to send to the API
274 274
 				$api_params = array(
275 275
 					'edd_action' => 'deactivate_license', //never change from "edd_" to "give_"!
276 276
 					'license'    => $this->license,
277
-					'item_name'  => urlencode( $this->item_name ),
277
+					'item_name'  => urlencode($this->item_name),
278 278
 					'url'        => home_url()
279 279
 				);
280 280
 
@@ -290,19 +290,19 @@  discard block
 block discarded – undo
290 290
 
291 291
 
292 292
 				// Make sure there are no errors
293
-				if ( is_wp_error( $response ) ) {
293
+				if (is_wp_error($response)) {
294 294
 					return;
295 295
 				}
296 296
 
297 297
 				// Decode the license data
298
-				$license_data = json_decode( wp_remote_retrieve_body( $response ) );
298
+				$license_data = json_decode(wp_remote_retrieve_body($response));
299 299
 
300
-				delete_option( $this->item_shortname . '_license_active' );
300
+				delete_option($this->item_shortname.'_license_active');
301 301
 
302
-				if ( ! (bool) $license_data->success ) {
303
-					set_transient( 'give_license_error', $license_data, 1000 );
302
+				if ( ! (bool) $license_data->success) {
303
+					set_transient('give_license_error', $license_data, 1000);
304 304
 				} else {
305
-					delete_transient( 'give_license_error' );
305
+					delete_transient('give_license_error');
306 306
 				}
307 307
 			}
308 308
 		}
@@ -316,44 +316,44 @@  discard block
 block discarded – undo
316 316
 		 */
317 317
 		public function notices() {
318 318
 
319
-			if ( ! isset( $_GET['page'] ) || 'give-settings' !== $_GET['page'] ) {
319
+			if ( ! isset($_GET['page']) || 'give-settings' !== $_GET['page']) {
320 320
 				return;
321 321
 			}
322 322
 
323
-			if ( ! isset( $_GET['tab'] ) || 'licenses' !== $_GET['tab'] ) {
323
+			if ( ! isset($_GET['tab']) || 'licenses' !== $_GET['tab']) {
324 324
 				return;
325 325
 			}
326 326
 
327
-			$license_error = get_transient( 'give_license_error' );
327
+			$license_error = get_transient('give_license_error');
328 328
 
329
-			if ( false === $license_error ) {
329
+			if (false === $license_error) {
330 330
 				return;
331 331
 			}
332 332
 
333
-			if ( ! empty( $license_error->error ) ) {
333
+			if ( ! empty($license_error->error)) {
334 334
 
335
-				switch ( $license_error->error ) {
335
+				switch ($license_error->error) {
336 336
 
337 337
 					case 'item_name_mismatch' :
338 338
 
339
-						$message = __( 'This license does not belong to the product you have entered it for.', 'give' );
339
+						$message = __('This license does not belong to the product you have entered it for.', 'give');
340 340
 						break;
341 341
 
342 342
 					case 'no_activations_left' :
343 343
 
344
-						$message = __( 'This license does not have any activations left.', 'give' );
344
+						$message = __('This license does not have any activations left.', 'give');
345 345
 						break;
346 346
 
347 347
 					case 'expired' :
348 348
 
349
-						$message = __( 'This license key is expired. Please renew it.', 'give' );
349
+						$message = __('This license key is expired. Please renew it.', 'give');
350 350
 						break;
351 351
 
352 352
 					default :
353 353
 
354 354
 						$message = sprintf(
355 355
 							/* translators: %s: license error */
356
-							__( 'There was a problem activating your license key, please try again or contact support. Error code: %s', 'give' ),
356
+							__('There was a problem activating your license key, please try again or contact support. Error code: %s', 'give'),
357 357
 							$license_error->error
358 358
 						);
359 359
 						break;
@@ -362,15 +362,15 @@  discard block
 block discarded – undo
362 362
 
363 363
 			}
364 364
 
365
-			if ( ! empty( $message ) ) {
365
+			if ( ! empty($message)) {
366 366
 
367 367
 				echo '<div class="error">';
368
-				echo '<p>' . $message . '</p>';
368
+				echo '<p>'.$message.'</p>';
369 369
 				echo '</div>';
370 370
 
371 371
 			}
372 372
 
373
-			delete_transient( 'give_license_error' );
373
+			delete_transient('give_license_error');
374 374
 
375 375
 		}
376 376
 	}
Please login to merge, or discard this patch.
includes/forms/widget.php 1 patch
Spacing   +49 added lines, -49 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
-defined( 'ABSPATH' ) or exit;
13
+defined('ABSPATH') or exit;
14 14
 
15 15
 /**
16 16
  * Give Form widget
@@ -31,18 +31,18 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	public function __construct()
33 33
 	{
34
-		$this->self = get_class( $this );
34
+		$this->self = get_class($this);
35 35
 
36 36
 		parent::__construct(
37
-			strtolower( $this->self ),
38
-			__( 'Give - Donation Form', 'give' ),
37
+			strtolower($this->self),
38
+			__('Give - Donation Form', 'give'),
39 39
 			array(
40
-				'description' => __( 'Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give' )
40
+				'description' => __('Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give')
41 41
 			)
42 42
 		);
43 43
 
44
-		add_action( 'widgets_init',          array( $this, 'widget_init' ) );
45
-		add_action( 'admin_enqueue_scripts', array( $this, 'admin_widget_scripts' ) );
44
+		add_action('widgets_init', array($this, 'widget_init'));
45
+		add_action('admin_enqueue_scripts', array($this, 'admin_widget_scripts'));
46 46
 	}
47 47
 
48 48
 	/**
@@ -52,24 +52,24 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @return void
54 54
 	 */
55
-	public function admin_widget_scripts( $hook )
55
+	public function admin_widget_scripts($hook)
56 56
 	{
57 57
 		// Directories of assets
58
-		$js_dir     = GIVE_PLUGIN_URL . 'assets/js/admin/';
59
-		$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
60
-		$css_dir    = GIVE_PLUGIN_URL . 'assets/css/';
58
+		$js_dir     = GIVE_PLUGIN_URL.'assets/js/admin/';
59
+		$js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/';
60
+		$css_dir    = GIVE_PLUGIN_URL.'assets/css/';
61 61
 
62 62
 		// Use minified libraries if SCRIPT_DEBUG is turned off
63
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
63
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
64 64
 
65 65
 		// Widget Script
66
-		if ( $hook == 'widgets.php' ) {
66
+		if ($hook == 'widgets.php') {
67 67
 
68
-			wp_enqueue_style( 'give-qtip-css', $css_dir . 'jquery.qtip' . $suffix . '.css' );
68
+			wp_enqueue_style('give-qtip-css', $css_dir.'jquery.qtip'.$suffix.'.css');
69 69
 
70
-			wp_enqueue_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION );
70
+			wp_enqueue_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION);
71 71
 
72
-			wp_enqueue_script( 'give-admin-widgets-scripts', $js_dir . 'admin-widgets' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
72
+			wp_enqueue_script('give-admin-widgets-scripts', $js_dir.'admin-widgets'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
73 73
 		}
74 74
 	}
75 75
 
@@ -80,24 +80,24 @@  discard block
 block discarded – undo
80 80
 	 *                        before_widget, and after_widget.
81 81
 	 * @param array $instance The settings for the particular instance of the widget.
82 82
 	 */
83
-	public function widget( $args, $instance )
83
+	public function widget($args, $instance)
84 84
 	{
85
-		extract( $args );
85
+		extract($args);
86 86
 
87
-		$title = !empty( $instance['title'] ) ? $instance['title'] : '';
88
-		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
87
+		$title = ! empty($instance['title']) ? $instance['title'] : '';
88
+		$title = apply_filters('widget_title', $title, $instance, $this->id_base);
89 89
 
90 90
 		echo $before_widget;
91 91
 
92
-		do_action( 'give_before_forms_widget' );
92
+		do_action('give_before_forms_widget');
93 93
 
94
-		echo $title ? $before_title . $title . $after_title : '';
94
+		echo $title ? $before_title.$title.$after_title : '';
95 95
 
96
-		give_get_donation_form( $instance );
96
+		give_get_donation_form($instance);
97 97
 
98 98
 		echo $after_widget;
99 99
 
100
-		do_action( 'give_after_forms_widget' );
100
+		do_action('give_after_forms_widget');
101 101
 	}
102 102
 
103 103
 	/**
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 * @return string
109 109
 	 */
110
-	public function form( $instance )
110
+	public function form($instance)
111 111
 	{
112 112
 		$defaults = array(
113 113
 			'title'        => '',
@@ -115,61 +115,61 @@  discard block
 block discarded – undo
115 115
 			'float_labels' => '',
116 116
 		);
117 117
 
118
-		$instance = wp_parse_args( (array) $instance, $defaults );
118
+		$instance = wp_parse_args((array) $instance, $defaults);
119 119
 
120
-		extract( $instance );
120
+		extract($instance);
121 121
 
122 122
 		// Query Give Forms
123 123
 
124 124
 		$args = array(
125 125
 			'post_type'      => 'give_forms',
126
-			'posts_per_page' => - 1,
126
+			'posts_per_page' => -1,
127 127
 			'post_status'    => 'publish',
128 128
 		);
129 129
 
130
-		$give_forms = get_posts( $args );
130
+		$give_forms = get_posts($args);
131 131
 
132 132
 		// Widget: Title
133 133
 
134 134
 		?><p>
135
-			<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'give' ); ?></label>
136
-			<input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $title ); ?>" /><br>
137
-			<small><?php _e( 'Leave blank to hide the widget title.', 'give' ); ?></small>
135
+			<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'give'); ?></label>
136
+			<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($title); ?>" /><br>
137
+			<small><?php _e('Leave blank to hide the widget title.', 'give'); ?></small>
138 138
 		</p><?php
139 139
 
140 140
 		// Widget: Give Form
141 141
 
142 142
 		?><p>
143
-			<label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php
143
+			<label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php
144 144
 				printf(
145 145
 					/* translators: %s: form singular label */
146
-					__( 'Give %s:', 'give' ),
146
+					__('Give %s:', 'give'),
147 147
 					give_get_forms_label_singular()
148 148
 				);
149 149
 			?></label>
150
-			<select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>">
151
-				<option value="current"><?php _e( '— Select —', 'give' ); ?></option>
152
-				<?php foreach ( $give_forms as $give_form ) { ?>
153
-					<option <?php selected( absint( $id ), $give_form->ID ); ?> value="<?php echo esc_attr( $give_form->ID ); ?>"><?php echo $give_form->post_title; ?></option>
150
+			<select class="widefat" name="<?php echo esc_attr($this->get_field_name('id')); ?>" id="<?php echo esc_attr($this->get_field_id('id')); ?>">
151
+				<option value="current"><?php _e('— Select —', 'give'); ?></option>
152
+				<?php foreach ($give_forms as $give_form) { ?>
153
+					<option <?php selected(absint($id), $give_form->ID); ?> value="<?php echo esc_attr($give_form->ID); ?>"><?php echo $give_form->post_title; ?></option>
154 154
 				<?php } ?>
155 155
 			</select><br>
156
-			<small><?php _e( 'Select a Give Form to embed in this widget.', 'give' ); ?></small>
156
+			<small><?php _e('Select a Give Form to embed in this widget.', 'give'); ?></small>
157 157
 		</p><?php
158 158
 
159 159
 		// Widget: Floating Labels
160 160
 
161 161
 		?><p>
162
-			<label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"><?php _e( 'Floating Labels (optional):', 'give' ); ?></label>
163
-			<select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'float_labels' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>">
164
-				<option value="" <?php selected( esc_attr( $float_labels ), '' ) ?>>– <?php _e( 'Select', 'give' ); ?> –</option>
165
-				<option value="enabled" <?php selected( esc_attr( $float_labels ), 'enabled' ) ?>><?php _e( 'Enabled', 'give' ); ?></option>
166
-				<option value="disabled" <?php selected( esc_attr( $float_labels ), 'disabled' ) ?>><?php _e( 'Disabled', 'give' ); ?></option>
162
+			<label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"><?php _e('Floating Labels (optional):', 'give'); ?></label>
163
+			<select class="widefat" name="<?php echo esc_attr($this->get_field_name('float_labels')); ?>" id="<?php echo esc_attr($this->get_field_id('float_labels')); ?>">
164
+				<option value="" <?php selected(esc_attr($float_labels), '') ?>>– <?php _e('Select', 'give'); ?> –</option>
165
+				<option value="enabled" <?php selected(esc_attr($float_labels), 'enabled') ?>><?php _e('Enabled', 'give'); ?></option>
166
+				<option value="disabled" <?php selected(esc_attr($float_labels), 'disabled') ?>><?php _e('Disabled', 'give'); ?></option>
167 167
 			</select><br>
168 168
 			<small><?php
169 169
 				printf(
170 170
 					/* translators: %s: http://bradfrost.com/blog/post/float-label-pattern/ */
171
-					__( 'Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give' ),
172
-					esc_url( 'http://bradfrost.com/blog/post/float-label-pattern/' )
171
+					__('Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give'),
172
+					esc_url('http://bradfrost.com/blog/post/float-label-pattern/')
173 173
 				);
174 174
 			?></small>
175 175
 		</p><?php
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 */
183 183
 	function widget_init()
184 184
 	{
185
-		register_widget( $this->self );
185
+		register_widget($this->self);
186 186
 	}
187 187
 
188 188
 	/**
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 *
194 194
 	 * @return array
195 195
 	 */
196
-	public function update( $new_instance, $old_instance )
196
+	public function update($new_instance, $old_instance)
197 197
 	{
198 198
 		$this->flush_widget_cache();
199 199
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	public function flush_widget_cache()
209 209
 	{
210
-		wp_cache_delete( $this->self, 'widget' );
210
+		wp_cache_delete($this->self, 'widget');
211 211
 	}
212 212
 }
213 213
 
Please login to merge, or discard this patch.
includes/forms/template.php 1 patch
Spacing   +405 added lines, -405 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,64 +23,64 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string $purchase_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 = esc_url( add_query_arg( apply_filters( 'give_form_action_args', array(
51
+	$form_action = esc_url(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
-	if ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) {
58
+	if ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) {
59 59
 		return false;
60 60
 	}
61 61
 
62
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
62
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
63 63
 		? $args['display_style']
64
-		: get_post_meta( $form->ID, '_give_payment_display', true );
64
+		: get_post_meta($form->ID, '_give_payment_display', true);
65 65
 
66
-	$float_labels_option = give_is_float_labels_enabled( $args )
66
+	$float_labels_option = give_is_float_labels_enabled($args)
67 67
 		? ' float-labels-enabled'
68 68
 		: '';
69 69
 
70 70
 	//Form Wrap Classes
71
-	$form_wrap_classes_array = apply_filters( 'give_form_wrap_classes', array(
71
+	$form_wrap_classes_array = apply_filters('give_form_wrap_classes', array(
72 72
 		'give-form-wrap',
73
-		'give-display-' . $display_option
74
-	), $form->ID, $args );
75
-	$form_wrap_classes       = implode( ' ', $form_wrap_classes_array );
73
+		'give-display-'.$display_option
74
+	), $form->ID, $args);
75
+	$form_wrap_classes = implode(' ', $form_wrap_classes_array);
76 76
 
77 77
 	//Form Classes
78
-	$form_classes_array = apply_filters( 'give_form_classes', array(
78
+	$form_classes_array = apply_filters('give_form_classes', array(
79 79
 		'give-form',
80
-		'give-form-' . $form->ID,
80
+		'give-form-'.$form->ID,
81 81
 		$float_labels_option
82
-	), $form->ID, $args );
83
-	$form_classes       = implode( ' ', $form_classes_array );
82
+	), $form->ID, $args);
83
+	$form_classes = implode(' ', $form_classes_array);
84 84
 
85 85
 
86 86
 	ob_start();
@@ -93,35 +93,35 @@  discard block
 block discarded – undo
93 93
 	 * @param int $form ->ID The current form ID
94 94
 	 * @param array $args An array of form args
95 95
 	 */
96
-	do_action( 'give_pre_form_output', $form->ID, $args ); ?>
96
+	do_action('give_pre_form_output', $form->ID, $args); ?>
97 97
 
98 98
 	<div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>">
99 99
 
100
-		<?php if ( $form->is_close_donation_form() ) {
100
+		<?php if ($form->is_close_donation_form()) {
101 101
 
102 102
 			//Get Goal thank you message.
103
-			$display_thankyou_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true );
104
-			$display_thankyou_message = ! empty( $display_thankyou_message ) ? $display_thankyou_message : __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' );
103
+			$display_thankyou_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true);
104
+			$display_thankyou_message = ! empty($display_thankyou_message) ? $display_thankyou_message : __('Thank you to all our donors, we have met our fundraising goal.', 'give');
105 105
 
106 106
 			//Print thank you message.
107
-			apply_filters( 'give_goal_closed_output', give_output_error( $display_thankyou_message, true, 'success' ) );
107
+			apply_filters('give_goal_closed_output', give_output_error($display_thankyou_message, true, 'success'));
108 108
 
109 109
 		} else {
110 110
 
111
-			if ( isset( $args['show_title'] ) && $args['show_title'] == true ) {
111
+			if (isset($args['show_title']) && $args['show_title'] == true) {
112 112
 
113
-				echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' );
113
+				echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>');
114 114
 
115 115
 			}
116 116
 
117
-			do_action( 'give_pre_form', $form->ID, $args ); ?>
117
+			do_action('give_pre_form', $form->ID, $args); ?>
118 118
 
119 119
 			<form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" action="<?php echo $form_action; ?>" method="post">
120 120
 				<input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/>
121
-				<input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/>
122
-				<input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
123
-				<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
124
-				<input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/>
121
+				<input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/>
122
+				<input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
123
+				<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
124
+				<input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/>
125 125
 
126 126
 				<!-- The following field is for robots only, invisible to humans: -->
127 127
 				<span class="give-hidden" style="display: none !important;">
@@ -132,13 +132,13 @@  discard block
 block discarded – undo
132 132
 				<?php
133 133
 
134 134
 				//Price ID hidden field for variable (mult-level) donation forms
135
-				if ( give_has_variable_prices( $form_id ) ) {
135
+				if (give_has_variable_prices($form_id)) {
136 136
 					//get default selected price ID
137
-					$prices   = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
137
+					$prices   = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
138 138
 					$price_id = 0;
139 139
 					//loop through prices
140
-					foreach ( $prices as $price ) {
141
-						if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
140
+					foreach ($prices as $price) {
141
+						if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
142 142
 							$price_id = $price['_give_id']['level_id'];
143 143
 						};
144 144
 					}
@@ -146,20 +146,20 @@  discard block
 block discarded – undo
146 146
 					<input type="hidden" name="give-price-id" value="<?php echo $price_id; ?>"/>
147 147
 				<?php }
148 148
 
149
-				do_action( 'give_checkout_form_top', $form->ID, $args );
149
+				do_action('give_checkout_form_top', $form->ID, $args);
150 150
 
151
-				do_action( 'give_payment_mode_select', $form->ID, $args );
151
+				do_action('give_payment_mode_select', $form->ID, $args);
152 152
 
153
-				do_action( 'give_checkout_form_bottom', $form->ID, $args );
153
+				do_action('give_checkout_form_bottom', $form->ID, $args);
154 154
 
155 155
 				?>
156 156
 			</form>
157 157
 
158
-			<?php do_action( 'give_post_form', $form->ID, $args ); ?>
158
+			<?php do_action('give_post_form', $form->ID, $args); ?>
159 159
 
160 160
 		<?php } ?>
161 161
 
162
-		<!--end #give-form-<?php echo absint( $form->ID ); ?>--></div>
162
+		<!--end #give-form-<?php echo absint($form->ID); ?>--></div>
163 163
 	<?php
164 164
 
165 165
 	/**
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
 	 * @param int $form ->ID The current form ID
171 171
 	 * @param array $args An array of form args
172 172
 	 */
173
-	do_action( 'give_post_form_output', $form->ID, $args );
173
+	do_action('give_post_form_output', $form->ID, $args);
174 174
 
175 175
 	$final_output = ob_get_clean();
176 176
 
177
-	echo apply_filters( 'give_donate_form', $final_output, $args );
177
+	echo apply_filters('give_donate_form', $final_output, $args);
178 178
 }
179 179
 
180 180
 
@@ -194,43 +194,43 @@  discard block
 block discarded – undo
194 194
  * @global    $give_options Array of all the Give options
195 195
  * @return string
196 196
  */
197
-function give_show_purchase_form( $form_id ) {
197
+function give_show_purchase_form($form_id) {
198 198
 
199
-	$payment_mode = give_get_chosen_gateway( $form_id );
199
+	$payment_mode = give_get_chosen_gateway($form_id);
200 200
 
201
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
201
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
202 202
 		$form_id = $_POST['give_form_id'];
203 203
 	}
204 204
 
205
-	do_action( 'give_purchase_form_top', $form_id );
205
+	do_action('give_purchase_form_top', $form_id);
206 206
 
207
-	if ( give_can_checkout() && isset( $form_id ) ) {
207
+	if (give_can_checkout() && isset($form_id)) {
208 208
 
209
-		do_action( 'give_purchase_form_before_register_login', $form_id );
209
+		do_action('give_purchase_form_before_register_login', $form_id);
210 210
 
211
-		do_action( 'give_purchase_form_register_login_fields', $form_id );
211
+		do_action('give_purchase_form_register_login_fields', $form_id);
212 212
 
213
-		do_action( 'give_purchase_form_before_cc_form', $form_id );
213
+		do_action('give_purchase_form_before_cc_form', $form_id);
214 214
 
215 215
 		// Load the credit card form and allow gateways to load their own if they wish
216
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
217
-			do_action( 'give_' . $payment_mode . '_cc_form', $form_id );
216
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
217
+			do_action('give_'.$payment_mode.'_cc_form', $form_id);
218 218
 		} else {
219
-			do_action( 'give_cc_form', $form_id );
219
+			do_action('give_cc_form', $form_id);
220 220
 		}
221 221
 
222
-		do_action( 'give_purchase_form_after_cc_form', $form_id );
222
+		do_action('give_purchase_form_after_cc_form', $form_id);
223 223
 
224 224
 	} else {
225 225
 		// Can't checkout
226
-		do_action( 'give_purchase_form_no_access', $form_id );
226
+		do_action('give_purchase_form_no_access', $form_id);
227 227
 
228 228
 	}
229 229
 
230
-	do_action( 'give_purchase_form_bottom', $form_id );
230
+	do_action('give_purchase_form_bottom', $form_id);
231 231
 }
232 232
 
233
-add_action( 'give_purchase_form', 'give_show_purchase_form' );
233
+add_action('give_purchase_form', 'give_show_purchase_form');
234 234
 
235 235
 /**
236 236
  *
@@ -242,26 +242,26 @@  discard block
 block discarded – undo
242 242
  *
243 243
  * @return void
244 244
  */
245
-function give_show_register_login_fields( $form_id ) {
245
+function give_show_register_login_fields($form_id) {
246 246
 
247
-	$show_register_form = give_show_login_register_option( $form_id );
247
+	$show_register_form = give_show_login_register_option($form_id);
248 248
 
249
-	if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?>
249
+	if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : ?>
250 250
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
251
-			<?php do_action( 'give_purchase_form_register_fields', $form_id ); ?>
251
+			<?php do_action('give_purchase_form_register_fields', $form_id); ?>
252 252
 		</div>
253
-	<?php elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?>
253
+	<?php elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : ?>
254 254
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
255
-			<?php do_action( 'give_purchase_form_login_fields', $form_id ); ?>
255
+			<?php do_action('give_purchase_form_login_fields', $form_id); ?>
256 256
 		</div>
257 257
 	<?php endif; ?>
258 258
 
259
-	<?php if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) {
260
-		do_action( 'give_purchase_form_after_user_info', $form_id );
259
+	<?php if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) {
260
+		do_action('give_purchase_form_after_user_info', $form_id);
261 261
 	}
262 262
 }
263 263
 
264
-add_action( 'give_purchase_form_register_login_fields', 'give_show_register_login_fields' );
264
+add_action('give_purchase_form_register_login_fields', 'give_show_register_login_fields');
265 265
 
266 266
 /**
267 267
  * Donation Amount Field
@@ -275,33 +275,33 @@  discard block
 block discarded – undo
275 275
  *
276 276
  * @return void
277 277
  */
278
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
278
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
279 279
 
280 280
 	global $give_options;
281 281
 
282
-	$variable_pricing    = give_has_variable_prices( $form_id );
283
-	$allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true );
284
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
285
-	$symbol              = give_currency_symbol( give_get_currency() );
286
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
287
-	$default_amount      = give_format_amount( give_get_default_form_amount( $form_id ) );
288
-	$custom_amount_text  = get_post_meta( $form_id, '_give_custom_amount_text', true );
282
+	$variable_pricing    = give_has_variable_prices($form_id);
283
+	$allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true);
284
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
285
+	$symbol              = give_currency_symbol(give_get_currency());
286
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
287
+	$default_amount      = give_format_amount(give_get_default_form_amount($form_id));
288
+	$custom_amount_text  = get_post_meta($form_id, '_give_custom_amount_text', true);
289 289
 
290
-	do_action( 'give_before_donation_levels', $form_id, $args );
290
+	do_action('give_before_donation_levels', $form_id, $args);
291 291
 
292 292
 	//Set Price, No Custom Amount Allowed means hidden price field
293
-	if ( $allow_custom_amount == 'no' ) {
293
+	if ($allow_custom_amount == 'no') {
294 294
 		?>
295 295
 
296
-		<label class="give-hidden" for="give-amount-hidden"><?php echo __( 'Donation Amount:', 'give' ); ?></label>
296
+		<label class="give-hidden" for="give-amount-hidden"><?php echo __('Donation Amount:', 'give'); ?></label>
297 297
 		<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount"
298 298
 		       value="<?php echo $default_amount; ?>" required>
299 299
 		<div class="set-price give-donation-amount form-row-wide">
300
-			<?php if ( $currency_position == 'before' ) {
300
+			<?php if ($currency_position == 'before') {
301 301
 				echo $currency_output;
302 302
 			} ?>
303 303
 			<span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span>
304
-			<?php if ( $currency_position == 'after' ) {
304
+			<?php if ($currency_position == 'after') {
305 305
 				echo $currency_output;
306 306
 			} ?>
307 307
 		</div>
@@ -311,34 +311,34 @@  discard block
 block discarded – undo
311 311
 		?>
312 312
 		<div class="give-total-wrap">
313 313
 			<div class="give-donation-amount form-row-wide">
314
-				<?php if ( $currency_position == 'before' ) {
314
+				<?php if ($currency_position == 'before') {
315 315
 					echo $currency_output;
316 316
 				} ?>
317
-				<label class="give-hidden" for="give-amount"><?php echo __( 'Donation Amount:', 'give' ); ?></label>
317
+				<label class="give-hidden" for="give-amount"><?php echo __('Donation Amount:', 'give'); ?></label>
318 318
 				<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
319
-				<?php if ( $currency_position == 'after' ) {
319
+				<?php if ($currency_position == 'after') {
320 320
 					echo $currency_output;
321 321
 				} ?>
322 322
 			</div>
323 323
 		</div>
324 324
 	<?php }
325 325
 
326
-	do_action( 'give_after_donation_amount', $form_id, $args );
326
+	do_action('give_after_donation_amount', $form_id, $args);
327 327
 
328 328
 	//Custom Amount Text
329
-	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?>
329
+	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?>
330 330
 		<p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
331 331
 	<?php }
332 332
 
333 333
 	//Output Variable Pricing Levels
334
-	if ( $variable_pricing ) {
335
-		give_output_levels( $form_id );
334
+	if ($variable_pricing) {
335
+		give_output_levels($form_id);
336 336
 	}
337 337
 
338
-	do_action( 'give_after_donation_levels', $form_id, $args );
338
+	do_action('give_after_donation_levels', $form_id, $args);
339 339
 }
340 340
 
341
-add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 );
341
+add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2);
342 342
 
343 343
 
344 344
 /**
@@ -350,32 +350,32 @@  discard block
 block discarded – undo
350 350
  *
351 351
  * @return string
352 352
  */
353
-function give_output_levels( $form_id ) {
353
+function give_output_levels($form_id) {
354 354
 
355 355
 	//Get variable pricing
356
-	$prices             = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
357
-	$display_style      = get_post_meta( $form_id, '_give_display_style', true );
358
-	$custom_amount      = get_post_meta( $form_id, '_give_custom_amount', true );
359
-	$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
360
-	if ( empty( $custom_amount_text ) ) {
361
-		$custom_amount_text = __( 'Give a Custom Amount', 'give' );
356
+	$prices             = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
357
+	$display_style      = get_post_meta($form_id, '_give_display_style', true);
358
+	$custom_amount      = get_post_meta($form_id, '_give_custom_amount', true);
359
+	$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
360
+	if (empty($custom_amount_text)) {
361
+		$custom_amount_text = __('Give a Custom Amount', 'give');
362 362
 	}
363 363
 
364 364
 	$output  = '';
365 365
 	$counter = 0;
366 366
 
367
-	switch ( $display_style ) {
367
+	switch ($display_style) {
368 368
 		case 'buttons':
369 369
 
370 370
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
371 371
 
372
-			foreach ( $prices as $price ) {
373
-				$counter ++;
374
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
375
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price );
372
+			foreach ($prices as $price) {
373
+				$counter++;
374
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
375
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$counter.' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price);
376 376
 
377 377
 				$output .= '<li>';
378
-				$output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">';
378
+				$output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">';
379 379
 				$output .= $level_text;
380 380
 				$output .= '</button>';
381 381
 				$output .= '</li>';
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 			}
384 384
 
385 385
 			//Custom Amount
386
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
386
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
387 387
 				$output .= '<li>';
388 388
 				$output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">';
389 389
 				$output .= $custom_amount_text;
@@ -399,23 +399,23 @@  discard block
 block discarded – undo
399 399
 
400 400
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
401 401
 
402
-			foreach ( $prices as $price ) {
403
-				$counter ++;
404
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
405
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
402
+			foreach ($prices as $price) {
403
+				$counter++;
404
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
405
+				$level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$counter.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
406 406
 
407 407
 				$output .= '<li>';
408
-				$output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">';
409
-				$output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>';
408
+				$output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$counter.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">';
409
+				$output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>';
410 410
 				$output .= '</li>';
411 411
 
412 412
 			}
413 413
 
414 414
 			//Custom Amount
415
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
415
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
416 416
 				$output .= '<li>';
417 417
 				$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">';
418
-				$output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>';
418
+				$output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>';
419 419
 				$output .= '</li>';
420 420
 			}
421 421
 
@@ -425,23 +425,23 @@  discard block
 block discarded – undo
425 425
 
426 426
 		case 'dropdown':
427 427
 
428
-			$output .= '<label for="give-donation-level" class="give-hidden">' . __( 'Choose Your Donation Amount', 'give' ) . ':</label>';
429
-			$output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level">';
428
+			$output .= '<label for="give-donation-level" class="give-hidden">'.__('Choose Your Donation Amount', 'give').':</label>';
429
+			$output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level">';
430 430
 
431 431
 			//first loop through prices
432
-			foreach ( $prices as $price ) {
433
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
434
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
432
+			foreach ($prices as $price) {
433
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
434
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
435 435
 
436
-				$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'] ) . '">';
436
+				$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']).'">';
437 437
 				$output .= $level_text;
438 438
 				$output .= '</option>';
439 439
 
440 440
 			}
441 441
 
442 442
 			//Custom Amount
443
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
444
-				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>';
443
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
444
+				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>';
445 445
 			}
446 446
 
447 447
 			$output .= '</select>';
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 			break;
450 450
 	}
451 451
 
452
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
452
+	echo apply_filters('give_form_level_output', $output, $form_id);
453 453
 }
454 454
 
455 455
 /**
@@ -461,26 +461,26 @@  discard block
 block discarded – undo
461 461
  * @param array $args
462 462
  *
463 463
  */
464
-function give_display_checkout_button( $form_id, $args ) {
464
+function give_display_checkout_button($form_id, $args) {
465 465
 
466
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
466
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
467 467
 		? $args['display_style']
468
-		: get_post_meta( $form_id, '_give_payment_display', true );
468
+		: get_post_meta($form_id, '_give_payment_display', true);
469 469
 
470 470
 	//no btn for onpage
471
-	if ( $display_option === 'onpage' ) {
471
+	if ($display_option === 'onpage') {
472 472
 		return;
473 473
 	}
474 474
 
475
-	$display_label_field = get_post_meta( $form_id, '_give_reveal_label', true );
476
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) );
475
+	$display_label_field = get_post_meta($form_id, '_give_reveal_label', true);
476
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give'));
477 477
 
478
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
478
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
479 479
 
480
-	echo apply_filters( 'give_display_checkout_button', $output );
480
+	echo apply_filters('give_display_checkout_button', $output);
481 481
 }
482 482
 
483
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
483
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
484 484
 
485 485
 /**
486 486
  * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided.
@@ -491,71 +491,71 @@  discard block
 block discarded – undo
491 491
  *
492 492
  * @return void
493 493
  */
494
-function give_user_info_fields( $form_id ) {
494
+function give_user_info_fields($form_id) {
495 495
 
496
-	if ( is_user_logged_in() ) :
497
-		$user_data = get_userdata( get_current_user_id() );
496
+	if (is_user_logged_in()) :
497
+		$user_data = get_userdata(get_current_user_id());
498 498
 	endif;
499 499
 
500
-	do_action( 'give_purchase_form_before_personal_info', $form_id );
500
+	do_action('give_purchase_form_before_personal_info', $form_id);
501 501
 	?>
502 502
 	<fieldset id="give_checkout_user_info">
503
-		<legend><?php echo apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ); ?></legend>
503
+		<legend><?php echo apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give')); ?></legend>
504 504
 		<p id="give-first-name-wrap" class="form-row form-row-first">
505 505
 			<label class="give-label" for="give-first">
506
-				<?php _e( 'First Name', 'give' ); ?>
507
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?>
506
+				<?php _e('First Name', 'give'); ?>
507
+				<?php if (give_field_is_required('give_first', $form_id)) { ?>
508 508
 					<span class="give-required-indicator">*</span>
509 509
 				<?php } ?>
510
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span>
510
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this to personalize your account experience.', 'give'); ?>"></span>
511 511
 			</label>
512
-			<input class="give-input required" type="text" name="give_first" placeholder="<?php _e( 'First name', 'give' ); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if ( give_field_is_required( 'give_first', $form_id ) ) {
512
+			<input class="give-input required" type="text" name="give_first" placeholder="<?php _e('First name', 'give'); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if (give_field_is_required('give_first', $form_id)) {
513 513
 				echo ' required ';
514 514
 			} ?>/>
515 515
 		</p>
516 516
 
517 517
 		<p id="give-last-name-wrap" class="form-row form-row-last">
518 518
 			<label class="give-label" for="give-last">
519
-				<?php _e( 'Last Name', 'give' ); ?>
520
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?>
519
+				<?php _e('Last Name', 'give'); ?>
520
+				<?php if (give_field_is_required('give_last', $form_id)) { ?>
521 521
 					<span class="give-required-indicator">*</span>
522 522
 				<?php } ?>
523
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span>
523
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this as well to personalize your account experience.', 'give'); ?>"></span>
524 524
 			</label>
525 525
 
526
-			<input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) {
526
+			<input class="give-input<?php if (give_field_is_required('give_last', $form_id)) {
527 527
 				echo ' required';
528
-			} ?>" type="text" name="give_last" id="give-last" placeholder="<?php _e( 'Last name', 'give' ); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if ( give_field_is_required( 'give_last', $form_id ) ) {
528
+			} ?>" type="text" name="give_last" id="give-last" placeholder="<?php _e('Last name', 'give'); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if (give_field_is_required('give_last', $form_id)) {
529 529
 				echo ' required ';
530 530
 			} ?> />
531 531
 		</p>
532 532
 
533
-		<?php do_action( 'give_purchase_form_before_email', $form_id ); ?>
533
+		<?php do_action('give_purchase_form_before_email', $form_id); ?>
534 534
 		<p id="give-email-wrap" class="form-row form-row-wide">
535 535
 			<label class="give-label" for="give-email">
536
-				<?php _e( 'Email Address', 'give' ); ?>
537
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
536
+				<?php _e('Email Address', 'give'); ?>
537
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
538 538
 					<span class="give-required-indicator">*</span>
539 539
 				<?php } ?>
540
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will send the purchase receipt to this address.', 'give' ); ?>"></span>
540
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will send the purchase receipt to this address.', 'give'); ?>"></span>
541 541
 			</label>
542 542
 
543
-			<input class="give-input required" type="email" name="give_email" placeholder="<?php _e( 'Email address', 'give' ); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if ( give_field_is_required( 'give_email', $form_id ) ) {
543
+			<input class="give-input required" type="email" name="give_email" placeholder="<?php _e('Email address', 'give'); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if (give_field_is_required('give_email', $form_id)) {
544 544
 				echo ' required ';
545 545
 			} ?>/>
546 546
 
547 547
 		</p>
548
-		<?php do_action( 'give_purchase_form_after_email', $form_id ); ?>
548
+		<?php do_action('give_purchase_form_after_email', $form_id); ?>
549 549
 
550
-		<?php do_action( 'give_purchase_form_user_info', $form_id ); ?>
550
+		<?php do_action('give_purchase_form_user_info', $form_id); ?>
551 551
 	</fieldset>
552 552
 	<?php
553
-	do_action( 'give_purchase_form_after_personal_info', $form_id );
553
+	do_action('give_purchase_form_after_personal_info', $form_id);
554 554
 
555 555
 }
556 556
 
557
-add_action( 'give_purchase_form_after_user_info', 'give_user_info_fields' );
558
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
557
+add_action('give_purchase_form_after_user_info', 'give_user_info_fields');
558
+add_action('give_register_fields_before', 'give_user_info_fields');
559 559
 
560 560
 /**
561 561
  * Renders the credit card info form.
@@ -566,73 +566,73 @@  discard block
 block discarded – undo
566 566
  *
567 567
  * @return void
568 568
  */
569
-function give_get_cc_form( $form_id ) {
569
+function give_get_cc_form($form_id) {
570 570
 
571 571
 	ob_start();
572 572
 
573
-	do_action( 'give_before_cc_fields', $form_id ); ?>
573
+	do_action('give_before_cc_fields', $form_id); ?>
574 574
 
575 575
 	<fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate">
576
-		<legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', __( 'Credit Card Info', 'give' ) ); ?></legend>
577
-		<?php if ( is_ssl() ) : ?>
576
+		<legend><?php echo apply_filters('give_credit_card_fieldset_heading', __('Credit Card Info', 'give')); ?></legend>
577
+		<?php if (is_ssl()) : ?>
578 578
 			<div id="give_secure_site_wrapper-<?php echo $form_id ?>">
579 579
 				<span class="give-icon padlock"></span>
580
-				<span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
580
+				<span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span>
581 581
 			</div>
582 582
 		<?php endif; ?>
583 583
 		<p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
584 584
 			<label for="card_number-<?php echo $form_id ?>" class="give-label">
585
-				<?php _e( 'Card Number', 'give' ); ?>
585
+				<?php _e('Card Number', 'give'); ?>
586 586
 				<span class="give-required-indicator">*</span>
587
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span>
587
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span>
588 588
 				<span class="card-type"></span>
589 589
 			</label>
590 590
 
591
-			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php _e( 'Card number', 'give' ); ?>" required/>
591
+			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php _e('Card number', 'give'); ?>" required/>
592 592
 		</p>
593 593
 
594 594
 		<p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third">
595 595
 			<label for="card_cvc-<?php echo $form_id ?>" class="give-label">
596
-				<?php _e( 'CVC', 'give' ); ?>
596
+				<?php _e('CVC', 'give'); ?>
597 597
 				<span class="give-required-indicator">*</span>
598
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span>
598
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span>
599 599
 			</label>
600 600
 
601
-			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php _e( 'Security code', 'give' ); ?>" required/>
601
+			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php _e('Security code', 'give'); ?>" required/>
602 602
 		</p>
603 603
 
604 604
 		<p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
605 605
 			<label for="card_name-<?php echo $form_id ?>" class="give-label">
606
-				<?php _e( 'Name on the Card', 'give' ); ?>
606
+				<?php _e('Name on the Card', 'give'); ?>
607 607
 				<span class="give-required-indicator">*</span>
608
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span>
608
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The name printed on the front of your credit card.', 'give'); ?>"></span>
609 609
 			</label>
610 610
 
611
-			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php _e( 'Card name', 'give' ); ?>" required/>
611
+			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php _e('Card name', 'give'); ?>" required/>
612 612
 		</p>
613
-		<?php do_action( 'give_before_cc_expiration' ); ?>
613
+		<?php do_action('give_before_cc_expiration'); ?>
614 614
 		<p class="card-expiration form-row form-row-one-third">
615 615
 			<label for="card_expiry-<?php echo $form_id ?>" class="give-label">
616
-				<?php _e( 'Expiration', 'give' ); ?>
616
+				<?php _e('Expiration', 'give'); ?>
617 617
 				<span class="give-required-indicator">*</span>
618
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span>
618
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span>
619 619
 			</label>
620 620
 
621 621
 			<input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/>
622 622
 			<input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/>
623 623
 
624
-			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php _e( 'MM / YY', 'give' ); ?>" required/>
624
+			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php _e('MM / YY', 'give'); ?>" required/>
625 625
 		</p>
626
-		<?php do_action( 'give_after_cc_expiration', $form_id ); ?>
626
+		<?php do_action('give_after_cc_expiration', $form_id); ?>
627 627
 
628 628
 	</fieldset>
629 629
 	<?php
630
-	do_action( 'give_after_cc_fields', $form_id );
630
+	do_action('give_after_cc_fields', $form_id);
631 631
 
632 632
 	echo ob_get_clean();
633 633
 }
634 634
 
635
-add_action( 'give_cc_form', 'give_get_cc_form' );
635
+add_action('give_cc_form', 'give_get_cc_form');
636 636
 
637 637
 /**
638 638
  * Outputs the default credit card address fields
@@ -643,110 +643,110 @@  discard block
 block discarded – undo
643 643
  *
644 644
  * @return void
645 645
  */
646
-function give_default_cc_address_fields( $form_id ) {
646
+function give_default_cc_address_fields($form_id) {
647 647
 
648 648
 	$logged_in = is_user_logged_in();
649 649
 
650
-	if ( $logged_in ) {
651
-		$user_address = get_user_meta( get_current_user_id(), '_give_user_address', true );
650
+	if ($logged_in) {
651
+		$user_address = get_user_meta(get_current_user_id(), '_give_user_address', true);
652 652
 	}
653
-	$line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : '';
654
-	$line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : '';
655
-	$city  = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : '';
656
-	$zip   = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : '';
653
+	$line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : '';
654
+	$line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : '';
655
+	$city  = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : '';
656
+	$zip   = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : '';
657 657
 	ob_start(); ?>
658 658
 	<fieldset id="give_cc_address" class="cc-address">
659
-		<legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', __( 'Billing Details', 'give' ) ); ?></legend>
660
-		<?php do_action( 'give_cc_billing_top' ); ?>
659
+		<legend><?php echo apply_filters('give_billing_details_fieldset_heading', __('Billing Details', 'give')); ?></legend>
660
+		<?php do_action('give_cc_billing_top'); ?>
661 661
 		<p id="give-card-address-wrap" class="form-row form-row-two-thirds">
662 662
 			<label for="card_address" class="give-label">
663
-				<?php _e( 'Address', 'give' ); ?>
663
+				<?php _e('Address', 'give'); ?>
664 664
 				<?php
665
-				if ( give_field_is_required( 'card_address', $form_id ) ) { ?>
665
+				if (give_field_is_required('card_address', $form_id)) { ?>
666 666
 					<span class="give-required-indicator">*</span>
667 667
 				<?php } ?>
668
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The primary billing address for your credit card.', 'give' ); ?>"></span>
668
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The primary billing address for your credit card.', 'give'); ?>"></span>
669 669
 			</label>
670 670
 
671
-			<input type="text" id="card_address" name="card_address" class="card-address give-input<?php if ( give_field_is_required( 'card_address', $form_id ) ) {
671
+			<input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) {
672 672
 				echo ' required';
673
-			} ?>" placeholder="<?php _e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) {
673
+			} ?>" placeholder="<?php _e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) {
674 674
 				echo '  required ';
675 675
 			} ?>/>
676 676
 		</p>
677 677
 
678 678
 		<p id="give-card-address-2-wrap" class="form-row form-row-one-third">
679 679
 			<label for="card_address_2" class="give-label">
680
-				<?php _e( 'Address Line 2', 'give' ); ?>
681
-				<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?>
680
+				<?php _e('Address Line 2', 'give'); ?>
681
+				<?php if (give_field_is_required('card_address_2', $form_id)) { ?>
682 682
 					<span class="give-required-indicator">*</span>
683 683
 				<?php } ?>
684
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span>
684
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span>
685 685
 			</label>
686 686
 
687
-			<input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) {
687
+			<input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if (give_field_is_required('card_address_2', $form_id)) {
688 688
 				echo ' required';
689
-			} ?>" placeholder="<?php _e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) {
689
+			} ?>" placeholder="<?php _e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) {
690 690
 				echo ' required ';
691 691
 			} ?>/>
692 692
 		</p>
693 693
 
694 694
 		<p id="give-card-city-wrap" class="form-row form-row-two-thirds">
695 695
 			<label for="card_city" class="give-label">
696
-				<?php _e( 'City', 'give' ); ?>
697
-				<?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?>
696
+				<?php _e('City', 'give'); ?>
697
+				<?php if (give_field_is_required('card_city', $form_id)) { ?>
698 698
 					<span class="give-required-indicator">*</span>
699 699
 				<?php } ?>
700
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The city for your billing address.', 'give' ); ?>"></span>
700
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The city for your billing address.', 'give'); ?>"></span>
701 701
 			</label>
702
-			<input type="text" id="card_city" name="card_city" class="card-city give-input<?php if ( give_field_is_required( 'card_city', $form_id ) ) {
702
+			<input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) {
703 703
 				echo ' required';
704
-			} ?>" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) {
704
+			} ?>" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) {
705 705
 				echo ' required ';
706 706
 			} ?>/>
707 707
 		</p>
708 708
 
709 709
 		<p id="give-card-zip-wrap" class="form-row form-row-one-third">
710 710
 			<label for="card_zip" class="give-label">
711
-				<?php _e( 'Zip / Postal Code', 'give' ); ?>
712
-				<?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?>
711
+				<?php _e('Zip / Postal Code', 'give'); ?>
712
+				<?php if (give_field_is_required('card_zip', $form_id)) { ?>
713 713
 					<span class="give-required-indicator">*</span>
714 714
 				<?php } ?>
715
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span>
715
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The zip or postal code for your billing address.', 'give'); ?>"></span>
716 716
 			</label>
717 717
 
718
-			<input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if ( give_field_is_required( 'card_zip', $form_id ) ) {
718
+			<input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if (give_field_is_required('card_zip', $form_id)) {
719 719
 				echo ' required';
720
-			} ?>" placeholder="<?php _e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) {
720
+			} ?>" placeholder="<?php _e('Zip / Postal Code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) {
721 721
 				echo ' required ';
722 722
 			} ?>/>
723 723
 		</p>
724 724
 
725 725
 		<p id="give-card-country-wrap" class="form-row form-row-first">
726 726
 			<label for="billing_country" class="give-label">
727
-				<?php _e( 'Country', 'give' ); ?>
728
-				<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?>
727
+				<?php _e('Country', 'give'); ?>
728
+				<?php if (give_field_is_required('billing_country', $form_id)) { ?>
729 729
 					<span class="give-required-indicator">*</span>
730 730
 				<?php } ?>
731
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The country for your billing address.', 'give' ); ?>"></span>
731
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The country for your billing address.', 'give'); ?>"></span>
732 732
 			</label>
733 733
 
734
-			<select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if ( give_field_is_required( 'billing_country', $form_id ) ) {
734
+			<select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) {
735 735
 				echo ' required';
736
-			} ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) {
736
+			} ?>"<?php if (give_field_is_required('billing_country', $form_id)) {
737 737
 				echo ' required ';
738 738
 			} ?>>
739 739
 				<?php
740 740
 
741 741
 				$selected_country = give_get_country();
742 742
 
743
-				if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) {
743
+				if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) {
744 744
 					$selected_country = $user_address['country'];
745 745
 				}
746 746
 
747 747
 				$countries = give_get_country_list();
748
-				foreach ( $countries as $country_code => $country ) {
749
-					echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
748
+				foreach ($countries as $country_code => $country) {
749
+					echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
750 750
 				}
751 751
 				?>
752 752
 			</select>
@@ -754,44 +754,44 @@  discard block
 block discarded – undo
754 754
 
755 755
 		<p id="give-card-state-wrap" class="form-row form-row-last">
756 756
 			<label for="card_state" class="give-label">
757
-				<?php _e( 'State / Province', 'give' ); ?>
758
-				<?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?>
757
+				<?php _e('State / Province', 'give'); ?>
758
+				<?php if (give_field_is_required('card_state', $form_id)) { ?>
759 759
 					<span class="give-required-indicator">*</span>
760 760
 				<?php } ?>
761
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The state or province for your billing address.', 'give' ); ?>"></span>
761
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The state or province for your billing address.', 'give'); ?>"></span>
762 762
 			</label>
763 763
 
764 764
 			<?php
765 765
 			$selected_state = give_get_state();
766
-			$states         = give_get_states( $selected_country );
766
+			$states         = give_get_states($selected_country);
767 767
 
768
-			if ( $logged_in && ! empty( $user_address['state'] ) ) {
768
+			if ($logged_in && ! empty($user_address['state'])) {
769 769
 				$selected_state = $user_address['state'];
770 770
 			}
771 771
 
772
-			if ( ! empty( $states ) ) : ?>
773
-				<select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) {
772
+			if ( ! empty($states)) : ?>
773
+				<select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) {
774 774
 					echo ' required';
775
-				} ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) {
775
+				} ?>"<?php if (give_field_is_required('card_state', $form_id)) {
776 776
 					echo ' required ';
777 777
 				} ?>>
778 778
 					<?php
779
-					foreach ( $states as $state_code => $state ) {
780
-						echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
779
+					foreach ($states as $state_code => $state) {
780
+						echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
781 781
 					}
782 782
 					?>
783 783
 				</select>
784 784
 			<?php else : ?>
785
-				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e( 'State / Province', 'give' ); ?>"/>
785
+				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e('State / Province', 'give'); ?>"/>
786 786
 			<?php endif; ?>
787 787
 		</p>
788
-		<?php do_action( 'give_cc_billing_bottom' ); ?>
788
+		<?php do_action('give_cc_billing_bottom'); ?>
789 789
 	</fieldset>
790 790
 	<?php
791 791
 	echo ob_get_clean();
792 792
 }
793 793
 
794
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
794
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
795 795
 
796 796
 
797 797
 /**
@@ -803,93 +803,93 @@  discard block
 block discarded – undo
803 803
  *
804 804
  * @return string
805 805
  */
806
-function give_get_register_fields( $form_id ) {
806
+function give_get_register_fields($form_id) {
807 807
 
808 808
 	global $user_ID;
809 809
 
810
-	if ( is_user_logged_in() ) {
811
-		$user_data = get_userdata( $user_ID );
810
+	if (is_user_logged_in()) {
811
+		$user_data = get_userdata($user_ID);
812 812
 	}
813 813
 
814
-	$show_register_form = give_show_login_register_option( $form_id );
814
+	$show_register_form = give_show_login_register_option($form_id);
815 815
 
816 816
 	ob_start(); ?>
817 817
 	<fieldset id="give-register-fields-<?php echo $form_id; ?>">
818 818
 
819
-		<?php if ( $show_register_form == 'both' ) { ?>
819
+		<?php if ($show_register_form == 'both') { ?>
820 820
 			<div class="give-login-account-wrap">
821
-				<p class="give-login-message"><?php _e( 'Already have an account?', 'give' ); ?>&nbsp;
822
-					<a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php _e( 'Login', 'give' ); ?></a>
821
+				<p class="give-login-message"><?php _e('Already have an account?', 'give'); ?>&nbsp;
822
+					<a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php _e('Login', 'give'); ?></a>
823 823
 				</p>
824 824
 				<p class="give-loading-text">
825
-					<span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></p>
825
+					<span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></p>
826 826
 			</div>
827 827
 		<?php } ?>
828 828
 
829
-		<?php do_action( 'give_register_fields_before', $form_id ); ?>
829
+		<?php do_action('give_register_fields_before', $form_id); ?>
830 830
 
831 831
 		<fieldset id="give-register-account-fields-<?php echo $form_id; ?>">
832
-			<legend><?php echo apply_filters( 'give_create_account_fieldset_heading', __( 'Create an account', 'give' ) );
833
-				if ( ! give_logged_in_only( $form_id ) ) {
834
-					echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>';
832
+			<legend><?php echo apply_filters('give_create_account_fieldset_heading', __('Create an account', 'give'));
833
+				if ( ! give_logged_in_only($form_id)) {
834
+					echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>';
835 835
 				} ?></legend>
836
-			<?php do_action( 'give_register_account_fields_before', $form_id ); ?>
836
+			<?php do_action('give_register_account_fields_before', $form_id); ?>
837 837
 			<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first">
838 838
 				<label for="give-user-login-<?php echo $form_id; ?>">
839
-					<?php _e( 'Username', 'give' ); ?>
840
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
839
+					<?php _e('Username', 'give'); ?>
840
+					<?php if (give_logged_in_only($form_id)) { ?>
841 841
 						<span class="give-required-indicator">*</span>
842 842
 					<?php } ?>
843
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The username you will use to log into your account.', 'give' ); ?>"></span>
843
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The username you will use to log into your account.', 'give'); ?>"></span>
844 844
 				</label>
845 845
 
846
-				<input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) {
846
+				<input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) {
847 847
 					echo 'required ';
848
-				} ?>give-input" type="text" placeholder="<?php _e( 'Username', 'give' ); ?>" title="<?php _e( 'Username', 'give' ); ?>"/>
848
+				} ?>give-input" type="text" placeholder="<?php _e('Username', 'give'); ?>" title="<?php _e('Username', 'give'); ?>"/>
849 849
 			</div>
850 850
 
851 851
 			<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third">
852 852
 				<label for="give-user-pass-<?php echo $form_id; ?>">
853
-					<?php _e( 'Password', 'give' ); ?>
854
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
853
+					<?php _e('Password', 'give'); ?>
854
+					<?php if (give_logged_in_only($form_id)) { ?>
855 855
 						<span class="give-required-indicator">*</span>
856 856
 					<?php } ?>
857
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The password used to access your account.', 'give' ); ?>"></span>
857
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The password used to access your account.', 'give'); ?>"></span>
858 858
 				</label>
859 859
 
860
-				<input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) {
860
+				<input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) {
861 861
 					echo 'required ';
862
-				} ?>give-input" placeholder="<?php _e( 'Password', 'give' ); ?>" type="password"/>
862
+				} ?>give-input" placeholder="<?php _e('Password', 'give'); ?>" type="password"/>
863 863
 			</div>
864 864
 
865 865
 			<div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" class="give-register-password form-row form-row-one-third">
866 866
 				<label for="give-user-pass-confirm-<?php echo $form_id; ?>">
867
-					<?php _e( 'Confirm PW', 'give' ); ?>
868
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
867
+					<?php _e('Confirm PW', 'give'); ?>
868
+					<?php if (give_logged_in_only($form_id)) { ?>
869 869
 						<span class="give-required-indicator">*</span>
870 870
 					<?php } ?>
871
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'Please retype your password to confirm.', 'give' ); ?>"></span>
871
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('Please retype your password to confirm.', 'give'); ?>"></span>
872 872
 				</label>
873 873
 
874
-				<input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) {
874
+				<input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) {
875 875
 					echo 'required ';
876
-				} ?>give-input" placeholder="<?php _e( 'Confirm password', 'give' ); ?>" type="password"/>
876
+				} ?>give-input" placeholder="<?php _e('Confirm password', 'give'); ?>" type="password"/>
877 877
 			</div>
878
-			<?php do_action( 'give_register_account_fields_after', $form_id ); ?>
878
+			<?php do_action('give_register_account_fields_after', $form_id); ?>
879 879
 		</fieldset>
880 880
 
881
-		<?php do_action( 'give_register_fields_after', $form_id ); ?>
881
+		<?php do_action('give_register_fields_after', $form_id); ?>
882 882
 
883 883
 		<input type="hidden" name="give-purchase-var" value="needs-to-register"/>
884 884
 
885
-		<?php do_action( 'give_purchase_form_user_info', $form_id ); ?>
885
+		<?php do_action('give_purchase_form_user_info', $form_id); ?>
886 886
 
887 887
 	</fieldset>
888 888
 	<?php
889 889
 	echo ob_get_clean();
890 890
 }
891 891
 
892
-add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' );
892
+add_action('give_purchase_form_register_fields', 'give_get_register_fields');
893 893
 
894 894
 /**
895 895
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -902,79 +902,79 @@  discard block
 block discarded – undo
902 902
  *
903 903
  * @return string
904 904
  */
905
-function give_get_login_fields( $form_id ) {
905
+function give_get_login_fields($form_id) {
906 906
 
907
-	$form_id            = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id;
908
-	$show_register_form = give_show_login_register_option( $form_id );
907
+	$form_id            = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id;
908
+	$show_register_form = give_show_login_register_option($form_id);
909 909
 
910 910
 	ob_start();
911 911
 	?>
912 912
 	<fieldset id="give-login-fields-<?php echo $form_id; ?>">
913
-		<legend><?php echo apply_filters( 'give_account_login_fieldset_heading', __( 'Login to Your Account', 'give' ) );
914
-			if ( ! give_logged_in_only( $form_id ) ) {
915
-				echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>';
913
+		<legend><?php echo apply_filters('give_account_login_fieldset_heading', __('Login to Your Account', 'give'));
914
+			if ( ! give_logged_in_only($form_id)) {
915
+				echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>';
916 916
 			} ?>
917 917
 		</legend>
918
-		<?php if ( $show_register_form == 'both' ) { ?>
918
+		<?php if ($show_register_form == 'both') { ?>
919 919
 			<p class="give-new-account-link">
920
-				<?php _e( 'Need to create an account?', 'give' ); ?>&nbsp;
921
-				<a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register">
922
-					<?php _e( 'Register', 'give' );
923
-					if ( ! give_logged_in_only( $form_id ) ) {
924
-						echo ' ' . __( 'or checkout as a guest.', 'give' );
920
+				<?php _e('Need to create an account?', 'give'); ?>&nbsp;
921
+				<a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register">
922
+					<?php _e('Register', 'give');
923
+					if ( ! give_logged_in_only($form_id)) {
924
+						echo ' '.__('or checkout as a guest.', 'give');
925 925
 					} ?>
926 926
 				</a>
927 927
 			</p>
928 928
 			<p class="give-loading-text">
929
-				<span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?> </p>
929
+				<span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?> </p>
930 930
 		<?php } ?>
931
-		<?php do_action( 'give_checkout_login_fields_before', $form_id ); ?>
931
+		<?php do_action('give_checkout_login_fields_before', $form_id); ?>
932 932
 		<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first">
933 933
 			<label class="give-label" for="give-user-login-<?php echo $form_id; ?>">
934
-				<?php _e( 'Username', 'give' ); ?>
935
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
934
+				<?php _e('Username', 'give'); ?>
935
+				<?php if (give_logged_in_only($form_id)) { ?>
936 936
 					<span class="give-required-indicator">*</span>
937 937
 				<?php } ?>
938 938
 			</label>
939 939
 
940
-			<input class="<?php if ( give_logged_in_only( $form_id ) ) {
940
+			<input class="<?php if (give_logged_in_only($form_id)) {
941 941
 				echo 'required ';
942
-			} ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e( 'Your username', 'give' ); ?>"/>
942
+			} ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e('Your username', 'give'); ?>"/>
943 943
 		</div>
944 944
 
945 945
 		<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last">
946 946
 			<label class="give-label" for="give-user-pass-<?php echo $form_id; ?>">
947
-				<?php _e( 'Password', 'give' ); ?>
948
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
947
+				<?php _e('Password', 'give'); ?>
948
+				<?php if (give_logged_in_only($form_id)) { ?>
949 949
 					<span class="give-required-indicator">*</span>
950 950
 				<?php } ?>
951 951
 			</label>
952
-			<input class="<?php if ( give_logged_in_only( $form_id ) ) {
952
+			<input class="<?php if (give_logged_in_only($form_id)) {
953 953
 				echo 'required ';
954
-			} ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e( 'Your password', 'give' ); ?>"/>
954
+			} ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e('Your password', 'give'); ?>"/>
955 955
 			<input type="hidden" name="give-purchase-var" value="needs-to-login"/>
956 956
 		</div>
957 957
 
958 958
 		<div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password">
959 959
 			 <span class="give-forgot-password ">
960
-				 <a href="<?php echo wp_lostpassword_url( $redirect )?>"> <?php _e( 'Forgot password?' ) ?> </a>
960
+				 <a href="<?php echo wp_lostpassword_url($redirect)?>"> <?php _e('Forgot password?') ?> </a>
961 961
 			 </span>
962 962
 		</div>
963 963
 
964 964
 		<div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix">
965
-			<input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e( 'Login', 'give' ); ?>"/>
966
-			<?php if ( $show_register_form !== 'login' ) { ?>
967
-				<input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php _e( 'Cancel', 'give' ); ?>"/>
965
+			<input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e('Login', 'give'); ?>"/>
966
+			<?php if ($show_register_form !== 'login') { ?>
967
+				<input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php _e('Cancel', 'give'); ?>"/>
968 968
 			<?php } ?>
969 969
 			<span class="give-loading-animation"></span>
970 970
 		</div>
971
-		<?php do_action( 'give_checkout_login_fields_after', $form_id ); ?>
971
+		<?php do_action('give_checkout_login_fields_after', $form_id); ?>
972 972
 	</fieldset><!--end #give-login-fields-->
973 973
 	<?php
974 974
 	echo ob_get_clean();
975 975
 }
976 976
 
977
-add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 );
977
+add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1);
978 978
 
979 979
 /**
980 980
  * Payment Mode Select
@@ -990,49 +990,49 @@  discard block
 block discarded – undo
990 990
  *
991 991
  * @return void
992 992
  */
993
-function give_payment_mode_select( $form_id ) {
993
+function give_payment_mode_select($form_id) {
994 994
 
995 995
 	$gateways = give_get_enabled_payment_gateways();
996 996
 
997
-	do_action( 'give_payment_mode_top', $form_id ); ?>
997
+	do_action('give_payment_mode_top', $form_id); ?>
998 998
 
999 999
 	<fieldset id="give-payment-mode-select">
1000
-		<?php do_action( 'give_payment_mode_before_gateways_wrap' ); ?>
1000
+		<?php do_action('give_payment_mode_before_gateways_wrap'); ?>
1001 1001
 		<div id="give-payment-mode-wrap">
1002
-			<legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', __( 'Select Payment Method', 'give' ) ); ?>
1003
-				<span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></span>
1002
+			<legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', __('Select Payment Method', 'give')); ?>
1003
+				<span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></span>
1004 1004
 			</legend>
1005 1005
 			<?php
1006 1006
 
1007
-			do_action( 'give_payment_mode_before_gateways' ) ?>
1007
+			do_action('give_payment_mode_before_gateways') ?>
1008 1008
 
1009 1009
 			<ul id="give-gateway-radio-list">
1010
-				<?php foreach ( $gateways as $gateway_id => $gateway ) :
1011
-					$checked       = checked( $gateway_id, give_get_default_gateway( $form_id ), false );
1010
+				<?php foreach ($gateways as $gateway_id => $gateway) :
1011
+					$checked       = checked($gateway_id, give_get_default_gateway($form_id), false);
1012 1012
 					$checked_class = $checked ? ' give-gateway-option-selected' : '';
1013
-					echo '<li><label for="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" class="give-gateway-option' . $checked_class . '" id="give-gateway-option-' . esc_attr( $gateway_id ) . '">';
1014
-					echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" value="' . esc_attr( $gateway_id ) . '"' . $checked . '>' . esc_html( $gateway['checkout_label'] );
1013
+					echo '<li><label for="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" class="give-gateway-option'.$checked_class.'" id="give-gateway-option-'.esc_attr($gateway_id).'">';
1014
+					echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" value="'.esc_attr($gateway_id).'"'.$checked.'>'.esc_html($gateway['checkout_label']);
1015 1015
 					echo '</label></li>';
1016 1016
 				endforeach; ?>
1017 1017
 			</ul>
1018
-			<?php do_action( 'give_payment_mode_after_gateways' ); ?>
1018
+			<?php do_action('give_payment_mode_after_gateways'); ?>
1019 1019
 		</div>
1020
-		<?php do_action( 'give_payment_mode_after_gateways_wrap' ); ?>
1020
+		<?php do_action('give_payment_mode_after_gateways_wrap'); ?>
1021 1021
 	</fieldset>
1022 1022
 
1023
-	<?php do_action( 'give_payment_mode_bottom', $form_id ); ?>
1023
+	<?php do_action('give_payment_mode_bottom', $form_id); ?>
1024 1024
 
1025 1025
 	<div id="give_purchase_form_wrap">
1026 1026
 
1027
-		<?php do_action( 'give_purchase_form', $form_id ); ?>
1027
+		<?php do_action('give_purchase_form', $form_id); ?>
1028 1028
 
1029 1029
 	</div><!-- the checkout fields are loaded into this-->
1030 1030
 
1031
-	<?php do_action( 'give_purchase_form_wrap_bottom', $form_id );
1031
+	<?php do_action('give_purchase_form_wrap_bottom', $form_id);
1032 1032
 
1033 1033
 }
1034 1034
 
1035
-add_action( 'give_payment_mode_select', 'give_payment_mode_select' );
1035
+add_action('give_payment_mode_select', 'give_payment_mode_select');
1036 1036
 
1037 1037
 
1038 1038
 /**
@@ -1047,36 +1047,36 @@  discard block
 block discarded – undo
1047 1047
  *
1048 1048
  * @return void
1049 1049
  */
1050
-function give_terms_agreement( $form_id ) {
1050
+function give_terms_agreement($form_id) {
1051 1051
 
1052
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1053
-	$label       = get_post_meta( $form_id, '_give_agree_label', true );
1054
-	$terms       = get_post_meta( $form_id, '_give_agree_text', true );
1052
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1053
+	$label       = get_post_meta($form_id, '_give_agree_label', true);
1054
+	$terms       = get_post_meta($form_id, '_give_agree_text', true);
1055 1055
 
1056
-	if ( $form_option === 'yes' && ! empty( $terms ) ) { ?>
1056
+	if ($form_option === 'yes' && ! empty($terms)) { ?>
1057 1057
 		<fieldset id="give_terms_agreement">
1058
-			<div id="give_terms" class= "give_terms-<?php echo $form_id;?>" style="display:none;">
1058
+			<div id="give_terms" class= "give_terms-<?php echo $form_id; ?>" style="display:none;">
1059 1059
 				<?php
1060
-				do_action( 'give_before_terms' );
1061
-				echo wpautop( stripslashes( $terms ) );
1062
-				do_action( 'give_after_terms' );
1060
+				do_action('give_before_terms');
1061
+				echo wpautop(stripslashes($terms));
1062
+				do_action('give_after_terms');
1063 1063
 				?>
1064 1064
 			</div>
1065 1065
 			<div id="give_show_terms">
1066
-				<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>"><?php _e( 'Show Terms', 'give' ); ?></a>
1067
-				<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>" style="display:none;"><?php _e( 'Hide Terms', 'give' ); ?></a>
1066
+				<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>"><?php _e('Show Terms', 'give'); ?></a>
1067
+				<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" style="display:none;"><?php _e('Hide Terms', 'give'); ?></a>
1068 1068
 			</div>
1069 1069
 
1070 1070
 			<input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1"/>
1071 1071
 			<label
1072
-				for="give_agree_to_terms"><?php echo ! empty( $label ) ? stripslashes( $label ) : __( 'Agree to Terms?', 'give' ); ?></label>
1072
+				for="give_agree_to_terms"><?php echo ! empty($label) ? stripslashes($label) : __('Agree to Terms?', 'give'); ?></label>
1073 1073
 
1074 1074
 		</fieldset>
1075 1075
 		<?php
1076 1076
 	}
1077 1077
 }
1078 1078
 
1079
-add_action( 'give_purchase_form_before_submit', 'give_terms_agreement', 10, 1 );
1079
+add_action('give_purchase_form_before_submit', 'give_terms_agreement', 10, 1);
1080 1080
 
1081 1081
 /**
1082 1082
  * Checkout Final Total
@@ -1088,27 +1088,27 @@  discard block
 block discarded – undo
1088 1088
  * @since      1.0
1089 1089
  * @return void
1090 1090
  */
1091
-function give_checkout_final_total( $form_id ) {
1091
+function give_checkout_final_total($form_id) {
1092 1092
 
1093
-	if ( isset( $_POST['give_total'] ) ) {
1094
-		$total = apply_filters( 'give_donation_total', $_POST['give_total'] );
1093
+	if (isset($_POST['give_total'])) {
1094
+		$total = apply_filters('give_donation_total', $_POST['give_total']);
1095 1095
 	} else {
1096 1096
 		//default total
1097
-		$total = give_get_default_form_amount( $form_id );
1097
+		$total = give_get_default_form_amount($form_id);
1098 1098
 	}
1099 1099
 	//Only proceed if give_total available
1100
-	if ( empty( $total ) ) {
1100
+	if (empty($total)) {
1101 1101
 		return;
1102 1102
 	}
1103 1103
 	?>
1104 1104
 	<p id="give-final-total-wrap" class="form-wrap ">
1105
-		<span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_attr__( 'Donation Total:', 'give' ) ); ?></span>
1106
-		<span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span>
1105
+		<span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_attr__('Donation Total:', 'give')); ?></span>
1106
+		<span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span>
1107 1107
 	</p>
1108 1108
 	<?php
1109 1109
 }
1110 1110
 
1111
-add_action( 'give_purchase_form_before_submit', 'give_checkout_final_total', 999 );
1111
+add_action('give_purchase_form_before_submit', 'give_checkout_final_total', 999);
1112 1112
 
1113 1113
 
1114 1114
 /**
@@ -1120,22 +1120,22 @@  discard block
 block discarded – undo
1120 1120
  *
1121 1121
  * @return void
1122 1122
  */
1123
-function give_checkout_submit( $form_id ) {
1123
+function give_checkout_submit($form_id) {
1124 1124
 	?>
1125 1125
 	<fieldset id="give_purchase_submit">
1126
-		<?php do_action( 'give_purchase_form_before_submit', $form_id ); ?>
1126
+		<?php do_action('give_purchase_form_before_submit', $form_id); ?>
1127 1127
 
1128
-		<?php give_checkout_hidden_fields( $form_id ); ?>
1128
+		<?php give_checkout_hidden_fields($form_id); ?>
1129 1129
 
1130
-		<?php echo give_checkout_button_purchase( $form_id ); ?>
1130
+		<?php echo give_checkout_button_purchase($form_id); ?>
1131 1131
 
1132
-		<?php do_action( 'give_purchase_form_after_submit', $form_id ); ?>
1132
+		<?php do_action('give_purchase_form_after_submit', $form_id); ?>
1133 1133
 
1134 1134
 	</fieldset>
1135 1135
 	<?php
1136 1136
 }
1137 1137
 
1138
-add_action( 'give_purchase_form_after_cc_form', 'give_checkout_submit', 9999 );
1138
+add_action('give_purchase_form_after_cc_form', 'give_checkout_submit', 9999);
1139 1139
 
1140 1140
 
1141 1141
 /**
@@ -1148,17 +1148,17 @@  discard block
 block discarded – undo
1148 1148
  *
1149 1149
  * @return string
1150 1150
  */
1151
-function give_checkout_button_purchase( $form_id ) {
1151
+function give_checkout_button_purchase($form_id) {
1152 1152
 
1153
-	$display_label_field = get_post_meta( $form_id, '_give_checkout_label', true );
1154
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) );
1153
+	$display_label_field = get_post_meta($form_id, '_give_checkout_label', true);
1154
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give'));
1155 1155
 	ob_start(); ?>
1156 1156
 	<div class="give-submit-button-wrap give-clearfix">
1157 1157
 		<input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" value="<?php echo $display_label; ?>"/>
1158 1158
 		<span class="give-loading-animation"></span>
1159 1159
 	</div>
1160 1160
 	<?php
1161
-	return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id );
1161
+	return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id);
1162 1162
 }
1163 1163
 
1164 1164
 /**
@@ -1171,18 +1171,18 @@  discard block
 block discarded – undo
1171 1171
  *
1172 1172
  * @return void
1173 1173
  */
1174
-function give_agree_to_terms_js( $form_id ) {
1174
+function give_agree_to_terms_js($form_id) {
1175 1175
 
1176
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1176
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1177 1177
 
1178
-	if ( $form_option === 'yes' ) {
1178
+	if ($form_option === 'yes') {
1179 1179
 		?>
1180 1180
 		<script type="text/javascript">
1181 1181
 			jQuery(document).ready(function ($) {
1182
-				$('body').on('click', '.give_terms_links-<?php echo $form_id;?>', function (e) {
1182
+				$('body').on('click', '.give_terms_links-<?php echo $form_id; ?>', function (e) {
1183 1183
 					e.preventDefault();
1184
-					$('.give_terms-<?php echo $form_id;?>').slideToggle();
1185
-					$('.give_terms_links-<?php echo $form_id;?>').toggle();
1184
+					$('.give_terms-<?php echo $form_id; ?>').slideToggle();
1185
+					$('.give_terms_links-<?php echo $form_id; ?>').toggle();
1186 1186
 					return false;
1187 1187
 				});
1188 1188
 			});
@@ -1191,7 +1191,7 @@  discard block
 block discarded – undo
1191 1191
 	}
1192 1192
 }
1193 1193
 
1194
-add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 );
1194
+add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2);
1195 1195
 
1196 1196
 /**
1197 1197
  * Show Give Goals
@@ -1204,25 +1204,25 @@  discard block
 block discarded – undo
1204 1204
  * @return mixed
1205 1205
  */
1206 1206
 
1207
-function give_show_goal_progress( $form_id, $args ) {
1207
+function give_show_goal_progress($form_id, $args) {
1208 1208
 
1209
-	$goal_option = get_post_meta( $form_id, '_give_goal_option', true );
1210
-	$form        = new Give_Donate_Form( $form_id );
1209
+	$goal_option = get_post_meta($form_id, '_give_goal_option', true);
1210
+	$form        = new Give_Donate_Form($form_id);
1211 1211
 	$goal        = $form->goal;
1212
-	$goal_format = get_post_meta( $form_id, '_give_goal_format', true );
1212
+	$goal_format = get_post_meta($form_id, '_give_goal_format', true);
1213 1213
 	$income      = $form->get_earnings();
1214
-	$color       = get_post_meta( $form_id, '_give_goal_color', true );
1215
-	$show_text   = (bool) isset( $args['show_text'] ) ? filter_var( $args['show_text'], FILTER_VALIDATE_BOOLEAN ) : true;
1216
-	$show_bar    = (bool) isset( $args['show_bar'] ) ? filter_var( $args['show_bar'], FILTER_VALIDATE_BOOLEAN ) : true;
1214
+	$color       = get_post_meta($form_id, '_give_goal_color', true);
1215
+	$show_text   = (bool) isset($args['show_text']) ? filter_var($args['show_text'], FILTER_VALIDATE_BOOLEAN) : true;
1216
+	$show_bar    = (bool) isset($args['show_bar']) ? filter_var($args['show_bar'], FILTER_VALIDATE_BOOLEAN) : true;
1217 1217
 
1218 1218
 	//Sanity check - respect shortcode args
1219
-	if ( isset( $args['show_goal'] ) && $args['show_goal'] === false ) {
1219
+	if (isset($args['show_goal']) && $args['show_goal'] === false) {
1220 1220
 		return false;
1221 1221
 	}
1222 1222
 
1223 1223
 	//Sanity check - ensure form has goal set to output
1224
-	if ( empty( $form->ID )
1225
-	     || ( is_singular( 'give_forms' ) && $goal_option !== 'yes' )
1224
+	if (empty($form->ID)
1225
+	     || (is_singular('give_forms') && $goal_option !== 'yes')
1226 1226
 	     || $goal_option !== 'yes'
1227 1227
 	     || $goal == 0
1228 1228
 	) {
@@ -1230,34 +1230,34 @@  discard block
 block discarded – undo
1230 1230
 		return false;
1231 1231
 	}
1232 1232
 
1233
-	$progress = round( ( $income / $goal ) * 100, 2 );
1233
+	$progress = round(($income / $goal) * 100, 2);
1234 1234
 
1235
-	if ( $income >= $goal ) {
1235
+	if ($income >= $goal) {
1236 1236
 		$progress = 100;
1237 1237
 	}
1238 1238
 
1239 1239
 	$output = '<div class="give-goal-progress">';
1240 1240
 
1241 1241
 	//Goal Progress Text
1242
-	if ( ! empty( $show_text ) ) {
1242
+	if ( ! empty($show_text)) {
1243 1243
 
1244 1244
 		$output .= '<div class="raised">';
1245 1245
 
1246
-		if ( $goal_format !== 'percentage' ) {
1246
+		if ($goal_format !== 'percentage') {
1247 1247
 
1248 1248
 			$output .= sprintf(
1249 1249
 				/* translators: 1: amount of income raised 2: goal target ammount */
1250
-				__( '%1$s of %2$s raised', 'give' ),
1251
-				'<span class="income">' . apply_filters( 'give_goal_amount_raised_output', give_currency_filter( give_format_amount( $income ) ) ) . '</span>',
1252
-				'<span class="goal-text">' . apply_filters( 'give_goal_amount_target_output', give_currency_filter( give_format_amount( $goal ) ) ) . '</span>'
1250
+				__('%1$s of %2$s raised', 'give'),
1251
+				'<span class="income">'.apply_filters('give_goal_amount_raised_output', give_currency_filter(give_format_amount($income))).'</span>',
1252
+				'<span class="goal-text">'.apply_filters('give_goal_amount_target_output', give_currency_filter(give_format_amount($goal))).'</span>'
1253 1253
 			);
1254 1254
 
1255
-		} elseif ( $goal_format == 'percentage' ) {
1255
+		} elseif ($goal_format == 'percentage') {
1256 1256
 
1257 1257
 			$output .= sprintf(
1258 1258
 				/* translators: %s: percentage of the amount raised compared to the goal target */
1259
-				__( '%s%% funded', 'give' ),
1260
-				'<span class="give-percentage">' . apply_filters( 'give_goal_amount_funded_percentage_output', round( $progress ) ) . '</span>'
1259
+				__('%s%% funded', 'give'),
1260
+				'<span class="give-percentage">'.apply_filters('give_goal_amount_funded_percentage_output', round($progress)).'</span>'
1261 1261
 			);
1262 1262
 
1263 1263
 		}
@@ -1267,11 +1267,11 @@  discard block
 block discarded – undo
1267 1267
 	}
1268 1268
 
1269 1269
 	//Goal Progress Bar
1270
-	if ( ! empty( $show_bar ) ) {
1270
+	if ( ! empty($show_bar)) {
1271 1271
 		$output .= '<div class="give-progress-bar">';
1272
-		$output .= '<span style="width: ' . esc_attr( $progress ) . '%;';
1273
-		if ( ! empty( $color ) ) {
1274
-			$output .= 'background-color:' . $color;
1272
+		$output .= '<span style="width: '.esc_attr($progress).'%;';
1273
+		if ( ! empty($color)) {
1274
+			$output .= 'background-color:'.$color;
1275 1275
 		}
1276 1276
 		$output .= '"></span>';
1277 1277
 		$output .= '</div><!-- /.give-progress-bar -->';
@@ -1279,13 +1279,13 @@  discard block
 block discarded – undo
1279 1279
 
1280 1280
 	$output .= '</div><!-- /.goal-progress -->';
1281 1281
 
1282
-	echo apply_filters( 'give_goal_output', $output );
1282
+	echo apply_filters('give_goal_output', $output);
1283 1283
 
1284 1284
 	return false;
1285 1285
 
1286 1286
 }
1287 1287
 
1288
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1288
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1289 1289
 
1290 1290
 /**
1291 1291
  * Adds Actions to Render Form Content
@@ -1297,19 +1297,19 @@  discard block
 block discarded – undo
1297 1297
  *
1298 1298
  * @return void
1299 1299
  */
1300
-function give_form_content( $form_id, $args ) {
1300
+function give_form_content($form_id, $args) {
1301 1301
 
1302
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1302
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1303 1303
 		? $args['show_content']
1304
-		: get_post_meta( $form_id, '_give_content_option', true );
1304
+		: get_post_meta($form_id, '_give_content_option', true);
1305 1305
 
1306
-	if ( $show_content !== 'none' ) {
1306
+	if ($show_content !== 'none') {
1307 1307
 		//add action according to value
1308
-		add_action( $show_content, 'give_form_display_content', 10, 2 );
1308
+		add_action($show_content, 'give_form_display_content', 10, 2);
1309 1309
 	}
1310 1310
 }
1311 1311
 
1312
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
1312
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
1313 1313
 
1314 1314
 /**
1315 1315
  * Renders Post Form Content
@@ -1321,24 +1321,24 @@  discard block
 block discarded – undo
1321 1321
  * @return void
1322 1322
  * @since      1.0
1323 1323
  */
1324
-function give_form_display_content( $form_id, $args ) {
1324
+function give_form_display_content($form_id, $args) {
1325 1325
 
1326
-	$content      = wpautop( get_post_meta( $form_id, '_give_form_content', true ) );
1327
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1326
+	$content      = wpautop(get_post_meta($form_id, '_give_form_content', true));
1327
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1328 1328
 		? $args['show_content']
1329
-		: get_post_meta( $form_id, '_give_content_option', true );
1329
+		: get_post_meta($form_id, '_give_content_option', true);
1330 1330
 
1331
-	if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) {
1332
-		$content = apply_filters( 'the_content', $content );
1331
+	if (give_get_option('disable_the_content_filter') !== 'on') {
1332
+		$content = apply_filters('the_content', $content);
1333 1333
 	}
1334 1334
 
1335
-	$output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>';
1335
+	$output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>';
1336 1336
 
1337
-	echo apply_filters( 'give_form_content_output', $output );
1337
+	echo apply_filters('give_form_content_output', $output);
1338 1338
 
1339 1339
 	//remove action to prevent content output on addition forms on page
1340 1340
 	//@see: https://github.com/WordImpress/Give/issues/634
1341
-	remove_action( $show_content, 'give_form_display_content' );
1341
+	remove_action($show_content, 'give_form_display_content');
1342 1342
 }
1343 1343
 
1344 1344
 
@@ -1351,16 +1351,16 @@  discard block
 block discarded – undo
1351 1351
  *
1352 1352
  * @return void
1353 1353
  */
1354
-function give_checkout_hidden_fields( $form_id ) {
1354
+function give_checkout_hidden_fields($form_id) {
1355 1355
 
1356
-	do_action( 'give_hidden_fields_before', $form_id );
1357
-	if ( is_user_logged_in() ) { ?>
1356
+	do_action('give_hidden_fields_before', $form_id);
1357
+	if (is_user_logged_in()) { ?>
1358 1358
 		<input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/>
1359 1359
 	<?php } ?>
1360 1360
 	<input type="hidden" name="give_action" value="purchase"/>
1361
-	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/>
1361
+	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/>
1362 1362
 	<?php
1363
-	do_action( 'give_hidden_fields_after', $form_id );
1363
+	do_action('give_hidden_fields_after', $form_id);
1364 1364
 
1365 1365
 }
1366 1366
 
@@ -1375,20 +1375,20 @@  discard block
 block discarded – undo
1375 1375
  *
1376 1376
  * @return string $content Filtered content
1377 1377
  */
1378
-function give_filter_success_page_content( $content ) {
1378
+function give_filter_success_page_content($content) {
1379 1379
 
1380 1380
 	global $give_options;
1381 1381
 
1382
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
1383
-		if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) {
1384
-			$content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content );
1382
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
1383
+		if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) {
1384
+			$content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content);
1385 1385
 		}
1386 1386
 	}
1387 1387
 
1388 1388
 	return $content;
1389 1389
 }
1390 1390
 
1391
-add_filter( 'the_content', 'give_filter_success_page_content' );
1391
+add_filter('the_content', 'give_filter_success_page_content');
1392 1392
 
1393 1393
 
1394 1394
 /**
@@ -1400,14 +1400,14 @@  discard block
 block discarded – undo
1400 1400
 
1401 1401
 function give_test_mode_frontend_warning() {
1402 1402
 
1403
-	$test_mode = give_get_option( 'test_mode' );
1403
+	$test_mode = give_get_option('test_mode');
1404 1404
 
1405
-	if ( $test_mode == 'on' ) {
1406
-		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . __( 'Notice', 'give' ) . '</strong>: ' . esc_attr__( 'Test mode is enabled. While in test mode no live transactions are processed.', 'give' ) . '</p></div>';
1405
+	if ($test_mode == 'on') {
1406
+		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.__('Notice', 'give').'</strong>: '.esc_attr__('Test mode is enabled. While in test mode no live transactions are processed.', 'give').'</p></div>';
1407 1407
 	}
1408 1408
 }
1409 1409
 
1410
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
1410
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
1411 1411
 
1412 1412
 
1413 1413
 /**
@@ -1417,21 +1417,21 @@  discard block
 block discarded – undo
1417 1417
  * @since       1.4.1
1418 1418
  */
1419 1419
 
1420
-function give_members_only_form( $final_output, $args ) {
1420
+function give_members_only_form($final_output, $args) {
1421 1421
 
1422
-	$form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0;
1422
+	$form_id = isset($args['form_id']) ? $args['form_id'] : 0;
1423 1423
 
1424 1424
 	//Sanity Check: Must have form_id & not be logged in
1425
-	if ( empty( $form_id ) || is_user_logged_in() ) {
1425
+	if (empty($form_id) || is_user_logged_in()) {
1426 1426
 		return $final_output;
1427 1427
 	}
1428 1428
 
1429 1429
 	//Logged in only and Register / Login set to none
1430
-	if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) {
1430
+	if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
1431 1431
 
1432
-		$final_output = give_output_error( __( 'Please login in order to complete your donation.', 'give' ), false );
1432
+		$final_output = give_output_error(__('Please login in order to complete your donation.', 'give'), false);
1433 1433
 
1434
-		return apply_filters( 'give_members_only_output', $final_output, $form_id );
1434
+		return apply_filters('give_members_only_output', $final_output, $form_id);
1435 1435
 
1436 1436
 	}
1437 1437
 
@@ -1439,4 +1439,4 @@  discard block
 block discarded – undo
1439 1439
 
1440 1440
 }
1441 1441
 
1442
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 );
1442
+add_filter('give_donate_form', 'give_members_only_form', 10, 2);
Please login to merge, or discard this patch.
includes/admin/welcome.php 1 patch
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 * @since 1.0
36 36
 	 */
37 37
 	public function __construct() {
38
-		add_action( 'admin_menu', array( $this, 'admin_menus' ) );
39
-		add_action( 'admin_head', array( $this, 'admin_head' ) );
40
-		add_action( 'admin_init', array( $this, 'welcome' ) );
38
+		add_action('admin_menu', array($this, 'admin_menus'));
39
+		add_action('admin_head', array($this, 'admin_head'));
40
+		add_action('admin_init', array($this, 'welcome'));
41 41
 	}
42 42
 
43 43
 	/**
@@ -51,38 +51,38 @@  discard block
 block discarded – undo
51 51
 	public function admin_menus() {
52 52
 		// About Page
53 53
 		add_dashboard_page(
54
-			__( 'Welcome to Give', 'give' ),
55
-			__( 'Welcome to Give', 'give' ),
54
+			__('Welcome to Give', 'give'),
55
+			__('Welcome to Give', 'give'),
56 56
 			$this->minimum_capability,
57 57
 			'give-about',
58
-			array( $this, 'about_screen' )
58
+			array($this, 'about_screen')
59 59
 		);
60 60
 
61 61
 		// Changelog Page
62 62
 		add_dashboard_page(
63
-			__( 'Give Changelog', 'give' ),
64
-			__( 'Give Changelog', 'give' ),
63
+			__('Give Changelog', 'give'),
64
+			__('Give Changelog', 'give'),
65 65
 			$this->minimum_capability,
66 66
 			'give-changelog',
67
-			array( $this, 'changelog_screen' )
67
+			array($this, 'changelog_screen')
68 68
 		);
69 69
 
70 70
 		// Getting Started Page
71 71
 		add_dashboard_page(
72
-			__( 'Getting started with Give', 'give' ),
73
-			__( 'Getting started with Give', 'give' ),
72
+			__('Getting started with Give', 'give'),
73
+			__('Getting started with Give', 'give'),
74 74
 			$this->minimum_capability,
75 75
 			'give-getting-started',
76
-			array( $this, 'getting_started_screen' )
76
+			array($this, 'getting_started_screen')
77 77
 		);
78 78
 
79 79
 		// Credits Page
80 80
 		add_dashboard_page(
81
-			__( 'The people that build Give', 'give' ),
82
-			__( 'The people that build Give', 'give' ),
81
+			__('The people that build Give', 'give'),
82
+			__('The people that build Give', 'give'),
83 83
 			$this->minimum_capability,
84 84
 			'give-credits',
85
-			array( $this, 'credits_screen' )
85
+			array($this, 'credits_screen')
86 86
 		);
87 87
 	}
88 88
 
@@ -95,13 +95,13 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function admin_head() {
97 97
 
98
-		remove_submenu_page( 'index.php', 'give-about' );
99
-		remove_submenu_page( 'index.php', 'give-changelog' );
100
-		remove_submenu_page( 'index.php', 'give-getting-started' );
101
-		remove_submenu_page( 'index.php', 'give-credits' );
98
+		remove_submenu_page('index.php', 'give-about');
99
+		remove_submenu_page('index.php', 'give-changelog');
100
+		remove_submenu_page('index.php', 'give-getting-started');
101
+		remove_submenu_page('index.php', 'give-credits');
102 102
 
103 103
 		// Badge for welcome page
104
-		$badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png';
104
+		$badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png';
105 105
 
106 106
 		?>
107 107
 		<style type="text/css" media="screen">
@@ -215,20 +215,20 @@  discard block
 block discarded – undo
215 215
 	 * @return void
216 216
 	 */
217 217
 	public function tabs() {
218
-		$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about';
218
+		$selected = isset($_GET['page']) ? $_GET['page'] : 'give-about';
219 219
 		?>
220 220
 		<h1 class="nav-tab-wrapper">
221
-			<a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>">
222
-				<?php _e( "About Give", 'give' ); ?>
221
+			<a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>">
222
+				<?php _e("About Give", 'give'); ?>
223 223
 			</a>
224
-			<a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>">
225
-				<?php _e( 'Getting Started', 'give' ); ?>
224
+			<a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>">
225
+				<?php _e('Getting Started', 'give'); ?>
226 226
 			</a>
227
-			<a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>">
228
-				<?php _e( 'Credits', 'give' ); ?>
227
+			<a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>">
228
+				<?php _e('Credits', 'give'); ?>
229 229
 			</a>
230
-			<a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( null, 'index.php' ) ) . 'edit.php?post_type=give_forms&page=give-addons'; ?>">
231
-				<?php _e( 'Add-ons', 'give' ); ?>
230
+			<a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(null, 'index.php')).'edit.php?post_type=give_forms&page=give-addons'; ?>">
231
+				<?php _e('Add-ons', 'give'); ?>
232 232
 			</a>
233 233
 		</h1>
234 234
 	<?php
@@ -242,13 +242,13 @@  discard block
 block discarded – undo
242 242
 	 * @return void
243 243
 	 */
244 244
 	public function about_screen() {
245
-		list( $display_version ) = explode( '-', GIVE_VERSION );
245
+		list($display_version) = explode('-', GIVE_VERSION);
246 246
 		?>
247 247
 		<div class="wrap about-wrap">
248 248
 			<h1 class="welcome-h1"><?php
249 249
 				printf(
250 250
 					/* translators: %s: Give version */
251
-					__( 'Welcome to Give %s', 'give' ),
251
+					__('Welcome to Give %s', 'give'),
252 252
 					$display_version
253 253
 				);
254 254
 			?></h1>
@@ -258,20 +258,20 @@  discard block
 block discarded – undo
258 258
 			<div class="about-text"><?php
259 259
 				printf(
260 260
 					/* translators: 1: https://givewp.com/documenation/ 2: title attribute text */
261
-					__( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. </You>We encourage you to check out the <a href="%1$s" title="%2$s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ),
262
-					esc_url( 'https://givewp.com/documenation/' ),
263
-					esc_attr( 'View the Give plugin documentation online', 'give' )
261
+					__('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. </You>We encourage you to check out the <a href="%1$s" title="%2$s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'),
262
+					esc_url('https://givewp.com/documenation/'),
263
+					esc_attr('View the Give plugin documentation online', 'give')
264 264
 				);
265 265
 			?></div>
266 266
 
267
-			<p class="newsletter-intro"><?php _e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p>
267
+			<p class="newsletter-intro"><?php _e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p>
268 268
 
269 269
 			<?php give_get_newsletter() ?>
270 270
 
271 271
 			<div class="give-badge"><?php
272 272
 				printf(
273 273
 					/* translators: %s: Give version */
274
-					__( 'Version %s', 'give' ),
274
+					__('Version %s', 'give'),
275 275
 					$display_version
276 276
 				);
277 277
 			?></div>
@@ -283,15 +283,15 @@  discard block
 block discarded – undo
283 283
 			<div class="feature-section clearfix introduction">
284 284
 
285 285
 				<div class="video feature-section-item">
286
-					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-form-mockup.png' ?>" title="A Give donation form" alt="A Give donation form">
286
+					<img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-form-mockup.png' ?>" title="A Give donation form" alt="A Give donation form">
287 287
 
288 288
 				</div>
289 289
 
290 290
 				<div class="content feature-section-item last-feature">
291 291
 
292
-					<h3><?php _e( 'Give - Democratizing Generosity', 'give' ); ?></h3>
292
+					<h3><?php _e('Give - Democratizing Generosity', 'give'); ?></h3>
293 293
 
294
-					<p><?php _e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p>
294
+					<p><?php _e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p>
295 295
 					<a href="https://givewp.com" target="_blank" class="button-secondary" title="Visit the Give Website">Learn More
296 296
 						<span class="dashicons dashicons-external"></span></a>
297 297
 
@@ -304,9 +304,9 @@  discard block
 block discarded – undo
304 304
 
305 305
 				<div class="content feature-section-item">
306 306
 
307
-					<h3><?php _e( 'Getting to Know Give', 'give' ); ?></h3>
307
+					<h3><?php _e('Getting to Know Give', 'give'); ?></h3>
308 308
 
309
-					<p><?php _e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have an question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p>
309
+					<p><?php _e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have an question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p>
310 310
 					<a href="https://givewp.com/documentation" target="_blank" class="button-secondary" title="Visit the Give Website">View Documentation
311 311
 						<span class="dashicons dashicons-external"></span></a>
312 312
 
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 
315 315
 				<div class="content  feature-section-item last-feature">
316 316
 
317
-					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>" title="Give" alt="Give">
317
+					<img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>" title="Give" alt="Give">
318 318
 
319 319
 				</div>
320 320
 
@@ -334,22 +334,22 @@  discard block
 block discarded – undo
334 334
 	 * @return void
335 335
 	 */
336 336
 	public function changelog_screen() {
337
-		list( $display_version ) = explode( '-', GIVE_VERSION );
337
+		list($display_version) = explode('-', GIVE_VERSION);
338 338
 		?>
339 339
 		<div class="wrap about-wrap">
340
-			<h1><?php _e( 'Give Changelog', 'give' ); ?></h1>
340
+			<h1><?php _e('Give Changelog', 'give'); ?></h1>
341 341
 
342 342
 			<div class="about-text"><?php
343 343
 				printf(
344 344
 					/* translators: %s: Give version */
345
-					__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ),
345
+					__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'),
346 346
 					$display_version
347 347
 				);
348 348
 			?></div>
349 349
 			<div class="give-badge"><?php
350 350
 				printf(
351 351
 					/* translators: %s: Give version */
352
-					__( 'Version %s', 'give' ),
352
+					__('Version %s', 'give'),
353 353
 					$display_version
354 354
 				);
355 355
 			?></div>
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 			<?php $this->tabs(); ?>
358 358
 
359 359
 			<div class="changelog">
360
-				<h3><?php _e( 'Full Changelog', 'give' ); ?></h3>
360
+				<h3><?php _e('Full Changelog', 'give'); ?></h3>
361 361
 
362 362
 				<div class="feature-section">
363 363
 					<?php echo $this->parse_readme(); ?>
@@ -365,10 +365,10 @@  discard block
 block discarded – undo
365 365
 			</div>
366 366
 
367 367
 			<div class="return-to-dashboard">
368
-				<a href="<?php echo esc_url( admin_url( add_query_arg( array(
368
+				<a href="<?php echo esc_url(admin_url(add_query_arg(array(
369 369
 					'post_type' => 'give_forms',
370 370
 					'page'      => 'give-settings'
371
-				), 'edit.php' ) ) ); ?>"><?php _e( 'Go to Give Settings', 'give' ); ?></a>
371
+				), 'edit.php'))); ?>"><?php _e('Go to Give Settings', 'give'); ?></a>
372 372
 			</div>
373 373
 		</div>
374 374
 	<?php
@@ -382,29 +382,29 @@  discard block
 block discarded – undo
382 382
 	 * @return void
383 383
 	 */
384 384
 	public function getting_started_screen() {
385
-		list( $display_version ) = explode( '-', GIVE_VERSION );
385
+		list($display_version) = explode('-', GIVE_VERSION);
386 386
 		?>
387 387
 		<div class="wrap about-wrap get-started">
388 388
 			<h1 class="welcome-h1"><?php
389 389
 				printf(
390 390
 					/* translators: %s: Give version */
391
-					__( 'Give %s - Getting Started Guide', 'give' ),
391
+					__('Give %s - Getting Started Guide', 'give'),
392 392
 					$display_version
393 393
 				);
394 394
 			?></h1>
395 395
 
396 396
 			<?php give_social_media_elements() ?>
397 397
 
398
-			<div class="about-text"><?php _e( 'Welcome to the getting started guide.', 'give' ); ?></div>
398
+			<div class="about-text"><?php _e('Welcome to the getting started guide.', 'give'); ?></div>
399 399
 
400
-			<p class="newsletter-intro"><?php _e( 'Don\'t forget to sign up for the newsletter!', 'give' ); ?>.</p>
400
+			<p class="newsletter-intro"><?php _e('Don\'t forget to sign up for the newsletter!', 'give'); ?>.</p>
401 401
 
402 402
 			<?php give_get_newsletter() ?>
403 403
 
404 404
 			<div class="give-badge"><?php
405 405
 				printf(
406 406
 					/* translators: %s: Give version */
407
-					__( 'Version %s', 'give' ),
407
+					__('Version %s', 'give'),
408 408
 					$display_version
409 409
 				);
410 410
 			?></div>
@@ -412,17 +412,17 @@  discard block
 block discarded – undo
412 412
 			<?php $this->tabs(); ?>
413 413
 
414 414
 
415
-			<div class="about-text"><?php printf( __( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></div>
415
+			<div class="about-text"><?php printf(__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></div>
416 416
 
417 417
 
418 418
 			<div class="feature-section clearfix">
419 419
 
420 420
 				<div class="content feature-section-item">
421
-					<h3><?php _e( 'STEP 1: Create a New Form', 'give' ); ?></h3>
421
+					<h3><?php _e('STEP 1: Create a New Form', 'give'); ?></h3>
422 422
 
423
-					<p><?php _e( 'Give is driven by it\'s powerful form building features. But it is not simply a "form". From the "Add New Form" page you\'ll be able to choose how and where you want to receive your donations. You\'ll be able to set the donation amounts. You even get to choose whether you want to create a whole page for your form, or embed it on a different page of your site.', 'give' ); ?></p>
423
+					<p><?php _e('Give is driven by it\'s powerful form building features. But it is not simply a "form". From the "Add New Form" page you\'ll be able to choose how and where you want to receive your donations. You\'ll be able to set the donation amounts. You even get to choose whether you want to create a whole page for your form, or embed it on a different page of your site.', 'give'); ?></p>
424 424
 
425
-					<p><?php _e( 'But all of these features begin simply by going to the menu and choosing "Add New Form."', 'give' ); ?></p>
425
+					<p><?php _e('But all of these features begin simply by going to the menu and choosing "Add New Form."', 'give'); ?></p>
426 426
 				</div>
427 427
 
428 428
 				<div class="content feature-section-item last-feature">
@@ -439,9 +439,9 @@  discard block
 block discarded – undo
439 439
 				</div>
440 440
 
441 441
 				<div class="content feature-section-item last-feature">
442
-					<h3><?php _e( 'STEP 2: Choose Your Levels', 'give' ); ?></h3>
442
+					<h3><?php _e('STEP 2: Choose Your Levels', 'give'); ?></h3>
443 443
 
444
-					<p><?php _e( 'Each Form can be set to receive either a pre-determined amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the levels section where you can add as many levels as you like with your own custom names and amounts.', 'give' ); ?></p>
444
+					<p><?php _e('Each Form can be set to receive either a pre-determined amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the levels section where you can add as many levels as you like with your own custom names and amounts.', 'give'); ?></p>
445 445
 				</div>
446 446
 
447 447
 			</div>
@@ -450,11 +450,11 @@  discard block
 block discarded – undo
450 450
 			<div class="feature-section clearfix">
451 451
 
452 452
 				<div class="content feature-section-item add-content">
453
-					<h3><?php _e( 'STEP 3: Landing Page or Shortcode Mode?', 'give' ); ?></h3>
453
+					<h3><?php _e('STEP 3: Landing Page or Shortcode Mode?', 'give'); ?></h3>
454 454
 
455
-					<p><?php _e( 'Every form you create in Give can either become it\'s own stand-alone page, or it can be inserted into any other page or post throughout your site as a Shortcode.', 'give' ); ?></p>
455
+					<p><?php _e('Every form you create in Give can either become it\'s own stand-alone page, or it can be inserted into any other page or post throughout your site as a Shortcode.', 'give'); ?></p>
456 456
 
457
-					<p><?php _e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the Donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p>
457
+					<p><?php _e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the Donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p>
458 458
 				</div>
459 459
 
460 460
 				<div class="content feature-section-item last-feature">
@@ -471,9 +471,9 @@  discard block
 block discarded – undo
471 471
 				</div>
472 472
 
473 473
 				<div class="content feature-section-item last-feature">
474
-					<h3><?php _e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3>
474
+					<h3><?php _e('STEP 4: Configure Your Display Options', 'give'); ?></h3>
475 475
 
476
-					<p><?php _e( 'Lastly, you can present the form in a lot of different ways. With the "Display Options" section you can configure how the credit card field appears, the submit button text, which Gateway you want to use, whether Guests (non-logged in users) can donate or not, and a log-in form.', 'give' ); ?></p>
476
+					<p><?php _e('Lastly, you can present the form in a lot of different ways. With the "Display Options" section you can configure how the credit card field appears, the submit button text, which Gateway you want to use, whether Guests (non-logged in users) can donate or not, and a log-in form.', 'give'); ?></p>
477 477
 				</div>
478 478
 
479 479
 
@@ -493,38 +493,38 @@  discard block
 block discarded – undo
493 493
 	 * @return void
494 494
 	 */
495 495
 	public function credits_screen() {
496
-		list( $display_version ) = explode( '-', GIVE_VERSION );
496
+		list($display_version) = explode('-', GIVE_VERSION);
497 497
 		?>
498 498
 		<div class="wrap about-wrap">
499 499
 			<h1 class="welcome-h1"><?php
500 500
 				printf(
501 501
 					/* translators: %s: Give version */
502
-					__( 'Give %s - Credits', 'give' ),
502
+					__('Give %s - Credits', 'give'),
503 503
 					$display_version
504 504
 				);
505 505
 			?></h1>
506 506
 
507 507
 			<?php give_social_media_elements() ?>
508 508
 
509
-			<div class="about-text"><?php _e( 'Thanks to all those who have contributed code directly or indirectly. ', 'give' ); ?></div>
509
+			<div class="about-text"><?php _e('Thanks to all those who have contributed code directly or indirectly. ', 'give'); ?></div>
510 510
 
511
-			<div class="about-text"><?php _e( 'Welcome to the getting started guide.', 'give' ); ?></div>
511
+			<div class="about-text"><?php _e('Welcome to the getting started guide.', 'give'); ?></div>
512 512
 
513
-			<p class="newsletter-intro"><?php _e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p>
513
+			<p class="newsletter-intro"><?php _e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p>
514 514
 
515 515
 			<?php give_get_newsletter() ?>
516 516
 
517 517
 			<div class="give-badge"><?php
518 518
 				printf(
519 519
 					/* translators: %s: Give version */
520
-					__( 'Version %s', 'give' ),
520
+					__('Version %s', 'give'),
521 521
 					$display_version
522 522
 				);
523 523
 			?></div>
524 524
 
525 525
 			<?php $this->tabs(); ?>
526 526
 
527
-			<p class="about-description"><?php _e( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="https://github.com/WordImpress/give" target="_blank">GitHub Repo</a>.', 'give' ); ?></p>
527
+			<p class="about-description"><?php _e('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="https://github.com/WordImpress/give" target="_blank">GitHub Repo</a>.', 'give'); ?></p>
528 528
 
529 529
 			<?php echo $this->contributors(); ?>
530 530
 		</div>
@@ -539,21 +539,21 @@  discard block
 block discarded – undo
539 539
 	 * @return string $readme HTML formatted readme file
540 540
 	 */
541 541
 	public function parse_readme() {
542
-		$file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
542
+		$file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR.'readme.txt' : null;
543 543
 
544
-		if ( ! $file ) {
545
-			$readme = '<p>' . __( 'No valid changlog was found.', 'give' ) . '</p>';
544
+		if ( ! $file) {
545
+			$readme = '<p>'.__('No valid changlog was found.', 'give').'</p>';
546 546
 		} else {
547
-			$readme = file_get_contents( $file );
548
-			$readme = nl2br( esc_html( $readme ) );
549
-			$readme = explode( '== Changelog ==', $readme );
550
-			$readme = end( $readme );
551
-
552
-			$readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme );
553
-			$readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme );
554
-			$readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme );
555
-			$readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme );
556
-			$readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme );
547
+			$readme = file_get_contents($file);
548
+			$readme = nl2br(esc_html($readme));
549
+			$readme = explode('== Changelog ==', $readme);
550
+			$readme = end($readme);
551
+
552
+			$readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme);
553
+			$readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme);
554
+			$readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme);
555
+			$readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme);
556
+			$readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme);
557 557
 		}
558 558
 
559 559
 		return $readme;
@@ -570,27 +570,27 @@  discard block
 block discarded – undo
570 570
 	public function contributors() {
571 571
 		$contributors = $this->get_contributors();
572 572
 
573
-		if ( empty( $contributors ) ) {
573
+		if (empty($contributors)) {
574 574
 			return '';
575 575
 		}
576 576
 
577 577
 		$contributor_list = '<ul class="wp-people-group">';
578 578
 
579
-		foreach ( $contributors as $contributor ) {
579
+		foreach ($contributors as $contributor) {
580 580
 			$contributor_list .= '<li class="wp-person">';
581
-			$contributor_list .= sprintf( '<a href="%s" title="%s">',
582
-				esc_url( 'https://github.com/' . $contributor->login ),
581
+			$contributor_list .= sprintf('<a href="%s" title="%s">',
582
+				esc_url('https://github.com/'.$contributor->login),
583 583
 				esc_html(
584 584
 					sprintf(
585 585
 						/* translators: %s: github contributor */
586
-						__( 'View %s', 'give' ),
586
+						__('View %s', 'give'),
587 587
 						$contributor->login
588 588
 					)
589 589
 				)
590 590
 			);
591
-			$contributor_list .= sprintf( '<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url( $contributor->avatar_url ), esc_html( $contributor->login ) );
591
+			$contributor_list .= sprintf('<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url($contributor->avatar_url), esc_html($contributor->login));
592 592
 			$contributor_list .= '</a>';
593
-			$contributor_list .= sprintf( '<a class="web" href="%s">%s</a>', esc_url( 'https://github.com/' . $contributor->login ), esc_html( $contributor->login ) );
593
+			$contributor_list .= sprintf('<a class="web" href="%s">%s</a>', esc_url('https://github.com/'.$contributor->login), esc_html($contributor->login));
594 594
 			$contributor_list .= '</a>';
595 595
 			$contributor_list .= '</li>';
596 596
 		}
@@ -608,25 +608,25 @@  discard block
 block discarded – undo
608 608
 	 * @return array $contributors List of contributors
609 609
 	 */
610 610
 	public function get_contributors() {
611
-		$contributors = get_transient( 'give_contributors' );
611
+		$contributors = get_transient('give_contributors');
612 612
 
613
-		if ( false !== $contributors ) {
613
+		if (false !== $contributors) {
614 614
 			return $contributors;
615 615
 		}
616 616
 
617
-		$response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) );
617
+		$response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false));
618 618
 
619
-		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
619
+		if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
620 620
 			return array();
621 621
 		}
622 622
 
623
-		$contributors = json_decode( wp_remote_retrieve_body( $response ) );
623
+		$contributors = json_decode(wp_remote_retrieve_body($response));
624 624
 
625
-		if ( ! is_array( $contributors ) ) {
625
+		if ( ! is_array($contributors)) {
626 626
 			return array();
627 627
 		}
628 628
 
629
-		set_transient( 'give_contributors', $contributors, 3600 );
629
+		set_transient('give_contributors', $contributors, 3600);
630 630
 
631 631
 		return $contributors;
632 632
 	}
@@ -645,24 +645,24 @@  discard block
 block discarded – undo
645 645
 
646 646
 
647 647
 		// Bail if no activation redirect
648
-		if ( ! get_transient( '_give_activation_redirect' ) ) {
648
+		if ( ! get_transient('_give_activation_redirect')) {
649 649
 			return;
650 650
 		}
651 651
 
652 652
 		// Delete the redirect transient
653
-		delete_transient( '_give_activation_redirect' );
653
+		delete_transient('_give_activation_redirect');
654 654
 
655 655
 		// Bail if activating from network, or bulk
656
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
656
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
657 657
 			return;
658 658
 		}
659 659
 
660
-		$upgrade = get_option( 'give_version_upgraded_from' );
660
+		$upgrade = get_option('give_version_upgraded_from');
661 661
 
662
-		if ( ! $upgrade ) { // First time install
663
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
662
+		if ( ! $upgrade) { // First time install
663
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
664 664
 			exit;
665
-		} elseif( isset( $give_options['disable_welcome'] ) ) { // Welcome is disabled in settings
665
+		} elseif (isset($give_options['disable_welcome'])) { // Welcome is disabled in settings
666 666
 
667 667
 		} else { // Welcome is NOT disabled in settings
668 668
 			wp_safe_redirect(admin_url('index.php?page=give-about'));
Please login to merge, or discard this patch.
includes/admin/class-addon-activation-banner.php 1 patch
Spacing   +22 added lines, -22 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
 
@@ -26,12 +26,12 @@  discard block
 block discarded – undo
26 26
 	 *
27 27
 	 * @param $_banner_details
28 28
 	 */
29
-	function __construct( $_banner_details ) {
29
+	function __construct($_banner_details) {
30 30
 
31 31
 		global $current_user;
32 32
 		$this->banner_details = $_banner_details;
33
-		$this->test_mode      = ( $this->banner_details['testing'] == 'true' ) ? true : false;
34
-		$this->nag_meta_key   = 'give_addon_activation_ignore_' . sanitize_title( $this->banner_details['name'] );
33
+		$this->test_mode      = ($this->banner_details['testing'] == 'true') ? true : false;
34
+		$this->nag_meta_key   = 'give_addon_activation_ignore_'.sanitize_title($this->banner_details['name']);
35 35
 
36 36
 		//Get current user
37 37
 		$this->user_id = $current_user->ID;
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 	public function init() {
51 51
 
52 52
 		//Testing?
53
-		if ( $this->test_mode ) {
54
-			delete_user_meta( $this->user_id, $this->nag_meta_key );
53
+		if ($this->test_mode) {
54
+			delete_user_meta($this->user_id, $this->nag_meta_key);
55 55
 		}
56 56
 
57 57
 		//Get the current page to add the notice to
58
-		add_action( 'current_screen', array( $this, 'give_addon_notice_ignore' ) );
59
-		add_action( 'admin_notices', array( $this, 'give_addon_activation_admin_notice' ) );
58
+		add_action('current_screen', array($this, 'give_addon_notice_ignore'));
59
+		add_action('admin_notices', array($this, 'give_addon_activation_admin_notice'));
60 60
 
61 61
 
62 62
 	}
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
 		global $pagenow;
72 72
 
73 73
 		//Make sure we're on the plugins page.
74
-		if ( $pagenow !== 'plugins.php' ) {
74
+		if ($pagenow !== 'plugins.php') {
75 75
 			return false;
76 76
 		}
77 77
 
78 78
 		// If the user hasn't already dismissed our alert,
79 79
 		// Output the activation banner
80
-		if ( ! get_user_meta( $this->user_id, $this->nag_meta_key ) ) { ?>
80
+		if ( ! get_user_meta($this->user_id, $this->nag_meta_key)) { ?>
81 81
 
82 82
 			<!-- * I output inline styles here
83 83
 				 * because there's no reason to keep these
@@ -157,15 +157,15 @@  discard block
 block discarded – undo
157 157
 				<h3><?php
158 158
 					printf(
159 159
 						/* translators: %s: Add-on name */
160
-						__( "Thank you for installing Give's %s Add-on!", 'give' ),
161
-						'<span>' . $this->banner_details['name'] . '</span>'
160
+						__("Thank you for installing Give's %s Add-on!", 'give'),
161
+						'<span>'.$this->banner_details['name'].'</span>'
162 162
 					);
163 163
 				?></h3>
164 164
 
165 165
 				<a href="<?php
166 166
 				//The Dismiss Button
167
-				$nag_admin_dismiss_url = 'plugins.php?' . $this->nag_meta_key . '=0';
168
-				echo admin_url( $nag_admin_dismiss_url ); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a>
167
+				$nag_admin_dismiss_url = 'plugins.php?'.$this->nag_meta_key.'=0';
168
+				echo admin_url($nag_admin_dismiss_url); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a>
169 169
 
170 170
 				<!-- * Now we output a few "actions"
171 171
 					 * that the user can take from here -->
@@ -173,21 +173,21 @@  discard block
 block discarded – undo
173 173
 				<div class="alert-actions">
174 174
 
175 175
 					<?php //Point them to your settings page
176
-					if ( isset( $this->banner_details['settings_url'] ) ) { ?>
176
+					if (isset($this->banner_details['settings_url'])) { ?>
177 177
 						<a href="<?php echo $this->banner_details['settings_url']; ?>">
178
-							<span class="dashicons dashicons-admin-settings"></span><?php _e( 'Go to Settings', 'give' ); ?>
178
+							<span class="dashicons dashicons-admin-settings"></span><?php _e('Go to Settings', 'give'); ?>
179 179
 						</a>
180 180
 					<?php } ?>
181 181
 
182 182
 					<?php
183 183
 					// Show them how to configure the Addon
184
-					if ( isset( $this->banner_details['documentation_url'] ) ) { ?>
184
+					if (isset($this->banner_details['documentation_url'])) { ?>
185 185
 						<a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank">
186 186
 							<span class="dashicons dashicons-media-text"></span>
187 187
 							<?php
188 188
 								printf(
189 189
 									/* translators: %s: Add-on name */
190
-									__( 'Documentation: %s Add-on', 'give' ),
190
+									__('Documentation: %s Add-on', 'give'),
191 191
 									$this->banner_details['name']
192 192
 								);
193 193
 							?>
@@ -195,10 +195,10 @@  discard block
 block discarded – undo
195 195
 					<?php } ?>
196 196
 					<?php
197 197
 					//Let them signup for plugin updates
198
-					if ( isset( $this->banner_details['support_url'] ) ) { ?>
198
+					if (isset($this->banner_details['support_url'])) { ?>
199 199
 
200 200
 						<a href="<?php echo $this->banner_details['support_url'] ?>" target="_blank">
201
-							<span class="dashicons dashicons-sos"></span><?php _e( 'Get Support', 'give' ); ?>
201
+							<span class="dashicons dashicons-sos"></span><?php _e('Get Support', 'give'); ?>
202 202
 						</a>
203 203
 
204 204
 					<?php } ?>
@@ -220,13 +220,13 @@  discard block
 block discarded – undo
220 220
 		/* If user clicks to ignore the notice, add that to their user meta the banner then checks whether this tag exists already or not.
221 221
 		 * See here: http://codex.wordpress.org/Function_Reference/add_user_meta
222 222
 		 */
223
-		if ( isset( $_GET[ $this->nag_meta_key ] ) && '0' == $_GET[ $this->nag_meta_key ] ) {
223
+		if (isset($_GET[$this->nag_meta_key]) && '0' == $_GET[$this->nag_meta_key]) {
224 224
 
225 225
 			//Get the global user
226 226
 			global $current_user;
227 227
 			$user_id = $current_user->ID;
228 228
 
229
-			add_user_meta( $user_id, $this->nag_meta_key, 'true', true );
229
+			add_user_meta($user_id, $this->nag_meta_key, 'true', true);
230 230
 		}
231 231
 	}
232 232
 
Please login to merge, or discard this patch.
includes/admin/class-admin-notices.php 1 patch
Spacing   +49 added lines, -49 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
 
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
 	 * @since 1.0
28 28
 	 */
29 29
 	public function __construct() {
30
-		add_action( 'admin_notices', array( $this, 'show_notices' ) );
31
-		add_action( 'give_dismiss_notices', array( $this, 'dismiss_notices' ) );
32
-		add_action( 'admin_bar_menu', array( $this, 'give_admin_bar_menu' ), 1000 );
30
+		add_action('admin_notices', array($this, 'show_notices'));
31
+		add_action('give_dismiss_notices', array($this, 'dismiss_notices'));
32
+		add_action('admin_bar_menu', array($this, 'give_admin_bar_menu'), 1000);
33 33
 	}
34 34
 
35 35
 
@@ -42,18 +42,18 @@  discard block
 block discarded – undo
42 42
 	public function give_admin_bar_menu() {
43 43
 		global $wp_admin_bar;
44 44
 
45
-		if ( ! give_is_test_mode() || ! current_user_can( 'view_give_reports' ) ) {
45
+		if ( ! give_is_test_mode() || ! current_user_can('view_give_reports')) {
46 46
 			return false;
47 47
 		}
48 48
 
49 49
 		//Add the main siteadmin menu item
50
-		$wp_admin_bar->add_menu( array(
50
+		$wp_admin_bar->add_menu(array(
51 51
 			'id'     => 'give-test-notice',
52
-			'href'   => admin_url() . 'edit.php?post_type=give_forms&page=give-settings&tab=gateways',
52
+			'href'   => admin_url().'edit.php?post_type=give_forms&page=give-settings&tab=gateways',
53 53
 			'parent' => 'top-secondary',
54
-			'title'  => __( 'Give Test Mode Active', 'give' ),
55
-			'meta'   => array( 'class' => 'give-test-mode-active' ),
56
-		) );
54
+			'title'  => __('Give Test Mode Active', 'give'),
55
+			'meta'   => array('class' => 'give-test-mode-active'),
56
+		));
57 57
 
58 58
 	}
59 59
 
@@ -68,98 +68,98 @@  discard block
 block discarded – undo
68 68
 			'error'   => array()
69 69
 		);
70 70
 
71
-		if ( ! give_test_ajax_works() && ! get_user_meta( get_current_user_id(), '_give_admin_ajax_inaccessible_dismissed', true ) && current_user_can( 'manage_give_settings' ) ) {
71
+		if ( ! give_test_ajax_works() && ! get_user_meta(get_current_user_id(), '_give_admin_ajax_inaccessible_dismissed', true) && current_user_can('manage_give_settings')) {
72 72
 			echo '<div class="error">';
73
-			echo '<p>' . __( 'Your site appears to be blocking the WordPress ajax interface. This may cause issues with Give.', 'give' ) . '</p>';
73
+			echo '<p>'.__('Your site appears to be blocking the WordPress ajax interface. This may cause issues with Give.', 'give').'</p>';
74 74
 			/* translators: %s: https://givewp.com/documentation/core/troubleshooting/admin-ajax-blocked/ */
75
-			echo '<p>' . sprintf( esc_attr__( 'Please see <a href="%s" target="_blank">this reference</a> for possible solutions.', 'give' ), esc_url( 'https://givewp.com/documentation/core/troubleshooting/admin-ajax-blocked/' ) ) . '</p>';
76
-			echo '<p><a href="' . add_query_arg( array(
75
+			echo '<p>'.sprintf(esc_attr__('Please see <a href="%s" target="_blank">this reference</a> for possible solutions.', 'give'), esc_url('https://givewp.com/documentation/core/troubleshooting/admin-ajax-blocked/')).'</p>';
76
+			echo '<p><a href="'.add_query_arg(array(
77 77
 					'give_action' => 'dismiss_notices',
78 78
 					'give_notice' => 'admin_ajax_inaccessible'
79
-				) ) . '">' . esc_attr__( 'Dismiss Notice', 'give' ) . '</a></p>';
79
+				)).'">'.esc_attr__('Dismiss Notice', 'give').'</a></p>';
80 80
 			echo '</div>';
81 81
 		}
82 82
 
83 83
 
84
-		if ( isset( $_GET['give-message'] ) ) {
84
+		if (isset($_GET['give-message'])) {
85 85
 
86 86
 			// Donation reports errors
87
-			if ( current_user_can( 'view_give_reports' ) ) {
88
-				switch ( $_GET['give-message'] ) {
87
+			if (current_user_can('view_give_reports')) {
88
+				switch ($_GET['give-message']) {
89 89
 					case 'payment_deleted' :
90
-						$notices['updated']['give-payment-deleted'] = esc_attr__( 'The payment has been deleted.', 'give' );
90
+						$notices['updated']['give-payment-deleted'] = esc_attr__('The payment has been deleted.', 'give');
91 91
 						break;
92 92
 					case 'email_sent' :
93
-						$notices['updated']['give-payment-sent'] = esc_attr__( 'The donation receipt has been resent.', 'give' );
93
+						$notices['updated']['give-payment-sent'] = esc_attr__('The donation receipt has been resent.', 'give');
94 94
 						break;
95 95
 					case 'refreshed-reports' :
96
-						$notices['updated']['give-refreshed-reports'] = esc_attr__( 'The reports cache has been cleared.', 'give' );
96
+						$notices['updated']['give-refreshed-reports'] = esc_attr__('The reports cache has been cleared.', 'give');
97 97
 						break;
98 98
 					case 'payment-note-deleted' :
99
-						$notices['updated']['give-payment-note-deleted'] = esc_attr__( 'The payment note has been deleted.', 'give' );
99
+						$notices['updated']['give-payment-note-deleted'] = esc_attr__('The payment note has been deleted.', 'give');
100 100
 						break;
101 101
 				}
102 102
 			}
103 103
 
104 104
 			// Give settings notices and errors
105
-			if ( current_user_can( 'manage_give_settings' ) ) {
106
-				switch ( $_GET['give-message'] ) {
105
+			if (current_user_can('manage_give_settings')) {
106
+				switch ($_GET['give-message']) {
107 107
 					case 'settings-imported' :
108
-						$notices['updated']['give-settings-imported'] = esc_attr__( 'The settings have been imported.', 'give' );
108
+						$notices['updated']['give-settings-imported'] = esc_attr__('The settings have been imported.', 'give');
109 109
 						break;
110 110
 					case 'api-key-generated' :
111
-						$notices['updated']['give-api-key-generated'] = esc_attr__( 'API keys successfully generated.', 'give' );
111
+						$notices['updated']['give-api-key-generated'] = esc_attr__('API keys successfully generated.', 'give');
112 112
 						break;
113 113
 					case 'api-key-exists' :
114
-						$notices['error']['give-api-key-exists'] = esc_attr__( 'The specified user already has API keys.', 'give' );
114
+						$notices['error']['give-api-key-exists'] = esc_attr__('The specified user already has API keys.', 'give');
115 115
 						break;
116 116
 					case 'api-key-regenerated' :
117
-						$notices['updated']['give-api-key-regenerated'] = esc_attr__( 'API keys successfully regenerated.', 'give' );
117
+						$notices['updated']['give-api-key-regenerated'] = esc_attr__('API keys successfully regenerated.', 'give');
118 118
 						break;
119 119
 					case 'api-key-revoked' :
120
-						$notices['updated']['give-api-key-revoked'] = esc_attr__( 'API keys successfully revoked.', 'give' );
120
+						$notices['updated']['give-api-key-revoked'] = esc_attr__('API keys successfully revoked.', 'give');
121 121
 						break;
122 122
 					case 'sent-test-email' :
123
-						$notices['updated']['give-sent-test-email'] = esc_attr__( 'The test email has been sent.', 'give' );
123
+						$notices['updated']['give-sent-test-email'] = esc_attr__('The test email has been sent.', 'give');
124 124
 						break;
125 125
 				}
126 126
 			}
127 127
 			// Payments errors
128
-			if ( current_user_can( 'edit_give_payments' ) ) {
129
-				switch ( $_GET['give-message'] ) {
128
+			if (current_user_can('edit_give_payments')) {
129
+				switch ($_GET['give-message']) {
130 130
 					case 'note-added' :
131
-						$notices['updated']['give-note-added'] = esc_attr__( 'The payment note has been added successfully.', 'give' );
131
+						$notices['updated']['give-note-added'] = esc_attr__('The payment note has been added successfully.', 'give');
132 132
 						break;
133 133
 					case 'payment-updated' :
134
-						$notices['updated']['give-payment-updated'] = esc_attr__( 'The payment has been successfully updated.', 'give' );
134
+						$notices['updated']['give-payment-updated'] = esc_attr__('The payment has been successfully updated.', 'give');
135 135
 						break;
136 136
 				}
137 137
 			}
138 138
 
139 139
 			// Customer Notices
140
-			if ( current_user_can( 'edit_give_payments' ) ) {
141
-				switch ( $_GET['give-message'] ) {
140
+			if (current_user_can('edit_give_payments')) {
141
+				switch ($_GET['give-message']) {
142 142
 					case 'customer-deleted' :
143
-						$notices['updated']['give-customer-deleted'] = esc_attr__( 'Donor successfully deleted.', 'give' );
143
+						$notices['updated']['give-customer-deleted'] = esc_attr__('Donor successfully deleted.', 'give');
144 144
 						break;
145 145
 				}
146 146
 			}
147 147
 
148 148
 		}
149 149
 
150
-		if ( count( $notices['updated'] ) > 0 ) {
151
-			foreach ( $notices['updated'] as $notice => $message ) {
152
-				add_settings_error( 'give-notices', $notice, $message, 'updated' );
150
+		if (count($notices['updated']) > 0) {
151
+			foreach ($notices['updated'] as $notice => $message) {
152
+				add_settings_error('give-notices', $notice, $message, 'updated');
153 153
 			}
154 154
 		}
155 155
 
156
-		if ( count( $notices['error'] ) > 0 ) {
157
-			foreach ( $notices['error'] as $notice => $message ) {
158
-				add_settings_error( 'give-notices', $notice, $message, 'error' );
156
+		if (count($notices['error']) > 0) {
157
+			foreach ($notices['error'] as $notice => $message) {
158
+				add_settings_error('give-notices', $notice, $message, 'error');
159 159
 			}
160 160
 		}
161 161
 
162
-		settings_errors( 'give-notices' );
162
+		settings_errors('give-notices');
163 163
 
164 164
 	}
165 165
 
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	 * @return void
172 172
 	 */
173 173
 	function give_admin_addons_notices() {
174
-		add_settings_error( 'give-notices', 'give-addons-feed-error', esc_attr__( 'There seems to be an issue with the server. Please try again in a few minutes.', 'give' ), 'error' );
175
-		settings_errors( 'give-notices' );
174
+		add_settings_error('give-notices', 'give-addons-feed-error', esc_attr__('There seems to be an issue with the server. Please try again in a few minutes.', 'give'), 'error');
175
+		settings_errors('give-notices');
176 176
 	}
177 177
 
178 178
 
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
 	 * @return void
184 184
 	 */
185 185
 	function dismiss_notices() {
186
-		if ( isset( $_GET['give_notice'] ) ) {
187
-			update_user_meta( get_current_user_id(), '_give_' . $_GET['give_notice'] . '_dismissed', 1 );
188
-			wp_redirect( remove_query_arg( array( 'give_action', 'give_notice' ) ) );
186
+		if (isset($_GET['give_notice'])) {
187
+			update_user_meta(get_current_user_id(), '_give_'.$_GET['give_notice'].'_dismissed', 1);
188
+			wp_redirect(remove_query_arg(array('give_action', 'give_notice')));
189 189
 			exit;
190 190
 		}
191 191
 	}
Please login to merge, or discard this patch.
includes/admin/dashboard-widgets.php 1 patch
Spacing   +33 added lines, -33 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
 
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
  * @return void
22 22
  */
23 23
 function give_register_dashboard_widgets() {
24
-	if ( current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) {
25
-		wp_add_dashboard_widget( 'give_dashboard_sales', __( 'Give: Donation Statistics', 'give' ), 'give_dashboard_sales_widget' );
24
+	if (current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) {
25
+		wp_add_dashboard_widget('give_dashboard_sales', __('Give: Donation Statistics', 'give'), 'give_dashboard_sales_widget');
26 26
 	}
27 27
 }
28 28
 
29
-add_action( 'wp_dashboard_setup', 'give_register_dashboard_widgets', 10 );
29
+add_action('wp_dashboard_setup', 'give_register_dashboard_widgets', 10);
30 30
 
31 31
 /**
32 32
  * Sales Summary Dashboard Widget
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  */
39 39
 function give_dashboard_sales_widget() {
40 40
 
41
-	if ( ! current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) {
41
+	if ( ! current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) {
42 42
 		return;
43 43
 	}
44 44
 	$stats = new Give_Payment_Stats; ?>
@@ -46,25 +46,25 @@  discard block
 block discarded – undo
46 46
 	<div class="give-dashboard-widget">
47 47
 
48 48
 		<div class="give-dashboard-today give-clearfix">
49
-			<h3 class="give-dashboard-date-today"><?php echo date( 'F j, Y' ); ?></h3>
49
+			<h3 class="give-dashboard-date-today"><?php echo date('F j, Y'); ?></h3>
50 50
 
51 51
 			<p class="give-dashboard-happy-day"><?php
52 52
 				printf(
53 53
 					/* translators: %s: day of the week */
54
-					__( 'Happy %s!', 'give' ),
55
-					date( 'l', current_time( 'timestamp' ) )
54
+					__('Happy %s!', 'give'),
55
+					date('l', current_time('timestamp'))
56 56
 				);
57 57
 			?></p>
58 58
 
59
-			<?php $earnings_today = $stats->get_earnings( 0, 'today', false ); ?>
59
+			<?php $earnings_today = $stats->get_earnings(0, 'today', false); ?>
60 60
 
61
-			<p class="give-dashboard-today-earnings"><?php echo give_currency_filter( give_format_amount( $earnings_today ) ); ?></p>
61
+			<p class="give-dashboard-today-earnings"><?php echo give_currency_filter(give_format_amount($earnings_today)); ?></p>
62 62
 
63
-			<p class="give-orders-today"><?php $donations_today = $stats->get_sales( 0, 'today', false, array(
63
+			<p class="give-orders-today"><?php $donations_today = $stats->get_sales(0, 'today', false, array(
64 64
 					'publish',
65 65
 					'revoked'
66
-				) ); ?><?php echo give_format_amount( $donations_today, false ); ?>
67
-				<span><?php echo _x( 'donations today', 'Displays in WP admin dashboard widget after the day\'s total donations', 'give' ); ?></span>
66
+				)); ?><?php echo give_format_amount($donations_today, false); ?>
67
+				<span><?php echo _x('donations today', 'Displays in WP admin dashboard widget after the day\'s total donations', 'give'); ?></span>
68 68
 			</p>
69 69
 
70 70
 
@@ -74,34 +74,34 @@  discard block
 block discarded – undo
74 74
 		<table class="give-table-stats">
75 75
 			<thead style="display: none;">
76 76
 			<tr>
77
-				<th><?php _e( 'This Week', 'give' ); ?></th>
78
-				<th><?php _e( 'This Month', 'give' ); ?></th>
79
-				<th><?php _e( 'Past 30 Days', 'give' ); ?></th>
77
+				<th><?php _e('This Week', 'give'); ?></th>
78
+				<th><?php _e('This Month', 'give'); ?></th>
79
+				<th><?php _e('Past 30 Days', 'give'); ?></th>
80 80
 			</tr>
81 81
 			</thead>
82 82
 			<tbody>
83 83
 			<tr id="give-table-stats-tr-1">
84 84
 				<td>
85
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_week' ) ) ); ?></p>
85
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_week'))); ?></p>
86 86
 
87
-					<p class="give-dashboard-stat-total-label"><?php _e( 'this week', 'give' ); ?></p>
87
+					<p class="give-dashboard-stat-total-label"><?php _e('this week', 'give'); ?></p>
88 88
 				</td>
89 89
 				<td>
90
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_month' ) ) ); ?></p>
90
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_month'))); ?></p>
91 91
 
92
-					<p class="give-dashboard-stat-total-label"><?php _e( 'this month', 'give' ); ?></p>
92
+					<p class="give-dashboard-stat-total-label"><?php _e('this month', 'give'); ?></p>
93 93
 				</td>
94 94
 			</tr>
95 95
 			<tr id="give-table-stats-tr-2">
96 96
 				<td>
97
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'last_month' ) ) ) ?></p>
97
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'last_month'))) ?></p>
98 98
 
99
-					<p class="give-dashboard-stat-total-label"><?php _e( 'last month', 'give' ); ?></p>
99
+					<p class="give-dashboard-stat-total-label"><?php _e('last month', 'give'); ?></p>
100 100
 				</td>
101 101
 				<td>
102
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_year', false ) ) ) ?></p>
102
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_year', false))) ?></p>
103 103
 
104
-					<p class="give-dashboard-stat-total-label"><?php _e( 'this year', 'give' ); ?></p>
104
+					<p class="give-dashboard-stat-total-label"><?php _e('this year', 'give'); ?></p>
105 105
 				</td>
106 106
 			</tr>
107 107
 			</tbody>
@@ -121,25 +121,25 @@  discard block
 block discarded – undo
121 121
  *
122 122
  * @return array
123 123
  */
124
-function give_dashboard_at_a_glance_widget( $items ) {
125
-	$num_posts = wp_count_posts( 'give_forms' );
124
+function give_dashboard_at_a_glance_widget($items) {
125
+	$num_posts = wp_count_posts('give_forms');
126 126
 
127
-	if ( $num_posts && $num_posts->publish ) {
127
+	if ($num_posts && $num_posts->publish) {
128 128
         
129 129
 		$text = sprintf(
130 130
 			/* translators: 1: number of posts published 2: forms singular label 3: forms plural label */
131
-			_n( '%1$s Give %2$s', '%1$s Give %3$s', $num_posts->publish, 'give' ),
131
+			_n('%1$s Give %2$s', '%1$s Give %3$s', $num_posts->publish, 'give'),
132 132
 			$num_posts->publish,
133 133
 			give_get_forms_label_singular(),
134 134
 			give_get_forms_label_plural()
135 135
 		);
136 136
 
137
-		$text = sprintf( $text, number_format_i18n( $num_posts->publish ) );
137
+		$text = sprintf($text, number_format_i18n($num_posts->publish));
138 138
 
139
-		if ( current_user_can( 'edit_give_forms', get_current_user_id() ) ) {
140
-			$text = sprintf( '<a class="give-forms-count" href="edit.php?post_type=give_forms">%1$s</a>', $text );
139
+		if (current_user_can('edit_give_forms', get_current_user_id())) {
140
+			$text = sprintf('<a class="give-forms-count" href="edit.php?post_type=give_forms">%1$s</a>', $text);
141 141
 		} else {
142
-			$text = sprintf( '<span class="give-forms-count">%1$s</span>', $text );
142
+			$text = sprintf('<span class="give-forms-count">%1$s</span>', $text);
143 143
 		}
144 144
 
145 145
 		$items[] = $text;
@@ -148,4 +148,4 @@  discard block
 block discarded – undo
148 148
 	return $items;
149 149
 }
150 150
 
151
-add_filter( 'dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1);
151
+add_filter('dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1);
Please login to merge, or discard this patch.