@@ -10,7 +10,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . untrailingslashit( $_SERVER['REQUEST_URI'] ) ); |
|
| 201 | + $current_url = set_url_scheme('http://'.$_SERVER['HTTP_HOST'].untrailingslashit($_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 |
||
| 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 | /** |
@@ -242,26 +242,26 @@ discard block |
||
| 242 | 242 | function give_get_timezone_id() { |
| 243 | 243 | |
| 244 | 244 | // if site timezone string exists, return it |
| 245 | - if ( $timezone = get_option( 'timezone_string' ) ) { |
|
| 245 | + if ($timezone = get_option('timezone_string')) { |
|
| 246 | 246 | return $timezone; |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | // get UTC offset, if it isn't set return UTC |
| 250 | - if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) { |
|
| 250 | + if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) { |
|
| 251 | 251 | return 'UTC'; |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | // attempt to guess the timezone string from the UTC offset |
| 255 | - $timezone = timezone_name_from_abbr( '', $utc_offset ); |
|
| 255 | + $timezone = timezone_name_from_abbr('', $utc_offset); |
|
| 256 | 256 | |
| 257 | 257 | // last try, guess timezone string manually |
| 258 | - if ( $timezone === false ) { |
|
| 258 | + if ($timezone === false) { |
|
| 259 | 259 | |
| 260 | - $is_dst = date( 'I' ); |
|
| 260 | + $is_dst = date('I'); |
|
| 261 | 261 | |
| 262 | - foreach ( timezone_abbreviations_list() as $abbr ) { |
|
| 263 | - foreach ( $abbr as $city ) { |
|
| 264 | - if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) { |
|
| 262 | + foreach (timezone_abbreviations_list() as $abbr) { |
|
| 263 | + foreach ($abbr as $city) { |
|
| 264 | + if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) { |
|
| 265 | 265 | return $city['timezone_id']; |
| 266 | 266 | } |
| 267 | 267 | } |
@@ -285,17 +285,17 @@ discard block |
||
| 285 | 285 | |
| 286 | 286 | $ip = '127.0.0.1'; |
| 287 | 287 | |
| 288 | - if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { |
|
| 288 | + if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) { |
|
| 289 | 289 | //check ip from share internet |
| 290 | 290 | $ip = $_SERVER['HTTP_CLIENT_IP']; |
| 291 | - } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { |
|
| 291 | + } elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
| 292 | 292 | //to check ip is pass from proxy |
| 293 | 293 | $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; |
| 294 | - } elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) { |
|
| 294 | + } elseif ( ! empty($_SERVER['REMOTE_ADDR'])) { |
|
| 295 | 295 | $ip = $_SERVER['REMOTE_ADDR']; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | - return apply_filters( 'give_get_ip', $ip ); |
|
| 298 | + return apply_filters('give_get_ip', $ip); |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | |
@@ -310,9 +310,9 @@ discard block |
||
| 310 | 310 | * |
| 311 | 311 | * @uses Give()->session->set() |
| 312 | 312 | */ |
| 313 | -function give_set_purchase_session( $purchase_data = array() ) { |
|
| 314 | - Give()->session->set( 'give_purchase', $purchase_data ); |
|
| 315 | - Give()->session->set( 'give_email', $purchase_data['user_email'] ); |
|
| 313 | +function give_set_purchase_session($purchase_data = array()) { |
|
| 314 | + Give()->session->set('give_purchase', $purchase_data); |
|
| 315 | + Give()->session->set('give_email', $purchase_data['user_email']); |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | /** |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | * @return mixed array | false |
| 327 | 327 | */ |
| 328 | 328 | function give_get_purchase_session() { |
| 329 | - return Give()->session->get( 'give_purchase' ); |
|
| 329 | + return Give()->session->get('give_purchase'); |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | /** |
@@ -341,14 +341,14 @@ discard block |
||
| 341 | 341 | * |
| 342 | 342 | * @return string |
| 343 | 343 | */ |
| 344 | -function give_get_purchase_summary( $purchase_data, $email = true ) { |
|
| 344 | +function give_get_purchase_summary($purchase_data, $email = true) { |
|
| 345 | 345 | $summary = ''; |
| 346 | 346 | |
| 347 | - if ( $email ) { |
|
| 348 | - $summary .= $purchase_data['user_email'] . ' - '; |
|
| 347 | + if ($email) { |
|
| 348 | + $summary .= $purchase_data['user_email'].' - '; |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | - $summary .= get_the_title( $purchase_data['post_data']['give-form-id'] ); |
|
| 351 | + $summary .= get_the_title($purchase_data['post_data']['give-form-id']); |
|
| 352 | 352 | |
| 353 | 353 | return $summary; |
| 354 | 354 | } |
@@ -365,31 +365,31 @@ discard block |
||
| 365 | 365 | function give_get_host() { |
| 366 | 366 | $host = false; |
| 367 | 367 | |
| 368 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
| 368 | + if (defined('WPE_APIKEY')) { |
|
| 369 | 369 | $host = 'WP Engine'; |
| 370 | - } elseif ( defined( 'PAGELYBIN' ) ) { |
|
| 370 | + } elseif (defined('PAGELYBIN')) { |
|
| 371 | 371 | $host = 'Pagely'; |
| 372 | - } elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
| 372 | + } elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
| 373 | 373 | $host = 'ICDSoft'; |
| 374 | - } elseif ( DB_HOST == 'mysqlv5' ) { |
|
| 374 | + } elseif (DB_HOST == 'mysqlv5') { |
|
| 375 | 375 | $host = 'NetworkSolutions'; |
| 376 | - } elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
| 376 | + } elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
| 377 | 377 | $host = 'iPage'; |
| 378 | - } elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
| 378 | + } elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
| 379 | 379 | $host = 'IPower'; |
| 380 | - } elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
| 380 | + } elseif (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
| 381 | 381 | $host = 'MediaTemple Grid'; |
| 382 | - } elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
| 382 | + } elseif (strpos(DB_HOST, '.pair.com') !== false) { |
|
| 383 | 383 | $host = 'pair Networks'; |
| 384 | - } elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
| 384 | + } elseif (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
| 385 | 385 | $host = 'Rackspace Cloud'; |
| 386 | - } elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
| 386 | + } elseif (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
| 387 | 387 | $host = 'SysFix.eu Power Hosting'; |
| 388 | - } elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
| 388 | + } elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
| 389 | 389 | $host = 'Flywheel'; |
| 390 | 390 | } else { |
| 391 | 391 | // Adding a general fallback for data gathering |
| 392 | - $host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME']; |
|
| 392 | + $host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME']; |
|
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | return $host; |
@@ -405,67 +405,67 @@ discard block |
||
| 405 | 405 | * |
| 406 | 406 | * @return bool true if host matches, false if not |
| 407 | 407 | */ |
| 408 | -function give_is_host( $host = false ) { |
|
| 408 | +function give_is_host($host = false) { |
|
| 409 | 409 | |
| 410 | 410 | $return = false; |
| 411 | 411 | |
| 412 | - if ( $host ) { |
|
| 413 | - $host = str_replace( ' ', '', strtolower( $host ) ); |
|
| 412 | + if ($host) { |
|
| 413 | + $host = str_replace(' ', '', strtolower($host)); |
|
| 414 | 414 | |
| 415 | - switch ( $host ) { |
|
| 415 | + switch ($host) { |
|
| 416 | 416 | case 'wpengine': |
| 417 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
| 417 | + if (defined('WPE_APIKEY')) { |
|
| 418 | 418 | $return = true; |
| 419 | 419 | } |
| 420 | 420 | break; |
| 421 | 421 | case 'pagely': |
| 422 | - if ( defined( 'PAGELYBIN' ) ) { |
|
| 422 | + if (defined('PAGELYBIN')) { |
|
| 423 | 423 | $return = true; |
| 424 | 424 | } |
| 425 | 425 | break; |
| 426 | 426 | case 'icdsoft': |
| 427 | - if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
| 427 | + if (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
| 428 | 428 | $return = true; |
| 429 | 429 | } |
| 430 | 430 | break; |
| 431 | 431 | case 'networksolutions': |
| 432 | - if ( DB_HOST == 'mysqlv5' ) { |
|
| 432 | + if (DB_HOST == 'mysqlv5') { |
|
| 433 | 433 | $return = true; |
| 434 | 434 | } |
| 435 | 435 | break; |
| 436 | 436 | case 'ipage': |
| 437 | - if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
| 437 | + if (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
| 438 | 438 | $return = true; |
| 439 | 439 | } |
| 440 | 440 | break; |
| 441 | 441 | case 'ipower': |
| 442 | - if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
| 442 | + if (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
| 443 | 443 | $return = true; |
| 444 | 444 | } |
| 445 | 445 | break; |
| 446 | 446 | case 'mediatemplegrid': |
| 447 | - if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
| 447 | + if (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
| 448 | 448 | $return = true; |
| 449 | 449 | } |
| 450 | 450 | break; |
| 451 | 451 | case 'pairnetworks': |
| 452 | - if ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
| 452 | + if (strpos(DB_HOST, '.pair.com') !== false) { |
|
| 453 | 453 | $return = true; |
| 454 | 454 | } |
| 455 | 455 | break; |
| 456 | 456 | case 'rackspacecloud': |
| 457 | - if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
| 457 | + if (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
| 458 | 458 | $return = true; |
| 459 | 459 | } |
| 460 | 460 | break; |
| 461 | 461 | case 'sysfix.eu': |
| 462 | 462 | case 'sysfix.eupowerhosting': |
| 463 | - if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
| 463 | + if (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
| 464 | 464 | $return = true; |
| 465 | 465 | } |
| 466 | 466 | break; |
| 467 | 467 | case 'flywheel': |
| 468 | - if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
| 468 | + if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
| 469 | 469 | $return = true; |
| 470 | 470 | } |
| 471 | 471 | break; |
@@ -498,20 +498,20 @@ discard block |
||
| 498 | 498 | * @param string $replacement Optional. The function that should have been called |
| 499 | 499 | * @param array $backtrace Optional. Contains stack backtrace of deprecated function |
| 500 | 500 | */ |
| 501 | -function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) { |
|
| 502 | - do_action( 'give_deprecated_function_run', $function, $replacement, $version ); |
|
| 501 | +function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) { |
|
| 502 | + do_action('give_deprecated_function_run', $function, $replacement, $version); |
|
| 503 | 503 | |
| 504 | - $show_errors = current_user_can( 'manage_options' ); |
|
| 504 | + $show_errors = current_user_can('manage_options'); |
|
| 505 | 505 | |
| 506 | 506 | // Allow plugin to filter the output error trigger |
| 507 | - if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) { |
|
| 508 | - if ( ! is_null( $replacement ) ) { |
|
| 509 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) ); |
|
| 510 | - 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. |
|
| 507 | + if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) { |
|
| 508 | + if ( ! is_null($replacement)) { |
|
| 509 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement)); |
|
| 510 | + 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. |
|
| 511 | 511 | // Alternatively we could dump this to a file. |
| 512 | 512 | } else { |
| 513 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) ); |
|
| 514 | - 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. |
|
| 513 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version)); |
|
| 514 | + 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. |
|
| 515 | 515 | // Alternatively we could dump this to a file. |
| 516 | 516 | } |
| 517 | 517 | } |
@@ -525,8 +525,8 @@ discard block |
||
| 525 | 525 | * @return string $post_id |
| 526 | 526 | */ |
| 527 | 527 | function give_get_admin_post_id() { |
| 528 | - $post_id = isset( $_GET['post'] ) ? $_GET['post'] : null; |
|
| 529 | - if ( ! $post_id && isset( $_POST['post_id'] ) ) { |
|
| 528 | + $post_id = isset($_GET['post']) ? $_GET['post'] : null; |
|
| 529 | + if ( ! $post_id && isset($_POST['post_id'])) { |
|
| 530 | 530 | $post_id = $_POST['post_id']; |
| 531 | 531 | } |
| 532 | 532 | |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | * @return string Arg separator output |
| 541 | 541 | */ |
| 542 | 542 | function give_get_php_arg_separator_output() { |
| 543 | - return ini_get( 'arg_separator.output' ); |
|
| 543 | + return ini_get('arg_separator.output'); |
|
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | |
@@ -555,10 +555,10 @@ discard block |
||
| 555 | 555 | * |
| 556 | 556 | * @return string Short month name |
| 557 | 557 | */ |
| 558 | -function give_month_num_to_name( $n ) { |
|
| 559 | - $timestamp = mktime( 0, 0, 0, $n, 1, 2005 ); |
|
| 558 | +function give_month_num_to_name($n) { |
|
| 559 | + $timestamp = mktime(0, 0, 0, $n, 1, 2005); |
|
| 560 | 560 | |
| 561 | - return date_i18n( "M", $timestamp ); |
|
| 561 | + return date_i18n("M", $timestamp); |
|
| 562 | 562 | } |
| 563 | 563 | |
| 564 | 564 | |
@@ -571,10 +571,10 @@ discard block |
||
| 571 | 571 | * |
| 572 | 572 | * @return bool Whether or not function is disabled. |
| 573 | 573 | */ |
| 574 | -function give_is_func_disabled( $function ) { |
|
| 575 | - $disabled = explode( ',', ini_get( 'disable_functions' ) ); |
|
| 574 | +function give_is_func_disabled($function) { |
|
| 575 | + $disabled = explode(',', ini_get('disable_functions')); |
|
| 576 | 576 | |
| 577 | - return in_array( $function, $disabled ); |
|
| 577 | + return in_array($function, $disabled); |
|
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | |
| 590 | 590 | <form action="//givewp.us3.list-manage.com/subscribe/post?u=3ccb75d68bda4381e2f45794c&id=12a081aa13" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate> |
| 591 | 591 | <div class="give-newsletter-confirmation"> |
| 592 | - <p><?php _e( 'Thanks for Subscribing!', 'give' ); ?> :)</p> |
|
| 592 | + <p><?php _e('Thanks for Subscribing!', 'give'); ?> :)</p> |
|
| 593 | 593 | </div> |
| 594 | 594 | |
| 595 | 595 | <table class="form-table give-newsletter-form"> |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | * |
| 686 | 686 | * @return mixed |
| 687 | 687 | */ |
| 688 | -function give_svg_icons( $icon ) { |
|
| 688 | +function give_svg_icons($icon) { |
|
| 689 | 689 | |
| 690 | 690 | // Store your SVGs in an associative array |
| 691 | 691 | $svgs = array( |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | ); |
| 698 | 698 | |
| 699 | 699 | // Return the chosen icon's SVG string |
| 700 | - return $svgs[ $icon ]; |
|
| 700 | + return $svgs[$icon]; |
|
| 701 | 701 | } |
| 702 | 702 | |
| 703 | 703 | /** |
@@ -709,15 +709,15 @@ discard block |
||
| 709 | 709 | * |
| 710 | 710 | * @return mixed |
| 711 | 711 | */ |
| 712 | -function modify_nav_menu_meta_box_object( $post_type ) { |
|
| 713 | - if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) { |
|
| 712 | +function modify_nav_menu_meta_box_object($post_type) { |
|
| 713 | + if (isset($post_type->name) && $post_type->name == 'give_forms') { |
|
| 714 | 714 | $post_type->labels->name = 'Donation Forms'; |
| 715 | 715 | } |
| 716 | 716 | |
| 717 | 717 | return $post_type; |
| 718 | 718 | } |
| 719 | 719 | |
| 720 | -add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' ); |
|
| 720 | +add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object'); |
|
| 721 | 721 | |
| 722 | 722 | |
| 723 | 723 | /** |
@@ -730,7 +730,7 @@ discard block |
||
| 730 | 730 | * @license http://opensource.org/licenses/MIT MIT |
| 731 | 731 | */ |
| 732 | 732 | |
| 733 | -if ( ! function_exists( 'array_column' ) ) { |
|
| 733 | +if ( ! function_exists('array_column')) { |
|
| 734 | 734 | /** |
| 735 | 735 | * Returns the values from a single column of the input array, identified by |
| 736 | 736 | * the $columnKey. |
@@ -749,56 +749,56 @@ discard block |
||
| 749 | 749 | * |
| 750 | 750 | * @return array |
| 751 | 751 | */ |
| 752 | - function array_column( $input = null, $columnKey = null, $indexKey = null ) { |
|
| 752 | + function array_column($input = null, $columnKey = null, $indexKey = null) { |
|
| 753 | 753 | // Using func_get_args() in order to check for proper number of |
| 754 | 754 | // parameters and trigger errors exactly as the built-in array_column() |
| 755 | 755 | // does in PHP 5.5. |
| 756 | 756 | $argc = func_num_args(); |
| 757 | 757 | $params = func_get_args(); |
| 758 | 758 | |
| 759 | - if ( $argc < 2 ) { |
|
| 760 | - trigger_error( "array_column() expects at least 2 parameters, {$argc} given", E_USER_WARNING ); |
|
| 759 | + if ($argc < 2) { |
|
| 760 | + trigger_error("array_column() expects at least 2 parameters, {$argc} given", E_USER_WARNING); |
|
| 761 | 761 | |
| 762 | 762 | return null; |
| 763 | 763 | } |
| 764 | 764 | |
| 765 | - if ( ! is_array( $params[0] ) ) { |
|
| 765 | + if ( ! is_array($params[0])) { |
|
| 766 | 766 | trigger_error( |
| 767 | - 'array_column() expects parameter 1 to be array, ' . gettype( $params[0] ) . ' given', |
|
| 767 | + 'array_column() expects parameter 1 to be array, '.gettype($params[0]).' given', |
|
| 768 | 768 | E_USER_WARNING |
| 769 | 769 | ); |
| 770 | 770 | |
| 771 | 771 | return null; |
| 772 | 772 | } |
| 773 | 773 | |
| 774 | - if ( ! is_int( $params[1] ) |
|
| 775 | - && ! is_float( $params[1] ) |
|
| 776 | - && ! is_string( $params[1] ) |
|
| 774 | + if ( ! is_int($params[1]) |
|
| 775 | + && ! is_float($params[1]) |
|
| 776 | + && ! is_string($params[1]) |
|
| 777 | 777 | && $params[1] !== null |
| 778 | - && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) |
|
| 778 | + && ! (is_object($params[1]) && method_exists($params[1], '__toString')) |
|
| 779 | 779 | ) { |
| 780 | - trigger_error( 'array_column(): The column key should be either a string or an integer', E_USER_WARNING ); |
|
| 780 | + trigger_error('array_column(): The column key should be either a string or an integer', E_USER_WARNING); |
|
| 781 | 781 | |
| 782 | 782 | return false; |
| 783 | 783 | } |
| 784 | 784 | |
| 785 | - if ( isset( $params[2] ) |
|
| 786 | - && ! is_int( $params[2] ) |
|
| 787 | - && ! is_float( $params[2] ) |
|
| 788 | - && ! is_string( $params[2] ) |
|
| 789 | - && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) |
|
| 785 | + if (isset($params[2]) |
|
| 786 | + && ! is_int($params[2]) |
|
| 787 | + && ! is_float($params[2]) |
|
| 788 | + && ! is_string($params[2]) |
|
| 789 | + && ! (is_object($params[2]) && method_exists($params[2], '__toString')) |
|
| 790 | 790 | ) { |
| 791 | - trigger_error( 'array_column(): The index key should be either a string or an integer', E_USER_WARNING ); |
|
| 791 | + trigger_error('array_column(): The index key should be either a string or an integer', E_USER_WARNING); |
|
| 792 | 792 | |
| 793 | 793 | return false; |
| 794 | 794 | } |
| 795 | 795 | |
| 796 | 796 | $paramsInput = $params[0]; |
| 797 | - $paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null; |
|
| 797 | + $paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null; |
|
| 798 | 798 | |
| 799 | 799 | $paramsIndexKey = null; |
| 800 | - if ( isset( $params[2] ) ) { |
|
| 801 | - if ( is_float( $params[2] ) || is_int( $params[2] ) ) { |
|
| 800 | + if (isset($params[2])) { |
|
| 801 | + if (is_float($params[2]) || is_int($params[2])) { |
|
| 802 | 802 | $paramsIndexKey = (int) $params[2]; |
| 803 | 803 | } else { |
| 804 | 804 | $paramsIndexKey = (string) $params[2]; |
@@ -807,26 +807,26 @@ discard block |
||
| 807 | 807 | |
| 808 | 808 | $resultArray = array(); |
| 809 | 809 | |
| 810 | - foreach ( $paramsInput as $row ) { |
|
| 810 | + foreach ($paramsInput as $row) { |
|
| 811 | 811 | $key = $value = null; |
| 812 | 812 | $keySet = $valueSet = false; |
| 813 | 813 | |
| 814 | - if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) { |
|
| 814 | + if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) { |
|
| 815 | 815 | $keySet = true; |
| 816 | - $key = (string) $row[ $paramsIndexKey ]; |
|
| 816 | + $key = (string) $row[$paramsIndexKey]; |
|
| 817 | 817 | } |
| 818 | 818 | |
| 819 | - if ( $paramsColumnKey === null ) { |
|
| 819 | + if ($paramsColumnKey === null) { |
|
| 820 | 820 | $valueSet = true; |
| 821 | 821 | $value = $row; |
| 822 | - } elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) { |
|
| 822 | + } elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) { |
|
| 823 | 823 | $valueSet = true; |
| 824 | - $value = $row[ $paramsColumnKey ]; |
|
| 824 | + $value = $row[$paramsColumnKey]; |
|
| 825 | 825 | } |
| 826 | 826 | |
| 827 | - if ( $valueSet ) { |
|
| 828 | - if ( $keySet ) { |
|
| 829 | - $resultArray[ $key ] = $value; |
|
| 827 | + if ($valueSet) { |
|
| 828 | + if ($keySet) { |
|
| 829 | + $resultArray[$key] = $value; |
|
| 830 | 830 | } else { |
| 831 | 831 | $resultArray[] = $value; |
| 832 | 832 | } |
@@ -848,39 +848,39 @@ discard block |
||
| 848 | 848 | * |
| 849 | 849 | * @return bool Whether the receipt is visible or not. |
| 850 | 850 | */ |
| 851 | -function give_can_view_receipt( $payment_key = '' ) { |
|
| 851 | +function give_can_view_receipt($payment_key = '') { |
|
| 852 | 852 | |
| 853 | 853 | $return = false; |
| 854 | 854 | |
| 855 | - if ( empty( $payment_key ) ) { |
|
| 855 | + if (empty($payment_key)) { |
|
| 856 | 856 | return $return; |
| 857 | 857 | } |
| 858 | 858 | |
| 859 | 859 | global $give_receipt_args; |
| 860 | 860 | |
| 861 | - $give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key ); |
|
| 861 | + $give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key); |
|
| 862 | 862 | |
| 863 | - $user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] ); |
|
| 863 | + $user_id = (int) give_get_payment_user_id($give_receipt_args['id']); |
|
| 864 | 864 | |
| 865 | - $payment_meta = give_get_payment_meta( $give_receipt_args['id'] ); |
|
| 865 | + $payment_meta = give_get_payment_meta($give_receipt_args['id']); |
|
| 866 | 866 | |
| 867 | - if ( is_user_logged_in() ) { |
|
| 868 | - if ( $user_id === (int) get_current_user_id() ) { |
|
| 867 | + if (is_user_logged_in()) { |
|
| 868 | + if ($user_id === (int) get_current_user_id()) { |
|
| 869 | 869 | $return = true; |
| 870 | - } elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) { |
|
| 870 | + } elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) { |
|
| 871 | 871 | $return = true; |
| 872 | - } elseif ( current_user_can( 'view_give_sensitive_data' ) ) { |
|
| 872 | + } elseif (current_user_can('view_give_sensitive_data')) { |
|
| 873 | 873 | $return = true; |
| 874 | 874 | } |
| 875 | 875 | } |
| 876 | 876 | |
| 877 | 877 | $session = give_get_purchase_session(); |
| 878 | - if ( ! empty( $session ) && ! is_user_logged_in() ) { |
|
| 879 | - if ( $session['purchase_key'] === $payment_meta['key'] ) { |
|
| 878 | + if ( ! empty($session) && ! is_user_logged_in()) { |
|
| 879 | + if ($session['purchase_key'] === $payment_meta['key']) { |
|
| 880 | 880 | $return = true; |
| 881 | 881 | } |
| 882 | 882 | } |
| 883 | 883 | |
| 884 | - return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key ); |
|
| 884 | + return (bool) apply_filters('give_can_view_receipt', $return, $payment_key); |
|
| 885 | 885 | |
| 886 | 886 | } |