Completed
Push — master ( 45b05a...b92b5a )
by Devin
53s
created
includes/misc-functions.php 1 patch
Spacing   +165 added lines, -165 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
 
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
 function give_is_test_mode() {
25 25
 	global $give_options;
26 26
 
27
-	$ret = ! empty( $give_options['test_mode'] );
27
+	$ret = ! empty($give_options['test_mode']);
28 28
 
29
-	return (bool) apply_filters( 'give_is_test_mode', $ret );
29
+	return (bool) apply_filters('give_is_test_mode', $ret);
30 30
 }
31 31
 
32 32
 /**
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
  */
38 38
 function give_get_currency() {
39 39
 	global $give_options;
40
-	$currency = isset( $give_options['currency'] ) ? $give_options['currency'] : 'USD';
40
+	$currency = isset($give_options['currency']) ? $give_options['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
 	global $give_options;
54
-	$currency_pos = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
54
+	$currency_pos = isset($give_options['currency_position']) ? $give_options['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'  => __( 'US Dollars ($)', 'give' ),
70
-		'EUR'  => __( 'Euros (€)', 'give' ),
71
-		'GBP'  => __( 'Pounds Sterling (£)', 'give' ),
72
-		'AUD'  => __( 'Australian Dollars ($)', 'give' ),
73
-		'BRL'  => __( 'Brazilian Real (R$)', 'give' ),
74
-		'CAD'  => __( 'Canadian Dollars ($)', 'give' ),
75
-		'CZK'  => __( 'Czech Koruna (Kč)', 'give' ),
76
-		'DKK'  => __( 'Danish Krone (kr)', 'give' ),
77
-		'HKD'  => __( 'Hong Kong Dollar ($)', 'give' ),
78
-		'HUF'  => __( 'Hungarian Forint (Ft)', 'give' ),
79
-		'ILS'  => __( 'Israeli Shekel (₪)', 'give' ),
80
-		'JPY'  => __( 'Japanese Yen (¥)', 'give' ),
81
-		'MYR'  => __( 'Malaysian Ringgits (RM)', 'give' ),
82
-		'MXN'  => __( 'Mexican Peso ($)', 'give' ),
83
-		'MAD'  => __( 'Moroccan Dirham (.د.م)', 'give' ),
84
-		'NZD'  => __( 'New Zealand Dollar ($)', 'give' ),
85
-		'NOK'  => __( 'Norwegian Krone (Kr.)', 'give' ),
86
-		'PHP'  => __( 'Philippine Pesos (₱)', 'give' ),
87
-		'PLN'  => __( 'Polish Zloty (zł)', 'give' ),
88
-		'SGD'  => __( 'Singapore Dollar ($)', 'give' ),
89
-		'KRW'  => __( 'South Korean Won (₩)', 'give' ),
90
-		'ZAR'  => __( 'South African Rand (R)', 'give' ),
91
-		'SEK'  => __( 'Swedish Krona (kr)', 'give' ),
92
-		'CHF'  => __( 'Swiss Franc (CHF)', 'give' ),
93
-		'TWD'  => __( 'Taiwan New Dollars (NT$)', 'give' ),
94
-		'THB'  => __( 'Thai Baht (฿)', 'give' ),
95
-		'INR'  => __( 'Indian Rupee (₹)', 'give' ),
96
-		'TRY'  => __( 'Turkish Lira (₺)', 'give' ),
97
-		'RIAL' => __( 'Iranian Rial (﷼)', 'give' ),
98
-		'RUB'  => __( 'Russian Rubles (руб)', 'give' )
69
+		'USD'  => __('US Dollars ($)', 'give'),
70
+		'EUR'  => __('Euros (€)', 'give'),
71
+		'GBP'  => __('Pounds Sterling (£)', 'give'),
72
+		'AUD'  => __('Australian Dollars ($)', 'give'),
73
+		'BRL'  => __('Brazilian Real (R$)', 'give'),
74
+		'CAD'  => __('Canadian Dollars ($)', 'give'),
75
+		'CZK'  => __('Czech Koruna (Kč)', 'give'),
76
+		'DKK'  => __('Danish Krone (kr)', 'give'),
77
+		'HKD'  => __('Hong Kong Dollar ($)', 'give'),
78
+		'HUF'  => __('Hungarian Forint (Ft)', 'give'),
79
+		'ILS'  => __('Israeli Shekel (₪)', 'give'),
80
+		'JPY'  => __('Japanese Yen (¥)', 'give'),
81
+		'MYR'  => __('Malaysian Ringgits (RM)', 'give'),
82
+		'MXN'  => __('Mexican Peso ($)', 'give'),
83
+		'MAD'  => __('Moroccan Dirham (.د.م)', 'give'),
84
+		'NZD'  => __('New Zealand Dollar ($)', 'give'),
85
+		'NOK'  => __('Norwegian Krone (Kr.)', 'give'),
86
+		'PHP'  => __('Philippine Pesos (₱)', 'give'),
87
+		'PLN'  => __('Polish Zloty (zł)', 'give'),
88
+		'SGD'  => __('Singapore Dollar ($)', 'give'),
89
+		'KRW'  => __('South Korean Won (₩)', 'give'),
90
+		'ZAR'  => __('South African Rand (R)', 'give'),
91
+		'SEK'  => __('Swedish Krona (kr)', 'give'),
92
+		'CHF'  => __('Swiss Franc (CHF)', 'give'),
93
+		'TWD'  => __('Taiwan New Dollars (NT$)', 'give'),
94
+		'THB'  => __('Thai Baht (฿)', 'give'),
95
+		'INR'  => __('Indian Rupee (₹)', 'give'),
96
+		'TRY'  => __('Turkish Lira (₺)', 'give'),
97
+		'RIAL' => __('Iranian Rial (﷼)', 'give'),
98
+		'RUB'  => __('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,13 +209,13 @@  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
-		$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . untrailingslashit( $_SERVER['REQUEST_URI'] ) );
215
+		$current_url = set_url_scheme('http://'.$_SERVER['HTTP_HOST'].untrailingslashit($_SERVER['REQUEST_URI']));
216 216
 	}
217 217
 
218
-	return apply_filters( 'give_get_current_page_url', esc_url( $current_url ) );
218
+	return apply_filters('give_get_current_page_url', esc_url($current_url));
219 219
 }
220 220
 
221 221
 
@@ -236,15 +236,15 @@  discard block
 block discarded – undo
236 236
 	 */
237 237
 	$gateways = give_get_enabled_payment_gateways();
238 238
 
239
-	if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) {
239
+	if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) {
240 240
 		$ret = true;
241
-	} else if ( count( $gateways ) == 1 ) {
241
+	} else if (count($gateways) == 1) {
242 242
 		$ret = false;
243
-	} else if ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) {
243
+	} else if (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) {
244 244
 		$ret = false;
245 245
 	}
246 246
 
247
-	return (bool) apply_filters( 'give_verify_credit_cards', $ret );
247
+	return (bool) apply_filters('give_verify_credit_cards', $ret);
248 248
 }
249 249
 
250 250
 /**
@@ -256,26 +256,26 @@  discard block
 block discarded – undo
256 256
 function give_get_timezone_id() {
257 257
 
258 258
 	// if site timezone string exists, return it
259
-	if ( $timezone = get_option( 'timezone_string' ) ) {
259
+	if ($timezone = get_option('timezone_string')) {
260 260
 		return $timezone;
261 261
 	}
262 262
 
263 263
 	// get UTC offset, if it isn't set return UTC
264
-	if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) {
264
+	if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) {
265 265
 		return 'UTC';
266 266
 	}
267 267
 
268 268
 	// attempt to guess the timezone string from the UTC offset
269
-	$timezone = timezone_name_from_abbr( '', $utc_offset );
269
+	$timezone = timezone_name_from_abbr('', $utc_offset);
270 270
 
271 271
 	// last try, guess timezone string manually
272
-	if ( $timezone === false ) {
272
+	if ($timezone === false) {
273 273
 
274
-		$is_dst = date( 'I' );
274
+		$is_dst = date('I');
275 275
 
276
-		foreach ( timezone_abbreviations_list() as $abbr ) {
277
-			foreach ( $abbr as $city ) {
278
-				if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) {
276
+		foreach (timezone_abbreviations_list() as $abbr) {
277
+			foreach ($abbr as $city) {
278
+				if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) {
279 279
 					return $city['timezone_id'];
280 280
 				}
281 281
 			}
@@ -299,17 +299,17 @@  discard block
 block discarded – undo
299 299
 
300 300
 	$ip = '127.0.0.1';
301 301
 
302
-	if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
302
+	if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) {
303 303
 		//check ip from share internet
304 304
 		$ip = $_SERVER['HTTP_CLIENT_IP'];
305
-	} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
305
+	} elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
306 306
 		//to check ip is pass from proxy
307 307
 		$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
308
-	} elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) {
308
+	} elseif ( ! empty($_SERVER['REMOTE_ADDR'])) {
309 309
 		$ip = $_SERVER['REMOTE_ADDR'];
310 310
 	}
311 311
 
312
-	return apply_filters( 'give_get_ip', $ip );
312
+	return apply_filters('give_get_ip', $ip);
313 313
 }
314 314
 
315 315
 
@@ -324,9 +324,9 @@  discard block
 block discarded – undo
324 324
  *
325 325
  * @uses  Give()->session->set()
326 326
  */
327
-function give_set_purchase_session( $purchase_data = array() ) {
328
-	Give()->session->set( 'give_purchase', $purchase_data );
329
-	Give()->session->set( 'give_email', $purchase_data['user_email'] );
327
+function give_set_purchase_session($purchase_data = array()) {
328
+	Give()->session->set('give_purchase', $purchase_data);
329
+	Give()->session->set('give_email', $purchase_data['user_email']);
330 330
 }
331 331
 
332 332
 /**
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
  * @return mixed array | false
341 341
  */
342 342
 function give_get_purchase_session() {
343
-	return Give()->session->get( 'give_purchase' );
343
+	return Give()->session->get('give_purchase');
344 344
 }
345 345
 
346 346
 /**
@@ -355,14 +355,14 @@  discard block
 block discarded – undo
355 355
  *
356 356
  * @return string
357 357
  */
358
-function give_get_purchase_summary( $purchase_data, $email = true ) {
358
+function give_get_purchase_summary($purchase_data, $email = true) {
359 359
 	$summary = '';
360 360
 
361
-	if ( $email ) {
362
-		$summary .= $purchase_data['user_email'] . ' - ';
361
+	if ($email) {
362
+		$summary .= $purchase_data['user_email'].' - ';
363 363
 	}
364 364
 
365
-	$summary .= get_the_title( $purchase_data['post_data']['give-form-id'] );
365
+	$summary .= get_the_title($purchase_data['post_data']['give-form-id']);
366 366
 
367 367
 	return $summary;
368 368
 }
@@ -379,31 +379,31 @@  discard block
 block discarded – undo
379 379
 function give_get_host() {
380 380
 	$host = false;
381 381
 
382
-	if ( defined( 'WPE_APIKEY' ) ) {
382
+	if (defined('WPE_APIKEY')) {
383 383
 		$host = 'WP Engine';
384
-	} elseif ( defined( 'PAGELYBIN' ) ) {
384
+	} elseif (defined('PAGELYBIN')) {
385 385
 		$host = 'Pagely';
386
-	} elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
386
+	} elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') {
387 387
 		$host = 'ICDSoft';
388
-	} elseif ( DB_HOST == 'mysqlv5' ) {
388
+	} elseif (DB_HOST == 'mysqlv5') {
389 389
 		$host = 'NetworkSolutions';
390
-	} elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
390
+	} elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) {
391 391
 		$host = 'iPage';
392
-	} elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
392
+	} elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) {
393 393
 		$host = 'IPower';
394
-	} elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
394
+	} elseif (strpos(DB_HOST, '.gridserver.com') !== false) {
395 395
 		$host = 'MediaTemple Grid';
396
-	} elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) {
396
+	} elseif (strpos(DB_HOST, '.pair.com') !== false) {
397 397
 		$host = 'pair Networks';
398
-	} elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
398
+	} elseif (strpos(DB_HOST, '.stabletransit.com') !== false) {
399 399
 		$host = 'Rackspace Cloud';
400
-	} elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
400
+	} elseif (strpos(DB_HOST, '.sysfix.eu') !== false) {
401 401
 		$host = 'SysFix.eu Power Hosting';
402
-	} elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
402
+	} elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
403 403
 		$host = 'Flywheel';
404 404
 	} else {
405 405
 		// Adding a general fallback for data gathering
406
-		$host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME'];
406
+		$host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME'];
407 407
 	}
408 408
 
409 409
 	return $host;
@@ -419,67 +419,67 @@  discard block
 block discarded – undo
419 419
  *
420 420
  * @return bool true if host matches, false if not
421 421
  */
422
-function give_is_host( $host = false ) {
422
+function give_is_host($host = false) {
423 423
 
424 424
 	$return = false;
425 425
 
426
-	if ( $host ) {
427
-		$host = str_replace( ' ', '', strtolower( $host ) );
426
+	if ($host) {
427
+		$host = str_replace(' ', '', strtolower($host));
428 428
 
429
-		switch ( $host ) {
429
+		switch ($host) {
430 430
 			case 'wpengine':
431
-				if ( defined( 'WPE_APIKEY' ) ) {
431
+				if (defined('WPE_APIKEY')) {
432 432
 					$return = true;
433 433
 				}
434 434
 				break;
435 435
 			case 'pagely':
436
-				if ( defined( 'PAGELYBIN' ) ) {
436
+				if (defined('PAGELYBIN')) {
437 437
 					$return = true;
438 438
 				}
439 439
 				break;
440 440
 			case 'icdsoft':
441
-				if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
441
+				if (DB_HOST == 'localhost:/tmp/mysql5.sock') {
442 442
 					$return = true;
443 443
 				}
444 444
 				break;
445 445
 			case 'networksolutions':
446
-				if ( DB_HOST == 'mysqlv5' ) {
446
+				if (DB_HOST == 'mysqlv5') {
447 447
 					$return = true;
448 448
 				}
449 449
 				break;
450 450
 			case 'ipage':
451
-				if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
451
+				if (strpos(DB_HOST, 'ipagemysql.com') !== false) {
452 452
 					$return = true;
453 453
 				}
454 454
 				break;
455 455
 			case 'ipower':
456
-				if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
456
+				if (strpos(DB_HOST, 'ipowermysql.com') !== false) {
457 457
 					$return = true;
458 458
 				}
459 459
 				break;
460 460
 			case 'mediatemplegrid':
461
-				if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
461
+				if (strpos(DB_HOST, '.gridserver.com') !== false) {
462 462
 					$return = true;
463 463
 				}
464 464
 				break;
465 465
 			case 'pairnetworks':
466
-				if ( strpos( DB_HOST, '.pair.com' ) !== false ) {
466
+				if (strpos(DB_HOST, '.pair.com') !== false) {
467 467
 					$return = true;
468 468
 				}
469 469
 				break;
470 470
 			case 'rackspacecloud':
471
-				if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
471
+				if (strpos(DB_HOST, '.stabletransit.com') !== false) {
472 472
 					$return = true;
473 473
 				}
474 474
 				break;
475 475
 			case 'sysfix.eu':
476 476
 			case 'sysfix.eupowerhosting':
477
-				if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
477
+				if (strpos(DB_HOST, '.sysfix.eu') !== false) {
478 478
 					$return = true;
479 479
 				}
480 480
 				break;
481 481
 			case 'flywheel':
482
-				if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
482
+				if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
483 483
 					$return = true;
484 484
 				}
485 485
 				break;
@@ -512,20 +512,20 @@  discard block
 block discarded – undo
512 512
  * @param string $replacement Optional. The function that should have been called
513 513
  * @param array $backtrace Optional. Contains stack backtrace of deprecated function
514 514
  */
515
-function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) {
516
-	do_action( 'give_deprecated_function_run', $function, $replacement, $version );
515
+function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) {
516
+	do_action('give_deprecated_function_run', $function, $replacement, $version);
517 517
 
518
-	$show_errors = current_user_can( 'manage_options' );
518
+	$show_errors = current_user_can('manage_options');
519 519
 
520 520
 	// Allow plugin to filter the output error trigger
521
-	if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) {
522
-		if ( ! is_null( $replacement ) ) {
523
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) );
524
-			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.
521
+	if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) {
522
+		if ( ! is_null($replacement)) {
523
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement));
524
+			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.
525 525
 			// Alternatively we could dump this to a file.
526 526
 		} else {
527
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) );
528
-			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
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version));
528
+			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 529
 			// Alternatively we could dump this to a file.
530 530
 		}
531 531
 	}
@@ -539,8 +539,8 @@  discard block
 block discarded – undo
539 539
  * @return string $post_id
540 540
  */
541 541
 function give_get_admin_post_id() {
542
-	$post_id = isset( $_GET['post'] ) ? $_GET['post'] : null;
543
-	if ( ! $post_id && isset( $_POST['post_id'] ) ) {
542
+	$post_id = isset($_GET['post']) ? $_GET['post'] : null;
543
+	if ( ! $post_id && isset($_POST['post_id'])) {
544 544
 		$post_id = $_POST['post_id'];
545 545
 	}
546 546
 
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
  * @return string Arg separator output
555 555
  */
556 556
 function give_get_php_arg_separator_output() {
557
-	return ini_get( 'arg_separator.output' );
557
+	return ini_get('arg_separator.output');
558 558
 }
559 559
 
560 560
 
@@ -569,10 +569,10 @@  discard block
 block discarded – undo
569 569
  *
570 570
  * @return string Short month name
571 571
  */
572
-function give_month_num_to_name( $n ) {
573
-	$timestamp = mktime( 0, 0, 0, $n, 1, 2005 );
572
+function give_month_num_to_name($n) {
573
+	$timestamp = mktime(0, 0, 0, $n, 1, 2005);
574 574
 
575
-	return date_i18n( "M", $timestamp );
575
+	return date_i18n("M", $timestamp);
576 576
 }
577 577
 
578 578
 
@@ -585,10 +585,10 @@  discard block
 block discarded – undo
585 585
  *
586 586
  * @return bool Whether or not function is disabled.
587 587
  */
588
-function give_is_func_disabled( $function ) {
589
-	$disabled = explode( ',', ini_get( 'disable_functions' ) );
588
+function give_is_func_disabled($function) {
589
+	$disabled = explode(',', ini_get('disable_functions'));
590 590
 
591
-	return in_array( $function, $disabled );
591
+	return in_array($function, $disabled);
592 592
 }
593 593
 
594 594
 
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 
604 604
 		<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>
605 605
 			<div class="give-newsletter-confirmation">
606
-				<p><?php _e( 'Thanks for Subscribing!', 'give' ); ?> :)</p>
606
+				<p><?php _e('Thanks for Subscribing!', 'give'); ?> :)</p>
607 607
 			</div>
608 608
 
609 609
 			<table class="form-table give-newsletter-form">
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
  *
700 700
  * @return mixed
701 701
  */
702
-function give_svg_icons( $icon ) {
702
+function give_svg_icons($icon) {
703 703
 
704 704
 	// Store your SVGs in an associative array
705 705
 	$svgs = array(
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 	);
712 712
 
713 713
 	// Return the chosen icon's SVG string
714
-	return $svgs[ $icon ];
714
+	return $svgs[$icon];
715 715
 }
716 716
 
717 717
 /**
@@ -723,15 +723,15 @@  discard block
 block discarded – undo
723 723
  *
724 724
  * @return mixed
725 725
  */
726
-function modify_nav_menu_meta_box_object( $post_type ) {
727
-	if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) {
726
+function modify_nav_menu_meta_box_object($post_type) {
727
+	if (isset($post_type->name) && $post_type->name == 'give_forms') {
728 728
 		$post_type->labels->name = 'Donation Forms';
729 729
 	}
730 730
 
731 731
 	return $post_type;
732 732
 }
733 733
 
734
-add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' );
734
+add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object');
735 735
 
736 736
 
737 737
 /**
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
  * @license    http://opensource.org/licenses/MIT MIT
745 745
  */
746 746
 
747
-if ( ! function_exists( 'array_column' ) ) {
747
+if ( ! function_exists('array_column')) {
748 748
 	/**
749 749
 	 * Returns the values from a single column of the input array, identified by
750 750
 	 * the $columnKey.
@@ -763,56 +763,56 @@  discard block
 block discarded – undo
763 763
 	 *
764 764
 	 * @return array
765 765
 	 */
766
-	function array_column( $input = null, $columnKey = null, $indexKey = null ) {
766
+	function array_column($input = null, $columnKey = null, $indexKey = null) {
767 767
 		// Using func_get_args() in order to check for proper number of
768 768
 		// parameters and trigger errors exactly as the built-in array_column()
769 769
 		// does in PHP 5.5.
770 770
 		$argc   = func_num_args();
771 771
 		$params = func_get_args();
772 772
 
773
-		if ( $argc < 2 ) {
774
-			trigger_error( "array_column() expects at least 2 parameters, {$argc} given", E_USER_WARNING );
773
+		if ($argc < 2) {
774
+			trigger_error("array_column() expects at least 2 parameters, {$argc} given", E_USER_WARNING);
775 775
 
776 776
 			return null;
777 777
 		}
778 778
 
779
-		if ( ! is_array( $params[0] ) ) {
779
+		if ( ! is_array($params[0])) {
780 780
 			trigger_error(
781
-				'array_column() expects parameter 1 to be array, ' . gettype( $params[0] ) . ' given',
781
+				'array_column() expects parameter 1 to be array, '.gettype($params[0]).' given',
782 782
 				E_USER_WARNING
783 783
 			);
784 784
 
785 785
 			return null;
786 786
 		}
787 787
 
788
-		if ( ! is_int( $params[1] )
789
-		     && ! is_float( $params[1] )
790
-		     && ! is_string( $params[1] )
788
+		if ( ! is_int($params[1])
789
+		     && ! is_float($params[1])
790
+		     && ! is_string($params[1])
791 791
 		     && $params[1] !== null
792
-		     && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )
792
+		     && ! (is_object($params[1]) && method_exists($params[1], '__toString'))
793 793
 		) {
794
-			trigger_error( 'array_column(): The column key should be either a string or an integer', E_USER_WARNING );
794
+			trigger_error('array_column(): The column key should be either a string or an integer', E_USER_WARNING);
795 795
 
796 796
 			return false;
797 797
 		}
798 798
 
799
-		if ( isset( $params[2] )
800
-		     && ! is_int( $params[2] )
801
-		     && ! is_float( $params[2] )
802
-		     && ! is_string( $params[2] )
803
-		     && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) )
799
+		if (isset($params[2])
800
+		     && ! is_int($params[2])
801
+		     && ! is_float($params[2])
802
+		     && ! is_string($params[2])
803
+		     && ! (is_object($params[2]) && method_exists($params[2], '__toString'))
804 804
 		) {
805
-			trigger_error( 'array_column(): The index key should be either a string or an integer', E_USER_WARNING );
805
+			trigger_error('array_column(): The index key should be either a string or an integer', E_USER_WARNING);
806 806
 
807 807
 			return false;
808 808
 		}
809 809
 
810 810
 		$paramsInput     = $params[0];
811
-		$paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null;
811
+		$paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null;
812 812
 
813 813
 		$paramsIndexKey = null;
814
-		if ( isset( $params[2] ) ) {
815
-			if ( is_float( $params[2] ) || is_int( $params[2] ) ) {
814
+		if (isset($params[2])) {
815
+			if (is_float($params[2]) || is_int($params[2])) {
816 816
 				$paramsIndexKey = (int) $params[2];
817 817
 			} else {
818 818
 				$paramsIndexKey = (string) $params[2];
@@ -821,26 +821,26 @@  discard block
 block discarded – undo
821 821
 
822 822
 		$resultArray = array();
823 823
 
824
-		foreach ( $paramsInput as $row ) {
824
+		foreach ($paramsInput as $row) {
825 825
 			$key    = $value = null;
826 826
 			$keySet = $valueSet = false;
827 827
 
828
-			if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) {
828
+			if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) {
829 829
 				$keySet = true;
830
-				$key    = (string) $row[ $paramsIndexKey ];
830
+				$key    = (string) $row[$paramsIndexKey];
831 831
 			}
832 832
 
833
-			if ( $paramsColumnKey === null ) {
833
+			if ($paramsColumnKey === null) {
834 834
 				$valueSet = true;
835 835
 				$value    = $row;
836
-			} elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) {
836
+			} elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) {
837 837
 				$valueSet = true;
838
-				$value    = $row[ $paramsColumnKey ];
838
+				$value    = $row[$paramsColumnKey];
839 839
 			}
840 840
 
841
-			if ( $valueSet ) {
842
-				if ( $keySet ) {
843
-					$resultArray[ $key ] = $value;
841
+			if ($valueSet) {
842
+				if ($keySet) {
843
+					$resultArray[$key] = $value;
844 844
 				} else {
845 845
 					$resultArray[] = $value;
846 846
 				}
@@ -862,40 +862,40 @@  discard block
 block discarded – undo
862 862
  *
863 863
  * @return bool Whether the receipt is visible or not.
864 864
  */
865
-function give_can_view_receipt( $payment_key = '' ) {
865
+function give_can_view_receipt($payment_key = '') {
866 866
 
867 867
 	$return = false;
868 868
 
869
-	if ( empty( $payment_key ) ) {
869
+	if (empty($payment_key)) {
870 870
 		return $return;
871 871
 	}
872 872
 
873 873
 	global $give_receipt_args;
874 874
 
875
-	$give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key );
875
+	$give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key);
876 876
 
877
-	$user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] );
877
+	$user_id = (int) give_get_payment_user_id($give_receipt_args['id']);
878 878
 
879
-	$payment_meta = give_get_payment_meta( $give_receipt_args['id'] );
879
+	$payment_meta = give_get_payment_meta($give_receipt_args['id']);
880 880
 
881
-	if ( is_user_logged_in() ) {
882
-		if ( $user_id === (int) get_current_user_id() ) {
881
+	if (is_user_logged_in()) {
882
+		if ($user_id === (int) get_current_user_id()) {
883 883
 			$return = true;
884
-		} elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) {
884
+		} elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) {
885 885
 			$return = true;
886
-		} elseif ( current_user_can( 'view_give_sensitive_data' ) ) {
886
+		} elseif (current_user_can('view_give_sensitive_data')) {
887 887
 			$return = true;
888 888
 		}
889 889
 	}
890 890
 
891 891
 	$session = give_get_purchase_session();
892
-	if ( ! empty( $session ) && ! is_user_logged_in() ) {
893
-		if ( $session['purchase_key'] === $payment_meta['key'] ) {
892
+	if ( ! empty($session) && ! is_user_logged_in()) {
893
+		if ($session['purchase_key'] === $payment_meta['key']) {
894 894
 			$return = true;
895 895
 		}
896 896
 	}
897 897
 
898
-	return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key );
898
+	return (bool) apply_filters('give_can_view_receipt', $return, $payment_key);
899 899
 
900 900
 }
901 901
 
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
  *
905 905
  * @description: Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar
906 906
  */
907
-if ( ! function_exists( 'cal_days_in_month' ) ) {
907
+if ( ! function_exists('cal_days_in_month')) {
908 908
 	/**
909 909
 	 * cal_days_in_month
910 910
 	 *
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
 	 *
915 915
 	 * @return bool|string
916 916
 	 */
917
-	function cal_days_in_month( $calendar, $month, $year ) {
918
-		return date( 't', mktime( 0, 0, 0, $month, 1, $year ) );
917
+	function cal_days_in_month($calendar, $month, $year) {
918
+		return date('t', mktime(0, 0, 0, $month, 1, $year));
919 919
 	}
920 920
 }
Please login to merge, or discard this patch.
includes/forms/template.php 1 patch
Spacing   +393 added lines, -393 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,64 +23,64 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string $purchase_form
25 25
  */
26
-function give_get_donation_form( $args = array() ) {
26
+function give_get_donation_form($args = array()) {
27 27
 
28 28
 	global $post;
29 29
 
30
-	$form_id = is_object( $post ) ? $post->ID : 0;
30
+	$form_id = is_object($post) ? $post->ID : 0;
31 31
 
32
-	if ( isset( $args['id'] ) ) {
32
+	if (isset($args['id'])) {
33 33
 		$form_id = $args['id'];
34 34
 	}
35 35
 
36
-	$defaults = apply_filters( 'give_form_args_defaults', array(
36
+	$defaults = apply_filters('give_form_args_defaults', array(
37 37
 		'form_id' => $form_id
38
-	) );
38
+	));
39 39
 
40
-	$args = wp_parse_args( $args, $defaults );
40
+	$args = wp_parse_args($args, $defaults);
41 41
 
42
-	$form = new Give_Donate_Form( $args['form_id'] );
42
+	$form = new Give_Donate_Form($args['form_id']);
43 43
 
44 44
 	//bail if no form ID
45
-	if ( empty( $form->ID ) ) {
45
+	if (empty($form->ID)) {
46 46
 		return false;
47 47
 	}
48 48
 
49
-	$payment_mode = give_get_chosen_gateway( $form->ID );
49
+	$payment_mode = give_get_chosen_gateway($form->ID);
50 50
 
51
-	$form_action = esc_url( add_query_arg( apply_filters( 'give_form_action_args', array(
51
+	$form_action = esc_url(add_query_arg(apply_filters('give_form_action_args', array(
52 52
 		'payment-mode' => $payment_mode,
53
-	) ),
53
+	)),
54 54
 		give_get_current_page_url()
55
-	) );
55
+	));
56 56
 
57 57
 	//Sanity Check: Donation form not published or user doesn't have permission to view drafts
58
-	if ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) {
58
+	if ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) {
59 59
 		return false;
60 60
 	}
61 61
 
62
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
62
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
63 63
 		? $args['display_style']
64
-		: get_post_meta( $form->ID, '_give_payment_display', true );
64
+		: get_post_meta($form->ID, '_give_payment_display', true);
65 65
 
66
-	$float_labels_option = give_is_float_labels_enabled( $args )
66
+	$float_labels_option = give_is_float_labels_enabled($args)
67 67
 		? ' float-labels-enabled'
68 68
 		: '';
69 69
 
70 70
 	//Form Wrap Classes
71
-	$form_wrap_classes_array = apply_filters( 'give_form_wrap_classes', array(
71
+	$form_wrap_classes_array = apply_filters('give_form_wrap_classes', array(
72 72
 		'give-form-wrap',
73
-		'give-display-' . $display_option
74
-	), $form->ID, $args );
75
-	$form_wrap_classes       = implode( ' ', $form_wrap_classes_array );
73
+		'give-display-'.$display_option
74
+	), $form->ID, $args);
75
+	$form_wrap_classes = implode(' ', $form_wrap_classes_array);
76 76
 
77 77
 	//Form Classes
78
-	$form_classes_array = apply_filters( 'give_form_classes', array(
78
+	$form_classes_array = apply_filters('give_form_classes', array(
79 79
 		'give-form',
80
-		'give-form-' . $form->ID,
80
+		'give-form-'.$form->ID,
81 81
 		$float_labels_option
82
-	), $form->ID, $args );
83
-	$form_classes       = implode( ' ', $form_classes_array );
82
+	), $form->ID, $args);
83
+	$form_classes = implode(' ', $form_classes_array);
84 84
 
85 85
 
86 86
 	ob_start();
@@ -93,35 +93,35 @@  discard block
 block discarded – undo
93 93
 	 * @param int $form ->ID The current form ID
94 94
 	 * @param array $args An array of form args
95 95
 	 */
96
-	do_action( 'give_pre_form_output', $form->ID, $args ); ?>
96
+	do_action('give_pre_form_output', $form->ID, $args); ?>
97 97
 
98 98
 	<div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>">
99 99
 
100 100
 		<?php
101
-		if ( isset( $args['show_title'] ) && $args['show_title'] == true ) {
101
+		if (isset($args['show_title']) && $args['show_title'] == true) {
102 102
 
103
-			echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' );
103
+			echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>');
104 104
 
105 105
 		} ?>
106 106
 
107
-		<?php do_action( 'give_pre_form', $form->ID, $args ); ?>
107
+		<?php do_action('give_pre_form', $form->ID, $args); ?>
108 108
 
109 109
 		<form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" action="<?php echo $form_action; ?>" method="post">
110 110
 			<input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/>
111
-			<input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/>
112
-			<input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
113
-			<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
114
-			<input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/>
111
+			<input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/>
112
+			<input type="hidden" name="give-current-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
113
+			<input type="hidden" name="give-form-url" value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
114
+			<input type="hidden" name="give-form-minimum" value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/>
115 115
 			<?php
116 116
 
117 117
 			//Price ID hidden field for variable (mult-level) donation forms
118
-			if ( give_has_variable_prices( $form_id ) ) {
118
+			if (give_has_variable_prices($form_id)) {
119 119
 				//get default selected price ID
120
-				$prices   = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
120
+				$prices   = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
121 121
 				$price_id = 0;
122 122
 				//loop through prices
123
-				foreach ( $prices as $price ) {
124
-					if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
123
+				foreach ($prices as $price) {
124
+					if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
125 125
 						$price_id = $price['_give_id']['level_id'];
126 126
 					};
127 127
 				}
@@ -129,19 +129,19 @@  discard block
 block discarded – undo
129 129
 				<input type="hidden" name="give-price-id" value="<?php echo $price_id; ?>"/>
130 130
 			<?php }
131 131
 
132
-			do_action( 'give_checkout_form_top', $form->ID, $args );
132
+			do_action('give_checkout_form_top', $form->ID, $args);
133 133
 
134
-			do_action( 'give_payment_mode_select', $form->ID, $args );
134
+			do_action('give_payment_mode_select', $form->ID, $args);
135 135
 
136
-			do_action( 'give_checkout_form_bottom', $form->ID, $args );
136
+			do_action('give_checkout_form_bottom', $form->ID, $args);
137 137
 
138 138
 			?>
139 139
 
140 140
 		</form>
141 141
 
142
-		<?php do_action( 'give_post_form', $form->ID, $args ); ?>
142
+		<?php do_action('give_post_form', $form->ID, $args); ?>
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
 
@@ -176,43 +176,43 @@  discard block
 block discarded – undo
176 176
  * @global    $give_options Array of all the Give options
177 177
  * @return string
178 178
  */
179
-function give_show_purchase_form( $form_id ) {
179
+function give_show_purchase_form($form_id) {
180 180
 
181
-	$payment_mode = give_get_chosen_gateway( $form_id );
181
+	$payment_mode = give_get_chosen_gateway($form_id);
182 182
 
183
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
183
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
184 184
 		$form_id = $_POST['give_form_id'];
185 185
 	}
186 186
 
187
-	do_action( 'give_purchase_form_top', $form_id );
187
+	do_action('give_purchase_form_top', $form_id);
188 188
 
189
-	if ( give_can_checkout() && isset( $form_id ) ) {
189
+	if (give_can_checkout() && isset($form_id)) {
190 190
 
191
-		do_action( 'give_purchase_form_before_register_login', $form_id );
191
+		do_action('give_purchase_form_before_register_login', $form_id);
192 192
 
193
-		do_action( 'give_purchase_form_register_login_fields', $form_id );
193
+		do_action('give_purchase_form_register_login_fields', $form_id);
194 194
 
195
-		do_action( 'give_purchase_form_before_cc_form', $form_id );
195
+		do_action('give_purchase_form_before_cc_form', $form_id);
196 196
 
197 197
 		// Load the credit card form and allow gateways to load their own if they wish
198
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
199
-			do_action( 'give_' . $payment_mode . '_cc_form', $form_id );
198
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
199
+			do_action('give_'.$payment_mode.'_cc_form', $form_id);
200 200
 		} else {
201
-			do_action( 'give_cc_form', $form_id );
201
+			do_action('give_cc_form', $form_id);
202 202
 		}
203 203
 
204
-		do_action( 'give_purchase_form_after_cc_form', $form_id );
204
+		do_action('give_purchase_form_after_cc_form', $form_id);
205 205
 
206 206
 	} else {
207 207
 		// Can't checkout
208
-		do_action( 'give_purchase_form_no_access', $form_id );
208
+		do_action('give_purchase_form_no_access', $form_id);
209 209
 
210 210
 	}
211 211
 
212
-	do_action( 'give_purchase_form_bottom', $form_id );
212
+	do_action('give_purchase_form_bottom', $form_id);
213 213
 }
214 214
 
215
-add_action( 'give_purchase_form', 'give_show_purchase_form' );
215
+add_action('give_purchase_form', 'give_show_purchase_form');
216 216
 
217 217
 /**
218 218
  *
@@ -224,26 +224,26 @@  discard block
 block discarded – undo
224 224
  *
225 225
  * @return void
226 226
  */
227
-function give_show_register_login_fields( $form_id ) {
227
+function give_show_register_login_fields($form_id) {
228 228
 
229
-	$show_register_form = give_show_login_register_option( $form_id );
229
+	$show_register_form = give_show_login_register_option($form_id);
230 230
 
231
-	if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?>
231
+	if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : ?>
232 232
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
233
-			<?php do_action( 'give_purchase_form_register_fields', $form_id ); ?>
233
+			<?php do_action('give_purchase_form_register_fields', $form_id); ?>
234 234
 		</div>
235
-	<?php elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : ?>
235
+	<?php elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : ?>
236 236
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
237
-			<?php do_action( 'give_purchase_form_login_fields', $form_id ); ?>
237
+			<?php do_action('give_purchase_form_login_fields', $form_id); ?>
238 238
 		</div>
239 239
 	<?php endif; ?>
240 240
 
241
-	<?php if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) {
242
-		do_action( 'give_purchase_form_after_user_info', $form_id );
241
+	<?php if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) {
242
+		do_action('give_purchase_form_after_user_info', $form_id);
243 243
 	}
244 244
 }
245 245
 
246
-add_action( 'give_purchase_form_register_login_fields', 'give_show_register_login_fields' );
246
+add_action('give_purchase_form_register_login_fields', 'give_show_register_login_fields');
247 247
 
248 248
 /**
249 249
  * Donation Amount Field
@@ -257,33 +257,33 @@  discard block
 block discarded – undo
257 257
  *
258 258
  * @return void
259 259
  */
260
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
260
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
261 261
 
262 262
 	global $give_options;
263 263
 
264
-	$variable_pricing    = give_has_variable_prices( $form_id );
265
-	$allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true );
266
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
267
-	$symbol              = give_currency_symbol( give_get_currency() );
268
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
269
-	$default_amount      = give_format_amount( give_get_default_form_amount( $form_id ) );
270
-	$custom_amount_text  = get_post_meta( $form_id, '_give_custom_amount_text', true );
264
+	$variable_pricing    = give_has_variable_prices($form_id);
265
+	$allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true);
266
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
267
+	$symbol              = give_currency_symbol(give_get_currency());
268
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
269
+	$default_amount      = give_format_amount(give_get_default_form_amount($form_id));
270
+	$custom_amount_text  = get_post_meta($form_id, '_give_custom_amount_text', true);
271 271
 
272
-	do_action( 'give_before_donation_levels', $form_id, $args );
272
+	do_action('give_before_donation_levels', $form_id, $args);
273 273
 
274 274
 	//Set Price, No Custom Amount Allowed means hidden price field
275
-	if ( $allow_custom_amount == 'no' ) {
275
+	if ($allow_custom_amount == 'no') {
276 276
 		?>
277 277
 
278
-		<label class="give-hidden" for="give-amount-hidden"><?php echo __( 'Donation Amount:', 'give' ); ?></label>
278
+		<label class="give-hidden" for="give-amount-hidden"><?php echo __('Donation Amount:', 'give'); ?></label>
279 279
 		<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount"
280 280
 		       value="<?php echo $default_amount; ?>" required>
281 281
 		<div class="set-price give-donation-amount form-row-wide">
282
-			<?php if ( $currency_position == 'before' ) {
282
+			<?php if ($currency_position == 'before') {
283 283
 				echo $currency_output;
284 284
 			} ?>
285 285
 			<span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span>
286
-			<?php if ( $currency_position == 'after' ) {
286
+			<?php if ($currency_position == 'after') {
287 287
 				echo $currency_output;
288 288
 			} ?>
289 289
 		</div>
@@ -293,34 +293,34 @@  discard block
 block discarded – undo
293 293
 		?>
294 294
 		<div class="give-total-wrap">
295 295
 			<div class="give-donation-amount form-row-wide">
296
-				<?php if ( $currency_position == 'before' ) {
296
+				<?php if ($currency_position == 'before') {
297 297
 					echo $currency_output;
298 298
 				} ?>
299
-				<label class="give-hidden" for="give-amount"><?php echo __( 'Donation Amount:', 'give' ); ?></label>
299
+				<label class="give-hidden" for="give-amount"><?php echo __('Donation Amount:', 'give'); ?></label>
300 300
 				<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
301
-				<?php if ( $currency_position == 'after' ) {
301
+				<?php if ($currency_position == 'after') {
302 302
 					echo $currency_output;
303 303
 				} ?>
304 304
 			</div>
305 305
 		</div>
306 306
 	<?php }
307 307
 
308
-	do_action( 'give_after_donation_amount', $form_id, $args );
308
+	do_action('give_after_donation_amount', $form_id, $args);
309 309
 
310 310
 	//Custom Amount Text
311
-	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?>
311
+	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?>
312 312
 		<p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
313 313
 	<?php }
314 314
 
315 315
 	//Output Variable Pricing Levels
316
-	if ( $variable_pricing ) {
317
-		give_output_levels( $form_id );
316
+	if ($variable_pricing) {
317
+		give_output_levels($form_id);
318 318
 	}
319 319
 
320
-	do_action( 'give_after_donation_levels', $form_id, $args );
320
+	do_action('give_after_donation_levels', $form_id, $args);
321 321
 }
322 322
 
323
-add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 );
323
+add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2);
324 324
 
325 325
 
326 326
 /**
@@ -332,32 +332,32 @@  discard block
 block discarded – undo
332 332
  *
333 333
  * @return string
334 334
  */
335
-function give_output_levels( $form_id ) {
335
+function give_output_levels($form_id) {
336 336
 
337 337
 	//Get variable pricing
338
-	$prices             = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
339
-	$display_style      = get_post_meta( $form_id, '_give_display_style', true );
340
-	$custom_amount      = get_post_meta( $form_id, '_give_custom_amount', true );
341
-	$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
342
-	if ( empty( $custom_amount_text ) ) {
343
-		$custom_amount_text = __( 'Give a Custom Amount', 'give' );
338
+	$prices             = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
339
+	$display_style      = get_post_meta($form_id, '_give_display_style', true);
340
+	$custom_amount      = get_post_meta($form_id, '_give_custom_amount', true);
341
+	$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
342
+	if (empty($custom_amount_text)) {
343
+		$custom_amount_text = __('Give a Custom Amount', 'give');
344 344
 	}
345 345
 
346 346
 	$output  = '';
347 347
 	$counter = 0;
348 348
 
349
-	switch ( $display_style ) {
349
+	switch ($display_style) {
350 350
 		case 'buttons':
351 351
 
352 352
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
353 353
 
354
-			foreach ( $prices as $price ) {
355
-				$counter ++;
356
-				$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 );
357
-				$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 );
354
+			foreach ($prices as $price) {
355
+				$counter++;
356
+				$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);
357
+				$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);
358 358
 
359 359
 				$output .= '<li>';
360
-				$output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">';
360
+				$output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">';
361 361
 				$output .= $level_text;
362 362
 				$output .= '</button>';
363 363
 				$output .= '</li>';
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 			}
366 366
 
367 367
 			//Custom Amount
368
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
368
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
369 369
 				$output .= '<li>';
370 370
 				$output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">';
371 371
 				$output .= $custom_amount_text;
@@ -381,23 +381,23 @@  discard block
 block discarded – undo
381 381
 
382 382
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
383 383
 
384
-			foreach ( $prices as $price ) {
385
-				$counter ++;
386
-				$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 );
387
-				$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 );
384
+			foreach ($prices as $price) {
385
+				$counter++;
386
+				$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);
387
+				$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);
388 388
 
389 389
 				$output .= '<li>';
390
-				$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'] ) . '">';
391
-				$output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>';
390
+				$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']).'">';
391
+				$output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>';
392 392
 				$output .= '</li>';
393 393
 
394 394
 			}
395 395
 
396 396
 			//Custom Amount
397
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
397
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
398 398
 				$output .= '<li>';
399 399
 				$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">';
400
-				$output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>';
400
+				$output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>';
401 401
 				$output .= '</li>';
402 402
 			}
403 403
 
@@ -407,23 +407,23 @@  discard block
 block discarded – undo
407 407
 
408 408
 		case 'dropdown':
409 409
 
410
-			$output .= '<label for="give-donation-level" class="give-hidden">' . __( 'Choose Your Donation Amount', 'give' ) . ':</label>';
411
-			$output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level">';
410
+			$output .= '<label for="give-donation-level" class="give-hidden">'.__('Choose Your Donation Amount', 'give').':</label>';
411
+			$output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level">';
412 412
 
413 413
 			//first loop through prices
414
-			foreach ( $prices as $price ) {
415
-				$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 );
416
-				$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 );
414
+			foreach ($prices as $price) {
415
+				$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);
416
+				$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);
417 417
 
418
-				$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
+				$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']).'">';
419 419
 				$output .= $level_text;
420 420
 				$output .= '</option>';
421 421
 
422 422
 			}
423 423
 
424 424
 			//Custom Amount
425
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
426
-				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>';
425
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
426
+				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>';
427 427
 			}
428 428
 
429 429
 			$output .= '</select>';
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 			break;
432 432
 	}
433 433
 
434
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
434
+	echo apply_filters('give_form_level_output', $output, $form_id);
435 435
 }
436 436
 
437 437
 /**
@@ -443,26 +443,26 @@  discard block
 block discarded – undo
443 443
  * @param array $args
444 444
  *
445 445
  */
446
-function give_display_checkout_button( $form_id, $args ) {
446
+function give_display_checkout_button($form_id, $args) {
447 447
 
448
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
448
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
449 449
 		? $args['display_style']
450
-		: get_post_meta( $form_id, '_give_payment_display', true );
450
+		: get_post_meta($form_id, '_give_payment_display', true);
451 451
 
452 452
 	//no btn for onpage
453
-	if ( $display_option === 'onpage' ) {
453
+	if ($display_option === 'onpage') {
454 454
 		return;
455 455
 	}
456 456
 
457
-	$display_label_field = get_post_meta( $form_id, '_give_reveal_label', true );
458
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) );
457
+	$display_label_field = get_post_meta($form_id, '_give_reveal_label', true);
458
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give'));
459 459
 
460
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
460
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
461 461
 
462
-	echo apply_filters( 'give_display_checkout_button', $output );
462
+	echo apply_filters('give_display_checkout_button', $output);
463 463
 }
464 464
 
465
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
465
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
466 466
 
467 467
 /**
468 468
  * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided.
@@ -473,71 +473,71 @@  discard block
 block discarded – undo
473 473
  *
474 474
  * @return void
475 475
  */
476
-function give_user_info_fields( $form_id ) {
476
+function give_user_info_fields($form_id) {
477 477
 
478
-	if ( is_user_logged_in() ) :
479
-		$user_data = get_userdata( get_current_user_id() );
478
+	if (is_user_logged_in()) :
479
+		$user_data = get_userdata(get_current_user_id());
480 480
 	endif;
481 481
 
482
-	do_action( 'give_purchase_form_before_personal_info', $form_id );
482
+	do_action('give_purchase_form_before_personal_info', $form_id);
483 483
 	?>
484 484
 	<fieldset id="give_checkout_user_info">
485
-		<legend><?php echo apply_filters( 'give_checkout_personal_info_text', __( 'Personal Info', 'give' ) ); ?></legend>
485
+		<legend><?php echo apply_filters('give_checkout_personal_info_text', __('Personal Info', 'give')); ?></legend>
486 486
 		<p id="give-first-name-wrap" class="form-row form-row-first">
487 487
 			<label class="give-label" for="give-first">
488
-				<?php _e( 'First Name', 'give' ); ?>
489
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) { ?>
488
+				<?php _e('First Name', 'give'); ?>
489
+				<?php if (give_field_is_required('give_first', $form_id)) { ?>
490 490
 					<span class="give-required-indicator">*</span>
491 491
 				<?php } ?>
492
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span>
492
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this to personalize your account experience.', 'give'); ?>"></span>
493 493
 			</label>
494
-			<input class="give-input required" type="text" name="give_first" placeholder="<?php _e( 'First name', 'give' ); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if ( give_field_is_required( 'give_first', $form_id ) ) {
494
+			<input class="give-input required" type="text" name="give_first" placeholder="<?php _e('First name', 'give'); ?>" id="give-first" value="<?php echo is_user_logged_in() ? $user_data->first_name : ''; ?>"<?php if (give_field_is_required('give_first', $form_id)) {
495 495
 				echo ' required ';
496 496
 			} ?>/>
497 497
 		</p>
498 498
 
499 499
 		<p id="give-last-name-wrap" class="form-row form-row-last">
500 500
 			<label class="give-label" for="give-last">
501
-				<?php _e( 'Last Name', 'give' ); ?>
502
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) { ?>
501
+				<?php _e('Last Name', 'give'); ?>
502
+				<?php if (give_field_is_required('give_last', $form_id)) { ?>
503 503
 					<span class="give-required-indicator">*</span>
504 504
 				<?php } ?>
505
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span>
505
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will use this as well to personalize your account experience.', 'give'); ?>"></span>
506 506
 			</label>
507 507
 
508
-			<input class="give-input<?php if ( give_field_is_required( 'give_last', $form_id ) ) {
508
+			<input class="give-input<?php if (give_field_is_required('give_last', $form_id)) {
509 509
 				echo ' required';
510
-			} ?>" type="text" name="give_last" id="give-last" placeholder="<?php _e( 'Last name', 'give' ); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if ( give_field_is_required( 'give_last', $form_id ) ) {
510
+			} ?>" type="text" name="give_last" id="give-last" placeholder="<?php _e('Last name', 'give'); ?>" value="<?php echo is_user_logged_in() ? $user_data->last_name : ''; ?>"<?php if (give_field_is_required('give_last', $form_id)) {
511 511
 				echo ' required ';
512 512
 			} ?> />
513 513
 		</p>
514 514
 
515
-		<?php do_action( 'give_purchase_form_before_email', $form_id ); ?>
515
+		<?php do_action('give_purchase_form_before_email', $form_id); ?>
516 516
 		<p id="give-email-wrap" class="form-row form-row-wide">
517 517
 			<label class="give-label" for="give-email">
518
-				<?php _e( 'Email Address', 'give' ); ?>
519
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
518
+				<?php _e('Email Address', 'give'); ?>
519
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
520 520
 					<span class="give-required-indicator">*</span>
521 521
 				<?php } ?>
522
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'We will send the purchase receipt to this address.', 'give' ); ?>"></span>
522
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('We will send the purchase receipt to this address.', 'give'); ?>"></span>
523 523
 			</label>
524 524
 
525
-			<input class="give-input required" type="email" name="give_email" placeholder="<?php _e( 'Email address', 'give' ); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if ( give_field_is_required( 'give_email', $form_id ) ) {
525
+			<input class="give-input required" type="email" name="give_email" placeholder="<?php _e('Email address', 'give'); ?>" id="give-email" value="<?php echo is_user_logged_in() ? $user_data->user_email : ''; ?>"<?php if (give_field_is_required('give_email', $form_id)) {
526 526
 				echo ' required ';
527 527
 			} ?>/>
528 528
 
529 529
 		</p>
530
-		<?php do_action( 'give_purchase_form_after_email', $form_id ); ?>
530
+		<?php do_action('give_purchase_form_after_email', $form_id); ?>
531 531
 
532
-		<?php do_action( 'give_purchase_form_user_info', $form_id ); ?>
532
+		<?php do_action('give_purchase_form_user_info', $form_id); ?>
533 533
 	</fieldset>
534 534
 	<?php
535
-	do_action( 'give_purchase_form_after_personal_info', $form_id );
535
+	do_action('give_purchase_form_after_personal_info', $form_id);
536 536
 
537 537
 }
538 538
 
539
-add_action( 'give_purchase_form_after_user_info', 'give_user_info_fields' );
540
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
539
+add_action('give_purchase_form_after_user_info', 'give_user_info_fields');
540
+add_action('give_register_fields_before', 'give_user_info_fields');
541 541
 
542 542
 /**
543 543
  * Renders the credit card info form.
@@ -548,73 +548,73 @@  discard block
 block discarded – undo
548 548
  *
549 549
  * @return void
550 550
  */
551
-function give_get_cc_form( $form_id ) {
551
+function give_get_cc_form($form_id) {
552 552
 
553 553
 	ob_start();
554 554
 
555
-	do_action( 'give_before_cc_fields', $form_id ); ?>
555
+	do_action('give_before_cc_fields', $form_id); ?>
556 556
 
557 557
 	<fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate">
558
-		<legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', __( 'Credit Card Info', 'give' ) ); ?></legend>
559
-		<?php if ( is_ssl() ) : ?>
558
+		<legend><?php echo apply_filters('give_credit_card_fieldset_heading', __('Credit Card Info', 'give')); ?></legend>
559
+		<?php if (is_ssl()) : ?>
560 560
 			<div id="give_secure_site_wrapper-<?php echo $form_id ?>">
561 561
 				<span class="give-icon padlock"></span>
562
-				<span><?php _e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
562
+				<span><?php _e('This is a secure SSL encrypted payment.', 'give'); ?></span>
563 563
 			</div>
564 564
 		<?php endif; ?>
565 565
 		<p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
566 566
 			<label for="card_number-<?php echo $form_id ?>" class="give-label">
567
-				<?php _e( 'Card Number', 'give' ); ?>
567
+				<?php _e('Card Number', 'give'); ?>
568 568
 				<span class="give-required-indicator">*</span>
569
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span>
569
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span>
570 570
 				<span class="card-type"></span>
571 571
 			</label>
572 572
 
573
-			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php _e( 'Card number', 'give' ); ?>" required/>
573
+			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" class="card-number give-input required" placeholder="<?php _e('Card number', 'give'); ?>" required/>
574 574
 		</p>
575 575
 
576 576
 		<p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third">
577 577
 			<label for="card_cvc-<?php echo $form_id ?>" class="give-label">
578
-				<?php _e( 'CVC', 'give' ); ?>
578
+				<?php _e('CVC', 'give'); ?>
579 579
 				<span class="give-required-indicator">*</span>
580
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span>
580
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span>
581 581
 			</label>
582 582
 
583
-			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php _e( 'Security code', 'give' ); ?>" required/>
583
+			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" class="card-cvc give-input required" placeholder="<?php _e('Security code', 'give'); ?>" required/>
584 584
 		</p>
585 585
 
586 586
 		<p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
587 587
 			<label for="card_name-<?php echo $form_id ?>" class="give-label">
588
-				<?php _e( 'Name on the Card', 'give' ); ?>
588
+				<?php _e('Name on the Card', 'give'); ?>
589 589
 				<span class="give-required-indicator">*</span>
590
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span>
590
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The name printed on the front of your credit card.', 'give'); ?>"></span>
591 591
 			</label>
592 592
 
593
-			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php _e( 'Card name', 'give' ); ?>" required/>
593
+			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" class="card-name give-input required" placeholder="<?php _e('Card name', 'give'); ?>" required/>
594 594
 		</p>
595
-		<?php do_action( 'give_before_cc_expiration' ); ?>
595
+		<?php do_action('give_before_cc_expiration'); ?>
596 596
 		<p class="card-expiration form-row form-row-one-third">
597 597
 			<label for="card_expiry-<?php echo $form_id ?>" class="give-label">
598
-				<?php _e( 'Expiration', 'give' ); ?>
598
+				<?php _e('Expiration', 'give'); ?>
599 599
 				<span class="give-required-indicator">*</span>
600
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span>
600
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span>
601 601
 			</label>
602 602
 
603 603
 			<input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" class="card-expiry-month"/>
604 604
 			<input type="hidden" id="card_exp_year-<?php echo $form_id ?>" name="card_exp_year" class="card-expiry-year"/>
605 605
 
606
-			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php _e( 'MM / YY', 'give' ); ?>" required/>
606
+			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" class="card-expiry give-input required" placeholder="<?php _e('MM / YY', 'give'); ?>" required/>
607 607
 		</p>
608
-		<?php do_action( 'give_after_cc_expiration', $form_id ); ?>
608
+		<?php do_action('give_after_cc_expiration', $form_id); ?>
609 609
 
610 610
 	</fieldset>
611 611
 	<?php
612
-	do_action( 'give_after_cc_fields', $form_id );
612
+	do_action('give_after_cc_fields', $form_id);
613 613
 
614 614
 	echo ob_get_clean();
615 615
 }
616 616
 
617
-add_action( 'give_cc_form', 'give_get_cc_form' );
617
+add_action('give_cc_form', 'give_get_cc_form');
618 618
 
619 619
 /**
620 620
  * Outputs the default credit card address fields
@@ -625,110 +625,110 @@  discard block
 block discarded – undo
625 625
  *
626 626
  * @return void
627 627
  */
628
-function give_default_cc_address_fields( $form_id ) {
628
+function give_default_cc_address_fields($form_id) {
629 629
 
630 630
 	$logged_in = is_user_logged_in();
631 631
 
632
-	if ( $logged_in ) {
633
-		$user_address = get_user_meta( get_current_user_id(), '_give_user_address', true );
632
+	if ($logged_in) {
633
+		$user_address = get_user_meta(get_current_user_id(), '_give_user_address', true);
634 634
 	}
635
-	$line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : '';
636
-	$line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : '';
637
-	$city  = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : '';
638
-	$zip   = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : '';
635
+	$line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : '';
636
+	$line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : '';
637
+	$city  = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : '';
638
+	$zip   = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : '';
639 639
 	ob_start(); ?>
640 640
 	<fieldset id="give_cc_address" class="cc-address">
641
-		<legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', __( 'Billing Details', 'give' ) ); ?></legend>
642
-		<?php do_action( 'give_cc_billing_top' ); ?>
641
+		<legend><?php echo apply_filters('give_billing_details_fieldset_heading', __('Billing Details', 'give')); ?></legend>
642
+		<?php do_action('give_cc_billing_top'); ?>
643 643
 		<p id="give-card-address-wrap" class="form-row form-row-two-thirds">
644 644
 			<label for="card_address" class="give-label">
645
-				<?php _e( 'Address', 'give' ); ?>
645
+				<?php _e('Address', 'give'); ?>
646 646
 				<?php
647
-				if ( give_field_is_required( 'card_address', $form_id ) ) { ?>
647
+				if (give_field_is_required('card_address', $form_id)) { ?>
648 648
 					<span class="give-required-indicator">*</span>
649 649
 				<?php } ?>
650
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The primary billing address for your credit card.', 'give' ); ?>"></span>
650
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The primary billing address for your credit card.', 'give'); ?>"></span>
651 651
 			</label>
652 652
 
653
-			<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
+			<input type="text" id="card_address" name="card_address" class="card-address give-input<?php if (give_field_is_required('card_address', $form_id)) {
654 654
 				echo ' required';
655
-			} ?>" placeholder="<?php _e( 'Address line 1', 'give' ); ?>" value="<?php echo $line1; ?>"<?php if ( give_field_is_required( 'card_address', $form_id ) ) {
655
+			} ?>" placeholder="<?php _e('Address line 1', 'give'); ?>" value="<?php echo $line1; ?>"<?php if (give_field_is_required('card_address', $form_id)) {
656 656
 				echo '  required ';
657 657
 			} ?>/>
658 658
 		</p>
659 659
 
660 660
 		<p id="give-card-address-2-wrap" class="form-row form-row-one-third">
661 661
 			<label for="card_address_2" class="give-label">
662
-				<?php _e( 'Address Line 2', 'give' ); ?>
663
-				<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) { ?>
662
+				<?php _e('Address Line 2', 'give'); ?>
663
+				<?php if (give_field_is_required('card_address_2', $form_id)) { ?>
664 664
 					<span class="give-required-indicator">*</span>
665 665
 				<?php } ?>
666
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span>
666
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span>
667 667
 			</label>
668 668
 
669
-			<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
+			<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)) {
670 670
 				echo ' required';
671
-			} ?>" placeholder="<?php _e( 'Address line 2', 'give' ); ?>" value="<?php echo $line2; ?>"<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) {
671
+			} ?>" placeholder="<?php _e('Address line 2', 'give'); ?>" value="<?php echo $line2; ?>"<?php if (give_field_is_required('card_address_2', $form_id)) {
672 672
 				echo ' required ';
673 673
 			} ?>/>
674 674
 		</p>
675 675
 
676 676
 		<p id="give-card-city-wrap" class="form-row form-row-two-thirds">
677 677
 			<label for="card_city" class="give-label">
678
-				<?php _e( 'City', 'give' ); ?>
679
-				<?php if ( give_field_is_required( 'card_city', $form_id ) ) { ?>
678
+				<?php _e('City', 'give'); ?>
679
+				<?php if (give_field_is_required('card_city', $form_id)) { ?>
680 680
 					<span class="give-required-indicator">*</span>
681 681
 				<?php } ?>
682
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The city for your billing address.', 'give' ); ?>"></span>
682
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The city for your billing address.', 'give'); ?>"></span>
683 683
 			</label>
684
-			<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
+			<input type="text" id="card_city" name="card_city" class="card-city give-input<?php if (give_field_is_required('card_city', $form_id)) {
685 685
 				echo ' required';
686
-			} ?>" placeholder="<?php _e( 'City', 'give' ); ?>" value="<?php echo $city; ?>"<?php if ( give_field_is_required( 'card_city', $form_id ) ) {
686
+			} ?>" placeholder="<?php _e('City', 'give'); ?>" value="<?php echo $city; ?>"<?php if (give_field_is_required('card_city', $form_id)) {
687 687
 				echo ' required ';
688 688
 			} ?>/>
689 689
 		</p>
690 690
 
691 691
 		<p id="give-card-zip-wrap" class="form-row form-row-one-third">
692 692
 			<label for="card_zip" class="give-label">
693
-				<?php _e( 'Zip / Postal Code', 'give' ); ?>
694
-				<?php if ( give_field_is_required( 'card_zip', $form_id ) ) { ?>
693
+				<?php _e('Zip / Postal Code', 'give'); ?>
694
+				<?php if (give_field_is_required('card_zip', $form_id)) { ?>
695 695
 					<span class="give-required-indicator">*</span>
696 696
 				<?php } ?>
697
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span>
697
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The zip or postal code for your billing address.', 'give'); ?>"></span>
698 698
 			</label>
699 699
 
700
-			<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
+			<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)) {
701 701
 				echo ' required';
702
-			} ?>" placeholder="<?php _e( 'Zip / Postal code', 'give' ); ?>" value="<?php echo $zip; ?>" <?php if ( give_field_is_required( 'card_zip', $form_id ) ) {
702
+			} ?>" placeholder="<?php _e('Zip / Postal code', 'give'); ?>" value="<?php echo $zip; ?>" <?php if (give_field_is_required('card_zip', $form_id)) {
703 703
 				echo ' required ';
704 704
 			} ?>/>
705 705
 		</p>
706 706
 
707 707
 		<p id="give-card-country-wrap" class="form-row form-row-first">
708 708
 			<label for="billing_country" class="give-label">
709
-				<?php _e( 'Country', 'give' ); ?>
710
-				<?php if ( give_field_is_required( 'billing_country', $form_id ) ) { ?>
709
+				<?php _e('Country', 'give'); ?>
710
+				<?php if (give_field_is_required('billing_country', $form_id)) { ?>
711 711
 					<span class="give-required-indicator">*</span>
712 712
 				<?php } ?>
713
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The country for your billing address.', 'give' ); ?>"></span>
713
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The country for your billing address.', 'give'); ?>"></span>
714 714
 			</label>
715 715
 
716
-			<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
+			<select name="billing_country" id="billing_country" class="billing-country billing_country give-select<?php if (give_field_is_required('billing_country', $form_id)) {
717 717
 				echo ' required';
718
-			} ?>"<?php if ( give_field_is_required( 'billing_country', $form_id ) ) {
718
+			} ?>"<?php if (give_field_is_required('billing_country', $form_id)) {
719 719
 				echo ' required ';
720 720
 			} ?>>
721 721
 				<?php
722 722
 
723 723
 				$selected_country = give_get_country();
724 724
 
725
-				if ( $logged_in && ! empty( $user_address['country'] ) && '*' !== $user_address['country'] ) {
725
+				if ($logged_in && ! empty($user_address['country']) && '*' !== $user_address['country']) {
726 726
 					$selected_country = $user_address['country'];
727 727
 				}
728 728
 
729 729
 				$countries = give_get_country_list();
730
-				foreach ( $countries as $country_code => $country ) {
731
-					echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
730
+				foreach ($countries as $country_code => $country) {
731
+					echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
732 732
 				}
733 733
 				?>
734 734
 			</select>
@@ -736,44 +736,44 @@  discard block
 block discarded – undo
736 736
 
737 737
 		<p id="give-card-state-wrap" class="form-row form-row-last">
738 738
 			<label for="card_state" class="give-label">
739
-				<?php _e( 'State / Province', 'give' ); ?>
740
-				<?php if ( give_field_is_required( 'card_state', $form_id ) ) { ?>
739
+				<?php _e('State / Province', 'give'); ?>
740
+				<?php if (give_field_is_required('card_state', $form_id)) { ?>
741 741
 					<span class="give-required-indicator">*</span>
742 742
 				<?php } ?>
743
-				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The state or province for your billing address.', 'give' ); ?>"></span>
743
+				<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The state or province for your billing address.', 'give'); ?>"></span>
744 744
 			</label>
745 745
 
746 746
 			<?php
747 747
 			$selected_state = give_get_state();
748
-			$states         = give_get_states( $selected_country );
748
+			$states         = give_get_states($selected_country);
749 749
 
750
-			if ( $logged_in && ! empty( $user_address['state'] ) ) {
750
+			if ($logged_in && ! empty($user_address['state'])) {
751 751
 				$selected_state = $user_address['state'];
752 752
 			}
753 753
 
754
-			if ( ! empty( $states ) ) : ?>
755
-				<select name="card_state" id="card_state" class="card_state give-select<?php if ( give_field_is_required( 'card_state', $form_id ) ) {
754
+			if ( ! empty($states)) : ?>
755
+				<select name="card_state" id="card_state" class="card_state give-select<?php if (give_field_is_required('card_state', $form_id)) {
756 756
 					echo ' required';
757
-				} ?>"<?php if ( give_field_is_required( 'card_state', $form_id ) ) {
757
+				} ?>"<?php if (give_field_is_required('card_state', $form_id)) {
758 758
 					echo ' required ';
759 759
 				} ?>>
760 760
 					<?php
761
-					foreach ( $states as $state_code => $state ) {
762
-						echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
761
+					foreach ($states as $state_code => $state) {
762
+						echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
763 763
 					}
764 764
 					?>
765 765
 				</select>
766 766
 			<?php else : ?>
767
-				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e( 'State / Province', 'give' ); ?>"/>
767
+				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" placeholder="<?php _e('State / Province', 'give'); ?>"/>
768 768
 			<?php endif; ?>
769 769
 		</p>
770
-		<?php do_action( 'give_cc_billing_bottom' ); ?>
770
+		<?php do_action('give_cc_billing_bottom'); ?>
771 771
 	</fieldset>
772 772
 	<?php
773 773
 	echo ob_get_clean();
774 774
 }
775 775
 
776
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
776
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
777 777
 
778 778
 
779 779
 /**
@@ -785,93 +785,93 @@  discard block
 block discarded – undo
785 785
  *
786 786
  * @return string
787 787
  */
788
-function give_get_register_fields( $form_id ) {
788
+function give_get_register_fields($form_id) {
789 789
 
790 790
 	global $user_ID;
791 791
 
792
-	if ( is_user_logged_in() ) {
793
-		$user_data = get_userdata( $user_ID );
792
+	if (is_user_logged_in()) {
793
+		$user_data = get_userdata($user_ID);
794 794
 	}
795 795
 
796
-	$show_register_form = give_show_login_register_option( $form_id );
796
+	$show_register_form = give_show_login_register_option($form_id);
797 797
 
798 798
 	ob_start(); ?>
799 799
 	<fieldset id="give-register-fields-<?php echo $form_id; ?>">
800 800
 
801
-		<?php if ( $show_register_form == 'both' ) { ?>
801
+		<?php if ($show_register_form == 'both') { ?>
802 802
 			<div class="give-login-account-wrap">
803
-				<p class="give-login-message"><?php _e( 'Already have an account?', 'give' ); ?>&nbsp;
804
-					<a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php _e( 'Login', 'give' ); ?></a>
803
+				<p class="give-login-message"><?php _e('Already have an account?', 'give'); ?>&nbsp;
804
+					<a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" data-action="give_checkout_login"><?php _e('Login', 'give'); ?></a>
805 805
 				</p>
806 806
 				<p class="give-loading-text">
807
-					<span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></p>
807
+					<span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></p>
808 808
 			</div>
809 809
 		<?php } ?>
810 810
 
811
-		<?php do_action( 'give_register_fields_before', $form_id ); ?>
811
+		<?php do_action('give_register_fields_before', $form_id); ?>
812 812
 
813 813
 		<fieldset id="give-register-account-fields-<?php echo $form_id; ?>">
814
-			<legend><?php echo apply_filters( 'give_create_account_fieldset_heading', __( 'Create an account', 'give' ) );
815
-				if ( ! give_logged_in_only( $form_id ) ) {
816
-					echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>';
814
+			<legend><?php echo apply_filters('give_create_account_fieldset_heading', __('Create an account', 'give'));
815
+				if ( ! give_logged_in_only($form_id)) {
816
+					echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>';
817 817
 				} ?></legend>
818
-			<?php do_action( 'give_register_account_fields_before', $form_id ); ?>
818
+			<?php do_action('give_register_account_fields_before', $form_id); ?>
819 819
 			<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first">
820 820
 				<label for="give-user-login-<?php echo $form_id; ?>">
821
-					<?php _e( 'Username', 'give' ); ?>
822
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
821
+					<?php _e('Username', 'give'); ?>
822
+					<?php if (give_logged_in_only($form_id)) { ?>
823 823
 						<span class="give-required-indicator">*</span>
824 824
 					<?php } ?>
825
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The username you will use to log into your account.', 'give' ); ?>"></span>
825
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The username you will use to log into your account.', 'give'); ?>"></span>
826 826
 				</label>
827 827
 
828
-				<input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) {
828
+				<input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) {
829 829
 					echo 'required ';
830
-				} ?>give-input" type="text" placeholder="<?php _e( 'Username', 'give' ); ?>" title="<?php _e( 'Username', 'give' ); ?>"/>
830
+				} ?>give-input" type="text" placeholder="<?php _e('Username', 'give'); ?>" title="<?php _e('Username', 'give'); ?>"/>
831 831
 			</div>
832 832
 
833 833
 			<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third">
834 834
 				<label for="give-user-pass-<?php echo $form_id; ?>">
835
-					<?php _e( 'Password', 'give' ); ?>
836
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
835
+					<?php _e('Password', 'give'); ?>
836
+					<?php if (give_logged_in_only($form_id)) { ?>
837 837
 						<span class="give-required-indicator">*</span>
838 838
 					<?php } ?>
839
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'The password used to access your account.', 'give' ); ?>"></span>
839
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('The password used to access your account.', 'give'); ?>"></span>
840 840
 				</label>
841 841
 
842
-				<input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if ( give_logged_in_only( $form_id ) ) {
842
+				<input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) {
843 843
 					echo 'required ';
844
-				} ?>give-input" placeholder="<?php _e( 'Password', 'give' ); ?>" type="password"/>
844
+				} ?>give-input" placeholder="<?php _e('Password', 'give'); ?>" type="password"/>
845 845
 			</div>
846 846
 
847 847
 			<div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" class="give-register-password form-row form-row-one-third">
848 848
 				<label for="give-user-pass-confirm-<?php echo $form_id; ?>">
849
-					<?php _e( 'Confirm PW', 'give' ); ?>
850
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
849
+					<?php _e('Confirm PW', 'give'); ?>
850
+					<?php if (give_logged_in_only($form_id)) { ?>
851 851
 						<span class="give-required-indicator">*</span>
852 852
 					<?php } ?>
853
-					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'Please retype your password to confirm.', 'give' ); ?>"></span>
853
+					<span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('Please retype your password to confirm.', 'give'); ?>"></span>
854 854
 				</label>
855 855
 
856
-				<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
+				<input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" class="<?php if (give_logged_in_only($form_id)) {
857 857
 					echo 'required ';
858
-				} ?>give-input" placeholder="<?php _e( 'Confirm password', 'give' ); ?>" type="password"/>
858
+				} ?>give-input" placeholder="<?php _e('Confirm password', 'give'); ?>" type="password"/>
859 859
 			</div>
860
-			<?php do_action( 'give_register_account_fields_after', $form_id ); ?>
860
+			<?php do_action('give_register_account_fields_after', $form_id); ?>
861 861
 		</fieldset>
862 862
 
863
-		<?php do_action( 'give_register_fields_after', $form_id ); ?>
863
+		<?php do_action('give_register_fields_after', $form_id); ?>
864 864
 
865 865
 		<input type="hidden" name="give-purchase-var" value="needs-to-register"/>
866 866
 
867
-		<?php do_action( 'give_purchase_form_user_info', $form_id ); ?>
867
+		<?php do_action('give_purchase_form_user_info', $form_id); ?>
868 868
 
869 869
 	</fieldset>
870 870
 	<?php
871 871
 	echo ob_get_clean();
872 872
 }
873 873
 
874
-add_action( 'give_purchase_form_register_fields', 'give_get_register_fields' );
874
+add_action('give_purchase_form_register_fields', 'give_get_register_fields');
875 875
 
876 876
 /**
877 877
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -884,73 +884,73 @@  discard block
 block discarded – undo
884 884
  *
885 885
  * @return string
886 886
  */
887
-function give_get_login_fields( $form_id ) {
887
+function give_get_login_fields($form_id) {
888 888
 
889
-	$form_id            = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id;
890
-	$show_register_form = give_show_login_register_option( $form_id );
889
+	$form_id            = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id;
890
+	$show_register_form = give_show_login_register_option($form_id);
891 891
 
892 892
 	ob_start();
893 893
 	?>
894 894
 	<fieldset id="give-login-fields-<?php echo $form_id; ?>">
895
-		<legend><?php echo apply_filters( 'give_account_login_fieldset_heading', __( 'Login to Your Account', 'give' ) );
896
-			if ( ! give_logged_in_only( $form_id ) ) {
897
-				echo ' <span class="sub-text">' . __( '(optional)', 'give' ) . '</span>';
895
+		<legend><?php echo apply_filters('give_account_login_fieldset_heading', __('Login to Your Account', 'give'));
896
+			if ( ! give_logged_in_only($form_id)) {
897
+				echo ' <span class="sub-text">'.__('(optional)', 'give').'</span>';
898 898
 			} ?>
899 899
 		</legend>
900
-		<?php if ( $show_register_form == 'both' ) { ?>
900
+		<?php if ($show_register_form == 'both') { ?>
901 901
 			<p class="give-new-account-link">
902
-				<?php _e( 'Need to create an account?', 'give' ); ?>&nbsp;
903
-				<a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register">
904
-					<?php _e( 'Register', 'give' );
905
-					if ( ! give_logged_in_only( $form_id ) ) {
906
-						echo ' ' . __( 'or checkout as a guest.', 'give' );
902
+				<?php _e('Need to create an account?', 'give'); ?>&nbsp;
903
+				<a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" data-action="give_checkout_register">
904
+					<?php _e('Register', 'give');
905
+					if ( ! give_logged_in_only($form_id)) {
906
+						echo ' '.__('or checkout as a guest.', 'give');
907 907
 					} ?>
908 908
 				</a>
909 909
 			</p>
910 910
 			<p class="give-loading-text">
911
-				<span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?> </p>
911
+				<span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?> </p>
912 912
 		<?php } ?>
913
-		<?php do_action( 'give_checkout_login_fields_before', $form_id ); ?>
913
+		<?php do_action('give_checkout_login_fields_before', $form_id); ?>
914 914
 		<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first">
915 915
 			<label class="give-label" for="give-user-login-<?php echo $form_id; ?>">
916
-				<?php _e( 'Username', 'give' ); ?>
917
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
916
+				<?php _e('Username', 'give'); ?>
917
+				<?php if (give_logged_in_only($form_id)) { ?>
918 918
 					<span class="give-required-indicator">*</span>
919 919
 				<?php } ?>
920 920
 			</label>
921 921
 
922
-			<input class="<?php if ( give_logged_in_only( $form_id ) ) {
922
+			<input class="<?php if (give_logged_in_only($form_id)) {
923 923
 				echo 'required ';
924
-			} ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e( 'Your username', 'give' ); ?>"/>
924
+			} ?>give-input" type="text" name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" placeholder="<?php _e('Your username', 'give'); ?>"/>
925 925
 		</div>
926 926
 
927 927
 		<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last">
928 928
 			<label class="give-label" for="give-user-pass-<?php echo $form_id; ?>">
929
-				<?php _e( 'Password', 'give' ); ?>
930
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
929
+				<?php _e('Password', 'give'); ?>
930
+				<?php if (give_logged_in_only($form_id)) { ?>
931 931
 					<span class="give-required-indicator">*</span>
932 932
 				<?php } ?>
933 933
 			</label>
934
-			<input class="<?php if ( give_logged_in_only( $form_id ) ) {
934
+			<input class="<?php if (give_logged_in_only($form_id)) {
935 935
 				echo 'required ';
936
-			} ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e( 'Your password', 'give' ); ?>"/>
936
+			} ?>give-input" type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" placeholder="<?php _e('Your password', 'give'); ?>"/>
937 937
 			<input type="hidden" name="give-purchase-var" value="needs-to-login"/>
938 938
 		</div>
939 939
 
940 940
 		<div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix">
941
-			<input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e( 'Login', 'give' ); ?>"/>
942
-			<?php if ( $show_register_form !== 'login' ) { ?>
943
-				<input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php _e( 'Cancel', 'give' ); ?>"/>
941
+			<input type="submit" class="give-submit give-btn button" name="give_login_submit" value="<?php _e('Login', 'give'); ?>"/>
942
+			<?php if ($show_register_form !== 'login') { ?>
943
+				<input type="button" data-action="give_cancel_login" class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" value="<?php _e('Cancel', 'give'); ?>"/>
944 944
 			<?php } ?>
945 945
 			<span class="give-loading-animation"></span>
946 946
 		</div>
947
-		<?php do_action( 'give_checkout_login_fields_after', $form_id ); ?>
947
+		<?php do_action('give_checkout_login_fields_after', $form_id); ?>
948 948
 	</fieldset><!--end #give-login-fields-->
949 949
 	<?php
950 950
 	echo ob_get_clean();
951 951
 }
952 952
 
953
-add_action( 'give_purchase_form_login_fields', 'give_get_login_fields', 10, 1 );
953
+add_action('give_purchase_form_login_fields', 'give_get_login_fields', 10, 1);
954 954
 
955 955
 /**
956 956
  * Payment Mode Select
@@ -966,49 +966,49 @@  discard block
 block discarded – undo
966 966
  *
967 967
  * @return void
968 968
  */
969
-function give_payment_mode_select( $form_id ) {
969
+function give_payment_mode_select($form_id) {
970 970
 
971 971
 	$gateways = give_get_enabled_payment_gateways();
972 972
 
973
-	do_action( 'give_payment_mode_top', $form_id ); ?>
973
+	do_action('give_payment_mode_top', $form_id); ?>
974 974
 
975 975
 	<fieldset id="give-payment-mode-select">
976
-		<?php do_action( 'give_payment_mode_before_gateways_wrap' ); ?>
976
+		<?php do_action('give_payment_mode_before_gateways_wrap'); ?>
977 977
 		<div id="give-payment-mode-wrap">
978
-			<legend class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', __( 'Select Payment Method', 'give' ) ); ?>
979
-				<span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e( 'Loading...', 'give' ); ?></span>
978
+			<legend class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', __('Select Payment Method', 'give')); ?>
979
+				<span class="give-loading-text"><span class="give-loading-animation"></span> <?php _e('Loading...', 'give'); ?></span>
980 980
 			</legend>
981 981
 			<?php
982 982
 
983
-			do_action( 'give_payment_mode_before_gateways' ) ?>
983
+			do_action('give_payment_mode_before_gateways') ?>
984 984
 
985 985
 			<ul id="give-gateway-radio-list">
986
-				<?php foreach ( $gateways as $gateway_id => $gateway ) :
987
-					$checked       = checked( $gateway_id, give_get_default_gateway( $form_id ), false );
986
+				<?php foreach ($gateways as $gateway_id => $gateway) :
987
+					$checked       = checked($gateway_id, give_get_default_gateway($form_id), false);
988 988
 					$checked_class = $checked ? ' give-gateway-option-selected' : '';
989
-					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 ) . '">';
990
-					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'] );
989
+					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).'">';
990
+					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']);
991 991
 					echo '</label></li>';
992 992
 				endforeach; ?>
993 993
 			</ul>
994
-			<?php do_action( 'give_payment_mode_after_gateways' ); ?>
994
+			<?php do_action('give_payment_mode_after_gateways'); ?>
995 995
 		</div>
996
-		<?php do_action( 'give_payment_mode_after_gateways_wrap' ); ?>
996
+		<?php do_action('give_payment_mode_after_gateways_wrap'); ?>
997 997
 	</fieldset>
998 998
 
999
-	<?php do_action( 'give_payment_mode_bottom', $form_id ); ?>
999
+	<?php do_action('give_payment_mode_bottom', $form_id); ?>
1000 1000
 
1001 1001
 	<div id="give_purchase_form_wrap">
1002 1002
 
1003
-		<?php do_action( 'give_purchase_form', $form_id ); ?>
1003
+		<?php do_action('give_purchase_form', $form_id); ?>
1004 1004
 
1005 1005
 	</div><!-- the checkout fields are loaded into this-->
1006 1006
 
1007
-	<?php do_action( 'give_purchase_form_wrap_bottom', $form_id );
1007
+	<?php do_action('give_purchase_form_wrap_bottom', $form_id);
1008 1008
 
1009 1009
 }
1010 1010
 
1011
-add_action( 'give_payment_mode_select', 'give_payment_mode_select' );
1011
+add_action('give_payment_mode_select', 'give_payment_mode_select');
1012 1012
 
1013 1013
 
1014 1014
 /**
@@ -1023,35 +1023,35 @@  discard block
 block discarded – undo
1023 1023
  *
1024 1024
  * @return void
1025 1025
  */
1026
-function give_terms_agreement( $form_id ) {
1026
+function give_terms_agreement($form_id) {
1027 1027
 
1028
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1029
-	$label       = get_post_meta( $form_id, '_give_agree_label', true );
1030
-	$terms       = get_post_meta( $form_id, '_give_agree_text', true );
1028
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1029
+	$label       = get_post_meta($form_id, '_give_agree_label', true);
1030
+	$terms       = get_post_meta($form_id, '_give_agree_text', true);
1031 1031
 
1032
-	if ( $form_option === 'yes' && ! empty( $terms ) ) { ?>
1032
+	if ($form_option === 'yes' && ! empty($terms)) { ?>
1033 1033
 		<fieldset id="give_terms_agreement">
1034 1034
 			<div id="give_terms" style="display:none;">
1035 1035
 				<?php
1036
-				do_action( 'give_before_terms' );
1037
-				echo wpautop( stripslashes( $terms ) );
1038
-				do_action( 'give_after_terms' );
1036
+				do_action('give_before_terms');
1037
+				echo wpautop(stripslashes($terms));
1038
+				do_action('give_after_terms');
1039 1039
 				?>
1040 1040
 			</div>
1041 1041
 			<div id="give_show_terms">
1042
-				<a href="#" class="give_terms_links"><?php _e( 'Show Terms', 'give' ); ?></a>
1043
-				<a href="#" class="give_terms_links" style="display:none;"><?php _e( 'Hide Terms', 'give' ); ?></a>
1042
+				<a href="#" class="give_terms_links"><?php _e('Show Terms', 'give'); ?></a>
1043
+				<a href="#" class="give_terms_links" style="display:none;"><?php _e('Hide Terms', 'give'); ?></a>
1044 1044
 			</div>
1045 1045
 
1046 1046
 			<label
1047
-				for="give_agree_to_terms"><?php echo ! empty( $label ) ? stripslashes( $label ) : __( 'Agree to Terms?', 'give' ); ?></label>
1047
+				for="give_agree_to_terms"><?php echo ! empty($label) ? stripslashes($label) : __('Agree to Terms?', 'give'); ?></label>
1048 1048
 			<input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms" value="1"/>
1049 1049
 		</fieldset>
1050 1050
 		<?php
1051 1051
 	}
1052 1052
 }
1053 1053
 
1054
-add_action( 'give_purchase_form_before_submit', 'give_terms_agreement', 10, 1 );
1054
+add_action('give_purchase_form_before_submit', 'give_terms_agreement', 10, 1);
1055 1055
 
1056 1056
 /**
1057 1057
  * Checkout Final Total
@@ -1063,27 +1063,27 @@  discard block
 block discarded – undo
1063 1063
  * @since      1.0
1064 1064
  * @return void
1065 1065
  */
1066
-function give_checkout_final_total( $form_id ) {
1066
+function give_checkout_final_total($form_id) {
1067 1067
 
1068
-	if ( isset( $_POST['give_total'] ) ) {
1069
-		$total = apply_filters( 'give_donation_total', $_POST['give_total'] );
1068
+	if (isset($_POST['give_total'])) {
1069
+		$total = apply_filters('give_donation_total', $_POST['give_total']);
1070 1070
 	} else {
1071 1071
 		//default total
1072
-		$total = give_get_default_form_amount( $form_id );
1072
+		$total = give_get_default_form_amount($form_id);
1073 1073
 	}
1074 1074
 	//Only proceed if give_total available
1075
-	if ( empty( $total ) ) {
1075
+	if (empty($total)) {
1076 1076
 		return;
1077 1077
 	}
1078 1078
 	?>
1079 1079
 	<p id="give-final-total-wrap" class="form-wrap ">
1080
-		<span class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_attr__( 'Donation Total:', 'give' ) ); ?></span>
1081
-		<span class="give-final-total-amount" data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span>
1080
+		<span class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_attr__('Donation Total:', 'give')); ?></span>
1081
+		<span class="give-final-total-amount" data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span>
1082 1082
 	</p>
1083 1083
 	<?php
1084 1084
 }
1085 1085
 
1086
-add_action( 'give_purchase_form_before_submit', 'give_checkout_final_total', 999 );
1086
+add_action('give_purchase_form_before_submit', 'give_checkout_final_total', 999);
1087 1087
 
1088 1088
 
1089 1089
 /**
@@ -1095,22 +1095,22 @@  discard block
 block discarded – undo
1095 1095
  *
1096 1096
  * @return void
1097 1097
  */
1098
-function give_checkout_submit( $form_id ) {
1098
+function give_checkout_submit($form_id) {
1099 1099
 	?>
1100 1100
 	<fieldset id="give_purchase_submit">
1101
-		<?php do_action( 'give_purchase_form_before_submit', $form_id ); ?>
1101
+		<?php do_action('give_purchase_form_before_submit', $form_id); ?>
1102 1102
 
1103
-		<?php give_checkout_hidden_fields( $form_id ); ?>
1103
+		<?php give_checkout_hidden_fields($form_id); ?>
1104 1104
 
1105
-		<?php echo give_checkout_button_purchase( $form_id ); ?>
1105
+		<?php echo give_checkout_button_purchase($form_id); ?>
1106 1106
 
1107
-		<?php do_action( 'give_purchase_form_after_submit', $form_id ); ?>
1107
+		<?php do_action('give_purchase_form_after_submit', $form_id); ?>
1108 1108
 
1109 1109
 	</fieldset>
1110 1110
 	<?php
1111 1111
 }
1112 1112
 
1113
-add_action( 'give_purchase_form_after_cc_form', 'give_checkout_submit', 9999 );
1113
+add_action('give_purchase_form_after_cc_form', 'give_checkout_submit', 9999);
1114 1114
 
1115 1115
 
1116 1116
 /**
@@ -1123,17 +1123,17 @@  discard block
 block discarded – undo
1123 1123
  *
1124 1124
  * @return string
1125 1125
  */
1126
-function give_checkout_button_purchase( $form_id ) {
1126
+function give_checkout_button_purchase($form_id) {
1127 1127
 
1128
-	$display_label_field = get_post_meta( $form_id, '_give_checkout_label', true );
1129
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : __( 'Donate Now', 'give' ) );
1128
+	$display_label_field = get_post_meta($form_id, '_give_checkout_label', true);
1129
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : __('Donate Now', 'give'));
1130 1130
 	ob_start(); ?>
1131 1131
 	<div class="give-submit-button-wrap give-clearfix">
1132 1132
 		<input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" value="<?php echo $display_label; ?>"/>
1133 1133
 		<span class="give-loading-animation"></span>
1134 1134
 	</div>
1135 1135
 	<?php
1136
-	return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id );
1136
+	return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id);
1137 1137
 }
1138 1138
 
1139 1139
 /**
@@ -1146,11 +1146,11 @@  discard block
 block discarded – undo
1146 1146
  *
1147 1147
  * @return void
1148 1148
  */
1149
-function give_agree_to_terms_js( $form_id ) {
1149
+function give_agree_to_terms_js($form_id) {
1150 1150
 
1151
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1151
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1152 1152
 
1153
-	if ( $form_option === 'yes' ) {
1153
+	if ($form_option === 'yes') {
1154 1154
 		?>
1155 1155
 		<script type="text/javascript">
1156 1156
 			jQuery(document).ready(function ($) {
@@ -1166,7 +1166,7 @@  discard block
 block discarded – undo
1166 1166
 	}
1167 1167
 }
1168 1168
 
1169
-add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 );
1169
+add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2);
1170 1170
 
1171 1171
 /**
1172 1172
  * Show Give Goals
@@ -1179,25 +1179,25 @@  discard block
 block discarded – undo
1179 1179
  * @return mixed
1180 1180
  */
1181 1181
 
1182
-function give_show_goal_progress( $form_id, $args ) {
1182
+function give_show_goal_progress($form_id, $args) {
1183 1183
 
1184
-	$goal_option = get_post_meta( $form_id, '_give_goal_option', true );
1185
-	$form        = new Give_Donate_Form( $form_id );
1184
+	$goal_option = get_post_meta($form_id, '_give_goal_option', true);
1185
+	$form        = new Give_Donate_Form($form_id);
1186 1186
 	$goal        = $form->goal;
1187
-	$goal_format = get_post_meta( $form_id, '_give_goal_format', true );
1187
+	$goal_format = get_post_meta($form_id, '_give_goal_format', true);
1188 1188
 	$income      = $form->get_earnings();
1189
-	$color       = get_post_meta( $form_id, '_give_goal_color', true );
1190
-	$show_text   = (bool) isset( $args['show_text'] ) ? filter_var( $args['show_text'], FILTER_VALIDATE_BOOLEAN ) : true;
1191
-	$show_bar    = (bool) isset( $args['show_bar'] ) ? filter_var( $args['show_bar'], FILTER_VALIDATE_BOOLEAN ) : true;
1189
+	$color       = get_post_meta($form_id, '_give_goal_color', true);
1190
+	$show_text   = (bool) isset($args['show_text']) ? filter_var($args['show_text'], FILTER_VALIDATE_BOOLEAN) : true;
1191
+	$show_bar    = (bool) isset($args['show_bar']) ? filter_var($args['show_bar'], FILTER_VALIDATE_BOOLEAN) : true;
1192 1192
 
1193 1193
 	//Sanity check - respect shortcode args
1194
-	if ( isset( $args['show_goal'] ) && $args['show_goal'] === false ) {
1194
+	if (isset($args['show_goal']) && $args['show_goal'] === false) {
1195 1195
 		return false;
1196 1196
 	}
1197 1197
 
1198 1198
 	//Sanity check - ensure form has goal set to output
1199
-	if ( empty( $form->ID )
1200
-	     || ( is_singular( 'give_forms' ) && $goal_option !== 'yes' )
1199
+	if (empty($form->ID)
1200
+	     || (is_singular('give_forms') && $goal_option !== 'yes')
1201 1201
 	     || $goal_option !== 'yes'
1202 1202
 	     || $goal == 0
1203 1203
 	) {
@@ -1205,26 +1205,26 @@  discard block
 block discarded – undo
1205 1205
 		return false;
1206 1206
 	}
1207 1207
 
1208
-	$progress = round( ( $income / $goal ) * 100, 2 );
1208
+	$progress = round(($income / $goal) * 100, 2);
1209 1209
 
1210
-	if ( $income >= $goal ) {
1210
+	if ($income >= $goal) {
1211 1211
 		$progress = 100;
1212 1212
 	}
1213 1213
 
1214 1214
 	$output = '<div class="give-goal-progress">';
1215 1215
 
1216 1216
 	//Goal Progress Text
1217
-	if ( ! empty( $show_text ) ) {
1217
+	if ( ! empty($show_text)) {
1218 1218
 
1219 1219
 		$output .= '<div class="raised">';
1220 1220
 
1221
-		if ( $goal_format !== 'percentage' ) {
1221
+		if ($goal_format !== 'percentage') {
1222 1222
 
1223
-			$output .= sprintf( _x( '%s of %s raised', 'This text displays the amount of income raised compared to the goal.', 'give' ), '<span class="income">' . apply_filters( 'give_goal_amount_raised_output', give_currency_filter( give_format_amount( $income ) ) ) . '</span>', '<span class="goal-text">' . apply_filters( 'give_goal_amount_target_output', give_currency_filter( give_format_amount( $goal ) ) ) ) . '</span>';
1223
+			$output .= sprintf(_x('%s of %s raised', 'This text displays the amount of income raised compared to the goal.', 'give'), '<span class="income">'.apply_filters('give_goal_amount_raised_output', give_currency_filter(give_format_amount($income))).'</span>', '<span class="goal-text">'.apply_filters('give_goal_amount_target_output', give_currency_filter(give_format_amount($goal)))).'</span>';
1224 1224
 
1225
-		} elseif ( $goal_format == 'percentage' ) {
1225
+		} elseif ($goal_format == 'percentage') {
1226 1226
 
1227
-			$output .= sprintf( _x( '%s%% funded', 'This text displays the percentage amount of income raised compared to the goal target.', 'give' ), '<span class="give-percentage">' . apply_filters( 'give_goal_amount_funded_percentage_output', round( $progress ) ) . '</span>' ) . '</span>';
1227
+			$output .= sprintf(_x('%s%% funded', 'This text displays the percentage amount of income raised compared to the goal target.', 'give'), '<span class="give-percentage">'.apply_filters('give_goal_amount_funded_percentage_output', round($progress)).'</span>').'</span>';
1228 1228
 
1229 1229
 		}
1230 1230
 
@@ -1233,11 +1233,11 @@  discard block
 block discarded – undo
1233 1233
 	}
1234 1234
 
1235 1235
 	//Goal Progress Bar
1236
-	if ( ! empty( $show_bar ) ) {
1236
+	if ( ! empty($show_bar)) {
1237 1237
 		$output .= '<div class="give-progress-bar">';
1238
-		$output .= '<span style="width: ' . esc_attr( $progress ) . '%;';
1239
-		if ( ! empty( $color ) ) {
1240
-			$output .= 'background-color:' . $color;
1238
+		$output .= '<span style="width: '.esc_attr($progress).'%;';
1239
+		if ( ! empty($color)) {
1240
+			$output .= 'background-color:'.$color;
1241 1241
 		}
1242 1242
 		$output .= '"></span>';
1243 1243
 		$output .= '</div><!-- /.give-progress-bar -->';
@@ -1245,13 +1245,13 @@  discard block
 block discarded – undo
1245 1245
 
1246 1246
 	$output .= '</div><!-- /.goal-progress -->';
1247 1247
 
1248
-	echo apply_filters( 'give_goal_output', $output );
1248
+	echo apply_filters('give_goal_output', $output);
1249 1249
 
1250 1250
 	return false;
1251 1251
 
1252 1252
 }
1253 1253
 
1254
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1254
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1255 1255
 
1256 1256
 /**
1257 1257
  * Adds Actions to Render Form Content
@@ -1263,19 +1263,19 @@  discard block
 block discarded – undo
1263 1263
  *
1264 1264
  * @return void
1265 1265
  */
1266
-function give_form_content( $form_id, $args ) {
1266
+function give_form_content($form_id, $args) {
1267 1267
 
1268
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1268
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1269 1269
 		? $args['show_content']
1270
-		: get_post_meta( $form_id, '_give_content_option', true );
1270
+		: get_post_meta($form_id, '_give_content_option', true);
1271 1271
 
1272
-	if ( $show_content !== 'none' ) {
1272
+	if ($show_content !== 'none') {
1273 1273
 		//add action according to value
1274
-		add_action( $show_content, 'give_form_display_content', 10, 2 );
1274
+		add_action($show_content, 'give_form_display_content', 10, 2);
1275 1275
 	}
1276 1276
 }
1277 1277
 
1278
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
1278
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
1279 1279
 
1280 1280
 /**
1281 1281
  * Renders Post Form Content
@@ -1287,24 +1287,24 @@  discard block
 block discarded – undo
1287 1287
  * @return void
1288 1288
  * @since      1.0
1289 1289
  */
1290
-function give_form_display_content( $form_id, $args ) {
1290
+function give_form_display_content($form_id, $args) {
1291 1291
 
1292
-	$content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) );
1293
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1292
+	$content = wpautop(get_post_meta($form_id, '_give_form_content', true));
1293
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1294 1294
 		? $args['show_content']
1295
-		: get_post_meta( $form_id, '_give_content_option', true );
1295
+		: get_post_meta($form_id, '_give_content_option', true);
1296 1296
 
1297
-	if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) {
1298
-		$content = apply_filters( 'the_content', $content );
1297
+	if (give_get_option('disable_the_content_filter') !== 'on') {
1298
+		$content = apply_filters('the_content', $content);
1299 1299
 	}
1300 1300
 
1301
-	$output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>';
1301
+	$output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>';
1302 1302
 
1303
-	echo apply_filters( 'give_form_content_output', $output );
1303
+	echo apply_filters('give_form_content_output', $output);
1304 1304
 
1305 1305
 	//remove action to prevent content output on addition forms on page
1306 1306
 	//@see: https://github.com/WordImpress/Give/issues/634
1307
-	remove_action( $show_content, 'give_form_display_content' );
1307
+	remove_action($show_content, 'give_form_display_content');
1308 1308
 }
1309 1309
 
1310 1310
 
@@ -1317,16 +1317,16 @@  discard block
 block discarded – undo
1317 1317
  *
1318 1318
  * @return void
1319 1319
  */
1320
-function give_checkout_hidden_fields( $form_id ) {
1320
+function give_checkout_hidden_fields($form_id) {
1321 1321
 
1322
-	do_action( 'give_hidden_fields_before', $form_id );
1323
-	if ( is_user_logged_in() ) { ?>
1322
+	do_action('give_hidden_fields_before', $form_id);
1323
+	if (is_user_logged_in()) { ?>
1324 1324
 		<input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/>
1325 1325
 	<?php } ?>
1326 1326
 	<input type="hidden" name="give_action" value="purchase"/>
1327
-	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/>
1327
+	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/>
1328 1328
 	<?php
1329
-	do_action( 'give_hidden_fields_after', $form_id );
1329
+	do_action('give_hidden_fields_after', $form_id);
1330 1330
 
1331 1331
 }
1332 1332
 
@@ -1341,20 +1341,20 @@  discard block
 block discarded – undo
1341 1341
  *
1342 1342
  * @return string $content Filtered content
1343 1343
  */
1344
-function give_filter_success_page_content( $content ) {
1344
+function give_filter_success_page_content($content) {
1345 1345
 
1346 1346
 	global $give_options;
1347 1347
 
1348
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
1349
-		if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) {
1350
-			$content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content );
1348
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
1349
+		if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) {
1350
+			$content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content);
1351 1351
 		}
1352 1352
 	}
1353 1353
 
1354 1354
 	return $content;
1355 1355
 }
1356 1356
 
1357
-add_filter( 'the_content', 'give_filter_success_page_content' );
1357
+add_filter('the_content', 'give_filter_success_page_content');
1358 1358
 
1359 1359
 
1360 1360
 /**
@@ -1366,14 +1366,14 @@  discard block
 block discarded – undo
1366 1366
 
1367 1367
 function give_test_mode_frontend_warning() {
1368 1368
 
1369
-	$test_mode = give_get_option( 'test_mode' );
1369
+	$test_mode = give_get_option('test_mode');
1370 1370
 
1371
-	if ( $test_mode == 'on' ) {
1372
-		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . __( 'Notice', 'give' ) . '</strong>: ' . esc_attr__( 'Test mode is enabled. While in test mode no live transactions are processed.', 'give' ) . '</p></div>';
1371
+	if ($test_mode == 'on') {
1372
+		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.__('Notice', 'give').'</strong>: '.esc_attr__('Test mode is enabled. While in test mode no live transactions are processed.', 'give').'</p></div>';
1373 1373
 	}
1374 1374
 }
1375 1375
 
1376
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
1376
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
1377 1377
 
1378 1378
 
1379 1379
 /**
@@ -1383,21 +1383,21 @@  discard block
 block discarded – undo
1383 1383
  * @since       1.4.1
1384 1384
  */
1385 1385
 
1386
-function give_members_only_form( $final_output, $args ) {
1386
+function give_members_only_form($final_output, $args) {
1387 1387
 
1388
-	$form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0;
1388
+	$form_id = isset($args['form_id']) ? $args['form_id'] : 0;
1389 1389
 
1390 1390
 	//Sanity Check: Must have form_id & not be logged in
1391
-	if ( empty( $form_id ) || is_user_logged_in() ) {
1391
+	if (empty($form_id) || is_user_logged_in()) {
1392 1392
 		return $final_output;
1393 1393
 	}
1394 1394
 
1395 1395
 	//Logged in only and Register / Login set to none
1396
-	if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) {
1396
+	if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
1397 1397
 
1398
-		$final_output = give_output_error( __( 'Please login in order to complete your donation.', 'give' ), false );
1398
+		$final_output = give_output_error(__('Please login in order to complete your donation.', 'give'), false);
1399 1399
 
1400
-		return apply_filters( 'give_members_only_output', $final_output, $form_id );
1400
+		return apply_filters('give_members_only_output', $final_output, $form_id);
1401 1401
 
1402 1402
 	}
1403 1403
 
@@ -1405,4 +1405,4 @@  discard block
 block discarded – undo
1405 1405
 
1406 1406
 }
1407 1407
 
1408
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 );
1409 1408
\ No newline at end of file
1409
+add_filter('give_donate_form', 'give_members_only_form', 10, 2);
1410 1410
\ No newline at end of file
Please login to merge, or discard this patch.
includes/gateways/offline-donations.php 1 patch
Spacing   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
  *
19 19
  * @return array
20 20
  */
21
-function give_offline_register_gateway( $gateways ) {
21
+function give_offline_register_gateway($gateways) {
22 22
 	// Format: ID => Name
23 23
 	$gateways['offline'] = array(
24
-		'admin_label'    => esc_attr__( 'Offline Donation', 'give' ),
25
-		'checkout_label' => esc_attr__( 'Offline Donation', 'give' )
24
+		'admin_label'    => esc_attr__('Offline Donation', 'give'),
25
+		'checkout_label' => esc_attr__('Offline Donation', 'give')
26 26
 	);
27 27
 
28 28
 	return $gateways;
29 29
 }
30 30
 
31
-add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 );
31
+add_filter('give_payment_gateways', 'give_offline_register_gateway', 1);
32 32
 
33 33
 
34 34
 /**
@@ -40,55 +40,55 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @return void
42 42
  */
43
-function give_offline_payment_cc_form( $form_id ) {
43
+function give_offline_payment_cc_form($form_id) {
44 44
 
45
-	$post_offline_customization_option = get_post_meta( $form_id, '_give_customize_offline_donations', true );
46
-	$post_offline_instructions         = get_post_meta( $form_id, '_give_offline_checkout_notes', true );
47
-	$global_offline_instruction        = give_get_option( 'global_offline_donation_content' );
45
+	$post_offline_customization_option = get_post_meta($form_id, '_give_customize_offline_donations', true);
46
+	$post_offline_instructions         = get_post_meta($form_id, '_give_offline_checkout_notes', true);
47
+	$global_offline_instruction        = give_get_option('global_offline_donation_content');
48 48
 	$offline_instructions              = $global_offline_instruction;
49 49
 
50
-	if ( $post_offline_customization_option == 'yes' ) {
50
+	if ($post_offline_customization_option == 'yes') {
51 51
 		$offline_instructions = $post_offline_instructions;
52 52
 	}
53 53
 
54 54
 
55 55
 	ob_start(); ?>
56
-	<?php do_action( 'give_before_offline_info_fields', $form_id ); ?>
56
+	<?php do_action('give_before_offline_info_fields', $form_id); ?>
57 57
 	<fieldset id="give_offline_payment_info">
58 58
 		<?php
59
-		$settings_url         = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' );
60
-		$offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( esc_attr__( 'Please enter offline donation instructions in the %s.', 'give' ), '<a href="' . $settings_url . '">' . __( 'this form\'s settings', 'give' ) . '</a>' );
61
-		echo wpautop( stripslashes( $offline_instructions ) );
59
+		$settings_url         = admin_url('post.php?post='.$form_id.'&action=edit&message=1');
60
+		$offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(esc_attr__('Please enter offline donation instructions in the %s.', 'give'), '<a href="'.$settings_url.'">'.__('this form\'s settings', 'give').'</a>');
61
+		echo wpautop(stripslashes($offline_instructions));
62 62
 		?>
63 63
 	</fieldset>
64
-	<?php do_action( 'give_after_offline_info_fields', $form_id ); ?>
64
+	<?php do_action('give_after_offline_info_fields', $form_id); ?>
65 65
 	<?php
66 66
 	echo ob_get_clean();
67 67
 }
68 68
 
69
-add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' );
69
+add_action('give_offline_cc_form', 'give_offline_payment_cc_form');
70 70
 
71 71
 /**
72 72
  * Give Offline Billing Field
73 73
  *
74 74
  * @param $form_id
75 75
  */
76
-function give_offline_billing_fields( $form_id ) {
76
+function give_offline_billing_fields($form_id) {
77 77
 	//Enable Default CC fields (billing info)
78
-	$post_offline_cc_fields        = get_post_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true );
79
-	$post_offline_customize_option = get_post_meta( $form_id, '_give_customize_offline_donations', true );
78
+	$post_offline_cc_fields        = get_post_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true);
79
+	$post_offline_customize_option = get_post_meta($form_id, '_give_customize_offline_donations', true);
80 80
 
81
-	$global_offline_cc_fields      = give_get_option( 'give_offline_donation_enable_billing_fields' );
81
+	$global_offline_cc_fields      = give_get_option('give_offline_donation_enable_billing_fields');
82 82
 
83 83
 	//Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options
84
-	if ( $global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes' ) {
85
-		give_default_cc_address_fields( $form_id );
86
-	} elseif($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') {
87
-		give_default_cc_address_fields( $form_id );
84
+	if ($global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes') {
85
+		give_default_cc_address_fields($form_id);
86
+	} elseif ($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') {
87
+		give_default_cc_address_fields($form_id);
88 88
 	}
89 89
 }
90 90
 
91
-add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 );
91
+add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1);
92 92
 
93 93
 /**
94 94
  * Process the payment
@@ -99,16 +99,16 @@  discard block
 block discarded – undo
99 99
  *
100 100
  * @return void
101 101
  */
102
-function give_offline_process_payment( $purchase_data ) {
102
+function give_offline_process_payment($purchase_data) {
103 103
 
104
-	$purchase_summary = give_get_purchase_summary( $purchase_data );
104
+	$purchase_summary = give_get_purchase_summary($purchase_data);
105 105
 
106 106
 	// setup the payment details
107 107
 	$payment_data = array(
108 108
 		'price'           => $purchase_data['price'],
109 109
 		'give_form_title' => $purchase_data['post_data']['give-form-title'],
110
-		'give_form_id'    => intval( $purchase_data['post_data']['give-form-id'] ),
111
-		'give_price_id'   => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '',
110
+		'give_form_id'    => intval($purchase_data['post_data']['give-form-id']),
111
+		'give_price_id'   => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '',
112 112
 		'date'            => $purchase_data['date'],
113 113
 		'user_email'      => $purchase_data['user_email'],
114 114
 		'purchase_key'    => $purchase_data['purchase_key'],
@@ -120,20 +120,20 @@  discard block
 block discarded – undo
120 120
 
121 121
 
122 122
 	// record the pending payment
123
-	$payment = give_insert_payment( $payment_data );
123
+	$payment = give_insert_payment($payment_data);
124 124
 
125
-	if ( $payment ) {
126
-		give_offline_send_admin_notice( $payment );
127
-		give_offline_send_donor_instructions( $payment );
125
+	if ($payment) {
126
+		give_offline_send_admin_notice($payment);
127
+		give_offline_send_donor_instructions($payment);
128 128
 		give_send_to_success_page();
129 129
 	} else {
130 130
 		// if errors are present, send the user back to the donation form so they can be corrected
131
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
131
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
132 132
 	}
133 133
 
134 134
 }
135 135
 
136
-add_action( 'give_gateway_offline', 'give_offline_process_payment' );
136
+add_action('give_gateway_offline', 'give_offline_process_payment');
137 137
 
138 138
 
139 139
 /**
@@ -146,47 +146,47 @@  discard block
 block discarded – undo
146 146
  * @since       1.0
147 147
  * @return void
148 148
  */
149
-function give_offline_send_donor_instructions( $payment_id = 0 ) {
149
+function give_offline_send_donor_instructions($payment_id = 0) {
150 150
 
151
-	$payment_data                      = give_get_payment_meta( $payment_id );
152
-	$post_offline_customization_option = get_post_meta( $payment_data['form_id'], '_give_customize_offline_donations', true );
151
+	$payment_data                      = give_get_payment_meta($payment_id);
152
+	$post_offline_customization_option = get_post_meta($payment_data['form_id'], '_give_customize_offline_donations', true);
153 153
 
154 154
 	//Customize email content depending on whether the single form has been customized
155
-	$email_content = give_get_option( 'global_offline_donation_email' );
155
+	$email_content = give_get_option('global_offline_donation_email');
156 156
 
157
-	if ( $post_offline_customization_option === 'yes' ) {
158
-		$email_content = get_post_meta( $payment_data['form_id'], '_give_offline_donation_email', true );
157
+	if ($post_offline_customization_option === 'yes') {
158
+		$email_content = get_post_meta($payment_data['form_id'], '_give_offline_donation_email', true);
159 159
 	}
160 160
 
161
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
162
-	$from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data );
161
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
162
+	$from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data);
163 163
 
164
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
165
-	$from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data );
164
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
165
+	$from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data);
166 166
 
167
-	$to_email = give_get_payment_user_email( $payment_id );
167
+	$to_email = give_get_payment_user_email($payment_id);
168 168
 
169
-	$subject = give_get_option( 'offline_donation_subject', __( 'Offline Donation Instructions', 'give' ) );
170
-	if ( $post_offline_customization_option === 'yes' ) {
171
-		$subject = get_post_meta( $payment_data['form_id'], '_give_offline_donation_subject', true );
169
+	$subject = give_get_option('offline_donation_subject', __('Offline Donation Instructions', 'give'));
170
+	if ($post_offline_customization_option === 'yes') {
171
+		$subject = get_post_meta($payment_data['form_id'], '_give_offline_donation_subject', true);
172 172
 	}
173 173
 
174
-	$subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id );
175
-	$subject = give_do_email_tags( $subject, $payment_id );
174
+	$subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id);
175
+	$subject = give_do_email_tags($subject, $payment_id);
176 176
 
177
-	$attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data );
178
-	$message     = give_do_email_tags( $email_content, $payment_id );
177
+	$attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data);
178
+	$message     = give_do_email_tags($email_content, $payment_id);
179 179
 
180 180
 	$emails = Give()->emails;
181 181
 
182
-	$emails->__set( 'from_name', $from_name );
183
-	$emails->__set( 'from_email', $from_email );
184
-	$emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) );
182
+	$emails->__set('from_name', $from_name);
183
+	$emails->__set('from_email', $from_email);
184
+	$emails->__set('heading', __('Offline Donation Instructions', 'give'));
185 185
 
186
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data );
187
-	$emails->__set( 'headers', $headers );
186
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
187
+	$emails->__set('headers', $headers);
188 188
 
189
-	$emails->send( $to_email, $subject, $message, $attachments );
189
+	$emails->send($to_email, $subject, $message, $attachments);
190 190
 
191 191
 }
192 192
 
@@ -203,48 +203,48 @@  discard block
 block discarded – undo
203 203
  * @return void
204 204
  *
205 205
  */
206
-function give_offline_send_admin_notice( $payment_id = 0 ) {
206
+function give_offline_send_admin_notice($payment_id = 0) {
207 207
 
208 208
 	/* Send an email notification to the admin */
209 209
 	$admin_email = give_get_admin_notice_emails();
210
-	$user_info   = give_get_payment_meta_user_info( $payment_id );
210
+	$user_info   = give_get_payment_meta_user_info($payment_id);
211 211
 
212
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) {
213
-		$user_data = get_userdata( $user_info['id'] );
212
+	if (isset($user_info['id']) && $user_info['id'] > 0) {
213
+		$user_data = get_userdata($user_info['id']);
214 214
 		$name      = $user_data->display_name;
215
-	} elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) {
216
-		$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
215
+	} elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
216
+		$name = $user_info['first_name'].' '.$user_info['last_name'];
217 217
 	} else {
218 218
 		$name = $user_info['email'];
219 219
 	}
220 220
 
221
-	$amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) );
221
+	$amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)));
222 222
 
223
-	$admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', esc_attr__( 'New Pending Donation', 'give' ), $payment_id );
223
+	$admin_subject = apply_filters('give_offline_admin_donation_notification_subject', esc_attr__('New Pending Donation', 'give'), $payment_id);
224 224
 
225
-	$admin_message = esc_attr__( 'Dear Admin,', 'give' ) . "\n\n";
226
-	$admin_message .= esc_attr__( 'An offline donation has been made on your website: ', 'give' ) . get_bloginfo( 'name' ) . ' ';
227
-	$admin_message .= esc_attr__( 'Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n";
225
+	$admin_message = esc_attr__('Dear Admin,', 'give')."\n\n";
226
+	$admin_message .= esc_attr__('An offline donation has been made on your website: ', 'give').get_bloginfo('name').' ';
227
+	$admin_message .= esc_attr__('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n";
228 228
 
229 229
 
230
-	$admin_message .= '<strong>' . esc_attr__( 'Donor: ', 'give' ) . '</strong>' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n";
231
-	$admin_message .= '<strong>' . esc_attr__( 'Amount: ', 'give' ) . '</strong>' . html_entity_decode( $amount, ENT_COMPAT, 'UTF-8' ) . "\n\n";
230
+	$admin_message .= '<strong>'.esc_attr__('Donor: ', 'give').'</strong>'.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n";
231
+	$admin_message .= '<strong>'.esc_attr__('Amount: ', 'give').'</strong>'.html_entity_decode($amount, ENT_COMPAT, 'UTF-8')."\n\n";
232 232
 
233 233
 	//Order URL
234
-	$order_url = '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ) . '">';
235
-	$admin_message .= sprintf( __( '%sClick Here to View and/or Update Donation Details%s', 'give' ), $order_url, ' &raquo;</a>' ) . "\n\n";
234
+	$order_url = '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment_id).'">';
235
+	$admin_message .= sprintf(__('%sClick Here to View and/or Update Donation Details%s', 'give'), $order_url, ' &raquo;</a>')."\n\n";
236 236
 
237
-	$admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id );
238
-	$attachments   = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id );
239
-	$admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id );
237
+	$admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id);
238
+	$attachments   = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id);
239
+	$admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id);
240 240
 
241 241
 	//Send Email
242 242
 	$emails = Give()->emails;
243
-	if ( ! empty( $admin_headers ) ) {
244
-		$emails->__set( 'headers', $admin_headers );
243
+	if ( ! empty($admin_headers)) {
244
+		$emails->__set('headers', $admin_headers);
245 245
 	}
246 246
 
247
-	$emails->send( $admin_email, $admin_subject, $admin_message, $attachments );
247
+	$emails->send($admin_email, $admin_subject, $admin_message, $attachments);
248 248
 
249 249
 }
250 250
 
@@ -255,15 +255,15 @@  discard block
 block discarded – undo
255 255
  * @since  1.0
256 256
  * @return array
257 257
  */
258
-function give_offline_add_settings( $settings ) {
258
+function give_offline_add_settings($settings) {
259 259
 
260 260
 	//Vars
261 261
 	$prefix = '_give_';
262 262
 
263
-	$is_gateway_active = give_is_gateway_active( 'offline' );
263
+	$is_gateway_active = give_is_gateway_active('offline');
264 264
 
265 265
 	//this gateway isn't active
266
-	if ( ! $is_gateway_active ) {
266
+	if ( ! $is_gateway_active) {
267 267
 		//return settings and bounce
268 268
 		return $settings;
269 269
 	}
@@ -272,27 +272,27 @@  discard block
 block discarded – undo
272 272
 	$check_settings = array(
273 273
 
274 274
 		array(
275
-			'name'    => esc_attr__( 'Customize Offline Donations', 'give' ),
276
-			'desc'    => esc_attr__( 'If you would like to customize the donation instructions for this specific forms check this option.', 'give' ),
277
-			'id'      => $prefix . 'customize_offline_donations',
275
+			'name'    => esc_attr__('Customize Offline Donations', 'give'),
276
+			'desc'    => esc_attr__('If you would like to customize the donation instructions for this specific forms check this option.', 'give'),
277
+			'id'      => $prefix.'customize_offline_donations',
278 278
 			'type'    => 'radio_inline',
279 279
 			'default' => 'no',
280 280
 			'options' => array(
281
-				'yes' => esc_attr__( 'Yes', 'give' ),
282
-				'no'  => esc_attr__( 'No', 'give' ),
281
+				'yes' => esc_attr__('Yes', 'give'),
282
+				'no'  => esc_attr__('No', 'give'),
283 283
 			),
284 284
 		),
285 285
 		array(
286
-			'name'        => esc_attr__( 'Request Billing Information', 'give' ),
287
-			'desc'        => esc_attr__( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ),
288
-			'id'          => $prefix . 'offline_donation_enable_billing_fields_single',
286
+			'name'        => esc_attr__('Request Billing Information', 'give'),
287
+			'desc'        => esc_attr__('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'),
288
+			'id'          => $prefix.'offline_donation_enable_billing_fields_single',
289 289
 			'row_classes' => 'give-subfield',
290 290
 			'type'        => 'checkbox'
291 291
 		),
292 292
 		array(
293
-			'id'          => $prefix . 'offline_checkout_notes',
294
-			'name'        => esc_attr__( 'Offline Donation Instructions', 'give' ),
295
-			'desc'        => esc_attr__( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
293
+			'id'          => $prefix.'offline_checkout_notes',
294
+			'name'        => esc_attr__('Offline Donation Instructions', 'give'),
295
+			'desc'        => esc_attr__('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
296 296
 			'default'     => give_get_default_offline_donation_content(),
297 297
 			'type'        => 'wysiwyg',
298 298
 			'row_classes' => 'give-subfield',
@@ -301,17 +301,17 @@  discard block
 block discarded – undo
301 301
 			)
302 302
 		),
303 303
 		array(
304
-			'id'          => $prefix . 'offline_donation_subject',
305
-			'name'        => esc_attr__( 'Offline Donation Email Instructions Subject', 'give' ),
306
-			'desc'        => esc_attr__( 'Enter the subject line for the donation receipt email.', 'give' ),
307
-			'default'     => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ),
304
+			'id'          => $prefix.'offline_donation_subject',
305
+			'name'        => esc_attr__('Offline Donation Email Instructions Subject', 'give'),
306
+			'desc'        => esc_attr__('Enter the subject line for the donation receipt email.', 'give'),
307
+			'default'     => esc_attr__('{donation} - Offline Donation Instructions', 'give'),
308 308
 			'row_classes' => 'give-subfield',
309 309
 			'type'        => 'text'
310 310
 		),
311 311
 		array(
312
-			'id'          => $prefix . 'offline_donation_email',
313
-			'name'        => esc_attr__( 'Offline Donation Email Instructions', 'give' ),
314
-			'desc'        => esc_attr__( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
312
+			'id'          => $prefix.'offline_donation_email',
313
+			'name'        => esc_attr__('Offline Donation Email Instructions', 'give'),
314
+			'desc'        => esc_attr__('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
315 315
 			'default'     => give_get_default_offline_donation_email_content(),
316 316
 			'type'        => 'wysiwyg',
317 317
 			'row_classes' => 'give-subfield',
@@ -321,10 +321,10 @@  discard block
 block discarded – undo
321 321
 		)
322 322
 	);
323 323
 
324
-	return array_merge( $settings, $check_settings );
324
+	return array_merge($settings, $check_settings);
325 325
 }
326 326
 
327
-add_filter( 'give_forms_display_options_metabox_fields', 'give_offline_add_settings' );
327
+add_filter('give_forms_display_options_metabox_fields', 'give_offline_add_settings');
328 328
 
329 329
 
330 330
 /**
@@ -336,20 +336,20 @@  discard block
 block discarded – undo
336 336
  */
337 337
 function give_get_default_offline_donation_content() {
338 338
 
339
-	$sitename = get_bloginfo( 'sitename' );
339
+	$sitename = get_bloginfo('sitename');
340 340
 
341
-	$default_text = '<p>' . esc_attr__( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>';
341
+	$default_text = '<p>'.esc_attr__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>';
342 342
 	$default_text .= '<ol>';
343
-	$default_text .= '<li>' . _x( 'Make a check payable to ', 'Step 1 for donating offline by check', 'give' ) . '"' . $sitename . '"' . '</li>';
344
-	$default_text .= '<li>' . _x( 'On the memo line of the check, please indicate that the donation is for ', 'Step 2 for donating by check; this explains who the check should be written to', 'give' ) . '"' . $sitename . '"' . '</li>';
345
-	$default_text .= '<li>' . _x( 'Please mail your check to:', 'Step 3; where to mail the check', 'give' ) . '</li>';
343
+	$default_text .= '<li>'._x('Make a check payable to ', 'Step 1 for donating offline by check', 'give').'"'.$sitename.'"'.'</li>';
344
+	$default_text .= '<li>'._x('On the memo line of the check, please indicate that the donation is for ', 'Step 2 for donating by check; this explains who the check should be written to', 'give').'"'.$sitename.'"'.'</li>';
345
+	$default_text .= '<li>'._x('Please mail your check to:', 'Step 3; where to mail the check', 'give').'</li>';
346 346
 	$default_text .= '</ol>';
347
-	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>' . $sitename . '</em><br>';
347
+	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>'.$sitename.'</em><br>';
348 348
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>123 G Street </em><br>';
349 349
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>San Diego, CA 92101 </em><br>';
350
-	$default_text .= '<p>' . esc_attr__( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>';
350
+	$default_text .= '<p>'.esc_attr__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>';
351 351
 
352
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
352
+	return apply_filters('give_default_offline_donation_content', $default_text);
353 353
 
354 354
 }
355 355
 
@@ -362,21 +362,21 @@  discard block
 block discarded – undo
362 362
  */
363 363
 function give_get_default_offline_donation_email_content() {
364 364
 
365
-	$sitename     = get_bloginfo( 'sitename' );
366
-	$default_text = '<p>' . esc_attr__( 'Dear {name},', 'give' ) . '</p>';
367
-	$default_text .= '<p>' . esc_attr__( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>';
365
+	$sitename     = get_bloginfo('sitename');
366
+	$default_text = '<p>'.esc_attr__('Dear {name},', 'give').'</p>';
367
+	$default_text .= '<p>'.esc_attr__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>';
368 368
 	$default_text .= '<ol>';
369
-	$default_text .= '<li>' . _x( 'Make a check payable to ', 'Step 1 for donating offline by check', 'give' ) . '"' . $sitename . '"' . '</li>';
370
-	$default_text .= '<li>' . _x( 'On the memo line of the check, please indicate that the donation is for ', 'Step 2 for donating by check; this explains who the check should be written to', 'give' ) . '"' . $sitename . '"' . '</li>';
371
-	$default_text .= '<li>' . _x( 'Please mail your check to:', 'Step 3; where to mail the check', 'give' ) . '</li>';
369
+	$default_text .= '<li>'._x('Make a check payable to ', 'Step 1 for donating offline by check', 'give').'"'.$sitename.'"'.'</li>';
370
+	$default_text .= '<li>'._x('On the memo line of the check, please indicate that the donation is for ', 'Step 2 for donating by check; this explains who the check should be written to', 'give').'"'.$sitename.'"'.'</li>';
371
+	$default_text .= '<li>'._x('Please mail your check to:', 'Step 3; where to mail the check', 'give').'</li>';
372 372
 	$default_text .= '</ol>';
373
-	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>' . $sitename . '</em><br>';
373
+	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>'.$sitename.'</em><br>';
374 374
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>123 G Street </em><br>';
375 375
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>San Diego, CA 92101 </em><br>';
376
-	$default_text .= '<p>' . esc_attr__( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>';
377
-	$default_text .= '<p>' . esc_attr__( 'Sincerely,', 'give' ) . '</p>';
378
-	$default_text .= '<p>' . $sitename . '</p>';
376
+	$default_text .= '<p>'.esc_attr__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>';
377
+	$default_text .= '<p>'.esc_attr__('Sincerely,', 'give').'</p>';
378
+	$default_text .= '<p>'.$sitename.'</p>';
379 379
 
380
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
380
+	return apply_filters('give_default_offline_donation_content', $default_text);
381 381
 
382 382
 }
Please login to merge, or discard this patch.
includes/admin/reporting/export/export-actions.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
11 11
  */
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -22,20 +22,20 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function give_process_batch_export_form() {
24 24
 
25
-	if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'give-batch-export' ) ) {
26
-		wp_die( __( 'Nonce verification failed', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
25
+	if ( ! wp_verify_nonce($_REQUEST['nonce'], 'give-batch-export')) {
26
+		wp_die(__('Nonce verification failed', 'give'), __('Error', 'give'), array('response' => 403));
27 27
 	}
28 28
 
29
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export.php';
29
+	require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export.php';
30 30
 
31
-	do_action( 'give_batch_export_class_include', $_REQUEST['class'] );
31
+	do_action('give_batch_export_class_include', $_REQUEST['class']);
32 32
 
33 33
 	$export = new $_REQUEST['class'];
34 34
 	$export->export();
35 35
 
36 36
 }
37 37
 
38
-add_action( 'give_form_batch_export', 'give_process_batch_export_form' );
38
+add_action('give_form_batch_export', 'give_process_batch_export_form');
39 39
 
40 40
 /**
41 41
  * Exports earnings for a specified time period
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
  * @return void
47 47
  */
48 48
 function give_export_earnings() {
49
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-earnings.php';
49
+	require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-earnings.php';
50 50
 
51 51
 	$earnings_export = new Give_Earnings_Export();
52 52
 
53 53
 	$earnings_export->export();
54 54
 }
55 55
 
56
-add_action( 'give_earnings_export', 'give_export_earnings' );
56
+add_action('give_earnings_export', 'give_export_earnings');
57 57
 
58 58
 
59 59
 /**
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
  * @return void
67 67
  */
68 68
 function give_export_all_customers() {
69
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-customers.php';
69
+	require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-customers.php';
70 70
 
71 71
 	$customer_export = new Give_Donors_Export();
72 72
 
73 73
 	$customer_export->export();
74 74
 }
75 75
 
76
-add_action( 'give_email_export', 'give_export_all_customers' );
76
+add_action('give_email_export', 'give_export_all_customers');
77 77
 
78 78
 /**
79 79
  * Add a hook allowing extensions to register a hook on the batch export process
@@ -82,22 +82,22 @@  discard block
 block discarded – undo
82 82
  * @return void
83 83
  */
84 84
 function give_register_batch_exporters() {
85
-	if ( is_admin() ) {
86
-		do_action( 'give_register_batch_exporter' );
85
+	if (is_admin()) {
86
+		do_action('give_register_batch_exporter');
87 87
 	}
88 88
 }
89 89
 
90
-add_action( 'plugins_loaded', 'give_register_batch_exporters' );
90
+add_action('plugins_loaded', 'give_register_batch_exporters');
91 91
 
92 92
 /**
93 93
  * Register the payments batch exporter
94 94
  * @since  1.5
95 95
  */
96 96
 function give_register_payments_batch_export() {
97
-	add_action( 'give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1 );
97
+	add_action('give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1);
98 98
 }
99 99
 
100
-add_action( 'give_register_batch_exporter', 'give_register_payments_batch_export', 10 );
100
+add_action('give_register_batch_exporter', 'give_register_payments_batch_export', 10);
101 101
 
102 102
 /**
103 103
  * Loads the payments batch process if needed
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
  *
109 109
  * @return void
110 110
  */
111
-function give_include_payments_batch_processor( $class ) {
111
+function give_include_payments_batch_processor($class) {
112 112
 
113
-	if ( 'Give_Batch_Payments_Export' === $class ) {
114
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-payments.php';
113
+	if ('Give_Batch_Payments_Export' === $class) {
114
+		require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-payments.php';
115 115
 	}
116 116
 
117 117
 }
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
  * @since  1.5.2
122 122
  */
123 123
 function give_register_customers_batch_export() {
124
-	add_action( 'give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1 );
124
+	add_action('give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1);
125 125
 }
126 126
 
127
-add_action( 'give_register_batch_exporter', 'give_register_customers_batch_export', 10 );
127
+add_action('give_register_batch_exporter', 'give_register_customers_batch_export', 10);
128 128
 
129 129
 /**
130 130
  * Loads the customers batch process if needed
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
  *
136 136
  * @return void
137 137
  */
138
-function give_include_customers_batch_processor( $class ) {
138
+function give_include_customers_batch_processor($class) {
139 139
 
140
-	if ( 'Give_Batch_Customers_Export' === $class ) {
141
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-customers.php';
140
+	if ('Give_Batch_Customers_Export' === $class) {
141
+		require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-customers.php';
142 142
 	}
143 143
 
144 144
 }
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
  * @since  1.5
150 150
  */
151 151
 function give_register_forms_batch_export() {
152
-	add_action( 'give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1 );
152
+	add_action('give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1);
153 153
 }
154 154
 
155
-add_action( 'give_register_batch_exporter', 'give_register_forms_batch_export', 10 );
155
+add_action('give_register_batch_exporter', 'give_register_forms_batch_export', 10);
156 156
 
157 157
 /**
158 158
  * Loads the file downloads batch process if needed
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
  *
164 164
  * @return void
165 165
  */
166
-function give_include_forms_batch_processor( $class ) {
166
+function give_include_forms_batch_processor($class) {
167 167
 
168
-	if ( 'Give_Batch_Forms_Export' === $class ) {
169
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-forms.php';
168
+	if ('Give_Batch_Forms_Export' === $class) {
169
+		require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-forms.php';
170 170
 	}
171 171
 
172 172
 }
173 173
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/reporting/reports.php 1 patch
Spacing   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 // Exit if accessed directly
19
-if ( ! defined( 'ABSPATH' ) ) {
19
+if ( ! defined('ABSPATH')) {
20 20
 	exit;
21 21
 }
22 22
 
@@ -29,36 +29,36 @@  discard block
 block discarded – undo
29 29
  * @return void
30 30
  */
31 31
 function give_reports_page() {
32
-	$current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' );
33
-	$active_tab   = isset( $_GET['tab'] ) ? $_GET['tab'] : 'reports';
32
+	$current_page = admin_url('edit.php?post_type=give_forms&page=give-reports');
33
+	$active_tab   = isset($_GET['tab']) ? $_GET['tab'] : 'reports';
34 34
 	?>
35 35
 	<div class="wrap">
36 36
 		<h1 class="nav-tab-wrapper">
37
-			<a href="<?php echo esc_url( add_query_arg( array(
37
+			<a href="<?php echo esc_url(add_query_arg(array(
38 38
 				'tab'              => 'reports',
39 39
 				'settings-updated' => false
40
-			), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Reports', 'give' ); ?></a>
41
-			<?php if ( current_user_can( 'export_give_reports' ) ) { ?>
42
-				<a href="<?php echo esc_url( add_query_arg( array(
40
+			), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'reports' ? 'nav-tab-active' : ''; ?>"><?php _e('Reports', 'give'); ?></a>
41
+			<?php if (current_user_can('export_give_reports')) { ?>
42
+				<a href="<?php echo esc_url(add_query_arg(array(
43 43
 					'tab'              => 'export',
44 44
 					'settings-updated' => false
45
-				), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Export', 'give' ); ?></a>
45
+				), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'export' ? 'nav-tab-active' : ''; ?>"><?php _e('Export', 'give'); ?></a>
46 46
 			<?php } ?>
47
-			<a href="<?php echo esc_url( add_query_arg( array(
47
+			<a href="<?php echo esc_url(add_query_arg(array(
48 48
 				'tab'              => 'logs',
49 49
 				'settings-updated' => false
50
-			), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Logs', 'give' ); ?></a>
51
-			<a href="<?php echo esc_url( add_query_arg( array(
50
+			), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'logs' ? 'nav-tab-active' : ''; ?>"><?php _e('Logs', 'give'); ?></a>
51
+			<a href="<?php echo esc_url(add_query_arg(array(
52 52
 				'tab'              => 'tools',
53 53
 				'settings-updated' => false
54
-			), $current_page ) ); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Tools', 'give' ); ?></a>
55
-			<?php do_action( 'give_reports_tabs' ); ?>
54
+			), $current_page)); ?>" class="nav-tab <?php echo $active_tab == 'tools' ? 'nav-tab-active' : ''; ?>"><?php _e('Tools', 'give'); ?></a>
55
+			<?php do_action('give_reports_tabs'); ?>
56 56
 		</h1>
57 57
 
58 58
 		<?php
59
-		do_action( 'give_reports_page_top' );
60
-		do_action( 'give_reports_tab_' . $active_tab );
61
-		do_action( 'give_reports_page_bottom' );
59
+		do_action('give_reports_page_top');
60
+		do_action('give_reports_tab_'.$active_tab);
61
+		do_action('give_reports_page_bottom');
62 62
 		?>
63 63
 	</div><!-- .wrap -->
64 64
 	<?php
@@ -72,13 +72,13 @@  discard block
 block discarded – undo
72 72
  */
73 73
 function give_reports_default_views() {
74 74
 	$views = array(
75
-		'earnings' => __( 'Income', 'give' ),
75
+		'earnings' => __('Income', 'give'),
76 76
 		'forms'    => give_get_forms_label_plural(),
77
-		'donors'   => __( 'Donors', 'give' ),
78
-		'gateways' => __( 'Payment Methods', 'give' )
77
+		'donors'   => __('Donors', 'give'),
78
+		'gateways' => __('Payment Methods', 'give')
79 79
 	);
80 80
 
81
-	$views = apply_filters( 'give_report_views', $views );
81
+	$views = apply_filters('give_report_views', $views);
82 82
 
83 83
 	return $views;
84 84
 }
@@ -94,15 +94,15 @@  discard block
 block discarded – undo
94 94
  * @return string $view Report View
95 95
  *
96 96
  */
97
-function give_get_reporting_view( $default = 'earnings' ) {
97
+function give_get_reporting_view($default = 'earnings') {
98 98
 
99
-	if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) {
99
+	if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) {
100 100
 		$view = $default;
101 101
 	} else {
102 102
 		$view = $_GET['view'];
103 103
 	}
104 104
 
105
-	return apply_filters( 'give_get_reporting_view', $view );
105
+	return apply_filters('give_get_reporting_view', $view);
106 106
 }
107 107
 
108 108
 /**
@@ -115,14 +115,14 @@  discard block
 block discarded – undo
115 115
 	$current_view = 'earnings';
116 116
 	$views        = give_reports_default_views();
117 117
 
118
-	if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $views ) ) {
118
+	if (isset($_GET['view']) && array_key_exists($_GET['view'], $views)) {
119 119
 		$current_view = $_GET['view'];
120 120
 	}
121 121
 
122
-	do_action( 'give_reports_view_' . $current_view );
122
+	do_action('give_reports_view_'.$current_view);
123 123
 }
124 124
 
125
-add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' );
125
+add_action('give_reports_tab_reports', 'give_reports_tab_reports');
126 126
 
127 127
 /**
128 128
  * Renders the Reports Page Views Drop Downs
@@ -132,25 +132,25 @@  discard block
 block discarded – undo
132 132
  */
133 133
 function give_report_views() {
134 134
 	$views        = give_reports_default_views();
135
-	$current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings';
136
-	do_action( 'give_report_view_actions_before' );
135
+	$current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings';
136
+	do_action('give_report_view_actions_before');
137 137
 	?>
138 138
 	<form id="give-reports-filter" method="get">
139 139
 		<select id="give-reports-view" name="view">
140
-			<option value="-1"><?php _e( 'Report Type', 'give' ); ?></option>
141
-			<?php foreach ( $views as $view_id => $label ) : ?>
142
-				<option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option>
140
+			<option value="-1"><?php _e('Report Type', 'give'); ?></option>
141
+			<?php foreach ($views as $view_id => $label) : ?>
142
+				<option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option>
143 143
 			<?php endforeach; ?>
144 144
 		</select>
145 145
 
146
-		<?php do_action( 'give_report_view_actions' ); ?>
146
+		<?php do_action('give_report_view_actions'); ?>
147 147
 
148 148
 		<input type="hidden" name="post_type" value="give_forms"/>
149 149
 		<input type="hidden" name="page" value="give-reports"/>
150
-		<?php submit_button( __( 'Show', 'give' ), 'secondary', 'submit', false ); ?>
150
+		<?php submit_button(__('Show', 'give'), 'secondary', 'submit', false); ?>
151 151
 	</form>
152 152
 	<?php
153
-	do_action( 'give_report_view_actions_after' );
153
+	do_action('give_report_view_actions_after');
154 154
 }
155 155
 
156 156
 /**
@@ -163,18 +163,18 @@  discard block
 block discarded – undo
163 163
  */
164 164
 function give_reports_forms_table() {
165 165
 
166
-	if ( isset( $_GET['form-id'] ) ) {
166
+	if (isset($_GET['form-id'])) {
167 167
 		return;
168 168
 	}
169 169
 
170
-	include( dirname( __FILE__ ) . '/class-form-reports-table.php' );
170
+	include(dirname(__FILE__).'/class-form-reports-table.php');
171 171
 
172 172
 	$give_table = new Give_Form_Reports_Table();
173 173
 	$give_table->prepare_items();
174 174
 	$give_table->display();
175 175
 }
176 176
 
177
-add_action( 'give_reports_view_forms', 'give_reports_forms_table' );
177
+add_action('give_reports_view_forms', 'give_reports_forms_table');
178 178
 
179 179
 /**
180 180
  * Renders the detailed report for a specific give form
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
  * @return void
184 184
  */
185 185
 function give_reports_form_details() {
186
-	if ( ! isset( $_GET['form-id'] ) ) {
186
+	if ( ! isset($_GET['form-id'])) {
187 187
 		return;
188 188
 	}
189 189
 	?>
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
 		<div class="actions bulkactions">
192 192
 			<?php give_report_views(); ?>
193 193
 			&nbsp;
194
-			<button onclick="history.go(-1);" class="button-secondary"><?php _e( 'Go Back', 'give' ); ?></button>
194
+			<button onclick="history.go(-1);" class="button-secondary"><?php _e('Go Back', 'give'); ?></button>
195 195
 		</div>
196 196
 	</div>
197 197
 	<?php
198
-	give_reports_graph_of_form( absint( $_GET['form-id'] ) );
198
+	give_reports_graph_of_form(absint($_GET['form-id']));
199 199
 }
200 200
 
201
-add_action( 'give_reports_view_forms', 'give_reports_form_details' );
201
+add_action('give_reports_view_forms', 'give_reports_form_details');
202 202
 
203 203
 /**
204 204
  * Renders the Reports Donors Table
@@ -209,28 +209,28 @@  discard block
 block discarded – undo
209 209
  * @return void
210 210
  */
211 211
 function give_reports_donors_table() {
212
-	include( dirname( __FILE__ ) . '/class-donor-reports-table.php' );
212
+	include(dirname(__FILE__).'/class-donor-reports-table.php');
213 213
 
214 214
 	$give_table = new Give_Donor_Reports_Table();
215 215
 	$give_table->prepare_items();
216 216
 	?>
217 217
 	<div class="wrap give-reports-donors-wrap">
218
-		<?php do_action( 'give_logs_donors_table_top' ); ?>
219
-		<form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=donors' ); ?>">
218
+		<?php do_action('give_logs_donors_table_top'); ?>
219
+		<form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&view=donors'); ?>">
220 220
 			<?php
221
-			$give_table->search_box( __( 'Search', 'give' ), 'give-donors' );
221
+			$give_table->search_box(__('Search', 'give'), 'give-donors');
222 222
 			$give_table->display();
223 223
 			?>
224 224
 			<input type="hidden" name="post_type" value="give_forms"/>
225 225
 			<input type="hidden" name="page" value="give-reports"/>
226 226
 			<input type="hidden" name="view" value="donors"/>
227 227
 		</form>
228
-		<?php do_action( 'give_logs_donors_table_bottom' ); ?>
228
+		<?php do_action('give_logs_donors_table_bottom'); ?>
229 229
 	</div>
230 230
 	<?php
231 231
 }
232 232
 
233
-add_action( 'give_reports_view_donors', 'give_reports_donors_table' );
233
+add_action('give_reports_view_donors', 'give_reports_donors_table');
234 234
 
235 235
 
236 236
 /**
@@ -242,14 +242,14 @@  discard block
 block discarded – undo
242 242
  * @return void
243 243
  */
244 244
 function give_reports_gateways_table() {
245
-	include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' );
245
+	include(dirname(__FILE__).'/class-gateways-reports-table.php');
246 246
 
247 247
 	$give_table = new Give_Gateawy_Reports_Table();
248 248
 	$give_table->prepare_items();
249 249
 	$give_table->display();
250 250
 }
251 251
 
252
-add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' );
252
+add_action('give_reports_view_gateways', 'give_reports_gateways_table');
253 253
 
254 254
 
255 255
 /**
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 function give_reports_earnings() {
262 262
 	?>
263 263
 	<div class="tablenav top reports-table-nav">
264
-		<h3 class="alignleft reports-earnings-title"><span><?php _e( 'Income Over Time', 'give' ); ?></span></h3>
264
+		<h3 class="alignleft reports-earnings-title"><span><?php _e('Income Over Time', 'give'); ?></span></h3>
265 265
 
266 266
 		<div class="alignright actions reports-views-wrap"><?php give_report_views(); ?></div>
267 267
 	</div>
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	give_reports_graph();
270 270
 }
271 271
 
272
-add_action( 'give_reports_view_earnings', 'give_reports_earnings' );
272
+add_action('give_reports_view_earnings', 'give_reports_earnings');
273 273
 
274 274
 
275 275
 /**
@@ -284,50 +284,50 @@  discard block
 block discarded – undo
284 284
 		<div id="post-body">
285 285
 			<div id="post-body-content">
286 286
 
287
-				<?php do_action( 'give_reports_tab_export_content_top' ); ?>
287
+				<?php do_action('give_reports_tab_export_content_top'); ?>
288 288
 
289 289
 				<table class="widefat export-options-table give-table">
290 290
 					<thead>
291 291
 					<tr>
292
-						<th class="row-title"><?php _e( 'Export Type', 'give' ); ?></th>
293
-						<th><?php _e( 'Export Options', 'give' ); ?></th>
292
+						<th class="row-title"><?php _e('Export Type', 'give'); ?></th>
293
+						<th><?php _e('Export Options', 'give'); ?></th>
294 294
 					</tr>
295 295
 					</thead>
296 296
 					<tbody>
297
-					<?php do_action( 'give_reports_tab_export_table_top' ); ?>
297
+					<?php do_action('give_reports_tab_export_table_top'); ?>
298 298
 					<tr class="give-export-pdf-sales-earnings">
299 299
 						<td class="row-title">
300
-							<h3><span><?php _e( 'Export PDF of Donations and Income', 'give' ); ?></span></h3>
300
+							<h3><span><?php _e('Export PDF of Donations and Income', 'give'); ?></span></h3>
301 301
 
302
-							<p><?php _e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p>
302
+							<p><?php _e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p>
303 303
 						</td>
304 304
 						<td>
305
-							<a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"><?php _e( 'Generate PDF', 'give' ); ?></a>
305
+							<a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"><?php _e('Generate PDF', 'give'); ?></a>
306 306
 						</td>
307 307
 					</tr>
308 308
 					<tr class="alternate give-export-sales-earnings">
309 309
 						<td class="row-title">
310
-							<h3><span><?php _e( 'Export Income and Donation Stats', 'give' ); ?></span></h3>
310
+							<h3><span><?php _e('Export Income and Donation Stats', 'give'); ?></span></h3>
311 311
 
312
-							<p><?php _e( 'Download a CSV of income and donations over time.', 'give' ); ?></p>
312
+							<p><?php _e('Download a CSV of income and donations over time.', 'give'); ?></p>
313 313
 						</td>
314 314
 						<td>
315 315
 							<form method="post">
316
-								<?php echo Give()->html->year_dropdown( 'start_year' ); ?>
317
-								<?php echo Give()->html->month_dropdown( 'start_month' ); ?>
318
-								<?php echo _x( 'to', 'Date one to date two', 'give' ); ?>
319
-								<?php echo Give()->html->year_dropdown( 'end_year' ); ?>
320
-								<?php echo Give()->html->month_dropdown( 'end_month' ); ?>
316
+								<?php echo Give()->html->year_dropdown('start_year'); ?>
317
+								<?php echo Give()->html->month_dropdown('start_month'); ?>
318
+								<?php echo _x('to', 'Date one to date two', 'give'); ?>
319
+								<?php echo Give()->html->year_dropdown('end_year'); ?>
320
+								<?php echo Give()->html->month_dropdown('end_month'); ?>
321 321
 								<input type="hidden" name="give-action" value="earnings_export"/>
322
-								<input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/>
322
+								<input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary"/>
323 323
 							</form>
324 324
 						</td>
325 325
 					</tr>
326 326
 					<tr class="give-export-payment-history">
327 327
 						<td class="row-title">
328
-							<h3><span><?php _e( 'Export Donation History', 'give' ); ?></span></h3>
328
+							<h3><span><?php _e('Export Donation History', 'give'); ?></span></h3>
329 329
 
330
-							<p><?php _e( 'Download a CSV of all donations recorded.', 'give' ); ?></p>
330
+							<p><?php _e('Download a CSV of all donations recorded.', 'give'); ?></p>
331 331
 						</td>
332 332
 						<td>
333 333
 							<form id="give-export-payments" class="give-export-form" method="post">
@@ -335,29 +335,29 @@  discard block
 block discarded – undo
335 335
 								$args = array(
336 336
 									'id'          => 'give-payment-export-start',
337 337
 									'name'        => 'start',
338
-									'placeholder' => __( 'Start date', 'give' )
338
+									'placeholder' => __('Start date', 'give')
339 339
 								);
340
-								echo Give()->html->date_field( $args ); ?>
340
+								echo Give()->html->date_field($args); ?>
341 341
 								<?php
342 342
 								$args = array(
343 343
 									'id'          => 'give-payment-export-end',
344 344
 									'name'        => 'end',
345
-									'placeholder' => __( 'End date', 'give' )
345
+									'placeholder' => __('End date', 'give')
346 346
 								);
347
-								echo Give()->html->date_field( $args ); ?>
347
+								echo Give()->html->date_field($args); ?>
348 348
 								<select name="status">
349
-									<option value="any"><?php _e( 'All Statuses', 'give' ); ?></option>
349
+									<option value="any"><?php _e('All Statuses', 'give'); ?></option>
350 350
 									<?php
351 351
 									$statuses = give_get_payment_statuses();
352
-									foreach ( $statuses as $status => $label ) {
353
-										echo '<option value="' . $status . '">' . $label . '</option>';
352
+									foreach ($statuses as $status => $label) {
353
+										echo '<option value="'.$status.'">'.$label.'</option>';
354 354
 									}
355 355
 									?>
356 356
 								</select>
357
-								<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
357
+								<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
358 358
 								<input type="hidden" name="give-export-class" value="Give_Batch_Payments_Export"/>
359 359
 								<span>
360
-									<input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/>
360
+									<input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary"/>
361 361
 									<span class="spinner"></span>
362 362
 								</span>
363 363
 							</form>
@@ -366,9 +366,9 @@  discard block
 block discarded – undo
366 366
 					</tr>
367 367
 					<tr class="alternate give-export-donors">
368 368
 						<td class="row-title">
369
-							<h3><span><?php _e( 'Export Donors in CSV', 'give' ); ?></span></h3>
369
+							<h3><span><?php _e('Export Donors in CSV', 'give'); ?></span></h3>
370 370
 
371
-							<p><?php _e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p>
371
+							<p><?php _e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p>
372 372
 						</td>
373 373
 						<td>
374 374
 							<form method="post" id="give_donor_export" class="give-export-form">
@@ -379,54 +379,54 @@  discard block
 block discarded – undo
379 379
 										'id'     => 'give_customer_export_form',
380 380
 										'chosen' => true
381 381
 									);
382
-									echo Give()->html->forms_dropdown( $args ); ?>
382
+									echo Give()->html->forms_dropdown($args); ?>
383 383
 								
384
-								<input type="submit" value="<?php _e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/>
384
+								<input type="submit" value="<?php _e('Generate CSV', 'give'); ?>" class="button-secondary"/>
385 385
 
386 386
 								<div id="export-donor-options-wrap" class="give-clearfix">
387
-									<p><?php _e( 'Export Columns', 'give' ); ?>:</p>
387
+									<p><?php _e('Export Columns', 'give'); ?>:</p>
388 388
 									<ul id="give-export-option-ul">
389 389
 										<li>
390
-											<label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php _e( 'Name', 'give' ); ?>
390
+											<label for="give-export-fullname"><input type="checkbox" checked name="give_export_option[full_name]" id="give-export-fullname"><?php _e('Name', 'give'); ?>
391 391
 											</label>
392 392
 										</li>
393 393
 										<li>
394
-											<label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php _e( 'Email', 'give' ); ?>
394
+											<label for="give-export-email"><input type="checkbox" checked name="give_export_option[email]" id="give-export-email"><?php _e('Email', 'give'); ?>
395 395
 											</label>
396 396
 										</li>
397 397
 										<li>
398
-											<label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php _e( 'Address', 'give' ); ?>
398
+											<label for="give-export-address"><input type="checkbox" checked name="give_export_option[address]" id="give-export-address"><?php _e('Address', 'give'); ?>
399 399
 											</label>
400 400
 										</li>
401 401
 										<li>
402
-											<label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php _e( 'User ID', 'give' ); ?>
402
+											<label for="give-export-userid"><input type="checkbox" checked name="give_export_option[userid]" id="give-export-userid"><?php _e('User ID', 'give'); ?>
403 403
 											</label>
404 404
 										</li>
405 405
 										<li>
406
-											<label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php _e( 'First Donation Date', 'give' ); ?>
406
+											<label for="give-export-first-donation-date"><input type="checkbox" checked name="give_export_option[date_first_donated]" id="give-export-first-donation-date"><?php _e('First Donation Date', 'give'); ?>
407 407
 											</label>
408 408
 										</li>
409 409
 										<li>
410
-											<label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php _e( 'Number of Donations', 'give' ); ?>
410
+											<label for="give-export-donation-number"><input type="checkbox" checked name="give_export_option[donations]" id="give-export-donation-number"><?php _e('Number of Donations', 'give'); ?>
411 411
 											</label>
412 412
 										</li>
413 413
 										<li>
414
-											<label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php _e( 'Total Donated', 'give' ); ?>
414
+											<label for="give-export-donation-sum"><input type="checkbox" checked name="give_export_option[donation_sum]" id="give-export-donation-sum"><?php _e('Total Donated', 'give'); ?>
415 415
 											</label>
416 416
 										</li>
417 417
 									</ul>
418 418
 								</div>
419
-								<?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
419
+								<?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?>
420 420
 								<input type="hidden" name="give-export-class" value="Give_Batch_Customers_Export"/>
421 421
 								<input type="hidden" name="give-action" value="email_export"/>
422 422
 							</form>
423 423
 						</td>
424 424
 					</tr>
425
-					<?php do_action( 'give_reports_tab_export_table_bottom' ); ?>
425
+					<?php do_action('give_reports_tab_export_table_bottom'); ?>
426 426
 					</tbody>
427 427
 				</table>
428 428
 
429
-				<?php do_action( 'give_reports_tab_export_content_bottom' ); ?>
429
+				<?php do_action('give_reports_tab_export_content_bottom'); ?>
430 430
 
431 431
 			</div>
432 432
 			<!-- .post-body-content -->
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 	<?php
437 437
 }
438 438
 
439
-add_action( 'give_reports_tab_export', 'give_reports_tab_export' );
439
+add_action('give_reports_tab_export', 'give_reports_tab_export');
440 440
 
441 441
 /**
442 442
  * Renders the Reports page
@@ -446,19 +446,19 @@  discard block
 block discarded – undo
446 446
  */
447 447
 function give_reports_tab_logs() {
448 448
 
449
-	require( GIVE_PLUGIN_DIR . 'includes/admin/reporting/logs.php' );
449
+	require(GIVE_PLUGIN_DIR.'includes/admin/reporting/logs.php');
450 450
 
451 451
 	$current_view = 'sales';
452 452
 	$log_views    = give_log_default_views();
453 453
 
454
-	if ( isset( $_GET['view'] ) && array_key_exists( $_GET['view'], $log_views ) ) {
454
+	if (isset($_GET['view']) && array_key_exists($_GET['view'], $log_views)) {
455 455
 		$current_view = $_GET['view'];
456 456
 	}
457 457
 
458
-	do_action( 'give_logs_view_' . $current_view );
458
+	do_action('give_logs_view_'.$current_view);
459 459
 }
460 460
 
461
-add_action( 'give_reports_tab_logs', 'give_reports_tab_logs' );
461
+add_action('give_reports_tab_logs', 'give_reports_tab_logs');
462 462
 
463 463
 /**
464 464
  * Retrieves estimated monthly earnings and sales
@@ -468,9 +468,9 @@  discard block
 block discarded – undo
468 468
  */
469 469
 function give_estimated_monthly_stats() {
470 470
 
471
-	$estimated = get_transient( 'give_estimated_monthly_stats' );
471
+	$estimated = get_transient('give_estimated_monthly_stats');
472 472
 
473
-	if ( false === $estimated ) {
473
+	if (false === $estimated) {
474 474
 
475 475
 		$estimated = array(
476 476
 			'earnings' => 0,
@@ -479,20 +479,20 @@  discard block
 block discarded – undo
479 479
 
480 480
 		$stats = new Give_Payment_Stats;
481 481
 
482
-		$to_date_earnings = $stats->get_earnings( 0, 'this_month' );
483
-		$to_date_sales    = $stats->get_sales( 0, 'this_month' );
482
+		$to_date_earnings = $stats->get_earnings(0, 'this_month');
483
+		$to_date_sales    = $stats->get_sales(0, 'this_month');
484 484
 
485
-		$current_day   = date( 'd', current_time( 'timestamp' ) );
486
-		$current_month = date( 'n', current_time( 'timestamp' ) );
487
-		$current_year  = date( 'Y', current_time( 'timestamp' ) );
488
-		$days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year );
485
+		$current_day   = date('d', current_time('timestamp'));
486
+		$current_month = date('n', current_time('timestamp'));
487
+		$current_year  = date('Y', current_time('timestamp'));
488
+		$days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year);
489 489
 
490
-		$estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month;
491
-		$estimated['sales']    = ( $to_date_sales / $current_day ) * $days_in_month;
490
+		$estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month;
491
+		$estimated['sales']    = ($to_date_sales / $current_day) * $days_in_month;
492 492
 
493 493
 		// Cache for one day
494
-		set_transient( 'give_estimated_monthly_stats', $estimated, 86400 );
494
+		set_transient('give_estimated_monthly_stats', $estimated, 86400);
495 495
 	}
496 496
 
497
-	return maybe_unserialize( $estimated );
497
+	return maybe_unserialize($estimated);
498 498
 }
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-receipt.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 class Give_Shortcode_Donation_Receipt extends Give_Shortcode_Generator {
15 15
 
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		$this->shortcode['title'] = __( 'Donation Receipt', 'give' );
22
-		$this->shortcode['label'] = __( 'Donation Receipt', 'give' );
21
+		$this->shortcode['title'] = __('Donation Receipt', 'give');
22
+		$this->shortcode['label'] = __('Donation Receipt', 'give');
23 23
 
24
-		parent::__construct( 'give_receipt' );
24
+		parent::__construct('give_receipt');
25 25
 	}
26 26
 
27 27
 	/**
@@ -34,60 +34,60 @@  discard block
 block discarded – undo
34 34
 		return array(
35 35
 			array(
36 36
 				'type' => 'container',
37
-				'html' => sprintf( '<p class="strong">%s</p>', __( 'Optional settings', 'give' ) ),
37
+				'html' => sprintf('<p class="strong">%s</p>', __('Optional settings', 'give')),
38 38
 			),
39 39
 			array(
40 40
 				'type'    => 'listbox',
41 41
 				'name'    => 'price',
42
-				'label'   => __( 'Show Donation Amount:', 'give' ),
42
+				'label'   => __('Show Donation Amount:', 'give'),
43 43
 				'options' => array(
44
-					'true'  => __( 'Show', 'give' ),
45
-					'false' => __( 'Hide', 'give' ),
44
+					'true'  => __('Show', 'give'),
45
+					'false' => __('Hide', 'give'),
46 46
 				),
47 47
 			),
48 48
 			array(
49 49
 				'type'    => 'listbox',
50 50
 				'name'    => 'donor',
51
-				'label'   => __( 'Show Donor Name:', 'give' ),
51
+				'label'   => __('Show Donor Name:', 'give'),
52 52
 				'options' => array(
53
-					'true'  => __( 'Show', 'give' ),
54
-					'false' => __( 'Hide', 'give' ),
53
+					'true'  => __('Show', 'give'),
54
+					'false' => __('Hide', 'give'),
55 55
 				),
56 56
 			),
57 57
 			array(
58 58
 				'type'    => 'listbox',
59 59
 				'name'    => 'date',
60
-				'label'   => __( 'Show Date:', 'give' ),
60
+				'label'   => __('Show Date:', 'give'),
61 61
 				'options' => array(
62
-					'true'  => __( 'Show', 'give' ),
63
-					'false' => __( 'Hide', 'give' ),
62
+					'true'  => __('Show', 'give'),
63
+					'false' => __('Hide', 'give'),
64 64
 				),
65 65
 			),
66 66
 			array(
67 67
 				'type'    => 'listbox',
68 68
 				'name'    => 'payment_key',
69
-				'label'   => __( 'Show Payment Key:', 'give' ),
69
+				'label'   => __('Show Payment Key:', 'give'),
70 70
 				'options' => array(
71
-					'true'  => __( 'Show', 'give' ),
72
-					'false' => __( 'Hide', 'give' ),
71
+					'true'  => __('Show', 'give'),
72
+					'false' => __('Hide', 'give'),
73 73
 				),
74 74
 			),
75 75
 			array(
76 76
 				'type'    => 'listbox',
77 77
 				'name'    => 'payment_method',
78
-				'label'   => __( 'Show Payment Method:', 'give' ),
78
+				'label'   => __('Show Payment Method:', 'give'),
79 79
 				'options' => array(
80
-					'true'  => __( 'Show', 'give' ),
81
-					'false' => __( 'Hide', 'give' ),
80
+					'true'  => __('Show', 'give'),
81
+					'false' => __('Hide', 'give'),
82 82
 				),
83 83
 			),
84 84
 			array(
85 85
 				'type'    => 'listbox',
86 86
 				'name'    => 'payment_id',
87
-				'label'   => __( 'Show Payment ID:', 'give' ),
87
+				'label'   => __('Show Payment ID:', 'give'),
88 88
 				'options' => array(
89
-					'true'  => __( 'Show', 'give' ),
90
-					'false' => __( 'Hide', 'give' ),
89
+					'true'  => __('Show', 'give'),
90
+					'false' => __('Hide', 'give'),
91 91
 				),
92 92
 			),
93 93
 		);
Please login to merge, or discard this patch.
includes/admin/shortcodes/abstract-shortcode-generator.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @since       1.3.0
12 12
  */
13 13
 
14
-defined( 'ABSPATH' ) or exit;
14
+defined('ABSPATH') or exit;
15 15
 
16 16
 abstract class Give_Shortcode_Generator {
17 17
 
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 	 *
58 58
 	 * @since 1.0
59 59
 	 */
60
-	public function __construct( $shortcode ) {
60
+	public function __construct($shortcode) {
61 61
 
62 62
 
63 63
 		$this->shortcode_tag = $shortcode;
64 64
 
65
-		add_action( 'admin_init', array( $this, 'init' ) );
65
+		add_action('admin_init', array($this, 'init'));
66 66
 
67 67
 	}
68 68
 
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function init() {
75 75
 
76
-		if ( $this->shortcode_tag ) {
76
+		if ($this->shortcode_tag) {
77 77
 
78
-			$this->self = get_class( $this );
78
+			$this->self = get_class($this);
79 79
 
80 80
 			$this->errors   = array();
81 81
 			$this->required = array();
@@ -84,18 +84,18 @@  discard block
 block discarded – undo
84 84
 			$fields = $this->get_fields();
85 85
 
86 86
 			$defaults = array(
87
-				'btn_close' => __( 'Close', 'give' ),
88
-				'btn_okay'  => __( 'Insert Shortcode', 'give' ),
87
+				'btn_close' => __('Close', 'give'),
88
+				'btn_okay'  => __('Insert Shortcode', 'give'),
89 89
 				'errors'    => $this->errors,
90 90
 				'fields'    => $fields,
91
-				'label'     => '[' . $this->shortcode_tag . ']',
91
+				'label'     => '['.$this->shortcode_tag.']',
92 92
 				'required'  => $this->required,
93
-				'title'     => __( 'Insert Shortcode', 'give' ),
93
+				'title'     => __('Insert Shortcode', 'give'),
94 94
 			);
95 95
 
96
-			if ( user_can_richedit() ) {
96
+			if (user_can_richedit()) {
97 97
 
98
-				Give_Shortcode_Button::$shortcodes[ $this->shortcode_tag ] = wp_parse_args( $this->shortcode, $defaults );
98
+				Give_Shortcode_Button::$shortcodes[$this->shortcode_tag] = wp_parse_args($this->shortcode, $defaults);
99 99
 
100 100
 			}
101 101
 		}
@@ -124,13 +124,13 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @since 1.0
126 126
 	 */
127
-	protected function generate_fields( $defined_fields ) {
127
+	protected function generate_fields($defined_fields) {
128 128
 
129 129
 		$fields = array();
130 130
 
131
-		if ( is_array( $defined_fields ) ) {
131
+		if (is_array($defined_fields)) {
132 132
 
133
-			foreach ( $defined_fields as $field ) {
133
+			foreach ($defined_fields as $field) {
134 134
 
135 135
 				$defaults = array(
136 136
 					'label'       => false,
@@ -141,14 +141,14 @@  discard block
 block discarded – undo
141 141
 					'type'        => '',
142 142
 				);
143 143
 
144
-				$field  = wp_parse_args( (array) $field, $defaults );
145
-				$method = 'generate_' . strtolower( $field['type'] );
144
+				$field  = wp_parse_args((array) $field, $defaults);
145
+				$method = 'generate_'.strtolower($field['type']);
146 146
 
147
-				if ( method_exists( $this, $method ) ) {
147
+				if (method_exists($this, $method)) {
148 148
 
149
-					$field = call_user_func( array( $this, $method ), $field );
149
+					$field = call_user_func(array($this, $method), $field);
150 150
 
151
-					if ( $field ) {
151
+					if ($field) {
152 152
 						$fields[] = $field;
153 153
 					}
154 154
 				}
@@ -168,22 +168,22 @@  discard block
 block discarded – undo
168 168
 	protected function get_fields() {
169 169
 
170 170
 		$defined_fields   = $this->define_fields();
171
-		$generated_fields = $this->generate_fields( $defined_fields );
171
+		$generated_fields = $this->generate_fields($defined_fields);
172 172
 
173 173
 		$errors = array();
174 174
 
175
-		if ( ! empty( $this->errors ) ) {
176
-			foreach ( $this->required as $name => $alert ) {
177
-				if ( false === array_search( $name, array_column( $generated_fields, 'name' ) ) ) {
175
+		if ( ! empty($this->errors)) {
176
+			foreach ($this->required as $name => $alert) {
177
+				if (false === array_search($name, array_column($generated_fields, 'name'))) {
178 178
 
179
-					$errors[] = $this->errors[ $name ];
179
+					$errors[] = $this->errors[$name];
180 180
 				}
181 181
 			}
182 182
 
183 183
 			$this->errors = $errors;
184 184
 		}
185 185
 
186
-		if ( ! empty( $errors ) ) {
186
+		if ( ! empty($errors)) {
187 187
 
188 188
 			return $errors;
189 189
 		}
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 	 *
201 201
 	 * @since 1.0
202 202
 	 */
203
-	protected function generate_container( $field ) {
203
+	protected function generate_container($field) {
204 204
 
205
-		if ( array_key_exists( 'html', $field ) ) {
205
+		if (array_key_exists('html', $field)) {
206 206
 
207 207
 			return array(
208 208
 				'type' => $field['type'],
@@ -222,36 +222,36 @@  discard block
 block discarded – undo
222 222
 	 *
223 223
 	 * @since 1.0
224 224
 	 */
225
-	protected function generate_listbox( $field ) {
225
+	protected function generate_listbox($field) {
226 226
 
227
-		$listbox = shortcode_atts( array(
227
+		$listbox = shortcode_atts(array(
228 228
 			'label'    => '',
229 229
 			'minWidth' => '',
230 230
 			'name'     => false,
231 231
 			'tooltip'  => '',
232 232
 			'type'     => '',
233 233
 			'value'    => '',
234
-		), $field );
234
+		), $field);
235 235
 
236
-		if ( $this->validate( $field ) ) {
236
+		if ($this->validate($field)) {
237 237
 
238 238
 			$new_listbox = array();
239 239
 
240
-			foreach ( $listbox as $key => $value ) {
240
+			foreach ($listbox as $key => $value) {
241 241
 
242
-				if ( $key == 'value' && empty( $value ) ) {
243
-					$new_listbox[ $key ] = $listbox['name'];
244
-				} else if ( $value ) {
245
-					$new_listbox[ $key ] = $value;
242
+				if ($key == 'value' && empty($value)) {
243
+					$new_listbox[$key] = $listbox['name'];
244
+				} else if ($value) {
245
+					$new_listbox[$key] = $value;
246 246
 				}
247 247
 			}
248 248
 
249 249
 			// do not reindex array!
250 250
 			$field['options'] = array(
251
-				                    '' => ( $field['placeholder'] ? $field['placeholder'] : sprintf( '– %s –', __( 'Select', 'give' ) ) ),
251
+				                    '' => ($field['placeholder'] ? $field['placeholder'] : sprintf('– %s –', __('Select', 'give'))),
252 252
 			                    ) + $field['options'];
253 253
 
254
-			foreach ( $field['options'] as $value => $text ) {
254
+			foreach ($field['options'] as $value => $text) {
255 255
 				$new_listbox['values'][] = array(
256 256
 					'text'  => $text,
257 257
 					'value' => $value,
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 *
274 274
 	 * @since 1.0
275 275
 	 */
276
-	protected function generate_post( $field ) {
276
+	protected function generate_post($field) {
277 277
 
278 278
 		$args = array(
279 279
 			'post_type'      => 'post',
@@ -282,23 +282,23 @@  discard block
 block discarded – undo
282 282
 			'posts_per_page' => 30,
283 283
 		);
284 284
 
285
-		$args    = wp_parse_args( (array) $field['query_args'], $args );
286
-		$posts   = get_posts( $args );
285
+		$args    = wp_parse_args((array) $field['query_args'], $args);
286
+		$posts   = get_posts($args);
287 287
 		$options = array();
288 288
 
289
-		if ( $posts ) {
290
-			foreach ( $posts as $post ) {
291
-				$options[ absint( $post->ID ) ] = esc_html( $post->post_title );
289
+		if ($posts) {
290
+			foreach ($posts as $post) {
291
+				$options[absint($post->ID)] = esc_html($post->post_title);
292 292
 			}
293 293
 
294 294
 			$field['type']    = 'listbox';
295 295
 			$field['options'] = $options;
296 296
 
297
-			return $this->generate_listbox( $field );
297
+			return $this->generate_listbox($field);
298 298
 		}
299 299
 
300 300
 		// perform validation here before returning false
301
-		$this->validate( $field );
301
+		$this->validate($field);
302 302
 
303 303
 		return false;
304 304
 	}
@@ -312,9 +312,9 @@  discard block
 block discarded – undo
312 312
 	 *
313 313
 	 * @since 1.0
314 314
 	 */
315
-	protected function generate_textbox( $field ) {
315
+	protected function generate_textbox($field) {
316 316
 
317
-		$textbox = shortcode_atts( array(
317
+		$textbox = shortcode_atts(array(
318 318
 			'label'     => '',
319 319
 			'maxLength' => '',
320 320
 			'minHeight' => '',
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
 			'tooltip'   => '',
325 325
 			'type'      => '',
326 326
 			'value'     => '',
327
-		), $field );
327
+		), $field);
328 328
 
329
-		if ( $this->validate( $field ) ) {
330
-			return array_filter( $textbox, array( $this, 'return_textbox_value' ) );
329
+		if ($this->validate($field)) {
330
+			return array_filter($textbox, array($this, 'return_textbox_value'));
331 331
 		}
332 332
 
333 333
 		return false;
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	 *
341 341
 	 * @return bool
342 342
 	 */
343
-	function return_textbox_value( $value ) {
343
+	function return_textbox_value($value) {
344 344
 		return $value !== '';
345 345
 	}
346 346
 
@@ -356,9 +356,9 @@  discard block
 block discarded – undo
356 356
 	 *
357 357
 	 * @since 1.0
358 358
 	 */
359
-	protected function validate( $field ) {
359
+	protected function validate($field) {
360 360
 
361
-		extract( shortcode_atts(
361
+		extract(shortcode_atts(
362 362
 				array(
363 363
 					'name'     => false,
364 364
 					'required' => false,
@@ -366,34 +366,34 @@  discard block
 block discarded – undo
366 366
 				), $field )
367 367
 		);
368 368
 
369
-		if ( $name ) {
369
+		if ($name) {
370 370
 
371
-			if ( isset( $required['error'] ) ) {
371
+			if (isset($required['error'])) {
372 372
 
373 373
 				$error = array(
374 374
 					'type' => 'container',
375 375
 					'html' => $required['error'],
376 376
 				);
377 377
 
378
-				$this->errors[ $name ] = $this->generate_container( $error );
378
+				$this->errors[$name] = $this->generate_container($error);
379 379
 			}
380 380
 
381
-			if ( ! ! $required || is_array( $required ) ) {
381
+			if ( ! ! $required || is_array($required)) {
382 382
 
383
-				$alert = __( 'Some of the Shortcode options are required.', 'give' );
383
+				$alert = __('Some of the Shortcode options are required.', 'give');
384 384
 
385
-				if ( isset( $required['alert'] ) ) {
385
+				if (isset($required['alert'])) {
386 386
 
387 387
 					$alert = $required['alert'];
388 388
 
389
-				} else if ( ! empty( $label ) ) {
389
+				} else if ( ! empty($label)) {
390 390
 
391
-					$alert = sprintf( __( 'The "%s" option is required.', 'give' ),
392
-						str_replace( ':', '', $label )
391
+					$alert = sprintf(__('The "%s" option is required.', 'give'),
392
+						str_replace(':', '', $label)
393 393
 					);
394 394
 				}
395 395
 
396
-				$this->required[ $name ] = $alert;
396
+				$this->required[$name] = $alert;
397 397
 			}
398 398
 
399 399
 			return true;
Please login to merge, or discard this patch.
includes/admin/customers/customer-actions.php 1 patch
Spacing   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,15 +23,15 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array $output Response messages
25 25
  */
26
-function give_edit_customer( $args ) {
26
+function give_edit_customer($args) {
27 27
 	
28
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
28
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
29 29
 
30
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
31
-		wp_die( __( 'You do not have permission to edit this donor.', 'give' ) );
30
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
31
+		wp_die(__('You do not have permission to edit this donor.', 'give'));
32 32
 	}
33 33
 
34
-	if ( empty( $args ) ) {
34
+	if (empty($args)) {
35 35
 		return;
36 36
 	}
37 37
 
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 	$customer_id   = (int) $args['customerinfo']['id'];
40 40
 	$nonce         = $args['_wpnonce'];
41 41
 
42
-	if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) {
43
-		wp_die( __( 'Cheatin\' eh?!', 'give' ) );
42
+	if ( ! wp_verify_nonce($nonce, 'edit-customer')) {
43
+		wp_die(__('Cheatin\' eh?!', 'give'));
44 44
 	}
45 45
 
46
-	$customer = new Give_Customer( $customer_id );
47
-	if ( empty( $customer->id ) ) {
46
+	$customer = new Give_Customer($customer_id);
47
+	if (empty($customer->id)) {
48 48
 		return false;
49 49
 	}
50 50
 
@@ -54,23 +54,23 @@  discard block
 block discarded – undo
54 54
 		'user_id' => 0
55 55
 	);
56 56
 
57
-	$customer_info = wp_parse_args( $customer_info, $defaults );
57
+	$customer_info = wp_parse_args($customer_info, $defaults);
58 58
 
59
-	if ( ! is_email( $customer_info['email'] ) ) {
60
-		give_set_error( 'give-invalid-email', __( 'Please enter a valid email address.', 'give' ) );
59
+	if ( ! is_email($customer_info['email'])) {
60
+		give_set_error('give-invalid-email', __('Please enter a valid email address.', 'give'));
61 61
 	}
62 62
 
63
-	if ( (int) $customer_info['user_id'] != (int) $customer->user_id ) {
63
+	if ((int) $customer_info['user_id'] != (int) $customer->user_id) {
64 64
 
65 65
 		// Make sure we don't already have this user attached to a customer
66
-		if ( ! empty( $customer_info['user_id'] ) && false !== Give()->customers->get_customer_by( 'user_id', $customer_info['user_id'] ) ) {
67
-			give_set_error( 'give-invalid-customer-user_id', sprintf( __( 'The User ID %d is already associated with a different donor.', 'give' ), $customer_info['user_id'] ) );
66
+		if ( ! empty($customer_info['user_id']) && false !== Give()->customers->get_customer_by('user_id', $customer_info['user_id'])) {
67
+			give_set_error('give-invalid-customer-user_id', sprintf(__('The User ID %d is already associated with a different donor.', 'give'), $customer_info['user_id']));
68 68
 		}
69 69
 
70 70
 		// Make sure it's actually a user
71
-		$user = get_user_by( 'id', $customer_info['user_id'] );
72
-		if ( ! empty( $customer_info['user_id'] ) && false === $user ) {
73
-			give_set_error( 'give-invalid-user_id', sprintf( __( 'The User ID %d does not exist. Please assign an existing user.', 'give' ), $customer_info['user_id'] ) );
71
+		$user = get_user_by('id', $customer_info['user_id']);
72
+		if ( ! empty($customer_info['user_id']) && false === $user) {
73
+			give_set_error('give-invalid-user_id', sprintf(__('The User ID %d does not exist. Please assign an existing user.', 'give'), $customer_info['user_id']));
74 74
 		}
75 75
 
76 76
 	}
@@ -78,82 +78,82 @@  discard block
 block discarded – undo
78 78
 	// Record this for later
79 79
 	$previous_user_id = $customer->user_id;
80 80
 
81
-	if ( give_get_errors() ) {
81
+	if (give_get_errors()) {
82 82
 		return;
83 83
 	}
84 84
 
85 85
 	// Setup the customer address, if present
86 86
 	$address = array();
87
-	if ( intval( $customer_info['user_id'] ) > 0 ) {
87
+	if (intval($customer_info['user_id']) > 0) {
88 88
 
89
-		$current_address = get_user_meta( $customer_info['user_id'], '_give_user_address', true );
89
+		$current_address = get_user_meta($customer_info['user_id'], '_give_user_address', true);
90 90
 
91
-		if ( false === $current_address ) {
92
-			$address['line1']   = isset( $customer_info['line1'] ) ? $customer_info['line1'] : '';
93
-			$address['line2']   = isset( $customer_info['line2'] ) ? $customer_info['line2'] : '';
94
-			$address['city']    = isset( $customer_info['city'] ) ? $customer_info['city'] : '';
95
-			$address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : '';
96
-			$address['zip']     = isset( $customer_info['zip'] ) ? $customer_info['zip'] : '';
97
-			$address['state']   = isset( $customer_info['state'] ) ? $customer_info['state'] : '';
91
+		if (false === $current_address) {
92
+			$address['line1']   = isset($customer_info['line1']) ? $customer_info['line1'] : '';
93
+			$address['line2']   = isset($customer_info['line2']) ? $customer_info['line2'] : '';
94
+			$address['city']    = isset($customer_info['city']) ? $customer_info['city'] : '';
95
+			$address['country'] = isset($customer_info['country']) ? $customer_info['country'] : '';
96
+			$address['zip']     = isset($customer_info['zip']) ? $customer_info['zip'] : '';
97
+			$address['state']   = isset($customer_info['state']) ? $customer_info['state'] : '';
98 98
 		} else {
99
-			$current_address    = wp_parse_args( $current_address, array(
99
+			$current_address    = wp_parse_args($current_address, array(
100 100
 				'line1',
101 101
 				'line2',
102 102
 				'city',
103 103
 				'zip',
104 104
 				'state',
105 105
 				'country'
106
-			) );
107
-			$address['line1']   = isset( $customer_info['line1'] ) ? $customer_info['line1'] : $current_address['line1'];
108
-			$address['line2']   = isset( $customer_info['line2'] ) ? $customer_info['line2'] : $current_address['line2'];
109
-			$address['city']    = isset( $customer_info['city'] ) ? $customer_info['city'] : $current_address['city'];
110
-			$address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : $current_address['country'];
111
-			$address['zip']     = isset( $customer_info['zip'] ) ? $customer_info['zip'] : $current_address['zip'];
112
-			$address['state']   = isset( $customer_info['state'] ) ? $customer_info['state'] : $current_address['state'];
106
+			));
107
+			$address['line1']   = isset($customer_info['line1']) ? $customer_info['line1'] : $current_address['line1'];
108
+			$address['line2']   = isset($customer_info['line2']) ? $customer_info['line2'] : $current_address['line2'];
109
+			$address['city']    = isset($customer_info['city']) ? $customer_info['city'] : $current_address['city'];
110
+			$address['country'] = isset($customer_info['country']) ? $customer_info['country'] : $current_address['country'];
111
+			$address['zip']     = isset($customer_info['zip']) ? $customer_info['zip'] : $current_address['zip'];
112
+			$address['state']   = isset($customer_info['state']) ? $customer_info['state'] : $current_address['state'];
113 113
 		}
114 114
 
115 115
 	}
116 116
 
117 117
 	// Sanitize the inputs
118 118
 	$customer_data            = array();
119
-	$customer_data['name']    = strip_tags( stripslashes( $customer_info['name'] ) );
119
+	$customer_data['name']    = strip_tags(stripslashes($customer_info['name']));
120 120
 	$customer_data['email']   = $customer_info['email'];
121 121
 	$customer_data['user_id'] = $customer_info['user_id'];
122 122
 
123
-	$customer_data = apply_filters( 'give_edit_customer_info', $customer_data, $customer_id );
124
-	$address       = apply_filters( 'give_edit_customer_address', $address, $customer_id );
123
+	$customer_data = apply_filters('give_edit_customer_info', $customer_data, $customer_id);
124
+	$address       = apply_filters('give_edit_customer_address', $address, $customer_id);
125 125
 
126
-	$customer_data = array_map( 'sanitize_text_field', $customer_data );
127
-	$address       = array_map( 'sanitize_text_field', $address );
126
+	$customer_data = array_map('sanitize_text_field', $customer_data);
127
+	$address       = array_map('sanitize_text_field', $address);
128 128
 
129
-	do_action( 'give_pre_edit_customer', $customer_id, $customer_data, $address );
129
+	do_action('give_pre_edit_customer', $customer_id, $customer_data, $address);
130 130
 
131 131
 	$output         = array();
132 132
 	$previous_email = $customer->email;
133 133
 
134
-	if ( $customer->update( $customer_data ) ) {
134
+	if ($customer->update($customer_data)) {
135 135
 
136
-		if ( ! empty( $customer->user_id ) && $customer->user_id > 0 ) {
137
-			update_user_meta( $customer->user_id, '_give_user_address', $address );
136
+		if ( ! empty($customer->user_id) && $customer->user_id > 0) {
137
+			update_user_meta($customer->user_id, '_give_user_address', $address);
138 138
 		}
139 139
 
140 140
 		// Update some payment meta if we need to
141
-		$payments_array = explode( ',', $customer->payment_ids );
141
+		$payments_array = explode(',', $customer->payment_ids);
142 142
 
143
-		if ( $customer->email != $previous_email ) {
144
-			foreach ( $payments_array as $payment_id ) {
145
-				give_update_payment_meta( $payment_id, 'email', $customer->email );
143
+		if ($customer->email != $previous_email) {
144
+			foreach ($payments_array as $payment_id) {
145
+				give_update_payment_meta($payment_id, 'email', $customer->email);
146 146
 			}
147 147
 		}
148 148
 
149
-		if ( $customer->user_id != $previous_user_id ) {
150
-			foreach ( $payments_array as $payment_id ) {
151
-				give_update_payment_meta( $payment_id, '_give_payment_user_id', $customer->user_id );
149
+		if ($customer->user_id != $previous_user_id) {
150
+			foreach ($payments_array as $payment_id) {
151
+				give_update_payment_meta($payment_id, '_give_payment_user_id', $customer->user_id);
152 152
 			}
153 153
 		}
154 154
 
155 155
 		$output['success']       = true;
156
-		$customer_data           = array_merge( $customer_data, $address );
156
+		$customer_data           = array_merge($customer_data, $address);
157 157
 		$output['customer_info'] = $customer_data;
158 158
 
159 159
 	} else {
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
 
163 163
 	}
164 164
 
165
-	do_action( 'give_post_edit_customer', $customer_id, $customer_data );
165
+	do_action('give_post_edit_customer', $customer_id, $customer_data);
166 166
 
167
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
168
-		header( 'Content-Type: application/json' );
169
-		echo json_encode( $output );
167
+	if (defined('DOING_AJAX') && DOING_AJAX) {
168
+		header('Content-Type: application/json');
169
+		echo json_encode($output);
170 170
 		wp_die();
171 171
 	}
172 172
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 
175 175
 }
176 176
 
177
-add_action( 'give_edit-customer', 'give_edit_customer', 10, 1 );
177
+add_action('give_edit-customer', 'give_edit_customer', 10, 1);
178 178
 
179 179
 /**
180 180
  * Save a customer note being added
@@ -185,53 +185,53 @@  discard block
 block discarded – undo
185 185
  *
186 186
  * @return int         The Note ID that was saved, or 0 if nothing was saved
187 187
  */
188
-function give_customer_save_note( $args ) {
188
+function give_customer_save_note($args) {
189 189
 
190
-	$customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' );
190
+	$customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports');
191 191
 
192
-	if ( ! is_admin() || ! current_user_can( $customer_view_role ) ) {
193
-		wp_die( __( 'You do not have permission to edit this donor.', 'give' ) );
192
+	if ( ! is_admin() || ! current_user_can($customer_view_role)) {
193
+		wp_die(__('You do not have permission to edit this donor.', 'give'));
194 194
 	}
195 195
 
196
-	if ( empty( $args ) ) {
196
+	if (empty($args)) {
197 197
 		return;
198 198
 	}
199 199
 
200
-	$customer_note = trim( sanitize_text_field( $args['customer_note'] ) );
200
+	$customer_note = trim(sanitize_text_field($args['customer_note']));
201 201
 	$customer_id   = (int) $args['customer_id'];
202 202
 	$nonce         = $args['add_customer_note_nonce'];
203 203
 
204
-	if ( ! wp_verify_nonce( $nonce, 'add-customer-note' ) ) {
205
-		wp_die( __( 'Cheatin\' eh?!', 'give' ) );
204
+	if ( ! wp_verify_nonce($nonce, 'add-customer-note')) {
205
+		wp_die(__('Cheatin\' eh?!', 'give'));
206 206
 	}
207 207
 
208
-	if ( empty( $customer_note ) ) {
209
-		give_set_error( 'empty-customer-note', __( 'A note is required', 'give' ) );
208
+	if (empty($customer_note)) {
209
+		give_set_error('empty-customer-note', __('A note is required', 'give'));
210 210
 	}
211 211
 
212
-	if ( give_get_errors() ) {
212
+	if (give_get_errors()) {
213 213
 		return;
214 214
 	}
215 215
 
216
-	$customer = new Give_Customer( $customer_id );
217
-	$new_note = $customer->add_note( $customer_note );
216
+	$customer = new Give_Customer($customer_id);
217
+	$new_note = $customer->add_note($customer_note);
218 218
 
219
-	do_action( 'give_pre_insert_customer_note', $customer_id, $new_note );
219
+	do_action('give_pre_insert_customer_note', $customer_id, $new_note);
220 220
 
221
-	if ( ! empty( $new_note ) && ! empty( $customer->id ) ) {
221
+	if ( ! empty($new_note) && ! empty($customer->id)) {
222 222
 
223 223
 		ob_start();
224 224
 		?>
225 225
 		<div class="customer-note-wrapper dashboard-comment-wrap comment-item">
226 226
 			<span class="note-content-wrap">
227
-				<?php echo stripslashes( $new_note ); ?>
227
+				<?php echo stripslashes($new_note); ?>
228 228
 			</span>
229 229
 		</div>
230 230
 		<?php
231 231
 		$output = ob_get_contents();
232 232
 		ob_end_clean();
233 233
 
234
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
234
+		if (defined('DOING_AJAX') && DOING_AJAX) {
235 235
 			echo $output;
236 236
 			exit;
237 237
 		}
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 
245 245
 }
246 246
 
247
-add_action( 'give_add-customer-note', 'give_customer_save_note', 10, 1 );
247
+add_action('give_add-customer-note', 'give_customer_save_note', 10, 1);
248 248
 
249 249
 /**
250 250
  * Delete a customer
@@ -255,87 +255,87 @@  discard block
 block discarded – undo
255 255
  *
256 256
  * @return int Whether it was a successful deletion
257 257
  */
258
-function give_customer_delete( $args ) {
258
+function give_customer_delete($args) {
259 259
 
260
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
260
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
261 261
 
262
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
263
-		wp_die( __( 'You do not have permission to delete this donor.', 'give' ) );
262
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
263
+		wp_die(__('You do not have permission to delete this donor.', 'give'));
264 264
 	}
265 265
 
266
-	if ( empty( $args ) ) {
266
+	if (empty($args)) {
267 267
 		return;
268 268
 	}
269 269
 
270 270
 	$customer_id = (int) $args['customer_id'];
271
-	$confirm     = ! empty( $args['give-customer-delete-confirm'] ) ? true : false;
272
-	$remove_data = ! empty( $args['give-customer-delete-records'] ) ? true : false;
271
+	$confirm     = ! empty($args['give-customer-delete-confirm']) ? true : false;
272
+	$remove_data = ! empty($args['give-customer-delete-records']) ? true : false;
273 273
 	$nonce       = $args['_wpnonce'];
274 274
 
275
-	if ( ! wp_verify_nonce( $nonce, 'delete-customer' ) ) {
276
-		wp_die( __( 'Cheatin\' eh?!', 'give' ) );
275
+	if ( ! wp_verify_nonce($nonce, 'delete-customer')) {
276
+		wp_die(__('Cheatin\' eh?!', 'give'));
277 277
 	}
278 278
 
279
-	if ( ! $confirm ) {
280
-		give_set_error( 'customer-delete-no-confirm', __( 'Please confirm you want to delete this donor', 'give' ) );
279
+	if ( ! $confirm) {
280
+		give_set_error('customer-delete-no-confirm', __('Please confirm you want to delete this donor', 'give'));
281 281
 	}
282 282
 
283
-	if ( give_get_errors() ) {
284
-		wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer_id ) );
283
+	if (give_get_errors()) {
284
+		wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer_id));
285 285
 		exit;
286 286
 	}
287 287
 
288
-	$customer = new Give_Customer( $customer_id );
288
+	$customer = new Give_Customer($customer_id);
289 289
 
290
-	do_action( 'give_pre_delete_customer', $customer_id, $confirm, $remove_data );
290
+	do_action('give_pre_delete_customer', $customer_id, $confirm, $remove_data);
291 291
 
292 292
 	$success = false;
293 293
 
294
-	if ( $customer->id > 0 ) {
294
+	if ($customer->id > 0) {
295 295
 
296
-		$payments_array = explode( ',', $customer->payment_ids );
297
-		$success        = Give()->customers->delete( $customer->id );
296
+		$payments_array = explode(',', $customer->payment_ids);
297
+		$success        = Give()->customers->delete($customer->id);
298 298
 
299
-		if ( $success ) {
299
+		if ($success) {
300 300
 
301
-			if ( $remove_data ) {
301
+			if ($remove_data) {
302 302
 
303 303
 				// Remove all payments, logs, etc
304
-				foreach ( $payments_array as $payment_id ) {
305
-					give_delete_purchase( $payment_id );
304
+				foreach ($payments_array as $payment_id) {
305
+					give_delete_purchase($payment_id);
306 306
 				}
307 307
 
308 308
 			} else {
309 309
 
310 310
 				// Just set the payments to customer_id of 0
311
-				foreach ( $payments_array as $payment_id ) {
312
-					give_update_payment_meta( $payment_id, '_give_payment_customer_id', 0 );
311
+				foreach ($payments_array as $payment_id) {
312
+					give_update_payment_meta($payment_id, '_give_payment_customer_id', 0);
313 313
 				}
314 314
 
315 315
 			}
316 316
 
317
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted' );
317
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted');
318 318
 
319 319
 		} else {
320 320
 
321
-			give_set_error( 'give-donor-delete-failed', __( 'Error deleting donor', 'give' ) );
322
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer_id );
321
+			give_set_error('give-donor-delete-failed', __('Error deleting donor', 'give'));
322
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer_id);
323 323
 
324 324
 		}
325 325
 
326 326
 	} else {
327 327
 
328
-		give_set_error( 'give-customer-delete-invalid-id', __( 'Invalid Donor ID', 'give' ) );
329
-		$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors' );
328
+		give_set_error('give-customer-delete-invalid-id', __('Invalid Donor ID', 'give'));
329
+		$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors');
330 330
 
331 331
 	}
332 332
 
333
-	wp_redirect( $redirect );
333
+	wp_redirect($redirect);
334 334
 	exit;
335 335
 
336 336
 }
337 337
 
338
-add_action( 'give_delete-customer', 'give_customer_delete', 10, 1 );
338
+add_action('give_delete-customer', 'give_customer_delete', 10, 1);
339 339
 
340 340
 /**
341 341
  * Disconnect a user ID from a donor
@@ -346,39 +346,39 @@  discard block
 block discarded – undo
346 346
  *
347 347
  * @return bool        If the disconnect was successful
348 348
  */
349
-function give_disconnect_customer_user_id( $args ) {
349
+function give_disconnect_customer_user_id($args) {
350 350
 
351
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
351
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
352 352
 
353
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
354
-		wp_die( __( 'You do not have permission to edit this donor.', 'give' ) );
353
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
354
+		wp_die(__('You do not have permission to edit this donor.', 'give'));
355 355
 	}
356 356
 
357
-	if ( empty( $args ) ) {
357
+	if (empty($args)) {
358 358
 		return;
359 359
 	}
360 360
 
361 361
 	$customer_id = (int) $args['customer_id'];
362 362
 	$nonce       = $args['_wpnonce'];
363 363
 
364
-	if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) {
365
-		wp_die( __( 'Cheatin\' eh?!', 'give' ) );
364
+	if ( ! wp_verify_nonce($nonce, 'edit-customer')) {
365
+		wp_die(__('Cheatin\' eh?!', 'give'));
366 366
 	}
367 367
 
368
-	$customer = new Give_Customer( $customer_id );
369
-	if ( empty( $customer->id ) ) {
368
+	$customer = new Give_Customer($customer_id);
369
+	if (empty($customer->id)) {
370 370
 		return false;
371 371
 	}
372 372
 
373
-	do_action( 'give_pre_customer_disconnect_user_id', $customer_id, $customer->user_id );
373
+	do_action('give_pre_customer_disconnect_user_id', $customer_id, $customer->user_id);
374 374
 
375
-	$customer_args = array( 'user_id' => 0 );
375
+	$customer_args = array('user_id' => 0);
376 376
 
377
-	if ( $customer->update( $customer_args ) ) {
377
+	if ($customer->update($customer_args)) {
378 378
 		global $wpdb;
379 379
 
380
-		if ( ! empty( $customer->payment_ids ) ) {
381
-			$wpdb->query( "UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )" );
380
+		if ( ! empty($customer->payment_ids)) {
381
+			$wpdb->query("UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )");
382 382
 		}
383 383
 
384 384
 		$output['success'] = true;
@@ -386,14 +386,14 @@  discard block
 block discarded – undo
386 386
 	} else {
387 387
 
388 388
 		$output['success'] = false;
389
-		give_set_error( 'give-disconnect-user-fail', __( 'Failed to disconnect user from donor', 'give' ) );
389
+		give_set_error('give-disconnect-user-fail', __('Failed to disconnect user from donor', 'give'));
390 390
 	}
391 391
 
392
-	do_action( 'give_post_customer_disconnect_user_id', $customer_id );
392
+	do_action('give_post_customer_disconnect_user_id', $customer_id);
393 393
 
394
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
395
-		header( 'Content-Type: application/json' );
396
-		echo json_encode( $output );
394
+	if (defined('DOING_AJAX') && DOING_AJAX) {
395
+		header('Content-Type: application/json');
396
+		echo json_encode($output);
397 397
 		wp_die();
398 398
 	}
399 399
 
@@ -401,4 +401,4 @@  discard block
 block discarded – undo
401 401
 
402 402
 }
403 403
 
404
-add_action( 'give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1 );
404
+add_action('give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1);
Please login to merge, or discard this patch.
includes/admin/payments/actions.php 1 patch
Spacing   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -26,106 +26,106 @@  discard block
 block discarded – undo
26 26
  * @return      void
27 27
  *
28 28
  */
29
-function give_update_payment_details( $data ) {
29
+function give_update_payment_details($data) {
30 30
 
31
-	if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) {
32
-		wp_die( __( 'You do not have permission to edit this payment record', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
31
+	if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) {
32
+		wp_die(__('You do not have permission to edit this payment record', 'give'), __('Error', 'give'), array('response' => 403));
33 33
 	}
34 34
 
35
-	check_admin_referer( 'give_update_payment_details_nonce' );
35
+	check_admin_referer('give_update_payment_details_nonce');
36 36
 
37 37
 	// Retrieve the payment ID
38
-	$payment_id = absint( $data['give_payment_id'] );
39
-	$payment    = new Give_Payment( $payment_id );
38
+	$payment_id = absint($data['give_payment_id']);
39
+	$payment    = new Give_Payment($payment_id);
40 40
 
41 41
 	// Retrieve existing payment meta
42 42
 	$meta      = $payment->get_meta();
43 43
 	$user_info = $payment->user_info;
44 44
 
45 45
 	$status = $data['give-payment-status'];
46
-	$date   = sanitize_text_field( $data['give-payment-date'] );
47
-	$hour   = sanitize_text_field( $data['give-payment-time-hour'] );
46
+	$date   = sanitize_text_field($data['give-payment-date']);
47
+	$hour   = sanitize_text_field($data['give-payment-time-hour']);
48 48
 
49 49
 	// Restrict to our high and low
50
-	if ( $hour > 23 ) {
50
+	if ($hour > 23) {
51 51
 		$hour = 23;
52
-	} elseif ( $hour < 0 ) {
52
+	} elseif ($hour < 0) {
53 53
 		$hour = 00;
54 54
 	}
55 55
 
56
-	$minute = sanitize_text_field( $data['give-payment-time-min'] );
56
+	$minute = sanitize_text_field($data['give-payment-time-min']);
57 57
 
58 58
 	// Restrict to our high and low
59
-	if ( $minute > 59 ) {
59
+	if ($minute > 59) {
60 60
 		$minute = 59;
61
-	} elseif ( $minute < 0 ) {
61
+	} elseif ($minute < 0) {
62 62
 		$minute = 00;
63 63
 	}
64 64
 
65
-	$address = array_map( 'trim', $data['give-payment-address'][0] );
65
+	$address = array_map('trim', $data['give-payment-address'][0]);
66 66
 
67
-	$curr_total = give_sanitize_amount( $payment->total );
68
-	$new_total  = give_sanitize_amount( $_POST['give-payment-total'] );
69
-	$date       = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00';
67
+	$curr_total = give_sanitize_amount($payment->total);
68
+	$new_total  = give_sanitize_amount($_POST['give-payment-total']);
69
+	$date       = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00';
70 70
 
71
-	$curr_customer_id = sanitize_text_field( $data['give-current-customer'] );
72
-	$new_customer_id  = sanitize_text_field( $data['customer-id'] );
71
+	$curr_customer_id = sanitize_text_field($data['give-current-customer']);
72
+	$new_customer_id  = sanitize_text_field($data['customer-id']);
73 73
 
74
-	do_action( 'give_update_edited_purchase', $payment_id );
74
+	do_action('give_update_edited_purchase', $payment_id);
75 75
 
76 76
 	$payment->date = $date;
77 77
 	$updated       = $payment->save();
78 78
 
79
-	if ( 0 === $updated ) {
80
-		wp_die( esc_attr__( 'Error Updating Payment', 'give' ), esc_attr__( 'Error', 'give' ), array( 'response' => 400 ) );
79
+	if (0 === $updated) {
80
+		wp_die(esc_attr__('Error Updating Payment', 'give'), esc_attr__('Error', 'give'), array('response' => 400));
81 81
 	}
82 82
 
83 83
 	$customer_changed = false;
84 84
 
85
-	if ( isset( $data['give-new-customer'] ) && $data['give-new-customer'] == '1' ) {
85
+	if (isset($data['give-new-customer']) && $data['give-new-customer'] == '1') {
86 86
 
87
-		$email = isset( $data['give-new-customer-email'] ) ? sanitize_text_field( $data['give-new-customer-email'] ) : '';
88
-		$names = isset( $data['give-new-customer-name'] ) ? sanitize_text_field( $data['give-new-customer-name'] ) : '';
87
+		$email = isset($data['give-new-customer-email']) ? sanitize_text_field($data['give-new-customer-email']) : '';
88
+		$names = isset($data['give-new-customer-name']) ? sanitize_text_field($data['give-new-customer-name']) : '';
89 89
 
90
-		if ( empty( $email ) || empty( $names ) ) {
91
-			wp_die( esc_attr__( 'New Customers require a name and email address', 'give' ) );
90
+		if (empty($email) || empty($names)) {
91
+			wp_die(esc_attr__('New Customers require a name and email address', 'give'));
92 92
 		}
93 93
 
94
-		$customer = new Give_Customer( $email );
95
-		if ( empty( $customer->id ) ) {
96
-			$customer_data = array( 'name' => $names, 'email' => $email );
97
-			$user_id       = email_exists( $email );
98
-			if ( false !== $user_id ) {
94
+		$customer = new Give_Customer($email);
95
+		if (empty($customer->id)) {
96
+			$customer_data = array('name' => $names, 'email' => $email);
97
+			$user_id       = email_exists($email);
98
+			if (false !== $user_id) {
99 99
 				$customer_data['user_id'] = $user_id;
100 100
 			}
101 101
 
102
-			if ( ! $customer->create( $customer_data ) ) {
102
+			if ( ! $customer->create($customer_data)) {
103 103
 				// Failed to crete the new donor, assume the previous donor
104 104
 				$customer_changed = false;
105
-				$customer         = new Give_Customer( $curr_customer_id );
106
-				give_set_error( 'give-payment-new-customer-fail', __( 'Error creating new donor', 'give' ) );
105
+				$customer         = new Give_Customer($curr_customer_id);
106
+				give_set_error('give-payment-new-customer-fail', __('Error creating new donor', 'give'));
107 107
 			}
108 108
 		}
109 109
 
110 110
 		$new_customer_id = $customer->id;
111 111
 
112
-		$previous_customer = new Give_Customer( $curr_customer_id );
112
+		$previous_customer = new Give_Customer($curr_customer_id);
113 113
 
114 114
 		$customer_changed = true;
115 115
 
116
-	} elseif ( $curr_customer_id !== $new_customer_id ) {
116
+	} elseif ($curr_customer_id !== $new_customer_id) {
117 117
 
118
-		$customer = new Give_Customer( $new_customer_id );
118
+		$customer = new Give_Customer($new_customer_id);
119 119
 		$email    = $customer->email;
120 120
 		$names    = $customer->name;
121 121
 
122
-		$previous_customer = new Give_Customer( $curr_customer_id );
122
+		$previous_customer = new Give_Customer($curr_customer_id);
123 123
 
124 124
 		$customer_changed = true;
125 125
 
126 126
 	} else {
127 127
 
128
-		$customer = new Give_Customer( $curr_customer_id );
128
+		$customer = new Give_Customer($curr_customer_id);
129 129
 		$email    = $customer->email;
130 130
 		$names    = $customer->name;
131 131
 
@@ -133,29 +133,29 @@  discard block
 block discarded – undo
133 133
 
134 134
 
135 135
 	// Setup first and last name from input values
136
-	$names      = explode( ' ', $names );
137
-	$first_name = ! empty( $names[0] ) ? $names[0] : '';
136
+	$names      = explode(' ', $names);
137
+	$first_name = ! empty($names[0]) ? $names[0] : '';
138 138
 	$last_name  = '';
139
-	if ( ! empty( $names[1] ) ) {
140
-		unset( $names[0] );
141
-		$last_name = implode( ' ', $names );
139
+	if ( ! empty($names[1])) {
140
+		unset($names[0]);
141
+		$last_name = implode(' ', $names);
142 142
 	}
143 143
 
144 144
 
145
-	if ( $customer_changed ) {
145
+	if ($customer_changed) {
146 146
 
147 147
 		// Remove the stats and payment from the previous customer and attach it to the new customer
148
-		$previous_customer->remove_payment( $payment_id, false );
149
-		$customer->attach_payment( $payment_id, false );
148
+		$previous_customer->remove_payment($payment_id, false);
149
+		$customer->attach_payment($payment_id, false);
150 150
 
151 151
 		// If purchase was completed and not ever refunded, adjust stats of customers
152
-		if ( 'revoked' == $status || 'publish' == $status ) {
152
+		if ('revoked' == $status || 'publish' == $status) {
153 153
 
154 154
 			$previous_customer->decrease_purchase_count();
155
-			$previous_customer->decrease_value( $new_total );
155
+			$previous_customer->decrease_value($new_total);
156 156
 
157 157
 			$customer->increase_purchase_count();
158
-			$customer->increase_value( $new_total );
158
+			$customer->increase_value($new_total);
159 159
 		}
160 160
 
161 161
 		$payment->customer_id = $customer->id;
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
 
172 172
 
173 173
 	// Check for payment notes
174
-	if ( ! empty( $data['give-payment-note'] ) ) {
174
+	if ( ! empty($data['give-payment-note'])) {
175 175
 
176
-		$note = wp_kses( $data['give-payment-note'], array() );
177
-		give_insert_payment_note( $payment_id, $note );
176
+		$note = wp_kses($data['give-payment-note'], array());
177
+		give_insert_payment_note($payment_id, $note);
178 178
 
179 179
 	}
180 180
 
@@ -182,17 +182,17 @@  discard block
 block discarded – undo
182 182
 	$payment->status = $status;
183 183
 
184 184
 	// Adjust total store earnings if the payment total has been changed
185
-	if ( $new_total !== $curr_total && ( 'publish' == $status || 'revoked' == $status ) ) {
185
+	if ($new_total !== $curr_total && ('publish' == $status || 'revoked' == $status)) {
186 186
 
187
-		if ( $new_total > $curr_total ) {
187
+		if ($new_total > $curr_total) {
188 188
 			// Increase if our new total is higher
189 189
 			$difference = $new_total - $curr_total;
190
-			give_increase_total_earnings( $difference );
190
+			give_increase_total_earnings($difference);
191 191
 
192
-		} elseif ( $curr_total > $new_total ) {
192
+		} elseif ($curr_total > $new_total) {
193 193
 			// Decrease if our new total is lower
194 194
 			$difference = $curr_total - $new_total;
195
-			give_decrease_total_earnings( $difference );
195
+			give_decrease_total_earnings($difference);
196 196
 
197 197
 		}
198 198
 
@@ -200,13 +200,13 @@  discard block
 block discarded – undo
200 200
 
201 201
 	$payment->save();
202 202
 
203
-	do_action( 'give_updated_edited_purchase', $payment_id );
203
+	do_action('give_updated_edited_purchase', $payment_id);
204 204
 
205
-	wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id=' . $payment_id ) );
205
+	wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id='.$payment_id));
206 206
 	exit;
207 207
 }
208 208
 
209
-add_action( 'give_update_payment_details', 'give_update_payment_details' );
209
+add_action('give_update_payment_details', 'give_update_payment_details');
210 210
 
211 211
 /**
212 212
  * Trigger a Purchase Deletion
@@ -217,48 +217,48 @@  discard block
 block discarded – undo
217 217
  *
218 218
  * @return void
219 219
  */
220
-function give_trigger_purchase_delete( $data ) {
221
-	if ( wp_verify_nonce( $data['_wpnonce'], 'give_payment_nonce' ) ) {
220
+function give_trigger_purchase_delete($data) {
221
+	if (wp_verify_nonce($data['_wpnonce'], 'give_payment_nonce')) {
222 222
 
223
-		$payment_id = absint( $data['purchase_id'] );
223
+		$payment_id = absint($data['purchase_id']);
224 224
 
225
-		if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
226
-			wp_die( __( 'You do not have permission to edit this payment record', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
225
+		if ( ! current_user_can('edit_give_payments', $payment_id)) {
226
+			wp_die(__('You do not have permission to edit this payment record', 'give'), __('Error', 'give'), array('response' => 403));
227 227
 		}
228 228
 
229
-		give_delete_purchase( $payment_id );
230
-		wp_redirect( admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&give-message=payment_deleted' ) );
229
+		give_delete_purchase($payment_id);
230
+		wp_redirect(admin_url('/edit.php?post_type=give_forms&page=give-payment-history&give-message=payment_deleted'));
231 231
 		give_die();
232 232
 	}
233 233
 }
234 234
 
235
-add_action( 'give_delete_payment', 'give_trigger_purchase_delete' );
235
+add_action('give_delete_payment', 'give_trigger_purchase_delete');
236 236
 
237 237
 /**
238 238
  * AJAX Store Payment Note
239 239
  */
240 240
 function give_ajax_store_payment_note() {
241 241
 
242
-	$payment_id = absint( $_POST['payment_id'] );
243
-	$note       = wp_kses( $_POST['note'], array() );
242
+	$payment_id = absint($_POST['payment_id']);
243
+	$note       = wp_kses($_POST['note'], array());
244 244
 
245
-	if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
246
-		wp_die( __( 'You do not have permission to edit this payment record', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
245
+	if ( ! current_user_can('edit_give_payments', $payment_id)) {
246
+		wp_die(__('You do not have permission to edit this payment record', 'give'), __('Error', 'give'), array('response' => 403));
247 247
 	}
248 248
 
249
-	if ( empty( $payment_id ) ) {
250
-		die( '-1' );
249
+	if (empty($payment_id)) {
250
+		die('-1');
251 251
 	}
252 252
 
253
-	if ( empty( $note ) ) {
254
-		die( '-1' );
253
+	if (empty($note)) {
254
+		die('-1');
255 255
 	}
256 256
 
257
-	$note_id = give_insert_payment_note( $payment_id, $note );
258
-	die( give_get_payment_note_html( $note_id ) );
257
+	$note_id = give_insert_payment_note($payment_id, $note);
258
+	die(give_get_payment_note_html($note_id));
259 259
 }
260 260
 
261
-add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' );
261
+add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note');
262 262
 
263 263
 /**
264 264
  * Triggers a payment note deletion without ajax
@@ -269,24 +269,24 @@  discard block
 block discarded – undo
269 269
  *
270 270
  * @return void
271 271
  */
272
-function give_trigger_payment_note_deletion( $data ) {
272
+function give_trigger_payment_note_deletion($data) {
273 273
 
274
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) {
274
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) {
275 275
 		return;
276 276
 	}
277 277
 
278
-	if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) {
279
-		wp_die( __( 'You do not have permission to edit this payment record', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
278
+	if ( ! current_user_can('edit_give_payments', $data['payment_id'])) {
279
+		wp_die(__('You do not have permission to edit this payment record', 'give'), __('Error', 'give'), array('response' => 403));
280 280
 	}
281 281
 
282
-	$edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-note-deleted&id=' . absint( $data['payment_id'] ) );
282
+	$edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-note-deleted&id='.absint($data['payment_id']));
283 283
 
284
-	give_delete_payment_note( $data['note_id'], $data['payment_id'] );
284
+	give_delete_payment_note($data['note_id'], $data['payment_id']);
285 285
 
286
-	wp_redirect( $edit_order_url );
286
+	wp_redirect($edit_order_url);
287 287
 }
288 288
 
289
-add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' );
289
+add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion');
290 290
 
291 291
 /**
292 292
  * Delete a payment note deletion with ajax
@@ -299,16 +299,16 @@  discard block
 block discarded – undo
299 299
  */
300 300
 function give_ajax_delete_payment_note() {
301 301
 
302
-	if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) {
303
-		wp_die( __( 'You do not have permission to edit this payment record', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
302
+	if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) {
303
+		wp_die(__('You do not have permission to edit this payment record', 'give'), __('Error', 'give'), array('response' => 403));
304 304
 	}
305 305
 
306
-	if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) {
307
-		die( '1' );
306
+	if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) {
307
+		die('1');
308 308
 	} else {
309
-		die( '-1' );
309
+		die('-1');
310 310
 	}
311 311
 
312 312
 }
313 313
 
314
-add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' );
315 314
\ No newline at end of file
315
+add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note');
316 316
\ No newline at end of file
Please login to merge, or discard this patch.