@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * Admin View: Imports |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } ?> |
9 | 9 | |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @since 1.8.14 |
20 | 20 | */ |
21 | - do_action( 'give_tools_tab_import_content_top' ); |
|
21 | + do_action('give_tools_tab_import_content_top'); |
|
22 | 22 | ?> |
23 | 23 | |
24 | 24 | <table class="widefat Import-options-table give-table"> |
25 | 25 | <thead> |
26 | 26 | <tr> |
27 | - <th scope="col"><?php esc_html_e( 'Import Type', 'give' ); ?></th> |
|
28 | - <th scope="col"><?php esc_html_e( 'Import Options', 'give' ); ?></th> |
|
27 | + <th scope="col"><?php esc_html_e('Import Type', 'give'); ?></th> |
|
28 | + <th scope="col"><?php esc_html_e('Import Options', 'give'); ?></th> |
|
29 | 29 | </tr> |
30 | 30 | </thead> |
31 | 31 | <tbody> |
@@ -38,19 +38,19 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @since 1.8.14 |
40 | 40 | */ |
41 | - do_action( 'give_tools_tab_import_table_top' ); |
|
41 | + do_action('give_tools_tab_import_table_top'); |
|
42 | 42 | ?> |
43 | 43 | |
44 | 44 | <tr class="give-Import-pdf-sales-earnings"> |
45 | 45 | <td scope="row" class="row-title"> |
46 | 46 | <h3> |
47 | - <span><?php esc_html_e( 'Import Donations', 'give' ); ?></span> |
|
47 | + <span><?php esc_html_e('Import Donations', 'give'); ?></span> |
|
48 | 48 | </h3> |
49 | - <p><?php esc_html_e( 'Import a CSV of Donations.', 'give' ); ?></p> |
|
49 | + <p><?php esc_html_e('Import a CSV of Donations.', 'give'); ?></p> |
|
50 | 50 | </td> |
51 | 51 | <td> |
52 | - <a class="button" href="<?php echo add_query_arg( array( 'importer-type' => 'import_donations' ) ); ?>"> |
|
53 | - <?php esc_html_e( 'Import CSV', 'give' ); ?> |
|
52 | + <a class="button" href="<?php echo add_query_arg(array('importer-type' => 'import_donations')); ?>"> |
|
53 | + <?php esc_html_e('Import CSV', 'give'); ?> |
|
54 | 54 | </a> |
55 | 55 | </td> |
56 | 56 | </tr> |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @since 1.8.14 |
66 | 66 | */ |
67 | - do_action( 'give_tools_tab_import_table_bottom' ); |
|
67 | + do_action('give_tools_tab_import_table_bottom'); |
|
68 | 68 | ?> |
69 | 69 | </tbody> |
70 | 70 | </table> |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @since 1.8.14 |
77 | 77 | */ |
78 | - do_action( 'give_tools_tab_import_content_bottom' ); |
|
78 | + do_action('give_tools_tab_import_content_bottom'); |
|
79 | 79 | ?> |
80 | 80 | |
81 | 81 | </div> |
@@ -3,11 +3,11 @@ discard block |
||
3 | 3 | * Admin View: Exports |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
10 | -if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
10 | +if ( ! current_user_can('manage_give_settings')) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -16,29 +16,29 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @since 1.5 |
18 | 18 | */ |
19 | -do_action( 'give_tools_recount_stats_before' ); |
|
19 | +do_action('give_tools_recount_stats_before'); |
|
20 | 20 | ?> |
21 | 21 | <div id="poststuff"> |
22 | 22 | <div class="postbox"> |
23 | 23 | |
24 | - <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2> |
|
24 | + <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2> |
|
25 | 25 | |
26 | 26 | <div class="inside recount-stats-controls"> |
27 | - <p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p> |
|
27 | + <p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p> |
|
28 | 28 | <form method="post" id="give-tools-recount-form" class="give-export-form"> |
29 | 29 | |
30 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
30 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
31 | 31 | |
32 | 32 | <select name="give-export-class" id="recount-stats-type"> |
33 | - <option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option> |
|
34 | - <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option> |
|
35 | - <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option> |
|
36 | - <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option> |
|
37 | - <option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option> |
|
38 | - <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Payments', 'give' ); ?></option> |
|
39 | - <option data-type="delete-test-donors" value="Give_Tools_Delete_Donors"><?php esc_html_e( 'Delete Test Donors and Payments', 'give' ); ?></option> |
|
40 | - <option data-type="delete-import-donors" value="Give_Tools_Import_Donors"><?php esc_html_e( 'Delete Imported Donors and Payments', 'give' ); ?></option> |
|
41 | - <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option> |
|
33 | + <option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option> |
|
34 | + <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option> |
|
35 | + <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option> |
|
36 | + <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option> |
|
37 | + <option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option> |
|
38 | + <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Payments', 'give'); ?></option> |
|
39 | + <option data-type="delete-test-donors" value="Give_Tools_Delete_Donors"><?php esc_html_e('Delete Test Donors and Payments', 'give'); ?></option> |
|
40 | + <option data-type="delete-import-donors" value="Give_Tools_Import_Donors"><?php esc_html_e('Delete Imported Donors and Payments', 'give'); ?></option> |
|
41 | + <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option> |
|
42 | 42 | <?php |
43 | 43 | /** |
44 | 44 | * Fires in the recount stats selectbox. |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @since 1.5 |
49 | 49 | */ |
50 | - do_action( 'give_recount_tool_options' ); |
|
50 | + do_action('give_recount_tool_options'); |
|
51 | 51 | ?> |
52 | 52 | </select> |
53 | 53 | |
@@ -55,33 +55,33 @@ discard block |
||
55 | 55 | <?php |
56 | 56 | $args = array( |
57 | 57 | 'name' => 'form_id', |
58 | - 'number' => - 1, |
|
58 | + 'number' => -1, |
|
59 | 59 | 'chosen' => true, |
60 | 60 | ); |
61 | - echo Give()->html->forms_dropdown( $args ); |
|
61 | + echo Give()->html->forms_dropdown($args); |
|
62 | 62 | ?> |
63 | 63 | </span> |
64 | 64 | |
65 | 65 | <span class="tools-form-dropdown tools-form-dropdown-delete-import-donors" style="display: none"> |
66 | 66 | <label for="delete-import-donors"> |
67 | 67 | <?php |
68 | - echo Give()->html->checkbox( array( |
|
68 | + echo Give()->html->checkbox(array( |
|
69 | 69 | 'name' => 'delete-import-donors' |
70 | - ) ); |
|
71 | - _e( 'Delete imported WordPress users', 'give' ); |
|
70 | + )); |
|
71 | + _e('Delete imported WordPress users', 'give'); |
|
72 | 72 | ?> |
73 | 73 | </label> |
74 | 74 | </span> |
75 | 75 | |
76 | - <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/> |
|
76 | + <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/> |
|
77 | 77 | |
78 | 78 | <br/> |
79 | 79 | |
80 | 80 | <span class="give-recount-stats-descriptions"> |
81 | - <span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span> |
|
82 | - <span id="recount-form"><?php esc_html_e( 'Recalculates the donation and income stats for a specific form.', 'give' ); ?></span> |
|
83 | - <span id="recount-all"><?php esc_html_e( 'Recalculates the earnings and sales stats for all forms.', 'give' ); ?></span> |
|
84 | - <span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span> |
|
81 | + <span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span> |
|
82 | + <span id="recount-form"><?php esc_html_e('Recalculates the donation and income stats for a specific form.', 'give'); ?></span> |
|
83 | + <span id="recount-all"><?php esc_html_e('Recalculates the earnings and sales stats for all forms.', 'give'); ?></span> |
|
84 | + <span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span> |
|
85 | 85 | <?php |
86 | 86 | /** |
87 | 87 | * Fires in the recount stats description area. |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @since 1.5 |
92 | 92 | */ |
93 | - do_action( 'give_recount_tool_descriptions' ); |
|
93 | + do_action('give_recount_tool_descriptions'); |
|
94 | 94 | ?> |
95 | - <span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give' ); ?></span> |
|
96 | - <span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span> |
|
95 | + <span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give'); ?></span> |
|
96 | + <span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give'); ?></span> |
|
97 | 97 | </span> |
98 | 98 | |
99 | 99 | <span class="spinner"></span> |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @since 1.5 |
109 | 109 | */ |
110 | - do_action( 'give_tools_recount_forms' ); |
|
110 | + do_action('give_tools_recount_forms'); |
|
111 | 111 | ?> |
112 | 112 | </div><!-- .inside --> |
113 | 113 | </div><!-- .postbox --> |
@@ -118,4 +118,4 @@ discard block |
||
118 | 118 | * |
119 | 119 | * @since 1.5 |
120 | 120 | */ |
121 | -do_action( 'give_tools_recount_stats_after' ); |
|
121 | +do_action('give_tools_recount_stats_after'); |
@@ -3,11 +3,11 @@ discard block |
||
3 | 3 | * Admin View: Import Donations |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
10 | -if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
10 | +if ( ! current_user_can('manage_give_settings')) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -16,11 +16,11 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @since 1.8.13 |
18 | 18 | */ |
19 | -do_action( 'give_tools_import_donations_main_before' ); |
|
19 | +do_action('give_tools_import_donations_main_before'); |
|
20 | 20 | ?> |
21 | 21 | <div id="poststuff"> |
22 | 22 | <div class="postbox"> |
23 | - <h1 class="give-importer-h1" align="center"><?php esc_html_e( 'Import Donations', 'give' ); ?></h1> |
|
23 | + <h1 class="give-importer-h1" align="center"><?php esc_html_e('Import Donations', 'give'); ?></h1> |
|
24 | 24 | <div class="inside give-tools-setting-page-import"> |
25 | 25 | <?php |
26 | 26 | /** |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @since 1.8.14 |
30 | 30 | */ |
31 | - do_action( 'give_tools_import_donations_form_before_start' ); |
|
31 | + do_action('give_tools_import_donations_form_before_start'); |
|
32 | 32 | ?> |
33 | 33 | <form method="post" id="give-import-donations-form" class="give-import-form tools-setting-page-import tools-setting-page-import"> |
34 | 34 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @since 1.8.14 |
40 | 40 | */ |
41 | - do_action( 'give_tools_import_donations_form_start' ); |
|
41 | + do_action('give_tools_import_donations_form_start'); |
|
42 | 42 | ?> |
43 | 43 | |
44 | 44 | <?php |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @since 1.8.14 |
49 | 49 | */ |
50 | - do_action( 'give_tools_import_donations_form_end' ); |
|
50 | + do_action('give_tools_import_donations_form_end'); |
|
51 | 51 | ?> |
52 | 52 | </form> |
53 | 53 | <?php |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @since 1.8.14 |
58 | 58 | */ |
59 | - do_action( 'give_tools_import_donations_form_after_end' ); |
|
59 | + do_action('give_tools_import_donations_form_after_end'); |
|
60 | 60 | ?> |
61 | 61 | </div><!-- .inside --> |
62 | 62 | </div><!-- .postbox --> |
@@ -67,4 +67,4 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @since 1.8.13 |
69 | 69 | */ |
70 | -do_action( 'give_tools_import_donations_main_after' ); |
|
70 | +do_action('give_tools_import_donations_main_after'); |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Import' ) ) { |
|
16 | +if ( ! class_exists('Give_Settings_Import')) { |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Import. |
@@ -38,23 +38,23 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function __construct() { |
40 | 40 | $this->id = 'import'; |
41 | - $this->label = __( 'Import', 'give' ); |
|
41 | + $this->label = __('Import', 'give'); |
|
42 | 42 | |
43 | 43 | // Add Import tab in submenu. |
44 | - add_filter( 'give-tools_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
44 | + add_filter('give-tools_tabs_array', array($this, 'add_settings_page'), 20); |
|
45 | 45 | |
46 | 46 | // Will display html of the import donation. |
47 | - add_action( 'give_admin_field_tools_import', array( 'Give_Settings_Import', 'render_import_field' ), 10, 2 ); |
|
47 | + add_action('give_admin_field_tools_import', array('Give_Settings_Import', 'render_import_field'), 10, 2); |
|
48 | 48 | |
49 | 49 | // Will call the function that generated the hook called 'give_admin_field_tools_import'. |
50 | - add_action( "give-tools_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
50 | + add_action("give-tools_settings_{$this->id}_page", array($this, 'output')); |
|
51 | 51 | |
52 | 52 | // Do not use main form for this tab. |
53 | - if ( give_get_current_setting_tab() === $this->id ) { |
|
54 | - add_action( "give-tools_open_form", '__return_empty_string' ); |
|
55 | - add_action( "give-tools_close_form", '__return_empty_string' ); |
|
53 | + if (give_get_current_setting_tab() === $this->id) { |
|
54 | + add_action("give-tools_open_form", '__return_empty_string'); |
|
55 | + add_action("give-tools_close_form", '__return_empty_string'); |
|
56 | 56 | |
57 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/import/class-give-import-donations.php'; |
|
57 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/import/class-give-import-donations.php'; |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @param array $settings |
78 | 78 | */ |
79 | 79 | $settings = apply_filters( |
80 | - 'give_get_settings_' . $this->id, |
|
80 | + 'give_get_settings_'.$this->id, |
|
81 | 81 | array( |
82 | 82 | array( |
83 | 83 | 'id' => 'give_tools_import', |
@@ -86,14 +86,14 @@ discard block |
||
86 | 86 | ), |
87 | 87 | array( |
88 | 88 | 'id' => 'import', |
89 | - 'name' => __( 'Import', 'give' ), |
|
89 | + 'name' => __('Import', 'give'), |
|
90 | 90 | 'type' => 'tools_import', |
91 | 91 | ), |
92 | 92 | array( |
93 | - 'name' => esc_html__( 'Import Docs Link', 'give' ), |
|
93 | + 'name' => esc_html__('Import Docs Link', 'give'), |
|
94 | 94 | 'id' => 'import_docs_link', |
95 | - 'url' => esc_url( 'http://docs.givewp.com/tools-importer' ), |
|
96 | - 'title' => __( 'Import Tab', 'give' ), |
|
95 | + 'url' => esc_url('http://docs.givewp.com/tools-importer'), |
|
96 | + 'title' => __('Import Tab', 'give'), |
|
97 | 97 | 'type' => 'give_docs_link', |
98 | 98 | ), |
99 | 99 | array( |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | * @param $field |
118 | 118 | * @param $option_value |
119 | 119 | */ |
120 | - public static function render_import_field( $field, $option_value ) { |
|
121 | - include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-imports.php'; |
|
120 | + public static function render_import_field($field, $option_value) { |
|
121 | + include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-imports.php'; |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | } |
@@ -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 | |
@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | ob_start(); ?> |
27 | 27 | <div class="wrap" id="give-add-ons"> |
28 | 28 | <h1><?php echo get_admin_page_title(); ?> |
29 | - — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?> |
|
29 | + — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e('View All Add-ons', 'give'); ?> |
|
30 | 30 | <span class="dashicons dashicons-external"></span></a> |
31 | 31 | </h1> |
32 | 32 | |
33 | 33 | <hr class="wp-header-end"> |
34 | 34 | |
35 | - <p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p> |
|
35 | + <p><?php esc_html_e('The following Add-ons extend the functionality of Give.', 'give'); ?></p> |
|
36 | 36 | <?php echo give_add_ons_get_feed(); ?> |
37 | 37 | </div> |
38 | 38 | <?php |
@@ -50,20 +50,20 @@ discard block |
||
50 | 50 | function give_add_ons_get_feed() { |
51 | 51 | |
52 | 52 | $addons_debug = false; //set to true to debug |
53 | - $cache = Give_Cache::get( 'give_add_ons_feed', true ); |
|
53 | + $cache = Give_Cache::get('give_add_ons_feed', true); |
|
54 | 54 | |
55 | - if ( $cache === false || $addons_debug === true && WP_DEBUG === true ) { |
|
56 | - $feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) ); |
|
55 | + if ($cache === false || $addons_debug === true && WP_DEBUG === true) { |
|
56 | + $feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false)); |
|
57 | 57 | |
58 | - if ( ! is_wp_error( $feed ) ) { |
|
59 | - if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) { |
|
60 | - $cache = wp_remote_retrieve_body( $feed ); |
|
61 | - Give_Cache::set( 'give_add_ons_feed', $cache, HOUR_IN_SECONDS, true ); |
|
58 | + if ( ! is_wp_error($feed)) { |
|
59 | + if (isset($feed['body']) && strlen($feed['body']) > 0) { |
|
60 | + $cache = wp_remote_retrieve_body($feed); |
|
61 | + Give_Cache::set('give_add_ons_feed', $cache, HOUR_IN_SECONDS, true); |
|
62 | 62 | } |
63 | 63 | } else { |
64 | 64 | $cache = sprintf( |
65 | 65 | '<div class="error"><p>%s</p></div>', |
66 | - esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' ) |
|
66 | + esc_html__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give') |
|
67 | 67 | ); |
68 | 68 | } |
69 | 69 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | // Exit if accessed directly. |
19 | -if ( ! defined( 'ABSPATH' ) ) { |
|
19 | +if ( ! defined('ABSPATH')) { |
|
20 | 20 | exit; |
21 | 21 | } |
22 | 22 | |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | * @return void |
30 | 30 | */ |
31 | 31 | function give_reports_page() { |
32 | - $current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' ); |
|
33 | - $active_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; |
|
32 | + $current_page = admin_url('edit.php?post_type=give_forms&page=give-reports'); |
|
33 | + $active_tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; |
|
34 | 34 | $views = give_reports_default_views(); |
35 | 35 | ?> |
36 | 36 | <div class="wrap give-settings-page"> |
@@ -38,17 +38,17 @@ discard block |
||
38 | 38 | <h1 class="screen-reader-text"><?php echo get_admin_page_title(); ?></h1> |
39 | 39 | |
40 | 40 | <h2 class="nav-tab-wrapper"> |
41 | - <?php foreach ( $views as $tab => $label ) { ?> |
|
42 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
41 | + <?php foreach ($views as $tab => $label) { ?> |
|
42 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
43 | 43 | 'tab' => $tab, |
44 | 44 | 'settings-updated' => false, |
45 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php echo esc_html( $label ); ?></a> |
|
45 | + ), $current_page)); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php echo esc_html($label); ?></a> |
|
46 | 46 | <?php } ?> |
47 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
48 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
47 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
48 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
49 | 49 | 'tab' => 'export', |
50 | 50 | 'settings-updated' => false, |
51 | - ), $current_page ) ); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a> |
|
51 | + ), $current_page)); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a> |
|
52 | 52 | <?php } |
53 | 53 | /** |
54 | 54 | * Fires in the report tabs. |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @since 1.0 |
59 | 59 | */ |
60 | - do_action( 'give_reports_tabs' ); |
|
60 | + do_action('give_reports_tabs'); |
|
61 | 61 | ?> |
62 | 62 | </h2> |
63 | 63 | |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @since 1.0 |
69 | 69 | */ |
70 | - do_action( 'give_reports_page_top' ); |
|
70 | + do_action('give_reports_page_top'); |
|
71 | 71 | |
72 | 72 | // Set $active_tab prior to hook firing. |
73 | - if ( in_array( $active_tab, array_keys( $views ) ) ) { |
|
73 | + if (in_array($active_tab, array_keys($views))) { |
|
74 | 74 | $active_tab = 'reports'; |
75 | 75 | } |
76 | 76 | |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @since 1.0 |
81 | 81 | */ |
82 | - do_action( "give_reports_tab_{$active_tab}" ); |
|
82 | + do_action("give_reports_tab_{$active_tab}"); |
|
83 | 83 | |
84 | 84 | /** |
85 | 85 | * Fires after the report page. |
86 | 86 | * |
87 | 87 | * @since 1.0 |
88 | 88 | */ |
89 | - do_action( 'give_reports_page_bottom' ); |
|
89 | + do_action('give_reports_page_bottom'); |
|
90 | 90 | ?> |
91 | 91 | </div><!-- .wrap --> |
92 | 92 | <?php |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | */ |
101 | 101 | function give_reports_default_views() { |
102 | 102 | $views = array( |
103 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
104 | - 'forms' => esc_html__( 'Forms', 'give' ), |
|
105 | - 'gateways' => esc_html__( 'Donation Methods', 'give' ), |
|
103 | + 'earnings' => esc_html__('Income', 'give'), |
|
104 | + 'forms' => esc_html__('Forms', 'give'), |
|
105 | + 'gateways' => esc_html__('Donation Methods', 'give'), |
|
106 | 106 | ); |
107 | 107 | |
108 | - $views = apply_filters( 'give_report_views', $views ); |
|
108 | + $views = apply_filters('give_report_views', $views); |
|
109 | 109 | |
110 | 110 | return $views; |
111 | 111 | } |
@@ -120,15 +120,15 @@ discard block |
||
120 | 120 | * @since 1.0 |
121 | 121 | * @return string $view Report View |
122 | 122 | */ |
123 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
123 | +function give_get_reporting_view($default = 'earnings') { |
|
124 | 124 | |
125 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
125 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
126 | 126 | $view = $default; |
127 | 127 | } else { |
128 | 128 | $view = $_GET['view']; |
129 | 129 | } |
130 | 130 | |
131 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
131 | + return apply_filters('give_get_reporting_view', $view); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $current_view = 'earnings'; |
142 | 142 | $views = give_reports_default_views(); |
143 | 143 | |
144 | - if ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $views ) ) { |
|
144 | + if (isset($_GET['tab']) && array_key_exists($_GET['tab'], $views)) { |
|
145 | 145 | $current_view = $_GET['tab']; |
146 | 146 | } |
147 | 147 | |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @since 1.0 |
152 | 152 | */ |
153 | - do_action( "give_reports_view_{$current_view}" ); |
|
153 | + do_action("give_reports_view_{$current_view}"); |
|
154 | 154 | } |
155 | 155 | |
156 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
156 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
157 | 157 | |
158 | 158 | /** |
159 | 159 | * Renders the Reports Page Views Drop Downs |
@@ -163,19 +163,19 @@ discard block |
||
163 | 163 | */ |
164 | 164 | function give_report_views() { |
165 | 165 | $views = give_reports_default_views(); |
166 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
166 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
167 | 167 | /** |
168 | 168 | * Fires before the report page actions form. |
169 | 169 | * |
170 | 170 | * @since 1.0 |
171 | 171 | */ |
172 | - do_action( 'give_report_view_actions_before' ); |
|
172 | + do_action('give_report_view_actions_before'); |
|
173 | 173 | ?> |
174 | 174 | <form id="give-reports-filter" method="get"> |
175 | 175 | <select id="give-reports-view" name="view"> |
176 | - <option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option> |
|
177 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
178 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
176 | + <option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option> |
|
177 | + <?php foreach ($views as $view_id => $label) : ?> |
|
178 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
179 | 179 | <?php endforeach; ?> |
180 | 180 | </select> |
181 | 181 | |
@@ -187,12 +187,12 @@ discard block |
||
187 | 187 | * |
188 | 188 | * @since 1.0 |
189 | 189 | */ |
190 | - do_action( 'give_report_view_actions' ); |
|
190 | + do_action('give_report_view_actions'); |
|
191 | 191 | ?> |
192 | 192 | |
193 | 193 | <input type="hidden" name="post_type" value="give_forms"/> |
194 | 194 | <input type="hidden" name="page" value="give-reports"/> |
195 | - <?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
195 | + <?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
196 | 196 | </form> |
197 | 197 | <?php |
198 | 198 | /** |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @since 1.0 |
202 | 202 | */ |
203 | - do_action( 'give_report_view_actions_after' ); |
|
203 | + do_action('give_report_view_actions_after'); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -213,11 +213,11 @@ discard block |
||
213 | 213 | */ |
214 | 214 | function give_reports_forms_table() { |
215 | 215 | |
216 | - if ( isset( $_GET['form-id'] ) ) { |
|
216 | + if (isset($_GET['form-id'])) { |
|
217 | 217 | return; |
218 | 218 | } |
219 | 219 | |
220 | - include( dirname( __FILE__ ) . '/class-form-reports-table.php' ); |
|
220 | + include(dirname(__FILE__).'/class-form-reports-table.php'); |
|
221 | 221 | |
222 | 222 | $give_table = new Give_Form_Reports_Table(); |
223 | 223 | $give_table->prepare_items(); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | <?php |
230 | 230 | } |
231 | 231 | |
232 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
232 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
233 | 233 | |
234 | 234 | /** |
235 | 235 | * Renders the detailed report for a specific give form. |
@@ -238,20 +238,20 @@ discard block |
||
238 | 238 | * @return void |
239 | 239 | */ |
240 | 240 | function give_reports_form_details() { |
241 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
241 | + if ( ! isset($_GET['form-id'])) { |
|
242 | 242 | return; |
243 | 243 | } |
244 | 244 | ?> |
245 | 245 | <div class="tablenav top reports-forms-details-wrap"> |
246 | 246 | <div class="actions bulkactions"> |
247 | - <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button> |
|
247 | + <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button> |
|
248 | 248 | </div> |
249 | 249 | </div> |
250 | 250 | <?php |
251 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
251 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
252 | 252 | } |
253 | 253 | |
254 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
254 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
255 | 255 | |
256 | 256 | /** |
257 | 257 | * Renders the Gateways Table |
@@ -262,14 +262,14 @@ discard block |
||
262 | 262 | * @return void |
263 | 263 | */ |
264 | 264 | function give_reports_gateways_table() { |
265 | - include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' ); |
|
265 | + include(dirname(__FILE__).'/class-gateways-reports-table.php'); |
|
266 | 266 | |
267 | 267 | $give_table = new Give_Gateway_Reports_Table(); |
268 | 268 | $give_table->prepare_items(); |
269 | 269 | $give_table->display(); |
270 | 270 | } |
271 | 271 | |
272 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
272 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
273 | 273 | |
274 | 274 | /** |
275 | 275 | * Renders the Reports Earnings Graphs |
@@ -280,13 +280,13 @@ discard block |
||
280 | 280 | function give_reports_earnings() { |
281 | 281 | ?> |
282 | 282 | <div class="tablenav top reports-table-nav"> |
283 | - <h2 class="reports-earnings-title"><?php esc_html_e( 'Income Report', 'give' ); ?></h2> |
|
283 | + <h2 class="reports-earnings-title"><?php esc_html_e('Income Report', 'give'); ?></h2> |
|
284 | 284 | </div> |
285 | 285 | <?php |
286 | 286 | give_reports_graph(); |
287 | 287 | } |
288 | 288 | |
289 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
289 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
290 | 290 | |
291 | 291 | |
292 | 292 | /** |
@@ -297,9 +297,9 @@ discard block |
||
297 | 297 | */ |
298 | 298 | function give_estimated_monthly_stats() { |
299 | 299 | |
300 | - $estimated = Give_Cache::get( 'give_estimated_monthly_stats', true ); |
|
300 | + $estimated = Give_Cache::get('give_estimated_monthly_stats', true); |
|
301 | 301 | |
302 | - if ( false === $estimated ) { |
|
302 | + if (false === $estimated) { |
|
303 | 303 | |
304 | 304 | $estimated = array( |
305 | 305 | 'earnings' => 0, |
@@ -308,22 +308,22 @@ discard block |
||
308 | 308 | |
309 | 309 | $stats = new Give_Payment_Stats; |
310 | 310 | |
311 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
312 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
311 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
312 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
313 | 313 | |
314 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
315 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
316 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
317 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
314 | + $current_day = date('d', current_time('timestamp')); |
|
315 | + $current_month = date('n', current_time('timestamp')); |
|
316 | + $current_year = date('Y', current_time('timestamp')); |
|
317 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
318 | 318 | |
319 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
320 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
319 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
320 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
321 | 321 | |
322 | 322 | // Cache for one day |
323 | - Give_Cache::set( 'give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true ); |
|
323 | + Give_Cache::set('give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true); |
|
324 | 324 | } |
325 | 325 | |
326 | - return maybe_unserialize( $estimated ); |
|
326 | + return maybe_unserialize($estimated); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | function give_reports_set_form_method() { |
337 | 337 | return 'get'; |
338 | 338 | } |
339 | -add_filter( 'give-reports_form_method_tab_forms', 'give_reports_set_form_method', 10 ); |
|
340 | -add_filter( 'give-reports_form_method_tab_donors', 'give_reports_set_form_method', 10 ); |
|
339 | +add_filter('give-reports_form_method_tab_forms', 'give_reports_set_form_method', 10); |
|
340 | +add_filter('give-reports_form_method_tab_donors', 'give_reports_set_form_method', 10); |
|
341 | 341 | |
342 | 342 | // @TODO: After release 1.8 Donations -> Reports generates with new setting api, so we can remove some old code from this 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 | |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @access public |
36 | 36 | */ |
37 | 37 | public function __construct() { |
38 | - add_filter( 'give_map_meta_cap', array( $this, 'meta_caps' ), 10, 4 ); |
|
39 | - add_filter( 'woocommerce_disable_admin_bar', array( $this, 'manage_admin_dashboard' ), 10 ); |
|
40 | - add_filter( 'woocommerce_prevent_admin_access', array( $this, 'manage_admin_dashboard'), 10 ); |
|
38 | + add_filter('give_map_meta_cap', array($this, 'meta_caps'), 10, 4); |
|
39 | + add_filter('woocommerce_disable_admin_bar', array($this, 'manage_admin_dashboard'), 10); |
|
40 | + add_filter('woocommerce_prevent_admin_access', array($this, 'manage_admin_dashboard'), 10); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @return void |
52 | 52 | */ |
53 | 53 | public function add_roles() { |
54 | - add_role( 'give_manager', __( 'Give Manager', 'give' ), array( |
|
54 | + add_role('give_manager', __('Give Manager', 'give'), array( |
|
55 | 55 | 'read' => true, |
56 | 56 | 'edit_posts' => true, |
57 | 57 | 'delete_posts' => true, |
@@ -80,25 +80,25 @@ discard block |
||
80 | 80 | 'publish_posts' => true, |
81 | 81 | 'read_private_pages' => true, |
82 | 82 | 'read_private_posts' => true, |
83 | - ) ); |
|
83 | + )); |
|
84 | 84 | |
85 | - add_role( 'give_accountant', __( 'Give Accountant', 'give' ), array( |
|
85 | + add_role('give_accountant', __('Give Accountant', 'give'), array( |
|
86 | 86 | 'read' => true, |
87 | 87 | 'edit_posts' => false, |
88 | 88 | 'delete_posts' => false |
89 | - ) ); |
|
89 | + )); |
|
90 | 90 | |
91 | - add_role( 'give_worker', __( 'Give Worker', 'give' ), array( |
|
91 | + add_role('give_worker', __('Give Worker', 'give'), array( |
|
92 | 92 | 'read' => true, |
93 | 93 | 'edit_posts' => true, |
94 | 94 | 'edit_pages' => true, |
95 | 95 | 'upload_files' => true, |
96 | 96 | 'delete_posts' => false, |
97 | - ) ); |
|
97 | + )); |
|
98 | 98 | |
99 | - add_role( 'give_donor', __( 'Give Donor', 'give' ), array( |
|
99 | + add_role('give_donor', __('Give Donor', 'give'), array( |
|
100 | 100 | 'read' => true, |
101 | - ) ); |
|
101 | + )); |
|
102 | 102 | |
103 | 103 | } |
104 | 104 | |
@@ -117,38 +117,38 @@ discard block |
||
117 | 117 | public function add_caps() { |
118 | 118 | global $wp_roles; |
119 | 119 | |
120 | - if ( class_exists( 'WP_Roles' ) ) { |
|
121 | - if ( ! isset( $wp_roles ) ) { |
|
120 | + if (class_exists('WP_Roles')) { |
|
121 | + if ( ! isset($wp_roles)) { |
|
122 | 122 | $wp_roles = new WP_Roles(); |
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
126 | - if ( is_object( $wp_roles ) ) { |
|
127 | - $wp_roles->add_cap( 'give_manager', 'view_give_reports' ); |
|
128 | - $wp_roles->add_cap( 'give_manager', 'view_give_sensitive_data' ); |
|
129 | - $wp_roles->add_cap( 'give_manager', 'export_give_reports' ); |
|
130 | - $wp_roles->add_cap( 'give_manager', 'manage_give_settings' ); |
|
126 | + if (is_object($wp_roles)) { |
|
127 | + $wp_roles->add_cap('give_manager', 'view_give_reports'); |
|
128 | + $wp_roles->add_cap('give_manager', 'view_give_sensitive_data'); |
|
129 | + $wp_roles->add_cap('give_manager', 'export_give_reports'); |
|
130 | + $wp_roles->add_cap('give_manager', 'manage_give_settings'); |
|
131 | 131 | |
132 | - $wp_roles->add_cap( 'administrator', 'view_give_reports' ); |
|
133 | - $wp_roles->add_cap( 'administrator', 'view_give_sensitive_data' ); |
|
134 | - $wp_roles->add_cap( 'administrator', 'export_give_reports' ); |
|
135 | - $wp_roles->add_cap( 'administrator', 'manage_give_settings' ); |
|
132 | + $wp_roles->add_cap('administrator', 'view_give_reports'); |
|
133 | + $wp_roles->add_cap('administrator', 'view_give_sensitive_data'); |
|
134 | + $wp_roles->add_cap('administrator', 'export_give_reports'); |
|
135 | + $wp_roles->add_cap('administrator', 'manage_give_settings'); |
|
136 | 136 | |
137 | 137 | // Add the main post type capabilities. |
138 | 138 | $capabilities = $this->get_core_caps(); |
139 | - foreach ( $capabilities as $cap_group ) { |
|
140 | - foreach ( $cap_group as $cap ) { |
|
141 | - $wp_roles->add_cap( 'administrator', $cap ); |
|
142 | - $wp_roles->add_cap( 'give_manager', $cap ); |
|
143 | - $wp_roles->add_cap( 'give_worker', $cap ); |
|
139 | + foreach ($capabilities as $cap_group) { |
|
140 | + foreach ($cap_group as $cap) { |
|
141 | + $wp_roles->add_cap('administrator', $cap); |
|
142 | + $wp_roles->add_cap('give_manager', $cap); |
|
143 | + $wp_roles->add_cap('give_worker', $cap); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | - $wp_roles->add_cap( 'give_accountant', 'edit_give_forms' ); |
|
148 | - $wp_roles->add_cap( 'give_accountant', 'read_private_give_forms' ); |
|
149 | - $wp_roles->add_cap( 'give_accountant', 'view_give_reports' ); |
|
150 | - $wp_roles->add_cap( 'give_accountant', 'export_give_reports' ); |
|
151 | - $wp_roles->add_cap( 'give_accountant', 'edit_give_payments' ); |
|
147 | + $wp_roles->add_cap('give_accountant', 'edit_give_forms'); |
|
148 | + $wp_roles->add_cap('give_accountant', 'read_private_give_forms'); |
|
149 | + $wp_roles->add_cap('give_accountant', 'view_give_reports'); |
|
150 | + $wp_roles->add_cap('give_accountant', 'export_give_reports'); |
|
151 | + $wp_roles->add_cap('give_accountant', 'edit_give_payments'); |
|
152 | 152 | |
153 | 153 | } |
154 | 154 | } |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | public function get_core_caps() { |
167 | 167 | $capabilities = array(); |
168 | 168 | |
169 | - $capability_types = array( 'give_form', 'give_payment' ); |
|
169 | + $capability_types = array('give_form', 'give_payment'); |
|
170 | 170 | |
171 | - foreach ( $capability_types as $capability_type ) { |
|
172 | - $capabilities[ $capability_type ] = array( |
|
171 | + foreach ($capability_types as $capability_type) { |
|
172 | + $capabilities[$capability_type] = array( |
|
173 | 173 | // Post type. |
174 | 174 | "edit_{$capability_type}", |
175 | 175 | "read_{$capability_type}", |
@@ -215,22 +215,22 @@ discard block |
||
215 | 215 | * |
216 | 216 | * @return array $caps Meta capabilities. |
217 | 217 | */ |
218 | - public function meta_caps( $caps, $cap, $user_id, $args ) { |
|
218 | + public function meta_caps($caps, $cap, $user_id, $args) { |
|
219 | 219 | |
220 | - switch ( $cap ) { |
|
220 | + switch ($cap) { |
|
221 | 221 | |
222 | 222 | case 'view_give_form_stats' : |
223 | 223 | |
224 | - if ( empty( $args[0] ) ) { |
|
224 | + if (empty($args[0])) { |
|
225 | 225 | break; |
226 | 226 | } |
227 | 227 | |
228 | - $form = get_post( $args[0] ); |
|
229 | - if ( empty( $form ) ) { |
|
228 | + $form = get_post($args[0]); |
|
229 | + if (empty($form)) { |
|
230 | 230 | break; |
231 | 231 | } |
232 | 232 | |
233 | - if ( user_can( $user_id, 'view_give_reports' ) || $user_id == $form->post_author ) { |
|
233 | + if (user_can($user_id, 'view_give_reports') || $user_id == $form->post_author) { |
|
234 | 234 | $caps = array(); |
235 | 235 | } |
236 | 236 | |
@@ -257,41 +257,41 @@ discard block |
||
257 | 257 | |
258 | 258 | global $wp_roles; |
259 | 259 | |
260 | - if ( class_exists( 'WP_Roles' ) ) { |
|
261 | - if ( ! isset( $wp_roles ) ) { |
|
260 | + if (class_exists('WP_Roles')) { |
|
261 | + if ( ! isset($wp_roles)) { |
|
262 | 262 | $wp_roles = new WP_Roles(); |
263 | 263 | } |
264 | 264 | } |
265 | 265 | |
266 | - if ( is_object( $wp_roles ) ) { |
|
266 | + if (is_object($wp_roles)) { |
|
267 | 267 | // Give Manager Capabilities. |
268 | - $wp_roles->remove_cap( 'give_manager', 'view_give_reports' ); |
|
269 | - $wp_roles->remove_cap( 'give_manager', 'view_give_sensitive_data' ); |
|
270 | - $wp_roles->remove_cap( 'give_manager', 'export_give_reports' ); |
|
271 | - $wp_roles->remove_cap( 'give_manager', 'manage_give_settings' ); |
|
268 | + $wp_roles->remove_cap('give_manager', 'view_give_reports'); |
|
269 | + $wp_roles->remove_cap('give_manager', 'view_give_sensitive_data'); |
|
270 | + $wp_roles->remove_cap('give_manager', 'export_give_reports'); |
|
271 | + $wp_roles->remove_cap('give_manager', 'manage_give_settings'); |
|
272 | 272 | |
273 | 273 | // Site Administrator Capabilities. |
274 | - $wp_roles->remove_cap( 'administrator', 'view_give_reports' ); |
|
275 | - $wp_roles->remove_cap( 'administrator', 'view_give_sensitive_data' ); |
|
276 | - $wp_roles->remove_cap( 'administrator', 'export_give_reports' ); |
|
277 | - $wp_roles->remove_cap( 'administrator', 'manage_give_settings' ); |
|
274 | + $wp_roles->remove_cap('administrator', 'view_give_reports'); |
|
275 | + $wp_roles->remove_cap('administrator', 'view_give_sensitive_data'); |
|
276 | + $wp_roles->remove_cap('administrator', 'export_give_reports'); |
|
277 | + $wp_roles->remove_cap('administrator', 'manage_give_settings'); |
|
278 | 278 | |
279 | 279 | // Remove the Main Post Type Capabilities. |
280 | 280 | $capabilities = $this->get_core_caps(); |
281 | 281 | |
282 | - foreach ( $capabilities as $cap_group ) { |
|
283 | - foreach ( $cap_group as $cap ) { |
|
284 | - $wp_roles->remove_cap( 'give_manager', $cap ); |
|
285 | - $wp_roles->remove_cap( 'administrator', $cap ); |
|
286 | - $wp_roles->remove_cap( 'give_worker', $cap ); |
|
282 | + foreach ($capabilities as $cap_group) { |
|
283 | + foreach ($cap_group as $cap) { |
|
284 | + $wp_roles->remove_cap('give_manager', $cap); |
|
285 | + $wp_roles->remove_cap('administrator', $cap); |
|
286 | + $wp_roles->remove_cap('give_worker', $cap); |
|
287 | 287 | } |
288 | 288 | } |
289 | 289 | |
290 | 290 | /** Give Accountant Capabilities */ |
291 | - $wp_roles->remove_cap( 'give_accountant', 'edit_give_forms' ); |
|
292 | - $wp_roles->remove_cap( 'give_accountant', 'read_private_give_forms' ); |
|
293 | - $wp_roles->remove_cap( 'give_accountant', 'view_give_reports' ); |
|
294 | - $wp_roles->remove_cap( 'give_accountant', 'export_give_reports' ); |
|
291 | + $wp_roles->remove_cap('give_accountant', 'edit_give_forms'); |
|
292 | + $wp_roles->remove_cap('give_accountant', 'read_private_give_forms'); |
|
293 | + $wp_roles->remove_cap('give_accountant', 'view_give_reports'); |
|
294 | + $wp_roles->remove_cap('give_accountant', 'export_give_reports'); |
|
295 | 295 | |
296 | 296 | } |
297 | 297 | } |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | $current_user = wp_get_current_user(); |
312 | 312 | |
313 | 313 | // If user with "Give Accountant" user role is logged-in . |
314 | - if ( 0 !== $current_user->ID && in_array( 'give_accountant', (array) $current_user->roles, true ) ) { |
|
314 | + if (0 !== $current_user->ID && in_array('give_accountant', (array) $current_user->roles, true)) { |
|
315 | 315 | |
316 | 316 | // Return false, means no prevention. |
317 | 317 | return false; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return bool true if has variable prices, false otherwise |
25 | 25 | */ |
26 | -function give_has_variable_prices( $form_id = 0 ) { |
|
26 | +function give_has_variable_prices($form_id = 0) { |
|
27 | 27 | |
28 | - if ( empty( $form_id ) ) { |
|
28 | + if (empty($form_id)) { |
|
29 | 29 | return false; |
30 | 30 | } |
31 | 31 | |
32 | - $form = new Give_Donate_Form( $form_id ); |
|
32 | + $form = new Give_Donate_Form($form_id); |
|
33 | 33 | |
34 | 34 | return $form->has_variable_prices(); |
35 | 35 | } |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return array|bool Variable prices |
46 | 46 | */ |
47 | -function give_get_variable_prices( $form_id = 0 ) { |
|
47 | +function give_get_variable_prices($form_id = 0) { |
|
48 | 48 | |
49 | - if ( empty( $form_id ) ) { |
|
49 | + if (empty($form_id)) { |
|
50 | 50 | return false; |
51 | 51 | } |
52 | 52 | |
53 | - $form = new Give_Donate_Form( $form_id ); |
|
53 | + $form = new Give_Donate_Form($form_id); |
|
54 | 54 | |
55 | 55 | return $form->prices; |
56 | 56 | |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @return array Variable prices |
67 | 67 | */ |
68 | -function give_get_variable_price_ids( $form_id = 0 ) { |
|
69 | - if( ! ( $prices = give_get_variable_prices( $form_id ) ) ) { |
|
68 | +function give_get_variable_price_ids($form_id = 0) { |
|
69 | + if ( ! ($prices = give_get_variable_prices($form_id))) { |
|
70 | 70 | return array(); |
71 | 71 | } |
72 | 72 | |
73 | 73 | $price_ids = array(); |
74 | - foreach ( $prices as $price ){ |
|
74 | + foreach ($prices as $price) { |
|
75 | 75 | $price_ids[] = $price['_give_id']['level_id']; |
76 | 76 | } |
77 | 77 | |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @return string $default_price |
91 | 91 | */ |
92 | -function give_get_default_multilevel_amount( $form_id ) { |
|
92 | +function give_get_default_multilevel_amount($form_id) { |
|
93 | 93 | $default_price = '1.00'; |
94 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
94 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
95 | 95 | |
96 | - foreach ( $prices as $price ) { |
|
96 | + foreach ($prices as $price) { |
|
97 | 97 | |
98 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
98 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
99 | 99 | $default_price = $price['_give_amount']; |
100 | 100 | } |
101 | 101 | |
@@ -116,19 +116,19 @@ discard block |
||
116 | 116 | * @return string $default_price |
117 | 117 | * @since 1.0 |
118 | 118 | */ |
119 | -function give_get_default_form_amount( $form_id ) { |
|
119 | +function give_get_default_form_amount($form_id) { |
|
120 | 120 | |
121 | - if ( give_has_variable_prices( $form_id ) ) { |
|
121 | + if (give_has_variable_prices($form_id)) { |
|
122 | 122 | |
123 | - $default_amount = give_get_default_multilevel_amount( $form_id ); |
|
123 | + $default_amount = give_get_default_multilevel_amount($form_id); |
|
124 | 124 | |
125 | 125 | } else { |
126 | 126 | |
127 | - $default_amount = give_get_meta( $form_id, '_give_set_price', true ); |
|
127 | + $default_amount = give_get_meta($form_id, '_give_set_price', true); |
|
128 | 128 | |
129 | 129 | } |
130 | 130 | |
131 | - return apply_filters( 'give_default_form_amount', $default_amount, $form_id ); |
|
131 | + return apply_filters('give_default_form_amount', $default_amount, $form_id); |
|
132 | 132 | |
133 | 133 | } |
134 | 134 | |
@@ -146,13 +146,13 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @return bool |
148 | 148 | */ |
149 | -function give_is_custom_price_mode( $form_id = 0 ) { |
|
149 | +function give_is_custom_price_mode($form_id = 0) { |
|
150 | 150 | |
151 | - if ( empty( $form_id ) ) { |
|
151 | + if (empty($form_id)) { |
|
152 | 152 | return false; |
153 | 153 | } |
154 | 154 | |
155 | - $form = new Give_Donate_Form( $form_id ); |
|
155 | + $form = new Give_Donate_Form($form_id); |
|
156 | 156 | |
157 | 157 | return $form->is_custom_price_mode(); |
158 | 158 | } |
159 | 159 | \ 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 | |
@@ -26,34 +26,34 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | -function give_set_settings_with_disable_prefix( $old_settings, $settings ) { |
|
29 | +function give_set_settings_with_disable_prefix($old_settings, $settings) { |
|
30 | 30 | // Bailout. |
31 | - if ( ! function_exists( 'give_v18_renamed_core_settings' ) ) { |
|
31 | + if ( ! function_exists('give_v18_renamed_core_settings')) { |
|
32 | 32 | return; |
33 | 33 | } |
34 | 34 | |
35 | 35 | // Get old setting names. |
36 | - $old_settings = array_flip( give_v18_renamed_core_settings() ); |
|
36 | + $old_settings = array_flip(give_v18_renamed_core_settings()); |
|
37 | 37 | $update_setting = false; |
38 | 38 | |
39 | - foreach ( $settings as $key => $value ) { |
|
39 | + foreach ($settings as $key => $value) { |
|
40 | 40 | |
41 | 41 | // Check 1. Check if new option is really updated or not. |
42 | 42 | // Check 2. Continue if key is not renamed. |
43 | - if ( ! isset( $old_settings[ $key ] ) ) { |
|
43 | + if ( ! isset($old_settings[$key])) { |
|
44 | 44 | continue; |
45 | 45 | } |
46 | 46 | |
47 | 47 | // Set old setting. |
48 | - $settings[ $old_settings[ $key ] ] = 'on'; |
|
48 | + $settings[$old_settings[$key]] = 'on'; |
|
49 | 49 | |
50 | 50 | // Do not need to set old setting if new setting is not set. |
51 | 51 | if ( |
52 | - ( give_is_setting_enabled( $value ) && ( false !== strpos( $old_settings[ $key ], 'disable_' ) ) ) |
|
53 | - || ( ! give_is_setting_enabled( $value ) && ( false !== strpos( $old_settings[ $key ], 'enable_' ) ) ) |
|
52 | + (give_is_setting_enabled($value) && (false !== strpos($old_settings[$key], 'disable_'))) |
|
53 | + || ( ! give_is_setting_enabled($value) && (false !== strpos($old_settings[$key], 'enable_'))) |
|
54 | 54 | |
55 | 55 | ) { |
56 | - unset( $settings[ $old_settings[ $key ] ] ); |
|
56 | + unset($settings[$old_settings[$key]]); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // Tell bot to update setting. |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | // Update setting if any old setting set. |
64 | - if ( $update_setting ) { |
|
65 | - update_option( 'give_settings', $settings ); |
|
64 | + if ($update_setting) { |
|
65 | + update_option('give_settings', $settings); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | -add_action( 'update_option_give_settings', 'give_set_settings_with_disable_prefix', 10, 2 ); |
|
69 | +add_action('update_option_give_settings', 'give_set_settings_with_disable_prefix', 10, 2); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Check spam through Akismet. |
@@ -80,45 +80,45 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return bool|mixed |
82 | 82 | */ |
83 | -function give_akismet( $spam ) { |
|
83 | +function give_akismet($spam) { |
|
84 | 84 | |
85 | 85 | // Bail out, If spam. |
86 | - if ( $spam ) { |
|
86 | + if ($spam) { |
|
87 | 87 | return $spam; |
88 | 88 | } |
89 | 89 | |
90 | 90 | // Bail out, if Akismet key not exist. |
91 | - if ( ! give_check_akismet_key() ) { |
|
91 | + if ( ! give_check_akismet_key()) { |
|
92 | 92 | return false; |
93 | 93 | } |
94 | 94 | |
95 | 95 | // Build args array. |
96 | 96 | $args = array(); |
97 | 97 | |
98 | - $args['comment_author'] = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : ''; |
|
99 | - $args['comment_author_email'] = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false; |
|
100 | - $args['blog'] = get_option( 'home' ); |
|
98 | + $args['comment_author'] = isset($_POST['give_first']) ? strip_tags(trim($_POST['give_first'])) : ''; |
|
99 | + $args['comment_author_email'] = isset($_POST['give_email']) ? $_POST['give_email'] : false; |
|
100 | + $args['blog'] = get_option('home'); |
|
101 | 101 | $args['blog_lang'] = get_locale(); |
102 | - $args['blog_charset'] = get_option( 'blog_charset' ); |
|
102 | + $args['blog_charset'] = get_option('blog_charset'); |
|
103 | 103 | $args['user_ip'] = $_SERVER['REMOTE_ADDR']; |
104 | 104 | $args['user_agent'] = $_SERVER['HTTP_USER_AGENT']; |
105 | 105 | $args['referrer'] = $_SERVER['HTTP_REFERER']; |
106 | 106 | $args['comment_type'] = 'contact-form'; |
107 | 107 | |
108 | - $ignore = array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' ); |
|
108 | + $ignore = array('HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'); |
|
109 | 109 | |
110 | - foreach ( $_SERVER as $key => $value ) { |
|
111 | - if ( ! in_array( $key, (array) $ignore ) ) { |
|
110 | + foreach ($_SERVER as $key => $value) { |
|
111 | + if ( ! in_array($key, (array) $ignore)) { |
|
112 | 112 | $args["$key"] = $value; |
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | 116 | // It will return Akismet spam detect API response. |
117 | - return give_akismet_spam_check( $args ); |
|
117 | + return give_akismet_spam_check($args); |
|
118 | 118 | |
119 | 119 | } |
120 | 120 | |
121 | -add_filter( 'give_spam', 'give_akismet' ); |
|
121 | +add_filter('give_spam', 'give_akismet'); |
|
122 | 122 | |
123 | 123 | /** |
124 | 124 | * Check Akismet API Key. |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | * @return bool |
129 | 129 | */ |
130 | 130 | function give_check_akismet_key() { |
131 | - if ( is_callable( array( 'Akismet', 'get_api_key' ) ) ) { // Akismet v3.0+ |
|
131 | + if (is_callable(array('Akismet', 'get_api_key'))) { // Akismet v3.0+ |
|
132 | 132 | return (bool) Akismet::get_api_key(); |
133 | 133 | } |
134 | 134 | |
135 | - if ( function_exists( 'akismet_get_key' ) ) { |
|
135 | + if (function_exists('akismet_get_key')) { |
|
136 | 136 | return (bool) akismet_get_key(); |
137 | 137 | } |
138 | 138 | |
@@ -148,24 +148,24 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @return bool|mixed |
150 | 150 | */ |
151 | -function give_akismet_spam_check( $args ) { |
|
151 | +function give_akismet_spam_check($args) { |
|
152 | 152 | global $akismet_api_host, $akismet_api_port; |
153 | 153 | |
154 | 154 | $spam = false; |
155 | - $query_string = http_build_query( $args ); |
|
155 | + $query_string = http_build_query($args); |
|
156 | 156 | |
157 | - if ( is_callable( array( 'Akismet', 'http_post' ) ) ) { // Akismet v3.0+ |
|
158 | - $response = Akismet::http_post( $query_string, 'comment-check' ); |
|
157 | + if (is_callable(array('Akismet', 'http_post'))) { // Akismet v3.0+ |
|
158 | + $response = Akismet::http_post($query_string, 'comment-check'); |
|
159 | 159 | } else { |
160 | - $response = akismet_http_post( $query_string, $akismet_api_host, |
|
161 | - '/1.1/comment-check', $akismet_api_port ); |
|
160 | + $response = akismet_http_post($query_string, $akismet_api_host, |
|
161 | + '/1.1/comment-check', $akismet_api_port); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | // It's spam if response status is true. |
165 | - if ( 'true' === $response[1] ) { |
|
165 | + if ('true' === $response[1]) { |
|
166 | 166 | $spam = true; |
167 | 167 | } |
168 | 168 | |
169 | 169 | // Allow developer to modified Akismet spam detection response. |
170 | - return apply_filters( 'give_akismet_spam_check', $spam, $args ); |
|
170 | + return apply_filters('give_akismet_spam_check', $spam, $args); |
|
171 | 171 | } |
172 | 172 | \ No newline at end of file |