@@ -10,17 +10,17 @@ |
||
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 | ?> |
17 | 17 | <div class="wrap" id="poststuff"> |
18 | 18 | <div id="give-updates"> |
19 | - <h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates Complete', 'give' ); ?></h1> |
|
19 | + <h1 id="give-updates-h1"><?php esc_html_e('Give - Updates Complete', 'give'); ?></h1> |
|
20 | 20 | <hr class="wp-header-end"> |
21 | 21 | |
22 | 22 | <div class="give-update-panel-content"> |
23 | - <p><?php esc_html_e( 'Congratulations! You are running the latest versions of Give and its add-ons.', 'give' ); ?></p> |
|
23 | + <p><?php esc_html_e('Congratulations! You are running the latest versions of Give and its add-ons.', 'give'); ?></p> |
|
24 | 24 | </div> |
25 | 25 | |
26 | 26 | </div> |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -25,63 +25,63 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_do_automatic_upgrades() { |
27 | 27 | $did_upgrade = false; |
28 | - $give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) ); |
|
28 | + $give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version')); |
|
29 | 29 | |
30 | - if ( ! $give_version ) { |
|
30 | + if ( ! $give_version) { |
|
31 | 31 | // 1.0 is the first version to use this option so we must add it. |
32 | 32 | $give_version = '1.0'; |
33 | 33 | } |
34 | 34 | |
35 | - switch ( true ) { |
|
35 | + switch (true) { |
|
36 | 36 | |
37 | - case version_compare( $give_version, '1.6', '<' ) : |
|
37 | + case version_compare($give_version, '1.6', '<') : |
|
38 | 38 | give_v16_upgrades(); |
39 | 39 | $did_upgrade = true; |
40 | 40 | |
41 | - case version_compare( $give_version, '1.7', '<' ) : |
|
41 | + case version_compare($give_version, '1.7', '<') : |
|
42 | 42 | give_v17_upgrades(); |
43 | 43 | $did_upgrade = true; |
44 | 44 | |
45 | - case version_compare( $give_version, '1.8', '<' ) : |
|
45 | + case version_compare($give_version, '1.8', '<') : |
|
46 | 46 | give_v18_upgrades(); |
47 | 47 | $did_upgrade = true; |
48 | 48 | |
49 | - case version_compare( $give_version, '1.8.7', '<' ) : |
|
49 | + case version_compare($give_version, '1.8.7', '<') : |
|
50 | 50 | give_v187_upgrades(); |
51 | 51 | $did_upgrade = true; |
52 | 52 | |
53 | - case version_compare( $give_version, '1.8.8', '<' ) : |
|
53 | + case version_compare($give_version, '1.8.8', '<') : |
|
54 | 54 | give_v188_upgrades(); |
55 | 55 | $did_upgrade = true; |
56 | 56 | |
57 | - case version_compare( $give_version, '1.8.9', '<' ) : |
|
57 | + case version_compare($give_version, '1.8.9', '<') : |
|
58 | 58 | give_v189_upgrades(); |
59 | 59 | $did_upgrade = true; |
60 | 60 | |
61 | - case version_compare( $give_version, '1.8.12', '<' ) : |
|
61 | + case version_compare($give_version, '1.8.12', '<') : |
|
62 | 62 | give_v1812_upgrades(); |
63 | 63 | $did_upgrade = true; |
64 | 64 | |
65 | - case version_compare( $give_version, '1.8.13', '<' ) : |
|
65 | + case version_compare($give_version, '1.8.13', '<') : |
|
66 | 66 | give_v1813_upgrades(); |
67 | 67 | $did_upgrade = true; |
68 | 68 | |
69 | - case version_compare( $give_version, '1.8.17', '<' ) : |
|
69 | + case version_compare($give_version, '1.8.17', '<') : |
|
70 | 70 | give_v1817_upgrades(); |
71 | 71 | $did_upgrade = true; |
72 | 72 | |
73 | - case version_compare( $give_version, '1.8.18', '<' ) : |
|
73 | + case version_compare($give_version, '1.8.18', '<') : |
|
74 | 74 | give_v1818_upgrades(); |
75 | 75 | $did_upgrade = true; |
76 | 76 | } |
77 | 77 | |
78 | - if ( $did_upgrade ) { |
|
79 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
78 | + if ($did_upgrade) { |
|
79 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | -add_action( 'admin_init', 'give_do_automatic_upgrades' ); |
|
84 | -add_action( 'give_upgrades', 'give_do_automatic_upgrades' ); |
|
83 | +add_action('admin_init', 'give_do_automatic_upgrades'); |
|
84 | +add_action('give_upgrades', 'give_do_automatic_upgrades'); |
|
85 | 85 | |
86 | 86 | /** |
87 | 87 | * Display Upgrade Notices. |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @return void |
97 | 97 | */ |
98 | -function give_show_upgrade_notices( $give_updates ) { |
|
98 | +function give_show_upgrade_notices($give_updates) { |
|
99 | 99 | // v1.3.2 Upgrades |
100 | 100 | $give_updates->register( |
101 | 101 | array( |
@@ -161,34 +161,34 @@ discard block |
||
161 | 161 | ); |
162 | 162 | |
163 | 163 | // v1.8.17 Upgrades for donations. |
164 | - $give_updates->register( array( |
|
164 | + $give_updates->register(array( |
|
165 | 165 | 'id' => 'v1817_update_donation_iranian_currency_code', |
166 | 166 | 'version' => '1.8.17', |
167 | 167 | 'callback' => 'give_v1817_update_donation_iranian_currency_code', |
168 | - ) ); |
|
168 | + )); |
|
169 | 169 | |
170 | 170 | // v1.8.17 Upgrades for cleanup of user roles. |
171 | - $give_updates->register( array( |
|
171 | + $give_updates->register(array( |
|
172 | 172 | 'id' => 'v1817_cleanup_user_roles', |
173 | 173 | 'version' => '1.8.17', |
174 | 174 | 'callback' => 'give_v1817_cleanup_user_roles', |
175 | - ) ); |
|
175 | + )); |
|
176 | 176 | |
177 | 177 | // v1.8.18 Upgrades for assigning custom amount to existing set donations. |
178 | - $give_updates->register( array( |
|
178 | + $give_updates->register(array( |
|
179 | 179 | 'id' => 'v1818_assign_custom_amount_set_donation', |
180 | 180 | 'version' => '1.8.18', |
181 | 181 | 'callback' => 'give_v1818_assign_custom_amount_set_donation', |
182 | - ) ); |
|
182 | + )); |
|
183 | 183 | // v1.8.18 Cleanup the Give Worker Role Caps. |
184 | - $give_updates->register( array( |
|
184 | + $give_updates->register(array( |
|
185 | 185 | 'id' => 'v1818_give_worker_role_cleanup', |
186 | 186 | 'version' => '1.8.18', |
187 | 187 | 'callback' => 'give_v1818_give_worker_role_cleanup', |
188 | - ) ); |
|
188 | + )); |
|
189 | 189 | } |
190 | 190 | |
191 | -add_action( 'give_register_updates', 'give_show_upgrade_notices' ); |
|
191 | +add_action('give_register_updates', 'give_show_upgrade_notices'); |
|
192 | 192 | |
193 | 193 | /** |
194 | 194 | * Triggers all upgrade functions |
@@ -200,29 +200,29 @@ discard block |
||
200 | 200 | */ |
201 | 201 | function give_trigger_upgrades() { |
202 | 202 | |
203 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
204 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
203 | + if ( ! current_user_can('manage_give_settings')) { |
|
204 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
205 | 205 | 'response' => 403, |
206 | - ) ); |
|
206 | + )); |
|
207 | 207 | } |
208 | 208 | |
209 | - $give_version = get_option( 'give_version' ); |
|
209 | + $give_version = get_option('give_version'); |
|
210 | 210 | |
211 | - if ( ! $give_version ) { |
|
211 | + if ( ! $give_version) { |
|
212 | 212 | // 1.0 is the first version to use this option so we must add it. |
213 | 213 | $give_version = '1.0'; |
214 | - add_option( 'give_version', $give_version ); |
|
214 | + add_option('give_version', $give_version); |
|
215 | 215 | } |
216 | 216 | |
217 | - update_option( 'give_version', GIVE_VERSION ); |
|
218 | - delete_option( 'give_doing_upgrade' ); |
|
217 | + update_option('give_version', GIVE_VERSION); |
|
218 | + delete_option('give_doing_upgrade'); |
|
219 | 219 | |
220 | - if ( DOING_AJAX ) { |
|
221 | - die( 'complete' ); |
|
220 | + if (DOING_AJAX) { |
|
221 | + die('complete'); |
|
222 | 222 | } // End if(). |
223 | 223 | } |
224 | 224 | |
225 | -add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' ); |
|
225 | +add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades'); |
|
226 | 226 | |
227 | 227 | |
228 | 228 | /** |
@@ -238,20 +238,20 @@ discard block |
||
238 | 238 | /* @var Give_Updates $give_updates */ |
239 | 239 | $give_updates = Give_Updates::get_instance(); |
240 | 240 | |
241 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
242 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
241 | + if ( ! current_user_can('manage_give_settings')) { |
|
242 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
243 | 243 | 'response' => 403, |
244 | - ) ); |
|
244 | + )); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | give_ignore_user_abort(); |
248 | 248 | |
249 | 249 | // UPDATE DB METAKEYS. |
250 | 250 | $sql = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'"; |
251 | - $query = $wpdb->query( $sql ); |
|
251 | + $query = $wpdb->query($sql); |
|
252 | 252 | |
253 | 253 | $give_updates->percentage = 100; |
254 | - give_set_upgrade_complete( 'upgrade_give_payment_customer_id' ); |
|
254 | + give_set_upgrade_complete('upgrade_give_payment_customer_id'); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | |
@@ -275,24 +275,24 @@ discard block |
||
275 | 275 | $where .= "AND ( p.post_status = 'abandoned' )"; |
276 | 276 | $where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )"; |
277 | 277 | |
278 | - $sql = $select . $join . $where; |
|
279 | - $found_payments = $wpdb->get_col( $sql ); |
|
278 | + $sql = $select.$join.$where; |
|
279 | + $found_payments = $wpdb->get_col($sql); |
|
280 | 280 | |
281 | - foreach ( $found_payments as $payment ) { |
|
281 | + foreach ($found_payments as $payment) { |
|
282 | 282 | |
283 | 283 | // Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves. |
284 | - $modified_time = get_post_modified_time( 'U', false, $payment ); |
|
284 | + $modified_time = get_post_modified_time('U', false, $payment); |
|
285 | 285 | |
286 | 286 | // 1450124863 = 12/10/2015 20:42:25. |
287 | - if ( $modified_time >= 1450124863 ) { |
|
287 | + if ($modified_time >= 1450124863) { |
|
288 | 288 | |
289 | - give_update_payment_status( $payment, 'pending' ); |
|
289 | + give_update_payment_status($payment, 'pending'); |
|
290 | 290 | |
291 | 291 | } |
292 | 292 | } |
293 | 293 | |
294 | 294 | $give_updates->percentage = 100; |
295 | - give_set_upgrade_complete( 'upgrade_give_offline_status' ); |
|
295 | + give_set_upgrade_complete('upgrade_give_offline_status'); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | |
@@ -305,17 +305,17 @@ discard block |
||
305 | 305 | */ |
306 | 306 | function give_v152_cleanup_users() { |
307 | 307 | |
308 | - $give_version = get_option( 'give_version' ); |
|
308 | + $give_version = get_option('give_version'); |
|
309 | 309 | |
310 | - if ( ! $give_version ) { |
|
310 | + if ( ! $give_version) { |
|
311 | 311 | // 1.0 is the first version to use this option so we must add it. |
312 | 312 | $give_version = '1.0'; |
313 | 313 | } |
314 | 314 | |
315 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
315 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
316 | 316 | |
317 | 317 | // v1.5.2 Upgrades |
318 | - if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) { |
|
318 | + if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) { |
|
319 | 319 | |
320 | 320 | // Delete all caps with "ss". |
321 | 321 | // Also delete all unused "campaign" roles. |
@@ -362,9 +362,9 @@ discard block |
||
362 | 362 | ); |
363 | 363 | |
364 | 364 | global $wp_roles; |
365 | - foreach ( $delete_caps as $cap ) { |
|
366 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
367 | - $wp_roles->remove_cap( $role, $cap ); |
|
365 | + foreach ($delete_caps as $cap) { |
|
366 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
367 | + $wp_roles->remove_cap($role, $cap); |
|
368 | 368 | } |
369 | 369 | } |
370 | 370 | |
@@ -374,15 +374,15 @@ discard block |
||
374 | 374 | $roles->add_caps(); |
375 | 375 | |
376 | 376 | // The Update Ran. |
377 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
378 | - give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' ); |
|
379 | - delete_option( 'give_doing_upgrade' ); |
|
377 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
378 | + give_set_upgrade_complete('upgrade_give_user_caps_cleanup'); |
|
379 | + delete_option('give_doing_upgrade'); |
|
380 | 380 | |
381 | 381 | }// End if(). |
382 | 382 | |
383 | 383 | } |
384 | 384 | |
385 | -add_action( 'admin_init', 'give_v152_cleanup_users' ); |
|
385 | +add_action('admin_init', 'give_v152_cleanup_users'); |
|
386 | 386 | |
387 | 387 | /** |
388 | 388 | * 1.6 Upgrade routine to create the customer meta table. |
@@ -425,53 +425,53 @@ discard block |
||
425 | 425 | |
426 | 426 | // Get addons license key. |
427 | 427 | $addons = array(); |
428 | - foreach ( $give_options as $key => $value ) { |
|
429 | - if ( false !== strpos( $key, '_license_key' ) ) { |
|
430 | - $addons[ $key ] = $value; |
|
428 | + foreach ($give_options as $key => $value) { |
|
429 | + if (false !== strpos($key, '_license_key')) { |
|
430 | + $addons[$key] = $value; |
|
431 | 431 | } |
432 | 432 | } |
433 | 433 | |
434 | 434 | // Bailout: We do not have any addon license data to upgrade. |
435 | - if ( empty( $addons ) ) { |
|
435 | + if (empty($addons)) { |
|
436 | 436 | return false; |
437 | 437 | } |
438 | 438 | |
439 | - foreach ( $addons as $key => $addon_license ) { |
|
439 | + foreach ($addons as $key => $addon_license) { |
|
440 | 440 | |
441 | 441 | // Get addon shortname. |
442 | - $shortname = str_replace( '_license_key', '', $key ); |
|
442 | + $shortname = str_replace('_license_key', '', $key); |
|
443 | 443 | |
444 | 444 | // Addon license option name. |
445 | - $addon_license_option_name = $shortname . '_license_active'; |
|
445 | + $addon_license_option_name = $shortname.'_license_active'; |
|
446 | 446 | |
447 | 447 | // bailout if license is empty. |
448 | - if ( empty( $addon_license ) ) { |
|
449 | - delete_option( $addon_license_option_name ); |
|
448 | + if (empty($addon_license)) { |
|
449 | + delete_option($addon_license_option_name); |
|
450 | 450 | continue; |
451 | 451 | } |
452 | 452 | |
453 | 453 | // Get addon name. |
454 | 454 | $addon_name = array(); |
455 | - $addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) ); |
|
456 | - foreach ( $addon_name_parts as $name_part ) { |
|
455 | + $addon_name_parts = explode('_', str_replace('give_', '', $shortname)); |
|
456 | + foreach ($addon_name_parts as $name_part) { |
|
457 | 457 | |
458 | 458 | // Fix addon name |
459 | - switch ( $name_part ) { |
|
459 | + switch ($name_part) { |
|
460 | 460 | case 'authorizenet' : |
461 | 461 | $name_part = 'authorize.net'; |
462 | 462 | break; |
463 | 463 | } |
464 | 464 | |
465 | - $addon_name[] = ucfirst( $name_part ); |
|
465 | + $addon_name[] = ucfirst($name_part); |
|
466 | 466 | } |
467 | 467 | |
468 | - $addon_name = implode( ' ', $addon_name ); |
|
468 | + $addon_name = implode(' ', $addon_name); |
|
469 | 469 | |
470 | 470 | // Data to send to the API. |
471 | 471 | $api_params = array( |
472 | 472 | 'edd_action' => 'activate_license', // never change from "edd_" to "give_"! |
473 | 473 | 'license' => $addon_license, |
474 | - 'item_name' => urlencode( $addon_name ), |
|
474 | + 'item_name' => urlencode($addon_name), |
|
475 | 475 | 'url' => home_url(), |
476 | 476 | ); |
477 | 477 | |
@@ -486,17 +486,17 @@ discard block |
||
486 | 486 | ); |
487 | 487 | |
488 | 488 | // Make sure there are no errors. |
489 | - if ( is_wp_error( $response ) ) { |
|
490 | - delete_option( $addon_license_option_name ); |
|
489 | + if (is_wp_error($response)) { |
|
490 | + delete_option($addon_license_option_name); |
|
491 | 491 | continue; |
492 | 492 | } |
493 | 493 | |
494 | 494 | // Tell WordPress to look for updates. |
495 | - set_site_transient( 'update_plugins', null ); |
|
495 | + set_site_transient('update_plugins', null); |
|
496 | 496 | |
497 | 497 | // Decode license data. |
498 | - $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
499 | - update_option( $addon_license_option_name, $license_data ); |
|
498 | + $license_data = json_decode(wp_remote_retrieve_body($response)); |
|
499 | + update_option($addon_license_option_name, $license_data); |
|
500 | 500 | }// End foreach(). |
501 | 501 | } |
502 | 502 | |
@@ -526,9 +526,9 @@ discard block |
||
526 | 526 | ); |
527 | 527 | |
528 | 528 | global $wp_roles; |
529 | - foreach ( $delete_caps as $cap ) { |
|
530 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
531 | - $wp_roles->remove_cap( $role, $cap ); |
|
529 | + foreach ($delete_caps as $cap) { |
|
530 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
531 | + $wp_roles->remove_cap($role, $cap); |
|
532 | 532 | } |
533 | 533 | } |
534 | 534 | |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | function give_v18_upgrades_core_setting() { |
563 | 563 | // Core settings which changes from checkbox to radio. |
564 | 564 | $core_setting_names = array_merge( |
565 | - array_keys( give_v18_renamed_core_settings() ), |
|
565 | + array_keys(give_v18_renamed_core_settings()), |
|
566 | 566 | array( |
567 | 567 | 'uninstall_on_delete', |
568 | 568 | 'scripts_footer', |
@@ -574,48 +574,48 @@ discard block |
||
574 | 574 | ); |
575 | 575 | |
576 | 576 | // Bailout: If not any setting define. |
577 | - if ( $give_settings = get_option( 'give_settings' ) ) { |
|
577 | + if ($give_settings = get_option('give_settings')) { |
|
578 | 578 | |
579 | 579 | $setting_changed = false; |
580 | 580 | |
581 | 581 | // Loop: check each setting field. |
582 | - foreach ( $core_setting_names as $setting_name ) { |
|
582 | + foreach ($core_setting_names as $setting_name) { |
|
583 | 583 | // New setting name. |
584 | - $new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name ); |
|
584 | + $new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name); |
|
585 | 585 | |
586 | 586 | // Continue: If setting already set. |
587 | 587 | if ( |
588 | - array_key_exists( $new_setting_name, $give_settings ) |
|
589 | - && in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) ) |
|
588 | + array_key_exists($new_setting_name, $give_settings) |
|
589 | + && in_array($give_settings[$new_setting_name], array('enabled', 'disabled')) |
|
590 | 590 | ) { |
591 | 591 | continue; |
592 | 592 | } |
593 | 593 | |
594 | 594 | // Set checkbox value to radio value. |
595 | - $give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' ); |
|
595 | + $give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled'); |
|
596 | 596 | |
597 | 597 | // @see https://github.com/WordImpress/Give/issues/1063. |
598 | - if ( false !== strpos( $setting_name, 'disable_' ) ) { |
|
598 | + if (false !== strpos($setting_name, 'disable_')) { |
|
599 | 599 | |
600 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' ); |
|
601 | - } elseif ( false !== strpos( $setting_name, 'enable_' ) ) { |
|
600 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled'); |
|
601 | + } elseif (false !== strpos($setting_name, 'enable_')) { |
|
602 | 602 | |
603 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' ); |
|
603 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled'); |
|
604 | 604 | } |
605 | 605 | |
606 | 606 | // Tell bot to update core setting to db. |
607 | - if ( ! $setting_changed ) { |
|
607 | + if ( ! $setting_changed) { |
|
608 | 608 | $setting_changed = true; |
609 | 609 | } |
610 | 610 | } |
611 | 611 | |
612 | 612 | // Update setting only if they changed. |
613 | - if ( $setting_changed ) { |
|
614 | - update_option( 'give_settings', $give_settings ); |
|
613 | + if ($setting_changed) { |
|
614 | + update_option('give_settings', $give_settings); |
|
615 | 615 | } |
616 | 616 | }// End if(). |
617 | 617 | |
618 | - give_set_upgrade_complete( 'v18_upgrades_core_setting' ); |
|
618 | + give_set_upgrade_complete('v18_upgrades_core_setting'); |
|
619 | 619 | } |
620 | 620 | |
621 | 621 | /** |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | $give_updates = Give_Updates::get_instance(); |
630 | 630 | |
631 | 631 | // form query |
632 | - $forms = new WP_Query( array( |
|
632 | + $forms = new WP_Query(array( |
|
633 | 633 | 'paged' => $give_updates->step, |
634 | 634 | 'status' => 'any', |
635 | 635 | 'order' => 'ASC', |
@@ -638,41 +638,41 @@ discard block |
||
638 | 638 | ) |
639 | 639 | ); |
640 | 640 | |
641 | - if ( $forms->have_posts() ) { |
|
642 | - $give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 20 ) ); |
|
641 | + if ($forms->have_posts()) { |
|
642 | + $give_updates->set_percentage($forms->found_posts, ($give_updates->step * 20)); |
|
643 | 643 | |
644 | - while ( $forms->have_posts() ) { |
|
644 | + while ($forms->have_posts()) { |
|
645 | 645 | $forms->the_post(); |
646 | 646 | |
647 | 647 | // Form content. |
648 | 648 | // Note in version 1.8 display content setting split into display content and content placement setting. |
649 | 649 | // You can delete _give_content_option in future. |
650 | - $show_content = give_get_meta( get_the_ID(), '_give_content_option', true ); |
|
651 | - if ( $show_content && ! give_get_meta( get_the_ID(), '_give_display_content', true ) ) { |
|
652 | - $field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' ); |
|
653 | - give_update_meta( get_the_ID(), '_give_display_content', $field_value ); |
|
650 | + $show_content = give_get_meta(get_the_ID(), '_give_content_option', true); |
|
651 | + if ($show_content && ! give_get_meta(get_the_ID(), '_give_display_content', true)) { |
|
652 | + $field_value = ('none' !== $show_content ? 'enabled' : 'disabled'); |
|
653 | + give_update_meta(get_the_ID(), '_give_display_content', $field_value); |
|
654 | 654 | |
655 | - $field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' ); |
|
656 | - give_update_meta( get_the_ID(), '_give_content_placement', $field_value ); |
|
655 | + $field_value = ('none' !== $show_content ? $show_content : 'give_pre_form'); |
|
656 | + give_update_meta(get_the_ID(), '_give_content_placement', $field_value); |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | // "Disable" Guest Donation. Checkbox. |
660 | 660 | // See: https://github.com/WordImpress/Give/issues/1470. |
661 | - $guest_donation = give_get_meta( get_the_ID(), '_give_logged_in_only', true ); |
|
662 | - $guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' ); |
|
663 | - give_update_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval ); |
|
661 | + $guest_donation = give_get_meta(get_the_ID(), '_give_logged_in_only', true); |
|
662 | + $guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled'); |
|
663 | + give_update_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval); |
|
664 | 664 | |
665 | 665 | // Offline Donations. |
666 | 666 | // See: https://github.com/WordImpress/Give/issues/1579. |
667 | - $offline_donation = give_get_meta( get_the_ID(), '_give_customize_offline_donations', true ); |
|
668 | - if ( 'no' === $offline_donation ) { |
|
667 | + $offline_donation = give_get_meta(get_the_ID(), '_give_customize_offline_donations', true); |
|
668 | + if ('no' === $offline_donation) { |
|
669 | 669 | $offline_donation_newval = 'global'; |
670 | - } elseif ( 'yes' === $offline_donation ) { |
|
670 | + } elseif ('yes' === $offline_donation) { |
|
671 | 671 | $offline_donation_newval = 'enabled'; |
672 | 672 | } else { |
673 | 673 | $offline_donation_newval = 'disabled'; |
674 | 674 | } |
675 | - give_update_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval ); |
|
675 | + give_update_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval); |
|
676 | 676 | |
677 | 677 | // Convert yes/no setting field to enabled/disabled. |
678 | 678 | $form_radio_settings = array( |
@@ -692,15 +692,15 @@ discard block |
||
692 | 692 | '_give_offline_donation_enable_billing_fields_single', |
693 | 693 | ); |
694 | 694 | |
695 | - foreach ( $form_radio_settings as $meta_key ) { |
|
695 | + foreach ($form_radio_settings as $meta_key) { |
|
696 | 696 | // Get value. |
697 | - $field_value = give_get_meta( get_the_ID(), $meta_key, true ); |
|
697 | + $field_value = give_get_meta(get_the_ID(), $meta_key, true); |
|
698 | 698 | |
699 | 699 | // Convert meta value only if it is in yes/no/none. |
700 | - if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) { |
|
700 | + if (in_array($field_value, array('yes', 'on', 'no', 'none'))) { |
|
701 | 701 | |
702 | - $field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' ); |
|
703 | - give_update_meta( get_the_ID(), $meta_key, $field_value ); |
|
702 | + $field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled'); |
|
703 | + give_update_meta(get_the_ID(), $meta_key, $field_value); |
|
704 | 704 | } |
705 | 705 | } |
706 | 706 | }// End while(). |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | |
710 | 710 | } else { |
711 | 711 | // No more forms found, finish up. |
712 | - give_set_upgrade_complete( 'v18_upgrades_form_metadata' ); |
|
712 | + give_set_upgrade_complete('v18_upgrades_form_metadata'); |
|
713 | 713 | } |
714 | 714 | } |
715 | 715 | |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | '%_transient_give_stats_%', |
777 | 777 | 'give_cache%', |
778 | 778 | '%_transient_give_add_ons_feed%', |
779 | - '%_transient__give_ajax_works' . |
|
779 | + '%_transient__give_ajax_works'. |
|
780 | 780 | '%_transient_give_total_api_keys%', |
781 | 781 | '%_transient_give_i18n_give_promo_hide%', |
782 | 782 | '%_transient_give_contributors%', |
@@ -803,24 +803,24 @@ discard block |
||
803 | 803 | ARRAY_A |
804 | 804 | ); |
805 | 805 | |
806 | - if ( ! empty( $user_apikey_options ) ) { |
|
807 | - foreach ( $user_apikey_options as $user ) { |
|
808 | - $cached_options[] = '_transient_' . md5( 'give_api_user_' . $user['meta_key'] ); |
|
809 | - $cached_options[] = '_transient_' . md5( 'give_api_user_public_key' . $user['user_id'] ); |
|
810 | - $cached_options[] = '_transient_' . md5( 'give_api_user_secret_key' . $user['user_id'] ); |
|
806 | + if ( ! empty($user_apikey_options)) { |
|
807 | + foreach ($user_apikey_options as $user) { |
|
808 | + $cached_options[] = '_transient_'.md5('give_api_user_'.$user['meta_key']); |
|
809 | + $cached_options[] = '_transient_'.md5('give_api_user_public_key'.$user['user_id']); |
|
810 | + $cached_options[] = '_transient_'.md5('give_api_user_secret_key'.$user['user_id']); |
|
811 | 811 | } |
812 | 812 | } |
813 | 813 | |
814 | - if ( ! empty( $cached_options ) ) { |
|
815 | - foreach ( $cached_options as $option ) { |
|
816 | - switch ( true ) { |
|
817 | - case ( false !== strpos( $option, 'transient' ) ): |
|
818 | - $option = str_replace( '_transient_', '', $option ); |
|
819 | - delete_transient( $option ); |
|
814 | + if ( ! empty($cached_options)) { |
|
815 | + foreach ($cached_options as $option) { |
|
816 | + switch (true) { |
|
817 | + case (false !== strpos($option, 'transient')): |
|
818 | + $option = str_replace('_transient_', '', $option); |
|
819 | + delete_transient($option); |
|
820 | 820 | break; |
821 | 821 | |
822 | 822 | default: |
823 | - delete_option( $option ); |
|
823 | + delete_option($option); |
|
824 | 824 | } |
825 | 825 | } |
826 | 826 | } |
@@ -838,7 +838,7 @@ discard block |
||
838 | 838 | global $wp_roles; |
839 | 839 | |
840 | 840 | // Get the role object. |
841 | - $give_worker = get_role( 'give_worker' ); |
|
841 | + $give_worker = get_role('give_worker'); |
|
842 | 842 | |
843 | 843 | // A list of capabilities to add for give workers. |
844 | 844 | $caps_to_add = array( |
@@ -846,9 +846,9 @@ discard block |
||
846 | 846 | 'edit_pages', |
847 | 847 | ); |
848 | 848 | |
849 | - foreach ( $caps_to_add as $cap ) { |
|
849 | + foreach ($caps_to_add as $cap) { |
|
850 | 850 | // Add the capability. |
851 | - $give_worker->add_cap( $cap ); |
|
851 | + $give_worker->add_cap($cap); |
|
852 | 852 | } |
853 | 853 | |
854 | 854 | } |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | $give_updates = Give_Updates::get_instance(); |
866 | 866 | |
867 | 867 | // form query. |
868 | - $donation_forms = new WP_Query( array( |
|
868 | + $donation_forms = new WP_Query(array( |
|
869 | 869 | 'paged' => $give_updates->step, |
870 | 870 | 'status' => 'any', |
871 | 871 | 'order' => 'ASC', |
@@ -874,10 +874,10 @@ discard block |
||
874 | 874 | ) |
875 | 875 | ); |
876 | 876 | |
877 | - if ( $donation_forms->have_posts() ) { |
|
878 | - $give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) ); |
|
877 | + if ($donation_forms->have_posts()) { |
|
878 | + $give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20)); |
|
879 | 879 | |
880 | - while ( $donation_forms->have_posts() ) { |
|
880 | + while ($donation_forms->have_posts()) { |
|
881 | 881 | $donation_forms->the_post(); |
882 | 882 | $form_id = get_the_ID(); |
883 | 883 | |
@@ -885,41 +885,41 @@ discard block |
||
885 | 885 | update_post_meta( |
886 | 886 | $form_id, |
887 | 887 | '_give_set_price', |
888 | - give_sanitize_amount( get_post_meta( $form_id, '_give_set_price', true ) ) |
|
888 | + give_sanitize_amount(get_post_meta($form_id, '_give_set_price', true)) |
|
889 | 889 | ); |
890 | 890 | |
891 | 891 | // Remove formatting from _give_custom_amount_minimum. |
892 | 892 | update_post_meta( |
893 | 893 | $form_id, |
894 | 894 | '_give_custom_amount_minimum', |
895 | - give_sanitize_amount( get_post_meta( $form_id, '_give_custom_amount_minimum', true ) ) |
|
895 | + give_sanitize_amount(get_post_meta($form_id, '_give_custom_amount_minimum', true)) |
|
896 | 896 | ); |
897 | 897 | |
898 | 898 | // Bailout. |
899 | - if ( 'set' === get_post_meta( $form_id, '_give_price_option', true ) ) { |
|
899 | + if ('set' === get_post_meta($form_id, '_give_price_option', true)) { |
|
900 | 900 | continue; |
901 | 901 | } |
902 | 902 | |
903 | - $donation_levels = get_post_meta( $form_id, '_give_donation_levels', true ); |
|
903 | + $donation_levels = get_post_meta($form_id, '_give_donation_levels', true); |
|
904 | 904 | |
905 | - if ( ! empty( $donation_levels ) ) { |
|
905 | + if ( ! empty($donation_levels)) { |
|
906 | 906 | |
907 | - foreach ( $donation_levels as $index => $donation_level ) { |
|
908 | - if ( isset( $donation_level['_give_amount'] ) ) { |
|
909 | - $donation_levels[ $index ]['_give_amount'] = give_sanitize_amount( $donation_level['_give_amount'] ); |
|
907 | + foreach ($donation_levels as $index => $donation_level) { |
|
908 | + if (isset($donation_level['_give_amount'])) { |
|
909 | + $donation_levels[$index]['_give_amount'] = give_sanitize_amount($donation_level['_give_amount']); |
|
910 | 910 | } |
911 | 911 | } |
912 | 912 | |
913 | - update_post_meta( $form_id, '_give_donation_levels', $donation_levels ); |
|
913 | + update_post_meta($form_id, '_give_donation_levels', $donation_levels); |
|
914 | 914 | |
915 | - $donation_levels_amounts = wp_list_pluck( $donation_levels, '_give_amount' ); |
|
915 | + $donation_levels_amounts = wp_list_pluck($donation_levels, '_give_amount'); |
|
916 | 916 | |
917 | - $min_amount = min( $donation_levels_amounts ); |
|
918 | - $max_amount = max( $donation_levels_amounts ); |
|
917 | + $min_amount = min($donation_levels_amounts); |
|
918 | + $max_amount = max($donation_levels_amounts); |
|
919 | 919 | |
920 | 920 | // Set Minimum and Maximum amount for Multi Level Donation Forms |
921 | - give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount( $min_amount ) : 0 ); |
|
922 | - give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount( $max_amount ) : 0 ); |
|
921 | + give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount($min_amount) : 0); |
|
922 | + give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount($max_amount) : 0); |
|
923 | 923 | } |
924 | 924 | |
925 | 925 | } |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | wp_reset_postdata(); |
929 | 929 | } else { |
930 | 930 | // The Update Ran. |
931 | - give_set_upgrade_complete( 'v189_upgrades_levels_post_meta' ); |
|
931 | + give_set_upgrade_complete('v189_upgrades_levels_post_meta'); |
|
932 | 932 | } |
933 | 933 | |
934 | 934 | } |
@@ -984,22 +984,22 @@ discard block |
||
984 | 984 | $give_settings = give_get_settings(); |
985 | 985 | $give_setting_updated = false; |
986 | 986 | |
987 | - if ( $give_settings['thousands_separator'] === $give_settings['decimal_separator'] ) { |
|
987 | + if ($give_settings['thousands_separator'] === $give_settings['decimal_separator']) { |
|
988 | 988 | $give_settings['number_decimals'] = 0; |
989 | 989 | $give_settings['decimal_separator'] = ''; |
990 | 990 | $give_setting_updated = true; |
991 | 991 | |
992 | - } elseif ( empty( $give_settings['decimal_separator'] ) ) { |
|
992 | + } elseif (empty($give_settings['decimal_separator'])) { |
|
993 | 993 | $give_settings['number_decimals'] = 0; |
994 | 994 | $give_setting_updated = true; |
995 | 995 | |
996 | - } elseif ( 6 < absint( $give_settings['number_decimals'] ) ) { |
|
996 | + } elseif (6 < absint($give_settings['number_decimals'])) { |
|
997 | 997 | $give_settings['number_decimals'] = 5; |
998 | 998 | $give_setting_updated = true; |
999 | 999 | } |
1000 | 1000 | |
1001 | - if ( $give_setting_updated ) { |
|
1002 | - update_option( 'give_settings', $give_settings ); |
|
1001 | + if ($give_setting_updated) { |
|
1002 | + update_option('give_settings', $give_settings); |
|
1003 | 1003 | } |
1004 | 1004 | } |
1005 | 1005 | |
@@ -1018,70 +1018,70 @@ discard block |
||
1018 | 1018 | $give_updates = Give_Updates::get_instance(); |
1019 | 1019 | |
1020 | 1020 | // form query. |
1021 | - $donation_forms = new WP_Query( array( |
|
1021 | + $donation_forms = new WP_Query(array( |
|
1022 | 1022 | 'paged' => $give_updates->step, |
1023 | 1023 | 'status' => 'any', |
1024 | 1024 | 'order' => 'ASC', |
1025 | - 'post_type' => array( 'give_forms', 'give_payment' ), |
|
1025 | + 'post_type' => array('give_forms', 'give_payment'), |
|
1026 | 1026 | 'posts_per_page' => 20, |
1027 | 1027 | ) |
1028 | 1028 | ); |
1029 | 1029 | |
1030 | - if ( $donation_forms->have_posts() ) { |
|
1031 | - $give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) ); |
|
1030 | + if ($donation_forms->have_posts()) { |
|
1031 | + $give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20)); |
|
1032 | 1032 | |
1033 | - while ( $donation_forms->have_posts() ) { |
|
1033 | + while ($donation_forms->have_posts()) { |
|
1034 | 1034 | $donation_forms->the_post(); |
1035 | 1035 | global $post; |
1036 | 1036 | |
1037 | - $meta = get_post_meta( $post->ID ); |
|
1037 | + $meta = get_post_meta($post->ID); |
|
1038 | 1038 | |
1039 | - switch ( $post->post_type ) { |
|
1039 | + switch ($post->post_type) { |
|
1040 | 1040 | case 'give_forms': |
1041 | 1041 | // _give_set_price. |
1042 | - if ( ! empty( $meta['_give_set_price'][0] ) ) { |
|
1043 | - update_post_meta( $post->ID, '_give_set_price', give_sanitize_amount_for_db( $meta['_give_set_price'][0] ) ); |
|
1042 | + if ( ! empty($meta['_give_set_price'][0])) { |
|
1043 | + update_post_meta($post->ID, '_give_set_price', give_sanitize_amount_for_db($meta['_give_set_price'][0])); |
|
1044 | 1044 | } |
1045 | 1045 | |
1046 | 1046 | // _give_custom_amount_minimum. |
1047 | - if ( ! empty( $meta['_give_custom_amount_minimum'][0] ) ) { |
|
1048 | - update_post_meta( $post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db( $meta['_give_custom_amount_minimum'][0] ) ); |
|
1047 | + if ( ! empty($meta['_give_custom_amount_minimum'][0])) { |
|
1048 | + update_post_meta($post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db($meta['_give_custom_amount_minimum'][0])); |
|
1049 | 1049 | } |
1050 | 1050 | |
1051 | 1051 | // _give_levels_minimum_amount. |
1052 | - if ( ! empty( $meta['_give_levels_minimum_amount'][0] ) ) { |
|
1053 | - update_post_meta( $post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db( $meta['_give_levels_minimum_amount'][0] ) ); |
|
1052 | + if ( ! empty($meta['_give_levels_minimum_amount'][0])) { |
|
1053 | + update_post_meta($post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db($meta['_give_levels_minimum_amount'][0])); |
|
1054 | 1054 | } |
1055 | 1055 | |
1056 | 1056 | // _give_levels_maximum_amount. |
1057 | - if ( ! empty( $meta['_give_levels_maximum_amount'][0] ) ) { |
|
1058 | - update_post_meta( $post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db( $meta['_give_levels_maximum_amount'][0] ) ); |
|
1057 | + if ( ! empty($meta['_give_levels_maximum_amount'][0])) { |
|
1058 | + update_post_meta($post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db($meta['_give_levels_maximum_amount'][0])); |
|
1059 | 1059 | } |
1060 | 1060 | |
1061 | 1061 | // _give_set_goal. |
1062 | - if ( ! empty( $meta['_give_set_goal'][0] ) ) { |
|
1063 | - update_post_meta( $post->ID, '_give_set_goal', give_sanitize_amount_for_db( $meta['_give_set_goal'][0] ) ); |
|
1062 | + if ( ! empty($meta['_give_set_goal'][0])) { |
|
1063 | + update_post_meta($post->ID, '_give_set_goal', give_sanitize_amount_for_db($meta['_give_set_goal'][0])); |
|
1064 | 1064 | } |
1065 | 1065 | |
1066 | 1066 | // _give_form_earnings. |
1067 | - if ( ! empty( $meta['_give_form_earnings'][0] ) ) { |
|
1068 | - update_post_meta( $post->ID, '_give_form_earnings', give_sanitize_amount_for_db( $meta['_give_form_earnings'][0] ) ); |
|
1067 | + if ( ! empty($meta['_give_form_earnings'][0])) { |
|
1068 | + update_post_meta($post->ID, '_give_form_earnings', give_sanitize_amount_for_db($meta['_give_form_earnings'][0])); |
|
1069 | 1069 | } |
1070 | 1070 | |
1071 | 1071 | // _give_custom_amount_minimum. |
1072 | - if ( ! empty( $meta['_give_donation_levels'][0] ) ) { |
|
1073 | - $donation_levels = unserialize( $meta['_give_donation_levels'][0] ); |
|
1072 | + if ( ! empty($meta['_give_donation_levels'][0])) { |
|
1073 | + $donation_levels = unserialize($meta['_give_donation_levels'][0]); |
|
1074 | 1074 | |
1075 | - foreach ( $donation_levels as $index => $level ) { |
|
1076 | - if ( empty( $level['_give_amount'] ) ) { |
|
1075 | + foreach ($donation_levels as $index => $level) { |
|
1076 | + if (empty($level['_give_amount'])) { |
|
1077 | 1077 | continue; |
1078 | 1078 | } |
1079 | 1079 | |
1080 | - $donation_levels[ $index ]['_give_amount'] = give_sanitize_amount_for_db( $level['_give_amount'] ); |
|
1080 | + $donation_levels[$index]['_give_amount'] = give_sanitize_amount_for_db($level['_give_amount']); |
|
1081 | 1081 | } |
1082 | 1082 | |
1083 | 1083 | $meta['_give_donation_levels'] = $donation_levels; |
1084 | - update_post_meta( $post->ID, '_give_donation_levels', $meta['_give_donation_levels'] ); |
|
1084 | + update_post_meta($post->ID, '_give_donation_levels', $meta['_give_donation_levels']); |
|
1085 | 1085 | } |
1086 | 1086 | |
1087 | 1087 | |
@@ -1089,8 +1089,8 @@ discard block |
||
1089 | 1089 | |
1090 | 1090 | case 'give_payment': |
1091 | 1091 | // _give_payment_total. |
1092 | - if ( ! empty( $meta['_give_payment_total'][0] ) ) { |
|
1093 | - update_post_meta( $post->ID, '_give_payment_total', give_sanitize_amount_for_db( $meta['_give_payment_total'][0] ) ); |
|
1092 | + if ( ! empty($meta['_give_payment_total'][0])) { |
|
1093 | + update_post_meta($post->ID, '_give_payment_total', give_sanitize_amount_for_db($meta['_give_payment_total'][0])); |
|
1094 | 1094 | } |
1095 | 1095 | |
1096 | 1096 | break; |
@@ -1101,7 +1101,7 @@ discard block |
||
1101 | 1101 | wp_reset_postdata(); |
1102 | 1102 | } else { |
1103 | 1103 | // The Update Ran. |
1104 | - give_set_upgrade_complete( 'v1812_update_amount_values' ); |
|
1104 | + give_set_upgrade_complete('v1812_update_amount_values'); |
|
1105 | 1105 | } |
1106 | 1106 | } |
1107 | 1107 | |
@@ -1121,22 +1121,22 @@ discard block |
||
1121 | 1121 | $offset = 1 === $give_updates->step ? 0 : $give_updates->step * 20; |
1122 | 1122 | |
1123 | 1123 | // form query. |
1124 | - $donors = Give()->donors->get_donors( array( |
|
1124 | + $donors = Give()->donors->get_donors(array( |
|
1125 | 1125 | 'number' => 20, |
1126 | 1126 | 'offset' => $offset, |
1127 | 1127 | ) |
1128 | 1128 | ); |
1129 | 1129 | |
1130 | - if ( ! empty( $donors ) ) { |
|
1131 | - $give_updates->set_percentage( Give()->donors->count(), ( $give_updates->step * 20 ) ); |
|
1130 | + if ( ! empty($donors)) { |
|
1131 | + $give_updates->set_percentage(Give()->donors->count(), ($give_updates->step * 20)); |
|
1132 | 1132 | |
1133 | 1133 | /* @var Object $donor */ |
1134 | - foreach ( $donors as $donor ) { |
|
1135 | - Give()->donors->update( $donor->id, array( 'purchase_value' => give_sanitize_amount_for_db( $donor->purchase_value ) ) ); |
|
1134 | + foreach ($donors as $donor) { |
|
1135 | + Give()->donors->update($donor->id, array('purchase_value' => give_sanitize_amount_for_db($donor->purchase_value))); |
|
1136 | 1136 | } |
1137 | 1137 | } else { |
1138 | 1138 | // The Update Ran. |
1139 | - give_set_upgrade_complete( 'v1812_update_donor_purchase_values' ); |
|
1139 | + give_set_upgrade_complete('v1812_update_donor_purchase_values'); |
|
1140 | 1140 | } |
1141 | 1141 | } |
1142 | 1142 | |
@@ -1151,25 +1151,25 @@ discard block |
||
1151 | 1151 | $offset = 1 === $give_updates->step ? 0 : $give_updates->step * 20; |
1152 | 1152 | |
1153 | 1153 | // Fetch all the existing donors. |
1154 | - $donors = Give()->donors->get_donors( array( |
|
1154 | + $donors = Give()->donors->get_donors(array( |
|
1155 | 1155 | 'number' => 20, |
1156 | 1156 | 'offset' => $offset, |
1157 | 1157 | ) |
1158 | 1158 | ); |
1159 | 1159 | |
1160 | - if ( ! empty( $donors ) ) { |
|
1161 | - $give_updates->set_percentage( Give()->donors->count(), ( $give_updates->step * 20 ) ); |
|
1160 | + if ( ! empty($donors)) { |
|
1161 | + $give_updates->set_percentage(Give()->donors->count(), ($give_updates->step * 20)); |
|
1162 | 1162 | |
1163 | 1163 | /* @var Object $donor */ |
1164 | - foreach ( $donors as $donor ) { |
|
1164 | + foreach ($donors as $donor) { |
|
1165 | 1165 | $user_id = $donor->user_id; |
1166 | 1166 | |
1167 | 1167 | // Proceed, if donor is attached with user. |
1168 | - if ( $user_id ) { |
|
1169 | - $user = get_userdata( $user_id ); |
|
1168 | + if ($user_id) { |
|
1169 | + $user = get_userdata($user_id); |
|
1170 | 1170 | |
1171 | 1171 | // Update user role, if user has subscriber role. |
1172 | - if ( is_array( $user->roles ) && in_array( 'subscriber', $user->roles ) ) { |
|
1172 | + if (is_array($user->roles) && in_array('subscriber', $user->roles)) { |
|
1173 | 1173 | wp_update_user( |
1174 | 1174 | array( |
1175 | 1175 | 'ID' => $user_id, |
@@ -1181,7 +1181,7 @@ discard block |
||
1181 | 1181 | } |
1182 | 1182 | } else { |
1183 | 1183 | // The Update Ran. |
1184 | - give_set_upgrade_complete( 'v1813_update_donor_user_roles' ); |
|
1184 | + give_set_upgrade_complete('v1813_update_donor_user_roles'); |
|
1185 | 1185 | } |
1186 | 1186 | } |
1187 | 1187 | |
@@ -1195,33 +1195,33 @@ discard block |
||
1195 | 1195 | $give_updates = Give_Updates::get_instance(); |
1196 | 1196 | |
1197 | 1197 | // form query. |
1198 | - $payments = new WP_Query( array( |
|
1198 | + $payments = new WP_Query(array( |
|
1199 | 1199 | 'paged' => $give_updates->step, |
1200 | 1200 | 'status' => 'any', |
1201 | 1201 | 'order' => 'ASC', |
1202 | - 'post_type' => array( 'give_payment' ), |
|
1202 | + 'post_type' => array('give_payment'), |
|
1203 | 1203 | 'posts_per_page' => 20, |
1204 | 1204 | ) |
1205 | 1205 | ); |
1206 | 1206 | |
1207 | - if ( $payments->have_posts() ) { |
|
1208 | - $give_updates->set_percentage( $payments->found_posts, ( $give_updates->step * 20 ) ); |
|
1207 | + if ($payments->have_posts()) { |
|
1208 | + $give_updates->set_percentage($payments->found_posts, ($give_updates->step * 20)); |
|
1209 | 1209 | |
1210 | - while( $payments->have_posts() ) { |
|
1210 | + while ($payments->have_posts()) { |
|
1211 | 1211 | $payments->the_post(); |
1212 | 1212 | |
1213 | - $payment_meta = give_get_payment_meta( get_the_ID() ); |
|
1213 | + $payment_meta = give_get_payment_meta(get_the_ID()); |
|
1214 | 1214 | |
1215 | - if ( 'RIAL' === $payment_meta['currency'] ) { |
|
1215 | + if ('RIAL' === $payment_meta['currency']) { |
|
1216 | 1216 | $payment_meta['currency'] = 'IRR'; |
1217 | - give_update_meta( get_the_ID(), '_give_payment_meta', $payment_meta ); |
|
1217 | + give_update_meta(get_the_ID(), '_give_payment_meta', $payment_meta); |
|
1218 | 1218 | } |
1219 | 1219 | |
1220 | 1220 | } |
1221 | 1221 | |
1222 | - }else{ |
|
1222 | + } else { |
|
1223 | 1223 | // The Update Ran. |
1224 | - give_set_upgrade_complete( 'v1817_update_donation_iranian_currency_code' ); |
|
1224 | + give_set_upgrade_complete('v1817_update_donation_iranian_currency_code'); |
|
1225 | 1225 | } |
1226 | 1226 | } |
1227 | 1227 | |
@@ -1232,7 +1232,7 @@ discard block |
||
1232 | 1232 | */ |
1233 | 1233 | function give_v1813_upgrades() { |
1234 | 1234 | // Update admin setting. |
1235 | - give_update_option( 'donor_default_user_role', 'give_donor' ); |
|
1235 | + give_update_option('donor_default_user_role', 'give_donor'); |
|
1236 | 1236 | |
1237 | 1237 | // Update Give roles. |
1238 | 1238 | $roles = new Give_Roles(); |
@@ -1249,9 +1249,9 @@ discard block |
||
1249 | 1249 | function give_v1817_upgrades() { |
1250 | 1250 | $give_settings = give_get_settings(); |
1251 | 1251 | |
1252 | - if ( 'RIAL' === $give_settings['currency'] ) { |
|
1252 | + if ('RIAL' === $give_settings['currency']) { |
|
1253 | 1253 | $give_settings['currency'] = 'IRR'; |
1254 | - update_option( 'give_settings', $give_settings ); |
|
1254 | + update_option('give_settings', $give_settings); |
|
1255 | 1255 | } |
1256 | 1256 | } |
1257 | 1257 | |
@@ -1264,7 +1264,7 @@ discard block |
||
1264 | 1264 | |
1265 | 1265 | global $wp_roles; |
1266 | 1266 | |
1267 | - if( ! ( $wp_roles instanceof WP_Roles ) ) { |
|
1267 | + if ( ! ($wp_roles instanceof WP_Roles)) { |
|
1268 | 1268 | return; |
1269 | 1269 | } |
1270 | 1270 | |
@@ -1288,15 +1288,15 @@ discard block |
||
1288 | 1288 | ), |
1289 | 1289 | ); |
1290 | 1290 | |
1291 | - foreach ( $add_caps as $role => $caps ) { |
|
1292 | - foreach( $caps as $cap ) { |
|
1293 | - $wp_roles->add_cap( $role, $cap ); |
|
1291 | + foreach ($add_caps as $role => $caps) { |
|
1292 | + foreach ($caps as $cap) { |
|
1293 | + $wp_roles->add_cap($role, $cap); |
|
1294 | 1294 | } |
1295 | 1295 | } |
1296 | 1296 | |
1297 | - foreach ( $remove_caps as $role => $caps ) { |
|
1298 | - foreach( $caps as $cap ) { |
|
1299 | - $wp_roles->remove_cap( $role, $cap ); |
|
1297 | + foreach ($remove_caps as $role => $caps) { |
|
1298 | + foreach ($caps as $cap) { |
|
1299 | + $wp_roles->remove_cap($role, $cap); |
|
1300 | 1300 | } |
1301 | 1301 | } |
1302 | 1302 | |
@@ -1322,7 +1322,7 @@ discard block |
||
1322 | 1322 | $roles->add_roles(); |
1323 | 1323 | $roles->add_caps(); |
1324 | 1324 | |
1325 | - give_set_upgrade_complete( 'v1817_cleanup_user_roles' ); |
|
1325 | + give_set_upgrade_complete('v1817_cleanup_user_roles'); |
|
1326 | 1326 | |
1327 | 1327 | } |
1328 | 1328 | |
@@ -1334,7 +1334,7 @@ discard block |
||
1334 | 1334 | function give_v1818_upgrades() { |
1335 | 1335 | |
1336 | 1336 | // Remove email_access_installed from give_settings. |
1337 | - give_delete_option( 'email_access_installed' ); |
|
1337 | + give_delete_option('email_access_installed'); |
|
1338 | 1338 | } |
1339 | 1339 | |
1340 | 1340 | /** |
@@ -1345,25 +1345,25 @@ discard block |
||
1345 | 1345 | function give_v1818_assign_custom_amount_set_donation() { |
1346 | 1346 | |
1347 | 1347 | /* @var Give_Updates $give_updates */ |
1348 | - $give_updates = Give_Updates::get_instance(); |
|
1348 | + $give_updates = Give_Updates::get_instance(); |
|
1349 | 1349 | |
1350 | - $donations = new WP_Query( array( |
|
1350 | + $donations = new WP_Query(array( |
|
1351 | 1351 | 'paged' => $give_updates->step, |
1352 | 1352 | 'status' => 'any', |
1353 | 1353 | 'order' => 'ASC', |
1354 | - 'post_type' => array( 'give_payment' ), |
|
1354 | + 'post_type' => array('give_payment'), |
|
1355 | 1355 | 'posts_per_page' => 100, |
1356 | 1356 | ) |
1357 | 1357 | ); |
1358 | 1358 | |
1359 | - if ( $donations->have_posts() ) { |
|
1360 | - $give_updates->set_percentage( $donations->found_posts, $give_updates->step * 20 ); |
|
1359 | + if ($donations->have_posts()) { |
|
1360 | + $give_updates->set_percentage($donations->found_posts, $give_updates->step * 20); |
|
1361 | 1361 | |
1362 | - while ( $donations->have_posts() ) { |
|
1362 | + while ($donations->have_posts()) { |
|
1363 | 1363 | $donations->the_post(); |
1364 | 1364 | |
1365 | - $form = new Give_Donate_Form( give_get_meta( get_the_ID(), '_give_payment_form_id', true ) ); |
|
1366 | - $donation_meta = give_get_payment_meta( get_the_ID() ); |
|
1365 | + $form = new Give_Donate_Form(give_get_meta(get_the_ID(), '_give_payment_form_id', true)); |
|
1366 | + $donation_meta = give_get_payment_meta(get_the_ID()); |
|
1367 | 1367 | |
1368 | 1368 | // Update Donation meta with price_id set as custom, only if it is: |
1369 | 1369 | // 1. Donation Type = Set Donation. |
@@ -1372,19 +1372,19 @@ discard block |
||
1372 | 1372 | if ( |
1373 | 1373 | $form->ID && |
1374 | 1374 | $form->is_set_type_donation_form() && |
1375 | - ( 'custom' !== $donation_meta['price_id'] ) && |
|
1376 | - $form->is_custom_price( give_get_meta( get_the_ID(), '_give_payment_total', true ) ) |
|
1375 | + ('custom' !== $donation_meta['price_id']) && |
|
1376 | + $form->is_custom_price(give_get_meta(get_the_ID(), '_give_payment_total', true)) |
|
1377 | 1377 | ) { |
1378 | 1378 | $donation_meta['price_id'] = 'custom'; |
1379 | - give_update_meta( get_the_ID(), '_give_payment_meta', $donation_meta ); |
|
1380 | - give_update_meta( get_the_ID(), '_give_payment_price_id', 'custom' ); |
|
1379 | + give_update_meta(get_the_ID(), '_give_payment_meta', $donation_meta); |
|
1380 | + give_update_meta(get_the_ID(), '_give_payment_price_id', 'custom'); |
|
1381 | 1381 | } |
1382 | 1382 | } |
1383 | 1383 | |
1384 | 1384 | wp_reset_postdata(); |
1385 | 1385 | } else { |
1386 | 1386 | // Update Ran Successfully. |
1387 | - give_set_upgrade_complete( 'v1818_assign_custom_amount_set_donation' ); |
|
1387 | + give_set_upgrade_complete('v1818_assign_custom_amount_set_donation'); |
|
1388 | 1388 | } |
1389 | 1389 | |
1390 | 1390 | } |
@@ -1397,14 +1397,14 @@ discard block |
||
1397 | 1397 | * |
1398 | 1398 | * @since 1.8.18 |
1399 | 1399 | */ |
1400 | -function give_v1818_give_worker_role_cleanup(){ |
|
1400 | +function give_v1818_give_worker_role_cleanup() { |
|
1401 | 1401 | |
1402 | 1402 | /* @var Give_Updates $give_updates */ |
1403 | 1403 | $give_updates = Give_Updates::get_instance(); |
1404 | 1404 | |
1405 | 1405 | global $wp_roles; |
1406 | 1406 | |
1407 | - if( ! ( $wp_roles instanceof WP_Roles ) ) { |
|
1407 | + if ( ! ($wp_roles instanceof WP_Roles)) { |
|
1408 | 1408 | return; |
1409 | 1409 | } |
1410 | 1410 | |
@@ -1422,9 +1422,9 @@ discard block |
||
1422 | 1422 | ), |
1423 | 1423 | ); |
1424 | 1424 | |
1425 | - foreach ( $remove_caps as $role => $caps ) { |
|
1426 | - foreach( $caps as $cap ) { |
|
1427 | - $wp_roles->remove_cap( $role, $cap ); |
|
1425 | + foreach ($remove_caps as $role => $caps) { |
|
1426 | + foreach ($caps as $cap) { |
|
1427 | + $wp_roles->remove_cap($role, $cap); |
|
1428 | 1428 | } |
1429 | 1429 | } |
1430 | 1430 | |
@@ -1435,6 +1435,6 @@ discard block |
||
1435 | 1435 | $roles->add_roles(); |
1436 | 1436 | $roles->add_caps(); |
1437 | 1437 | |
1438 | - give_set_upgrade_complete( 'v1818_give_worker_role_cleanup' ); |
|
1438 | + give_set_upgrade_complete('v1818_give_worker_role_cleanup'); |
|
1439 | 1439 | |
1440 | 1440 | } |
1441 | 1441 | \ No newline at end of file |
@@ -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 | |
@@ -32,17 +32,17 @@ discard block |
||
32 | 32 | global $give_settings_page, $give_payments_page, $give_reports_page, $give_add_ons_page, $give_donors_page, $give_tools_page; |
33 | 33 | |
34 | 34 | //Payments |
35 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
36 | - $give_payments_page = add_submenu_page( 'edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page' ); |
|
35 | + $give_payment = get_post_type_object('give_payment'); |
|
36 | + $give_payments_page = add_submenu_page('edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page'); |
|
37 | 37 | |
38 | 38 | //Donors |
39 | - $give_donors_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Donors', 'give' ), esc_html__( 'Donors', 'give' ), 'view_give_reports', 'give-donors', 'give_donors_page' ); |
|
39 | + $give_donors_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Donors', 'give'), esc_html__('Donors', 'give'), 'view_give_reports', 'give-donors', 'give_donors_page'); |
|
40 | 40 | |
41 | 41 | //Reports` |
42 | 42 | $give_reports_page = add_submenu_page( |
43 | 43 | 'edit.php?post_type=give_forms', |
44 | - esc_html__( 'Donation Reports', 'give' ), |
|
45 | - esc_html__( 'Reports', 'give' ), |
|
44 | + esc_html__('Donation Reports', 'give'), |
|
45 | + esc_html__('Reports', 'give'), |
|
46 | 46 | 'view_give_reports', |
47 | 47 | 'give-reports', |
48 | 48 | array( |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | //Settings |
55 | 55 | $give_settings_page = add_submenu_page( |
56 | 56 | 'edit.php?post_type=give_forms', |
57 | - esc_html__( 'Give Settings', 'give' ), |
|
58 | - esc_html__( 'Settings', 'give' ), |
|
57 | + esc_html__('Give Settings', 'give'), |
|
58 | + esc_html__('Settings', 'give'), |
|
59 | 59 | 'manage_give_settings', |
60 | 60 | 'give-settings', |
61 | 61 | array( |
@@ -65,16 +65,16 @@ discard block |
||
65 | 65 | ); |
66 | 66 | |
67 | 67 | //Tools. |
68 | - $give_tools_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Tools', 'give' ), esc_html__( 'Tools', 'give' ), 'manage_give_settings', 'give-tools', array( |
|
68 | + $give_tools_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Tools', 'give'), esc_html__('Tools', 'give'), 'manage_give_settings', 'give-tools', array( |
|
69 | 69 | Give()->give_settings, |
70 | 70 | 'output' |
71 | - ) ); |
|
71 | + )); |
|
72 | 72 | |
73 | 73 | //Add-ons |
74 | - $give_add_ons_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Add-ons', 'give' ), esc_html__( 'Add-ons', 'give' ), 'install_plugins', 'give-addons', 'give_add_ons_page' ); |
|
74 | + $give_add_ons_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Add-ons', 'give'), esc_html__('Add-ons', 'give'), 'install_plugins', 'give-addons', 'give_add_ons_page'); |
|
75 | 75 | } |
76 | 76 | |
77 | -add_action( 'admin_menu', 'give_add_options_links', 10 ); |
|
77 | +add_action('admin_menu', 'give_add_options_links', 10); |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * Determines whether the current admin page is a Give admin page. |
@@ -89,224 +89,224 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @return bool True if Give admin page. |
91 | 91 | */ |
92 | -function give_is_admin_page( $passed_page = '', $passed_view = '' ) { |
|
92 | +function give_is_admin_page($passed_page = '', $passed_view = '') { |
|
93 | 93 | |
94 | 94 | global $pagenow, $typenow; |
95 | 95 | |
96 | 96 | $found = false; |
97 | - $post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false; |
|
98 | - $action = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false; |
|
99 | - $taxonomy = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false; |
|
100 | - $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false; |
|
101 | - $view = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false; |
|
102 | - $tab = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false; |
|
103 | - |
|
104 | - switch ( $passed_page ) { |
|
97 | + $post_type = isset($_GET['post_type']) ? strtolower($_GET['post_type']) : false; |
|
98 | + $action = isset($_GET['action']) ? strtolower($_GET['action']) : false; |
|
99 | + $taxonomy = isset($_GET['taxonomy']) ? strtolower($_GET['taxonomy']) : false; |
|
100 | + $page = isset($_GET['page']) ? strtolower($_GET['page']) : false; |
|
101 | + $view = isset($_GET['view']) ? strtolower($_GET['view']) : false; |
|
102 | + $tab = isset($_GET['tab']) ? strtolower($_GET['tab']) : false; |
|
103 | + |
|
104 | + switch ($passed_page) { |
|
105 | 105 | case 'give_forms': |
106 | - switch ( $passed_view ) { |
|
106 | + switch ($passed_view) { |
|
107 | 107 | case 'list-table': |
108 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' ) { |
|
108 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php') { |
|
109 | 109 | $found = true; |
110 | 110 | } |
111 | 111 | break; |
112 | 112 | case 'edit': |
113 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post.php' ) { |
|
113 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post.php') { |
|
114 | 114 | $found = true; |
115 | 115 | } |
116 | 116 | break; |
117 | 117 | case 'new': |
118 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post-new.php' ) { |
|
118 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post-new.php') { |
|
119 | 119 | $found = true; |
120 | 120 | } |
121 | 121 | break; |
122 | 122 | default: |
123 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) || 'give_forms' === $post_type || ( 'post-new.php' == $pagenow && 'give_forms' === $post_type ) ) { |
|
123 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) || 'give_forms' === $post_type || ('post-new.php' == $pagenow && 'give_forms' === $post_type)) { |
|
124 | 124 | $found = true; |
125 | 125 | } |
126 | 126 | break; |
127 | 127 | } |
128 | 128 | break; |
129 | 129 | case 'categories': |
130 | - switch ( $passed_view ) { |
|
130 | + switch ($passed_view) { |
|
131 | 131 | case 'list-table': |
132 | 132 | case 'new': |
133 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy ) { |
|
133 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy) { |
|
134 | 134 | $found = true; |
135 | 135 | } |
136 | 136 | break; |
137 | 137 | case 'edit': |
138 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy ) { |
|
138 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy) { |
|
139 | 139 | $found = true; |
140 | 140 | } |
141 | 141 | break; |
142 | 142 | default: |
143 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy ) { |
|
143 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy) { |
|
144 | 144 | $found = true; |
145 | 145 | } |
146 | 146 | break; |
147 | 147 | } |
148 | 148 | break; |
149 | 149 | case 'tags': |
150 | - switch ( $passed_view ) { |
|
150 | + switch ($passed_view) { |
|
151 | 151 | case 'list-table': |
152 | 152 | case 'new': |
153 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy ) { |
|
153 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy) { |
|
154 | 154 | $found = true; |
155 | 155 | } |
156 | 156 | break; |
157 | 157 | case 'edit': |
158 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy ) { |
|
158 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy) { |
|
159 | 159 | $found = true; |
160 | 160 | } |
161 | 161 | break; |
162 | 162 | default: |
163 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy ) { |
|
163 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy) { |
|
164 | 164 | $found = true; |
165 | 165 | } |
166 | 166 | break; |
167 | 167 | } |
168 | 168 | break; |
169 | 169 | case 'payments': |
170 | - switch ( $passed_view ) { |
|
170 | + switch ($passed_view) { |
|
171 | 171 | case 'list-table': |
172 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view ) { |
|
172 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view) { |
|
173 | 173 | $found = true; |
174 | 174 | } |
175 | 175 | break; |
176 | 176 | case 'edit': |
177 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-payment-details' === $view ) { |
|
177 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-payment-details' === $view) { |
|
178 | 178 | $found = true; |
179 | 179 | } |
180 | 180 | break; |
181 | 181 | default: |
182 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page ) { |
|
182 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page) { |
|
183 | 183 | $found = true; |
184 | 184 | } |
185 | 185 | break; |
186 | 186 | } |
187 | 187 | break; |
188 | 188 | case 'reports': |
189 | - switch ( $passed_view ) { |
|
189 | + switch ($passed_view) { |
|
190 | 190 | // If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ] |
191 | 191 | case 'earnings': |
192 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) { |
|
192 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && ('earnings' === $view || '-1' === $view || false === $view)) { |
|
193 | 193 | $found = true; |
194 | 194 | } |
195 | 195 | break; |
196 | 196 | case 'donors': |
197 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view ) { |
|
197 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view) { |
|
198 | 198 | $found = true; |
199 | 199 | } |
200 | 200 | break; |
201 | 201 | case 'gateways': |
202 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view ) { |
|
202 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view) { |
|
203 | 203 | $found = true; |
204 | 204 | } |
205 | 205 | break; |
206 | 206 | case 'export': |
207 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view ) { |
|
207 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view) { |
|
208 | 208 | $found = true; |
209 | 209 | } |
210 | 210 | break; |
211 | 211 | case 'logs': |
212 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view ) { |
|
212 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view) { |
|
213 | 213 | $found = true; |
214 | 214 | } |
215 | 215 | break; |
216 | 216 | default: |
217 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
217 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
218 | 218 | $found = true; |
219 | 219 | } |
220 | 220 | break; |
221 | 221 | } |
222 | 222 | break; |
223 | 223 | case 'settings': |
224 | - switch ( $passed_view ) { |
|
224 | + switch ($passed_view) { |
|
225 | 225 | case 'general': |
226 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && ( 'general' === $tab || false === $tab ) ) { |
|
226 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && ('general' === $tab || false === $tab)) { |
|
227 | 227 | $found = true; |
228 | 228 | } |
229 | 229 | break; |
230 | 230 | case 'gateways': |
231 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab ) { |
|
231 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab) { |
|
232 | 232 | $found = true; |
233 | 233 | } |
234 | 234 | break; |
235 | 235 | case 'emails': |
236 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab ) { |
|
236 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab) { |
|
237 | 237 | $found = true; |
238 | 238 | } |
239 | 239 | break; |
240 | 240 | case 'display': |
241 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab ) { |
|
241 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab) { |
|
242 | 242 | $found = true; |
243 | 243 | } |
244 | 244 | break; |
245 | 245 | case 'licenses': |
246 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab ) { |
|
246 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab) { |
|
247 | 247 | $found = true; |
248 | 248 | } |
249 | 249 | break; |
250 | 250 | case 'api': |
251 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab ) { |
|
251 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab) { |
|
252 | 252 | $found = true; |
253 | 253 | } |
254 | 254 | break; |
255 | 255 | case 'advanced': |
256 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab ) { |
|
256 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab) { |
|
257 | 257 | $found = true; |
258 | 258 | } |
259 | 259 | break; |
260 | 260 | case 'system_info': |
261 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab ) { |
|
261 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab) { |
|
262 | 262 | $found = true; |
263 | 263 | } |
264 | 264 | break; |
265 | 265 | default: |
266 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page ) { |
|
266 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page) { |
|
267 | 267 | $found = true; |
268 | 268 | } |
269 | 269 | break; |
270 | 270 | } |
271 | 271 | break; |
272 | 272 | case 'addons': |
273 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-addons' === $page ) { |
|
273 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-addons' === $page) { |
|
274 | 274 | $found = true; |
275 | 275 | } |
276 | 276 | break; |
277 | 277 | case 'donors': |
278 | - switch ( $passed_view ) { |
|
278 | + switch ($passed_view) { |
|
279 | 279 | case 'list-table': |
280 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view ) { |
|
280 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view) { |
|
281 | 281 | $found = true; |
282 | 282 | } |
283 | 283 | break; |
284 | 284 | case 'overview': |
285 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view ) { |
|
285 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view) { |
|
286 | 286 | $found = true; |
287 | 287 | } |
288 | 288 | break; |
289 | 289 | case 'notes': |
290 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view ) { |
|
290 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view) { |
|
291 | 291 | $found = true; |
292 | 292 | } |
293 | 293 | break; |
294 | 294 | default: |
295 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page ) { |
|
295 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page) { |
|
296 | 296 | $found = true; |
297 | 297 | } |
298 | 298 | break; |
299 | 299 | } |
300 | 300 | break; |
301 | 301 | case 'reports': |
302 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
302 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
303 | 303 | $found = true; |
304 | 304 | } |
305 | 305 | break; |
306 | 306 | default: |
307 | 307 | global $give_payments_page, $give_settings_page, $give_reports_page, $give_system_info_page, $give_add_ons_page, $give_settings_export, $give_donors_page, $give_tools_page; |
308 | 308 | |
309 | - $admin_pages = apply_filters( 'give_admin_pages', array( |
|
309 | + $admin_pages = apply_filters('give_admin_pages', array( |
|
310 | 310 | $give_payments_page, |
311 | 311 | $give_settings_page, |
312 | 312 | $give_reports_page, |
@@ -316,16 +316,16 @@ discard block |
||
316 | 316 | $give_donors_page, |
317 | 317 | $give_tools_page, |
318 | 318 | 'widgets.php' |
319 | - ) ); |
|
320 | - if ( 'give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) { |
|
319 | + )); |
|
320 | + if ('give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow) { |
|
321 | 321 | $found = true; |
322 | - } elseif ( in_array( $pagenow, $admin_pages ) ) { |
|
322 | + } elseif (in_array($pagenow, $admin_pages)) { |
|
323 | 323 | $found = true; |
324 | 324 | } |
325 | 325 | break; |
326 | 326 | } |
327 | 327 | |
328 | - return (bool) apply_filters( 'give_is_admin_page', $found, $page, $view, $passed_page, $passed_view ); |
|
328 | + return (bool) apply_filters('give_is_admin_page', $found, $page, $view, $passed_page, $passed_view); |
|
329 | 329 | |
330 | 330 | } |
331 | 331 | |
@@ -337,37 +337,37 @@ discard block |
||
337 | 337 | * @param array $settings |
338 | 338 | * @return array |
339 | 339 | */ |
340 | -function give_settings_page_pages( $settings ) { |
|
341 | - include( 'abstract-admin-settings-page.php' ); |
|
342 | - include( 'settings/class-settings-cmb2-backward-compatibility.php' ); |
|
340 | +function give_settings_page_pages($settings) { |
|
341 | + include('abstract-admin-settings-page.php'); |
|
342 | + include('settings/class-settings-cmb2-backward-compatibility.php'); |
|
343 | 343 | |
344 | 344 | $settings = array( |
345 | 345 | // General settings. |
346 | - include( 'settings/class-settings-general.php' ), |
|
346 | + include('settings/class-settings-general.php'), |
|
347 | 347 | |
348 | 348 | // Payment Gateways Settings. |
349 | - include( 'settings/class-settings-gateways.php' ), |
|
349 | + include('settings/class-settings-gateways.php'), |
|
350 | 350 | |
351 | 351 | // Display settings. |
352 | - include( 'settings/class-settings-display.php' ), |
|
352 | + include('settings/class-settings-display.php'), |
|
353 | 353 | |
354 | 354 | // Emails settings. |
355 | - include( 'settings/class-settings-email.php' ), |
|
355 | + include('settings/class-settings-email.php'), |
|
356 | 356 | |
357 | 357 | // Addons settings. |
358 | - include( 'settings/class-settings-addon.php' ), |
|
358 | + include('settings/class-settings-addon.php'), |
|
359 | 359 | |
360 | 360 | // License settings. |
361 | - include( 'settings/class-settings-license.php' ), |
|
361 | + include('settings/class-settings-license.php'), |
|
362 | 362 | |
363 | 363 | // Advanced settings. |
364 | - include( 'settings/class-settings-advanced.php' ) |
|
364 | + include('settings/class-settings-advanced.php') |
|
365 | 365 | ); |
366 | 366 | |
367 | 367 | // Output. |
368 | 368 | return $settings; |
369 | 369 | } |
370 | -add_filter( 'give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1 ); |
|
370 | +add_filter('give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1); |
|
371 | 371 | |
372 | 372 | |
373 | 373 | /** |
@@ -377,25 +377,25 @@ discard block |
||
377 | 377 | * @param array $settings |
378 | 378 | * @return array |
379 | 379 | */ |
380 | -function give_reports_page_pages( $settings ) { |
|
381 | - include( 'abstract-admin-settings-page.php' ); |
|
380 | +function give_reports_page_pages($settings) { |
|
381 | + include('abstract-admin-settings-page.php'); |
|
382 | 382 | |
383 | 383 | $settings = array( |
384 | 384 | // Earnings. |
385 | - include( 'reports/class-earnings-report.php' ), |
|
385 | + include('reports/class-earnings-report.php'), |
|
386 | 386 | |
387 | 387 | // Forms. |
388 | - include( 'reports/class-forms-report.php' ), |
|
388 | + include('reports/class-forms-report.php'), |
|
389 | 389 | |
390 | 390 | // Gateways. |
391 | - include( 'reports/class-gateways-report.php' ), |
|
391 | + include('reports/class-gateways-report.php'), |
|
392 | 392 | |
393 | 393 | ); |
394 | 394 | |
395 | 395 | // Output. |
396 | 396 | return $settings; |
397 | 397 | } |
398 | -add_filter( 'give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1 ); |
|
398 | +add_filter('give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1); |
|
399 | 399 | |
400 | 400 | /** |
401 | 401 | * Add setting tab to give-settings page |
@@ -404,34 +404,34 @@ discard block |
||
404 | 404 | * @param array $settings |
405 | 405 | * @return array |
406 | 406 | */ |
407 | -function give_tools_page_pages( $settings ) { |
|
408 | - include( 'abstract-admin-settings-page.php' ); |
|
407 | +function give_tools_page_pages($settings) { |
|
408 | + include('abstract-admin-settings-page.php'); |
|
409 | 409 | |
410 | 410 | $settings = array( |
411 | 411 | // System Info. |
412 | - include( 'tools/class-settings-system-info.php' ), |
|
412 | + include('tools/class-settings-system-info.php'), |
|
413 | 413 | |
414 | 414 | // Logs. |
415 | - include( 'tools/class-settings-logs.php' ), |
|
415 | + include('tools/class-settings-logs.php'), |
|
416 | 416 | |
417 | 417 | // API. |
418 | - include( 'tools/class-settings-api.php' ), |
|
418 | + include('tools/class-settings-api.php'), |
|
419 | 419 | |
420 | 420 | // Data. |
421 | - include( 'tools/class-settings-data.php' ), |
|
421 | + include('tools/class-settings-data.php'), |
|
422 | 422 | |
423 | 423 | // Export. |
424 | - include( 'tools/class-settings-export.php' ), |
|
424 | + include('tools/class-settings-export.php'), |
|
425 | 425 | |
426 | 426 | // Import. |
427 | - include( 'tools/class-settings-import.php' ), |
|
427 | + include('tools/class-settings-import.php'), |
|
428 | 428 | |
429 | 429 | ); |
430 | 430 | |
431 | 431 | // Output. |
432 | 432 | return $settings; |
433 | 433 | } |
434 | -add_filter( 'give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1 ); |
|
434 | +add_filter('give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1); |
|
435 | 435 | |
436 | 436 | /** |
437 | 437 | * Set default tools page tab. |
@@ -440,10 +440,10 @@ discard block |
||
440 | 440 | * @param string $default_tab Default tab name. |
441 | 441 | * @return string |
442 | 442 | */ |
443 | -function give_set_default_tab_form_tools_page( $default_tab ) { |
|
443 | +function give_set_default_tab_form_tools_page($default_tab) { |
|
444 | 444 | return 'system-info'; |
445 | 445 | } |
446 | -add_filter( 'give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1 ); |
|
446 | +add_filter('give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1); |
|
447 | 447 | |
448 | 448 | |
449 | 449 | /** |
@@ -453,10 +453,10 @@ discard block |
||
453 | 453 | * @param string $default_tab Default tab name. |
454 | 454 | * @return string |
455 | 455 | */ |
456 | -function give_set_default_tab_form_reports_page( $default_tab ) { |
|
456 | +function give_set_default_tab_form_reports_page($default_tab) { |
|
457 | 457 | return 'earnings'; |
458 | 458 | } |
459 | -add_filter( 'give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1 ); |
|
459 | +add_filter('give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1); |
|
460 | 460 | |
461 | 461 | |
462 | 462 | /** |
@@ -469,19 +469,19 @@ discard block |
||
469 | 469 | * |
470 | 470 | * @return array |
471 | 471 | */ |
472 | -function give_add_display_page_states( $post_states, $post ) { |
|
472 | +function give_add_display_page_states($post_states, $post) { |
|
473 | 473 | |
474 | - switch( $post->ID ) { |
|
475 | - case give_get_option( 'success_page' ): |
|
476 | - $post_states['give_successfully_page'] = __( 'Donation Success Page', 'give' ); |
|
474 | + switch ($post->ID) { |
|
475 | + case give_get_option('success_page'): |
|
476 | + $post_states['give_successfully_page'] = __('Donation Success Page', 'give'); |
|
477 | 477 | break; |
478 | 478 | |
479 | - case give_get_option( 'failure_page' ): |
|
480 | - $post_states['give_failure_page'] = __( 'Donation Failed Page', 'give' ); |
|
479 | + case give_get_option('failure_page'): |
|
480 | + $post_states['give_failure_page'] = __('Donation Failed Page', 'give'); |
|
481 | 481 | break; |
482 | 482 | |
483 | - case give_get_option( 'history_page' ): |
|
484 | - $post_states['give_history_page'] = __( 'Donation History Page', 'give' ); |
|
483 | + case give_get_option('history_page'): |
|
484 | + $post_states['give_history_page'] = __('Donation History Page', 'give'); |
|
485 | 485 | break; |
486 | 486 | } |
487 | 487 | |
@@ -489,4 +489,4 @@ discard block |
||
489 | 489 | } |
490 | 490 | |
491 | 491 | // Add a post display state for special Give pages. |
492 | -add_filter( 'display_post_states', 'give_add_display_page_states', 10, 2 ); |
|
493 | 492 | \ No newline at end of file |
493 | +add_filter('display_post_states', 'give_add_display_page_states', 10, 2); |
|
494 | 494 | \ No newline at end of file |
@@ -673,9 +673,9 @@ |
||
673 | 673 | } |
674 | 674 | |
675 | 675 | echo ' – ' |
676 | - . sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) |
|
677 | - . ' – ' |
|
678 | - . esc_html( $plugin_data['Version'] ); |
|
676 | + . sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) |
|
677 | + . ' – ' |
|
678 | + . esc_html( $plugin_data['Version'] ); |
|
679 | 679 | ?> |
680 | 680 | </td> |
681 | 681 | </tr> |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * Admin View: System Info |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | ?> |
24 | 24 | |
25 | 25 | <div class="give-debug-report-wrapper"> |
26 | - <p class="give-debug-report-text"><?php echo sprintf(__( 'Please copy and paste this information in your ticket when contacting support:', 'give' )); ?> </p> |
|
26 | + <p class="give-debug-report-text"><?php echo sprintf(__('Please copy and paste this information in your ticket when contacting support:', 'give')); ?> </p> |
|
27 | 27 | <div class="give-debug-report-actions"> |
28 | - <a class="button-primary js-give-debug-report-button" href="#"><?php _e( 'Get System Report', 'give' ); ?></a> |
|
29 | - <a class="button-secondary docs" href="http://docs.givewp.com/settings-system-info" target="_blank"><?php _e( 'Understanding the System Report', 'give' ); ?> <span class="dashicons dashicons-external"></span></a> |
|
28 | + <a class="button-primary js-give-debug-report-button" href="#"><?php _e('Get System Report', 'give'); ?></a> |
|
29 | + <a class="button-secondary docs" href="http://docs.givewp.com/settings-system-info" target="_blank"><?php _e('Understanding the System Report', 'give'); ?> <span class="dashicons dashicons-external"></span></a> |
|
30 | 30 | </div> |
31 | 31 | <div class="give-debug-report js-give-debug-report"> |
32 | 32 | <textarea readonly="readonly"></textarea> |
@@ -36,55 +36,55 @@ discard block |
||
36 | 36 | <table class="give-status-table widefat" cellspacing="0" id="status"> |
37 | 37 | <thead> |
38 | 38 | <tr> |
39 | - <th colspan="3" data-export-label="WordPress Environment"><h2><?php _e( 'WordPress Environment', 'give' ); ?></h2></th> |
|
39 | + <th colspan="3" data-export-label="WordPress Environment"><h2><?php _e('WordPress Environment', 'give'); ?></h2></th> |
|
40 | 40 | </tr> |
41 | 41 | </thead> |
42 | 42 | <tbody> |
43 | 43 | <tr> |
44 | - <td data-export-label="Home URL"><?php _e( 'Home URL', 'give' ); ?>:</td> |
|
45 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The URL of your site\'s homepage.', 'give' ) ); ?>"></span></td> |
|
46 | - <td><?php form_option( 'home' ); ?></td> |
|
44 | + <td data-export-label="Home URL"><?php _e('Home URL', 'give'); ?>:</td> |
|
45 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The URL of your site\'s homepage.', 'give')); ?>"></span></td> |
|
46 | + <td><?php form_option('home'); ?></td> |
|
47 | 47 | </tr> |
48 | 48 | <tr> |
49 | - <td data-export-label="Site URL"><?php _e( 'Site URL', 'give' ); ?>:</td> |
|
50 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The root URL of your site.', 'give' ) ); ?>"></span></td> |
|
51 | - <td><?php form_option( 'siteurl' ); ?></td> |
|
49 | + <td data-export-label="Site URL"><?php _e('Site URL', 'give'); ?>:</td> |
|
50 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The root URL of your site.', 'give')); ?>"></span></td> |
|
51 | + <td><?php form_option('siteurl'); ?></td> |
|
52 | 52 | </tr> |
53 | 53 | <tr> |
54 | - <td data-export-label="WP Version"><?php _e( 'WP Version', 'give' ); ?>:</td> |
|
55 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The version of WordPress installed on your site.', 'give' ) ); ?>"></span></td> |
|
54 | + <td data-export-label="WP Version"><?php _e('WP Version', 'give'); ?>:</td> |
|
55 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The version of WordPress installed on your site.', 'give')); ?>"></span></td> |
|
56 | 56 | <td><?php bloginfo('version'); ?></td> |
57 | 57 | </tr> |
58 | 58 | <tr> |
59 | - <td data-export-label="WP Multisite"><?php _e( 'WP Multisite', 'give' ); ?>:</td> |
|
60 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether or not you have WordPress Multisite enabled.', 'give' ) ); ?>"></span></td> |
|
61 | - <td><?php if ( is_multisite() ) echo '<span class="dashicons dashicons-yes"></span>'; else echo '–'; ?></td> |
|
59 | + <td data-export-label="WP Multisite"><?php _e('WP Multisite', 'give'); ?>:</td> |
|
60 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether or not you have WordPress Multisite enabled.', 'give')); ?>"></span></td> |
|
61 | + <td><?php if (is_multisite()) echo '<span class="dashicons dashicons-yes"></span>'; else echo '–'; ?></td> |
|
62 | 62 | </tr> |
63 | 63 | <tr> |
64 | - <td data-export-label="WP Memory Limit"><?php _e( 'WP Memory Limit', 'give' ); ?>:</td> |
|
65 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The maximum amount of memory (RAM) that your site can use at one time.', 'give' ) ); ?>"></span></td> |
|
64 | + <td data-export-label="WP Memory Limit"><?php _e('WP Memory Limit', 'give'); ?>:</td> |
|
65 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The maximum amount of memory (RAM) that your site can use at one time.', 'give')); ?>"></span></td> |
|
66 | 66 | <td> |
67 | 67 | <?php |
68 | - $memory = give_let_to_num( WP_MEMORY_LIMIT ); |
|
68 | + $memory = give_let_to_num(WP_MEMORY_LIMIT); |
|
69 | 69 | |
70 | - if ( function_exists( 'memory_get_usage' ) ) { |
|
71 | - $system_memory = give_let_to_num( @ini_get( 'memory_limit' ) ); |
|
72 | - $memory = max( $memory, $system_memory ); |
|
70 | + if (function_exists('memory_get_usage')) { |
|
71 | + $system_memory = give_let_to_num(@ini_get('memory_limit')); |
|
72 | + $memory = max($memory, $system_memory); |
|
73 | 73 | } |
74 | 74 | |
75 | - if ( $memory < 67108864 ) { |
|
76 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend setting memory to at least 64 MB. See: %s', 'give' ), size_format( $memory ), '<a href="https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">' . __( 'Increasing memory allocated to PHP', 'give' ) . '</a>' ) . '</mark>'; |
|
75 | + if ($memory < 67108864) { |
|
76 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('%s - We recommend setting memory to at least 64 MB. See: %s', 'give'), size_format($memory), '<a href="https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">'.__('Increasing memory allocated to PHP', 'give').'</a>').'</mark>'; |
|
77 | 77 | } else { |
78 | - echo '<mark class="yes">' . size_format( $memory ) . '</mark>'; |
|
78 | + echo '<mark class="yes">'.size_format($memory).'</mark>'; |
|
79 | 79 | } |
80 | 80 | ?> |
81 | 81 | </td> |
82 | 82 | </tr> |
83 | 83 | <tr> |
84 | - <td data-export-label="WP Debug Mode"><?php _e( 'WP Debug Mode', 'give' ); ?>:</td> |
|
85 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Displays whether or not WordPress is in Debug Mode.', 'give' ) ); ?>"></span></td> |
|
84 | + <td data-export-label="WP Debug Mode"><?php _e('WP Debug Mode', 'give'); ?>:</td> |
|
85 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Displays whether or not WordPress is in Debug Mode.', 'give')); ?>"></span></td> |
|
86 | 86 | <td> |
87 | - <?php if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) : ?> |
|
87 | + <?php if (defined('WP_DEBUG') && WP_DEBUG) : ?> |
|
88 | 88 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
89 | 89 | <?php else : ?> |
90 | 90 | <mark class="no">–</mark> |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | </td> |
93 | 93 | </tr> |
94 | 94 | <tr> |
95 | - <td data-export-label="WP Cron"><?php _e( 'WP Cron', 'give' ); ?>:</td> |
|
96 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Displays whether or not WP Cron Jobs are enabled.', 'give' ) ); ?>"></span></td> |
|
95 | + <td data-export-label="WP Cron"><?php _e('WP Cron', 'give'); ?>:</td> |
|
96 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Displays whether or not WP Cron Jobs are enabled.', 'give')); ?>"></span></td> |
|
97 | 97 | <td> |
98 | - <?php if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) : ?> |
|
98 | + <?php if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON) : ?> |
|
99 | 99 | <mark class="no">–</mark> |
100 | 100 | <?php else : ?> |
101 | 101 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
@@ -103,55 +103,55 @@ discard block |
||
103 | 103 | </td> |
104 | 104 | </tr> |
105 | 105 | <tr> |
106 | - <td data-export-label="Language"><?php _e( 'Language', 'give' ); ?>:</td> |
|
107 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The current language used by WordPress. Default = English', 'give' ) ); ?>"></span></td> |
|
106 | + <td data-export-label="Language"><?php _e('Language', 'give'); ?>:</td> |
|
107 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The current language used by WordPress. Default = English', 'give')); ?>"></span></td> |
|
108 | 108 | <td><?php echo get_locale(); ?></td> |
109 | 109 | </tr> |
110 | 110 | <tr> |
111 | - <td data-export-label="Permalink Structure"><?php _e( 'Permalink Structure', 'give' ); ?>:</td> |
|
112 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The permalink structure as defined in Settings.', 'give' ) ); ?>"></span></td> |
|
113 | - <td><?php echo esc_html( get_option( 'permalink_structure', __( 'Default', 'give' ) ) ); ?></td> |
|
111 | + <td data-export-label="Permalink Structure"><?php _e('Permalink Structure', 'give'); ?>:</td> |
|
112 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The permalink structure as defined in Settings.', 'give')); ?>"></span></td> |
|
113 | + <td><?php echo esc_html(get_option('permalink_structure', __('Default', 'give'))); ?></td> |
|
114 | 114 | </tr> |
115 | 115 | <tr> |
116 | - <td data-export-label="Show on Front"><?php _e( 'Show on Front', 'give' ); ?>:</td> |
|
117 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether your front page is set to show posts or a static page.', 'give' ) ); ?>"></span></td> |
|
118 | - <td><?php echo esc_html( get_option( 'show_on_front', '–' ) ); ?></td> |
|
116 | + <td data-export-label="Show on Front"><?php _e('Show on Front', 'give'); ?>:</td> |
|
117 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether your front page is set to show posts or a static page.', 'give')); ?>"></span></td> |
|
118 | + <td><?php echo esc_html(get_option('show_on_front', '–')); ?></td> |
|
119 | 119 | </tr> |
120 | - <?php if ( 'page' === get_option( 'show_on_front' ) ) : ?> |
|
120 | + <?php if ('page' === get_option('show_on_front')) : ?> |
|
121 | 121 | <?php |
122 | - $front_page_id = absint( get_option( 'page_on_front' ) ); |
|
123 | - $blog_page_id = absint( get_option( 'page_for_posts' ) ); |
|
122 | + $front_page_id = absint(get_option('page_on_front')); |
|
123 | + $blog_page_id = absint(get_option('page_for_posts')); |
|
124 | 124 | ?> |
125 | 125 | <tr> |
126 | - <td data-export-label="Page on Front"><?php _e( 'Page on Front', 'give' ); ?>:</td> |
|
127 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The page set to display as your front page.', 'give' ) ); ?>"></span></td> |
|
128 | - <td><?php echo 0 !== $front_page_id ? esc_html( get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' ) : __( 'Unset', 'give' ); ?></td> |
|
126 | + <td data-export-label="Page on Front"><?php _e('Page on Front', 'give'); ?>:</td> |
|
127 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The page set to display as your front page.', 'give')); ?>"></span></td> |
|
128 | + <td><?php echo 0 !== $front_page_id ? esc_html(get_the_title($front_page_id).' (#'.$front_page_id.')') : __('Unset', 'give'); ?></td> |
|
129 | 129 | </tr> |
130 | 130 | <tr> |
131 | - <td data-export-label="Page for Posts"><?php _e( 'Page for Posts', 'give' ); ?>:</td> |
|
132 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The page set to display your posts.', 'give' ) ); ?>"></span></td> |
|
133 | - <td><?php echo 0 !== $blog_page_id ? esc_html( get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' ) : __( 'Unset', 'give' ); ?></td> |
|
131 | + <td data-export-label="Page for Posts"><?php _e('Page for Posts', 'give'); ?>:</td> |
|
132 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The page set to display your posts.', 'give')); ?>"></span></td> |
|
133 | + <td><?php echo 0 !== $blog_page_id ? esc_html(get_the_title($blog_page_id).' (#'.$blog_page_id.')') : __('Unset', 'give'); ?></td> |
|
134 | 134 | </tr> |
135 | - <?php endif;?> |
|
135 | + <?php endif; ?> |
|
136 | 136 | <tr> |
137 | - <td data-export-label="Table Prefix Length"><?php _e( 'Table Prefix Length', 'give' ); ?>:</td> |
|
138 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The length of the table prefix used in your WordPress database.', 'give' ) ); ?>"></span></td> |
|
139 | - <td><?php echo esc_html( strlen( $wpdb->prefix ) ); ?></td> |
|
137 | + <td data-export-label="Table Prefix Length"><?php _e('Table Prefix Length', 'give'); ?>:</td> |
|
138 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The length of the table prefix used in your WordPress database.', 'give')); ?>"></span></td> |
|
139 | + <td><?php echo esc_html(strlen($wpdb->prefix)); ?></td> |
|
140 | 140 | </tr> |
141 | 141 | <tr> |
142 | - <td data-export-label="Table Prefix Status"><?php _e( 'Table Prefix Status', 'give' ); ?>:</td> |
|
143 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The status of the table prefix used in your WordPress database.', 'give' ) ); ?>"></span></td> |
|
144 | - <td><?php echo strlen( $wpdb->prefix ) > 16 ? esc_html( 'Error: Too long', 'give' ) : esc_html( 'Acceptable', 'give' ); ?></td> |
|
142 | + <td data-export-label="Table Prefix Status"><?php _e('Table Prefix Status', 'give'); ?>:</td> |
|
143 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The status of the table prefix used in your WordPress database.', 'give')); ?>"></span></td> |
|
144 | + <td><?php echo strlen($wpdb->prefix) > 16 ? esc_html('Error: Too long', 'give') : esc_html('Acceptable', 'give'); ?></td> |
|
145 | 145 | </tr> |
146 | 146 | <tr> |
147 | - <td data-export-label="Admin AJAX"><?php _e( 'Admin AJAX', 'give' ); ?>:</td> |
|
148 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether Admin AJAX is accessible.', 'give' ) ); ?>"></span></td> |
|
149 | - <td><?php echo give_test_ajax_works() ? __( 'Accessible', 'give' ) : __( 'Inaccessible', 'give' ); ?></td> |
|
147 | + <td data-export-label="Admin AJAX"><?php _e('Admin AJAX', 'give'); ?>:</td> |
|
148 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether Admin AJAX is accessible.', 'give')); ?>"></span></td> |
|
149 | + <td><?php echo give_test_ajax_works() ? __('Accessible', 'give') : __('Inaccessible', 'give'); ?></td> |
|
150 | 150 | </tr> |
151 | 151 | <tr> |
152 | - <td data-export-label="Registered Post Statuses"><?php _e( 'Registered Post Statuses', 'give' ); ?>:</td> |
|
153 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'A list of all registered post statuses.', 'give' ) ); ?>"></span></td> |
|
154 | - <td><?php echo esc_html( implode( ', ', get_post_stati() ) ); ?></td> |
|
152 | + <td data-export-label="Registered Post Statuses"><?php _e('Registered Post Statuses', 'give'); ?>:</td> |
|
153 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('A list of all registered post statuses.', 'give')); ?>"></span></td> |
|
154 | + <td><?php echo esc_html(implode(', ', get_post_stati())); ?></td> |
|
155 | 155 | </tr> |
156 | 156 | </tbody> |
157 | 157 | </table> |
@@ -159,90 +159,90 @@ discard block |
||
159 | 159 | <table class="give-status-table widefat" cellspacing="0"> |
160 | 160 | <thead> |
161 | 161 | <tr> |
162 | - <th colspan="3" data-export-label="Server Environment"><h2><?php _e( 'Server Environment', 'give' ); ?></h2></th> |
|
162 | + <th colspan="3" data-export-label="Server Environment"><h2><?php _e('Server Environment', 'give'); ?></h2></th> |
|
163 | 163 | </tr> |
164 | 164 | </thead> |
165 | 165 | <tbody> |
166 | 166 | <tr> |
167 | - <td data-export-label="Hosting Provider"><?php _e( 'Hosting Provider', 'give' ); ?>:</td> |
|
168 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The hosting provider for this WordPress installation.', 'give' ) ); ?>"></span></td> |
|
169 | - <td><?php echo give_get_host() ? esc_html( give_get_host() ) : __( 'Unknown', 'give' ); ?></td> |
|
167 | + <td data-export-label="Hosting Provider"><?php _e('Hosting Provider', 'give'); ?>:</td> |
|
168 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The hosting provider for this WordPress installation.', 'give')); ?>"></span></td> |
|
169 | + <td><?php echo give_get_host() ? esc_html(give_get_host()) : __('Unknown', 'give'); ?></td> |
|
170 | 170 | </tr> |
171 | 171 | <tr> |
172 | - <td data-export-label="TLS Connection"><?php _e( 'TLS Connection', 'give' ); ?>:</td> |
|
173 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Most payment gateway APIs only support connections using the TLS 1.2 security protocol.', 'give' ) ); ?>"></span></td> |
|
172 | + <td data-export-label="TLS Connection"><?php _e('TLS Connection', 'give'); ?>:</td> |
|
173 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Most payment gateway APIs only support connections using the TLS 1.2 security protocol.', 'give')); ?>"></span></td> |
|
174 | 174 | <td><?php |
175 | - $tls_check = wp_remote_post( 'https://www.howsmyssl.com/a/check' ); |
|
176 | - if ( ! is_wp_error( $tls_check ) ) { |
|
177 | - $tls_check = json_decode( wp_remote_retrieve_body( $tls_check ) ); |
|
175 | + $tls_check = wp_remote_post('https://www.howsmyssl.com/a/check'); |
|
176 | + if ( ! is_wp_error($tls_check)) { |
|
177 | + $tls_check = json_decode(wp_remote_retrieve_body($tls_check)); |
|
178 | 178 | /* translators: %s: SSL connection response */ |
179 | - printf( __('Connection uses %s', 'give'), esc_html( $tls_check->tls_version )) ; |
|
179 | + printf(__('Connection uses %s', 'give'), esc_html($tls_check->tls_version)); |
|
180 | 180 | } |
181 | 181 | ?></td> |
182 | 182 | </tr> |
183 | 183 | <tr> |
184 | - <td data-export-label="TLS Connection"><?php _e( 'TLS Rating', 'give' ); ?>:</td> |
|
185 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The server\'s connection as rated by https://www.howsmyssl.com/', 'give' ) ); ?>"></span></td> |
|
186 | - <td><?php if ( ! is_wp_error( $tls_check ) ) { |
|
187 | - esc_html_e( $tls_check->rating); |
|
184 | + <td data-export-label="TLS Connection"><?php _e('TLS Rating', 'give'); ?>:</td> |
|
185 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The server\'s connection as rated by https://www.howsmyssl.com/', 'give')); ?>"></span></td> |
|
186 | + <td><?php if ( ! is_wp_error($tls_check)) { |
|
187 | + esc_html_e($tls_check->rating); |
|
188 | 188 | } ?></td> |
189 | 189 | </tr> |
190 | 190 | <tr> |
191 | - <td data-export-label="Server Info"><?php _e( 'Server Info', 'give' ); ?>:</td> |
|
192 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Information about the web server that is currently hosting your site.', 'give' ) ); ?>"></span></td> |
|
193 | - <td><?php echo esc_html( $_SERVER['SERVER_SOFTWARE'] ); ?></td> |
|
191 | + <td data-export-label="Server Info"><?php _e('Server Info', 'give'); ?>:</td> |
|
192 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Information about the web server that is currently hosting your site.', 'give')); ?>"></span></td> |
|
193 | + <td><?php echo esc_html($_SERVER['SERVER_SOFTWARE']); ?></td> |
|
194 | 194 | </tr> |
195 | 195 | <tr> |
196 | - <td data-export-label="PHP Version"><?php _e( 'PHP Version', 'give' ); ?>:</td> |
|
197 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The version of PHP installed on your hosting server.', 'give' ) ); ?>"></span></td> |
|
196 | + <td data-export-label="PHP Version"><?php _e('PHP Version', 'give'); ?>:</td> |
|
197 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The version of PHP installed on your hosting server.', 'give')); ?>"></span></td> |
|
198 | 198 | <td><?php |
199 | 199 | // Check if phpversion function exists. |
200 | - if ( function_exists( 'phpversion' ) ) { |
|
200 | + if (function_exists('phpversion')) { |
|
201 | 201 | $php_version = phpversion(); |
202 | 202 | |
203 | - if ( version_compare( $php_version, '5.6', '<' ) ) { |
|
204 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend a minimum PHP version of 5.6. See: %s', 'give' ), esc_html( $php_version ), '<a href="http://docs.givewp.com/settings-system-info" target="_blank">' . __( 'PHP Requirements in Give', 'give' ) . '</a>' ) . '</mark>'; |
|
203 | + if (version_compare($php_version, '5.6', '<')) { |
|
204 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('%s - We recommend a minimum PHP version of 5.6. See: %s', 'give'), esc_html($php_version), '<a href="http://docs.givewp.com/settings-system-info" target="_blank">'.__('PHP Requirements in Give', 'give').'</a>').'</mark>'; |
|
205 | 205 | } else { |
206 | - echo '<mark class="yes">' . esc_html( $php_version ) . '</mark>'; |
|
206 | + echo '<mark class="yes">'.esc_html($php_version).'</mark>'; |
|
207 | 207 | } |
208 | 208 | } else { |
209 | - _e( "Couldn't determine PHP version because phpversion() doesn't exist.", 'give' ); |
|
209 | + _e("Couldn't determine PHP version because phpversion() doesn't exist.", 'give'); |
|
210 | 210 | } |
211 | 211 | ?></td> |
212 | 212 | </tr> |
213 | - <?php if ( function_exists( 'ini_get' ) ) : ?> |
|
213 | + <?php if (function_exists('ini_get')) : ?> |
|
214 | 214 | <tr> |
215 | - <td data-export-label="PHP Post Max Size"><?php _e( 'PHP Post Max Size', 'give' ); ?>:</td> |
|
216 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The largest filesize that can be contained in one post.', 'give' ) ); ?>"></span></td> |
|
217 | - <td><?php echo size_format( give_let_to_num( ini_get( 'post_max_size' ) ) ); ?></td> |
|
215 | + <td data-export-label="PHP Post Max Size"><?php _e('PHP Post Max Size', 'give'); ?>:</td> |
|
216 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The largest filesize that can be contained in one post.', 'give')); ?>"></span></td> |
|
217 | + <td><?php echo size_format(give_let_to_num(ini_get('post_max_size'))); ?></td> |
|
218 | 218 | </tr> |
219 | 219 | <tr> |
220 | - <td data-export-label="PHP Time Limit"><?php _e( 'PHP Time Limit', 'give' ); ?>:</td> |
|
221 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The amount of time (in seconds) that your site will spend on a single operation before timing out (to avoid server lockups).', 'give' ) ); ?>"></span></td> |
|
222 | - <td><?php echo ini_get( 'max_execution_time' ); ?></td> |
|
220 | + <td data-export-label="PHP Time Limit"><?php _e('PHP Time Limit', 'give'); ?>:</td> |
|
221 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The amount of time (in seconds) that your site will spend on a single operation before timing out (to avoid server lockups).', 'give')); ?>"></span></td> |
|
222 | + <td><?php echo ini_get('max_execution_time'); ?></td> |
|
223 | 223 | </tr> |
224 | 224 | <tr> |
225 | - <td data-export-label="PHP Max Input Vars"><?php _e( 'PHP Max Input Vars', 'give' ); ?>:</td> |
|
226 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The maximum number of variables your server can use for a single function to avoid overloads.', 'give' ) ); ?>"></span></td> |
|
227 | - <td><?php echo ini_get( 'max_input_vars' ); ?></td> |
|
225 | + <td data-export-label="PHP Max Input Vars"><?php _e('PHP Max Input Vars', 'give'); ?>:</td> |
|
226 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The maximum number of variables your server can use for a single function to avoid overloads.', 'give')); ?>"></span></td> |
|
227 | + <td><?php echo ini_get('max_input_vars'); ?></td> |
|
228 | 228 | </tr> |
229 | 229 | <tr> |
230 | - <td data-export-label="PHP Max Upload Size"><?php _e( 'PHP Max Upload Size', 'give' ); ?>:</td> |
|
231 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The largest filesize that can be uploaded to your WordPress installation.', 'give' ) ); ?>"></span></td> |
|
232 | - <td><?php echo size_format( wp_max_upload_size() ); ?></td> |
|
230 | + <td data-export-label="PHP Max Upload Size"><?php _e('PHP Max Upload Size', 'give'); ?>:</td> |
|
231 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The largest filesize that can be uploaded to your WordPress installation.', 'give')); ?>"></span></td> |
|
232 | + <td><?php echo size_format(wp_max_upload_size()); ?></td> |
|
233 | 233 | </tr> |
234 | 234 | <tr> |
235 | - <td data-export-label="cURL Version"><?php _e( 'cURL Version', 'give' ); ?>:</td> |
|
236 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The version of cURL installed on your server.', 'give' ) ); ?>"></span></td> |
|
235 | + <td data-export-label="cURL Version"><?php _e('cURL Version', 'give'); ?>:</td> |
|
236 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The version of cURL installed on your server.', 'give')); ?>"></span></td> |
|
237 | 237 | <td> |
238 | 238 | <?php |
239 | - if ( function_exists( 'curl_version' ) ) { |
|
239 | + if (function_exists('curl_version')) { |
|
240 | 240 | $curl_version = curl_version(); |
241 | 241 | |
242 | - if ( version_compare( $curl_version['version'], '7.40', '<' ) ) { |
|
243 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend a minimum cURL version of 7.40.', 'give' ), esc_html( $curl_version['version'] . ', ' . $curl_version['ssl_version'] ) ) . '</mark>'; |
|
242 | + if (version_compare($curl_version['version'], '7.40', '<')) { |
|
243 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('%s - We recommend a minimum cURL version of 7.40.', 'give'), esc_html($curl_version['version'].', '.$curl_version['ssl_version'])).'</mark>'; |
|
244 | 244 | } else { |
245 | - echo '<mark class="yes">' . esc_html( $curl_version['version'] . ', ' . $curl_version['ssl_version'] ) . '</mark>'; |
|
245 | + echo '<mark class="yes">'.esc_html($curl_version['version'].', '.$curl_version['ssl_version']).'</mark>'; |
|
246 | 246 | } |
247 | 247 | } else { |
248 | 248 | echo '&ndash'; |
@@ -251,42 +251,42 @@ discard block |
||
251 | 251 | </td> |
252 | 252 | </tr> |
253 | 253 | <tr> |
254 | - <td data-export-label="SUHOSIN Installed"><?php _e( 'SUHOSIN Installed', 'give' ); ?>:</td> |
|
255 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Suhosin is an advanced protection system for PHP installations. It was designed to protect your servers on the one hand against a number of well known problems in PHP applications and on the other hand against potential unknown vulnerabilities within these applications or the PHP core itself. If enabled on your server, Suhosin may need to be configured to increase its data submission limits.', 'give' ) ); ?>"></span></td> |
|
256 | - <td><?php echo extension_loaded( 'suhosin' ) ? '<span class="dashicons dashicons-yes"></span>' : '–'; ?></td> |
|
254 | + <td data-export-label="SUHOSIN Installed"><?php _e('SUHOSIN Installed', 'give'); ?>:</td> |
|
255 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Suhosin is an advanced protection system for PHP installations. It was designed to protect your servers on the one hand against a number of well known problems in PHP applications and on the other hand against potential unknown vulnerabilities within these applications or the PHP core itself. If enabled on your server, Suhosin may need to be configured to increase its data submission limits.', 'give')); ?>"></span></td> |
|
256 | + <td><?php echo extension_loaded('suhosin') ? '<span class="dashicons dashicons-yes"></span>' : '–'; ?></td> |
|
257 | 257 | </tr> |
258 | 258 | <?php endif; |
259 | 259 | |
260 | - if ( $wpdb->use_mysqli ) { |
|
261 | - $ver = mysqli_get_server_info( $wpdb->dbh ); |
|
260 | + if ($wpdb->use_mysqli) { |
|
261 | + $ver = mysqli_get_server_info($wpdb->dbh); |
|
262 | 262 | } else { |
263 | 263 | $ver = mysql_get_server_info(); |
264 | 264 | } |
265 | 265 | |
266 | - if ( ! empty( $wpdb->is_mysql ) && ! stristr( $ver, 'MariaDB' ) ) : ?> |
|
266 | + if ( ! empty($wpdb->is_mysql) && ! stristr($ver, 'MariaDB')) : ?> |
|
267 | 267 | <tr> |
268 | - <td data-export-label="MySQL Version"><?php _e( 'MySQL Version', 'give' ); ?>:</td> |
|
269 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The version of MySQL installed on your hosting server.', 'give' ) ); ?>"></span></td> |
|
268 | + <td data-export-label="MySQL Version"><?php _e('MySQL Version', 'give'); ?>:</td> |
|
269 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The version of MySQL installed on your hosting server.', 'give')); ?>"></span></td> |
|
270 | 270 | <td> |
271 | 271 | <?php |
272 | 272 | $mysql_version = $wpdb->db_version(); |
273 | 273 | |
274 | - if ( version_compare( $mysql_version, '5.6', '<' ) ) { |
|
275 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend a minimum MySQL version of 5.6. See: %s', 'give' ), esc_html( $mysql_version ), '<a href="https://wordpress.org/about/requirements/" target="_blank">' . __( 'WordPress Requirements', 'give' ) . '</a>' ) . '</mark>'; |
|
274 | + if (version_compare($mysql_version, '5.6', '<')) { |
|
275 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('%s - We recommend a minimum MySQL version of 5.6. See: %s', 'give'), esc_html($mysql_version), '<a href="https://wordpress.org/about/requirements/" target="_blank">'.__('WordPress Requirements', 'give').'</a>').'</mark>'; |
|
276 | 276 | } else { |
277 | - echo '<mark class="yes">' . esc_html( $mysql_version ) . '</mark>'; |
|
277 | + echo '<mark class="yes">'.esc_html($mysql_version).'</mark>'; |
|
278 | 278 | } |
279 | 279 | ?> |
280 | 280 | </td> |
281 | 281 | </tr> |
282 | 282 | <?php endif; ?> |
283 | 283 | <tr> |
284 | - <td data-export-label="Default Timezone is UTC"><?php _e( 'Default Timezone is UTC', 'give' ); ?>:</td> |
|
285 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The default timezone for your server.', 'give' ) ); ?>"></span></td> |
|
284 | + <td data-export-label="Default Timezone is UTC"><?php _e('Default Timezone is UTC', 'give'); ?>:</td> |
|
285 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The default timezone for your server.', 'give')); ?>"></span></td> |
|
286 | 286 | <td><?php |
287 | 287 | $default_timezone = date_default_timezone_get(); |
288 | - if ( 'UTC' !== $default_timezone ) { |
|
289 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Default timezone is %s - it should be UTC', 'give' ), $default_timezone ) . '</mark>'; |
|
288 | + if ('UTC' !== $default_timezone) { |
|
289 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('Default timezone is %s - it should be UTC', 'give'), $default_timezone).'</mark>'; |
|
290 | 290 | } else { |
291 | 291 | echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>'; |
292 | 292 | } ?> |
@@ -297,118 +297,118 @@ discard block |
||
297 | 297 | |
298 | 298 | // fsockopen/cURL. |
299 | 299 | $posting['fsockopen_curl']['name'] = 'fsockopen/cURL'; |
300 | - $posting['fsockopen_curl']['help'] = __( 'Payment gateways can use cURL to communicate with remote servers to authorize payments, other plugins may also use it when communicating with remote services.', 'give' ); |
|
300 | + $posting['fsockopen_curl']['help'] = __('Payment gateways can use cURL to communicate with remote servers to authorize payments, other plugins may also use it when communicating with remote services.', 'give'); |
|
301 | 301 | |
302 | - if ( function_exists( 'fsockopen' ) || function_exists( 'curl_init' ) ) { |
|
302 | + if (function_exists('fsockopen') || function_exists('curl_init')) { |
|
303 | 303 | $posting['fsockopen_curl']['success'] = true; |
304 | 304 | } else { |
305 | 305 | $posting['fsockopen_curl']['success'] = false; |
306 | - $posting['fsockopen_curl']['note'] = __( 'Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'give' ); |
|
306 | + $posting['fsockopen_curl']['note'] = __('Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'give'); |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | // SOAP. |
310 | 310 | $posting['soap_client']['name'] = 'SoapClient'; |
311 | - $posting['soap_client']['help'] = __( 'Some webservices like shipping use SOAP to get information from remote servers, for example, live shipping quotes from FedEx require SOAP to be installed.', 'give' ); |
|
311 | + $posting['soap_client']['help'] = __('Some webservices like shipping use SOAP to get information from remote servers, for example, live shipping quotes from FedEx require SOAP to be installed.', 'give'); |
|
312 | 312 | |
313 | - if ( class_exists( 'SoapClient' ) ) { |
|
313 | + if (class_exists('SoapClient')) { |
|
314 | 314 | $posting['soap_client']['success'] = true; |
315 | 315 | } else { |
316 | 316 | $posting['soap_client']['success'] = false; |
317 | - $posting['soap_client']['note'] = sprintf( __( 'Your server does not have the %s class enabled - some gateway plugins which use SOAP may not work as expected.', 'give' ), '<a href="https://php.net/manual/en/class.soapclient.php">SoapClient</a>' ); |
|
317 | + $posting['soap_client']['note'] = sprintf(__('Your server does not have the %s class enabled - some gateway plugins which use SOAP may not work as expected.', 'give'), '<a href="https://php.net/manual/en/class.soapclient.php">SoapClient</a>'); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | // DOMDocument. |
321 | 321 | $posting['dom_document']['name'] = 'DOMDocument'; |
322 | - $posting['dom_document']['help'] = __( 'HTML/Multipart emails use DOMDocument to generate inline CSS in templates.', 'give' ); |
|
322 | + $posting['dom_document']['help'] = __('HTML/Multipart emails use DOMDocument to generate inline CSS in templates.', 'give'); |
|
323 | 323 | |
324 | - if ( class_exists( 'DOMDocument' ) ) { |
|
324 | + if (class_exists('DOMDocument')) { |
|
325 | 325 | $posting['dom_document']['success'] = true; |
326 | 326 | } else { |
327 | 327 | $posting['dom_document']['success'] = false; |
328 | - $posting['dom_document']['note'] = sprintf( __( 'Your server does not have the %s class enabled - HTML/Multipart emails, and also some extensions, will not work without DOMDocument.', 'give' ), '<a href="https://php.net/manual/en/class.domdocument.php">DOMDocument</a>' ); |
|
328 | + $posting['dom_document']['note'] = sprintf(__('Your server does not have the %s class enabled - HTML/Multipart emails, and also some extensions, will not work without DOMDocument.', 'give'), '<a href="https://php.net/manual/en/class.domdocument.php">DOMDocument</a>'); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | // gzip. |
332 | 332 | $posting['gzip']['name'] = 'gzip'; |
333 | - $posting['gzip']['help'] = __( 'gzip is used for file compression and decompression.', 'give' ); |
|
333 | + $posting['gzip']['help'] = __('gzip is used for file compression and decompression.', 'give'); |
|
334 | 334 | |
335 | - if ( is_callable( 'gzopen' ) ) { |
|
335 | + if (is_callable('gzopen')) { |
|
336 | 336 | $posting['gzip']['success'] = true; |
337 | 337 | } else { |
338 | 338 | $posting['gzip']['success'] = false; |
339 | - $posting['gzip']['note'] = sprintf( __( 'Your server does not support the %s function - this is used for file compression and decompression.', 'give' ), '<a href="https://php.net/manual/en/zlib.installation.php">gzopen</a>' ); |
|
339 | + $posting['gzip']['note'] = sprintf(__('Your server does not support the %s function - this is used for file compression and decompression.', 'give'), '<a href="https://php.net/manual/en/zlib.installation.php">gzopen</a>'); |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | // GD Graphics Library. |
343 | 343 | $posting['gd']['name'] = 'GD Graphics Library'; |
344 | - $posting['gd']['help'] = __( 'GD Graphics Library is used for dynamically manipulating images.', 'give' ); |
|
345 | - $posting['gd']['success'] = extension_loaded( 'gd' ) && function_exists( 'gd_info' ) ? true : false; |
|
344 | + $posting['gd']['help'] = __('GD Graphics Library is used for dynamically manipulating images.', 'give'); |
|
345 | + $posting['gd']['success'] = extension_loaded('gd') && function_exists('gd_info') ? true : false; |
|
346 | 346 | |
347 | 347 | // Multibyte String. |
348 | 348 | $posting['mbstring']['name'] = 'Multibyte String'; |
349 | - $posting['mbstring']['help'] = __( 'Multibyte String (mbstring) is used to convert character encoding, like for emails or converting characters to lowercase.', 'give' ); |
|
349 | + $posting['mbstring']['help'] = __('Multibyte String (mbstring) is used to convert character encoding, like for emails or converting characters to lowercase.', 'give'); |
|
350 | 350 | |
351 | - if ( extension_loaded( 'mbstring' ) ) { |
|
351 | + if (extension_loaded('mbstring')) { |
|
352 | 352 | $posting['mbstring']['success'] = true; |
353 | 353 | } else { |
354 | 354 | $posting['mbstring']['success'] = false; |
355 | - $posting['mbstring']['note'] = sprintf( __( 'Your server does not support the %s functions - this is required for better character encoding. Some fallbacks will be used instead for it.', 'give' ), '<a href="https://php.net/manual/en/mbstring.installation.php">mbstring</a>' ); |
|
355 | + $posting['mbstring']['note'] = sprintf(__('Your server does not support the %s functions - this is required for better character encoding. Some fallbacks will be used instead for it.', 'give'), '<a href="https://php.net/manual/en/mbstring.installation.php">mbstring</a>'); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | // WP Remote Post Check. |
359 | - $posting['wp_remote_post']['name'] = __( 'Remote Post', 'give'); |
|
360 | - $posting['wp_remote_post']['help'] = __( 'PayPal uses this method of communicating when sending back transaction information.', 'give' ); |
|
359 | + $posting['wp_remote_post']['name'] = __('Remote Post', 'give'); |
|
360 | + $posting['wp_remote_post']['help'] = __('PayPal uses this method of communicating when sending back transaction information.', 'give'); |
|
361 | 361 | |
362 | - $response = wp_safe_remote_post( 'https://www.paypal.com/cgi-bin/webscr', array( |
|
362 | + $response = wp_safe_remote_post('https://www.paypal.com/cgi-bin/webscr', array( |
|
363 | 363 | 'timeout' => 60, |
364 | - 'user-agent' => 'Give/' . GIVE_VERSION, |
|
364 | + 'user-agent' => 'Give/'.GIVE_VERSION, |
|
365 | 365 | 'httpversion' => '1.1', |
366 | 366 | 'body' => array( |
367 | 367 | 'cmd' => '_notify-validate' |
368 | 368 | ) |
369 | - ) ); |
|
369 | + )); |
|
370 | 370 | |
371 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
371 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
372 | 372 | $posting['wp_remote_post']['success'] = true; |
373 | 373 | } else { |
374 | - $posting['wp_remote_post']['note'] = __( 'wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider.', 'give' ); |
|
375 | - if ( is_wp_error( $response ) ) { |
|
376 | - $posting['wp_remote_post']['note'] .= ' ' . sprintf( __( 'Error: %s', 'give' ), sanitize_text_field( $response->get_error_message() ) ); |
|
374 | + $posting['wp_remote_post']['note'] = __('wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider.', 'give'); |
|
375 | + if (is_wp_error($response)) { |
|
376 | + $posting['wp_remote_post']['note'] .= ' '.sprintf(__('Error: %s', 'give'), sanitize_text_field($response->get_error_message())); |
|
377 | 377 | } else { |
378 | - $posting['wp_remote_post']['note'] .= ' ' . sprintf( __( 'Status code: %s', 'give' ), sanitize_text_field( $response['response']['code'] ) ); |
|
378 | + $posting['wp_remote_post']['note'] .= ' '.sprintf(__('Status code: %s', 'give'), sanitize_text_field($response['response']['code'])); |
|
379 | 379 | } |
380 | 380 | $posting['wp_remote_post']['success'] = false; |
381 | 381 | } |
382 | 382 | |
383 | 383 | // WP Remote Get Check. |
384 | - $posting['wp_remote_get']['name'] = __( 'Remote Get', 'give'); |
|
385 | - $posting['wp_remote_get']['help'] = __( 'Give plugins may use this method of communication when checking for plugin updates.', 'give' ); |
|
384 | + $posting['wp_remote_get']['name'] = __('Remote Get', 'give'); |
|
385 | + $posting['wp_remote_get']['help'] = __('Give plugins may use this method of communication when checking for plugin updates.', 'give'); |
|
386 | 386 | |
387 | - $response = wp_safe_remote_get( 'https://woocommerce.com/wc-api/product-key-api?request=ping&network=' . ( is_multisite() ? '1' : '0' ) ); |
|
387 | + $response = wp_safe_remote_get('https://woocommerce.com/wc-api/product-key-api?request=ping&network='.(is_multisite() ? '1' : '0')); |
|
388 | 388 | |
389 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
389 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
390 | 390 | $posting['wp_remote_get']['success'] = true; |
391 | 391 | } else { |
392 | - $posting['wp_remote_get']['note'] = __( 'wp_remote_get() failed. The Give plugin updater won\'t work with your server. Contact your hosting provider.', 'give' ); |
|
393 | - if ( is_wp_error( $response ) ) { |
|
394 | - $posting['wp_remote_get']['note'] .= ' ' . sprintf( __( 'Error: %s', 'give' ), give_clean( $response->get_error_message() ) ); |
|
392 | + $posting['wp_remote_get']['note'] = __('wp_remote_get() failed. The Give plugin updater won\'t work with your server. Contact your hosting provider.', 'give'); |
|
393 | + if (is_wp_error($response)) { |
|
394 | + $posting['wp_remote_get']['note'] .= ' '.sprintf(__('Error: %s', 'give'), give_clean($response->get_error_message())); |
|
395 | 395 | } else { |
396 | - $posting['wp_remote_get']['note'] .= ' ' . sprintf( __( 'Status code: %s', 'give' ), give_clean( $response['response']['code'] ) ); |
|
396 | + $posting['wp_remote_get']['note'] .= ' '.sprintf(__('Status code: %s', 'give'), give_clean($response['response']['code'])); |
|
397 | 397 | } |
398 | 398 | $posting['wp_remote_get']['success'] = false; |
399 | 399 | } |
400 | 400 | |
401 | - $posting = apply_filters( 'give_debug_posting', $posting ); |
|
401 | + $posting = apply_filters('give_debug_posting', $posting); |
|
402 | 402 | |
403 | - foreach ( $posting as $post ) { |
|
404 | - $mark = ! empty( $post['success'] ) ? 'yes' : 'error'; |
|
403 | + foreach ($posting as $post) { |
|
404 | + $mark = ! empty($post['success']) ? 'yes' : 'error'; |
|
405 | 405 | ?> |
406 | 406 | <tr> |
407 | - <td data-export-label="<?php echo esc_html( $post['name'] ); ?>"><?php echo esc_html( $post['name'] ); ?>:</td> |
|
408 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( isset( $post['help'] ) ? $post['help'] : '' ); ?>"></span></td> |
|
407 | + <td data-export-label="<?php echo esc_html($post['name']); ?>"><?php echo esc_html($post['name']); ?>:</td> |
|
408 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(isset($post['help']) ? $post['help'] : ''); ?>"></span></td> |
|
409 | 409 | <td> |
410 | 410 | <mark class="<?php echo $mark; ?>"> |
411 | - <?php echo ! empty( $post['success'] ) ? '<span class="dashicons dashicons-yes"></span>' : '<span class="dashicons dashicons-no-alt"></span>'; ?> <?php echo ! empty( $post['note'] ) ? wp_kses_data( $post['note'] ) : ''; ?> |
|
411 | + <?php echo ! empty($post['success']) ? '<span class="dashicons dashicons-yes"></span>' : '<span class="dashicons dashicons-no-alt"></span>'; ?> <?php echo ! empty($post['note']) ? wp_kses_data($post['note']) : ''; ?> |
|
412 | 412 | </mark> |
413 | 413 | </td> |
414 | 414 | </tr> |
@@ -421,36 +421,36 @@ discard block |
||
421 | 421 | <table class="give-status-table widefat" cellspacing="0"> |
422 | 422 | <thead> |
423 | 423 | <tr> |
424 | - <th colspan="3" data-export-label="Give Configuration"><h2><?php _e( 'Give Configuration', 'give' ); ?></h2></th> |
|
424 | + <th colspan="3" data-export-label="Give Configuration"><h2><?php _e('Give Configuration', 'give'); ?></h2></th> |
|
425 | 425 | </tr> |
426 | 426 | </thead> |
427 | 427 | <tbody> |
428 | 428 | <tr> |
429 | - <td data-export-label="Give Version"><?php _e( 'Give Version', 'give' ); ?>:</td> |
|
430 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The version of Give installed on your site.', 'give' ) ); ?>"></span></td> |
|
431 | - <td><?php echo esc_html( GIVE_VERSION ); ?></td> |
|
429 | + <td data-export-label="Give Version"><?php _e('Give Version', 'give'); ?>:</td> |
|
430 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The version of Give installed on your site.', 'give')); ?>"></span></td> |
|
431 | + <td><?php echo esc_html(GIVE_VERSION); ?></td> |
|
432 | 432 | </tr> |
433 | 433 | <tr> |
434 | - <td data-export-label="Database Updates"><?php _e( 'Database Updates', 'give' ); ?>:</td> |
|
435 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e( 'This will show the number of pending database updates.', 'give' ); ?>"></span></td> |
|
434 | + <td data-export-label="Database Updates"><?php _e('Database Updates', 'give'); ?>:</td> |
|
435 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php _e('This will show the number of pending database updates.', 'give'); ?>"></span></td> |
|
436 | 436 | <td> |
437 | 437 | <?php |
438 | - $updates_text = __( 'All DB Updates Completed.', 'give' ); |
|
438 | + $updates_text = __('All DB Updates Completed.', 'give'); |
|
439 | 439 | $pending_updates = $give_updates->get_db_update_count(); |
440 | 440 | $total_updates = $give_updates->get_total_db_update_count(); |
441 | 441 | |
442 | - if( $pending_updates === $total_updates ) { |
|
442 | + if ($pending_updates === $total_updates) { |
|
443 | 443 | |
444 | 444 | // When all the db updates are pending. |
445 | 445 | $updates_text = sprintf( |
446 | - __( '%1$s updates still need to run.', 'give' ), |
|
446 | + __('%1$s updates still need to run.', 'give'), |
|
447 | 447 | $total_updates |
448 | 448 | ); |
449 | - } elseif( $pending_updates > 0 ) { |
|
449 | + } elseif ($pending_updates > 0) { |
|
450 | 450 | |
451 | 451 | // When some of the db updates are completed and some are pending. |
452 | 452 | $updates_text = sprintf( |
453 | - __( '%1$s of %2$s updates still need to run.', 'give' ), |
|
453 | + __('%1$s of %2$s updates still need to run.', 'give'), |
|
454 | 454 | $pending_updates, |
455 | 455 | $total_updates |
456 | 456 | ); |
@@ -461,112 +461,112 @@ discard block |
||
461 | 461 | </td> |
462 | 462 | </tr> |
463 | 463 | <tr> |
464 | - <td data-export-label="Upgraded From"><?php _e( 'Upgraded From', 'give' ); ?>:</td> |
|
465 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The version of Give installed prior to the last update.', 'give' ) ); ?>"></span></td> |
|
466 | - <td><?php echo esc_html( get_option( 'give_version_upgraded_from', '–' ) ); ?></td> |
|
464 | + <td data-export-label="Upgraded From"><?php _e('Upgraded From', 'give'); ?>:</td> |
|
465 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The version of Give installed prior to the last update.', 'give')); ?>"></span></td> |
|
466 | + <td><?php echo esc_html(get_option('give_version_upgraded_from', '–')); ?></td> |
|
467 | 467 | </tr> |
468 | 468 | <tr> |
469 | - <td data-export-label="Test Mode"><?php _e( 'Test Mode', 'give' ); ?>:</td> |
|
470 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether Test Mode is enabled in Give settings.', 'give' ) ); ?>"></span></td> |
|
471 | - <td><?php echo give_is_test_mode() ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
469 | + <td data-export-label="Test Mode"><?php _e('Test Mode', 'give'); ?>:</td> |
|
470 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether Test Mode is enabled in Give settings.', 'give')); ?>"></span></td> |
|
471 | + <td><?php echo give_is_test_mode() ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
472 | 472 | </tr> |
473 | 473 | <tr> |
474 | - <td data-export-label="Currency Code"><?php _e( 'Currency Code', 'give' ); ?>:</td> |
|
475 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The currency code selected in Give settings.', 'give' ) ); ?>"></span></td> |
|
476 | - <td><?php echo esc_html( give_get_currency() ); ?></td> |
|
474 | + <td data-export-label="Currency Code"><?php _e('Currency Code', 'give'); ?>:</td> |
|
475 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The currency code selected in Give settings.', 'give')); ?>"></span></td> |
|
476 | + <td><?php echo esc_html(give_get_currency()); ?></td> |
|
477 | 477 | </tr> |
478 | 478 | <tr> |
479 | - <td data-export-label="Currency Position"><?php _e( 'Currency Position', 'give' ); ?>:</td> |
|
480 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The currency position selected in Give settings.', 'give' ) ); ?>"></span></td> |
|
481 | - <td><?php echo 'before' === give_get_option( 'currency_position' ) ? __( 'Before', 'give' ) : __( 'After', 'give' ); ?></td> |
|
479 | + <td data-export-label="Currency Position"><?php _e('Currency Position', 'give'); ?>:</td> |
|
480 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The currency position selected in Give settings.', 'give')); ?>"></span></td> |
|
481 | + <td><?php echo 'before' === give_get_option('currency_position') ? __('Before', 'give') : __('After', 'give'); ?></td> |
|
482 | 482 | </tr> |
483 | 483 | <tr> |
484 | - <td data-export-label="Decimal Separator"><?php _e( 'Decimal Separator', 'give' ); ?>:</td> |
|
485 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The decimal separator defined in Give settings.', 'give' ) ); ?>"></span></td> |
|
486 | - <td><?php echo esc_html( give_get_price_decimal_separator() ); ?></td> |
|
484 | + <td data-export-label="Decimal Separator"><?php _e('Decimal Separator', 'give'); ?>:</td> |
|
485 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The decimal separator defined in Give settings.', 'give')); ?>"></span></td> |
|
486 | + <td><?php echo esc_html(give_get_price_decimal_separator()); ?></td> |
|
487 | 487 | </tr> |
488 | 488 | <tr> |
489 | - <td data-export-label="Thousands Separator"><?php _e( 'Thousands Separator', 'give' ); ?>:</td> |
|
490 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The thousands separator defined in Give settings.', 'give' ) ); ?>"></span></td> |
|
491 | - <td><?php echo esc_html( give_get_price_thousand_separator() ); ?></td> |
|
489 | + <td data-export-label="Thousands Separator"><?php _e('Thousands Separator', 'give'); ?>:</td> |
|
490 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The thousands separator defined in Give settings.', 'give')); ?>"></span></td> |
|
491 | + <td><?php echo esc_html(give_get_price_thousand_separator()); ?></td> |
|
492 | 492 | </tr> |
493 | 493 | <tr> |
494 | - <td data-export-label="Success Page"><?php _e( 'Success Page', 'give' ); ?>:</td> |
|
495 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The page where donors land following a successful transaction.', 'give' ) ); ?>"></span></td> |
|
496 | - <td><?php echo ! empty( $give_options['success_page'] ) ? esc_url( get_permalink( $give_options['success_page'] ) ) : '–'; ?></td> |
|
494 | + <td data-export-label="Success Page"><?php _e('Success Page', 'give'); ?>:</td> |
|
495 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The page where donors land following a successful transaction.', 'give')); ?>"></span></td> |
|
496 | + <td><?php echo ! empty($give_options['success_page']) ? esc_url(get_permalink($give_options['success_page'])) : '–'; ?></td> |
|
497 | 497 | </tr> |
498 | 498 | <tr> |
499 | - <td data-export-label="Failure Page"><?php _e( 'Failure Page', 'give' ); ?>:</td> |
|
500 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The page where donors land following a failed transaction.', 'give' ) ); ?>"></span></td> |
|
501 | - <td><?php echo ! empty( $give_options['failure_page'] ) ? esc_url( get_permalink( $give_options['failure_page'] ) ) : '–'; ?></td> |
|
499 | + <td data-export-label="Failure Page"><?php _e('Failure Page', 'give'); ?>:</td> |
|
500 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The page where donors land following a failed transaction.', 'give')); ?>"></span></td> |
|
501 | + <td><?php echo ! empty($give_options['failure_page']) ? esc_url(get_permalink($give_options['failure_page'])) : '–'; ?></td> |
|
502 | 502 | </tr> |
503 | 503 | <tr> |
504 | - <td data-export-label="Donation History Page"><?php _e( 'Donation History Page', 'give' ); ?>:</td> |
|
505 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The page where past donations are listed.', 'give' ) ); ?>"></span></td> |
|
506 | - <td><?php echo ! empty( $give_options['history_page'] ) ? esc_url( get_permalink( $give_options['history_page'] ) ) : '–'; ?></td> |
|
504 | + <td data-export-label="Donation History Page"><?php _e('Donation History Page', 'give'); ?>:</td> |
|
505 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The page where past donations are listed.', 'give')); ?>"></span></td> |
|
506 | + <td><?php echo ! empty($give_options['history_page']) ? esc_url(get_permalink($give_options['history_page'])) : '–'; ?></td> |
|
507 | 507 | </tr> |
508 | 508 | <tr> |
509 | - <td data-export-label="Give Forms Slug"><?php _e( 'Give Forms Slug', 'give' ); ?>:</td> |
|
510 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The slug used for Give donation forms.', 'give' ) ); ?>"></span></td> |
|
511 | - <td><?php echo esc_html( defined( 'GIVE_SLUG' ) ? '/' . GIVE_SLUG . '/' : '/donations/' ); ?></td> |
|
509 | + <td data-export-label="Give Forms Slug"><?php _e('Give Forms Slug', 'give'); ?>:</td> |
|
510 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The slug used for Give donation forms.', 'give')); ?>"></span></td> |
|
511 | + <td><?php echo esc_html(defined('GIVE_SLUG') ? '/'.GIVE_SLUG.'/' : '/donations/'); ?></td> |
|
512 | 512 | </tr> |
513 | 513 | <?php |
514 | 514 | $active_gateways = give_get_enabled_payment_gateways(); |
515 | 515 | $enabled_gateways = $default_gateway = ''; |
516 | 516 | |
517 | - if ( $active_gateways ) { |
|
518 | - $default_gateway_is_active = give_is_gateway_active( give_get_default_gateway( null ) ); |
|
517 | + if ($active_gateways) { |
|
518 | + $default_gateway_is_active = give_is_gateway_active(give_get_default_gateway(null)); |
|
519 | 519 | |
520 | - if ( $default_gateway_is_active ) { |
|
521 | - $default_gateway = give_get_default_gateway( null ); |
|
522 | - $default_gateway = $active_gateways[ $default_gateway ]['admin_label']; |
|
520 | + if ($default_gateway_is_active) { |
|
521 | + $default_gateway = give_get_default_gateway(null); |
|
522 | + $default_gateway = $active_gateways[$default_gateway]['admin_label']; |
|
523 | 523 | } else { |
524 | - $default_gateway = __( 'Test Donation', 'give' ); |
|
524 | + $default_gateway = __('Test Donation', 'give'); |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | $gateways = array(); |
528 | 528 | |
529 | - foreach ( $active_gateways as $gateway ) { |
|
529 | + foreach ($active_gateways as $gateway) { |
|
530 | 530 | $gateways[] = $gateway['admin_label']; |
531 | 531 | } |
532 | 532 | |
533 | - $enabled_gateways = implode( ', ', $gateways ); |
|
533 | + $enabled_gateways = implode(', ', $gateways); |
|
534 | 534 | } |
535 | 535 | ?> |
536 | 536 | <tr> |
537 | - <td data-export-label="Enabled Payment Gateways"><?php _e( 'Enabled Payment Gateways', 'give' ); ?>:</td> |
|
538 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'All payment gateways enabled in Give settings.', 'give' ) ); ?>"></span></td> |
|
539 | - <td><?php echo esc_html( ! empty( $enabled_gateways ) ? $enabled_gateways : '–' ); ?></td> |
|
537 | + <td data-export-label="Enabled Payment Gateways"><?php _e('Enabled Payment Gateways', 'give'); ?>:</td> |
|
538 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('All payment gateways enabled in Give settings.', 'give')); ?>"></span></td> |
|
539 | + <td><?php echo esc_html( ! empty($enabled_gateways) ? $enabled_gateways : '–'); ?></td> |
|
540 | 540 | </tr> |
541 | 541 | <tr> |
542 | - <td data-export-label="Default Payment Gateway"><?php _e( 'Default Payment Gateway', 'give' ); ?>:</td> |
|
543 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The default payment gateway selected in Give settings.', 'give' ) ); ?>"></span></td> |
|
544 | - <td><?php echo esc_html( ! empty( $default_gateway ) ? $default_gateway : '–' ); ?></td> |
|
542 | + <td data-export-label="Default Payment Gateway"><?php _e('Default Payment Gateway', 'give'); ?>:</td> |
|
543 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The default payment gateway selected in Give settings.', 'give')); ?>"></span></td> |
|
544 | + <td><?php echo esc_html( ! empty($default_gateway) ? $default_gateway : '–'); ?></td> |
|
545 | 545 | </tr> |
546 | 546 | <tr> |
547 | - <td data-export-label="PayPal IPN Verification"><?php _e( 'PayPal IPN Verification', 'give' ); ?>:</td> |
|
548 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether admins requires verification of IPN notifications with PayPal.', 'give' ) ); ?>"></span></td> |
|
549 | - <td><?php echo 'enabled' === give_get_option( 'paypal_verification' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
547 | + <td data-export-label="PayPal IPN Verification"><?php _e('PayPal IPN Verification', 'give'); ?>:</td> |
|
548 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether admins requires verification of IPN notifications with PayPal.', 'give')); ?>"></span></td> |
|
549 | + <td><?php echo 'enabled' === give_get_option('paypal_verification') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
550 | 550 | </tr> |
551 | 551 | <tr> |
552 | - <td data-export-label="PayPal IPN Notifications"><?php _e( 'PayPal IPN Notifications', 'give' ); ?>:</td> |
|
553 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Displays whether when last PayPal IPN is received with which donation or transaction.', 'give' ) ); ?>"></span></td> |
|
552 | + <td data-export-label="PayPal IPN Notifications"><?php _e('PayPal IPN Notifications', 'give'); ?>:</td> |
|
553 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Displays whether when last PayPal IPN is received with which donation or transaction.', 'give')); ?>"></span></td> |
|
554 | 554 | <td> |
555 | 555 | <?php |
556 | - $last_paypal_ipn_received = get_option( 'give_last_paypal_ipn_received' ); |
|
557 | - if( is_array( $last_paypal_ipn_received ) && count( $last_paypal_ipn_received ) > 0 ) { |
|
556 | + $last_paypal_ipn_received = get_option('give_last_paypal_ipn_received'); |
|
557 | + if (is_array($last_paypal_ipn_received) && count($last_paypal_ipn_received) > 0) { |
|
558 | 558 | $donation_id = $last_paypal_ipn_received['payment_id']; |
559 | - $ipn_timestamp = give_get_meta( $donation_id, 'give_last_paypal_ipn_received', true ); |
|
560 | - $transaction_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=' . $last_paypal_ipn_received['transaction_id']; |
|
561 | - $donation_url = site_url() . '/wp-admin/edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $donation_id; |
|
559 | + $ipn_timestamp = give_get_meta($donation_id, 'give_last_paypal_ipn_received', true); |
|
560 | + $transaction_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id='.$last_paypal_ipn_received['transaction_id']; |
|
561 | + $donation_url = site_url().'/wp-admin/edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$donation_id; |
|
562 | 562 | echo sprintf( |
563 | - __( 'IPN received for <a href="%s">#%s</a> ( <a href="%s" target="_blank">%s</a> ) on %s at %s. Status %s', 'give' ), |
|
563 | + __('IPN received for <a href="%s">#%s</a> ( <a href="%s" target="_blank">%s</a> ) on %s at %s. Status %s', 'give'), |
|
564 | 564 | $donation_url, |
565 | 565 | $donation_id, |
566 | 566 | $transaction_url, |
567 | 567 | $last_paypal_ipn_received['transaction_id'], |
568 | - date_i18n( 'm/d/Y', $ipn_timestamp ), |
|
569 | - date_i18n( 'H:i', $ipn_timestamp ), |
|
568 | + date_i18n('m/d/Y', $ipn_timestamp), |
|
569 | + date_i18n('H:i', $ipn_timestamp), |
|
570 | 570 | $last_paypal_ipn_received['auth_status'] |
571 | 571 | ); |
572 | 572 | } else { |
@@ -576,14 +576,14 @@ discard block |
||
576 | 576 | </td> |
577 | 577 | </tr> |
578 | 578 | <tr> |
579 | - <td data-export-label="Admin Email Notifications"><?php _e( 'Admin Email Notifications', 'give' ); ?>:</td> |
|
580 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether admins receive email notifications of transactions.', 'give' ) ); ?>"></span></td> |
|
581 | - <td><?php echo 'enabled' === give_get_option( 'admin_notices' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
579 | + <td data-export-label="Admin Email Notifications"><?php _e('Admin Email Notifications', 'give'); ?>:</td> |
|
580 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether admins receive email notifications of transactions.', 'give')); ?>"></span></td> |
|
581 | + <td><?php echo 'enabled' === give_get_option('admin_notices') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
582 | 582 | </tr> |
583 | 583 | <tr> |
584 | - <td data-export-label="Donor Email Access"><?php _e( 'Donor Email Access', 'give' ); ?>:</td> |
|
585 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether donors can access their donation history using only email.', 'give' ) ); ?>"></span></td> |
|
586 | - <td><?php echo 'enabled' === give_get_option( 'email_access' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
584 | + <td data-export-label="Donor Email Access"><?php _e('Donor Email Access', 'give'); ?>:</td> |
|
585 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether donors can access their donation history using only email.', 'give')); ?>"></span></td> |
|
586 | + <td><?php echo 'enabled' === give_get_option('email_access') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
587 | 587 | </tr> |
588 | 588 | </tbody> |
589 | 589 | </table> |
@@ -591,45 +591,45 @@ discard block |
||
591 | 591 | <table class="give-status-table widefat" cellspacing="0"> |
592 | 592 | <thead> |
593 | 593 | <tr> |
594 | - <th colspan="3" data-export-label="Session Configuration"><h2><?php _e( 'Session Configuration', 'give' ); ?></h2></th> |
|
594 | + <th colspan="3" data-export-label="Session Configuration"><h2><?php _e('Session Configuration', 'give'); ?></h2></th> |
|
595 | 595 | </tr> |
596 | 596 | </thead> |
597 | 597 | <tbody> |
598 | 598 | <tr> |
599 | - <td data-export-label="Give Use Sessions"><?php _e( 'Give Use Sessions', 'give' ); ?>:</td> |
|
600 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether PHP sessions are enforced, enabled, or disabled.', 'give' ) ); ?>"></span></td> |
|
601 | - <td><?php echo defined( 'GIVE_USE_PHP_SESSIONS' ) && GIVE_USE_PHP_SESSIONS ? __( 'Enforced', 'give' ) : ( Give()->session->use_php_sessions() ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ) ); ?></td> |
|
599 | + <td data-export-label="Give Use Sessions"><?php _e('Give Use Sessions', 'give'); ?>:</td> |
|
600 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether PHP sessions are enforced, enabled, or disabled.', 'give')); ?>"></span></td> |
|
601 | + <td><?php echo defined('GIVE_USE_PHP_SESSIONS') && GIVE_USE_PHP_SESSIONS ? __('Enforced', 'give') : (Give()->session->use_php_sessions() ? __('Enabled', 'give') : __('Disabled', 'give')); ?></td> |
|
602 | 602 | </tr> |
603 | 603 | <tr> |
604 | - <td data-export-label="Session"><?php _e( 'Session', 'give' ); ?>:</td> |
|
605 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether a PHP session is currently set.', 'give' ) ); ?>"></span></td> |
|
606 | - <td><?php echo isset( $_SESSION ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
604 | + <td data-export-label="Session"><?php _e('Session', 'give'); ?>:</td> |
|
605 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether a PHP session is currently set.', 'give')); ?>"></span></td> |
|
606 | + <td><?php echo isset($_SESSION) ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
607 | 607 | </tr> |
608 | - <?php if ( isset( $_SESSION ) ) { ?> |
|
608 | + <?php if (isset($_SESSION)) { ?> |
|
609 | 609 | <tr> |
610 | - <td data-export-label="Session Name"><?php _e( 'Session Name', 'give' ); ?>:</td> |
|
611 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The name of the current PHP session.', 'give' ) ); ?>"></span></td> |
|
612 | - <td><?php echo esc_html( ini_get( 'session.name' ) ); ?></td> |
|
610 | + <td data-export-label="Session Name"><?php _e('Session Name', 'give'); ?>:</td> |
|
611 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The name of the current PHP session.', 'give')); ?>"></span></td> |
|
612 | + <td><?php echo esc_html(ini_get('session.name')); ?></td> |
|
613 | 613 | </tr> |
614 | 614 | <tr> |
615 | - <td data-export-label="Cookie Path"><?php _e( 'Cookie Path', 'give' ); ?>:</td> |
|
616 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The cookie path of the current PHP session.', 'give' ) ); ?>"></span></td> |
|
617 | - <td><?php echo esc_html( ini_get( 'session.cookie_path' ) ); ?></td> |
|
615 | + <td data-export-label="Cookie Path"><?php _e('Cookie Path', 'give'); ?>:</td> |
|
616 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The cookie path of the current PHP session.', 'give')); ?>"></span></td> |
|
617 | + <td><?php echo esc_html(ini_get('session.cookie_path')); ?></td> |
|
618 | 618 | </tr> |
619 | 619 | <tr> |
620 | - <td data-export-label="Save Path"><?php _e( 'Save Path', 'give' ); ?>:</td> |
|
621 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The save path of the current PHP session.', 'give' ) ); ?>"></span></td> |
|
622 | - <td><?php echo esc_html( ini_get( 'session.save_path' ) ); ?></td> |
|
620 | + <td data-export-label="Save Path"><?php _e('Save Path', 'give'); ?>:</td> |
|
621 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The save path of the current PHP session.', 'give')); ?>"></span></td> |
|
622 | + <td><?php echo esc_html(ini_get('session.save_path')); ?></td> |
|
623 | 623 | </tr> |
624 | 624 | <tr> |
625 | - <td data-export-label="Use Cookies"><?php _e( 'Use Cookies', 'give' ); ?>:</td> |
|
626 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether the current PHP session is set to use cookies.', 'give' ) ); ?>"></span></td> |
|
627 | - <td><?php echo ini_get( 'session.use_cookies' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
625 | + <td data-export-label="Use Cookies"><?php _e('Use Cookies', 'give'); ?>:</td> |
|
626 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether the current PHP session is set to use cookies.', 'give')); ?>"></span></td> |
|
627 | + <td><?php echo ini_get('session.use_cookies') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
628 | 628 | </tr> |
629 | 629 | <tr> |
630 | - <td data-export-label="Use Only Cookies"><?php _e( 'Use Only Cookies', 'give' ); ?>:</td> |
|
631 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether the current PHP session is set to use only cookies.', 'give' ) ); ?>"></span></td> |
|
632 | - <td><?php echo ini_get( 'session.use_only_cookies' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
630 | + <td data-export-label="Use Only Cookies"><?php _e('Use Only Cookies', 'give'); ?>:</td> |
|
631 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether the current PHP session is set to use only cookies.', 'give')); ?>"></span></td> |
|
632 | + <td><?php echo ini_get('session.use_only_cookies') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
633 | 633 | </tr> |
634 | 634 | <?php } ?> |
635 | 635 | </tbody> |
@@ -638,13 +638,13 @@ discard block |
||
638 | 638 | <table class="give-status-table widefat" cellspacing="0"> |
639 | 639 | <thead> |
640 | 640 | <tr> |
641 | - <th colspan="3" data-export-label="Active Give Add-ons"><h2><?php _e( 'Active Give Add-ons', 'give' ); ?></h2></th> |
|
641 | + <th colspan="3" data-export-label="Active Give Add-ons"><h2><?php _e('Active Give Add-ons', 'give'); ?></h2></th> |
|
642 | 642 | </tr> |
643 | 643 | </thead> |
644 | 644 | <tbody> |
645 | 645 | <?php |
646 | - foreach ( $plugins as $plugin_data ) { |
|
647 | - if ( 'active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type'] ) { |
|
646 | + foreach ($plugins as $plugin_data) { |
|
647 | + if ('active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type']) { |
|
648 | 648 | continue; |
649 | 649 | } |
650 | 650 | |
@@ -652,30 +652,30 @@ discard block |
||
652 | 652 | $author_name = $plugin_data['Author']; |
653 | 653 | |
654 | 654 | // Link the plugin name to the plugin URL if available. |
655 | - if ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
656 | - $plugin_name = '<a href="' . esc_url( $plugin_data['PluginURI'] ) . '" title="' . esc_attr__( 'Visit plugin homepage' , 'give' ) . '">' . $plugin_name . '</a>'; |
|
655 | + if ( ! empty($plugin_data['PluginURI'])) { |
|
656 | + $plugin_name = '<a href="'.esc_url($plugin_data['PluginURI']).'" title="'.esc_attr__('Visit plugin homepage', 'give').'">'.$plugin_name.'</a>'; |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | // Link the author name to the author URL if available. |
660 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
661 | - $author_name = '<a href="' . esc_url( $plugin_data['AuthorURI'] ) . '" title="' . esc_attr__( 'Visit author homepage' , 'give' ) . '">' . $author_name . '</a>'; |
|
660 | + if ( ! empty($plugin_data['AuthorURI'])) { |
|
661 | + $author_name = '<a href="'.esc_url($plugin_data['AuthorURI']).'" title="'.esc_attr__('Visit author homepage', 'give').'">'.$author_name.'</a>'; |
|
662 | 662 | } |
663 | 663 | ?> |
664 | 664 | <tr> |
665 | - <td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td> |
|
665 | + <td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td> |
|
666 | 666 | <td class="help"> </td> |
667 | 667 | <td> |
668 | 668 | <?php |
669 | - if ( true === $plugin_data['License'] ) { |
|
670 | - echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark> ' . __( 'Licensed', 'give' ); |
|
669 | + if (true === $plugin_data['License']) { |
|
670 | + echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark> '.__('Licensed', 'give'); |
|
671 | 671 | } else { |
672 | - echo '<mark class="error"><span class="dashicons dashicons-no-alt"></span></mark> ' . __( 'Unlicensed', 'give' ); |
|
672 | + echo '<mark class="error"><span class="dashicons dashicons-no-alt"></span></mark> '.__('Unlicensed', 'give'); |
|
673 | 673 | } |
674 | 674 | |
675 | 675 | echo ' – ' |
676 | - . sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) |
|
676 | + . sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))) |
|
677 | 677 | . ' – ' |
678 | - . esc_html( $plugin_data['Version'] ); |
|
678 | + . esc_html($plugin_data['Version']); |
|
679 | 679 | ?> |
680 | 680 | </td> |
681 | 681 | </tr> |
@@ -688,18 +688,18 @@ discard block |
||
688 | 688 | <table class="give-status-table widefat" cellspacing="0"> |
689 | 689 | <thead> |
690 | 690 | <tr> |
691 | - <th colspan="3" data-export-label="Other Active Plugins"><h2><?php _e( 'Other Active Plugins', 'give' ); ?></h2></th> |
|
691 | + <th colspan="3" data-export-label="Other Active Plugins"><h2><?php _e('Other Active Plugins', 'give'); ?></h2></th> |
|
692 | 692 | </tr> |
693 | 693 | </thead> |
694 | 694 | <tbody> |
695 | 695 | <?php |
696 | - foreach ( $plugins as $plugin_data ) { |
|
697 | - if ( 'active' != $plugin_data['Status'] || 'other' != $plugin_data['Type'] ) { |
|
696 | + foreach ($plugins as $plugin_data) { |
|
697 | + if ('active' != $plugin_data['Status'] || 'other' != $plugin_data['Type']) { |
|
698 | 698 | continue; |
699 | 699 | } |
700 | 700 | |
701 | 701 | // Do not show Give core plugin. |
702 | - if ( 'Give - Donation Plugin' === $plugin_data['Name'] ) { |
|
702 | + if ('Give - Donation Plugin' === $plugin_data['Name']) { |
|
703 | 703 | continue; |
704 | 704 | } |
705 | 705 | |
@@ -707,19 +707,19 @@ discard block |
||
707 | 707 | $author_name = $plugin_data['Author']; |
708 | 708 | |
709 | 709 | // Link the plugin name to the plugin URL if available. |
710 | - if ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
711 | - $plugin_name = '<a href="' . esc_url( $plugin_data['PluginURI'] ) . '" title="' . esc_attr__( 'Visit plugin homepage' , 'give' ) . '">' . $plugin_name . '</a>'; |
|
710 | + if ( ! empty($plugin_data['PluginURI'])) { |
|
711 | + $plugin_name = '<a href="'.esc_url($plugin_data['PluginURI']).'" title="'.esc_attr__('Visit plugin homepage', 'give').'">'.$plugin_name.'</a>'; |
|
712 | 712 | } |
713 | 713 | |
714 | 714 | // Link the author name to the author URL if available. |
715 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
716 | - $author_name = '<a href="' . esc_url( $plugin_data['AuthorURI'] ) . '" title="' . esc_attr__( 'Visit author homepage' , 'give' ) . '">' . $author_name . '</a>'; |
|
715 | + if ( ! empty($plugin_data['AuthorURI'])) { |
|
716 | + $author_name = '<a href="'.esc_url($plugin_data['AuthorURI']).'" title="'.esc_attr__('Visit author homepage', 'give').'">'.$author_name.'</a>'; |
|
717 | 717 | } |
718 | 718 | ?> |
719 | 719 | <tr> |
720 | - <td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td> |
|
720 | + <td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td> |
|
721 | 721 | <td class="help"> </td> |
722 | - <td><?php echo sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) . ' – ' . esc_html( $plugin_data['Version'] ); ?></td> |
|
722 | + <td><?php echo sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))).' – '.esc_html($plugin_data['Version']); ?></td> |
|
723 | 723 | </tr> |
724 | 724 | <?php |
725 | 725 | } |
@@ -730,13 +730,13 @@ discard block |
||
730 | 730 | <table class="give-status-table widefat" cellspacing="0"> |
731 | 731 | <thead> |
732 | 732 | <tr> |
733 | - <th colspan="3" data-export-label="Inactive Plugins"><h2><?php _e( 'Inactive Plugins', 'give' ); ?></h2></th> |
|
733 | + <th colspan="3" data-export-label="Inactive Plugins"><h2><?php _e('Inactive Plugins', 'give'); ?></h2></th> |
|
734 | 734 | </tr> |
735 | 735 | </thead> |
736 | 736 | <tbody> |
737 | 737 | <?php |
738 | - foreach ( $plugins as $plugin_data ) { |
|
739 | - if ( 'inactive' != $plugin_data['Status'] ) { |
|
738 | + foreach ($plugins as $plugin_data) { |
|
739 | + if ('inactive' != $plugin_data['Status']) { |
|
740 | 740 | continue; |
741 | 741 | } |
742 | 742 | |
@@ -744,19 +744,19 @@ discard block |
||
744 | 744 | $author_name = $plugin_data['Author']; |
745 | 745 | |
746 | 746 | // Link the plugin name to the plugin URL if available. |
747 | - if ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
748 | - $plugin_name = '<a href="' . esc_url( $plugin_data['PluginURI'] ) . '" title="' . esc_attr__( 'Visit plugin homepage' , 'give' ) . '">' . $plugin_name . '</a>'; |
|
747 | + if ( ! empty($plugin_data['PluginURI'])) { |
|
748 | + $plugin_name = '<a href="'.esc_url($plugin_data['PluginURI']).'" title="'.esc_attr__('Visit plugin homepage', 'give').'">'.$plugin_name.'</a>'; |
|
749 | 749 | } |
750 | 750 | |
751 | 751 | // Link the author name to the author URL if available. |
752 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
753 | - $author_name = '<a href="' . esc_url( $plugin_data['AuthorURI'] ) . '" title="' . esc_attr__( 'Visit author homepage' , 'give' ) . '">' . $author_name . '</a>'; |
|
752 | + if ( ! empty($plugin_data['AuthorURI'])) { |
|
753 | + $author_name = '<a href="'.esc_url($plugin_data['AuthorURI']).'" title="'.esc_attr__('Visit author homepage', 'give').'">'.$author_name.'</a>'; |
|
754 | 754 | } |
755 | 755 | ?> |
756 | 756 | <tr> |
757 | - <td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td> |
|
757 | + <td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td> |
|
758 | 758 | <td class="help"> </td> |
759 | - <td><?php echo sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) . ' – ' . esc_html( $plugin_data['Version'] ); ?></td> |
|
759 | + <td><?php echo sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))).' – '.esc_html($plugin_data['Version']); ?></td> |
|
760 | 760 | </tr> |
761 | 761 | <?php |
762 | 762 | } |
@@ -766,37 +766,37 @@ discard block |
||
766 | 766 | |
767 | 767 | <?php |
768 | 768 | $active_mu_plugins = (array) get_mu_plugins(); |
769 | -if ( ! empty( $active_mu_plugins ) ) { |
|
769 | +if ( ! empty($active_mu_plugins)) { |
|
770 | 770 | ?> |
771 | 771 | <table class="give-status-table widefat" cellspacing="0"> |
772 | 772 | <thead> |
773 | 773 | <tr> |
774 | - <th colspan="3" data-export-label="Active MU Plugins"><h2><?php _e( 'Active MU Plugins', 'give' ); ?></h2></th> |
|
774 | + <th colspan="3" data-export-label="Active MU Plugins"><h2><?php _e('Active MU Plugins', 'give'); ?></h2></th> |
|
775 | 775 | </tr> |
776 | 776 | </thead> |
777 | 777 | <tbody> |
778 | 778 | <?php |
779 | 779 | |
780 | - foreach ( $active_mu_plugins as $mu_plugin_data ) { |
|
781 | - if ( ! empty( $mu_plugin_data['Name'] ) ) { |
|
780 | + foreach ($active_mu_plugins as $mu_plugin_data) { |
|
781 | + if ( ! empty($mu_plugin_data['Name'])) { |
|
782 | 782 | // Link the plugin name to the plugin URL if available. |
783 | - $plugin_name = esc_html( $mu_plugin_data['Name'] ); |
|
783 | + $plugin_name = esc_html($mu_plugin_data['Name']); |
|
784 | 784 | |
785 | - if ( ! empty( $mu_plugin_data['PluginURI'] ) ) { |
|
786 | - $plugin_name = '<a href="' . esc_url( $mu_plugin_data['PluginURI'] ) . '" title="' . esc_attr__( 'Visit plugin homepage' , 'give' ) . '">' . $plugin_name . '</a>'; |
|
785 | + if ( ! empty($mu_plugin_data['PluginURI'])) { |
|
786 | + $plugin_name = '<a href="'.esc_url($mu_plugin_data['PluginURI']).'" title="'.esc_attr__('Visit plugin homepage', 'give').'">'.$plugin_name.'</a>'; |
|
787 | 787 | } |
788 | 788 | |
789 | 789 | // Link the author name to the author URL if available. |
790 | - $author_name = esc_html( $mu_plugin_data['Author'] ); |
|
790 | + $author_name = esc_html($mu_plugin_data['Author']); |
|
791 | 791 | |
792 | - if ( ! empty( $mu_plugin_data['AuthorURI'] ) ) { |
|
793 | - $author_name = '<a href="' . esc_url( $mu_plugin_data['AuthorURI'] ) . '">' . $author_name . '</a>'; |
|
792 | + if ( ! empty($mu_plugin_data['AuthorURI'])) { |
|
793 | + $author_name = '<a href="'.esc_url($mu_plugin_data['AuthorURI']).'">'.$author_name.'</a>'; |
|
794 | 794 | } |
795 | 795 | ?> |
796 | 796 | <tr> |
797 | 797 | <td><?php echo $plugin_name; ?></td> |
798 | 798 | <td class="help"> </td> |
799 | - <td><?php echo sprintf( _x( 'by %s', 'by author', 'give' ), $author_name ) . ' – ' . esc_html( $mu_plugin_data['Version'] ); ?></td> |
|
799 | + <td><?php echo sprintf(_x('by %s', 'by author', 'give'), $author_name).' – '.esc_html($mu_plugin_data['Version']); ?></td> |
|
800 | 800 | </tr> |
801 | 801 | <?php |
802 | 802 | } |
@@ -809,53 +809,53 @@ discard block |
||
809 | 809 | <table class="give-status-table widefat" cellspacing="0"> |
810 | 810 | <thead> |
811 | 811 | <tr> |
812 | - <th colspan="3" data-export-label="Theme"><h2><?php _e( 'Theme', 'give' ); ?></h2></th> |
|
812 | + <th colspan="3" data-export-label="Theme"><h2><?php _e('Theme', 'give'); ?></h2></th> |
|
813 | 813 | </tr> |
814 | 814 | </thead> |
815 | 815 | <?php |
816 | - include_once( ABSPATH . 'wp-admin/includes/theme-install.php' ); |
|
816 | + include_once(ABSPATH.'wp-admin/includes/theme-install.php'); |
|
817 | 817 | $active_theme = wp_get_theme(); |
818 | 818 | ?> |
819 | 819 | <tbody> |
820 | 820 | <tr> |
821 | - <td data-export-label="Name"><?php _e( 'Name', 'give' ); ?>:</td> |
|
822 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The name of the current active theme.', 'give' ) ); ?>"></span></td> |
|
823 | - <td><?php echo esc_html( $active_theme->Name ); ?></td> |
|
821 | + <td data-export-label="Name"><?php _e('Name', 'give'); ?>:</td> |
|
822 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The name of the current active theme.', 'give')); ?>"></span></td> |
|
823 | + <td><?php echo esc_html($active_theme->Name); ?></td> |
|
824 | 824 | </tr> |
825 | 825 | <tr> |
826 | - <td data-export-label="Version"><?php _e( 'Version', 'give' ); ?>:</td> |
|
827 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The installed version of the current active theme.', 'give' ) ); ?>"></span></td> |
|
828 | - <td><?php echo esc_html( $active_theme->Version ); ?></td> |
|
826 | + <td data-export-label="Version"><?php _e('Version', 'give'); ?>:</td> |
|
827 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The installed version of the current active theme.', 'give')); ?>"></span></td> |
|
828 | + <td><?php echo esc_html($active_theme->Version); ?></td> |
|
829 | 829 | </tr> |
830 | 830 | <tr> |
831 | - <td data-export-label="Author URL"><?php _e( 'Author URL', 'give' ); ?>:</td> |
|
832 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The theme developer\'s URL.', 'give' ) ); ?>"></span></td> |
|
831 | + <td data-export-label="Author URL"><?php _e('Author URL', 'give'); ?>:</td> |
|
832 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The theme developer\'s URL.', 'give')); ?>"></span></td> |
|
833 | 833 | <td><?php echo $active_theme->{'Author URI'}; ?></td> |
834 | 834 | </tr> |
835 | 835 | <tr> |
836 | - <td data-export-label="Child Theme"><?php _e( 'Child Theme', 'give' ); ?>:</td> |
|
837 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether the current theme is a child theme.', 'give' ) ); ?>"></span></td> |
|
836 | + <td data-export-label="Child Theme"><?php _e('Child Theme', 'give'); ?>:</td> |
|
837 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether the current theme is a child theme.', 'give')); ?>"></span></td> |
|
838 | 838 | <td><?php |
839 | - echo is_child_theme() ? __( 'Yes', 'give' ) : __( 'No', 'give' ) . ' – ' . sprintf( __( 'If you\'re modifying Give on a parent theme you didn\'t build personally, then we recommend using a child theme. See: <a href="%s" target="_blank">How to Create a Child Theme</a>', 'give' ), 'https://codex.wordpress.org/Child_Themes' ); |
|
839 | + echo is_child_theme() ? __('Yes', 'give') : __('No', 'give').' – '.sprintf(__('If you\'re modifying Give on a parent theme you didn\'t build personally, then we recommend using a child theme. See: <a href="%s" target="_blank">How to Create a Child Theme</a>', 'give'), 'https://codex.wordpress.org/Child_Themes'); |
|
840 | 840 | ?></td> |
841 | 841 | </tr> |
842 | 842 | <?php |
843 | - if( is_child_theme() ) { |
|
844 | - $parent_theme = wp_get_theme( $active_theme->Template ); |
|
843 | + if (is_child_theme()) { |
|
844 | + $parent_theme = wp_get_theme($active_theme->Template); |
|
845 | 845 | ?> |
846 | 846 | <tr> |
847 | - <td data-export-label="Parent Theme Name"><?php _e( 'Parent Theme Name', 'give' ); ?>:</td> |
|
848 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The name of the parent theme.', 'give' ) ); ?>"></span></td> |
|
849 | - <td><?php echo esc_html( $parent_theme->Name ); ?></td> |
|
847 | + <td data-export-label="Parent Theme Name"><?php _e('Parent Theme Name', 'give'); ?>:</td> |
|
848 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The name of the parent theme.', 'give')); ?>"></span></td> |
|
849 | + <td><?php echo esc_html($parent_theme->Name); ?></td> |
|
850 | 850 | </tr> |
851 | 851 | <tr> |
852 | - <td data-export-label="Parent Theme Version"><?php _e( 'Parent Theme Version', 'give' ); ?>:</td> |
|
853 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The installed version of the parent theme.', 'give' ) ); ?>"></span></td> |
|
854 | - <td><?php echo esc_html( $parent_theme->Version ); ?></td> |
|
852 | + <td data-export-label="Parent Theme Version"><?php _e('Parent Theme Version', 'give'); ?>:</td> |
|
853 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The installed version of the parent theme.', 'give')); ?>"></span></td> |
|
854 | + <td><?php echo esc_html($parent_theme->Version); ?></td> |
|
855 | 855 | </tr> |
856 | 856 | <tr> |
857 | - <td data-export-label="Parent Theme Author URL"><?php _e( 'Parent Theme Author URL', 'give' ); ?>:</td> |
|
858 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The parent theme developers URL.', 'give' ) ); ?>"></span></td> |
|
857 | + <td data-export-label="Parent Theme Author URL"><?php _e('Parent Theme Author URL', 'give'); ?>:</td> |
|
858 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The parent theme developers URL.', 'give')); ?>"></span></td> |
|
859 | 859 | <td><?php echo $parent_theme->{'Author URI'}; ?></td> |
860 | 860 | </tr> |
861 | 861 | <?php } ?> |
@@ -58,7 +58,12 @@ discard block |
||
58 | 58 | <tr> |
59 | 59 | <td data-export-label="WP Multisite"><?php _e( 'WP Multisite', 'give' ); ?>:</td> |
60 | 60 | <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether or not you have WordPress Multisite enabled.', 'give' ) ); ?>"></span></td> |
61 | - <td><?php if ( is_multisite() ) echo '<span class="dashicons dashicons-yes"></span>'; else echo '–'; ?></td> |
|
61 | + <td><?php if ( is_multisite() ) { |
|
62 | + echo '<span class="dashicons dashicons-yes"></span>'; |
|
63 | +} else { |
|
64 | + echo '–'; |
|
65 | +} |
|
66 | +?></td> |
|
62 | 67 | </tr> |
63 | 68 | <tr> |
64 | 69 | <td data-export-label="WP Memory Limit"><?php _e( 'WP Memory Limit', 'give' ); ?>:</td> |
@@ -86,9 +91,12 @@ discard block |
||
86 | 91 | <td> |
87 | 92 | <?php if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) : ?> |
88 | 93 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
89 | - <?php else : ?> |
|
94 | + <?php else { |
|
95 | + : ?> |
|
90 | 96 | <mark class="no">–</mark> |
91 | - <?php endif; ?> |
|
97 | + <?php endif; |
|
98 | +} |
|
99 | +?> |
|
92 | 100 | </td> |
93 | 101 | </tr> |
94 | 102 | <tr> |
@@ -97,9 +105,12 @@ discard block |
||
97 | 105 | <td> |
98 | 106 | <?php if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) : ?> |
99 | 107 | <mark class="no">–</mark> |
100 | - <?php else : ?> |
|
108 | + <?php else { |
|
109 | + : ?> |
|
101 | 110 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
102 | - <?php endif; ?> |
|
111 | + <?php endif; |
|
112 | +} |
|
113 | +?> |
|
103 | 114 | </td> |
104 | 115 | </tr> |
105 | 116 | <tr> |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -80,108 +80,106 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function get_data() { |
82 | 82 | |
83 | - $totals = $this->get_stored_data( 'give_temp_recount_all_stats' ); |
|
84 | - $payment_items = $this->get_stored_data( 'give_temp_payment_items' ); |
|
85 | - $processed_payments = $this->get_stored_data( 'give_temp_processed_payments' ); |
|
86 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
83 | + $totals = $this->get_stored_data('give_temp_recount_all_stats'); |
|
84 | + $payment_items = $this->get_stored_data('give_temp_payment_items'); |
|
85 | + $processed_payments = $this->get_stored_data('give_temp_processed_payments'); |
|
86 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
87 | 87 | |
88 | - if ( false === $totals ) { |
|
88 | + if (false === $totals) { |
|
89 | 89 | $totals = array(); |
90 | 90 | } |
91 | 91 | |
92 | - if ( false === $payment_items ) { |
|
92 | + if (false === $payment_items) { |
|
93 | 93 | $payment_items = array(); |
94 | 94 | } |
95 | 95 | |
96 | - if ( false === $processed_payments ) { |
|
96 | + if (false === $processed_payments) { |
|
97 | 97 | $processed_payments = array(); |
98 | 98 | } |
99 | 99 | |
100 | - $all_forms = $this->get_stored_data( 'give_temp_form_ids' ); |
|
100 | + $all_forms = $this->get_stored_data('give_temp_form_ids'); |
|
101 | 101 | |
102 | - $payments = $this->get_stored_data( 'give_temp_all_payments_data' ); |
|
102 | + $payments = $this->get_stored_data('give_temp_all_payments_data'); |
|
103 | 103 | |
104 | - if ( empty( $payments ) ) { |
|
105 | - $args = apply_filters( 'give_recount_form_stats_args', array( |
|
104 | + if (empty($payments)) { |
|
105 | + $args = apply_filters('give_recount_form_stats_args', array( |
|
106 | 106 | 'give_forms' => $all_forms, |
107 | 107 | 'number' => $this->per_step, |
108 | 108 | 'status' => $accepted_statuses, |
109 | 109 | 'paged' => $this->step, |
110 | 110 | 'output' => 'give_payments', |
111 | - ) ); |
|
111 | + )); |
|
112 | 112 | |
113 | - $payments_query = new Give_Payments_Query( $args ); |
|
113 | + $payments_query = new Give_Payments_Query($args); |
|
114 | 114 | $payments = $payments_query->get_payments(); |
115 | 115 | } |
116 | 116 | |
117 | - if ( ! empty( $payments ) ) { |
|
117 | + if ( ! empty($payments)) { |
|
118 | 118 | |
119 | 119 | //Loop through payments |
120 | - foreach ( $payments as $payment ) { |
|
120 | + foreach ($payments as $payment) { |
|
121 | 121 | |
122 | - $payment_id = ( ! empty( $payment['ID'] ) ? absint( $payment['ID'] ) : ( ! empty( $payment->ID ) ? absint( $payment->ID ) : false ) ); |
|
123 | - $payment = new Give_Payment( $payment_id ); |
|
122 | + $payment_id = ( ! empty($payment['ID']) ? absint($payment['ID']) : ( ! empty($payment->ID) ? absint($payment->ID) : false)); |
|
123 | + $payment = new Give_Payment($payment_id); |
|
124 | 124 | |
125 | 125 | // Prevent payments that have all ready been retrieved from a previous sales log from counting again. |
126 | - if ( in_array( $payment->ID, $processed_payments ) ) { |
|
126 | + if (in_array($payment->ID, $processed_payments)) { |
|
127 | 127 | continue; |
128 | 128 | } |
129 | 129 | |
130 | 130 | // Verify accepted status. |
131 | - if ( ! in_array( $payment->post_status, $accepted_statuses ) ) { |
|
131 | + if ( ! in_array($payment->post_status, $accepted_statuses)) { |
|
132 | 132 | $processed_payments[] = $payment->ID; |
133 | 133 | continue; |
134 | 134 | } |
135 | 135 | |
136 | - $payment_item = $payment_items[ $payment->ID ]; |
|
136 | + $payment_item = $payment_items[$payment->ID]; |
|
137 | 137 | |
138 | - $form_id = isset( $payment_item['id'] ) ? $payment_item['id'] : ''; |
|
138 | + $form_id = isset($payment_item['id']) ? $payment_item['id'] : ''; |
|
139 | 139 | |
140 | 140 | // Must have a form ID. |
141 | - if ( empty( $form_id ) ) { |
|
141 | + if (empty($form_id)) { |
|
142 | 142 | continue; |
143 | 143 | } |
144 | 144 | |
145 | 145 | // Form ID must be within $all_forms array to be validated. |
146 | - if ( ! in_array( $form_id, $all_forms ) ) { |
|
146 | + if ( ! in_array($form_id, $all_forms)) { |
|
147 | 147 | continue; |
148 | 148 | } |
149 | 149 | |
150 | 150 | // Set Sales count |
151 | - $totals[ $form_id ]['sales'] = isset( $totals[ $form_id ]['sales'] ) ? |
|
152 | - ++ $totals[ $form_id ]['sales'] : |
|
153 | - 1; |
|
151 | + $totals[$form_id]['sales'] = isset($totals[$form_id]['sales']) ? |
|
152 | + ++$totals[$form_id]['sales'] : 1; |
|
154 | 153 | |
155 | 154 | // Set Total Earnings |
156 | - $totals[ $form_id ]['earnings'] = isset( $totals[ $form_id ]['earnings'] ) ? |
|
157 | - ( $totals[ $form_id ]['earnings'] + $payment_item['price'] ) : |
|
158 | - $payment_item['price']; |
|
155 | + $totals[$form_id]['earnings'] = isset($totals[$form_id]['earnings']) ? |
|
156 | + ($totals[$form_id]['earnings'] + $payment_item['price']) : $payment_item['price']; |
|
159 | 157 | |
160 | 158 | $processed_payments[] = $payment->ID; |
161 | 159 | } |
162 | 160 | |
163 | 161 | // Get the list of form ids which does not contain any payment record. |
164 | - $remaining_form_ids = array_diff( $all_forms, array_keys( $totals ) ); |
|
165 | - foreach ( $remaining_form_ids as $form_id ) { |
|
162 | + $remaining_form_ids = array_diff($all_forms, array_keys($totals)); |
|
163 | + foreach ($remaining_form_ids as $form_id) { |
|
166 | 164 | //If array key doesn't exist, create it |
167 | - if ( ! array_key_exists( $form_id, $totals ) ) { |
|
168 | - $totals[ $form_id ] = array( |
|
165 | + if ( ! array_key_exists($form_id, $totals)) { |
|
166 | + $totals[$form_id] = array( |
|
169 | 167 | 'sales' => (int) 0, |
170 | 168 | 'earnings' => (float) 0, |
171 | 169 | ); |
172 | 170 | } |
173 | 171 | } |
174 | 172 | |
175 | - $this->store_data( 'give_temp_processed_payments', $processed_payments ); |
|
176 | - $this->store_data( 'give_temp_recount_all_stats', $totals ); |
|
173 | + $this->store_data('give_temp_processed_payments', $processed_payments); |
|
174 | + $this->store_data('give_temp_recount_all_stats', $totals); |
|
177 | 175 | |
178 | 176 | return true; |
179 | 177 | } |
180 | 178 | |
181 | 179 | |
182 | - foreach ( $totals as $key => $stats ) { |
|
183 | - give_update_meta( $key, '_give_form_sales', $stats['sales'] ); |
|
184 | - give_update_meta( $key, '_give_form_earnings', give_sanitize_amount_for_db( $stats['earnings'] ) ); |
|
180 | + foreach ($totals as $key => $stats) { |
|
181 | + give_update_meta($key, '_give_form_sales', $stats['sales']); |
|
182 | + give_update_meta($key, '_give_form_earnings', give_sanitize_amount_for_db($stats['earnings'])); |
|
185 | 183 | } |
186 | 184 | |
187 | 185 | return false; |
@@ -196,20 +194,20 @@ discard block |
||
196 | 194 | */ |
197 | 195 | public function get_percentage_complete() { |
198 | 196 | |
199 | - $total = $this->get_stored_data( 'give_recount_all_total' ); |
|
197 | + $total = $this->get_stored_data('give_recount_all_total'); |
|
200 | 198 | |
201 | - if ( false === $total ) { |
|
199 | + if (false === $total) { |
|
202 | 200 | $this->pre_fetch(); |
203 | - $total = $this->get_stored_data( 'give_recount_all_total' ); |
|
201 | + $total = $this->get_stored_data('give_recount_all_total'); |
|
204 | 202 | } |
205 | 203 | |
206 | 204 | $percentage = 100; |
207 | 205 | |
208 | - if ( $total > 0 ) { |
|
209 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
206 | + if ($total > 0) { |
|
207 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
210 | 208 | } |
211 | 209 | |
212 | - if ( $percentage > 100 ) { |
|
210 | + if ($percentage > 100) { |
|
213 | 211 | $percentage = 100; |
214 | 212 | } |
215 | 213 | |
@@ -223,8 +221,8 @@ discard block |
||
223 | 221 | * |
224 | 222 | * @param array $request The Form Data passed into the batch processing |
225 | 223 | */ |
226 | - public function set_properties( $request ) { |
|
227 | - $this->form_id = isset( $request['form_id'] ) ? sanitize_text_field( $request['form_id'] ) : false; |
|
224 | + public function set_properties($request) { |
|
225 | + $this->form_id = isset($request['form_id']) ? sanitize_text_field($request['form_id']) : false; |
|
228 | 226 | } |
229 | 227 | |
230 | 228 | /** |
@@ -235,25 +233,25 @@ discard block |
||
235 | 233 | */ |
236 | 234 | public function process_step() { |
237 | 235 | |
238 | - if ( ! $this->can_export() ) { |
|
239 | - wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
236 | + if ( ! $this->can_export()) { |
|
237 | + wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
240 | 238 | } |
241 | 239 | |
242 | 240 | $had_data = $this->get_data(); |
243 | 241 | |
244 | - if ( $had_data ) { |
|
242 | + if ($had_data) { |
|
245 | 243 | $this->done = false; |
246 | 244 | |
247 | 245 | return true; |
248 | 246 | } else { |
249 | - $this->delete_data( 'give_recount_total_' . $this->form_id ); |
|
250 | - $this->delete_data( 'give_recount_all_total' ); |
|
251 | - $this->delete_data( 'give_temp_recount_all_stats' ); |
|
252 | - $this->delete_data( 'give_temp_payment_items' ); |
|
253 | - $this->delete_data( 'give_temp_form_ids' ); |
|
254 | - $this->delete_data( 'give_temp_processed_payments' ); |
|
247 | + $this->delete_data('give_recount_total_'.$this->form_id); |
|
248 | + $this->delete_data('give_recount_all_total'); |
|
249 | + $this->delete_data('give_temp_recount_all_stats'); |
|
250 | + $this->delete_data('give_temp_payment_items'); |
|
251 | + $this->delete_data('give_temp_form_ids'); |
|
252 | + $this->delete_data('give_temp_processed_payments'); |
|
255 | 253 | $this->done = true; |
256 | - $this->message = esc_html__( 'Donation form income amounts and donation counts stats successfully recounted.', 'give' ); |
|
254 | + $this->message = esc_html__('Donation form income amounts and donation counts stats successfully recounted.', 'give'); |
|
257 | 255 | |
258 | 256 | return false; |
259 | 257 | } |
@@ -289,70 +287,70 @@ discard block |
||
289 | 287 | */ |
290 | 288 | public function pre_fetch() { |
291 | 289 | |
292 | - if ( 1 == $this->step ) { |
|
293 | - $this->delete_data( 'give_temp_recount_all_total' ); |
|
294 | - $this->delete_data( 'give_temp_recount_all_stats' ); |
|
295 | - $this->delete_data( 'give_temp_payment_items' ); |
|
296 | - $this->delete_data( 'give_temp_processed_payments' ); |
|
297 | - $this->delete_data( 'give_temp_all_payments_data' ); |
|
290 | + if (1 == $this->step) { |
|
291 | + $this->delete_data('give_temp_recount_all_total'); |
|
292 | + $this->delete_data('give_temp_recount_all_stats'); |
|
293 | + $this->delete_data('give_temp_payment_items'); |
|
294 | + $this->delete_data('give_temp_processed_payments'); |
|
295 | + $this->delete_data('give_temp_all_payments_data'); |
|
298 | 296 | } |
299 | 297 | |
300 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
301 | - $total = $this->get_stored_data( 'give_temp_recount_all_total' ); |
|
298 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
299 | + $total = $this->get_stored_data('give_temp_recount_all_total'); |
|
302 | 300 | |
303 | - if ( false === $total ) { |
|
301 | + if (false === $total) { |
|
304 | 302 | |
305 | - $payment_items = $this->get_stored_data( 'give_temp_payment_items' ); |
|
303 | + $payment_items = $this->get_stored_data('give_temp_payment_items'); |
|
306 | 304 | |
307 | - if ( false === $payment_items ) { |
|
305 | + if (false === $payment_items) { |
|
308 | 306 | $payment_items = array(); |
309 | - $this->store_data( 'give_temp_payment_items', $payment_items ); |
|
307 | + $this->store_data('give_temp_payment_items', $payment_items); |
|
310 | 308 | } |
311 | 309 | |
312 | 310 | $args = array( |
313 | 311 | 'post_status' => 'publish', |
314 | 312 | 'post_type' => 'give_forms', |
315 | - 'posts_per_page' => - 1, |
|
313 | + 'posts_per_page' => -1, |
|
316 | 314 | 'fields' => 'ids', |
317 | 315 | ); |
318 | 316 | |
319 | - $all_forms = get_posts( $args ); |
|
317 | + $all_forms = get_posts($args); |
|
320 | 318 | |
321 | - $this->store_data( 'give_temp_form_ids', $all_forms ); |
|
319 | + $this->store_data('give_temp_form_ids', $all_forms); |
|
322 | 320 | |
323 | - $args = apply_filters( 'give_recount_form_stats_total_args', array( |
|
321 | + $args = apply_filters('give_recount_form_stats_total_args', array( |
|
324 | 322 | 'give_forms' => $all_forms, |
325 | 323 | 'number' => $this->per_step, |
326 | 324 | 'status' => $accepted_statuses, |
327 | 325 | 'page' => $this->step, |
328 | 326 | 'output' => 'payments', |
329 | - ) ); |
|
327 | + )); |
|
330 | 328 | |
331 | - $payments_query = new Give_Payments_Query( $args ); |
|
329 | + $payments_query = new Give_Payments_Query($args); |
|
332 | 330 | $payments = $payments_query->get_payments(); |
333 | 331 | |
334 | - $total = wp_count_posts( 'give_payment' )->publish; |
|
332 | + $total = wp_count_posts('give_payment')->publish; |
|
335 | 333 | |
336 | - $this->store_data( 'give_temp_all_payments_data', $payments ); |
|
334 | + $this->store_data('give_temp_all_payments_data', $payments); |
|
337 | 335 | |
338 | - if ( $payments ) { |
|
336 | + if ($payments) { |
|
339 | 337 | |
340 | - foreach ( $payments as $payment ) { |
|
338 | + foreach ($payments as $payment) { |
|
341 | 339 | |
342 | 340 | $form_id = $payment->form_id; |
343 | 341 | |
344 | 342 | //If for some reason somehow the form_ID isn't set check payment meta |
345 | - if ( empty( $payment->form_id ) ) { |
|
343 | + if (empty($payment->form_id)) { |
|
346 | 344 | $payment_meta = $payment->get_meta(); |
347 | - $form_id = isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : 0; |
|
345 | + $form_id = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : 0; |
|
348 | 346 | } |
349 | 347 | |
350 | - if ( ! in_array( $payment->post_status, $accepted_statuses ) ) { |
|
348 | + if ( ! in_array($payment->post_status, $accepted_statuses)) { |
|
351 | 349 | continue; |
352 | 350 | } |
353 | 351 | |
354 | - if ( ! array_key_exists( $payment->ID, $payment_items ) ) { |
|
355 | - $payment_items[ $payment->ID ] = array( |
|
352 | + if ( ! array_key_exists($payment->ID, $payment_items)) { |
|
353 | + $payment_items[$payment->ID] = array( |
|
356 | 354 | 'id' => $form_id, |
357 | 355 | 'payment_id' => $payment->ID, |
358 | 356 | 'price' => $payment->total, |
@@ -360,8 +358,8 @@ discard block |
||
360 | 358 | } |
361 | 359 | } |
362 | 360 | } |
363 | - $this->store_data( 'give_temp_payment_items', $payment_items ); |
|
364 | - $this->store_data( 'give_recount_all_total', $total ); |
|
361 | + $this->store_data('give_temp_payment_items', $payment_items); |
|
362 | + $this->store_data('give_recount_all_total', $total); |
|
365 | 363 | } |
366 | 364 | |
367 | 365 | } |
@@ -375,17 +373,17 @@ discard block |
||
375 | 373 | * |
376 | 374 | * @return mixed Returns the data from the database |
377 | 375 | */ |
378 | - private function get_stored_data( $key ) { |
|
376 | + private function get_stored_data($key) { |
|
379 | 377 | global $wpdb; |
380 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
381 | - if ( empty( $value ) ) { |
|
378 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
379 | + if (empty($value)) { |
|
382 | 380 | return false; |
383 | 381 | } |
384 | 382 | |
385 | - $maybe_json = json_decode( $value ); |
|
383 | + $maybe_json = json_decode($value); |
|
386 | 384 | |
387 | - if ( ! is_null( $maybe_json ) ) { |
|
388 | - $value = json_decode( $value, true ); |
|
385 | + if ( ! is_null($maybe_json)) { |
|
386 | + $value = json_decode($value, true); |
|
389 | 387 | } |
390 | 388 | |
391 | 389 | return $value; |
@@ -401,10 +399,10 @@ discard block |
||
401 | 399 | * |
402 | 400 | * @return void |
403 | 401 | */ |
404 | - private function store_data( $key, $value ) { |
|
402 | + private function store_data($key, $value) { |
|
405 | 403 | global $wpdb; |
406 | 404 | |
407 | - $value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value ); |
|
405 | + $value = is_array($value) ? wp_json_encode($value) : esc_attr($value); |
|
408 | 406 | |
409 | 407 | $data = array( |
410 | 408 | 'option_name' => $key, |
@@ -418,7 +416,7 @@ discard block |
||
418 | 416 | '%s', |
419 | 417 | ); |
420 | 418 | |
421 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
419 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
422 | 420 | } |
423 | 421 | |
424 | 422 | /** |
@@ -430,9 +428,9 @@ discard block |
||
430 | 428 | * |
431 | 429 | * @return void |
432 | 430 | */ |
433 | - private function delete_data( $key ) { |
|
431 | + private function delete_data($key) { |
|
434 | 432 | global $wpdb; |
435 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
433 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
436 | 434 | } |
437 | 435 | |
438 | 436 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -53,40 +53,40 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function get_data() { |
55 | 55 | |
56 | - $donor = new Give_Donor( $this->customer_id ); |
|
57 | - $payments = $this->get_stored_data( 'give_recount_donor_payments_' . $donor->id ); |
|
56 | + $donor = new Give_Donor($this->customer_id); |
|
57 | + $payments = $this->get_stored_data('give_recount_donor_payments_'.$donor->id); |
|
58 | 58 | |
59 | - $offset = ( $this->step - 1 ) * $this->per_step; |
|
60 | - $step_items = array_slice( $payments, $offset, $this->per_step ); |
|
59 | + $offset = ($this->step - 1) * $this->per_step; |
|
60 | + $step_items = array_slice($payments, $offset, $this->per_step); |
|
61 | 61 | |
62 | - if ( count( $step_items ) > 0 ) { |
|
63 | - $pending_total = (float) $this->get_stored_data( 'give_stats_donor_pending_total' . $donor->id ); |
|
62 | + if (count($step_items) > 0) { |
|
63 | + $pending_total = (float) $this->get_stored_data('give_stats_donor_pending_total'.$donor->id); |
|
64 | 64 | $step_total = 0; |
65 | 65 | |
66 | - $found_payment_ids = $this->get_stored_data( 'give_stats_found_payments_' . $donor->id ); |
|
66 | + $found_payment_ids = $this->get_stored_data('give_stats_found_payments_'.$donor->id); |
|
67 | 67 | |
68 | - foreach ( $step_items as $payment ) { |
|
69 | - $payment = get_post( $payment->ID ); |
|
68 | + foreach ($step_items as $payment) { |
|
69 | + $payment = get_post($payment->ID); |
|
70 | 70 | |
71 | - if ( is_null( $payment ) || is_wp_error( $payment ) || 'give_payment' !== $payment->post_type ) { |
|
71 | + if (is_null($payment) || is_wp_error($payment) || 'give_payment' !== $payment->post_type) { |
|
72 | 72 | |
73 | - $missing_payments = $this->get_stored_data( 'give_stats_missing_payments' . $donor->id ); |
|
73 | + $missing_payments = $this->get_stored_data('give_stats_missing_payments'.$donor->id); |
|
74 | 74 | $missing_payments[] = $payment->ID; |
75 | - $this->store_data( 'give_stats_missing_payments' . $donor->id, $missing_payments ); |
|
75 | + $this->store_data('give_stats_missing_payments'.$donor->id, $missing_payments); |
|
76 | 76 | |
77 | 77 | continue; |
78 | 78 | } |
79 | 79 | |
80 | 80 | $should_process_payment = 'publish' == $payment->post_status ? true : false; |
81 | - $should_process_payment = apply_filters( 'give_donor_recount_should_process_donation', $should_process_payment, $payment ); |
|
81 | + $should_process_payment = apply_filters('give_donor_recount_should_process_donation', $should_process_payment, $payment); |
|
82 | 82 | |
83 | - if ( true === $should_process_payment ) { |
|
83 | + if (true === $should_process_payment) { |
|
84 | 84 | |
85 | 85 | $found_payment_ids[] = $payment->ID; |
86 | 86 | |
87 | - if ( apply_filters( 'give_donor_recount_should_increase_value', true, $payment ) ) { |
|
88 | - $payment_amount = (float) give_donation_amount( $payment->ID, array( 'type' => 'stats' ) ); |
|
89 | - $step_total += $payment_amount; |
|
87 | + if (apply_filters('give_donor_recount_should_increase_value', true, $payment)) { |
|
88 | + $payment_amount = (float) give_donation_amount($payment->ID, array('type' => 'stats')); |
|
89 | + $step_total += $payment_amount; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | } |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | } |
95 | 95 | |
96 | 96 | $updated_total = $pending_total + $step_total; |
97 | - $this->store_data( 'give_stats_donor_pending_total' . $donor->id, $updated_total ); |
|
98 | - $this->store_data( 'give_stats_found_payments_' . $donor->id, $found_payment_ids ); |
|
97 | + $this->store_data('give_stats_donor_pending_total'.$donor->id, $updated_total); |
|
98 | + $this->store_data('give_stats_found_payments_'.$donor->id, $found_payment_ids); |
|
99 | 99 | |
100 | 100 | return true; |
101 | 101 | } |
@@ -112,16 +112,16 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function get_percentage_complete() { |
114 | 114 | |
115 | - $payments = $this->get_stored_data( 'give_recount_donor_payments_' . $this->customer_id ); |
|
116 | - $total = count( $payments ); |
|
115 | + $payments = $this->get_stored_data('give_recount_donor_payments_'.$this->customer_id); |
|
116 | + $total = count($payments); |
|
117 | 117 | |
118 | 118 | $percentage = 100; |
119 | 119 | |
120 | - if ( $total > 0 ) { |
|
121 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
120 | + if ($total > 0) { |
|
121 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
122 | 122 | } |
123 | 123 | |
124 | - if ( $percentage > 100 ) { |
|
124 | + if ($percentage > 100) { |
|
125 | 125 | $percentage = 100; |
126 | 126 | } |
127 | 127 | |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @param array $request The Form Data passed into the batch processing |
137 | 137 | */ |
138 | - public function set_properties( $request ) { |
|
139 | - $this->customer_id = isset( $request['customer_id'] ) ? sanitize_text_field( $request['customer_id'] ) : false; |
|
138 | + public function set_properties($request) { |
|
139 | + $this->customer_id = isset($request['customer_id']) ? sanitize_text_field($request['customer_id']) : false; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -147,53 +147,53 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function process_step() { |
149 | 149 | |
150 | - if ( ! $this->can_export() ) { |
|
151 | - wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
150 | + if ( ! $this->can_export()) { |
|
151 | + wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | $had_data = $this->get_data(); |
155 | 155 | |
156 | - if ( $had_data ) { |
|
156 | + if ($had_data) { |
|
157 | 157 | $this->done = false; |
158 | 158 | |
159 | 159 | return true; |
160 | 160 | } else { |
161 | - $donor = new Give_Donor( $this->customer_id ); |
|
162 | - $payment_ids = get_option( 'give_stats_found_payments_' . $donor->id, array() ); |
|
163 | - $this->delete_data( 'give_stats_found_payments_' . $donor->id ); |
|
161 | + $donor = new Give_Donor($this->customer_id); |
|
162 | + $payment_ids = get_option('give_stats_found_payments_'.$donor->id, array()); |
|
163 | + $this->delete_data('give_stats_found_payments_'.$donor->id); |
|
164 | 164 | |
165 | - $removed_payments = array_unique( get_option( 'give_stats_missing_payments' . $donor->id, array() ) ); |
|
165 | + $removed_payments = array_unique(get_option('give_stats_missing_payments'.$donor->id, array())); |
|
166 | 166 | |
167 | 167 | // Find non-existing payments (deleted) and total up the donation count |
168 | 168 | $purchase_count = 0; |
169 | - foreach ( $payment_ids as $key => $payment_id ) { |
|
170 | - if ( in_array( $payment_id, $removed_payments ) ) { |
|
171 | - unset( $payment_ids[ $key ] ); |
|
169 | + foreach ($payment_ids as $key => $payment_id) { |
|
170 | + if (in_array($payment_id, $removed_payments)) { |
|
171 | + unset($payment_ids[$key]); |
|
172 | 172 | continue; |
173 | 173 | } |
174 | 174 | |
175 | - $payment = get_post( $payment_id ); |
|
176 | - if ( apply_filters( 'give_donor_recount_should_increase_count', true, $payment ) ) { |
|
177 | - $purchase_count ++; |
|
175 | + $payment = get_post($payment_id); |
|
176 | + if (apply_filters('give_donor_recount_should_increase_count', true, $payment)) { |
|
177 | + $purchase_count++; |
|
178 | 178 | } |
179 | 179 | } |
180 | 180 | |
181 | - $this->delete_data( 'give_stats_missing_payments' . $donor->id ); |
|
181 | + $this->delete_data('give_stats_missing_payments'.$donor->id); |
|
182 | 182 | |
183 | - $pending_total = $this->get_stored_data( 'give_stats_donor_pending_total' . $donor->id ); |
|
184 | - $this->delete_data( 'give_stats_donor_pending_total' . $donor->id ); |
|
185 | - $this->delete_data( 'give_recount_donor_stats_' . $donor->id ); |
|
186 | - $this->delete_data( 'give_recount_donor_payments_' . $this->customer_id ); |
|
183 | + $pending_total = $this->get_stored_data('give_stats_donor_pending_total'.$donor->id); |
|
184 | + $this->delete_data('give_stats_donor_pending_total'.$donor->id); |
|
185 | + $this->delete_data('give_recount_donor_stats_'.$donor->id); |
|
186 | + $this->delete_data('give_recount_donor_payments_'.$this->customer_id); |
|
187 | 187 | |
188 | - $payment_ids = implode( ',', $payment_ids ); |
|
189 | - $donor->update( array( |
|
188 | + $payment_ids = implode(',', $payment_ids); |
|
189 | + $donor->update(array( |
|
190 | 190 | 'payment_ids' => $payment_ids, |
191 | 191 | 'purchase_count' => $purchase_count, |
192 | 192 | 'purchase_value' => $pending_total, |
193 | - ) ); |
|
193 | + )); |
|
194 | 194 | |
195 | 195 | $this->done = true; |
196 | - $this->message = esc_html__( 'Donor stats have been successfully recounted.', 'give' ); |
|
196 | + $this->message = esc_html__('Donor stats have been successfully recounted.', 'give'); |
|
197 | 197 | |
198 | 198 | return false; |
199 | 199 | } |
@@ -226,26 +226,26 @@ discard block |
||
226 | 226 | * @return void |
227 | 227 | */ |
228 | 228 | public function pre_fetch() { |
229 | - if ( $this->step === 1 ) { |
|
230 | - $allowed_payment_status = apply_filters( 'give_recount_donors_donation_statuses', give_get_payment_status_keys() ); |
|
229 | + if ($this->step === 1) { |
|
230 | + $allowed_payment_status = apply_filters('give_recount_donors_donation_statuses', give_get_payment_status_keys()); |
|
231 | 231 | |
232 | 232 | // Before we start, let's zero out the customer's data |
233 | - $donor = new Give_Donor( $this->customer_id ); |
|
234 | - $donor->update( array( 'purchase_value' => give_format_amount( 0, array( 'sanitize' => false ) ), 'purchase_count' => 0 ) ); |
|
233 | + $donor = new Give_Donor($this->customer_id); |
|
234 | + $donor->update(array('purchase_value' => give_format_amount(0, array('sanitize' => false)), 'purchase_count' => 0)); |
|
235 | 235 | |
236 | - $attached_payment_ids = explode( ',', $donor->payment_ids ); |
|
236 | + $attached_payment_ids = explode(',', $donor->payment_ids); |
|
237 | 237 | |
238 | 238 | $attached_args = array( |
239 | 239 | 'post__in' => $attached_payment_ids, |
240 | - 'number' => - 1, |
|
240 | + 'number' => -1, |
|
241 | 241 | 'status' => $allowed_payment_status, |
242 | 242 | ); |
243 | 243 | |
244 | - $attached_payments = give_get_payments( $attached_args ); |
|
244 | + $attached_payments = give_get_payments($attached_args); |
|
245 | 245 | |
246 | 246 | $unattached_args = array( |
247 | 247 | 'post__not_in' => $attached_payment_ids, |
248 | - 'number' => - 1, |
|
248 | + 'number' => -1, |
|
249 | 249 | 'status' => $allowed_payment_status, |
250 | 250 | 'meta_query' => array( |
251 | 251 | array( |
@@ -255,11 +255,11 @@ discard block |
||
255 | 255 | ), |
256 | 256 | ); |
257 | 257 | |
258 | - $unattached_payments = give_get_payments( $unattached_args ); |
|
258 | + $unattached_payments = give_get_payments($unattached_args); |
|
259 | 259 | |
260 | - $payments = array_merge( $attached_payments, $unattached_payments ); |
|
260 | + $payments = array_merge($attached_payments, $unattached_payments); |
|
261 | 261 | |
262 | - $this->store_data( 'give_recount_donor_payments_' . $donor->id, $payments ); |
|
262 | + $this->store_data('give_recount_donor_payments_'.$donor->id, $payments); |
|
263 | 263 | } |
264 | 264 | } |
265 | 265 | |
@@ -272,17 +272,17 @@ discard block |
||
272 | 272 | * |
273 | 273 | * @return mixed Returns the data from the database |
274 | 274 | */ |
275 | - private function get_stored_data( $key ) { |
|
275 | + private function get_stored_data($key) { |
|
276 | 276 | global $wpdb; |
277 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
277 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
278 | 278 | |
279 | - if ( empty( $value ) ) { |
|
279 | + if (empty($value)) { |
|
280 | 280 | return false; |
281 | 281 | } |
282 | 282 | |
283 | - $maybe_json = json_decode( $value ); |
|
284 | - if ( ! is_null( $maybe_json ) ) { |
|
285 | - $value = json_decode( $value, true ); |
|
283 | + $maybe_json = json_decode($value); |
|
284 | + if ( ! is_null($maybe_json)) { |
|
285 | + $value = json_decode($value, true); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | return $value; |
@@ -298,10 +298,10 @@ discard block |
||
298 | 298 | * |
299 | 299 | * @return void |
300 | 300 | */ |
301 | - private function store_data( $key, $value ) { |
|
301 | + private function store_data($key, $value) { |
|
302 | 302 | global $wpdb; |
303 | 303 | |
304 | - $value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value ); |
|
304 | + $value = is_array($value) ? wp_json_encode($value) : esc_attr($value); |
|
305 | 305 | |
306 | 306 | $data = array( |
307 | 307 | 'option_name' => $key, |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | '%s', |
316 | 316 | ); |
317 | 317 | |
318 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
318 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | /** |
@@ -327,9 +327,9 @@ discard block |
||
327 | 327 | * |
328 | 328 | * @return void |
329 | 329 | */ |
330 | - private function delete_data( $key ) { |
|
330 | + private function delete_data($key) { |
|
331 | 331 | global $wpdb; |
332 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
332 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -53,49 +53,49 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function get_data() { |
55 | 55 | |
56 | - if ( $this->step == 1 ) { |
|
57 | - $this->delete_data( 'give_temp_recount_earnings' ); |
|
56 | + if ($this->step == 1) { |
|
57 | + $this->delete_data('give_temp_recount_earnings'); |
|
58 | 58 | } |
59 | 59 | |
60 | - $total = get_option( 'give_temp_recount_earnings', false ); |
|
60 | + $total = get_option('give_temp_recount_earnings', false); |
|
61 | 61 | |
62 | - if ( false === $total ) { |
|
62 | + if (false === $total) { |
|
63 | 63 | $total = (float) 0; |
64 | - $this->store_data( 'give_temp_recount_earnings', $total ); |
|
64 | + $this->store_data('give_temp_recount_earnings', $total); |
|
65 | 65 | } |
66 | 66 | |
67 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
67 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
68 | 68 | |
69 | - $args = apply_filters( 'give_recount_earnings_args', array( |
|
69 | + $args = apply_filters('give_recount_earnings_args', array( |
|
70 | 70 | 'number' => $this->per_step, |
71 | 71 | 'page' => $this->step, |
72 | 72 | 'status' => $accepted_statuses, |
73 | 73 | 'fields' => 'ids' |
74 | - ) ); |
|
74 | + )); |
|
75 | 75 | |
76 | - $payments = give_get_payments( $args ); |
|
76 | + $payments = give_get_payments($args); |
|
77 | 77 | |
78 | - if ( ! empty( $payments ) ) { |
|
78 | + if ( ! empty($payments)) { |
|
79 | 79 | |
80 | - foreach ( $payments as $payment ) { |
|
80 | + foreach ($payments as $payment) { |
|
81 | 81 | |
82 | - $total += (float) give_donation_amount( $payment, array( 'type' => 'stats' ) ); |
|
82 | + $total += (float) give_donation_amount($payment, array('type' => 'stats')); |
|
83 | 83 | |
84 | 84 | } |
85 | 85 | |
86 | - if ( $total < 0 ) { |
|
86 | + if ($total < 0) { |
|
87 | 87 | $totals = 0; |
88 | 88 | } |
89 | 89 | |
90 | - $total = round( $total, give_get_price_decimals() ); |
|
90 | + $total = round($total, give_get_price_decimals()); |
|
91 | 91 | |
92 | - $this->store_data( 'give_temp_recount_earnings', $total ); |
|
92 | + $this->store_data('give_temp_recount_earnings', $total); |
|
93 | 93 | |
94 | 94 | return true; |
95 | 95 | |
96 | 96 | } |
97 | 97 | |
98 | - update_option( 'give_earnings_total', $total ); |
|
98 | + update_option('give_earnings_total', $total); |
|
99 | 99 | |
100 | 100 | return false; |
101 | 101 | |
@@ -109,25 +109,25 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function get_percentage_complete() { |
111 | 111 | |
112 | - $total = $this->get_stored_data( 'give_recount_earnings_total' ); |
|
112 | + $total = $this->get_stored_data('give_recount_earnings_total'); |
|
113 | 113 | |
114 | - if ( false === $total ) { |
|
115 | - $args = apply_filters( 'give_recount_earnings_total_args', array() ); |
|
114 | + if (false === $total) { |
|
115 | + $args = apply_filters('give_recount_earnings_total_args', array()); |
|
116 | 116 | |
117 | - $counts = give_count_payments( $args ); |
|
118 | - $total = absint( $counts->publish ); |
|
119 | - $total = apply_filters( 'give_recount_store_earnings_total', $total ); |
|
117 | + $counts = give_count_payments($args); |
|
118 | + $total = absint($counts->publish); |
|
119 | + $total = apply_filters('give_recount_store_earnings_total', $total); |
|
120 | 120 | |
121 | - $this->store_data( 'give_recount_earnings_total', $total ); |
|
121 | + $this->store_data('give_recount_earnings_total', $total); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | $percentage = 100; |
125 | 125 | |
126 | - if ( $total > 0 ) { |
|
127 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
126 | + if ($total > 0) { |
|
127 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
128 | 128 | } |
129 | 129 | |
130 | - if ( $percentage > 100 ) { |
|
130 | + if ($percentage > 100) { |
|
131 | 131 | $percentage = 100; |
132 | 132 | } |
133 | 133 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * |
142 | 142 | * @param array $request The Form Data passed into the batch processing |
143 | 143 | */ |
144 | - public function set_properties( $request ) { |
|
144 | + public function set_properties($request) { |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -152,21 +152,21 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function process_step() { |
154 | 154 | |
155 | - if ( ! $this->can_export() ) { |
|
156 | - wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
155 | + if ( ! $this->can_export()) { |
|
156 | + wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | $had_data = $this->get_data(); |
160 | 160 | |
161 | - if ( $had_data ) { |
|
161 | + if ($had_data) { |
|
162 | 162 | $this->done = false; |
163 | 163 | |
164 | 164 | return true; |
165 | 165 | } else { |
166 | - $this->delete_data( 'give_recount_earnings_total' ); |
|
167 | - $this->delete_data( 'give_temp_recount_earnings' ); |
|
166 | + $this->delete_data('give_recount_earnings_total'); |
|
167 | + $this->delete_data('give_temp_recount_earnings'); |
|
168 | 168 | $this->done = true; |
169 | - $this->message = esc_html__( 'Income stats have been successfully recounted.', 'give' ); |
|
169 | + $this->message = esc_html__('Income stats have been successfully recounted.', 'give'); |
|
170 | 170 | |
171 | 171 | return false; |
172 | 172 | } |
@@ -203,17 +203,17 @@ discard block |
||
203 | 203 | * |
204 | 204 | * @return mixed Returns the data from the database |
205 | 205 | */ |
206 | - private function get_stored_data( $key ) { |
|
206 | + private function get_stored_data($key) { |
|
207 | 207 | global $wpdb; |
208 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
208 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
209 | 209 | |
210 | - if ( empty( $value ) ) { |
|
210 | + if (empty($value)) { |
|
211 | 211 | return false; |
212 | 212 | } |
213 | 213 | |
214 | - $maybe_json = json_decode( $value ); |
|
215 | - if ( ! is_null( $maybe_json ) ) { |
|
216 | - $value = json_decode( $value, true ); |
|
214 | + $maybe_json = json_decode($value); |
|
215 | + if ( ! is_null($maybe_json)) { |
|
216 | + $value = json_decode($value, true); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | return $value; |
@@ -229,10 +229,10 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @return void |
231 | 231 | */ |
232 | - private function store_data( $key, $value ) { |
|
232 | + private function store_data($key, $value) { |
|
233 | 233 | global $wpdb; |
234 | 234 | |
235 | - $value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value ); |
|
235 | + $value = is_array($value) ? wp_json_encode($value) : esc_attr($value); |
|
236 | 236 | |
237 | 237 | $data = array( |
238 | 238 | 'option_name' => $key, |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | '%s', |
247 | 247 | ); |
248 | 248 | |
249 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
249 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
@@ -258,9 +258,9 @@ discard block |
||
258 | 258 | * |
259 | 259 | * @return void |
260 | 260 | */ |
261 | - private function delete_data( $key ) { |
|
261 | + private function delete_data($key) { |
|
262 | 262 | global $wpdb; |
263 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
263 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | } |
@@ -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 | |
@@ -57,32 +57,32 @@ discard block |
||
57 | 57 | |
58 | 58 | $args = array( |
59 | 59 | 'number' => $this->per_step, |
60 | - 'offset' => $this->per_step * ( $this->step - 1 ), |
|
60 | + 'offset' => $this->per_step * ($this->step - 1), |
|
61 | 61 | 'orderby' => 'id', |
62 | 62 | 'order' => 'DESC', |
63 | 63 | ); |
64 | 64 | |
65 | - $donors = Give()->donors->get_donors( $args ); |
|
65 | + $donors = Give()->donors->get_donors($args); |
|
66 | 66 | |
67 | - if ( $donors ) { |
|
67 | + if ($donors) { |
|
68 | 68 | |
69 | - $allowed_payment_status = apply_filters( 'give_recount_donors_donation_statuses', give_get_payment_status_keys() ); |
|
69 | + $allowed_payment_status = apply_filters('give_recount_donors_donation_statuses', give_get_payment_status_keys()); |
|
70 | 70 | |
71 | - foreach ( $donors as $donor ) { |
|
71 | + foreach ($donors as $donor) { |
|
72 | 72 | |
73 | - $attached_payment_ids = explode( ',', $donor->payment_ids ); |
|
73 | + $attached_payment_ids = explode(',', $donor->payment_ids); |
|
74 | 74 | |
75 | 75 | $attached_args = array( |
76 | 76 | 'post__in' => $attached_payment_ids, |
77 | - 'number' => - 1, |
|
77 | + 'number' => -1, |
|
78 | 78 | 'status' => $allowed_payment_status, |
79 | 79 | ); |
80 | 80 | |
81 | - $attached_payments = (array) give_get_payments( $attached_args ); |
|
81 | + $attached_payments = (array) give_get_payments($attached_args); |
|
82 | 82 | |
83 | 83 | $unattached_args = array( |
84 | 84 | 'post__not_in' => $attached_payment_ids, |
85 | - 'number' => - 1, |
|
85 | + 'number' => -1, |
|
86 | 86 | 'status' => $allowed_payment_status, |
87 | 87 | 'meta_query' => array( |
88 | 88 | array( |
@@ -93,29 +93,29 @@ discard block |
||
93 | 93 | ), |
94 | 94 | ); |
95 | 95 | |
96 | - $unattached_payments = give_get_payments( $unattached_args ); |
|
96 | + $unattached_payments = give_get_payments($unattached_args); |
|
97 | 97 | |
98 | - $payments = array_merge( $attached_payments, $unattached_payments ); |
|
98 | + $payments = array_merge($attached_payments, $unattached_payments); |
|
99 | 99 | |
100 | 100 | $purchase_value = 0.00; |
101 | 101 | $purchase_count = 0; |
102 | 102 | $payment_ids = array(); |
103 | 103 | |
104 | - if ( $payments ) { |
|
104 | + if ($payments) { |
|
105 | 105 | |
106 | - foreach ( $payments as $payment ) { |
|
106 | + foreach ($payments as $payment) { |
|
107 | 107 | |
108 | 108 | $should_process_payment = 'publish' == $payment->post_status ? true : false; |
109 | - $should_process_payment = apply_filters( 'give_donor_recount_should_process_donation', $should_process_payment, $payment ); |
|
109 | + $should_process_payment = apply_filters('give_donor_recount_should_process_donation', $should_process_payment, $payment); |
|
110 | 110 | |
111 | - if ( true === $should_process_payment ) { |
|
111 | + if (true === $should_process_payment) { |
|
112 | 112 | |
113 | - if ( apply_filters( 'give_donor_recount_should_increase_value', true, $payment ) ) { |
|
114 | - $purchase_value += (float) give_donation_amount( $payment->ID, array( 'type' => 'stats' ) ); |
|
113 | + if (apply_filters('give_donor_recount_should_increase_value', true, $payment)) { |
|
114 | + $purchase_value += (float) give_donation_amount($payment->ID, array('type' => 'stats')); |
|
115 | 115 | } |
116 | 116 | |
117 | - if ( apply_filters( 'give_donor_recount_should_increase_count', true, $payment ) ) { |
|
118 | - $purchase_count ++; |
|
117 | + if (apply_filters('give_donor_recount_should_increase_count', true, $payment)) { |
|
118 | + $purchase_count++; |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
126 | - $payment_ids = implode( ',', $payment_ids ); |
|
126 | + $payment_ids = implode(',', $payment_ids); |
|
127 | 127 | |
128 | 128 | $donor_update_data = array( |
129 | 129 | 'purchase_count' => $purchase_count, |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | 'payment_ids' => $payment_ids, |
132 | 132 | ); |
133 | 133 | |
134 | - $donor_instance = new Give_Donor( $donor->id ); |
|
135 | - $donor_instance->update( $donor_update_data ); |
|
134 | + $donor_instance = new Give_Donor($donor->id); |
|
135 | + $donor_instance->update($donor_update_data); |
|
136 | 136 | |
137 | 137 | }// End foreach(). |
138 | 138 | |
@@ -152,21 +152,21 @@ discard block |
||
152 | 152 | public function get_percentage_complete() { |
153 | 153 | |
154 | 154 | $args = array( |
155 | - 'number' => - 1, |
|
155 | + 'number' => -1, |
|
156 | 156 | 'orderby' => 'id', |
157 | 157 | 'order' => 'DESC', |
158 | 158 | ); |
159 | 159 | |
160 | - $donors = Give()->donors->get_donors( $args ); |
|
161 | - $total = count( $donors ); |
|
160 | + $donors = Give()->donors->get_donors($args); |
|
161 | + $total = count($donors); |
|
162 | 162 | |
163 | 163 | $percentage = 100; |
164 | 164 | |
165 | - if ( $total > 0 ) { |
|
166 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
165 | + if ($total > 0) { |
|
166 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
167 | 167 | } |
168 | 168 | |
169 | - if ( $percentage > 100 ) { |
|
169 | + if ($percentage > 100) { |
|
170 | 170 | $percentage = 100; |
171 | 171 | } |
172 | 172 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @param array $request The Form Data passed into the batch processing |
182 | 182 | */ |
183 | - public function set_properties( $request ) { |
|
183 | + public function set_properties($request) { |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | /** |
@@ -191,21 +191,21 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function process_step() { |
193 | 193 | |
194 | - if ( ! $this->can_export() ) { |
|
195 | - wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
194 | + if ( ! $this->can_export()) { |
|
195 | + wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array( |
|
196 | 196 | 'response' => 403, |
197 | - ) ); |
|
197 | + )); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | $had_data = $this->get_data(); |
201 | 201 | |
202 | - if ( $had_data ) { |
|
202 | + if ($had_data) { |
|
203 | 203 | $this->done = false; |
204 | 204 | |
205 | 205 | return true; |
206 | 206 | } else { |
207 | 207 | $this->done = true; |
208 | - $this->message = esc_html__( 'Donor stats have been successfully recounted.', 'give' ); |
|
208 | + $this->message = esc_html__('Donor stats have been successfully recounted.', 'give'); |
|
209 | 209 | |
210 | 210 | return false; |
211 | 211 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -60,59 +60,59 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function get_data() { |
62 | 62 | |
63 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
63 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
64 | 64 | |
65 | - if ( $this->step == 1 ) { |
|
66 | - $this->delete_data( 'give_temp_recount_form_stats' ); |
|
65 | + if ($this->step == 1) { |
|
66 | + $this->delete_data('give_temp_recount_form_stats'); |
|
67 | 67 | } |
68 | 68 | |
69 | - $totals = $this->get_stored_data( 'give_temp_recount_form_stats' ); |
|
69 | + $totals = $this->get_stored_data('give_temp_recount_form_stats'); |
|
70 | 70 | |
71 | - if ( false === $totals ) { |
|
71 | + if (false === $totals) { |
|
72 | 72 | $totals = array( |
73 | 73 | 'earnings' => (float) 0, |
74 | 74 | 'sales' => 0, |
75 | 75 | ); |
76 | - $this->store_data( 'give_temp_recount_form_stats', $totals ); |
|
76 | + $this->store_data('give_temp_recount_form_stats', $totals); |
|
77 | 77 | } |
78 | 78 | |
79 | - $args = apply_filters( 'give_recount_form_stats_args', array( |
|
79 | + $args = apply_filters('give_recount_form_stats_args', array( |
|
80 | 80 | 'give_forms' => $this->form_id, |
81 | 81 | 'number' => $this->per_step, |
82 | 82 | 'status' => $accepted_statuses, |
83 | 83 | 'paged' => $this->step, |
84 | 84 | 'fields' => 'ids', |
85 | - ) ); |
|
85 | + )); |
|
86 | 86 | |
87 | - $payments = new Give_Payments_Query( $args ); |
|
87 | + $payments = new Give_Payments_Query($args); |
|
88 | 88 | $payments = $payments->get_payments(); |
89 | 89 | |
90 | - if ( $payments ) { |
|
91 | - foreach ( $payments as $payment ) { |
|
90 | + if ($payments) { |
|
91 | + foreach ($payments as $payment) { |
|
92 | 92 | |
93 | 93 | // Ensure acceptable status only. |
94 | - if ( ! in_array( $payment->post_status, $accepted_statuses ) ) { |
|
94 | + if ( ! in_array($payment->post_status, $accepted_statuses)) { |
|
95 | 95 | continue; |
96 | 96 | } |
97 | 97 | |
98 | 98 | // Ensure only payments for this form are counted. |
99 | - if ( $payment->form_id != $this->form_id ) { |
|
99 | + if ($payment->form_id != $this->form_id) { |
|
100 | 100 | continue; |
101 | 101 | } |
102 | 102 | |
103 | - $totals['sales'] ++; |
|
103 | + $totals['sales']++; |
|
104 | 104 | $totals['earnings'] += $payment->total; |
105 | 105 | |
106 | 106 | } |
107 | 107 | |
108 | - $this->store_data( 'give_temp_recount_form_stats', $totals ); |
|
108 | + $this->store_data('give_temp_recount_form_stats', $totals); |
|
109 | 109 | |
110 | 110 | return true; |
111 | 111 | } |
112 | 112 | |
113 | 113 | |
114 | - give_update_meta( $this->form_id, '_give_form_sales', $totals['sales'] ); |
|
115 | - give_update_meta( $this->form_id, '_give_form_earnings', give_sanitize_amount_for_db( $totals['earnings'] ) ); |
|
114 | + give_update_meta($this->form_id, '_give_form_sales', $totals['sales']); |
|
115 | + give_update_meta($this->form_id, '_give_form_earnings', give_sanitize_amount_for_db($totals['earnings'])); |
|
116 | 116 | |
117 | 117 | return false; |
118 | 118 | } |
@@ -124,35 +124,35 @@ discard block |
||
124 | 124 | * @return int |
125 | 125 | */ |
126 | 126 | public function get_percentage_complete() { |
127 | - if ( $this->step == 1 ) { |
|
128 | - $this->delete_data( 'give_recount_total_' . $this->form_id ); |
|
127 | + if ($this->step == 1) { |
|
128 | + $this->delete_data('give_recount_total_'.$this->form_id); |
|
129 | 129 | } |
130 | 130 | |
131 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
132 | - $total = $this->get_stored_data( 'give_recount_total_' . $this->form_id ); |
|
131 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
132 | + $total = $this->get_stored_data('give_recount_total_'.$this->form_id); |
|
133 | 133 | |
134 | - if ( false === $total ) { |
|
134 | + if (false === $total) { |
|
135 | 135 | $total = 0; |
136 | - $args = apply_filters( 'give_recount_form_stats_total_args', array( |
|
136 | + $args = apply_filters('give_recount_form_stats_total_args', array( |
|
137 | 137 | 'give_forms' => $this->form_id, |
138 | - 'number' => - 1, |
|
138 | + 'number' => -1, |
|
139 | 139 | 'status' => $accepted_statuses, |
140 | 140 | 'fields' => 'ids', |
141 | - ) ); |
|
141 | + )); |
|
142 | 142 | |
143 | - $payments = new Give_Payments_Query( $args ); |
|
144 | - $total = count( $payments->get_payments() ); |
|
145 | - $this->store_data( 'give_recount_total_' . $this->form_id, $total ); |
|
143 | + $payments = new Give_Payments_Query($args); |
|
144 | + $total = count($payments->get_payments()); |
|
145 | + $this->store_data('give_recount_total_'.$this->form_id, $total); |
|
146 | 146 | |
147 | 147 | } |
148 | 148 | |
149 | 149 | $percentage = 100; |
150 | 150 | |
151 | - if ( $total > 0 ) { |
|
152 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
151 | + if ($total > 0) { |
|
152 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
153 | 153 | } |
154 | 154 | |
155 | - if ( $percentage > 100 ) { |
|
155 | + if ($percentage > 100) { |
|
156 | 156 | $percentage = 100; |
157 | 157 | } |
158 | 158 | |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @param array $request The Form Data passed into the batch processing |
168 | 168 | */ |
169 | - public function set_properties( $request ) { |
|
170 | - $this->form_id = isset( $request['form_id'] ) ? sanitize_text_field( $request['form_id'] ) : false; |
|
169 | + public function set_properties($request) { |
|
170 | + $this->form_id = isset($request['form_id']) ? sanitize_text_field($request['form_id']) : false; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -178,21 +178,21 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function process_step() { |
180 | 180 | |
181 | - if ( ! $this->can_export() ) { |
|
182 | - wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
181 | + if ( ! $this->can_export()) { |
|
182 | + wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | $had_data = $this->get_data(); |
186 | 186 | |
187 | - if ( $had_data ) { |
|
187 | + if ($had_data) { |
|
188 | 188 | $this->done = false; |
189 | 189 | |
190 | 190 | return true; |
191 | 191 | } else { |
192 | - $this->delete_data( 'give_recount_total_' . $this->form_id ); |
|
193 | - $this->delete_data( 'give_temp_recount_form_stats' ); |
|
192 | + $this->delete_data('give_recount_total_'.$this->form_id); |
|
193 | + $this->delete_data('give_temp_recount_form_stats'); |
|
194 | 194 | $this->done = true; |
195 | - $this->message = sprintf( esc_html__( 'Donation counts and income amount statistics successfully recounted for "%s".', 'give' ), get_the_title( $this->form_id ) ); |
|
195 | + $this->message = sprintf(esc_html__('Donation counts and income amount statistics successfully recounted for "%s".', 'give'), get_the_title($this->form_id)); |
|
196 | 196 | |
197 | 197 | return false; |
198 | 198 | } |
@@ -226,17 +226,17 @@ discard block |
||
226 | 226 | * |
227 | 227 | * @return mixed Returns the data from the database |
228 | 228 | */ |
229 | - private function get_stored_data( $key ) { |
|
229 | + private function get_stored_data($key) { |
|
230 | 230 | global $wpdb; |
231 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
231 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
232 | 232 | |
233 | - if ( empty( $value ) ) { |
|
233 | + if (empty($value)) { |
|
234 | 234 | return false; |
235 | 235 | } |
236 | 236 | |
237 | - $maybe_json = json_decode( $value ); |
|
238 | - if ( ! is_null( $maybe_json ) ) { |
|
239 | - $value = json_decode( $value, true ); |
|
237 | + $maybe_json = json_decode($value); |
|
238 | + if ( ! is_null($maybe_json)) { |
|
239 | + $value = json_decode($value, true); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | return $value; |
@@ -252,10 +252,10 @@ discard block |
||
252 | 252 | * |
253 | 253 | * @return void |
254 | 254 | */ |
255 | - private function store_data( $key, $value ) { |
|
255 | + private function store_data($key, $value) { |
|
256 | 256 | global $wpdb; |
257 | 257 | |
258 | - $value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value ); |
|
258 | + $value = is_array($value) ? wp_json_encode($value) : esc_attr($value); |
|
259 | 259 | |
260 | 260 | $data = array( |
261 | 261 | 'option_name' => $key, |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | '%s', |
270 | 270 | ); |
271 | 271 | |
272 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
272 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | /** |
@@ -281,9 +281,9 @@ discard block |
||
281 | 281 | * |
282 | 282 | * @return void |
283 | 283 | */ |
284 | - private function delete_data( $key ) { |
|
284 | + private function delete_data($key) { |
|
285 | 285 | global $wpdb; |
286 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
286 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | } |
290 | 290 | \ No newline at end of file |