Completed
Push — master ( 9a5cf9...f11a89 )
by Devin
37:27 queued 17:25
created
includes/forms/functions.php 1 patch
Spacing   +190 added lines, -190 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,14 +23,14 @@  discard block
 block discarded – undo
23 23
 
24 24
 	global $typenow;
25 25
 
26
-	if ( $typenow != 'give_forms' ) {
26
+	if ($typenow != 'give_forms') {
27 27
 		return true;
28 28
 	}
29 29
 
30 30
 	return false;
31 31
 }
32 32
 
33
-add_filter( 'give_shortcode_button_condition', 'give_shortcode_button_condition' );
33
+add_filter('give_shortcode_button_condition', 'give_shortcode_button_condition');
34 34
 
35 35
 
36 36
 /**
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @return int|false
42 42
  */
43
-function get_form_id_from_args( $args ) {
43
+function get_form_id_from_args($args) {
44 44
 
45
-	if ( isset( $args['form_id'] ) && $args['form_id'] != 0 ) {
45
+	if (isset($args['form_id']) && $args['form_id'] != 0) {
46 46
 
47
-		return intval( $args['form_id'] );
47
+		return intval($args['form_id']);
48 48
 	}
49 49
 
50 50
 	return false;
@@ -59,23 +59,23 @@  discard block
 block discarded – undo
59 59
  *
60 60
  * @return bool
61 61
  */
62
-function give_is_float_labels_enabled( $args ) {
62
+function give_is_float_labels_enabled($args) {
63 63
 
64 64
 	$float_labels = '';
65 65
 
66
-	if ( ! empty( $args['float_labels'] ) ) {
66
+	if ( ! empty($args['float_labels'])) {
67 67
 		$float_labels = $args['float_labels'];
68 68
 	}
69 69
 
70
-	if ( empty( $float_labels ) ) {
71
-		$float_labels = get_post_meta( $args['form_id'], '_give_form_floating_labels', true );
70
+	if (empty($float_labels)) {
71
+		$float_labels = get_post_meta($args['form_id'], '_give_form_floating_labels', true);
72 72
 	}
73 73
 
74
-	if ( empty( $float_labels ) ) {
75
-		$float_labels = give_get_option( 'enable_floatlabels' ) ? 'enabled' : 'disabled';
74
+	if (empty($float_labels)) {
75
+		$float_labels = give_get_option('enable_floatlabels') ? 'enabled' : 'disabled';
76 76
 	}
77 77
 
78
-	return ( $float_labels == 'enabled' ) ? true : false;
78
+	return ($float_labels == 'enabled') ? true : false;
79 79
 }
80 80
 
81 81
 /**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 	$can_checkout = true;
93 93
 
94
-	return (bool) apply_filters( 'give_can_checkout', $can_checkout );
94
+	return (bool) apply_filters('give_can_checkout', $can_checkout);
95 95
 }
96 96
 
97 97
 /**
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 function give_get_success_page_uri() {
106 106
 	global $give_options;
107 107
 
108
-	$success_page = isset( $give_options['success_page'] ) ? get_permalink( absint( $give_options['success_page'] ) ) : get_bloginfo( 'url' );
108
+	$success_page = isset($give_options['success_page']) ? get_permalink(absint($give_options['success_page'])) : get_bloginfo('url');
109 109
 
110
-	return apply_filters( 'give_get_success_page_uri', $success_page );
110
+	return apply_filters('give_get_success_page_uri', $success_page);
111 111
 }
112 112
 
113 113
 /**
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
  */
120 120
 function give_is_success_page() {
121 121
 	global $give_options;
122
-	$is_success_page = isset( $give_options['success_page'] ) ? is_page( $give_options['success_page'] ) : false;
122
+	$is_success_page = isset($give_options['success_page']) ? is_page($give_options['success_page']) : false;
123 123
 
124
-	return apply_filters( 'give_is_success_page', $is_success_page );
124
+	return apply_filters('give_is_success_page', $is_success_page);
125 125
 }
126 126
 
127 127
 /**
@@ -135,17 +135,17 @@  discard block
 block discarded – undo
135 135
  * @since       1.0
136 136
  * @return      void
137 137
  */
138
-function give_send_to_success_page( $query_string = null ) {
138
+function give_send_to_success_page($query_string = null) {
139 139
 
140 140
 	$redirect = give_get_success_page_uri();
141 141
 
142
-	if ( $query_string ) {
142
+	if ($query_string) {
143 143
 		$redirect .= $query_string;
144 144
 	}
145 145
 
146
-	$gateway = isset( $_REQUEST['give-gateway'] ) ? $_REQUEST['give-gateway'] : '';
146
+	$gateway = isset($_REQUEST['give-gateway']) ? $_REQUEST['give-gateway'] : '';
147 147
 
148
-	wp_redirect( apply_filters( 'give_success_page_redirect', $redirect, $gateway, $query_string ) );
148
+	wp_redirect(apply_filters('give_success_page_redirect', $redirect, $gateway, $query_string));
149 149
 	give_die();
150 150
 }
151 151
 
@@ -162,17 +162,17 @@  discard block
 block discarded – undo
162 162
  * @since  1.0
163 163
  * @return Void
164 164
  */
165
-function give_send_back_to_checkout( $args = array() ) {
165
+function give_send_back_to_checkout($args = array()) {
166 166
 
167
-	if ( isset( $_POST['give-current-url'] ) ) {
168
-		$url = sanitize_text_field( $_POST['give-current-url']);
167
+	if (isset($_POST['give-current-url'])) {
168
+		$url = sanitize_text_field($_POST['give-current-url']);
169 169
 	} else {
170
-		wp_safe_redirect( home_url() );
170
+		wp_safe_redirect(home_url());
171 171
 		give_die();
172 172
 	}
173 173
 
174
-	if ( isset( $_POST['give-form-id'] ) ) {
175
-		$form_id = sanitize_text_field( $_POST['give-form-id']);
174
+	if (isset($_POST['give-form-id'])) {
175
+		$form_id = sanitize_text_field($_POST['give-form-id']);
176 176
 	} else {
177 177
 		$form_id = 0;
178 178
 	}
@@ -182,22 +182,22 @@  discard block
 block discarded – undo
182 182
 	);
183 183
 
184 184
 	// Check for backward compatibility
185
-	if ( is_string( $args ) ) {
186
-		$args = str_replace( '?', '', $args );
185
+	if (is_string($args)) {
186
+		$args = str_replace('?', '', $args);
187 187
 	}
188 188
 
189
-	$args = wp_parse_args( $args, $defaults );
189
+	$args = wp_parse_args($args, $defaults);
190 190
 
191 191
 	// Merge URL query with $args to maintain third-party URL parameters after redirect.
192
-	$url_data = wp_parse_url( $url );
193
-	parse_str( $url_data['query'], $query );
194
-	$new_query = array_merge( $args, $query );
195
-	$new_query_string = http_build_query( $new_query );
192
+	$url_data = wp_parse_url($url);
193
+	parse_str($url_data['query'], $query);
194
+	$new_query = array_merge($args, $query);
195
+	$new_query_string = http_build_query($new_query);
196 196
 
197 197
 	// Assemble URL parts.
198
-	$redirect = home_url( '/' . $url_data['path'] . '?' . $new_query_string . '#give-form-' . $form_id . '-wrap' );
198
+	$redirect = home_url('/'.$url_data['path'].'?'.$new_query_string.'#give-form-'.$form_id.'-wrap');
199 199
 
200
-	wp_safe_redirect( apply_filters( 'give_send_back_to_checkout', $redirect, $args ) );
200
+	wp_safe_redirect(apply_filters('give_send_back_to_checkout', $redirect, $args));
201 201
 	give_die();
202 202
 }
203 203
 
@@ -212,16 +212,16 @@  discard block
 block discarded – undo
212 212
  * @since       1.0
213 213
  * @return      string
214 214
  */
215
-function give_get_success_page_url( $query_string = null ) {
215
+function give_get_success_page_url($query_string = null) {
216 216
 
217
-	$success_page = give_get_option( 'success_page', 0 );
218
-	$success_page = get_permalink( $success_page );
217
+	$success_page = give_get_option('success_page', 0);
218
+	$success_page = get_permalink($success_page);
219 219
 
220
-	if ( $query_string ) {
220
+	if ($query_string) {
221 221
 		$success_page .= $query_string;
222 222
 	}
223 223
 
224
-	return apply_filters( 'give_success_page_url', $success_page );
224
+	return apply_filters('give_success_page_url', $success_page);
225 225
 
226 226
 }
227 227
 
@@ -235,15 +235,15 @@  discard block
 block discarded – undo
235 235
  *
236 236
  * @return mixed|void Full URL to the Transaction Failed page, if present, home page if it doesn't exist
237 237
  */
238
-function give_get_failed_transaction_uri( $extras = false ) {
238
+function give_get_failed_transaction_uri($extras = false) {
239 239
 	global $give_options;
240 240
 
241
-	$uri = ! empty( $give_options['failure_page'] ) ? trailingslashit( get_permalink( $give_options['failure_page'] ) ) : home_url();
242
-	if ( $extras ) {
241
+	$uri = ! empty($give_options['failure_page']) ? trailingslashit(get_permalink($give_options['failure_page'])) : home_url();
242
+	if ($extras) {
243 243
 		$uri .= $extras;
244 244
 	}
245 245
 
246
-	return apply_filters( 'give_get_failed_transaction_uri', $uri );
246
+	return apply_filters('give_get_failed_transaction_uri', $uri);
247 247
 }
248 248
 
249 249
 /**
@@ -254,9 +254,9 @@  discard block
 block discarded – undo
254 254
  */
255 255
 function give_is_failed_transaction_page() {
256 256
 	global $give_options;
257
-	$ret = isset( $give_options['failure_page'] ) ? is_page( $give_options['failure_page'] ) : false;
257
+	$ret = isset($give_options['failure_page']) ? is_page($give_options['failure_page']) : false;
258 258
 
259
-	return apply_filters( 'give_is_failure_page', $ret );
259
+	return apply_filters('give_is_failure_page', $ret);
260 260
 }
261 261
 
262 262
 /**
@@ -268,18 +268,18 @@  discard block
 block discarded – undo
268 268
  */
269 269
 function give_listen_for_failed_payments() {
270 270
 
271
-	$failed_page = give_get_option( 'failure_page', 0 );
271
+	$failed_page = give_get_option('failure_page', 0);
272 272
 
273
-	if ( ! empty( $failed_page ) && is_page( $failed_page ) && ! empty( $_GET['payment-id'] ) ) {
273
+	if ( ! empty($failed_page) && is_page($failed_page) && ! empty($_GET['payment-id'])) {
274 274
 
275
-		$payment_id = absint( $_GET['payment-id'] );
276
-		give_update_payment_status( $payment_id, 'failed' );
275
+		$payment_id = absint($_GET['payment-id']);
276
+		give_update_payment_status($payment_id, 'failed');
277 277
 
278 278
 	}
279 279
 
280 280
 }
281 281
 
282
-add_action( 'template_redirect', 'give_listen_for_failed_payments' );
282
+add_action('template_redirect', 'give_listen_for_failed_payments');
283 283
 
284 284
 
285 285
 /**
@@ -292,11 +292,11 @@  discard block
 block discarded – undo
292 292
  * @since       1.0
293 293
  * @return      bool
294 294
  */
295
-function give_field_is_required( $field = '', $form_id ) {
295
+function give_field_is_required($field = '', $form_id) {
296 296
 
297
-	$required_fields = give_purchase_form_required_fields( $form_id );
297
+	$required_fields = give_purchase_form_required_fields($form_id);
298 298
 
299
-	return array_key_exists( $field, $required_fields );
299
+	return array_key_exists($field, $required_fields);
300 300
 }
301 301
 
302 302
 /**
@@ -314,14 +314,14 @@  discard block
 block discarded – undo
314 314
  *
315 315
  * @return void
316 316
  */
317
-function give_record_sale_in_log( $give_form_id = 0, $payment_id, $price_id = false, $sale_date = null ) {
317
+function give_record_sale_in_log($give_form_id = 0, $payment_id, $price_id = false, $sale_date = null) {
318 318
 	global $give_logs;
319 319
 
320 320
 	$log_data = array(
321 321
 		'post_parent'   => $give_form_id,
322 322
 		'log_type'      => 'sale',
323
-		'post_date'     => isset( $sale_date ) ? $sale_date : null,
324
-		'post_date_gmt' => isset( $sale_date ) ? $sale_date : null
323
+		'post_date'     => isset($sale_date) ? $sale_date : null,
324
+		'post_date_gmt' => isset($sale_date) ? $sale_date : null
325 325
 	);
326 326
 
327 327
 	$log_meta = array(
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 		'price_id'   => (int) $price_id
330 330
 	);
331 331
 
332
-	$give_logs->insert_log( $log_data, $log_meta );
332
+	$give_logs->insert_log($log_data, $log_meta);
333 333
 }
334 334
 
335 335
 
@@ -343,11 +343,11 @@  discard block
 block discarded – undo
343 343
  *
344 344
  * @return bool|int
345 345
  */
346
-function give_increase_purchase_count( $form_id = 0, $quantity = 1 ) {
346
+function give_increase_purchase_count($form_id = 0, $quantity = 1) {
347 347
 	$quantity = (int) $quantity;
348
-	$form     = new Give_Donate_Form( $form_id );
348
+	$form     = new Give_Donate_Form($form_id);
349 349
 
350
-	return $form->increase_sales( $quantity );
350
+	return $form->increase_sales($quantity);
351 351
 }
352 352
 
353 353
 /**
@@ -360,11 +360,11 @@  discard block
 block discarded – undo
360 360
  *
361 361
  * @return bool|int
362 362
  */
363
-function give_decrease_purchase_count( $form_id = 0, $quantity = 1 ) {
363
+function give_decrease_purchase_count($form_id = 0, $quantity = 1) {
364 364
 	$quantity = (int) $quantity;
365
-	$form     = new Give_Donate_Form( $form_id );
365
+	$form     = new Give_Donate_Form($form_id);
366 366
 
367
-	return $form->decrease_sales( $quantity );
367
+	return $form->decrease_sales($quantity);
368 368
 }
369 369
 
370 370
 /**
@@ -377,10 +377,10 @@  discard block
 block discarded – undo
377 377
  *
378 378
  * @return bool|int
379 379
  */
380
-function give_increase_earnings( $give_form_id = 0, $amount ) {
381
-	$form = new Give_Donate_Form( $give_form_id );
380
+function give_increase_earnings($give_form_id = 0, $amount) {
381
+	$form = new Give_Donate_Form($give_form_id);
382 382
 
383
-	return $form->increase_earnings( $amount );
383
+	return $form->increase_earnings($amount);
384 384
 }
385 385
 
386 386
 /**
@@ -393,10 +393,10 @@  discard block
 block discarded – undo
393 393
  *
394 394
  * @return bool|int
395 395
  */
396
-function give_decrease_earnings( $form_id = 0, $amount ) {
397
-	$form = new Give_Donate_Form( $form_id );
396
+function give_decrease_earnings($form_id = 0, $amount) {
397
+	$form = new Give_Donate_Form($form_id);
398 398
 
399
-	return $form->decrease_earnings( $amount );
399
+	return $form->decrease_earnings($amount);
400 400
 }
401 401
 
402 402
 
@@ -409,8 +409,8 @@  discard block
 block discarded – undo
409 409
  *
410 410
  * @return int $earnings Earnings for a certain form
411 411
  */
412
-function give_get_form_earnings_stats( $form_id = 0 ) {
413
-	$give_form = new Give_Donate_Form( $form_id );
412
+function give_get_form_earnings_stats($form_id = 0) {
413
+	$give_form = new Give_Donate_Form($form_id);
414 414
 
415 415
 	return $give_form->earnings;
416 416
 }
@@ -425,8 +425,8 @@  discard block
 block discarded – undo
425 425
  *
426 426
  * @return int $sales Amount of sales for a certain form
427 427
  */
428
-function give_get_form_sales_stats( $give_form_id = 0 ) {
429
-	$give_form = new Give_Donate_Form( $give_form_id );
428
+function give_get_form_sales_stats($give_form_id = 0) {
429
+	$give_form = new Give_Donate_Form($give_form_id);
430 430
 
431 431
 	return $give_form->sales;
432 432
 }
@@ -441,16 +441,16 @@  discard block
 block discarded – undo
441 441
  *
442 442
  * @return float $sales Average monthly sales
443 443
  */
444
-function give_get_average_monthly_form_sales( $form_id = 0 ) {
445
-	$sales        = give_get_form_sales_stats( $form_id );
446
-	$release_date = get_post_field( 'post_date', $form_id );
444
+function give_get_average_monthly_form_sales($form_id = 0) {
445
+	$sales        = give_get_form_sales_stats($form_id);
446
+	$release_date = get_post_field('post_date', $form_id);
447 447
 
448
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
448
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
449 449
 
450
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
450
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
451 451
 
452
-	if ( $months > 0 ) {
453
-		$sales = ( $sales / $months );
452
+	if ($months > 0) {
453
+		$sales = ($sales / $months);
454 454
 	}
455 455
 
456 456
 	return $sales;
@@ -466,16 +466,16 @@  discard block
 block discarded – undo
466 466
  *
467 467
  * @return float $earnings Average monthly earnings
468 468
  */
469
-function give_get_average_monthly_form_earnings( $form_id = 0 ) {
470
-	$earnings     = give_get_form_earnings_stats( $form_id );
471
-	$release_date = get_post_field( 'post_date', $form_id );
469
+function give_get_average_monthly_form_earnings($form_id = 0) {
470
+	$earnings     = give_get_form_earnings_stats($form_id);
471
+	$release_date = get_post_field('post_date', $form_id);
472 472
 
473
-	$diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) );
473
+	$diff = abs(current_time('timestamp') - strtotime($release_date));
474 474
 
475
-	$months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication
475
+	$months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication
476 476
 
477
-	if ( $months > 0 ) {
478
-		$earnings = ( $earnings / $months );
477
+	if ($months > 0) {
478
+		$earnings = ($earnings / $months);
479 479
 	}
480 480
 
481 481
 	return $earnings < 0 ? 0 : $earnings;
@@ -495,25 +495,25 @@  discard block
 block discarded – undo
495 495
  *
496 496
  * @return string $price_name Name of the price option
497 497
  */
498
-function give_get_price_option_name( $form_id = 0, $price_id = 0, $payment_id = 0 ) {
498
+function give_get_price_option_name($form_id = 0, $price_id = 0, $payment_id = 0) {
499 499
 
500
-	$prices     = give_get_variable_prices( $form_id );
500
+	$prices     = give_get_variable_prices($form_id);
501 501
 	$price_name = '';
502 502
 
503
-	foreach ( $prices as $price ) {
503
+	foreach ($prices as $price) {
504 504
 
505
-		if ( intval( $price['_give_id']['level_id'] ) == intval( $price_id ) ) {
505
+		if (intval($price['_give_id']['level_id']) == intval($price_id)) {
506 506
 
507
-			$price_text     = isset( $price['_give_text'] ) ? $price['_give_text'] : '';
508
-			$price_fallback = give_currency_filter( give_format_amount( $price['_give_amount'] ) );
509
-			$price_name     = ! empty( $price_text ) ? $price_text : $price_fallback;
507
+			$price_text     = isset($price['_give_text']) ? $price['_give_text'] : '';
508
+			$price_fallback = give_currency_filter(give_format_amount($price['_give_amount']));
509
+			$price_name     = ! empty($price_text) ? $price_text : $price_fallback;
510 510
 
511 511
 		}
512 512
 
513 513
 	}
514 514
 
515 515
 
516
-	return apply_filters( 'give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id );
516
+	return apply_filters('give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id);
517 517
 }
518 518
 
519 519
 
@@ -526,14 +526,14 @@  discard block
 block discarded – undo
526 526
  *
527 527
  * @return string $range A fully formatted price range
528 528
  */
529
-function give_price_range( $form_id = 0 ) {
530
-	$low   = give_get_lowest_price_option( $form_id );
531
-	$high  = give_get_highest_price_option( $form_id );
532
-	$range = '<span class="give_price_range_low">' . give_currency_filter( give_format_amount( $low ) ) . '</span>';
529
+function give_price_range($form_id = 0) {
530
+	$low   = give_get_lowest_price_option($form_id);
531
+	$high  = give_get_highest_price_option($form_id);
532
+	$range = '<span class="give_price_range_low">'.give_currency_filter(give_format_amount($low)).'</span>';
533 533
 	$range .= '<span class="give_price_range_sep">&nbsp;&ndash;&nbsp;</span>';
534
-	$range .= '<span class="give_price_range_high">' . give_currency_filter( give_format_amount( $high ) ) . '</span>';
534
+	$range .= '<span class="give_price_range_high">'.give_currency_filter(give_format_amount($high)).'</span>';
535 535
 
536
-	return apply_filters( 'give_price_range', $range, $form_id, $low, $high );
536
+	return apply_filters('give_price_range', $range, $form_id, $low, $high);
537 537
 }
538 538
 
539 539
 
@@ -548,36 +548,36 @@  discard block
 block discarded – undo
548 548
  *
549 549
  * @return int ID of the lowest price
550 550
  */
551
-function give_get_lowest_price_id( $form_id = 0 ) {
551
+function give_get_lowest_price_id($form_id = 0) {
552 552
 
553
-	if ( empty( $form_id ) ) {
553
+	if (empty($form_id)) {
554 554
 		$form_id = get_the_ID();
555 555
 	}
556 556
 
557
-	if ( ! give_has_variable_prices( $form_id ) ) {
558
-		return give_get_form_price( $form_id );
557
+	if ( ! give_has_variable_prices($form_id)) {
558
+		return give_get_form_price($form_id);
559 559
 	}
560 560
 
561
-	$prices = give_get_variable_prices( $form_id );
561
+	$prices = give_get_variable_prices($form_id);
562 562
 
563 563
 	$low    = 0.00;
564 564
 	$min_id = 1;
565 565
 
566
-	if ( ! empty( $prices ) ) {
566
+	if ( ! empty($prices)) {
567 567
 
568
-		foreach ( $prices as $key => $price ) {
568
+		foreach ($prices as $key => $price) {
569 569
 
570
-			if ( empty( $price['_give_amount'] ) ) {
570
+			if (empty($price['_give_amount'])) {
571 571
 				continue;
572 572
 			}
573 573
 
574
-			if ( ! isset( $min ) ) {
574
+			if ( ! isset($min)) {
575 575
 				$min = $price['_give_amount'];
576 576
 			} else {
577
-				$min = min( $min, $price['_give_amount'] );
577
+				$min = min($min, $price['_give_amount']);
578 578
 			}
579 579
 
580
-			if ( $price['_give_amount'] == $min ) {
580
+			if ($price['_give_amount'] == $min) {
581 581
 				$min_id = $price['_give_id']['level_id'];
582 582
 			}
583 583
 		}
@@ -595,43 +595,43 @@  discard block
 block discarded – undo
595 595
  *
596 596
  * @return float Amount of the lowest price
597 597
  */
598
-function give_get_lowest_price_option( $form_id = 0 ) {
599
-	if ( empty( $form_id ) ) {
598
+function give_get_lowest_price_option($form_id = 0) {
599
+	if (empty($form_id)) {
600 600
 		$form_id = get_the_ID();
601 601
 	}
602 602
 
603
-	if ( ! give_has_variable_prices( $form_id ) ) {
604
-		return give_get_form_price( $form_id );
603
+	if ( ! give_has_variable_prices($form_id)) {
604
+		return give_get_form_price($form_id);
605 605
 	}
606 606
 
607
-	$prices = give_get_variable_prices( $form_id );
607
+	$prices = give_get_variable_prices($form_id);
608 608
 
609 609
 	$low = 0.00;
610 610
 
611
-	if ( ! empty( $prices ) ) {
611
+	if ( ! empty($prices)) {
612 612
 
613
-		foreach ( $prices as $key => $price ) {
613
+		foreach ($prices as $key => $price) {
614 614
 
615
-			if ( empty( $price['_give_amount'] ) ) {
615
+			if (empty($price['_give_amount'])) {
616 616
 				continue;
617 617
 			}
618 618
 
619
-			if ( ! isset( $min ) ) {
619
+			if ( ! isset($min)) {
620 620
 				$min = $price['_give_amount'];
621 621
 			} else {
622
-				$min = min( $min, give_sanitize_amount( $price['_give_amount'] ) );
622
+				$min = min($min, give_sanitize_amount($price['_give_amount']));
623 623
 			}
624 624
 
625
-			if ( $price['_give_amount'] == $min ) {
625
+			if ($price['_give_amount'] == $min) {
626 626
 				$min_id = $key;
627 627
 			}
628 628
 		}
629 629
 
630
-		$low = $prices[ $min_id ]['_give_amount'];
630
+		$low = $prices[$min_id]['_give_amount'];
631 631
 
632 632
 	}
633 633
 
634
-	return give_sanitize_amount( $low );
634
+	return give_sanitize_amount($low);
635 635
 }
636 636
 
637 637
 /**
@@ -643,41 +643,41 @@  discard block
 block discarded – undo
643 643
  *
644 644
  * @return float Amount of the highest price
645 645
  */
646
-function give_get_highest_price_option( $form_id = 0 ) {
646
+function give_get_highest_price_option($form_id = 0) {
647 647
 
648
-	if ( empty( $form_id ) ) {
648
+	if (empty($form_id)) {
649 649
 		$form_id = get_the_ID();
650 650
 	}
651 651
 
652
-	if ( ! give_has_variable_prices( $form_id ) ) {
653
-		return give_get_form_price( $form_id );
652
+	if ( ! give_has_variable_prices($form_id)) {
653
+		return give_get_form_price($form_id);
654 654
 	}
655 655
 
656
-	$prices = give_get_variable_prices( $form_id );
656
+	$prices = give_get_variable_prices($form_id);
657 657
 
658 658
 	$high = 0.00;
659 659
 
660
-	if ( ! empty( $prices ) ) {
660
+	if ( ! empty($prices)) {
661 661
 
662 662
 		$max = 0;
663 663
 
664
-		foreach ( $prices as $key => $price ) {
665
-			if ( empty( $price['_give_amount'] ) ) {
664
+		foreach ($prices as $key => $price) {
665
+			if (empty($price['_give_amount'])) {
666 666
 				continue;
667 667
 			}
668
-			$give_amount = give_sanitize_amount( $price['_give_amount'] );
668
+			$give_amount = give_sanitize_amount($price['_give_amount']);
669 669
 
670
-			$max = max( $max, $give_amount );
670
+			$max = max($max, $give_amount);
671 671
 
672
-			if ( $give_amount == $max ) {
672
+			if ($give_amount == $max) {
673 673
 				$max_id = $key;
674 674
 			}
675 675
 		}
676 676
 
677
-		$high = $prices[ $max_id ]['_give_amount'];
677
+		$high = $prices[$max_id]['_give_amount'];
678 678
 	}
679 679
 
680
-	return give_sanitize_amount( $high );
680
+	return give_sanitize_amount($high);
681 681
 }
682 682
 
683 683
 /**
@@ -689,15 +689,15 @@  discard block
 block discarded – undo
689 689
  *
690 690
  * @return mixed string|int Price of the form
691 691
  */
692
-function give_get_form_price( $form_id = 0 ) {
692
+function give_get_form_price($form_id = 0) {
693 693
 
694
-	if ( empty( $form_id ) ) {
694
+	if (empty($form_id)) {
695 695
 		return false;
696 696
 	}
697 697
 
698
-	$form = new Give_Donate_Form( $form_id );
698
+	$form = new Give_Donate_Form($form_id);
699 699
 
700
-	return $form->__get( 'price' );
700
+	return $form->__get('price');
701 701
 }
702 702
 
703 703
 /**
@@ -709,15 +709,15 @@  discard block
 block discarded – undo
709 709
  *
710 710
  * @return mixed string|int Minimum price of the form
711 711
  */
712
-function give_get_form_minimum_price( $form_id = 0 ) {
712
+function give_get_form_minimum_price($form_id = 0) {
713 713
 
714
-	if ( empty( $form_id ) ) {
714
+	if (empty($form_id)) {
715 715
 		return false;
716 716
 	}
717 717
 
718
-	$form = new Give_Donate_Form( $form_id );
718
+	$form = new Give_Donate_Form($form_id);
719 719
 
720
-	return $form->__get( 'minimum_price' );
720
+	return $form->__get('minimum_price');
721 721
 
722 722
 }
723 723
 
@@ -732,52 +732,52 @@  discard block
 block discarded – undo
732 732
  *
733 733
  * @return int $formatted_price
734 734
  */
735
-function give_price( $form_id = 0, $echo = true, $price_id = false ) {
735
+function give_price($form_id = 0, $echo = true, $price_id = false) {
736 736
 
737
-	if ( empty( $form_id ) ) {
737
+	if (empty($form_id)) {
738 738
 		$form_id = get_the_ID();
739 739
 	}
740 740
 
741
-	if ( give_has_variable_prices( $form_id ) ) {
741
+	if (give_has_variable_prices($form_id)) {
742 742
 
743
-		$prices = give_get_variable_prices( $form_id );
743
+		$prices = give_get_variable_prices($form_id);
744 744
 
745
-		if ( false !== $price_id ) {
745
+		if (false !== $price_id) {
746 746
 
747 747
 			//loop through multi-prices to see which is default
748
-			foreach ( $prices as $price ) {
748
+			foreach ($prices as $price) {
749 749
 				//this is the default price
750
-				if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
750
+				if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
751 751
 					$price = (float) $price['_give_amount'];
752 752
 				};
753 753
 			}
754 754
 
755 755
 		} else {
756 756
 
757
-			$price = give_get_lowest_price_option( $form_id );
757
+			$price = give_get_lowest_price_option($form_id);
758 758
 		}
759 759
 
760
-		$price = give_sanitize_amount( $price );
760
+		$price = give_sanitize_amount($price);
761 761
 
762 762
 	} else {
763 763
 
764
-		$price = give_get_form_price( $form_id );
764
+		$price = give_get_form_price($form_id);
765 765
 
766 766
 	}
767 767
 
768
-	$price           = apply_filters( 'give_form_price', give_sanitize_amount( $price ), $form_id );
769
-	$formatted_price = '<span class="give_price" id="give_price_' . $form_id . '">' . $price . '</span>';
770
-	$formatted_price = apply_filters( 'give_form_price_after_html', $formatted_price, $form_id, $price );
768
+	$price           = apply_filters('give_form_price', give_sanitize_amount($price), $form_id);
769
+	$formatted_price = '<span class="give_price" id="give_price_'.$form_id.'">'.$price.'</span>';
770
+	$formatted_price = apply_filters('give_form_price_after_html', $formatted_price, $form_id, $price);
771 771
 
772
-	if ( $echo ) {
772
+	if ($echo) {
773 773
 		echo $formatted_price;
774 774
 	} else {
775 775
 		return $formatted_price;
776 776
 	}
777 777
 }
778 778
 
779
-add_filter( 'give_form_price', 'give_format_amount', 10 );
780
-add_filter( 'give_form_price', 'give_currency_filter', 20 );
779
+add_filter('give_form_price', 'give_format_amount', 10);
780
+add_filter('give_form_price', 'give_currency_filter', 20);
781 781
 
782 782
 
783 783
 /**
@@ -790,19 +790,19 @@  discard block
 block discarded – undo
790 790
  *
791 791
  * @return float $amount Amount of the price option
792 792
  */
793
-function give_get_price_option_amount( $form_id = 0, $price_id = 0 ) {
794
-	$prices = give_get_variable_prices( $form_id );
793
+function give_get_price_option_amount($form_id = 0, $price_id = 0) {
794
+	$prices = give_get_variable_prices($form_id);
795 795
 
796 796
 	$amount = 0.00;
797 797
 
798
-	foreach ( $prices as $price ) {
799
-		if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] == $price_id ) {
800
-			$amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00;
798
+	foreach ($prices as $price) {
799
+		if (isset($price['_give_id']['level_id']) && $price['_give_id']['level_id'] == $price_id) {
800
+			$amount = isset($price['_give_amount']) ? $price['_give_amount'] : 0.00;
801 801
             break;
802 802
 		};
803 803
 	}
804 804
 
805
-	return apply_filters( 'give_get_price_option_amount', give_sanitize_amount( $amount ), $form_id, $price_id );
805
+	return apply_filters('give_get_price_option_amount', give_sanitize_amount($amount), $form_id, $price_id);
806 806
 }
807 807
 
808 808
 /**
@@ -814,13 +814,13 @@  discard block
 block discarded – undo
814 814
  *
815 815
  * @return mixed string|int Goal of the form
816 816
  */
817
-function give_get_form_goal( $form_id = 0 ) {
817
+function give_get_form_goal($form_id = 0) {
818 818
 
819
-	if ( empty( $form_id ) ) {
819
+	if (empty($form_id)) {
820 820
 		return false;
821 821
 	}
822 822
 
823
-	$form = new Give_Donate_Form( $form_id );
823
+	$form = new Give_Donate_Form($form_id);
824 824
 
825 825
 	return $form->goal;
826 826
 
@@ -836,27 +836,27 @@  discard block
 block discarded – undo
836 836
  *
837 837
  * @return string $formatted_goal
838 838
  */
839
-function give_goal( $form_id = 0, $echo = true ) {
839
+function give_goal($form_id = 0, $echo = true) {
840 840
 
841
-	if ( empty( $form_id ) ) {
841
+	if (empty($form_id)) {
842 842
 		$form_id = get_the_ID();
843 843
 	}
844 844
 
845
-	$goal = give_get_form_goal( $form_id );
845
+	$goal = give_get_form_goal($form_id);
846 846
 
847
-	$goal           = apply_filters( 'give_form_goal', give_sanitize_amount( $goal ), $form_id );
848
-	$formatted_goal = '<span class="give_price" id="give_price_' . $form_id . '">' . $goal . '</span>';
849
-	$formatted_goal = apply_filters( 'give_form_price_after_html', $formatted_goal, $form_id, $goal );
847
+	$goal           = apply_filters('give_form_goal', give_sanitize_amount($goal), $form_id);
848
+	$formatted_goal = '<span class="give_price" id="give_price_'.$form_id.'">'.$goal.'</span>';
849
+	$formatted_goal = apply_filters('give_form_price_after_html', $formatted_goal, $form_id, $goal);
850 850
 
851
-	if ( $echo ) {
851
+	if ($echo) {
852 852
 		echo $formatted_goal;
853 853
 	} else {
854 854
 		return $formatted_goal;
855 855
 	}
856 856
 }
857 857
 
858
-add_filter( 'give_form_goal', 'give_format_amount', 10 );
859
-add_filter( 'give_form_goal', 'give_currency_filter', 20 );
858
+add_filter('give_form_goal', 'give_format_amount', 10);
859
+add_filter('give_form_goal', 'give_currency_filter', 20);
860 860
 
861 861
 
862 862
 /**
@@ -870,13 +870,13 @@  discard block
 block discarded – undo
870 870
  *
871 871
  * @return bool  $ret Whether or not the logged_in_only setting is set
872 872
  */
873
-function give_logged_in_only( $form_id ) {
873
+function give_logged_in_only($form_id) {
874 874
 
875
-	$form_option = get_post_meta( $form_id, '_give_logged_in_only', true );
875
+	$form_option = get_post_meta($form_id, '_give_logged_in_only', true);
876 876
 
877
-	$ret = ! empty( $form_option ) ? $form_option : false;
877
+	$ret = ! empty($form_option) ? $form_option : false;
878 878
 
879
-	return (bool) apply_filters( 'give_logged_in_only', $ret, $form_id );
879
+	return (bool) apply_filters('give_logged_in_only', $ret, $form_id);
880 880
 
881 881
 }
882 882
 
@@ -890,10 +890,10 @@  discard block
 block discarded – undo
890 890
  *
891 891
  * @return string
892 892
  */
893
-function give_show_login_register_option( $form_id ) {
893
+function give_show_login_register_option($form_id) {
894 894
 
895
-	$show_register_form = get_post_meta( $form_id, '_give_show_register_form', true );
895
+	$show_register_form = get_post_meta($form_id, '_give_show_register_form', true);
896 896
 
897
-	return apply_filters( 'give_show_register_form', $show_register_form, $form_id );
897
+	return apply_filters('give_show_register_form', $show_register_form, $form_id);
898 898
 
899 899
 }
900 900
\ No newline at end of file
Please login to merge, or discard this patch.
includes/forms/template.php 1 patch
Spacing   +374 added lines, -374 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,47 +23,47 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string $purchase_form
25 25
  */
26
-function give_get_donation_form( $args = array() ) {
26
+function give_get_donation_form($args = array()) {
27 27
 
28 28
 	global $post;
29 29
 
30
-	$form_id = is_object( $post ) ? $post->ID : 0;
30
+	$form_id = is_object($post) ? $post->ID : 0;
31 31
 
32
-	if ( isset( $args['id'] ) ) {
32
+	if (isset($args['id'])) {
33 33
 		$form_id = $args['id'];
34 34
 	}
35 35
 
36
-	$defaults = apply_filters( 'give_form_args_defaults', array(
36
+	$defaults = apply_filters('give_form_args_defaults', array(
37 37
 		'form_id' => $form_id
38
-	) );
38
+	));
39 39
 
40
-	$args = wp_parse_args( $args, $defaults );
40
+	$args = wp_parse_args($args, $defaults);
41 41
 
42
-	$form = new Give_Donate_Form( $args['form_id'] );
42
+	$form = new Give_Donate_Form($args['form_id']);
43 43
 
44 44
 	//bail if no form ID
45
-	if ( empty( $form->ID ) ) {
45
+	if (empty($form->ID)) {
46 46
 		return false;
47 47
 	}
48 48
 
49
-	$payment_mode = give_get_chosen_gateway( $form->ID );
49
+	$payment_mode = give_get_chosen_gateway($form->ID);
50 50
 
51
-	$form_action = add_query_arg( apply_filters( 'give_form_action_args', array(
51
+	$form_action = add_query_arg(apply_filters('give_form_action_args', array(
52 52
 		'payment-mode' => $payment_mode,
53
-	) ),
53
+	)),
54 54
 		give_get_current_page_url()
55 55
 	);
56 56
 
57 57
 	//Sanity Check: Donation form not published or user doesn't have permission to view drafts
58
-	if ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) {
58
+	if ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) {
59 59
 		return false;
60 60
 	}
61 61
 
62 62
 	//Get the form wrap CSS classes.
63
-	$form_wrap_classes       = $form->get_form_wrap_classes($args);
63
+	$form_wrap_classes = $form->get_form_wrap_classes($args);
64 64
 
65 65
 	//Get the <form> tag wrap CSS classes.
66
-	$form_classes       = $form->get_form_classes($args);
66
+	$form_classes = $form->get_form_classes($args);
67 67
 
68 68
 	ob_start();
69 69
 
@@ -75,35 +75,35 @@  discard block
 block discarded – undo
75 75
 	 * @param int $form ->ID The current form ID
76 76
 	 * @param array $args An array of form args
77 77
 	 */
78
-	do_action( 'give_pre_form_output', $form->ID, $args ); ?>
78
+	do_action('give_pre_form_output', $form->ID, $args); ?>
79 79
 
80 80
 	<div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>">
81 81
 
82
-		<?php if ( $form->is_close_donation_form() ) {
82
+		<?php if ($form->is_close_donation_form()) {
83 83
 
84 84
 			//Get Goal thank you message.
85
-			$display_thankyou_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true );
86
-			$display_thankyou_message = ! empty( $display_thankyou_message ) ? $display_thankyou_message : esc_html__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' );
85
+			$display_thankyou_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true);
86
+			$display_thankyou_message = ! empty($display_thankyou_message) ? $display_thankyou_message : esc_html__('Thank you to all our donors, we have met our fundraising goal.', 'give');
87 87
 
88 88
 			//Print thank you message.
89
-			apply_filters( 'give_goal_closed_output', give_output_error( $display_thankyou_message, true, 'success' ) );
89
+			apply_filters('give_goal_closed_output', give_output_error($display_thankyou_message, true, 'success'));
90 90
 
91 91
 		} else {
92 92
 
93
-			if ( isset( $args['show_title'] ) && $args['show_title'] == true ) {
93
+			if (isset($args['show_title']) && $args['show_title'] == true) {
94 94
 
95
-				echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' );
95
+				echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>');
96 96
 
97 97
 			}
98 98
 
99
-			do_action( 'give_pre_form', $form->ID, $args ); ?>
99
+			do_action('give_pre_form', $form->ID, $args); ?>
100 100
 
101
-			<form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" action="<?php echo esc_url_raw( $form_action ); ?>" method="post">
101
+			<form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" action="<?php echo esc_url_raw($form_action); ?>" method="post">
102 102
 				<input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/>
103
-				<input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/>
104
-				<input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
105
-				<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
106
-				<input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/>
103
+				<input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/>
104
+				<input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
105
+				<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
106
+				<input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/>
107 107
 
108 108
 				<!-- The following field is for robots only, invisible to humans: -->
109 109
 				<span class="give-hidden" style="display: none !important;">
@@ -114,13 +114,13 @@  discard block
 block discarded – undo
114 114
 				<?php
115 115
 
116 116
 				//Price ID hidden field for variable (mult-level) donation forms
117
-				if ( give_has_variable_prices( $form_id ) ) {
117
+				if (give_has_variable_prices($form_id)) {
118 118
 					//get default selected price ID
119
-					$prices   = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
119
+					$prices   = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
120 120
 					$price_id = 0;
121 121
 					//loop through prices
122
-					foreach ( $prices as $price ) {
123
-						if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
122
+					foreach ($prices as $price) {
123
+						if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
124 124
 							$price_id = $price['_give_id']['level_id'];
125 125
 						};
126 126
 					}
@@ -128,20 +128,20 @@  discard block
 block discarded – undo
128 128
 					<input type="hidden" name="give-price-id" value="<?php echo $price_id; ?>"/>
129 129
 				<?php }
130 130
 
131
-				do_action( 'give_checkout_form_top', $form->ID, $args );
131
+				do_action('give_checkout_form_top', $form->ID, $args);
132 132
 
133
-				do_action( 'give_payment_mode_select', $form->ID, $args );
133
+				do_action('give_payment_mode_select', $form->ID, $args);
134 134
 
135
-				do_action( 'give_checkout_form_bottom', $form->ID, $args );
135
+				do_action('give_checkout_form_bottom', $form->ID, $args);
136 136
 
137 137
 				?>
138 138
 			</form>
139 139
 
140
-			<?php do_action( 'give_post_form', $form->ID, $args ); ?>
140
+			<?php do_action('give_post_form', $form->ID, $args); ?>
141 141
 
142 142
 		<?php } ?>
143 143
 
144
-		<!--end #give-form-<?php echo absint( $form->ID ); ?>--></div>
144
+		<!--end #give-form-<?php echo absint($form->ID); ?>--></div>
145 145
 	<?php
146 146
 
147 147
 	/**
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
 	 * @param int $form ->ID The current form ID
153 153
 	 * @param array $args An array of form args
154 154
 	 */
155
-	do_action( 'give_post_form_output', $form->ID, $args );
155
+	do_action('give_post_form_output', $form->ID, $args);
156 156
 
157 157
 	$final_output = ob_get_clean();
158 158
 
159
-	echo apply_filters( 'give_donate_form', $final_output, $args );
159
+	echo apply_filters('give_donate_form', $final_output, $args);
160 160
 }
161 161
 
162 162
 
@@ -175,43 +175,43 @@  discard block
 block discarded – undo
175 175
  *
176 176
  * @return string
177 177
  */
178
-function give_show_purchase_form( $form_id ) {
178
+function give_show_purchase_form($form_id) {
179 179
 
180
-	$payment_mode = give_get_chosen_gateway( $form_id );
180
+	$payment_mode = give_get_chosen_gateway($form_id);
181 181
 
182
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
182
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
183 183
 		$form_id = $_POST['give_form_id'];
184 184
 	}
185 185
 
186
-	do_action( 'give_purchase_form_top', $form_id );
186
+	do_action('give_purchase_form_top', $form_id);
187 187
 
188
-	if ( give_can_checkout() && isset( $form_id ) ) {
188
+	if (give_can_checkout() && isset($form_id)) {
189 189
 
190
-		do_action( 'give_purchase_form_before_register_login', $form_id );
190
+		do_action('give_purchase_form_before_register_login', $form_id);
191 191
 
192
-		do_action( 'give_purchase_form_register_login_fields', $form_id );
192
+		do_action('give_purchase_form_register_login_fields', $form_id);
193 193
 
194
-		do_action( 'give_purchase_form_before_cc_form', $form_id );
194
+		do_action('give_purchase_form_before_cc_form', $form_id);
195 195
 
196 196
 		// Load the credit card form and allow gateways to load their own if they wish
197
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
198
-			do_action( 'give_' . $payment_mode . '_cc_form', $form_id );
197
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
198
+			do_action('give_'.$payment_mode.'_cc_form', $form_id);
199 199
 		} else {
200
-			do_action( 'give_cc_form', $form_id );
200
+			do_action('give_cc_form', $form_id);
201 201
 		}
202 202
 
203
-		do_action( 'give_purchase_form_after_cc_form', $form_id );
203
+		do_action('give_purchase_form_after_cc_form', $form_id);
204 204
 
205 205
 	} else {
206 206
 		// Can't checkout
207
-		do_action( 'give_purchase_form_no_access', $form_id );
207
+		do_action('give_purchase_form_no_access', $form_id);
208 208
 
209 209
 	}
210 210
 
211
-	do_action( 'give_purchase_form_bottom', $form_id );
211
+	do_action('give_purchase_form_bottom', $form_id);
212 212
 }
213 213
 
214
-add_action( 'give_purchase_form', 'give_show_purchase_form' );
214
+add_action('give_purchase_form', 'give_show_purchase_form');
215 215
 
216 216
 /**
217 217
  *
@@ -223,26 +223,26 @@  discard block
 block discarded – undo
223 223
  *
224 224
  * @return void
225 225
  */
226
-function give_show_register_login_fields( $form_id ) {
226
+function give_show_register_login_fields($form_id) {
227 227
 
228
-	$show_register_form = give_show_login_register_option( $form_id );
228
+	$show_register_form = give_show_login_register_option($form_id);
229 229
 
230
-	if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?>
230
+	if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : ?>
231 231
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
232
-			<?php do_action( 'give_purchase_form_register_fields', $form_id ); ?>
232
+			<?php do_action('give_purchase_form_register_fields', $form_id); ?>
233 233
 		</div>
234
-	<?php elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?>
234
+	<?php elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : ?>
235 235
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
236
-			<?php do_action( 'give_purchase_form_login_fields', $form_id ); ?>
236
+			<?php do_action('give_purchase_form_login_fields', $form_id); ?>
237 237
 		</div>
238 238
 	<?php endif; ?>
239 239
 
240
-	<?php if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) {
241
-		do_action( 'give_purchase_form_after_user_info', $form_id );
240
+	<?php if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) {
241
+		do_action('give_purchase_form_after_user_info', $form_id);
242 242
 	}
243 243
 }
244 244
 
245
-add_action( 'give_purchase_form_register_login_fields', 'give_show_register_login_fields' );
245
+add_action('give_purchase_form_register_login_fields', 'give_show_register_login_fields');
246 246
 
247 247
 /**
248 248
  * Donation Amount Field
@@ -256,33 +256,33 @@  discard block
 block discarded – undo
256 256
  *
257 257
  * @return void
258 258
  */
259
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
259
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
260 260
 
261 261
 	global $give_options;
262 262
 
263
-	$variable_pricing    = give_has_variable_prices( $form_id );
264
-	$allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true );
265
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
266
-	$symbol              = give_currency_symbol( give_get_currency() );
267
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
268
-	$default_amount      = give_format_amount( give_get_default_form_amount( $form_id ) );
269
-	$custom_amount_text  = get_post_meta( $form_id, '_give_custom_amount_text', true );
263
+	$variable_pricing    = give_has_variable_prices($form_id);
264
+	$allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true);
265
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
266
+	$symbol              = give_currency_symbol(give_get_currency());
267
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
268
+	$default_amount      = give_format_amount(give_get_default_form_amount($form_id));
269
+	$custom_amount_text  = get_post_meta($form_id, '_give_custom_amount_text', true);
270 270
 
271
-	do_action( 'give_before_donation_levels', $form_id, $args );
271
+	do_action('give_before_donation_levels', $form_id, $args);
272 272
 
273 273
 	//Set Price, No Custom Amount Allowed means hidden price field
274
-	if ( $allow_custom_amount == 'no' ) {
274
+	if ($allow_custom_amount == 'no') {
275 275
 		?>
276 276
 
277
-		<label class="give-hidden" for="give-amount-hidden"><?php echo esc_html__( 'Donation Amount:', 'give' ); ?></label>
277
+		<label class="give-hidden" for="give-amount-hidden"><?php echo esc_html__('Donation Amount:', 'give'); ?></label>
278 278
 		<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount"
279 279
 		       value="<?php echo $default_amount; ?>" required>
280 280
 		<div class="set-price give-donation-amount form-row-wide">
281
-			<?php if ( $currency_position == 'before' ) {
281
+			<?php if ($currency_position == 'before') {
282 282
 				echo $currency_output;
283 283
 			} ?>
284 284
 			<span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span>
285
-			<?php if ( $currency_position == 'after' ) {
285
+			<?php if ($currency_position == 'after') {
286 286
 				echo $currency_output;
287 287
 			} ?>
288 288
 		</div>
@@ -292,34 +292,34 @@  discard block
 block discarded – undo
292 292
 		?>
293 293
 		<div class="give-total-wrap">
294 294
 			<div class="give-donation-amount form-row-wide">
295
-				<?php if ( $currency_position == 'before' ) {
295
+				<?php if ($currency_position == 'before') {
296 296
 					echo $currency_output;
297 297
 				} ?>
298
-				<label class="give-hidden" for="give-amount"><?php echo esc_html__( 'Donation Amount:', 'give' ); ?></label>
298
+				<label class="give-hidden" for="give-amount"><?php echo esc_html__('Donation Amount:', 'give'); ?></label>
299 299
 				<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
300
-				<?php if ( $currency_position == 'after' ) {
300
+				<?php if ($currency_position == 'after') {
301 301
 					echo $currency_output;
302 302
 				} ?>
303 303
 			</div>
304 304
 		</div>
305 305
 	<?php }
306 306
 
307
-	do_action( 'give_after_donation_amount', $form_id, $args );
307
+	do_action('give_after_donation_amount', $form_id, $args);
308 308
 
309 309
 	//Custom Amount Text
310
-	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?>
310
+	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?>
311 311
 		<p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
312 312
 	<?php }
313 313
 
314 314
 	//Output Variable Pricing Levels
315
-	if ( $variable_pricing ) {
316
-		give_output_levels( $form_id );
315
+	if ($variable_pricing) {
316
+		give_output_levels($form_id);
317 317
 	}
318 318
 
319
-	do_action( 'give_after_donation_levels', $form_id, $args );
319
+	do_action('give_after_donation_levels', $form_id, $args);
320 320
 }
321 321
 
322
-add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 );
322
+add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2);
323 323
 
324 324
 
325 325
 /**
@@ -331,32 +331,32 @@  discard block
 block discarded – undo
331 331
  *
332 332
  * @return string
333 333
  */
334
-function give_output_levels( $form_id ) {
334
+function give_output_levels($form_id) {
335 335
 
336 336
 	//Get variable pricing
337
-	$prices             = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
338
-	$display_style      = get_post_meta( $form_id, '_give_display_style', true );
339
-	$custom_amount      = get_post_meta( $form_id, '_give_custom_amount', true );
340
-	$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
341
-	if ( empty( $custom_amount_text ) ) {
342
-		$custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' );
337
+	$prices             = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
338
+	$display_style      = get_post_meta($form_id, '_give_display_style', true);
339
+	$custom_amount      = get_post_meta($form_id, '_give_custom_amount', true);
340
+	$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
341
+	if (empty($custom_amount_text)) {
342
+		$custom_amount_text = esc_html__('Give a Custom Amount', 'give');
343 343
 	}
344 344
 
345 345
 	$output  = '';
346 346
 	$counter = 0;
347 347
 
348
-	switch ( $display_style ) {
348
+	switch ($display_style) {
349 349
 		case 'buttons':
350 350
 
351 351
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
352 352
 
353
-			foreach ( $prices as $price ) {
354
-				$counter ++;
355
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
356
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price );
353
+			foreach ($prices as $price) {
354
+				$counter++;
355
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
356
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$counter.' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price);
357 357
 
358 358
 				$output .= '<li>';
359
-				$output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">';
359
+				$output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">';
360 360
 				$output .= $level_text;
361 361
 				$output .= '</button>';
362 362
 				$output .= '</li>';
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 			}
365 365
 
366 366
 			//Custom Amount
367
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
367
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
368 368
 				$output .= '<li>';
369 369
 				$output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">';
370 370
 				$output .= $custom_amount_text;
@@ -380,23 +380,23 @@  discard block
 block discarded – undo
380 380
 
381 381
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
382 382
 
383
-			foreach ( $prices as $price ) {
384
-				$counter ++;
385
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
386
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
383
+			foreach ($prices as $price) {
384
+				$counter++;
385
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
386
+				$level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$counter.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
387 387
 
388 388
 				$output .= '<li>';
389
-				$output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">';
390
-				$output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>';
389
+				$output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$counter.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">';
390
+				$output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>';
391 391
 				$output .= '</li>';
392 392
 
393 393
 			}
394 394
 
395 395
 			//Custom Amount
396
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
396
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
397 397
 				$output .= '<li>';
398 398
 				$output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">';
399
-				$output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>';
399
+				$output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>';
400 400
 				$output .= '</li>';
401 401
 			}
402 402
 
@@ -406,23 +406,23 @@  discard block
 block discarded – undo
406 406
 
407 407
 		case 'dropdown':
408 408
 
409
-			$output .= '<label for="give-donation-level" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>';
410
-			$output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">';
409
+			$output .= '<label for="give-donation-level" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>';
410
+			$output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">';
411 411
 
412 412
 			//first loop through prices
413
-			foreach ( $prices as $price ) {
414
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
415
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
413
+			foreach ($prices as $price) {
414
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
415
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
416 416
 
417
-				$output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">';
417
+				$output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount']).'">';
418 418
 				$output .= $level_text;
419 419
 				$output .= '</option>';
420 420
 
421 421
 			}
422 422
 
423 423
 			//Custom Amount
424
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
425
-				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>';
424
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
425
+				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>';
426 426
 			}
427 427
 
428 428
 			$output .= '</select>';
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 			break;
431 431
 	}
432 432
 
433
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
433
+	echo apply_filters('give_form_level_output', $output, $form_id);
434 434
 }
435 435
 
436 436
 /**
@@ -442,26 +442,26 @@  discard block
 block discarded – undo
442 442
  * @param array $args
443 443
  *
444 444
  */
445
-function give_display_checkout_button( $form_id, $args ) {
445
+function give_display_checkout_button($form_id, $args) {
446 446
 
447
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
447
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
448 448
 		? $args['display_style']
449
-		: get_post_meta( $form_id, '_give_payment_display', true );
449
+		: get_post_meta($form_id, '_give_payment_display', true);
450 450
 
451 451
 	//no btn for onpage
452
-	if ( $display_option === 'onpage' ) {
452
+	if ($display_option === 'onpage') {
453 453
 		return;
454 454
 	}
455 455
 
456
-	$display_label_field = get_post_meta( $form_id, '_give_reveal_label', true );
457
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
456
+	$display_label_field = get_post_meta($form_id, '_give_reveal_label', true);
457
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
458 458
 
459
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
459
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
460 460
 
461
-	echo apply_filters( 'give_display_checkout_button', $output );
461
+	echo apply_filters('give_display_checkout_button', $output);
462 462
 }
463 463
 
464
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
464
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
465 465
 
466 466
 /**
467 467
  * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided.
@@ -472,71 +472,71 @@  discard block
 block discarded – undo
472 472
  *
473 473
  * @return void
474 474
  */
475
-function give_user_info_fields( $form_id ) {
475
+function give_user_info_fields($form_id) {
476 476
 
477
-	if ( is_user_logged_in() ) :
478
-		$user_data = get_userdata( get_current_user_id() );
477
+	if (is_user_logged_in()) :
478
+		$user_data = get_userdata(get_current_user_id());
479 479
 	endif;
480 480
 
481
-	do_action( 'give_purchase_form_before_personal_info', $form_id );
481
+	do_action('give_purchase_form_before_personal_info', $form_id);
482 482
 	?>
483 483
 	<fieldset id="give_checkout_user_info">
484
-		<legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend>
484
+		<legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend>
485 485
 		<p id="give-first-name-wrap" class="form-row form-row-first">
486 486
 			<label class="give-label" for="give-first">
487
-				<?php esc_html_e( 'First Name', 'give' ); ?>
488
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?>
487
+				<?php esc_html_e('First Name', 'give'); ?>
488
+				<?php if (give_field_is_required('give_first', $form_id)) { ?>
489 489
 					<span class="give-required-indicator">*</span>
490 490
 				<?php } ?>
491
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span>
491
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('We will use this to personalize your account experience.', 'give'); ?>"></span>
492 492
 			</label>
493
-			<input class="give-input required" type="text" name="give_first" placeholder="<?php esc_html_e( 'First Name', 'give' ); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if ( give_field_is_required( 'give_first', $form_id ) ) {
493
+			<input class="give-input required" type="text" name="give_first" placeholder="<?php esc_html_e('First Name', 'give'); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if (give_field_is_required('give_first', $form_id)) {
494 494
 				echo ' required ';
495 495
 			} ?>/>
496 496
 		</p>
497 497
 
498 498
 		<p id="give-last-name-wrap" class="form-row form-row-last">
499 499
 			<label class="give-label" for="give-last">
500
-				<?php esc_html_e( 'Last Name', 'give' ); ?>
501
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?>
500
+				<?php esc_html_e('Last Name', 'give'); ?>
501
+				<?php if (give_field_is_required('give_last', $form_id)) { ?>
502 502
 					<span class="give-required-indicator">*</span>
503 503
 				<?php } ?>
504
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span>
504
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span>
505 505
 			</label>
506 506
 
507
-			<input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) {
507
+			<input class="give-input<?php if (give_field_is_required('give_last', $form_id)) {
508 508
 				echo ' required';
509
-			} ?>" type="text" name="give_last" id="give-last" placeholder="<?php esc_html_e( 'Last Name', 'give' ); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if ( give_field_is_required( 'give_last', $form_id ) ) {
509
+			} ?>" type="text" name="give_last" id="give-last" placeholder="<?php esc_html_e('Last Name', 'give'); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if (give_field_is_required('give_last', $form_id)) {
510 510
 				echo ' required ';
511 511
 			} ?> />
512 512
 		</p>
513 513
 
514
-		<?php do_action( 'give_purchase_form_before_email', $form_id ); ?>
514
+		<?php do_action('give_purchase_form_before_email', $form_id); ?>
515 515
 		<p id="give-email-wrap" class="form-row form-row-wide">
516 516
 			<label class="give-label" for="give-email">
517
-				<?php esc_html_e( 'Email Address', 'give' ); ?>
518
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
517
+				<?php esc_html_e('Email Address', 'give'); ?>
518
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
519 519
 					<span class="give-required-indicator">*</span>
520 520
 				<?php } ?>
521
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'We will send the purchase receipt to this address.', 'give' ); ?>"></span>
521
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('We will send the purchase receipt to this address.', 'give'); ?>"></span>
522 522
 			</label>
523 523
 
524
-			<input class="give-input required" type="email" name="give_email" placeholder="<?php esc_html_e( 'Email address', 'give' ); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if ( give_field_is_required( 'give_email', $form_id ) ) {
524
+			<input class="give-input required" type="email" name="give_email" placeholder="<?php esc_html_e('Email address', 'give'); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if (give_field_is_required('give_email', $form_id)) {
525 525
 				echo ' required ';
526 526
 			} ?>/>
527 527
 
528 528
 		</p>
529
-		<?php do_action( 'give_purchase_form_after_email', $form_id ); ?>
529
+		<?php do_action('give_purchase_form_after_email', $form_id); ?>
530 530
 
531
-		<?php do_action( 'give_purchase_form_user_info', $form_id ); ?>
531
+		<?php do_action('give_purchase_form_user_info', $form_id); ?>
532 532
 	</fieldset>
533 533
 	<?php
534
-	do_action( 'give_purchase_form_after_personal_info', $form_id );
534
+	do_action('give_purchase_form_after_personal_info', $form_id);
535 535
 
536 536
 }
537 537
 
538
-add_action( 'give_purchase_form_after_user_info', 'give_user_info_fields' );
539
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
538
+add_action('give_purchase_form_after_user_info', 'give_user_info_fields');
539
+add_action('give_register_fields_before', 'give_user_info_fields');
540 540
 
541 541
 /**
542 542
  * Renders the credit card info form.
@@ -547,73 +547,73 @@  discard block
 block discarded – undo
547 547
  *
548 548
  * @return void
549 549
  */
550
-function give_get_cc_form( $form_id ) {
550
+function give_get_cc_form($form_id) {
551 551
 
552 552
 	ob_start();
553 553
 
554
-	do_action( 'give_before_cc_fields', $form_id ); ?>
554
+	do_action('give_before_cc_fields', $form_id); ?>
555 555
 
556 556
 	<fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate">
557
-		<legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend>
558
-		<?php if ( is_ssl() ) : ?>
557
+		<legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend>
558
+		<?php if (is_ssl()) : ?>
559 559
 			<div id="give_secure_site_wrapper-<?php echo $form_id ?>">
560 560
 				<span class="give-icon padlock"></span>
561
-				<span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
561
+				<span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span>
562 562
 			</div>
563 563
 		<?php endif; ?>
564 564
 		<p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
565 565
 			<label for="card_number-<?php echo $form_id ?>" class="give-label">
566
-				<?php esc_html_e( 'Card Number', 'give' ); ?>
566
+				<?php esc_html_e('Card Number', 'give'); ?>
567 567
 				<span class="give-required-indicator">*</span>
568
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span>
568
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span>
569 569
 				<span class="card-type"></span>
570 570
 			</label>
571 571
 
572
-			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php esc_html_e( 'Card number', 'give' ); ?>" required/>
572
+			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php esc_html_e('Card number', 'give'); ?>" required/>
573 573
 		</p>
574 574
 
575 575
 		<p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third">
576 576
 			<label for="card_cvc-<?php echo $form_id ?>" class="give-label">
577
-				<?php esc_html_e( 'CVC', 'give' ); ?>
577
+				<?php esc_html_e('CVC', 'give'); ?>
578 578
 				<span class="give-required-indicator">*</span>
579
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span>
579
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span>
580 580
 			</label>
581 581
 
582
-			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php esc_html_e( 'Security code', 'give' ); ?>" required/>
582
+			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php esc_html_e('Security code', 'give'); ?>" required/>
583 583
 		</p>
584 584
 
585 585
 		<p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
586 586
 			<label for="card_name-<?php echo $form_id ?>" class="give-label">
587
-				<?php esc_html_e( 'Name on the Card', 'give' ); ?>
587
+				<?php esc_html_e('Name on the Card', 'give'); ?>
588 588
 				<span class="give-required-indicator">*</span>
589
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span>
589
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The name printed on the front of your credit card.', 'give'); ?>"></span>
590 590
 			</label>
591 591
 
592
-			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php esc_html_e( 'Card name', 'give' ); ?>" required/>
592
+			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php esc_html_e('Card name', 'give'); ?>" required/>
593 593
 		</p>
594
-		<?php do_action( 'give_before_cc_expiration' ); ?>
594
+		<?php do_action('give_before_cc_expiration'); ?>
595 595
 		<p class="card-expiration form-row form-row-one-third">
596 596
 			<label for="card_expiry-<?php echo $form_id ?>" class="give-label">
597
-				<?php esc_html_e( 'Expiration', 'give' ); ?>
597
+				<?php esc_html_e('Expiration', 'give'); ?>
598 598
 				<span class="give-required-indicator">*</span>
599
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span>
599
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span>
600 600
 			</label>
601 601
 
602 602
 			<input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/>
603 603
 			<input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/>
604 604
 
605
-			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_html_e( 'MM / YY', 'give' ); ?>" required/>
605
+			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php esc_html_e('MM / YY', 'give'); ?>" required/>
606 606
 		</p>
607
-		<?php do_action( 'give_after_cc_expiration', $form_id ); ?>
607
+		<?php do_action('give_after_cc_expiration', $form_id); ?>
608 608
 
609 609
 	</fieldset>
610 610
 	<?php
611
-	do_action( 'give_after_cc_fields', $form_id );
611
+	do_action('give_after_cc_fields', $form_id);
612 612
 
613 613
 	echo ob_get_clean();
614 614
 }
615 615
 
616
-add_action( 'give_cc_form', 'give_get_cc_form' );
616
+add_action('give_cc_form', 'give_get_cc_form');
617 617
 
618 618
 /**
619 619
  * Outputs the default credit card address fields
@@ -624,110 +624,110 @@  discard block
 block discarded – undo
624 624
  *
625 625
  * @return void
626 626
  */
627
-function give_default_cc_address_fields( $form_id ) {
627
+function give_default_cc_address_fields($form_id) {
628 628
 
629 629
 	$logged_in = is_user_logged_in();
630 630
 
631
-	if ( $logged_in ) {
632
-		$user_address = get_user_meta( get_current_user_id(), '_give_user_address', true );
631
+	if ($logged_in) {
632
+		$user_address = get_user_meta(get_current_user_id(), '_give_user_address', true);
633 633
 	}
634
-	$line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : '';
635
-	$line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : '';
636
-	$city  = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : '';
637
-	$zip   = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : '';
634
+	$line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : '';
635
+	$line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : '';
636
+	$city  = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : '';
637
+	$zip   = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : '';
638 638
 	ob_start(); ?>
639 639
 	<fieldset id="give_cc_address" class="cc-address">
640
-		<legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend>
641
-		<?php do_action( 'give_cc_billing_top' ); ?>
640
+		<legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend>
641
+		<?php do_action('give_cc_billing_top'); ?>
642 642
 		<p id="give-card-address-wrap" class="form-row form-row-two-thirds">
643 643
 			<label for="card_address" class="give-label">
644
-				<?php esc_html_e( 'Address', 'give' ); ?>
644
+				<?php esc_html_e('Address', 'give'); ?>
645 645
 				<?php
646
-				if ( give_field_is_required( 'card_address', $form_id ) ) { ?>
646
+				if (give_field_is_required('card_address', $form_id)) { ?>
647 647
 					<span class="give-required-indicator">*</span>
648 648
 				<?php } ?>
649
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span>
649
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The primary billing address for your credit card.', 'give'); ?>"></span>
650 650
 			</label>
651 651
 
652
-			<input type="text" id="card_address" name="card_address" class="card-address give-input<?php if ( give_field_is_required( 'card_address', $form_id ) ) {
652
+			<input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) {
653 653
 				echo ' required';
654
-			} ?>" placeholder="<?php esc_html_e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) {
654
+			} ?>" placeholder="<?php esc_html_e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) {
655 655
 				echo '  required ';
656 656
 			} ?>/>
657 657
 		</p>
658 658
 
659 659
 		<p id="give-card-address-2-wrap" class="form-row form-row-one-third">
660 660
 			<label for="card_address_2" class="give-label">
661
-				<?php esc_html_e( 'Address Line 2', 'give' ); ?>
662
-				<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?>
661
+				<?php esc_html_e('Address Line 2', 'give'); ?>
662
+				<?php if (give_field_is_required('card_address_2', $form_id)) { ?>
663 663
 					<span class="give-required-indicator">*</span>
664 664
 				<?php } ?>
665
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span>
665
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span>
666 666
 			</label>
667 667
 
668
-			<input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) {
668
+			<input type="text" id="card_address_2" name="card_address_2" class="card-address-2 give-input<?php if (give_field_is_required('card_address_2', $form_id)) {
669 669
 				echo ' required';
670
-			} ?>" placeholder="<?php esc_html_e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) {
670
+			} ?>" placeholder="<?php esc_html_e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) {
671 671
 				echo ' required ';
672 672
 			} ?>/>
673 673
 		</p>
674 674
 
675 675
 		<p id="give-card-city-wrap" class="form-row form-row-two-thirds">
676 676
 			<label for="card_city" class="give-label">
677
-				<?php esc_html_e( 'City', 'give' ); ?>
678
-				<?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?>
677
+				<?php esc_html_e('City', 'give'); ?>
678
+				<?php if (give_field_is_required('card_city', $form_id)) { ?>
679 679
 					<span class="give-required-indicator">*</span>
680 680
 				<?php } ?>
681
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The city for your billing address.', 'give' ); ?>"></span>
681
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The city for your billing address.', 'give'); ?>"></span>
682 682
 			</label>
683
-			<input type="text" id="card_city" name="card_city" class="card-city give-input<?php if ( give_field_is_required( 'card_city', $form_id ) ) {
683
+			<input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) {
684 684
 				echo ' required';
685
-			} ?>" placeholder="<?php esc_html_e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) {
685
+			} ?>" placeholder="<?php esc_html_e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) {
686 686
 				echo ' required ';
687 687
 			} ?>/>
688 688
 		</p>
689 689
 
690 690
 		<p id="give-card-zip-wrap" class="form-row form-row-one-third">
691 691
 			<label for="card_zip" class="give-label">
692
-				<?php esc_html_e( 'Zip / Postal Code', 'give' ); ?>
693
-				<?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?>
692
+				<?php esc_html_e('Zip / Postal Code', 'give'); ?>
693
+				<?php if (give_field_is_required('card_zip', $form_id)) { ?>
694 694
 					<span class="give-required-indicator">*</span>
695 695
 				<?php } ?>
696
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span>
696
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The zip or postal code for your billing address.', 'give'); ?>"></span>
697 697
 			</label>
698 698
 
699
-			<input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if ( give_field_is_required( 'card_zip', $form_id ) ) {
699
+			<input type="text" size="4" id="card_zip" name="card_zip" class="card-zip give-input<?php if (give_field_is_required('card_zip', $form_id)) {
700 700
 				echo ' required';
701
-			} ?>" placeholder="<?php esc_html_e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) {
701
+			} ?>" placeholder="<?php esc_html_e('Zip / Postal Code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) {
702 702
 				echo ' required ';
703 703
 			} ?>/>
704 704
 		</p>
705 705
 
706 706
 		<p id="give-card-country-wrap" class="form-row form-row-first">
707 707
 			<label for="billing_country" class="give-label">
708
-				<?php esc_html_e( 'Country', 'give' ); ?>
709
-				<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?>
708
+				<?php esc_html_e('Country', 'give'); ?>
709
+				<?php if (give_field_is_required('billing_country', $form_id)) { ?>
710 710
 					<span class="give-required-indicator">*</span>
711 711
 				<?php } ?>
712
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The country for your billing address.', 'give' ); ?>"></span>
712
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The country for your billing address.', 'give'); ?>"></span>
713 713
 			</label>
714 714
 
715
-			<select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if ( give_field_is_required( 'billing_country', $form_id ) ) {
715
+			<select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) {
716 716
 				echo ' required';
717
-			} ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) {
717
+			} ?>"<?php if (give_field_is_required('billing_country', $form_id)) {
718 718
 				echo ' required ';
719 719
 			} ?>>
720 720
 				<?php
721 721
 
722 722
 				$selected_country = give_get_country();
723 723
 
724
-				if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) {
724
+				if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) {
725 725
 					$selected_country = $user_address['country'];
726 726
 				}
727 727
 
728 728
 				$countries = give_get_country_list();
729
-				foreach ( $countries as $country_code => $country ) {
730
-					echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
729
+				foreach ($countries as $country_code => $country) {
730
+					echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
731 731
 				}
732 732
 				?>
733 733
 			</select>
@@ -735,44 +735,44 @@  discard block
 block discarded – undo
735 735
 
736 736
 		<p id="give-card-state-wrap" class="form-row form-row-last">
737 737
 			<label for="card_state" class="give-label">
738
-				<?php esc_html_e( 'State / Province', 'give' ); ?>
739
-				<?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?>
738
+				<?php esc_html_e('State / Province', 'give'); ?>
739
+				<?php if (give_field_is_required('card_state', $form_id)) { ?>
740 740
 					<span class="give-required-indicator">*</span>
741 741
 				<?php } ?>
742
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The state or province for your billing address.', 'give' ); ?>"></span>
742
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The state or province for your billing address.', 'give'); ?>"></span>
743 743
 			</label>
744 744
 
745 745
 			<?php
746 746
 			$selected_state = give_get_state();
747
-			$states         = give_get_states( $selected_country );
747
+			$states         = give_get_states($selected_country);
748 748
 
749
-			if ( $logged_in && ! empty( $user_address['state'] ) ) {
749
+			if ($logged_in && ! empty($user_address['state'])) {
750 750
 				$selected_state = $user_address['state'];
751 751
 			}
752 752
 
753
-			if ( ! empty( $states ) ) : ?>
754
-				<select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) {
753
+			if ( ! empty($states)) : ?>
754
+				<select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) {
755 755
 					echo ' required';
756
-				} ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) {
756
+				} ?>"<?php if (give_field_is_required('card_state', $form_id)) {
757 757
 					echo ' required ';
758 758
 				} ?>>
759 759
 					<?php
760
-					foreach ( $states as $state_code => $state ) {
761
-						echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
760
+					foreach ($states as $state_code => $state) {
761
+						echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
762 762
 					}
763 763
 					?>
764 764
 				</select>
765 765
 			<?php else : ?>
766
-				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_html_e( 'State / Province', 'give' ); ?>"/>
766
+				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php esc_html_e('State / Province', 'give'); ?>"/>
767 767
 			<?php endif; ?>
768 768
 		</p>
769
-		<?php do_action( 'give_cc_billing_bottom' ); ?>
769
+		<?php do_action('give_cc_billing_bottom'); ?>
770 770
 	</fieldset>
771 771
 	<?php
772 772
 	echo ob_get_clean();
773 773
 }
774 774
 
775
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
775
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
776 776
 
777 777
 
778 778
 /**
@@ -784,93 +784,93 @@  discard block
 block discarded – undo
784 784
  *
785 785
  * @return string
786 786
  */
787
-function give_get_register_fields( $form_id ) {
787
+function give_get_register_fields($form_id) {
788 788
 
789 789
 	global $user_ID;
790 790
 
791
-	if ( is_user_logged_in() ) {
792
-		$user_data = get_userdata( $user_ID );
791
+	if (is_user_logged_in()) {
792
+		$user_data = get_userdata($user_ID);
793 793
 	}
794 794
 
795
-	$show_register_form = give_show_login_register_option( $form_id );
795
+	$show_register_form = give_show_login_register_option($form_id);
796 796
 
797 797
 	ob_start(); ?>
798 798
 	<fieldset id="give-register-fields-<?php echo $form_id; ?>">
799 799
 
800
-		<?php if ( $show_register_form == 'both' ) { ?>
800
+		<?php if ($show_register_form == 'both') { ?>
801 801
 			<div class="give-login-account-wrap">
802
-				<p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?>&nbsp;
803
-					<a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a>
802
+				<p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?>&nbsp;
803
+					<a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a>
804 804
 				</p>
805 805
 				<p class="give-loading-text">
806
-					<span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></p>
806
+					<span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></p>
807 807
 			</div>
808 808
 		<?php } ?>
809 809
 
810
-		<?php do_action( 'give_register_fields_before', $form_id ); ?>
810
+		<?php do_action('give_register_fields_before', $form_id); ?>
811 811
 
812 812
 		<fieldset id="give-register-account-fields-<?php echo $form_id; ?>">
813
-			<legend><?php echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) );
814
-				if ( ! give_logged_in_only( $form_id ) ) {
815
-					echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>';
813
+			<legend><?php echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give'));
814
+				if ( ! give_logged_in_only($form_id)) {
815
+					echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>';
816 816
 				} ?></legend>
817
-			<?php do_action( 'give_register_account_fields_before', $form_id ); ?>
817
+			<?php do_action('give_register_account_fields_before', $form_id); ?>
818 818
 			<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first">
819 819
 				<label for="give-user-login-<?php echo $form_id; ?>">
820
-					<?php esc_html_e( 'Username', 'give' ); ?>
821
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
820
+					<?php esc_html_e('Username', 'give'); ?>
821
+					<?php if (give_logged_in_only($form_id)) { ?>
822 822
 						<span class="give-required-indicator">*</span>
823 823
 					<?php } ?>
824
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The username you will use to log into your account.', 'give' ); ?>"></span>
824
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The username you will use to log into your account.', 'give'); ?>"></span>
825 825
 				</label>
826 826
 
827
-				<input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) {
827
+				<input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) {
828 828
 					echo 'required ';
829
-				} ?>give-input" type="text" placeholder="<?php esc_html_e( 'Username', 'give' ); ?>" title="<?php esc_html_e( 'Username', 'give' ); ?>"/>
829
+				} ?>give-input" type="text" placeholder="<?php esc_html_e('Username', 'give'); ?>" title="<?php esc_html_e('Username', 'give'); ?>"/>
830 830
 			</div>
831 831
 
832 832
 			<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third">
833 833
 				<label for="give-user-pass-<?php echo $form_id; ?>">
834
-					<?php esc_html_e( 'Password', 'give' ); ?>
835
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
834
+					<?php esc_html_e('Password', 'give'); ?>
835
+					<?php if (give_logged_in_only($form_id)) { ?>
836 836
 						<span class="give-required-indicator">*</span>
837 837
 					<?php } ?>
838
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'The password used to access your account.', 'give' ); ?>"></span>
838
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('The password used to access your account.', 'give'); ?>"></span>
839 839
 				</label>
840 840
 
841
-				<input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) {
841
+				<input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) {
842 842
 					echo 'required ';
843
-				} ?>give-input" placeholder="<?php esc_html_e( 'Password', 'give' ); ?>" type="password"/>
843
+				} ?>give-input" placeholder="<?php esc_html_e('Password', 'give'); ?>" type="password"/>
844 844
 			</div>
845 845
 
846 846
 			<div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" class="give-register-password form-row form-row-one-third">
847 847
 				<label for="give-user-pass-confirm-<?php echo $form_id; ?>">
848
-					<?php esc_html_e( 'Confirm PW', 'give' ); ?>
849
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
848
+					<?php esc_html_e('Confirm PW', 'give'); ?>
849
+					<?php if (give_logged_in_only($form_id)) { ?>
850 850
 						<span class="give-required-indicator">*</span>
851 851
 					<?php } ?>
852
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e( 'Please retype your password to confirm.', 'give' ); ?>"></span>
852
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php esc_html_e('Please retype your password to confirm.', 'give'); ?>"></span>
853 853
 				</label>
854 854
 
855
-				<input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) {
855
+				<input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) {
856 856
 					echo 'required ';
857
-				} ?>give-input" placeholder="<?php esc_html_e( 'Confirm password', 'give' ); ?>" type="password"/>
857
+				} ?>give-input" placeholder="<?php esc_html_e('Confirm password', 'give'); ?>" type="password"/>
858 858
 			</div>
859
-			<?php do_action( 'give_register_account_fields_after', $form_id ); ?>
859
+			<?php do_action('give_register_account_fields_after', $form_id); ?>
860 860
 		</fieldset>
861 861
 
862
-		<?php do_action( 'give_register_fields_after', $form_id ); ?>
862
+		<?php do_action('give_register_fields_after', $form_id); ?>
863 863
 
864 864
 		<input type="hidden" name="give-purchase-var" value="needs-to-register"/>
865 865
 
866
-		<?php do_action( 'give_purchase_form_user_info', $form_id ); ?>
866
+		<?php do_action('give_purchase_form_user_info', $form_id); ?>
867 867
 
868 868
 	</fieldset>
869 869
 	<?php
870 870
 	echo ob_get_clean();
871 871
 }
872 872
 
873
-add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' );
873
+add_action('give_purchase_form_register_fields', 'give_get_register_fields');
874 874
 
875 875
 /**
876 876
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -883,79 +883,79 @@  discard block
 block discarded – undo
883 883
  *
884 884
  * @return string
885 885
  */
886
-function give_get_login_fields( $form_id ) {
886
+function give_get_login_fields($form_id) {
887 887
 
888
-	$form_id            = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id;
889
-	$show_register_form = give_show_login_register_option( $form_id );
888
+	$form_id            = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id;
889
+	$show_register_form = give_show_login_register_option($form_id);
890 890
 
891 891
 	ob_start();
892 892
 	?>
893 893
 	<fieldset id="give-login-fields-<?php echo $form_id; ?>">
894
-		<legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) );
895
-			if ( ! give_logged_in_only( $form_id ) ) {
896
-				echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>';
894
+		<legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give'));
895
+			if ( ! give_logged_in_only($form_id)) {
896
+				echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>';
897 897
 			} ?>
898 898
 		</legend>
899
-		<?php if ( $show_register_form == 'both' ) { ?>
899
+		<?php if ($show_register_form == 'both') { ?>
900 900
 			<p class="give-new-account-link">
901
-				<?php esc_html_e( 'Need to create an account?', 'give' ); ?>&nbsp;
902
-				<a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register">
903
-					<?php esc_html_e( 'Register', 'give' );
904
-					if ( ! give_logged_in_only( $form_id ) ) {
905
-						echo ' ' . esc_html__( 'or checkout as a guest &raquo;', 'give' );
901
+				<?php esc_html_e('Need to create an account?', 'give'); ?>&nbsp;
902
+				<a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register">
903
+					<?php esc_html_e('Register', 'give');
904
+					if ( ! give_logged_in_only($form_id)) {
905
+						echo ' '.esc_html__('or checkout as a guest &raquo;', 'give');
906 906
 					} ?>
907 907
 				</a>
908 908
 			</p>
909 909
 			<p class="give-loading-text">
910
-				<span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?> </p>
910
+				<span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?> </p>
911 911
 		<?php } ?>
912
-		<?php do_action( 'give_checkout_login_fields_before', $form_id ); ?>
912
+		<?php do_action('give_checkout_login_fields_before', $form_id); ?>
913 913
 		<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first">
914 914
 			<label class="give-label" for="give-user-login-<?php echo $form_id; ?>">
915
-				<?php esc_html_e( 'Username', 'give' ); ?>
916
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
915
+				<?php esc_html_e('Username', 'give'); ?>
916
+				<?php if (give_logged_in_only($form_id)) { ?>
917 917
 					<span class="give-required-indicator">*</span>
918 918
 				<?php } ?>
919 919
 			</label>
920 920
 
921
-			<input class="<?php if ( give_logged_in_only( $form_id ) ) {
921
+			<input class="<?php if (give_logged_in_only($form_id)) {
922 922
 				echo 'required ';
923
-			} ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php esc_html_e( 'Your username', 'give' ); ?>"/>
923
+			} ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php esc_html_e('Your username', 'give'); ?>"/>
924 924
 		</div>
925 925
 
926 926
 		<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last">
927 927
 			<label class="give-label" for="give-user-pass-<?php echo $form_id; ?>">
928
-				<?php esc_html_e( 'Password', 'give' ); ?>
929
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
928
+				<?php esc_html_e('Password', 'give'); ?>
929
+				<?php if (give_logged_in_only($form_id)) { ?>
930 930
 					<span class="give-required-indicator">*</span>
931 931
 				<?php } ?>
932 932
 			</label>
933
-			<input class="<?php if ( give_logged_in_only( $form_id ) ) {
933
+			<input class="<?php if (give_logged_in_only($form_id)) {
934 934
 				echo 'required ';
935
-			} ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php esc_html_e( 'Your password', 'give' ); ?>"/>
935
+			} ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php esc_html_e('Your password', 'give'); ?>"/>
936 936
 			<input type="hidden" name="give-purchase-var" value="needs-to-login"/>
937 937
 		</div>
938 938
 
939 939
 		<div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password">
940 940
 			 <span class="give-forgot-password ">
941
-				 <a href="<?php echo wp_lostpassword_url() ?>" target="_blank"><?php esc_html_e( 'Reset password?' ) ?></a>
941
+				 <a href="<?php echo wp_lostpassword_url() ?>" target="_blank"><?php esc_html_e('Reset password?') ?></a>
942 942
 			 </span>
943 943
 		</div>
944 944
 
945 945
 		<div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix">
946
-			<input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php esc_html_e( 'Login', 'give' ); ?>"/>
947
-			<?php if ( $show_register_form !== 'login' ) { ?>
948
-				<input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php esc_html_e( 'Cancel', 'give' ); ?>"/>
946
+			<input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php esc_html_e('Login', 'give'); ?>"/>
947
+			<?php if ($show_register_form !== 'login') { ?>
948
+				<input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php esc_html_e('Cancel', 'give'); ?>"/>
949 949
 			<?php } ?>
950 950
 			<span class="give-loading-animation"></span>
951 951
 		</div>
952
-		<?php do_action( 'give_checkout_login_fields_after', $form_id ); ?>
952
+		<?php do_action('give_checkout_login_fields_after', $form_id); ?>
953 953
 	</fieldset><!--end #give-login-fields-->
954 954
 	<?php
955 955
 	echo ob_get_clean();
956 956
 }
957 957
 
958
-add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 );
958
+add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1);
959 959
 
960 960
 /**
961 961
  * Payment Mode Select
@@ -971,49 +971,49 @@  discard block
 block discarded – undo
971 971
  *
972 972
  * @return void
973 973
  */
974
-function give_payment_mode_select( $form_id ) {
974
+function give_payment_mode_select($form_id) {
975 975
 
976 976
 	$gateways = give_get_enabled_payment_gateways();
977 977
 
978
-	do_action( 'give_payment_mode_top', $form_id ); ?>
978
+	do_action('give_payment_mode_top', $form_id); ?>
979 979
 
980 980
 	<fieldset id="give-payment-mode-select">
981
-		<?php do_action( 'give_payment_mode_before_gateways_wrap' ); ?>
981
+		<?php do_action('give_payment_mode_before_gateways_wrap'); ?>
982 982
 		<div id="give-payment-mode-wrap">
983
-			<legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?>
984
-				<span class="give-loading-text"><span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></span>
983
+			<legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?>
984
+				<span class="give-loading-text"><span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></span>
985 985
 			</legend>
986 986
 			<?php
987 987
 
988
-			do_action( 'give_payment_mode_before_gateways' ) ?>
988
+			do_action('give_payment_mode_before_gateways') ?>
989 989
 
990 990
 			<ul id="give-gateway-radio-list">
991
-				<?php foreach ( $gateways as $gateway_id => $gateway ) :
992
-					$checked       = checked( $gateway_id, give_get_default_gateway( $form_id ), false );
991
+				<?php foreach ($gateways as $gateway_id => $gateway) :
992
+					$checked       = checked($gateway_id, give_get_default_gateway($form_id), false);
993 993
 					$checked_class = $checked ? ' give-gateway-option-selected' : '';
994
-					echo '<li><label for="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" class="give-gateway-option' . $checked_class . '" id="give-gateway-option-' . esc_attr( $gateway_id ) . '">';
995
-					echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-' . esc_attr( $gateway_id ) . '-' . $form_id . '" value="' . esc_attr( $gateway_id ) . '"' . $checked . '>' . esc_html( $gateway['checkout_label'] );
994
+					echo '<li><label for="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" class="give-gateway-option'.$checked_class.'" id="give-gateway-option-'.esc_attr($gateway_id).'">';
995
+					echo '<input type="radio" name="payment-mode" class="give-gateway" id="give-gateway-'.esc_attr($gateway_id).'-'.$form_id.'" value="'.esc_attr($gateway_id).'"'.$checked.'>'.esc_html($gateway['checkout_label']);
996 996
 					echo '</label></li>';
997 997
 				endforeach; ?>
998 998
 			</ul>
999
-			<?php do_action( 'give_payment_mode_after_gateways' ); ?>
999
+			<?php do_action('give_payment_mode_after_gateways'); ?>
1000 1000
 		</div>
1001
-		<?php do_action( 'give_payment_mode_after_gateways_wrap' ); ?>
1001
+		<?php do_action('give_payment_mode_after_gateways_wrap'); ?>
1002 1002
 	</fieldset>
1003 1003
 
1004
-	<?php do_action( 'give_payment_mode_bottom', $form_id ); ?>
1004
+	<?php do_action('give_payment_mode_bottom', $form_id); ?>
1005 1005
 
1006 1006
 	<div id="give_purchase_form_wrap">
1007 1007
 
1008
-		<?php do_action( 'give_purchase_form', $form_id ); ?>
1008
+		<?php do_action('give_purchase_form', $form_id); ?>
1009 1009
 
1010 1010
 	</div><!-- the checkout fields are loaded into this-->
1011 1011
 
1012
-	<?php do_action( 'give_purchase_form_wrap_bottom', $form_id );
1012
+	<?php do_action('give_purchase_form_wrap_bottom', $form_id);
1013 1013
 
1014 1014
 }
1015 1015
 
1016
-add_action( 'give_payment_mode_select', 'give_payment_mode_select' );
1016
+add_action('give_payment_mode_select', 'give_payment_mode_select');
1017 1017
 
1018 1018
 
1019 1019
 /**
@@ -1027,36 +1027,36 @@  discard block
 block discarded – undo
1027 1027
  *
1028 1028
  * @return void
1029 1029
  */
1030
-function give_terms_agreement( $form_id ) {
1030
+function give_terms_agreement($form_id) {
1031 1031
 
1032
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1033
-	$label       = get_post_meta( $form_id, '_give_agree_label', true );
1034
-	$terms       = get_post_meta( $form_id, '_give_agree_text', true );
1032
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1033
+	$label       = get_post_meta($form_id, '_give_agree_label', true);
1034
+	$terms       = get_post_meta($form_id, '_give_agree_text', true);
1035 1035
 
1036
-	if ( $form_option === 'yes' && ! empty( $terms ) ) { ?>
1036
+	if ($form_option === 'yes' && ! empty($terms)) { ?>
1037 1037
 		<fieldset id="give_terms_agreement">
1038
-			<div id="give_terms" class= "give_terms-<?php echo $form_id;?>" style="display:none;">
1038
+			<div id="give_terms" class= "give_terms-<?php echo $form_id; ?>" style="display:none;">
1039 1039
 				<?php
1040
-				do_action( 'give_before_terms' );
1041
-				echo wpautop( stripslashes( $terms ) );
1042
-				do_action( 'give_after_terms' );
1040
+				do_action('give_before_terms');
1041
+				echo wpautop(stripslashes($terms));
1042
+				do_action('give_after_terms');
1043 1043
 				?>
1044 1044
 			</div>
1045 1045
 			<div id="give_show_terms">
1046
-				<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>"><?php esc_html_e( 'Show Terms', 'give' ); ?></a>
1047
-				<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id;?>" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a>
1046
+				<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>"><?php esc_html_e('Show Terms', 'give'); ?></a>
1047
+				<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a>
1048 1048
 			</div>
1049 1049
 
1050 1050
 			<input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1"/>
1051 1051
 			<label
1052
-				for="give_agree_to_terms"><?php echo ! empty( $label ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' ); ?></label>
1052
+				for="give_agree_to_terms"><?php echo ! empty($label) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give'); ?></label>
1053 1053
 
1054 1054
 		</fieldset>
1055 1055
 		<?php
1056 1056
 	}
1057 1057
 }
1058 1058
 
1059
-add_action( 'give_purchase_form_before_submit', 'give_terms_agreement', 10, 1 );
1059
+add_action('give_purchase_form_before_submit', 'give_terms_agreement', 10, 1);
1060 1060
 
1061 1061
 /**
1062 1062
  * Checkout Final Total
@@ -1069,27 +1069,27 @@  discard block
 block discarded – undo
1069 1069
  *
1070 1070
  * @return void
1071 1071
  */
1072
-function give_checkout_final_total( $form_id ) {
1072
+function give_checkout_final_total($form_id) {
1073 1073
 
1074
-	if ( isset( $_POST['give_total'] ) ) {
1075
-		$total = apply_filters( 'give_donation_total', $_POST['give_total'] );
1074
+	if (isset($_POST['give_total'])) {
1075
+		$total = apply_filters('give_donation_total', $_POST['give_total']);
1076 1076
 	} else {
1077 1077
 		//default total
1078
-		$total = give_get_default_form_amount( $form_id );
1078
+		$total = give_get_default_form_amount($form_id);
1079 1079
 	}
1080 1080
 	//Only proceed if give_total available
1081
-	if ( empty( $total ) ) {
1081
+	if (empty($total)) {
1082 1082
 		return;
1083 1083
 	}
1084 1084
 	?>
1085 1085
 	<p id="give-final-total-wrap" class="form-wrap ">
1086
-		<span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?></span>
1087
-		<span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span>
1086
+		<span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?></span>
1087
+		<span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span>
1088 1088
 	</p>
1089 1089
 	<?php
1090 1090
 }
1091 1091
 
1092
-add_action( 'give_purchase_form_before_submit', 'give_checkout_final_total', 999 );
1092
+add_action('give_purchase_form_before_submit', 'give_checkout_final_total', 999);
1093 1093
 
1094 1094
 
1095 1095
 /**
@@ -1101,22 +1101,22 @@  discard block
 block discarded – undo
1101 1101
  *
1102 1102
  * @return void
1103 1103
  */
1104
-function give_checkout_submit( $form_id ) {
1104
+function give_checkout_submit($form_id) {
1105 1105
 	?>
1106 1106
 	<fieldset id="give_purchase_submit">
1107
-		<?php do_action( 'give_purchase_form_before_submit', $form_id ); ?>
1107
+		<?php do_action('give_purchase_form_before_submit', $form_id); ?>
1108 1108
 
1109
-		<?php give_checkout_hidden_fields( $form_id ); ?>
1109
+		<?php give_checkout_hidden_fields($form_id); ?>
1110 1110
 
1111
-		<?php echo give_checkout_button_purchase( $form_id ); ?>
1111
+		<?php echo give_checkout_button_purchase($form_id); ?>
1112 1112
 
1113
-		<?php do_action( 'give_purchase_form_after_submit', $form_id ); ?>
1113
+		<?php do_action('give_purchase_form_after_submit', $form_id); ?>
1114 1114
 
1115 1115
 	</fieldset>
1116 1116
 	<?php
1117 1117
 }
1118 1118
 
1119
-add_action( 'give_purchase_form_after_cc_form', 'give_checkout_submit', 9999 );
1119
+add_action('give_purchase_form_after_cc_form', 'give_checkout_submit', 9999);
1120 1120
 
1121 1121
 
1122 1122
 /**
@@ -1129,17 +1129,17 @@  discard block
 block discarded – undo
1129 1129
  *
1130 1130
  * @return string
1131 1131
  */
1132
-function give_checkout_button_purchase( $form_id ) {
1132
+function give_checkout_button_purchase($form_id) {
1133 1133
 
1134
-	$display_label_field = get_post_meta( $form_id, '_give_checkout_label', true );
1135
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
1134
+	$display_label_field = get_post_meta($form_id, '_give_checkout_label', true);
1135
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
1136 1136
 	ob_start(); ?>
1137 1137
 	<div class="give-submit-button-wrap give-clearfix">
1138 1138
 		<input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" value="<?php echo $display_label; ?>"/>
1139 1139
 		<span class="give-loading-animation"></span>
1140 1140
 	</div>
1141 1141
 	<?php
1142
-	return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id );
1142
+	return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id);
1143 1143
 }
1144 1144
 
1145 1145
 /**
@@ -1152,18 +1152,18 @@  discard block
 block discarded – undo
1152 1152
  *
1153 1153
  * @return void
1154 1154
  */
1155
-function give_agree_to_terms_js( $form_id ) {
1155
+function give_agree_to_terms_js($form_id) {
1156 1156
 
1157
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1157
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1158 1158
 
1159
-	if ( $form_option === 'yes' ) {
1159
+	if ($form_option === 'yes') {
1160 1160
 		?>
1161 1161
 		<script type="text/javascript">
1162 1162
 			jQuery(document).ready(function ($) {
1163
-				$('body').on('click', '.give_terms_links-<?php echo $form_id;?>', function (e) {
1163
+				$('body').on('click', '.give_terms_links-<?php echo $form_id; ?>', function (e) {
1164 1164
 					e.preventDefault();
1165
-					$('.give_terms-<?php echo $form_id;?>').slideToggle();
1166
-					$('.give_terms_links-<?php echo $form_id;?>').toggle();
1165
+					$('.give_terms-<?php echo $form_id; ?>').slideToggle();
1166
+					$('.give_terms_links-<?php echo $form_id; ?>').toggle();
1167 1167
 					return false;
1168 1168
 				});
1169 1169
 			});
@@ -1172,7 +1172,7 @@  discard block
 block discarded – undo
1172 1172
 	}
1173 1173
 }
1174 1174
 
1175
-add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 );
1175
+add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2);
1176 1176
 
1177 1177
 /**
1178 1178
  * Show Give Goals
@@ -1187,17 +1187,17 @@  discard block
 block discarded – undo
1187 1187
  * @return mixed
1188 1188
  */
1189 1189
 
1190
-function give_show_goal_progress( $form_id, $args ) {
1190
+function give_show_goal_progress($form_id, $args) {
1191 1191
 
1192 1192
     ob_start();
1193
-    give_get_template( 'shortcode-goal' , array( 'form_id' => $form_id, 'args' => $args ) );
1193
+    give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args));
1194 1194
 
1195
-    echo apply_filters( 'give_goal_output', ob_get_clean() );
1195
+    echo apply_filters('give_goal_output', ob_get_clean());
1196 1196
 
1197 1197
 	return true;
1198 1198
 }
1199 1199
 
1200
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1200
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1201 1201
 
1202 1202
 /**
1203 1203
  * Adds Actions to Render Form Content
@@ -1209,19 +1209,19 @@  discard block
 block discarded – undo
1209 1209
  *
1210 1210
  * @return void
1211 1211
  */
1212
-function give_form_content( $form_id, $args ) {
1212
+function give_form_content($form_id, $args) {
1213 1213
 
1214
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1214
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1215 1215
 		? $args['show_content']
1216
-		: get_post_meta( $form_id, '_give_content_option', true );
1216
+		: get_post_meta($form_id, '_give_content_option', true);
1217 1217
 
1218
-	if ( $show_content !== 'none' ) {
1218
+	if ($show_content !== 'none') {
1219 1219
 		//add action according to value
1220
-		add_action( $show_content, 'give_form_display_content', 10, 2 );
1220
+		add_action($show_content, 'give_form_display_content', 10, 2);
1221 1221
 	}
1222 1222
 }
1223 1223
 
1224
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
1224
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
1225 1225
 
1226 1226
 /**
1227 1227
  * Renders Post Form Content
@@ -1233,24 +1233,24 @@  discard block
 block discarded – undo
1233 1233
  * @return void
1234 1234
  * @since      1.0
1235 1235
  */
1236
-function give_form_display_content( $form_id, $args ) {
1236
+function give_form_display_content($form_id, $args) {
1237 1237
 
1238
-	$content      = wpautop( get_post_meta( $form_id, '_give_form_content', true ) );
1239
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1238
+	$content      = wpautop(get_post_meta($form_id, '_give_form_content', true));
1239
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1240 1240
 		? $args['show_content']
1241
-		: get_post_meta( $form_id, '_give_content_option', true );
1241
+		: get_post_meta($form_id, '_give_content_option', true);
1242 1242
 
1243
-	if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) {
1244
-		$content = apply_filters( 'the_content', $content );
1243
+	if (give_get_option('disable_the_content_filter') !== 'on') {
1244
+		$content = apply_filters('the_content', $content);
1245 1245
 	}
1246 1246
 
1247
-	$output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>';
1247
+	$output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>';
1248 1248
 
1249
-	echo apply_filters( 'give_form_content_output', $output );
1249
+	echo apply_filters('give_form_content_output', $output);
1250 1250
 
1251 1251
 	//remove action to prevent content output on addition forms on page
1252 1252
 	//@see: https://github.com/WordImpress/Give/issues/634
1253
-	remove_action( $show_content, 'give_form_display_content' );
1253
+	remove_action($show_content, 'give_form_display_content');
1254 1254
 }
1255 1255
 
1256 1256
 
@@ -1263,16 +1263,16 @@  discard block
 block discarded – undo
1263 1263
  *
1264 1264
  * @return void
1265 1265
  */
1266
-function give_checkout_hidden_fields( $form_id ) {
1266
+function give_checkout_hidden_fields($form_id) {
1267 1267
 
1268
-	do_action( 'give_hidden_fields_before', $form_id );
1269
-	if ( is_user_logged_in() ) { ?>
1268
+	do_action('give_hidden_fields_before', $form_id);
1269
+	if (is_user_logged_in()) { ?>
1270 1270
 		<input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/>
1271 1271
 	<?php } ?>
1272 1272
 	<input type="hidden" name="give_action" value="purchase"/>
1273
-	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/>
1273
+	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/>
1274 1274
 	<?php
1275
-	do_action( 'give_hidden_fields_after', $form_id );
1275
+	do_action('give_hidden_fields_after', $form_id);
1276 1276
 
1277 1277
 }
1278 1278
 
@@ -1287,20 +1287,20 @@  discard block
 block discarded – undo
1287 1287
  *
1288 1288
  * @return string $content Filtered content
1289 1289
  */
1290
-function give_filter_success_page_content( $content ) {
1290
+function give_filter_success_page_content($content) {
1291 1291
 
1292 1292
 	global $give_options;
1293 1293
 
1294
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
1295
-		if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) {
1296
-			$content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content );
1294
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
1295
+		if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) {
1296
+			$content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content);
1297 1297
 		}
1298 1298
 	}
1299 1299
 
1300 1300
 	return $content;
1301 1301
 }
1302 1302
 
1303
-add_filter( 'the_content', 'give_filter_success_page_content' );
1303
+add_filter('the_content', 'give_filter_success_page_content');
1304 1304
 
1305 1305
 
1306 1306
 /**
@@ -1312,14 +1312,14 @@  discard block
 block discarded – undo
1312 1312
 
1313 1313
 function give_test_mode_frontend_warning() {
1314 1314
 
1315
-	$test_mode = give_get_option( 'test_mode' );
1315
+	$test_mode = give_get_option('test_mode');
1316 1316
 
1317
-	if ( $test_mode == 'on' ) {
1318
-		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice', 'give' ) . '</strong>: ' . esc_html__( 'Test mode is enabled. While in test mode no live transactions are processed.', 'give' ) . '</p></div>';
1317
+	if ($test_mode == 'on') {
1318
+		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice', 'give').'</strong>: '.esc_html__('Test mode is enabled. While in test mode no live transactions are processed.', 'give').'</p></div>';
1319 1319
 	}
1320 1320
 }
1321 1321
 
1322
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
1322
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
1323 1323
 
1324 1324
 
1325 1325
 /**
@@ -1335,21 +1335,21 @@  discard block
 block discarded – undo
1335 1335
  * @return string
1336 1336
  */
1337 1337
 
1338
-function give_members_only_form( $final_output, $args ) {
1338
+function give_members_only_form($final_output, $args) {
1339 1339
 
1340
-	$form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0;
1340
+	$form_id = isset($args['form_id']) ? $args['form_id'] : 0;
1341 1341
 
1342 1342
 	//Sanity Check: Must have form_id & not be logged in
1343
-	if ( empty( $form_id ) || is_user_logged_in() ) {
1343
+	if (empty($form_id) || is_user_logged_in()) {
1344 1344
 		return $final_output;
1345 1345
 	}
1346 1346
 
1347 1347
 	//Logged in only and Register / Login set to none
1348
-	if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) {
1348
+	if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
1349 1349
 
1350
-		$final_output = give_output_error( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false );
1350
+		$final_output = give_output_error(esc_html__('Please log in in order to complete your donation.', 'give'), false);
1351 1351
 
1352
-		return apply_filters( 'give_members_only_output', $final_output, $form_id );
1352
+		return apply_filters('give_members_only_output', $final_output, $form_id);
1353 1353
 
1354 1354
 	}
1355 1355
 
@@ -1357,4 +1357,4 @@  discard block
 block discarded – undo
1357 1357
 
1358 1358
 }
1359 1359
 
1360
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 );
1360
+add_filter('give_donate_form', 'give_members_only_form', 10, 2);
Please login to merge, or discard this patch.
includes/formatting.php 1 patch
Spacing   +93 added lines, -93 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
  * @return mixed
24 24
  */
25 25
 function give_get_price_decimals() {
26
-	return apply_filters( 'give_sanitize_amount_decimals', give_get_option( 'number_decimals', 0 ) );
26
+	return apply_filters('give_sanitize_amount_decimals', give_get_option('number_decimals', 0));
27 27
 }
28 28
 
29 29
 /**
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  * @return mixed
35 35
  */
36 36
 function give_get_price_thousand_separator() {
37
-	return give_get_option( 'thousands_separator', ',' );
37
+	return give_get_option('thousands_separator', ',');
38 38
 }
39 39
 
40 40
 /**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
  * @return mixed
46 46
  */
47 47
 function give_get_price_decimal_separator() {
48
-	return give_get_option( 'decimal_separator', '.' );
48
+	return give_get_option('decimal_separator', '.');
49 49
 }
50 50
 
51 51
 /**
@@ -62,67 +62,67 @@  discard block
 block discarded – undo
62 62
  *
63 63
  * @return string $amount Newly sanitized amount
64 64
  */
65
-function give_sanitize_amount( $number, $dp = false, $trim_zeros = false ) {
65
+function give_sanitize_amount($number, $dp = false, $trim_zeros = false) {
66 66
 
67 67
 	// Bailout.
68
-	if ( empty( $number ) ) {
68
+	if (empty($number)) {
69 69
 		return $number;
70 70
 	}
71 71
 
72 72
 	// Remove slash from amount.
73 73
 	// If thousand or decimal separator is set to ' then in $_POST or $_GET param we will get an escaped number.
74 74
 	// To prevent notices and warning remove slash from amount/number.
75
-	$number = wp_unslash( $number );
75
+	$number = wp_unslash($number);
76 76
 
77 77
 	$thousand_separator = give_get_price_thousand_separator();
78 78
 
79 79
 	$locale   = localeconv();
80
-	$decimals = array( give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point'] );
80
+	$decimals = array(give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point']);
81 81
 
82 82
 	// Remove locale from string
83
-	if ( ! is_float( $number ) ) {
84
-		$number = str_replace( $decimals, '.', $number );
83
+	if ( ! is_float($number)) {
84
+		$number = str_replace($decimals, '.', $number);
85 85
 	}
86 86
 
87 87
 	// Remove thousand amount formatting if amount has.
88 88
 	// This condition use to add backward compatibility to version before 1.6, because before version 1.6 we were saving formatted amount to db.
89 89
 	// Do not replace thousand separator from price if it is same as decimal separator, because it will be already replace by above code.
90
-	if ( ! in_array( $thousand_separator, $decimals ) && ( false !== strpos( $number, $thousand_separator ) ) ) {
91
-		$number = str_replace( $thousand_separator, '', $number );
92
-	} elseif ( in_array( $thousand_separator, $decimals ) ) {
93
-		$number = preg_replace( '/\.(?=.*\.)/', '', $number );
90
+	if ( ! in_array($thousand_separator, $decimals) && (false !== strpos($number, $thousand_separator))) {
91
+		$number = str_replace($thousand_separator, '', $number);
92
+	} elseif (in_array($thousand_separator, $decimals)) {
93
+		$number = preg_replace('/\.(?=.*\.)/', '', $number);
94 94
 	}
95 95
 
96 96
 	// Remove non numeric entity before decimal separator.
97
-	$number     = preg_replace( '/[^0-9\.]/', '', $number );
97
+	$number     = preg_replace('/[^0-9\.]/', '', $number);
98 98
 	$default_dp = give_get_price_decimals();
99 99
 
100 100
 	// Reset negative amount to zero.
101
-	if ( 0 > $number ) {
102
-		$number = number_format( 0, $default_dp, '.' );
101
+	if (0 > $number) {
102
+		$number = number_format(0, $default_dp, '.');
103 103
 	}
104 104
 
105 105
 	// If number does not have decimal then add number of decimals to it.
106 106
 	if (
107
-		false === strpos( $number, '.' )
108
-		|| ( $default_dp > strlen( substr( $number, strpos( $number, '.' ) + 1 ) ) )
107
+		false === strpos($number, '.')
108
+		|| ($default_dp > strlen(substr($number, strpos($number, '.') + 1)))
109 109
 	) {
110
-		$number = number_format( $number, $default_dp, '.', '' );
110
+		$number = number_format($number, $default_dp, '.', '');
111 111
 	}
112 112
 
113 113
 	// Format number by custom number of decimals.
114
-	if ( false !== $dp ) {
115
-		$dp     = intval( empty( $dp ) ? $default_dp : $dp );
116
-		$dp     = apply_filters( 'give_sanitize_amount_decimals', $dp, $number );
117
-		$number = number_format( floatval( $number ), $dp, '.', '' );
114
+	if (false !== $dp) {
115
+		$dp     = intval(empty($dp) ? $default_dp : $dp);
116
+		$dp     = apply_filters('give_sanitize_amount_decimals', $dp, $number);
117
+		$number = number_format(floatval($number), $dp, '.', '');
118 118
 	}
119 119
 
120 120
 	// Trim zeros.
121
-	if ( $trim_zeros && strstr( $number, '.' ) ) {
122
-		$number = rtrim( rtrim( $number, '0' ), '.' );
121
+	if ($trim_zeros && strstr($number, '.')) {
122
+		$number = rtrim(rtrim($number, '0'), '.');
123 123
 	}
124 124
 
125
-	return apply_filters( 'give_sanitize_amount', $number );
125
+	return apply_filters('give_sanitize_amount', $number);
126 126
 }
127 127
 
128 128
 /**
@@ -135,22 +135,22 @@  discard block
 block discarded – undo
135 135
  *
136 136
  * @return string $amount   Newly formatted amount or Price Not Available
137 137
  */
138
-function give_format_amount( $amount, $decimals = true ) {
139
-	$thousands_sep = give_get_option( 'thousands_separator', ',' );
140
-	$decimal_sep   = give_get_option( 'decimal_separator', '.' );
138
+function give_format_amount($amount, $decimals = true) {
139
+	$thousands_sep = give_get_option('thousands_separator', ',');
140
+	$decimal_sep   = give_get_option('decimal_separator', '.');
141 141
 
142
-	if ( empty( $amount ) ) {
142
+	if (empty($amount)) {
143 143
 		$amount = 0;
144 144
 	} else {
145 145
 		// Sanitize amount before formatting.
146
-		$amount = give_sanitize_amount( $amount );
146
+		$amount = give_sanitize_amount($amount);
147 147
 	}
148 148
 
149 149
 	$decimals = $decimals ? give_get_price_decimals() : 0;
150 150
 
151
-	$formatted = number_format( $amount, $decimals, $decimal_sep, $thousands_sep );
151
+	$formatted = number_format($amount, $decimals, $decimal_sep, $thousands_sep);
152 152
 
153
-	return apply_filters( 'give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep );
153
+	return apply_filters('give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep);
154 154
 }
155 155
 
156 156
 
@@ -167,33 +167,33 @@  discard block
 block discarded – undo
167 167
  *
168 168
  * @return float|string  formatted amount number with large number names.
169 169
  */
170
-function give_human_format_large_amount( $amount ) {
170
+function give_human_format_large_amount($amount) {
171 171
 
172 172
 	// Get thousand separator.
173 173
 	$thousands_sep = give_get_price_thousand_separator();
174 174
 
175 175
 	// Sanitize amount.
176
-	$sanitize_amount = give_sanitize_amount( $amount );
176
+	$sanitize_amount = give_sanitize_amount($amount);
177 177
 
178 178
 	// Explode amount to calculate name of large numbers.
179
-	$amount_array = explode( $thousands_sep, $amount );
179
+	$amount_array = explode($thousands_sep, $amount);
180 180
 
181 181
 	// Calculate amount parts count.
182
-	$amount_count_parts = count( $amount_array );
182
+	$amount_count_parts = count($amount_array);
183 183
 
184 184
 	// Human format amount (default).
185 185
 	$human_format_amount = $amount;
186 186
 
187 187
 	// Calculate large number formatted amount.
188
-	if ( 4 < $amount_count_parts ) {
189
-		$human_format_amount = sprintf( esc_html__( '%s trillion', 'give' ), round( ( $sanitize_amount / 1000000000000 ), 2 ) );
190
-	} elseif ( 3 < $amount_count_parts ) {
191
-		$human_format_amount = sprintf( esc_html__( '%s billion', 'give' ), round( ( $sanitize_amount / 1000000000 ), 2 ) );
192
-	} elseif ( 2 < $amount_count_parts ) {
193
-		$human_format_amount = sprintf( esc_html__( '%s million', 'give' ), round( ( $sanitize_amount / 1000000 ), 2 ) );
188
+	if (4 < $amount_count_parts) {
189
+		$human_format_amount = sprintf(esc_html__('%s trillion', 'give'), round(($sanitize_amount / 1000000000000), 2));
190
+	} elseif (3 < $amount_count_parts) {
191
+		$human_format_amount = sprintf(esc_html__('%s billion', 'give'), round(($sanitize_amount / 1000000000), 2));
192
+	} elseif (2 < $amount_count_parts) {
193
+		$human_format_amount = sprintf(esc_html__('%s million', 'give'), round(($sanitize_amount / 1000000), 2));
194 194
 	}
195 195
 
196
-	return apply_filters( 'give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount );
196
+	return apply_filters('give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount);
197 197
 }
198 198
 
199 199
 /**
@@ -206,15 +206,15 @@  discard block
 block discarded – undo
206 206
  *
207 207
  * @return string $amount Newly formatted amount or Price Not Available
208 208
  */
209
-function give_format_decimal( $amount, $dp = false ) {
209
+function give_format_decimal($amount, $dp = false) {
210 210
 	$decimal_separator = give_get_price_decimal_separator();
211
-	$formatted_amount  = give_sanitize_amount( $amount, $dp );
211
+	$formatted_amount  = give_sanitize_amount($amount, $dp);
212 212
 
213
-	if ( false !== strpos( $formatted_amount, '.' ) ) {
214
-		$formatted_amount = str_replace( '.', $decimal_separator, $formatted_amount );
213
+	if (false !== strpos($formatted_amount, '.')) {
214
+		$formatted_amount = str_replace('.', $decimal_separator, $formatted_amount);
215 215
 	}
216 216
 
217
-	return apply_filters( 'give_format_decimal', $formatted_amount, $amount, $decimal_separator );
217
+	return apply_filters('give_format_decimal', $formatted_amount, $amount, $decimal_separator);
218 218
 }
219 219
 
220 220
 
@@ -228,13 +228,13 @@  discard block
 block discarded – undo
228 228
  *
229 229
  * @return bool
230 230
  */
231
-function give_format_admin_multilevel_amount( $field_args, $field ) {
231
+function give_format_admin_multilevel_amount($field_args, $field) {
232 232
 
233
-	if ( empty( $field->value ) ) {
233
+	if (empty($field->value)) {
234 234
 		return false;
235 235
 	}
236 236
 
237
-	$field->value = give_format_decimal( $field->value );
237
+	$field->value = give_format_decimal($field->value);
238 238
 }
239 239
 
240 240
 /**
@@ -247,24 +247,24 @@  discard block
 block discarded – undo
247 247
  *
248 248
  * @return mixed|string|void
249 249
  */
250
-function give_currency_filter( $price = '', $currency = '' ) {
250
+function give_currency_filter($price = '', $currency = '') {
251 251
 
252
-	if ( empty( $currency ) ) {
252
+	if (empty($currency)) {
253 253
 		$currency = give_get_currency();
254 254
 	}
255 255
 
256
-	$position = give_get_option( 'currency_position', 'before' );
256
+	$position = give_get_option('currency_position', 'before');
257 257
 
258 258
 	$negative = $price < 0;
259 259
 
260
-	if ( $negative ) {
260
+	if ($negative) {
261 261
 		// Remove proceeding "-".
262
-		$price = substr( $price, 1 );
262
+		$price = substr($price, 1);
263 263
 	}
264 264
 
265
-	$symbol = give_currency_symbol( $currency );
265
+	$symbol = give_currency_symbol($currency);
266 266
 
267
-	switch ( $currency ):
267
+	switch ($currency):
268 268
 		case 'GBP' :
269 269
 		case 'BRL' :
270 270
 		case 'EUR' :
@@ -293,13 +293,13 @@  discard block
 block discarded – undo
293 293
 		case 'MAD' :
294 294
 		case 'KRW' :
295 295
 		case 'ZAR' :
296
-			$formatted = ( 'before' === $position ? $symbol . $price : $price . $symbol );
296
+			$formatted = ('before' === $position ? $symbol.$price : $price.$symbol);
297 297
 			break;
298 298
 		case 'NOK' :
299
-			$formatted = ( 'before' === $position ? $symbol . ' ' . $price : $price . ' ' . $symbol );
299
+			$formatted = ('before' === $position ? $symbol.' '.$price : $price.' '.$symbol);
300 300
 			break;
301 301
 		default :
302
-			$formatted = ( 'before' === $position ? $currency . ' ' . $price : $price . ' ' . $currency );
302
+			$formatted = ('before' === $position ? $currency.' '.$price : $price.' '.$currency);
303 303
 			break;
304 304
 	endswitch;
305 305
 
@@ -315,11 +315,11 @@  discard block
 block discarded – undo
315 315
 	 *           filter name will be give_usd_currency_filter_after
316 316
 	 *
317 317
 	 */
318
-	$formatted = apply_filters( 'give_' . strtolower( $currency ) . "_currency_filter_{$position}", $formatted, $currency, $price );
318
+	$formatted = apply_filters('give_'.strtolower($currency)."_currency_filter_{$position}", $formatted, $currency, $price);
319 319
 
320
-	if ( $negative ) {
320
+	if ($negative) {
321 321
 		// Prepend the minus sign before the currency sign.
322
-		$formatted = '-' . $formatted;
322
+		$formatted = '-'.$formatted;
323 323
 	}
324 324
 
325 325
 	return $formatted;
@@ -335,22 +335,22 @@  discard block
 block discarded – undo
335 335
  */
336 336
 function give_currency_decimal_filter() {
337 337
 
338
-	remove_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' );
338
+	remove_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter');
339 339
 
340 340
 	// Set default number of decimals.
341 341
 	$decimals = give_get_price_decimals();
342 342
 
343
-	add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' );
343
+	add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter');
344 344
 
345 345
 
346 346
 	// Get number of decimals with backward compatibility ( version < 1.6 )
347
-	if ( 1 <= func_num_args() ) {
348
-		$decimals = ( false === func_get_arg( 0 ) ? $decimals : absint( func_get_arg( 0 ) ) );
347
+	if (1 <= func_num_args()) {
348
+		$decimals = (false === func_get_arg(0) ? $decimals : absint(func_get_arg(0)));
349 349
 	}
350 350
 
351 351
 	$currency = give_get_currency();
352 352
 
353
-	switch ( $currency ) {
353
+	switch ($currency) {
354 354
 		case 'RIAL' :
355 355
 		case 'JPY' :
356 356
 		case 'TWD' :
@@ -360,11 +360,11 @@  discard block
 block discarded – undo
360 360
 			break;
361 361
 	}
362 362
 
363
-	return apply_filters( 'give_currency_decimal_count', $decimals, $currency );
363
+	return apply_filters('give_currency_decimal_count', $decimals, $currency);
364 364
 }
365 365
 
366
-add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' );
367
-add_filter( 'give_format_amount_decimals', 'give_currency_decimal_filter' );
366
+add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter');
367
+add_filter('give_format_amount_decimals', 'give_currency_decimal_filter');
368 368
 
369 369
 /**
370 370
  * Sanitize thousand separator
@@ -377,8 +377,8 @@  discard block
 block discarded – undo
377 377
  *
378 378
  * @return mixed
379 379
  */
380
-function give_sanitize_thousand_separator( $value, $field_args, $field ) {
381
-	return stripslashes( $value );
380
+function give_sanitize_thousand_separator($value, $field_args, $field) {
381
+	return stripslashes($value);
382 382
 }
383 383
 
384 384
 
@@ -393,8 +393,8 @@  discard block
 block discarded – undo
393 393
  *
394 394
  * @return mixed
395 395
  */
396
-function give_sanitize_number_decimals( $value, $field_args, $field ) {
397
-	return absint( $value );
396
+function give_sanitize_number_decimals($value, $field_args, $field) {
397
+	return absint($value);
398 398
 }
399 399
 
400 400
 /**
@@ -408,8 +408,8 @@  discard block
 block discarded – undo
408 408
  *
409 409
  * @return mixed
410 410
  */
411
-function give_sanitize_price_field_value( $value, $field_args, $field ) {
412
-	return give_sanitize_amount( $value );
411
+function give_sanitize_price_field_value($value, $field_args, $field) {
412
+	return give_sanitize_amount($value);
413 413
 }
414 414
 
415 415
 
@@ -423,29 +423,29 @@  discard block
 block discarded – undo
423 423
  *
424 424
  * @return void
425 425
  */
426
-function give_cmb_amount_field_render_row_cb( $field_args, $field ) {
426
+function give_cmb_amount_field_render_row_cb($field_args, $field) {
427 427
 
428 428
 	// Get args.
429
-	$id                = $field->args( 'id' );
430
-	$label             = $field->args( 'name' );
431
-	$name              = $field->args( '_name' );
432
-	$description       = $field->args( 'description' );
433
-	$attributes        = $field->args( 'attributes' );
429
+	$id                = $field->args('id');
430
+	$label             = $field->args('name');
431
+	$name              = $field->args('_name');
432
+	$description       = $field->args('description');
433
+	$attributes        = $field->args('attributes');
434 434
 	$attributes_string = '';
435 435
 	$row_class         = $field->row_classes();
436 436
 
437 437
 	// Get attributes.
438
-	if ( ! empty( $attributes ) ) {
439
-		foreach ( $attributes as $attribute_name => $attribute_val ) {
438
+	if ( ! empty($attributes)) {
439
+		foreach ($attributes as $attribute_name => $attribute_val) {
440 440
 			$attributes_string[] = "$attribute_name=\"$attribute_val\"";
441 441
 		}
442 442
 
443
-		$attributes_string = implode( ' ', $attributes_string );
443
+		$attributes_string = implode(' ', $attributes_string);
444 444
 	}
445 445
 
446 446
 	// Get row class.
447
-	if ( ! empty( $row_class ) && is_array( $row_class ) ) {
448
-		$row_class = implode( ' ', $row_class );
447
+	if ( ! empty($row_class) && is_array($row_class)) {
448
+		$row_class = implode(' ', $row_class);
449 449
 	}
450 450
 	?>
451 451
 	<div class="cmb-row <?php echo $row_class; ?>">
@@ -453,9 +453,9 @@  discard block
 block discarded – undo
453 453
 			<label for="<?php echo $id; ?>"><?php echo $label; ?></label>
454 454
 		</div>
455 455
 		<div class="cmb-td">
456
-			<?php echo( give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '' ); ?>
456
+			<?php echo(give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : ''); ?>
457 457
 			<input id="<?php echo $id; ?>" type="text" name="<?php echo $name; ?>" <?php echo $attributes_string ?>/>
458
-			<?php echo( give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '' ); ?>
458
+			<?php echo(give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : ''); ?>
459 459
 
460 460
 			<span class="cmb2-metabox-description"><?php echo $description; ?></span>
461 461
 		</div>
Please login to merge, or discard this patch.
includes/misc-functions.php 1 patch
Spacing   +166 added lines, -166 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,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 	$ret = give_get_option('test_mode', false);
27 27
 
28
-	return (bool) apply_filters( 'give_is_test_mode', $ret );
28
+	return (bool) apply_filters('give_is_test_mode', $ret);
29 29
 
30 30
 }
31 31
 
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
  */
38 38
 function give_get_currency() {
39 39
 
40
-	$currency = give_get_option( 'currency', 'USD' );
40
+	$currency = give_get_option('currency', 'USD');
41 41
 
42
-	return apply_filters( 'give_currency', $currency );
42
+	return apply_filters('give_currency', $currency);
43 43
 }
44 44
 
45 45
 /**
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
  */
52 52
 function give_get_currency_position() {
53 53
 
54
-	$currency_pos = give_get_option( 'currency_position', 'before' );
54
+	$currency_pos = give_get_option('currency_position', 'before');
55 55
 
56
-	return apply_filters( 'give_currency_position', $currency_pos );
56
+	return apply_filters('give_currency_position', $currency_pos);
57 57
 }
58 58
 
59 59
 
@@ -66,39 +66,39 @@  discard block
 block discarded – undo
66 66
 
67 67
 function give_get_currencies() {
68 68
 	$currencies = array(
69
-		'USD'  => esc_html__( 'US Dollars ($)', 'give' ),
70
-		'EUR'  => esc_html__( 'Euros (€)', 'give' ),
71
-		'GBP'  => esc_html__( 'Pounds Sterling (£)', 'give' ),
72
-		'AUD'  => esc_html__( 'Australian Dollars ($)', 'give' ),
73
-		'BRL'  => esc_html__( 'Brazilian Real (R$)', 'give' ),
74
-		'CAD'  => esc_html__( 'Canadian Dollars ($)', 'give' ),
75
-		'CZK'  => esc_html__( 'Czech Koruna (Kč)', 'give' ),
76
-		'DKK'  => esc_html__( 'Danish Krone (kr)', 'give' ),
77
-		'HKD'  => esc_html__( 'Hong Kong Dollar ($)', 'give' ),
78
-		'HUF'  => esc_html__( 'Hungarian Forint (Ft)', 'give' ),
79
-		'ILS'  => esc_html__( 'Israeli Shekel (₪)', 'give' ),
80
-		'JPY'  => esc_html__( 'Japanese Yen (¥)', 'give' ),
81
-		'MYR'  => esc_html__( 'Malaysian Ringgits (RM)', 'give' ),
82
-		'MXN'  => esc_html__( 'Mexican Peso ($)', 'give' ),
83
-		'MAD'  => esc_html__( 'Moroccan Dirham (&#x2e;&#x62f;&#x2e;&#x645;)', 'give' ),
84
-		'NZD'  => esc_html__( 'New Zealand Dollar ($)', 'give' ),
85
-		'NOK'  => esc_html__( 'Norwegian Krone (Kr.)', 'give' ),
86
-		'PHP'  => esc_html__( 'Philippine Pesos (₱)', 'give' ),
87
-		'PLN'  => esc_html__( 'Polish Zloty (zł)', 'give' ),
88
-		'SGD'  => esc_html__( 'Singapore Dollar ($)', 'give' ),
89
-		'KRW'  => esc_html__( 'South Korean Won (₩)', 'give' ),
90
-		'ZAR'  => esc_html__( 'South African Rand (R)', 'give' ),
91
-		'SEK'  => esc_html__( 'Swedish Krona (kr)', 'give' ),
92
-		'CHF'  => esc_html__( 'Swiss Franc (CHF)', 'give' ),
93
-		'TWD'  => esc_html__( 'Taiwan New Dollars (NT$)', 'give' ),
94
-		'THB'  => esc_html__( 'Thai Baht (฿)', 'give' ),
95
-		'INR'  => esc_html__( 'Indian Rupee (₹)', 'give' ),
96
-		'TRY'  => esc_html__( 'Turkish Lira (₺)', 'give' ),
97
-		'RIAL' => esc_html__( 'Iranian Rial (﷼)', 'give' ),
98
-		'RUB'  => esc_html__( 'Russian Rubles (руб)', 'give' )
69
+		'USD'  => esc_html__('US Dollars ($)', 'give'),
70
+		'EUR'  => esc_html__('Euros (€)', 'give'),
71
+		'GBP'  => esc_html__('Pounds Sterling (£)', 'give'),
72
+		'AUD'  => esc_html__('Australian Dollars ($)', 'give'),
73
+		'BRL'  => esc_html__('Brazilian Real (R$)', 'give'),
74
+		'CAD'  => esc_html__('Canadian Dollars ($)', 'give'),
75
+		'CZK'  => esc_html__('Czech Koruna (Kč)', 'give'),
76
+		'DKK'  => esc_html__('Danish Krone (kr)', 'give'),
77
+		'HKD'  => esc_html__('Hong Kong Dollar ($)', 'give'),
78
+		'HUF'  => esc_html__('Hungarian Forint (Ft)', 'give'),
79
+		'ILS'  => esc_html__('Israeli Shekel (₪)', 'give'),
80
+		'JPY'  => esc_html__('Japanese Yen (¥)', 'give'),
81
+		'MYR'  => esc_html__('Malaysian Ringgits (RM)', 'give'),
82
+		'MXN'  => esc_html__('Mexican Peso ($)', 'give'),
83
+		'MAD'  => esc_html__('Moroccan Dirham (&#x2e;&#x62f;&#x2e;&#x645;)', 'give'),
84
+		'NZD'  => esc_html__('New Zealand Dollar ($)', 'give'),
85
+		'NOK'  => esc_html__('Norwegian Krone (Kr.)', 'give'),
86
+		'PHP'  => esc_html__('Philippine Pesos (₱)', 'give'),
87
+		'PLN'  => esc_html__('Polish Zloty (zł)', 'give'),
88
+		'SGD'  => esc_html__('Singapore Dollar ($)', 'give'),
89
+		'KRW'  => esc_html__('South Korean Won (₩)', 'give'),
90
+		'ZAR'  => esc_html__('South African Rand (R)', 'give'),
91
+		'SEK'  => esc_html__('Swedish Krona (kr)', 'give'),
92
+		'CHF'  => esc_html__('Swiss Franc (CHF)', 'give'),
93
+		'TWD'  => esc_html__('Taiwan New Dollars (NT$)', 'give'),
94
+		'THB'  => esc_html__('Thai Baht (฿)', 'give'),
95
+		'INR'  => esc_html__('Indian Rupee (₹)', 'give'),
96
+		'TRY'  => esc_html__('Turkish Lira (₺)', 'give'),
97
+		'RIAL' => esc_html__('Iranian Rial (﷼)', 'give'),
98
+		'RUB'  => esc_html__('Russian Rubles (руб)', 'give')
99 99
 	);
100 100
 
101
-	return apply_filters( 'give_currencies', $currencies );
101
+	return apply_filters('give_currencies', $currencies);
102 102
 }
103 103
 
104 104
 
@@ -113,12 +113,12 @@  discard block
 block discarded – undo
113 113
  *
114 114
  * @return string           The symbol to use for the currency
115 115
  */
116
-function give_currency_symbol( $currency = '' ) {
116
+function give_currency_symbol($currency = '') {
117 117
 
118
-	if ( empty( $currency ) ) {
118
+	if (empty($currency)) {
119 119
 		$currency = give_get_currency();
120 120
 	}
121
-	switch ( $currency ) :
121
+	switch ($currency) :
122 122
 		case 'GBP' :
123 123
 			$symbol = '£';
124 124
 			break;
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	endswitch;
198 198
 
199 199
 
200
-	return apply_filters( 'give_currency_symbol', $symbol, $currency );
200
+	return apply_filters('give_currency_symbol', $symbol, $currency);
201 201
 }
202 202
 
203 203
 
@@ -209,15 +209,15 @@  discard block
 block discarded – undo
209 209
  */
210 210
 function give_get_current_page_url() {
211 211
 
212
-	if ( is_front_page() ) {
213
-		$current_url = home_url( '/' );
212
+	if (is_front_page()) {
213
+		$current_url = home_url('/');
214 214
 	} else {
215
-		$http_host = sanitize_text_field( $_SERVER['HTTP_HOST'] );
216
-		$request_uri = sanitize_text_field( $_SERVER['REQUEST_URI'] );
217
-		$current_url = set_url_scheme( 'http://' . $http_host . untrailingslashit( $request_uri ) );
215
+		$http_host = sanitize_text_field($_SERVER['HTTP_HOST']);
216
+		$request_uri = sanitize_text_field($_SERVER['REQUEST_URI']);
217
+		$current_url = set_url_scheme('http://'.$http_host.untrailingslashit($request_uri));
218 218
 	}
219 219
 
220
-	return apply_filters( 'give_get_current_page_url', $current_url );
220
+	return apply_filters('give_get_current_page_url', $current_url);
221 221
 }
222 222
 
223 223
 
@@ -238,15 +238,15 @@  discard block
 block discarded – undo
238 238
 	 */
239 239
 	$gateways = give_get_enabled_payment_gateways();
240 240
 
241
-	if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) {
241
+	if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) {
242 242
 		$ret = true;
243
-	} else if ( count( $gateways ) == 1 ) {
243
+	} else if (count($gateways) == 1) {
244 244
 		$ret = false;
245
-	} else if ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) {
245
+	} else if (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) {
246 246
 		$ret = false;
247 247
 	}
248 248
 
249
-	return (bool) apply_filters( 'give_verify_credit_cards', $ret );
249
+	return (bool) apply_filters('give_verify_credit_cards', $ret);
250 250
 }
251 251
 
252 252
 /**
@@ -258,26 +258,26 @@  discard block
 block discarded – undo
258 258
 function give_get_timezone_id() {
259 259
 
260 260
 	// if site timezone string exists, return it
261
-	if ( $timezone = get_option( 'timezone_string' ) ) {
261
+	if ($timezone = get_option('timezone_string')) {
262 262
 		return $timezone;
263 263
 	}
264 264
 
265 265
 	// get UTC offset, if it isn't set return UTC
266
-	if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) {
266
+	if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) {
267 267
 		return 'UTC';
268 268
 	}
269 269
 
270 270
 	// attempt to guess the timezone string from the UTC offset
271
-	$timezone = timezone_name_from_abbr( '', $utc_offset );
271
+	$timezone = timezone_name_from_abbr('', $utc_offset);
272 272
 
273 273
 	// last try, guess timezone string manually
274
-	if ( $timezone === false ) {
274
+	if ($timezone === false) {
275 275
 
276
-		$is_dst = date( 'I' );
276
+		$is_dst = date('I');
277 277
 
278
-		foreach ( timezone_abbreviations_list() as $abbr ) {
279
-			foreach ( $abbr as $city ) {
280
-				if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) {
278
+		foreach (timezone_abbreviations_list() as $abbr) {
279
+			foreach ($abbr as $city) {
280
+				if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) {
281 281
 					return $city['timezone_id'];
282 282
 				}
283 283
 			}
@@ -301,17 +301,17 @@  discard block
 block discarded – undo
301 301
 
302 302
 	$ip = '127.0.0.1';
303 303
 
304
-	if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
304
+	if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) {
305 305
 		//check ip from share internet
306 306
 		$ip = $_SERVER['HTTP_CLIENT_IP'];
307
-	} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
307
+	} elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
308 308
 		//to check ip is pass from proxy
309 309
 		$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
310
-	} elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) {
310
+	} elseif ( ! empty($_SERVER['REMOTE_ADDR'])) {
311 311
 		$ip = $_SERVER['REMOTE_ADDR'];
312 312
 	}
313 313
 
314
-	return apply_filters( 'give_get_ip', $ip );
314
+	return apply_filters('give_get_ip', $ip);
315 315
 }
316 316
 
317 317
 
@@ -326,9 +326,9 @@  discard block
 block discarded – undo
326 326
  *
327 327
  * @uses  Give()->session->set()
328 328
  */
329
-function give_set_purchase_session( $purchase_data = array() ) {
330
-	Give()->session->set( 'give_purchase', $purchase_data );
331
-	Give()->session->set( 'give_email', $purchase_data['user_email'] );
329
+function give_set_purchase_session($purchase_data = array()) {
330
+	Give()->session->set('give_purchase', $purchase_data);
331
+	Give()->session->set('give_email', $purchase_data['user_email']);
332 332
 }
333 333
 
334 334
 /**
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
  * @return mixed array | false
343 343
  */
344 344
 function give_get_purchase_session() {
345
-	return Give()->session->get( 'give_purchase' );
345
+	return Give()->session->get('give_purchase');
346 346
 }
347 347
 
348 348
 /**
@@ -357,14 +357,14 @@  discard block
 block discarded – undo
357 357
  *
358 358
  * @return string
359 359
  */
360
-function give_get_purchase_summary( $purchase_data, $email = true ) {
360
+function give_get_purchase_summary($purchase_data, $email = true) {
361 361
 	$summary = '';
362 362
 
363
-	if ( $email ) {
364
-		$summary .= $purchase_data['user_email'] . ' - ';
363
+	if ($email) {
364
+		$summary .= $purchase_data['user_email'].' - ';
365 365
 	}
366 366
 
367
-	$summary .= get_the_title( $purchase_data['post_data']['give-form-id'] );
367
+	$summary .= get_the_title($purchase_data['post_data']['give-form-id']);
368 368
 
369 369
 	return $summary;
370 370
 }
@@ -381,31 +381,31 @@  discard block
 block discarded – undo
381 381
 function give_get_host() {
382 382
 	$host = false;
383 383
 
384
-	if ( defined( 'WPE_APIKEY' ) ) {
384
+	if (defined('WPE_APIKEY')) {
385 385
 		$host = 'WP Engine';
386
-	} elseif ( defined( 'PAGELYBIN' ) ) {
386
+	} elseif (defined('PAGELYBIN')) {
387 387
 		$host = 'Pagely';
388
-	} elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
388
+	} elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') {
389 389
 		$host = 'ICDSoft';
390
-	} elseif ( DB_HOST == 'mysqlv5' ) {
390
+	} elseif (DB_HOST == 'mysqlv5') {
391 391
 		$host = 'NetworkSolutions';
392
-	} elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
392
+	} elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) {
393 393
 		$host = 'iPage';
394
-	} elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
394
+	} elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) {
395 395
 		$host = 'IPower';
396
-	} elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
396
+	} elseif (strpos(DB_HOST, '.gridserver.com') !== false) {
397 397
 		$host = 'MediaTemple Grid';
398
-	} elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) {
398
+	} elseif (strpos(DB_HOST, '.pair.com') !== false) {
399 399
 		$host = 'pair Networks';
400
-	} elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
400
+	} elseif (strpos(DB_HOST, '.stabletransit.com') !== false) {
401 401
 		$host = 'Rackspace Cloud';
402
-	} elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
402
+	} elseif (strpos(DB_HOST, '.sysfix.eu') !== false) {
403 403
 		$host = 'SysFix.eu Power Hosting';
404
-	} elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
404
+	} elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
405 405
 		$host = 'Flywheel';
406 406
 	} else {
407 407
 		// Adding a general fallback for data gathering
408
-		$host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME'];
408
+		$host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME'];
409 409
 	}
410 410
 
411 411
 	return $host;
@@ -421,67 +421,67 @@  discard block
 block discarded – undo
421 421
  *
422 422
  * @return bool true if host matches, false if not
423 423
  */
424
-function give_is_host( $host = false ) {
424
+function give_is_host($host = false) {
425 425
 
426 426
 	$return = false;
427 427
 
428
-	if ( $host ) {
429
-		$host = str_replace( ' ', '', strtolower( $host ) );
428
+	if ($host) {
429
+		$host = str_replace(' ', '', strtolower($host));
430 430
 
431
-		switch ( $host ) {
431
+		switch ($host) {
432 432
 			case 'wpengine':
433
-				if ( defined( 'WPE_APIKEY' ) ) {
433
+				if (defined('WPE_APIKEY')) {
434 434
 					$return = true;
435 435
 				}
436 436
 				break;
437 437
 			case 'pagely':
438
-				if ( defined( 'PAGELYBIN' ) ) {
438
+				if (defined('PAGELYBIN')) {
439 439
 					$return = true;
440 440
 				}
441 441
 				break;
442 442
 			case 'icdsoft':
443
-				if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
443
+				if (DB_HOST == 'localhost:/tmp/mysql5.sock') {
444 444
 					$return = true;
445 445
 				}
446 446
 				break;
447 447
 			case 'networksolutions':
448
-				if ( DB_HOST == 'mysqlv5' ) {
448
+				if (DB_HOST == 'mysqlv5') {
449 449
 					$return = true;
450 450
 				}
451 451
 				break;
452 452
 			case 'ipage':
453
-				if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
453
+				if (strpos(DB_HOST, 'ipagemysql.com') !== false) {
454 454
 					$return = true;
455 455
 				}
456 456
 				break;
457 457
 			case 'ipower':
458
-				if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
458
+				if (strpos(DB_HOST, 'ipowermysql.com') !== false) {
459 459
 					$return = true;
460 460
 				}
461 461
 				break;
462 462
 			case 'mediatemplegrid':
463
-				if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
463
+				if (strpos(DB_HOST, '.gridserver.com') !== false) {
464 464
 					$return = true;
465 465
 				}
466 466
 				break;
467 467
 			case 'pairnetworks':
468
-				if ( strpos( DB_HOST, '.pair.com' ) !== false ) {
468
+				if (strpos(DB_HOST, '.pair.com') !== false) {
469 469
 					$return = true;
470 470
 				}
471 471
 				break;
472 472
 			case 'rackspacecloud':
473
-				if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
473
+				if (strpos(DB_HOST, '.stabletransit.com') !== false) {
474 474
 					$return = true;
475 475
 				}
476 476
 				break;
477 477
 			case 'sysfix.eu':
478 478
 			case 'sysfix.eupowerhosting':
479
-				if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
479
+				if (strpos(DB_HOST, '.sysfix.eu') !== false) {
480 480
 					$return = true;
481 481
 				}
482 482
 				break;
483 483
 			case 'flywheel':
484
-				if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
484
+				if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
485 485
 					$return = true;
486 486
 				}
487 487
 				break;
@@ -514,20 +514,20 @@  discard block
 block discarded – undo
514 514
  * @param string $replacement Optional. The function that should have been called
515 515
  * @param array  $backtrace Optional. Contains stack backtrace of deprecated function
516 516
  */
517
-function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) {
518
-	do_action( 'give_deprecated_function_run', $function, $replacement, $version );
517
+function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) {
518
+	do_action('give_deprecated_function_run', $function, $replacement, $version);
519 519
 
520
-	$show_errors = current_user_can( 'manage_options' );
520
+	$show_errors = current_user_can('manage_options');
521 521
 
522 522
 	// Allow plugin to filter the output error trigger
523
-	if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) {
524
-		if ( ! is_null( $replacement ) ) {
525
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) );
526
-			trigger_error( print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
523
+	if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) {
524
+		if ( ! is_null($replacement)) {
525
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement));
526
+			trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
527 527
 			// Alternatively we could dump this to a file.
528 528
 		} else {
529
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) );
530
-			trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
529
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version));
530
+			trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
531 531
 			// Alternatively we could dump this to a file.
532 532
 		}
533 533
 	}
@@ -541,8 +541,8 @@  discard block
 block discarded – undo
541 541
  * @return string $post_id
542 542
  */
543 543
 function give_get_admin_post_id() {
544
-	$post_id = isset( $_GET['post'] ) ? $_GET['post'] : null;
545
-	if ( ! $post_id && isset( $_POST['post_id'] ) ) {
544
+	$post_id = isset($_GET['post']) ? $_GET['post'] : null;
545
+	if ( ! $post_id && isset($_POST['post_id'])) {
546 546
 		$post_id = $_POST['post_id'];
547 547
 	}
548 548
 
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
  * @return string Arg separator output
557 557
  */
558 558
 function give_get_php_arg_separator_output() {
559
-	return ini_get( 'arg_separator.output' );
559
+	return ini_get('arg_separator.output');
560 560
 }
561 561
 
562 562
 
@@ -571,10 +571,10 @@  discard block
 block discarded – undo
571 571
  *
572 572
  * @return string Short month name
573 573
  */
574
-function give_month_num_to_name( $n ) {
575
-	$timestamp = mktime( 0, 0, 0, $n, 1, 2005 );
574
+function give_month_num_to_name($n) {
575
+	$timestamp = mktime(0, 0, 0, $n, 1, 2005);
576 576
 
577
-	return date_i18n( "M", $timestamp );
577
+	return date_i18n("M", $timestamp);
578 578
 }
579 579
 
580 580
 
@@ -587,10 +587,10 @@  discard block
 block discarded – undo
587 587
  *
588 588
  * @return bool Whether or not function is disabled.
589 589
  */
590
-function give_is_func_disabled( $function ) {
591
-	$disabled = explode( ',', ini_get( 'disable_functions' ) );
590
+function give_is_func_disabled($function) {
591
+	$disabled = explode(',', ini_get('disable_functions'));
592 592
 
593
-	return in_array( $function, $disabled );
593
+	return in_array($function, $disabled);
594 594
 }
595 595
 
596 596
 
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 
606 606
 		<form action="//givewp.us3.list-manage.com/subscribe/post?u=3ccb75d68bda4381e2f45794c&amp;id=12a081aa13" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
607 607
 			<div class="give-newsletter-confirmation">
608
-				<p><?php esc_html_e( 'Thanks for Subscribing!', 'give' ); ?> :)</p>
608
+				<p><?php esc_html_e('Thanks for Subscribing!', 'give'); ?> :)</p>
609 609
 			</div>
610 610
 
611 611
 			<table class="form-table give-newsletter-form">
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
  *
702 702
  * @return mixed
703 703
  */
704
-function give_svg_icons( $icon ) {
704
+function give_svg_icons($icon) {
705 705
 
706 706
 	// Store your SVGs in an associative array
707 707
 	$svgs = array(
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 	);
714 714
 
715 715
 	// Return the chosen icon's SVG string
716
-	return $svgs[ $icon ];
716
+	return $svgs[$icon];
717 717
 }
718 718
 
719 719
 /**
@@ -725,15 +725,15 @@  discard block
 block discarded – undo
725 725
  *
726 726
  * @return mixed
727 727
  */
728
-function modify_nav_menu_meta_box_object( $post_type ) {
729
-	if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) {
728
+function modify_nav_menu_meta_box_object($post_type) {
729
+	if (isset($post_type->name) && $post_type->name == 'give_forms') {
730 730
 		$post_type->labels->name = 'Donation Forms';
731 731
 	}
732 732
 
733 733
 	return $post_type;
734 734
 }
735 735
 
736
-add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' );
736
+add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object');
737 737
 
738 738
 
739 739
 /**
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
  * @license    http://opensource.org/licenses/MIT MIT
748 748
  */
749 749
 
750
-if ( ! function_exists( 'array_column' ) ) {
750
+if ( ! function_exists('array_column')) {
751 751
 	/**
752 752
 	 * Returns the values from a single column of the input array, identified by
753 753
 	 * the $columnKey.
@@ -766,56 +766,56 @@  discard block
 block discarded – undo
766 766
 	 *
767 767
 	 * @return array
768 768
 	 */
769
-	function array_column( $input = null, $columnKey = null, $indexKey = null ) {
769
+	function array_column($input = null, $columnKey = null, $indexKey = null) {
770 770
 		// Using func_get_args() in order to check for proper number of
771 771
 		// parameters and trigger errors exactly as the built-in array_column()
772 772
 		// does in PHP 5.5.
773 773
 		$argc   = func_num_args();
774 774
 		$params = func_get_args();
775 775
 
776
-		if ( $argc < 2 ) {
777
-			trigger_error( "array_column() expects at least 2 parameters, {$argc} given", E_USER_WARNING );
776
+		if ($argc < 2) {
777
+			trigger_error("array_column() expects at least 2 parameters, {$argc} given", E_USER_WARNING);
778 778
 
779 779
 			return null;
780 780
 		}
781 781
 
782
-		if ( ! is_array( $params[0] ) ) {
782
+		if ( ! is_array($params[0])) {
783 783
 			trigger_error(
784
-				'array_column() expects parameter 1 to be array, ' . gettype( $params[0] ) . ' given',
784
+				'array_column() expects parameter 1 to be array, '.gettype($params[0]).' given',
785 785
 				E_USER_WARNING
786 786
 			);
787 787
 
788 788
 			return null;
789 789
 		}
790 790
 
791
-		if ( ! is_int( $params[1] )
792
-		     && ! is_float( $params[1] )
793
-		     && ! is_string( $params[1] )
791
+		if ( ! is_int($params[1])
792
+		     && ! is_float($params[1])
793
+		     && ! is_string($params[1])
794 794
 		     && $params[1] !== null
795
-		     && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )
795
+		     && ! (is_object($params[1]) && method_exists($params[1], '__toString'))
796 796
 		) {
797
-			trigger_error( 'array_column(): The column key should be either a string or an integer', E_USER_WARNING );
797
+			trigger_error('array_column(): The column key should be either a string or an integer', E_USER_WARNING);
798 798
 
799 799
 			return false;
800 800
 		}
801 801
 
802
-		if ( isset( $params[2] )
803
-		     && ! is_int( $params[2] )
804
-		     && ! is_float( $params[2] )
805
-		     && ! is_string( $params[2] )
806
-		     && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) )
802
+		if (isset($params[2])
803
+		     && ! is_int($params[2])
804
+		     && ! is_float($params[2])
805
+		     && ! is_string($params[2])
806
+		     && ! (is_object($params[2]) && method_exists($params[2], '__toString'))
807 807
 		) {
808
-			trigger_error( 'array_column(): The index key should be either a string or an integer', E_USER_WARNING );
808
+			trigger_error('array_column(): The index key should be either a string or an integer', E_USER_WARNING);
809 809
 
810 810
 			return false;
811 811
 		}
812 812
 
813 813
 		$paramsInput     = $params[0];
814
-		$paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null;
814
+		$paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null;
815 815
 
816 816
 		$paramsIndexKey = null;
817
-		if ( isset( $params[2] ) ) {
818
-			if ( is_float( $params[2] ) || is_int( $params[2] ) ) {
817
+		if (isset($params[2])) {
818
+			if (is_float($params[2]) || is_int($params[2])) {
819 819
 				$paramsIndexKey = (int) $params[2];
820 820
 			} else {
821 821
 				$paramsIndexKey = (string) $params[2];
@@ -824,26 +824,26 @@  discard block
 block discarded – undo
824 824
 
825 825
 		$resultArray = array();
826 826
 
827
-		foreach ( $paramsInput as $row ) {
827
+		foreach ($paramsInput as $row) {
828 828
 			$key    = $value = null;
829 829
 			$keySet = $valueSet = false;
830 830
 
831
-			if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) {
831
+			if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) {
832 832
 				$keySet = true;
833
-				$key    = (string) $row[ $paramsIndexKey ];
833
+				$key    = (string) $row[$paramsIndexKey];
834 834
 			}
835 835
 
836
-			if ( $paramsColumnKey === null ) {
836
+			if ($paramsColumnKey === null) {
837 837
 				$valueSet = true;
838 838
 				$value    = $row;
839
-			} elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) {
839
+			} elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) {
840 840
 				$valueSet = true;
841
-				$value    = $row[ $paramsColumnKey ];
841
+				$value    = $row[$paramsColumnKey];
842 842
 			}
843 843
 
844
-			if ( $valueSet ) {
845
-				if ( $keySet ) {
846
-					$resultArray[ $key ] = $value;
844
+			if ($valueSet) {
845
+				if ($keySet) {
846
+					$resultArray[$key] = $value;
847 847
 				} else {
848 848
 					$resultArray[] = $value;
849 849
 				}
@@ -865,40 +865,40 @@  discard block
 block discarded – undo
865 865
  *
866 866
  * @return bool Whether the receipt is visible or not.
867 867
  */
868
-function give_can_view_receipt( $payment_key = '' ) {
868
+function give_can_view_receipt($payment_key = '') {
869 869
 
870 870
 	$return = false;
871 871
 
872
-	if ( empty( $payment_key ) ) {
872
+	if (empty($payment_key)) {
873 873
 		return $return;
874 874
 	}
875 875
 
876 876
 	global $give_receipt_args;
877 877
 
878
-	$give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key );
878
+	$give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key);
879 879
 
880
-	$user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] );
880
+	$user_id = (int) give_get_payment_user_id($give_receipt_args['id']);
881 881
 
882
-	$payment_meta = give_get_payment_meta( $give_receipt_args['id'] );
882
+	$payment_meta = give_get_payment_meta($give_receipt_args['id']);
883 883
 
884
-	if ( is_user_logged_in() ) {
885
-		if ( $user_id === (int) get_current_user_id() ) {
884
+	if (is_user_logged_in()) {
885
+		if ($user_id === (int) get_current_user_id()) {
886 886
 			$return = true;
887
-		} elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) {
887
+		} elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) {
888 888
 			$return = true;
889
-		} elseif ( current_user_can( 'view_give_sensitive_data' ) ) {
889
+		} elseif (current_user_can('view_give_sensitive_data')) {
890 890
 			$return = true;
891 891
 		}
892 892
 	}
893 893
 
894 894
 	$session = give_get_purchase_session();
895
-	if ( ! empty( $session ) && ! is_user_logged_in() ) {
896
-		if ( $session['purchase_key'] === $payment_meta['key'] ) {
895
+	if ( ! empty($session) && ! is_user_logged_in()) {
896
+		if ($session['purchase_key'] === $payment_meta['key']) {
897 897
 			$return = true;
898 898
 		}
899 899
 	}
900 900
 
901
-	return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key );
901
+	return (bool) apply_filters('give_can_view_receipt', $return, $payment_key);
902 902
 
903 903
 }
904 904
 
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
  *
908 908
  * Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar
909 909
  */
910
-if ( ! function_exists( 'cal_days_in_month' ) ) {
910
+if ( ! function_exists('cal_days_in_month')) {
911 911
 	/**
912 912
 	 * cal_days_in_month
913 913
 	 *
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 	 *
918 918
 	 * @return bool|string
919 919
 	 */
920
-	function cal_days_in_month( $calendar, $month, $year ) {
921
-		return date( 't', mktime( 0, 0, 0, $month, 1, $year ) );
920
+	function cal_days_in_month($calendar, $month, $year) {
921
+		return date('t', mktime(0, 0, 0, $month, 1, $year));
922 922
 	}
923 923
 }
Please login to merge, or discard this patch.
includes/gateways/paypal-standard.php 1 patch
Spacing   +187 added lines, -187 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.0
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  * @access private
22 22
  * @since  1.0
23 23
  */
24
-add_action( 'give_paypal_cc_form', '__return_false' );
24
+add_action('give_paypal_cc_form', '__return_false');
25 25
 
26 26
 /**
27 27
  * Process PayPal Purchase.
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return void
34 34
  */
35
-function give_process_paypal_purchase( $purchase_data ) {
35
+function give_process_paypal_purchase($purchase_data) {
36 36
 
37
-	if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) {
38
-		wp_die( esc_html__( 'Nonce verification has failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
37
+	if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) {
38
+		wp_die(esc_html__('Nonce verification has failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
39 39
 	}
40 40
 
41
-	$form_id  = intval( $purchase_data['post_data']['give-form-id'] );
42
-	$price_id = isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '';
41
+	$form_id  = intval($purchase_data['post_data']['give-form-id']);
42
+	$price_id = isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '';
43 43
 
44 44
 	// Collect payment data.
45 45
 	$payment_data = array(
@@ -57,101 +57,101 @@  discard block
 block discarded – undo
57 57
 	);
58 58
 
59 59
 	// Record the pending payment.
60
-	$payment_id = give_insert_payment( $payment_data );
60
+	$payment_id = give_insert_payment($payment_data);
61 61
 
62 62
 	// Check payment.
63
-	if ( ! $payment_id ) {
63
+	if ( ! $payment_id) {
64 64
 		// Record the error.
65 65
 		give_record_gateway_error(
66
-			esc_html__( 'Payment Error', 'give' ),
66
+			esc_html__('Payment Error', 'give'),
67 67
 			sprintf(
68 68
 			/* translators: %s: payment data */
69
-				esc_html__( 'Payment creation failed before sending donor to PayPal. Payment data: %s', 'give' ),
70
-				json_encode( $payment_data )
69
+				esc_html__('Payment creation failed before sending donor to PayPal. Payment data: %s', 'give'),
70
+				json_encode($payment_data)
71 71
 			),
72 72
 			$payment_id
73 73
 		);
74 74
 		// Problems? Send back.
75
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
75
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
76 76
 
77 77
 	} else {
78 78
 
79 79
 		// Only send to PayPal if the pending payment is created successfully.
80
-		$listener_url = add_query_arg( 'give-listener', 'IPN', home_url( 'index.php' ) );
80
+		$listener_url = add_query_arg('give-listener', 'IPN', home_url('index.php'));
81 81
 
82 82
 		// Get the success url.
83
-		$return_url = add_query_arg( array(
83
+		$return_url = add_query_arg(array(
84 84
 			'payment-confirmation' => 'paypal',
85 85
 			'payment-id'           => $payment_id
86 86
 
87
-		), get_permalink( give_get_option( 'success_page' ) ) );
87
+		), get_permalink(give_get_option('success_page')));
88 88
 
89 89
 		// Get the PayPal redirect uri.
90
-		$paypal_redirect = trailingslashit( give_get_paypal_redirect() ) . '?';
90
+		$paypal_redirect = trailingslashit(give_get_paypal_redirect()).'?';
91 91
 
92 92
 		//Item name - pass level name if variable priced.
93 93
 		$item_name = $purchase_data['post_data']['give-form-title'];
94 94
 
95 95
 		//Verify has variable prices.
96
-		if ( give_has_variable_prices( $form_id ) && isset( $purchase_data['post_data']['give-price-id'] ) ) {
96
+		if (give_has_variable_prices($form_id) && isset($purchase_data['post_data']['give-price-id'])) {
97 97
 
98
-			$item_price_level_text = give_get_price_option_name( $form_id, $purchase_data['post_data']['give-price-id'] );
98
+			$item_price_level_text = give_get_price_option_name($form_id, $purchase_data['post_data']['give-price-id']);
99 99
 
100
-			$price_level_amount = give_get_price_option_amount( $form_id, $purchase_data['post_data']['give-price-id'] );
100
+			$price_level_amount = give_get_price_option_amount($form_id, $purchase_data['post_data']['give-price-id']);
101 101
 
102 102
 			//Donation given doesn't match selected level (must be a custom amount).
103
-			if ( $price_level_amount != give_sanitize_amount( $purchase_data['price'] ) ) {
104
-				$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
103
+			if ($price_level_amount != give_sanitize_amount($purchase_data['price'])) {
104
+				$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
105 105
 				//user custom amount text if any, fallback to default if not.
106
-				$item_name .= ' - ' . ( ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' ) );
106
+				$item_name .= ' - '.( ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give'));
107 107
 
108 108
 			} //Is there any donation level text?
109
-			elseif ( ! empty( $item_price_level_text ) ) {
110
-				$item_name .= ' - ' . $item_price_level_text;
109
+			elseif ( ! empty($item_price_level_text)) {
110
+				$item_name .= ' - '.$item_price_level_text;
111 111
 			}
112 112
 
113 113
 		} //Single donation: Custom Amount.
114
-		elseif ( give_get_form_price( $form_id ) !== give_sanitize_amount( $purchase_data['price'] ) ) {
115
-			$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
114
+		elseif (give_get_form_price($form_id) !== give_sanitize_amount($purchase_data['price'])) {
115
+			$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
116 116
 			//user custom amount text if any, fallback to default if not.
117
-			$item_name .= ' - ' . ( ! empty( $custom_amount_text ) ? $custom_amount_text : esc_html__( 'Custom Amount', 'give' ) );
117
+			$item_name .= ' - '.( ! empty($custom_amount_text) ? $custom_amount_text : esc_html__('Custom Amount', 'give'));
118 118
 		}
119 119
 
120 120
 		// Setup PayPal API params.
121 121
 		$paypal_args = array(
122
-			'business'      => give_get_option( 'paypal_email', false ),
122
+			'business'      => give_get_option('paypal_email', false),
123 123
 			'first_name'    => $purchase_data['user_info']['first_name'],
124 124
 			'last_name'     => $purchase_data['user_info']['last_name'],
125 125
 			'email'         => $purchase_data['user_email'],
126 126
 			'invoice'       => $purchase_data['purchase_key'],
127 127
 			'amount'        => $purchase_data['price'],
128
-			'item_name'     => stripslashes( $item_name ),
128
+			'item_name'     => stripslashes($item_name),
129 129
 			'no_shipping'   => '1',
130 130
 			'shipping'      => '0',
131 131
 			'no_note'       => '1',
132 132
 			'currency_code' => give_get_currency(),
133
-			'charset'       => get_bloginfo( 'charset' ),
133
+			'charset'       => get_bloginfo('charset'),
134 134
 			'custom'        => $payment_id,
135 135
 			'rm'            => '2',
136 136
 			'return'        => $return_url,
137
-			'cancel_return' => give_get_failed_transaction_uri( '?payment-id=' . $payment_id ),
137
+			'cancel_return' => give_get_failed_transaction_uri('?payment-id='.$payment_id),
138 138
 			'notify_url'    => $listener_url,
139 139
 			'page_style'    => give_get_paypal_page_style(),
140
-			'cbt'           => get_bloginfo( 'name' ),
140
+			'cbt'           => get_bloginfo('name'),
141 141
 			'bn'            => 'givewp_SP'
142 142
 		);
143 143
 
144 144
 		//Add user address if present.
145
-		if ( ! empty( $purchase_data['user_info']['address'] ) ) {
146
-			$paypal_args['address1'] = isset( $purchase_data['user_info']['address']['line1'] ) ? $purchase_data['user_info']['address']['line1'] : '';
147
-			$paypal_args['address2'] = isset( $purchase_data['user_info']['address']['line2'] ) ? $purchase_data['user_info']['address']['line2'] : '';
148
-			$paypal_args['city']     = isset( $purchase_data['user_info']['address']['city'] ) ? $purchase_data['user_info']['address']['city'] : '';
149
-			$paypal_args['state']    = isset( $purchase_data['user_info']['address']['state'] ) ? $purchase_data['user_info']['address']['state'] : '';
150
-			$paypal_args['country']  = isset( $purchase_data['user_info']['address']['country'] ) ? $purchase_data['user_info']['address']['country'] : '';
145
+		if ( ! empty($purchase_data['user_info']['address'])) {
146
+			$paypal_args['address1'] = isset($purchase_data['user_info']['address']['line1']) ? $purchase_data['user_info']['address']['line1'] : '';
147
+			$paypal_args['address2'] = isset($purchase_data['user_info']['address']['line2']) ? $purchase_data['user_info']['address']['line2'] : '';
148
+			$paypal_args['city']     = isset($purchase_data['user_info']['address']['city']) ? $purchase_data['user_info']['address']['city'] : '';
149
+			$paypal_args['state']    = isset($purchase_data['user_info']['address']['state']) ? $purchase_data['user_info']['address']['state'] : '';
150
+			$paypal_args['country']  = isset($purchase_data['user_info']['address']['country']) ? $purchase_data['user_info']['address']['country'] : '';
151 151
 		}
152 152
 
153 153
 		//Donations or regular transactions?
154
-		if ( give_get_option( 'paypal_button_type' ) === 'standard' ) {
154
+		if (give_get_option('paypal_button_type') === 'standard') {
155 155
 			$paypal_extra_args = array(
156 156
 				'cmd' => '_xclick',
157 157
 			);
@@ -161,23 +161,23 @@  discard block
 block discarded – undo
161 161
 			);
162 162
 		}
163 163
 
164
-		$paypal_args = array_merge( $paypal_extra_args, $paypal_args );
165
-		$paypal_args = apply_filters( 'give_paypal_redirect_args', $paypal_args, $purchase_data );
164
+		$paypal_args = array_merge($paypal_extra_args, $paypal_args);
165
+		$paypal_args = apply_filters('give_paypal_redirect_args', $paypal_args, $purchase_data);
166 166
 
167 167
 		// Build query.
168
-		$paypal_redirect .= http_build_query( $paypal_args );
168
+		$paypal_redirect .= http_build_query($paypal_args);
169 169
 
170 170
 		// Fix for some sites that encode the entities.
171
-		$paypal_redirect = str_replace( '&amp;', '&', $paypal_redirect );
171
+		$paypal_redirect = str_replace('&amp;', '&', $paypal_redirect);
172 172
 
173 173
 		// Redirect to PayPal.
174
-		wp_redirect( $paypal_redirect );
174
+		wp_redirect($paypal_redirect);
175 175
 		exit;
176 176
 	}
177 177
 
178 178
 }
179 179
 
180
-add_action( 'give_gateway_paypal', 'give_process_paypal_purchase' );
180
+add_action('give_gateway_paypal', 'give_process_paypal_purchase');
181 181
 
182 182
 /**
183 183
  * Listens for a PayPal IPN requests and then sends to the processing function
@@ -187,12 +187,12 @@  discard block
 block discarded – undo
187 187
  */
188 188
 function give_listen_for_paypal_ipn() {
189 189
 	// Regular PayPal IPN
190
-	if ( isset( $_GET['give-listener'] ) && $_GET['give-listener'] == 'IPN' ) {
191
-		do_action( 'give_verify_paypal_ipn' );
190
+	if (isset($_GET['give-listener']) && $_GET['give-listener'] == 'IPN') {
191
+		do_action('give_verify_paypal_ipn');
192 192
 	}
193 193
 }
194 194
 
195
-add_action( 'init', 'give_listen_for_paypal_ipn' );
195
+add_action('init', 'give_listen_for_paypal_ipn');
196 196
 
197 197
 /**
198 198
  * Process PayPal IPN
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 function give_process_paypal_ipn() {
204 204
 
205 205
 	// Check the request method is POST
206
-	if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] != 'POST' ) {
206
+	if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'POST') {
207 207
 		return;
208 208
 	}
209 209
 
@@ -211,11 +211,11 @@  discard block
 block discarded – undo
211 211
 	$post_data = '';
212 212
 
213 213
 	// Fallback just in case post_max_size is lower than needed
214
-	if ( ini_get( 'allow_url_fopen' ) ) {
215
-		$post_data = file_get_contents( 'php://input' );
214
+	if (ini_get('allow_url_fopen')) {
215
+		$post_data = file_get_contents('php://input');
216 216
 	} else {
217 217
 		// If allow_url_fopen is not enabled, then make sure that post_max_size is large enough
218
-		ini_set( 'post_max_size', '12M' );
218
+		ini_set('post_max_size', '12M');
219 219
 	}
220 220
 	// Start the encoded data collection with notification command
221 221
 	$encoded_data = 'cmd=_notify-validate';
@@ -224,40 +224,40 @@  discard block
 block discarded – undo
224 224
 	$arg_separator = give_get_php_arg_separator_output();
225 225
 
226 226
 	// Verify there is a post_data
227
-	if ( $post_data || strlen( $post_data ) > 0 ) {
227
+	if ($post_data || strlen($post_data) > 0) {
228 228
 		// Append the data
229
-		$encoded_data .= $arg_separator . $post_data;
229
+		$encoded_data .= $arg_separator.$post_data;
230 230
 	} else {
231 231
 		// Check if POST is empty
232
-		if ( empty( $_POST ) ) {
232
+		if (empty($_POST)) {
233 233
 			// Nothing to do
234 234
 			return;
235 235
 		} else {
236 236
 			// Loop through each POST
237
-			foreach ( $_POST as $key => $value ) {
237
+			foreach ($_POST as $key => $value) {
238 238
 				// Encode the value and append the data.
239
-				$encoded_data .= $arg_separator . "$key=" . urlencode( $value );
239
+				$encoded_data .= $arg_separator."$key=".urlencode($value);
240 240
 			}
241 241
 		}
242 242
 	}
243 243
 
244 244
 	// Convert collected post data to an array.
245
-	parse_str( $encoded_data, $encoded_data_array );
245
+	parse_str($encoded_data, $encoded_data_array);
246 246
 
247
-	foreach ( $encoded_data_array as $key => $value ) {
247
+	foreach ($encoded_data_array as $key => $value) {
248 248
 
249
-		if ( false !== strpos( $key, 'amp;' ) ) {
250
-			$new_key = str_replace( '&amp;', '&', $key );
251
-			$new_key = str_replace( 'amp;', '&', $new_key );
249
+		if (false !== strpos($key, 'amp;')) {
250
+			$new_key = str_replace('&amp;', '&', $key);
251
+			$new_key = str_replace('amp;', '&', $new_key);
252 252
 
253
-			unset( $encoded_data_array[ $key ] );
254
-			$encoded_data_array[ $new_key ] = $value;
253
+			unset($encoded_data_array[$key]);
254
+			$encoded_data_array[$new_key] = $value;
255 255
 		}
256 256
 
257 257
 	}
258 258
 
259 259
 	//Validate IPN request w/ PayPal if user hasn't disabled this security measure.
260
-	if ( ! give_get_option( 'disable_paypal_verification' ) ) {
260
+	if ( ! give_get_option('disable_paypal_verification')) {
261 261
 
262 262
 		$remote_post_vars = array(
263 263
 			'method'      => 'POST',
@@ -277,28 +277,28 @@  discard block
 block discarded – undo
277 277
 		);
278 278
 
279 279
 		// Validate the IPN.
280
-		$api_response = wp_remote_post( give_get_paypal_redirect(), $remote_post_vars );
280
+		$api_response = wp_remote_post(give_get_paypal_redirect(), $remote_post_vars);
281 281
 
282
-		if ( is_wp_error( $api_response ) ) {
282
+		if (is_wp_error($api_response)) {
283 283
 			give_record_gateway_error(
284
-				esc_html__( 'IPN Error', 'give' ),
284
+				esc_html__('IPN Error', 'give'),
285 285
 				sprintf(
286 286
 				/* translators: %s: Paypal IPN response */
287
-					esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ),
288
-					json_encode( $api_response )
287
+					esc_html__('Invalid IPN verification response. IPN data: %s', 'give'),
288
+					json_encode($api_response)
289 289
 				)
290 290
 			);
291 291
 
292 292
 			return; // Something went wrong
293 293
 		}
294 294
 
295
-		if ( $api_response['body'] !== 'VERIFIED' && give_get_option( 'disable_paypal_verification', false ) ) {
295
+		if ($api_response['body'] !== 'VERIFIED' && give_get_option('disable_paypal_verification', false)) {
296 296
 			give_record_gateway_error(
297
-				esc_html__( 'IPN Error', 'give' ),
297
+				esc_html__('IPN Error', 'give'),
298 298
 				sprintf(
299 299
 				/* translators: %s: Paypal IPN response */
300
-					esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ),
301
-					json_encode( $api_response )
300
+					esc_html__('Invalid IPN verification response. IPN data: %s', 'give'),
301
+					json_encode($api_response)
302 302
 				)
303 303
 			);
304 304
 
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 	}
309 309
 
310 310
 	// Check if $post_data_array has been populated
311
-	if ( ! is_array( $encoded_data_array ) && ! empty( $encoded_data_array ) ) {
311
+	if ( ! is_array($encoded_data_array) && ! empty($encoded_data_array)) {
312 312
 		return;
313 313
 	}
314 314
 
@@ -317,21 +317,21 @@  discard block
 block discarded – undo
317 317
 		'payment_status' => ''
318 318
 	);
319 319
 
320
-	$encoded_data_array = wp_parse_args( $encoded_data_array, $defaults );
320
+	$encoded_data_array = wp_parse_args($encoded_data_array, $defaults);
321 321
 
322
-	$payment_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0;
322
+	$payment_id = isset($encoded_data_array['custom']) ? absint($encoded_data_array['custom']) : 0;
323 323
 
324
-	if ( has_action( 'give_paypal_' . $encoded_data_array['txn_type'] ) ) {
324
+	if (has_action('give_paypal_'.$encoded_data_array['txn_type'])) {
325 325
 		// Allow PayPal IPN types to be processed separately.
326
-		do_action( 'give_paypal_' . $encoded_data_array['txn_type'], $encoded_data_array, $payment_id );
326
+		do_action('give_paypal_'.$encoded_data_array['txn_type'], $encoded_data_array, $payment_id);
327 327
 	} else {
328 328
 		// Fallback to web accept just in case the txn_type isn't present.
329
-		do_action( 'give_paypal_web_accept', $encoded_data_array, $payment_id );
329
+		do_action('give_paypal_web_accept', $encoded_data_array, $payment_id);
330 330
 	}
331 331
 	exit;
332 332
 }
333 333
 
334
-add_action( 'give_verify_paypal_ipn', 'give_process_paypal_ipn' );
334
+add_action('give_verify_paypal_ipn', 'give_process_paypal_ipn');
335 335
 
336 336
 /**
337 337
  * Process web accept (one time) payment IPNs.
@@ -343,124 +343,124 @@  discard block
 block discarded – undo
343 343
  *
344 344
  * @return void
345 345
  */
346
-function give_process_paypal_web_accept_and_cart( $data, $payment_id ) {
346
+function give_process_paypal_web_accept_and_cart($data, $payment_id) {
347 347
 
348 348
 	//Only allow through these transaction types.
349
-	if ( $data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && strtolower( $data['payment_status'] ) != 'refunded' ) {
349
+	if ($data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && strtolower($data['payment_status']) != 'refunded') {
350 350
 		return;
351 351
 	}
352 352
 
353 353
 	//Need $payment_id to continue.
354
-	if ( empty( $payment_id ) ) {
354
+	if (empty($payment_id)) {
355 355
 		return;
356 356
 	}
357 357
 
358 358
 	// Collect payment details
359
-	$purchase_key   = isset( $data['invoice'] ) ? $data['invoice'] : $data['item_number'];
359
+	$purchase_key   = isset($data['invoice']) ? $data['invoice'] : $data['item_number'];
360 360
 	$paypal_amount  = $data['mc_gross'];
361
-	$payment_status = strtolower( $data['payment_status'] );
362
-	$currency_code  = strtolower( $data['mc_currency'] );
363
-	$business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] );
364
-	$payment_meta   = give_get_payment_meta( $payment_id );
365
-	$pp_button_type = give_get_option( 'paypal_button_type' );
361
+	$payment_status = strtolower($data['payment_status']);
362
+	$currency_code  = strtolower($data['mc_currency']);
363
+	$business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']);
364
+	$payment_meta   = give_get_payment_meta($payment_id);
365
+	$pp_button_type = give_get_option('paypal_button_type');
366 366
 
367 367
 	// Must be a PayPal standard IPN.
368
-	if ( give_get_payment_gateway( $payment_id ) != 'paypal' ) {
368
+	if (give_get_payment_gateway($payment_id) != 'paypal') {
369 369
 		return;
370 370
 	}
371 371
 
372 372
 	// Verify payment recipient
373
-	if ( strcasecmp( $business_email, trim( give_get_option( 'paypal_email' ) ) ) != 0 ) {
373
+	if (strcasecmp($business_email, trim(give_get_option('paypal_email'))) != 0) {
374 374
 
375 375
 		give_record_gateway_error(
376
-			esc_html__( 'IPN Error', 'give' ),
376
+			esc_html__('IPN Error', 'give'),
377 377
 			sprintf(
378 378
 			/* translators: %s: Paypal IPN response */
379
-				esc_html__( 'Invalid business email in IPN response. IPN data: %s', 'give' ),
380
-				json_encode( $data )
379
+				esc_html__('Invalid business email in IPN response. IPN data: %s', 'give'),
380
+				json_encode($data)
381 381
 			),
382 382
 			$payment_id
383 383
 		);
384
-		give_update_payment_status( $payment_id, 'failed' );
385
-		give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid PayPal business email.', 'give' ) );
384
+		give_update_payment_status($payment_id, 'failed');
385
+		give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid PayPal business email.', 'give'));
386 386
 
387 387
 		return;
388 388
 	}
389 389
 
390 390
 	// Verify payment currency.
391
-	if ( $currency_code != strtolower( $payment_meta['currency'] ) ) {
391
+	if ($currency_code != strtolower($payment_meta['currency'])) {
392 392
 
393 393
 		give_record_gateway_error(
394
-			esc_html__( 'IPN Error', 'give' ),
394
+			esc_html__('IPN Error', 'give'),
395 395
 			sprintf(
396 396
 			/* translators: %s: Paypal IPN response */
397
-				esc_html__( 'Invalid currency in IPN response. IPN data: %s', 'give' ),
398
-				json_encode( $data )
397
+				esc_html__('Invalid currency in IPN response. IPN data: %s', 'give'),
398
+				json_encode($data)
399 399
 			),
400 400
 			$payment_id
401 401
 		);
402
-		give_update_payment_status( $payment_id, 'failed' );
403
-		give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid currency in PayPal IPN.', 'give' ) );
402
+		give_update_payment_status($payment_id, 'failed');
403
+		give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid currency in PayPal IPN.', 'give'));
404 404
 
405 405
 		return;
406 406
 	}
407 407
 
408
-	if ( ! give_get_payment_user_email( $payment_id ) ) {
408
+	if ( ! give_get_payment_user_email($payment_id)) {
409 409
 
410 410
 		// No email associated with donation, so store email from PayPal.
411
-		give_update_payment_meta( $payment_id, '_give_payment_user_email', $data['payer_email'] );
411
+		give_update_payment_meta($payment_id, '_give_payment_user_email', $data['payer_email']);
412 412
 
413 413
 		// Setup and store the donors's details.
414 414
 		$address            = array();
415
-		$address['line1']   = ! empty( $data['address_street'] ) ? sanitize_text_field( $data['address_street'] ) : false;
416
-		$address['city']    = ! empty( $data['address_city'] ) ? sanitize_text_field( $data['address_city'] ) : false;
417
-		$address['state']   = ! empty( $data['address_state'] ) ? sanitize_text_field( $data['address_state'] ) : false;
418
-		$address['country'] = ! empty( $data['address_country_code'] ) ? sanitize_text_field( $data['address_country_code'] ) : false;
419
-		$address['zip']     = ! empty( $data['address_zip'] ) ? sanitize_text_field( $data['address_zip'] ) : false;
415
+		$address['line1']   = ! empty($data['address_street']) ? sanitize_text_field($data['address_street']) : false;
416
+		$address['city']    = ! empty($data['address_city']) ? sanitize_text_field($data['address_city']) : false;
417
+		$address['state']   = ! empty($data['address_state']) ? sanitize_text_field($data['address_state']) : false;
418
+		$address['country'] = ! empty($data['address_country_code']) ? sanitize_text_field($data['address_country_code']) : false;
419
+		$address['zip']     = ! empty($data['address_zip']) ? sanitize_text_field($data['address_zip']) : false;
420 420
 
421 421
 		$user_info = array(
422 422
 			'id'         => '-1',
423
-			'email'      => sanitize_text_field( $data['payer_email'] ),
424
-			'first_name' => sanitize_text_field( $data['first_name'] ),
425
-			'last_name'  => sanitize_text_field( $data['last_name'] ),
423
+			'email'      => sanitize_text_field($data['payer_email']),
424
+			'first_name' => sanitize_text_field($data['first_name']),
425
+			'last_name'  => sanitize_text_field($data['last_name']),
426 426
 			'discount'   => '',
427 427
 			'address'    => $address
428 428
 		);
429 429
 
430 430
 		$payment_meta['user_info'] = $user_info;
431
-		give_update_payment_meta( $payment_id, '_give_payment_meta', $payment_meta );
431
+		give_update_payment_meta($payment_id, '_give_payment_meta', $payment_meta);
432 432
 	}
433 433
 
434 434
 	//Process refunds & reversed.
435
-	if ( $payment_status == 'refunded' || $payment_status == 'reversed' ) {
435
+	if ($payment_status == 'refunded' || $payment_status == 'reversed') {
436 436
 
437 437
 		// Process a refund
438
-		give_process_paypal_refund( $data, $payment_id );
438
+		give_process_paypal_refund($data, $payment_id);
439 439
 
440 440
 		return;
441 441
 	}
442 442
 
443
-	if ( get_post_status( $payment_id ) == 'publish' ) {
443
+	if (get_post_status($payment_id) == 'publish') {
444 444
 		return; // Only complete payments once
445 445
 	}
446 446
 
447 447
 	// Retrieve the total donation amount (before PayPal).
448
-	$payment_amount = give_get_payment_amount( $payment_id );
448
+	$payment_amount = give_get_payment_amount($payment_id);
449 449
 
450 450
 	//Check that the donation PP and local db amounts match.
451
-	if ( number_format( (float) $paypal_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
451
+	if (number_format((float) $paypal_amount, 2) < number_format((float) $payment_amount, 2)) {
452 452
 		// The prices don't match
453 453
 		give_record_gateway_error(
454
-			esc_html__( 'IPN Error', 'give' ),
454
+			esc_html__('IPN Error', 'give'),
455 455
 			sprintf(
456 456
 			/* translators: %s: Paypal IPN response */
457
-				esc_html__( 'Invalid payment amount in IPN response. IPN data: %s', 'give' ),
458
-				json_encode( $data )
457
+				esc_html__('Invalid payment amount in IPN response. IPN data: %s', 'give'),
458
+				json_encode($data)
459 459
 			),
460 460
 			$payment_id
461 461
 		);
462
-		give_update_payment_status( $payment_id, 'failed' );
463
-		give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid amount in PayPal IPN.', 'give' ) );
462
+		give_update_payment_status($payment_id, 'failed');
463
+		give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid amount in PayPal IPN.', 'give'));
464 464
 
465 465
 		return;
466 466
 	}
@@ -468,52 +468,52 @@  discard block
 block discarded – undo
468 468
 	//Verify the payment ID matches local db's if "standard" transaction is set.
469 469
 	//@see
470 470
 
471
-	if ( $pp_button_type == 'standard' && $purchase_key != give_get_payment_key( $payment_id ) ) {
471
+	if ($pp_button_type == 'standard' && $purchase_key != give_get_payment_key($payment_id)) {
472 472
 		// Purchase keys don't match
473 473
 		give_record_gateway_error(
474
-			esc_html__( 'IPN Error', 'give' ),
474
+			esc_html__('IPN Error', 'give'),
475 475
 			sprintf(
476 476
 			/* translators: %s: Paypal IPN response */
477
-				esc_html__( 'Invalid purchase key in IPN response. IPN data: %s', 'give' ),
478
-				json_encode( $data )
477
+				esc_html__('Invalid purchase key in IPN response. IPN data: %s', 'give'),
478
+				json_encode($data)
479 479
 			),
480 480
 			$payment_id
481 481
 		);
482
-		give_update_payment_status( $payment_id, 'failed' );
483
-		give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid purchase key in PayPal IPN.', 'give' ) );
482
+		give_update_payment_status($payment_id, 'failed');
483
+		give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid purchase key in PayPal IPN.', 'give'));
484 484
 
485 485
 		return;
486 486
 	}
487 487
 
488 488
 	//Process completed donations.
489
-	if ( $payment_status == 'completed' || give_is_test_mode() ) {
489
+	if ($payment_status == 'completed' || give_is_test_mode()) {
490 490
 
491 491
 		give_insert_payment_note(
492 492
 			$payment_id,
493 493
 			sprintf(
494 494
 			/* translators: %s: Paypal transaction ID */
495
-				esc_html__( 'PayPal Transaction ID: %s', 'give' ),
495
+				esc_html__('PayPal Transaction ID: %s', 'give'),
496 496
 				$data['txn_id']
497 497
 			)
498 498
 		);
499
-		give_set_payment_transaction_id( $payment_id, $data['txn_id'] );
500
-		give_update_payment_status( $payment_id, 'publish' );
499
+		give_set_payment_transaction_id($payment_id, $data['txn_id']);
500
+		give_update_payment_status($payment_id, 'publish');
501 501
 
502
-	} elseif ( 'pending' == $payment_status && isset( $data['pending_reason'] ) ) {
502
+	} elseif ('pending' == $payment_status && isset($data['pending_reason'])) {
503 503
 
504 504
 		// Look for possible pending reasons, such as an echeck.
505
-		$note = give_paypal_get_pending_donation_note( strtolower( $data['pending_reason'] ) );
505
+		$note = give_paypal_get_pending_donation_note(strtolower($data['pending_reason']));
506 506
 
507
-		if ( ! empty( $note ) ) {
507
+		if ( ! empty($note)) {
508 508
 
509
-			give_insert_payment_note( $payment_id, $note );
509
+			give_insert_payment_note($payment_id, $note);
510 510
 
511 511
 		}
512 512
 	}
513 513
 
514 514
 }
515 515
 
516
-add_action( 'give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2 );
516
+add_action('give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2);
517 517
 
518 518
 /**
519 519
  * Process PayPal IPN Refunds
@@ -525,28 +525,28 @@  discard block
 block discarded – undo
525 525
  *
526 526
  * @return void
527 527
  */
528
-function give_process_paypal_refund( $data, $payment_id = 0 ) {
528
+function give_process_paypal_refund($data, $payment_id = 0) {
529 529
 
530 530
 	// Collect payment details
531 531
 
532
-	if ( empty( $payment_id ) ) {
532
+	if (empty($payment_id)) {
533 533
 		return;
534 534
 	}
535 535
 
536
-	if ( get_post_status( $payment_id ) == 'refunded' ) {
536
+	if (get_post_status($payment_id) == 'refunded') {
537 537
 		return; // Only refund payments once
538 538
 	}
539 539
 
540
-	$payment_amount = give_get_payment_amount( $payment_id );
540
+	$payment_amount = give_get_payment_amount($payment_id);
541 541
 	$refund_amount  = $data['payment_gross'] * - 1;
542 542
 
543
-	if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) {
543
+	if (number_format((float) $refund_amount, 2) < number_format((float) $payment_amount, 2)) {
544 544
 
545 545
 		give_insert_payment_note(
546 546
 			$payment_id,
547 547
 			sprintf(
548 548
 			/* translators: %s: Paypal parent transaction ID */
549
-				esc_html__( 'Partial PayPal refund processed: %s', 'give' ),
549
+				esc_html__('Partial PayPal refund processed: %s', 'give'),
550 550
 				$data['parent_txn_id']
551 551
 			)
552 552
 		);
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 		$payment_id,
560 560
 		sprintf(
561 561
 		/* translators: %s: Paypal parent transaction ID */
562
-			esc_html__( 'PayPal Payment #%s Refunded for reason: %s', 'give' ),
562
+			esc_html__('PayPal Payment #%s Refunded for reason: %s', 'give'),
563 563
 			$data['parent_txn_id'], $data['reason_code']
564 564
 		)
565 565
 	);
@@ -567,11 +567,11 @@  discard block
 block discarded – undo
567 567
 		$payment_id,
568 568
 		sprintf(
569 569
 		/* translators: %s: Paypal transaction ID */
570
-			esc_html__( 'PayPal Refund Transaction ID: %s', 'give' ),
570
+			esc_html__('PayPal Refund Transaction ID: %s', 'give'),
571 571
 			$data['txn_id']
572 572
 		)
573 573
 	);
574
-	give_update_payment_status( $payment_id, 'refunded' );
574
+	give_update_payment_status($payment_id, 'refunded');
575 575
 }
576 576
 
577 577
 /**
@@ -583,24 +583,24 @@  discard block
 block discarded – undo
583 583
  *
584 584
  * @return string
585 585
  */
586
-function give_get_paypal_redirect( $ssl_check = false ) {
586
+function give_get_paypal_redirect($ssl_check = false) {
587 587
 
588
-	if ( is_ssl() || ! $ssl_check ) {
588
+	if (is_ssl() || ! $ssl_check) {
589 589
 		$protocal = 'https://';
590 590
 	} else {
591 591
 		$protocal = 'http://';
592 592
 	}
593 593
 
594 594
 	// Check the current payment mode
595
-	if ( give_is_test_mode() ) {
595
+	if (give_is_test_mode()) {
596 596
 		// Test mode
597
-		$paypal_uri = $protocal . 'www.sandbox.paypal.com/cgi-bin/webscr';
597
+		$paypal_uri = $protocal.'www.sandbox.paypal.com/cgi-bin/webscr';
598 598
 	} else {
599 599
 		// Live mode
600
-		$paypal_uri = $protocal . 'www.paypal.com/cgi-bin/webscr';
600
+		$paypal_uri = $protocal.'www.paypal.com/cgi-bin/webscr';
601 601
 	}
602 602
 
603
-	return apply_filters( 'give_paypal_uri', $paypal_uri );
603
+	return apply_filters('give_paypal_uri', $paypal_uri);
604 604
 }
605 605
 
606 606
 /**
@@ -610,9 +610,9 @@  discard block
 block discarded – undo
610 610
  * @return string
611 611
  */
612 612
 function give_get_paypal_page_style() {
613
-	$page_style = trim( give_get_option( 'paypal_page_style', 'PayPal' ) );
613
+	$page_style = trim(give_get_option('paypal_page_style', 'PayPal'));
614 614
 
615
-	return apply_filters( 'give_paypal_page_style', $page_style );
615
+	return apply_filters('give_paypal_page_style', $page_style);
616 616
 }
617 617
 
618 618
 /**
@@ -627,26 +627,26 @@  discard block
 block discarded – undo
627 627
  * @return string
628 628
  *
629 629
  */
630
-function give_paypal_success_page_content( $content ) {
630
+function give_paypal_success_page_content($content) {
631 631
 
632
-	if ( ! isset( $_GET['payment-id'] ) && ! give_get_purchase_session() ) {
632
+	if ( ! isset($_GET['payment-id']) && ! give_get_purchase_session()) {
633 633
 		return $content;
634 634
 	}
635 635
 
636
-	$payment_id = isset( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : false;
636
+	$payment_id = isset($_GET['payment-id']) ? absint($_GET['payment-id']) : false;
637 637
 
638
-	if ( ! $payment_id ) {
638
+	if ( ! $payment_id) {
639 639
 		$session    = give_get_purchase_session();
640
-		$payment_id = give_get_purchase_id_by_key( $session['purchase_key'] );
640
+		$payment_id = give_get_purchase_id_by_key($session['purchase_key']);
641 641
 	}
642 642
 
643
-	$payment = get_post( $payment_id );
644
-	if ( $payment && 'pending' == $payment->post_status ) {
643
+	$payment = get_post($payment_id);
644
+	if ($payment && 'pending' == $payment->post_status) {
645 645
 
646 646
 		// Payment is still pending so show processing indicator to fix the race condition.
647 647
 		ob_start();
648 648
 
649
-		give_get_template_part( 'payment', 'processing' );
649
+		give_get_template_part('payment', 'processing');
650 650
 
651 651
 		$content = ob_get_clean();
652 652
 
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
 
657 657
 }
658 658
 
659
-add_filter( 'give_payment_confirm_paypal', 'give_paypal_success_page_content' );
659
+add_filter('give_payment_confirm_paypal', 'give_paypal_success_page_content');
660 660
 
661 661
 /**
662 662
  * Given a Payment ID, extract the transaction ID
@@ -667,22 +667,22 @@  discard block
 block discarded – undo
667 667
  *
668 668
  * @return string                   Transaction ID
669 669
  */
670
-function give_paypal_get_payment_transaction_id( $payment_id ) {
670
+function give_paypal_get_payment_transaction_id($payment_id) {
671 671
 
672 672
 	$transaction_id = '';
673
-	$notes          = give_get_payment_notes( $payment_id );
673
+	$notes          = give_get_payment_notes($payment_id);
674 674
 
675
-	foreach ( $notes as $note ) {
676
-		if ( preg_match( '/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match ) ) {
675
+	foreach ($notes as $note) {
676
+		if (preg_match('/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match)) {
677 677
 			$transaction_id = $match[1];
678 678
 			continue;
679 679
 		}
680 680
 	}
681 681
 
682
-	return apply_filters( 'give_paypal_set_payment_transaction_id', $transaction_id, $payment_id );
682
+	return apply_filters('give_paypal_set_payment_transaction_id', $transaction_id, $payment_id);
683 683
 }
684 684
 
685
-add_filter( 'give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1 );
685
+add_filter('give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1);
686 686
 
687 687
 /**
688 688
  * Given a transaction ID, generate a link to the PayPal transaction ID details
@@ -694,16 +694,16 @@  discard block
 block discarded – undo
694 694
  *
695 695
  * @return string                 A link to the PayPal transaction details
696 696
  */
697
-function give_paypal_link_transaction_id( $transaction_id, $payment_id ) {
697
+function give_paypal_link_transaction_id($transaction_id, $payment_id) {
698 698
 
699 699
 	$paypal_base_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=';
700
-	$transaction_url = '<a href="' . esc_url( $paypal_base_url . $transaction_id ) . '" target="_blank">' . $transaction_id . '</a>';
700
+	$transaction_url = '<a href="'.esc_url($paypal_base_url.$transaction_id).'" target="_blank">'.$transaction_id.'</a>';
701 701
 
702
-	return apply_filters( 'give_paypal_link_payment_details_transaction_id', $transaction_url );
702
+	return apply_filters('give_paypal_link_payment_details_transaction_id', $transaction_url);
703 703
 
704 704
 }
705 705
 
706
-add_filter( 'give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2 );
706
+add_filter('give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2);
707 707
 
708 708
 
709 709
 /**
@@ -715,61 +715,61 @@  discard block
 block discarded – undo
715 715
  *
716 716
  * @return string
717 717
  */
718
-function give_get_pending_donation_note( $pending_reason ) {
719
-	switch ( $pending_reason ) {
718
+function give_get_pending_donation_note($pending_reason) {
719
+	switch ($pending_reason) {
720 720
 
721 721
 		case 'echeck' :
722 722
 
723
-			$note = esc_html__( 'Payment made via eCheck and will clear automatically in 5-8 days.', 'give' );
723
+			$note = esc_html__('Payment made via eCheck and will clear automatically in 5-8 days.', 'give');
724 724
 
725 725
 			break;
726 726
 
727 727
 		case 'address' :
728 728
 
729
-			$note = esc_html__( 'Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give' );
729
+			$note = esc_html__('Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give');
730 730
 
731 731
 			break;
732 732
 
733 733
 		case 'intl' :
734 734
 
735
-			$note = esc_html__( 'Payment must be accepted manually through PayPal due to international account regulations.', 'give' );
735
+			$note = esc_html__('Payment must be accepted manually through PayPal due to international account regulations.', 'give');
736 736
 
737 737
 			break;
738 738
 
739 739
 		case 'multi-currency' :
740 740
 
741
-			$note = esc_html__( 'Payment received in non-shop currency and must be accepted manually through PayPal.', 'give' );
741
+			$note = esc_html__('Payment received in non-shop currency and must be accepted manually through PayPal.', 'give');
742 742
 
743 743
 			break;
744 744
 
745 745
 		case 'paymentreview' :
746 746
 		case 'regulatory_review' :
747 747
 
748
-			$note = esc_html__( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give' );
748
+			$note = esc_html__('Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give');
749 749
 
750 750
 			break;
751 751
 
752 752
 		case 'unilateral' :
753 753
 
754
-			$note = esc_html__( 'Payment was sent to non-confirmed or non-registered email address.', 'give' );
754
+			$note = esc_html__('Payment was sent to non-confirmed or non-registered email address.', 'give');
755 755
 
756 756
 			break;
757 757
 
758 758
 		case 'upgrade' :
759 759
 
760
-			$note = esc_html__( 'PayPal account must be upgraded before this payment can be accepted.', 'give' );
760
+			$note = esc_html__('PayPal account must be upgraded before this payment can be accepted.', 'give');
761 761
 
762 762
 			break;
763 763
 
764 764
 		case 'verify' :
765 765
 
766
-			$note = esc_html__( 'PayPal account is not verified. Verify account in order to accept this donation.', 'give' );
766
+			$note = esc_html__('PayPal account is not verified. Verify account in order to accept this donation.', 'give');
767 767
 
768 768
 			break;
769 769
 
770 770
 		case 'other' :
771 771
 
772
-			$note = esc_html__( 'Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give' );
772
+			$note = esc_html__('Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give');
773 773
 
774 774
 			break;
775 775
 
Please login to merge, or discard this patch.