Completed
Push — master ( 2d0d2e...7b2edb )
by Devin
17:50
created
includes/misc-functions.php 1 patch
Spacing   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 	$ret = give_get_option('test_mode', false);
27 27
 
28
-	return (bool) apply_filters( 'give_is_test_mode', $ret );
28
+	return (bool) apply_filters('give_is_test_mode', $ret);
29 29
 
30 30
 }
31 31
 
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
  */
38 38
 function give_get_currency() {
39 39
 
40
-	$currency = give_get_option( 'currency', 'USD' );
40
+	$currency = give_get_option('currency', 'USD');
41 41
 
42
-	return apply_filters( 'give_currency', $currency );
42
+	return apply_filters('give_currency', $currency);
43 43
 }
44 44
 
45 45
 /**
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
  */
52 52
 function give_get_currency_position() {
53 53
 
54
-	$currency_pos = give_get_option( 'currency_position', 'before' );
54
+	$currency_pos = give_get_option('currency_position', 'before');
55 55
 
56
-	return apply_filters( 'give_currency_position', $currency_pos );
56
+	return apply_filters('give_currency_position', $currency_pos);
57 57
 }
58 58
 
59 59
 
@@ -66,39 +66,39 @@  discard block
 block discarded – undo
66 66
 
67 67
 function give_get_currencies() {
68 68
 	$currencies = array(
69
-		'USD'  => esc_html__( 'US Dollars ($)', 'give' ),
70
-		'EUR'  => esc_html__( 'Euros (€)', 'give' ),
71
-		'GBP'  => esc_html__( 'Pounds Sterling (£)', 'give' ),
72
-		'AUD'  => esc_html__( 'Australian Dollars ($)', 'give' ),
73
-		'BRL'  => esc_html__( 'Brazilian Real (R$)', 'give' ),
74
-		'CAD'  => esc_html__( 'Canadian Dollars ($)', 'give' ),
75
-		'CZK'  => esc_html__( 'Czech Koruna (Kč)', 'give' ),
76
-		'DKK'  => esc_html__( 'Danish Krone (kr)', 'give' ),
77
-		'HKD'  => esc_html__( 'Hong Kong Dollar ($)', 'give' ),
78
-		'HUF'  => esc_html__( 'Hungarian Forint (Ft)', 'give' ),
79
-		'ILS'  => esc_html__( 'Israeli Shekel (₪)', 'give' ),
80
-		'JPY'  => esc_html__( 'Japanese Yen (¥)', 'give' ),
81
-		'MYR'  => esc_html__( 'Malaysian Ringgits (RM)', 'give' ),
82
-		'MXN'  => esc_html__( 'Mexican Peso ($)', 'give' ),
83
-		'MAD'  => esc_html__( 'Moroccan Dirham (.د.م)', 'give' ),
84
-		'NZD'  => esc_html__( 'New Zealand Dollar ($)', 'give' ),
85
-		'NOK'  => esc_html__( 'Norwegian Krone (Kr.)', 'give' ),
86
-		'PHP'  => esc_html__( 'Philippine Pesos (₱)', 'give' ),
87
-		'PLN'  => esc_html__( 'Polish Zloty (zł)', 'give' ),
88
-		'SGD'  => esc_html__( 'Singapore Dollar ($)', 'give' ),
89
-		'KRW'  => esc_html__( 'South Korean Won (₩)', 'give' ),
90
-		'ZAR'  => esc_html__( 'South African Rand (R)', 'give' ),
91
-		'SEK'  => esc_html__( 'Swedish Krona (kr)', 'give' ),
92
-		'CHF'  => esc_html__( 'Swiss Franc (CHF)', 'give' ),
93
-		'TWD'  => esc_html__( 'Taiwan New Dollars (NT$)', 'give' ),
94
-		'THB'  => esc_html__( 'Thai Baht (฿)', 'give' ),
95
-		'INR'  => esc_html__( 'Indian Rupee (₹)', 'give' ),
96
-		'TRY'  => esc_html__( 'Turkish Lira (₺)', 'give' ),
97
-		'RIAL' => esc_html__( 'Iranian Rial (﷼)', 'give' ),
98
-		'RUB'  => esc_html__( 'Russian Rubles (руб)', 'give' )
69
+		'USD'  => esc_html__('US Dollars ($)', 'give'),
70
+		'EUR'  => esc_html__('Euros (€)', 'give'),
71
+		'GBP'  => esc_html__('Pounds Sterling (£)', 'give'),
72
+		'AUD'  => esc_html__('Australian Dollars ($)', 'give'),
73
+		'BRL'  => esc_html__('Brazilian Real (R$)', 'give'),
74
+		'CAD'  => esc_html__('Canadian Dollars ($)', 'give'),
75
+		'CZK'  => esc_html__('Czech Koruna (Kč)', 'give'),
76
+		'DKK'  => esc_html__('Danish Krone (kr)', 'give'),
77
+		'HKD'  => esc_html__('Hong Kong Dollar ($)', 'give'),
78
+		'HUF'  => esc_html__('Hungarian Forint (Ft)', 'give'),
79
+		'ILS'  => esc_html__('Israeli Shekel (₪)', 'give'),
80
+		'JPY'  => esc_html__('Japanese Yen (¥)', 'give'),
81
+		'MYR'  => esc_html__('Malaysian Ringgits (RM)', 'give'),
82
+		'MXN'  => esc_html__('Mexican Peso ($)', 'give'),
83
+		'MAD'  => esc_html__('Moroccan Dirham (.د.م)', 'give'),
84
+		'NZD'  => esc_html__('New Zealand Dollar ($)', 'give'),
85
+		'NOK'  => esc_html__('Norwegian Krone (Kr.)', 'give'),
86
+		'PHP'  => esc_html__('Philippine Pesos (₱)', 'give'),
87
+		'PLN'  => esc_html__('Polish Zloty (zł)', 'give'),
88
+		'SGD'  => esc_html__('Singapore Dollar ($)', 'give'),
89
+		'KRW'  => esc_html__('South Korean Won (₩)', 'give'),
90
+		'ZAR'  => esc_html__('South African Rand (R)', 'give'),
91
+		'SEK'  => esc_html__('Swedish Krona (kr)', 'give'),
92
+		'CHF'  => esc_html__('Swiss Franc (CHF)', 'give'),
93
+		'TWD'  => esc_html__('Taiwan New Dollars (NT$)', 'give'),
94
+		'THB'  => esc_html__('Thai Baht (฿)', 'give'),
95
+		'INR'  => esc_html__('Indian Rupee (₹)', 'give'),
96
+		'TRY'  => esc_html__('Turkish Lira (₺)', 'give'),
97
+		'RIAL' => esc_html__('Iranian Rial (﷼)', 'give'),
98
+		'RUB'  => esc_html__('Russian Rubles (руб)', 'give')
99 99
 	);
100 100
 
101
-	return apply_filters( 'give_currencies', $currencies );
101
+	return apply_filters('give_currencies', $currencies);
102 102
 }
103 103
 
104 104
 
@@ -113,12 +113,12 @@  discard block
 block discarded – undo
113 113
  *
114 114
  * @return string           The symbol to use for the currency
115 115
  */
116
-function give_currency_symbol( $currency = '' ) {
116
+function give_currency_symbol($currency = '') {
117 117
 
118
-	if ( empty( $currency ) ) {
118
+	if (empty($currency)) {
119 119
 		$currency = give_get_currency();
120 120
 	}
121
-	switch ( $currency ) :
121
+	switch ($currency) :
122 122
 		case 'GBP' :
123 123
 			$symbol = '£';
124 124
 			break;
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	endswitch;
198 198
 
199 199
 
200
-	return apply_filters( 'give_currency_symbol', $symbol, $currency );
200
+	return apply_filters('give_currency_symbol', $symbol, $currency);
201 201
 }
202 202
 
203 203
 
@@ -209,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 esc_html_e( 'Thanks for Subscribing!', 'give' ); ?> :)</p>
606
+				<p><?php esc_html_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
  * 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.