Completed
Push — master ( c80a59...a2d76a )
by Devin
12:14
created
includes/misc-functions.php 1 patch
Spacing   +154 added lines, -154 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
 
@@ -65,36 +65,36 @@  discard block
 block discarded – undo
65 65
  */
66 66
 function give_get_currencies() {
67 67
 	$currencies = array(
68
-		'USD'  => __( 'US Dollars ($)', 'give' ),
69
-		'EUR'  => __( 'Euros (€)', 'give' ),
70
-		'GBP'  => __( 'Pounds Sterling (£)', 'give' ),
71
-		'AUD'  => __( 'Australian Dollars ($)', 'give' ),
72
-		'BRL'  => __( 'Brazilian Real (R$)', 'give' ),
73
-		'CAD'  => __( 'Canadian Dollars ($)', 'give' ),
74
-		'CZK'  => __( 'Czech Koruna (Kč)', 'give' ),
75
-		'DKK'  => __( 'Danish Krone (kr)', 'give' ),
76
-		'HKD'  => __( 'Hong Kong Dollar ($)', 'give' ),
77
-		'HUF'  => __( 'Hungarian Forint (Ft)', 'give' ),
78
-		'ILS'  => __( 'Israeli Shekel (₪)', 'give' ),
79
-		'JPY'  => __( 'Japanese Yen (¥)', 'give' ),
80
-		'MYR'  => __( 'Malaysian Ringgits (RM)', 'give' ),
81
-		'MXN'  => __( 'Mexican Peso ($)', 'give' ),
82
-		'NZD'  => __( 'New Zealand Dollar ($)', 'give' ),
83
-		'NOK'  => __( 'Norwegian Krone (Kr.)', 'give' ),
84
-		'PHP'  => __( 'Philippine Pesos (₱)', 'give' ),
85
-		'PLN'  => __( 'Polish Zloty (zł)', 'give' ),
86
-		'SGD'  => __( 'Singapore Dollar ($)', 'give' ),
87
-		'SEK'  => __( 'Swedish Krona (kr)', 'give' ),
88
-		'CHF'  => __( 'Swiss Franc (CHF)', 'give' ),
89
-		'TWD'  => __( 'Taiwan New Dollars (NT$)', 'give' ),
90
-		'THB'  => __( 'Thai Baht (฿)', 'give' ),
91
-		'INR'  => __( 'Indian Rupee (₹)', 'give' ),
92
-		'TRY'  => __( 'Turkish Lira (₺)', 'give' ),
93
-		'RIAL' => __( 'Iranian Rial (﷼)', 'give' ),
94
-		'RUB'  => __( 'Russian Rubles (руб)', 'give' )
68
+		'USD'  => __('US Dollars ($)', 'give'),
69
+		'EUR'  => __('Euros (€)', 'give'),
70
+		'GBP'  => __('Pounds Sterling (£)', 'give'),
71
+		'AUD'  => __('Australian Dollars ($)', 'give'),
72
+		'BRL'  => __('Brazilian Real (R$)', 'give'),
73
+		'CAD'  => __('Canadian Dollars ($)', 'give'),
74
+		'CZK'  => __('Czech Koruna (Kč)', 'give'),
75
+		'DKK'  => __('Danish Krone (kr)', 'give'),
76
+		'HKD'  => __('Hong Kong Dollar ($)', 'give'),
77
+		'HUF'  => __('Hungarian Forint (Ft)', 'give'),
78
+		'ILS'  => __('Israeli Shekel (₪)', 'give'),
79
+		'JPY'  => __('Japanese Yen (¥)', 'give'),
80
+		'MYR'  => __('Malaysian Ringgits (RM)', 'give'),
81
+		'MXN'  => __('Mexican Peso ($)', 'give'),
82
+		'NZD'  => __('New Zealand Dollar ($)', 'give'),
83
+		'NOK'  => __('Norwegian Krone (Kr.)', 'give'),
84
+		'PHP'  => __('Philippine Pesos (₱)', 'give'),
85
+		'PLN'  => __('Polish Zloty (zł)', 'give'),
86
+		'SGD'  => __('Singapore Dollar ($)', 'give'),
87
+		'SEK'  => __('Swedish Krona (kr)', 'give'),
88
+		'CHF'  => __('Swiss Franc (CHF)', 'give'),
89
+		'TWD'  => __('Taiwan New Dollars (NT$)', 'give'),
90
+		'THB'  => __('Thai Baht (฿)', 'give'),
91
+		'INR'  => __('Indian Rupee (₹)', 'give'),
92
+		'TRY'  => __('Turkish Lira (₺)', 'give'),
93
+		'RIAL' => __('Iranian Rial (﷼)', 'give'),
94
+		'RUB'  => __('Russian Rubles (руб)', 'give')
95 95
 	);
96 96
 
97
-	return apply_filters( 'give_currencies', $currencies );
97
+	return apply_filters('give_currencies', $currencies);
98 98
 }
99 99
 
100 100
 
@@ -109,12 +109,12 @@  discard block
 block discarded – undo
109 109
  *
110 110
  * @return string           The symbol to use for the currency
111 111
  */
112
-function give_currency_symbol( $currency = '' ) {
112
+function give_currency_symbol($currency = '') {
113 113
 
114
-	if ( empty( $currency ) ) {
114
+	if (empty($currency)) {
115 115
 		$currency = give_get_currency();
116 116
 	}
117
-	switch ( $currency ) :
117
+	switch ($currency) :
118 118
 		case 'GBP' :
119 119
 			$symbol = '£';
120 120
 			break;
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 			break;
184 184
 	endswitch;
185 185
 
186
-	return apply_filters( 'give_currency_symbol', $symbol, $currency );
186
+	return apply_filters('give_currency_symbol', $symbol, $currency);
187 187
 }
188 188
 
189 189
 
@@ -195,13 +195,13 @@  discard block
 block discarded – undo
195 195
  */
196 196
 function give_get_current_page_url() {
197 197
 
198
-	if ( is_front_page() ) {
199
-		$current_url = home_url( '/' );
198
+	if (is_front_page()) {
199
+		$current_url = home_url('/');
200 200
 	} else {
201
-		$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
201
+		$current_url = (is_ssl() ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
202 202
 	}
203 203
 
204
-	return apply_filters( 'give_get_current_page_url', esc_url( $current_url ) );
204
+	return apply_filters('give_get_current_page_url', esc_url($current_url));
205 205
 }
206 206
 
207 207
 
@@ -222,15 +222,15 @@  discard block
 block discarded – undo
222 222
 	 */
223 223
 	$gateways = give_get_enabled_payment_gateways();
224 224
 
225
-	if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) {
225
+	if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) {
226 226
 		$ret = true;
227
-	} else if ( count( $gateways ) == 1 ) {
227
+	} else if (count($gateways) == 1) {
228 228
 		$ret = false;
229
-	} else if ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) {
229
+	} else if (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) {
230 230
 		$ret = false;
231 231
 	}
232 232
 
233
-	return (bool) apply_filters( 'give_verify_credit_cards', $ret );
233
+	return (bool) apply_filters('give_verify_credit_cards', $ret);
234 234
 }
235 235
 
236 236
 
@@ -245,9 +245,9 @@  discard block
 block discarded – undo
245 245
 
246 246
 	global $give_options;
247 247
 
248
-	$ret = ! empty( $give_options['logged_in_only'] );
248
+	$ret = ! empty($give_options['logged_in_only']);
249 249
 
250
-	return (bool) apply_filters( 'give_logged_in_only', $ret );
250
+	return (bool) apply_filters('give_logged_in_only', $ret);
251 251
 
252 252
 }
253 253
 
@@ -261,26 +261,26 @@  discard block
 block discarded – undo
261 261
 function give_get_timezone_id() {
262 262
 
263 263
 	// if site timezone string exists, return it
264
-	if ( $timezone = get_option( 'timezone_string' ) ) {
264
+	if ($timezone = get_option('timezone_string')) {
265 265
 		return $timezone;
266 266
 	}
267 267
 
268 268
 	// get UTC offset, if it isn't set return UTC
269
-	if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) {
269
+	if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) {
270 270
 		return 'UTC';
271 271
 	}
272 272
 
273 273
 	// attempt to guess the timezone string from the UTC offset
274
-	$timezone = timezone_name_from_abbr( '', $utc_offset );
274
+	$timezone = timezone_name_from_abbr('', $utc_offset);
275 275
 
276 276
 	// last try, guess timezone string manually
277
-	if ( $timezone === false ) {
277
+	if ($timezone === false) {
278 278
 
279
-		$is_dst = date( 'I' );
279
+		$is_dst = date('I');
280 280
 
281
-		foreach ( timezone_abbreviations_list() as $abbr ) {
282
-			foreach ( $abbr as $city ) {
283
-				if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) {
281
+		foreach (timezone_abbreviations_list() as $abbr) {
282
+			foreach ($abbr as $city) {
283
+				if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) {
284 284
 					return $city['timezone_id'];
285 285
 				}
286 286
 			}
@@ -304,17 +304,17 @@  discard block
 block discarded – undo
304 304
 
305 305
 	$ip = '127.0.0.1';
306 306
 
307
-	if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
307
+	if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) {
308 308
 		//check ip from share internet
309 309
 		$ip = $_SERVER['HTTP_CLIENT_IP'];
310
-	} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
310
+	} elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
311 311
 		//to check ip is pass from proxy
312 312
 		$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
313
-	} elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) {
313
+	} elseif ( ! empty($_SERVER['REMOTE_ADDR'])) {
314 314
 		$ip = $_SERVER['REMOTE_ADDR'];
315 315
 	}
316 316
 
317
-	return apply_filters( 'give_get_ip', $ip );
317
+	return apply_filters('give_get_ip', $ip);
318 318
 }
319 319
 
320 320
 
@@ -329,8 +329,8 @@  discard block
 block discarded – undo
329 329
  *
330 330
  * @uses  Give()->session->set()
331 331
  */
332
-function give_set_purchase_session( $purchase_data = array() ) {
333
-	Give()->session->set( 'give_purchase', $purchase_data );
332
+function give_set_purchase_session($purchase_data = array()) {
333
+	Give()->session->set('give_purchase', $purchase_data);
334 334
 }
335 335
 
336 336
 /**
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
  * @return mixed array | false
345 345
  */
346 346
 function give_get_purchase_session() {
347
-	return Give()->session->get( 'give_purchase' );
347
+	return Give()->session->get('give_purchase');
348 348
 }
349 349
 
350 350
 /**
@@ -359,14 +359,14 @@  discard block
 block discarded – undo
359 359
  *
360 360
  * @return string
361 361
  */
362
-function give_get_purchase_summary( $purchase_data, $email = true ) {
362
+function give_get_purchase_summary($purchase_data, $email = true) {
363 363
 	$summary = '';
364 364
 
365
-	if ( $email ) {
366
-		$summary .= $purchase_data['user_email'] . ' - ';
365
+	if ($email) {
366
+		$summary .= $purchase_data['user_email'].' - ';
367 367
 	}
368 368
 
369
-	$summary .= get_the_title( $purchase_data['post_data']['give-form-id'] );
369
+	$summary .= get_the_title($purchase_data['post_data']['give-form-id']);
370 370
 
371 371
 	return $summary;
372 372
 }
@@ -383,31 +383,31 @@  discard block
 block discarded – undo
383 383
 function give_get_host() {
384 384
 	$host = false;
385 385
 
386
-	if ( defined( 'WPE_APIKEY' ) ) {
386
+	if (defined('WPE_APIKEY')) {
387 387
 		$host = 'WP Engine';
388
-	} elseif ( defined( 'PAGELYBIN' ) ) {
388
+	} elseif (defined('PAGELYBIN')) {
389 389
 		$host = 'Pagely';
390
-	} elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
390
+	} elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') {
391 391
 		$host = 'ICDSoft';
392
-	} elseif ( DB_HOST == 'mysqlv5' ) {
392
+	} elseif (DB_HOST == 'mysqlv5') {
393 393
 		$host = 'NetworkSolutions';
394
-	} elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
394
+	} elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) {
395 395
 		$host = 'iPage';
396
-	} elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
396
+	} elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) {
397 397
 		$host = 'IPower';
398
-	} elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
398
+	} elseif (strpos(DB_HOST, '.gridserver.com') !== false) {
399 399
 		$host = 'MediaTemple Grid';
400
-	} elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) {
400
+	} elseif (strpos(DB_HOST, '.pair.com') !== false) {
401 401
 		$host = 'pair Networks';
402
-	} elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
402
+	} elseif (strpos(DB_HOST, '.stabletransit.com') !== false) {
403 403
 		$host = 'Rackspace Cloud';
404
-	} elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
404
+	} elseif (strpos(DB_HOST, '.sysfix.eu') !== false) {
405 405
 		$host = 'SysFix.eu Power Hosting';
406
-	} elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
406
+	} elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
407 407
 		$host = 'Flywheel';
408 408
 	} else {
409 409
 		// Adding a general fallback for data gathering
410
-		$host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME'];
410
+		$host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME'];
411 411
 	}
412 412
 
413 413
 	return $host;
@@ -423,67 +423,67 @@  discard block
 block discarded – undo
423 423
  *
424 424
  * @return bool true if host matches, false if not
425 425
  */
426
-function give_is_host( $host = false ) {
426
+function give_is_host($host = false) {
427 427
 
428 428
 	$return = false;
429 429
 
430
-	if ( $host ) {
431
-		$host = str_replace( ' ', '', strtolower( $host ) );
430
+	if ($host) {
431
+		$host = str_replace(' ', '', strtolower($host));
432 432
 
433
-		switch ( $host ) {
433
+		switch ($host) {
434 434
 			case 'wpengine':
435
-				if ( defined( 'WPE_APIKEY' ) ) {
435
+				if (defined('WPE_APIKEY')) {
436 436
 					$return = true;
437 437
 				}
438 438
 				break;
439 439
 			case 'pagely':
440
-				if ( defined( 'PAGELYBIN' ) ) {
440
+				if (defined('PAGELYBIN')) {
441 441
 					$return = true;
442 442
 				}
443 443
 				break;
444 444
 			case 'icdsoft':
445
-				if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
445
+				if (DB_HOST == 'localhost:/tmp/mysql5.sock') {
446 446
 					$return = true;
447 447
 				}
448 448
 				break;
449 449
 			case 'networksolutions':
450
-				if ( DB_HOST == 'mysqlv5' ) {
450
+				if (DB_HOST == 'mysqlv5') {
451 451
 					$return = true;
452 452
 				}
453 453
 				break;
454 454
 			case 'ipage':
455
-				if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
455
+				if (strpos(DB_HOST, 'ipagemysql.com') !== false) {
456 456
 					$return = true;
457 457
 				}
458 458
 				break;
459 459
 			case 'ipower':
460
-				if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
460
+				if (strpos(DB_HOST, 'ipowermysql.com') !== false) {
461 461
 					$return = true;
462 462
 				}
463 463
 				break;
464 464
 			case 'mediatemplegrid':
465
-				if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
465
+				if (strpos(DB_HOST, '.gridserver.com') !== false) {
466 466
 					$return = true;
467 467
 				}
468 468
 				break;
469 469
 			case 'pairnetworks':
470
-				if ( strpos( DB_HOST, '.pair.com' ) !== false ) {
470
+				if (strpos(DB_HOST, '.pair.com') !== false) {
471 471
 					$return = true;
472 472
 				}
473 473
 				break;
474 474
 			case 'rackspacecloud':
475
-				if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
475
+				if (strpos(DB_HOST, '.stabletransit.com') !== false) {
476 476
 					$return = true;
477 477
 				}
478 478
 				break;
479 479
 			case 'sysfix.eu':
480 480
 			case 'sysfix.eupowerhosting':
481
-				if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
481
+				if (strpos(DB_HOST, '.sysfix.eu') !== false) {
482 482
 					$return = true;
483 483
 				}
484 484
 				break;
485 485
 			case 'flywheel':
486
-				if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
486
+				if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
487 487
 					$return = true;
488 488
 				}
489 489
 				break;
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
  * @return string $post_id
505 505
  */
506 506
 function give_get_admin_post_id() {
507
-	$post_id = isset( $_GET['post'] ) ? $_GET['post'] : null;
508
-	if ( ! $post_id && isset( $_POST['post_id'] ) ) {
507
+	$post_id = isset($_GET['post']) ? $_GET['post'] : null;
508
+	if ( ! $post_id && isset($_POST['post_id'])) {
509 509
 		$post_id = $_POST['post_id'];
510 510
 	}
511 511
 
@@ -523,11 +523,11 @@  discard block
 block discarded – undo
523 523
  *
524 524
  * @return bool $ret True if guest checkout is enabled, false otherwise
525 525
  */
526
-function give_no_guest_checkout( $form_id ) {
526
+function give_no_guest_checkout($form_id) {
527 527
 
528
-	$ret = get_post_meta( $form_id, '_give_logged_in_only', true );
528
+	$ret = get_post_meta($form_id, '_give_logged_in_only', true);
529 529
 
530
-	return (bool) apply_filters( 'give_no_guest_checkout', $ret );
530
+	return (bool) apply_filters('give_no_guest_checkout', $ret);
531 531
 }
532 532
 
533 533
 
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
  * @return string Arg separator output
539 539
  */
540 540
 function give_get_php_arg_separator_output() {
541
-	return ini_get( 'arg_separator.output' );
541
+	return ini_get('arg_separator.output');
542 542
 }
543 543
 
544 544
 
@@ -553,10 +553,10 @@  discard block
 block discarded – undo
553 553
  *
554 554
  * @return string Short month name
555 555
  */
556
-function give_month_num_to_name( $n ) {
557
-	$timestamp = mktime( 0, 0, 0, $n, 1, 2005 );
556
+function give_month_num_to_name($n) {
557
+	$timestamp = mktime(0, 0, 0, $n, 1, 2005);
558 558
 
559
-	return date_i18n( "M", $timestamp );
559
+	return date_i18n("M", $timestamp);
560 560
 }
561 561
 
562 562
 
@@ -569,10 +569,10 @@  discard block
 block discarded – undo
569 569
  *
570 570
  * @return bool Whether or not function is disabled.
571 571
  */
572
-function give_is_func_disabled( $function ) {
573
-	$disabled = explode( ',', ini_get( 'disable_functions' ) );
572
+function give_is_func_disabled($function) {
573
+	$disabled = explode(',', ini_get('disable_functions'));
574 574
 
575
-	return in_array( $function, $disabled );
575
+	return in_array($function, $disabled);
576 576
 }
577 577
 
578 578
 
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 
588 588
 		<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>
589 589
 			<div class="give-newsletter-confirmation">
590
-				<p><?php _e( 'Thanks for Subscribing!', 'give' ); ?> :)</p>
590
+				<p><?php _e('Thanks for Subscribing!', 'give'); ?> :)</p>
591 591
 			</div>
592 592
 
593 593
 			<table class="form-table give-newsletter-form">
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
  *
684 684
  * @return mixed
685 685
  */
686
-function give_svg_icons( $icon ) {
686
+function give_svg_icons($icon) {
687 687
 
688 688
 	// Store your SVGs in an associative array
689 689
 	$svgs = array(
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
 	);
696 696
 
697 697
 	// Return the chosen icon's SVG string
698
-	return $svgs[ $icon ];
698
+	return $svgs[$icon];
699 699
 }
700 700
 
701 701
 /**
@@ -707,15 +707,15 @@  discard block
 block discarded – undo
707 707
  *
708 708
  * @return mixed
709 709
  */
710
-function modify_nav_menu_meta_box_object( $post_type ) {
711
-	if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) {
710
+function modify_nav_menu_meta_box_object($post_type) {
711
+	if (isset($post_type->name) && $post_type->name == 'give_forms') {
712 712
 		$post_type->labels->name = 'Donation Forms';
713 713
 	}
714 714
 
715 715
 	return $post_type;
716 716
 }
717 717
 
718
-add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' );
718
+add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object');
719 719
 
720 720
 
721 721
 /**
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
  * @license    http://opensource.org/licenses/MIT MIT
729 729
  */
730 730
 
731
-if ( ! function_exists( 'array_column' ) ) {
731
+if ( ! function_exists('array_column')) {
732 732
 	/**
733 733
 	 * Returns the values from a single column of the input array, identified by
734 734
 	 * the $columnKey.
@@ -747,56 +747,56 @@  discard block
 block discarded – undo
747 747
 	 *
748 748
 	 * @return array
749 749
 	 */
750
-	function array_column( $input = null, $columnKey = null, $indexKey = null ) {
750
+	function array_column($input = null, $columnKey = null, $indexKey = null) {
751 751
 		// Using func_get_args() in order to check for proper number of
752 752
 		// parameters and trigger errors exactly as the built-in array_column()
753 753
 		// does in PHP 5.5.
754 754
 		$argc   = func_num_args();
755 755
 		$params = func_get_args();
756 756
 
757
-		if ( $argc < 2 ) {
758
-			trigger_error( "array_column() expects at least 2 parameters, {$argc} given", E_USER_WARNING );
757
+		if ($argc < 2) {
758
+			trigger_error("array_column() expects at least 2 parameters, {$argc} given", E_USER_WARNING);
759 759
 
760 760
 			return null;
761 761
 		}
762 762
 
763
-		if ( ! is_array( $params[0] ) ) {
763
+		if ( ! is_array($params[0])) {
764 764
 			trigger_error(
765
-				'array_column() expects parameter 1 to be array, ' . gettype( $params[0] ) . ' given',
765
+				'array_column() expects parameter 1 to be array, '.gettype($params[0]).' given',
766 766
 				E_USER_WARNING
767 767
 			);
768 768
 
769 769
 			return null;
770 770
 		}
771 771
 
772
-		if ( ! is_int( $params[1] )
773
-		     && ! is_float( $params[1] )
774
-		     && ! is_string( $params[1] )
772
+		if ( ! is_int($params[1])
773
+		     && ! is_float($params[1])
774
+		     && ! is_string($params[1])
775 775
 		     && $params[1] !== null
776
-		     && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )
776
+		     && ! (is_object($params[1]) && method_exists($params[1], '__toString'))
777 777
 		) {
778
-			trigger_error( 'array_column(): The column key should be either a string or an integer', E_USER_WARNING );
778
+			trigger_error('array_column(): The column key should be either a string or an integer', E_USER_WARNING);
779 779
 
780 780
 			return false;
781 781
 		}
782 782
 
783
-		if ( isset( $params[2] )
784
-		     && ! is_int( $params[2] )
785
-		     && ! is_float( $params[2] )
786
-		     && ! is_string( $params[2] )
787
-		     && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) )
783
+		if (isset($params[2])
784
+		     && ! is_int($params[2])
785
+		     && ! is_float($params[2])
786
+		     && ! is_string($params[2])
787
+		     && ! (is_object($params[2]) && method_exists($params[2], '__toString'))
788 788
 		) {
789
-			trigger_error( 'array_column(): The index key should be either a string or an integer', E_USER_WARNING );
789
+			trigger_error('array_column(): The index key should be either a string or an integer', E_USER_WARNING);
790 790
 
791 791
 			return false;
792 792
 		}
793 793
 
794 794
 		$paramsInput     = $params[0];
795
-		$paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null;
795
+		$paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null;
796 796
 
797 797
 		$paramsIndexKey = null;
798
-		if ( isset( $params[2] ) ) {
799
-			if ( is_float( $params[2] ) || is_int( $params[2] ) ) {
798
+		if (isset($params[2])) {
799
+			if (is_float($params[2]) || is_int($params[2])) {
800 800
 				$paramsIndexKey = (int) $params[2];
801 801
 			} else {
802 802
 				$paramsIndexKey = (string) $params[2];
@@ -805,26 +805,26 @@  discard block
 block discarded – undo
805 805
 
806 806
 		$resultArray = array();
807 807
 
808
-		foreach ( $paramsInput as $row ) {
808
+		foreach ($paramsInput as $row) {
809 809
 			$key    = $value = null;
810 810
 			$keySet = $valueSet = false;
811 811
 
812
-			if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) {
812
+			if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) {
813 813
 				$keySet = true;
814
-				$key    = (string) $row[ $paramsIndexKey ];
814
+				$key    = (string) $row[$paramsIndexKey];
815 815
 			}
816 816
 
817
-			if ( $paramsColumnKey === null ) {
817
+			if ($paramsColumnKey === null) {
818 818
 				$valueSet = true;
819 819
 				$value    = $row;
820
-			} elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) {
820
+			} elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) {
821 821
 				$valueSet = true;
822
-				$value    = $row[ $paramsColumnKey ];
822
+				$value    = $row[$paramsColumnKey];
823 823
 			}
824 824
 
825
-			if ( $valueSet ) {
826
-				if ( $keySet ) {
827
-					$resultArray[ $key ] = $value;
825
+			if ($valueSet) {
826
+				if ($keySet) {
827
+					$resultArray[$key] = $value;
828 828
 				} else {
829 829
 					$resultArray[] = $value;
830 830
 				}
@@ -846,39 +846,39 @@  discard block
 block discarded – undo
846 846
  *
847 847
  * @return bool Whether the receipt is visible or not.
848 848
  */
849
-function give_can_view_receipt( $payment_key = '' ) {
849
+function give_can_view_receipt($payment_key = '') {
850 850
 
851 851
 	$return = false;
852 852
 
853
-	if ( empty( $payment_key ) ) {
853
+	if (empty($payment_key)) {
854 854
 		return $return;
855 855
 	}
856 856
 
857 857
 	global $give_receipt_args;
858 858
 
859
-	$give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key );
859
+	$give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key);
860 860
 
861
-	$user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] );
861
+	$user_id = (int) give_get_payment_user_id($give_receipt_args['id']);
862 862
 
863
-	$payment_meta = give_get_payment_meta( $give_receipt_args['id'] );
863
+	$payment_meta = give_get_payment_meta($give_receipt_args['id']);
864 864
 
865
-	if ( is_user_logged_in() ) {
866
-		if ( $user_id === (int) get_current_user_id() ) {
865
+	if (is_user_logged_in()) {
866
+		if ($user_id === (int) get_current_user_id()) {
867 867
 			$return = true;
868
-		} elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) {
868
+		} elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) {
869 869
 			$return = true;
870
-		} elseif ( current_user_can( 'view_give_sensitive_data' ) ) {
870
+		} elseif (current_user_can('view_give_sensitive_data')) {
871 871
 			$return = true;
872 872
 		}
873 873
 	}
874 874
 
875 875
 	$session = give_get_purchase_session();
876
-	if ( ! empty( $session ) && ! is_user_logged_in() ) {
877
-		if ( $session['purchase_key'] === $payment_meta['key'] ) {
876
+	if ( ! empty($session) && ! is_user_logged_in()) {
877
+		if ($session['purchase_key'] === $payment_meta['key']) {
878 878
 			$return = true;
879 879
 		}
880 880
 	}
881 881
 
882
-	return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key );
882
+	return (bool) apply_filters('give_can_view_receipt', $return, $payment_key);
883 883
 
884 884
 }
885 885
\ No newline at end of file
Please login to merge, or discard this patch.