Completed
Push — master ( a1463a...f7d43f )
by Devin
20:04
created
includes/misc-functions.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Misc Functions
4
- *
5
- * @package     Give
6
- * @subpackage  Functions
7
- * @copyright   Copyright (c) 2016, WordImpress
8
- * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
- * @since       1.0
10
- */
3
+	 * Misc Functions
4
+	 *
5
+	 * @package     Give
6
+	 * @subpackage  Functions
7
+	 * @copyright   Copyright (c) 2016, WordImpress
8
+	 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
9
+	 * @since       1.0
10
+	 */
11 11
 
12 12
 // Exit if accessed directly
13 13
 if ( ! defined( 'ABSPATH' ) ) {
@@ -770,10 +770,10 @@  discard block
 block discarded – undo
770 770
 		}
771 771
 
772 772
 		if ( ! is_int( $params[1] )
773
-		     && ! is_float( $params[1] )
774
-		     && ! is_string( $params[1] )
775
-		     && $params[1] !== null
776
-		     && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )
773
+			 && ! is_float( $params[1] )
774
+			 && ! is_string( $params[1] )
775
+			 && $params[1] !== null
776
+			 && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )
777 777
 		) {
778 778
 			trigger_error( 'array_column(): The column key should be either a string or an integer', E_USER_WARNING );
779 779
 
@@ -781,10 +781,10 @@  discard block
 block discarded – undo
781 781
 		}
782 782
 
783 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' ) )
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 789
 			trigger_error( 'array_column(): The index key should be either a string or an integer', E_USER_WARNING );
790 790
 
Please login to merge, or discard this patch.
Spacing   +162 added lines, -162 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
 
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
  * @global $give_options
242 242
  * @return bool $ret Whether or not the logged_in_only setting is set
243 243
  */
244
-function give_logged_in_only( $form_id ) {
244
+function give_logged_in_only($form_id) {
245 245
 
246
-	$form_option = get_post_meta( $form_id, '_give_logged_in_only', true );
246
+	$form_option = get_post_meta($form_id, '_give_logged_in_only', true);
247 247
 
248
-	$ret = ! empty( $form_option ) ? $form_option : false;
248
+	$ret = ! empty($form_option) ? $form_option : false;
249 249
 
250
-	return (bool) apply_filters( 'give_logged_in_only', $ret, $form_id );
250
+	return (bool) apply_filters('give_logged_in_only', $ret, $form_id);
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;
@@ -516,20 +516,20 @@  discard block
 block discarded – undo
516 516
  * @param string $replacement Optional. The function that should have been called
517 517
  * @param array $backtrace Optional. Contains stack backtrace of deprecated function
518 518
  */
519
-function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) {
520
-	do_action( 'give_deprecated_function_run', $function, $replacement, $version );
519
+function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) {
520
+	do_action('give_deprecated_function_run', $function, $replacement, $version);
521 521
 
522
-	$show_errors = current_user_can( 'manage_options' );
522
+	$show_errors = current_user_can('manage_options');
523 523
 
524 524
 	// Allow plugin to filter the output error trigger
525
-	if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) {
526
-		if ( ! is_null( $replacement ) ) {
527
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) );
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.
525
+	if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) {
526
+		if ( ! is_null($replacement)) {
527
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement));
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
 		} else {
531
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) );
532
-			trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
531
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version));
532
+			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.
533 533
 			// Alternatively we could dump this to a file.
534 534
 		}
535 535
 	}
@@ -543,8 +543,8 @@  discard block
 block discarded – undo
543 543
  * @return string $post_id
544 544
  */
545 545
 function give_get_admin_post_id() {
546
-	$post_id = isset( $_GET['post'] ) ? $_GET['post'] : null;
547
-	if ( ! $post_id && isset( $_POST['post_id'] ) ) {
546
+	$post_id = isset($_GET['post']) ? $_GET['post'] : null;
547
+	if ( ! $post_id && isset($_POST['post_id'])) {
548 548
 		$post_id = $_POST['post_id'];
549 549
 	}
550 550
 
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
  * @return string Arg separator output
559 559
  */
560 560
 function give_get_php_arg_separator_output() {
561
-	return ini_get( 'arg_separator.output' );
561
+	return ini_get('arg_separator.output');
562 562
 }
563 563
 
564 564
 
@@ -573,10 +573,10 @@  discard block
 block discarded – undo
573 573
  *
574 574
  * @return string Short month name
575 575
  */
576
-function give_month_num_to_name( $n ) {
577
-	$timestamp = mktime( 0, 0, 0, $n, 1, 2005 );
576
+function give_month_num_to_name($n) {
577
+	$timestamp = mktime(0, 0, 0, $n, 1, 2005);
578 578
 
579
-	return date_i18n( "M", $timestamp );
579
+	return date_i18n("M", $timestamp);
580 580
 }
581 581
 
582 582
 
@@ -589,10 +589,10 @@  discard block
 block discarded – undo
589 589
  *
590 590
  * @return bool Whether or not function is disabled.
591 591
  */
592
-function give_is_func_disabled( $function ) {
593
-	$disabled = explode( ',', ini_get( 'disable_functions' ) );
592
+function give_is_func_disabled($function) {
593
+	$disabled = explode(',', ini_get('disable_functions'));
594 594
 
595
-	return in_array( $function, $disabled );
595
+	return in_array($function, $disabled);
596 596
 }
597 597
 
598 598
 
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 
608 608
 		<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>
609 609
 			<div class="give-newsletter-confirmation">
610
-				<p><?php _e( 'Thanks for Subscribing!', 'give' ); ?> :)</p>
610
+				<p><?php _e('Thanks for Subscribing!', 'give'); ?> :)</p>
611 611
 			</div>
612 612
 
613 613
 			<table class="form-table give-newsletter-form">
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
  *
704 704
  * @return mixed
705 705
  */
706
-function give_svg_icons( $icon ) {
706
+function give_svg_icons($icon) {
707 707
 
708 708
 	// Store your SVGs in an associative array
709 709
 	$svgs = array(
@@ -715,7 +715,7 @@  discard block
 block discarded – undo
715 715
 	);
716 716
 
717 717
 	// Return the chosen icon's SVG string
718
-	return $svgs[ $icon ];
718
+	return $svgs[$icon];
719 719
 }
720 720
 
721 721
 /**
@@ -727,15 +727,15 @@  discard block
 block discarded – undo
727 727
  *
728 728
  * @return mixed
729 729
  */
730
-function modify_nav_menu_meta_box_object( $post_type ) {
731
-	if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) {
730
+function modify_nav_menu_meta_box_object($post_type) {
731
+	if (isset($post_type->name) && $post_type->name == 'give_forms') {
732 732
 		$post_type->labels->name = 'Donation Forms';
733 733
 	}
734 734
 
735 735
 	return $post_type;
736 736
 }
737 737
 
738
-add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' );
738
+add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object');
739 739
 
740 740
 
741 741
 /**
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
  * @license    http://opensource.org/licenses/MIT MIT
749 749
  */
750 750
 
751
-if ( ! function_exists( 'array_column' ) ) {
751
+if ( ! function_exists('array_column')) {
752 752
 	/**
753 753
 	 * Returns the values from a single column of the input array, identified by
754 754
 	 * the $columnKey.
@@ -767,56 +767,56 @@  discard block
 block discarded – undo
767 767
 	 *
768 768
 	 * @return array
769 769
 	 */
770
-	function array_column( $input = null, $columnKey = null, $indexKey = null ) {
770
+	function array_column($input = null, $columnKey = null, $indexKey = null) {
771 771
 		// Using func_get_args() in order to check for proper number of
772 772
 		// parameters and trigger errors exactly as the built-in array_column()
773 773
 		// does in PHP 5.5.
774 774
 		$argc   = func_num_args();
775 775
 		$params = func_get_args();
776 776
 
777
-		if ( $argc < 2 ) {
778
-			trigger_error( "array_column() expects at least 2 parameters, {$argc} given", E_USER_WARNING );
777
+		if ($argc < 2) {
778
+			trigger_error("array_column() expects at least 2 parameters, {$argc} given", E_USER_WARNING);
779 779
 
780 780
 			return null;
781 781
 		}
782 782
 
783
-		if ( ! is_array( $params[0] ) ) {
783
+		if ( ! is_array($params[0])) {
784 784
 			trigger_error(
785
-				'array_column() expects parameter 1 to be array, ' . gettype( $params[0] ) . ' given',
785
+				'array_column() expects parameter 1 to be array, '.gettype($params[0]).' given',
786 786
 				E_USER_WARNING
787 787
 			);
788 788
 
789 789
 			return null;
790 790
 		}
791 791
 
792
-		if ( ! is_int( $params[1] )
793
-		     && ! is_float( $params[1] )
794
-		     && ! is_string( $params[1] )
792
+		if ( ! is_int($params[1])
793
+		     && ! is_float($params[1])
794
+		     && ! is_string($params[1])
795 795
 		     && $params[1] !== null
796
-		     && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )
796
+		     && ! (is_object($params[1]) && method_exists($params[1], '__toString'))
797 797
 		) {
798
-			trigger_error( 'array_column(): The column key should be either a string or an integer', E_USER_WARNING );
798
+			trigger_error('array_column(): The column key should be either a string or an integer', E_USER_WARNING);
799 799
 
800 800
 			return false;
801 801
 		}
802 802
 
803
-		if ( isset( $params[2] )
804
-		     && ! is_int( $params[2] )
805
-		     && ! is_float( $params[2] )
806
-		     && ! is_string( $params[2] )
807
-		     && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) )
803
+		if (isset($params[2])
804
+		     && ! is_int($params[2])
805
+		     && ! is_float($params[2])
806
+		     && ! is_string($params[2])
807
+		     && ! (is_object($params[2]) && method_exists($params[2], '__toString'))
808 808
 		) {
809
-			trigger_error( 'array_column(): The index key should be either a string or an integer', E_USER_WARNING );
809
+			trigger_error('array_column(): The index key should be either a string or an integer', E_USER_WARNING);
810 810
 
811 811
 			return false;
812 812
 		}
813 813
 
814 814
 		$paramsInput     = $params[0];
815
-		$paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null;
815
+		$paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null;
816 816
 
817 817
 		$paramsIndexKey = null;
818
-		if ( isset( $params[2] ) ) {
819
-			if ( is_float( $params[2] ) || is_int( $params[2] ) ) {
818
+		if (isset($params[2])) {
819
+			if (is_float($params[2]) || is_int($params[2])) {
820 820
 				$paramsIndexKey = (int) $params[2];
821 821
 			} else {
822 822
 				$paramsIndexKey = (string) $params[2];
@@ -825,26 +825,26 @@  discard block
 block discarded – undo
825 825
 
826 826
 		$resultArray = array();
827 827
 
828
-		foreach ( $paramsInput as $row ) {
828
+		foreach ($paramsInput as $row) {
829 829
 			$key    = $value = null;
830 830
 			$keySet = $valueSet = false;
831 831
 
832
-			if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) {
832
+			if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) {
833 833
 				$keySet = true;
834
-				$key    = (string) $row[ $paramsIndexKey ];
834
+				$key    = (string) $row[$paramsIndexKey];
835 835
 			}
836 836
 
837
-			if ( $paramsColumnKey === null ) {
837
+			if ($paramsColumnKey === null) {
838 838
 				$valueSet = true;
839 839
 				$value    = $row;
840
-			} elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) {
840
+			} elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) {
841 841
 				$valueSet = true;
842
-				$value    = $row[ $paramsColumnKey ];
842
+				$value    = $row[$paramsColumnKey];
843 843
 			}
844 844
 
845
-			if ( $valueSet ) {
846
-				if ( $keySet ) {
847
-					$resultArray[ $key ] = $value;
845
+			if ($valueSet) {
846
+				if ($keySet) {
847
+					$resultArray[$key] = $value;
848 848
 				} else {
849 849
 					$resultArray[] = $value;
850 850
 				}
@@ -866,39 +866,39 @@  discard block
 block discarded – undo
866 866
  *
867 867
  * @return bool Whether the receipt is visible or not.
868 868
  */
869
-function give_can_view_receipt( $payment_key = '' ) {
869
+function give_can_view_receipt($payment_key = '') {
870 870
 
871 871
 	$return = false;
872 872
 
873
-	if ( empty( $payment_key ) ) {
873
+	if (empty($payment_key)) {
874 874
 		return $return;
875 875
 	}
876 876
 
877 877
 	global $give_receipt_args;
878 878
 
879
-	$give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key );
879
+	$give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key);
880 880
 
881
-	$user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] );
881
+	$user_id = (int) give_get_payment_user_id($give_receipt_args['id']);
882 882
 
883
-	$payment_meta = give_get_payment_meta( $give_receipt_args['id'] );
883
+	$payment_meta = give_get_payment_meta($give_receipt_args['id']);
884 884
 
885
-	if ( is_user_logged_in() ) {
886
-		if ( $user_id === (int) get_current_user_id() ) {
885
+	if (is_user_logged_in()) {
886
+		if ($user_id === (int) get_current_user_id()) {
887 887
 			$return = true;
888
-		} elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) {
888
+		} elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) {
889 889
 			$return = true;
890
-		} elseif ( current_user_can( 'view_give_sensitive_data' ) ) {
890
+		} elseif (current_user_can('view_give_sensitive_data')) {
891 891
 			$return = true;
892 892
 		}
893 893
 	}
894 894
 
895 895
 	$session = give_get_purchase_session();
896
-	if ( ! empty( $session ) && ! is_user_logged_in() ) {
897
-		if ( $session['purchase_key'] === $payment_meta['key'] ) {
896
+	if ( ! empty($session) && ! is_user_logged_in()) {
897
+		if ($session['purchase_key'] === $payment_meta['key']) {
898 898
 			$return = true;
899 899
 		}
900 900
 	}
901 901
 
902
-	return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key );
902
+	return (bool) apply_filters('give_can_view_receipt', $return, $payment_key);
903 903
 
904 904
 }
905 905
\ No newline at end of file
Please login to merge, or discard this patch.