@@ -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_Email' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Email')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Email. |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'emails'; |
30 | - $this->label = esc_html__( 'Emails', 'give' ); |
|
30 | + $this->label = esc_html__('Emails', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'email-settings'; |
33 | 33 | |
34 | 34 | parent::__construct(); |
35 | 35 | |
36 | - add_action( 'give_admin_field_email_notification', array( $this, 'email_notification_setting' ) ); |
|
36 | + add_action('give_admin_field_email_notification', array($this, 'email_notification_setting')); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -46,13 +46,13 @@ discard block |
||
46 | 46 | $settings = array(); |
47 | 47 | $current_section = give_get_current_setting_section(); |
48 | 48 | |
49 | - switch ( $current_section ) { |
|
49 | + switch ($current_section) { |
|
50 | 50 | case 'email-settings' : |
51 | 51 | $settings = array( |
52 | 52 | |
53 | 53 | // Section 1: Email Notification Listing. |
54 | 54 | array( |
55 | - 'desc' => __( 'Email notifications sent from Give are listed below. Click on an email to configure it.', 'give' ), |
|
55 | + 'desc' => __('Email notifications sent from Give are listed below. Click on an email to configure it.', 'give'), |
|
56 | 56 | 'type' => 'title', |
57 | 57 | 'id' => 'give_email_notification_settings', |
58 | 58 | 'table_html' => false, |
@@ -67,42 +67,42 @@ discard block |
||
67 | 67 | |
68 | 68 | // Section 2: Email Sender Setting |
69 | 69 | array( |
70 | - 'title' => __( 'Email Sender Options', 'give' ), |
|
70 | + 'title' => __('Email Sender Options', 'give'), |
|
71 | 71 | 'id' => 'give_title_email_settings_1', |
72 | 72 | 'type' => 'title', |
73 | 73 | ), |
74 | 74 | array( |
75 | 75 | 'id' => 'email_template', |
76 | - 'name' => esc_html__( 'Email Template', 'give' ), |
|
77 | - 'desc' => esc_html__( 'Choose your template from the available registered template types.', 'give' ), |
|
76 | + 'name' => esc_html__('Email Template', 'give'), |
|
77 | + 'desc' => esc_html__('Choose your template from the available registered template types.', 'give'), |
|
78 | 78 | 'type' => 'select', |
79 | 79 | 'options' => give_get_email_templates(), |
80 | 80 | ), |
81 | 81 | array( |
82 | 82 | 'id' => 'email_logo', |
83 | - 'name' => esc_html__( 'Logo', 'give' ), |
|
84 | - 'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ), |
|
83 | + 'name' => esc_html__('Logo', 'give'), |
|
84 | + 'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), |
|
85 | 85 | 'type' => 'file', |
86 | 86 | ), |
87 | 87 | array( |
88 | 88 | 'id' => 'from_name', |
89 | - 'name' => esc_html__( 'From Name', 'give' ), |
|
90 | - 'desc' => esc_html__( 'The name which appears in the "From" field in all Give donation emails.', 'give' ), |
|
91 | - 'default' => get_bloginfo( 'name' ), |
|
89 | + 'name' => esc_html__('From Name', 'give'), |
|
90 | + 'desc' => esc_html__('The name which appears in the "From" field in all Give donation emails.', 'give'), |
|
91 | + 'default' => get_bloginfo('name'), |
|
92 | 92 | 'type' => 'text', |
93 | 93 | ), |
94 | 94 | array( |
95 | 95 | 'id' => 'from_email', |
96 | - 'name' => esc_html__( 'From Email', 'give' ), |
|
97 | - 'desc' => esc_html__( 'Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give' ), |
|
98 | - 'default' => get_bloginfo( 'admin_email' ), |
|
96 | + 'name' => esc_html__('From Email', 'give'), |
|
97 | + 'desc' => esc_html__('Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give'), |
|
98 | + 'default' => get_bloginfo('admin_email'), |
|
99 | 99 | 'type' => 'text', |
100 | 100 | ), |
101 | 101 | array( |
102 | - 'name' => esc_html__( 'Donation Notification Settings Docs Link', 'give' ), |
|
102 | + 'name' => esc_html__('Donation Notification Settings Docs Link', 'give'), |
|
103 | 103 | 'id' => 'donation_notification_settings_docs_link', |
104 | - 'url' => esc_url( 'http://docs.givewp.com/settings-donation-notification' ), |
|
105 | - 'title' => __( 'Donation Notification Settings', 'give' ), |
|
104 | + 'url' => esc_url('http://docs.givewp.com/settings-donation-notification'), |
|
105 | + 'title' => __('Donation Notification Settings', 'give'), |
|
106 | 106 | 'type' => 'give_docs_link', |
107 | 107 | ), |
108 | 108 | array( |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * Filter the emails settings. |
118 | 118 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
119 | 119 | */ |
120 | - $settings = apply_filters( 'give_settings_emails', $settings ); |
|
120 | + $settings = apply_filters('give_settings_emails', $settings); |
|
121 | 121 | |
122 | 122 | /** |
123 | 123 | * Filter the settings. |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @param array $settings |
128 | 128 | */ |
129 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
129 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
130 | 130 | |
131 | 131 | // Output. |
132 | 132 | return $settings; |
@@ -140,10 +140,10 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public function get_sections() { |
142 | 142 | $sections = array( |
143 | - 'email-settings' => esc_html__( 'Email Settings', 'give' ), |
|
143 | + 'email-settings' => esc_html__('Email Settings', 'give'), |
|
144 | 144 | ); |
145 | 145 | |
146 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
146 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function email_notification_setting() { |
156 | 156 | // Load email notification table. |
157 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notification-table.php'; |
|
157 | + require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notification-table.php'; |
|
158 | 158 | |
159 | 159 | // Init table. |
160 | 160 | $email_notifications_table = new Give_Email_Notification_Table(); |
@@ -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_Advanced' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Advanced')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Advanced. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'advanced'; |
30 | - $this->label = __( 'Advanced', 'give' ); |
|
30 | + $this->label = __('Advanced', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'advanced-options'; |
33 | 33 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $current_section = give_get_current_setting_section(); |
47 | 47 | |
48 | - switch ( $current_section ) { |
|
48 | + switch ($current_section) { |
|
49 | 49 | case 'advanced-options': |
50 | 50 | $settings = array( |
51 | 51 | array( |
@@ -53,19 +53,19 @@ discard block |
||
53 | 53 | 'type' => 'title', |
54 | 54 | ), |
55 | 55 | array( |
56 | - 'name' => __( 'Remove Data on Uninstall', 'give' ), |
|
57 | - 'desc' => __( 'When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give' ), |
|
56 | + 'name' => __('Remove Data on Uninstall', 'give'), |
|
57 | + 'desc' => __('When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give'), |
|
58 | 58 | 'id' => 'uninstall_on_delete', |
59 | 59 | 'type' => 'radio_inline', |
60 | 60 | 'default' => 'disabled', |
61 | 61 | 'options' => array( |
62 | - 'enabled' => __( 'Yes, Remove all data', 'give' ), |
|
63 | - 'disabled' => __( 'No, keep my Give settings and donation data', 'give' ), |
|
62 | + 'enabled' => __('Yes, Remove all data', 'give'), |
|
63 | + 'disabled' => __('No, keep my Give settings and donation data', 'give'), |
|
64 | 64 | ), |
65 | 65 | ), |
66 | 66 | array( |
67 | - 'name' => __( 'Default User Role', 'give' ), |
|
68 | - 'desc' => __( 'Assign default user roles for donors when donors opt to register as a WP User.', 'give' ), |
|
67 | + 'name' => __('Default User Role', 'give'), |
|
68 | + 'desc' => __('Assign default user roles for donors when donors opt to register as a WP User.', 'give'), |
|
69 | 69 | 'id' => 'donor_default_user_role', |
70 | 70 | 'type' => 'select', |
71 | 71 | 'default' => 'give_donor', |
@@ -73,44 +73,44 @@ discard block |
||
73 | 73 | ), |
74 | 74 | array( |
75 | 75 | /* translators: %s: the_content */ |
76 | - 'name' => sprintf( __( '%s filter', 'give' ), '<code>the_content</code>' ), |
|
76 | + 'name' => sprintf(__('%s filter', 'give'), '<code>the_content</code>'), |
|
77 | 77 | /* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */ |
78 | - 'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ), |
|
78 | + 'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'), |
|
79 | 79 | 'id' => 'the_content_filter', |
80 | 80 | 'default' => 'enabled', |
81 | 81 | 'type' => 'radio_inline', |
82 | 82 | 'options' => array( |
83 | - 'enabled' => __( 'Enabled', 'give' ), |
|
84 | - 'disabled' => __( 'Disabled', 'give' ), |
|
83 | + 'enabled' => __('Enabled', 'give'), |
|
84 | + 'disabled' => __('Disabled', 'give'), |
|
85 | 85 | ), |
86 | 86 | ), |
87 | 87 | array( |
88 | - 'name' => __( 'Script Loading Location', 'give' ), |
|
89 | - 'desc' => __( 'This allows you to load your Give scripts either in the <code><head></code> or footer of your website.', 'give' ), |
|
88 | + 'name' => __('Script Loading Location', 'give'), |
|
89 | + 'desc' => __('This allows you to load your Give scripts either in the <code><head></code> or footer of your website.', 'give'), |
|
90 | 90 | 'id' => 'scripts_footer', |
91 | 91 | 'type' => 'radio_inline', |
92 | 92 | 'default' => 'disabled', |
93 | 93 | 'options' => array( |
94 | - 'disabled' => __( 'Head', 'give' ), |
|
95 | - 'enabled' => __( 'Footer', 'give' ), |
|
94 | + 'disabled' => __('Head', 'give'), |
|
95 | + 'enabled' => __('Footer', 'give'), |
|
96 | 96 | ), |
97 | 97 | ), |
98 | 98 | array( |
99 | - 'name' => __( 'Akismet SPAM Protection', 'give' ), |
|
100 | - 'desc' => __( 'Add a layer of SPAM protection to your donation submissions with Akismet. When enabled, donation submissions will be first sent to Akismet\'s API if you have the plugin activated and configured.', 'give' ), |
|
99 | + 'name' => __('Akismet SPAM Protection', 'give'), |
|
100 | + 'desc' => __('Add a layer of SPAM protection to your donation submissions with Akismet. When enabled, donation submissions will be first sent to Akismet\'s API if you have the plugin activated and configured.', 'give'), |
|
101 | 101 | 'id' => 'akismet_spam_protection', |
102 | 102 | 'type' => 'radio_inline', |
103 | - 'default' => ( give_check_akismet_key() ) ? 'enabled' : 'disabled', |
|
103 | + 'default' => (give_check_akismet_key()) ? 'enabled' : 'disabled', |
|
104 | 104 | 'options' => array( |
105 | - 'enabled' => __( 'Enabled', 'give' ), |
|
106 | - 'disabled' => __( 'Disabled', 'give' ), |
|
105 | + 'enabled' => __('Enabled', 'give'), |
|
106 | + 'disabled' => __('Disabled', 'give'), |
|
107 | 107 | ), |
108 | 108 | ), |
109 | 109 | array( |
110 | - 'name' => __( 'Advanced Settings Docs Link', 'give' ), |
|
110 | + 'name' => __('Advanced Settings Docs Link', 'give'), |
|
111 | 111 | 'id' => 'advanced_settings_docs_link', |
112 | - 'url' => esc_url( 'http://docs.givewp.com/settings-advanced' ), |
|
113 | - 'title' => __( 'Advanced Settings', 'give' ), |
|
112 | + 'url' => esc_url('http://docs.givewp.com/settings-advanced'), |
|
113 | + 'title' => __('Advanced Settings', 'give'), |
|
114 | 114 | 'type' => 'give_docs_link', |
115 | 115 | ), |
116 | 116 | array( |
@@ -126,20 +126,20 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @since 2.0 |
128 | 128 | */ |
129 | - if( apply_filters( 'give_settings_advanced_show_cache_setting', false ) ) { |
|
130 | - array_splice( $settings, 1, 0, array( |
|
129 | + if (apply_filters('give_settings_advanced_show_cache_setting', false)) { |
|
130 | + array_splice($settings, 1, 0, array( |
|
131 | 131 | array( |
132 | - 'name' => __( 'Cache', 'give' ), |
|
133 | - 'desc' => __( 'If caching is enabled the plugin will start caching custom post type related queries and reduce the overall load time.', 'give' ), |
|
132 | + 'name' => __('Cache', 'give'), |
|
133 | + 'desc' => __('If caching is enabled the plugin will start caching custom post type related queries and reduce the overall load time.', 'give'), |
|
134 | 134 | 'id' => 'cache', |
135 | 135 | 'type' => 'radio_inline', |
136 | 136 | 'default' => 'enabled', |
137 | 137 | 'options' => array( |
138 | - 'enabled' => __( 'Enabled', 'give' ), |
|
139 | - 'disabled' => __( 'Disabled', 'give' ), |
|
138 | + 'enabled' => __('Enabled', 'give'), |
|
139 | + 'disabled' => __('Disabled', 'give'), |
|
140 | 140 | ), |
141 | 141 | ) |
142 | - ) ); |
|
142 | + )); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * Filter the advanced settings. |
148 | 148 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
149 | 149 | */ |
150 | - $settings = apply_filters( 'give_settings_advanced', $settings ); |
|
150 | + $settings = apply_filters('give_settings_advanced', $settings); |
|
151 | 151 | |
152 | 152 | /** |
153 | 153 | * Filter the settings. |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * |
157 | 157 | * @param array $settings |
158 | 158 | */ |
159 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
159 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
160 | 160 | |
161 | 161 | // Output. |
162 | 162 | return $settings; |
@@ -170,10 +170,10 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function get_sections() { |
172 | 172 | $sections = array( |
173 | - 'advanced-options' => __( 'Advanced Options', 'give' ), |
|
173 | + 'advanced-options' => __('Advanced Options', 'give'), |
|
174 | 174 | ); |
175 | 175 | |
176 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
176 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 |
@@ -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,7 +32,7 @@ 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' ); |
|
35 | + $give_payment = get_post_type_object('give_payment'); |
|
36 | 36 | $give_payments_page = add_submenu_page( |
37 | 37 | 'edit.php?post_type=give_forms', |
38 | 38 | $give_payment->labels->name, |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | //Donors |
46 | 46 | $give_donors_page = add_submenu_page( |
47 | 47 | 'edit.php?post_type=give_forms', |
48 | - esc_html__( 'Donors', 'give' ), |
|
49 | - esc_html__( 'Donors', 'give' ), |
|
48 | + esc_html__('Donors', 'give'), |
|
49 | + esc_html__('Donors', 'give'), |
|
50 | 50 | 'view_give_reports', |
51 | 51 | 'give-donors', |
52 | 52 | 'give_donors_page' |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | //Reports` |
56 | 56 | $give_reports_page = add_submenu_page( |
57 | 57 | 'edit.php?post_type=give_forms', |
58 | - esc_html__( 'Donation Reports', 'give' ), |
|
59 | - esc_html__( 'Reports', 'give' ), |
|
58 | + esc_html__('Donation Reports', 'give'), |
|
59 | + esc_html__('Reports', 'give'), |
|
60 | 60 | 'view_give_reports', |
61 | 61 | 'give-reports', |
62 | 62 | array( |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | //Settings |
69 | 69 | $give_settings_page = add_submenu_page( |
70 | 70 | 'edit.php?post_type=give_forms', |
71 | - esc_html__( 'Give Settings', 'give' ), |
|
72 | - esc_html__( 'Settings', 'give' ), |
|
71 | + esc_html__('Give Settings', 'give'), |
|
72 | + esc_html__('Settings', 'give'), |
|
73 | 73 | 'manage_give_settings', |
74 | 74 | 'give-settings', |
75 | 75 | array( |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | //Tools. |
82 | 82 | $give_tools_page = add_submenu_page( |
83 | 83 | 'edit.php?post_type=give_forms', |
84 | - esc_html__( 'Give Tools', 'give' ), |
|
85 | - esc_html__( 'Tools', 'give' ), |
|
84 | + esc_html__('Give Tools', 'give'), |
|
85 | + esc_html__('Tools', 'give'), |
|
86 | 86 | 'manage_give_settings', |
87 | 87 | 'give-tools', |
88 | 88 | array( |
@@ -94,15 +94,15 @@ discard block |
||
94 | 94 | //Add-ons |
95 | 95 | $give_add_ons_page = add_submenu_page( |
96 | 96 | 'edit.php?post_type=give_forms', |
97 | - esc_html__( 'Give Add-ons', 'give' ), |
|
98 | - esc_html__( 'Add-ons', 'give' ), |
|
97 | + esc_html__('Give Add-ons', 'give'), |
|
98 | + esc_html__('Add-ons', 'give'), |
|
99 | 99 | 'install_plugins', |
100 | 100 | 'give-addons', |
101 | 101 | 'give_add_ons_page' |
102 | 102 | ); |
103 | 103 | } |
104 | 104 | |
105 | -add_action( 'admin_menu', 'give_add_options_links', 10 ); |
|
105 | +add_action('admin_menu', 'give_add_options_links', 10); |
|
106 | 106 | |
107 | 107 | /** |
108 | 108 | * Determines whether the current admin page is a Give admin page. |
@@ -117,224 +117,224 @@ discard block |
||
117 | 117 | * |
118 | 118 | * @return bool True if Give admin page. |
119 | 119 | */ |
120 | -function give_is_admin_page( $passed_page = '', $passed_view = '' ) { |
|
120 | +function give_is_admin_page($passed_page = '', $passed_view = '') { |
|
121 | 121 | |
122 | 122 | global $pagenow, $typenow; |
123 | 123 | |
124 | 124 | $found = false; |
125 | - $post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false; |
|
126 | - $action = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false; |
|
127 | - $taxonomy = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false; |
|
128 | - $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false; |
|
129 | - $view = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false; |
|
130 | - $tab = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false; |
|
131 | - |
|
132 | - switch ( $passed_page ) { |
|
125 | + $post_type = isset($_GET['post_type']) ? strtolower($_GET['post_type']) : false; |
|
126 | + $action = isset($_GET['action']) ? strtolower($_GET['action']) : false; |
|
127 | + $taxonomy = isset($_GET['taxonomy']) ? strtolower($_GET['taxonomy']) : false; |
|
128 | + $page = isset($_GET['page']) ? strtolower($_GET['page']) : false; |
|
129 | + $view = isset($_GET['view']) ? strtolower($_GET['view']) : false; |
|
130 | + $tab = isset($_GET['tab']) ? strtolower($_GET['tab']) : false; |
|
131 | + |
|
132 | + switch ($passed_page) { |
|
133 | 133 | case 'give_forms': |
134 | - switch ( $passed_view ) { |
|
134 | + switch ($passed_view) { |
|
135 | 135 | case 'list-table': |
136 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' ) { |
|
136 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php') { |
|
137 | 137 | $found = true; |
138 | 138 | } |
139 | 139 | break; |
140 | 140 | case 'edit': |
141 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post.php' ) { |
|
141 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post.php') { |
|
142 | 142 | $found = true; |
143 | 143 | } |
144 | 144 | break; |
145 | 145 | case 'new': |
146 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post-new.php' ) { |
|
146 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post-new.php') { |
|
147 | 147 | $found = true; |
148 | 148 | } |
149 | 149 | break; |
150 | 150 | default: |
151 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) || 'give_forms' === $post_type || ( 'post-new.php' == $pagenow && 'give_forms' === $post_type ) ) { |
|
151 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) || 'give_forms' === $post_type || ('post-new.php' == $pagenow && 'give_forms' === $post_type)) { |
|
152 | 152 | $found = true; |
153 | 153 | } |
154 | 154 | break; |
155 | 155 | } |
156 | 156 | break; |
157 | 157 | case 'categories': |
158 | - switch ( $passed_view ) { |
|
158 | + switch ($passed_view) { |
|
159 | 159 | case 'list-table': |
160 | 160 | case 'new': |
161 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy ) { |
|
161 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy) { |
|
162 | 162 | $found = true; |
163 | 163 | } |
164 | 164 | break; |
165 | 165 | case 'edit': |
166 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy ) { |
|
166 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy) { |
|
167 | 167 | $found = true; |
168 | 168 | } |
169 | 169 | break; |
170 | 170 | default: |
171 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy ) { |
|
171 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy) { |
|
172 | 172 | $found = true; |
173 | 173 | } |
174 | 174 | break; |
175 | 175 | } |
176 | 176 | break; |
177 | 177 | case 'tags': |
178 | - switch ( $passed_view ) { |
|
178 | + switch ($passed_view) { |
|
179 | 179 | case 'list-table': |
180 | 180 | case 'new': |
181 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy ) { |
|
181 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy) { |
|
182 | 182 | $found = true; |
183 | 183 | } |
184 | 184 | break; |
185 | 185 | case 'edit': |
186 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy ) { |
|
186 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy) { |
|
187 | 187 | $found = true; |
188 | 188 | } |
189 | 189 | break; |
190 | 190 | default: |
191 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy ) { |
|
191 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy) { |
|
192 | 192 | $found = true; |
193 | 193 | } |
194 | 194 | break; |
195 | 195 | } |
196 | 196 | break; |
197 | 197 | case 'payments': |
198 | - switch ( $passed_view ) { |
|
198 | + switch ($passed_view) { |
|
199 | 199 | case 'list-table': |
200 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view ) { |
|
200 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view) { |
|
201 | 201 | $found = true; |
202 | 202 | } |
203 | 203 | break; |
204 | 204 | case 'edit': |
205 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-payment-details' === $view ) { |
|
205 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-payment-details' === $view) { |
|
206 | 206 | $found = true; |
207 | 207 | } |
208 | 208 | break; |
209 | 209 | default: |
210 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page ) { |
|
210 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page) { |
|
211 | 211 | $found = true; |
212 | 212 | } |
213 | 213 | break; |
214 | 214 | } |
215 | 215 | break; |
216 | 216 | case 'reports': |
217 | - switch ( $passed_view ) { |
|
217 | + switch ($passed_view) { |
|
218 | 218 | // If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ] |
219 | 219 | case 'earnings': |
220 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) { |
|
220 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && ('earnings' === $view || '-1' === $view || false === $view)) { |
|
221 | 221 | $found = true; |
222 | 222 | } |
223 | 223 | break; |
224 | 224 | case 'donors': |
225 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view ) { |
|
225 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view) { |
|
226 | 226 | $found = true; |
227 | 227 | } |
228 | 228 | break; |
229 | 229 | case 'gateways': |
230 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view ) { |
|
230 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view) { |
|
231 | 231 | $found = true; |
232 | 232 | } |
233 | 233 | break; |
234 | 234 | case 'export': |
235 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view ) { |
|
235 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view) { |
|
236 | 236 | $found = true; |
237 | 237 | } |
238 | 238 | break; |
239 | 239 | case 'logs': |
240 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view ) { |
|
240 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view) { |
|
241 | 241 | $found = true; |
242 | 242 | } |
243 | 243 | break; |
244 | 244 | default: |
245 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
245 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
246 | 246 | $found = true; |
247 | 247 | } |
248 | 248 | break; |
249 | 249 | } |
250 | 250 | break; |
251 | 251 | case 'settings': |
252 | - switch ( $passed_view ) { |
|
252 | + switch ($passed_view) { |
|
253 | 253 | case 'general': |
254 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && ( 'general' === $tab || false === $tab ) ) { |
|
254 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && ('general' === $tab || false === $tab)) { |
|
255 | 255 | $found = true; |
256 | 256 | } |
257 | 257 | break; |
258 | 258 | case 'gateways': |
259 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab ) { |
|
259 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab) { |
|
260 | 260 | $found = true; |
261 | 261 | } |
262 | 262 | break; |
263 | 263 | case 'emails': |
264 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab ) { |
|
264 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab) { |
|
265 | 265 | $found = true; |
266 | 266 | } |
267 | 267 | break; |
268 | 268 | case 'display': |
269 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab ) { |
|
269 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab) { |
|
270 | 270 | $found = true; |
271 | 271 | } |
272 | 272 | break; |
273 | 273 | case 'licenses': |
274 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab ) { |
|
274 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab) { |
|
275 | 275 | $found = true; |
276 | 276 | } |
277 | 277 | break; |
278 | 278 | case 'api': |
279 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab ) { |
|
279 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab) { |
|
280 | 280 | $found = true; |
281 | 281 | } |
282 | 282 | break; |
283 | 283 | case 'advanced': |
284 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab ) { |
|
284 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab) { |
|
285 | 285 | $found = true; |
286 | 286 | } |
287 | 287 | break; |
288 | 288 | case 'system_info': |
289 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab ) { |
|
289 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab) { |
|
290 | 290 | $found = true; |
291 | 291 | } |
292 | 292 | break; |
293 | 293 | default: |
294 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page ) { |
|
294 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page) { |
|
295 | 295 | $found = true; |
296 | 296 | } |
297 | 297 | break; |
298 | 298 | } |
299 | 299 | break; |
300 | 300 | case 'addons': |
301 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-addons' === $page ) { |
|
301 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-addons' === $page) { |
|
302 | 302 | $found = true; |
303 | 303 | } |
304 | 304 | break; |
305 | 305 | case 'donors': |
306 | - switch ( $passed_view ) { |
|
306 | + switch ($passed_view) { |
|
307 | 307 | case 'list-table': |
308 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view ) { |
|
308 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view) { |
|
309 | 309 | $found = true; |
310 | 310 | } |
311 | 311 | break; |
312 | 312 | case 'overview': |
313 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view ) { |
|
313 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view) { |
|
314 | 314 | $found = true; |
315 | 315 | } |
316 | 316 | break; |
317 | 317 | case 'notes': |
318 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view ) { |
|
318 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view) { |
|
319 | 319 | $found = true; |
320 | 320 | } |
321 | 321 | break; |
322 | 322 | default: |
323 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page ) { |
|
323 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page) { |
|
324 | 324 | $found = true; |
325 | 325 | } |
326 | 326 | break; |
327 | 327 | } |
328 | 328 | break; |
329 | 329 | case 'reports': |
330 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
330 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
331 | 331 | $found = true; |
332 | 332 | } |
333 | 333 | break; |
334 | 334 | default: |
335 | 335 | 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; |
336 | 336 | |
337 | - $admin_pages = apply_filters( 'give_admin_pages', array( |
|
337 | + $admin_pages = apply_filters('give_admin_pages', array( |
|
338 | 338 | $give_payments_page, |
339 | 339 | $give_settings_page, |
340 | 340 | $give_reports_page, |
@@ -344,16 +344,16 @@ discard block |
||
344 | 344 | $give_donors_page, |
345 | 345 | $give_tools_page, |
346 | 346 | 'widgets.php' |
347 | - ) ); |
|
348 | - if ( 'give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) { |
|
347 | + )); |
|
348 | + if ('give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow) { |
|
349 | 349 | $found = true; |
350 | - } elseif ( in_array( $pagenow, $admin_pages ) ) { |
|
350 | + } elseif (in_array($pagenow, $admin_pages)) { |
|
351 | 351 | $found = true; |
352 | 352 | } |
353 | 353 | break; |
354 | 354 | } |
355 | 355 | |
356 | - return (bool) apply_filters( 'give_is_admin_page', $found, $page, $view, $passed_page, $passed_view ); |
|
356 | + return (bool) apply_filters('give_is_admin_page', $found, $page, $view, $passed_page, $passed_view); |
|
357 | 357 | |
358 | 358 | } |
359 | 359 | |
@@ -365,37 +365,37 @@ discard block |
||
365 | 365 | * @param array $settings |
366 | 366 | * @return array |
367 | 367 | */ |
368 | -function give_settings_page_pages( $settings ) { |
|
369 | - include( 'abstract-admin-settings-page.php' ); |
|
370 | - include( 'settings/class-settings-cmb2-backward-compatibility.php' ); |
|
368 | +function give_settings_page_pages($settings) { |
|
369 | + include('abstract-admin-settings-page.php'); |
|
370 | + include('settings/class-settings-cmb2-backward-compatibility.php'); |
|
371 | 371 | |
372 | 372 | $settings = array( |
373 | 373 | // General settings. |
374 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-general.php' ), |
|
374 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-general.php'), |
|
375 | 375 | |
376 | 376 | // Payment Gateways Settings. |
377 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-gateways.php' ), |
|
377 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-gateways.php'), |
|
378 | 378 | |
379 | 379 | // Display settings. |
380 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-display.php' ), |
|
380 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-display.php'), |
|
381 | 381 | |
382 | 382 | // Emails settings. |
383 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-email.php' ), |
|
383 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-email.php'), |
|
384 | 384 | |
385 | 385 | // Addons settings. |
386 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-addon.php' ), |
|
386 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-addon.php'), |
|
387 | 387 | |
388 | 388 | // License settings. |
389 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-license.php' ), |
|
389 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-license.php'), |
|
390 | 390 | |
391 | 391 | // Advanced settings. |
392 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-advanced.php' ) |
|
392 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-advanced.php') |
|
393 | 393 | ); |
394 | 394 | |
395 | 395 | // Output. |
396 | 396 | return $settings; |
397 | 397 | } |
398 | -add_filter( 'give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1 ); |
|
398 | +add_filter('give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1); |
|
399 | 399 | |
400 | 400 | |
401 | 401 | /** |
@@ -405,25 +405,25 @@ discard block |
||
405 | 405 | * @param array $settings |
406 | 406 | * @return array |
407 | 407 | */ |
408 | -function give_reports_page_pages( $settings ) { |
|
409 | - include( 'abstract-admin-settings-page.php' ); |
|
408 | +function give_reports_page_pages($settings) { |
|
409 | + include('abstract-admin-settings-page.php'); |
|
410 | 410 | |
411 | 411 | $settings = array( |
412 | 412 | // Earnings. |
413 | - include( 'reports/class-earnings-report.php' ), |
|
413 | + include('reports/class-earnings-report.php'), |
|
414 | 414 | |
415 | 415 | // Forms. |
416 | - include( 'reports/class-forms-report.php' ), |
|
416 | + include('reports/class-forms-report.php'), |
|
417 | 417 | |
418 | 418 | // Gateways. |
419 | - include( 'reports/class-gateways-report.php' ), |
|
419 | + include('reports/class-gateways-report.php'), |
|
420 | 420 | |
421 | 421 | ); |
422 | 422 | |
423 | 423 | // Output. |
424 | 424 | return $settings; |
425 | 425 | } |
426 | -add_filter( 'give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1 ); |
|
426 | +add_filter('give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1); |
|
427 | 427 | |
428 | 428 | /** |
429 | 429 | * Add setting tab to give-settings page |
@@ -432,33 +432,33 @@ discard block |
||
432 | 432 | * @param array $settings |
433 | 433 | * @return array |
434 | 434 | */ |
435 | -function give_tools_page_pages( $settings ) { |
|
436 | - include( 'abstract-admin-settings-page.php' ); |
|
435 | +function give_tools_page_pages($settings) { |
|
436 | + include('abstract-admin-settings-page.php'); |
|
437 | 437 | |
438 | 438 | $settings = array( |
439 | 439 | // System Info. |
440 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-system-info.php' ), |
|
440 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-system-info.php'), |
|
441 | 441 | |
442 | 442 | // Logs. |
443 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-logs.php' ), |
|
443 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-logs.php'), |
|
444 | 444 | |
445 | 445 | // API. |
446 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-api.php' ), |
|
446 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-api.php'), |
|
447 | 447 | |
448 | 448 | // Data. |
449 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-data.php' ), |
|
449 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-data.php'), |
|
450 | 450 | |
451 | 451 | // Export. |
452 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-export.php' ), |
|
452 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-export.php'), |
|
453 | 453 | |
454 | 454 | // Import |
455 | - include_once( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-import.php' ), |
|
455 | + include_once(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-import.php'), |
|
456 | 456 | ); |
457 | 457 | |
458 | 458 | // Output. |
459 | 459 | return $settings; |
460 | 460 | } |
461 | -add_filter( 'give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1 ); |
|
461 | +add_filter('give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1); |
|
462 | 462 | |
463 | 463 | /** |
464 | 464 | * Set default tools page tab. |
@@ -467,10 +467,10 @@ discard block |
||
467 | 467 | * @param string $default_tab Default tab name. |
468 | 468 | * @return string |
469 | 469 | */ |
470 | -function give_set_default_tab_form_tools_page( $default_tab ) { |
|
470 | +function give_set_default_tab_form_tools_page($default_tab) { |
|
471 | 471 | return 'system-info'; |
472 | 472 | } |
473 | -add_filter( 'give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1 ); |
|
473 | +add_filter('give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1); |
|
474 | 474 | |
475 | 475 | |
476 | 476 | /** |
@@ -480,10 +480,10 @@ discard block |
||
480 | 480 | * @param string $default_tab Default tab name. |
481 | 481 | * @return string |
482 | 482 | */ |
483 | -function give_set_default_tab_form_reports_page( $default_tab ) { |
|
483 | +function give_set_default_tab_form_reports_page($default_tab) { |
|
484 | 484 | return 'earnings'; |
485 | 485 | } |
486 | -add_filter( 'give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1 ); |
|
486 | +add_filter('give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1); |
|
487 | 487 | |
488 | 488 | |
489 | 489 | /** |
@@ -496,19 +496,19 @@ discard block |
||
496 | 496 | * |
497 | 497 | * @return array |
498 | 498 | */ |
499 | -function give_add_display_page_states( $post_states, $post ) { |
|
499 | +function give_add_display_page_states($post_states, $post) { |
|
500 | 500 | |
501 | - switch( $post->ID ) { |
|
502 | - case give_get_option( 'success_page' ): |
|
503 | - $post_states['give_successfully_page'] = __( 'Donation Success Page', 'give' ); |
|
501 | + switch ($post->ID) { |
|
502 | + case give_get_option('success_page'): |
|
503 | + $post_states['give_successfully_page'] = __('Donation Success Page', 'give'); |
|
504 | 504 | break; |
505 | 505 | |
506 | - case give_get_option( 'failure_page' ): |
|
507 | - $post_states['give_failure_page'] = __( 'Donation Failed Page', 'give' ); |
|
506 | + case give_get_option('failure_page'): |
|
507 | + $post_states['give_failure_page'] = __('Donation Failed Page', 'give'); |
|
508 | 508 | break; |
509 | 509 | |
510 | - case give_get_option( 'history_page' ): |
|
511 | - $post_states['give_history_page'] = __( 'Donation History Page', 'give' ); |
|
510 | + case give_get_option('history_page'): |
|
511 | + $post_states['give_history_page'] = __('Donation History Page', 'give'); |
|
512 | 512 | break; |
513 | 513 | } |
514 | 514 | |
@@ -516,4 +516,4 @@ discard block |
||
516 | 516 | } |
517 | 517 | |
518 | 518 | // Add a post display state for special Give pages. |
519 | -add_filter( 'display_post_states', 'give_add_display_page_states', 10, 2 ); |
|
520 | 519 | \ No newline at end of file |
520 | +add_filter('display_post_states', 'give_add_display_page_states', 10, 2); |
|
521 | 521 | \ 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 | |
@@ -25,135 +25,135 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @uses give_pdf |
27 | 27 | */ |
28 | -function give_generate_pdf( $data ) { |
|
28 | +function give_generate_pdf($data) { |
|
29 | 29 | |
30 | - if ( ! current_user_can( 'view_give_reports' ) ) { |
|
31 | - wp_die( __( 'You do not have permission to generate PDF sales reports.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
30 | + if ( ! current_user_can('view_give_reports')) { |
|
31 | + wp_die(__('You do not have permission to generate PDF sales reports.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
32 | 32 | } |
33 | 33 | |
34 | - if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'give_generate_pdf' ) ) { |
|
35 | - wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
34 | + if ( ! wp_verify_nonce($_GET['_wpnonce'], 'give_generate_pdf')) { |
|
35 | + wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
36 | 36 | } |
37 | 37 | |
38 | - if ( ! file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/give-pdf.php' ) ) { |
|
39 | - wp_die( __( 'Dependency missing.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
38 | + if ( ! file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/give-pdf.php')) { |
|
39 | + wp_die(__('Dependency missing.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
40 | 40 | } |
41 | 41 | |
42 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/give-pdf.php'; |
|
42 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/give-pdf.php'; |
|
43 | 43 | |
44 | 44 | $daterange = utf8_decode( |
45 | 45 | sprintf( |
46 | 46 | /* translators: 1: start date 2: end date */ |
47 | - __( '%1$s to %2$s', 'give' ), |
|
48 | - date_i18n( give_date_format(), mktime( 0, 0, 0, 1, 1, date( 'Y' ) ) ), |
|
49 | - date_i18n( give_date_format() ) |
|
47 | + __('%1$s to %2$s', 'give'), |
|
48 | + date_i18n(give_date_format(), mktime(0, 0, 0, 1, 1, date('Y'))), |
|
49 | + date_i18n(give_date_format()) |
|
50 | 50 | ) |
51 | 51 | ); |
52 | 52 | |
53 | - $categories_enabled = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ); |
|
54 | - $tags_enabled = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ); |
|
53 | + $categories_enabled = give_is_setting_enabled(give_get_option('categories', 'disabled')); |
|
54 | + $tags_enabled = give_is_setting_enabled(give_get_option('tags', 'disabled')); |
|
55 | 55 | |
56 | - $pdf = new Give_PDF( 'L', 'mm', 'A', true, 'UTF-8', false ); |
|
57 | - $default_font = apply_filters( 'give_pdf_default_font', 'Helvetica' ); |
|
56 | + $pdf = new Give_PDF('L', 'mm', 'A', true, 'UTF-8', false); |
|
57 | + $default_font = apply_filters('give_pdf_default_font', 'Helvetica'); |
|
58 | 58 | $custom_font = 'dejavusans'; |
59 | 59 | $font_style = ''; |
60 | 60 | |
61 | 61 | if ( |
62 | - file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/tcpdf/fonts/CODE2000.TTF' ) && |
|
62 | + file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/tcpdf/fonts/CODE2000.TTF') && |
|
63 | 63 | |
64 | 64 | // RIAL exist for backward compatibility. |
65 | - in_array( give_get_currency(), array( 'RIAL', 'RUB', 'IRR' ) ) |
|
65 | + in_array(give_get_currency(), array('RIAL', 'RUB', 'IRR')) |
|
66 | 66 | ) { |
67 | - TCPDF_FONTS::addTTFfont( GIVE_PLUGIN_DIR . '/includes/libraries/tcpdf/fonts/CODE2000.TTF', '' ); |
|
67 | + TCPDF_FONTS::addTTFfont(GIVE_PLUGIN_DIR.'/includes/libraries/tcpdf/fonts/CODE2000.TTF', ''); |
|
68 | 68 | $custom_font = 'CODE2000'; |
69 | 69 | $font_style = 'B'; |
70 | 70 | } |
71 | 71 | |
72 | - $pdf->AddPage( 'L', 'A4' ); |
|
73 | - $pdf->setImageScale( 1.5 ); |
|
74 | - $pdf->SetTitle( utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ) ); |
|
75 | - $pdf->SetAuthor( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) ); |
|
76 | - $pdf->SetCreator( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) ); |
|
72 | + $pdf->AddPage('L', 'A4'); |
|
73 | + $pdf->setImageScale(1.5); |
|
74 | + $pdf->SetTitle(utf8_decode(__('Donation report for the current year for all forms', 'give'))); |
|
75 | + $pdf->SetAuthor(utf8_decode(__('Give - Democratizing Generosity', 'give'))); |
|
76 | + $pdf->SetCreator(utf8_decode(__('Give - Democratizing Generosity', 'give'))); |
|
77 | 77 | |
78 | 78 | // Image URL should have absolute path. @see https://tcpdf.org/examples/example_009/. |
79 | - $pdf->Image( apply_filters( 'give_pdf_export_logo', GIVE_PLUGIN_DIR . 'assets/images/give-logo-small.png' ), 247, 8 ); |
|
79 | + $pdf->Image(apply_filters('give_pdf_export_logo', GIVE_PLUGIN_DIR.'assets/images/give-logo-small.png'), 247, 8); |
|
80 | 80 | |
81 | - $pdf->SetMargins( 8, 8, 8 ); |
|
82 | - $pdf->SetX( 8 ); |
|
81 | + $pdf->SetMargins(8, 8, 8); |
|
82 | + $pdf->SetX(8); |
|
83 | 83 | |
84 | - $pdf->SetFont( $default_font, '', 16 ); |
|
85 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
86 | - $pdf->Cell( 0, 3, utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ), 0, 2, 'L', false ); |
|
84 | + $pdf->SetFont($default_font, '', 16); |
|
85 | + $pdf->SetTextColor(50, 50, 50); |
|
86 | + $pdf->Cell(0, 3, utf8_decode(__('Donation report for the current year for all forms', 'give')), 0, 2, 'L', false); |
|
87 | 87 | |
88 | - $pdf->SetFont( $default_font, '', 13 ); |
|
89 | - $pdf->SetTextColor( 150, 150, 150 ); |
|
90 | - $pdf->Ln( 1 ); |
|
91 | - $pdf->Cell( 0, 6, utf8_decode( __( 'Date Range: ', 'give' ) ) . $daterange, 0, 2, 'L', false ); |
|
88 | + $pdf->SetFont($default_font, '', 13); |
|
89 | + $pdf->SetTextColor(150, 150, 150); |
|
90 | + $pdf->Ln(1); |
|
91 | + $pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'give')).$daterange, 0, 2, 'L', false); |
|
92 | 92 | $pdf->Ln(); |
93 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
94 | - $pdf->SetFont( $default_font, '', 14 ); |
|
95 | - $pdf->Cell( 0, 10, utf8_decode( __( 'Table View', 'give' ) ), 0, 2, 'L', false ); |
|
96 | - $pdf->SetFont( $default_font, '', 12 ); |
|
93 | + $pdf->SetTextColor(50, 50, 50); |
|
94 | + $pdf->SetFont($default_font, '', 14); |
|
95 | + $pdf->Cell(0, 10, utf8_decode(__('Table View', 'give')), 0, 2, 'L', false); |
|
96 | + $pdf->SetFont($default_font, '', 12); |
|
97 | 97 | |
98 | - $pdf->SetFillColor( 238, 238, 238 ); |
|
99 | - $pdf->SetTextColor( 0, 0, 0, 100 ); // Set Black color. |
|
100 | - $pdf->Cell( 50, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true ); |
|
101 | - $pdf->Cell( 50, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true ); |
|
98 | + $pdf->SetFillColor(238, 238, 238); |
|
99 | + $pdf->SetTextColor(0, 0, 0, 100); // Set Black color. |
|
100 | + $pdf->Cell(50, 6, utf8_decode(__('Form Name', 'give')), 1, 0, 'L', true); |
|
101 | + $pdf->Cell(50, 6, utf8_decode(__('Price', 'give')), 1, 0, 'L', true); |
|
102 | 102 | |
103 | 103 | // Display Categories Heading only, if user has opted for it. |
104 | - if ( $categories_enabled ) { |
|
105 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true ); |
|
104 | + if ($categories_enabled) { |
|
105 | + $pdf->Cell(45, 6, utf8_decode(__('Categories', 'give')), 1, 0, 'L', true); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | // Display Tags Heading only, if user has opted for it. |
109 | - if ( $tags_enabled ) { |
|
110 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true ); |
|
109 | + if ($tags_enabled) { |
|
110 | + $pdf->Cell(45, 6, utf8_decode(__('Tags', 'give')), 1, 0, 'L', true); |
|
111 | 111 | } |
112 | 112 | |
113 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true ); |
|
114 | - $pdf->Cell( 45, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true ); |
|
113 | + $pdf->Cell(45, 6, utf8_decode(__('Number of Donations', 'give')), 1, 0, 'L', true); |
|
114 | + $pdf->Cell(45, 6, utf8_decode(__('Income to Date', 'give')), 1, 1, 'L', true); |
|
115 | 115 | |
116 | 116 | // Set Custom Font to support various currencies. |
117 | - $pdf->SetFont( apply_filters( 'give_pdf_custom_font', $custom_font ), $font_style, 12 ); |
|
117 | + $pdf->SetFont(apply_filters('give_pdf_custom_font', $custom_font), $font_style, 12); |
|
118 | 118 | |
119 | - $year = date( 'Y' ); |
|
120 | - $give_forms = get_posts( array( |
|
119 | + $year = date('Y'); |
|
120 | + $give_forms = get_posts(array( |
|
121 | 121 | 'post_type' => 'give_forms', |
122 | 122 | 'year' => $year, |
123 | - 'posts_per_page' => - 1, |
|
123 | + 'posts_per_page' => -1, |
|
124 | 124 | 'supply_filter' => false, |
125 | - ) ); |
|
125 | + )); |
|
126 | 126 | |
127 | - if ( $give_forms ) { |
|
128 | - $pdf->SetWidths( array( 50, 50, 45, 45, 45, 45 ) ); |
|
127 | + if ($give_forms) { |
|
128 | + $pdf->SetWidths(array(50, 50, 45, 45, 45, 45)); |
|
129 | 129 | |
130 | - foreach ( $give_forms as $form ): |
|
131 | - $pdf->SetFillColor( 255, 255, 255 ); |
|
130 | + foreach ($give_forms as $form): |
|
131 | + $pdf->SetFillColor(255, 255, 255); |
|
132 | 132 | |
133 | 133 | $title = $form->post_title; |
134 | 134 | |
135 | - if ( give_has_variable_prices( $form->ID ) ) { |
|
136 | - $price = html_entity_decode( give_price_range( $form->ID, false ), ENT_COMPAT, 'UTF-8' ); |
|
135 | + if (give_has_variable_prices($form->ID)) { |
|
136 | + $price = html_entity_decode(give_price_range($form->ID, false), ENT_COMPAT, 'UTF-8'); |
|
137 | 137 | } else { |
138 | - $price = give_currency_filter( give_get_form_price( $form->ID ), array( 'decode_currency' => true ) ); |
|
138 | + $price = give_currency_filter(give_get_form_price($form->ID), array('decode_currency' => true)); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | // Display Categories Data only, if user has opted for it. |
142 | 142 | $categories = array(); |
143 | - if ( $categories_enabled ) { |
|
144 | - $categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' ); |
|
145 | - $categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : ''; |
|
143 | + if ($categories_enabled) { |
|
144 | + $categories = get_the_term_list($form->ID, 'give_forms_category', '', ', ', ''); |
|
145 | + $categories = ! is_wp_error($categories) ? strip_tags($categories) : ''; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | // Display Tags Data only, if user has opted for it. |
149 | 149 | $tags = array(); |
150 | - if ( $tags_enabled ) { |
|
151 | - $tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' ); |
|
152 | - $tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : ''; |
|
150 | + if ($tags_enabled) { |
|
151 | + $tags = get_the_term_list($form->ID, 'give_forms_tag', '', ', ', ''); |
|
152 | + $tags = ! is_wp_error($tags) ? strip_tags($tags) : ''; |
|
153 | 153 | } |
154 | 154 | |
155 | - $sales = give_get_form_sales_stats( $form->ID ); |
|
156 | - $earnings = give_currency_filter( give_format_amount( give_get_form_earnings_stats( $form->ID ), array( 'sanitize' => false, ) ), array( 'decode_currency' => true ) ); |
|
155 | + $sales = give_get_form_sales_stats($form->ID); |
|
156 | + $earnings = give_currency_filter(give_format_amount(give_get_form_earnings_stats($form->ID), array('sanitize' => false,)), array('decode_currency' => true)); |
|
157 | 157 | |
158 | 158 | // This will help filter data before appending it to PDF Receipt. |
159 | 159 | $prepare_pdf_data = array(); |
@@ -161,54 +161,54 @@ discard block |
||
161 | 161 | $prepare_pdf_data[] = $price; |
162 | 162 | |
163 | 163 | // Append Categories Data only, if user has opted for it. |
164 | - if ( $categories_enabled ) { |
|
164 | + if ($categories_enabled) { |
|
165 | 165 | $prepare_pdf_data[] = $categories; |
166 | 166 | } |
167 | 167 | |
168 | 168 | // Append Tags Data only, if user has opted for it. |
169 | - if ( $tags_enabled ) { |
|
169 | + if ($tags_enabled) { |
|
170 | 170 | $prepare_pdf_data[] = $tags; |
171 | 171 | } |
172 | 172 | |
173 | 173 | $prepare_pdf_data[] = $sales; |
174 | 174 | $prepare_pdf_data[] = $earnings; |
175 | 175 | |
176 | - $pdf->Row( $prepare_pdf_data ); |
|
176 | + $pdf->Row($prepare_pdf_data); |
|
177 | 177 | |
178 | 178 | endforeach; |
179 | 179 | } else { |
180 | 180 | |
181 | 181 | // Fix: Minor Styling Alignment Issue for PDF. |
182 | - if ( $categories_enabled && $tags_enabled ) { |
|
182 | + if ($categories_enabled && $tags_enabled) { |
|
183 | 183 | $no_found_width = 280; |
184 | - } elseif ( $categories_enabled || $tags_enabled ) { |
|
184 | + } elseif ($categories_enabled || $tags_enabled) { |
|
185 | 185 | $no_found_width = 235; |
186 | 186 | } else { |
187 | 187 | $no_found_width = 190; |
188 | 188 | } |
189 | - $title = utf8_decode( __( 'No forms found.', 'give' ) ); |
|
190 | - $pdf->MultiCell( $no_found_width, 5, $title, 1, 'C', false, 1, '', '', true, 0, false, true, 0, 'T', false ); |
|
189 | + $title = utf8_decode(__('No forms found.', 'give')); |
|
190 | + $pdf->MultiCell($no_found_width, 5, $title, 1, 'C', false, 1, '', '', true, 0, false, true, 0, 'T', false); |
|
191 | 191 | }// End if(). |
192 | 192 | $pdf->Ln(); |
193 | - $pdf->SetTextColor( 50, 50, 50 ); |
|
194 | - $pdf->SetFont( $default_font, '', 14 ); |
|
193 | + $pdf->SetTextColor(50, 50, 50); |
|
194 | + $pdf->SetFont($default_font, '', 14); |
|
195 | 195 | |
196 | 196 | // Output Graph on a new page. |
197 | - $pdf->AddPage( 'L', 'A4' ); |
|
198 | - $pdf->Cell( 0, 10, utf8_decode( __( 'Graph View', 'give' ) ), 0, 2, 'L', false ); |
|
199 | - $pdf->SetFont( $default_font, '', 12 ); |
|
197 | + $pdf->AddPage('L', 'A4'); |
|
198 | + $pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false); |
|
199 | + $pdf->SetFont($default_font, '', 12); |
|
200 | 200 | |
201 | - $image = html_entity_decode( urldecode( give_draw_chart_image() ) ); |
|
202 | - $image = str_replace( ' ', '%20', $image ); |
|
201 | + $image = html_entity_decode(urldecode(give_draw_chart_image())); |
|
202 | + $image = str_replace(' ', '%20', $image); |
|
203 | 203 | |
204 | - $pdf->SetX( 25 ); |
|
205 | - $pdf->Image( $image . '&file=.png' ); |
|
206 | - $pdf->Ln( 7 ); |
|
207 | - $pdf->Output( apply_filters( 'give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n( 'Y-m-d' ) ) . '.pdf', 'D' ); |
|
204 | + $pdf->SetX(25); |
|
205 | + $pdf->Image($image.'&file=.png'); |
|
206 | + $pdf->Ln(7); |
|
207 | + $pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-'.date_i18n('Y-m-d')).'.pdf', 'D'); |
|
208 | 208 | exit(); |
209 | 209 | } |
210 | 210 | |
211 | -add_action( 'give_generate_pdf', 'give_generate_pdf' ); |
|
211 | +add_action('give_generate_pdf', 'give_generate_pdf'); |
|
212 | 212 | |
213 | 213 | /** |
214 | 214 | * Draws Chart for PDF Report. |
@@ -225,38 +225,38 @@ discard block |
||
225 | 225 | * @return string $chart->getUrl() URL for the Google Chart |
226 | 226 | */ |
227 | 227 | function give_draw_chart_image() { |
228 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php'; |
|
229 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
230 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
228 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/GoogleChart.php'; |
|
229 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php'; |
|
230 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php'; |
|
231 | 231 | |
232 | - $chart = new GoogleChart( 'lc', 900, 330 ); |
|
232 | + $chart = new GoogleChart('lc', 900, 330); |
|
233 | 233 | |
234 | 234 | $i = 1; |
235 | 235 | $earnings = ""; |
236 | 236 | $sales = ""; |
237 | 237 | |
238 | - while ( $i <= 12 ) : |
|
239 | - $earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . ","; |
|
240 | - $sales .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . ","; |
|
241 | - $i ++; |
|
238 | + while ($i <= 12) : |
|
239 | + $earnings .= give_get_earnings_by_date(null, $i, date('Y')).","; |
|
240 | + $sales .= give_get_sales_by_date(null, $i, date('Y')).","; |
|
241 | + $i++; |
|
242 | 242 | endwhile; |
243 | 243 | |
244 | - $earnings_array = explode( ",", $earnings ); |
|
245 | - $sales_array = explode( ",", $sales ); |
|
244 | + $earnings_array = explode(",", $earnings); |
|
245 | + $sales_array = explode(",", $sales); |
|
246 | 246 | |
247 | 247 | $i = 0; |
248 | - while ( $i <= 11 ) { |
|
249 | - if ( empty( $sales_array[ $i ] ) ) { |
|
250 | - $sales_array[ $i ] = 0; |
|
248 | + while ($i <= 11) { |
|
249 | + if (empty($sales_array[$i])) { |
|
250 | + $sales_array[$i] = 0; |
|
251 | 251 | } |
252 | - $i ++; |
|
252 | + $i++; |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | $min_earnings = 0; |
256 | - $max_earnings = max( $earnings_array ); |
|
257 | - $earnings_scale = round( $max_earnings, - 1 ); |
|
256 | + $max_earnings = max($earnings_array); |
|
257 | + $earnings_scale = round($max_earnings, - 1); |
|
258 | 258 | |
259 | - $data = new GoogleChartData( array( |
|
259 | + $data = new GoogleChartData(array( |
|
260 | 260 | $earnings_array[0], |
261 | 261 | $earnings_array[1], |
262 | 262 | $earnings_array[2], |
@@ -269,25 +269,25 @@ discard block |
||
269 | 269 | $earnings_array[9], |
270 | 270 | $earnings_array[10], |
271 | 271 | $earnings_array[11], |
272 | - ) ); |
|
272 | + )); |
|
273 | 273 | |
274 | - $data->setLegend( __( 'Income', 'give' ) ); |
|
275 | - $data->setColor( '1b58a3' ); |
|
276 | - $chart->addData( $data ); |
|
274 | + $data->setLegend(__('Income', 'give')); |
|
275 | + $data->setColor('1b58a3'); |
|
276 | + $chart->addData($data); |
|
277 | 277 | |
278 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
279 | - $shape_marker->setColor( '000000' ); |
|
280 | - $shape_marker->setSize( 7 ); |
|
281 | - $shape_marker->setBorder( 2 ); |
|
282 | - $shape_marker->setData( $data ); |
|
283 | - $chart->addMarker( $shape_marker ); |
|
278 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
279 | + $shape_marker->setColor('000000'); |
|
280 | + $shape_marker->setSize(7); |
|
281 | + $shape_marker->setBorder(2); |
|
282 | + $shape_marker->setData($data); |
|
283 | + $chart->addMarker($shape_marker); |
|
284 | 284 | |
285 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
286 | - $value_marker->setColor( '000000' ); |
|
287 | - $value_marker->setData( $data ); |
|
288 | - $chart->addMarker( $value_marker ); |
|
285 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
286 | + $value_marker->setColor('000000'); |
|
287 | + $value_marker->setData($data); |
|
288 | + $chart->addMarker($value_marker); |
|
289 | 289 | |
290 | - $data = new GoogleChartData( array( |
|
290 | + $data = new GoogleChartData(array( |
|
291 | 291 | $sales_array[0], |
292 | 292 | $sales_array[1], |
293 | 293 | $sales_array[2], |
@@ -300,46 +300,46 @@ discard block |
||
300 | 300 | $sales_array[9], |
301 | 301 | $sales_array[10], |
302 | 302 | $sales_array[11], |
303 | - ) ); |
|
304 | - $data->setLegend( __( 'Donations', 'give' ) ); |
|
305 | - $data->setColor( 'ff6c1c' ); |
|
306 | - $chart->addData( $data ); |
|
307 | - |
|
308 | - $chart->setTitle( __( 'Donations by Month for all Give Forms', 'give' ), '336699', 18 ); |
|
309 | - |
|
310 | - $chart->setScale( 0, $max_earnings ); |
|
311 | - |
|
312 | - $y_axis = new GoogleChartAxis( 'y' ); |
|
313 | - $y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) ); |
|
314 | - $chart->addAxis( $y_axis ); |
|
315 | - |
|
316 | - $x_axis = new GoogleChartAxis( 'x' ); |
|
317 | - $x_axis->setTickMarks( 5 ); |
|
318 | - $x_axis->setLabels( array( |
|
319 | - __( 'Jan', 'give' ), |
|
320 | - __( 'Feb', 'give' ), |
|
321 | - __( 'Mar', 'give' ), |
|
322 | - __( 'Apr', 'give' ), |
|
323 | - __( 'May', 'give' ), |
|
324 | - __( 'June', 'give' ), |
|
325 | - __( 'July', 'give' ), |
|
326 | - __( 'Aug', 'give' ), |
|
327 | - __( 'Sept', 'give' ), |
|
328 | - __( 'Oct', 'give' ), |
|
329 | - __( 'Nov', 'give' ), |
|
330 | - __( 'Dec', 'give' ), |
|
331 | - ) ); |
|
332 | - $chart->addAxis( $x_axis ); |
|
333 | - |
|
334 | - $shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE ); |
|
335 | - $shape_marker->setSize( 6 ); |
|
336 | - $shape_marker->setBorder( 2 ); |
|
337 | - $shape_marker->setData( $data ); |
|
338 | - $chart->addMarker( $shape_marker ); |
|
339 | - |
|
340 | - $value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE ); |
|
341 | - $value_marker->setData( $data ); |
|
342 | - $chart->addMarker( $value_marker ); |
|
303 | + )); |
|
304 | + $data->setLegend(__('Donations', 'give')); |
|
305 | + $data->setColor('ff6c1c'); |
|
306 | + $chart->addData($data); |
|
307 | + |
|
308 | + $chart->setTitle(__('Donations by Month for all Give Forms', 'give'), '336699', 18); |
|
309 | + |
|
310 | + $chart->setScale(0, $max_earnings); |
|
311 | + |
|
312 | + $y_axis = new GoogleChartAxis('y'); |
|
313 | + $y_axis->setDrawTickMarks(true)->setLabels(array(0, $max_earnings)); |
|
314 | + $chart->addAxis($y_axis); |
|
315 | + |
|
316 | + $x_axis = new GoogleChartAxis('x'); |
|
317 | + $x_axis->setTickMarks(5); |
|
318 | + $x_axis->setLabels(array( |
|
319 | + __('Jan', 'give'), |
|
320 | + __('Feb', 'give'), |
|
321 | + __('Mar', 'give'), |
|
322 | + __('Apr', 'give'), |
|
323 | + __('May', 'give'), |
|
324 | + __('June', 'give'), |
|
325 | + __('July', 'give'), |
|
326 | + __('Aug', 'give'), |
|
327 | + __('Sept', 'give'), |
|
328 | + __('Oct', 'give'), |
|
329 | + __('Nov', 'give'), |
|
330 | + __('Dec', 'give'), |
|
331 | + )); |
|
332 | + $chart->addAxis($x_axis); |
|
333 | + |
|
334 | + $shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE); |
|
335 | + $shape_marker->setSize(6); |
|
336 | + $shape_marker->setBorder(2); |
|
337 | + $shape_marker->setData($data); |
|
338 | + $chart->addMarker($shape_marker); |
|
339 | + |
|
340 | + $value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE); |
|
341 | + $value_marker->setData($data); |
|
342 | + $chart->addMarker($value_marker); |
|
343 | 343 | |
344 | 344 | return $chart->getUrl(); |
345 | 345 | } |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Exit if accessed directly. |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | 16 | // Load WP_List_Table if not loaded. |
17 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
18 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
17 | +if ( ! class_exists('WP_List_Table')) { |
|
18 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function __construct() { |
46 | 46 | // Set parent defaults. |
47 | - parent::__construct( array( |
|
48 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
49 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
50 | - 'ajax' => false,// Does this table support ajax?. |
|
51 | - ) ); |
|
47 | + parent::__construct(array( |
|
48 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
49 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
50 | + 'ajax' => false, // Does this table support ajax?. |
|
51 | + )); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -62,19 +62,19 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return string Column Name. |
64 | 64 | */ |
65 | - public function column_default( $item, $column_name ) { |
|
65 | + public function column_default($item, $column_name) { |
|
66 | 66 | |
67 | - switch ( $column_name ) { |
|
67 | + switch ($column_name) { |
|
68 | 68 | case 'ID' : |
69 | 69 | return $item['ID_label']; |
70 | 70 | case 'payment_id' : |
71 | - return empty( $item['payment_id'] ) ? esc_html__( 'n/a', 'give' ) : sprintf( "<a href=\"%s\" target=\"_blank\">{$item['payment_id']}</a>", get_edit_post_link( $item['payment_id'] ) ); |
|
71 | + return empty($item['payment_id']) ? esc_html__('n/a', 'give') : sprintf("<a href=\"%s\" target=\"_blank\">{$item['payment_id']}</a>", get_edit_post_link($item['payment_id'])); |
|
72 | 72 | case 'gateway' : |
73 | - return empty( $item['gateway'] ) ? esc_html__( 'n/a', 'give' ) : $item['gateway']; |
|
73 | + return empty($item['gateway']) ? esc_html__('n/a', 'give') : $item['gateway']; |
|
74 | 74 | case 'error' : |
75 | - return esc_html( $item['log_title'] ); |
|
75 | + return esc_html($item['log_title']); |
|
76 | 76 | default: |
77 | - return $item[ $column_name ]; |
|
77 | + return $item[$column_name]; |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
@@ -88,35 +88,35 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return void |
90 | 90 | */ |
91 | - public function column_message( $item ) { |
|
91 | + public function column_message($item) { |
|
92 | 92 | ?> |
93 | 93 | <?php |
94 | - echo Give()->tooltips->render_link( array( |
|
95 | - 'label' => __( 'View Log Message', 'give' ), |
|
94 | + echo Give()->tooltips->render_link(array( |
|
95 | + 'label' => __('View Log Message', 'give'), |
|
96 | 96 | 'tag_content' => '<span class="dashicons dashicons-visibility"></span>', |
97 | 97 | 'link' => "#TB_inline?width=640&inlineId=log-message-{$item['ID']}", |
98 | 98 | 'attributes' => array( |
99 | 99 | 'class' => 'thickbox give-error-log-details-link button button-small', |
100 | 100 | ), |
101 | - ) ); |
|
101 | + )); |
|
102 | 102 | ?> |
103 | 103 | <div id="log-message-<?php echo $item['ID']; ?>" style="display:none;"> |
104 | 104 | <?php |
105 | 105 | |
106 | - $serialized = strpos( $item['log_content'], '{"' ); |
|
106 | + $serialized = strpos($item['log_content'], '{"'); |
|
107 | 107 | |
108 | 108 | // Check to see if the log message contains serialized information |
109 | - if ( $serialized !== false ) { |
|
110 | - $length = strlen( $item['log_content'] ) - $serialized; |
|
111 | - $intro = substr( $item['log_content'], 0, - $length ); |
|
112 | - $data = substr( $item['log_content'], $serialized, strlen( $item['log_content'] ) - 1 ); |
|
109 | + if ($serialized !== false) { |
|
110 | + $length = strlen($item['log_content']) - $serialized; |
|
111 | + $intro = substr($item['log_content'], 0, - $length); |
|
112 | + $data = substr($item['log_content'], $serialized, strlen($item['log_content']) - 1); |
|
113 | 113 | |
114 | - echo wpautop( $intro ); |
|
115 | - echo wpautop( '<strong>' . esc_html__( 'Log data:', 'give' ) . '</strong>' ); |
|
116 | - echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>'; |
|
114 | + echo wpautop($intro); |
|
115 | + echo wpautop('<strong>'.esc_html__('Log data:', 'give').'</strong>'); |
|
116 | + echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>'; |
|
117 | 117 | } else { |
118 | 118 | // No serialized data found |
119 | - echo wpautop( $item['log_content'] ); |
|
119 | + echo wpautop($item['log_content']); |
|
120 | 120 | } |
121 | 121 | ?> |
122 | 122 | </div> |
@@ -132,12 +132,12 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public function get_columns() { |
134 | 134 | $columns = array( |
135 | - 'ID' => esc_html__( 'Log ID', 'give' ), |
|
136 | - 'error' => esc_html__( 'Error', 'give' ), |
|
137 | - 'gateway' => esc_html__( 'Gateway', 'give' ), |
|
138 | - 'payment_id' => esc_html__( 'Donation ID', 'give' ), |
|
139 | - 'date' => esc_html__( 'Date', 'give' ), |
|
140 | - 'message' => esc_html__( 'Details', 'give' ), |
|
135 | + 'ID' => esc_html__('Log ID', 'give'), |
|
136 | + 'error' => esc_html__('Error', 'give'), |
|
137 | + 'gateway' => esc_html__('Gateway', 'give'), |
|
138 | + 'payment_id' => esc_html__('Donation ID', 'give'), |
|
139 | + 'date' => esc_html__('Date', 'give'), |
|
140 | + 'message' => esc_html__('Details', 'give'), |
|
141 | 141 | ); |
142 | 142 | |
143 | 143 | return $columns; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @return int Current page number |
152 | 152 | */ |
153 | 153 | public function get_paged() { |
154 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
154 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * @since 1.0 |
162 | 162 | * @return void |
163 | 163 | */ |
164 | - public function bulk_actions( $which = '' ) { |
|
164 | + public function bulk_actions($which = '') { |
|
165 | 165 | give_log_views(); |
166 | 166 | } |
167 | 167 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | public function get_logs() { |
177 | 177 | // Prevent the queries from getting cached. |
178 | 178 | // Without this there are occasional memory issues for some installs. |
179 | - wp_suspend_cache_addition( true ); |
|
179 | + wp_suspend_cache_addition(true); |
|
180 | 180 | |
181 | 181 | $logs_data = array(); |
182 | 182 | $paged = $this->get_paged(); |
@@ -186,17 +186,17 @@ discard block |
||
186 | 186 | 'posts_per_page' => $this->per_page, |
187 | 187 | ); |
188 | 188 | |
189 | - $logs = Give()->logs->get_connected_logs( $log_query ); |
|
189 | + $logs = Give()->logs->get_connected_logs($log_query); |
|
190 | 190 | |
191 | - if ( $logs ) { |
|
192 | - foreach ( $logs as $log ) { |
|
191 | + if ($logs) { |
|
192 | + foreach ($logs as $log) { |
|
193 | 193 | |
194 | 194 | $logs_data[] = array( |
195 | 195 | 'ID' => $log->ID, |
196 | - 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>', |
|
196 | + 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>', |
|
197 | 197 | 'payment_id' => $log->log_parent, |
198 | 198 | 'error' => 'error', |
199 | - 'gateway' => give_get_payment_gateway( $log->log_parent ), |
|
199 | + 'gateway' => give_get_payment_gateway($log->log_parent), |
|
200 | 200 | 'date' => $log->log_date, |
201 | 201 | 'log_content' => $log->log_content, |
202 | 202 | 'log_title' => $log->log_title, |
@@ -220,19 +220,19 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @param string $which |
222 | 222 | */ |
223 | - protected function display_tablenav( $which ) { |
|
224 | - if ( 'top' === $which ) { |
|
225 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
223 | + protected function display_tablenav($which) { |
|
224 | + if ('top' === $which) { |
|
225 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
226 | 226 | } |
227 | 227 | ?> |
228 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
228 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
229 | 229 | |
230 | 230 | <div class="alignleft actions bulkactions"> |
231 | - <?php $this->bulk_actions( $which ); ?> |
|
231 | + <?php $this->bulk_actions($which); ?> |
|
232 | 232 | </div> |
233 | 233 | <?php |
234 | - $this->extra_tablenav( $which ); |
|
235 | - $this->pagination( $which ); |
|
234 | + $this->extra_tablenav($which); |
|
235 | + $this->pagination($which); |
|
236 | 236 | ?> |
237 | 237 | |
238 | 238 | <br class="clear"/> |
@@ -258,14 +258,14 @@ discard block |
||
258 | 258 | $columns = $this->get_columns(); |
259 | 259 | $hidden = array(); // No hidden columns |
260 | 260 | $sortable = $this->get_sortable_columns(); |
261 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
261 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
262 | 262 | $this->items = $this->get_logs(); |
263 | - $total_items = Give()->logs->get_log_count( 0, 'gateway_error' ); |
|
263 | + $total_items = Give()->logs->get_log_count(0, 'gateway_error'); |
|
264 | 264 | |
265 | - $this->set_pagination_args( array( |
|
265 | + $this->set_pagination_args(array( |
|
266 | 266 | 'total_items' => $total_items, |
267 | 267 | 'per_page' => $this->per_page, |
268 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
268 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
269 | 269 | ) |
270 | 270 | ); |
271 | 271 | } |
@@ -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 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_get_logs_tab() { |
24 | 24 | |
25 | - require( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php' ); |
|
25 | + require(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php'); |
|
26 | 26 | |
27 | 27 | // Get current section. |
28 | 28 | $current_section = $_GET['section'] = give_get_current_setting_section(); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @since 1.0 |
34 | 34 | */ |
35 | - do_action( "give_logs_view_{$current_section}" ); |
|
35 | + do_action("give_logs_view_{$current_section}"); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | function give_logs_view_sales() { |
48 | 48 | |
49 | - include GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-sales-logs-list-table.php'; |
|
49 | + include GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-sales-logs-list-table.php'; |
|
50 | 50 | |
51 | 51 | $logs_table = new Give_Sales_Log_Table(); |
52 | 52 | $logs_table->prepare_items(); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @since 1.8.12 |
61 | 61 | */ |
62 | - do_action( 'give_logs_donations_top' ); |
|
62 | + do_action('give_logs_donations_top'); |
|
63 | 63 | |
64 | 64 | $logs_table->display(); ?> |
65 | 65 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -73,14 +73,14 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @since 1.8.12 |
75 | 75 | */ |
76 | - do_action( 'give_logs_donations_bottom' ); |
|
76 | + do_action('give_logs_donations_bottom'); |
|
77 | 77 | ?> |
78 | 78 | |
79 | 79 | </div> |
80 | 80 | <?php |
81 | 81 | } |
82 | 82 | |
83 | -add_action( 'give_logs_view_sales', 'give_logs_view_sales' ); |
|
83 | +add_action('give_logs_view_sales', 'give_logs_view_sales'); |
|
84 | 84 | |
85 | 85 | |
86 | 86 | /** |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * @return void |
93 | 93 | */ |
94 | 94 | function give_logs_view_gateway_errors() { |
95 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-gateway-error-logs-list-table.php' ); |
|
95 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-gateway-error-logs-list-table.php'); |
|
96 | 96 | |
97 | 97 | $logs_table = new Give_Gateway_Error_Log_Table(); |
98 | 98 | $logs_table->prepare_items(); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @since 1.8.12 |
107 | 107 | */ |
108 | - do_action( 'give_logs_payment_error_top' ); |
|
108 | + do_action('give_logs_payment_error_top'); |
|
109 | 109 | |
110 | 110 | $logs_table->display(); ?> |
111 | 111 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -119,14 +119,14 @@ discard block |
||
119 | 119 | * |
120 | 120 | * @since 1.8.12 |
121 | 121 | */ |
122 | - do_action( 'give_logs_payment_error_bottom' ); |
|
122 | + do_action('give_logs_payment_error_bottom'); |
|
123 | 123 | ?> |
124 | 124 | |
125 | 125 | </div> |
126 | 126 | <?php |
127 | 127 | } |
128 | 128 | |
129 | -add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' ); |
|
129 | +add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors'); |
|
130 | 130 | |
131 | 131 | /** |
132 | 132 | * API Request Logs |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @return void |
138 | 138 | */ |
139 | 139 | function give_logs_view_api_requests() { |
140 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-api-requests-logs-list-table.php' ); |
|
140 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-api-requests-logs-list-table.php'); |
|
141 | 141 | |
142 | 142 | $logs_table = new Give_API_Request_Log_Table(); |
143 | 143 | $logs_table->prepare_items(); |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | * |
148 | 148 | * @since 1.0 |
149 | 149 | */ |
150 | - do_action( 'give_logs_api_requests_top' ); |
|
150 | + do_action('give_logs_api_requests_top'); |
|
151 | 151 | |
152 | - $logs_table->search_box( esc_html__( 'Search', 'give' ), 'give-api-requests' ); |
|
152 | + $logs_table->search_box(esc_html__('Search', 'give'), 'give-api-requests'); |
|
153 | 153 | $logs_table->display(); |
154 | 154 | ?> |
155 | 155 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @since 1.0 |
165 | 165 | */ |
166 | - do_action( 'give_logs_api_requests_bottom' ); |
|
166 | + do_action('give_logs_api_requests_bottom'); |
|
167 | 167 | } |
168 | -add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' ); |
|
168 | +add_action('give_logs_view_api_requests', 'give_logs_view_api_requests'); |
|
169 | 169 | |
170 | 170 | /** |
171 | 171 | * Renders the log views drop down. |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | $current_section = give_get_current_setting_section(); |
178 | 178 | |
179 | 179 | // If there are not any event attach to action then do not show form. |
180 | - if ( ! has_action( 'give_log_view_actions' ) ) { |
|
180 | + if ( ! has_action('give_log_view_actions')) { |
|
181 | 181 | return; |
182 | 182 | } |
183 | 183 | ?> |
184 | - <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs§ion=' . $current_section; ?>"> |
|
184 | + <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs§ion='.$current_section; ?>"> |
|
185 | 185 | <?php |
186 | 186 | /** |
187 | 187 | * Fires after displaying the reports page views drop down. |
@@ -190,14 +190,14 @@ discard block |
||
190 | 190 | * |
191 | 191 | * @since 1.0 |
192 | 192 | */ |
193 | - do_action( 'give_log_view_actions' ); |
|
193 | + do_action('give_log_view_actions'); |
|
194 | 194 | ?> |
195 | 195 | |
196 | 196 | <input type="hidden" name="post_type" value="give_forms"/> |
197 | 197 | <input type="hidden" name="page" value="give-tools"/> |
198 | 198 | <input type="hidden" name="tab" value="logs"/> |
199 | 199 | |
200 | - <?php submit_button( esc_html__( 'Apply', 'give' ), 'secondary', 'submit', false ); ?> |
|
200 | + <?php submit_button(esc_html__('Apply', 'give'), 'secondary', 'submit', false); ?> |
|
201 | 201 | </form> |
202 | 202 | <?php |
203 | 203 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * |
210 | 210 | * @return string |
211 | 211 | */ |
212 | -function give_tools_set_form_method( $method ) { |
|
212 | +function give_tools_set_form_method($method) { |
|
213 | 213 | return 'get'; |
214 | 214 | } |
215 | -add_filter( 'give-tools_form_method_tab_logs', 'give_tools_set_form_method', 10 ); |
|
215 | +add_filter('give-tools_form_method_tab_logs', 'give_tools_set_form_method', 10); |
@@ -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 | |
@@ -58,16 +58,16 @@ discard block |
||
58 | 58 | public function get_data() { |
59 | 59 | global $wpdb; |
60 | 60 | |
61 | - $items = $this->get_stored_data( 'give_temp_reset_ids' ); |
|
61 | + $items = $this->get_stored_data('give_temp_reset_ids'); |
|
62 | 62 | |
63 | - if ( ! is_array( $items ) ) { |
|
63 | + if ( ! is_array($items)) { |
|
64 | 64 | return false; |
65 | 65 | } |
66 | 66 | |
67 | - $offset = ( $this->step - 1 ) * $this->per_step; |
|
68 | - $step_items = array_slice( $items, $offset, $this->per_step ); |
|
67 | + $offset = ($this->step - 1) * $this->per_step; |
|
68 | + $step_items = array_slice($items, $offset, $this->per_step); |
|
69 | 69 | |
70 | - if ( $step_items ) { |
|
70 | + if ($step_items) { |
|
71 | 71 | |
72 | 72 | $step_ids = array( |
73 | 73 | 'customers' => array(), |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | 'other' => array(), |
76 | 76 | ); |
77 | 77 | |
78 | - foreach ( $step_items as $item ) { |
|
78 | + foreach ($step_items as $item) { |
|
79 | 79 | |
80 | - switch ( $item['type'] ) { |
|
80 | + switch ($item['type']) { |
|
81 | 81 | case 'customer': |
82 | 82 | $step_ids['customers'][] = $item['id']; |
83 | 83 | break; |
@@ -85,28 +85,28 @@ discard block |
||
85 | 85 | $step_ids['give_forms'][] = $item['id']; |
86 | 86 | break; |
87 | 87 | default: |
88 | - $item_type = apply_filters( 'give_reset_item_type', 'other', $item ); |
|
89 | - $step_ids[ $item_type ][] = $item['id']; |
|
88 | + $item_type = apply_filters('give_reset_item_type', 'other', $item); |
|
89 | + $step_ids[$item_type][] = $item['id']; |
|
90 | 90 | break; |
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
94 | 94 | $sql = array(); |
95 | - $meta_table = __give_v20_bc_table_details('form' ); |
|
95 | + $meta_table = __give_v20_bc_table_details('form'); |
|
96 | 96 | |
97 | - foreach ( $step_ids as $type => $ids ) { |
|
97 | + foreach ($step_ids as $type => $ids) { |
|
98 | 98 | |
99 | - if ( empty( $ids ) ) { |
|
99 | + if (empty($ids)) { |
|
100 | 100 | continue; |
101 | 101 | } |
102 | 102 | |
103 | - $ids = implode( ',', $ids ); |
|
103 | + $ids = implode(',', $ids); |
|
104 | 104 | |
105 | - switch ( $type ) { |
|
105 | + switch ($type) { |
|
106 | 106 | case 'customers': |
107 | 107 | $sql[] = "DELETE FROM $wpdb->donors WHERE id IN ($ids)"; |
108 | - $table_name = $wpdb->prefix . 'give_customers'; |
|
109 | - $meta_table_name = $wpdb->prefix . 'give_customermeta'; |
|
108 | + $table_name = $wpdb->prefix.'give_customers'; |
|
109 | + $meta_table_name = $wpdb->prefix.'give_customermeta'; |
|
110 | 110 | $sql[] = "DELETE FROM $table_name WHERE id IN ($ids)"; |
111 | 111 | $sql[] = "DELETE FROM $meta_table_name WHERE customer_id IN ($ids)"; |
112 | 112 | break; |
@@ -122,16 +122,16 @@ discard block |
||
122 | 122 | break; |
123 | 123 | } |
124 | 124 | |
125 | - if ( ! in_array( $type, array( 'customers', 'forms', 'other' ) ) ) { |
|
125 | + if ( ! in_array($type, array('customers', 'forms', 'other'))) { |
|
126 | 126 | // Allows other types of custom post types to filter on their own post_type |
127 | 127 | // and add items to the query list, for the IDs found in their post type. |
128 | - $sql = apply_filters( "give_reset_add_queries_{$type}", $sql, $ids ); |
|
128 | + $sql = apply_filters("give_reset_add_queries_{$type}", $sql, $ids); |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | |
132 | - if ( ! empty( $sql ) ) { |
|
133 | - foreach ( $sql as $query ) { |
|
134 | - $wpdb->query( $query ); |
|
132 | + if ( ! empty($sql)) { |
|
133 | + foreach ($sql as $query) { |
|
134 | + $wpdb->query($query); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
@@ -151,16 +151,16 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function get_percentage_complete() { |
153 | 153 | |
154 | - $items = $this->get_stored_data( 'give_temp_reset_ids' ); |
|
155 | - $total = count( $items ); |
|
154 | + $items = $this->get_stored_data('give_temp_reset_ids'); |
|
155 | + $total = count($items); |
|
156 | 156 | |
157 | 157 | $percentage = 100; |
158 | 158 | |
159 | - if ( $total > 0 ) { |
|
160 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
159 | + if ($total > 0) { |
|
160 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
161 | 161 | } |
162 | 162 | |
163 | - if ( $percentage > 100 ) { |
|
163 | + if ($percentage > 100) { |
|
164 | 164 | $percentage = 100; |
165 | 165 | } |
166 | 166 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * |
175 | 175 | * @param array $request The Form Data passed into the batch processing. |
176 | 176 | */ |
177 | - public function set_properties( $request ) { |
|
177 | + public function set_properties($request) { |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
@@ -185,31 +185,31 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function process_step() { |
187 | 187 | |
188 | - if ( ! $this->can_export() ) { |
|
189 | - wp_die( esc_html__( 'You do not have permission to reset data.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
188 | + if ( ! $this->can_export()) { |
|
189 | + wp_die(esc_html__('You do not have permission to reset data.', 'give'), esc_html__('Error', 'give'), array( |
|
190 | 190 | 'response' => 403, |
191 | - ) ); |
|
191 | + )); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | $had_data = $this->get_data(); |
195 | 195 | |
196 | - if ( $had_data ) { |
|
196 | + if ($had_data) { |
|
197 | 197 | $this->done = false; |
198 | 198 | |
199 | 199 | return true; |
200 | 200 | } else { |
201 | - update_option( 'give_earnings_total', 0 ); |
|
202 | - Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) ); |
|
201 | + update_option('give_earnings_total', 0); |
|
202 | + Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats')); |
|
203 | 203 | |
204 | - $this->delete_data( 'give_temp_reset_ids' ); |
|
204 | + $this->delete_data('give_temp_reset_ids'); |
|
205 | 205 | |
206 | 206 | // Reset the sequential order numbers |
207 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
208 | - delete_option( 'give_last_payment_number' ); |
|
207 | + if (give_get_option('enable_sequential')) { |
|
208 | + delete_option('give_last_payment_number'); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | $this->done = true; |
212 | - $this->message = esc_html__( 'Donation forms, income, donations counts, and logs successfully reset.', 'give' ); |
|
212 | + $this->message = esc_html__('Donation forms, income, donations counts, and logs successfully reset.', 'give'); |
|
213 | 213 | |
214 | 214 | return false; |
215 | 215 | } |
@@ -242,26 +242,26 @@ discard block |
||
242 | 242 | */ |
243 | 243 | public function pre_fetch() { |
244 | 244 | |
245 | - if ( $this->step == 1 ) { |
|
246 | - $this->delete_data( 'give_temp_reset_ids' ); |
|
245 | + if ($this->step == 1) { |
|
246 | + $this->delete_data('give_temp_reset_ids'); |
|
247 | 247 | } |
248 | 248 | |
249 | - $items = get_option( 'give_temp_reset_ids', false ); |
|
249 | + $items = get_option('give_temp_reset_ids', false); |
|
250 | 250 | |
251 | - if ( false === $items ) { |
|
251 | + if (false === $items) { |
|
252 | 252 | $items = array(); |
253 | 253 | |
254 | - $give_types_for_reset = array( 'give_forms', 'give_payment' ); |
|
255 | - $give_types_for_reset = apply_filters( 'give_reset_store_post_types', $give_types_for_reset ); |
|
254 | + $give_types_for_reset = array('give_forms', 'give_payment'); |
|
255 | + $give_types_for_reset = apply_filters('give_reset_store_post_types', $give_types_for_reset); |
|
256 | 256 | |
257 | - $args = apply_filters( 'give_tools_reset_stats_total_args', array( |
|
257 | + $args = apply_filters('give_tools_reset_stats_total_args', array( |
|
258 | 258 | 'post_type' => $give_types_for_reset, |
259 | 259 | 'post_status' => 'any', |
260 | - 'posts_per_page' => - 1, |
|
261 | - ) ); |
|
260 | + 'posts_per_page' => -1, |
|
261 | + )); |
|
262 | 262 | |
263 | - $posts = get_posts( $args ); |
|
264 | - foreach ( $posts as $post ) { |
|
263 | + $posts = get_posts($args); |
|
264 | + foreach ($posts as $post) { |
|
265 | 265 | $items[] = array( |
266 | 266 | 'id' => (int) $post->ID, |
267 | 267 | 'type' => $post->post_type, |
@@ -269,10 +269,10 @@ discard block |
||
269 | 269 | } |
270 | 270 | |
271 | 271 | $donor_args = array( |
272 | - 'number' => - 1, |
|
272 | + 'number' => -1, |
|
273 | 273 | ); |
274 | - $donors = Give()->donors->get_donors( $donor_args ); |
|
275 | - foreach ( $donors as $donor ) { |
|
274 | + $donors = Give()->donors->get_donors($donor_args); |
|
275 | + foreach ($donors as $donor) { |
|
276 | 276 | $items[] = array( |
277 | 277 | 'id' => (int) $donor->id, |
278 | 278 | 'type' => 'customer', |
@@ -281,9 +281,9 @@ discard block |
||
281 | 281 | |
282 | 282 | // Allow filtering of items to remove with an unassociative array for each item |
283 | 283 | // The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method |
284 | - $items = apply_filters( 'give_reset_items', $items ); |
|
284 | + $items = apply_filters('give_reset_items', $items); |
|
285 | 285 | |
286 | - $this->store_data( 'give_temp_reset_ids', $items ); |
|
286 | + $this->store_data('give_temp_reset_ids', $items); |
|
287 | 287 | }// End if(). |
288 | 288 | |
289 | 289 | } |
@@ -297,17 +297,17 @@ discard block |
||
297 | 297 | * |
298 | 298 | * @return mixed Returns the data from the database. |
299 | 299 | */ |
300 | - private function get_stored_data( $key ) { |
|
300 | + private function get_stored_data($key) { |
|
301 | 301 | global $wpdb; |
302 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
302 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
303 | 303 | |
304 | - if ( empty( $value ) ) { |
|
304 | + if (empty($value)) { |
|
305 | 305 | return false; |
306 | 306 | } |
307 | 307 | |
308 | - $maybe_json = json_decode( $value ); |
|
309 | - if ( ! is_null( $maybe_json ) ) { |
|
310 | - $value = json_decode( $value, true ); |
|
308 | + $maybe_json = json_decode($value); |
|
309 | + if ( ! is_null($maybe_json)) { |
|
310 | + $value = json_decode($value, true); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | return $value; |
@@ -323,10 +323,10 @@ discard block |
||
323 | 323 | * |
324 | 324 | * @return void |
325 | 325 | */ |
326 | - private function store_data( $key, $value ) { |
|
326 | + private function store_data($key, $value) { |
|
327 | 327 | global $wpdb; |
328 | 328 | |
329 | - $value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value ); |
|
329 | + $value = is_array($value) ? wp_json_encode($value) : esc_attr($value); |
|
330 | 330 | |
331 | 331 | $data = array( |
332 | 332 | 'option_name' => $key, |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | '%s', |
341 | 341 | ); |
342 | 342 | |
343 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
343 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
@@ -352,11 +352,11 @@ discard block |
||
352 | 352 | * |
353 | 353 | * @return void |
354 | 354 | */ |
355 | - private function delete_data( $key ) { |
|
355 | + private function delete_data($key) { |
|
356 | 356 | global $wpdb; |
357 | - $wpdb->delete( $wpdb->options, array( |
|
357 | + $wpdb->delete($wpdb->options, array( |
|
358 | 358 | 'option_name' => $key, |
359 | - ) ); |
|
359 | + )); |
|
360 | 360 | } |
361 | 361 | |
362 | 362 | } |
363 | 363 | \ No newline at end of file |
@@ -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,20 +53,20 @@ discard block |
||
53 | 53 | * @return array|bool $data The data for the CSV file |
54 | 54 | */ |
55 | 55 | public function get_data() { |
56 | - $items = $this->get_stored_data( 'give_temp_delete_test_ids' ); |
|
56 | + $items = $this->get_stored_data('give_temp_delete_test_ids'); |
|
57 | 57 | |
58 | - if ( ! is_array( $items ) ) { |
|
58 | + if ( ! is_array($items)) { |
|
59 | 59 | return false; |
60 | 60 | } |
61 | 61 | |
62 | - $offset = ( $this->step - 1 ) * $this->per_step; |
|
63 | - $step_items = array_slice( $items, $offset, $this->per_step ); |
|
64 | - $meta_table = __give_v20_bc_table_details( 'payment' ); |
|
62 | + $offset = ($this->step - 1) * $this->per_step; |
|
63 | + $step_items = array_slice($items, $offset, $this->per_step); |
|
64 | + $meta_table = __give_v20_bc_table_details('payment'); |
|
65 | 65 | |
66 | - if ( $step_items ) { |
|
67 | - foreach ( $step_items as $item ) { |
|
66 | + if ($step_items) { |
|
67 | + foreach ($step_items as $item) { |
|
68 | 68 | // Delete the main payment. |
69 | - give_delete_donation( absint( $item['id'] ) ); |
|
69 | + give_delete_donation(absint($item['id'])); |
|
70 | 70 | } |
71 | 71 | return true; |
72 | 72 | } |
@@ -82,16 +82,16 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function get_percentage_complete() { |
84 | 84 | |
85 | - $items = $this->get_stored_data( 'give_temp_delete_test_ids', false ); |
|
86 | - $total = count( $items ); |
|
85 | + $items = $this->get_stored_data('give_temp_delete_test_ids', false); |
|
86 | + $total = count($items); |
|
87 | 87 | |
88 | 88 | $percentage = 100; |
89 | 89 | |
90 | - if ( $total > 0 ) { |
|
91 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
90 | + if ($total > 0) { |
|
91 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
92 | 92 | } |
93 | 93 | |
94 | - if ( $percentage > 100 ) { |
|
94 | + if ($percentage > 100) { |
|
95 | 95 | $percentage = 100; |
96 | 96 | } |
97 | 97 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @param array $request The Form Data passed into the batch processing |
107 | 107 | */ |
108 | - public function set_properties( $request ) { |
|
108 | + public function set_properties($request) { |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -116,29 +116,29 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function process_step() { |
118 | 118 | |
119 | - if ( ! $this->can_export() ) { |
|
120 | - wp_die( __( 'You do not have permission to delete test transactions.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
119 | + if ( ! $this->can_export()) { |
|
120 | + wp_die(__('You do not have permission to delete test transactions.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | $had_data = $this->get_data(); |
124 | 124 | |
125 | - if ( $had_data ) { |
|
125 | + if ($had_data) { |
|
126 | 126 | $this->done = false; |
127 | 127 | |
128 | 128 | return true; |
129 | 129 | } else { |
130 | - update_option( 'give_earnings_total', give_get_total_earnings( true ) ); |
|
131 | - Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) ); |
|
130 | + update_option('give_earnings_total', give_get_total_earnings(true)); |
|
131 | + Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats')); |
|
132 | 132 | |
133 | - $this->delete_data( 'give_temp_delete_test_ids' ); |
|
133 | + $this->delete_data('give_temp_delete_test_ids'); |
|
134 | 134 | |
135 | 135 | // Reset the sequential order numbers |
136 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
137 | - delete_option( 'give_last_payment_number' ); |
|
136 | + if (give_get_option('enable_sequential')) { |
|
137 | + delete_option('give_last_payment_number'); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | $this->done = true; |
141 | - $this->message = __( 'Test transactions successfully deleted.', 'give' ); |
|
141 | + $this->message = __('Test transactions successfully deleted.', 'give'); |
|
142 | 142 | |
143 | 143 | return false; |
144 | 144 | } |
@@ -171,27 +171,27 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function pre_fetch() { |
173 | 173 | |
174 | - if ( $this->step == 1 ) { |
|
175 | - $this->delete_data( 'give_temp_delete_test_ids' ); |
|
174 | + if ($this->step == 1) { |
|
175 | + $this->delete_data('give_temp_delete_test_ids'); |
|
176 | 176 | } |
177 | 177 | |
178 | - $items = get_option( 'give_temp_delete_test_ids', false ); |
|
178 | + $items = get_option('give_temp_delete_test_ids', false); |
|
179 | 179 | |
180 | - if ( false === $items ) { |
|
180 | + if (false === $items) { |
|
181 | 181 | $items = array(); |
182 | 182 | |
183 | - $args = apply_filters( 'give_tools_reset_stats_total_args', array( |
|
183 | + $args = apply_filters('give_tools_reset_stats_total_args', array( |
|
184 | 184 | 'post_status' => 'any', |
185 | - 'number' => - 1, |
|
185 | + 'number' => -1, |
|
186 | 186 | 'meta_key' => '_give_payment_mode', |
187 | 187 | 'meta_value' => 'test' |
188 | - ) ); |
|
188 | + )); |
|
189 | 189 | |
190 | - $posts = new Give_Payments_Query( $args ); |
|
190 | + $posts = new Give_Payments_Query($args); |
|
191 | 191 | $payments = $posts->get_payments(); |
192 | 192 | |
193 | 193 | /* @var Give_Payment $payment */ |
194 | - foreach ( $payments as $payment ) { |
|
194 | + foreach ($payments as $payment) { |
|
195 | 195 | $items[] = array( |
196 | 196 | 'id' => (int) $payment->ID, |
197 | 197 | 'type' => 'give_payment', |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | |
201 | 201 | // Allow filtering of items to remove with an unassociative array for each item. |
202 | 202 | // The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method. |
203 | - $items = apply_filters( 'give_delete_test_items', $items ); |
|
203 | + $items = apply_filters('give_delete_test_items', $items); |
|
204 | 204 | |
205 | - $this->store_data( 'give_temp_delete_test_ids', $items ); |
|
205 | + $this->store_data('give_temp_delete_test_ids', $items); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | } |
@@ -216,17 +216,17 @@ discard block |
||
216 | 216 | * |
217 | 217 | * @return mixed Returns the data from the database |
218 | 218 | */ |
219 | - private function get_stored_data( $key ) { |
|
219 | + private function get_stored_data($key) { |
|
220 | 220 | global $wpdb; |
221 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
221 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
222 | 222 | |
223 | - if ( empty( $value ) ) { |
|
223 | + if (empty($value)) { |
|
224 | 224 | return false; |
225 | 225 | } |
226 | 226 | |
227 | - $maybe_json = json_decode( $value ); |
|
228 | - if ( ! is_null( $maybe_json ) ) { |
|
229 | - $value = json_decode( $value, true ); |
|
227 | + $maybe_json = json_decode($value); |
|
228 | + if ( ! is_null($maybe_json)) { |
|
229 | + $value = json_decode($value, true); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | return $value; |
@@ -242,10 +242,10 @@ discard block |
||
242 | 242 | * |
243 | 243 | * @return void |
244 | 244 | */ |
245 | - private function store_data( $key, $value ) { |
|
245 | + private function store_data($key, $value) { |
|
246 | 246 | global $wpdb; |
247 | 247 | |
248 | - $value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value ); |
|
248 | + $value = is_array($value) ? wp_json_encode($value) : esc_attr($value); |
|
249 | 249 | |
250 | 250 | $data = array( |
251 | 251 | 'option_name' => $key, |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | '%s', |
260 | 260 | ); |
261 | 261 | |
262 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
262 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | /** |
@@ -271,9 +271,9 @@ discard block |
||
271 | 271 | * |
272 | 272 | * @return void |
273 | 273 | */ |
274 | - private function delete_data( $key ) { |
|
274 | + private function delete_data($key) { |
|
275 | 275 | global $wpdb; |
276 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
276 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | } |
@@ -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 | |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @since 1.0 |
36 | 36 | */ |
37 | 37 | public function __construct() { |
38 | - add_action( 'admin_menu', array( $this, 'admin_menus' ) ); |
|
39 | - add_action( 'admin_head', array( $this, 'admin_head' ) ); |
|
40 | - add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
38 | + add_action('admin_menu', array($this, 'admin_menus')); |
|
39 | + add_action('admin_head', array($this, 'admin_head')); |
|
40 | + add_action('admin_init', array($this, 'welcome')); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -49,45 +49,45 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public function admin_menus() { |
52 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
52 | + list($display_version) = explode('-', GIVE_VERSION); |
|
53 | 53 | |
54 | 54 | // About Page |
55 | 55 | add_dashboard_page( |
56 | 56 | /* translators: %s: Give version */ |
57 | - sprintf( esc_html__( 'Welcome to Give %s', 'give' ), $display_version ), |
|
58 | - esc_html__( 'Welcome to Give', 'give' ), |
|
57 | + sprintf(esc_html__('Welcome to Give %s', 'give'), $display_version), |
|
58 | + esc_html__('Welcome to Give', 'give'), |
|
59 | 59 | $this->minimum_capability, |
60 | 60 | 'give-about', |
61 | - array( $this, 'about_screen' ) |
|
61 | + array($this, 'about_screen') |
|
62 | 62 | ); |
63 | 63 | |
64 | 64 | // Changelog Page |
65 | 65 | add_dashboard_page( |
66 | - esc_html__( 'Give Changelog', 'give' ), |
|
67 | - esc_html__( 'Give Changelog', 'give' ), |
|
66 | + esc_html__('Give Changelog', 'give'), |
|
67 | + esc_html__('Give Changelog', 'give'), |
|
68 | 68 | $this->minimum_capability, |
69 | 69 | 'give-changelog', |
70 | - array( $this, 'changelog_screen' ) |
|
70 | + array($this, 'changelog_screen') |
|
71 | 71 | ); |
72 | 72 | |
73 | 73 | // Getting Started Page |
74 | 74 | add_dashboard_page( |
75 | 75 | /* translators: %s: Give version */ |
76 | - sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ), |
|
77 | - esc_html__( 'Getting started with Give', 'give' ), |
|
76 | + sprintf(esc_html__('Give %s - Getting Started Guide', 'give'), $display_version), |
|
77 | + esc_html__('Getting started with Give', 'give'), |
|
78 | 78 | $this->minimum_capability, |
79 | 79 | 'give-getting-started', |
80 | - array( $this, 'getting_started_screen' ) |
|
80 | + array($this, 'getting_started_screen') |
|
81 | 81 | ); |
82 | 82 | |
83 | 83 | // Credits Page |
84 | 84 | add_dashboard_page( |
85 | 85 | /* translators: %s: Give version */ |
86 | - sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ), |
|
87 | - esc_html__( 'The people that build Give', 'give' ), |
|
86 | + sprintf(esc_html__('Give %s - Credits', 'give'), $display_version), |
|
87 | + esc_html__('The people that build Give', 'give'), |
|
88 | 88 | $this->minimum_capability, |
89 | 89 | 'give-credits', |
90 | - array( $this, 'credits_screen' ) |
|
90 | + array($this, 'credits_screen') |
|
91 | 91 | ); |
92 | 92 | } |
93 | 93 | |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function admin_head() { |
102 | 102 | |
103 | - remove_submenu_page( 'index.php', 'give-about' ); |
|
104 | - remove_submenu_page( 'index.php', 'give-changelog' ); |
|
105 | - remove_submenu_page( 'index.php', 'give-getting-started' ); |
|
106 | - remove_submenu_page( 'index.php', 'give-credits' ); |
|
103 | + remove_submenu_page('index.php', 'give-about'); |
|
104 | + remove_submenu_page('index.php', 'give-changelog'); |
|
105 | + remove_submenu_page('index.php', 'give-getting-started'); |
|
106 | + remove_submenu_page('index.php', 'give-credits'); |
|
107 | 107 | |
108 | 108 | } |
109 | 109 | |
@@ -115,24 +115,24 @@ discard block |
||
115 | 115 | * @return void |
116 | 116 | */ |
117 | 117 | public function tabs() { |
118 | - $selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about'; |
|
118 | + $selected = isset($_GET['page']) ? $_GET['page'] : 'give-about'; |
|
119 | 119 | ?> |
120 | 120 | <h2 class="nav-tab-wrapper"> |
121 | 121 | <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" |
122 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>"> |
|
123 | - <?php esc_html_e( 'About Give', 'give' ); ?> |
|
122 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>"> |
|
123 | + <?php esc_html_e('About Give', 'give'); ?> |
|
124 | 124 | </a> |
125 | 125 | <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" |
126 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>"> |
|
127 | - <?php esc_html_e( 'Getting Started', 'give' ); ?> |
|
126 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>"> |
|
127 | + <?php esc_html_e('Getting Started', 'give'); ?> |
|
128 | 128 | </a> |
129 | 129 | <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" |
130 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>"> |
|
131 | - <?php esc_html_e( 'Credits', 'give' ); ?> |
|
130 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>"> |
|
131 | + <?php esc_html_e('Credits', 'give'); ?> |
|
132 | 132 | </a> |
133 | 133 | <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" |
134 | - href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-addons' ) ); ?>"> |
|
135 | - <?php esc_html_e( 'Add-ons', 'give' ); ?> |
|
134 | + href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-addons')); ?>"> |
|
135 | + <?php esc_html_e('Add-ons', 'give'); ?> |
|
136 | 136 | </a> |
137 | 137 | </h2> |
138 | 138 | <?php |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @return void |
147 | 147 | */ |
148 | 148 | public function about_screen() { |
149 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
149 | + list($display_version) = explode('-', GIVE_VERSION); |
|
150 | 150 | ?> |
151 | 151 | <div class="wrap about-wrap"> |
152 | 152 | |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | <p class="about-text"><?php |
156 | 156 | printf( |
157 | 157 | /* translators: %s: http://docs.givewp.com/docs */ |
158 | - __( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ), |
|
159 | - esc_url( 'http://docs.givewp.com/docs' ) |
|
158 | + __('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'), |
|
159 | + esc_url('http://docs.givewp.com/docs') |
|
160 | 160 | ); |
161 | 161 | ?></p> |
162 | 162 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | <div class="give-badge"><?php |
166 | 166 | printf( |
167 | 167 | /* translators: %s: Give version */ |
168 | - esc_html__( 'Version %s', 'give' ), |
|
168 | + esc_html__('Version %s', 'give'), |
|
169 | 169 | $display_version |
170 | 170 | ); |
171 | 171 | ?></div> |
@@ -175,17 +175,17 @@ discard block |
||
175 | 175 | <div class="feature-section clearfix introduction"> |
176 | 176 | |
177 | 177 | <div class="video feature-section-item"> |
178 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>" |
|
179 | - alt="<?php esc_attr_e( 'Give', 'give' ); ?>"> |
|
178 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>" |
|
179 | + alt="<?php esc_attr_e('Give', 'give'); ?>"> |
|
180 | 180 | </div> |
181 | 181 | |
182 | 182 | <div class="content feature-section-item last-feature"> |
183 | 183 | |
184 | - <h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3> |
|
184 | + <h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3> |
|
185 | 185 | |
186 | - <p><?php esc_html_e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p> |
|
186 | + <p><?php esc_html_e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p> |
|
187 | 187 | <a href="https://givewp.com" target="_blank" class="button-secondary"> |
188 | - <?php esc_html_e( 'Learn More', 'give' ); ?> |
|
188 | + <?php esc_html_e('Learn More', 'give'); ?> |
|
189 | 189 | <span class="dashicons dashicons-external"></span> |
190 | 190 | </a> |
191 | 191 | |
@@ -198,22 +198,22 @@ discard block |
||
198 | 198 | |
199 | 199 | <div class="content feature-section-item"> |
200 | 200 | |
201 | - <h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3> |
|
201 | + <h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3> |
|
202 | 202 | |
203 | - <p><?php esc_html_e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p> |
|
203 | + <p><?php esc_html_e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p> |
|
204 | 204 | |
205 | 205 | <h4>Find Out More:</h4> |
206 | 206 | <ul class="ul-disc"> |
207 | - <li><a href="https://givewp.com/" target="_blank"><?php esc_html_e( 'Visit the Give Website', 'give' ); ?></a></li> |
|
208 | - <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e( 'View the Give Features', 'give' ); ?></a></li> |
|
209 | - <li><a href="https://givewp.com/documentation/" target="_blank"><?php esc_html_e( 'Read the Documentation', 'give' ); ?></a></li> |
|
207 | + <li><a href="https://givewp.com/" target="_blank"><?php esc_html_e('Visit the Give Website', 'give'); ?></a></li> |
|
208 | + <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e('View the Give Features', 'give'); ?></a></li> |
|
209 | + <li><a href="https://givewp.com/documentation/" target="_blank"><?php esc_html_e('Read the Documentation', 'give'); ?></a></li> |
|
210 | 210 | </ul> |
211 | 211 | |
212 | 212 | </div> |
213 | 213 | |
214 | 214 | <div class="content feature-section-item last-feature"> |
215 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/admin/give-form-mockup.png' ?>" |
|
216 | - alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>"> |
|
215 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/admin/give-form-mockup.png' ?>" |
|
216 | + alt="<?php esc_attr_e('A Give donation form', 'give'); ?>"> |
|
217 | 217 | </div> |
218 | 218 | |
219 | 219 | </div> |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @return void |
233 | 233 | */ |
234 | 234 | public function changelog_screen() { |
235 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
235 | + list($display_version) = explode('-', GIVE_VERSION); |
|
236 | 236 | ?> |
237 | 237 | <div class="wrap about-wrap"> |
238 | 238 | <h1><?php echo get_admin_page_title(); ?></h1> |
@@ -240,14 +240,14 @@ discard block |
||
240 | 240 | <p class="about-text"><?php |
241 | 241 | printf( |
242 | 242 | /* translators: %s: Give version */ |
243 | - esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ), |
|
243 | + esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'), |
|
244 | 244 | $display_version |
245 | 245 | ); |
246 | 246 | ?></p> |
247 | 247 | <div class="give-badge"><?php |
248 | 248 | printf( |
249 | 249 | /* translators: %s: Give version */ |
250 | - esc_html__( 'Version %s', 'give' ), |
|
250 | + esc_html__('Version %s', 'give'), |
|
251 | 251 | $display_version |
252 | 252 | ); |
253 | 253 | ?></div> |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | <?php $this->tabs(); ?> |
256 | 256 | |
257 | 257 | <div class="changelog"> |
258 | - <h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3> |
|
258 | + <h3><?php esc_html_e('Full Changelog', 'give'); ?></h3> |
|
259 | 259 | |
260 | 260 | <div class="feature-section"> |
261 | 261 | <?php echo $this->parse_readme(); ?> |
@@ -263,10 +263,10 @@ discard block |
||
263 | 263 | </div> |
264 | 264 | |
265 | 265 | <div class="return-to-dashboard"> |
266 | - <a href="<?php echo esc_url( admin_url( add_query_arg( array( |
|
266 | + <a href="<?php echo esc_url(admin_url(add_query_arg(array( |
|
267 | 267 | 'post_type' => 'give_forms', |
268 | 268 | 'page' => 'give-settings' |
269 | - ), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a> |
|
269 | + ), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a> |
|
270 | 270 | </div> |
271 | 271 | </div> |
272 | 272 | <?php |
@@ -280,36 +280,36 @@ discard block |
||
280 | 280 | * @return void |
281 | 281 | */ |
282 | 282 | public function getting_started_screen() { |
283 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
283 | + list($display_version) = explode('-', GIVE_VERSION); |
|
284 | 284 | ?> |
285 | 285 | <div class="wrap about-wrap get-started"> |
286 | 286 | |
287 | 287 | <?php $this->get_welcome_header() ?> |
288 | 288 | |
289 | - <p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p> |
|
289 | + <p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p> |
|
290 | 290 | |
291 | 291 | <?php give_get_newsletter(); ?> |
292 | 292 | |
293 | 293 | <div class="give-badge"><?php |
294 | 294 | printf( |
295 | 295 | /* translators: %s: Give version */ |
296 | - esc_html__( 'Version %s', 'give' ), |
|
296 | + esc_html__('Version %s', 'give'), |
|
297 | 297 | $display_version |
298 | 298 | ); |
299 | 299 | ?></div> |
300 | 300 | |
301 | 301 | <?php $this->tabs(); ?> |
302 | 302 | |
303 | - <p class="about-text"><?php printf( esc_html__( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></p> |
|
303 | + <p class="about-text"><?php printf(esc_html__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></p> |
|
304 | 304 | |
305 | 305 | <div class="feature-section clearfix"> |
306 | 306 | |
307 | 307 | <div class="content feature-section-item"> |
308 | - <h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3> |
|
308 | + <h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3> |
|
309 | 309 | |
310 | - <p><?php esc_html_e( 'Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give' ); ?></p> |
|
310 | + <p><?php esc_html_e('Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give'); ?></p> |
|
311 | 311 | |
312 | - <p><?php esc_html_e( 'All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give' ); ?></p> |
|
312 | + <p><?php esc_html_e('All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give'); ?></p> |
|
313 | 313 | </div> |
314 | 314 | |
315 | 315 | <div class="content feature-section-item last-feature"> |
@@ -326,9 +326,9 @@ discard block |
||
326 | 326 | </div> |
327 | 327 | |
328 | 328 | <div class="content feature-section-item last-feature"> |
329 | - <h3><?php esc_html_e( 'STEP 2: Customize Your Donation Forms', 'give' ); ?></h3> |
|
329 | + <h3><?php esc_html_e('STEP 2: Customize Your Donation Forms', 'give'); ?></h3> |
|
330 | 330 | |
331 | - <p><?php esc_html_e( 'Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give' ); ?></p> |
|
331 | + <p><?php esc_html_e('Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give'); ?></p> |
|
332 | 332 | </div> |
333 | 333 | |
334 | 334 | </div> |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | <div class="feature-section clearfix"> |
338 | 338 | |
339 | 339 | <div class="content feature-section-item add-content"> |
340 | - <h3><?php esc_html_e( 'STEP 3: Add Additional Content', 'give' ); ?></h3> |
|
340 | + <h3><?php esc_html_e('STEP 3: Add Additional Content', 'give'); ?></h3> |
|
341 | 341 | |
342 | - <p><?php esc_html_e( 'Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give' ); ?></p> |
|
342 | + <p><?php esc_html_e('Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give'); ?></p> |
|
343 | 343 | |
344 | - <p><?php esc_html_e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p> |
|
344 | + <p><?php esc_html_e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p> |
|
345 | 345 | </div> |
346 | 346 | |
347 | 347 | <div class="content feature-section-item last-feature"> |
@@ -358,9 +358,9 @@ discard block |
||
358 | 358 | </div> |
359 | 359 | |
360 | 360 | <div class="content feature-section-item last-feature"> |
361 | - <h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3> |
|
361 | + <h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3> |
|
362 | 362 | |
363 | - <p><?php esc_html_e( 'Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give' ); ?></p> |
|
363 | + <p><?php esc_html_e('Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give'); ?></p> |
|
364 | 364 | </div> |
365 | 365 | |
366 | 366 | |
@@ -380,20 +380,20 @@ discard block |
||
380 | 380 | * @return void |
381 | 381 | */ |
382 | 382 | public function credits_screen() { |
383 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
383 | + list($display_version) = explode('-', GIVE_VERSION); |
|
384 | 384 | ?> |
385 | 385 | <div class="wrap about-wrap"> |
386 | 386 | |
387 | 387 | <?php $this->get_welcome_header() ?> |
388 | 388 | |
389 | - <p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p> |
|
389 | + <p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p> |
|
390 | 390 | |
391 | 391 | <?php give_get_newsletter(); ?> |
392 | 392 | |
393 | 393 | <div class="give-badge"><?php |
394 | 394 | printf( |
395 | 395 | /* translators: %s: Give version */ |
396 | - esc_html__( 'Version %s', 'give' ), |
|
396 | + esc_html__('Version %s', 'give'), |
|
397 | 397 | $display_version |
398 | 398 | ); |
399 | 399 | ?></div> |
@@ -403,8 +403,8 @@ discard block |
||
403 | 403 | <p class="about-description"><?php |
404 | 404 | printf( |
405 | 405 | /* translators: %s: https://github.com/WordImpress/give */ |
406 | - __( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ), |
|
407 | - esc_url( 'https://github.com/WordImpress/give' ) |
|
406 | + __('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give'), |
|
407 | + esc_url('https://github.com/WordImpress/give') |
|
408 | 408 | ); |
409 | 409 | ?></p> |
410 | 410 | |
@@ -421,21 +421,21 @@ discard block |
||
421 | 421 | * @return string $readme HTML formatted readme file |
422 | 422 | */ |
423 | 423 | public function parse_readme() { |
424 | - $file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null; |
|
424 | + $file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR . 'readme.txt' : null; |
|
425 | 425 | |
426 | - if ( ! $file ) { |
|
427 | - $readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>'; |
|
426 | + if ( ! $file) { |
|
427 | + $readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>'; |
|
428 | 428 | } else { |
429 | - $readme = file_get_contents( $file ); |
|
430 | - $readme = nl2br( esc_html( $readme ) ); |
|
431 | - $readme = explode( '== Changelog ==', $readme ); |
|
432 | - $readme = end( $readme ); |
|
433 | - |
|
434 | - $readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme ); |
|
435 | - $readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme ); |
|
436 | - $readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme ); |
|
437 | - $readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme ); |
|
438 | - $readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme ); |
|
429 | + $readme = file_get_contents($file); |
|
430 | + $readme = nl2br(esc_html($readme)); |
|
431 | + $readme = explode('== Changelog ==', $readme); |
|
432 | + $readme = end($readme); |
|
433 | + |
|
434 | + $readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme); |
|
435 | + $readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme); |
|
436 | + $readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme); |
|
437 | + $readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme); |
|
438 | + $readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | return $readme; |
@@ -452,24 +452,24 @@ discard block |
||
452 | 452 | public function contributors() { |
453 | 453 | $contributors = $this->get_contributors(); |
454 | 454 | |
455 | - if ( empty( $contributors ) ) { |
|
455 | + if (empty($contributors)) { |
|
456 | 456 | return ''; |
457 | 457 | } |
458 | 458 | |
459 | 459 | $contributor_list = '<ul class="wp-people-group">'; |
460 | 460 | |
461 | - foreach ( $contributors as $contributor ) { |
|
461 | + foreach ($contributors as $contributor) { |
|
462 | 462 | $contributor_list .= '<li class="wp-person">'; |
463 | 463 | $contributor_list .= sprintf( |
464 | 464 | '<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>', |
465 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
466 | - esc_url( $contributor->avatar_url ), |
|
467 | - esc_attr( $contributor->login ) |
|
465 | + esc_url('https://github.com/'.$contributor->login), |
|
466 | + esc_url($contributor->avatar_url), |
|
467 | + esc_attr($contributor->login) |
|
468 | 468 | ); |
469 | 469 | $contributor_list .= sprintf( |
470 | 470 | '<a class="web" target="_blank" href="%1$s">%2$s</a>', |
471 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
472 | - esc_html( $contributor->login ) |
|
471 | + esc_url('https://github.com/'.$contributor->login), |
|
472 | + esc_html($contributor->login) |
|
473 | 473 | ); |
474 | 474 | $contributor_list .= '</li>'; |
475 | 475 | } |
@@ -487,25 +487,25 @@ discard block |
||
487 | 487 | * @return array $contributors List of contributors |
488 | 488 | */ |
489 | 489 | public function get_contributors() { |
490 | - $contributors = Give_Cache::get( 'give_contributors', true ); |
|
490 | + $contributors = Give_Cache::get('give_contributors', true); |
|
491 | 491 | |
492 | - if ( false !== $contributors ) { |
|
492 | + if (false !== $contributors) { |
|
493 | 493 | return $contributors; |
494 | 494 | } |
495 | 495 | |
496 | - $response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) ); |
|
496 | + $response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false)); |
|
497 | 497 | |
498 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
|
498 | + if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) { |
|
499 | 499 | return array(); |
500 | 500 | } |
501 | 501 | |
502 | - $contributors = json_decode( wp_remote_retrieve_body( $response ) ); |
|
502 | + $contributors = json_decode(wp_remote_retrieve_body($response)); |
|
503 | 503 | |
504 | - if ( ! is_array( $contributors ) ) { |
|
504 | + if ( ! is_array($contributors)) { |
|
505 | 505 | return array(); |
506 | 506 | } |
507 | 507 | |
508 | - Give_Cache::set( 'give_contributors', $contributors, HOUR_IN_SECONDS, true ); |
|
508 | + Give_Cache::set('give_contributors', $contributors, HOUR_IN_SECONDS, true); |
|
509 | 509 | |
510 | 510 | return $contributors; |
511 | 511 | } |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | */ |
518 | 518 | public function get_welcome_header() { |
519 | 519 | // Badge for welcome page |
520 | - $badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png'; |
|
520 | + $badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png'; |
|
521 | 521 | ?> |
522 | 522 | <h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1> |
523 | 523 | <?php $this->social_media_elements(); ?> |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | <a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false"><?php |
611 | 611 | printf( |
612 | 612 | /* translators: %s: Give twitter user @givewp */ |
613 | - esc_html_e( 'Follow %s', 'give' ), |
|
613 | + esc_html_e('Follow %s', 'give'), |
|
614 | 614 | '@givewp' |
615 | 615 | ); |
616 | 616 | ?></a> |
@@ -644,27 +644,27 @@ discard block |
||
644 | 644 | public function welcome() { |
645 | 645 | |
646 | 646 | // Bail if no activation redirect |
647 | - if ( ! Give_Cache::get( '_give_activation_redirect', true ) || wp_doing_ajax() ) { |
|
647 | + if ( ! Give_Cache::get('_give_activation_redirect', true) || wp_doing_ajax()) { |
|
648 | 648 | return; |
649 | 649 | } |
650 | 650 | |
651 | 651 | // Delete the redirect transient |
652 | - Give_Cache::delete( Give_Cache::get_key( '_give_activation_redirect' ) ); |
|
652 | + Give_Cache::delete(Give_Cache::get_key('_give_activation_redirect')); |
|
653 | 653 | |
654 | 654 | // Bail if activating from network, or bulk |
655 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
655 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
656 | 656 | return; |
657 | 657 | } |
658 | 658 | |
659 | - $upgrade = get_option( 'give_version_upgraded_from' ); |
|
659 | + $upgrade = get_option('give_version_upgraded_from'); |
|
660 | 660 | |
661 | - if ( ! $upgrade ) { // First time install |
|
662 | - wp_safe_redirect( admin_url( 'index.php?page=give-about' ) ); |
|
661 | + if ( ! $upgrade) { // First time install |
|
662 | + wp_safe_redirect(admin_url('index.php?page=give-about')); |
|
663 | 663 | exit; |
664 | - } elseif ( ! give_is_setting_enabled( give_get_option( 'welcome' ) ) ) { // Welcome is disabled in settings |
|
664 | + } elseif ( ! give_is_setting_enabled(give_get_option('welcome'))) { // Welcome is disabled in settings |
|
665 | 665 | |
666 | 666 | } else { // Welcome is NOT disabled in settings |
667 | - wp_safe_redirect( admin_url( 'index.php?page=give-about' ) ); |
|
667 | + wp_safe_redirect(admin_url('index.php?page=give-about')); |
|
668 | 668 | exit; |
669 | 669 | } |
670 | 670 | } |