@@ -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,17 +243,17 @@ 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 | |
253 | 253 | // Verify has variable prices. |
254 | - if ( give_has_variable_prices( $form_id ) && ! empty( $price_id ) ) { |
|
254 | + if (give_has_variable_prices($form_id) && ! empty($price_id)) { |
|
255 | 255 | |
256 | - $item_price_level_text = give_get_price_option_name( $form_id, $price_id, 0, false ); |
|
256 | + $item_price_level_text = give_get_price_option_name($form_id, $price_id, 0, false); |
|
257 | 257 | |
258 | 258 | /** |
259 | 259 | * Output donation level text if: |
@@ -261,9 +261,9 @@ discard block |
||
261 | 261 | * 1. It's not a custom amount |
262 | 262 | * 2. The level field has actual text and isn't the amount (which is already displayed on the receipt). |
263 | 263 | */ |
264 | - if ( 'custom' !== $price_id && ! empty( $item_price_level_text ) ) { |
|
264 | + if ('custom' !== $price_id && ! empty($item_price_level_text)) { |
|
265 | 265 | // Matches a donation level - append level text. |
266 | - $item_name .= ' - ' . $item_price_level_text; |
|
266 | + $item_name .= ' - '.$item_price_level_text; |
|
267 | 267 | } |
268 | 268 | } |
269 | 269 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * |
279 | 279 | * @return string |
280 | 280 | */ |
281 | - return apply_filters( 'give_payment_gateway_item_title', $item_name, $form_id, $payment_data ); |
|
281 | + return apply_filters('give_payment_gateway_item_title', $item_name, $form_id, $payment_data); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
@@ -294,38 +294,38 @@ discard block |
||
294 | 294 | * |
295 | 295 | * @return string |
296 | 296 | */ |
297 | -function give_payment_gateway_donation_summary( $donation_data, $name_and_email = true, $length = 255 ) { |
|
297 | +function give_payment_gateway_donation_summary($donation_data, $name_and_email = true, $length = 255) { |
|
298 | 298 | |
299 | - $form_id = isset( $donation_data['post_data']['give-form-id'] ) ? $donation_data['post_data']['give-form-id'] : ''; |
|
300 | - $price_id = isset( $donation_data['post_data']['give-price-id'] ) ? $donation_data['post_data']['give-price-id'] : ''; |
|
299 | + $form_id = isset($donation_data['post_data']['give-form-id']) ? $donation_data['post_data']['give-form-id'] : ''; |
|
300 | + $price_id = isset($donation_data['post_data']['give-price-id']) ? $donation_data['post_data']['give-price-id'] : ''; |
|
301 | 301 | |
302 | 302 | // Form title. |
303 | - $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 | + $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'))); |
|
304 | 304 | |
305 | 305 | // Form multilevel if applicable. |
306 | - if ( ! empty( $price_id ) && 'custom' !== $price_id ) { |
|
307 | - $summary .= ': ' . give_get_price_option_name( $form_id, $donation_data['post_data']['give-price-id'] ); |
|
306 | + if ( ! empty($price_id) && 'custom' !== $price_id) { |
|
307 | + $summary .= ': '.give_get_price_option_name($form_id, $donation_data['post_data']['give-price-id']); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | // Add Donor's name + email if requested. |
311 | - if ( $name_and_email ) { |
|
311 | + if ($name_and_email) { |
|
312 | 312 | |
313 | 313 | // First name |
314 | - if ( isset( $donation_data['user_info']['first_name'] ) && ! empty( $donation_data['user_info']['first_name'] ) ) { |
|
315 | - $summary .= ' - ' . $donation_data['user_info']['first_name']; |
|
314 | + if (isset($donation_data['user_info']['first_name']) && ! empty($donation_data['user_info']['first_name'])) { |
|
315 | + $summary .= ' - '.$donation_data['user_info']['first_name']; |
|
316 | 316 | } |
317 | 317 | |
318 | - if ( isset( $donation_data['user_info']['last_name'] ) && ! empty( $donation_data['user_info']['last_name'] ) ) { |
|
319 | - $summary .= ' ' . $donation_data['user_info']['last_name']; |
|
318 | + if (isset($donation_data['user_info']['last_name']) && ! empty($donation_data['user_info']['last_name'])) { |
|
319 | + $summary .= ' '.$donation_data['user_info']['last_name']; |
|
320 | 320 | } |
321 | 321 | |
322 | - $summary .= ' (' . $donation_data['user_email'] . ')'; |
|
322 | + $summary .= ' ('.$donation_data['user_email'].')'; |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | // Cut the length |
326 | - $summary = substr( $summary, 0, $length ); |
|
326 | + $summary = substr($summary, 0, $length); |
|
327 | 327 | |
328 | - return apply_filters( 'give_payment_gateway_donation_summary', $summary ); |
|
328 | + return apply_filters('give_payment_gateway_donation_summary', $summary); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | |
@@ -340,31 +340,31 @@ discard block |
||
340 | 340 | function give_get_host() { |
341 | 341 | $host = false; |
342 | 342 | |
343 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
343 | + if (defined('WPE_APIKEY')) { |
|
344 | 344 | $host = 'WP Engine'; |
345 | - } elseif ( defined( 'PAGELYBIN' ) ) { |
|
345 | + } elseif (defined('PAGELYBIN')) { |
|
346 | 346 | $host = 'Pagely'; |
347 | - } elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
347 | + } elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
348 | 348 | $host = 'ICDSoft'; |
349 | - } elseif ( DB_HOST == 'mysqlv5' ) { |
|
349 | + } elseif (DB_HOST == 'mysqlv5') { |
|
350 | 350 | $host = 'NetworkSolutions'; |
351 | - } elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
351 | + } elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
352 | 352 | $host = 'iPage'; |
353 | - } elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
353 | + } elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
354 | 354 | $host = 'IPower'; |
355 | - } elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
355 | + } elseif (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
356 | 356 | $host = 'MediaTemple Grid'; |
357 | - } elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
357 | + } elseif (strpos(DB_HOST, '.pair.com') !== false) { |
|
358 | 358 | $host = 'pair Networks'; |
359 | - } elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
359 | + } elseif (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
360 | 360 | $host = 'Rackspace Cloud'; |
361 | - } elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
361 | + } elseif (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
362 | 362 | $host = 'SysFix.eu Power Hosting'; |
363 | - } elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
363 | + } elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
364 | 364 | $host = 'Flywheel'; |
365 | 365 | } else { |
366 | 366 | // Adding a general fallback for data gathering |
367 | - $host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME']; |
|
367 | + $host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME']; |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | return $host; |
@@ -380,67 +380,67 @@ discard block |
||
380 | 380 | * |
381 | 381 | * @return bool true if host matches, false if not |
382 | 382 | */ |
383 | -function give_is_host( $host = false ) { |
|
383 | +function give_is_host($host = false) { |
|
384 | 384 | |
385 | 385 | $return = false; |
386 | 386 | |
387 | - if ( $host ) { |
|
388 | - $host = str_replace( ' ', '', strtolower( $host ) ); |
|
387 | + if ($host) { |
|
388 | + $host = str_replace(' ', '', strtolower($host)); |
|
389 | 389 | |
390 | - switch ( $host ) { |
|
390 | + switch ($host) { |
|
391 | 391 | case 'wpengine': |
392 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
392 | + if (defined('WPE_APIKEY')) { |
|
393 | 393 | $return = true; |
394 | 394 | } |
395 | 395 | break; |
396 | 396 | case 'pagely': |
397 | - if ( defined( 'PAGELYBIN' ) ) { |
|
397 | + if (defined('PAGELYBIN')) { |
|
398 | 398 | $return = true; |
399 | 399 | } |
400 | 400 | break; |
401 | 401 | case 'icdsoft': |
402 | - if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
402 | + if (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
403 | 403 | $return = true; |
404 | 404 | } |
405 | 405 | break; |
406 | 406 | case 'networksolutions': |
407 | - if ( DB_HOST == 'mysqlv5' ) { |
|
407 | + if (DB_HOST == 'mysqlv5') { |
|
408 | 408 | $return = true; |
409 | 409 | } |
410 | 410 | break; |
411 | 411 | case 'ipage': |
412 | - if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
412 | + if (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
413 | 413 | $return = true; |
414 | 414 | } |
415 | 415 | break; |
416 | 416 | case 'ipower': |
417 | - if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
417 | + if (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
418 | 418 | $return = true; |
419 | 419 | } |
420 | 420 | break; |
421 | 421 | case 'mediatemplegrid': |
422 | - if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
422 | + if (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
423 | 423 | $return = true; |
424 | 424 | } |
425 | 425 | break; |
426 | 426 | case 'pairnetworks': |
427 | - if ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
427 | + if (strpos(DB_HOST, '.pair.com') !== false) { |
|
428 | 428 | $return = true; |
429 | 429 | } |
430 | 430 | break; |
431 | 431 | case 'rackspacecloud': |
432 | - if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
432 | + if (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
433 | 433 | $return = true; |
434 | 434 | } |
435 | 435 | break; |
436 | 436 | case 'sysfix.eu': |
437 | 437 | case 'sysfix.eupowerhosting': |
438 | - if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
438 | + if (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
439 | 439 | $return = true; |
440 | 440 | } |
441 | 441 | break; |
442 | 442 | case 'flywheel': |
443 | - if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
443 | + if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
444 | 444 | $return = true; |
445 | 445 | } |
446 | 446 | break; |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | * @param string $replacement Optional. The function that should have been called. |
474 | 474 | * @param array $backtrace Optional. Contains stack backtrace of deprecated function. |
475 | 475 | */ |
476 | -function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) { |
|
476 | +function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) { |
|
477 | 477 | |
478 | 478 | /** |
479 | 479 | * Fires while give deprecated function call occurs. |
@@ -486,19 +486,19 @@ discard block |
||
486 | 486 | * @param string $replacement Optional. The function that should have been called. |
487 | 487 | * @param string $version The plugin version that deprecated the function. |
488 | 488 | */ |
489 | - do_action( 'give_deprecated_function_run', $function, $replacement, $version ); |
|
489 | + do_action('give_deprecated_function_run', $function, $replacement, $version); |
|
490 | 490 | |
491 | - $show_errors = current_user_can( 'manage_options' ); |
|
491 | + $show_errors = current_user_can('manage_options'); |
|
492 | 492 | |
493 | 493 | // Allow plugin to filter the output error trigger. |
494 | - if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) { |
|
495 | - if ( ! is_null( $replacement ) ) { |
|
496 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) ); |
|
497 | - 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. |
|
494 | + if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) { |
|
495 | + if ( ! is_null($replacement)) { |
|
496 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement)); |
|
497 | + 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. |
|
498 | 498 | // Alternatively we could dump this to a file. |
499 | 499 | } else { |
500 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) ); |
|
501 | - 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. |
|
500 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version)); |
|
501 | + 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. |
|
502 | 502 | // Alternatively we could dump this to a file. |
503 | 503 | } |
504 | 504 | } |
@@ -512,11 +512,11 @@ discard block |
||
512 | 512 | * @return string $post_id |
513 | 513 | */ |
514 | 514 | function give_get_admin_post_id() { |
515 | - $post_id = isset( $_REQUEST['post'] ) ? absint( $_REQUEST['post'] ) : null; |
|
515 | + $post_id = isset($_REQUEST['post']) ? absint($_REQUEST['post']) : null; |
|
516 | 516 | |
517 | - $post_id = ! empty( $post_id ) ? $post_id : ( isset( $_REQUEST['post_id'] ) ? absint( $_REQUEST['post_id'] ) : null ); |
|
517 | + $post_id = ! empty($post_id) ? $post_id : (isset($_REQUEST['post_id']) ? absint($_REQUEST['post_id']) : null); |
|
518 | 518 | |
519 | - $post_id = ! empty( $post_id ) ? $post_id : ( isset( $_REQUEST['post_ID'] ) ? absint( $_REQUEST['post_ID'] ) : null ); |
|
519 | + $post_id = ! empty($post_id) ? $post_id : (isset($_REQUEST['post_ID']) ? absint($_REQUEST['post_ID']) : null); |
|
520 | 520 | |
521 | 521 | return $post_id; |
522 | 522 | } |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | * @return string Arg separator output |
529 | 529 | */ |
530 | 530 | function give_get_php_arg_separator_output() { |
531 | - return ini_get( 'arg_separator.output' ); |
|
531 | + return ini_get('arg_separator.output'); |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | |
@@ -543,10 +543,10 @@ discard block |
||
543 | 543 | * |
544 | 544 | * @return string Short month name |
545 | 545 | */ |
546 | -function give_month_num_to_name( $n ) { |
|
547 | - $timestamp = mktime( 0, 0, 0, $n, 1, 2005 ); |
|
546 | +function give_month_num_to_name($n) { |
|
547 | + $timestamp = mktime(0, 0, 0, $n, 1, 2005); |
|
548 | 548 | |
549 | - return date_i18n( 'M', $timestamp ); |
|
549 | + return date_i18n('M', $timestamp); |
|
550 | 550 | } |
551 | 551 | |
552 | 552 | |
@@ -559,10 +559,10 @@ discard block |
||
559 | 559 | * |
560 | 560 | * @return bool Whether or not function is disabled. |
561 | 561 | */ |
562 | -function give_is_func_disabled( $function ) { |
|
563 | - $disabled = explode( ',', ini_get( 'disable_functions' ) ); |
|
562 | +function give_is_func_disabled($function) { |
|
563 | + $disabled = explode(',', ini_get('disable_functions')); |
|
564 | 564 | |
565 | - return in_array( $function, $disabled ); |
|
565 | + return in_array($function, $disabled); |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | /** |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | function give_get_newsletter() { |
574 | 574 | ?> |
575 | 575 | |
576 | - <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 | + <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> |
|
577 | 577 | |
578 | 578 | <div class="give-newsletter-form-wrap"> |
579 | 579 | |
@@ -581,33 +581,33 @@ discard block |
||
581 | 581 | method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" |
582 | 582 | target="_blank"> |
583 | 583 | <div class="give-newsletter-confirmation"> |
584 | - <p><?php esc_html_e( 'To complete your subscription, click the confirmation link in your email. Thank you!', 'give' ); ?></p> |
|
584 | + <p><?php esc_html_e('To complete your subscription, click the confirmation link in your email. Thank you!', 'give'); ?></p> |
|
585 | 585 | </div> |
586 | 586 | |
587 | 587 | <table class="form-table give-newsletter-form"> |
588 | 588 | <tr valign="middle"> |
589 | 589 | <td> |
590 | 590 | <label for="mce-EMAIL" |
591 | - class="screen-reader-text"><?php esc_html_e( 'Email Address (required)', 'give' ); ?></label> |
|
591 | + class="screen-reader-text"><?php esc_html_e('Email Address (required)', 'give'); ?></label> |
|
592 | 592 | <input type="email" name="EMAIL" id="mce-EMAIL" |
593 | - placeholder="<?php esc_attr_e( 'Email Address (required)', 'give' ); ?>" |
|
593 | + placeholder="<?php esc_attr_e('Email Address (required)', 'give'); ?>" |
|
594 | 594 | class="required email" value="" required> |
595 | 595 | </td> |
596 | 596 | <td> |
597 | 597 | <label for="mce-FNAME" |
598 | - class="screen-reader-text"><?php esc_html_e( 'First Name', 'give' ); ?></label> |
|
598 | + class="screen-reader-text"><?php esc_html_e('First Name', 'give'); ?></label> |
|
599 | 599 | <input type="text" name="FNAME" id="mce-FNAME" |
600 | - placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" class="" value="" required> |
|
600 | + placeholder="<?php esc_attr_e('First Name', 'give'); ?>" class="" value="" required> |
|
601 | 601 | </td> |
602 | 602 | <td> |
603 | 603 | <label for="mce-LNAME" |
604 | - class="screen-reader-text"><?php esc_html_e( 'Last Name', 'give' ); ?></label> |
|
604 | + class="screen-reader-text"><?php esc_html_e('Last Name', 'give'); ?></label> |
|
605 | 605 | <input type="text" name="LNAME" id="mce-LNAME" |
606 | - placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" class="" value=""> |
|
606 | + placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" class="" value=""> |
|
607 | 607 | </td> |
608 | 608 | <td> |
609 | 609 | <input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button" |
610 | - value="<?php esc_attr_e( 'Subscribe', 'give' ); ?>"> |
|
610 | + value="<?php esc_attr_e('Subscribe', 'give'); ?>"> |
|
611 | 611 | </td> |
612 | 612 | </tr> |
613 | 613 | </table> |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | * |
665 | 665 | * @return string |
666 | 666 | */ |
667 | -function give_svg_icons( $icon ) { |
|
667 | +function give_svg_icons($icon) { |
|
668 | 668 | |
669 | 669 | // Store your SVGs in an associative array |
670 | 670 | $svgs = array( |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | ); |
677 | 677 | |
678 | 678 | // Return the chosen icon's SVG string |
679 | - return $svgs[ $icon ]; |
|
679 | + return $svgs[$icon]; |
|
680 | 680 | } |
681 | 681 | |
682 | 682 | /** |
@@ -688,15 +688,15 @@ discard block |
||
688 | 688 | * |
689 | 689 | * @return mixed |
690 | 690 | */ |
691 | -function modify_nav_menu_meta_box_object( $post_type ) { |
|
692 | - if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) { |
|
693 | - $post_type->labels->name = esc_html__( 'Donation Forms', 'give' ); |
|
691 | +function modify_nav_menu_meta_box_object($post_type) { |
|
692 | + if (isset($post_type->name) && $post_type->name == 'give_forms') { |
|
693 | + $post_type->labels->name = esc_html__('Donation Forms', 'give'); |
|
694 | 694 | } |
695 | 695 | |
696 | 696 | return $post_type; |
697 | 697 | } |
698 | 698 | |
699 | -add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' ); |
|
699 | +add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object'); |
|
700 | 700 | |
701 | 701 | /** |
702 | 702 | * Show Donation Forms Post Type in Appearance > Menus by default on fresh install. |
@@ -713,30 +713,30 @@ discard block |
||
713 | 713 | $screen = get_current_screen(); |
714 | 714 | |
715 | 715 | // Proceed, if current screen is navigation menus. |
716 | - if ( 'nav-menus' === $screen->id && give_is_setting_enabled( give_get_option( 'forms_singular' ) ) && ! get_user_option( 'give_is_donation_forms_menu_updated' ) ) { |
|
716 | + if ('nav-menus' === $screen->id && give_is_setting_enabled(give_get_option('forms_singular')) && ! get_user_option('give_is_donation_forms_menu_updated')) { |
|
717 | 717 | |
718 | 718 | // Return false, if it fails to retrieve hidden meta box list and is not admin. |
719 | - if ( ! is_admin() || ( ! $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus' ) ) ) { |
|
719 | + if ( ! is_admin() || ( ! $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus'))) { |
|
720 | 720 | return false; |
721 | 721 | } |
722 | 722 | |
723 | 723 | // Return false, In case, we don't find 'Donation Form' in hidden meta box list. |
724 | - if ( ! in_array( 'add-post-type-give_forms', $hidden_meta_boxes, true ) ) { |
|
724 | + if ( ! in_array('add-post-type-give_forms', $hidden_meta_boxes, true)) { |
|
725 | 725 | return false; |
726 | 726 | } |
727 | 727 | |
728 | 728 | // Exclude 'Donation Form' value from hidden meta box's list. |
729 | - $hidden_meta_boxes = array_diff( $hidden_meta_boxes, array( 'add-post-type-give_forms' ) ); |
|
729 | + $hidden_meta_boxes = array_diff($hidden_meta_boxes, array('add-post-type-give_forms')); |
|
730 | 730 | |
731 | 731 | // Get current user ID. |
732 | 732 | $user = wp_get_current_user(); |
733 | 733 | |
734 | - update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true ); |
|
735 | - update_user_option( $user->ID, 'give_is_donation_forms_menu_updated', true, true ); |
|
734 | + update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true); |
|
735 | + update_user_option($user->ID, 'give_is_donation_forms_menu_updated', true, true); |
|
736 | 736 | } |
737 | 737 | } |
738 | 738 | |
739 | -add_action( 'current_screen', 'give_donation_metabox_menu' ); |
|
739 | +add_action('current_screen', 'give_donation_metabox_menu'); |
|
740 | 740 | |
741 | 741 | /** |
742 | 742 | * Array_column backup usage |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | * @license https://opensource.org/licenses/MIT MIT |
750 | 750 | */ |
751 | 751 | |
752 | -if ( ! function_exists( 'array_column' ) ) { |
|
752 | +if ( ! function_exists('array_column')) { |
|
753 | 753 | /** |
754 | 754 | * Returns the values from a single column of the input array, identified by |
755 | 755 | * the $columnKey. |
@@ -768,43 +768,43 @@ discard block |
||
768 | 768 | * |
769 | 769 | * @return array |
770 | 770 | */ |
771 | - function array_column( $input = null, $columnKey = null, $indexKey = null ) { |
|
771 | + function array_column($input = null, $columnKey = null, $indexKey = null) { |
|
772 | 772 | // Using func_get_args() in order to check for proper number of |
773 | 773 | // parameters and trigger errors exactly as the built-in array_column() |
774 | 774 | // does in PHP 5.5. |
775 | 775 | $argc = func_num_args(); |
776 | 776 | $params = func_get_args(); |
777 | 777 | |
778 | - if ( $argc < 2 ) { |
|
779 | - trigger_error( sprintf( esc_html__( 'array_column() expects at least 2 parameters, %s given.', 'give' ), $argc ), E_USER_WARNING ); |
|
778 | + if ($argc < 2) { |
|
779 | + trigger_error(sprintf(esc_html__('array_column() expects at least 2 parameters, %s given.', 'give'), $argc), E_USER_WARNING); |
|
780 | 780 | |
781 | 781 | return null; |
782 | 782 | } |
783 | 783 | |
784 | - if ( ! is_array( $params[0] ) ) { |
|
785 | - trigger_error( sprintf( esc_html__( 'array_column() expects parameter 1 to be array, %s given.', 'give' ), gettype( $params[0] ) ), E_USER_WARNING ); |
|
784 | + if ( ! is_array($params[0])) { |
|
785 | + trigger_error(sprintf(esc_html__('array_column() expects parameter 1 to be array, %s given.', 'give'), gettype($params[0])), E_USER_WARNING); |
|
786 | 786 | |
787 | 787 | return null; |
788 | 788 | } |
789 | 789 | |
790 | - 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' ) ) ) { |
|
791 | - trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING ); |
|
790 | + 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'))) { |
|
791 | + trigger_error(esc_html__('array_column(): The column key should be either a string or an integer.', 'give'), E_USER_WARNING); |
|
792 | 792 | |
793 | 793 | return false; |
794 | 794 | } |
795 | 795 | |
796 | - 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' ) ) ) { |
|
797 | - trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING ); |
|
796 | + 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'))) { |
|
797 | + trigger_error(esc_html__('array_column(): The index key should be either a string or an integer.', 'give'), E_USER_WARNING); |
|
798 | 798 | |
799 | 799 | return false; |
800 | 800 | } |
801 | 801 | |
802 | 802 | $paramsInput = $params[0]; |
803 | - $paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null; |
|
803 | + $paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null; |
|
804 | 804 | |
805 | 805 | $paramsIndexKey = null; |
806 | - if ( isset( $params[2] ) ) { |
|
807 | - if ( is_float( $params[2] ) || is_int( $params[2] ) ) { |
|
806 | + if (isset($params[2])) { |
|
807 | + if (is_float($params[2]) || is_int($params[2])) { |
|
808 | 808 | $paramsIndexKey = (int) $params[2]; |
809 | 809 | } else { |
810 | 810 | $paramsIndexKey = (string) $params[2]; |
@@ -813,26 +813,26 @@ discard block |
||
813 | 813 | |
814 | 814 | $resultArray = array(); |
815 | 815 | |
816 | - foreach ( $paramsInput as $row ) { |
|
816 | + foreach ($paramsInput as $row) { |
|
817 | 817 | $key = $value = null; |
818 | 818 | $keySet = $valueSet = false; |
819 | 819 | |
820 | - if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) { |
|
820 | + if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) { |
|
821 | 821 | $keySet = true; |
822 | - $key = (string) $row[ $paramsIndexKey ]; |
|
822 | + $key = (string) $row[$paramsIndexKey]; |
|
823 | 823 | } |
824 | 824 | |
825 | - if ( $paramsColumnKey === null ) { |
|
825 | + if ($paramsColumnKey === null) { |
|
826 | 826 | $valueSet = true; |
827 | 827 | $value = $row; |
828 | - } elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) { |
|
828 | + } elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) { |
|
829 | 829 | $valueSet = true; |
830 | - $value = $row[ $paramsColumnKey ]; |
|
830 | + $value = $row[$paramsColumnKey]; |
|
831 | 831 | } |
832 | 832 | |
833 | - if ( $valueSet ) { |
|
834 | - if ( $keySet ) { |
|
835 | - $resultArray[ $key ] = $value; |
|
833 | + if ($valueSet) { |
|
834 | + if ($keySet) { |
|
835 | + $resultArray[$key] = $value; |
|
836 | 836 | } else { |
837 | 837 | $resultArray[] = $value; |
838 | 838 | } |
@@ -852,54 +852,54 @@ discard block |
||
852 | 852 | * |
853 | 853 | * @return bool Whether the receipt is visible or not. |
854 | 854 | */ |
855 | -function give_can_view_receipt( $payment_key = '' ) { |
|
855 | +function give_can_view_receipt($payment_key = '') { |
|
856 | 856 | |
857 | 857 | $return = false; |
858 | 858 | |
859 | - if ( empty( $payment_key ) ) { |
|
859 | + if (empty($payment_key)) { |
|
860 | 860 | return $return; |
861 | 861 | } |
862 | 862 | |
863 | 863 | global $give_receipt_args; |
864 | 864 | |
865 | - $give_receipt_args['id'] = give_get_donation_id_by_key( $payment_key ); |
|
865 | + $give_receipt_args['id'] = give_get_donation_id_by_key($payment_key); |
|
866 | 866 | |
867 | - $user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] ); |
|
867 | + $user_id = (int) give_get_payment_user_id($give_receipt_args['id']); |
|
868 | 868 | |
869 | - $payment_meta = give_get_payment_meta( $give_receipt_args['id'] ); |
|
869 | + $payment_meta = give_get_payment_meta($give_receipt_args['id']); |
|
870 | 870 | |
871 | - if ( is_user_logged_in() ) { |
|
872 | - if ( $user_id === (int) get_current_user_id() ) { |
|
871 | + if (is_user_logged_in()) { |
|
872 | + if ($user_id === (int) get_current_user_id()) { |
|
873 | 873 | $return = true; |
874 | - } elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) { |
|
874 | + } elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) { |
|
875 | 875 | $return = true; |
876 | - } elseif ( current_user_can( 'view_give_sensitive_data' ) ) { |
|
876 | + } elseif (current_user_can('view_give_sensitive_data')) { |
|
877 | 877 | $return = true; |
878 | 878 | } |
879 | 879 | } |
880 | 880 | |
881 | 881 | // Check whether it is purchase session? |
882 | 882 | $purchase_session = give_get_purchase_session(); |
883 | - if ( ! empty( $purchase_session ) && ! is_user_logged_in() ) { |
|
884 | - if ( $purchase_session['purchase_key'] === $payment_meta['key'] ) { |
|
883 | + if ( ! empty($purchase_session) && ! is_user_logged_in()) { |
|
884 | + if ($purchase_session['purchase_key'] === $payment_meta['key']) { |
|
885 | 885 | $return = true; |
886 | 886 | } |
887 | 887 | } |
888 | 888 | |
889 | 889 | // Check whether it is receipt access session? |
890 | 890 | $receipt_session = give_get_receipt_session(); |
891 | - if ( ! empty( $receipt_session ) && ! is_user_logged_in() ) { |
|
892 | - if ( $receipt_session === $payment_meta['key'] ) { |
|
891 | + if ( ! empty($receipt_session) && ! is_user_logged_in()) { |
|
892 | + if ($receipt_session === $payment_meta['key']) { |
|
893 | 893 | $return = true; |
894 | 894 | } |
895 | 895 | } |
896 | 896 | |
897 | 897 | // Check whether it is history access session? |
898 | - if ( true === give_get_history_session() ) { |
|
898 | + if (true === give_get_history_session()) { |
|
899 | 899 | $return = true; |
900 | 900 | } |
901 | 901 | |
902 | - return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key ); |
|
902 | + return (bool) apply_filters('give_can_view_receipt', $return, $payment_key); |
|
903 | 903 | |
904 | 904 | } |
905 | 905 | |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | * |
909 | 909 | * Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar |
910 | 910 | */ |
911 | -if ( ! function_exists( 'cal_days_in_month' ) ) { |
|
911 | +if ( ! function_exists('cal_days_in_month')) { |
|
912 | 912 | /** |
913 | 913 | * cal_days_in_month |
914 | 914 | * |
@@ -918,8 +918,8 @@ discard block |
||
918 | 918 | * |
919 | 919 | * @return bool|string |
920 | 920 | */ |
921 | - function cal_days_in_month( $calendar, $month, $year ) { |
|
922 | - return date( 't', mktime( 0, 0, 0, $month, 1, $year ) ); |
|
921 | + function cal_days_in_month($calendar, $month, $year) { |
|
922 | + return date('t', mktime(0, 0, 0, $month, 1, $year)); |
|
923 | 923 | } |
924 | 924 | } |
925 | 925 | |
@@ -938,40 +938,40 @@ discard block |
||
938 | 938 | */ |
939 | 939 | function give_get_plugins() { |
940 | 940 | $plugins = get_plugins(); |
941 | - $active_plugin_paths = (array) get_option( 'active_plugins', array() ); |
|
941 | + $active_plugin_paths = (array) get_option('active_plugins', array()); |
|
942 | 942 | |
943 | - if ( is_multisite() ) { |
|
944 | - $network_activated_plugin_paths = array_keys( get_site_option( 'active_sitewide_plugins', array() ) ); |
|
945 | - $active_plugin_paths = array_merge( $active_plugin_paths, $network_activated_plugin_paths ); |
|
943 | + if (is_multisite()) { |
|
944 | + $network_activated_plugin_paths = array_keys(get_site_option('active_sitewide_plugins', array())); |
|
945 | + $active_plugin_paths = array_merge($active_plugin_paths, $network_activated_plugin_paths); |
|
946 | 946 | } |
947 | 947 | |
948 | - foreach ( $plugins as $plugin_path => $plugin_data ) { |
|
948 | + foreach ($plugins as $plugin_path => $plugin_data) { |
|
949 | 949 | // Is plugin active? |
950 | - if ( in_array( $plugin_path, $active_plugin_paths ) ) { |
|
951 | - $plugins[ $plugin_path ]['Status'] = 'active'; |
|
950 | + if (in_array($plugin_path, $active_plugin_paths)) { |
|
951 | + $plugins[$plugin_path]['Status'] = 'active'; |
|
952 | 952 | } else { |
953 | - $plugins[ $plugin_path ]['Status'] = 'inactive'; |
|
953 | + $plugins[$plugin_path]['Status'] = 'inactive'; |
|
954 | 954 | } |
955 | 955 | |
956 | - $dirname = strtolower( dirname( $plugin_path ) ); |
|
956 | + $dirname = strtolower(dirname($plugin_path)); |
|
957 | 957 | |
958 | 958 | // Is plugin a Give add-on by WordImpress? |
959 | - if ( strstr( $dirname, 'give-' ) && strstr( $plugin_data['AuthorURI'], 'wordimpress.com' ) ) { |
|
959 | + if (strstr($dirname, 'give-') && strstr($plugin_data['AuthorURI'], 'wordimpress.com')) { |
|
960 | 960 | // Plugin is a Give-addon. |
961 | - $plugins[ $plugin_path ]['Type'] = 'add-on'; |
|
961 | + $plugins[$plugin_path]['Type'] = 'add-on'; |
|
962 | 962 | |
963 | 963 | /* @var stdClass $license_active */ |
964 | - $license_active = __give_get_active_license_info( Give_License::get_short_name( $plugin_data['Name'] ) ); |
|
964 | + $license_active = __give_get_active_license_info(Give_License::get_short_name($plugin_data['Name'])); |
|
965 | 965 | |
966 | 966 | // Does a valid license exist? |
967 | - if ( ! empty( $license_active ) && 'valid' === $license_active->license ) { |
|
968 | - $plugins[ $plugin_path ]['License'] = true; |
|
967 | + if ( ! empty($license_active) && 'valid' === $license_active->license) { |
|
968 | + $plugins[$plugin_path]['License'] = true; |
|
969 | 969 | } else { |
970 | - $plugins[ $plugin_path ]['License'] = false; |
|
970 | + $plugins[$plugin_path]['License'] = false; |
|
971 | 971 | } |
972 | 972 | } else { |
973 | 973 | // Plugin is not a Give add-on. |
974 | - $plugins[ $plugin_path ]['Type'] = 'other'; |
|
974 | + $plugins[$plugin_path]['Type'] = 'other'; |
|
975 | 975 | } |
976 | 976 | } |
977 | 977 | |
@@ -987,13 +987,13 @@ discard block |
||
987 | 987 | * |
988 | 988 | * @return bool |
989 | 989 | */ |
990 | -function give_is_terms_enabled( $form_id ) { |
|
991 | - $form_option = give_get_meta( $form_id, '_give_terms_option', true ); |
|
990 | +function give_is_terms_enabled($form_id) { |
|
991 | + $form_option = give_get_meta($form_id, '_give_terms_option', true); |
|
992 | 992 | |
993 | - if ( give_is_setting_enabled( $form_option, 'global' ) && give_is_setting_enabled( give_get_option( 'terms' ) ) ) { |
|
993 | + if (give_is_setting_enabled($form_option, 'global') && give_is_setting_enabled(give_get_option('terms'))) { |
|
994 | 994 | return true; |
995 | 995 | |
996 | - } elseif ( give_is_setting_enabled( $form_option ) ) { |
|
996 | + } elseif (give_is_setting_enabled($form_option)) { |
|
997 | 997 | return true; |
998 | 998 | |
999 | 999 | } else { |
@@ -1017,10 +1017,10 @@ discard block |
||
1017 | 1017 | * |
1018 | 1018 | * @return WP_Error|bool |
1019 | 1019 | */ |
1020 | -function give_delete_donation_stats( $date_range = '', $args = array() ) { |
|
1020 | +function give_delete_donation_stats($date_range = '', $args = array()) { |
|
1021 | 1021 | |
1022 | 1022 | // Delete all cache. |
1023 | - $status = Give_Cache::delete( Give_Cache::get_options_like( 'give_stats' ) ); |
|
1023 | + $status = Give_Cache::delete(Give_Cache::get_options_like('give_stats')); |
|
1024 | 1024 | |
1025 | 1025 | /** |
1026 | 1026 | * Fire the action when donation stats delete. |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | * @param string|array $date_range |
1031 | 1031 | * @param array $args |
1032 | 1032 | */ |
1033 | - do_action( 'give_delete_donation_stats', $status, $date_range, $args ); |
|
1033 | + do_action('give_delete_donation_stats', $status, $date_range, $args); |
|
1034 | 1034 | |
1035 | 1035 | return $status; |
1036 | 1036 | } |
@@ -1044,7 +1044,7 @@ discard block |
||
1044 | 1044 | function give_is_add_new_form_page() { |
1045 | 1045 | $status = false; |
1046 | 1046 | |
1047 | - if ( false !== strpos( $_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms' ) ) { |
|
1047 | + if (false !== strpos($_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms')) { |
|
1048 | 1048 | $status = true; |
1049 | 1049 | } |
1050 | 1050 | |
@@ -1067,15 +1067,15 @@ discard block |
||
1067 | 1067 | * |
1068 | 1068 | * @return mixed |
1069 | 1069 | */ |
1070 | -function give_get_meta( $id, $meta_key = '', $single = false, $default = false ) { |
|
1070 | +function give_get_meta($id, $meta_key = '', $single = false, $default = false) { |
|
1071 | 1071 | /** |
1072 | 1072 | * Filter the meta value |
1073 | 1073 | * |
1074 | 1074 | * @since 1.8.8 |
1075 | 1075 | */ |
1076 | - $meta_value = apply_filters( 'give_get_meta', get_post_meta( $id, $meta_key, $single ), $id, $meta_key, $default ); |
|
1076 | + $meta_value = apply_filters('give_get_meta', get_post_meta($id, $meta_key, $single), $id, $meta_key, $default); |
|
1077 | 1077 | |
1078 | - if ( ( empty( $meta_key ) || empty( $meta_value ) ) && $default ) { |
|
1078 | + if ((empty($meta_key) || empty($meta_value)) && $default) { |
|
1079 | 1079 | $meta_value = $default; |
1080 | 1080 | } |
1081 | 1081 | |
@@ -1094,15 +1094,15 @@ discard block |
||
1094 | 1094 | * |
1095 | 1095 | * @return mixed |
1096 | 1096 | */ |
1097 | -function give_update_meta( $id, $meta_key, $meta_value, $prev_value = '' ) { |
|
1098 | - $status = update_post_meta( $id, $meta_key, $meta_value, $prev_value ); |
|
1097 | +function give_update_meta($id, $meta_key, $meta_value, $prev_value = '') { |
|
1098 | + $status = update_post_meta($id, $meta_key, $meta_value, $prev_value); |
|
1099 | 1099 | |
1100 | 1100 | /** |
1101 | 1101 | * Filter the meta value update status |
1102 | 1102 | * |
1103 | 1103 | * @since 1.8.8 |
1104 | 1104 | */ |
1105 | - return apply_filters( 'give_update_meta', $status, $id, $meta_key, $meta_value ); |
|
1105 | + return apply_filters('give_update_meta', $status, $id, $meta_key, $meta_value); |
|
1106 | 1106 | } |
1107 | 1107 | |
1108 | 1108 | /** |
@@ -1116,15 +1116,15 @@ discard block |
||
1116 | 1116 | * |
1117 | 1117 | * @return mixed |
1118 | 1118 | */ |
1119 | -function give_delete_meta( $id, $meta_key, $meta_value = '' ) { |
|
1120 | - $status = delete_post_meta( $id, $meta_key, $meta_value ); |
|
1119 | +function give_delete_meta($id, $meta_key, $meta_value = '') { |
|
1120 | + $status = delete_post_meta($id, $meta_key, $meta_value); |
|
1121 | 1121 | |
1122 | 1122 | /** |
1123 | 1123 | * Filter the meta value delete status |
1124 | 1124 | * |
1125 | 1125 | * @since 1.8.8 |
1126 | 1126 | */ |
1127 | - return apply_filters( 'give_delete_meta', $status, $id, $meta_key, $meta_value ); |
|
1127 | + return apply_filters('give_delete_meta', $status, $id, $meta_key, $meta_value); |
|
1128 | 1128 | } |
1129 | 1129 | |
1130 | 1130 | /** |
@@ -1136,23 +1136,23 @@ discard block |
||
1136 | 1136 | * |
1137 | 1137 | * @return bool If the action has been added to the completed actions array |
1138 | 1138 | */ |
1139 | -function give_has_upgrade_completed( $upgrade_action = '' ) { |
|
1139 | +function give_has_upgrade_completed($upgrade_action = '') { |
|
1140 | 1140 | // Bailout. |
1141 | - if ( empty( $upgrade_action ) ) { |
|
1141 | + if (empty($upgrade_action)) { |
|
1142 | 1142 | return false; |
1143 | 1143 | } |
1144 | 1144 | |
1145 | 1145 | // Fresh install? |
1146 | 1146 | // If fresh install then all upgrades will be consider as completed. |
1147 | - $is_fresh_install = ! get_option( 'give_version' ); |
|
1148 | - if ( $is_fresh_install ) { |
|
1147 | + $is_fresh_install = ! get_option('give_version'); |
|
1148 | + if ($is_fresh_install) { |
|
1149 | 1149 | return true; |
1150 | 1150 | } |
1151 | 1151 | |
1152 | 1152 | |
1153 | 1153 | $completed_upgrades = give_get_completed_upgrades(); |
1154 | 1154 | |
1155 | - return in_array( $upgrade_action, $completed_upgrades ); |
|
1155 | + return in_array($upgrade_action, $completed_upgrades); |
|
1156 | 1156 | |
1157 | 1157 | } |
1158 | 1158 | |
@@ -1164,8 +1164,8 @@ discard block |
||
1164 | 1164 | * @return mixed When nothing to resume returns false, otherwise starts the upgrade where it left off |
1165 | 1165 | */ |
1166 | 1166 | function give_maybe_resume_upgrade() { |
1167 | - $doing_upgrade = get_option( 'give_doing_upgrade', false ); |
|
1168 | - if ( empty( $doing_upgrade ) ) { |
|
1167 | + $doing_upgrade = get_option('give_doing_upgrade', false); |
|
1168 | + if (empty($doing_upgrade)) { |
|
1169 | 1169 | return false; |
1170 | 1170 | } |
1171 | 1171 | |
@@ -1181,9 +1181,9 @@ discard block |
||
1181 | 1181 | * |
1182 | 1182 | * @return bool If the function was successfully added |
1183 | 1183 | */ |
1184 | -function give_set_upgrade_complete( $upgrade_action = '' ) { |
|
1184 | +function give_set_upgrade_complete($upgrade_action = '') { |
|
1185 | 1185 | |
1186 | - if ( empty( $upgrade_action ) ) { |
|
1186 | + if (empty($upgrade_action)) { |
|
1187 | 1187 | return false; |
1188 | 1188 | } |
1189 | 1189 | |
@@ -1191,16 +1191,16 @@ discard block |
||
1191 | 1191 | $completed_upgrades[] = $upgrade_action; |
1192 | 1192 | |
1193 | 1193 | // Remove any blanks, and only show uniques. |
1194 | - $completed_upgrades = array_unique( array_values( $completed_upgrades ) ); |
|
1194 | + $completed_upgrades = array_unique(array_values($completed_upgrades)); |
|
1195 | 1195 | |
1196 | 1196 | /** |
1197 | 1197 | * Fire the action when any upgrade set to complete. |
1198 | 1198 | * |
1199 | 1199 | * @since 1.8.12 |
1200 | 1200 | */ |
1201 | - do_action( 'give_set_upgrade_completed', $upgrade_action, $completed_upgrades ); |
|
1201 | + do_action('give_set_upgrade_completed', $upgrade_action, $completed_upgrades); |
|
1202 | 1202 | |
1203 | - return update_option( 'give_completed_upgrades', $completed_upgrades, false ); |
|
1203 | + return update_option('give_completed_upgrades', $completed_upgrades, false); |
|
1204 | 1204 | } |
1205 | 1205 | |
1206 | 1206 | /** |
@@ -1210,7 +1210,7 @@ discard block |
||
1210 | 1210 | * @return array The array of completed upgrades |
1211 | 1211 | */ |
1212 | 1212 | function give_get_completed_upgrades() { |
1213 | - return (array) get_option( 'give_completed_upgrades' ); |
|
1213 | + return (array) get_option('give_completed_upgrades'); |
|
1214 | 1214 | } |
1215 | 1215 | |
1216 | 1216 | /** |
@@ -1225,16 +1225,16 @@ discard block |
||
1225 | 1225 | * |
1226 | 1226 | * @return null|array |
1227 | 1227 | */ |
1228 | -function __give_v20_bc_table_details( $type ) { |
|
1228 | +function __give_v20_bc_table_details($type) { |
|
1229 | 1229 | global $wpdb; |
1230 | 1230 | $table = array(); |
1231 | 1231 | |
1232 | 1232 | // Bailout. |
1233 | - if ( empty( $type ) ) { |
|
1233 | + if (empty($type)) { |
|
1234 | 1234 | return null; |
1235 | 1235 | } |
1236 | 1236 | |
1237 | - switch ( $type ) { |
|
1237 | + switch ($type) { |
|
1238 | 1238 | case 'form': |
1239 | 1239 | $table['name'] = $wpdb->formmeta; |
1240 | 1240 | $table['column']['id'] = 'form_id'; |
@@ -1243,11 +1243,11 @@ discard block |
||
1243 | 1243 | |
1244 | 1244 | case 'payment': |
1245 | 1245 | $table['name'] = $wpdb->donationmeta; |
1246 | - $table['column']['id'] = Give()->payment_meta->get_meta_type() . '_id'; |
|
1246 | + $table['column']['id'] = Give()->payment_meta->get_meta_type().'_id'; |
|
1247 | 1247 | } |
1248 | 1248 | |
1249 | 1249 | // Backward compatibility. |
1250 | - if ( ! give_has_upgrade_completed( 'v20_move_metadata_into_new_table' ) ) { |
|
1250 | + if ( ! give_has_upgrade_completed('v20_move_metadata_into_new_table')) { |
|
1251 | 1251 | $table['name'] = $wpdb->postmeta; |
1252 | 1252 | $table['column']['id'] = 'post_id'; |
1253 | 1253 | } |
@@ -1263,22 +1263,22 @@ discard block |
||
1263 | 1263 | * |
1264 | 1264 | * @param WP_Query $query |
1265 | 1265 | */ |
1266 | -function give_remove_pages_from_search( $query ) { |
|
1266 | +function give_remove_pages_from_search($query) { |
|
1267 | 1267 | |
1268 | - if ( ! $query->is_admin && $query->is_search && $query->is_main_query() ) { |
|
1268 | + if ( ! $query->is_admin && $query->is_search && $query->is_main_query()) { |
|
1269 | 1269 | |
1270 | - $transaction_failed = give_get_option( 'failure_page', 0 ); |
|
1271 | - $success_page = give_get_option( 'success_page', 0 ); |
|
1270 | + $transaction_failed = give_get_option('failure_page', 0); |
|
1271 | + $success_page = give_get_option('success_page', 0); |
|
1272 | 1272 | |
1273 | - $args = apply_filters( 'give_remove_pages_from_search', array( |
|
1273 | + $args = apply_filters('give_remove_pages_from_search', array( |
|
1274 | 1274 | $transaction_failed, |
1275 | 1275 | $success_page, |
1276 | - ), $query ); |
|
1277 | - $query->set( 'post__not_in', $args ); |
|
1276 | + ), $query); |
|
1277 | + $query->set('post__not_in', $args); |
|
1278 | 1278 | } |
1279 | 1279 | } |
1280 | 1280 | |
1281 | -add_action( 'pre_get_posts', 'give_remove_pages_from_search', 10, 1 ); |
|
1281 | +add_action('pre_get_posts', 'give_remove_pages_from_search', 10, 1); |
|
1282 | 1282 | |
1283 | 1283 | /** |
1284 | 1284 | * Inserts a new key/value before a key in the array. |
@@ -1294,14 +1294,14 @@ discard block |
||
1294 | 1294 | * |
1295 | 1295 | * @see array_insert_before() |
1296 | 1296 | */ |
1297 | -function give_array_insert_before( $key, array &$array, $new_key, $new_value ) { |
|
1298 | - if ( array_key_exists( $key, $array ) ) { |
|
1297 | +function give_array_insert_before($key, array &$array, $new_key, $new_value) { |
|
1298 | + if (array_key_exists($key, $array)) { |
|
1299 | 1299 | $new = array(); |
1300 | - foreach ( $array as $k => $value ) { |
|
1301 | - if ( $k === $key ) { |
|
1302 | - $new[ $new_key ] = $new_value; |
|
1300 | + foreach ($array as $k => $value) { |
|
1301 | + if ($k === $key) { |
|
1302 | + $new[$new_key] = $new_value; |
|
1303 | 1303 | } |
1304 | - $new[ $k ] = $value; |
|
1304 | + $new[$k] = $value; |
|
1305 | 1305 | } |
1306 | 1306 | |
1307 | 1307 | return $new; |
@@ -1324,13 +1324,13 @@ discard block |
||
1324 | 1324 | * |
1325 | 1325 | * @see array_insert_before() |
1326 | 1326 | */ |
1327 | -function give_array_insert_after( $key, array &$array, $new_key, $new_value ) { |
|
1328 | - if ( array_key_exists( $key, $array ) ) { |
|
1327 | +function give_array_insert_after($key, array &$array, $new_key, $new_value) { |
|
1328 | + if (array_key_exists($key, $array)) { |
|
1329 | 1329 | $new = array(); |
1330 | - foreach ( $array as $k => $value ) { |
|
1331 | - $new[ $k ] = $value; |
|
1332 | - if ( $k === $key ) { |
|
1333 | - $new[ $new_key ] = $new_value; |
|
1330 | + foreach ($array as $k => $value) { |
|
1331 | + $new[$k] = $value; |
|
1332 | + if ($k === $key) { |
|
1333 | + $new[$new_key] = $new_value; |
|
1334 | 1334 | } |
1335 | 1335 | } |
1336 | 1336 | |
@@ -1357,21 +1357,21 @@ discard block |
||
1357 | 1357 | * corresponding to `$index_key`. If `$index_key` is null, array keys from the original |
1358 | 1358 | * `$list` will be preserved in the results. |
1359 | 1359 | */ |
1360 | -function give_list_pluck( $list, $field, $index_key = null ) { |
|
1360 | +function give_list_pluck($list, $field, $index_key = null) { |
|
1361 | 1361 | |
1362 | - if ( ! $index_key ) { |
|
1362 | + if ( ! $index_key) { |
|
1363 | 1363 | /** |
1364 | 1364 | * This is simple. Could at some point wrap array_column() |
1365 | 1365 | * if we knew we had an array of arrays. |
1366 | 1366 | */ |
1367 | - foreach ( $list as $key => $value ) { |
|
1368 | - if ( is_object( $value ) ) { |
|
1369 | - if ( isset( $value->$field ) ) { |
|
1370 | - $list[ $key ] = $value->$field; |
|
1367 | + foreach ($list as $key => $value) { |
|
1368 | + if (is_object($value)) { |
|
1369 | + if (isset($value->$field)) { |
|
1370 | + $list[$key] = $value->$field; |
|
1371 | 1371 | } |
1372 | 1372 | } else { |
1373 | - if ( isset( $value[ $field ] ) ) { |
|
1374 | - $list[ $key ] = $value[ $field ]; |
|
1373 | + if (isset($value[$field])) { |
|
1374 | + $list[$key] = $value[$field]; |
|
1375 | 1375 | } |
1376 | 1376 | } |
1377 | 1377 | } |
@@ -1384,18 +1384,18 @@ discard block |
||
1384 | 1384 | * to the end of the stack. This is how array_column() behaves. |
1385 | 1385 | */ |
1386 | 1386 | $newlist = array(); |
1387 | - foreach ( $list as $value ) { |
|
1388 | - if ( is_object( $value ) ) { |
|
1389 | - if ( isset( $value->$index_key ) ) { |
|
1390 | - $newlist[ $value->$index_key ] = $value->$field; |
|
1387 | + foreach ($list as $value) { |
|
1388 | + if (is_object($value)) { |
|
1389 | + if (isset($value->$index_key)) { |
|
1390 | + $newlist[$value->$index_key] = $value->$field; |
|
1391 | 1391 | } else { |
1392 | 1392 | $newlist[] = $value->$field; |
1393 | 1393 | } |
1394 | 1394 | } else { |
1395 | - if ( isset( $value[ $index_key ] ) ) { |
|
1396 | - $newlist[ $value[ $index_key ] ] = $value[ $field ]; |
|
1395 | + if (isset($value[$index_key])) { |
|
1396 | + $newlist[$value[$index_key]] = $value[$field]; |
|
1397 | 1397 | } else { |
1398 | - $newlist[] = $value[ $field ]; |
|
1398 | + $newlist[] = $value[$field]; |
|
1399 | 1399 | } |
1400 | 1400 | } |
1401 | 1401 | } |
@@ -1418,8 +1418,8 @@ discard block |
||
1418 | 1418 | * |
1419 | 1419 | * @return int|false Meta ID on success, false on failure. |
1420 | 1420 | */ |
1421 | -function add_donor_meta( $donor_id, $meta_key, $meta_value, $unique = false ) { |
|
1422 | - return add_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $unique ); |
|
1421 | +function add_donor_meta($donor_id, $meta_key, $meta_value, $unique = false) { |
|
1422 | + return add_metadata('give_customer', $donor_id, $meta_key, $meta_value, $unique); |
|
1423 | 1423 | } |
1424 | 1424 | |
1425 | 1425 | /** |
@@ -1437,8 +1437,8 @@ discard block |
||
1437 | 1437 | * |
1438 | 1438 | * @return bool True on success, false on failure. |
1439 | 1439 | */ |
1440 | -function delete_donor_meta( $donor_id, $meta_key, $meta_value = '' ) { |
|
1441 | - return delete_metadata( 'give_customer', $donor_id, $meta_key, $meta_value ); |
|
1440 | +function delete_donor_meta($donor_id, $meta_key, $meta_value = '') { |
|
1441 | + return delete_metadata('give_customer', $donor_id, $meta_key, $meta_value); |
|
1442 | 1442 | } |
1443 | 1443 | |
1444 | 1444 | /** |
@@ -1453,8 +1453,8 @@ discard block |
||
1453 | 1453 | * @return mixed Will be an array if $single is false. Will be value of meta data field if $single |
1454 | 1454 | * is true. |
1455 | 1455 | */ |
1456 | -function get_donor_meta( $donor_id, $key = '', $single = false ) { |
|
1457 | - return get_metadata( 'give_customer', $donor_id, $key, $single ); |
|
1456 | +function get_donor_meta($donor_id, $key = '', $single = false) { |
|
1457 | + return get_metadata('give_customer', $donor_id, $key, $single); |
|
1458 | 1458 | } |
1459 | 1459 | |
1460 | 1460 | /** |
@@ -1471,8 +1471,8 @@ discard block |
||
1471 | 1471 | * |
1472 | 1472 | * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure. |
1473 | 1473 | */ |
1474 | -function update_donor_meta( $donor_id, $meta_key, $meta_value, $prev_value = '' ) { |
|
1475 | - return update_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $prev_value ); |
|
1474 | +function update_donor_meta($donor_id, $meta_key, $meta_value, $prev_value = '') { |
|
1475 | + return update_metadata('give_customer', $donor_id, $meta_key, $meta_value, $prev_value); |
|
1476 | 1476 | } |
1477 | 1477 | |
1478 | 1478 | |
@@ -1485,55 +1485,55 @@ discard block |
||
1485 | 1485 | * |
1486 | 1486 | * @return void |
1487 | 1487 | */ |
1488 | -function give_recount_form_income_donation( $form_id = 0 ) { |
|
1488 | +function give_recount_form_income_donation($form_id = 0) { |
|
1489 | 1489 | // Check if form id is not empty. |
1490 | - if ( ! empty( $form_id ) ) { |
|
1490 | + if ( ! empty($form_id)) { |
|
1491 | 1491 | /** |
1492 | 1492 | * Filter to modify payment status. |
1493 | 1493 | * |
1494 | 1494 | * @since 1.8.13 |
1495 | 1495 | */ |
1496 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
1496 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
1497 | 1497 | |
1498 | 1498 | /** |
1499 | 1499 | * Filter to modify args of payment query before recalculating the form total |
1500 | 1500 | * |
1501 | 1501 | * @since 1.8.13 |
1502 | 1502 | */ |
1503 | - $args = apply_filters( 'give_recount_form_stats_args', array( |
|
1503 | + $args = apply_filters('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 | |
1510 | 1510 | $totals = array( |
1511 | 1511 | 'sales' => 0, |
1512 | 1512 | 'earnings' => 0, |
1513 | 1513 | ); |
1514 | 1514 | |
1515 | - $payments = new Give_Payments_Query( $args ); |
|
1515 | + $payments = new Give_Payments_Query($args); |
|
1516 | 1516 | $payments = $payments->get_payments(); |
1517 | 1517 | |
1518 | - if ( $payments ) { |
|
1519 | - foreach ( $payments as $payment ) { |
|
1518 | + if ($payments) { |
|
1519 | + foreach ($payments as $payment) { |
|
1520 | 1520 | // Ensure acceptible status only |
1521 | - if ( ! in_array( $payment->post_status, $accepted_statuses ) ) { |
|
1521 | + if ( ! in_array($payment->post_status, $accepted_statuses)) { |
|
1522 | 1522 | continue; |
1523 | 1523 | } |
1524 | 1524 | |
1525 | 1525 | // Ensure only payments for this form are counted |
1526 | - if ( $payment->form_id != $form_id ) { |
|
1526 | + if ($payment->form_id != $form_id) { |
|
1527 | 1527 | continue; |
1528 | 1528 | } |
1529 | 1529 | |
1530 | - $totals['sales'] ++; |
|
1530 | + $totals['sales']++; |
|
1531 | 1531 | $totals['earnings'] += $payment->total; |
1532 | 1532 | |
1533 | 1533 | } |
1534 | 1534 | } |
1535 | - give_update_meta( $form_id, '_give_form_sales', $totals['sales'] ); |
|
1536 | - give_update_meta( $form_id, '_give_form_earnings', give_sanitize_amount_for_db( $totals['earnings'] ) ); |
|
1535 | + give_update_meta($form_id, '_give_form_sales', $totals['sales']); |
|
1536 | + give_update_meta($form_id, '_give_form_earnings', give_sanitize_amount_for_db($totals['earnings'])); |
|
1537 | 1537 | }// End if(). |
1538 | 1538 | } |
1539 | 1539 | |
@@ -1548,26 +1548,26 @@ discard block |
||
1548 | 1548 | * |
1549 | 1549 | * @return string |
1550 | 1550 | */ |
1551 | -function give_get_attribute_str( $attributes, $default_attributes = array() ) { |
|
1551 | +function give_get_attribute_str($attributes, $default_attributes = array()) { |
|
1552 | 1552 | $attribute_str = ''; |
1553 | 1553 | |
1554 | - if( isset( $attributes['attributes'] ) ) { |
|
1554 | + if (isset($attributes['attributes'])) { |
|
1555 | 1555 | $attributes = $attributes['attributes']; |
1556 | 1556 | } |
1557 | 1557 | |
1558 | - if( ! empty( $default_attributes ) ) { |
|
1559 | - $attributes = wp_parse_args( $attributes, $default_attributes ); |
|
1558 | + if ( ! empty($default_attributes)) { |
|
1559 | + $attributes = wp_parse_args($attributes, $default_attributes); |
|
1560 | 1560 | } |
1561 | 1561 | |
1562 | - if ( empty( $attributes ) ) { |
|
1562 | + if (empty($attributes)) { |
|
1563 | 1563 | return $attribute_str; |
1564 | 1564 | } |
1565 | 1565 | |
1566 | - foreach ( $attributes as $tag => $value ) { |
|
1566 | + foreach ($attributes as $tag => $value) { |
|
1567 | 1567 | $attribute_str .= " {$tag}=\"{$value}\""; |
1568 | 1568 | } |
1569 | 1569 | |
1570 | - return trim( $attribute_str ); |
|
1570 | + return trim($attribute_str); |
|
1571 | 1571 | } |
1572 | 1572 | |
1573 | 1573 | /** |
@@ -1580,7 +1580,7 @@ discard block |
||
1580 | 1580 | function give_get_wp_upload_dir() { |
1581 | 1581 | $wp_upload_dir = wp_upload_dir(); |
1582 | 1582 | |
1583 | - return ( ! empty( $wp_upload_dir['path'] ) ? $wp_upload_dir['path'] : false ); |
|
1583 | + return ( ! empty($wp_upload_dir['path']) ? $wp_upload_dir['path'] : false); |
|
1584 | 1584 | } |
1585 | 1585 | |
1586 | 1586 | /** |
@@ -1592,15 +1592,15 @@ discard block |
||
1592 | 1592 | * |
1593 | 1593 | * @return string|bool $file_contents File content |
1594 | 1594 | */ |
1595 | -function give_get_core_settings_json( $file_name ) { |
|
1595 | +function give_get_core_settings_json($file_name) { |
|
1596 | 1596 | $upload_dir = give_get_wp_upload_dir(); |
1597 | - $file_path = $upload_dir . '/' . $file_name; |
|
1597 | + $file_path = $upload_dir.'/'.$file_name; |
|
1598 | 1598 | |
1599 | - if ( is_wp_error( $file_path ) || empty( $file_path ) ) { |
|
1600 | - Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid JSON file.', 'give' ) ); |
|
1599 | + if (is_wp_error($file_path) || empty($file_path)) { |
|
1600 | + Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid JSON file.', 'give')); |
|
1601 | 1601 | } |
1602 | 1602 | |
1603 | - $file_contents = file_get_contents( $file_path ); |
|
1603 | + $file_contents = file_get_contents($file_path); |
|
1604 | 1604 | |
1605 | 1605 | return $file_contents; |
1606 | 1606 | } |
@@ -1613,7 +1613,7 @@ discard block |
||
1613 | 1613 | * @return int $country The two letter country code for the site's base country |
1614 | 1614 | */ |
1615 | 1615 | function give_get_limit_display_donations() { |
1616 | - return give_get_option( 'limit_display_donations', 1 ); |
|
1616 | + return give_get_option('limit_display_donations', 1); |
|
1617 | 1617 | } |
1618 | 1618 | |
1619 | 1619 | /** |
@@ -1622,7 +1622,7 @@ discard block |
||
1622 | 1622 | * @since 1.8.17 |
1623 | 1623 | */ |
1624 | 1624 | function give_donation_history_table_end() { |
1625 | - $email = Give()->session->get( 'give_email' ); |
|
1625 | + $email = Give()->session->get('give_email'); |
|
1626 | 1626 | ?> |
1627 | 1627 | <tfoot> |
1628 | 1628 | <tr> |
@@ -1630,15 +1630,15 @@ discard block |
||
1630 | 1630 | <div class="give-security-wrap"> |
1631 | 1631 | <div class="give-security-column give-security-description-wrap"> |
1632 | 1632 | <?php |
1633 | - echo sprintf( __( 'For security reasons, please confirm your email address (%s) to view your complete donation history.', 'give' ), $email ); |
|
1633 | + echo sprintf(__('For security reasons, please confirm your email address (%s) to view your complete donation history.', 'give'), $email); |
|
1634 | 1634 | ?> |
1635 | 1635 | </div> |
1636 | 1636 | <div class="give-security-column give-security-button-wrap"> |
1637 | 1637 | <a href="#" data-email="<?php echo $email; ?>" id="give-confirm-email-btn" |
1638 | 1638 | class="give-confirm-email-btn give-btn"> |
1639 | - <?php _e( 'Confirm Email', 'give' ); ?> |
|
1639 | + <?php _e('Confirm Email', 'give'); ?> |
|
1640 | 1640 | </a> |
1641 | - <span><?php _e( 'Email Sent!', 'give' ); ?></span> |
|
1641 | + <span><?php _e('Email Sent!', 'give'); ?></span> |
|
1642 | 1642 | </div> |
1643 | 1643 | </div> |
1644 | 1644 | </td> |
@@ -1659,10 +1659,10 @@ discard block |
||
1659 | 1659 | * |
1660 | 1660 | * @return void |
1661 | 1661 | */ |
1662 | -function give_doing_it_wrong( $function, $message, $version ) { |
|
1663 | - $message .= "\nBacktrace:" . wp_debug_backtrace_summary(); |
|
1662 | +function give_doing_it_wrong($function, $message, $version) { |
|
1663 | + $message .= "\nBacktrace:".wp_debug_backtrace_summary(); |
|
1664 | 1664 | |
1665 | - _doing_it_wrong( $function, $message, $version ); |
|
1665 | + _doing_it_wrong($function, $message, $version); |
|
1666 | 1666 | } |
1667 | 1667 | |
1668 | 1668 | |
@@ -1672,10 +1672,10 @@ discard block |
||
1672 | 1672 | * @since 1.8.18 |
1673 | 1673 | */ |
1674 | 1674 | function give_ignore_user_abort() { |
1675 | - ignore_user_abort( true ); |
|
1675 | + ignore_user_abort(true); |
|
1676 | 1676 | |
1677 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
1678 | - set_time_limit( 0 ); |
|
1677 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
1678 | + set_time_limit(0); |
|
1679 | 1679 | } |
1680 | 1680 | } |
1681 | 1681 | |
@@ -1689,28 +1689,28 @@ discard block |
||
1689 | 1689 | * |
1690 | 1690 | * @return int |
1691 | 1691 | */ |
1692 | -function give_get_total_post_type_count( $post_type = '', $args = array() ) { |
|
1692 | +function give_get_total_post_type_count($post_type = '', $args = array()) { |
|
1693 | 1693 | global $wpdb; |
1694 | 1694 | $where = ''; |
1695 | 1695 | |
1696 | - if ( ! $post_type ) { |
|
1696 | + if ( ! $post_type) { |
|
1697 | 1697 | return 0; |
1698 | 1698 | } |
1699 | 1699 | |
1700 | 1700 | // Bulit where query |
1701 | - if ( ! empty( $post_type ) ) { |
|
1701 | + if ( ! empty($post_type)) { |
|
1702 | 1702 | $where .= ' WHERE'; |
1703 | 1703 | |
1704 | - if ( is_array( $post_type ) ) { |
|
1705 | - $where .= " post_type='" . implode( "' OR post_type='", $post_type ) . "'"; |
|
1704 | + if (is_array($post_type)) { |
|
1705 | + $where .= " post_type='".implode("' OR post_type='", $post_type)."'"; |
|
1706 | 1706 | } else { |
1707 | 1707 | $where .= " post_type='{$post_type}'"; |
1708 | 1708 | } |
1709 | 1709 | } |
1710 | 1710 | |
1711 | - $result = $wpdb->get_var( "SELECT count(ID) FROM {$wpdb->posts}{$where}" ); |
|
1711 | + $result = $wpdb->get_var("SELECT count(ID) FROM {$wpdb->posts}{$where}"); |
|
1712 | 1712 | |
1713 | - return absint( $result ); |
|
1713 | + return absint($result); |
|
1714 | 1714 | } |
1715 | 1715 | |
1716 | 1716 | /** |
@@ -1723,9 +1723,9 @@ discard block |
||
1723 | 1723 | * |
1724 | 1724 | * @credit WooCommerce |
1725 | 1725 | */ |
1726 | -function give_maybe_define_constant( $name, $value ) { |
|
1727 | - if ( ! defined( $name ) ) { |
|
1728 | - define( $name, $value ); |
|
1726 | +function give_maybe_define_constant($name, $value) { |
|
1727 | + if ( ! defined($name)) { |
|
1728 | + define($name, $value); |
|
1729 | 1729 | } |
1730 | 1730 | } |
1731 | 1731 | |
@@ -1739,10 +1739,10 @@ discard block |
||
1739 | 1739 | * |
1740 | 1740 | * @return string |
1741 | 1741 | */ |
1742 | -function give_time_do_tags( $string, $timestamp = 0 ) { |
|
1743 | - $current_time = ! empty( $timestamp ) ? $timestamp : current_time( 'timestamp' ); |
|
1742 | +function give_time_do_tags($string, $timestamp = 0) { |
|
1743 | + $current_time = ! empty($timestamp) ? $timestamp : current_time('timestamp'); |
|
1744 | 1744 | |
1745 | - $formatted_string = str_replace( array( |
|
1745 | + $formatted_string = str_replace(array( |
|
1746 | 1746 | '{D}', |
1747 | 1747 | '{DD}', |
1748 | 1748 | '{M}', |
@@ -1754,23 +1754,23 @@ discard block |
||
1754 | 1754 | '{N}', |
1755 | 1755 | '{S}' |
1756 | 1756 | ), array( |
1757 | - date( 'j', $current_time ), |
|
1758 | - date( 'd', $current_time ), |
|
1759 | - date( 'n', $current_time ), |
|
1760 | - date( 'm', $current_time ), |
|
1761 | - date( 'Y', $current_time ), |
|
1762 | - date( 'Y', $current_time ), |
|
1763 | - date( 'G', $current_time ), |
|
1764 | - date( 'H', $current_time ), |
|
1765 | - date( 's', $current_time ) |
|
1766 | - ), $string ); |
|
1757 | + date('j', $current_time), |
|
1758 | + date('d', $current_time), |
|
1759 | + date('n', $current_time), |
|
1760 | + date('m', $current_time), |
|
1761 | + date('Y', $current_time), |
|
1762 | + date('Y', $current_time), |
|
1763 | + date('G', $current_time), |
|
1764 | + date('H', $current_time), |
|
1765 | + date('s', $current_time) |
|
1766 | + ), $string); |
|
1767 | 1767 | |
1768 | 1768 | /** |
1769 | 1769 | * Filter the parsed string. |
1770 | 1770 | * |
1771 | 1771 | * @since 2.1.0 |
1772 | 1772 | */ |
1773 | - return apply_filters( 'give_time_do_tags', $formatted_string, $string, $timestamp ); |
|
1773 | + return apply_filters('give_time_do_tags', $formatted_string, $string, $timestamp); |
|
1774 | 1774 | } |
1775 | 1775 | |
1776 | 1776 | |
@@ -1783,23 +1783,23 @@ discard block |
||
1783 | 1783 | * |
1784 | 1784 | * @return bool |
1785 | 1785 | */ |
1786 | -function give_is_company_field_enabled( $form_id ) { |
|
1787 | - $form_setting_val = give_get_meta( $form_id, '_give_company_field', true ); |
|
1788 | - $global_setting_val = give_get_option( 'company_field' ); |
|
1786 | +function give_is_company_field_enabled($form_id) { |
|
1787 | + $form_setting_val = give_get_meta($form_id, '_give_company_field', true); |
|
1788 | + $global_setting_val = give_get_option('company_field'); |
|
1789 | 1789 | |
1790 | - if ( ! empty( $form_setting_val ) ) { |
|
1791 | - if ( give_is_setting_enabled( $form_setting_val, array( 'required', 'optional' ) ) ) { |
|
1790 | + if ( ! empty($form_setting_val)) { |
|
1791 | + if (give_is_setting_enabled($form_setting_val, array('required', 'optional'))) { |
|
1792 | 1792 | return true; |
1793 | - } elseif ( 'global' === $form_setting_val && give_is_setting_enabled( $global_setting_val, array( |
|
1793 | + } elseif ('global' === $form_setting_val && give_is_setting_enabled($global_setting_val, array( |
|
1794 | 1794 | 'required', |
1795 | 1795 | 'optional' |
1796 | - ) ) ) { |
|
1796 | + ))) { |
|
1797 | 1797 | return true; |
1798 | 1798 | } else { |
1799 | 1799 | return false; |
1800 | 1800 | } |
1801 | 1801 | |
1802 | - } elseif ( give_is_setting_enabled( $global_setting_val, array( 'required', 'optional' ) ) ) { |
|
1802 | + } elseif (give_is_setting_enabled($global_setting_val, array('required', 'optional'))) { |
|
1803 | 1803 | return true; |
1804 | 1804 | |
1805 | 1805 | } else { |
@@ -1816,19 +1816,19 @@ discard block |
||
1816 | 1816 | * |
1817 | 1817 | * @return bool |
1818 | 1818 | */ |
1819 | -function give_is_anonymous_donation_field_enabled( $form_id ) { |
|
1820 | - $form_setting_val = give_get_meta( $form_id, '_give_anonymous_donation', true, 'global' ); |
|
1821 | - $global_setting_val = give_get_option( 'anonymous_donation', 'disabled' ); |
|
1819 | +function give_is_anonymous_donation_field_enabled($form_id) { |
|
1820 | + $form_setting_val = give_get_meta($form_id, '_give_anonymous_donation', true, 'global'); |
|
1821 | + $global_setting_val = give_get_option('anonymous_donation', 'disabled'); |
|
1822 | 1822 | |
1823 | - if ( ! empty( $form_setting_val ) ) { |
|
1824 | - if( give_is_setting_enabled( $form_setting_val ) ) { |
|
1823 | + if ( ! empty($form_setting_val)) { |
|
1824 | + if (give_is_setting_enabled($form_setting_val)) { |
|
1825 | 1825 | return true; |
1826 | - }elseif ( 'global' === $form_setting_val && give_is_setting_enabled( $global_setting_val ) ){ |
|
1826 | + }elseif ('global' === $form_setting_val && give_is_setting_enabled($global_setting_val)) { |
|
1827 | 1827 | return true; |
1828 | - }else{ |
|
1828 | + } else { |
|
1829 | 1829 | return false; |
1830 | 1830 | } |
1831 | - } elseif ( give_is_setting_enabled( $global_setting_val ) ) { |
|
1831 | + } elseif (give_is_setting_enabled($global_setting_val)) { |
|
1832 | 1832 | return true; |
1833 | 1833 | } |
1834 | 1834 | |
@@ -1844,19 +1844,19 @@ discard block |
||
1844 | 1844 | * |
1845 | 1845 | * @return bool |
1846 | 1846 | */ |
1847 | -function give_is_donor_comment_field_enabled( $form_id ) { |
|
1848 | - $form_setting_val = give_get_meta( $form_id, '_give_donor_comment', true, 'global' ); |
|
1849 | - $global_setting_val = give_get_option( 'donor_comment', 'disabled' ); |
|
1847 | +function give_is_donor_comment_field_enabled($form_id) { |
|
1848 | + $form_setting_val = give_get_meta($form_id, '_give_donor_comment', true, 'global'); |
|
1849 | + $global_setting_val = give_get_option('donor_comment', 'disabled'); |
|
1850 | 1850 | |
1851 | - if ( ! empty( $form_setting_val ) ) { |
|
1852 | - if( give_is_setting_enabled( $form_setting_val ) ) { |
|
1851 | + if ( ! empty($form_setting_val)) { |
|
1852 | + if (give_is_setting_enabled($form_setting_val)) { |
|
1853 | 1853 | return true; |
1854 | - } elseif ( 'global' === $form_setting_val && give_is_setting_enabled( $global_setting_val ) ){ |
|
1854 | + } elseif ('global' === $form_setting_val && give_is_setting_enabled($global_setting_val)) { |
|
1855 | 1855 | return true; |
1856 | - }else{ |
|
1856 | + } else { |
|
1857 | 1857 | return false; |
1858 | 1858 | } |
1859 | - } elseif ( give_is_setting_enabled( $global_setting_val ) ) { |
|
1859 | + } elseif (give_is_setting_enabled($global_setting_val)) { |
|
1860 | 1860 | return true; |
1861 | 1861 | } |
1862 | 1862 | |
@@ -1874,13 +1874,13 @@ discard block |
||
1874 | 1874 | * |
1875 | 1875 | * @return array |
1876 | 1876 | */ |
1877 | -function __give_get_active_license_info( $license_id ) { |
|
1877 | +function __give_get_active_license_info($license_id) { |
|
1878 | 1878 | global $wpdb; |
1879 | 1879 | $option_name = "{$license_id}_license_active"; |
1880 | 1880 | $data = array(); |
1881 | 1881 | |
1882 | - if ( ! isset( $GLOBALS['give_active_licenses_info'] ) ) { |
|
1883 | - $GLOBALS['give_active_licenses_info'] = array(); |
|
1882 | + if ( ! isset($GLOBALS['give_active_licenses_info'])) { |
|
1883 | + $GLOBALS['give_active_licenses_info'] = array(); |
|
1884 | 1884 | |
1885 | 1885 | $licenses_info = $wpdb->get_results( |
1886 | 1886 | " |
@@ -1892,16 +1892,16 @@ discard block |
||
1892 | 1892 | ARRAY_A |
1893 | 1893 | ); |
1894 | 1894 | |
1895 | - if ( ! empty( $licenses_info ) ) { |
|
1895 | + if ( ! empty($licenses_info)) { |
|
1896 | 1896 | $GLOBALS['give_active_licenses_info'] = array_combine( |
1897 | - wp_list_pluck( $licenses_info, 'option_name' ), |
|
1898 | - wp_list_pluck( $licenses_info, 'option_value' ) |
|
1897 | + wp_list_pluck($licenses_info, 'option_name'), |
|
1898 | + wp_list_pluck($licenses_info, 'option_value') |
|
1899 | 1899 | ); |
1900 | 1900 | } |
1901 | 1901 | } |
1902 | 1902 | |
1903 | - if ( in_array( $option_name, array_keys( $GLOBALS['give_active_licenses_info'] ) ) ) { |
|
1904 | - $data = maybe_unserialize( $GLOBALS['give_active_licenses_info'][ $option_name ] ); |
|
1903 | + if (in_array($option_name, array_keys($GLOBALS['give_active_licenses_info']))) { |
|
1904 | + $data = maybe_unserialize($GLOBALS['give_active_licenses_info'][$option_name]); |
|
1905 | 1905 | } |
1906 | 1906 | |
1907 | 1907 | return $data; |
@@ -1917,18 +1917,18 @@ discard block |
||
1917 | 1917 | * |
1918 | 1918 | * @return array |
1919 | 1919 | */ |
1920 | -function __give_get_active_by_user_meta( $banner_addon_name ) { |
|
1920 | +function __give_get_active_by_user_meta($banner_addon_name) { |
|
1921 | 1921 | global $wpdb; |
1922 | 1922 | |
1923 | 1923 | // Get the option key. |
1924 | - $option_name = Give_Addon_Activation_Banner::get_banner_user_meta_key( $banner_addon_name ); |
|
1924 | + $option_name = Give_Addon_Activation_Banner::get_banner_user_meta_key($banner_addon_name); |
|
1925 | 1925 | $data = array(); |
1926 | 1926 | |
1927 | 1927 | if ( |
1928 | - ! isset( $GLOBALS['give_addon_activated_by_user'][ $banner_addon_name ] ) |
|
1929 | - || empty( $GLOBALS['give_addon_activated_by_user'][ $banner_addon_name ] ) |
|
1928 | + ! isset($GLOBALS['give_addon_activated_by_user'][$banner_addon_name]) |
|
1929 | + || empty($GLOBALS['give_addon_activated_by_user'][$banner_addon_name]) |
|
1930 | 1930 | ) { |
1931 | - $GLOBALS['give_addon_activated_by_user'][ $banner_addon_name ] = array(); |
|
1931 | + $GLOBALS['give_addon_activated_by_user'][$banner_addon_name] = array(); |
|
1932 | 1932 | |
1933 | 1933 | // Get the meta of activation banner by user. |
1934 | 1934 | $activation_banners = $wpdb->get_results( |
@@ -1941,16 +1941,16 @@ discard block |
||
1941 | 1941 | ARRAY_A |
1942 | 1942 | ); |
1943 | 1943 | |
1944 | - if ( ! empty( $activation_banners ) ) { |
|
1944 | + if ( ! empty($activation_banners)) { |
|
1945 | 1945 | $GLOBALS['give_addon_activated_by_user'] = array_combine( |
1946 | - wp_list_pluck( $activation_banners, 'option_name' ), |
|
1947 | - wp_list_pluck( $activation_banners, 'option_value' ) |
|
1946 | + wp_list_pluck($activation_banners, 'option_name'), |
|
1947 | + wp_list_pluck($activation_banners, 'option_value') |
|
1948 | 1948 | ); |
1949 | 1949 | } |
1950 | 1950 | } |
1951 | 1951 | |
1952 | - if ( in_array( $option_name, array_keys( $GLOBALS['give_addon_activated_by_user'] ) ) ) { |
|
1953 | - $data = maybe_unserialize( $GLOBALS['give_addon_activated_by_user'][ $option_name ] ); |
|
1952 | + if (in_array($option_name, array_keys($GLOBALS['give_addon_activated_by_user']))) { |
|
1953 | + $data = maybe_unserialize($GLOBALS['give_addon_activated_by_user'][$option_name]); |
|
1954 | 1954 | } |
1955 | 1955 | |
1956 | 1956 | return $data; |
@@ -1963,13 +1963,13 @@ discard block |
||
1963 | 1963 | * |
1964 | 1964 | * @return int |
1965 | 1965 | */ |
1966 | -function give_get_nonce_life(){ |
|
1966 | +function give_get_nonce_life() { |
|
1967 | 1967 | /** |
1968 | 1968 | * Filters the lifespan of nonces in seconds. |
1969 | 1969 | * |
1970 | 1970 | * @see wp-inlucdes/pluggable.php:wp_nonce_tick |
1971 | 1971 | */ |
1972 | - return (int) apply_filters( 'nonce_life', DAY_IN_SECONDS ); |
|
1972 | + return (int) apply_filters('nonce_life', DAY_IN_SECONDS); |
|
1973 | 1973 | } |
1974 | 1974 | |
1975 | 1975 | /** |
@@ -1983,11 +1983,11 @@ discard block |
||
1983 | 1983 | * |
1984 | 1984 | * @return string |
1985 | 1985 | */ |
1986 | -function give_get_nonce_field( $action, $name, $referer = false ) { |
|
1986 | +function give_get_nonce_field($action, $name, $referer = false) { |
|
1987 | 1987 | return str_replace( |
1988 | 1988 | "id=\"{$name}\"", |
1989 | 1989 | '', |
1990 | - wp_nonce_field( $action, $name, $referer, false ) |
|
1990 | + wp_nonce_field($action, $name, $referer, false) |
|
1991 | 1991 | ); |
1992 | 1992 | } |
1993 | 1993 | |
@@ -2000,31 +2000,31 @@ discard block |
||
2000 | 2000 | * |
2001 | 2001 | * @return array |
2002 | 2002 | */ |
2003 | -function give_goal_progress_stats( $form ) { |
|
2003 | +function give_goal_progress_stats($form) { |
|
2004 | 2004 | |
2005 | - if ( ! $form instanceof Give_Donate_Form ) { |
|
2006 | - $form = new Give_Donate_Form( $form ); |
|
2005 | + if ( ! $form instanceof Give_Donate_Form) { |
|
2006 | + $form = new Give_Donate_Form($form); |
|
2007 | 2007 | } |
2008 | 2008 | |
2009 | 2009 | $donors = ''; |
2010 | 2010 | |
2011 | - $goal_format = give_get_form_goal_format( $form->ID ); |
|
2011 | + $goal_format = give_get_form_goal_format($form->ID); |
|
2012 | 2012 | |
2013 | 2013 | /** |
2014 | 2014 | * Filter the form. |
2015 | 2015 | * |
2016 | 2016 | * @since 1.8.8 |
2017 | 2017 | */ |
2018 | - $total_goal = apply_filters( 'give_goal_amount_target_output', round( give_maybe_sanitize_amount( $form->goal ) ), $form->ID, $form ); |
|
2018 | + $total_goal = apply_filters('give_goal_amount_target_output', round(give_maybe_sanitize_amount($form->goal)), $form->ID, $form); |
|
2019 | 2019 | |
2020 | - switch ( $goal_format ) { |
|
2020 | + switch ($goal_format) { |
|
2021 | 2021 | case 'donation': |
2022 | 2022 | /** |
2023 | 2023 | * Filter the form donations. |
2024 | 2024 | * |
2025 | 2025 | * @since 2.1 |
2026 | 2026 | */ |
2027 | - $actual = $donations = apply_filters( 'give_goal_donations_raised_output', $form->sales, $form->ID, $form ); |
|
2027 | + $actual = $donations = apply_filters('give_goal_donations_raised_output', $form->sales, $form->ID, $form); |
|
2028 | 2028 | break; |
2029 | 2029 | case 'donors': |
2030 | 2030 | /** |
@@ -2038,7 +2038,7 @@ discard block |
||
2038 | 2038 | * |
2039 | 2039 | * @return int $donors Total number of donors that donated to the form. |
2040 | 2040 | */ |
2041 | - $actual = $donors = apply_filters( 'give_goal_donors_target_output', give_get_form_donor_count( $form->ID ), $form->ID, $form ); |
|
2041 | + $actual = $donors = apply_filters('give_goal_donors_target_output', give_get_form_donor_count($form->ID), $form->ID, $form); |
|
2042 | 2042 | break; |
2043 | 2043 | default : |
2044 | 2044 | /** |
@@ -2046,11 +2046,11 @@ discard block |
||
2046 | 2046 | * |
2047 | 2047 | * @since 1.8.8 |
2048 | 2048 | */ |
2049 | - $actual = $income = apply_filters( 'give_goal_amount_raised_output', $form->earnings, $form->ID, $form ); |
|
2049 | + $actual = $income = apply_filters('give_goal_amount_raised_output', $form->earnings, $form->ID, $form); |
|
2050 | 2050 | break; |
2051 | 2051 | } |
2052 | 2052 | |
2053 | - $progress = $total_goal ? round( ( $actual / $total_goal ) * 100, 2 ) : 0; |
|
2053 | + $progress = $total_goal ? round(($actual / $total_goal) * 100, 2) : 0; |
|
2054 | 2054 | |
2055 | 2055 | $stats_array = array( |
2056 | 2056 | 'raw_actual' => $actual, |
@@ -2062,20 +2062,20 @@ discard block |
||
2062 | 2062 | * |
2063 | 2063 | * @since 1.8.8 |
2064 | 2064 | */ |
2065 | - $progress = apply_filters( 'give_goal_amount_funded_percentage_output', $progress, $form->ID, $form ); |
|
2065 | + $progress = apply_filters('give_goal_amount_funded_percentage_output', $progress, $form->ID, $form); |
|
2066 | 2066 | |
2067 | 2067 | // Define Actual Goal based on the goal format. |
2068 | - if ( 'percentage' === $goal_format ) { |
|
2068 | + if ('percentage' === $goal_format) { |
|
2069 | 2069 | $actual = "{$actual}%"; |
2070 | - } else if ( 'amount' === $goal_format ) { |
|
2071 | - $actual = give_currency_filter( give_format_amount( $actual ) ); |
|
2070 | + } else if ('amount' === $goal_format) { |
|
2071 | + $actual = give_currency_filter(give_format_amount($actual)); |
|
2072 | 2072 | } |
2073 | 2073 | |
2074 | 2074 | // Define Total Goal based on the goal format. |
2075 | - if ( 'percentage' === $goal_format ) { |
|
2075 | + if ('percentage' === $goal_format) { |
|
2076 | 2076 | $total_goal = ''; |
2077 | - } else if ( 'amount' === $goal_format ) { |
|
2078 | - $total_goal = give_currency_filter( give_format_amount( $total_goal ) ); |
|
2077 | + } else if ('amount' === $goal_format) { |
|
2078 | + $total_goal = give_currency_filter(give_format_amount($total_goal)); |
|
2079 | 2079 | } |
2080 | 2080 | |
2081 | 2081 | $stats_array = array_merge( |
@@ -2093,7 +2093,7 @@ discard block |
||
2093 | 2093 | * |
2094 | 2094 | * @since 2.1 |
2095 | 2095 | */ |
2096 | - return apply_filters( 'give_goal_progress_stats', $stats_array ); |
|
2096 | + return apply_filters('give_goal_progress_stats', $stats_array); |
|
2097 | 2097 | } |
2098 | 2098 | |
2099 | 2099 | /** |
@@ -2105,20 +2105,20 @@ discard block |
||
2105 | 2105 | * |
2106 | 2106 | * @return mixed |
2107 | 2107 | */ |
2108 | -function give_get_name_title_prefixes( $form_id = 0 ) { |
|
2108 | +function give_get_name_title_prefixes($form_id = 0) { |
|
2109 | 2109 | |
2110 | - $name_title_prefix = give_is_name_title_prefix_enabled( $form_id ); |
|
2111 | - $title_prefixes = give_get_option( 'title_prefixes' ); |
|
2110 | + $name_title_prefix = give_is_name_title_prefix_enabled($form_id); |
|
2111 | + $title_prefixes = give_get_option('title_prefixes'); |
|
2112 | 2112 | |
2113 | 2113 | // If form id exists, then fetch form specific title prefixes. |
2114 | - if ( intval( $form_id ) > 0 && $name_title_prefix ) { |
|
2114 | + if (intval($form_id) > 0 && $name_title_prefix) { |
|
2115 | 2115 | |
2116 | - $form_title_prefix = give_get_meta( $form_id, '_give_name_title_prefix', true ); |
|
2117 | - if ( 'global' !== $form_title_prefix ) { |
|
2118 | - $form_title_prefixes = give_get_meta( $form_id, '_give_title_prefixes', true ); |
|
2116 | + $form_title_prefix = give_get_meta($form_id, '_give_name_title_prefix', true); |
|
2117 | + if ('global' !== $form_title_prefix) { |
|
2118 | + $form_title_prefixes = give_get_meta($form_id, '_give_title_prefixes', true); |
|
2119 | 2119 | |
2120 | 2120 | // Check whether the form based title prefixes exists or not. |
2121 | - if ( is_array( $form_title_prefixes ) && count( $form_title_prefixes ) > 0 ) { |
|
2121 | + if (is_array($form_title_prefixes) && count($form_title_prefixes) > 0) { |
|
2122 | 2122 | $title_prefixes = $form_title_prefixes; |
2123 | 2123 | } |
2124 | 2124 | } |
@@ -2137,22 +2137,22 @@ discard block |
||
2137 | 2137 | * |
2138 | 2138 | * @return bool |
2139 | 2139 | */ |
2140 | -function give_is_name_title_prefix_enabled( $form_id = 0, $status = '' ) { |
|
2141 | - if ( empty( $status ) ) { |
|
2142 | - $status = array( 'required', 'optional' ); |
|
2140 | +function give_is_name_title_prefix_enabled($form_id = 0, $status = '') { |
|
2141 | + if (empty($status)) { |
|
2142 | + $status = array('required', 'optional'); |
|
2143 | 2143 | } else { |
2144 | - $status = array( $status ); |
|
2144 | + $status = array($status); |
|
2145 | 2145 | } |
2146 | 2146 | |
2147 | - $title_prefix_status = give_is_setting_enabled( give_get_option( 'name_title_prefix' ), $status ); |
|
2147 | + $title_prefix_status = give_is_setting_enabled(give_get_option('name_title_prefix'), $status); |
|
2148 | 2148 | |
2149 | - if ( intval( $form_id ) > 0 ) { |
|
2150 | - $form_title_prefix = give_get_meta( $form_id, '_give_name_title_prefix', true ); |
|
2149 | + if (intval($form_id) > 0) { |
|
2150 | + $form_title_prefix = give_get_meta($form_id, '_give_name_title_prefix', true); |
|
2151 | 2151 | |
2152 | - if ( 'disabled' === $form_title_prefix ) { |
|
2152 | + if ('disabled' === $form_title_prefix) { |
|
2153 | 2153 | $title_prefix_status = false; |
2154 | - } elseif ( in_array( $form_title_prefix, $status, true ) ) { |
|
2155 | - $title_prefix_status = give_is_setting_enabled( $form_title_prefix, $status ); |
|
2154 | + } elseif (in_array($form_title_prefix, $status, true)) { |
|
2155 | + $title_prefix_status = give_is_setting_enabled($form_title_prefix, $status); |
|
2156 | 2156 | } |
2157 | 2157 | } |
2158 | 2158 | |
@@ -2169,18 +2169,18 @@ discard block |
||
2169 | 2169 | * |
2170 | 2170 | * @return object |
2171 | 2171 | */ |
2172 | -function give_get_name_with_title_prefixes( $donor ) { |
|
2172 | +function give_get_name_with_title_prefixes($donor) { |
|
2173 | 2173 | |
2174 | 2174 | // Prepare Give_Donor object, if $donor is numeric. |
2175 | - if ( is_numeric( $donor ) ) { |
|
2176 | - $donor = new Give_Donor( $donor ); |
|
2175 | + if (is_numeric($donor)) { |
|
2176 | + $donor = new Give_Donor($donor); |
|
2177 | 2177 | } |
2178 | 2178 | |
2179 | - $title_prefix = Give()->donor_meta->get_meta( $donor->id, '_give_donor_title_prefix', true ); |
|
2179 | + $title_prefix = Give()->donor_meta->get_meta($donor->id, '_give_donor_title_prefix', true); |
|
2180 | 2180 | |
2181 | 2181 | // Update Donor name, if non empty title prefix. |
2182 | - if ( ! empty( $title_prefix ) ) { |
|
2183 | - $donor->name = give_get_donor_name_with_title_prefixes( $title_prefix, $donor->name ); |
|
2182 | + if ( ! empty($title_prefix)) { |
|
2183 | + $donor->name = give_get_donor_name_with_title_prefixes($title_prefix, $donor->name); |
|
2184 | 2184 | } |
2185 | 2185 | |
2186 | 2186 | return $donor; |
@@ -2196,15 +2196,15 @@ discard block |
||
2196 | 2196 | * |
2197 | 2197 | * @return string |
2198 | 2198 | */ |
2199 | -function give_get_donor_name_with_title_prefixes( $title_prefix, $name ) { |
|
2199 | +function give_get_donor_name_with_title_prefixes($title_prefix, $name) { |
|
2200 | 2200 | |
2201 | 2201 | $donor_name = $name; |
2202 | 2202 | |
2203 | - if ( ! empty( $title_prefix ) && ! empty( $name ) ) { |
|
2203 | + if ( ! empty($title_prefix) && ! empty($name)) { |
|
2204 | 2204 | $donor_name = "{$title_prefix} {$name}"; |
2205 | 2205 | } |
2206 | 2206 | |
2207 | - return trim( $donor_name ); |
|
2207 | + return trim($donor_name); |
|
2208 | 2208 | } |
2209 | 2209 | |
2210 | 2210 | /** |
@@ -2224,9 +2224,9 @@ discard block |
||
2224 | 2224 | return apply_filters( |
2225 | 2225 | 'give_get_default_title_prefixes', |
2226 | 2226 | array( |
2227 | - 'Mr.' => __( 'Mr.', 'give' ), |
|
2228 | - 'Mrs.' => __( 'Mrs.', 'give' ), |
|
2229 | - 'Ms.' => __( 'Ms.', 'give' ), |
|
2227 | + 'Mr.' => __('Mr.', 'give'), |
|
2228 | + 'Mrs.' => __('Mrs.', 'give'), |
|
2229 | + 'Ms.' => __('Ms.', 'give'), |
|
2230 | 2230 | ) |
2231 | 2231 | ); |
2232 | 2232 | } |
@@ -2240,27 +2240,27 @@ discard block |
||
2240 | 2240 | * |
2241 | 2241 | * @return bool |
2242 | 2242 | */ |
2243 | -function give_is_name_title_prefix_required( $form_id = 0 ) { |
|
2243 | +function give_is_name_title_prefix_required($form_id = 0) { |
|
2244 | 2244 | |
2245 | 2245 | // Bail out, if name title prefix is not enabled. |
2246 | - if ( ! give_is_name_title_prefix_enabled( $form_id ) ) { |
|
2246 | + if ( ! give_is_name_title_prefix_enabled($form_id)) { |
|
2247 | 2247 | return false; |
2248 | 2248 | } |
2249 | 2249 | |
2250 | - $status = array( 'optional' ); |
|
2251 | - $is_optional = give_is_setting_enabled( give_get_option( 'name_title_prefix' ), $status ); |
|
2250 | + $status = array('optional'); |
|
2251 | + $is_optional = give_is_setting_enabled(give_get_option('name_title_prefix'), $status); |
|
2252 | 2252 | |
2253 | - if ( intval( $form_id ) > 0 ) { |
|
2254 | - $form_title_prefix = give_get_meta( $form_id, '_give_name_title_prefix', true ); |
|
2253 | + if (intval($form_id) > 0) { |
|
2254 | + $form_title_prefix = give_get_meta($form_id, '_give_name_title_prefix', true); |
|
2255 | 2255 | |
2256 | - if ( 'required' === $form_title_prefix ) { |
|
2256 | + if ('required' === $form_title_prefix) { |
|
2257 | 2257 | $is_optional = false; |
2258 | - } elseif ( 'optional' === $form_title_prefix ) { |
|
2258 | + } elseif ('optional' === $form_title_prefix) { |
|
2259 | 2259 | $is_optional = true; |
2260 | 2260 | } |
2261 | 2261 | } |
2262 | 2262 | |
2263 | - return ( ! $is_optional ); |
|
2263 | + return ( ! $is_optional); |
|
2264 | 2264 | } |
2265 | 2265 | |
2266 | 2266 | /** |
@@ -2271,11 +2271,11 @@ discard block |
||
2271 | 2271 | * @return array $message admin message key. |
2272 | 2272 | */ |
2273 | 2273 | function give_get_admin_messages_key() { |
2274 | - $messages = empty( $_GET['give-messages'] ) ? array() : give_clean( $_GET['give-messages'] ); |
|
2274 | + $messages = empty($_GET['give-messages']) ? array() : give_clean($_GET['give-messages']); |
|
2275 | 2275 | |
2276 | 2276 | // backward compatibility. |
2277 | - if ( ! empty( $_GET['give-message'] ) ) { |
|
2278 | - $messages[] = give_clean( $_GET['give-message'] ); |
|
2277 | + if ( ! empty($_GET['give-message'])) { |
|
2278 | + $messages[] = give_clean($_GET['give-message']); |
|
2279 | 2279 | } |
2280 | 2280 | |
2281 | 2281 | /** |
@@ -2287,7 +2287,7 @@ discard block |
||
2287 | 2287 | * |
2288 | 2288 | * @return array $message admin message key. |
2289 | 2289 | */ |
2290 | - return (array) apply_filters( 'give_get_admin_messages_key', $messages ); |
|
2290 | + return (array) apply_filters('give_get_admin_messages_key', $messages); |
|
2291 | 2291 | } |
2292 | 2292 | |
2293 | 2293 | /** |
@@ -2300,7 +2300,7 @@ discard block |
||
2300 | 2300 | function give_get_user_agent() { |
2301 | 2301 | |
2302 | 2302 | // Get User Agent. |
2303 | - $user_agent = ! empty( $_SERVER['HTTP_USER_AGENT'] ) ? give_clean( $_SERVER['HTTP_USER_AGENT'] ) : ''; // WPCS: input var ok. |
|
2303 | + $user_agent = ! empty($_SERVER['HTTP_USER_AGENT']) ? give_clean($_SERVER['HTTP_USER_AGENT']) : ''; // WPCS: input var ok. |
|
2304 | 2304 | |
2305 | 2305 | return $user_agent; |
2306 | 2306 | } |
@@ -2315,11 +2315,11 @@ discard block |
||
2315 | 2315 | * @param integer $expire Expiry of the cookie. |
2316 | 2316 | * @param bool $secure Whether the cookie should be served only over https. |
2317 | 2317 | */ |
2318 | -function give_setcookie( $name, $value, $expire = 0, $secure = false ) { |
|
2319 | - if ( ! headers_sent() ) { |
|
2318 | +function give_setcookie($name, $value, $expire = 0, $secure = false) { |
|
2319 | + if ( ! headers_sent()) { |
|
2320 | 2320 | setcookie( |
2321 | - $name,$value, $expire, COOKIEPATH ? COOKIEPATH : '/', COOKIE_DOMAIN, $secure, |
|
2322 | - apply_filters( 'give_cookie_httponly', false, $name, $value, $expire, $secure ) |
|
2321 | + $name, $value, $expire, COOKIEPATH ? COOKIEPATH : '/', COOKIE_DOMAIN, $secure, |
|
2322 | + apply_filters('give_cookie_httponly', false, $name, $value, $expire, $secure) |
|
2323 | 2323 | ); |
2324 | 2324 | } |
2325 | 2325 | } |
@@ -2333,7 +2333,7 @@ discard block |
||
2333 | 2333 | * |
2334 | 2334 | * @return string Formatted address. |
2335 | 2335 | */ |
2336 | -function give_get_formatted_address( $address = array() ) { |
|
2336 | +function give_get_formatted_address($address = array()) { |
|
2337 | 2337 | $formatted_address = ''; |
2338 | 2338 | |
2339 | 2339 | /** |
@@ -2341,21 +2341,21 @@ discard block |
||
2341 | 2341 | * |
2342 | 2342 | * @since 2.2.0 |
2343 | 2343 | */ |
2344 | - $address_format = apply_filters( 'give_address_format_template', "{street_address}\n{city}, {state} {postal_code}\n{country}" ); |
|
2345 | - preg_match_all( "/{([A-z0-9\-\_\ ]+)}/s", $address_format, $matches ); |
|
2344 | + $address_format = apply_filters('give_address_format_template', "{street_address}\n{city}, {state} {postal_code}\n{country}"); |
|
2345 | + preg_match_all("/{([A-z0-9\-\_\ ]+)}/s", $address_format, $matches); |
|
2346 | 2346 | |
2347 | - if( ! empty( $matches ) && ! empty( $address ) ) { |
|
2347 | + if ( ! empty($matches) && ! empty($address)) { |
|
2348 | 2348 | $address_values = array(); |
2349 | 2349 | |
2350 | - foreach ($matches[1] as $address_tag ) { |
|
2351 | - $address_values[ $address_tag ] = ''; |
|
2350 | + foreach ($matches[1] as $address_tag) { |
|
2351 | + $address_values[$address_tag] = ''; |
|
2352 | 2352 | |
2353 | - if( isset( $address[$address_tag] ) ) { |
|
2354 | - $address_values[ $address_tag ] = $address[$address_tag]; |
|
2353 | + if (isset($address[$address_tag])) { |
|
2354 | + $address_values[$address_tag] = $address[$address_tag]; |
|
2355 | 2355 | } |
2356 | 2356 | } |
2357 | 2357 | |
2358 | - $formatted_address = str_ireplace( $matches[0], $address_values, $address_format ); |
|
2358 | + $formatted_address = str_ireplace($matches[0], $address_values, $address_format); |
|
2359 | 2359 | } |
2360 | 2360 | |
2361 | 2361 | /** |
@@ -2366,7 +2366,7 @@ discard block |
||
2366 | 2366 | * @param string $formatted_address Formatted address. |
2367 | 2367 | * @param string $address_format Format of the address. |
2368 | 2368 | */ |
2369 | - $formatted_address = apply_filters( 'give_get_formatted_address', $formatted_address, $address_format, $address ); |
|
2369 | + $formatted_address = apply_filters('give_get_formatted_address', $formatted_address, $address_format, $address); |
|
2370 | 2370 | |
2371 | 2371 | return $formatted_address; |
2372 | 2372 | } |
@@ -2380,10 +2380,10 @@ discard block |
||
2380 | 2380 | * |
2381 | 2381 | * @return string The JS date format. |
2382 | 2382 | */ |
2383 | -function give_convert_php_date_format_to_js( $php_format ) { |
|
2383 | +function give_convert_php_date_format_to_js($php_format) { |
|
2384 | 2384 | $js_format = $php_format; |
2385 | 2385 | |
2386 | - switch ( $php_format ) { |
|
2386 | + switch ($php_format) { |
|
2387 | 2387 | case 'F j, Y': |
2388 | 2388 | $js_format = 'MM dd, yy'; |
2389 | 2389 | break; |
@@ -2406,7 +2406,7 @@ discard block |
||
2406 | 2406 | * @param string $js_format The JS date format. |
2407 | 2407 | * @param string $php_format The PHP date format. |
2408 | 2408 | */ |
2409 | - $js_format = apply_filters( 'give_js_date_format', $js_format, $php_format ); |
|
2409 | + $js_format = apply_filters('give_js_date_format', $js_format, $php_format); |
|
2410 | 2410 | |
2411 | 2411 | return $js_format; |
2412 | 2412 | } |
@@ -2420,7 +2420,7 @@ discard block |
||
2420 | 2420 | */ |
2421 | 2421 | function give_get_localized_date_format_to_js() { |
2422 | 2422 | |
2423 | - return give_convert_php_date_format_to_js( get_option( 'date_format' ) ); |
|
2423 | + return give_convert_php_date_format_to_js(get_option('date_format')); |
|
2424 | 2424 | } |
2425 | 2425 | |
2426 | 2426 | /** |
@@ -2433,21 +2433,21 @@ discard block |
||
2433 | 2433 | * |
2434 | 2434 | * @return string |
2435 | 2435 | */ |
2436 | -function give_get_safe_asset_url( $url ) { |
|
2436 | +function give_get_safe_asset_url($url) { |
|
2437 | 2437 | |
2438 | 2438 | // Bailout, if empty URL passed. |
2439 | - if ( empty( $url ) ) { |
|
2439 | + if (empty($url)) { |
|
2440 | 2440 | return $url; |
2441 | 2441 | } |
2442 | 2442 | |
2443 | - $schema = parse_url( $url, PHP_URL_SCHEME ); |
|
2444 | - $schema_length = strlen( $schema ) + 1; |
|
2445 | - $url = substr( $url, $schema_length ); |
|
2443 | + $schema = parse_url($url, PHP_URL_SCHEME); |
|
2444 | + $schema_length = strlen($schema) + 1; |
|
2445 | + $url = substr($url, $schema_length); |
|
2446 | 2446 | |
2447 | 2447 | /** |
2448 | 2448 | * Fire the filter |
2449 | 2449 | * |
2450 | 2450 | * @since 2.2.0 |
2451 | 2451 | */ |
2452 | - return apply_filters( 'give_get_safe_asset_url', $url ); |
|
2452 | + return apply_filters('give_get_safe_asset_url', $url); |
|
2453 | 2453 | } |