@@ -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 | |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function give_is_test_mode() { |
25 | 25 | |
26 | - $ret = give_is_setting_enabled( give_get_option( 'test_mode' ) ); |
|
26 | + $ret = give_is_setting_enabled(give_get_option('test_mode')); |
|
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 | |
@@ -39,18 +39,18 @@ discard block |
||
39 | 39 | |
40 | 40 | global $wp; |
41 | 41 | |
42 | - if ( get_option( 'permalink_structure' ) ) { |
|
43 | - $base = trailingslashit( home_url( $wp->request ) ); |
|
42 | + if (get_option('permalink_structure')) { |
|
43 | + $base = trailingslashit(home_url($wp->request)); |
|
44 | 44 | } else { |
45 | - $base = add_query_arg( $wp->query_string, '', trailingslashit( home_url( $wp->request ) ) ); |
|
46 | - $base = remove_query_arg( array( 'post_type', 'name' ), $base ); |
|
45 | + $base = add_query_arg($wp->query_string, '', trailingslashit(home_url($wp->request))); |
|
46 | + $base = remove_query_arg(array('post_type', 'name'), $base); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $scheme = is_ssl() ? 'https' : 'http'; |
50 | - $current_uri = set_url_scheme( $base, $scheme ); |
|
50 | + $current_uri = set_url_scheme($base, $scheme); |
|
51 | 51 | |
52 | - if ( is_front_page() ) { |
|
53 | - $current_uri = home_url( '/' ); |
|
52 | + if (is_front_page()) { |
|
53 | + $current_uri = home_url('/'); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @param string $current_uri |
62 | 62 | */ |
63 | - return apply_filters( 'give_get_current_page_url', $current_uri ); |
|
63 | + return apply_filters('give_get_current_page_url', $current_uri); |
|
64 | 64 | |
65 | 65 | } |
66 | 66 | |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | */ |
83 | 83 | $gateways = give_get_enabled_payment_gateways(); |
84 | 84 | |
85 | - if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) { |
|
85 | + if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) { |
|
86 | 86 | $ret = true; |
87 | - } elseif ( count( $gateways ) == 1 ) { |
|
87 | + } elseif (count($gateways) == 1) { |
|
88 | 88 | $ret = false; |
89 | - } elseif ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) { |
|
89 | + } elseif (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) { |
|
90 | 90 | $ret = false; |
91 | 91 | } |
92 | 92 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @param bool $ret |
99 | 99 | */ |
100 | - return (bool) apply_filters( 'give_is_cc_verify_enabled', $ret ); |
|
100 | + return (bool) apply_filters('give_is_cc_verify_enabled', $ret); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -109,26 +109,26 @@ discard block |
||
109 | 109 | function give_get_timezone_id() { |
110 | 110 | |
111 | 111 | // if site timezone string exists, return it. |
112 | - if ( $timezone = get_option( 'timezone_string' ) ) { |
|
112 | + if ($timezone = get_option('timezone_string')) { |
|
113 | 113 | return $timezone; |
114 | 114 | } |
115 | 115 | |
116 | 116 | // get UTC offset, if it isn't set return UTC. |
117 | - if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) { |
|
117 | + if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) { |
|
118 | 118 | return 'UTC'; |
119 | 119 | } |
120 | 120 | |
121 | 121 | // attempt to guess the timezone string from the UTC offset. |
122 | - $timezone = timezone_name_from_abbr( '', $utc_offset ); |
|
122 | + $timezone = timezone_name_from_abbr('', $utc_offset); |
|
123 | 123 | |
124 | 124 | // last try, guess timezone string manually. |
125 | - if ( $timezone === false ) { |
|
125 | + if ($timezone === false) { |
|
126 | 126 | |
127 | - $is_dst = date( 'I' ); |
|
127 | + $is_dst = date('I'); |
|
128 | 128 | |
129 | - foreach ( timezone_abbreviations_list() as $abbr ) { |
|
130 | - foreach ( $abbr as $city ) { |
|
131 | - if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) { |
|
129 | + foreach (timezone_abbreviations_list() as $abbr) { |
|
130 | + foreach ($abbr as $city) { |
|
131 | + if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) { |
|
132 | 132 | return $city['timezone_id']; |
133 | 133 | } |
134 | 134 | } |
@@ -152,13 +152,13 @@ discard block |
||
152 | 152 | |
153 | 153 | $ip = '127.0.0.1'; |
154 | 154 | |
155 | - if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { |
|
155 | + if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) { |
|
156 | 156 | // check ip from share internet |
157 | 157 | $ip = $_SERVER['HTTP_CLIENT_IP']; |
158 | - } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { |
|
158 | + } elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
159 | 159 | // to check ip is pass from proxy |
160 | 160 | $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; |
161 | - } elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) { |
|
161 | + } elseif ( ! empty($_SERVER['REMOTE_ADDR'])) { |
|
162 | 162 | $ip = $_SERVER['REMOTE_ADDR']; |
163 | 163 | } |
164 | 164 | |
@@ -167,15 +167,15 @@ discard block |
||
167 | 167 | * |
168 | 168 | * @since 1.0 |
169 | 169 | */ |
170 | - $ip = apply_filters( 'give_get_ip', $ip ); |
|
170 | + $ip = apply_filters('give_get_ip', $ip); |
|
171 | 171 | |
172 | 172 | // Filter empty values. |
173 | - if ( false !== strpos( $ip, ',' ) ) { |
|
174 | - $ip = give_clean( explode( ',', $ip ) ); |
|
175 | - $ip = array_filter( $ip ); |
|
176 | - $ip = implode( ',', $ip ); |
|
173 | + if (false !== strpos($ip, ',')) { |
|
174 | + $ip = give_clean(explode(',', $ip)); |
|
175 | + $ip = array_filter($ip); |
|
176 | + $ip = implode(',', $ip); |
|
177 | 177 | } else { |
178 | - $ip = give_clean( $ip ); |
|
178 | + $ip = give_clean($ip); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | return $ip; |
@@ -193,9 +193,9 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @uses Give()->session->set() |
195 | 195 | */ |
196 | -function give_set_purchase_session( $purchase_data = array() ) { |
|
197 | - Give()->session->set( 'give_purchase', $purchase_data ); |
|
198 | - Give()->session->set( 'give_email', $purchase_data['user_email'] ); |
|
196 | +function give_set_purchase_session($purchase_data = array()) { |
|
197 | + Give()->session->set('give_purchase', $purchase_data); |
|
198 | + Give()->session->set('give_email', $purchase_data['user_email']); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @return mixed array | false |
210 | 210 | */ |
211 | 211 | function give_get_purchase_session() { |
212 | - return Give()->session->get( 'give_purchase' ); |
|
212 | + return Give()->session->get('give_purchase'); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @return array|string |
221 | 221 | */ |
222 | 222 | function give_get_receipt_session() { |
223 | - return Give()->session->get( 'receipt_access' ); |
|
223 | + return Give()->session->get('receipt_access'); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | /** |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * @return array|string |
232 | 232 | */ |
233 | 233 | function give_get_history_session() { |
234 | - return (bool) Give()->session->get( 'history_access' ); |
|
234 | + return (bool) Give()->session->get('history_access'); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -243,16 +243,16 @@ discard block |
||
243 | 243 | * |
244 | 244 | * @return string By default, the name of the form. Then the price level text if any is found. |
245 | 245 | */ |
246 | -function give_payment_gateway_item_title( $payment_data ) { |
|
246 | +function give_payment_gateway_item_title($payment_data) { |
|
247 | 247 | |
248 | - $form_id = intval( $payment_data['post_data']['give-form-id'] ); |
|
249 | - $item_name = isset( $payment_data['post_data']['give-form-title'] ) ? $payment_data['post_data']['give-form-title'] : ''; |
|
250 | - $price_id = isset( $payment_data['post_data']['give-price-id'] ) ? $payment_data['post_data']['give-price-id'] : ''; |
|
248 | + $form_id = intval($payment_data['post_data']['give-form-id']); |
|
249 | + $item_name = isset($payment_data['post_data']['give-form-title']) ? $payment_data['post_data']['give-form-title'] : ''; |
|
250 | + $price_id = isset($payment_data['post_data']['give-price-id']) ? $payment_data['post_data']['give-price-id'] : ''; |
|
251 | 251 | |
252 | 252 | // Verify has variable prices. |
253 | - if ( give_has_variable_prices( $form_id ) && ! empty( $price_id ) ) { |
|
253 | + if (give_has_variable_prices($form_id) && ! empty($price_id)) { |
|
254 | 254 | |
255 | - $item_price_level_text = give_get_price_option_name( $form_id, $price_id, 0, false ); |
|
255 | + $item_price_level_text = give_get_price_option_name($form_id, $price_id, 0, false); |
|
256 | 256 | |
257 | 257 | /** |
258 | 258 | * Output donation level text if: |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | * 1. It's not a custom amount |
261 | 261 | * 2. The level field has actual text and isn't the amount (which is already displayed on the receipt). |
262 | 262 | */ |
263 | - if ( 'custom' !== $price_id && ! empty( $item_price_level_text ) ) { |
|
263 | + if ('custom' !== $price_id && ! empty($item_price_level_text)) { |
|
264 | 264 | // Matches a donation level - append level text. |
265 | - $item_name .= ' - ' . $item_price_level_text; |
|
265 | + $item_name .= ' - '.$item_price_level_text; |
|
266 | 266 | } |
267 | 267 | } |
268 | 268 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * |
278 | 278 | * @return string |
279 | 279 | */ |
280 | - return apply_filters( 'give_payment_gateway_item_title', $item_name, $form_id, $payment_data ); |
|
280 | + return apply_filters('give_payment_gateway_item_title', $item_name, $form_id, $payment_data); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
@@ -293,38 +293,38 @@ discard block |
||
293 | 293 | * |
294 | 294 | * @return string |
295 | 295 | */ |
296 | -function give_payment_gateway_donation_summary( $donation_data, $name_and_email = true, $length = 255 ) { |
|
296 | +function give_payment_gateway_donation_summary($donation_data, $name_and_email = true, $length = 255) { |
|
297 | 297 | |
298 | - $form_id = isset( $donation_data['post_data']['give-form-id'] ) ? $donation_data['post_data']['give-form-id'] : ''; |
|
299 | - $price_id = isset( $donation_data['post_data']['give-price-id'] ) ? $donation_data['post_data']['give-price-id'] : ''; |
|
298 | + $form_id = isset($donation_data['post_data']['give-form-id']) ? $donation_data['post_data']['give-form-id'] : ''; |
|
299 | + $price_id = isset($donation_data['post_data']['give-price-id']) ? $donation_data['post_data']['give-price-id'] : ''; |
|
300 | 300 | |
301 | 301 | // Form title. |
302 | - $summary = ( ! empty( $donation_data['post_data']['give-form-title'] ) ? $donation_data['post_data']['give-form-title'] : ( ! empty( $form_id ) ? wp_sprintf( __( 'Donation Form ID: %d', 'give' ), $form_id ) : __( 'Untitled donation form', 'give' ) ) ); |
|
302 | + $summary = ( ! empty($donation_data['post_data']['give-form-title']) ? $donation_data['post_data']['give-form-title'] : ( ! empty($form_id) ? wp_sprintf(__('Donation Form ID: %d', 'give'), $form_id) : __('Untitled donation form', 'give'))); |
|
303 | 303 | |
304 | 304 | // Form multilevel if applicable. |
305 | - if ( ! empty( $price_id ) && 'custom' !== $price_id ) { |
|
306 | - $summary .= ': ' . give_get_price_option_name( $form_id, $donation_data['post_data']['give-price-id'] ); |
|
305 | + if ( ! empty($price_id) && 'custom' !== $price_id) { |
|
306 | + $summary .= ': '.give_get_price_option_name($form_id, $donation_data['post_data']['give-price-id']); |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | // Add Donor's name + email if requested. |
310 | - if ( $name_and_email ) { |
|
310 | + if ($name_and_email) { |
|
311 | 311 | |
312 | 312 | // First name |
313 | - if ( isset( $donation_data['user_info']['first_name'] ) && ! empty( $donation_data['user_info']['first_name'] ) ) { |
|
314 | - $summary .= ' - ' . $donation_data['user_info']['first_name']; |
|
313 | + if (isset($donation_data['user_info']['first_name']) && ! empty($donation_data['user_info']['first_name'])) { |
|
314 | + $summary .= ' - '.$donation_data['user_info']['first_name']; |
|
315 | 315 | } |
316 | 316 | |
317 | - if ( isset( $donation_data['user_info']['last_name'] ) && ! empty( $donation_data['user_info']['last_name'] ) ) { |
|
318 | - $summary .= ' ' . $donation_data['user_info']['last_name']; |
|
317 | + if (isset($donation_data['user_info']['last_name']) && ! empty($donation_data['user_info']['last_name'])) { |
|
318 | + $summary .= ' '.$donation_data['user_info']['last_name']; |
|
319 | 319 | } |
320 | 320 | |
321 | - $summary .= ' (' . $donation_data['user_email'] . ')'; |
|
321 | + $summary .= ' ('.$donation_data['user_email'].')'; |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | // Cut the length |
325 | - $summary = substr( $summary, 0, $length ); |
|
325 | + $summary = substr($summary, 0, $length); |
|
326 | 326 | |
327 | - return apply_filters( 'give_payment_gateway_donation_summary', $summary ); |
|
327 | + return apply_filters('give_payment_gateway_donation_summary', $summary); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | |
@@ -339,31 +339,31 @@ discard block |
||
339 | 339 | function give_get_host() { |
340 | 340 | $host = false; |
341 | 341 | |
342 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
342 | + if (defined('WPE_APIKEY')) { |
|
343 | 343 | $host = 'WP Engine'; |
344 | - } elseif ( defined( 'PAGELYBIN' ) ) { |
|
344 | + } elseif (defined('PAGELYBIN')) { |
|
345 | 345 | $host = 'Pagely'; |
346 | - } elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
346 | + } elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
347 | 347 | $host = 'ICDSoft'; |
348 | - } elseif ( DB_HOST == 'mysqlv5' ) { |
|
348 | + } elseif (DB_HOST == 'mysqlv5') { |
|
349 | 349 | $host = 'NetworkSolutions'; |
350 | - } elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
350 | + } elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
351 | 351 | $host = 'iPage'; |
352 | - } elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
352 | + } elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
353 | 353 | $host = 'IPower'; |
354 | - } elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
354 | + } elseif (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
355 | 355 | $host = 'MediaTemple Grid'; |
356 | - } elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
356 | + } elseif (strpos(DB_HOST, '.pair.com') !== false) { |
|
357 | 357 | $host = 'pair Networks'; |
358 | - } elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
358 | + } elseif (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
359 | 359 | $host = 'Rackspace Cloud'; |
360 | - } elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
360 | + } elseif (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
361 | 361 | $host = 'SysFix.eu Power Hosting'; |
362 | - } elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
362 | + } elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
363 | 363 | $host = 'Flywheel'; |
364 | 364 | } else { |
365 | 365 | // Adding a general fallback for data gathering |
366 | - $host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME']; |
|
366 | + $host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME']; |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | return $host; |
@@ -379,67 +379,67 @@ discard block |
||
379 | 379 | * |
380 | 380 | * @return bool true if host matches, false if not |
381 | 381 | */ |
382 | -function give_is_host( $host = false ) { |
|
382 | +function give_is_host($host = false) { |
|
383 | 383 | |
384 | 384 | $return = false; |
385 | 385 | |
386 | - if ( $host ) { |
|
387 | - $host = str_replace( ' ', '', strtolower( $host ) ); |
|
386 | + if ($host) { |
|
387 | + $host = str_replace(' ', '', strtolower($host)); |
|
388 | 388 | |
389 | - switch ( $host ) { |
|
389 | + switch ($host) { |
|
390 | 390 | case 'wpengine': |
391 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
391 | + if (defined('WPE_APIKEY')) { |
|
392 | 392 | $return = true; |
393 | 393 | } |
394 | 394 | break; |
395 | 395 | case 'pagely': |
396 | - if ( defined( 'PAGELYBIN' ) ) { |
|
396 | + if (defined('PAGELYBIN')) { |
|
397 | 397 | $return = true; |
398 | 398 | } |
399 | 399 | break; |
400 | 400 | case 'icdsoft': |
401 | - if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
401 | + if (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
402 | 402 | $return = true; |
403 | 403 | } |
404 | 404 | break; |
405 | 405 | case 'networksolutions': |
406 | - if ( DB_HOST == 'mysqlv5' ) { |
|
406 | + if (DB_HOST == 'mysqlv5') { |
|
407 | 407 | $return = true; |
408 | 408 | } |
409 | 409 | break; |
410 | 410 | case 'ipage': |
411 | - if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
411 | + if (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
412 | 412 | $return = true; |
413 | 413 | } |
414 | 414 | break; |
415 | 415 | case 'ipower': |
416 | - if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
416 | + if (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
417 | 417 | $return = true; |
418 | 418 | } |
419 | 419 | break; |
420 | 420 | case 'mediatemplegrid': |
421 | - if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
421 | + if (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
422 | 422 | $return = true; |
423 | 423 | } |
424 | 424 | break; |
425 | 425 | case 'pairnetworks': |
426 | - if ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
426 | + if (strpos(DB_HOST, '.pair.com') !== false) { |
|
427 | 427 | $return = true; |
428 | 428 | } |
429 | 429 | break; |
430 | 430 | case 'rackspacecloud': |
431 | - if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
431 | + if (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
432 | 432 | $return = true; |
433 | 433 | } |
434 | 434 | break; |
435 | 435 | case 'sysfix.eu': |
436 | 436 | case 'sysfix.eupowerhosting': |
437 | - if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
437 | + if (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
438 | 438 | $return = true; |
439 | 439 | } |
440 | 440 | break; |
441 | 441 | case 'flywheel': |
442 | - if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
442 | + if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
443 | 443 | $return = true; |
444 | 444 | } |
445 | 445 | break; |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | * @param string $replacement Optional. The function that should have been called. |
473 | 473 | * @param array $backtrace Optional. Contains stack backtrace of deprecated function. |
474 | 474 | */ |
475 | -function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) { |
|
475 | +function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) { |
|
476 | 476 | |
477 | 477 | /** |
478 | 478 | * Fires while give deprecated function call occurs. |
@@ -485,19 +485,19 @@ discard block |
||
485 | 485 | * @param string $replacement Optional. The function that should have been called. |
486 | 486 | * @param string $version The plugin version that deprecated the function. |
487 | 487 | */ |
488 | - do_action( 'give_deprecated_function_run', $function, $replacement, $version ); |
|
488 | + do_action('give_deprecated_function_run', $function, $replacement, $version); |
|
489 | 489 | |
490 | - $show_errors = current_user_can( 'manage_options' ); |
|
490 | + $show_errors = current_user_can('manage_options'); |
|
491 | 491 | |
492 | 492 | // Allow plugin to filter the output error trigger. |
493 | - if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) { |
|
494 | - if ( ! is_null( $replacement ) ) { |
|
495 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) ); |
|
496 | - 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. |
|
493 | + if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) { |
|
494 | + if ( ! is_null($replacement)) { |
|
495 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement)); |
|
496 | + 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. |
|
497 | 497 | // Alternatively we could dump this to a file. |
498 | 498 | } else { |
499 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) ); |
|
500 | - 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. |
|
499 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version)); |
|
500 | + 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. |
|
501 | 501 | // Alternatively we could dump this to a file. |
502 | 502 | } |
503 | 503 | } |
@@ -511,11 +511,11 @@ discard block |
||
511 | 511 | * @return string $post_id |
512 | 512 | */ |
513 | 513 | function give_get_admin_post_id() { |
514 | - $post_id = isset( $_REQUEST['post'] ) ? absint( $_REQUEST['post'] ) : null; |
|
514 | + $post_id = isset($_REQUEST['post']) ? absint($_REQUEST['post']) : null; |
|
515 | 515 | |
516 | - $post_id = ! empty( $post_id ) ? $post_id : ( isset( $_REQUEST['post_id'] ) ? absint( $_REQUEST['post_id'] ) : null ); |
|
516 | + $post_id = ! empty($post_id) ? $post_id : (isset($_REQUEST['post_id']) ? absint($_REQUEST['post_id']) : null); |
|
517 | 517 | |
518 | - $post_id = ! empty( $post_id ) ? $post_id : ( isset( $_REQUEST['post_ID'] ) ? absint( $_REQUEST['post_ID'] ) : null ); |
|
518 | + $post_id = ! empty($post_id) ? $post_id : (isset($_REQUEST['post_ID']) ? absint($_REQUEST['post_ID']) : null); |
|
519 | 519 | |
520 | 520 | return $post_id; |
521 | 521 | } |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | * @return string Arg separator output |
528 | 528 | */ |
529 | 529 | function give_get_php_arg_separator_output() { |
530 | - return ini_get( 'arg_separator.output' ); |
|
530 | + return ini_get('arg_separator.output'); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | |
@@ -542,10 +542,10 @@ discard block |
||
542 | 542 | * |
543 | 543 | * @return string Short month name |
544 | 544 | */ |
545 | -function give_month_num_to_name( $n ) { |
|
546 | - $timestamp = mktime( 0, 0, 0, $n, 1, 2005 ); |
|
545 | +function give_month_num_to_name($n) { |
|
546 | + $timestamp = mktime(0, 0, 0, $n, 1, 2005); |
|
547 | 547 | |
548 | - return date_i18n( 'M', $timestamp ); |
|
548 | + return date_i18n('M', $timestamp); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | |
@@ -558,10 +558,10 @@ discard block |
||
558 | 558 | * |
559 | 559 | * @return bool Whether or not function is disabled. |
560 | 560 | */ |
561 | -function give_is_func_disabled( $function ) { |
|
562 | - $disabled = explode( ',', ini_get( 'disable_functions' ) ); |
|
561 | +function give_is_func_disabled($function) { |
|
562 | + $disabled = explode(',', ini_get('disable_functions')); |
|
563 | 563 | |
564 | - return in_array( $function, $disabled ); |
|
564 | + return in_array($function, $disabled); |
|
565 | 565 | } |
566 | 566 | |
567 | 567 | /** |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | function give_get_newsletter() { |
573 | 573 | ?> |
574 | 574 | |
575 | - <p class="newsletter-intro"><?php esc_html_e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p> |
|
575 | + <p class="newsletter-intro"><?php esc_html_e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p> |
|
576 | 576 | |
577 | 577 | <div class="give-newsletter-form-wrap"> |
578 | 578 | |
@@ -580,33 +580,33 @@ discard block |
||
580 | 580 | method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" |
581 | 581 | target="_blank"> |
582 | 582 | <div class="give-newsletter-confirmation"> |
583 | - <p><?php esc_html_e( 'To complete your subscription, click the confirmation link in your email. Thank you!', 'give' ); ?></p> |
|
583 | + <p><?php esc_html_e('To complete your subscription, click the confirmation link in your email. Thank you!', 'give'); ?></p> |
|
584 | 584 | </div> |
585 | 585 | |
586 | 586 | <table class="form-table give-newsletter-form"> |
587 | 587 | <tr valign="middle"> |
588 | 588 | <td> |
589 | 589 | <label for="mce-EMAIL" |
590 | - class="screen-reader-text"><?php esc_html_e( 'Email Address (required)', 'give' ); ?></label> |
|
590 | + class="screen-reader-text"><?php esc_html_e('Email Address (required)', 'give'); ?></label> |
|
591 | 591 | <input type="email" name="EMAIL" id="mce-EMAIL" |
592 | - placeholder="<?php esc_attr_e( 'Email Address (required)', 'give' ); ?>" |
|
592 | + placeholder="<?php esc_attr_e('Email Address (required)', 'give'); ?>" |
|
593 | 593 | class="required email" value="" required> |
594 | 594 | </td> |
595 | 595 | <td> |
596 | 596 | <label for="mce-FNAME" |
597 | - class="screen-reader-text"><?php esc_html_e( 'First Name', 'give' ); ?></label> |
|
597 | + class="screen-reader-text"><?php esc_html_e('First Name', 'give'); ?></label> |
|
598 | 598 | <input type="text" name="FNAME" id="mce-FNAME" |
599 | - placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" class="" value="" required> |
|
599 | + placeholder="<?php esc_attr_e('First Name', 'give'); ?>" class="" value="" required> |
|
600 | 600 | </td> |
601 | 601 | <td> |
602 | 602 | <label for="mce-LNAME" |
603 | - class="screen-reader-text"><?php esc_html_e( 'Last Name', 'give' ); ?></label> |
|
603 | + class="screen-reader-text"><?php esc_html_e('Last Name', 'give'); ?></label> |
|
604 | 604 | <input type="text" name="LNAME" id="mce-LNAME" |
605 | - placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" class="" value=""> |
|
605 | + placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" class="" value=""> |
|
606 | 606 | </td> |
607 | 607 | <td> |
608 | 608 | <input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button" |
609 | - value="<?php esc_attr_e( 'Subscribe', 'give' ); ?>"> |
|
609 | + value="<?php esc_attr_e('Subscribe', 'give'); ?>"> |
|
610 | 610 | </td> |
611 | 611 | </tr> |
612 | 612 | </table> |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | * |
664 | 664 | * @return string |
665 | 665 | */ |
666 | -function give_svg_icons( $icon ) { |
|
666 | +function give_svg_icons($icon) { |
|
667 | 667 | |
668 | 668 | // Store your SVGs in an associative array |
669 | 669 | $svgs = array( |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | ); |
676 | 676 | |
677 | 677 | // Return the chosen icon's SVG string |
678 | - return $svgs[ $icon ]; |
|
678 | + return $svgs[$icon]; |
|
679 | 679 | } |
680 | 680 | |
681 | 681 | /** |
@@ -687,15 +687,15 @@ discard block |
||
687 | 687 | * |
688 | 688 | * @return mixed |
689 | 689 | */ |
690 | -function modify_nav_menu_meta_box_object( $post_type ) { |
|
691 | - if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) { |
|
692 | - $post_type->labels->name = esc_html__( 'Donation Forms', 'give' ); |
|
690 | +function modify_nav_menu_meta_box_object($post_type) { |
|
691 | + if (isset($post_type->name) && $post_type->name == 'give_forms') { |
|
692 | + $post_type->labels->name = esc_html__('Donation Forms', 'give'); |
|
693 | 693 | } |
694 | 694 | |
695 | 695 | return $post_type; |
696 | 696 | } |
697 | 697 | |
698 | -add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' ); |
|
698 | +add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object'); |
|
699 | 699 | |
700 | 700 | /** |
701 | 701 | * Show Donation Forms Post Type in Appearance > Menus by default on fresh install. |
@@ -712,30 +712,30 @@ discard block |
||
712 | 712 | $screen = get_current_screen(); |
713 | 713 | |
714 | 714 | // Proceed, if current screen is navigation menus. |
715 | - if ( 'nav-menus' === $screen->id && give_is_setting_enabled( give_get_option( 'forms_singular' ) ) && ! get_user_option( 'give_is_donation_forms_menu_updated' ) ) { |
|
715 | + if ('nav-menus' === $screen->id && give_is_setting_enabled(give_get_option('forms_singular')) && ! get_user_option('give_is_donation_forms_menu_updated')) { |
|
716 | 716 | |
717 | 717 | // Return false, if it fails to retrieve hidden meta box list and is not admin. |
718 | - if ( ! is_admin() || ( ! $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus' ) ) ) { |
|
718 | + if ( ! is_admin() || ( ! $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus'))) { |
|
719 | 719 | return false; |
720 | 720 | } |
721 | 721 | |
722 | 722 | // Return false, In case, we don't find 'Donation Form' in hidden meta box list. |
723 | - if ( ! in_array( 'add-post-type-give_forms', $hidden_meta_boxes, true ) ) { |
|
723 | + if ( ! in_array('add-post-type-give_forms', $hidden_meta_boxes, true)) { |
|
724 | 724 | return false; |
725 | 725 | } |
726 | 726 | |
727 | 727 | // Exclude 'Donation Form' value from hidden meta box's list. |
728 | - $hidden_meta_boxes = array_diff( $hidden_meta_boxes, array( 'add-post-type-give_forms' ) ); |
|
728 | + $hidden_meta_boxes = array_diff($hidden_meta_boxes, array('add-post-type-give_forms')); |
|
729 | 729 | |
730 | 730 | // Get current user ID. |
731 | 731 | $user = wp_get_current_user(); |
732 | 732 | |
733 | - update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true ); |
|
734 | - update_user_option( $user->ID, 'give_is_donation_forms_menu_updated', true, true ); |
|
733 | + update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true); |
|
734 | + update_user_option($user->ID, 'give_is_donation_forms_menu_updated', true, true); |
|
735 | 735 | } |
736 | 736 | } |
737 | 737 | |
738 | -add_action( 'current_screen', 'give_donation_metabox_menu' ); |
|
738 | +add_action('current_screen', 'give_donation_metabox_menu'); |
|
739 | 739 | |
740 | 740 | /** |
741 | 741 | * Array_column backup usage |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | * @license https://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,43 +767,43 @@ discard block |
||
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( sprintf( esc_html__( 'array_column() expects at least 2 parameters, %s given.', 'give' ), $argc ), E_USER_WARNING ); |
|
777 | + if ($argc < 2) { |
|
778 | + trigger_error(sprintf(esc_html__('array_column() expects at least 2 parameters, %s given.', 'give'), $argc), E_USER_WARNING); |
|
779 | 779 | |
780 | 780 | return null; |
781 | 781 | } |
782 | 782 | |
783 | - if ( ! is_array( $params[0] ) ) { |
|
784 | - trigger_error( sprintf( esc_html__( 'array_column() expects parameter 1 to be array, %s given.', 'give' ), gettype( $params[0] ) ), E_USER_WARNING ); |
|
783 | + if ( ! is_array($params[0])) { |
|
784 | + trigger_error(sprintf(esc_html__('array_column() expects parameter 1 to be array, %s given.', 'give'), gettype($params[0])), E_USER_WARNING); |
|
785 | 785 | |
786 | 786 | return null; |
787 | 787 | } |
788 | 788 | |
789 | - if ( ! is_int( $params[1] ) && ! is_float( $params[1] ) && ! is_string( $params[1] ) && $params[1] !== null && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) ) { |
|
790 | - trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING ); |
|
789 | + if ( ! is_int($params[1]) && ! is_float($params[1]) && ! is_string($params[1]) && $params[1] !== null && ! (is_object($params[1]) && method_exists($params[1], '__toString'))) { |
|
790 | + trigger_error(esc_html__('array_column(): The column key should be either a string or an integer.', 'give'), E_USER_WARNING); |
|
791 | 791 | |
792 | 792 | return false; |
793 | 793 | } |
794 | 794 | |
795 | - if ( isset( $params[2] ) && ! is_int( $params[2] ) && ! is_float( $params[2] ) && ! is_string( $params[2] ) && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) ) { |
|
796 | - trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING ); |
|
795 | + if (isset($params[2]) && ! is_int($params[2]) && ! is_float($params[2]) && ! is_string($params[2]) && ! (is_object($params[2]) && method_exists($params[2], '__toString'))) { |
|
796 | + trigger_error(esc_html__('array_column(): The index key should be either a string or an integer.', 'give'), E_USER_WARNING); |
|
797 | 797 | |
798 | 798 | return false; |
799 | 799 | } |
800 | 800 | |
801 | 801 | $paramsInput = $params[0]; |
802 | - $paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null; |
|
802 | + $paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null; |
|
803 | 803 | |
804 | 804 | $paramsIndexKey = null; |
805 | - if ( isset( $params[2] ) ) { |
|
806 | - if ( is_float( $params[2] ) || is_int( $params[2] ) ) { |
|
805 | + if (isset($params[2])) { |
|
806 | + if (is_float($params[2]) || is_int($params[2])) { |
|
807 | 807 | $paramsIndexKey = (int) $params[2]; |
808 | 808 | } else { |
809 | 809 | $paramsIndexKey = (string) $params[2]; |
@@ -812,26 +812,26 @@ discard block |
||
812 | 812 | |
813 | 813 | $resultArray = array(); |
814 | 814 | |
815 | - foreach ( $paramsInput as $row ) { |
|
815 | + foreach ($paramsInput as $row) { |
|
816 | 816 | $key = $value = null; |
817 | 817 | $keySet = $valueSet = false; |
818 | 818 | |
819 | - if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) { |
|
819 | + if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) { |
|
820 | 820 | $keySet = true; |
821 | - $key = (string) $row[ $paramsIndexKey ]; |
|
821 | + $key = (string) $row[$paramsIndexKey]; |
|
822 | 822 | } |
823 | 823 | |
824 | - if ( $paramsColumnKey === null ) { |
|
824 | + if ($paramsColumnKey === null) { |
|
825 | 825 | $valueSet = true; |
826 | 826 | $value = $row; |
827 | - } elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) { |
|
827 | + } elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) { |
|
828 | 828 | $valueSet = true; |
829 | - $value = $row[ $paramsColumnKey ]; |
|
829 | + $value = $row[$paramsColumnKey]; |
|
830 | 830 | } |
831 | 831 | |
832 | - if ( $valueSet ) { |
|
833 | - if ( $keySet ) { |
|
834 | - $resultArray[ $key ] = $value; |
|
832 | + if ($valueSet) { |
|
833 | + if ($keySet) { |
|
834 | + $resultArray[$key] = $value; |
|
835 | 835 | } else { |
836 | 836 | $resultArray[] = $value; |
837 | 837 | } |
@@ -851,54 +851,54 @@ discard block |
||
851 | 851 | * |
852 | 852 | * @return bool Whether the receipt is visible or not. |
853 | 853 | */ |
854 | -function give_can_view_receipt( $payment_key = '' ) { |
|
854 | +function give_can_view_receipt($payment_key = '') { |
|
855 | 855 | |
856 | 856 | $return = false; |
857 | 857 | |
858 | - if ( empty( $payment_key ) ) { |
|
858 | + if (empty($payment_key)) { |
|
859 | 859 | return $return; |
860 | 860 | } |
861 | 861 | |
862 | 862 | global $give_receipt_args; |
863 | 863 | |
864 | - $give_receipt_args['id'] = give_get_donation_id_by_key( $payment_key ); |
|
864 | + $give_receipt_args['id'] = give_get_donation_id_by_key($payment_key); |
|
865 | 865 | |
866 | - $user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] ); |
|
866 | + $user_id = (int) give_get_payment_user_id($give_receipt_args['id']); |
|
867 | 867 | |
868 | - $payment_meta = give_get_payment_meta( $give_receipt_args['id'] ); |
|
868 | + $payment_meta = give_get_payment_meta($give_receipt_args['id']); |
|
869 | 869 | |
870 | - if ( is_user_logged_in() ) { |
|
871 | - if ( $user_id === (int) get_current_user_id() ) { |
|
870 | + if (is_user_logged_in()) { |
|
871 | + if ($user_id === (int) get_current_user_id()) { |
|
872 | 872 | $return = true; |
873 | - } elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) { |
|
873 | + } elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) { |
|
874 | 874 | $return = true; |
875 | - } elseif ( current_user_can( 'view_give_sensitive_data' ) ) { |
|
875 | + } elseif (current_user_can('view_give_sensitive_data')) { |
|
876 | 876 | $return = true; |
877 | 877 | } |
878 | 878 | } |
879 | 879 | |
880 | 880 | // Check whether it is purchase session? |
881 | 881 | $purchase_session = give_get_purchase_session(); |
882 | - if ( ! empty( $purchase_session ) && ! is_user_logged_in() ) { |
|
883 | - if ( $purchase_session['purchase_key'] === $payment_meta['key'] ) { |
|
882 | + if ( ! empty($purchase_session) && ! is_user_logged_in()) { |
|
883 | + if ($purchase_session['purchase_key'] === $payment_meta['key']) { |
|
884 | 884 | $return = true; |
885 | 885 | } |
886 | 886 | } |
887 | 887 | |
888 | 888 | // Check whether it is receipt access session? |
889 | 889 | $receipt_session = give_get_receipt_session(); |
890 | - if ( ! empty( $receipt_session ) && ! is_user_logged_in() ) { |
|
891 | - if ( $receipt_session === $payment_meta['key'] ) { |
|
890 | + if ( ! empty($receipt_session) && ! is_user_logged_in()) { |
|
891 | + if ($receipt_session === $payment_meta['key']) { |
|
892 | 892 | $return = true; |
893 | 893 | } |
894 | 894 | } |
895 | 895 | |
896 | 896 | // Check whether it is history access session? |
897 | - if ( true === give_get_history_session() ) { |
|
897 | + if (true === give_get_history_session()) { |
|
898 | 898 | $return = true; |
899 | 899 | } |
900 | 900 | |
901 | - return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key ); |
|
901 | + return (bool) apply_filters('give_can_view_receipt', $return, $payment_key); |
|
902 | 902 | |
903 | 903 | } |
904 | 904 | |
@@ -907,7 +907,7 @@ discard block |
||
907 | 907 | * |
908 | 908 | * Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar |
909 | 909 | */ |
910 | -if ( ! function_exists( 'cal_days_in_month' ) ) { |
|
910 | +if ( ! function_exists('cal_days_in_month')) { |
|
911 | 911 | /** |
912 | 912 | * cal_days_in_month |
913 | 913 | * |
@@ -917,8 +917,8 @@ discard block |
||
917 | 917 | * |
918 | 918 | * @return bool|string |
919 | 919 | */ |
920 | - function cal_days_in_month( $calendar, $month, $year ) { |
|
921 | - return date( 't', mktime( 0, 0, 0, $month, 1, $year ) ); |
|
920 | + function cal_days_in_month($calendar, $month, $year) { |
|
921 | + return date('t', mktime(0, 0, 0, $month, 1, $year)); |
|
922 | 922 | } |
923 | 923 | } |
924 | 924 | |
@@ -937,40 +937,40 @@ discard block |
||
937 | 937 | */ |
938 | 938 | function give_get_plugins() { |
939 | 939 | $plugins = get_plugins(); |
940 | - $active_plugin_paths = (array) get_option( 'active_plugins', array() ); |
|
940 | + $active_plugin_paths = (array) get_option('active_plugins', array()); |
|
941 | 941 | |
942 | - if ( is_multisite() ) { |
|
943 | - $network_activated_plugin_paths = array_keys( get_site_option( 'active_sitewide_plugins', array() ) ); |
|
944 | - $active_plugin_paths = array_merge( $active_plugin_paths, $network_activated_plugin_paths ); |
|
942 | + if (is_multisite()) { |
|
943 | + $network_activated_plugin_paths = array_keys(get_site_option('active_sitewide_plugins', array())); |
|
944 | + $active_plugin_paths = array_merge($active_plugin_paths, $network_activated_plugin_paths); |
|
945 | 945 | } |
946 | 946 | |
947 | - foreach ( $plugins as $plugin_path => $plugin_data ) { |
|
947 | + foreach ($plugins as $plugin_path => $plugin_data) { |
|
948 | 948 | // Is plugin active? |
949 | - if ( in_array( $plugin_path, $active_plugin_paths ) ) { |
|
950 | - $plugins[ $plugin_path ]['Status'] = 'active'; |
|
949 | + if (in_array($plugin_path, $active_plugin_paths)) { |
|
950 | + $plugins[$plugin_path]['Status'] = 'active'; |
|
951 | 951 | } else { |
952 | - $plugins[ $plugin_path ]['Status'] = 'inactive'; |
|
952 | + $plugins[$plugin_path]['Status'] = 'inactive'; |
|
953 | 953 | } |
954 | 954 | |
955 | - $dirname = strtolower( dirname( $plugin_path ) ); |
|
955 | + $dirname = strtolower(dirname($plugin_path)); |
|
956 | 956 | |
957 | 957 | // Is plugin a Give add-on by WordImpress? |
958 | - if ( strstr( $dirname, 'give-' ) && strstr( $plugin_data['AuthorURI'], 'wordimpress.com' ) ) { |
|
958 | + if (strstr($dirname, 'give-') && strstr($plugin_data['AuthorURI'], 'wordimpress.com')) { |
|
959 | 959 | // Plugin is a Give-addon. |
960 | - $plugins[ $plugin_path ]['Type'] = 'add-on'; |
|
960 | + $plugins[$plugin_path]['Type'] = 'add-on'; |
|
961 | 961 | |
962 | 962 | /* @var stdClass $license_active */ |
963 | - $license_active = __give_get_active_license_info( Give_License::get_short_name( $plugin_data['Name'] ) ); |
|
963 | + $license_active = __give_get_active_license_info(Give_License::get_short_name($plugin_data['Name'])); |
|
964 | 964 | |
965 | 965 | // Does a valid license exist? |
966 | - if ( ! empty( $license_active ) && 'valid' === $license_active->license ) { |
|
967 | - $plugins[ $plugin_path ]['License'] = true; |
|
966 | + if ( ! empty($license_active) && 'valid' === $license_active->license) { |
|
967 | + $plugins[$plugin_path]['License'] = true; |
|
968 | 968 | } else { |
969 | - $plugins[ $plugin_path ]['License'] = false; |
|
969 | + $plugins[$plugin_path]['License'] = false; |
|
970 | 970 | } |
971 | 971 | } else { |
972 | 972 | // Plugin is not a Give add-on. |
973 | - $plugins[ $plugin_path ]['Type'] = 'other'; |
|
973 | + $plugins[$plugin_path]['Type'] = 'other'; |
|
974 | 974 | } |
975 | 975 | } |
976 | 976 | |
@@ -986,13 +986,13 @@ discard block |
||
986 | 986 | * |
987 | 987 | * @return bool |
988 | 988 | */ |
989 | -function give_is_terms_enabled( $form_id ) { |
|
990 | - $form_option = give_get_meta( $form_id, '_give_terms_option', true ); |
|
989 | +function give_is_terms_enabled($form_id) { |
|
990 | + $form_option = give_get_meta($form_id, '_give_terms_option', true); |
|
991 | 991 | |
992 | - if ( give_is_setting_enabled( $form_option, 'global' ) && give_is_setting_enabled( give_get_option( 'terms' ) ) ) { |
|
992 | + if (give_is_setting_enabled($form_option, 'global') && give_is_setting_enabled(give_get_option('terms'))) { |
|
993 | 993 | return true; |
994 | 994 | |
995 | - } elseif ( give_is_setting_enabled( $form_option ) ) { |
|
995 | + } elseif (give_is_setting_enabled($form_option)) { |
|
996 | 996 | return true; |
997 | 997 | |
998 | 998 | } else { |
@@ -1016,10 +1016,10 @@ discard block |
||
1016 | 1016 | * |
1017 | 1017 | * @return WP_Error|bool |
1018 | 1018 | */ |
1019 | -function give_delete_donation_stats( $date_range = '', $args = array() ) { |
|
1019 | +function give_delete_donation_stats($date_range = '', $args = array()) { |
|
1020 | 1020 | |
1021 | 1021 | // Delete all cache. |
1022 | - $status = Give_Cache::delete( Give_Cache::get_options_like( 'give_stats' ) ); |
|
1022 | + $status = Give_Cache::delete(Give_Cache::get_options_like('give_stats')); |
|
1023 | 1023 | |
1024 | 1024 | /** |
1025 | 1025 | * Fire the action when donation stats delete. |
@@ -1029,7 +1029,7 @@ discard block |
||
1029 | 1029 | * @param string|array $date_range |
1030 | 1030 | * @param array $args |
1031 | 1031 | */ |
1032 | - do_action( 'give_delete_donation_stats', $status, $date_range, $args ); |
|
1032 | + do_action('give_delete_donation_stats', $status, $date_range, $args); |
|
1033 | 1033 | |
1034 | 1034 | return $status; |
1035 | 1035 | } |
@@ -1043,7 +1043,7 @@ discard block |
||
1043 | 1043 | function give_is_add_new_form_page() { |
1044 | 1044 | $status = false; |
1045 | 1045 | |
1046 | - if ( false !== strpos( $_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms' ) ) { |
|
1046 | + if (false !== strpos($_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms')) { |
|
1047 | 1047 | $status = true; |
1048 | 1048 | } |
1049 | 1049 | |
@@ -1066,15 +1066,15 @@ discard block |
||
1066 | 1066 | * |
1067 | 1067 | * @return mixed |
1068 | 1068 | */ |
1069 | -function give_get_meta( $id, $meta_key = '', $single = false, $default = false ) { |
|
1069 | +function give_get_meta($id, $meta_key = '', $single = false, $default = false) { |
|
1070 | 1070 | /** |
1071 | 1071 | * Filter the meta value |
1072 | 1072 | * |
1073 | 1073 | * @since 1.8.8 |
1074 | 1074 | */ |
1075 | - $meta_value = apply_filters( 'give_get_meta', get_post_meta( $id, $meta_key, $single ), $id, $meta_key, $default ); |
|
1075 | + $meta_value = apply_filters('give_get_meta', get_post_meta($id, $meta_key, $single), $id, $meta_key, $default); |
|
1076 | 1076 | |
1077 | - if ( ( empty( $meta_key ) || empty( $meta_value ) ) && $default ) { |
|
1077 | + if ((empty($meta_key) || empty($meta_value)) && $default) { |
|
1078 | 1078 | $meta_value = $default; |
1079 | 1079 | } |
1080 | 1080 | |
@@ -1093,15 +1093,15 @@ discard block |
||
1093 | 1093 | * |
1094 | 1094 | * @return mixed |
1095 | 1095 | */ |
1096 | -function give_update_meta( $id, $meta_key, $meta_value, $prev_value = '' ) { |
|
1097 | - $status = update_post_meta( $id, $meta_key, $meta_value, $prev_value ); |
|
1096 | +function give_update_meta($id, $meta_key, $meta_value, $prev_value = '') { |
|
1097 | + $status = update_post_meta($id, $meta_key, $meta_value, $prev_value); |
|
1098 | 1098 | |
1099 | 1099 | /** |
1100 | 1100 | * Filter the meta value update status |
1101 | 1101 | * |
1102 | 1102 | * @since 1.8.8 |
1103 | 1103 | */ |
1104 | - return apply_filters( 'give_update_meta', $status, $id, $meta_key, $meta_value ); |
|
1104 | + return apply_filters('give_update_meta', $status, $id, $meta_key, $meta_value); |
|
1105 | 1105 | } |
1106 | 1106 | |
1107 | 1107 | /** |
@@ -1115,15 +1115,15 @@ discard block |
||
1115 | 1115 | * |
1116 | 1116 | * @return mixed |
1117 | 1117 | */ |
1118 | -function give_delete_meta( $id, $meta_key, $meta_value = '' ) { |
|
1119 | - $status = delete_post_meta( $id, $meta_key, $meta_value ); |
|
1118 | +function give_delete_meta($id, $meta_key, $meta_value = '') { |
|
1119 | + $status = delete_post_meta($id, $meta_key, $meta_value); |
|
1120 | 1120 | |
1121 | 1121 | /** |
1122 | 1122 | * Filter the meta value delete status |
1123 | 1123 | * |
1124 | 1124 | * @since 1.8.8 |
1125 | 1125 | */ |
1126 | - return apply_filters( 'give_delete_meta', $status, $id, $meta_key, $meta_value ); |
|
1126 | + return apply_filters('give_delete_meta', $status, $id, $meta_key, $meta_value); |
|
1127 | 1127 | } |
1128 | 1128 | |
1129 | 1129 | /** |
@@ -1135,22 +1135,22 @@ discard block |
||
1135 | 1135 | * |
1136 | 1136 | * @return bool If the action has been added to the completed actions array |
1137 | 1137 | */ |
1138 | -function give_has_upgrade_completed( $upgrade_action = '' ) { |
|
1138 | +function give_has_upgrade_completed($upgrade_action = '') { |
|
1139 | 1139 | // Bailout. |
1140 | - if ( empty( $upgrade_action ) ) { |
|
1140 | + if (empty($upgrade_action)) { |
|
1141 | 1141 | return false; |
1142 | 1142 | } |
1143 | 1143 | |
1144 | 1144 | // Fresh install? |
1145 | 1145 | // If fresh install then all upgrades will be consider as completed. |
1146 | - $is_fresh_install = ! get_option( 'give_version' ); |
|
1147 | - if ( $is_fresh_install ) { |
|
1146 | + $is_fresh_install = ! get_option('give_version'); |
|
1147 | + if ($is_fresh_install) { |
|
1148 | 1148 | return true; |
1149 | 1149 | } |
1150 | 1150 | |
1151 | 1151 | $completed_upgrades = give_get_completed_upgrades(); |
1152 | 1152 | |
1153 | - return in_array( $upgrade_action, $completed_upgrades ); |
|
1153 | + return in_array($upgrade_action, $completed_upgrades); |
|
1154 | 1154 | |
1155 | 1155 | } |
1156 | 1156 | |
@@ -1162,8 +1162,8 @@ discard block |
||
1162 | 1162 | * @return mixed When nothing to resume returns false, otherwise starts the upgrade where it left off |
1163 | 1163 | */ |
1164 | 1164 | function give_maybe_resume_upgrade() { |
1165 | - $doing_upgrade = get_option( 'give_doing_upgrade', false ); |
|
1166 | - if ( empty( $doing_upgrade ) ) { |
|
1165 | + $doing_upgrade = get_option('give_doing_upgrade', false); |
|
1166 | + if (empty($doing_upgrade)) { |
|
1167 | 1167 | return false; |
1168 | 1168 | } |
1169 | 1169 | |
@@ -1179,9 +1179,9 @@ discard block |
||
1179 | 1179 | * |
1180 | 1180 | * @return bool If the function was successfully added |
1181 | 1181 | */ |
1182 | -function give_set_upgrade_complete( $upgrade_action = '' ) { |
|
1182 | +function give_set_upgrade_complete($upgrade_action = '') { |
|
1183 | 1183 | |
1184 | - if ( empty( $upgrade_action ) ) { |
|
1184 | + if (empty($upgrade_action)) { |
|
1185 | 1185 | return false; |
1186 | 1186 | } |
1187 | 1187 | |
@@ -1189,16 +1189,16 @@ discard block |
||
1189 | 1189 | $completed_upgrades[] = $upgrade_action; |
1190 | 1190 | |
1191 | 1191 | // Remove any blanks, and only show uniques. |
1192 | - $completed_upgrades = array_unique( array_values( $completed_upgrades ) ); |
|
1192 | + $completed_upgrades = array_unique(array_values($completed_upgrades)); |
|
1193 | 1193 | |
1194 | 1194 | /** |
1195 | 1195 | * Fire the action when any upgrade set to complete. |
1196 | 1196 | * |
1197 | 1197 | * @since 1.8.12 |
1198 | 1198 | */ |
1199 | - do_action( 'give_set_upgrade_completed', $upgrade_action, $completed_upgrades ); |
|
1199 | + do_action('give_set_upgrade_completed', $upgrade_action, $completed_upgrades); |
|
1200 | 1200 | |
1201 | - return update_option( 'give_completed_upgrades', $completed_upgrades, false ); |
|
1201 | + return update_option('give_completed_upgrades', $completed_upgrades, false); |
|
1202 | 1202 | } |
1203 | 1203 | |
1204 | 1204 | /** |
@@ -1208,7 +1208,7 @@ discard block |
||
1208 | 1208 | * @return array The array of completed upgrades |
1209 | 1209 | */ |
1210 | 1210 | function give_get_completed_upgrades() { |
1211 | - return (array) get_option( 'give_completed_upgrades' ); |
|
1211 | + return (array) get_option('give_completed_upgrades'); |
|
1212 | 1212 | } |
1213 | 1213 | |
1214 | 1214 | /** |
@@ -1223,16 +1223,16 @@ discard block |
||
1223 | 1223 | * |
1224 | 1224 | * @return null|array |
1225 | 1225 | */ |
1226 | -function __give_v20_bc_table_details( $type ) { |
|
1226 | +function __give_v20_bc_table_details($type) { |
|
1227 | 1227 | global $wpdb; |
1228 | 1228 | $table = array(); |
1229 | 1229 | |
1230 | 1230 | // Bailout. |
1231 | - if ( empty( $type ) ) { |
|
1231 | + if (empty($type)) { |
|
1232 | 1232 | return null; |
1233 | 1233 | } |
1234 | 1234 | |
1235 | - switch ( $type ) { |
|
1235 | + switch ($type) { |
|
1236 | 1236 | case 'form': |
1237 | 1237 | $table['name'] = $wpdb->formmeta; |
1238 | 1238 | $table['column']['id'] = 'form_id'; |
@@ -1241,11 +1241,11 @@ discard block |
||
1241 | 1241 | |
1242 | 1242 | case 'payment': |
1243 | 1243 | $table['name'] = $wpdb->donationmeta; |
1244 | - $table['column']['id'] = Give()->payment_meta->get_meta_type() . '_id'; |
|
1244 | + $table['column']['id'] = Give()->payment_meta->get_meta_type().'_id'; |
|
1245 | 1245 | } |
1246 | 1246 | |
1247 | 1247 | // Backward compatibility. |
1248 | - if ( ! give_has_upgrade_completed( 'v20_move_metadata_into_new_table' ) ) { |
|
1248 | + if ( ! give_has_upgrade_completed('v20_move_metadata_into_new_table')) { |
|
1249 | 1249 | $table['name'] = $wpdb->postmeta; |
1250 | 1250 | $table['column']['id'] = 'post_id'; |
1251 | 1251 | } |
@@ -1260,12 +1260,12 @@ discard block |
||
1260 | 1260 | * |
1261 | 1261 | * @param WP_Query $query |
1262 | 1262 | */ |
1263 | -function give_remove_pages_from_search( $query ) { |
|
1263 | +function give_remove_pages_from_search($query) { |
|
1264 | 1264 | |
1265 | - if ( ! $query->is_admin && $query->is_search && $query->is_main_query() ) { |
|
1265 | + if ( ! $query->is_admin && $query->is_search && $query->is_main_query()) { |
|
1266 | 1266 | |
1267 | - $transaction_failed = give_get_option( 'failure_page', 0 ); |
|
1268 | - $success_page = give_get_option( 'success_page', 0 ); |
|
1267 | + $transaction_failed = give_get_option('failure_page', 0); |
|
1268 | + $success_page = give_get_option('success_page', 0); |
|
1269 | 1269 | |
1270 | 1270 | $args = apply_filters( |
1271 | 1271 | 'give_remove_pages_from_search', array( |
@@ -1273,11 +1273,11 @@ discard block |
||
1273 | 1273 | $success_page, |
1274 | 1274 | ), $query |
1275 | 1275 | ); |
1276 | - $query->set( 'post__not_in', $args ); |
|
1276 | + $query->set('post__not_in', $args); |
|
1277 | 1277 | } |
1278 | 1278 | } |
1279 | 1279 | |
1280 | -add_action( 'pre_get_posts', 'give_remove_pages_from_search', 10, 1 ); |
|
1280 | +add_action('pre_get_posts', 'give_remove_pages_from_search', 10, 1); |
|
1281 | 1281 | |
1282 | 1282 | /** |
1283 | 1283 | * Inserts a new key/value before a key in the array. |
@@ -1293,14 +1293,14 @@ discard block |
||
1293 | 1293 | * |
1294 | 1294 | * @see array_insert_before() |
1295 | 1295 | */ |
1296 | -function give_array_insert_before( $key, array &$array, $new_key, $new_value ) { |
|
1297 | - if ( array_key_exists( $key, $array ) ) { |
|
1296 | +function give_array_insert_before($key, array &$array, $new_key, $new_value) { |
|
1297 | + if (array_key_exists($key, $array)) { |
|
1298 | 1298 | $new = array(); |
1299 | - foreach ( $array as $k => $value ) { |
|
1300 | - if ( $k === $key ) { |
|
1301 | - $new[ $new_key ] = $new_value; |
|
1299 | + foreach ($array as $k => $value) { |
|
1300 | + if ($k === $key) { |
|
1301 | + $new[$new_key] = $new_value; |
|
1302 | 1302 | } |
1303 | - $new[ $k ] = $value; |
|
1303 | + $new[$k] = $value; |
|
1304 | 1304 | } |
1305 | 1305 | |
1306 | 1306 | return $new; |
@@ -1323,13 +1323,13 @@ discard block |
||
1323 | 1323 | * |
1324 | 1324 | * @see array_insert_before() |
1325 | 1325 | */ |
1326 | -function give_array_insert_after( $key, array &$array, $new_key, $new_value ) { |
|
1327 | - if ( array_key_exists( $key, $array ) ) { |
|
1326 | +function give_array_insert_after($key, array &$array, $new_key, $new_value) { |
|
1327 | + if (array_key_exists($key, $array)) { |
|
1328 | 1328 | $new = array(); |
1329 | - foreach ( $array as $k => $value ) { |
|
1330 | - $new[ $k ] = $value; |
|
1331 | - if ( $k === $key ) { |
|
1332 | - $new[ $new_key ] = $new_value; |
|
1329 | + foreach ($array as $k => $value) { |
|
1330 | + $new[$k] = $value; |
|
1331 | + if ($k === $key) { |
|
1332 | + $new[$new_key] = $new_value; |
|
1333 | 1333 | } |
1334 | 1334 | } |
1335 | 1335 | |
@@ -1356,21 +1356,21 @@ discard block |
||
1356 | 1356 | * corresponding to `$index_key`. If `$index_key` is null, array keys from the original |
1357 | 1357 | * `$list` will be preserved in the results. |
1358 | 1358 | */ |
1359 | -function give_list_pluck( $list, $field, $index_key = null ) { |
|
1359 | +function give_list_pluck($list, $field, $index_key = null) { |
|
1360 | 1360 | |
1361 | - if ( ! $index_key ) { |
|
1361 | + if ( ! $index_key) { |
|
1362 | 1362 | /** |
1363 | 1363 | * This is simple. Could at some point wrap array_column() |
1364 | 1364 | * if we knew we had an array of arrays. |
1365 | 1365 | */ |
1366 | - foreach ( $list as $key => $value ) { |
|
1367 | - if ( is_object( $value ) ) { |
|
1368 | - if ( isset( $value->$field ) ) { |
|
1369 | - $list[ $key ] = $value->$field; |
|
1366 | + foreach ($list as $key => $value) { |
|
1367 | + if (is_object($value)) { |
|
1368 | + if (isset($value->$field)) { |
|
1369 | + $list[$key] = $value->$field; |
|
1370 | 1370 | } |
1371 | 1371 | } else { |
1372 | - if ( isset( $value[ $field ] ) ) { |
|
1373 | - $list[ $key ] = $value[ $field ]; |
|
1372 | + if (isset($value[$field])) { |
|
1373 | + $list[$key] = $value[$field]; |
|
1374 | 1374 | } |
1375 | 1375 | } |
1376 | 1376 | } |
@@ -1383,18 +1383,18 @@ discard block |
||
1383 | 1383 | * to the end of the stack. This is how array_column() behaves. |
1384 | 1384 | */ |
1385 | 1385 | $newlist = array(); |
1386 | - foreach ( $list as $value ) { |
|
1387 | - if ( is_object( $value ) ) { |
|
1388 | - if ( isset( $value->$index_key ) ) { |
|
1389 | - $newlist[ $value->$index_key ] = $value->$field; |
|
1386 | + foreach ($list as $value) { |
|
1387 | + if (is_object($value)) { |
|
1388 | + if (isset($value->$index_key)) { |
|
1389 | + $newlist[$value->$index_key] = $value->$field; |
|
1390 | 1390 | } else { |
1391 | 1391 | $newlist[] = $value->$field; |
1392 | 1392 | } |
1393 | 1393 | } else { |
1394 | - if ( isset( $value[ $index_key ] ) ) { |
|
1395 | - $newlist[ $value[ $index_key ] ] = $value[ $field ]; |
|
1394 | + if (isset($value[$index_key])) { |
|
1395 | + $newlist[$value[$index_key]] = $value[$field]; |
|
1396 | 1396 | } else { |
1397 | - $newlist[] = $value[ $field ]; |
|
1397 | + $newlist[] = $value[$field]; |
|
1398 | 1398 | } |
1399 | 1399 | } |
1400 | 1400 | } |
@@ -1417,8 +1417,8 @@ discard block |
||
1417 | 1417 | * |
1418 | 1418 | * @return int|false Meta ID on success, false on failure. |
1419 | 1419 | */ |
1420 | -function add_donor_meta( $donor_id, $meta_key, $meta_value, $unique = false ) { |
|
1421 | - return add_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $unique ); |
|
1420 | +function add_donor_meta($donor_id, $meta_key, $meta_value, $unique = false) { |
|
1421 | + return add_metadata('give_customer', $donor_id, $meta_key, $meta_value, $unique); |
|
1422 | 1422 | } |
1423 | 1423 | |
1424 | 1424 | /** |
@@ -1436,8 +1436,8 @@ discard block |
||
1436 | 1436 | * |
1437 | 1437 | * @return bool True on success, false on failure. |
1438 | 1438 | */ |
1439 | -function delete_donor_meta( $donor_id, $meta_key, $meta_value = '' ) { |
|
1440 | - return delete_metadata( 'give_customer', $donor_id, $meta_key, $meta_value ); |
|
1439 | +function delete_donor_meta($donor_id, $meta_key, $meta_value = '') { |
|
1440 | + return delete_metadata('give_customer', $donor_id, $meta_key, $meta_value); |
|
1441 | 1441 | } |
1442 | 1442 | |
1443 | 1443 | /** |
@@ -1452,8 +1452,8 @@ discard block |
||
1452 | 1452 | * @return mixed Will be an array if $single is false. Will be value of meta data field if $single |
1453 | 1453 | * is true. |
1454 | 1454 | */ |
1455 | -function get_donor_meta( $donor_id, $key = '', $single = false ) { |
|
1456 | - return get_metadata( 'give_customer', $donor_id, $key, $single ); |
|
1455 | +function get_donor_meta($donor_id, $key = '', $single = false) { |
|
1456 | + return get_metadata('give_customer', $donor_id, $key, $single); |
|
1457 | 1457 | } |
1458 | 1458 | |
1459 | 1459 | /** |
@@ -1470,8 +1470,8 @@ discard block |
||
1470 | 1470 | * |
1471 | 1471 | * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure. |
1472 | 1472 | */ |
1473 | -function update_donor_meta( $donor_id, $meta_key, $meta_value, $prev_value = '' ) { |
|
1474 | - return update_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $prev_value ); |
|
1473 | +function update_donor_meta($donor_id, $meta_key, $meta_value, $prev_value = '') { |
|
1474 | + return update_metadata('give_customer', $donor_id, $meta_key, $meta_value, $prev_value); |
|
1475 | 1475 | } |
1476 | 1476 | |
1477 | 1477 | |
@@ -1484,15 +1484,15 @@ discard block |
||
1484 | 1484 | * |
1485 | 1485 | * @return void |
1486 | 1486 | */ |
1487 | -function give_recount_form_income_donation( $form_id = 0 ) { |
|
1487 | +function give_recount_form_income_donation($form_id = 0) { |
|
1488 | 1488 | // Check if form id is not empty. |
1489 | - if ( ! empty( $form_id ) ) { |
|
1489 | + if ( ! empty($form_id)) { |
|
1490 | 1490 | /** |
1491 | 1491 | * Filter to modify payment status. |
1492 | 1492 | * |
1493 | 1493 | * @since 1.8.13 |
1494 | 1494 | */ |
1495 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
1495 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
1496 | 1496 | |
1497 | 1497 | /** |
1498 | 1498 | * Filter to modify args of payment query before recalculating the form total |
@@ -1503,7 +1503,7 @@ discard block |
||
1503 | 1503 | 'give_recount_form_stats_args', array( |
1504 | 1504 | 'give_forms' => $form_id, |
1505 | 1505 | 'status' => $accepted_statuses, |
1506 | - 'posts_per_page' => - 1, |
|
1506 | + 'posts_per_page' => -1, |
|
1507 | 1507 | 'fields' => 'ids', |
1508 | 1508 | ) |
1509 | 1509 | ); |
@@ -1513,28 +1513,28 @@ discard block |
||
1513 | 1513 | 'earnings' => 0, |
1514 | 1514 | ); |
1515 | 1515 | |
1516 | - $payments = new Give_Payments_Query( $args ); |
|
1516 | + $payments = new Give_Payments_Query($args); |
|
1517 | 1517 | $payments = $payments->get_payments(); |
1518 | 1518 | |
1519 | - if ( $payments ) { |
|
1520 | - foreach ( $payments as $payment ) { |
|
1519 | + if ($payments) { |
|
1520 | + foreach ($payments as $payment) { |
|
1521 | 1521 | // Ensure acceptible status only |
1522 | - if ( ! in_array( $payment->post_status, $accepted_statuses ) ) { |
|
1522 | + if ( ! in_array($payment->post_status, $accepted_statuses)) { |
|
1523 | 1523 | continue; |
1524 | 1524 | } |
1525 | 1525 | |
1526 | 1526 | // Ensure only payments for this form are counted |
1527 | - if ( $payment->form_id != $form_id ) { |
|
1527 | + if ($payment->form_id != $form_id) { |
|
1528 | 1528 | continue; |
1529 | 1529 | } |
1530 | 1530 | |
1531 | - $totals['sales'] ++; |
|
1531 | + $totals['sales']++; |
|
1532 | 1532 | $totals['earnings'] += $payment->total; |
1533 | 1533 | |
1534 | 1534 | } |
1535 | 1535 | } |
1536 | - give_update_meta( $form_id, '_give_form_sales', $totals['sales'] ); |
|
1537 | - give_update_meta( $form_id, '_give_form_earnings', give_sanitize_amount_for_db( $totals['earnings'] ) ); |
|
1536 | + give_update_meta($form_id, '_give_form_sales', $totals['sales']); |
|
1537 | + give_update_meta($form_id, '_give_form_earnings', give_sanitize_amount_for_db($totals['earnings'])); |
|
1538 | 1538 | }// End if(). |
1539 | 1539 | } |
1540 | 1540 | |
@@ -1549,26 +1549,26 @@ discard block |
||
1549 | 1549 | * |
1550 | 1550 | * @return string |
1551 | 1551 | */ |
1552 | -function give_get_attribute_str( $attributes, $default_attributes = array() ) { |
|
1552 | +function give_get_attribute_str($attributes, $default_attributes = array()) { |
|
1553 | 1553 | $attribute_str = ''; |
1554 | 1554 | |
1555 | - if ( isset( $attributes['attributes'] ) ) { |
|
1555 | + if (isset($attributes['attributes'])) { |
|
1556 | 1556 | $attributes = $attributes['attributes']; |
1557 | 1557 | } |
1558 | 1558 | |
1559 | - if ( ! empty( $default_attributes ) ) { |
|
1560 | - $attributes = wp_parse_args( $attributes, $default_attributes ); |
|
1559 | + if ( ! empty($default_attributes)) { |
|
1560 | + $attributes = wp_parse_args($attributes, $default_attributes); |
|
1561 | 1561 | } |
1562 | 1562 | |
1563 | - if ( empty( $attributes ) ) { |
|
1563 | + if (empty($attributes)) { |
|
1564 | 1564 | return $attribute_str; |
1565 | 1565 | } |
1566 | 1566 | |
1567 | - foreach ( $attributes as $tag => $value ) { |
|
1567 | + foreach ($attributes as $tag => $value) { |
|
1568 | 1568 | $attribute_str .= " {$tag}=\"{$value}\""; |
1569 | 1569 | } |
1570 | 1570 | |
1571 | - return trim( $attribute_str ); |
|
1571 | + return trim($attribute_str); |
|
1572 | 1572 | } |
1573 | 1573 | |
1574 | 1574 | /** |
@@ -1581,7 +1581,7 @@ discard block |
||
1581 | 1581 | function give_get_wp_upload_dir() { |
1582 | 1582 | $wp_upload_dir = wp_upload_dir(); |
1583 | 1583 | |
1584 | - return ( ! empty( $wp_upload_dir['path'] ) ? $wp_upload_dir['path'] : false ); |
|
1584 | + return ( ! empty($wp_upload_dir['path']) ? $wp_upload_dir['path'] : false); |
|
1585 | 1585 | } |
1586 | 1586 | |
1587 | 1587 | /** |
@@ -1593,15 +1593,15 @@ discard block |
||
1593 | 1593 | * |
1594 | 1594 | * @return string|bool $file_contents File content |
1595 | 1595 | */ |
1596 | -function give_get_core_settings_json( $file_name ) { |
|
1596 | +function give_get_core_settings_json($file_name) { |
|
1597 | 1597 | $upload_dir = give_get_wp_upload_dir(); |
1598 | - $file_path = $upload_dir . '/' . $file_name; |
|
1598 | + $file_path = $upload_dir.'/'.$file_name; |
|
1599 | 1599 | |
1600 | - if ( is_wp_error( $file_path ) || empty( $file_path ) ) { |
|
1601 | - Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid JSON file.', 'give' ) ); |
|
1600 | + if (is_wp_error($file_path) || empty($file_path)) { |
|
1601 | + Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid JSON file.', 'give')); |
|
1602 | 1602 | } |
1603 | 1603 | |
1604 | - $file_contents = file_get_contents( $file_path ); |
|
1604 | + $file_contents = file_get_contents($file_path); |
|
1605 | 1605 | |
1606 | 1606 | return $file_contents; |
1607 | 1607 | } |
@@ -1614,7 +1614,7 @@ discard block |
||
1614 | 1614 | * @return int $country The two letter country code for the site's base country |
1615 | 1615 | */ |
1616 | 1616 | function give_get_limit_display_donations() { |
1617 | - return give_get_option( 'limit_display_donations', 1 ); |
|
1617 | + return give_get_option('limit_display_donations', 1); |
|
1618 | 1618 | } |
1619 | 1619 | |
1620 | 1620 | /** |
@@ -1623,7 +1623,7 @@ discard block |
||
1623 | 1623 | * @since 1.8.17 |
1624 | 1624 | */ |
1625 | 1625 | function give_donation_history_table_end() { |
1626 | - $email = Give()->session->get( 'give_email' ); |
|
1626 | + $email = Give()->session->get('give_email'); |
|
1627 | 1627 | ?> |
1628 | 1628 | <tfoot> |
1629 | 1629 | <tr> |
@@ -1631,15 +1631,15 @@ discard block |
||
1631 | 1631 | <div class="give-security-wrap"> |
1632 | 1632 | <div class="give-security-column give-security-description-wrap"> |
1633 | 1633 | <?php |
1634 | - echo sprintf( __( 'For security reasons, please confirm your email address (%s) to view your complete donation history.', 'give' ), $email ); |
|
1634 | + echo sprintf(__('For security reasons, please confirm your email address (%s) to view your complete donation history.', 'give'), $email); |
|
1635 | 1635 | ?> |
1636 | 1636 | </div> |
1637 | 1637 | <div class="give-security-column give-security-button-wrap"> |
1638 | 1638 | <a href="#" data-email="<?php echo $email; ?>" id="give-confirm-email-btn" |
1639 | 1639 | class="give-confirm-email-btn give-btn"> |
1640 | - <?php _e( 'Confirm Email', 'give' ); ?> |
|
1640 | + <?php _e('Confirm Email', 'give'); ?> |
|
1641 | 1641 | </a> |
1642 | - <span><?php _e( 'Email Sent!', 'give' ); ?></span> |
|
1642 | + <span><?php _e('Email Sent!', 'give'); ?></span> |
|
1643 | 1643 | </div> |
1644 | 1644 | </div> |
1645 | 1645 | </td> |
@@ -1660,10 +1660,10 @@ discard block |
||
1660 | 1660 | * |
1661 | 1661 | * @return void |
1662 | 1662 | */ |
1663 | -function give_doing_it_wrong( $function, $message, $version ) { |
|
1664 | - $message .= "\nBacktrace:" . wp_debug_backtrace_summary(); |
|
1663 | +function give_doing_it_wrong($function, $message, $version) { |
|
1664 | + $message .= "\nBacktrace:".wp_debug_backtrace_summary(); |
|
1665 | 1665 | |
1666 | - _doing_it_wrong( $function, $message, $version ); |
|
1666 | + _doing_it_wrong($function, $message, $version); |
|
1667 | 1667 | } |
1668 | 1668 | |
1669 | 1669 | |
@@ -1673,10 +1673,10 @@ discard block |
||
1673 | 1673 | * @since 1.8.18 |
1674 | 1674 | */ |
1675 | 1675 | function give_ignore_user_abort() { |
1676 | - ignore_user_abort( true ); |
|
1676 | + ignore_user_abort(true); |
|
1677 | 1677 | |
1678 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
1679 | - set_time_limit( 0 ); |
|
1678 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
1679 | + set_time_limit(0); |
|
1680 | 1680 | } |
1681 | 1681 | } |
1682 | 1682 | |
@@ -1690,28 +1690,28 @@ discard block |
||
1690 | 1690 | * |
1691 | 1691 | * @return int |
1692 | 1692 | */ |
1693 | -function give_get_total_post_type_count( $post_type = '', $args = array() ) { |
|
1693 | +function give_get_total_post_type_count($post_type = '', $args = array()) { |
|
1694 | 1694 | global $wpdb; |
1695 | 1695 | $where = ''; |
1696 | 1696 | |
1697 | - if ( ! $post_type ) { |
|
1697 | + if ( ! $post_type) { |
|
1698 | 1698 | return 0; |
1699 | 1699 | } |
1700 | 1700 | |
1701 | 1701 | // Bulit where query |
1702 | - if ( ! empty( $post_type ) ) { |
|
1702 | + if ( ! empty($post_type)) { |
|
1703 | 1703 | $where .= ' WHERE'; |
1704 | 1704 | |
1705 | - if ( is_array( $post_type ) ) { |
|
1706 | - $where .= " post_type='" . implode( "' OR post_type='", $post_type ) . "'"; |
|
1705 | + if (is_array($post_type)) { |
|
1706 | + $where .= " post_type='".implode("' OR post_type='", $post_type)."'"; |
|
1707 | 1707 | } else { |
1708 | 1708 | $where .= " post_type='{$post_type}'"; |
1709 | 1709 | } |
1710 | 1710 | } |
1711 | 1711 | |
1712 | - $result = $wpdb->get_var( "SELECT count(ID) FROM {$wpdb->posts}{$where}" ); |
|
1712 | + $result = $wpdb->get_var("SELECT count(ID) FROM {$wpdb->posts}{$where}"); |
|
1713 | 1713 | |
1714 | - return absint( $result ); |
|
1714 | + return absint($result); |
|
1715 | 1715 | } |
1716 | 1716 | |
1717 | 1717 | /** |
@@ -1724,9 +1724,9 @@ discard block |
||
1724 | 1724 | * |
1725 | 1725 | * @credit WooCommerce |
1726 | 1726 | */ |
1727 | -function give_maybe_define_constant( $name, $value ) { |
|
1728 | - if ( ! defined( $name ) ) { |
|
1729 | - define( $name, $value ); |
|
1727 | +function give_maybe_define_constant($name, $value) { |
|
1728 | + if ( ! defined($name)) { |
|
1729 | + define($name, $value); |
|
1730 | 1730 | } |
1731 | 1731 | } |
1732 | 1732 | |
@@ -1740,8 +1740,8 @@ discard block |
||
1740 | 1740 | * |
1741 | 1741 | * @return string |
1742 | 1742 | */ |
1743 | -function give_time_do_tags( $string, $timestamp = 0 ) { |
|
1744 | - $current_time = ! empty( $timestamp ) ? $timestamp : current_time( 'timestamp' ); |
|
1743 | +function give_time_do_tags($string, $timestamp = 0) { |
|
1744 | + $current_time = ! empty($timestamp) ? $timestamp : current_time('timestamp'); |
|
1745 | 1745 | |
1746 | 1746 | $formatted_string = str_replace( |
1747 | 1747 | array( |
@@ -1756,15 +1756,15 @@ discard block |
||
1756 | 1756 | '{N}', |
1757 | 1757 | '{S}', |
1758 | 1758 | ), array( |
1759 | - date( 'j', $current_time ), |
|
1760 | - date( 'd', $current_time ), |
|
1761 | - date( 'n', $current_time ), |
|
1762 | - date( 'm', $current_time ), |
|
1763 | - date( 'Y', $current_time ), |
|
1764 | - date( 'Y', $current_time ), |
|
1765 | - date( 'G', $current_time ), |
|
1766 | - date( 'H', $current_time ), |
|
1767 | - date( 's', $current_time ), |
|
1759 | + date('j', $current_time), |
|
1760 | + date('d', $current_time), |
|
1761 | + date('n', $current_time), |
|
1762 | + date('m', $current_time), |
|
1763 | + date('Y', $current_time), |
|
1764 | + date('Y', $current_time), |
|
1765 | + date('G', $current_time), |
|
1766 | + date('H', $current_time), |
|
1767 | + date('s', $current_time), |
|
1768 | 1768 | ), $string |
1769 | 1769 | ); |
1770 | 1770 | |
@@ -1773,7 +1773,7 @@ discard block |
||
1773 | 1773 | * |
1774 | 1774 | * @since 2.1.0 |
1775 | 1775 | */ |
1776 | - return apply_filters( 'give_time_do_tags', $formatted_string, $string, $timestamp ); |
|
1776 | + return apply_filters('give_time_do_tags', $formatted_string, $string, $timestamp); |
|
1777 | 1777 | } |
1778 | 1778 | |
1779 | 1779 | |
@@ -1786,24 +1786,24 @@ discard block |
||
1786 | 1786 | * |
1787 | 1787 | * @return bool |
1788 | 1788 | */ |
1789 | -function give_is_company_field_enabled( $form_id ) { |
|
1790 | - $form_setting_val = give_get_meta( $form_id, '_give_company_field', true ); |
|
1791 | - $global_setting_val = give_get_option( 'company_field' ); |
|
1789 | +function give_is_company_field_enabled($form_id) { |
|
1790 | + $form_setting_val = give_get_meta($form_id, '_give_company_field', true); |
|
1791 | + $global_setting_val = give_get_option('company_field'); |
|
1792 | 1792 | |
1793 | - if ( ! empty( $form_setting_val ) ) { |
|
1794 | - if ( give_is_setting_enabled( $form_setting_val, array( 'required', 'optional' ) ) ) { |
|
1793 | + if ( ! empty($form_setting_val)) { |
|
1794 | + if (give_is_setting_enabled($form_setting_val, array('required', 'optional'))) { |
|
1795 | 1795 | return true; |
1796 | - } elseif ( 'global' === $form_setting_val && give_is_setting_enabled( |
|
1796 | + } elseif ('global' === $form_setting_val && give_is_setting_enabled( |
|
1797 | 1797 | $global_setting_val, array( |
1798 | 1798 | 'required', |
1799 | 1799 | 'optional', |
1800 | 1800 | ) |
1801 | - ) ) { |
|
1801 | + )) { |
|
1802 | 1802 | return true; |
1803 | 1803 | } else { |
1804 | 1804 | return false; |
1805 | 1805 | } |
1806 | - } elseif ( give_is_setting_enabled( $global_setting_val, array( 'required', 'optional' ) ) ) { |
|
1806 | + } elseif (give_is_setting_enabled($global_setting_val, array('required', 'optional'))) { |
|
1807 | 1807 | return true; |
1808 | 1808 | |
1809 | 1809 | } else { |
@@ -1820,19 +1820,19 @@ discard block |
||
1820 | 1820 | * |
1821 | 1821 | * @return bool |
1822 | 1822 | */ |
1823 | -function give_is_anonymous_donation_field_enabled( $form_id ) { |
|
1824 | - $form_setting_val = give_get_meta( $form_id, '_give_anonymous_donation', true, 'global' ); |
|
1825 | - $global_setting_val = give_get_option( 'anonymous_donation', 'disabled' ); |
|
1823 | +function give_is_anonymous_donation_field_enabled($form_id) { |
|
1824 | + $form_setting_val = give_get_meta($form_id, '_give_anonymous_donation', true, 'global'); |
|
1825 | + $global_setting_val = give_get_option('anonymous_donation', 'disabled'); |
|
1826 | 1826 | |
1827 | - if ( ! empty( $form_setting_val ) ) { |
|
1828 | - if ( give_is_setting_enabled( $form_setting_val ) ) { |
|
1827 | + if ( ! empty($form_setting_val)) { |
|
1828 | + if (give_is_setting_enabled($form_setting_val)) { |
|
1829 | 1829 | return true; |
1830 | - } elseif ( 'global' === $form_setting_val && give_is_setting_enabled( $global_setting_val ) ) { |
|
1830 | + } elseif ('global' === $form_setting_val && give_is_setting_enabled($global_setting_val)) { |
|
1831 | 1831 | return true; |
1832 | 1832 | } else { |
1833 | 1833 | return false; |
1834 | 1834 | } |
1835 | - } elseif ( give_is_setting_enabled( $global_setting_val ) ) { |
|
1835 | + } elseif (give_is_setting_enabled($global_setting_val)) { |
|
1836 | 1836 | return true; |
1837 | 1837 | } |
1838 | 1838 | |
@@ -1848,19 +1848,19 @@ discard block |
||
1848 | 1848 | * |
1849 | 1849 | * @return bool |
1850 | 1850 | */ |
1851 | -function give_is_donor_comment_field_enabled( $form_id ) { |
|
1852 | - $form_setting_val = give_get_meta( $form_id, '_give_donor_comment', true, 'global' ); |
|
1853 | - $global_setting_val = give_get_option( 'donor_comment', 'disabled' ); |
|
1851 | +function give_is_donor_comment_field_enabled($form_id) { |
|
1852 | + $form_setting_val = give_get_meta($form_id, '_give_donor_comment', true, 'global'); |
|
1853 | + $global_setting_val = give_get_option('donor_comment', 'disabled'); |
|
1854 | 1854 | |
1855 | - if ( ! empty( $form_setting_val ) ) { |
|
1856 | - if ( give_is_setting_enabled( $form_setting_val ) ) { |
|
1855 | + if ( ! empty($form_setting_val)) { |
|
1856 | + if (give_is_setting_enabled($form_setting_val)) { |
|
1857 | 1857 | return true; |
1858 | - } elseif ( 'global' === $form_setting_val && give_is_setting_enabled( $global_setting_val ) ) { |
|
1858 | + } elseif ('global' === $form_setting_val && give_is_setting_enabled($global_setting_val)) { |
|
1859 | 1859 | return true; |
1860 | 1860 | } else { |
1861 | 1861 | return false; |
1862 | 1862 | } |
1863 | - } elseif ( give_is_setting_enabled( $global_setting_val ) ) { |
|
1863 | + } elseif (give_is_setting_enabled($global_setting_val)) { |
|
1864 | 1864 | return true; |
1865 | 1865 | } |
1866 | 1866 | |
@@ -1878,12 +1878,12 @@ discard block |
||
1878 | 1878 | * |
1879 | 1879 | * @return array |
1880 | 1880 | */ |
1881 | -function __give_get_active_license_info( $license_id ) { |
|
1881 | +function __give_get_active_license_info($license_id) { |
|
1882 | 1882 | global $wpdb; |
1883 | 1883 | $option_name = "{$license_id}_license_active"; |
1884 | 1884 | $data = array(); |
1885 | 1885 | |
1886 | - if ( ! isset( $GLOBALS['give_active_licenses_info'] ) ) { |
|
1886 | + if ( ! isset($GLOBALS['give_active_licenses_info'])) { |
|
1887 | 1887 | $GLOBALS['give_active_licenses_info'] = array(); |
1888 | 1888 | |
1889 | 1889 | $licenses_info = $wpdb->get_results( |
@@ -1896,16 +1896,16 @@ discard block |
||
1896 | 1896 | ARRAY_A |
1897 | 1897 | ); |
1898 | 1898 | |
1899 | - if ( ! empty( $licenses_info ) ) { |
|
1899 | + if ( ! empty($licenses_info)) { |
|
1900 | 1900 | $GLOBALS['give_active_licenses_info'] = array_combine( |
1901 | - wp_list_pluck( $licenses_info, 'option_name' ), |
|
1902 | - wp_list_pluck( $licenses_info, 'option_value' ) |
|
1901 | + wp_list_pluck($licenses_info, 'option_name'), |
|
1902 | + wp_list_pluck($licenses_info, 'option_value') |
|
1903 | 1903 | ); |
1904 | 1904 | } |
1905 | 1905 | } |
1906 | 1906 | |
1907 | - if ( in_array( $option_name, array_keys( $GLOBALS['give_active_licenses_info'] ) ) ) { |
|
1908 | - $data = maybe_unserialize( $GLOBALS['give_active_licenses_info'][ $option_name ] ); |
|
1907 | + if (in_array($option_name, array_keys($GLOBALS['give_active_licenses_info']))) { |
|
1908 | + $data = maybe_unserialize($GLOBALS['give_active_licenses_info'][$option_name]); |
|
1909 | 1909 | } |
1910 | 1910 | |
1911 | 1911 | return $data; |
@@ -1921,18 +1921,18 @@ discard block |
||
1921 | 1921 | * |
1922 | 1922 | * @return array |
1923 | 1923 | */ |
1924 | -function __give_get_active_by_user_meta( $banner_addon_name ) { |
|
1924 | +function __give_get_active_by_user_meta($banner_addon_name) { |
|
1925 | 1925 | global $wpdb; |
1926 | 1926 | |
1927 | 1927 | // Get the option key. |
1928 | - $option_name = Give_Addon_Activation_Banner::get_banner_user_meta_key( $banner_addon_name ); |
|
1928 | + $option_name = Give_Addon_Activation_Banner::get_banner_user_meta_key($banner_addon_name); |
|
1929 | 1929 | $data = array(); |
1930 | 1930 | |
1931 | 1931 | if ( |
1932 | - ! isset( $GLOBALS['give_addon_activated_by_user'][ $banner_addon_name ] ) |
|
1933 | - || empty( $GLOBALS['give_addon_activated_by_user'][ $banner_addon_name ] ) |
|
1932 | + ! isset($GLOBALS['give_addon_activated_by_user'][$banner_addon_name]) |
|
1933 | + || empty($GLOBALS['give_addon_activated_by_user'][$banner_addon_name]) |
|
1934 | 1934 | ) { |
1935 | - $GLOBALS['give_addon_activated_by_user'][ $banner_addon_name ] = array(); |
|
1935 | + $GLOBALS['give_addon_activated_by_user'][$banner_addon_name] = array(); |
|
1936 | 1936 | |
1937 | 1937 | // Get the meta of activation banner by user. |
1938 | 1938 | $activation_banners = $wpdb->get_results( |
@@ -1945,16 +1945,16 @@ discard block |
||
1945 | 1945 | ARRAY_A |
1946 | 1946 | ); |
1947 | 1947 | |
1948 | - if ( ! empty( $activation_banners ) ) { |
|
1948 | + if ( ! empty($activation_banners)) { |
|
1949 | 1949 | $GLOBALS['give_addon_activated_by_user'] = array_combine( |
1950 | - wp_list_pluck( $activation_banners, 'option_name' ), |
|
1951 | - wp_list_pluck( $activation_banners, 'option_value' ) |
|
1950 | + wp_list_pluck($activation_banners, 'option_name'), |
|
1951 | + wp_list_pluck($activation_banners, 'option_value') |
|
1952 | 1952 | ); |
1953 | 1953 | } |
1954 | 1954 | } |
1955 | 1955 | |
1956 | - if ( in_array( $option_name, array_keys( $GLOBALS['give_addon_activated_by_user'] ) ) ) { |
|
1957 | - $data = maybe_unserialize( $GLOBALS['give_addon_activated_by_user'][ $option_name ] ); |
|
1956 | + if (in_array($option_name, array_keys($GLOBALS['give_addon_activated_by_user']))) { |
|
1957 | + $data = maybe_unserialize($GLOBALS['give_addon_activated_by_user'][$option_name]); |
|
1958 | 1958 | } |
1959 | 1959 | |
1960 | 1960 | return $data; |
@@ -1973,7 +1973,7 @@ discard block |
||
1973 | 1973 | * |
1974 | 1974 | * @see wp-inlucdes/pluggable.php:wp_nonce_tick |
1975 | 1975 | */ |
1976 | - return (int) apply_filters( 'nonce_life', DAY_IN_SECONDS ); |
|
1976 | + return (int) apply_filters('nonce_life', DAY_IN_SECONDS); |
|
1977 | 1977 | } |
1978 | 1978 | |
1979 | 1979 | /** |
@@ -1987,11 +1987,11 @@ discard block |
||
1987 | 1987 | * |
1988 | 1988 | * @return string |
1989 | 1989 | */ |
1990 | -function give_get_nonce_field( $action, $name, $referer = false ) { |
|
1990 | +function give_get_nonce_field($action, $name, $referer = false) { |
|
1991 | 1991 | return str_replace( |
1992 | 1992 | "id=\"{$name}\"", |
1993 | 1993 | '', |
1994 | - wp_nonce_field( $action, $name, $referer, false ) |
|
1994 | + wp_nonce_field($action, $name, $referer, false) |
|
1995 | 1995 | ); |
1996 | 1996 | } |
1997 | 1997 | |
@@ -2004,31 +2004,31 @@ discard block |
||
2004 | 2004 | * |
2005 | 2005 | * @return array |
2006 | 2006 | */ |
2007 | -function give_goal_progress_stats( $form ) { |
|
2007 | +function give_goal_progress_stats($form) { |
|
2008 | 2008 | |
2009 | - if ( ! $form instanceof Give_Donate_Form ) { |
|
2010 | - $form = new Give_Donate_Form( $form ); |
|
2009 | + if ( ! $form instanceof Give_Donate_Form) { |
|
2010 | + $form = new Give_Donate_Form($form); |
|
2011 | 2011 | } |
2012 | 2012 | |
2013 | 2013 | $donors = ''; |
2014 | 2014 | |
2015 | - $goal_format = give_get_form_goal_format( $form->ID ); |
|
2015 | + $goal_format = give_get_form_goal_format($form->ID); |
|
2016 | 2016 | |
2017 | 2017 | /** |
2018 | 2018 | * Filter the form. |
2019 | 2019 | * |
2020 | 2020 | * @since 1.8.8 |
2021 | 2021 | */ |
2022 | - $total_goal = apply_filters( 'give_goal_amount_target_output', round( give_maybe_sanitize_amount( $form->goal ) ), $form->ID, $form ); |
|
2022 | + $total_goal = apply_filters('give_goal_amount_target_output', round(give_maybe_sanitize_amount($form->goal)), $form->ID, $form); |
|
2023 | 2023 | |
2024 | - switch ( $goal_format ) { |
|
2024 | + switch ($goal_format) { |
|
2025 | 2025 | case 'donation': |
2026 | 2026 | /** |
2027 | 2027 | * Filter the form donations. |
2028 | 2028 | * |
2029 | 2029 | * @since 2.1 |
2030 | 2030 | */ |
2031 | - $actual = $donations = apply_filters( 'give_goal_donations_raised_output', $form->sales, $form->ID, $form ); |
|
2031 | + $actual = $donations = apply_filters('give_goal_donations_raised_output', $form->sales, $form->ID, $form); |
|
2032 | 2032 | break; |
2033 | 2033 | case 'donors': |
2034 | 2034 | /** |
@@ -2042,7 +2042,7 @@ discard block |
||
2042 | 2042 | * |
2043 | 2043 | * @return int $donors Total number of donors that donated to the form. |
2044 | 2044 | */ |
2045 | - $actual = $donors = apply_filters( 'give_goal_donors_target_output', give_get_form_donor_count( $form->ID ), $form->ID, $form ); |
|
2045 | + $actual = $donors = apply_filters('give_goal_donors_target_output', give_get_form_donor_count($form->ID), $form->ID, $form); |
|
2046 | 2046 | break; |
2047 | 2047 | default: |
2048 | 2048 | /** |
@@ -2050,11 +2050,11 @@ discard block |
||
2050 | 2050 | * |
2051 | 2051 | * @since 1.8.8 |
2052 | 2052 | */ |
2053 | - $actual = $income = apply_filters( 'give_goal_amount_raised_output', $form->earnings, $form->ID, $form ); |
|
2053 | + $actual = $income = apply_filters('give_goal_amount_raised_output', $form->earnings, $form->ID, $form); |
|
2054 | 2054 | break; |
2055 | 2055 | } |
2056 | 2056 | |
2057 | - $progress = $total_goal ? round( ( $actual / $total_goal ) * 100, 2 ) : 0; |
|
2057 | + $progress = $total_goal ? round(($actual / $total_goal) * 100, 2) : 0; |
|
2058 | 2058 | |
2059 | 2059 | $stats_array = array( |
2060 | 2060 | 'raw_actual' => $actual, |
@@ -2066,20 +2066,20 @@ discard block |
||
2066 | 2066 | * |
2067 | 2067 | * @since 1.8.8 |
2068 | 2068 | */ |
2069 | - $progress = apply_filters( 'give_goal_amount_funded_percentage_output', $progress, $form->ID, $form ); |
|
2069 | + $progress = apply_filters('give_goal_amount_funded_percentage_output', $progress, $form->ID, $form); |
|
2070 | 2070 | |
2071 | 2071 | // Define Actual Goal based on the goal format. |
2072 | - if ( 'percentage' === $goal_format ) { |
|
2072 | + if ('percentage' === $goal_format) { |
|
2073 | 2073 | $actual = "{$actual}%"; |
2074 | - } elseif ( 'amount' === $goal_format ) { |
|
2075 | - $actual = give_currency_filter( give_format_amount( $actual ) ); |
|
2074 | + } elseif ('amount' === $goal_format) { |
|
2075 | + $actual = give_currency_filter(give_format_amount($actual)); |
|
2076 | 2076 | } |
2077 | 2077 | |
2078 | 2078 | // Define Total Goal based on the goal format. |
2079 | - if ( 'percentage' === $goal_format ) { |
|
2079 | + if ('percentage' === $goal_format) { |
|
2080 | 2080 | $total_goal = ''; |
2081 | - } elseif ( 'amount' === $goal_format ) { |
|
2082 | - $total_goal = give_currency_filter( give_format_amount( $total_goal ) ); |
|
2081 | + } elseif ('amount' === $goal_format) { |
|
2082 | + $total_goal = give_currency_filter(give_format_amount($total_goal)); |
|
2083 | 2083 | } |
2084 | 2084 | |
2085 | 2085 | $stats_array = array_merge( |
@@ -2097,7 +2097,7 @@ discard block |
||
2097 | 2097 | * |
2098 | 2098 | * @since 2.1 |
2099 | 2099 | */ |
2100 | - return apply_filters( 'give_goal_progress_stats', $stats_array ); |
|
2100 | + return apply_filters('give_goal_progress_stats', $stats_array); |
|
2101 | 2101 | } |
2102 | 2102 | |
2103 | 2103 | /** |
@@ -2109,20 +2109,20 @@ discard block |
||
2109 | 2109 | * |
2110 | 2110 | * @return mixed |
2111 | 2111 | */ |
2112 | -function give_get_name_title_prefixes( $form_id = 0 ) { |
|
2112 | +function give_get_name_title_prefixes($form_id = 0) { |
|
2113 | 2113 | |
2114 | - $name_title_prefix = give_is_name_title_prefix_enabled( $form_id ); |
|
2115 | - $title_prefixes = give_get_option( 'title_prefixes' ); |
|
2114 | + $name_title_prefix = give_is_name_title_prefix_enabled($form_id); |
|
2115 | + $title_prefixes = give_get_option('title_prefixes'); |
|
2116 | 2116 | |
2117 | 2117 | // If form id exists, then fetch form specific title prefixes. |
2118 | - if ( intval( $form_id ) > 0 && $name_title_prefix ) { |
|
2118 | + if (intval($form_id) > 0 && $name_title_prefix) { |
|
2119 | 2119 | |
2120 | - $form_title_prefix = give_get_meta( $form_id, '_give_name_title_prefix', true ); |
|
2121 | - if ( 'global' !== $form_title_prefix ) { |
|
2122 | - $form_title_prefixes = give_get_meta( $form_id, '_give_title_prefixes', true ); |
|
2120 | + $form_title_prefix = give_get_meta($form_id, '_give_name_title_prefix', true); |
|
2121 | + if ('global' !== $form_title_prefix) { |
|
2122 | + $form_title_prefixes = give_get_meta($form_id, '_give_title_prefixes', true); |
|
2123 | 2123 | |
2124 | 2124 | // Check whether the form based title prefixes exists or not. |
2125 | - if ( is_array( $form_title_prefixes ) && count( $form_title_prefixes ) > 0 ) { |
|
2125 | + if (is_array($form_title_prefixes) && count($form_title_prefixes) > 0) { |
|
2126 | 2126 | $title_prefixes = $form_title_prefixes; |
2127 | 2127 | } |
2128 | 2128 | } |
@@ -2141,22 +2141,22 @@ discard block |
||
2141 | 2141 | * |
2142 | 2142 | * @return bool |
2143 | 2143 | */ |
2144 | -function give_is_name_title_prefix_enabled( $form_id = 0, $status = '' ) { |
|
2145 | - if ( empty( $status ) ) { |
|
2146 | - $status = array( 'required', 'optional' ); |
|
2144 | +function give_is_name_title_prefix_enabled($form_id = 0, $status = '') { |
|
2145 | + if (empty($status)) { |
|
2146 | + $status = array('required', 'optional'); |
|
2147 | 2147 | } else { |
2148 | - $status = array( $status ); |
|
2148 | + $status = array($status); |
|
2149 | 2149 | } |
2150 | 2150 | |
2151 | - $title_prefix_status = give_is_setting_enabled( give_get_option( 'name_title_prefix' ), $status ); |
|
2151 | + $title_prefix_status = give_is_setting_enabled(give_get_option('name_title_prefix'), $status); |
|
2152 | 2152 | |
2153 | - if ( intval( $form_id ) > 0 ) { |
|
2154 | - $form_title_prefix = give_get_meta( $form_id, '_give_name_title_prefix', true ); |
|
2153 | + if (intval($form_id) > 0) { |
|
2154 | + $form_title_prefix = give_get_meta($form_id, '_give_name_title_prefix', true); |
|
2155 | 2155 | |
2156 | - if ( 'disabled' === $form_title_prefix ) { |
|
2156 | + if ('disabled' === $form_title_prefix) { |
|
2157 | 2157 | $title_prefix_status = false; |
2158 | - } elseif ( in_array( $form_title_prefix, $status, true ) ) { |
|
2159 | - $title_prefix_status = give_is_setting_enabled( $form_title_prefix, $status ); |
|
2158 | + } elseif (in_array($form_title_prefix, $status, true)) { |
|
2159 | + $title_prefix_status = give_is_setting_enabled($form_title_prefix, $status); |
|
2160 | 2160 | } |
2161 | 2161 | } |
2162 | 2162 | |
@@ -2173,18 +2173,18 @@ discard block |
||
2173 | 2173 | * |
2174 | 2174 | * @return object |
2175 | 2175 | */ |
2176 | -function give_get_name_with_title_prefixes( $donor ) { |
|
2176 | +function give_get_name_with_title_prefixes($donor) { |
|
2177 | 2177 | |
2178 | 2178 | // Prepare Give_Donor object, if $donor is numeric. |
2179 | - if ( is_numeric( $donor ) ) { |
|
2180 | - $donor = new Give_Donor( $donor ); |
|
2179 | + if (is_numeric($donor)) { |
|
2180 | + $donor = new Give_Donor($donor); |
|
2181 | 2181 | } |
2182 | 2182 | |
2183 | - $title_prefix = Give()->donor_meta->get_meta( $donor->id, '_give_donor_title_prefix', true ); |
|
2183 | + $title_prefix = Give()->donor_meta->get_meta($donor->id, '_give_donor_title_prefix', true); |
|
2184 | 2184 | |
2185 | 2185 | // Update Donor name, if non empty title prefix. |
2186 | - if ( ! empty( $title_prefix ) ) { |
|
2187 | - $donor->name = give_get_donor_name_with_title_prefixes( $title_prefix, $donor->name ); |
|
2186 | + if ( ! empty($title_prefix)) { |
|
2187 | + $donor->name = give_get_donor_name_with_title_prefixes($title_prefix, $donor->name); |
|
2188 | 2188 | } |
2189 | 2189 | |
2190 | 2190 | return $donor; |
@@ -2200,15 +2200,15 @@ discard block |
||
2200 | 2200 | * |
2201 | 2201 | * @return string |
2202 | 2202 | */ |
2203 | -function give_get_donor_name_with_title_prefixes( $title_prefix, $name ) { |
|
2203 | +function give_get_donor_name_with_title_prefixes($title_prefix, $name) { |
|
2204 | 2204 | |
2205 | 2205 | $donor_name = $name; |
2206 | 2206 | |
2207 | - if ( ! empty( $title_prefix ) && ! empty( $name ) ) { |
|
2207 | + if ( ! empty($title_prefix) && ! empty($name)) { |
|
2208 | 2208 | $donor_name = "{$title_prefix} {$name}"; |
2209 | 2209 | } |
2210 | 2210 | |
2211 | - return trim( $donor_name ); |
|
2211 | + return trim($donor_name); |
|
2212 | 2212 | } |
2213 | 2213 | |
2214 | 2214 | /** |
@@ -2228,9 +2228,9 @@ discard block |
||
2228 | 2228 | return apply_filters( |
2229 | 2229 | 'give_get_default_title_prefixes', |
2230 | 2230 | array( |
2231 | - 'Mr.' => __( 'Mr.', 'give' ), |
|
2232 | - 'Mrs.' => __( 'Mrs.', 'give' ), |
|
2233 | - 'Ms.' => __( 'Ms.', 'give' ), |
|
2231 | + 'Mr.' => __('Mr.', 'give'), |
|
2232 | + 'Mrs.' => __('Mrs.', 'give'), |
|
2233 | + 'Ms.' => __('Ms.', 'give'), |
|
2234 | 2234 | ) |
2235 | 2235 | ); |
2236 | 2236 | } |
@@ -2244,27 +2244,27 @@ discard block |
||
2244 | 2244 | * |
2245 | 2245 | * @return bool |
2246 | 2246 | */ |
2247 | -function give_is_name_title_prefix_required( $form_id = 0 ) { |
|
2247 | +function give_is_name_title_prefix_required($form_id = 0) { |
|
2248 | 2248 | |
2249 | 2249 | // Bail out, if name title prefix is not enabled. |
2250 | - if ( ! give_is_name_title_prefix_enabled( $form_id ) ) { |
|
2250 | + if ( ! give_is_name_title_prefix_enabled($form_id)) { |
|
2251 | 2251 | return false; |
2252 | 2252 | } |
2253 | 2253 | |
2254 | - $status = array( 'optional' ); |
|
2255 | - $is_optional = give_is_setting_enabled( give_get_option( 'name_title_prefix' ), $status ); |
|
2254 | + $status = array('optional'); |
|
2255 | + $is_optional = give_is_setting_enabled(give_get_option('name_title_prefix'), $status); |
|
2256 | 2256 | |
2257 | - if ( intval( $form_id ) > 0 ) { |
|
2258 | - $form_title_prefix = give_get_meta( $form_id, '_give_name_title_prefix', true ); |
|
2257 | + if (intval($form_id) > 0) { |
|
2258 | + $form_title_prefix = give_get_meta($form_id, '_give_name_title_prefix', true); |
|
2259 | 2259 | |
2260 | - if ( 'required' === $form_title_prefix ) { |
|
2260 | + if ('required' === $form_title_prefix) { |
|
2261 | 2261 | $is_optional = false; |
2262 | - } elseif ( 'optional' === $form_title_prefix ) { |
|
2262 | + } elseif ('optional' === $form_title_prefix) { |
|
2263 | 2263 | $is_optional = true; |
2264 | 2264 | } |
2265 | 2265 | } |
2266 | 2266 | |
2267 | - return ( ! $is_optional ); |
|
2267 | + return ( ! $is_optional); |
|
2268 | 2268 | } |
2269 | 2269 | |
2270 | 2270 | /** |
@@ -2275,11 +2275,11 @@ discard block |
||
2275 | 2275 | * @return array $message admin message key. |
2276 | 2276 | */ |
2277 | 2277 | function give_get_admin_messages_key() { |
2278 | - $messages = empty( $_GET['give-messages'] ) ? array() : give_clean( $_GET['give-messages'] ); |
|
2278 | + $messages = empty($_GET['give-messages']) ? array() : give_clean($_GET['give-messages']); |
|
2279 | 2279 | |
2280 | 2280 | // backward compatibility. |
2281 | - if ( ! empty( $_GET['give-message'] ) ) { |
|
2282 | - $messages[] = give_clean( $_GET['give-message'] ); |
|
2281 | + if ( ! empty($_GET['give-message'])) { |
|
2282 | + $messages[] = give_clean($_GET['give-message']); |
|
2283 | 2283 | } |
2284 | 2284 | |
2285 | 2285 | /** |
@@ -2291,7 +2291,7 @@ discard block |
||
2291 | 2291 | * |
2292 | 2292 | * @return array $message admin message key. |
2293 | 2293 | */ |
2294 | - return (array) apply_filters( 'give_get_admin_messages_key', $messages ); |
|
2294 | + return (array) apply_filters('give_get_admin_messages_key', $messages); |
|
2295 | 2295 | } |
2296 | 2296 | |
2297 | 2297 | /** |
@@ -2304,7 +2304,7 @@ discard block |
||
2304 | 2304 | function give_get_user_agent() { |
2305 | 2305 | |
2306 | 2306 | // Get User Agent. |
2307 | - $user_agent = ! empty( $_SERVER['HTTP_USER_AGENT'] ) ? give_clean( $_SERVER['HTTP_USER_AGENT'] ) : ''; // WPCS: input var ok. |
|
2307 | + $user_agent = ! empty($_SERVER['HTTP_USER_AGENT']) ? give_clean($_SERVER['HTTP_USER_AGENT']) : ''; // WPCS: input var ok. |
|
2308 | 2308 | |
2309 | 2309 | return $user_agent; |
2310 | 2310 | } |
@@ -2319,11 +2319,11 @@ discard block |
||
2319 | 2319 | * @param integer $expire Expiry of the cookie. |
2320 | 2320 | * @param bool $secure Whether the cookie should be served only over https. |
2321 | 2321 | */ |
2322 | -function give_setcookie( $name, $value, $expire = 0, $secure = false ) { |
|
2323 | - if ( ! headers_sent() ) { |
|
2322 | +function give_setcookie($name, $value, $expire = 0, $secure = false) { |
|
2323 | + if ( ! headers_sent()) { |
|
2324 | 2324 | setcookie( |
2325 | 2325 | $name, $value, $expire, COOKIEPATH ? COOKIEPATH : '/', COOKIE_DOMAIN, $secure, |
2326 | - apply_filters( 'give_cookie_httponly', false, $name, $value, $expire, $secure ) |
|
2326 | + apply_filters('give_cookie_httponly', false, $name, $value, $expire, $secure) |
|
2327 | 2327 | ); |
2328 | 2328 | } |
2329 | 2329 | } |
@@ -2337,7 +2337,7 @@ discard block |
||
2337 | 2337 | * |
2338 | 2338 | * @return string Formatted address. |
2339 | 2339 | */ |
2340 | -function give_get_formatted_address( $address = array() ) { |
|
2340 | +function give_get_formatted_address($address = array()) { |
|
2341 | 2341 | $formatted_address = ''; |
2342 | 2342 | |
2343 | 2343 | /** |
@@ -2345,21 +2345,21 @@ discard block |
||
2345 | 2345 | * |
2346 | 2346 | * @since 2.2.0 |
2347 | 2347 | */ |
2348 | - $address_format = apply_filters( 'give_address_format_template', "{street_address}\n{city}, {state} {postal_code}\n{country}" ); |
|
2349 | - preg_match_all( '/{([A-z0-9\-\_\ ]+)}/s', $address_format, $matches ); |
|
2348 | + $address_format = apply_filters('give_address_format_template', "{street_address}\n{city}, {state} {postal_code}\n{country}"); |
|
2349 | + preg_match_all('/{([A-z0-9\-\_\ ]+)}/s', $address_format, $matches); |
|
2350 | 2350 | |
2351 | - if ( ! empty( $matches ) && ! empty( $address ) ) { |
|
2351 | + if ( ! empty($matches) && ! empty($address)) { |
|
2352 | 2352 | $address_values = array(); |
2353 | 2353 | |
2354 | - foreach ( $matches[1] as $address_tag ) { |
|
2355 | - $address_values[ $address_tag ] = ''; |
|
2354 | + foreach ($matches[1] as $address_tag) { |
|
2355 | + $address_values[$address_tag] = ''; |
|
2356 | 2356 | |
2357 | - if ( isset( $address[ $address_tag ] ) ) { |
|
2358 | - $address_values[ $address_tag ] = $address[ $address_tag ]; |
|
2357 | + if (isset($address[$address_tag])) { |
|
2358 | + $address_values[$address_tag] = $address[$address_tag]; |
|
2359 | 2359 | } |
2360 | 2360 | } |
2361 | 2361 | |
2362 | - $formatted_address = str_ireplace( $matches[0], $address_values, $address_format ); |
|
2362 | + $formatted_address = str_ireplace($matches[0], $address_values, $address_format); |
|
2363 | 2363 | } |
2364 | 2364 | |
2365 | 2365 | /** |
@@ -2370,7 +2370,7 @@ discard block |
||
2370 | 2370 | * @param string $formatted_address Formatted address. |
2371 | 2371 | * @param string $address_format Format of the address. |
2372 | 2372 | */ |
2373 | - $formatted_address = apply_filters( 'give_get_formatted_address', $formatted_address, $address_format, $address ); |
|
2373 | + $formatted_address = apply_filters('give_get_formatted_address', $formatted_address, $address_format, $address); |
|
2374 | 2374 | |
2375 | 2375 | return $formatted_address; |
2376 | 2376 | } |
@@ -2384,10 +2384,10 @@ discard block |
||
2384 | 2384 | * |
2385 | 2385 | * @return string The JS date format. |
2386 | 2386 | */ |
2387 | -function give_convert_php_date_format_to_js( $php_format ) { |
|
2387 | +function give_convert_php_date_format_to_js($php_format) { |
|
2388 | 2388 | $js_format = $php_format; |
2389 | 2389 | |
2390 | - switch ( $php_format ) { |
|
2390 | + switch ($php_format) { |
|
2391 | 2391 | case 'F j, Y': |
2392 | 2392 | $js_format = 'MM dd, yy'; |
2393 | 2393 | break; |
@@ -2410,7 +2410,7 @@ discard block |
||
2410 | 2410 | * @param string $js_format The JS date format. |
2411 | 2411 | * @param string $php_format The PHP date format. |
2412 | 2412 | */ |
2413 | - $js_format = apply_filters( 'give_js_date_format', $js_format, $php_format ); |
|
2413 | + $js_format = apply_filters('give_js_date_format', $js_format, $php_format); |
|
2414 | 2414 | |
2415 | 2415 | return $js_format; |
2416 | 2416 | } |
@@ -2424,7 +2424,7 @@ discard block |
||
2424 | 2424 | */ |
2425 | 2425 | function give_get_localized_date_format_to_js() { |
2426 | 2426 | |
2427 | - return give_convert_php_date_format_to_js( get_option( 'date_format' ) ); |
|
2427 | + return give_convert_php_date_format_to_js(get_option('date_format')); |
|
2428 | 2428 | } |
2429 | 2429 | |
2430 | 2430 | /** |
@@ -2437,21 +2437,21 @@ discard block |
||
2437 | 2437 | * |
2438 | 2438 | * @return string |
2439 | 2439 | */ |
2440 | -function give_get_safe_asset_url( $url ) { |
|
2440 | +function give_get_safe_asset_url($url) { |
|
2441 | 2441 | |
2442 | 2442 | // Bailout, if empty URL passed. |
2443 | - if ( empty( $url ) ) { |
|
2443 | + if (empty($url)) { |
|
2444 | 2444 | return $url; |
2445 | 2445 | } |
2446 | 2446 | |
2447 | - $schema = parse_url( $url, PHP_URL_SCHEME ); |
|
2448 | - $schema_length = strlen( $schema ) + 1; |
|
2449 | - $url = substr( $url, $schema_length ); |
|
2447 | + $schema = parse_url($url, PHP_URL_SCHEME); |
|
2448 | + $schema_length = strlen($schema) + 1; |
|
2449 | + $url = substr($url, $schema_length); |
|
2450 | 2450 | |
2451 | 2451 | /** |
2452 | 2452 | * Fire the filter |
2453 | 2453 | * |
2454 | 2454 | * @since 2.2.0 |
2455 | 2455 | */ |
2456 | - return apply_filters( 'give_get_safe_asset_url', $url ); |
|
2456 | + return apply_filters('give_get_safe_asset_url', $url); |
|
2457 | 2457 | } |