Completed
Pull Request — master (#770)
by Devin
20:03
created
includes/process-purchase.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @access      private
23 23
  * @since       1.0
24
- * @return      void
24
+ * @return      false|null
25 25
  */
26 26
 function give_process_purchase_form() {
27 27
 
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
  *
327 327
  * @since  1.0.1
328 328
  *
329
- * @param $payment_mode
329
+ * @param string $payment_mode
330 330
  *
331 331
  * @return mixed|void
332 332
  */
Please login to merge, or discard this 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/user-functions.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -270,7 +270,7 @@
 block discarded – undo
270 270
  * @access      public
271 271
  * @since       1.0
272 272
  *
273
- * @param       $username string - the username to validate
273
+ * @param       string $username string - the username to validate
274 274
  *
275 275
  * @return      bool
276 276
  */
Please login to merge, or discard this patch.
Spacing   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -30,36 +30,36 @@  discard block
 block discarded – undo
30 30
  *
31 31
  * @return bool|object List of all user purchases
32 32
  */
33
-function give_get_users_purchases( $user = 0, $number = 20, $pagination = false, $status = 'complete' ) {
33
+function give_get_users_purchases($user = 0, $number = 20, $pagination = false, $status = 'complete') {
34 34
 
35
-	if ( empty( $user ) ) {
35
+	if (empty($user)) {
36 36
 		$user = get_current_user_id();
37 37
 	}
38 38
 
39
-	if ( 0 === $user && ! Give()->email_access->token_exists ) {
39
+	if (0 === $user && ! Give()->email_access->token_exists) {
40 40
 		return false;
41 41
 	}
42 42
 
43 43
 	$status = $status === 'complete' ? 'publish' : $status;
44 44
 
45
-	if ( $pagination ) {
46
-		if ( get_query_var( 'paged' ) ) {
47
-			$paged = get_query_var( 'paged' );
48
-		} else if ( get_query_var( 'page' ) ) {
49
-			$paged = get_query_var( 'page' );
45
+	if ($pagination) {
46
+		if (get_query_var('paged')) {
47
+			$paged = get_query_var('paged');
48
+		} else if (get_query_var('page')) {
49
+			$paged = get_query_var('page');
50 50
 		} else {
51 51
 			$paged = 1;
52 52
 		}
53 53
 	}
54 54
 
55
-	$args = apply_filters( 'give_get_users_purchases_args', array(
55
+	$args = apply_filters('give_get_users_purchases_args', array(
56 56
 		'user'    => $user,
57 57
 		'number'  => $number,
58 58
 		'status'  => $status,
59 59
 		'orderby' => 'date'
60
-	) );
60
+	));
61 61
 
62
-	if ( $pagination ) {
62
+	if ($pagination) {
63 63
 
64 64
 		$args['page'] = $paged;
65 65
 
@@ -69,20 +69,20 @@  discard block
 block discarded – undo
69 69
 
70 70
 	}
71 71
 
72
-	$by_user_id = is_numeric( $user ) ? true : false;
73
-	$customer   = new Give_Customer( $user, $by_user_id );
72
+	$by_user_id = is_numeric($user) ? true : false;
73
+	$customer   = new Give_Customer($user, $by_user_id);
74 74
 
75
-	if ( ! empty( $customer->payment_ids ) ) {
75
+	if ( ! empty($customer->payment_ids)) {
76 76
 
77
-		unset( $args['user'] );
78
-		$args['post__in'] = array_map( 'absint', explode( ',', $customer->payment_ids ) );
77
+		unset($args['user']);
78
+		$args['post__in'] = array_map('absint', explode(',', $customer->payment_ids));
79 79
 
80 80
 	}
81 81
 
82
-	$purchases = give_get_payments( apply_filters( 'give_get_users_purchases_args', $args ) );
82
+	$purchases = give_get_payments(apply_filters('give_get_users_purchases_args', $args));
83 83
 
84 84
 	// No purchases
85
-	if ( ! $purchases ) {
85
+	if ( ! $purchases) {
86 86
 		return false;
87 87
 	}
88 88
 
@@ -101,65 +101,65 @@  discard block
 block discarded – undo
101 101
  *
102 102
  * @return bool|object List of unique forms purchased by user
103 103
  */
104
-function give_get_users_completed_donations( $user = 0, $status = 'complete' ) {
105
-	if ( empty( $user ) ) {
104
+function give_get_users_completed_donations($user = 0, $status = 'complete') {
105
+	if (empty($user)) {
106 106
 		$user = get_current_user_id();
107 107
 	}
108 108
 
109
-	if ( empty( $user ) ) {
109
+	if (empty($user)) {
110 110
 		return false;
111 111
 	}
112 112
 
113
-	$by_user_id = is_numeric( $user ) ? true : false;
113
+	$by_user_id = is_numeric($user) ? true : false;
114 114
 
115
-	$customer = new Give_Customer( $user, $by_user_id );
115
+	$customer = new Give_Customer($user, $by_user_id);
116 116
 
117
-	if ( empty( $customer->payment_ids ) ) {
117
+	if (empty($customer->payment_ids)) {
118 118
 		return false;
119 119
 	}
120 120
 
121 121
 	// Get all the items purchased
122
-	$payment_ids    = array_reverse( explode( ',', $customer->payment_ids ) );
123
-	$limit_payments = apply_filters( 'give_users_completed_donations_payments', 50 );
124
-	if ( ! empty( $limit_payments ) ) {
125
-		$payment_ids = array_slice( $payment_ids, 0, $limit_payments );
122
+	$payment_ids    = array_reverse(explode(',', $customer->payment_ids));
123
+	$limit_payments = apply_filters('give_users_completed_donations_payments', 50);
124
+	if ( ! empty($limit_payments)) {
125
+		$payment_ids = array_slice($payment_ids, 0, $limit_payments);
126 126
 	}
127 127
 	$donation_data = array();
128
-	foreach ( $payment_ids as $payment_id ) {
129
-		$donation_data[] = give_get_payment_meta( $payment_id );
128
+	foreach ($payment_ids as $payment_id) {
129
+		$donation_data[] = give_get_payment_meta($payment_id);
130 130
 	}
131 131
 
132
-	if ( empty( $donation_data ) ) {
132
+	if (empty($donation_data)) {
133 133
 		return false;
134 134
 	}
135 135
 
136 136
 	// Grab only the post ids "form_id" of the forms purchased on this order
137 137
 	$completed_donations_ids = array();
138
-	foreach ( $donation_data as $purchase_meta ) {
138
+	foreach ($donation_data as $purchase_meta) {
139 139
 		$completed_donations_ids[] = isset($purchase_meta['form_id']) ? $purchase_meta['form_id'] : '';
140 140
 	}
141 141
 
142
-	if ( empty( $completed_donations_ids ) ) {
142
+	if (empty($completed_donations_ids)) {
143 143
 		return false;
144 144
 	}
145 145
 
146 146
 	// Only include each product purchased once
147
-	$form_ids = array_unique( $completed_donations_ids );
147
+	$form_ids = array_unique($completed_donations_ids);
148 148
 
149 149
 	// Make sure we still have some products and a first item
150
-	if ( empty ( $form_ids ) || ! isset( $form_ids[0] ) ) {
150
+	if (empty ($form_ids) || ! isset($form_ids[0])) {
151 151
 		return false;
152 152
 	}
153 153
 
154
-	$post_type = get_post_type( $form_ids[0] );
154
+	$post_type = get_post_type($form_ids[0]);
155 155
 
156
-	$args = apply_filters( 'give_get_users_completed_donations_args', array(
156
+	$args = apply_filters('give_get_users_completed_donations_args', array(
157 157
 		'include'        => $form_ids,
158 158
 		'post_type'      => $post_type,
159
-		'posts_per_page' => - 1
160
-	) );
159
+		'posts_per_page' => -1
160
+	));
161 161
 
162
-	return apply_filters( 'give_users_completed_donations_list', get_posts( $args ) );
162
+	return apply_filters('give_users_completed_donations_list', get_posts($args));
163 163
 }
164 164
 
165 165
 
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
  *
176 176
  * @return      bool - true if has purchased, false other wise.
177 177
  */
178
-function give_has_purchases( $user_id = null ) {
179
-	if ( empty( $user_id ) ) {
178
+function give_has_purchases($user_id = null) {
179
+	if (empty($user_id)) {
180 180
 		$user_id = get_current_user_id();
181 181
 	}
182 182
 
183
-	if ( give_get_users_purchases( $user_id, 1 ) ) {
183
+	if (give_get_users_purchases($user_id, 1)) {
184 184
 		return true; // User has at least one purchase
185 185
 	}
186 186
 
@@ -200,32 +200,32 @@  discard block
 block discarded – undo
200 200
  *
201 201
  * @return      array
202 202
  */
203
-function give_get_purchase_stats_by_user( $user = '' ) {
203
+function give_get_purchase_stats_by_user($user = '') {
204 204
 
205
-	if ( is_email( $user ) ) {
205
+	if (is_email($user)) {
206 206
 
207 207
 		$field = 'email';
208 208
 
209
-	} elseif ( is_numeric( $user ) ) {
209
+	} elseif (is_numeric($user)) {
210 210
 
211 211
 		$field = 'user_id';
212 212
 
213 213
 	}
214 214
 
215 215
 	$stats    = array();
216
-	$customer = Give()->customers->get_customer_by( $field, $user );
216
+	$customer = Give()->customers->get_customer_by($field, $user);
217 217
 
218
-	if ( $customer ) {
218
+	if ($customer) {
219 219
 
220
-		$customer = new Give_Customer( $customer->id );
220
+		$customer = new Give_Customer($customer->id);
221 221
 
222
-		$stats['purchases']   = absint( $customer->purchase_count );
223
-		$stats['total_spent'] = give_sanitize_amount( $customer->purchase_value );
222
+		$stats['purchases']   = absint($customer->purchase_count);
223
+		$stats['total_spent'] = give_sanitize_amount($customer->purchase_value);
224 224
 
225 225
 	}
226 226
 
227 227
 
228
-	return (array) apply_filters( 'give_purchase_stats_by_user', $stats, $user );
228
+	return (array) apply_filters('give_purchase_stats_by_user', $stats, $user);
229 229
 }
230 230
 
231 231
 
@@ -241,22 +241,22 @@  discard block
 block discarded – undo
241 241
  *
242 242
  * @return      int - the total number of purchases
243 243
  */
244
-function give_count_purchases_of_customer( $user = null ) {
244
+function give_count_purchases_of_customer($user = null) {
245 245
 
246 246
 	//Logged in?
247
-	if ( empty( $user ) ) {
247
+	if (empty($user)) {
248 248
 		$user = get_current_user_id();
249 249
 	}
250 250
 
251 251
 	//Email access?
252
-	if ( empty( $user ) && Give()->email_access->token_email ) {
252
+	if (empty($user) && Give()->email_access->token_email) {
253 253
 		$user = Give()->email_access->token_email;
254 254
 	}
255 255
 
256 256
 
257
-	$stats = ! empty( $user ) ? give_get_purchase_stats_by_user( $user ) : false;
257
+	$stats = ! empty($user) ? give_get_purchase_stats_by_user($user) : false;
258 258
 
259
-	return isset( $stats['purchases'] ) ? $stats['purchases'] : 0;
259
+	return isset($stats['purchases']) ? $stats['purchases'] : 0;
260 260
 }
261 261
 
262 262
 /**
@@ -269,9 +269,9 @@  discard block
 block discarded – undo
269 269
  *
270 270
  * @return      float - the total amount the user has spent
271 271
  */
272
-function give_purchase_total_of_user( $user = null ) {
272
+function give_purchase_total_of_user($user = null) {
273 273
 
274
-	$stats = give_get_purchase_stats_by_user( $user );
274
+	$stats = give_get_purchase_stats_by_user($user);
275 275
 
276 276
 	return $stats['total_spent'];
277 277
 }
@@ -287,11 +287,11 @@  discard block
 block discarded – undo
287 287
  *
288 288
  * @return      bool
289 289
  */
290
-function give_validate_username( $username ) {
291
-	$sanitized = sanitize_user( $username, false );
292
-	$valid     = ( $sanitized == $username );
290
+function give_validate_username($username) {
291
+	$sanitized = sanitize_user($username, false);
292
+	$valid     = ($sanitized == $username);
293 293
 
294
-	return (bool) apply_filters( 'give_validate_username', $valid, $username );
294
+	return (bool) apply_filters('give_validate_username', $valid, $username);
295 295
 }
296 296
 
297 297
 
@@ -308,32 +308,32 @@  discard block
 block discarded – undo
308 308
  *
309 309
  * @return      void
310 310
  */
311
-function give_add_past_purchases_to_new_user( $user_id ) {
311
+function give_add_past_purchases_to_new_user($user_id) {
312 312
 
313
-	$email = get_the_author_meta( 'user_email', $user_id );
313
+	$email = get_the_author_meta('user_email', $user_id);
314 314
 
315
-	$payments = give_get_payments( array( 's' => $email ) );
315
+	$payments = give_get_payments(array('s' => $email));
316 316
 
317
-	if ( $payments ) {
318
-		foreach ( $payments as $payment ) {
319
-			if ( intval( give_get_payment_user_id( $payment->ID ) ) > 0 ) {
317
+	if ($payments) {
318
+		foreach ($payments as $payment) {
319
+			if (intval(give_get_payment_user_id($payment->ID)) > 0) {
320 320
 				continue;
321 321
 			} // This payment already associated with an account
322 322
 
323
-			$meta                    = give_get_payment_meta( $payment->ID );
324
-			$meta['user_info']       = maybe_unserialize( $meta['user_info'] );
323
+			$meta                    = give_get_payment_meta($payment->ID);
324
+			$meta['user_info']       = maybe_unserialize($meta['user_info']);
325 325
 			$meta['user_info']['id'] = $user_id;
326 326
 			$meta['user_info']       = $meta['user_info'];
327 327
 
328 328
 			// Store the updated user ID in the payment meta
329
-			give_update_payment_meta( $payment->ID, '_give_payment_meta', $meta );
330
-			give_update_payment_meta( $payment->ID, '_give_payment_user_id', $user_id );
329
+			give_update_payment_meta($payment->ID, '_give_payment_meta', $meta);
330
+			give_update_payment_meta($payment->ID, '_give_payment_user_id', $user_id);
331 331
 		}
332 332
 	}
333 333
 
334 334
 }
335 335
 
336
-add_action( 'user_register', 'give_add_past_purchases_to_new_user' );
336
+add_action('user_register', 'give_add_past_purchases_to_new_user');
337 337
 
338 338
 
339 339
 /**
@@ -355,34 +355,34 @@  discard block
 block discarded – undo
355 355
  * @since         1.0
356 356
  * @return        array - The donor's address, if any
357 357
  */
358
-function give_get_donor_address( $user_id = 0 ) {
359
-	if ( empty( $user_id ) ) {
358
+function give_get_donor_address($user_id = 0) {
359
+	if (empty($user_id)) {
360 360
 		$user_id = get_current_user_id();
361 361
 	}
362 362
 
363
-	$address = get_user_meta( $user_id, '_give_user_address', true );
363
+	$address = get_user_meta($user_id, '_give_user_address', true);
364 364
 
365
-	if ( ! isset( $address['line1'] ) ) {
365
+	if ( ! isset($address['line1'])) {
366 366
 		$address['line1'] = '';
367 367
 	}
368 368
 
369
-	if ( ! isset( $address['line2'] ) ) {
369
+	if ( ! isset($address['line2'])) {
370 370
 		$address['line2'] = '';
371 371
 	}
372 372
 
373
-	if ( ! isset( $address['city'] ) ) {
373
+	if ( ! isset($address['city'])) {
374 374
 		$address['city'] = '';
375 375
 	}
376 376
 
377
-	if ( ! isset( $address['zip'] ) ) {
377
+	if ( ! isset($address['zip'])) {
378 378
 		$address['zip'] = '';
379 379
 	}
380 380
 
381
-	if ( ! isset( $address['country'] ) ) {
381
+	if ( ! isset($address['country'])) {
382 382
 		$address['country'] = '';
383 383
 	}
384 384
 
385
-	if ( ! isset( $address['state'] ) ) {
385
+	if ( ! isset($address['state'])) {
386 386
 		$address['state'] = '';
387 387
 	}
388 388
 
@@ -402,42 +402,42 @@  discard block
 block discarded – undo
402 402
  *
403 403
  * @return        void
404 404
  */
405
-function give_new_user_notification( $user_id = 0, $user_data = array() ) {
405
+function give_new_user_notification($user_id = 0, $user_data = array()) {
406 406
 
407
-	if ( empty( $user_id ) || empty( $user_data ) ) {
407
+	if (empty($user_id) || empty($user_data)) {
408 408
 		return;
409 409
 	}
410
-	$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
410
+	$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
411 411
 
412 412
 	/* translators: %s: site name */
413
-	$message  = sprintf( esc_attr__( 'New user registration on your site %s:' ), $blogname ) . "\r\n\r\n";
413
+	$message  = sprintf(esc_attr__('New user registration on your site %s:'), $blogname)."\r\n\r\n";
414 414
 	/* translators: %s: user login */
415
-	$message .= sprintf( esc_attr__( 'Username: %s' ), $user_data['user_login'] ) . "\r\n\r\n";
415
+	$message .= sprintf(esc_attr__('Username: %s'), $user_data['user_login'])."\r\n\r\n";
416 416
 	/* translators: %s: user email */
417
-	$message .= sprintf( esc_attr__( 'E-mail: %s' ), $user_data['user_email'] ) . "\r\n";
417
+	$message .= sprintf(esc_attr__('E-mail: %s'), $user_data['user_email'])."\r\n";
418 418
 
419 419
 	@wp_mail(
420
-		get_option( 'admin_email' ),
420
+		get_option('admin_email'),
421 421
 		sprintf(
422 422
 			/* translators: %s: site name */
423
-			esc_attr__( '[%s] New User Registration' ),
423
+			esc_attr__('[%s] New User Registration'),
424 424
 			$blogname
425 425
 		),
426 426
 		$message
427 427
 	);
428 428
 
429 429
 	/* translators: %s: user login */
430
-	$message  = sprintf( esc_attr__( 'Username: %s' ), $user_data['user_login'] ) . "\r\n";
430
+	$message  = sprintf(esc_attr__('Username: %s'), $user_data['user_login'])."\r\n";
431 431
 	/* translators: %s: paswword */
432
-	$message .= sprintf( esc_attr__( 'Password: %s' ), esc_attr__( '[Password entered during donation]', 'give' ) ) . "\r\n";
432
+	$message .= sprintf(esc_attr__('Password: %s'), esc_attr__('[Password entered during donation]', 'give'))."\r\n";
433 433
 
434
-	$message .= '<a href="' . wp_login_url() . '"> ' . esc_attr__( 'Click Here to Login', 'give' ) . ' &raquo;</a>' . "\r\n";
434
+	$message .= '<a href="'.wp_login_url().'"> '.esc_attr__('Click Here to Login', 'give').' &raquo;</a>'."\r\n";
435 435
 
436 436
 	wp_mail(
437 437
 		$user_data['user_email'],
438 438
 		sprintf(
439 439
 			/* translators: %s: site name */
440
-			esc_attr__( '[%s] Your username and password' ),
440
+			esc_attr__('[%s] Your username and password'),
441 441
 			$blogname
442 442
 		),
443 443
 		$message
@@ -445,4 +445,4 @@  discard block
 block discarded – undo
445 445
 
446 446
 }
447 447
 
448
-add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 );
448
+add_action('give_insert_user', 'give_new_user_notification', 10, 2);
Please login to merge, or discard this patch.
includes/actions.php 1 patch
Spacing   +7 added lines, -7 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,12 +23,12 @@  discard block
 block discarded – undo
23 23
  * @return void
24 24
  */
25 25
 function give_get_actions() {
26
-	if ( isset( $_GET['give_action'] ) ) {
27
-		do_action( 'give_' . $_GET['give_action'], $_GET );
26
+	if (isset($_GET['give_action'])) {
27
+		do_action('give_'.$_GET['give_action'], $_GET);
28 28
 	}
29 29
 }
30 30
 
31
-add_action( 'init', 'give_get_actions' );
31
+add_action('init', 'give_get_actions');
32 32
 
33 33
 /**
34 34
  * Hooks Give actions, when present in the $_POST superglobal. Every give_action
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
  * @return void
40 40
  */
41 41
 function give_post_actions() {
42
-	if ( isset( $_POST['give_action'] ) ) {
43
-		do_action( 'give_' . $_POST['give_action'], $_POST );
42
+	if (isset($_POST['give_action'])) {
43
+		do_action('give_'.$_POST['give_action'], $_POST);
44 44
 	}
45 45
 }
46 46
 
47
-add_action( 'init', 'give_post_actions' );
48 47
\ No newline at end of file
48
+add_action('init', 'give_post_actions');
49 49
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/admin-actions.php 1 patch
Spacing   +6 added lines, -6 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
 
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
  * @return void
23 23
  */
24 24
 function give_process_actions() {
25
-	if ( isset( $_POST['give-action'] ) ) {
26
-		do_action( 'give_' . $_POST['give-action'], $_POST );
25
+	if (isset($_POST['give-action'])) {
26
+		do_action('give_'.$_POST['give-action'], $_POST);
27 27
 	}
28 28
 
29
-	if ( isset( $_GET['give-action'] ) ) {
30
-		do_action( 'give_' . $_GET['give-action'], $_GET );
29
+	if (isset($_GET['give-action'])) {
30
+		do_action('give_'.$_GET['give-action'], $_GET);
31 31
 	}
32 32
 }
33 33
 
34
-add_action( 'admin_init', 'give_process_actions' );
35 34
\ No newline at end of file
35
+add_action('admin_init', 'give_process_actions');
36 36
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/admin-pages.php 1 patch
Spacing   +65 added lines, -65 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
 
@@ -34,31 +34,31 @@  discard block
 block discarded – undo
34 34
 	//	$give_campaigns_page = add_submenu_page( 'edit.php?post_type=give_forms', $give_campaigns->labels->menu_name, $give_campaigns->labels->add_new, 'edit_' . $give_campaigns->capability_type . 's', 'post-new.php?post_type=give_campaigns', null );
35 35
 
36 36
 	//Payments
37
-	$give_payment       = get_post_type_object( 'give_payment' );
38
-	$give_payments_page = add_submenu_page( 'edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page' );
37
+	$give_payment       = get_post_type_object('give_payment');
38
+	$give_payments_page = add_submenu_page('edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page');
39 39
 
40 40
 	//Donors
41
-	$give_donors_page = add_submenu_page( 'edit.php?post_type=give_forms', __( 'Donors', 'give' ), __( 'Donors', 'give' ), 'view_give_reports', 'give-donors', 'give_customers_page' );
41
+	$give_donors_page = add_submenu_page('edit.php?post_type=give_forms', __('Donors', 'give'), __('Donors', 'give'), 'view_give_reports', 'give-donors', 'give_customers_page');
42 42
 
43 43
 	//Reports
44
-	$give_reports_page = add_submenu_page( 'edit.php?post_type=give_forms', __( 'Donation Reports', 'give' ), __( 'Reports', 'give' ), 'view_give_reports', 'give-reports', 'give_reports_page' );
44
+	$give_reports_page = add_submenu_page('edit.php?post_type=give_forms', __('Donation Reports', 'give'), __('Reports', 'give'), 'view_give_reports', 'give-reports', 'give_reports_page');
45 45
 
46 46
 	//Settings
47
-	$give_settings_page = add_submenu_page( 'edit.php?post_type=give_forms', __( 'Give Settings', 'give' ), __( 'Settings', 'give' ), 'manage_give_settings', 'give-settings', array(
47
+	$give_settings_page = add_submenu_page('edit.php?post_type=give_forms', __('Give Settings', 'give'), __('Settings', 'give'), 'manage_give_settings', 'give-settings', array(
48 48
 		Give()->give_settings,
49 49
 		'admin_page_display'
50
-	) );
50
+	));
51 51
 
52 52
 	//Add-ons
53
-	$give_add_ons_page = add_submenu_page( 'edit.php?post_type=give_forms', __( 'Give Add-ons', 'give' ), __( 'Add-ons', 'give' ), 'install_plugins', 'give-addons', 'give_add_ons_page' );
53
+	$give_add_ons_page = add_submenu_page('edit.php?post_type=give_forms', __('Give Add-ons', 'give'), __('Add-ons', 'give'), 'install_plugins', 'give-addons', 'give_add_ons_page');
54 54
 
55 55
 	//Upgrades
56
-	$give_upgrades_screen = add_submenu_page( null, __( 'Give Upgrades', 'give' ), __( 'Give Upgrades', 'give' ), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen' );
56
+	$give_upgrades_screen = add_submenu_page(null, __('Give Upgrades', 'give'), __('Give Upgrades', 'give'), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen');
57 57
 
58 58
 
59 59
 }
60 60
 
61
-add_action( 'admin_menu', 'give_add_options_links', 10 );
61
+add_action('admin_menu', 'give_add_options_links', 10);
62 62
 
63 63
 /**
64 64
  *  Determines whether the current admin page is a Give admin page.
@@ -73,224 +73,224 @@  discard block
 block discarded – undo
73 73
  *
74 74
  * @return bool True if Give admin page.
75 75
  */
76
-function give_is_admin_page( $passed_page = '', $passed_view = '' ) {
76
+function give_is_admin_page($passed_page = '', $passed_view = '') {
77 77
 
78 78
 	global $pagenow, $typenow;
79 79
 
80 80
 	$found     = false;
81
-	$post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false;
82
-	$action    = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false;
83
-	$taxonomy  = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false;
84
-	$page      = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false;
85
-	$view      = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false;
86
-	$tab       = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false;
81
+	$post_type = isset($_GET['post_type']) ? strtolower($_GET['post_type']) : false;
82
+	$action    = isset($_GET['action']) ? strtolower($_GET['action']) : false;
83
+	$taxonomy  = isset($_GET['taxonomy']) ? strtolower($_GET['taxonomy']) : false;
84
+	$page      = isset($_GET['page']) ? strtolower($_GET['page']) : false;
85
+	$view      = isset($_GET['view']) ? strtolower($_GET['view']) : false;
86
+	$tab       = isset($_GET['tab']) ? strtolower($_GET['tab']) : false;
87 87
 
88
-	switch ( $passed_page ) {
88
+	switch ($passed_page) {
89 89
 		case 'give_forms':
90
-			switch ( $passed_view ) {
90
+			switch ($passed_view) {
91 91
 				case 'list-table':
92
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' ) {
92
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php') {
93 93
 						$found = true;
94 94
 					}
95 95
 					break;
96 96
 				case 'edit':
97
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post.php' ) {
97
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post.php') {
98 98
 						$found = true;
99 99
 					}
100 100
 					break;
101 101
 				case 'new':
102
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post-new.php' ) {
102
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post-new.php') {
103 103
 						$found = true;
104 104
 					}
105 105
 					break;
106 106
 				default:
107
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) || 'give_forms' === $post_type || ( 'post-new.php' == $pagenow && 'give_forms' === $post_type ) ) {
107
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) || 'give_forms' === $post_type || ('post-new.php' == $pagenow && 'give_forms' === $post_type)) {
108 108
 						$found = true;
109 109
 					}
110 110
 					break;
111 111
 			}
112 112
 			break;
113 113
 		case 'categories':
114
-			switch ( $passed_view ) {
114
+			switch ($passed_view) {
115 115
 				case 'list-table':
116 116
 				case 'new':
117
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy ) {
117
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy) {
118 118
 						$found = true;
119 119
 					}
120 120
 					break;
121 121
 				case 'edit':
122
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy ) {
122
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy) {
123 123
 						$found = true;
124 124
 					}
125 125
 					break;
126 126
 				default:
127
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy ) {
127
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy) {
128 128
 						$found = true;
129 129
 					}
130 130
 					break;
131 131
 			}
132 132
 			break;
133 133
 		case 'tags':
134
-			switch ( $passed_view ) {
134
+			switch ($passed_view) {
135 135
 				case 'list-table':
136 136
 				case 'new':
137
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy ) {
137
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy) {
138 138
 						$found = true;
139 139
 					}
140 140
 					break;
141 141
 				case 'edit':
142
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy ) {
142
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy) {
143 143
 						$found = true;
144 144
 					}
145 145
 					break;
146 146
 				default:
147
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy ) {
147
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy) {
148 148
 						$found = true;
149 149
 					}
150 150
 					break;
151 151
 			}
152 152
 			break;
153 153
 		case 'payments':
154
-			switch ( $passed_view ) {
154
+			switch ($passed_view) {
155 155
 				case 'list-table':
156
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view ) {
156
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view) {
157 157
 						$found = true;
158 158
 					}
159 159
 					break;
160 160
 				case 'edit':
161
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view ) {
161
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view) {
162 162
 						$found = true;
163 163
 					}
164 164
 					break;
165 165
 				default:
166
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page ) {
166
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page) {
167 167
 						$found = true;
168 168
 					}
169 169
 					break;
170 170
 			}
171 171
 			break;
172 172
 		case 'reports':
173
-			switch ( $passed_view ) {
173
+			switch ($passed_view) {
174 174
 				// If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ]
175 175
 				case 'earnings':
176
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) {
176
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && ('earnings' === $view || '-1' === $view || false === $view)) {
177 177
 						$found = true;
178 178
 					}
179 179
 					break;
180 180
 				case 'donors':
181
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view ) {
181
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view) {
182 182
 						$found = true;
183 183
 					}
184 184
 					break;
185 185
 				case 'gateways':
186
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view ) {
186
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view) {
187 187
 						$found = true;
188 188
 					}
189 189
 					break;
190 190
 				case 'export':
191
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view ) {
191
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view) {
192 192
 						$found = true;
193 193
 					}
194 194
 					break;
195 195
 				case 'logs':
196
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view ) {
196
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view) {
197 197
 						$found = true;
198 198
 					}
199 199
 					break;
200 200
 				default:
201
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) {
201
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) {
202 202
 						$found = true;
203 203
 					}
204 204
 					break;
205 205
 			}
206 206
 			break;
207 207
 		case 'settings':
208
-			switch ( $passed_view ) {
208
+			switch ($passed_view) {
209 209
 				case 'general':
210
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && ( 'general' === $tab || false === $tab ) ) {
210
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && ('general' === $tab || false === $tab)) {
211 211
 						$found = true;
212 212
 					}
213 213
 					break;
214 214
 				case 'gateways':
215
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab ) {
215
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab) {
216 216
 						$found = true;
217 217
 					}
218 218
 					break;
219 219
 				case 'emails':
220
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab ) {
220
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab) {
221 221
 						$found = true;
222 222
 					}
223 223
 					break;
224 224
 				case 'display':
225
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab ) {
225
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab) {
226 226
 						$found = true;
227 227
 					}
228 228
 					break;
229 229
 				case 'licenses':
230
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab ) {
230
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab) {
231 231
 						$found = true;
232 232
 					}
233 233
 					break;
234 234
 				case 'api':
235
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab ) {
235
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab) {
236 236
 						$found = true;
237 237
 					}
238 238
 					break;
239 239
 				case 'advanced':
240
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab ) {
240
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab) {
241 241
 						$found = true;
242 242
 					}
243 243
 					break;
244 244
 				case 'system_info':
245
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab ) {
245
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab) {
246 246
 						$found = true;
247 247
 					}
248 248
 					break;
249 249
 				default:
250
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page ) {
250
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page) {
251 251
 						$found = true;
252 252
 					}
253 253
 					break;
254 254
 			}
255 255
 			break;
256 256
 		case 'addons':
257
-			if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-addons' === $page ) {
257
+			if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-addons' === $page) {
258 258
 				$found = true;
259 259
 			}
260 260
 			break;
261 261
 		case 'donors':
262
-			switch ( $passed_view ) {
262
+			switch ($passed_view) {
263 263
 				case 'list-table':
264
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view ) {
264
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view) {
265 265
 						$found = true;
266 266
 					}
267 267
 					break;
268 268
 				case 'overview':
269
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view ) {
269
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view) {
270 270
 						$found = true;
271 271
 					}
272 272
 					break;
273 273
 				case 'notes':
274
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view ) {
274
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view) {
275 275
 						$found = true;
276 276
 					}
277 277
 					break;
278 278
 				default:
279
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page ) {
279
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page) {
280 280
 						$found = true;
281 281
 					}
282 282
 					break;
283 283
 			}
284 284
 			break;
285 285
 		case 'reports':
286
-			if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) {
286
+			if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) {
287 287
 				$found = true;
288 288
 			}
289 289
 			break;
290 290
 		default:
291 291
 			global $give_payments_page, $give_settings_page, $give_reports_page, $give_system_info_page, $give_add_ons_page, $give_settings_export, $give_upgrades_screen, $give_customers_page;
292 292
 
293
-			$admin_pages = apply_filters( 'give_admin_pages', array(
293
+			$admin_pages = apply_filters('give_admin_pages', array(
294 294
 				$give_payments_page,
295 295
 				$give_settings_page,
296 296
 				$give_reports_page,
@@ -299,18 +299,18 @@  discard block
 block discarded – undo
299 299
 				$give_upgrades_screen,
300 300
 				$give_settings_export,
301 301
 				$give_customers_page
302
-			) );
303
-			if ( 'give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) {
302
+			));
303
+			if ('give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow) {
304 304
 				$found = true;
305
-				if ( 'give-upgrades' === $page ) {
305
+				if ('give-upgrades' === $page) {
306 306
 					$found = false;
307 307
 				}
308
-			} elseif ( in_array( $pagenow, $admin_pages ) ) {
308
+			} elseif (in_array($pagenow, $admin_pages)) {
309 309
 				$found = true;
310 310
 			}
311 311
 			break;
312 312
 	}
313 313
 
314
-	return (bool) apply_filters( 'give_is_admin_page', $found, $page, $view, $passed_page, $passed_view );
314
+	return (bool) apply_filters('give_is_admin_page', $found, $page, $view, $passed_page, $passed_view);
315 315
 
316 316
 }
317 317
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/customers/customer-functions.php 1 patch
Spacing   +12 added lines, -12 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,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array        The altered list of views
25 25
  */
26
-function give_register_default_customer_views( $views ) {
26
+function give_register_default_customer_views($views) {
27 27
 
28 28
 	$default_views = array(
29 29
 		'overview' => 'give_customers_view',
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 		'notes'    => 'give_customer_notes_view'
32 32
 	);
33 33
 
34
-	return array_merge( $views, $default_views );
34
+	return array_merge($views, $default_views);
35 35
 
36 36
 }
37 37
 
38
-add_filter( 'give_customer_views', 'give_register_default_customer_views', 1, 1 );
38
+add_filter('give_customer_views', 'give_register_default_customer_views', 1, 1);
39 39
 
40 40
 /**
41 41
  * Register a tab for the single customer view
@@ -46,17 +46,17 @@  discard block
 block discarded – undo
46 46
  *
47 47
  * @return array       The altered list of tabs
48 48
  */
49
-function give_register_default_customer_tabs( $tabs ) {
49
+function give_register_default_customer_tabs($tabs) {
50 50
 
51 51
 	$default_tabs = array(
52
-		'overview' => array( 'dashicon' => 'dashicons-admin-users', 'title' => __( 'Donor Profile', 'give' ) ),
53
-		'notes'    => array( 'dashicon' => 'dashicons-admin-comments', 'title' => __( 'Donor Notes', 'give' ) )
52
+		'overview' => array('dashicon' => 'dashicons-admin-users', 'title' => __('Donor Profile', 'give')),
53
+		'notes'    => array('dashicon' => 'dashicons-admin-comments', 'title' => __('Donor Notes', 'give'))
54 54
 	);
55 55
 
56
-	return array_merge( $tabs, $default_tabs );
56
+	return array_merge($tabs, $default_tabs);
57 57
 }
58 58
 
59
-add_filter( 'give_customer_tabs', 'give_register_default_customer_tabs', 1, 1 );
59
+add_filter('give_customer_tabs', 'give_register_default_customer_tabs', 1, 1);
60 60
 
61 61
 /**
62 62
  * Register the Delete icon as late as possible so it's at the bottom
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @return array       The altered list of tabs, with 'delete' at the bottom
69 69
  */
70
-function give_register_delete_customer_tab( $tabs ) {
70
+function give_register_delete_customer_tab($tabs) {
71 71
 
72
-	$tabs['delete'] = array( 'dashicon' => 'dashicons-trash', 'title' => __( 'Delete Donor', 'give' ) );
72
+	$tabs['delete'] = array('dashicon' => 'dashicons-trash', 'title' => __('Delete Donor', 'give'));
73 73
 
74 74
 	return $tabs;
75 75
 }
76 76
 
77
-add_filter( 'give_customer_tabs', 'give_register_delete_customer_tab', PHP_INT_MAX, 1 );
77
+add_filter('give_customer_tabs', 'give_register_delete_customer_tab', PHP_INT_MAX, 1);
Please login to merge, or discard this patch.
includes/admin/payments/payments-history.php 2 patches
Spacing   +21 added lines, -21 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' ) ) exit;
13
+if ( ! defined('ABSPATH')) exit;
14 14
 
15 15
 /**
16 16
  * Payment History Page
@@ -24,19 +24,19 @@  discard block
 block discarded – undo
24 24
 function give_payment_history_page() {
25 25
 	global $give_options;
26 26
 
27
-	$give_payment = get_post_type_object( 'give_payment' );
27
+	$give_payment = get_post_type_object('give_payment');
28 28
 
29
-	if ( isset( $_GET['view'] ) && 'view-order-details' == $_GET['view'] ) {
30
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/view-order-details.php';
29
+	if (isset($_GET['view']) && 'view-order-details' == $_GET['view']) {
30
+		require_once GIVE_PLUGIN_DIR.'includes/admin/payments/view-order-details.php';
31 31
 	} else {
32
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/class-payments-table.php';
32
+		require_once GIVE_PLUGIN_DIR.'includes/admin/payments/class-payments-table.php';
33 33
 		$payments_table = new Give_Payment_History_Table();
34 34
 		$payments_table->prepare_items();
35 35
 	?>
36 36
 	<div class="wrap">
37 37
 		<h2><?php echo $give_payment->labels->menu_name ?></h2>
38
-		<?php do_action( 'give_payments_page_top' ); ?>
39
-		<form id="give-payments-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>">
38
+		<?php do_action('give_payments_page_top'); ?>
39
+		<form id="give-payments-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>">
40 40
 			<input type="hidden" name="post_type" value="give_forms" />
41 41
 			<input type="hidden" name="page" value="give-payment-history" />
42 42
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 			
47 47
 			<?php $payments_table->display() ?>
48 48
 		</form>
49
-		<?php do_action( 'give_payments_page_bottom' ); ?>
49
+		<?php do_action('give_payments_page_bottom'); ?>
50 50
 	</div>
51 51
 <?php
52 52
 	}
@@ -61,21 +61,21 @@  discard block
 block discarded – undo
61 61
  * @param $title
62 62
  * @return string
63 63
  */
64
-function give_view_order_details_title( $admin_title, $title ) {
64
+function give_view_order_details_title($admin_title, $title) {
65 65
 
66
-	if ( 'give_forms_page_give-payment-history' != get_current_screen()->base )
66
+	if ('give_forms_page_give-payment-history' != get_current_screen()->base)
67 67
 		return $admin_title;
68 68
 
69
-	if( ! isset( $_GET['give-action'] ) )
69
+	if ( ! isset($_GET['give-action']))
70 70
 		return $admin_title;
71 71
 
72
-	switch( $_GET['give-action'] ) :
72
+	switch ($_GET['give-action']) :
73 73
 
74 74
 		case 'view-order-details' :
75
-			$title = __( 'View Donation Details', 'give' ) . ' - ' . $admin_title;
75
+			$title = __('View Donation Details', 'give').' - '.$admin_title;
76 76
 			break;
77 77
 		case 'edit-payment' :
78
-			$title = __( 'Edit Payment', 'give' ) . ' - ' . $admin_title;
78
+			$title = __('Edit Payment', 'give').' - '.$admin_title;
79 79
 			break;
80 80
 		default:
81 81
 			$title = $admin_title;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
 	return $title;
86 86
 }
87
-add_filter( 'admin_title', 'give_view_order_details_title', 10, 2 );
87
+add_filter('admin_title', 'give_view_order_details_title', 10, 2);
88 88
 
89 89
 /**
90 90
  * Intercept default Edit post links for Give payments and rewrite them to the View Order Details screen
@@ -96,17 +96,17 @@  discard block
 block discarded – undo
96 96
  * @param $context
97 97
  * @return string
98 98
  */
99
-function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) {
99
+function give_override_edit_post_for_payment_link($url, $post_id = 0, $context) {
100 100
 
101
-	$post = get_post( $post_id );
102
-	if( ! $post )
101
+	$post = get_post($post_id);
102
+	if ( ! $post)
103 103
 		return $url;
104 104
 
105
-	if( 'give_payment' != $post->post_type )
105
+	if ('give_payment' != $post->post_type)
106 106
 		return $url;
107 107
 
108
-	$url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $post_id );
108
+	$url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$post_id);
109 109
 
110 110
 	return $url;
111 111
 }
112
-add_filter( 'get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3 );
112
+add_filter('get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3);
Please login to merge, or discard this patch.
Braces   +15 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
10 10
 */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) exit;
13
+if ( ! defined( 'ABSPATH' ) ) {
14
+	exit;
15
+}
14 16
 
15 17
 /**
16 18
  * Payment History Page
@@ -63,11 +65,13 @@  discard block
 block discarded – undo
63 65
  */
64 66
 function give_view_order_details_title( $admin_title, $title ) {
65 67
 
66
-	if ( 'give_forms_page_give-payment-history' != get_current_screen()->base )
67
-		return $admin_title;
68
+	if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) {
69
+			return $admin_title;
70
+	}
68 71
 
69
-	if( ! isset( $_GET['give-action'] ) )
70
-		return $admin_title;
72
+	if( ! isset( $_GET['give-action'] ) ) {
73
+			return $admin_title;
74
+	}
71 75
 
72 76
 	switch( $_GET['give-action'] ) :
73 77
 
@@ -99,11 +103,13 @@  discard block
 block discarded – undo
99 103
 function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) {
100 104
 
101 105
 	$post = get_post( $post_id );
102
-	if( ! $post )
103
-		return $url;
106
+	if( ! $post ) {
107
+			return $url;
108
+	}
104 109
 
105
-	if( 'give_payment' != $post->post_type )
106
-		return $url;
110
+	if( 'give_payment' != $post->post_type ) {
111
+			return $url;
112
+	}
107 113
 
108 114
 	$url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $post_id );
109 115
 
Please login to merge, or discard this patch.
includes/admin/payments/view-order-details.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -440,8 +440,10 @@
 block discarded – undo
440 440
 												echo give_get_payment_note_html( $note, $payment_id );
441 441
 
442 442
 											endforeach;
443
-										else :
443
+										else {
444
+											:
444 445
 											$no_notes_display = '';
446
+										}
445 447
 										endif;
446 448
 										echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . __( 'No payment notes', 'give' ) . '</p>';
447 449
 										?>
Please login to merge, or discard this patch.
Spacing   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -20,27 +20,27 @@  discard block
 block discarded – undo
20 20
  * @since 1.0
21 21
  * @return void
22 22
  */
23
-if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
24
-	wp_die( __( 'Donation ID not supplied. Please try again', 'give' ), __( 'Error', 'give' ) );
23
+if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
24
+	wp_die(__('Donation ID not supplied. Please try again', 'give'), __('Error', 'give'));
25 25
 }
26 26
 
27 27
 // Setup the variables
28
-$payment_id = absint( $_GET['id'] );
29
-$payment    = new Give_Payment( $payment_id );
28
+$payment_id = absint($_GET['id']);
29
+$payment    = new Give_Payment($payment_id);
30 30
 
31 31
 // Sanity check... fail if purchase ID is invalid
32 32
 $payment_exists = $payment->ID;
33
-if ( empty( $payment_exists ) ) {
34
-	wp_die( __( 'The specified ID does not belong to a payment. Please try again', 'give' ), __( 'Error', 'give' ) );
33
+if (empty($payment_exists)) {
34
+	wp_die(__('The specified ID does not belong to a payment. Please try again', 'give'), __('Error', 'give'));
35 35
 }
36 36
 
37 37
 $number         = $payment->number;
38 38
 $payment_meta   = $payment->get_meta();
39
-$transaction_id = esc_attr( $payment->transaction_id );
39
+$transaction_id = esc_attr($payment->transaction_id);
40 40
 $user_id        = $payment->user_id;
41 41
 $customer_id    = $payment->customer_id;
42
-$payment_date   = strtotime( $payment->date );
43
-$user_info      = give_get_payment_meta_user_info( $payment_id );
42
+$payment_date   = strtotime($payment->date);
43
+$user_info      = give_get_payment_meta_user_info($payment_id);
44 44
 $address        = $payment->address;
45 45
 $gateway        = $payment->gateway;
46 46
 $currency_code  = $payment->currency;
@@ -52,76 +52,76 @@  discard block
 block discarded – undo
52 52
 	<h1 id="transaction-details-heading"><?php
53 53
 		printf(
54 54
 		/* translators: %s: payment number */
55
-			__( 'Payment %s', 'give' ),
55
+			__('Payment %s', 'give'),
56 56
 			$number
57 57
 		);
58
-		if ( $payment_mode == 'test' ) {
59
-			echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="' . __( 'This payment was made in Test Mode', 'give' ) . '" data-tooltip-my-position="center left" data-tooltip-target-position="center right">' . __( 'Test Payment', 'give' ) . '</span>';
58
+		if ($payment_mode == 'test') {
59
+			echo '<span id="test-payment-label" class="give-item-label give-item-label-orange" data-tooltip="'.__('This payment was made in Test Mode', 'give').'" data-tooltip-my-position="center left" data-tooltip-target-position="center right">'.__('Test Payment', 'give').'</span>';
60 60
 		}
61 61
 		?></h1>
62 62
 
63
-	<?php do_action( 'give_view_order_details_before', $payment_id ); ?>
63
+	<?php do_action('give_view_order_details_before', $payment_id); ?>
64 64
 	<form id="give-edit-order-form" method="post">
65
-		<?php do_action( 'give_view_order_details_form_top', $payment_id ); ?>
65
+		<?php do_action('give_view_order_details_form_top', $payment_id); ?>
66 66
 		<div id="poststuff">
67 67
 			<div id="give-dashboard-widgets-wrap">
68 68
 				<div id="post-body" class="metabox-holder columns-2">
69 69
 					<div id="postbox-container-1" class="postbox-container">
70 70
 						<div id="side-sortables" class="meta-box-sortables ui-sortable">
71 71
 
72
-							<?php do_action( 'give_view_order_details_sidebar_before', $payment_id ); ?>
72
+							<?php do_action('give_view_order_details_sidebar_before', $payment_id); ?>
73 73
 
74 74
 
75 75
 							<div id="give-order-update" class="postbox give-order-data">
76 76
 
77 77
 								<h3 class="hndle">
78
-									<span><?php _e( 'Update Payment', 'give' ); ?></span>
78
+									<span><?php _e('Update Payment', 'give'); ?></span>
79 79
 								</h3>
80 80
 
81 81
 								<div class="inside">
82 82
 									<div class="give-admin-box">
83 83
 
84
-										<?php do_action( 'give_view_order_details_totals_before', $payment_id ); ?>
84
+										<?php do_action('give_view_order_details_totals_before', $payment_id); ?>
85 85
 
86 86
 										<div class="give-admin-box-inside">
87 87
 											<p>
88
-												<span class="label"><?php _e( 'Status:', 'give' ); ?></span>&nbsp;
88
+												<span class="label"><?php _e('Status:', 'give'); ?></span>&nbsp;
89 89
 												<select name="give-payment-status" class="medium-text">
90
-													<?php foreach ( give_get_payment_statuses() as $key => $status ) : ?>
91
-														<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option>
90
+													<?php foreach (give_get_payment_statuses() as $key => $status) : ?>
91
+														<option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option>
92 92
 													<?php endforeach; ?>
93 93
 												</select>
94
-												<span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span>
94
+												<span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span>
95 95
 											</p>
96 96
 										</div>
97 97
 
98 98
 										<div class="give-admin-box-inside">
99 99
 											<p>
100
-												<span class="label"><?php _e( 'Date:', 'give' ); ?></span>&nbsp;
101
-												<input type="text" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/>
100
+												<span class="label"><?php _e('Date:', 'give'); ?></span>&nbsp;
101
+												<input type="text" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/>
102 102
 											</p>
103 103
 										</div>
104 104
 
105 105
 										<div class="give-admin-box-inside">
106 106
 											<p>
107
-												<span class="label"><?php _e( 'Time:', 'give' ); ?></span>&nbsp;
108
-												<input type="number" step="1" max="24" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
109
-												<input type="number" step="1" max="59" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/>
107
+												<span class="label"><?php _e('Time:', 'give'); ?></span>&nbsp;
108
+												<input type="number" step="1" max="24" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
109
+												<input type="number" step="1" max="59" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/>
110 110
 											</p>
111 111
 										</div>
112 112
 
113
-										<?php do_action( 'give_view_order_details_update_inner', $payment_id ); ?>
113
+										<?php do_action('give_view_order_details_update_inner', $payment_id); ?>
114 114
 
115 115
 										<?php
116 116
 										//@TODO: Fees
117
-										$fees = give_get_payment_fees( $payment_id );
118
-										if ( ! empty( $fees ) ) : ?>
117
+										$fees = give_get_payment_fees($payment_id);
118
+										if ( ! empty($fees)) : ?>
119 119
 											<div class="give-order-fees give-admin-box-inside">
120
-												<p class="strong"><?php _e( 'Fees', 'give' ); ?>:</p>
120
+												<p class="strong"><?php _e('Fees', 'give'); ?>:</p>
121 121
 												<ul class="give-payment-fees">
122
-													<?php foreach ( $fees as $fee ) : ?>
122
+													<?php foreach ($fees as $fee) : ?>
123 123
 														<li>
124
-															<span class="fee-label"><?php echo $fee['label'] . ':</span> ' . '<span class="fee-amount" data-fee="' . esc_attr( $fee['amount'] ) . '">' . give_currency_filter( $fee['amount'], $currency_code ); ?></span>
124
+															<span class="fee-label"><?php echo $fee['label'].':</span> '.'<span class="fee-amount" data-fee="'.esc_attr($fee['amount']).'">'.give_currency_filter($fee['amount'], $currency_code); ?></span>
125 125
 														</li>
126 126
 													<?php endforeach; ?>
127 127
 												</ul>
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
 
132 132
 										<div class="give-order-payment give-admin-box-inside">
133 133
 											<p>
134
-												<span class="label"><?php _e( 'Total Donation', 'give' ); ?>:</span>&nbsp;
135
-												<?php echo give_currency_symbol( $payment->currency ); ?>&nbsp;<input name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_get_payment_amount( $payment_id ) ) ); ?>"/>
134
+												<span class="label"><?php _e('Total Donation', 'give'); ?>:</span>&nbsp;
135
+												<?php echo give_currency_symbol($payment->currency); ?>&nbsp;<input name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_get_payment_amount($payment_id))); ?>"/>
136 136
 											</p>
137 137
 										</div>
138 138
 
139
-										<?php do_action( 'give_view_order_details_totals_after', $payment_id ); ?>
139
+										<?php do_action('give_view_order_details_totals_after', $payment_id); ?>
140 140
 
141 141
 									</div>
142 142
 									<!-- /.give-admin-box -->
@@ -145,20 +145,20 @@  discard block
 block discarded – undo
145 145
 								<!-- /.inside -->
146 146
 
147 147
 								<div class="give-order-update-box give-admin-box">
148
-									<?php do_action( 'give_view_order_details_update_before', $payment_id ); ?>
148
+									<?php do_action('give_view_order_details_update_before', $payment_id); ?>
149 149
 									<div id="major-publishing-actions">
150 150
 										<div id="publishing-action">
151
-											<input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Payment', 'give' ); ?>"/>
152
-											<?php if ( give_is_payment_complete( $payment_id ) ) : ?>
153
-												<a href="<?php echo esc_url( add_query_arg( array(
151
+											<input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Payment', 'give'); ?>"/>
152
+											<?php if (give_is_payment_complete($payment_id)) : ?>
153
+												<a href="<?php echo esc_url(add_query_arg(array(
154 154
 													'give-action' => 'email_links',
155 155
 													'purchase_id' => $payment_id
156
-												) ) ); ?>" id="give-resend-receipt" class="button-secondary right"><?php _e( 'Resend Receipt', 'give' ); ?></a>
156
+												))); ?>" id="give-resend-receipt" class="button-secondary right"><?php _e('Resend Receipt', 'give'); ?></a>
157 157
 											<?php endif; ?>
158 158
 										</div>
159 159
 										<div class="clear"></div>
160 160
 									</div>
161
-									<?php do_action( 'give_view_order_details_update_after', $payment_id ); ?>
161
+									<?php do_action('give_view_order_details_update_after', $payment_id); ?>
162 162
 								</div>
163 163
 								<!-- /.give-order-update-box -->
164 164
 
@@ -168,55 +168,55 @@  discard block
 block discarded – undo
168 168
 							<div id="give-order-details" class="postbox give-order-data">
169 169
 
170 170
 								<h3 class="hndle">
171
-									<span><?php _e( 'Payment Meta', 'give' ); ?></span>
171
+									<span><?php _e('Payment Meta', 'give'); ?></span>
172 172
 								</h3>
173 173
 
174 174
 								<div class="inside">
175 175
 									<div class="give-admin-box">
176 176
 
177
-										<?php do_action( 'give_view_order_details_payment_meta_before', $payment_id ); ?>
177
+										<?php do_action('give_view_order_details_payment_meta_before', $payment_id); ?>
178 178
 
179 179
 										<?php
180
-										$gateway = give_get_payment_gateway( $payment_id );
181
-										if ( $gateway ) : ?>
180
+										$gateway = give_get_payment_gateway($payment_id);
181
+										if ($gateway) : ?>
182 182
 											<div class="give-order-gateway give-admin-box-inside">
183 183
 												<p>
184
-													<span class="label"><?php _e( 'Gateway:', 'give' ); ?></span>&nbsp;
185
-													<?php echo give_get_gateway_admin_label( $gateway ); ?>
184
+													<span class="label"><?php _e('Gateway:', 'give'); ?></span>&nbsp;
185
+													<?php echo give_get_gateway_admin_label($gateway); ?>
186 186
 												</p>
187 187
 											</div>
188 188
 										<?php endif; ?>
189 189
 
190 190
 										<div class="give-order-payment-key give-admin-box-inside">
191 191
 											<p>
192
-												<span class="label"><?php _e( 'Key:', 'give' ); ?></span>&nbsp;
193
-												<span><?php echo give_get_payment_key( $payment_id ); ?></span>
192
+												<span class="label"><?php _e('Key:', 'give'); ?></span>&nbsp;
193
+												<span><?php echo give_get_payment_key($payment_id); ?></span>
194 194
 											</p>
195 195
 										</div>
196 196
 
197 197
 										<div class="give-order-ip give-admin-box-inside">
198 198
 											<p>
199
-												<span class="label"><?php _e( 'IP:', 'give' ); ?></span>&nbsp;
200
-												<span><?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?></span>
199
+												<span class="label"><?php _e('IP:', 'give'); ?></span>&nbsp;
200
+												<span><?php echo esc_html(give_get_payment_user_ip($payment_id)); ?></span>
201 201
 											</p>
202 202
 										</div>
203 203
 
204
-										<?php if ( $transaction_id ) : ?>
204
+										<?php if ($transaction_id) : ?>
205 205
 											<div class="give-order-tx-id give-admin-box-inside">
206 206
 												<p>
207
-													<span class="label"><?php _e( 'Transaction ID:', 'give' ); ?></span>&nbsp;
208
-													<span><?php echo apply_filters( 'give_payment_details_transaction_id-' . $gateway, $transaction_id, $payment_id ); ?></span>
207
+													<span class="label"><?php _e('Transaction ID:', 'give'); ?></span>&nbsp;
208
+													<span><?php echo apply_filters('give_payment_details_transaction_id-'.$gateway, $transaction_id, $payment_id); ?></span>
209 209
 												</p>
210 210
 											</div>
211 211
 										<?php endif; ?>
212 212
 
213 213
 										<div class="give-admin-box-inside">
214
-											<p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( esc_attr( give_get_payment_user_email( $payment_id ) ) ) ); ?>
215
-												<a href="<?php echo $purchase_url; ?>"><?php _e( 'View all donations for this donor', 'give' ); ?> &raquo;</a>
214
+											<p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode(esc_attr(give_get_payment_user_email($payment_id)))); ?>
215
+												<a href="<?php echo $purchase_url; ?>"><?php _e('View all donations for this donor', 'give'); ?> &raquo;</a>
216 216
 											</p>
217 217
 										</div>
218 218
 
219
-										<?php do_action( 'give_view_order_details_payment_meta_after', $payment_id ); ?>
219
+										<?php do_action('give_view_order_details_payment_meta_after', $payment_id); ?>
220 220
 
221 221
 									</div>
222 222
 									<!-- /.column-container -->
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 							</div>
228 228
 							<!-- /#give-order-data -->
229 229
 
230
-							<?php do_action( 'give_view_order_details_sidebar_after', $payment_id ); ?>
230
+							<?php do_action('give_view_order_details_sidebar_after', $payment_id); ?>
231 231
 
232 232
 						</div>
233 233
 						<!-- /#side-sortables -->
@@ -238,12 +238,12 @@  discard block
 block discarded – undo
238 238
 
239 239
 						<div id="normal-sortables" class="meta-box-sortables ui-sortable">
240 240
 
241
-							<?php do_action( 'give_view_order_details_main_before', $payment_id ); ?>
241
+							<?php do_action('give_view_order_details_main_before', $payment_id); ?>
242 242
 
243 243
 							<?php $column_count = 'columns-3'; ?>
244 244
 							<div id="give-donation-overview" class="postbox <?php echo $column_count; ?>">
245 245
 								<h3 class="hndle">
246
-									<span><?php _e( 'Donation Information', 'give' ); ?></span>
246
+									<span><?php _e('Donation Information', 'give'); ?></span>
247 247
 								</h3>
248 248
 
249 249
 								<div class="inside">
@@ -251,31 +251,31 @@  discard block
 block discarded – undo
251 251
 									<table style="width:100%;text-align:left;">
252 252
 										<thead>
253 253
 										<tr>
254
-											<?php do_action( 'give_donation_details_thead_before', $payment_id ); ?>
255
-											<th><?php _e( 'Donation Form ID', 'give' ) ?></th>
256
-											<th><?php _e( 'Donation Form Title', 'give' ) ?></th>
257
-											<th><?php _e( 'Donation Level', 'give' ) ?></th>
258
-											<th><?php _e( 'Donation Date', 'give' ) ?></th>
259
-											<th><?php _e( 'Total Donation', 'give' ) ?></th>
260
-											<?php do_action( 'give_donation_details_thead_after', $payment_id ); ?>
254
+											<?php do_action('give_donation_details_thead_before', $payment_id); ?>
255
+											<th><?php _e('Donation Form ID', 'give') ?></th>
256
+											<th><?php _e('Donation Form Title', 'give') ?></th>
257
+											<th><?php _e('Donation Level', 'give') ?></th>
258
+											<th><?php _e('Donation Date', 'give') ?></th>
259
+											<th><?php _e('Total Donation', 'give') ?></th>
260
+											<?php do_action('give_donation_details_thead_after', $payment_id); ?>
261 261
 										</tr>
262 262
 										</thead>
263 263
 										<tr>
264
-											<?php do_action( 'give_donation_details_tbody_before', $payment_id ); ?>
264
+											<?php do_action('give_donation_details_tbody_before', $payment_id); ?>
265 265
 											<td>
266 266
 												<?php echo $payment_meta['form_id']; ?>
267 267
 											</td>
268 268
 											<td>
269
-												<?php give_get_form_dropdown( array(
269
+												<?php give_get_form_dropdown(array(
270 270
 													'id'       => $payment_meta['form_id'],
271 271
 													'selected' => $payment_meta['form_id'],
272 272
 													'chosen'   => true
273
-												), true ); ?>
273
+												), true); ?>
274 274
 											</td>
275 275
 											<td>
276 276
 												<?php
277
-												if ( empty( give_has_variable_prices( $payment_meta['form_id'] ) ) ) {
278
-													echo __( 'n/a', 'give' );
277
+												if (empty(give_has_variable_prices($payment_meta['form_id']))) {
278
+													echo __('n/a', 'give');
279 279
 												} else {
280 280
 													// Variable price dropdown options.
281 281
 													$variable_price_dropdown_option = array(
@@ -287,20 +287,20 @@  discard block
 block discarded – undo
287 287
 													);
288 288
 
289 289
 													// Render variable prices select tag html.
290
-													give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
290
+													give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
291 291
 												}
292 292
 												?>
293 293
 											</td>
294 294
 											<td>
295 295
 												<?php
296 296
 												//Transaction Date
297
-												$date_format = get_option( 'date_format' );
298
-												echo date_i18n( $date_format, strtotime( $payment_date ) );
297
+												$date_format = get_option('date_format');
298
+												echo date_i18n($date_format, strtotime($payment_date));
299 299
 												?>
300 300
 											</td>
301 301
 											<td>
302
-												<?php echo esc_html( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ) ); ?></td>
303
-											<?php do_action( 'give_donation_details_tbody_after', $payment_id ); ?>
302
+												<?php echo esc_html(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)))); ?></td>
303
+											<?php do_action('give_donation_details_tbody_after', $payment_id); ?>
304 304
 
305 305
 										</tr>
306 306
 									</table>
@@ -312,64 +312,64 @@  discard block
 block discarded – undo
312 312
 							</div>
313 313
 							<!-- /#give-donation-overview -->
314 314
 
315
-							<?php do_action( 'give_view_order_details_files_after', $payment_id ); ?>
315
+							<?php do_action('give_view_order_details_files_after', $payment_id); ?>
316 316
 
317
-							<?php do_action( 'give_view_order_details_billing_before', $payment_id ); ?>
317
+							<?php do_action('give_view_order_details_billing_before', $payment_id); ?>
318 318
 
319 319
 
320 320
 							<div id="give-customer-details" class="postbox">
321 321
 								<h3 class="hndle">
322
-									<span><?php _e( 'Donor Details', 'give' ); ?></span>
322
+									<span><?php _e('Donor Details', 'give'); ?></span>
323 323
 								</h3>
324 324
 
325 325
 								<div class="inside give-clearfix">
326 326
 
327
-									<?php $customer = new Give_Customer( $customer_id ); ?>
327
+									<?php $customer = new Give_Customer($customer_id); ?>
328 328
 
329 329
 									<div class="column-container customer-info">
330 330
 										<div class="column">
331
-											<?php echo Give()->html->donor_dropdown( array(
331
+											<?php echo Give()->html->donor_dropdown(array(
332 332
 												'selected' => $customer->id,
333 333
 												'name'     => 'customer-id'
334
-											) ); ?>
334
+											)); ?>
335 335
 										</div>
336 336
 										<div class="column">
337 337
 											<input type="hidden" name="give-current-customer" value="<?php echo $customer->id; ?>"/>
338 338
 										</div>
339 339
 										<div class="column">
340
-											<?php if ( ! empty( $customer->id ) ) : ?>
341
-												<?php $customer_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>
342
-												<a href="<?php echo $customer_url; ?>" title="<?php _e( 'View Donor Details', 'give' ); ?>"><?php _e( 'View Donor Details', 'give' ); ?></a>
340
+											<?php if ( ! empty($customer->id)) : ?>
341
+												<?php $customer_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>
342
+												<a href="<?php echo $customer_url; ?>" title="<?php _e('View Donor Details', 'give'); ?>"><?php _e('View Donor Details', 'give'); ?></a>
343 343
 												&nbsp;|&nbsp;
344 344
 											<?php endif; ?>
345
-											<a href="#new" class="give-payment-new-customer" title="<?php _e( 'New Donor', 'give' ); ?>"><?php _e( 'New Donor', 'give' ); ?></a>
345
+											<a href="#new" class="give-payment-new-customer" title="<?php _e('New Donor', 'give'); ?>"><?php _e('New Donor', 'give'); ?></a>
346 346
 										</div>
347 347
 									</div>
348 348
 
349 349
 									<div class="column-container new-customer" style="display: none">
350 350
 										<div class="column">
351
-											<label for="give-new-customer-name"><?php _e( 'Name:', 'give' ); ?></label>&nbsp;
351
+											<label for="give-new-customer-name"><?php _e('Name:', 'give'); ?></label>&nbsp;
352 352
 											<input id="give-new-customer-name" type="text" name="give-new-customer-name" value="" class="medium-text"/>
353 353
 										</div>
354 354
 										<div class="column">
355
-											<label for="give-new-customer-email"><?php _e( 'Email:', 'give' ); ?></label>&nbsp;
355
+											<label for="give-new-customer-email"><?php _e('Email:', 'give'); ?></label>&nbsp;
356 356
 											<input id="give-new-customer-email" type="email" name="give-new-customer-email" value="" class="medium-text"/>
357 357
 										</div>
358 358
 										<div class="column">
359 359
 											<input type="hidden" id="give-new-customer" name="give-new-customer" value="0"/>
360
-											<a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a>
360
+											<a href="#cancel" class="give-payment-new-customer-cancel give-delete"><?php _e('Cancel', 'give'); ?></a>
361 361
 										</div>
362 362
 										<div class="column">
363 363
 											<small>
364
-												<em>*<?php _e( 'Click "Save Payment" to create new donor', 'give' ); ?></em>
364
+												<em>*<?php _e('Click "Save Payment" to create new donor', 'give'); ?></em>
365 365
 											</small>
366 366
 										</div>
367 367
 									</div>
368 368
 
369 369
 									<?php
370 370
 									// The give_payment_personal_details_list hook is left here for backwards compatibility
371
-									do_action( 'give_payment_personal_details_list', $payment_meta, $user_info );
372
-									do_action( 'give_payment_view_details', $payment_id );
371
+									do_action('give_payment_personal_details_list', $payment_meta, $user_info);
372
+									do_action('give_payment_view_details', $payment_id);
373 373
 									?>
374 374
 
375 375
 								</div>
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 
381 381
 							<div id="give-billing-details" class="postbox">
382 382
 								<h3 class="hndle">
383
-									<span><?php _e( 'Billing Address', 'give' ); ?></span>
383
+									<span><?php _e('Billing Address', 'give'); ?></span>
384 384
 								</h3>
385 385
 
386 386
 								<div class="inside give-clearfix">
@@ -391,62 +391,62 @@  discard block
 block discarded – undo
391 391
 											<div class="data column-container">
392 392
 												<div class="column">
393 393
 													<div class="give-wrap-address-line1">
394
-														<label for="give-payment-address-line1" class="order-data-address"><?php _e( 'Street Address Line 1:', 'give' ); ?></label>
395
-														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/>
394
+														<label for="give-payment-address-line1" class="order-data-address"><?php _e('Street Address Line 1:', 'give'); ?></label>
395
+														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/>
396 396
 													</div>
397 397
 
398 398
 													<div class="give-wrap-address-line2">
399
-														<label for="give-payment-address-line2" class="order-data-address-line"><?php _e( 'Street Address Line 2:', 'give' ); ?></label>
400
-														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/>
399
+														<label for="give-payment-address-line2" class="order-data-address-line"><?php _e('Street Address Line 2:', 'give'); ?></label>
400
+														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/>
401 401
 													</div>
402 402
 
403 403
 												</div>
404 404
 												<div class="column">
405 405
 													<div class="give-wrap-address-city">
406
-														<label for="give-payment-address-city" class="order-data-address-line"><?php _e( 'City:', 'give' ); ?></label>
407
-														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/>
406
+														<label for="give-payment-address-city" class="order-data-address-line"><?php _e('City:', 'give'); ?></label>
407
+														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/>
408 408
 
409 409
 													</div>
410 410
 
411 411
 													<div class="give-wrap-address-zip">
412
-														<label for="give-payment-address-zip" class="order-data-address-line"><?php _e( 'Zip / Postal Code:', 'give' ); ?></label>
413
-														<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/>
412
+														<label for="give-payment-address-zip" class="order-data-address-line"><?php _e('Zip / Postal Code:', 'give'); ?></label>
413
+														<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/>
414 414
 
415 415
 													</div>
416 416
 												</div>
417 417
 												<div class="column">
418 418
 													<div id="give-order-address-country-wrap">
419
-														<label class="order-data-address-line"><?php _e( 'Country:', 'give' ); ?></label>
419
+														<label class="order-data-address-line"><?php _e('Country:', 'give'); ?></label>
420 420
 														<?php
421
-														echo Give()->html->select( array(
421
+														echo Give()->html->select(array(
422 422
 															'options'          => give_get_country_list(),
423 423
 															'name'             => 'give-payment-address[0][country]',
424 424
 															'selected'         => $address['country'],
425 425
 															'show_option_all'  => false,
426 426
 															'show_option_none' => false,
427 427
 															'chosen'           => true,
428
-															'placeholder'      => __( 'Select a country', 'give' )
429
-														) );
428
+															'placeholder'      => __('Select a country', 'give')
429
+														));
430 430
 														?>
431 431
 													</div>
432 432
 
433 433
 													<div id="give-order-address-state-wrap">
434
-														<label for="give-payment-address-state" class="order-data-address-line"><?php _e( 'State / Province:', 'give' ); ?></label>
434
+														<label for="give-payment-address-state" class="order-data-address-line"><?php _e('State / Province:', 'give'); ?></label>
435 435
 														<?php
436
-														$states = give_get_states( $address['country'] );
437
-														if ( ! empty( $states ) ) {
438
-															echo Give()->html->select( array(
436
+														$states = give_get_states($address['country']);
437
+														if ( ! empty($states)) {
438
+															echo Give()->html->select(array(
439 439
 																'options'          => $states,
440 440
 																'name'             => 'give-payment-address[0][state]',
441 441
 																'selected'         => $address['state'],
442 442
 																'show_option_all'  => false,
443 443
 																'show_option_none' => false,
444 444
 																'chosen'           => true,
445
-																'placeholder'      => __( 'Select a state', 'give' )
446
-															) );
445
+																'placeholder'      => __('Select a state', 'give')
446
+															));
447 447
 														} else {
448 448
 															?>
449
-															<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/>
449
+															<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/>
450 450
 															<?php
451 451
 														} ?>
452 452
 													</div>
@@ -456,38 +456,38 @@  discard block
 block discarded – undo
456 456
 									</div>
457 457
 									<!-- /#give-order-address -->
458 458
 
459
-									<?php do_action( 'give_payment_billing_details', $payment_id ); ?>
459
+									<?php do_action('give_payment_billing_details', $payment_id); ?>
460 460
 
461 461
 								</div>
462 462
 								<!-- /.inside -->
463 463
 							</div>
464 464
 							<!-- /#give-billing-details -->
465 465
 
466
-							<?php do_action( 'give_view_order_details_billing_after', $payment_id ); ?>
466
+							<?php do_action('give_view_order_details_billing_after', $payment_id); ?>
467 467
 
468 468
 							<div id="give-payment-notes" class="postbox">
469
-								<h3 class="hndle"><span><?php _e( 'Payment Notes', 'give' ); ?></span></h3>
469
+								<h3 class="hndle"><span><?php _e('Payment Notes', 'give'); ?></span></h3>
470 470
 
471 471
 								<div class="inside">
472 472
 									<div id="give-payment-notes-inner">
473 473
 										<?php
474
-										$notes = give_get_payment_notes( $payment_id );
475
-										if ( ! empty( $notes ) ) :
474
+										$notes = give_get_payment_notes($payment_id);
475
+										if ( ! empty($notes)) :
476 476
 											$no_notes_display = ' style="display:none;"';
477
-											foreach ( $notes as $note ) :
477
+											foreach ($notes as $note) :
478 478
 
479
-												echo give_get_payment_note_html( $note, $payment_id );
479
+												echo give_get_payment_note_html($note, $payment_id);
480 480
 
481 481
 											endforeach;
482 482
 										else :
483 483
 											$no_notes_display = '';
484 484
 										endif;
485
-										echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . __( 'No payment notes', 'give' ) . '</p>'; ?>
485
+										echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.__('No payment notes', 'give').'</p>'; ?>
486 486
 									</div>
487 487
 									<textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea>
488 488
 
489 489
 									<div class="give-clearfix">
490
-										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php _e( 'Add Note', 'give' ); ?></button>
490
+										<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php _e('Add Note', 'give'); ?></button>
491 491
 									</div>
492 492
 
493 493
 								</div>
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 							</div>
496 496
 							<!-- /#give-payment-notes -->
497 497
 
498
-							<?php do_action( 'give_view_order_details_main_after', $payment_id ); ?>
498
+							<?php do_action('give_view_order_details_main_after', $payment_id); ?>
499 499
 						</div>
500 500
 						<!-- /#normal-sortables -->
501 501
 					</div>
@@ -506,10 +506,10 @@  discard block
 block discarded – undo
506 506
 			<!-- #give-dashboard-widgets-wrap -->
507 507
 		</div>
508 508
 		<!-- /#post-stuff -->
509
-		<?php do_action( 'give_view_order_details_form_bottom', $payment_id ); ?>
510
-		<?php wp_nonce_field( 'give_update_payment_details_nonce' ); ?>
511
-		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/>
509
+		<?php do_action('give_view_order_details_form_bottom', $payment_id); ?>
510
+		<?php wp_nonce_field('give_update_payment_details_nonce'); ?>
511
+		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/>
512 512
 		<input type="hidden" name="give_action" value="update_payment_details"/>
513 513
 	</form>
514
-	<?php do_action( 'give_view_order_details_after', $payment_id ); ?>
514
+	<?php do_action('give_view_order_details_after', $payment_id); ?>
515 515
 </div><!-- /.wrap -->
Please login to merge, or discard this patch.
includes/admin/reporting/class-donor-reports-table.php 2 patches
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 		global $status, $page;
63 63
 
64 64
 		// Set parent defaults
65
-		parent::__construct( array(
66
-			'singular' => __( 'Donor', 'give' ),     // Singular name of the listed records
67
-			'plural'   => __( 'Donors', 'give' ),    // Plural name of the listed records
65
+		parent::__construct(array(
66
+			'singular' => __('Donor', 'give'), // Singular name of the listed records
67
+			'plural'   => __('Donors', 'give'), // Plural name of the listed records
68 68
 			'ajax'     => false                        // Does this table support ajax?
69
-		) );
69
+		));
70 70
 
71 71
 	}
72 72
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 *
84 84
 	 * @return false
85 85
 	 */
86
-	public function search_box( $text, $input_id ) {
86
+	public function search_box($text, $input_id) {
87 87
 		return;
88 88
 	}
89 89
 
@@ -98,20 +98,20 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @return void
100 100
 	 */
101
-	public function give_search_box( $text, $input_id ) {
102
-		$input_id = $input_id . '-search-input';
101
+	public function give_search_box($text, $input_id) {
102
+		$input_id = $input_id.'-search-input';
103 103
 
104
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
105
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
104
+		if ( ! empty($_REQUEST['orderby'])) {
105
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
106 106
 		}
107
-		if ( ! empty( $_REQUEST['order'] ) ) {
108
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
107
+		if ( ! empty($_REQUEST['order'])) {
108
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
109 109
 		}
110 110
 		?>
111 111
 		<p class="search-box donor-search">
112 112
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
113 113
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
114
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?>
114
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?>
115 115
 		</p>
116 116
 	<?php
117 117
 	}
@@ -124,29 +124,29 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @param string $which
126 126
 	 */
127
-	protected function display_tablenav( $which ) {
127
+	protected function display_tablenav($which) {
128 128
 
129
-		if ( 'top' == $which ) {
130
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
129
+		if ('top' == $which) {
130
+			wp_nonce_field('bulk-'.$this->_args['plural']);
131 131
 		}
132 132
 		?>
133
-		<div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>">
133
+		<div class="tablenav give-clearfix <?php echo esc_attr($which); ?>">
134 134
 
135
-			<h3 class="alignleft reports-earnings-title"><span><?php _e( 'Donors Report', 'give' ); ?></span></h3>
135
+			<h3 class="alignleft reports-earnings-title"><span><?php _e('Donors Report', 'give'); ?></span></h3>
136 136
 
137 137
 			<div class="alignright tablenav-right">
138 138
 				<div class="actions bulkactions">
139 139
 					<?php
140
-					if ( 'top' == $which ) {
141
-						$this->give_search_box( __( 'Search Donors', 'give' ), 'give-donors-report-search' );
140
+					if ('top' == $which) {
141
+						$this->give_search_box(__('Search Donors', 'give'), 'give-donors-report-search');
142 142
 					}
143 143
 
144
-					$this->bulk_actions( $which ); ?>
144
+					$this->bulk_actions($which); ?>
145 145
 
146 146
 				</div>
147 147
 				<?php
148
-				$this->extra_tablenav( $which );
149
-				$this->pagination( $which );
148
+				$this->extra_tablenav($which);
149
+				$this->pagination($which);
150 150
 				?>
151 151
 			</div>
152 152
 
@@ -168,25 +168,25 @@  discard block
 block discarded – undo
168 168
 	 *
169 169
 	 * @return string Column Name
170 170
 	 */
171
-	public function column_default( $item, $column_name ) {
172
-		switch ( $column_name ) {
171
+	public function column_default($item, $column_name) {
172
+		switch ($column_name) {
173 173
 
174 174
 			case 'num_purchases' :
175
-				$value = '<a href="' .
176
-				         admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
177
-				         ) . '">' . esc_html( $item['num_purchases'] ) . '</a>';
175
+				$value = '<a href="'.
176
+				         admin_url('/edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email'])
177
+				         ).'">'.esc_html($item['num_purchases']).'</a>';
178 178
 				break;
179 179
 
180 180
 			case 'amount_spent' :
181
-				$value = give_currency_filter( give_format_amount( $item[ $column_name ] ) );
181
+				$value = give_currency_filter(give_format_amount($item[$column_name]));
182 182
 				break;
183 183
 
184 184
 			default:
185
-				$value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null;
185
+				$value = isset($item[$column_name]) ? $item[$column_name] : null;
186 186
 				break;
187 187
 		}
188 188
 
189
-		return apply_filters( 'give_report_column_' . $column_name, $value, $item['id'] );
189
+		return apply_filters('give_report_column_'.$column_name, $value, $item['id']);
190 190
 	}
191 191
 
192 192
 	/**
@@ -198,14 +198,14 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	public function get_columns() {
200 200
 		$columns = array(
201
-			'name'          => __( 'Name', 'give' ),
202
-			'id'            => __( 'ID', 'give' ),
203
-			'email'         => __( 'Email', 'give' ),
204
-			'num_purchases' => __( 'Purchases', 'give' ),
205
-			'amount_spent'  => __( 'Total Spent', 'give' )
201
+			'name'          => __('Name', 'give'),
202
+			'id'            => __('ID', 'give'),
203
+			'email'         => __('Email', 'give'),
204
+			'num_purchases' => __('Purchases', 'give'),
205
+			'amount_spent'  => __('Total Spent', 'give')
206 206
 		);
207 207
 
208
-		return apply_filters( 'give_report_donor_columns', $columns );
208
+		return apply_filters('give_report_donor_columns', $columns);
209 209
 
210 210
 	}
211 211
 
@@ -218,10 +218,10 @@  discard block
 block discarded – undo
218 218
 	 */
219 219
 	public function get_sortable_columns() {
220 220
 		return array(
221
-			'id'            => array( 'id', true ),
222
-			'name'          => array( 'name', true ),
223
-			'num_purchases' => array( 'purchase_count', false ),
224
-			'amount_spent'  => array( 'purchase_value', false ),
221
+			'id'            => array('id', true),
222
+			'name'          => array('name', true),
223
+			'num_purchases' => array('purchase_count', false),
224
+			'amount_spent'  => array('purchase_value', false),
225 225
 		);
226 226
 	}
227 227
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * @since  1.0
233 233
 	 * @return void
234 234
 	 */
235
-	public function bulk_actions( $which = '' ) {
235
+	public function bulk_actions($which = '') {
236 236
 		// These aren't really bulk actions but this outputs the markup in the right place
237 237
 		give_report_views();
238 238
 	}
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 * @return int Current page number
246 246
 	 */
247 247
 	public function get_paged() {
248
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
248
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
249 249
 	}
250 250
 
251 251
 	/**
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 	 * @return mixed string If search is present, false otherwise
257 257
 	 */
258 258
 	public function get_search() {
259
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
259
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
260 260
 	}
261 261
 
262 262
 	/**
@@ -273,10 +273,10 @@  discard block
 block discarded – undo
273 273
 
274 274
 		$data    = array();
275 275
 		$paged   = $this->get_paged();
276
-		$offset  = $this->per_page * ( $paged - 1 );
276
+		$offset  = $this->per_page * ($paged - 1);
277 277
 		$search  = $this->get_search();
278
-		$order   = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC';
279
-		$orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id';
278
+		$order   = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC';
279
+		$orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id';
280 280
 
281 281
 		$args = array(
282 282
 			'number'  => $this->per_page,
@@ -285,21 +285,21 @@  discard block
 block discarded – undo
285 285
 			'orderby' => $orderby
286 286
 		);
287 287
 
288
-		if ( is_email( $search ) ) {
288
+		if (is_email($search)) {
289 289
 			$args['email'] = $search;
290
-		} elseif ( is_numeric( $search ) ) {
290
+		} elseif (is_numeric($search)) {
291 291
 			$args['id'] = $search;
292 292
 		}
293 293
 
294
-		$donors = Give()->customers->get_customers( $args );
294
+		$donors = Give()->customers->get_customers($args);
295 295
 
296
-		if ( $donors ) {
296
+		if ($donors) {
297 297
 
298
-			$this->count = count( $donors );
298
+			$this->count = count($donors);
299 299
 
300
-			foreach ( $donors as $donor ) {
300
+			foreach ($donors as $donor) {
301 301
 
302
-				$user_id = ! empty( $donor->user_id ) ? absint( $donor->user_id ) : 0;
302
+				$user_id = ! empty($donor->user_id) ? absint($donor->user_id) : 0;
303 303
 
304 304
 				$data[] = array(
305 305
 					'id'            => $donor->id,
@@ -332,16 +332,16 @@  discard block
 block discarded – undo
332 332
 		$hidden   = array(); // No hidden columns
333 333
 		$sortable = $this->get_sortable_columns();
334 334
 
335
-		$this->_column_headers = array( $columns, $hidden, $sortable );
335
+		$this->_column_headers = array($columns, $hidden, $sortable);
336 336
 
337 337
 		$this->items = $this->reports_data();
338 338
 
339 339
 		$this->total = give_count_total_customers();
340 340
 
341
-		$this->set_pagination_args( array(
341
+		$this->set_pagination_args(array(
342 342
 			'total_items' => $this->total,
343 343
 			'per_page'    => $this->per_page,
344
-			'total_pages' => ceil( $this->total / $this->per_page )
345
-		) );
344
+			'total_pages' => ceil($this->total / $this->per_page)
345
+		));
346 346
 	}
347 347
 }
348 348
\ No newline at end of file
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -115,8 +115,8 @@
 block discarded – undo
115 115
 
116 116
 			case 'num_purchases' :
117 117
 				$value = '<a href="' .
118
-				         admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
119
-				         ) . '">' . esc_html( $item['num_purchases'] ) . '</a>';
118
+						 admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] )
119
+						 ) . '">' . esc_html( $item['num_purchases'] ) . '</a>';
120 120
 				break;
121 121
 
122 122
 			case 'amount_spent' :
Please login to merge, or discard this patch.