@@ -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,12 +27,12 @@ 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 | |
34 | - if ( $this->id === give_get_current_setting_tab() ) { |
|
35 | - add_action( 'give_admin_field_remove_cache_button', array( $this, 'render_remove_cache_button' ), 10, 1 ); |
|
34 | + if ($this->id === give_get_current_setting_tab()) { |
|
35 | + add_action('give_admin_field_remove_cache_button', array($this, 'render_remove_cache_button'), 10, 1); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | parent::__construct(); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | $current_section = give_get_current_setting_section(); |
51 | 51 | |
52 | - switch ( $current_section ) { |
|
52 | + switch ($current_section) { |
|
53 | 53 | case 'advanced-options': |
54 | 54 | $settings = array( |
55 | 55 | array( |
@@ -57,19 +57,19 @@ discard block |
||
57 | 57 | 'type' => 'title', |
58 | 58 | ), |
59 | 59 | array( |
60 | - 'name' => __( 'Remove Data on Uninstall', 'give' ), |
|
61 | - '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' ), |
|
60 | + 'name' => __('Remove Data on Uninstall', 'give'), |
|
61 | + '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'), |
|
62 | 62 | 'id' => 'uninstall_on_delete', |
63 | 63 | 'type' => 'radio_inline', |
64 | 64 | 'default' => 'disabled', |
65 | 65 | 'options' => array( |
66 | - 'enabled' => __( 'Yes, Remove all data', 'give' ), |
|
67 | - 'disabled' => __( 'No, keep my Give settings and donation data', 'give' ), |
|
66 | + 'enabled' => __('Yes, Remove all data', 'give'), |
|
67 | + 'disabled' => __('No, keep my Give settings and donation data', 'give'), |
|
68 | 68 | ), |
69 | 69 | ), |
70 | 70 | array( |
71 | - 'name' => __( 'Default User Role', 'give' ), |
|
72 | - 'desc' => __( 'Assign default user roles for donors when donors opt to register as a WP User.', 'give' ), |
|
71 | + 'name' => __('Default User Role', 'give'), |
|
72 | + 'desc' => __('Assign default user roles for donors when donors opt to register as a WP User.', 'give'), |
|
73 | 73 | 'id' => 'donor_default_user_role', |
74 | 74 | 'type' => 'select', |
75 | 75 | 'default' => 'give_donor', |
@@ -77,51 +77,51 @@ discard block |
||
77 | 77 | ), |
78 | 78 | array( |
79 | 79 | /* translators: %s: the_content */ |
80 | - 'name' => sprintf( __( '%s filter', 'give' ), '<code>the_content</code>' ), |
|
80 | + 'name' => sprintf(__('%s filter', 'give'), '<code>the_content</code>'), |
|
81 | 81 | /* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */ |
82 | - '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>' ), |
|
82 | + '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>'), |
|
83 | 83 | 'id' => 'the_content_filter', |
84 | 84 | 'default' => 'enabled', |
85 | 85 | 'type' => 'radio_inline', |
86 | 86 | 'options' => array( |
87 | - 'enabled' => __( 'Enabled', 'give' ), |
|
88 | - 'disabled' => __( 'Disabled', 'give' ), |
|
87 | + 'enabled' => __('Enabled', 'give'), |
|
88 | + 'disabled' => __('Disabled', 'give'), |
|
89 | 89 | ), |
90 | 90 | ), |
91 | 91 | array( |
92 | - 'name' => __( 'Script Loading Location', 'give' ), |
|
93 | - 'desc' => __( 'This allows you to load your Give scripts either in the <code><head></code> or footer of your website.', 'give' ), |
|
92 | + 'name' => __('Script Loading Location', 'give'), |
|
93 | + 'desc' => __('This allows you to load your Give scripts either in the <code><head></code> or footer of your website.', 'give'), |
|
94 | 94 | 'id' => 'scripts_footer', |
95 | 95 | 'type' => 'radio_inline', |
96 | 96 | 'default' => 'disabled', |
97 | 97 | 'options' => array( |
98 | - 'disabled' => __( 'Head', 'give' ), |
|
99 | - 'enabled' => __( 'Footer', 'give' ), |
|
98 | + 'disabled' => __('Head', 'give'), |
|
99 | + 'enabled' => __('Footer', 'give'), |
|
100 | 100 | ), |
101 | 101 | ), |
102 | 102 | array( |
103 | - 'name' => __( 'Akismet SPAM Protection', 'give' ), |
|
104 | - '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' ), |
|
103 | + 'name' => __('Akismet SPAM Protection', 'give'), |
|
104 | + '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'), |
|
105 | 105 | 'id' => 'akismet_spam_protection', |
106 | 106 | 'type' => 'radio_inline', |
107 | - 'default' => ( give_check_akismet_key() ) ? 'enabled' : 'disabled', |
|
107 | + 'default' => (give_check_akismet_key()) ? 'enabled' : 'disabled', |
|
108 | 108 | 'options' => array( |
109 | - 'enabled' => __( 'Enabled', 'give' ), |
|
110 | - 'disabled' => __( 'Disabled', 'give' ), |
|
109 | + 'enabled' => __('Enabled', 'give'), |
|
110 | + 'disabled' => __('Disabled', 'give'), |
|
111 | 111 | ), |
112 | 112 | ), |
113 | 113 | array( |
114 | 114 | 'name' => 'Give Cache', |
115 | 115 | 'id' => 'give-clear-cache', |
116 | - 'buttonTitle' => __( 'Clear Cache', 'give' ), |
|
117 | - 'desc' => __( 'Click this button if you want to clear Give\'s cache. The plugin stores common settings and queries in cache to optimize performance. Clearing cache will remove and begin rebuilding these saved queries.', 'give' ), |
|
116 | + 'buttonTitle' => __('Clear Cache', 'give'), |
|
117 | + 'desc' => __('Click this button if you want to clear Give\'s cache. The plugin stores common settings and queries in cache to optimize performance. Clearing cache will remove and begin rebuilding these saved queries.', 'give'), |
|
118 | 118 | 'type' => 'remove_cache_button' |
119 | 119 | ), |
120 | 120 | array( |
121 | - 'name' => __( 'Advanced Settings Docs Link', 'give' ), |
|
121 | + 'name' => __('Advanced Settings Docs Link', 'give'), |
|
122 | 122 | 'id' => 'advanced_settings_docs_link', |
123 | - 'url' => esc_url( 'http://docs.givewp.com/settings-advanced' ), |
|
124 | - 'title' => __( 'Advanced Settings', 'give' ), |
|
123 | + 'url' => esc_url('http://docs.givewp.com/settings-advanced'), |
|
124 | + 'title' => __('Advanced Settings', 'give'), |
|
125 | 125 | 'type' => 'give_docs_link', |
126 | 126 | ), |
127 | 127 | array( |
@@ -137,20 +137,20 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @since 2.0 |
139 | 139 | */ |
140 | - if ( apply_filters( 'give_settings_advanced_show_cache_setting', false ) ) { |
|
141 | - array_splice( $settings, 1, 0, array( |
|
140 | + if (apply_filters('give_settings_advanced_show_cache_setting', false)) { |
|
141 | + array_splice($settings, 1, 0, array( |
|
142 | 142 | array( |
143 | - 'name' => __( 'Cache', 'give' ), |
|
144 | - 'desc' => __( 'If caching is enabled the plugin will start caching custom post type related queries and reduce the overall load time.', 'give' ), |
|
143 | + 'name' => __('Cache', 'give'), |
|
144 | + 'desc' => __('If caching is enabled the plugin will start caching custom post type related queries and reduce the overall load time.', 'give'), |
|
145 | 145 | 'id' => 'cache', |
146 | 146 | 'type' => 'radio_inline', |
147 | 147 | 'default' => 'enabled', |
148 | 148 | 'options' => array( |
149 | - 'enabled' => __( 'Enabled', 'give' ), |
|
150 | - 'disabled' => __( 'Disabled', 'give' ), |
|
149 | + 'enabled' => __('Enabled', 'give'), |
|
150 | + 'disabled' => __('Disabled', 'give'), |
|
151 | 151 | ), |
152 | 152 | ) |
153 | - ) ); |
|
153 | + )); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * Filter the advanced settings. |
159 | 159 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
160 | 160 | */ |
161 | - $settings = apply_filters( 'give_settings_advanced', $settings ); |
|
161 | + $settings = apply_filters('give_settings_advanced', $settings); |
|
162 | 162 | |
163 | 163 | /** |
164 | 164 | * Filter the settings. |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * |
168 | 168 | * @param array $settings |
169 | 169 | */ |
170 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
170 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
171 | 171 | |
172 | 172 | // Output. |
173 | 173 | return $settings; |
@@ -181,10 +181,10 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function get_sections() { |
183 | 183 | $sections = array( |
184 | - 'advanced-options' => __( 'Advanced Options', 'give' ), |
|
184 | + 'advanced-options' => __('Advanced Options', 'give'), |
|
185 | 185 | ); |
186 | 186 | |
187 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
187 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | |
@@ -196,17 +196,17 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @param array $field |
198 | 198 | */ |
199 | - public function render_remove_cache_button( $field ) { |
|
199 | + public function render_remove_cache_button($field) { |
|
200 | 200 | ?> |
201 | - <tr valign="top" <?php echo ! empty( $field['wrapper_class'] ) ? 'class="' . $field['wrapper_class'] . '"' : '' ?>> |
|
201 | + <tr valign="top" <?php echo ! empty($field['wrapper_class']) ? 'class="'.$field['wrapper_class'].'"' : '' ?>> |
|
202 | 202 | <th scope="row" class="titledesc"> |
203 | 203 | <label |
204 | - for="<?php echo esc_attr( $field['id'] ); ?>"><?php echo esc_html( $field['name'] ) ?></label> |
|
204 | + for="<?php echo esc_attr($field['id']); ?>"><?php echo esc_html($field['name']) ?></label> |
|
205 | 205 | </th> |
206 | 206 | <td class="give-forminp"> |
207 | - <button type="button" id="<?php echo esc_attr( $field['id'] ); ?>" |
|
208 | - class="button button-secondary"><?php echo esc_html( $field['buttonTitle'] ) ?></button> |
|
209 | - <?php echo Give_Admin_Settings::get_field_description( $field ); ?> |
|
207 | + <button type="button" id="<?php echo esc_attr($field['id']); ?>" |
|
208 | + class="button button-secondary"><?php echo esc_html($field['buttonTitle']) ?></button> |
|
209 | + <?php echo Give_Admin_Settings::get_field_description($field); ?> |
|
210 | 210 | </td> |
211 | 211 | </tr> |
212 | 212 | <?php |
@@ -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_General' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_General')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_General. |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'general'; |
30 | - $this->label = __( 'General', 'give' ); |
|
30 | + $this->label = __('General', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'general-settings'; |
33 | 33 | |
34 | - if ( $this->id === give_get_current_setting_tab() ) { |
|
35 | - add_action( 'give_save_settings_give_settings', array( $this, '__give_change_donation_stating_number' ), 10, 3 ); |
|
36 | - add_action( 'give_admin_field_give_sequential_donation_code_preview', array( $this, '__render_give_sequential_donation_code_preview' ), 10, 3 ); |
|
37 | - add_action( 'give_admin_field_give_unlock_all_settings', array( $this, '__render_give_unlock_all_settings' ), 10, 3 ); |
|
34 | + if ($this->id === give_get_current_setting_tab()) { |
|
35 | + add_action('give_save_settings_give_settings', array($this, '__give_change_donation_stating_number'), 10, 3); |
|
36 | + add_action('give_admin_field_give_sequential_donation_code_preview', array($this, '__render_give_sequential_donation_code_preview'), 10, 3); |
|
37 | + add_action('give_admin_field_give_unlock_all_settings', array($this, '__render_give_unlock_all_settings'), 10, 3); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | parent::__construct(); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $settings = array(); |
51 | 51 | $current_section = give_get_current_setting_section(); |
52 | 52 | |
53 | - switch ( $current_section ) { |
|
53 | + switch ($current_section) { |
|
54 | 54 | case 'access-control': |
55 | 55 | $settings = array( |
56 | 56 | // Section 3: Access control. |
@@ -60,20 +60,20 @@ discard block |
||
60 | 60 | ), |
61 | 61 | array( |
62 | 62 | 'id' => 'session_lifetime', |
63 | - 'name' => __( 'Session Lifetime', 'give' ), |
|
64 | - 'desc' => __( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ), |
|
63 | + 'name' => __('Session Lifetime', 'give'), |
|
64 | + 'desc' => __('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'), |
|
65 | 65 | 'type' => 'select', |
66 | 66 | 'options' => array( |
67 | - '86400' => __( '24 Hours', 'give' ), |
|
68 | - '172800' => __( '48 Hours', 'give' ), |
|
69 | - '259200' => __( '72 Hours', 'give' ), |
|
70 | - '604800' => __( '1 Week', 'give' ), |
|
67 | + '86400' => __('24 Hours', 'give'), |
|
68 | + '172800' => __('48 Hours', 'give'), |
|
69 | + '259200' => __('72 Hours', 'give'), |
|
70 | + '604800' => __('1 Week', 'give'), |
|
71 | 71 | ), |
72 | 72 | ), |
73 | 73 | array( |
74 | 74 | 'id' => 'limit_display_donations', |
75 | - 'name' => __( 'Limit Donations Displayed', 'give' ), |
|
76 | - 'desc' => __( 'Adjusts the number of donations displayed to a non logged-in user when they attempt to access the Donation History page without an active session. For security reasons, it\'s best to leave this at 1-3 donations.', 'give' ), |
|
75 | + 'name' => __('Limit Donations Displayed', 'give'), |
|
76 | + 'desc' => __('Adjusts the number of donations displayed to a non logged-in user when they attempt to access the Donation History page without an active session. For security reasons, it\'s best to leave this at 1-3 donations.', 'give'), |
|
77 | 77 | 'default' => '1', |
78 | 78 | 'type' => 'number', |
79 | 79 | 'css' => 'width:50px;', |
@@ -83,47 +83,47 @@ discard block |
||
83 | 83 | ), |
84 | 84 | ), |
85 | 85 | array( |
86 | - 'name' => __( 'Email Access', 'give' ), |
|
87 | - 'desc' => __( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ), |
|
86 | + 'name' => __('Email Access', 'give'), |
|
87 | + 'desc' => __('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'), |
|
88 | 88 | 'id' => 'email_access', |
89 | 89 | 'type' => 'radio_inline', |
90 | 90 | 'default' => 'disabled', |
91 | 91 | 'options' => array( |
92 | - 'enabled' => __( 'Enabled', 'give' ), |
|
93 | - 'disabled' => __( 'Disabled', 'give' ), |
|
92 | + 'enabled' => __('Enabled', 'give'), |
|
93 | + 'disabled' => __('Disabled', 'give'), |
|
94 | 94 | ), |
95 | 95 | ), |
96 | 96 | array( |
97 | - 'name' => __( 'Enable reCAPTCHA', 'give' ), |
|
98 | - 'desc' => __( 'Would you like to enable the reCAPTCHA feature?', 'give' ), |
|
97 | + 'name' => __('Enable reCAPTCHA', 'give'), |
|
98 | + 'desc' => __('Would you like to enable the reCAPTCHA feature?', 'give'), |
|
99 | 99 | 'id' => 'enable_recaptcha', |
100 | 100 | 'type' => 'radio_inline', |
101 | 101 | 'default' => 'disabled', |
102 | 102 | 'options' => array( |
103 | - 'enabled' => __( 'Enabled', 'give' ), |
|
104 | - 'disabled' => __( 'Disabled', 'give' ), |
|
103 | + 'enabled' => __('Enabled', 'give'), |
|
104 | + 'disabled' => __('Disabled', 'give'), |
|
105 | 105 | ), |
106 | 106 | ), |
107 | 107 | array( |
108 | 108 | 'id' => 'recaptcha_key', |
109 | - 'name' => __( 'reCAPTCHA Site Key', 'give' ), |
|
109 | + 'name' => __('reCAPTCHA Site Key', 'give'), |
|
110 | 110 | /* translators: %s: https://www.google.com/recaptcha/ */ |
111 | - 'desc' => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key and paste your reCAPTCHA site key here. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'http://docs.givewp.com/recaptcha' ) ), |
|
111 | + 'desc' => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key and paste your reCAPTCHA site key here. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('http://docs.givewp.com/recaptcha')), |
|
112 | 112 | 'default' => '', |
113 | 113 | 'type' => 'text', |
114 | 114 | ), |
115 | 115 | array( |
116 | 116 | 'id' => 'recaptcha_secret', |
117 | - 'name' => __( 'reCAPTCHA Secret Key', 'give' ), |
|
118 | - 'desc' => __( 'Please paste the reCAPTCHA secret key here from your reCAPTCHA API Keys panel.', 'give' ), |
|
117 | + 'name' => __('reCAPTCHA Secret Key', 'give'), |
|
118 | + 'desc' => __('Please paste the reCAPTCHA secret key here from your reCAPTCHA API Keys panel.', 'give'), |
|
119 | 119 | 'default' => '', |
120 | 120 | 'type' => 'text', |
121 | 121 | ), |
122 | 122 | array( |
123 | - 'name' => __( 'Access Control Docs Link', 'give' ), |
|
123 | + 'name' => __('Access Control Docs Link', 'give'), |
|
124 | 124 | 'id' => 'access_control_docs_link', |
125 | - 'url' => esc_url( 'http://docs.givewp.com/settings-access-control' ), |
|
126 | - 'title' => __( 'Access Control', 'give' ), |
|
125 | + 'url' => esc_url('http://docs.givewp.com/settings-access-control'), |
|
126 | + 'title' => __('Access Control', 'give'), |
|
127 | 127 | 'type' => 'give_docs_link', |
128 | 128 | ), |
129 | 129 | array( |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | break; |
135 | 135 | |
136 | 136 | case 'currency-settings' : |
137 | - $currency_position_before = __( 'Before - %s‎10', 'give' ); |
|
138 | - $currency_position_after = __( 'After - 10%s‏', 'give' ); |
|
137 | + $currency_position_before = __('Before - %s‎10', 'give'); |
|
138 | + $currency_position_after = __('After - 10%s‏', 'give'); |
|
139 | 139 | |
140 | 140 | $settings = array( |
141 | 141 | // Section 2: Currency |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | 'id' => 'give_title_general_settings_2', |
145 | 145 | ), |
146 | 146 | array( |
147 | - 'name' => __( 'Currency Settings', 'give' ), |
|
147 | + 'name' => __('Currency Settings', 'give'), |
|
148 | 148 | 'desc' => '', |
149 | 149 | 'type' => 'give_title', |
150 | 150 | 'id' => 'give_title_general_settings_2', |
151 | 151 | ), |
152 | 152 | array( |
153 | - 'name' => __( 'Currency', 'give' ), |
|
154 | - 'desc' => __( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ), |
|
153 | + 'name' => __('Currency', 'give'), |
|
154 | + 'desc' => __('The donation currency. Note that some payment gateways have currency restrictions.', 'give'), |
|
155 | 155 | 'id' => 'currency', |
156 | 156 | 'class' => 'give-select-chosen', |
157 | 157 | 'type' => 'select', |
@@ -159,51 +159,51 @@ discard block |
||
159 | 159 | 'default' => 'USD', |
160 | 160 | ), |
161 | 161 | array( |
162 | - 'name' => __( 'Currency Position', 'give' ), |
|
163 | - 'desc' => __( 'The position of the currency symbol.', 'give' ), |
|
162 | + 'name' => __('Currency Position', 'give'), |
|
163 | + 'desc' => __('The position of the currency symbol.', 'give'), |
|
164 | 164 | 'id' => 'currency_position', |
165 | 165 | 'type' => 'select', |
166 | 166 | 'options' => array( |
167 | 167 | /* translators: %s: currency symbol */ |
168 | - 'before' => sprintf( $currency_position_before, give_currency_symbol( give_get_currency() ) ), |
|
168 | + 'before' => sprintf($currency_position_before, give_currency_symbol(give_get_currency())), |
|
169 | 169 | /* translators: %s: currency symbol */ |
170 | - 'after' => sprintf( $currency_position_after, give_currency_symbol( give_get_currency() ) ), |
|
170 | + 'after' => sprintf($currency_position_after, give_currency_symbol(give_get_currency())), |
|
171 | 171 | ), |
172 | 172 | 'default' => 'before', |
173 | 173 | 'attributes' => array( |
174 | - 'data-before-template' => sprintf( $currency_position_before, '{currency_pos}' ), |
|
175 | - 'data-after-template' => sprintf( $currency_position_after, '{currency_pos}' ), |
|
174 | + 'data-before-template' => sprintf($currency_position_before, '{currency_pos}'), |
|
175 | + 'data-after-template' => sprintf($currency_position_after, '{currency_pos}'), |
|
176 | 176 | ), |
177 | 177 | ), |
178 | 178 | array( |
179 | - 'name' => __( 'Thousands Separator', 'give' ), |
|
180 | - 'desc' => __( 'The symbol (typically , or .) to separate thousands.', 'give' ), |
|
179 | + 'name' => __('Thousands Separator', 'give'), |
|
180 | + 'desc' => __('The symbol (typically , or .) to separate thousands.', 'give'), |
|
181 | 181 | 'id' => 'thousands_separator', |
182 | 182 | 'type' => 'text', |
183 | 183 | 'default' => ',', |
184 | 184 | 'css' => 'width:12em;', |
185 | 185 | ), |
186 | 186 | array( |
187 | - 'name' => __( 'Decimal Separator', 'give' ), |
|
188 | - 'desc' => __( 'The symbol (usually , or .) to separate decimal points.', 'give' ), |
|
187 | + 'name' => __('Decimal Separator', 'give'), |
|
188 | + 'desc' => __('The symbol (usually , or .) to separate decimal points.', 'give'), |
|
189 | 189 | 'id' => 'decimal_separator', |
190 | 190 | 'type' => 'text', |
191 | 191 | 'default' => '.', |
192 | 192 | 'css' => 'width:12em;', |
193 | 193 | ), |
194 | 194 | array( |
195 | - 'name' => __( 'Number of Decimals', 'give' ), |
|
196 | - 'desc' => __( 'The number of decimal points displayed in amounts.', 'give' ), |
|
195 | + 'name' => __('Number of Decimals', 'give'), |
|
196 | + 'desc' => __('The number of decimal points displayed in amounts.', 'give'), |
|
197 | 197 | 'id' => 'number_decimals', |
198 | 198 | 'type' => 'text', |
199 | 199 | 'default' => 2, |
200 | 200 | 'css' => 'width:12em;', |
201 | 201 | ), |
202 | 202 | array( |
203 | - 'name' => __( 'Currency Options Docs Link', 'give' ), |
|
203 | + 'name' => __('Currency Options Docs Link', 'give'), |
|
204 | 204 | 'id' => 'currency_settings_docs_link', |
205 | - 'url' => esc_url( 'http://docs.givewp.com/settings-currency' ), |
|
206 | - 'title' => __( 'Currency Settings', 'give' ), |
|
205 | + 'url' => esc_url('http://docs.givewp.com/settings-currency'), |
|
206 | + 'title' => __('Currency Settings', 'give'), |
|
207 | 207 | 'type' => 'give_docs_link', |
208 | 208 | ), |
209 | 209 | array( |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $country = give_get_country(); |
220 | 220 | |
221 | 221 | // get the list of the states of which default country is selected. |
222 | - $states = give_get_states( $country ); |
|
222 | + $states = give_get_states($country); |
|
223 | 223 | |
224 | 224 | // Get the country list that does not have any states init. |
225 | 225 | $no_states_country = give_no_states_country_list(); |
@@ -231,58 +231,58 @@ discard block |
||
231 | 231 | 'id' => 'give_title_general_settings_1', |
232 | 232 | ), |
233 | 233 | array( |
234 | - 'name' => __( 'General Settings', 'give' ), |
|
234 | + 'name' => __('General Settings', 'give'), |
|
235 | 235 | 'desc' => '', |
236 | 236 | 'type' => 'give_title', |
237 | 237 | 'id' => 'give_title_general_settings_1', |
238 | 238 | ), |
239 | 239 | array( |
240 | - 'name' => __( 'Success Page', 'give' ), |
|
240 | + 'name' => __('Success Page', 'give'), |
|
241 | 241 | /* translators: %s: [give_receipt] */ |
242 | - 'desc' => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ), |
|
242 | + 'desc' => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'), |
|
243 | 243 | 'id' => 'success_page', |
244 | 244 | 'class' => 'give-select give-select-chosen', |
245 | 245 | 'type' => 'select', |
246 | - 'options' => give_cmb2_get_post_options( array( |
|
246 | + 'options' => give_cmb2_get_post_options(array( |
|
247 | 247 | 'post_type' => 'page', |
248 | 248 | 'numberposts' => 30, |
249 | - ) ), |
|
249 | + )), |
|
250 | 250 | 'attributes' => array( |
251 | 251 | 'data-search-type' => 'pages' |
252 | 252 | ) |
253 | 253 | ), |
254 | 254 | array( |
255 | - 'name' => __( 'Failed Donation Page', 'give' ), |
|
256 | - 'desc' => __( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ), |
|
255 | + 'name' => __('Failed Donation Page', 'give'), |
|
256 | + 'desc' => __('The page donors are sent to if their donation is cancelled or fails.', 'give'), |
|
257 | 257 | 'class' => 'give-select give-select-chosen', |
258 | 258 | 'id' => 'failure_page', |
259 | 259 | 'type' => 'select', |
260 | - 'options' => give_cmb2_get_post_options( array( |
|
260 | + 'options' => give_cmb2_get_post_options(array( |
|
261 | 261 | 'post_type' => 'page', |
262 | 262 | 'numberposts' => 30, |
263 | - ) ), |
|
263 | + )), |
|
264 | 264 | 'attributes' => array( |
265 | 265 | 'data-search-type' => 'pages' |
266 | 266 | ) |
267 | 267 | ), |
268 | 268 | array( |
269 | - 'name' => __( 'Donation History Page', 'give' ), |
|
269 | + 'name' => __('Donation History Page', 'give'), |
|
270 | 270 | /* translators: %s: [donation_history] */ |
271 | - 'desc' => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ), |
|
271 | + 'desc' => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'), |
|
272 | 272 | 'id' => 'history_page', |
273 | 273 | 'class' => 'give-select give-select-chosen', |
274 | 274 | 'type' => 'select', |
275 | - 'options' => give_cmb2_get_post_options( array( |
|
275 | + 'options' => give_cmb2_get_post_options(array( |
|
276 | 276 | 'post_type' => 'page', |
277 | 277 | 'numberposts' => 30, |
278 | - ) ), |
|
278 | + )), |
|
279 | 279 | 'attributes' => array( |
280 | 280 | 'data-search-type' => 'pages' |
281 | 281 | ) |
282 | 282 | ), |
283 | 283 | array( |
284 | - 'name' => __( 'Base Country', 'give' ), |
|
285 | - 'desc' => __( 'The country your site operates from.', 'give' ), |
|
284 | + 'name' => __('Base Country', 'give'), |
|
285 | + 'desc' => __('The country your site operates from.', 'give'), |
|
286 | 286 | 'id' => 'base_country', |
287 | 287 | 'type' => 'select', |
288 | 288 | 'options' => give_get_country_list(), |
@@ -293,18 +293,18 @@ discard block |
||
293 | 293 | * @since 1.8.14 |
294 | 294 | */ |
295 | 295 | array( |
296 | - 'wrapper_class' => ( array_key_exists( $country, $no_states_country ) ? 'give-hidden' : '' ), |
|
297 | - 'name' => __( 'Base State/Province', 'give' ), |
|
298 | - 'desc' => __( 'The state/province your site operates from.', 'give' ), |
|
296 | + 'wrapper_class' => (array_key_exists($country, $no_states_country) ? 'give-hidden' : ''), |
|
297 | + 'name' => __('Base State/Province', 'give'), |
|
298 | + 'desc' => __('The state/province your site operates from.', 'give'), |
|
299 | 299 | 'id' => 'base_state', |
300 | - 'type' => ( empty( $states ) ? 'text' : 'select' ), |
|
300 | + 'type' => (empty($states) ? 'text' : 'select'), |
|
301 | 301 | 'options' => $states, |
302 | 302 | ), |
303 | 303 | array( |
304 | - 'name' => __( 'General Options Docs Link', 'give' ), |
|
304 | + 'name' => __('General Options Docs Link', 'give'), |
|
305 | 305 | 'id' => 'general_options_docs_link', |
306 | - 'url' => esc_url( 'http://docs.givewp.com/settings-general' ), |
|
307 | - 'title' => __( 'General Options', 'give' ), |
|
306 | + 'url' => esc_url('http://docs.givewp.com/settings-general'), |
|
307 | + 'title' => __('General Options', 'give'), |
|
308 | 308 | 'type' => 'give_docs_link', |
309 | 309 | ), |
310 | 310 | array( |
@@ -324,48 +324,48 @@ discard block |
||
324 | 324 | 'type' => 'title' |
325 | 325 | ), |
326 | 326 | array( |
327 | - 'name' => __( 'Sequential Ordering', 'give' ), |
|
327 | + 'name' => __('Sequential Ordering', 'give'), |
|
328 | 328 | 'id' => "{$current_section}_status", |
329 | - 'desc' => __( 'Custom donation numbering that increases sequentially to prevent gaps between donation IDs. If disabled, then donation numbers are generated from WordPress post IDs, which will result in gaps between numbers.', 'give' ), |
|
329 | + 'desc' => __('Custom donation numbering that increases sequentially to prevent gaps between donation IDs. If disabled, then donation numbers are generated from WordPress post IDs, which will result in gaps between numbers.', 'give'), |
|
330 | 330 | 'type' => 'radio_inline', |
331 | 331 | 'default' => 'disabled', |
332 | 332 | 'options' => array( |
333 | - 'enabled' => __( 'Enabled', 'give' ), |
|
334 | - 'disabled' => __( 'Disabled', 'give' ) |
|
333 | + 'enabled' => __('Enabled', 'give'), |
|
334 | + 'disabled' => __('Disabled', 'give') |
|
335 | 335 | ) |
336 | 336 | ), |
337 | 337 | array( |
338 | - 'name' => __( 'Next Donation Number', 'give' ), |
|
338 | + 'name' => __('Next Donation Number', 'give'), |
|
339 | 339 | 'id' => "{$current_section}_number", |
340 | 340 | 'desc' => sprintf( |
341 | - __( 'The number used to generate the next donation ID. This value must be greater than or equal to %s to avoid conflicts with existing donation IDs.', 'give' ), |
|
342 | - '<code>' . Give()->seq_donation_number->get_next_number() . '</code>' |
|
341 | + __('The number used to generate the next donation ID. This value must be greater than or equal to %s to avoid conflicts with existing donation IDs.', 'give'), |
|
342 | + '<code>'.Give()->seq_donation_number->get_next_number().'</code>' |
|
343 | 343 | ), |
344 | 344 | 'type' => 'number', |
345 | 345 | ), |
346 | 346 | array( |
347 | - 'name' => __( 'Number Prefix', 'give' ), |
|
347 | + 'name' => __('Number Prefix', 'give'), |
|
348 | 348 | 'id' => "{$current_section}_number_prefix", |
349 | 349 | 'desc' => sprintf( |
350 | - __( 'The prefix appended to all sequential donation numbers. Spaces are replaced by %s.', 'give' ), |
|
350 | + __('The prefix appended to all sequential donation numbers. Spaces are replaced by %s.', 'give'), |
|
351 | 351 | '<code>-</code>' |
352 | 352 | ), |
353 | 353 | 'type' => 'text', |
354 | 354 | ), |
355 | 355 | array( |
356 | - 'name' => __( 'Number Suffix', 'give' ), |
|
356 | + 'name' => __('Number Suffix', 'give'), |
|
357 | 357 | 'id' => "{$current_section}_number_suffix", |
358 | 358 | 'desc' => sprintf( |
359 | - __( 'The suffix appended to all sequential donation numbers. Spaces are replaced by %s.', 'give' ), |
|
359 | + __('The suffix appended to all sequential donation numbers. Spaces are replaced by %s.', 'give'), |
|
360 | 360 | '<code>-</code>' |
361 | 361 | ), |
362 | 362 | 'type' => 'text', |
363 | 363 | ), |
364 | 364 | array( |
365 | - 'name' => __( 'Number Padding', 'give' ), |
|
365 | + 'name' => __('Number Padding', 'give'), |
|
366 | 366 | 'id' => "{$current_section}_number_padding", |
367 | 367 | 'desc' => sprintf( |
368 | - __( 'The minimum number of digits in the sequential donation number. Enter %s to display %s as %s.', 'give' ), |
|
368 | + __('The minimum number of digits in the sequential donation number. Enter %s to display %s as %s.', 'give'), |
|
369 | 369 | '<code>4</code>', |
370 | 370 | '<code>1</code>', |
371 | 371 | '<code>0001</code>' |
@@ -374,16 +374,16 @@ discard block |
||
374 | 374 | 'default' => '0', |
375 | 375 | ), |
376 | 376 | array( |
377 | - 'name' => __( 'Donation ID Preview', 'give' ), |
|
377 | + 'name' => __('Donation ID Preview', 'give'), |
|
378 | 378 | 'id' => "{$current_section}_preview", |
379 | 379 | 'type' => 'give_sequential_donation_code_preview', |
380 | - 'desc' => __( 'A preview of the next sequential donation ID. This preview cannot be edited directly as it is generated from the settings above.', 'give' ), |
|
380 | + 'desc' => __('A preview of the next sequential donation ID. This preview cannot be edited directly as it is generated from the settings above.', 'give'), |
|
381 | 381 | ), |
382 | 382 | array( |
383 | - 'name' => __( 'Sequential Ordering Docs Link', 'give' ), |
|
383 | + 'name' => __('Sequential Ordering Docs Link', 'give'), |
|
384 | 384 | 'id' => "{$current_section}_doc link", |
385 | - 'url' => esc_url( 'http://docs.givewp.com/settings-sequential-ordering' ), |
|
386 | - 'title' => __( 'Sequential Ordering', 'give' ), |
|
385 | + 'url' => esc_url('http://docs.givewp.com/settings-sequential-ordering'), |
|
386 | + 'title' => __('Sequential Ordering', 'give'), |
|
387 | 387 | 'type' => 'give_docs_link', |
388 | 388 | ), |
389 | 389 | array( |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | * Filter the general settings. |
398 | 398 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
399 | 399 | */ |
400 | - $settings = apply_filters( 'give_settings_general', $settings ); |
|
400 | + $settings = apply_filters('give_settings_general', $settings); |
|
401 | 401 | |
402 | 402 | /** |
403 | 403 | * Filter the settings. |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | * |
407 | 407 | * @param array $settings |
408 | 408 | */ |
409 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
409 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
410 | 410 | |
411 | 411 | // Output. |
412 | 412 | return $settings; |
@@ -420,13 +420,13 @@ discard block |
||
420 | 420 | */ |
421 | 421 | public function get_sections() { |
422 | 422 | $sections = array( |
423 | - 'general-settings' => __( 'General', 'give' ), |
|
424 | - 'currency-settings' => __( 'Currency', 'give' ), |
|
425 | - 'access-control' => __( 'Access Control', 'give' ), |
|
426 | - 'sequential-ordering' => __( 'Sequential Ordering', 'give' ), |
|
423 | + 'general-settings' => __('General', 'give'), |
|
424 | + 'currency-settings' => __('Currency', 'give'), |
|
425 | + 'access-control' => __('Access Control', 'give'), |
|
426 | + 'sequential-ordering' => __('Sequential Ordering', 'give'), |
|
427 | 427 | ); |
428 | 428 | |
429 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
429 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | |
@@ -442,23 +442,23 @@ discard block |
||
442 | 442 | * |
443 | 443 | * @return bool |
444 | 444 | */ |
445 | - public function __give_change_donation_stating_number( $update_options, $option_name, $old_options ) { |
|
446 | - if ( ! isset( $_POST['sequential-ordering_number'] ) ) { |
|
445 | + public function __give_change_donation_stating_number($update_options, $option_name, $old_options) { |
|
446 | + if ( ! isset($_POST['sequential-ordering_number'])) { |
|
447 | 447 | return false; |
448 | 448 | } |
449 | 449 | |
450 | - if ( ( $next_number = Give()->seq_donation_number->get_next_number() ) > $update_options['sequential-ordering_number'] ) { |
|
451 | - give_update_option( 'sequential-ordering_number', $next_number ); |
|
450 | + if (($next_number = Give()->seq_donation_number->get_next_number()) > $update_options['sequential-ordering_number']) { |
|
451 | + give_update_option('sequential-ordering_number', $next_number); |
|
452 | 452 | |
453 | 453 | Give_Admin_Settings::add_error( |
454 | 454 | 'give-invalid-sequential-starting-number', |
455 | 455 | sprintf( |
456 | - __( 'Next Donation Number must be equal to or larger than %s to avoid conflicts with existing donation IDs.', 'give' ), |
|
456 | + __('Next Donation Number must be equal to or larger than %s to avoid conflicts with existing donation IDs.', 'give'), |
|
457 | 457 | $next_number |
458 | 458 | ) |
459 | 459 | ); |
460 | - } elseif ( $update_options['sequential-ordering_number'] !== $old_options['sequential-ordering_number'] ) { |
|
461 | - update_option( '_give_reset_sequential_number', 1 ); |
|
460 | + } elseif ($update_options['sequential-ordering_number'] !== $old_options['sequential-ordering_number']) { |
|
461 | + update_option('_give_reset_sequential_number', 1); |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | return true; |
@@ -473,16 +473,16 @@ discard block |
||
473 | 473 | * |
474 | 474 | * @param $field |
475 | 475 | */ |
476 | - public function __render_give_sequential_donation_code_preview( $field ) { |
|
476 | + public function __render_give_sequential_donation_code_preview($field) { |
|
477 | 477 | ?> |
478 | - <tr valign="top" <?php echo ! empty( $field['wrapper_class'] ) ? 'class="' . $field['wrapper_class'] . '"' : '' ?>> |
|
478 | + <tr valign="top" <?php echo ! empty($field['wrapper_class']) ? 'class="'.$field['wrapper_class'].'"' : '' ?>> |
|
479 | 479 | <th scope="row" class="titledesc"> |
480 | 480 | <label |
481 | - for="<?php echo esc_attr( $field['id'] ); ?>"><?php echo esc_html( $field['name'] ) ?></label> |
|
481 | + for="<?php echo esc_attr($field['id']); ?>"><?php echo esc_html($field['name']) ?></label> |
|
482 | 482 | </th> |
483 | 483 | <td class="give-forminp"> |
484 | - <input id="<?php echo esc_attr( $field['id'] ); ?>" class="give-input-field" type="text" disabled> |
|
485 | - <?php echo Give_Admin_Settings::get_field_description( $field ); ?> |
|
484 | + <input id="<?php echo esc_attr($field['id']); ?>" class="give-input-field" type="text" disabled> |
|
485 | + <?php echo Give_Admin_Settings::get_field_description($field); ?> |
|
486 | 486 | </td> |
487 | 487 | </tr> |
488 | 488 | <?php |
@@ -497,16 +497,16 @@ discard block |
||
497 | 497 | * |
498 | 498 | * @param $field |
499 | 499 | */ |
500 | - public function __render_give_unlock_all_settings( $field ) { |
|
500 | + public function __render_give_unlock_all_settings($field) { |
|
501 | 501 | ?> |
502 | - <tr valign="top" <?php echo ! empty( $field['wrapper_class'] ) ? 'class="' . $field['wrapper_class'] . '"' : '' ?>> |
|
502 | + <tr valign="top" <?php echo ! empty($field['wrapper_class']) ? 'class="'.$field['wrapper_class'].'"' : '' ?>> |
|
503 | 503 | <th scope="row" class="titledesc"> |
504 | 504 | <label |
505 | - for="<?php echo esc_attr( $field['id'] ); ?>"><?php echo esc_html( $field['name'] ) ?></label> |
|
505 | + for="<?php echo esc_attr($field['id']); ?>"><?php echo esc_html($field['name']) ?></label> |
|
506 | 506 | </th> |
507 | 507 | <td class="give-forminp"> |
508 | - <?php echo Give_Admin_Settings::get_field_description( $field ); ?> |
|
509 | - <a href="" id="<?php echo $field['id']; ?>" data-message="<?php echo $field['confirmation_msg'] ?>"><?php echo __( 'Unlock all settings', 'give' ); ?></a> |
|
508 | + <?php echo Give_Admin_Settings::get_field_description($field); ?> |
|
509 | + <a href="" id="<?php echo $field['id']; ?>" data-message="<?php echo $field['confirmation_msg'] ?>"><?php echo __('Unlock all settings', 'give'); ?></a> |
|
510 | 510 | </td> |
511 | 511 | </tr> |
512 | 512 | <?php |
@@ -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_Display' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Display')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Display. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'display'; |
30 | - $this->label = __( 'Display Options', 'give' ); |
|
30 | + $this->label = __('Display Options', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'display-settings'; |
33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $settings = array(); |
45 | 45 | $current_section = give_get_current_setting_section(); |
46 | 46 | |
47 | - switch ( $current_section ) { |
|
47 | + switch ($current_section) { |
|
48 | 48 | case 'display-settings' : |
49 | 49 | $settings = array( |
50 | 50 | // Section 1: Display |
@@ -53,67 +53,67 @@ discard block |
||
53 | 53 | 'type' => 'title', |
54 | 54 | ), |
55 | 55 | array( |
56 | - 'name' => __( 'Default Give Styles', 'give' ), |
|
57 | - 'desc' => __( 'You can disable Give\'s default styles for donation forms and other frontend elements.', 'give' ), |
|
56 | + 'name' => __('Default Give Styles', 'give'), |
|
57 | + 'desc' => __('You can disable Give\'s default styles for donation forms and other frontend elements.', 'give'), |
|
58 | 58 | 'id' => 'css', |
59 | 59 | 'type' => 'radio_inline', |
60 | 60 | 'default' => 'enabled', |
61 | 61 | 'options' => array( |
62 | - 'enabled' => __( 'Enabled', 'give' ), |
|
63 | - 'disabled' => __( 'Disabled', 'give' ), |
|
62 | + 'enabled' => __('Enabled', 'give'), |
|
63 | + 'disabled' => __('Disabled', 'give'), |
|
64 | 64 | ), |
65 | 65 | ), |
66 | 66 | array( |
67 | - 'name' => __( 'Floating Labels', 'give' ), |
|
67 | + 'name' => __('Floating Labels', 'give'), |
|
68 | 68 | /* translators: %s: http://docs.givewp.com/form-floating-labels */ |
69 | - 'desc' => sprintf( wp_kses( __( '<a href="%s" target="_blank">Floating labels</a> allows your labels to be inset within the form fields to provide a cleaner form appearance. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array( |
|
69 | + 'desc' => sprintf(wp_kses(__('<a href="%s" target="_blank">Floating labels</a> allows your labels to be inset within the form fields to provide a cleaner form appearance. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array( |
|
70 | 70 | 'a' => array( |
71 | 71 | 'href' => array(), |
72 | 72 | 'target' => array(), |
73 | 73 | ), |
74 | - ) ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
74 | + )), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
75 | 75 | 'id' => 'floatlabels', |
76 | 76 | 'type' => 'radio_inline', |
77 | 77 | 'default' => 'disabled', |
78 | 78 | 'options' => array( |
79 | - 'enabled' => __( 'Enabled', 'give' ), |
|
80 | - 'disabled' => __( 'Disabled', 'give' ), |
|
79 | + 'enabled' => __('Enabled', 'give'), |
|
80 | + 'disabled' => __('Disabled', 'give'), |
|
81 | 81 | ), |
82 | 82 | ), |
83 | 83 | array( |
84 | - 'name' => __( 'Welcome Screen', 'give' ), |
|
84 | + 'name' => __('Welcome Screen', 'give'), |
|
85 | 85 | /* translators: %s: about page URL */ |
86 | - 'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> that displays each time Give is activated or updated.', 'give' ), array( |
|
86 | + 'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> that displays each time Give is activated or updated.', 'give'), array( |
|
87 | 87 | 'a' => array( |
88 | 88 | 'href' => array(), |
89 | 89 | 'target' => array(), |
90 | 90 | ), |
91 | - ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ), |
|
91 | + )), esc_url(admin_url('index.php?page=give-about'))), |
|
92 | 92 | 'id' => 'welcome', |
93 | 93 | 'type' => 'radio_inline', |
94 | 94 | 'default' => 'enabled', |
95 | 95 | 'options' => array( |
96 | - 'enabled' => __( 'Enabled', 'give' ), |
|
97 | - 'disabled' => __( 'Disabled', 'give' ), |
|
96 | + 'enabled' => __('Enabled', 'give'), |
|
97 | + 'disabled' => __('Disabled', 'give'), |
|
98 | 98 | ), |
99 | 99 | ), |
100 | 100 | array( |
101 | - 'name' => __( 'Company Donations', 'give' ), |
|
102 | - 'desc' => __( 'Do you want a Company field to appear after First Name and Last Name?', 'give' ), |
|
101 | + 'name' => __('Company Donations', 'give'), |
|
102 | + 'desc' => __('Do you want a Company field to appear after First Name and Last Name?', 'give'), |
|
103 | 103 | 'id' => 'company_field', |
104 | 104 | 'type' => 'radio_inline', |
105 | 105 | 'default' => 'disabled', |
106 | 106 | 'options' => array( |
107 | - 'disabled' => __( 'Disabled', 'give' ), |
|
108 | - 'required' => __( 'Required', 'give' ), |
|
109 | - 'optional' => __( 'Optional', 'give' ), |
|
107 | + 'disabled' => __('Disabled', 'give'), |
|
108 | + 'required' => __('Required', 'give'), |
|
109 | + 'optional' => __('Optional', 'give'), |
|
110 | 110 | ), |
111 | 111 | ), |
112 | 112 | array( |
113 | - 'name' => __( 'Display Settings Docs Link', 'give' ), |
|
113 | + 'name' => __('Display Settings Docs Link', 'give'), |
|
114 | 114 | 'id' => 'display_settings_docs_link', |
115 | - 'url' => esc_url( 'http://docs.givewp.com/form-display-options' ), |
|
116 | - 'title' => __( 'Display Options Settings', 'give' ), |
|
115 | + 'url' => esc_url('http://docs.givewp.com/form-display-options'), |
|
116 | + 'title' => __('Display Options Settings', 'give'), |
|
117 | 117 | 'type' => 'give_docs_link', |
118 | 118 | ), |
119 | 119 | array( |
@@ -130,78 +130,78 @@ discard block |
||
130 | 130 | 'type' => 'title', |
131 | 131 | ), |
132 | 132 | array( |
133 | - 'name' => __( 'Form Single Views', 'give' ), |
|
134 | - 'desc' => __( 'By default, all donation form have single views enabled which creates a specific URL on your website for that form. This option disables the singular posts from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ), |
|
133 | + 'name' => __('Form Single Views', 'give'), |
|
134 | + 'desc' => __('By default, all donation form have single views enabled which creates a specific URL on your website for that form. This option disables the singular posts from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'), |
|
135 | 135 | 'id' => 'forms_singular', |
136 | 136 | 'type' => 'radio_inline', |
137 | 137 | 'default' => 'enabled', |
138 | 138 | 'options' => array( |
139 | - 'enabled' => __( 'Enabled', 'give' ), |
|
140 | - 'disabled' => __( 'Disabled', 'give' ), |
|
139 | + 'enabled' => __('Enabled', 'give'), |
|
140 | + 'disabled' => __('Disabled', 'give'), |
|
141 | 141 | ), |
142 | 142 | ), |
143 | 143 | array( |
144 | - 'name' => __( 'Form Archives', 'give' ), |
|
145 | - 'desc' => sprintf( wp_kses( __( 'Archives pages list all the donation forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to <a href="%s">refresh your permalinks</a> after this option has been enabled.', 'give' ), array( |
|
144 | + 'name' => __('Form Archives', 'give'), |
|
145 | + 'desc' => sprintf(wp_kses(__('Archives pages list all the donation forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to <a href="%s">refresh your permalinks</a> after this option has been enabled.', 'give'), array( |
|
146 | 146 | 'a' => array( |
147 | 147 | 'href' => array(), |
148 | 148 | 'target' => array(), |
149 | 149 | ), |
150 | - ) ), esc_url( admin_url( 'options-permalink.php' ) ) ), |
|
150 | + )), esc_url(admin_url('options-permalink.php'))), |
|
151 | 151 | 'id' => 'forms_archives', |
152 | 152 | 'type' => 'radio_inline', |
153 | 153 | 'default' => 'enabled', |
154 | 154 | 'options' => array( |
155 | - 'enabled' => __( 'Enabled', 'give' ), |
|
156 | - 'disabled' => __( 'Disabled', 'give' ), |
|
155 | + 'enabled' => __('Enabled', 'give'), |
|
156 | + 'disabled' => __('Disabled', 'give'), |
|
157 | 157 | ), |
158 | 158 | ), |
159 | 159 | array( |
160 | - 'name' => __( 'Form Excerpts', 'give' ), |
|
161 | - 'desc' => __( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ), |
|
160 | + 'name' => __('Form Excerpts', 'give'), |
|
161 | + 'desc' => __('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'), |
|
162 | 162 | 'id' => 'forms_excerpt', |
163 | 163 | 'type' => 'radio_inline', |
164 | 164 | 'default' => 'enabled', |
165 | 165 | 'options' => array( |
166 | - 'enabled' => __( 'Enabled', 'give' ), |
|
167 | - 'disabled' => __( 'Disabled', 'give' ), |
|
166 | + 'enabled' => __('Enabled', 'give'), |
|
167 | + 'disabled' => __('Disabled', 'give'), |
|
168 | 168 | ), |
169 | 169 | ), |
170 | 170 | array( |
171 | - 'name' => __( 'Form Featured Image', 'give' ), |
|
172 | - 'desc' => __( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ), |
|
171 | + 'name' => __('Form Featured Image', 'give'), |
|
172 | + 'desc' => __('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'), |
|
173 | 173 | 'id' => 'form_featured_img', |
174 | 174 | 'type' => 'radio_inline', |
175 | 175 | 'default' => 'enabled', |
176 | 176 | 'options' => array( |
177 | - 'enabled' => __( 'Enabled', 'give' ), |
|
178 | - 'disabled' => __( 'Disabled', 'give' ), |
|
177 | + 'enabled' => __('Enabled', 'give'), |
|
178 | + 'disabled' => __('Disabled', 'give'), |
|
179 | 179 | ), |
180 | 180 | ), |
181 | 181 | array( |
182 | - 'name' => __( 'Featured Image Size', 'give' ), |
|
183 | - 'desc' => __( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give' ), |
|
182 | + 'name' => __('Featured Image Size', 'give'), |
|
183 | + 'desc' => __('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give'), |
|
184 | 184 | 'id' => 'featured_image_size', |
185 | 185 | 'type' => 'select', |
186 | 186 | 'default' => 'large', |
187 | 187 | 'options' => give_get_featured_image_sizes(), |
188 | 188 | ), |
189 | 189 | array( |
190 | - 'name' => __( 'Single Form Sidebar', 'give' ), |
|
191 | - 'desc' => __( 'The sidebar allows you to add additional widgets to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ), |
|
190 | + 'name' => __('Single Form Sidebar', 'give'), |
|
191 | + 'desc' => __('The sidebar allows you to add additional widgets to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'), |
|
192 | 192 | 'id' => 'form_sidebar', |
193 | 193 | 'type' => 'radio_inline', |
194 | 194 | 'default' => 'enabled', |
195 | 195 | 'options' => array( |
196 | - 'enabled' => __( 'Enabled', 'give' ), |
|
197 | - 'disabled' => __( 'Disabled', 'give' ), |
|
196 | + 'enabled' => __('Enabled', 'give'), |
|
197 | + 'disabled' => __('Disabled', 'give'), |
|
198 | 198 | ), |
199 | 199 | ), |
200 | 200 | array( |
201 | - 'name' => __( 'Post Types Docs Link', 'give' ), |
|
201 | + 'name' => __('Post Types Docs Link', 'give'), |
|
202 | 202 | 'id' => 'post_types_settings_docs_link', |
203 | - 'url' => esc_url( 'http://docs.givewp.com/settings-post-types' ), |
|
204 | - 'title' => __( 'Post Types Settings', 'give' ), |
|
203 | + 'url' => esc_url('http://docs.givewp.com/settings-post-types'), |
|
204 | + 'title' => __('Post Types Settings', 'give'), |
|
205 | 205 | 'type' => 'give_docs_link', |
206 | 206 | ), |
207 | 207 | array( |
@@ -218,32 +218,32 @@ discard block |
||
218 | 218 | 'type' => 'title', |
219 | 219 | ), |
220 | 220 | array( |
221 | - 'name' => __( 'Form Categories', 'give' ), |
|
222 | - 'desc' => __( 'Enable Categories for all Give forms.', 'give' ), |
|
221 | + 'name' => __('Form Categories', 'give'), |
|
222 | + 'desc' => __('Enable Categories for all Give forms.', 'give'), |
|
223 | 223 | 'id' => 'categories', |
224 | 224 | 'type' => 'radio_inline', |
225 | 225 | 'default' => 'disabled', |
226 | 226 | 'options' => array( |
227 | - 'enabled' => __( 'Enabled', 'give' ), |
|
228 | - 'disabled' => __( 'Disabled', 'give' ), |
|
227 | + 'enabled' => __('Enabled', 'give'), |
|
228 | + 'disabled' => __('Disabled', 'give'), |
|
229 | 229 | ), |
230 | 230 | ), |
231 | 231 | array( |
232 | - 'name' => __( 'Form Tags', 'give' ), |
|
233 | - 'desc' => __( 'Enable Tags for all Give forms.', 'give' ), |
|
232 | + 'name' => __('Form Tags', 'give'), |
|
233 | + 'desc' => __('Enable Tags for all Give forms.', 'give'), |
|
234 | 234 | 'id' => 'tags', |
235 | 235 | 'type' => 'radio_inline', |
236 | 236 | 'default' => 'disabled', |
237 | 237 | 'options' => array( |
238 | - 'enabled' => __( 'Enabled', 'give' ), |
|
239 | - 'disabled' => __( 'Disabled', 'give' ), |
|
238 | + 'enabled' => __('Enabled', 'give'), |
|
239 | + 'disabled' => __('Disabled', 'give'), |
|
240 | 240 | ), |
241 | 241 | ), |
242 | 242 | array( |
243 | - 'name' => __( 'Taxonomies Docs Link', 'give' ), |
|
243 | + 'name' => __('Taxonomies Docs Link', 'give'), |
|
244 | 244 | 'id' => 'taxonomies_settings_docs_link', |
245 | - 'url' => esc_url( 'http://docs.givewp.com/settings-taxonomies' ), |
|
246 | - 'title' => __( 'Taxonomies Settings', 'give' ), |
|
245 | + 'url' => esc_url('http://docs.givewp.com/settings-taxonomies'), |
|
246 | + 'title' => __('Taxonomies Settings', 'give'), |
|
247 | 247 | 'type' => 'give_docs_link', |
248 | 248 | ), |
249 | 249 | array( |
@@ -260,36 +260,36 @@ discard block |
||
260 | 260 | 'type' => 'title', |
261 | 261 | ), |
262 | 262 | array( |
263 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
264 | - 'desc' => __( 'Would you like donors to require that donors agree to your terms when donating? Note: You can enable/disable this option and customize the terms per form as well.', 'give' ), |
|
263 | + 'name' => __('Terms and Conditions', 'give'), |
|
264 | + 'desc' => __('Would you like donors to require that donors agree to your terms when donating? Note: You can enable/disable this option and customize the terms per form as well.', 'give'), |
|
265 | 265 | 'id' => 'terms', |
266 | 266 | 'type' => 'radio_inline', |
267 | 267 | 'default' => 'disabled', |
268 | 268 | 'options' => array( |
269 | - 'enabled' => __( 'Enabled', 'give' ), |
|
270 | - 'disabled' => __( 'Disabled', 'give' ), |
|
269 | + 'enabled' => __('Enabled', 'give'), |
|
270 | + 'disabled' => __('Disabled', 'give'), |
|
271 | 271 | ), |
272 | 272 | ), |
273 | 273 | array( |
274 | - 'name' => __( 'Agree to Terms Label', 'give' ), |
|
275 | - 'desc' => __( 'The label shown next to the agree to terms check box. Customize it here or leave blank to use the default placeholder text. Note: You can customize the label per form.', 'give' ), |
|
274 | + 'name' => __('Agree to Terms Label', 'give'), |
|
275 | + 'desc' => __('The label shown next to the agree to terms check box. Customize it here or leave blank to use the default placeholder text. Note: You can customize the label per form.', 'give'), |
|
276 | 276 | 'id' => 'agree_to_terms_label', |
277 | 277 | 'attributes' => array( |
278 | - 'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ), |
|
278 | + 'placeholder' => esc_attr__('Agree to Terms?', 'give'), |
|
279 | 279 | ), |
280 | 280 | 'type' => 'text', |
281 | 281 | ), |
282 | 282 | array( |
283 | - 'name' => __( 'Agreement Text', 'give' ), |
|
284 | - 'desc' => __( 'This is the actual text which the user will be asked to agree to in order to donate. Note: You can customize the content per form as needed.', 'give' ), |
|
283 | + 'name' => __('Agreement Text', 'give'), |
|
284 | + 'desc' => __('This is the actual text which the user will be asked to agree to in order to donate. Note: You can customize the content per form as needed.', 'give'), |
|
285 | 285 | 'id' => 'agreement_text', |
286 | 286 | 'type' => 'wysiwyg', |
287 | 287 | ), |
288 | 288 | array( |
289 | - 'name' => __( 'Terms and Conditions Docs Link', 'give' ), |
|
289 | + 'name' => __('Terms and Conditions Docs Link', 'give'), |
|
290 | 290 | 'id' => 'terms_settings_docs_link', |
291 | - 'url' => esc_url( 'http://docs.givewp.com/settings-terms' ), |
|
292 | - 'title' => __( 'Terms and Conditions Settings', 'give' ), |
|
291 | + 'url' => esc_url('http://docs.givewp.com/settings-terms'), |
|
292 | + 'title' => __('Terms and Conditions Settings', 'give'), |
|
293 | 293 | 'type' => 'give_docs_link', |
294 | 294 | ), |
295 | 295 | array( |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | * Filter the display options settings. |
305 | 305 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
306 | 306 | */ |
307 | - $settings = apply_filters( 'give_settings_display', $settings ); |
|
307 | + $settings = apply_filters('give_settings_display', $settings); |
|
308 | 308 | |
309 | 309 | /** |
310 | 310 | * Filter the settings. |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | * |
314 | 314 | * @param array $settings |
315 | 315 | */ |
316 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
316 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
317 | 317 | |
318 | 318 | // Output. |
319 | 319 | return $settings; |
@@ -327,13 +327,13 @@ discard block |
||
327 | 327 | */ |
328 | 328 | public function get_sections() { |
329 | 329 | $sections = array( |
330 | - 'display-settings' => __( 'Display', 'give' ), |
|
331 | - 'post-types' => __( 'Post Types', 'give' ), |
|
332 | - 'taxonomies' => __( 'Taxonomies', 'give' ), |
|
333 | - 'term-and-conditions' => __( 'Terms and Conditions', 'give' ), |
|
330 | + 'display-settings' => __('Display', 'give'), |
|
331 | + 'post-types' => __('Post Types', 'give'), |
|
332 | + 'taxonomies' => __('Taxonomies', 'give'), |
|
333 | + 'term-and-conditions' => __('Terms and Conditions', 'give'), |
|
334 | 334 | ); |
335 | 335 | |
336 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
336 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
337 | 337 | } |
338 | 338 | } |
339 | 339 |
@@ -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(); |
@@ -173,13 +173,13 @@ discard block |
||
173 | 173 | * @return void |
174 | 174 | */ |
175 | 175 | public function output() { |
176 | - if ( $this->enable_save ) { |
|
177 | - $GLOBALS['give_hide_save_button'] = apply_filters( 'give_hide_save_button_on_email_admin_setting_page', false ); |
|
176 | + if ($this->enable_save) { |
|
177 | + $GLOBALS['give_hide_save_button'] = apply_filters('give_hide_save_button_on_email_admin_setting_page', false); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | $settings = $this->get_settings(); |
181 | 181 | |
182 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
182 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
183 | 183 | } |
184 | 184 | } |
185 | 185 |
@@ -618,8 +618,11 @@ |
||
618 | 618 | <a href="<?php echo esc_url( add_query_arg( array( 'give-restart-db-upgrades' => 1 ), admin_url( 'edit.php?post_type=give_forms&page=give-updates' ) ) ); ?>" class="button button-primary give-restart-updater-btn"> |
619 | 619 | <?php _e( 'Restart the updater', 'give' ); ?> |
620 | 620 | </a> |
621 | - <?php else: ?> |
|
622 | - <strong><?php _e( 'Database Update', 'give' ); ?></strong> |
|
621 | + <?php else { |
|
622 | + : ?> |
|
623 | + <strong><?php _e( 'Database Update', 'give' ); |
|
624 | +} |
|
625 | +?></strong> |
|
623 | 626 | – <?php _e( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' ); ?> |
624 | 627 | <?php |
625 | 628 | endif; |
@@ -80,34 +80,34 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @param array $args |
82 | 82 | */ |
83 | - public function register( $args ) { |
|
83 | + public function register($args) { |
|
84 | 84 | $args_default = array( |
85 | 85 | 'id' => '', |
86 | 86 | 'version' => '', |
87 | 87 | 'callback' => '', |
88 | 88 | ); |
89 | 89 | |
90 | - $args = wp_parse_args( $args, $args_default ); |
|
90 | + $args = wp_parse_args($args, $args_default); |
|
91 | 91 | |
92 | 92 | // You can only register database upgrade. |
93 | 93 | $args['type'] = 'database'; |
94 | 94 | |
95 | 95 | // Bailout. |
96 | 96 | if ( |
97 | - empty( $args['id'] ) || |
|
98 | - empty( $args['version'] ) || |
|
99 | - empty( $args['callback'] ) || |
|
100 | - ! is_callable( $args['callback'] ) |
|
97 | + empty($args['id']) || |
|
98 | + empty($args['version']) || |
|
99 | + empty($args['callback']) || |
|
100 | + ! is_callable($args['callback']) |
|
101 | 101 | ) { |
102 | 102 | return; |
103 | 103 | } |
104 | 104 | |
105 | 105 | // Change depend param to array. |
106 | - if ( isset( $args['depend'] ) && is_string( $args['depend'] ) ) { |
|
107 | - $args['depend'] = array( $args['depend'] ); |
|
106 | + if (isset($args['depend']) && is_string($args['depend'])) { |
|
107 | + $args['depend'] = array($args['depend']); |
|
108 | 108 | } |
109 | 109 | |
110 | - $this->updates[ $args['type'] ][] = $args; |
|
110 | + $this->updates[$args['type']][] = $args; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @return static |
119 | 119 | */ |
120 | 120 | static function get_instance() { |
121 | - if ( is_null( self::$instance ) ) { |
|
121 | + if (is_null(self::$instance)) { |
|
122 | 122 | self::$instance = new self(); |
123 | 123 | } |
124 | 124 | |
@@ -136,27 +136,27 @@ discard block |
||
136 | 136 | /** |
137 | 137 | * Load file |
138 | 138 | */ |
139 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-background-updater.php'; |
|
140 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
139 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-background-updater.php'; |
|
140 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
141 | 141 | |
142 | 142 | self::$background_updater = new Give_Background_Updater(); |
143 | 143 | |
144 | 144 | /** |
145 | 145 | * Setup hooks. |
146 | 146 | */ |
147 | - add_action( 'init', array( $this, '__register_upgrade' ), 9999 ); |
|
148 | - add_action( 'give_set_upgrade_completed', array( $this, '__flush_resume_updates' ), 9999 ); |
|
149 | - add_action( 'wp_ajax_give_db_updates_info', array( $this, '__give_db_updates_info' ) ); |
|
150 | - add_action( 'wp_ajax_give_run_db_updates', array( $this, '__give_start_updating' ) ); |
|
151 | - add_action( 'admin_init', array( $this, '__redirect_admin' ) ); |
|
152 | - add_action( 'admin_init', array( $this, '__pause_db_update' ), - 1 ); |
|
153 | - add_action( 'admin_init', array( $this, '__restart_db_update' ), - 1 ); |
|
154 | - add_action( 'admin_notices', array( $this, '__show_notice' ) ); |
|
155 | - add_action( 'give_restart_db_upgrade', array( $this, '__health_background_update' ) ); |
|
156 | - |
|
157 | - if ( is_admin() ) { |
|
158 | - add_action( 'admin_init', array( $this, '__change_donations_label' ), 9999 ); |
|
159 | - add_action( 'admin_menu', array( $this, '__register_menu' ), 9999 ); |
|
147 | + add_action('init', array($this, '__register_upgrade'), 9999); |
|
148 | + add_action('give_set_upgrade_completed', array($this, '__flush_resume_updates'), 9999); |
|
149 | + add_action('wp_ajax_give_db_updates_info', array($this, '__give_db_updates_info')); |
|
150 | + add_action('wp_ajax_give_run_db_updates', array($this, '__give_start_updating')); |
|
151 | + add_action('admin_init', array($this, '__redirect_admin')); |
|
152 | + add_action('admin_init', array($this, '__pause_db_update'), - 1); |
|
153 | + add_action('admin_init', array($this, '__restart_db_update'), - 1); |
|
154 | + add_action('admin_notices', array($this, '__show_notice')); |
|
155 | + add_action('give_restart_db_upgrade', array($this, '__health_background_update')); |
|
156 | + |
|
157 | + if (is_admin()) { |
|
158 | + add_action('admin_init', array($this, '__change_donations_label'), 9999); |
|
159 | + add_action('admin_menu', array($this, '__register_menu'), 9999); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
@@ -170,12 +170,12 @@ discard block |
||
170 | 170 | $addons = give_get_plugins(); |
171 | 171 | $plugin_updates = get_plugin_updates(); |
172 | 172 | |
173 | - foreach ( $addons as $key => $info ) { |
|
174 | - if ( 'active' != $info['Status'] || 'add-on' != $info['Type'] || empty( $plugin_updates[ $key ] ) ) { |
|
173 | + foreach ($addons as $key => $info) { |
|
174 | + if ('active' != $info['Status'] || 'add-on' != $info['Type'] || empty($plugin_updates[$key])) { |
|
175 | 175 | continue; |
176 | 176 | } |
177 | 177 | |
178 | - $this->updates['plugin'][] = array_merge( $info, (array) $plugin_updates[ $key ] ); |
|
178 | + $this->updates['plugin'][] = array_merge($info, (array) $plugin_updates[$key]); |
|
179 | 179 | } |
180 | 180 | } |
181 | 181 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * @access public |
188 | 188 | */ |
189 | 189 | public function __register_upgrade() { |
190 | - if ( ! is_admin() ) { |
|
190 | + if ( ! is_admin()) { |
|
191 | 191 | return; |
192 | 192 | } |
193 | 193 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @since 1.8.12 |
198 | 198 | */ |
199 | - do_action( 'give_register_updates', $this ); |
|
199 | + do_action('give_register_updates', $this); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
@@ -209,23 +209,22 @@ discard block |
||
209 | 209 | global $menu; |
210 | 210 | |
211 | 211 | // Bailout. |
212 | - if ( empty( $menu ) || ! $this->get_total_update_count() ) { |
|
212 | + if (empty($menu) || ! $this->get_total_update_count()) { |
|
213 | 213 | return; |
214 | 214 | } |
215 | 215 | |
216 | - $is_update = ( $this->is_doing_updates() && ! self::$background_updater->is_paused_process() ); |
|
216 | + $is_update = ($this->is_doing_updates() && ! self::$background_updater->is_paused_process()); |
|
217 | 217 | |
218 | - foreach ( $menu as $index => $menu_item ) { |
|
219 | - if ( 'edit.php?post_type=give_forms' !== $menu_item[2] ) { |
|
218 | + foreach ($menu as $index => $menu_item) { |
|
219 | + if ('edit.php?post_type=give_forms' !== $menu_item[2]) { |
|
220 | 220 | continue; |
221 | 221 | } |
222 | 222 | |
223 | - $menu[ $index ][0] = sprintf( |
|
223 | + $menu[$index][0] = sprintf( |
|
224 | 224 | '%1$s <span class="update-plugins"><span class="plugin-count give-update-progress-count">%2$s%3$s</span></span>', |
225 | - __( 'Donations', 'give' ), |
|
225 | + __('Donations', 'give'), |
|
226 | 226 | $is_update ? |
227 | - $this->get_db_update_processing_percentage() : |
|
228 | - $this->get_total_update_count(), |
|
227 | + $this->get_db_update_processing_percentage() : $this->get_total_update_count(), |
|
229 | 228 | $is_update ? '%' : '' |
230 | 229 | ); |
231 | 230 | |
@@ -244,41 +243,40 @@ discard block |
||
244 | 243 | $this->__register_plugin_addon_updates(); |
245 | 244 | |
246 | 245 | // Bailout. |
247 | - if ( ! $this->get_total_update_count() ) { |
|
246 | + if ( ! $this->get_total_update_count()) { |
|
248 | 247 | // Show complete update message if still on update setting page. |
249 | - if ( isset( $_GET['page'] ) && 'give-updates' === $_GET['page'] ) { |
|
248 | + if (isset($_GET['page']) && 'give-updates' === $_GET['page']) { |
|
250 | 249 | // Upgrades |
251 | 250 | add_submenu_page( |
252 | 251 | 'edit.php?post_type=give_forms', |
253 | - esc_html__( 'Give Updates Complete', 'give' ), |
|
254 | - __( 'Updates', 'give' ), |
|
252 | + esc_html__('Give Updates Complete', 'give'), |
|
253 | + __('Updates', 'give'), |
|
255 | 254 | 'manage_give_settings', |
256 | 255 | 'give-updates', |
257 | - array( $this, 'render_complete_page' ) |
|
256 | + array($this, 'render_complete_page') |
|
258 | 257 | ); |
259 | 258 | } |
260 | 259 | |
261 | 260 | return; |
262 | 261 | } |
263 | 262 | |
264 | - $is_update = ( $this->is_doing_updates() && ! self::$background_updater->is_paused_process() ); |
|
263 | + $is_update = ($this->is_doing_updates() && ! self::$background_updater->is_paused_process()); |
|
265 | 264 | |
266 | 265 | // Upgrades |
267 | 266 | add_submenu_page( |
268 | 267 | 'edit.php?post_type=give_forms', |
269 | - esc_html__( 'Give Updates', 'give' ), |
|
268 | + esc_html__('Give Updates', 'give'), |
|
270 | 269 | sprintf( |
271 | 270 | '%1$s <span class="update-plugins"%2$s><span class="plugin-count give-update-progress-count">%3$s%4$s</span></span>', |
272 | - __( 'Updates', 'give' ), |
|
273 | - isset( $_GET['give-pause-db-upgrades'] ) ? ' style="display:none;"' : '', |
|
271 | + __('Updates', 'give'), |
|
272 | + isset($_GET['give-pause-db-upgrades']) ? ' style="display:none;"' : '', |
|
274 | 273 | $is_update ? |
275 | - $this->get_db_update_processing_percentage() : |
|
276 | - $this->get_total_update_count(), |
|
274 | + $this->get_db_update_processing_percentage() : $this->get_total_update_count(), |
|
277 | 275 | $is_update ? '%' : '' |
278 | 276 | ), |
279 | 277 | 'manage_give_settings', |
280 | 278 | 'give-updates', |
281 | - array( $this, 'render_page' ) |
|
279 | + array($this, 'render_page') |
|
282 | 280 | ); |
283 | 281 | } |
284 | 282 | |
@@ -293,13 +291,13 @@ discard block |
||
293 | 291 | // Show db upgrade completed notice. |
294 | 292 | if ( |
295 | 293 | ! wp_doing_ajax() && |
296 | - current_user_can( 'manage_give_settings' ) && |
|
297 | - get_option( 'give_show_db_upgrade_complete_notice' ) && |
|
298 | - ! isset( $_GET['give-db-update-completed'] ) |
|
294 | + current_user_can('manage_give_settings') && |
|
295 | + get_option('give_show_db_upgrade_complete_notice') && |
|
296 | + ! isset($_GET['give-db-update-completed']) |
|
299 | 297 | ) { |
300 | - delete_option( 'give_show_db_upgrade_complete_notice' ); |
|
298 | + delete_option('give_show_db_upgrade_complete_notice'); |
|
301 | 299 | |
302 | - wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-updates&give-db-update-completed=give_db_upgrade_completed' ) ); |
|
300 | + wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-updates&give-db-update-completed=give_db_upgrade_completed')); |
|
303 | 301 | exit(); |
304 | 302 | } |
305 | 303 | } |
@@ -315,15 +313,15 @@ discard block |
||
315 | 313 | * |
316 | 314 | * @return bool |
317 | 315 | */ |
318 | - public function __pause_db_update( $force = false ) { |
|
316 | + public function __pause_db_update($force = false) { |
|
319 | 317 | // Bailout. |
320 | 318 | if ( |
321 | 319 | ! $force && |
322 | 320 | ( |
323 | 321 | wp_doing_ajax() || |
324 | - ! isset( $_GET['page'] ) || |
|
322 | + ! isset($_GET['page']) || |
|
325 | 323 | 'give-updates' !== $_GET['page'] || |
326 | - ! isset( $_GET['give-pause-db-upgrades'] ) || |
|
324 | + ! isset($_GET['give-pause-db-upgrades']) || |
|
327 | 325 | self::$background_updater->is_paused_process() |
328 | 326 | ) |
329 | 327 | |
@@ -331,13 +329,13 @@ discard block |
||
331 | 329 | return false; |
332 | 330 | } |
333 | 331 | |
334 | - delete_option( 'give_upgrade_error' ); |
|
332 | + delete_option('give_upgrade_error'); |
|
335 | 333 | |
336 | - $this->__health_background_update( $this ); |
|
334 | + $this->__health_background_update($this); |
|
337 | 335 | $batch = self::$background_updater->get_all_batch(); |
338 | 336 | |
339 | 337 | // Bailout: if batch is empty |
340 | - if ( empty( $batch->data ) ) { |
|
338 | + if (empty($batch->data)) { |
|
341 | 339 | return false; |
342 | 340 | } |
343 | 341 | |
@@ -346,25 +344,25 @@ discard block |
||
346 | 344 | |
347 | 345 | // Do not stop background process immediately if task running. |
348 | 346 | // @see Give_Background_Updater::lock_process |
349 | - if ( ! $force && self::$background_updater->is_process_running() ) { |
|
350 | - update_option( 'give_pause_upgrade', 1 ); |
|
347 | + if ( ! $force && self::$background_updater->is_process_running()) { |
|
348 | + update_option('give_pause_upgrade', 1); |
|
351 | 349 | |
352 | 350 | return true; |
353 | 351 | } |
354 | 352 | |
355 | - update_option( 'give_paused_batches', $batch, 'no' ); |
|
356 | - delete_option( $batch->key ); |
|
357 | - delete_site_transient( self::$background_updater->get_identifier() . '_process_lock' ); |
|
358 | - wp_clear_scheduled_hook( self::$background_updater->get_cron_identifier() ); |
|
353 | + update_option('give_paused_batches', $batch, 'no'); |
|
354 | + delete_option($batch->key); |
|
355 | + delete_site_transient(self::$background_updater->get_identifier().'_process_lock'); |
|
356 | + wp_clear_scheduled_hook(self::$background_updater->get_cron_identifier()); |
|
359 | 357 | |
360 | - Give()->logs->add( 'Update Pause', print_r( $batch, true ), 0, 'update' ); |
|
358 | + Give()->logs->add('Update Pause', print_r($batch, true), 0, 'update'); |
|
361 | 359 | |
362 | 360 | /** |
363 | 361 | * Fire action when pause db updates |
364 | 362 | * |
365 | 363 | * @since 2.0.1 |
366 | 364 | */ |
367 | - do_action( 'give_pause_db_upgrade', $this ); |
|
365 | + do_action('give_pause_db_upgrade', $this); |
|
368 | 366 | |
369 | 367 | return true; |
370 | 368 | } |
@@ -381,31 +379,31 @@ discard block |
||
381 | 379 | // Bailout. |
382 | 380 | if ( |
383 | 381 | wp_doing_ajax() || |
384 | - ! isset( $_GET['page'] ) || |
|
382 | + ! isset($_GET['page']) || |
|
385 | 383 | 'give-updates' !== $_GET['page'] || |
386 | - ! isset( $_GET['give-restart-db-upgrades'] ) || |
|
384 | + ! isset($_GET['give-restart-db-upgrades']) || |
|
387 | 385 | ! self::$background_updater->is_paused_process() |
388 | 386 | ) { |
389 | 387 | return false; |
390 | 388 | } |
391 | 389 | |
392 | 390 | Give_Background_Updater::flush_cache(); |
393 | - $batch = get_option( 'give_paused_batches' ); |
|
391 | + $batch = get_option('give_paused_batches'); |
|
394 | 392 | |
395 | - if ( ! empty( $batch ) ) { |
|
396 | - wp_cache_delete( $batch->key, 'options' ); |
|
397 | - update_option( $batch->key, $batch->data ); |
|
393 | + if ( ! empty($batch)) { |
|
394 | + wp_cache_delete($batch->key, 'options'); |
|
395 | + update_option($batch->key, $batch->data); |
|
398 | 396 | |
399 | - delete_option( 'give_paused_batches' ); |
|
397 | + delete_option('give_paused_batches'); |
|
400 | 398 | |
401 | - Give()->logs->add( 'Update Restart', print_r( $batch, true ), 0, 'update' ); |
|
399 | + Give()->logs->add('Update Restart', print_r($batch, true), 0, 'update'); |
|
402 | 400 | |
403 | 401 | |
404 | 402 | /** Fire action when restart db updates |
405 | 403 | * |
406 | 404 | * @since 2.0.1 |
407 | 405 | */ |
408 | - do_action( 'give_restart_db_upgrade', $this ); |
|
406 | + do_action('give_restart_db_upgrade', $this); |
|
409 | 407 | |
410 | 408 | self::$background_updater->dispatch(); |
411 | 409 | } |
@@ -421,53 +419,53 @@ discard block |
||
421 | 419 | * |
422 | 420 | * @param Give_Updates $give_updates |
423 | 421 | */ |
424 | - public function __health_background_update( $give_updates ) { |
|
425 | - if ( ! $this->is_doing_updates() ) { |
|
422 | + public function __health_background_update($give_updates) { |
|
423 | + if ( ! $this->is_doing_updates()) { |
|
426 | 424 | return; |
427 | 425 | } |
428 | 426 | |
429 | 427 | Give_Background_Updater::flush_cache(); |
430 | 428 | |
431 | 429 | $batch = Give_Updates::$background_updater->get_all_batch(); |
432 | - $batch_data_count = count( $batch->data ); |
|
433 | - $all_updates = $give_updates->get_updates( 'database', 'all' ); |
|
434 | - $all_update_ids = wp_list_pluck( $all_updates, 'id' ); |
|
435 | - $all_batch_update_ids = ! empty( $batch->data ) ? wp_list_pluck( $batch->data, 'id' ) : array(); |
|
430 | + $batch_data_count = count($batch->data); |
|
431 | + $all_updates = $give_updates->get_updates('database', 'all'); |
|
432 | + $all_update_ids = wp_list_pluck($all_updates, 'id'); |
|
433 | + $all_batch_update_ids = ! empty($batch->data) ? wp_list_pluck($batch->data, 'id') : array(); |
|
436 | 434 | $log_data = ''; |
437 | - $doing_upgrade_args = get_option( 'give_doing_upgrade' ); |
|
435 | + $doing_upgrade_args = get_option('give_doing_upgrade'); |
|
438 | 436 | |
439 | - if ( ! empty( $doing_upgrade_args ) ) { |
|
440 | - $log_data .= 'Doing update:' . "\n"; |
|
441 | - $log_data .= print_r( $doing_upgrade_args, true ) . "\n"; |
|
437 | + if ( ! empty($doing_upgrade_args)) { |
|
438 | + $log_data .= 'Doing update:'."\n"; |
|
439 | + $log_data .= print_r($doing_upgrade_args, true)."\n"; |
|
442 | 440 | } |
443 | 441 | |
444 | 442 | /** |
445 | 443 | * Add remove upgrade from batch |
446 | 444 | */ |
447 | - if ( ! empty( $batch->data ) ) { |
|
445 | + if ( ! empty($batch->data)) { |
|
448 | 446 | |
449 | - foreach ( $batch->data as $index => $update ) { |
|
450 | - $log_data = print_r( $update, true ) . "\n"; |
|
447 | + foreach ($batch->data as $index => $update) { |
|
448 | + $log_data = print_r($update, true)."\n"; |
|
451 | 449 | |
452 | - if ( ! is_callable( $update['callback'] ) ) { |
|
453 | - $log_data .= 'Removing missing callback update: ' . "{$update['id']}\n"; |
|
454 | - unset( $batch->data[ $index ] ); |
|
455 | - } elseif ( give_has_upgrade_completed( $update['id'] ) ) { |
|
456 | - $log_data .= 'Removing already completed update: ' . "{$update['id']}\n"; |
|
457 | - unset( $batch->data[ $index ] ); |
|
450 | + if ( ! is_callable($update['callback'])) { |
|
451 | + $log_data .= 'Removing missing callback update: '."{$update['id']}\n"; |
|
452 | + unset($batch->data[$index]); |
|
453 | + } elseif (give_has_upgrade_completed($update['id'])) { |
|
454 | + $log_data .= 'Removing already completed update: '."{$update['id']}\n"; |
|
455 | + unset($batch->data[$index]); |
|
458 | 456 | } |
459 | 457 | |
460 | - if ( ! empty( $update['depend'] ) ) { |
|
458 | + if ( ! empty($update['depend'])) { |
|
461 | 459 | |
462 | - foreach ( $update['depend'] as $depend ) { |
|
463 | - if ( give_has_upgrade_completed( $depend ) ) { |
|
464 | - $log_data .= 'Completed update: ' . "{$depend}\n"; |
|
460 | + foreach ($update['depend'] as $depend) { |
|
461 | + if (give_has_upgrade_completed($depend)) { |
|
462 | + $log_data .= 'Completed update: '."{$depend}\n"; |
|
465 | 463 | continue; |
466 | 464 | } |
467 | 465 | |
468 | - if ( in_array( $depend, $all_update_ids ) && ! in_array( $depend, $all_batch_update_ids ) ) { |
|
469 | - $log_data .= 'Adding missing update: ' . "{$depend}\n"; |
|
470 | - array_unshift( $batch->data, $all_updates[ array_search( $depend, $all_update_ids ) ] ); |
|
466 | + if (in_array($depend, $all_update_ids) && ! in_array($depend, $all_batch_update_ids)) { |
|
467 | + $log_data .= 'Adding missing update: '."{$depend}\n"; |
|
468 | + array_unshift($batch->data, $all_updates[array_search($depend, $all_update_ids)]); |
|
471 | 469 | } |
472 | 470 | } |
473 | 471 | } |
@@ -477,52 +475,52 @@ discard block |
||
477 | 475 | /** |
478 | 476 | * Add new upgrade to batch |
479 | 477 | */ |
480 | - if ( $new_updates = $this->get_updates( 'database', 'new' ) ) { |
|
481 | - $all_batch_update_ids = ! empty( $batch->data ) ? wp_list_pluck( $batch->data, 'id' ) : array(); |
|
478 | + if ($new_updates = $this->get_updates('database', 'new')) { |
|
479 | + $all_batch_update_ids = ! empty($batch->data) ? wp_list_pluck($batch->data, 'id') : array(); |
|
482 | 480 | |
483 | - foreach ( $new_updates as $index => $new_update ) { |
|
484 | - if ( give_has_upgrade_completed( $new_update['id'] ) || in_array( $new_update['id'], $all_batch_update_ids ) ) { |
|
485 | - unset( $new_updates[ $index ] ); |
|
481 | + foreach ($new_updates as $index => $new_update) { |
|
482 | + if (give_has_upgrade_completed($new_update['id']) || in_array($new_update['id'], $all_batch_update_ids)) { |
|
483 | + unset($new_updates[$index]); |
|
486 | 484 | } |
487 | 485 | } |
488 | 486 | |
489 | - if ( ! empty( $new_updates ) ) { |
|
490 | - $log_data .= 'Adding new update: ' . "\n"; |
|
491 | - $log_data .= print_r( $new_updates, true ) . "\n"; |
|
487 | + if ( ! empty($new_updates)) { |
|
488 | + $log_data .= 'Adding new update: '."\n"; |
|
489 | + $log_data .= print_r($new_updates, true)."\n"; |
|
492 | 490 | |
493 | - $batch->data = array_merge( (array) $batch->data, $new_updates ); |
|
494 | - update_option( 'give_db_update_count', ( absint( get_option( 'give_db_update_count' ) ) + count( $new_updates ) ) ); |
|
491 | + $batch->data = array_merge((array) $batch->data, $new_updates); |
|
492 | + update_option('give_db_update_count', (absint(get_option('give_db_update_count')) + count($new_updates))); |
|
495 | 493 | } |
496 | 494 | } |
497 | 495 | |
498 | 496 | /** |
499 | 497 | * Fix batch |
500 | 498 | */ |
501 | - if ( empty( $batch->data ) ) { |
|
499 | + if (empty($batch->data)) { |
|
502 | 500 | // Complete batch if do not have any data to process. |
503 | - self::$background_updater->delete( $batch->key ); |
|
501 | + self::$background_updater->delete($batch->key); |
|
504 | 502 | |
505 | - if ( self::$background_updater->has_queue() ) { |
|
506 | - $this->__health_background_update( $this ); |
|
503 | + if (self::$background_updater->has_queue()) { |
|
504 | + $this->__health_background_update($this); |
|
507 | 505 | } else { |
508 | - delete_site_transient( self::$background_updater->get_identifier() . '_process_lock' ); |
|
509 | - wp_clear_scheduled_hook( self::$background_updater->get_cron_identifier() ); |
|
506 | + delete_site_transient(self::$background_updater->get_identifier().'_process_lock'); |
|
507 | + wp_clear_scheduled_hook(self::$background_updater->get_cron_identifier()); |
|
510 | 508 | |
511 | 509 | self::$background_updater->complete(); |
512 | 510 | } |
513 | 511 | |
514 | - } elseif ( $batch_data_count !== count( $batch->data ) ) { |
|
512 | + } elseif ($batch_data_count !== count($batch->data)) { |
|
515 | 513 | |
516 | - $log_data .= 'Updating batch' . "\n"; |
|
517 | - $log_data .= print_r( $batch, true ); |
|
514 | + $log_data .= 'Updating batch'."\n"; |
|
515 | + $log_data .= print_r($batch, true); |
|
518 | 516 | |
519 | - if ( ! empty( $batch->key ) ) { |
|
520 | - wp_cache_delete( $batch->key, 'options' ); |
|
521 | - update_option( $batch->key, $batch->data ); |
|
517 | + if ( ! empty($batch->key)) { |
|
518 | + wp_cache_delete($batch->key, 'options'); |
|
519 | + update_option($batch->key, $batch->data); |
|
522 | 520 | } else { |
523 | 521 | |
524 | - foreach ( $batch->data as $data ) { |
|
525 | - Give_Updates::$background_updater->push_to_queue( $data ); |
|
522 | + foreach ($batch->data as $data) { |
|
523 | + Give_Updates::$background_updater->push_to_queue($data); |
|
526 | 524 | } |
527 | 525 | |
528 | 526 | Give_Updates::$background_updater->save(); |
@@ -533,31 +531,31 @@ discard block |
||
533 | 531 | /** |
534 | 532 | * Fix give_doing_upgrade option |
535 | 533 | */ |
536 | - if( $fresh_new_db_count = $this->get_total_new_db_update_count( true ) ) { |
|
537 | - update_option( 'give_db_update_count', $fresh_new_db_count ); |
|
534 | + if ($fresh_new_db_count = $this->get_total_new_db_update_count(true)) { |
|
535 | + update_option('give_db_update_count', $fresh_new_db_count); |
|
538 | 536 | } |
539 | 537 | |
540 | 538 | $doing_upgrade_args['update'] = 1; |
541 | - $doing_upgrade_args['heading'] = sprintf( 'Update %s of %s', 1, $fresh_new_db_count ); |
|
542 | - $doing_upgrade_args['total_percentage'] = $this->get_db_update_processing_percentage( true ); |
|
539 | + $doing_upgrade_args['heading'] = sprintf('Update %s of %s', 1, $fresh_new_db_count); |
|
540 | + $doing_upgrade_args['total_percentage'] = $this->get_db_update_processing_percentage(true); |
|
543 | 541 | |
544 | 542 | // Remove already completed update from info. |
545 | 543 | if ( |
546 | - empty( $doing_upgrade_args['update_info'] ) |
|
547 | - || give_has_upgrade_completed( $doing_upgrade_args['update_info']['id'] ) |
|
544 | + empty($doing_upgrade_args['update_info']) |
|
545 | + || give_has_upgrade_completed($doing_upgrade_args['update_info']['id']) |
|
548 | 546 | ) { |
549 | - $doing_upgrade_args['update_info'] = current( array_values( $batch->data ) ); |
|
547 | + $doing_upgrade_args['update_info'] = current(array_values($batch->data)); |
|
550 | 548 | $doing_upgrade_args['step'] = 1; |
551 | 549 | } |
552 | 550 | |
553 | 551 | // Check if dependency completed or not. |
554 | - if ( isset( $doing_upgrade_args['update_info']['depend'] ) ) { |
|
555 | - foreach ( $doing_upgrade_args['update_info']['depend'] as $depend ) { |
|
556 | - if ( give_has_upgrade_completed( $depend ) ) { |
|
552 | + if (isset($doing_upgrade_args['update_info']['depend'])) { |
|
553 | + foreach ($doing_upgrade_args['update_info']['depend'] as $depend) { |
|
554 | + if (give_has_upgrade_completed($depend)) { |
|
557 | 555 | continue; |
558 | 556 | } |
559 | 557 | |
560 | - $doing_upgrade_args['update_info'] = $all_updates[ array_search( $depend, $all_update_ids ) ]; |
|
558 | + $doing_upgrade_args['update_info'] = $all_updates[array_search($depend, $all_update_ids)]; |
|
561 | 559 | $doing_upgrade_args['step'] = 1; |
562 | 560 | $doing_upgrade_args['percentage'] = 0; |
563 | 561 | $doing_upgrade_args['total_percentage'] = 0; |
@@ -566,14 +564,14 @@ discard block |
||
566 | 564 | } |
567 | 565 | } |
568 | 566 | |
569 | - if( ! empty( $doing_upgrade_args['update_info'] ) ) { |
|
570 | - update_option( 'give_doing_upgrade', $doing_upgrade_args ); |
|
567 | + if ( ! empty($doing_upgrade_args['update_info'])) { |
|
568 | + update_option('give_doing_upgrade', $doing_upgrade_args); |
|
571 | 569 | |
572 | - $log_data .= 'Updated doing update:' . "\n"; |
|
573 | - $log_data .= print_r( $doing_upgrade_args, true ) . "\n"; |
|
570 | + $log_data .= 'Updated doing update:'."\n"; |
|
571 | + $log_data .= print_r($doing_upgrade_args, true)."\n"; |
|
574 | 572 | } |
575 | 573 | |
576 | - Give()->logs->add( 'Update Health Check', $log_data, 0, 'update' ); |
|
574 | + Give()->logs->add('Update Health Check', $log_data, 0, 'update'); |
|
577 | 575 | } |
578 | 576 | |
579 | 577 | |
@@ -587,61 +585,61 @@ discard block |
||
587 | 585 | $current_screen = get_current_screen(); |
588 | 586 | |
589 | 587 | // Bailout. |
590 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
588 | + if ( ! current_user_can('manage_give_settings')) { |
|
591 | 589 | return; |
592 | 590 | } |
593 | 591 | |
594 | 592 | // Run DB updates. |
595 | - if ( ! empty( $_GET['give-run-db-update'] ) ) { |
|
593 | + if ( ! empty($_GET['give-run-db-update'])) { |
|
596 | 594 | $this->run_db_update(); |
597 | 595 | } |
598 | 596 | |
599 | 597 | |
600 | 598 | // Bailout. |
601 | - if ( in_array( $current_screen->base, array( 'give_forms_page_give-updates', 'update-core' ) ) ) { |
|
599 | + if (in_array($current_screen->base, array('give_forms_page_give-updates', 'update-core'))) { |
|
602 | 600 | return; |
603 | 601 | } |
604 | 602 | |
605 | 603 | // Show notice if upgrade paused. |
606 | - if ( self::$background_updater->is_paused_process() ) { |
|
604 | + if (self::$background_updater->is_paused_process()) { |
|
607 | 605 | ob_start(); |
608 | 606 | |
609 | - $upgrade_error = get_option( 'give_upgrade_error' ); |
|
610 | - if ( ! $upgrade_error ) : ?> |
|
611 | - <strong><?php _e( 'Database Update', 'give' ); ?></strong> |
|
612 | - – <?php _e( 'GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a backup before proceeding.', 'give' ); ?> |
|
607 | + $upgrade_error = get_option('give_upgrade_error'); |
|
608 | + if ( ! $upgrade_error) : ?> |
|
609 | + <strong><?php _e('Database Update', 'give'); ?></strong> |
|
610 | + – <?php _e('GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a backup before proceeding.', 'give'); ?> |
|
613 | 611 | <br> |
614 | 612 | <br> |
615 | - <a href="<?php echo esc_url( add_query_arg( array( 'give-restart-db-upgrades' => 1 ), admin_url( 'edit.php?post_type=give_forms&page=give-updates' ) ) ); ?>" class="button button-primary give-restart-updater-btn"> |
|
616 | - <?php _e( 'Restart the updater', 'give' ); ?> |
|
613 | + <a href="<?php echo esc_url(add_query_arg(array('give-restart-db-upgrades' => 1), admin_url('edit.php?post_type=give_forms&page=give-updates'))); ?>" class="button button-primary give-restart-updater-btn"> |
|
614 | + <?php _e('Restart the updater', 'give'); ?> |
|
617 | 615 | </a> |
618 | 616 | <?php else: ?> |
619 | - <strong><?php _e( 'Database Update', 'give' ); ?></strong> |
|
620 | - – <?php _e( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' ); ?> |
|
617 | + <strong><?php _e('Database Update', 'give'); ?></strong> |
|
618 | + – <?php _e('An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give'); ?> |
|
621 | 619 | <?php |
622 | 620 | endif; |
623 | 621 | $desc_html = ob_get_clean(); |
624 | 622 | |
625 | - Give()->notices->register_notice( array( |
|
623 | + Give()->notices->register_notice(array( |
|
626 | 624 | 'id' => 'give_upgrade_db', |
627 | 625 | 'type' => 'error', |
628 | 626 | 'dismissible' => false, |
629 | 627 | 'description' => $desc_html, |
630 | - ) ); |
|
628 | + )); |
|
631 | 629 | } |
632 | 630 | |
633 | 631 | // Bailout if doing upgrades. |
634 | - if ( $this->is_doing_updates() ) { |
|
632 | + if ($this->is_doing_updates()) { |
|
635 | 633 | return; |
636 | 634 | } |
637 | 635 | |
638 | 636 | // Show notice if ajax is not working. |
639 | - if ( ! give_test_ajax_works() ) { |
|
637 | + if ( ! give_test_ajax_works()) { |
|
640 | 638 | Give()->notices->register_notice( |
641 | 639 | array( |
642 | 640 | 'id' => 'give_db_upgrade_ajax_inaccessible', |
643 | 641 | 'type' => 'error', |
644 | - 'description' => sprintf( '%1$s <a href="%2$s" target="_blank">%3$s</a>', __( 'Give needs to upgrade the database but cannot because AJAX does not appear accessible. This could be because your website is password protected, in maintenance mode, or has a specific hosting configuration or plugin active that is preventing access.', 'give' ), 'http://docs.givewp.com/admin-ajax-error', __( 'Read More', 'give' ) . ' »' ), |
|
642 | + 'description' => sprintf('%1$s <a href="%2$s" target="_blank">%3$s</a>', __('Give needs to upgrade the database but cannot because AJAX does not appear accessible. This could be because your website is password protected, in maintenance mode, or has a specific hosting configuration or plugin active that is preventing access.', 'give'), 'http://docs.givewp.com/admin-ajax-error', __('Read More', 'give').' »'), |
|
645 | 643 | 'show' => true, |
646 | 644 | ) |
647 | 645 | ); |
@@ -650,40 +648,40 @@ discard block |
||
650 | 648 | } |
651 | 649 | |
652 | 650 | // Show db upgrade completed notice. |
653 | - if ( ! empty( $_GET['give-db-update-completed'] ) ) { |
|
654 | - Give()->notices->register_notice( array( |
|
651 | + if ( ! empty($_GET['give-db-update-completed'])) { |
|
652 | + Give()->notices->register_notice(array( |
|
655 | 653 | 'id' => 'give_db_upgrade_completed', |
656 | 654 | 'type' => 'updated', |
657 | - 'description' => __( 'Give database updates completed successfully. Thank you for updating to the latest version!', 'give' ), |
|
655 | + 'description' => __('Give database updates completed successfully. Thank you for updating to the latest version!', 'give'), |
|
658 | 656 | 'show' => true, |
659 | - ) ); |
|
657 | + )); |
|
660 | 658 | |
661 | 659 | // Start update. |
662 | - } elseif ( ! empty( $_GET['give-run-db-update'] ) ) { |
|
660 | + } elseif ( ! empty($_GET['give-run-db-update'])) { |
|
663 | 661 | $this->run_db_update(); |
664 | 662 | |
665 | 663 | // Show run the update notice. |
666 | - } elseif ( $this->get_total_new_db_update_count() ) { |
|
664 | + } elseif ($this->get_total_new_db_update_count()) { |
|
667 | 665 | ob_start(); |
668 | 666 | ?> |
669 | 667 | <p> |
670 | - <strong><?php _e( 'Database Update', 'give' ); ?></strong> |
|
671 | - – <?php _e( 'GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a complete backup before proceeding.', 'give' ); ?> |
|
668 | + <strong><?php _e('Database Update', 'give'); ?></strong> |
|
669 | + – <?php _e('GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a complete backup before proceeding.', 'give'); ?> |
|
672 | 670 | </p> |
673 | 671 | <p class="submit"> |
674 | - <a href="<?php echo esc_url( add_query_arg( array( 'give-run-db-update' => 1 ), admin_url( 'edit.php?post_type=give_forms&page=give-updates' ) ) ); ?>" class="button button-primary give-run-update-now"> |
|
675 | - <?php _e( 'Run the updater', 'give' ); ?> |
|
672 | + <a href="<?php echo esc_url(add_query_arg(array('give-run-db-update' => 1), admin_url('edit.php?post_type=give_forms&page=give-updates'))); ?>" class="button button-primary give-run-update-now"> |
|
673 | + <?php _e('Run the updater', 'give'); ?> |
|
676 | 674 | </a> |
677 | 675 | </p> |
678 | 676 | <?php |
679 | 677 | $desc_html = ob_get_clean(); |
680 | 678 | |
681 | - Give()->notices->register_notice( array( |
|
679 | + Give()->notices->register_notice(array( |
|
682 | 680 | 'id' => 'give_upgrade_db', |
683 | 681 | 'type' => 'updated', |
684 | 682 | 'dismissible' => false, |
685 | 683 | 'description' => $desc_html, |
686 | - ) ); |
|
684 | + )); |
|
687 | 685 | } |
688 | 686 | } |
689 | 687 | |
@@ -694,7 +692,7 @@ discard block |
||
694 | 692 | * @access public |
695 | 693 | */ |
696 | 694 | public function render_complete_page() { |
697 | - include_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/upgrades-complete.php'; |
|
695 | + include_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/upgrades-complete.php'; |
|
698 | 696 | } |
699 | 697 | |
700 | 698 | /** |
@@ -704,7 +702,7 @@ discard block |
||
704 | 702 | * @access public |
705 | 703 | */ |
706 | 704 | public function render_page() { |
707 | - include_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/upgrades.php'; |
|
705 | + include_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/upgrades.php'; |
|
708 | 706 | } |
709 | 707 | |
710 | 708 | /** |
@@ -715,26 +713,26 @@ discard block |
||
715 | 713 | */ |
716 | 714 | private function run_db_update() { |
717 | 715 | // Bailout. |
718 | - if ( $this->is_doing_updates() || ! $this->get_total_new_db_update_count() ) { |
|
716 | + if ($this->is_doing_updates() || ! $this->get_total_new_db_update_count()) { |
|
719 | 717 | return; |
720 | 718 | } |
721 | 719 | |
722 | - $updates = $this->get_updates( 'database', 'new' ); |
|
720 | + $updates = $this->get_updates('database', 'new'); |
|
723 | 721 | |
724 | - foreach ( $updates as $update ) { |
|
725 | - self::$background_updater->push_to_queue( $update ); |
|
722 | + foreach ($updates as $update) { |
|
723 | + self::$background_updater->push_to_queue($update); |
|
726 | 724 | } |
727 | 725 | |
728 | - add_option( 'give_db_update_count', count( $updates ), '', 'no' ); |
|
726 | + add_option('give_db_update_count', count($updates), '', 'no'); |
|
729 | 727 | |
730 | - add_option( 'give_doing_upgrade', array( |
|
728 | + add_option('give_doing_upgrade', array( |
|
731 | 729 | 'update_info' => $updates[0], |
732 | 730 | 'step' => 1, |
733 | 731 | 'update' => 1, |
734 | - 'heading' => sprintf( 'Update %s of %s', 1, count( $updates ) ), |
|
732 | + 'heading' => sprintf('Update %s of %s', 1, count($updates)), |
|
735 | 733 | 'percentage' => 0, |
736 | 734 | 'total_percentage' => 0, |
737 | - ), '', 'no' ); |
|
735 | + ), '', 'no'); |
|
738 | 736 | |
739 | 737 | self::$background_updater->save()->dispatch(); |
740 | 738 | } |
@@ -748,14 +746,13 @@ discard block |
||
748 | 746 | */ |
749 | 747 | public function __flush_resume_updates() { |
750 | 748 | //delete_option( 'give_doing_upgrade' ); |
751 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
749 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
752 | 750 | |
753 | 751 | // Reset counter. |
754 | 752 | $this->step = $this->percentage = 0; |
755 | 753 | |
756 | - $this->update = ( $this->get_total_db_update_count() > $this->update ) ? |
|
757 | - ( $this->update + 1 ) : |
|
758 | - $this->update; |
|
754 | + $this->update = ($this->get_total_db_update_count() > $this->update) ? |
|
755 | + ($this->update + 1) : $this->update; |
|
759 | 756 | } |
760 | 757 | |
761 | 758 | |
@@ -770,7 +767,7 @@ discard block |
||
770 | 767 | public function __give_start_updating() { |
771 | 768 | // Check permission. |
772 | 769 | if ( |
773 | - ! current_user_can( 'manage_give_settings' ) || |
|
770 | + ! current_user_can('manage_give_settings') || |
|
774 | 771 | $this->is_doing_updates() |
775 | 772 | ) { |
776 | 773 | wp_send_json_error(); |
@@ -778,7 +775,7 @@ discard block |
||
778 | 775 | |
779 | 776 | // @todo: validate nonce |
780 | 777 | // @todo: set http method to post |
781 | - if ( empty( $_POST['run_db_update'] ) ) { |
|
778 | + if (empty($_POST['run_db_update'])) { |
|
782 | 779 | wp_send_json_error(); |
783 | 780 | } |
784 | 781 | |
@@ -797,34 +794,34 @@ discard block |
||
797 | 794 | * @return string |
798 | 795 | */ |
799 | 796 | public function __give_db_updates_info() { |
800 | - $update_info = get_option( 'give_doing_upgrade' ); |
|
797 | + $update_info = get_option('give_doing_upgrade'); |
|
801 | 798 | $response_type = ''; |
802 | 799 | |
803 | - if ( self::$background_updater->is_paused_process() ) { |
|
800 | + if (self::$background_updater->is_paused_process()) { |
|
804 | 801 | $update_info = array( |
805 | - 'message' => __( 'The updates have been paused.', 'give' ), |
|
802 | + 'message' => __('The updates have been paused.', 'give'), |
|
806 | 803 | 'heading' => '', |
807 | 804 | 'percentage' => 0, |
808 | 805 | ); |
809 | 806 | |
810 | - if ( get_option( 'give_upgrade_error' ) ) { |
|
811 | - $update_info['message'] = __( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' ); |
|
807 | + if (get_option('give_upgrade_error')) { |
|
808 | + $update_info['message'] = __('An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give'); |
|
812 | 809 | } |
813 | 810 | |
814 | 811 | $response_type = 'error'; |
815 | 812 | |
816 | - } elseif ( empty( $update_info ) || ! $this->get_total_new_db_update_count( true ) ) { |
|
813 | + } elseif (empty($update_info) || ! $this->get_total_new_db_update_count(true)) { |
|
817 | 814 | $update_info = array( |
818 | - 'message' => __( 'Give database updates completed successfully. Thank you for updating to the latest version!', 'give' ), |
|
819 | - 'heading' => __( 'Updates Completed.', 'give' ), |
|
815 | + 'message' => __('Give database updates completed successfully. Thank you for updating to the latest version!', 'give'), |
|
816 | + 'heading' => __('Updates Completed.', 'give'), |
|
820 | 817 | 'percentage' => 0, |
821 | 818 | ); |
822 | 819 | $response_type = 'success'; |
823 | 820 | |
824 | - delete_option( 'give_show_db_upgrade_complete_notice' ); |
|
821 | + delete_option('give_show_db_upgrade_complete_notice'); |
|
825 | 822 | } |
826 | 823 | |
827 | - $this->send_ajax_response( $update_info, $response_type ); |
|
824 | + $this->send_ajax_response($update_info, $response_type); |
|
828 | 825 | } |
829 | 826 | |
830 | 827 | /** |
@@ -836,7 +833,7 @@ discard block |
||
836 | 833 | * @param $data |
837 | 834 | * @param string $type |
838 | 835 | */ |
839 | - public function send_ajax_response( $data, $type = '' ) { |
|
836 | + public function send_ajax_response($data, $type = '') { |
|
840 | 837 | $default = array( |
841 | 838 | 'message' => '', |
842 | 839 | 'heading' => '', |
@@ -846,24 +843,24 @@ discard block |
||
846 | 843 | ); |
847 | 844 | |
848 | 845 | // Set data. |
849 | - $data = wp_parse_args( $data, $default ); |
|
846 | + $data = wp_parse_args($data, $default); |
|
850 | 847 | |
851 | 848 | // Enable cache. |
852 | 849 | Give_Cache::enable(); |
853 | 850 | |
854 | - switch ( $type ) { |
|
851 | + switch ($type) { |
|
855 | 852 | case 'success': |
856 | - wp_send_json_success( $data ); |
|
853 | + wp_send_json_success($data); |
|
857 | 854 | break; |
858 | 855 | |
859 | 856 | case 'error': |
860 | - wp_send_json_error( $data ); |
|
857 | + wp_send_json_error($data); |
|
861 | 858 | break; |
862 | 859 | |
863 | 860 | default: |
864 | - wp_send_json( array( |
|
861 | + wp_send_json(array( |
|
865 | 862 | 'data' => $data, |
866 | - ) ); |
|
863 | + )); |
|
867 | 864 | break; |
868 | 865 | } |
869 | 866 | } |
@@ -877,12 +874,12 @@ discard block |
||
877 | 874 | * @param $total |
878 | 875 | * @param $current_total |
879 | 876 | */ |
880 | - public function set_percentage( $total, $current_total ) { |
|
877 | + public function set_percentage($total, $current_total) { |
|
881 | 878 | // Set percentage. |
882 | - $this->percentage = $total ? ( ( $current_total ) / $total ) * 100 : 0; |
|
879 | + $this->percentage = $total ? (($current_total) / $total) * 100 : 0; |
|
883 | 880 | |
884 | 881 | // Verify percentage. |
885 | - $this->percentage = ( 100 < $this->percentage ) ? 100 : $this->percentage; |
|
882 | + $this->percentage = (100 < $this->percentage) ? 100 : $this->percentage; |
|
886 | 883 | } |
887 | 884 | |
888 | 885 | /** |
@@ -895,22 +892,22 @@ discard block |
||
895 | 892 | * |
896 | 893 | * @return bool|null |
897 | 894 | */ |
898 | - public function is_parent_updates_completed( $update ) { |
|
895 | + public function is_parent_updates_completed($update) { |
|
899 | 896 | // Bailout. |
900 | - if ( empty( $update['depend'] ) ) { |
|
897 | + if (empty($update['depend'])) { |
|
901 | 898 | return true; |
902 | 899 | } |
903 | 900 | |
904 | 901 | // Check if dependency is valid or not. |
905 | - if ( ! $this->has_valid_dependency( $update ) ) { |
|
902 | + if ( ! $this->has_valid_dependency($update)) { |
|
906 | 903 | return null; |
907 | 904 | } |
908 | 905 | |
909 | 906 | $is_dependency_completed = true; |
910 | 907 | |
911 | - foreach ( $update['depend'] as $depend ) { |
|
908 | + foreach ($update['depend'] as $depend) { |
|
912 | 909 | |
913 | - if ( ! give_has_upgrade_completed( $depend ) ) { |
|
910 | + if ( ! give_has_upgrade_completed($depend)) { |
|
914 | 911 | $is_dependency_completed = false; |
915 | 912 | break; |
916 | 913 | } |
@@ -927,7 +924,7 @@ discard block |
||
927 | 924 | * @return bool |
928 | 925 | */ |
929 | 926 | public function is_doing_updates() { |
930 | - return (bool) get_option( 'give_doing_upgrade' ); |
|
927 | + return (bool) get_option('give_doing_upgrade'); |
|
931 | 928 | } |
932 | 929 | |
933 | 930 | |
@@ -941,7 +938,7 @@ discard block |
||
941 | 938 | * |
942 | 939 | * @return bool |
943 | 940 | */ |
944 | - public function has_valid_dependency( $update ) { |
|
941 | + public function has_valid_dependency($update) { |
|
945 | 942 | $is_valid_dependency = true; |
946 | 943 | // $update_ids = wp_list_pluck( $this->get_updates( 'database', 'all' ), 'id' ); |
947 | 944 | // |
@@ -967,33 +964,33 @@ discard block |
||
967 | 964 | * |
968 | 965 | * @return array |
969 | 966 | */ |
970 | - public function get_updates( $update_type = '', $status = 'all' ) { |
|
967 | + public function get_updates($update_type = '', $status = 'all') { |
|
971 | 968 | // return all updates. |
972 | - if ( empty( $update_type ) ) { |
|
969 | + if (empty($update_type)) { |
|
973 | 970 | return $this->updates; |
974 | 971 | } |
975 | 972 | |
976 | 973 | // Get specific update. |
977 | - $updates = ! empty( $this->updates[ $update_type ] ) ? $this->updates[ $update_type ] : array(); |
|
974 | + $updates = ! empty($this->updates[$update_type]) ? $this->updates[$update_type] : array(); |
|
978 | 975 | |
979 | 976 | // Bailout. |
980 | - if ( empty( $updates ) ) { |
|
977 | + if (empty($updates)) { |
|
981 | 978 | return $updates; |
982 | 979 | } |
983 | 980 | |
984 | - switch ( $status ) { |
|
981 | + switch ($status) { |
|
985 | 982 | case 'new': |
986 | 983 | // Remove already completed updates. |
987 | - wp_cache_delete( 'give_completed_upgrades', 'options' ); |
|
984 | + wp_cache_delete('give_completed_upgrades', 'options'); |
|
988 | 985 | $completed_updates = give_get_completed_upgrades(); |
989 | 986 | |
990 | - if ( ! empty( $completed_updates ) ) { |
|
991 | - foreach ( $updates as $index => $update ) { |
|
992 | - if ( in_array( $update['id'], $completed_updates ) ) { |
|
993 | - unset( $updates[ $index ] ); |
|
987 | + if ( ! empty($completed_updates)) { |
|
988 | + foreach ($updates as $index => $update) { |
|
989 | + if (in_array($update['id'], $completed_updates)) { |
|
990 | + unset($updates[$index]); |
|
994 | 991 | } |
995 | 992 | } |
996 | - $updates = array_values( $updates ); |
|
993 | + $updates = array_values($updates); |
|
997 | 994 | } |
998 | 995 | |
999 | 996 | break; |
@@ -1010,7 +1007,7 @@ discard block |
||
1010 | 1007 | * @return int |
1011 | 1008 | */ |
1012 | 1009 | public function get_total_plugin_update_count() { |
1013 | - return count( $this->get_updates( 'plugin' ) ); |
|
1010 | + return count($this->get_updates('plugin')); |
|
1014 | 1011 | } |
1015 | 1012 | |
1016 | 1013 | /** |
@@ -1025,7 +1022,7 @@ discard block |
||
1025 | 1022 | $db_update_count = $this->get_pending_db_update_count(); |
1026 | 1023 | $plugin_update_count = $this->get_total_plugin_update_count(); |
1027 | 1024 | |
1028 | - return ( $db_update_count + $plugin_update_count ); |
|
1025 | + return ($db_update_count + $plugin_update_count); |
|
1029 | 1026 | } |
1030 | 1027 | |
1031 | 1028 | /** |
@@ -1037,7 +1034,7 @@ discard block |
||
1037 | 1034 | * @return int |
1038 | 1035 | */ |
1039 | 1036 | public function get_pending_db_update_count() { |
1040 | - return count( $this->get_updates( 'database', 'new' ) ); |
|
1037 | + return count($this->get_updates('database', 'new')); |
|
1041 | 1038 | } |
1042 | 1039 | |
1043 | 1040 | /** |
@@ -1049,7 +1046,7 @@ discard block |
||
1049 | 1046 | * @return int |
1050 | 1047 | */ |
1051 | 1048 | public function get_total_db_update_count() { |
1052 | - return count( $this->get_updates( 'database', 'all' ) ); |
|
1049 | + return count($this->get_updates('database', 'all')); |
|
1053 | 1050 | } |
1054 | 1051 | |
1055 | 1052 | /** |
@@ -1062,10 +1059,9 @@ discard block |
||
1062 | 1059 | * |
1063 | 1060 | * @return int |
1064 | 1061 | */ |
1065 | - public function get_total_new_db_update_count( $refresh = false ) { |
|
1062 | + public function get_total_new_db_update_count($refresh = false) { |
|
1066 | 1063 | $update_count = $this->is_doing_updates() && ! $refresh ? |
1067 | - get_option( 'give_db_update_count' ) : |
|
1068 | - $this->get_pending_db_update_count(); |
|
1064 | + get_option('give_db_update_count') : $this->get_pending_db_update_count(); |
|
1069 | 1065 | |
1070 | 1066 | return $update_count; |
1071 | 1067 | } |
@@ -1080,11 +1076,11 @@ discard block |
||
1080 | 1076 | * |
1081 | 1077 | * @return int |
1082 | 1078 | */ |
1083 | - public function get_running_db_update( $refresh = false ) { |
|
1079 | + public function get_running_db_update($refresh = false) { |
|
1084 | 1080 | $current_update = 1; |
1085 | 1081 | |
1086 | - if ( $this->is_doing_updates() && ! $refresh ) { |
|
1087 | - $current_update = get_option( 'give_doing_upgrade' ); |
|
1082 | + if ($this->is_doing_updates() && ! $refresh) { |
|
1083 | + $current_update = get_option('give_doing_upgrade'); |
|
1088 | 1084 | $current_update = $current_update['update']; |
1089 | 1085 | } |
1090 | 1086 | |
@@ -1101,25 +1097,23 @@ discard block |
||
1101 | 1097 | * |
1102 | 1098 | * @return float|int |
1103 | 1099 | */ |
1104 | - public function get_db_update_processing_percentage( $refresh = false ) { |
|
1100 | + public function get_db_update_processing_percentage($refresh = false) { |
|
1105 | 1101 | // Bailout. |
1106 | - if ( ! $this->get_total_new_db_update_count( $refresh ) ) { |
|
1102 | + if ( ! $this->get_total_new_db_update_count($refresh)) { |
|
1107 | 1103 | return 0; |
1108 | 1104 | } |
1109 | 1105 | |
1110 | - $resume_update = get_option( 'give_doing_upgrade' ); |
|
1111 | - $update_count_percentages = ( ( $this->get_running_db_update( $refresh ) - 1 ) / $this->get_total_new_db_update_count( $refresh ) ) * 100; |
|
1112 | - $update_percentage_share = ( 1 / $this->get_total_new_db_update_count() ) * 100; |
|
1113 | - $upgrade_percentage = ( ( $resume_update['percentage'] * $update_percentage_share ) / 100 ); |
|
1106 | + $resume_update = get_option('give_doing_upgrade'); |
|
1107 | + $update_count_percentages = (($this->get_running_db_update($refresh) - 1) / $this->get_total_new_db_update_count($refresh)) * 100; |
|
1108 | + $update_percentage_share = (1 / $this->get_total_new_db_update_count()) * 100; |
|
1109 | + $upgrade_percentage = (($resume_update['percentage'] * $update_percentage_share) / 100); |
|
1114 | 1110 | |
1115 | 1111 | $final_percentage = $update_count_percentages + $upgrade_percentage; |
1116 | 1112 | |
1117 | 1113 | return $this->is_doing_updates() ? |
1118 | - ( absint( $final_percentage ) ? |
|
1119 | - absint( $final_percentage ) : |
|
1120 | - round( $final_percentage, 2 ) |
|
1121 | - ) : |
|
1122 | - 0; |
|
1114 | + (absint($final_percentage) ? |
|
1115 | + absint($final_percentage) : round($final_percentage, 2) |
|
1116 | + ) : 0; |
|
1123 | 1117 | } |
1124 | 1118 | |
1125 | 1119 | |
@@ -1131,8 +1125,8 @@ discard block |
||
1131 | 1125 | * @return array |
1132 | 1126 | */ |
1133 | 1127 | public function get_update_ids() { |
1134 | - $all_updates = $this->get_updates( 'database', 'all' ); |
|
1135 | - $all_update_ids = wp_list_pluck( $all_updates, 'id' ); |
|
1128 | + $all_updates = $this->get_updates('database', 'all'); |
|
1129 | + $all_update_ids = wp_list_pluck($all_updates, 'id'); |
|
1136 | 1130 | |
1137 | 1131 | return $all_update_ids; |
1138 | 1132 | } |
@@ -1147,10 +1141,9 @@ discard block |
||
1147 | 1141 | * |
1148 | 1142 | * @return float|int |
1149 | 1143 | */ |
1150 | - public function get_offset( $process_item_count ) { |
|
1151 | - return ( 1 === $this->step ) ? |
|
1152 | - 0 : |
|
1153 | - ( $this->step - 1 ) * $process_item_count; |
|
1144 | + public function get_offset($process_item_count) { |
|
1145 | + return (1 === $this->step) ? |
|
1146 | + 0 : ($this->step - 1) * $process_item_count; |
|
1154 | 1147 | } |
1155 | 1148 | } |
1156 | 1149 |
@@ -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 | |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @return string |
26 | 26 | */ |
27 | -function give_admin_rate_us( $footer_text ) { |
|
27 | +function give_admin_rate_us($footer_text) { |
|
28 | 28 | global $typenow; |
29 | 29 | |
30 | - if ( 'give_forms' === $typenow ) { |
|
30 | + if ('give_forms' === $typenow) { |
|
31 | 31 | $rate_text = sprintf( |
32 | 32 | /* translators: %s: Link to 5 star rating */ |
33 | - __( 'If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give' ), |
|
34 | - '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" style="text-decoration:none;" data-rated="' . esc_attr__( 'Thanks :)', 'give' ) . '">★★★★★</a>' |
|
33 | + __('If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give'), |
|
34 | + '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" style="text-decoration:none;" data-rated="'.esc_attr__('Thanks :)', 'give').'">★★★★★</a>' |
|
35 | 35 | ); |
36 | 36 | |
37 | 37 | return $rate_text; |
@@ -40,4 +40,4 @@ discard block |
||
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | -add_filter( 'admin_footer_text', 'give_admin_rate_us' ); |
|
43 | +add_filter('admin_footer_text', 'give_admin_rate_us'); |
@@ -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. |
@@ -118,28 +118,28 @@ discard block |
||
118 | 118 | * |
119 | 119 | * @return bool True if Give admin page. |
120 | 120 | */ |
121 | -function give_is_admin_page( $passed_page = '', $passed_view = '' ) { |
|
121 | +function give_is_admin_page($passed_page = '', $passed_view = '') { |
|
122 | 122 | global $pagenow, $typenow; |
123 | 123 | |
124 | 124 | $found = true; |
125 | - $get_query_args = ! empty( $_GET ) ? @array_map( 'strtolower', $_GET ) : array(); |
|
125 | + $get_query_args = ! empty($_GET) ? @array_map('strtolower', $_GET) : array(); |
|
126 | 126 | |
127 | 127 | // Set default argument, if not passed. |
128 | - $query_args = wp_parse_args( $get_query_args, array_fill_keys( array( 'post_type', 'action', 'taxonomy', 'page', 'view', 'tab' ), false ) ); |
|
128 | + $query_args = wp_parse_args($get_query_args, array_fill_keys(array('post_type', 'action', 'taxonomy', 'page', 'view', 'tab'), false)); |
|
129 | 129 | |
130 | - switch ( $passed_page ) { |
|
130 | + switch ($passed_page) { |
|
131 | 131 | case 'categories': |
132 | 132 | case 'tags': |
133 | - $has_view = in_array( $passed_view, array( 'list-table', 'edit', 'new' ), true ); |
|
133 | + $has_view = in_array($passed_view, array('list-table', 'edit', 'new'), true); |
|
134 | 134 | |
135 | 135 | if ( |
136 | - ! in_array( $query_args['taxonomy'], array( 'give_forms_category', 'give_forms_tag' ), true ) && |
|
136 | + ! in_array($query_args['taxonomy'], array('give_forms_category', 'give_forms_tag'), true) && |
|
137 | 137 | 'edit-tags.php' !== $pagenow && |
138 | 138 | ( |
139 | 139 | $has_view || |
140 | 140 | ( |
141 | - ( in_array( $passed_view, array( 'list-table', 'new' ), true ) && 'edit' === $query_args['action'] ) || |
|
142 | - ( 'edit' !== $passed_view && 'edit' !== $query_args['action'] ) && |
|
141 | + (in_array($passed_view, array('list-table', 'new'), true) && 'edit' === $query_args['action']) || |
|
142 | + ('edit' !== $passed_view && 'edit' !== $query_args['action']) && |
|
143 | 143 | ! $has_view |
144 | 144 | ) |
145 | 145 | ) |
@@ -149,18 +149,18 @@ discard block |
||
149 | 149 | break; |
150 | 150 | // Give Donation form page. |
151 | 151 | case 'give_forms': |
152 | - $has_view = in_array( $passed_view, array( 'new', 'list-table', 'edit' ), true ); |
|
152 | + $has_view = in_array($passed_view, array('new', 'list-table', 'edit'), true); |
|
153 | 153 | |
154 | 154 | if ( |
155 | 155 | 'give_forms' !== $typenow && |
156 | 156 | ( |
157 | - ( 'list-table' !== $passed_view && 'edit.php' !== $pagenow ) && |
|
158 | - ( 'edit' !== $passed_view && 'post.php' !== $pagenow ) && |
|
159 | - ( 'new' !== $passed_view && 'post-new.php' !== $pagenow ) |
|
157 | + ('list-table' !== $passed_view && 'edit.php' !== $pagenow) && |
|
158 | + ('edit' !== $passed_view && 'post.php' !== $pagenow) && |
|
159 | + ('new' !== $passed_view && 'post-new.php' !== $pagenow) |
|
160 | 160 | ) || |
161 | 161 | ( |
162 | 162 | ! $has_view && |
163 | - ( 'post-new.php' !== $pagenow && 'give_forms' !== $query_args['post_type'] ) |
|
163 | + ('post-new.php' !== $pagenow && 'give_forms' !== $query_args['post_type']) |
|
164 | 164 | ) |
165 | 165 | ) { |
166 | 166 | $found = false; |
@@ -168,13 +168,13 @@ discard block |
||
168 | 168 | break; |
169 | 169 | // Give Donors page. |
170 | 170 | case 'donors': |
171 | - $has_view = array_intersect( array( $passed_view, $query_args['view'] ), array( 'list-table', 'overview', 'notes' ) ); |
|
171 | + $has_view = array_intersect(array($passed_view, $query_args['view']), array('list-table', 'overview', 'notes')); |
|
172 | 172 | |
173 | 173 | if ( |
174 | - ( 'give-donors' !== $query_args['page'] || 'edit.php' !== $pagenow ) && |
|
174 | + ('give-donors' !== $query_args['page'] || 'edit.php' !== $pagenow) && |
|
175 | 175 | ( |
176 | - ( $passed_view !== $query_args['view'] || ! empty( $has_view ) ) || |
|
177 | - ( false !== $query_args['view'] && 'list-table' !== $passed_view ) |
|
176 | + ($passed_view !== $query_args['view'] || ! empty($has_view)) || |
|
177 | + (false !== $query_args['view'] && 'list-table' !== $passed_view) |
|
178 | 178 | ) |
179 | 179 | ) { |
180 | 180 | $found = false; |
@@ -183,12 +183,12 @@ discard block |
||
183 | 183 | // Give Donations page. |
184 | 184 | case 'payments': |
185 | 185 | if ( |
186 | - ( 'give-payment-history' !== $query_args['page'] || 'edit.php' !== $pagenow ) && |
|
186 | + ('give-payment-history' !== $query_args['page'] || 'edit.php' !== $pagenow) && |
|
187 | 187 | ( |
188 | - ! in_array( $passed_view, array( 'list-table', 'edit' ), true ) || |
|
188 | + ! in_array($passed_view, array('list-table', 'edit'), true) || |
|
189 | 189 | ( |
190 | - ( 'list-table' !== $passed_view && false !== $query_args['view'] ) || |
|
191 | - ( 'edit' !== $passed_view && 'view-payment-details' !== $query_args['view'] ) |
|
190 | + ('list-table' !== $passed_view && false !== $query_args['view']) || |
|
191 | + ('edit' !== $passed_view && 'view-payment-details' !== $query_args['view']) |
|
192 | 192 | ) |
193 | 193 | ) |
194 | 194 | ) { |
@@ -199,20 +199,20 @@ discard block |
||
199 | 199 | case 'settings': |
200 | 200 | case 'addons': |
201 | 201 | // Get current tab. |
202 | - $current_tab = empty( $passed_view ) ? $query_args['tab'] : $passed_view; |
|
203 | - $give_setting_page = in_array( $query_args['page'], array( 'give-reports', 'give-settings', 'give-addons' ), true ); |
|
202 | + $current_tab = empty($passed_view) ? $query_args['tab'] : $passed_view; |
|
203 | + $give_setting_page = in_array($query_args['page'], array('give-reports', 'give-settings', 'give-addons'), true); |
|
204 | 204 | |
205 | 205 | // Check if it's Give Setting page or not. |
206 | 206 | if ( |
207 | - ( 'edit.php' !== $pagenow || ! $give_setting_page ) && |
|
208 | - ! Give_Admin_Settings::is_setting_page( $current_tab ) |
|
207 | + ('edit.php' !== $pagenow || ! $give_setting_page) && |
|
208 | + ! Give_Admin_Settings::is_setting_page($current_tab) |
|
209 | 209 | ) { |
210 | 210 | $found = false; |
211 | 211 | } |
212 | 212 | break; |
213 | 213 | default: |
214 | 214 | 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; |
215 | - $admin_pages = apply_filters( 'give_admin_pages', array( |
|
215 | + $admin_pages = apply_filters('give_admin_pages', array( |
|
216 | 216 | $give_payments_page, |
217 | 217 | $give_settings_page, |
218 | 218 | $give_reports_page, |
@@ -222,11 +222,11 @@ discard block |
||
222 | 222 | $give_donors_page, |
223 | 223 | $give_tools_page, |
224 | 224 | 'widgets.php', |
225 | - ) ); |
|
225 | + )); |
|
226 | 226 | |
227 | - $found = ( 'give_forms' === $typenow || in_array( $pagenow, array_merge( $admin_pages, array( 'index.php', 'post-new.php', 'post.php' ) ), true ) ) ? true : false; |
|
227 | + $found = ('give_forms' === $typenow || in_array($pagenow, array_merge($admin_pages, array('index.php', 'post-new.php', 'post.php')), true)) ? true : false; |
|
228 | 228 | } |
229 | - return (bool) apply_filters( 'give_is_admin_page', $found, $query_args['page'], $query_args['view'], $passed_page, $passed_view ); |
|
229 | + return (bool) apply_filters('give_is_admin_page', $found, $query_args['page'], $query_args['view'], $passed_page, $passed_view); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
@@ -236,37 +236,37 @@ discard block |
||
236 | 236 | * @param array $settings |
237 | 237 | * @return array |
238 | 238 | */ |
239 | -function give_settings_page_pages( $settings ) { |
|
240 | - include( 'abstract-admin-settings-page.php' ); |
|
241 | - include( 'settings/class-settings-cmb2-backward-compatibility.php' ); |
|
239 | +function give_settings_page_pages($settings) { |
|
240 | + include('abstract-admin-settings-page.php'); |
|
241 | + include('settings/class-settings-cmb2-backward-compatibility.php'); |
|
242 | 242 | |
243 | 243 | $settings = array( |
244 | 244 | // General settings. |
245 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-general.php' ), |
|
245 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-general.php'), |
|
246 | 246 | |
247 | 247 | // Payment Gateways Settings. |
248 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-gateways.php' ), |
|
248 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-gateways.php'), |
|
249 | 249 | |
250 | 250 | // Display settings. |
251 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-display.php' ), |
|
251 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-display.php'), |
|
252 | 252 | |
253 | 253 | // Emails settings. |
254 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-email.php' ), |
|
254 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-email.php'), |
|
255 | 255 | |
256 | 256 | // Addons settings. |
257 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-addon.php' ), |
|
257 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-addon.php'), |
|
258 | 258 | |
259 | 259 | // License settings. |
260 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-license.php' ), |
|
260 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-license.php'), |
|
261 | 261 | |
262 | 262 | // Advanced settings. |
263 | - include( GIVE_PLUGIN_DIR . 'includes/admin/settings/class-settings-advanced.php' ), |
|
263 | + include(GIVE_PLUGIN_DIR.'includes/admin/settings/class-settings-advanced.php'), |
|
264 | 264 | ); |
265 | 265 | |
266 | 266 | // Output. |
267 | 267 | return $settings; |
268 | 268 | } |
269 | -add_filter( 'give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1 ); |
|
269 | +add_filter('give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1); |
|
270 | 270 | |
271 | 271 | |
272 | 272 | /** |
@@ -276,25 +276,25 @@ discard block |
||
276 | 276 | * @param array $settings |
277 | 277 | * @return array |
278 | 278 | */ |
279 | -function give_reports_page_pages( $settings ) { |
|
280 | - include( 'abstract-admin-settings-page.php' ); |
|
279 | +function give_reports_page_pages($settings) { |
|
280 | + include('abstract-admin-settings-page.php'); |
|
281 | 281 | |
282 | 282 | $settings = array( |
283 | 283 | // Earnings. |
284 | - include( 'reports/class-earnings-report.php' ), |
|
284 | + include('reports/class-earnings-report.php'), |
|
285 | 285 | |
286 | 286 | // Forms. |
287 | - include( 'reports/class-forms-report.php' ), |
|
287 | + include('reports/class-forms-report.php'), |
|
288 | 288 | |
289 | 289 | // Gateways. |
290 | - include( 'reports/class-gateways-report.php' ), |
|
290 | + include('reports/class-gateways-report.php'), |
|
291 | 291 | |
292 | 292 | ); |
293 | 293 | |
294 | 294 | // Output. |
295 | 295 | return $settings; |
296 | 296 | } |
297 | -add_filter( 'give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1 ); |
|
297 | +add_filter('give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1); |
|
298 | 298 | |
299 | 299 | /** |
300 | 300 | * Add setting tab to give-settings page |
@@ -303,34 +303,34 @@ discard block |
||
303 | 303 | * @param array $settings |
304 | 304 | * @return array |
305 | 305 | */ |
306 | -function give_tools_page_pages( $settings ) { |
|
307 | - include( 'abstract-admin-settings-page.php' ); |
|
306 | +function give_tools_page_pages($settings) { |
|
307 | + include('abstract-admin-settings-page.php'); |
|
308 | 308 | |
309 | 309 | $settings = array( |
310 | 310 | |
311 | 311 | // Export. |
312 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-export.php' ), |
|
312 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-export.php'), |
|
313 | 313 | |
314 | 314 | // Import |
315 | - include_once( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-import.php' ), |
|
315 | + include_once(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-import.php'), |
|
316 | 316 | |
317 | 317 | // Logs. |
318 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-logs.php' ), |
|
318 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-logs.php'), |
|
319 | 319 | |
320 | 320 | // API. |
321 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-api.php' ), |
|
321 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-api.php'), |
|
322 | 322 | |
323 | 323 | // Data. |
324 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-data.php' ), |
|
324 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-data.php'), |
|
325 | 325 | |
326 | 326 | // System Info. |
327 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/class-settings-system-info.php' ), |
|
327 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/class-settings-system-info.php'), |
|
328 | 328 | ); |
329 | 329 | |
330 | 330 | // Output. |
331 | 331 | return $settings; |
332 | 332 | } |
333 | -add_filter( 'give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1 ); |
|
333 | +add_filter('give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1); |
|
334 | 334 | |
335 | 335 | /** |
336 | 336 | * Set default tools page tab. |
@@ -339,10 +339,10 @@ discard block |
||
339 | 339 | * @param string $default_tab Default tab name. |
340 | 340 | * @return string |
341 | 341 | */ |
342 | -function give_set_default_tab_form_tools_page( $default_tab ) { |
|
342 | +function give_set_default_tab_form_tools_page($default_tab) { |
|
343 | 343 | return 'export'; |
344 | 344 | } |
345 | -add_filter( 'give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1 ); |
|
345 | +add_filter('give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1); |
|
346 | 346 | |
347 | 347 | |
348 | 348 | /** |
@@ -352,10 +352,10 @@ discard block |
||
352 | 352 | * @param string $default_tab Default tab name. |
353 | 353 | * @return string |
354 | 354 | */ |
355 | -function give_set_default_tab_form_reports_page( $default_tab ) { |
|
355 | +function give_set_default_tab_form_reports_page($default_tab) { |
|
356 | 356 | return 'earnings'; |
357 | 357 | } |
358 | -add_filter( 'give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1 ); |
|
358 | +add_filter('give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1); |
|
359 | 359 | |
360 | 360 | |
361 | 361 | /** |
@@ -368,19 +368,19 @@ discard block |
||
368 | 368 | * |
369 | 369 | * @return array |
370 | 370 | */ |
371 | -function give_add_display_page_states( $post_states, $post ) { |
|
371 | +function give_add_display_page_states($post_states, $post) { |
|
372 | 372 | |
373 | - switch ( $post->ID ) { |
|
374 | - case give_get_option( 'success_page' ): |
|
375 | - $post_states['give_successfully_page'] = __( 'Donation Success Page', 'give' ); |
|
373 | + switch ($post->ID) { |
|
374 | + case give_get_option('success_page'): |
|
375 | + $post_states['give_successfully_page'] = __('Donation Success Page', 'give'); |
|
376 | 376 | break; |
377 | 377 | |
378 | - case give_get_option( 'failure_page' ): |
|
379 | - $post_states['give_failure_page'] = __( 'Donation Failed Page', 'give' ); |
|
378 | + case give_get_option('failure_page'): |
|
379 | + $post_states['give_failure_page'] = __('Donation Failed Page', 'give'); |
|
380 | 380 | break; |
381 | 381 | |
382 | - case give_get_option( 'history_page' ): |
|
383 | - $post_states['give_history_page'] = __( 'Donation History Page', 'give' ); |
|
382 | + case give_get_option('history_page'): |
|
383 | + $post_states['give_history_page'] = __('Donation History Page', 'give'); |
|
384 | 384 | break; |
385 | 385 | } |
386 | 386 | |
@@ -388,4 +388,4 @@ discard block |
||
388 | 388 | } |
389 | 389 | |
390 | 390 | // Add a post display state for special Give pages. |
391 | -add_filter( 'display_post_states', 'give_add_display_page_states', 10, 2 ); |
|
391 | +add_filter('display_post_states', 'give_add_display_page_states', 10, 2); |
@@ -10,13 +10,13 @@ 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 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | global $status, $page; |
54 | 54 | |
55 | 55 | // Set parent defaults |
56 | - parent::__construct( array( |
|
57 | - 'singular' => esc_html__( 'API Key', 'give' ), // Singular name of the listed records |
|
58 | - 'plural' => esc_html__( 'API Keys', 'give' ), // Plural name of the listed records |
|
56 | + parent::__construct(array( |
|
57 | + 'singular' => esc_html__('API Key', 'give'), // Singular name of the listed records |
|
58 | + 'plural' => esc_html__('API Keys', 'give'), // Plural name of the listed records |
|
59 | 59 | 'ajax' => false, // Does this table support ajax? |
60 | - ) ); |
|
60 | + )); |
|
61 | 61 | |
62 | 62 | $this->query(); |
63 | 63 | } |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return string Column Name |
75 | 75 | */ |
76 | - public function column_default( $item, $column_name ) { |
|
77 | - return $item[ $column_name ]; |
|
76 | + public function column_default($item, $column_name) { |
|
77 | + return $item[$column_name]; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | * |
88 | 88 | * @return string Column Name |
89 | 89 | */ |
90 | - public function column_key( $item ) { |
|
91 | - return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['key'] ) . '"/>'; |
|
90 | + public function column_key($item) { |
|
91 | + return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['key']).'"/>'; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return string Column Name |
103 | 103 | */ |
104 | - public function column_token( $item ) { |
|
105 | - return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['token'] ) . '"/>'; |
|
104 | + public function column_token($item) { |
|
105 | + return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['token']).'"/>'; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @return string Column Name |
117 | 117 | */ |
118 | - public function column_secret( $item ) { |
|
119 | - return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['secret'] ) . '"/>'; |
|
118 | + public function column_secret($item) { |
|
119 | + return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['secret']).'"/>'; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -126,46 +126,46 @@ discard block |
||
126 | 126 | * @since 1.1 |
127 | 127 | * @return string |
128 | 128 | */ |
129 | - public function column_user( $item ) { |
|
129 | + public function column_user($item) { |
|
130 | 130 | |
131 | 131 | $actions = array(); |
132 | 132 | |
133 | - if ( apply_filters( 'give_api_log_requests', true ) ) { |
|
133 | + if (apply_filters('give_api_log_requests', true)) { |
|
134 | 134 | $actions['view'] = sprintf( |
135 | 135 | '<a href="%s">%s</a>', |
136 | - esc_url( add_query_arg( array( |
|
136 | + esc_url(add_query_arg(array( |
|
137 | 137 | 'section' => 'api_requests', |
138 | 138 | 'post_type' => 'give_forms', |
139 | 139 | 'page' => 'give-tools', |
140 | 140 | 'tab' => 'logs', |
141 | 141 | 's' => $item['email'], |
142 | - ), 'edit.php' ) ), |
|
143 | - esc_html__( 'View API Log', 'give' ) |
|
142 | + ), 'edit.php')), |
|
143 | + esc_html__('View API Log', 'give') |
|
144 | 144 | ); |
145 | 145 | } |
146 | 146 | |
147 | 147 | $actions['reissue'] = sprintf( |
148 | 148 | '<a href="%s" class="give-regenerate-api-key">%s</a>', |
149 | - esc_url( wp_nonce_url( add_query_arg( array( |
|
149 | + esc_url(wp_nonce_url(add_query_arg(array( |
|
150 | 150 | 'user_id' => $item['id'], |
151 | 151 | 'give_action' => 'process_api_key', |
152 | 152 | 'give_api_process' => 'regenerate', |
153 | - ) ), 'give-api-nonce' ) ), |
|
154 | - esc_html__( 'Reissue', 'give' ) |
|
153 | + )), 'give-api-nonce')), |
|
154 | + esc_html__('Reissue', 'give') |
|
155 | 155 | ); |
156 | - $actions['revoke'] = sprintf( |
|
156 | + $actions['revoke'] = sprintf( |
|
157 | 157 | '<a href="%s" class="give-revoke-api-key give-delete">%s</a>', |
158 | - esc_url( wp_nonce_url( add_query_arg( array( |
|
158 | + esc_url(wp_nonce_url(add_query_arg(array( |
|
159 | 159 | 'user_id' => $item['id'], |
160 | 160 | 'give_action' => 'process_api_key', |
161 | 161 | 'give_api_process' => 'revoke', |
162 | - ) ), 'give-api-nonce' ) ), |
|
163 | - esc_html__( 'Revoke', 'give' ) |
|
162 | + )), 'give-api-nonce')), |
|
163 | + esc_html__('Revoke', 'give') |
|
164 | 164 | ); |
165 | 165 | |
166 | - $actions = apply_filters( 'give_api_row_actions', array_filter( $actions ) ); |
|
166 | + $actions = apply_filters('give_api_row_actions', array_filter($actions)); |
|
167 | 167 | |
168 | - return sprintf( '%1$s %2$s', $item['user'], $this->row_actions( $actions ) ); |
|
168 | + return sprintf('%1$s %2$s', $item['user'], $this->row_actions($actions)); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -189,10 +189,10 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function get_columns() { |
191 | 191 | $columns = array( |
192 | - 'user' => esc_html__( 'Username', 'give' ), |
|
193 | - 'key' => esc_html__( 'Public Key', 'give' ), |
|
194 | - 'token' => esc_html__( 'Token', 'give' ), |
|
195 | - 'secret' => esc_html__( 'Secret Key', 'give' ), |
|
192 | + 'user' => esc_html__('Username', 'give'), |
|
193 | + 'key' => esc_html__('Public Key', 'give'), |
|
194 | + 'token' => esc_html__('Token', 'give'), |
|
195 | + 'secret' => esc_html__('Secret Key', 'give'), |
|
196 | 196 | ); |
197 | 197 | |
198 | 198 | return $columns; |
@@ -206,20 +206,20 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @param string $which |
208 | 208 | */ |
209 | - protected function display_tablenav( $which ) { |
|
210 | - if ( 'top' === $which ) { |
|
211 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
209 | + protected function display_tablenav($which) { |
|
210 | + if ('top' === $which) { |
|
211 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
212 | 212 | } |
213 | 213 | ?> |
214 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
214 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
215 | 215 | |
216 | 216 | <div class="alignleft actions bulkactions"> |
217 | - <?php $this->bulk_actions( $which ); ?> |
|
217 | + <?php $this->bulk_actions($which); ?> |
|
218 | 218 | </div> |
219 | 219 | |
220 | 220 | <?php |
221 | - $this->extra_tablenav( $which ); |
|
222 | - $this->pagination( $which ); |
|
221 | + $this->extra_tablenav($which); |
|
222 | + $this->pagination($which); |
|
223 | 223 | ?> |
224 | 224 | |
225 | 225 | <br class="clear"/> |
@@ -237,18 +237,18 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @return void |
239 | 239 | */ |
240 | - function bulk_actions( $which = '' ) { |
|
240 | + function bulk_actions($which = '') { |
|
241 | 241 | // These aren't really bulk actions but this outputs the markup in the right place. |
242 | 242 | static $give_api_is_bottom; |
243 | 243 | |
244 | - if ( $give_api_is_bottom ) { |
|
244 | + if ($give_api_is_bottom) { |
|
245 | 245 | return; |
246 | 246 | } |
247 | 247 | ?> |
248 | 248 | <input type="hidden" name="give_action" value="process_api_key"/> |
249 | 249 | <input type="hidden" name="give_api_process" value="generate"/> |
250 | 250 | <?php |
251 | - wp_nonce_field( 'give-api-nonce' ); |
|
251 | + wp_nonce_field('give-api-nonce'); |
|
252 | 252 | /** |
253 | 253 | * API Key user search. |
254 | 254 | */ |
@@ -257,9 +257,9 @@ discard block |
||
257 | 257 | 'name' => 'user_id', |
258 | 258 | ); |
259 | 259 | |
260 | - echo Give()->html->ajax_user_search( $args ); |
|
260 | + echo Give()->html->ajax_user_search($args); |
|
261 | 261 | |
262 | - submit_button( esc_html__( 'Generate New API Keys', 'give' ), 'secondary', 'submit', false ); |
|
262 | + submit_button(esc_html__('Generate New API Keys', 'give'), 'secondary', 'submit', false); |
|
263 | 263 | |
264 | 264 | $give_api_is_bottom = true; |
265 | 265 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * @return int Current page number |
273 | 273 | */ |
274 | 274 | public function get_paged() { |
275 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
275 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
@@ -283,21 +283,21 @@ discard block |
||
283 | 283 | * @return array |
284 | 284 | */ |
285 | 285 | public function query() { |
286 | - $users = get_users( array( |
|
286 | + $users = get_users(array( |
|
287 | 287 | 'meta_value' => 'give_user_secret_key', |
288 | 288 | 'number' => $this->per_page, |
289 | - 'offset' => $this->per_page * ( $this->get_paged() - 1 ), |
|
290 | - ) ); |
|
291 | - $keys = array(); |
|
292 | - |
|
293 | - foreach ( $users as $user ) { |
|
294 | - $keys[ $user->ID ]['id'] = $user->ID; |
|
295 | - $keys[ $user->ID ]['email'] = $user->user_email; |
|
296 | - $keys[ $user->ID ]['user'] = '<a href="' . add_query_arg( 'user_id', $user->ID, 'user-edit.php' ) . '"><strong>' . $user->user_login . '</strong></a>'; |
|
297 | - |
|
298 | - $keys[ $user->ID ]['key'] = Give()->api->get_user_public_key( $user->ID ); |
|
299 | - $keys[ $user->ID ]['secret'] = Give()->api->get_user_secret_key( $user->ID ); |
|
300 | - $keys[ $user->ID ]['token'] = Give()->api->get_token( $user->ID ); |
|
289 | + 'offset' => $this->per_page * ($this->get_paged() - 1), |
|
290 | + )); |
|
291 | + $keys = array(); |
|
292 | + |
|
293 | + foreach ($users as $user) { |
|
294 | + $keys[$user->ID]['id'] = $user->ID; |
|
295 | + $keys[$user->ID]['email'] = $user->user_email; |
|
296 | + $keys[$user->ID]['user'] = '<a href="'.add_query_arg('user_id', $user->ID, 'user-edit.php').'"><strong>'.$user->user_login.'</strong></a>'; |
|
297 | + |
|
298 | + $keys[$user->ID]['key'] = Give()->api->get_user_public_key($user->ID); |
|
299 | + $keys[$user->ID]['secret'] = Give()->api->get_user_secret_key($user->ID); |
|
300 | + $keys[$user->ID]['token'] = Give()->api->get_token($user->ID); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | return $keys; |
@@ -314,9 +314,9 @@ discard block |
||
314 | 314 | public function total_items() { |
315 | 315 | global $wpdb; |
316 | 316 | |
317 | - $total_items = Give_Cache::get( 'give_total_api_keys', true ); |
|
317 | + $total_items = Give_Cache::get('give_total_api_keys', true); |
|
318 | 318 | |
319 | - if ( ! $total_items ) { |
|
319 | + if ( ! $total_items) { |
|
320 | 320 | $total_items = $wpdb->get_var( |
321 | 321 | $wpdb->prepare( |
322 | 322 | "SELECT count(user_id) |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | ) |
326 | 326 | ); |
327 | 327 | |
328 | - Give_Cache::set( 'give_total_api_keys', $total_items, HOUR_IN_SECONDS, true ); |
|
328 | + Give_Cache::set('give_total_api_keys', $total_items, HOUR_IN_SECONDS, true); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | return $total_items; |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | $hidden = array(); // No hidden columns |
345 | 345 | $sortable = array(); // Not sortable... for now |
346 | 346 | |
347 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
347 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
348 | 348 | |
349 | 349 | $data = $this->query(); |
350 | 350 | |
@@ -352,10 +352,10 @@ discard block |
||
352 | 352 | |
353 | 353 | $this->items = $data; |
354 | 354 | |
355 | - $this->set_pagination_args( array( |
|
355 | + $this->set_pagination_args(array( |
|
356 | 356 | 'total_items' => $total_items, |
357 | 357 | 'per_page' => $this->per_page, |
358 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
359 | - ) ); |
|
358 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
359 | + )); |
|
360 | 360 | } |
361 | 361 | } |
@@ -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,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @return string |
27 | 27 | */ |
28 | -function __give_get_format_address( $address, $address_args = array() ) { |
|
28 | +function __give_get_format_address($address, $address_args = array()) { |
|
29 | 29 | $address_html = ''; |
30 | 30 | $address_args = wp_parse_args( |
31 | 31 | $address_args, |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $address_id = $address_args['type']; |
41 | 41 | |
42 | 42 | // Bailout. |
43 | - if ( empty( $address ) || ! is_array( $address ) ) { |
|
43 | + if (empty($address) || ! is_array($address)) { |
|
44 | 44 | return $address_html; |
45 | 45 | } |
46 | 46 | |
@@ -49,19 +49,19 @@ discard block |
||
49 | 49 | $address_html .= sprintf( |
50 | 50 | '<span data-address-type="line1">%1$s</span>%2$s', |
51 | 51 | $address['line1'], |
52 | - ( ! empty( $address['line2'] ) ? '<br>' : '' ) |
|
52 | + ( ! empty($address['line2']) ? '<br>' : '') |
|
53 | 53 | ); |
54 | 54 | $address_html .= sprintf( |
55 | 55 | '<span data-address-type="line2">%1$s</span>%2$s', |
56 | 56 | $address['line2'], |
57 | - ( ! empty( $address['city'] ) ? '<br>' : '' ) |
|
57 | + ( ! empty($address['city']) ? '<br>' : '') |
|
58 | 58 | ); |
59 | 59 | $address_html .= sprintf( |
60 | 60 | '<span data-address-type="city">%1$s</span><span data-address-type="state">%2$s</span><span data-address-type="zip">%3$s</span>%4$s', |
61 | 61 | $address['city'], |
62 | - ( ! empty( $address['state'] ) ? ", {$address['state']}" : '' ), |
|
63 | - ( ! empty( $address['zip'] ) ? " {$address['zip']}" : '' ), |
|
64 | - ( ! empty( $address['country'] ) ? '<br>' : '' ) |
|
62 | + ( ! empty($address['state']) ? ", {$address['state']}" : ''), |
|
63 | + ( ! empty($address['zip']) ? " {$address['zip']}" : ''), |
|
64 | + ( ! empty($address['country']) ? '<br>' : '') |
|
65 | 65 | ); |
66 | 66 | $address_html .= sprintf( |
67 | 67 | '<span data-address-type="country">%s</span><br>', |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | // Address action. |
72 | 72 | $address_html .= sprintf( |
73 | 73 | '<br><a href="#" class="js-edit">%1$s</a> | <a href="#" class="js-remove">%2$s</a>', |
74 | - __( 'Edit', 'give' ), |
|
75 | - __( 'Remove', 'give' ) |
|
74 | + __('Edit', 'give'), |
|
75 | + __('Remove', 'give') |
|
76 | 76 | ); |
77 | 77 | |
78 | 78 | /** |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @since 2.0 |
82 | 82 | */ |
83 | - $address_label = apply_filters( "give_donor_{$address_args['type']}_address_label", ucfirst( $address_args['type'] ), $address_args ); |
|
83 | + $address_label = apply_filters("give_donor_{$address_args['type']}_address_label", ucfirst($address_args['type']), $address_args); |
|
84 | 84 | |
85 | 85 | // Set unique id and index for multi type address. |
86 | - if ( isset( $address_args['index'] ) ) { |
|
86 | + if (isset($address_args['index'])) { |
|
87 | 87 | $address_label = "{$address_label} #{$address_args['index']}"; |
88 | 88 | } |
89 | 89 | |
90 | - if ( isset( $address_args['id'] ) ) { |
|
90 | + if (isset($address_args['id'])) { |
|
91 | 91 | $address_id = "{$address_id}_{$address_args['id']}"; |
92 | 92 | } |
93 | 93 | |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | */ |
113 | 113 | function give_donors_page() { |
114 | 114 | $default_views = give_donor_views(); |
115 | - $requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'donors'; |
|
116 | - if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) { |
|
117 | - give_render_donor_view( $requested_view, $default_views ); |
|
115 | + $requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'donors'; |
|
116 | + if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) { |
|
117 | + give_render_donor_view($requested_view, $default_views); |
|
118 | 118 | } else { |
119 | 119 | give_donors_list(); |
120 | 120 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | $views = array(); |
132 | 132 | |
133 | - return apply_filters( 'give_donor_views', $views ); |
|
133 | + return apply_filters('give_donor_views', $views); |
|
134 | 134 | |
135 | 135 | } |
136 | 136 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | $tabs = array(); |
146 | 146 | |
147 | - return apply_filters( 'give_donor_tabs', $tabs ); |
|
147 | + return apply_filters('give_donor_tabs', $tabs); |
|
148 | 148 | |
149 | 149 | } |
150 | 150 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | function give_donors_list() { |
158 | 158 | |
159 | - include GIVE_PLUGIN_DIR . 'includes/admin/donors/class-donor-table.php'; |
|
159 | + include GIVE_PLUGIN_DIR.'includes/admin/donors/class-donor-table.php'; |
|
160 | 160 | |
161 | 161 | $donors_table = new Give_Donor_List_Table(); |
162 | 162 | $donors_table->prepare_items(); |
@@ -169,12 +169,12 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @since 1.0 |
171 | 171 | */ |
172 | - do_action( 'give_donors_table_top' ); |
|
172 | + do_action('give_donors_table_top'); |
|
173 | 173 | ?> |
174 | 174 | |
175 | 175 | <hr class="wp-header-end"> |
176 | - <form id="give-donors-search-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>"> |
|
177 | - <?php $donors_table->search_box( __( 'Search Donors', 'give' ), 'give-donors' ); ?> |
|
176 | + <form id="give-donors-search-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>"> |
|
177 | + <?php $donors_table->search_box(__('Search Donors', 'give'), 'give-donors'); ?> |
|
178 | 178 | <input type="hidden" name="post_type" value="give_forms" /> |
179 | 179 | <input type="hidden" name="page" value="give-donors" /> |
180 | 180 | <input type="hidden" name="view" value="donors" /> |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * |
192 | 192 | * @since 1.0 |
193 | 193 | */ |
194 | - do_action( 'give_donors_table_bottom' ); |
|
194 | + do_action('give_donors_table_bottom'); |
|
195 | 195 | ?> |
196 | 196 | </div> |
197 | 197 | <?php |
@@ -207,33 +207,33 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @return void |
209 | 209 | */ |
210 | -function give_render_donor_view( $view, $callbacks ) { |
|
210 | +function give_render_donor_view($view, $callbacks) { |
|
211 | 211 | |
212 | 212 | $render = true; |
213 | 213 | |
214 | - $donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' ); |
|
214 | + $donor_view_role = apply_filters('give_view_donors_role', 'view_give_reports'); |
|
215 | 215 | |
216 | - if ( ! current_user_can( $donor_view_role ) ) { |
|
217 | - give_set_error( 'give-no-access', __( 'You are not permitted to view this data.', 'give' ) ); |
|
216 | + if ( ! current_user_can($donor_view_role)) { |
|
217 | + give_set_error('give-no-access', __('You are not permitted to view this data.', 'give')); |
|
218 | 218 | $render = false; |
219 | 219 | } |
220 | 220 | |
221 | - if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
222 | - give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) ); |
|
221 | + if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
222 | + give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give')); |
|
223 | 223 | $render = false; |
224 | 224 | } |
225 | 225 | |
226 | 226 | $donor_id = (int) $_GET['id']; |
227 | - $reconnect_user_id = ! empty( $_GET['user_id'] ) ? (int) $_GET['user_id'] : ''; |
|
228 | - $donor = new Give_Donor( $donor_id ); |
|
227 | + $reconnect_user_id = ! empty($_GET['user_id']) ? (int) $_GET['user_id'] : ''; |
|
228 | + $donor = new Give_Donor($donor_id); |
|
229 | 229 | |
230 | 230 | // Reconnect User with Donor profile. |
231 | - if ( $reconnect_user_id ) { |
|
232 | - give_connect_user_donor_profile( $donor, array( 'user_id' => $reconnect_user_id ), array() ); |
|
231 | + if ($reconnect_user_id) { |
|
232 | + give_connect_user_donor_profile($donor, array('user_id' => $reconnect_user_id), array()); |
|
233 | 233 | } |
234 | 234 | |
235 | - if ( empty( $donor->id ) ) { |
|
236 | - give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) ); |
|
235 | + if (empty($donor->id)) { |
|
236 | + give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give')); |
|
237 | 237 | $render = false; |
238 | 238 | } |
239 | 239 | |
@@ -242,9 +242,9 @@ discard block |
||
242 | 242 | |
243 | 243 | <div class='wrap'> |
244 | 244 | |
245 | - <?php if ( give_get_errors() ) : ?> |
|
245 | + <?php if (give_get_errors()) : ?> |
|
246 | 246 | <div class="error settings-error"> |
247 | - <?php Give()->notices->render_frontend_notices( 0 ); ?> |
|
247 | + <?php Give()->notices->render_frontend_notices(0); ?> |
|
248 | 248 | </div> |
249 | 249 | <?php endif; ?> |
250 | 250 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | <?php |
253 | 253 | printf( |
254 | 254 | /* translators: %s: donor first name */ |
255 | - __( 'Edit Donor: %s %s', 'give' ), |
|
255 | + __('Edit Donor: %s %s', 'give'), |
|
256 | 256 | $donor->get_first_name(), |
257 | 257 | $donor->get_last_name() |
258 | 258 | ); |
@@ -261,26 +261,26 @@ discard block |
||
261 | 261 | |
262 | 262 | <hr class="wp-header-end"> |
263 | 263 | |
264 | - <?php if ( $donor && $render ) : ?> |
|
264 | + <?php if ($donor && $render) : ?> |
|
265 | 265 | |
266 | 266 | <h2 class="nav-tab-wrapper"> |
267 | 267 | <?php |
268 | - foreach ( $donor_tabs as $key => $tab ) : |
|
268 | + foreach ($donor_tabs as $key => $tab) : |
|
269 | 269 | $active = $key === $view ? true : false; |
270 | 270 | $class = $active ? 'nav-tab nav-tab-active' : 'nav-tab'; |
271 | 271 | printf( |
272 | - '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>' . "\n", |
|
273 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $donor->id ) ), |
|
274 | - esc_attr( $class ), |
|
275 | - sanitize_html_class( $tab['dashicon'] ), |
|
276 | - esc_html( $tab['title'] ) |
|
272 | + '<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>'."\n", |
|
273 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$donor->id)), |
|
274 | + esc_attr($class), |
|
275 | + sanitize_html_class($tab['dashicon']), |
|
276 | + esc_html($tab['title']) |
|
277 | 277 | ); |
278 | 278 | endforeach; |
279 | 279 | ?> |
280 | 280 | </h2> |
281 | 281 | |
282 | 282 | <div id="give-donor-card-wrapper"> |
283 | - <?php $callbacks[ $view ]( $donor ) ?> |
|
283 | + <?php $callbacks[$view]($donor) ?> |
|
284 | 284 | </div> |
285 | 285 | |
286 | 286 | <?php endif; ?> |
@@ -300,9 +300,9 @@ discard block |
||
300 | 300 | * |
301 | 301 | * @return void |
302 | 302 | */ |
303 | -function give_donor_view( $donor ) { |
|
303 | +function give_donor_view($donor) { |
|
304 | 304 | |
305 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
305 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
306 | 306 | |
307 | 307 | /** |
308 | 308 | * Fires in donor profile screen, above the donor card. |
@@ -311,11 +311,11 @@ discard block |
||
311 | 311 | * |
312 | 312 | * @param object $donor The donor object being displayed. |
313 | 313 | */ |
314 | - do_action( 'give_donor_card_top', $donor ); |
|
314 | + do_action('give_donor_card_top', $donor); |
|
315 | 315 | |
316 | 316 | // Set Read only to the fields which needs to be locked. |
317 | 317 | $read_only = ''; |
318 | - if ( $donor->user_id ) { |
|
318 | + if ($donor->user_id) { |
|
319 | 319 | $read_only = 'readonly="readonly"'; |
320 | 320 | } |
321 | 321 | ?> |
@@ -323,32 +323,32 @@ discard block |
||
323 | 323 | <div id="donor-summary" class="info-wrapper donor-section postbox"> |
324 | 324 | |
325 | 325 | <form id="edit-donor-info" method="post" |
326 | - action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>"> |
|
326 | + action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>"> |
|
327 | 327 | |
328 | 328 | <div class="donor-info"> |
329 | 329 | |
330 | 330 | <div class="donor-bio-header clearfix"> |
331 | 331 | |
332 | 332 | <div class="avatar-wrap left" id="donor-avatar"> |
333 | - <?php echo get_avatar( $donor->email ); ?> |
|
333 | + <?php echo get_avatar($donor->email); ?> |
|
334 | 334 | </div> |
335 | 335 | |
336 | 336 | <div id="donor-name-wrap" class="left"> |
337 | 337 | <span class="donor-name info-item edit-item"> |
338 | 338 | <input <?php echo $read_only; ?> size="15" data-key="first_name" |
339 | 339 | name="customerinfo[first_name]" type="text" |
340 | - value="<?php esc_attr_e( $donor->get_first_name() ); ?>" |
|
341 | - placeholder="<?php _e( 'First Name', 'give' ); ?>"/> |
|
342 | - <?php if ( $donor->user_id ) : ?> |
|
340 | + value="<?php esc_attr_e($donor->get_first_name()); ?>" |
|
341 | + placeholder="<?php _e('First Name', 'give'); ?>"/> |
|
342 | + <?php if ($donor->user_id) : ?> |
|
343 | 343 | <a href="#" class="give-lock-block"> |
344 | 344 | <i class="give-icon give-icon-locked"></i> |
345 | 345 | </a> |
346 | 346 | <?php endif; ?> |
347 | 347 | <input <?php echo $read_only; ?> size="15" data-key="last_name" |
348 | 348 | name="customerinfo[last_name]" type="text" |
349 | - value="<?php esc_attr_e( $donor->get_last_name() ); ?>" |
|
350 | - placeholder="<?php _e( 'Last Name', 'give' ); ?>"/> |
|
351 | - <?php if ( $donor->user_id ) : ?> |
|
349 | + value="<?php esc_attr_e($donor->get_last_name()); ?>" |
|
350 | + placeholder="<?php _e('Last Name', 'give'); ?>"/> |
|
351 | + <?php if ($donor->user_id) : ?> |
|
352 | 352 | <a href="#" class="give-lock-block"> |
353 | 353 | <i class="give-icon give-icon-locked"></i> |
354 | 354 | </a> |
@@ -358,12 +358,12 @@ discard block |
||
358 | 358 | data-key="name"><?php echo $donor->name; ?></span></span> |
359 | 359 | </div> |
360 | 360 | <p class="donor-since info-item"> |
361 | - <?php _e( 'Donor since', 'give' ); ?> |
|
362 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
361 | + <?php _e('Donor since', 'give'); ?> |
|
362 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
363 | 363 | </p> |
364 | - <?php if ( current_user_can( $donor_edit_role ) ) : ?> |
|
364 | + <?php if (current_user_can($donor_edit_role)) : ?> |
|
365 | 365 | <a href="#" id="edit-donor" |
366 | - class="button info-item editable donor-edit-link"><?php _e( 'Edit Donor', 'give' ); ?></a> |
|
366 | + class="button info-item editable donor-edit-link"><?php _e('Edit Donor', 'give'); ?></a> |
|
367 | 367 | <?php endif; ?> |
368 | 368 | </div> |
369 | 369 | <!-- /donor-bio-header --> |
@@ -373,11 +373,11 @@ discard block |
||
373 | 373 | <table class="widefat striped"> |
374 | 374 | <tbody> |
375 | 375 | <tr> |
376 | - <th scope="col"><label for="tablecell"><?php _e( 'Donor ID:', 'give' ); ?></label></th> |
|
376 | + <th scope="col"><label for="tablecell"><?php _e('Donor ID:', 'give'); ?></label></th> |
|
377 | 377 | <td><?php echo $donor->id; ?></td> |
378 | 378 | </tr> |
379 | 379 | <tr> |
380 | - <th scope="col"><label for="tablecell"><?php _e( 'User ID:', 'give' ); ?></label></th> |
|
380 | + <th scope="col"><label for="tablecell"><?php _e('User ID:', 'give'); ?></label></th> |
|
381 | 381 | <td> |
382 | 382 | <span class="donor-user-id info-item edit-item"> |
383 | 383 | <?php |
@@ -394,22 +394,22 @@ discard block |
||
394 | 394 | 'data' => $data_atts, |
395 | 395 | ); |
396 | 396 | |
397 | - if ( ! empty( $user_id ) ) { |
|
398 | - $userdata = get_userdata( $user_id ); |
|
397 | + if ( ! empty($user_id)) { |
|
398 | + $userdata = get_userdata($user_id); |
|
399 | 399 | $user_args['selected'] = $user_id; |
400 | 400 | } |
401 | 401 | |
402 | - echo Give()->html->ajax_user_search( $user_args ); |
|
402 | + echo Give()->html->ajax_user_search($user_args); |
|
403 | 403 | ?> |
404 | 404 | </span> |
405 | 405 | |
406 | 406 | <span class="donor-user-id info-item editable"> |
407 | - <?php if ( ! empty( $userdata ) ) : ?> |
|
408 | - <span data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span> |
|
407 | + <?php if ( ! empty($userdata)) : ?> |
|
408 | + <span data-key="user_id">#<?php echo $donor->user_id.' - '.$userdata->display_name; ?></span> |
|
409 | 409 | <?php else: ?> |
410 | - <span data-key="user_id"><?php _e( 'Unregistered', 'give' ); ?></span> |
|
410 | + <span data-key="user_id"><?php _e('Unregistered', 'give'); ?></span> |
|
411 | 411 | <?php endif; ?> |
412 | - <?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ): |
|
412 | + <?php if (current_user_can($donor_edit_role) && intval($donor->user_id) > 0): |
|
413 | 413 | |
414 | 414 | echo sprintf( |
415 | 415 | '- <span class="disconnect-user"> |
@@ -418,11 +418,11 @@ discard block |
||
418 | 418 | | <span class="view-user-profile"> |
419 | 419 | <a id="view-user-profile" href="%3$s" aria-label="%4$s">%5$s</a> |
420 | 420 | </span>', |
421 | - __( 'Disconnects the current user ID from this donor record.', 'give' ), |
|
422 | - __( 'Disconnect User', 'give' ), |
|
423 | - 'user-edit.php?user_id=' . $donor->user_id, |
|
424 | - __( 'View User Profile of current user ID.', 'give' ), |
|
425 | - __( 'View User Profile', 'give' ) |
|
421 | + __('Disconnects the current user ID from this donor record.', 'give'), |
|
422 | + __('Disconnect User', 'give'), |
|
423 | + 'user-edit.php?user_id='.$donor->user_id, |
|
424 | + __('View User Profile of current user ID.', 'give'), |
|
425 | + __('View User Profile', 'give') |
|
426 | 426 | ); |
427 | 427 | |
428 | 428 | endif; ?> |
@@ -431,13 +431,13 @@ discard block |
||
431 | 431 | </tr> |
432 | 432 | |
433 | 433 | <?php |
434 | - $donor_company = $donor->get_meta( '_give_donor_company', true ); |
|
434 | + $donor_company = $donor->get_meta('_give_donor_company', true); |
|
435 | 435 | |
436 | - if ( ! empty( $donor_company ) ) { |
|
436 | + if ( ! empty($donor_company)) { |
|
437 | 437 | ?> |
438 | 438 | <tr class="alternate"> |
439 | 439 | <th scope="col"> |
440 | - <label for="tablecell"><?php _e( 'Company Name:', 'give' ); ?></label> |
|
440 | + <label for="tablecell"><?php _e('Company Name:', 'give'); ?></label> |
|
441 | 441 | </th> |
442 | 442 | <td><?php echo $donor_company; ?></td> |
443 | 443 | </tr> |
@@ -453,11 +453,11 @@ discard block |
||
453 | 453 | |
454 | 454 | <span id="donor-edit-actions" class="edit-item"> |
455 | 455 | <input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $donor->id; ?>"/> |
456 | - <?php wp_nonce_field( 'edit-donor', '_wpnonce', false, true ); ?> |
|
456 | + <?php wp_nonce_field('edit-donor', '_wpnonce', false, true); ?> |
|
457 | 457 | <input type="hidden" name="give_action" value="edit-donor"/> |
458 | 458 | <input type="submit" id="give-edit-donor-save" class="button-secondary" |
459 | - value="<?php _e( 'Update Donor', 'give' ); ?>"/> |
|
460 | - <a id="give-edit-donor-cancel" href="" class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
459 | + value="<?php _e('Update Donor', 'give'); ?>"/> |
|
460 | + <a id="give-edit-donor-cancel" href="" class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
461 | 461 | </span> |
462 | 462 | |
463 | 463 | </form> |
@@ -472,24 +472,24 @@ discard block |
||
472 | 472 | * |
473 | 473 | * @param Give_Donor $donor The donor object being displayed. |
474 | 474 | */ |
475 | - do_action( 'give_donor_before_stats', $donor ); |
|
475 | + do_action('give_donor_before_stats', $donor); |
|
476 | 476 | ?> |
477 | 477 | |
478 | 478 | <div id="donor-stats-wrapper" class="donor-section postbox clear"> |
479 | 479 | <ul> |
480 | 480 | <li> |
481 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( $donor->id ) ); ?>"> |
|
481 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint($donor->id)); ?>"> |
|
482 | 482 | <span class="dashicons dashicons-heart"></span> |
483 | 483 | <?php |
484 | 484 | // Completed Donations. |
485 | - $completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give' ), $donor->purchase_count ); |
|
486 | - echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $donor ); |
|
485 | + $completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give'), $donor->purchase_count); |
|
486 | + echo apply_filters('give_donor_completed_donations', $completed_donations_text, $donor); |
|
487 | 487 | ?> |
488 | 488 | </a> |
489 | 489 | </li> |
490 | 490 | <li> |
491 | 491 | <span class="dashicons dashicons-chart-area"></span> |
492 | - <?php echo give_currency_filter( give_format_amount( $donor->get_total_donation_amount(), array( 'sanitize' => false ) ) ); ?> <?php _e( 'Lifetime Donations', 'give' ); ?> |
|
492 | + <?php echo give_currency_filter(give_format_amount($donor->get_total_donation_amount(), array('sanitize' => false))); ?> <?php _e('Lifetime Donations', 'give'); ?> |
|
493 | 493 | </li> |
494 | 494 | <?php |
495 | 495 | /** |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | * |
502 | 502 | * @param object $donor The donor object being displayed. |
503 | 503 | */ |
504 | - do_action( 'give_donor_stats_list', $donor ); |
|
504 | + do_action('give_donor_stats_list', $donor); |
|
505 | 505 | ?> |
506 | 506 | </ul> |
507 | 507 | </div> |
@@ -514,11 +514,11 @@ discard block |
||
514 | 514 | * |
515 | 515 | * @param Give_Donor $donor The donor object being displayed. |
516 | 516 | */ |
517 | - do_action( 'give_donor_before_address', $donor ); |
|
517 | + do_action('give_donor_before_address', $donor); |
|
518 | 518 | ?> |
519 | 519 | |
520 | 520 | <div id="donor-address-wrapper" class="donor-section clear"> |
521 | - <h3><?php _e( 'Addresses', 'give' ); ?></h3> |
|
521 | + <h3><?php _e('Addresses', 'give'); ?></h3> |
|
522 | 522 | |
523 | 523 | <div class="postbox"> |
524 | 524 | <div class="give-spinner-wrapper"> |
@@ -528,16 +528,16 @@ discard block |
||
528 | 528 | <div class="all-address"> |
529 | 529 | <div class="give-grid-row"> |
530 | 530 | <?php |
531 | - if ( ! empty( $donor->address ) ) : |
|
531 | + if ( ! empty($donor->address)) : |
|
532 | 532 | // Default address always will be at zero array index. |
533 | 533 | $is_set_as_default = null; |
534 | 534 | |
535 | - foreach ( $donor->address as $address_type => $addresses ) { |
|
535 | + foreach ($donor->address as $address_type => $addresses) { |
|
536 | 536 | |
537 | - switch ( true ) { |
|
538 | - case is_array( end( $addresses ) ): |
|
537 | + switch (true) { |
|
538 | + case is_array(end($addresses)): |
|
539 | 539 | $index = 1; |
540 | - foreach ( $addresses as $id => $address ) { |
|
540 | + foreach ($addresses as $id => $address) { |
|
541 | 541 | echo __give_get_format_address( |
542 | 542 | $address, |
543 | 543 | array( |
@@ -547,11 +547,11 @@ discard block |
||
547 | 547 | ) |
548 | 548 | ); |
549 | 549 | |
550 | - $index ++; |
|
550 | + $index++; |
|
551 | 551 | } |
552 | 552 | break; |
553 | 553 | |
554 | - case is_string( end( $addresses ) ): |
|
554 | + case is_string(end($addresses)): |
|
555 | 555 | echo __give_get_format_address( |
556 | 556 | $addresses, |
557 | 557 | array( |
@@ -564,13 +564,13 @@ discard block |
||
564 | 564 | endif; |
565 | 565 | ?> |
566 | 566 | </div> |
567 | - <span class="give-no-address-message<?php if ( ! empty( $donor->address ) ) { |
|
567 | + <span class="give-no-address-message<?php if ( ! empty($donor->address)) { |
|
568 | 568 | echo ' give-hidden'; |
569 | 569 | } ?>"> |
570 | - <?php _e( 'This donor does not have any addresses saved.', 'give' ); ?> |
|
570 | + <?php _e('This donor does not have any addresses saved.', 'give'); ?> |
|
571 | 571 | </span> |
572 | 572 | <button class="button add-new-address"> |
573 | - <?php _e( 'Add Address', 'give' ); ?> |
|
573 | + <?php _e('Add Address', 'give'); ?> |
|
574 | 574 | </button> |
575 | 575 | </div> |
576 | 576 | |
@@ -580,26 +580,26 @@ discard block |
||
580 | 580 | <tbody> |
581 | 581 | <tr> |
582 | 582 | <th class="col"> |
583 | - <label class="country"><?php esc_html_e( 'Country:', 'give' ); ?></label> |
|
583 | + <label class="country"><?php esc_html_e('Country:', 'give'); ?></label> |
|
584 | 584 | </th> |
585 | 585 | <td> |
586 | 586 | <?php |
587 | - echo Give()->html->select( array( |
|
587 | + echo Give()->html->select(array( |
|
588 | 588 | 'options' => give_get_country_list(), |
589 | 589 | 'name' => 'country', |
590 | - 'selected' => give_get_option( 'base_country' ), |
|
590 | + 'selected' => give_get_option('base_country'), |
|
591 | 591 | 'show_option_all' => false, |
592 | 592 | 'show_option_none' => false, |
593 | 593 | 'chosen' => true, |
594 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
595 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
596 | - ) ); |
|
594 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
595 | + 'data' => array('search-type' => 'no_ajax'), |
|
596 | + )); |
|
597 | 597 | ?> |
598 | 598 | </td> |
599 | 599 | </tr> |
600 | 600 | <tr> |
601 | 601 | <th class="col"> |
602 | - <label for="line1"><?php esc_html_e( 'Address 1:', 'give' ); ?></label> |
|
602 | + <label for="line1"><?php esc_html_e('Address 1:', 'give'); ?></label> |
|
603 | 603 | </th> |
604 | 604 | <td> |
605 | 605 | <input id="line1" name="line1" type="text" class="medium-text"/> |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | </tr> |
608 | 608 | <tr> |
609 | 609 | <th class="col"> |
610 | - <label for="line2"><?php esc_html_e( 'Address 2:', 'give' ); ?></label> |
|
610 | + <label for="line2"><?php esc_html_e('Address 2:', 'give'); ?></label> |
|
611 | 611 | </th> |
612 | 612 | <td> |
613 | 613 | <input id="line2" type="text" name="line2" value="" class="medium-text"/> |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | </tr> |
617 | 617 | <tr> |
618 | 618 | <th class="col"> |
619 | - <label for="city"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
619 | + <label for="city"><?php esc_html_e('City:', 'give'); ?></label> |
|
620 | 620 | </th> |
621 | 621 | <td> |
622 | 622 | <input id="city" type="text" name="city" value="" class="medium-text"/> |
@@ -624,41 +624,41 @@ discard block |
||
624 | 624 | </tr> |
625 | 625 | <?php |
626 | 626 | $no_states_country = give_no_states_country_list(); |
627 | - $base_country = give_get_option( 'base_country' ); |
|
628 | - if ( ! array_key_exists( $base_country, $no_states_country ) ) { |
|
627 | + $base_country = give_get_option('base_country'); |
|
628 | + if ( ! array_key_exists($base_country, $no_states_country)) { |
|
629 | 629 | ?> |
630 | 630 | <tr class="give-field-wrap"> |
631 | 631 | <th class="col"> |
632 | - <label for="state"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label> |
|
632 | + <label for="state"><?php esc_html_e('State / Province / County:', 'give'); ?></label> |
|
633 | 633 | </th> |
634 | 634 | <td> |
635 | 635 | <?php |
636 | - $states = give_get_states( $base_country ); |
|
636 | + $states = give_get_states($base_country); |
|
637 | 637 | $state_args = array( |
638 | 638 | 'name' => 'state', |
639 | 639 | 'class' => 'regular-text', |
640 | 640 | ); |
641 | 641 | |
642 | - if ( empty( $states ) ) { |
|
642 | + if (empty($states)) { |
|
643 | 643 | |
644 | 644 | // Show Text field, if empty states. |
645 | - $state_args = wp_parse_args( $state_args, array( |
|
646 | - 'value' => give_get_option( 'base_state' ), |
|
647 | - ) ); |
|
648 | - echo Give()->html->text( $state_args ); |
|
645 | + $state_args = wp_parse_args($state_args, array( |
|
646 | + 'value' => give_get_option('base_state'), |
|
647 | + )); |
|
648 | + echo Give()->html->text($state_args); |
|
649 | 649 | } else { |
650 | 650 | |
651 | 651 | // Show Chosen DropDown, if states are not empty. |
652 | - $state_args = wp_parse_args( $state_args, array( |
|
652 | + $state_args = wp_parse_args($state_args, array( |
|
653 | 653 | 'options' => $states, |
654 | - 'selected' => give_get_option( 'base_state' ), |
|
654 | + 'selected' => give_get_option('base_state'), |
|
655 | 655 | 'show_option_all' => false, |
656 | 656 | 'show_option_none' => false, |
657 | 657 | 'chosen' => true, |
658 | - 'placeholder' => __( 'Select a state', 'give' ), |
|
659 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
660 | - ) ); |
|
661 | - echo Give()->html->select( $state_args ); |
|
658 | + 'placeholder' => __('Select a state', 'give'), |
|
659 | + 'data' => array('search-type' => 'no_ajax'), |
|
660 | + )); |
|
661 | + echo Give()->html->select($state_args); |
|
662 | 662 | } |
663 | 663 | ?> |
664 | 664 | </td> |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | ?> |
669 | 669 | <tr> |
670 | 670 | <th class="col"> |
671 | - <label for="zip"><?php esc_html_e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
671 | + <label for="zip"><?php esc_html_e('Zip / Postal Code:', 'give'); ?></label> |
|
672 | 672 | </th> |
673 | 673 | <td> |
674 | 674 | <input id="zip" type="text" name="zip" value="" class="medium-text"/> |
@@ -676,12 +676,12 @@ discard block |
||
676 | 676 | </tr> |
677 | 677 | <tr> |
678 | 678 | <td colspan="2"> |
679 | - <?php wp_nonce_field( 'give-manage-donor-addresses', '_wpnonce', false ); ?> |
|
679 | + <?php wp_nonce_field('give-manage-donor-addresses', '_wpnonce', false); ?> |
|
680 | 680 | <input type="hidden" name="address-action" value="add"> |
681 | 681 | <input type="hidden" name="address-id" value=""> |
682 | 682 | <input type="submit" class="button button-primary js-save" |
683 | - value="<?php _e( 'Save', 'give' ); ?>"> <button |
|
684 | - class="button js-cancel"><?php _e( 'Cancel', 'give' ); ?></button> |
|
683 | + value="<?php _e('Save', 'give'); ?>"> <button |
|
684 | + class="button js-cancel"><?php _e('Cancel', 'give'); ?></button> |
|
685 | 685 | </td> |
686 | 686 | </tr> |
687 | 687 | </tbody> |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | * |
701 | 701 | * @param Give_Donor $donor The donor object being displayed. |
702 | 702 | */ |
703 | - do_action( 'give_donor_before_tables_wrapper', $donor ); |
|
703 | + do_action('give_donor_before_tables_wrapper', $donor); |
|
704 | 704 | ?> |
705 | 705 | |
706 | 706 | <div id="donor-tables-wrapper" class="donor-section"> |
@@ -713,46 +713,46 @@ discard block |
||
713 | 713 | * |
714 | 714 | * @param object $donor The donor object being displayed. |
715 | 715 | */ |
716 | - do_action( 'give_donor_before_tables', $donor ); |
|
716 | + do_action('give_donor_before_tables', $donor); |
|
717 | 717 | ?> |
718 | 718 | |
719 | - <h3><?php _e( 'Donor Emails', 'give' ); ?></h3> |
|
719 | + <h3><?php _e('Donor Emails', 'give'); ?></h3> |
|
720 | 720 | |
721 | 721 | <table class="wp-list-table widefat striped emails"> |
722 | 722 | <thead> |
723 | 723 | <tr> |
724 | - <th><?php _e( 'Email', 'give' ); ?></th> |
|
725 | - <th><?php _e( 'Actions', 'give' ); ?></th> |
|
724 | + <th><?php _e('Email', 'give'); ?></th> |
|
725 | + <th><?php _e('Actions', 'give'); ?></th> |
|
726 | 726 | </tr> |
727 | 727 | </thead> |
728 | 728 | |
729 | 729 | <tbody> |
730 | - <?php if ( ! empty( $donor->emails ) ) { ?> |
|
730 | + <?php if ( ! empty($donor->emails)) { ?> |
|
731 | 731 | |
732 | - <?php foreach ( $donor->emails as $key => $email ) : ?> |
|
732 | + <?php foreach ($donor->emails as $key => $email) : ?> |
|
733 | 733 | <tr data-key="<?php echo $key; ?>"> |
734 | 734 | <td> |
735 | 735 | <?php echo $email; ?> |
736 | - <?php if ( 'primary' === $key ) : ?> |
|
736 | + <?php if ('primary' === $key) : ?> |
|
737 | 737 | <span class="dashicons dashicons-star-filled primary-email-icon"></span> |
738 | 738 | <?php endif; ?> |
739 | 739 | </td> |
740 | 740 | <td> |
741 | - <?php if ( 'primary' !== $key ) : ?> |
|
741 | + <?php if ('primary' !== $key) : ?> |
|
742 | 742 | <?php |
743 | - $base_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); |
|
744 | - $promote_url = wp_nonce_url( add_query_arg( array( |
|
745 | - 'email' => rawurlencode( $email ), |
|
743 | + $base_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); |
|
744 | + $promote_url = wp_nonce_url(add_query_arg(array( |
|
745 | + 'email' => rawurlencode($email), |
|
746 | 746 | 'give_action' => 'set_donor_primary_email', |
747 | - ), $base_url ), 'give-set-donor-primary-email' ); |
|
748 | - $remove_url = wp_nonce_url( add_query_arg( array( |
|
749 | - 'email' => rawurlencode( $email ), |
|
747 | + ), $base_url), 'give-set-donor-primary-email'); |
|
748 | + $remove_url = wp_nonce_url(add_query_arg(array( |
|
749 | + 'email' => rawurlencode($email), |
|
750 | 750 | 'give_action' => 'remove_donor_email', |
751 | - ), $base_url ), 'give-remove-donor-email' ); |
|
751 | + ), $base_url), 'give-remove-donor-email'); |
|
752 | 752 | ?> |
753 | - <a href="<?php echo $promote_url; ?>"><?php _e( 'Make Primary', 'give' ); ?></a> |
|
753 | + <a href="<?php echo $promote_url; ?>"><?php _e('Make Primary', 'give'); ?></a> |
|
754 | 754 | | |
755 | - <a href="<?php echo $remove_url; ?>" class="delete"><?php _e( 'Remove', 'give' ); ?></a> |
|
755 | + <a href="<?php echo $remove_url; ?>" class="delete"><?php _e('Remove', 'give'); ?></a> |
|
756 | 756 | <?php endif; ?> |
757 | 757 | </td> |
758 | 758 | </tr> |
@@ -762,14 +762,14 @@ discard block |
||
762 | 762 | <td colspan="2" class="add-donor-email-td"> |
763 | 763 | <div class="add-donor-email-wrapper"> |
764 | 764 | <input type="hidden" name="donor-id" value="<?php echo $donor->id; ?>"/> |
765 | - <?php wp_nonce_field( 'give_add_donor_email', 'add_email_nonce', false, true ); ?> |
|
765 | + <?php wp_nonce_field('give_add_donor_email', 'add_email_nonce', false, true); ?> |
|
766 | 766 | <input type="email" name="additional-email" value="" |
767 | - placeholder="<?php _e( 'Email Address', 'give' ); ?>"/> |
|
767 | + placeholder="<?php _e('Email Address', 'give'); ?>"/> |
|
768 | 768 | <input type="checkbox" name="make-additional-primary" value="1" |
769 | 769 | id="make-additional-primary"/> <label |
770 | - for="make-additional-primary"><?php _e( 'Make Primary', 'give' ); ?></label> |
|
770 | + for="make-additional-primary"><?php _e('Make Primary', 'give'); ?></label> |
|
771 | 771 | <button class="button-secondary give-add-donor-email" |
772 | - id="add-donor-email"><?php _e( 'Add Email', 'give' ); ?></button> |
|
772 | + id="add-donor-email"><?php _e('Add Email', 'give'); ?></button> |
|
773 | 773 | <span class="spinner"></span> |
774 | 774 | </div> |
775 | 775 | <div class="notice-wrap"></div> |
@@ -777,50 +777,50 @@ discard block |
||
777 | 777 | </tr> |
778 | 778 | <?php } else { ?> |
779 | 779 | <tr> |
780 | - <td colspan="2"><?php _e( 'No Emails Found', 'give' ); ?></td> |
|
780 | + <td colspan="2"><?php _e('No Emails Found', 'give'); ?></td> |
|
781 | 781 | </tr> |
782 | 782 | <?php }// End if(). |
783 | 783 | ?> |
784 | 784 | </tbody> |
785 | 785 | </table> |
786 | 786 | |
787 | - <h3><?php _e( 'Recent Donations', 'give' ); ?></h3> |
|
787 | + <h3><?php _e('Recent Donations', 'give'); ?></h3> |
|
788 | 788 | <?php |
789 | - $payment_ids = explode( ',', $donor->payment_ids ); |
|
790 | - $payments = give_get_payments( array( |
|
789 | + $payment_ids = explode(',', $donor->payment_ids); |
|
790 | + $payments = give_get_payments(array( |
|
791 | 791 | 'post__in' => $payment_ids, |
792 | - ) ); |
|
793 | - $payments = array_slice( $payments, 0, 10 ); |
|
792 | + )); |
|
793 | + $payments = array_slice($payments, 0, 10); |
|
794 | 794 | ?> |
795 | 795 | <table class="wp-list-table widefat striped payments"> |
796 | 796 | <thead> |
797 | 797 | <tr> |
798 | - <th scope="col"><?php _e( 'ID', 'give' ); ?></th> |
|
799 | - <th scope="col"><?php _e( 'Amount', 'give' ); ?></th> |
|
800 | - <th scope="col"><?php _e( 'Date', 'give' ); ?></th> |
|
801 | - <th scope="col"><?php _e( 'Status', 'give' ); ?></th> |
|
802 | - <th scope="col"><?php _e( 'Actions', 'give' ); ?></th> |
|
798 | + <th scope="col"><?php _e('ID', 'give'); ?></th> |
|
799 | + <th scope="col"><?php _e('Amount', 'give'); ?></th> |
|
800 | + <th scope="col"><?php _e('Date', 'give'); ?></th> |
|
801 | + <th scope="col"><?php _e('Status', 'give'); ?></th> |
|
802 | + <th scope="col"><?php _e('Actions', 'give'); ?></th> |
|
803 | 803 | </tr> |
804 | 804 | </thead> |
805 | 805 | <tbody> |
806 | - <?php if ( ! empty( $payments ) ) { ?> |
|
807 | - <?php foreach ( $payments as $payment ) : ?> |
|
806 | + <?php if ( ! empty($payments)) { ?> |
|
807 | + <?php foreach ($payments as $payment) : ?> |
|
808 | 808 | <tr> |
809 | - <td><?php echo Give()->seq_donation_number->get_serial_code( $payment->ID ); ?></td> |
|
810 | - <td><?php echo give_donation_amount( $payment->ID, array( 'currency' => true, 'amount' => true, 'type' => 'donor' ) ); ?></td> |
|
811 | - <td><?php echo date_i18n( give_date_format(), strtotime( $payment->post_date ) ); ?></td> |
|
812 | - <td><?php echo give_get_payment_status( $payment, true ); ?></td> |
|
809 | + <td><?php echo Give()->seq_donation_number->get_serial_code($payment->ID); ?></td> |
|
810 | + <td><?php echo give_donation_amount($payment->ID, array('currency' => true, 'amount' => true, 'type' => 'donor')); ?></td> |
|
811 | + <td><?php echo date_i18n(give_date_format(), strtotime($payment->post_date)); ?></td> |
|
812 | + <td><?php echo give_get_payment_status($payment, true); ?></td> |
|
813 | 813 | <td> |
814 | 814 | <?php |
815 | 815 | printf( |
816 | 816 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
817 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment->ID ), |
|
817 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment->ID), |
|
818 | 818 | sprintf( |
819 | 819 | /* translators: %s: Donation ID */ |
820 | - esc_attr__( 'View Donation %s.', 'give' ), |
|
820 | + esc_attr__('View Donation %s.', 'give'), |
|
821 | 821 | $payment->ID |
822 | 822 | ), |
823 | - __( 'View Donation', 'give' ) |
|
823 | + __('View Donation', 'give') |
|
824 | 824 | ); |
825 | 825 | ?> |
826 | 826 | |
@@ -835,47 +835,47 @@ discard block |
||
835 | 835 | * @param object $donor The donor object being displayed. |
836 | 836 | * @param object $payment The payment object being displayed. |
837 | 837 | */ |
838 | - do_action( 'give_donor_recent_purchases_actions', $donor, $payment ); |
|
838 | + do_action('give_donor_recent_purchases_actions', $donor, $payment); |
|
839 | 839 | ?> |
840 | 840 | </td> |
841 | 841 | </tr> |
842 | 842 | <?php endforeach; ?> |
843 | 843 | <?php } else { ?> |
844 | 844 | <tr> |
845 | - <td colspan="5"><?php _e( 'No donations found.', 'give' ); ?></td> |
|
845 | + <td colspan="5"><?php _e('No donations found.', 'give'); ?></td> |
|
846 | 846 | </tr> |
847 | 847 | <?php }// End if(). |
848 | 848 | ?> |
849 | 849 | </tbody> |
850 | 850 | </table> |
851 | 851 | |
852 | - <h3><?php _e( 'Completed Forms', 'give' ); ?></h3> |
|
852 | + <h3><?php _e('Completed Forms', 'give'); ?></h3> |
|
853 | 853 | <?php |
854 | - $donations = give_get_users_completed_donations( $donor->email ); |
|
854 | + $donations = give_get_users_completed_donations($donor->email); |
|
855 | 855 | ?> |
856 | 856 | <table class="wp-list-table widefat striped donations"> |
857 | 857 | <thead> |
858 | 858 | <tr> |
859 | - <th scope="col"><?php _e( 'Form', 'give' ); ?></th> |
|
860 | - <th scope="col" width="120px"><?php _e( 'Actions', 'give' ); ?></th> |
|
859 | + <th scope="col"><?php _e('Form', 'give'); ?></th> |
|
860 | + <th scope="col" width="120px"><?php _e('Actions', 'give'); ?></th> |
|
861 | 861 | </tr> |
862 | 862 | </thead> |
863 | 863 | <tbody> |
864 | - <?php if ( ! empty( $donations ) ) { ?> |
|
865 | - <?php foreach ( $donations as $donation ) : ?> |
|
864 | + <?php if ( ! empty($donations)) { ?> |
|
865 | + <?php foreach ($donations as $donation) : ?> |
|
866 | 866 | <tr> |
867 | 867 | <td><?php echo $donation->post_title; ?></td> |
868 | 868 | <td> |
869 | 869 | <?php |
870 | 870 | printf( |
871 | 871 | '<a href="%1$s" aria-label="%2$s">%3$s</a>', |
872 | - esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ), |
|
872 | + esc_url(admin_url('post.php?action=edit&post='.$donation->ID)), |
|
873 | 873 | sprintf( |
874 | 874 | /* translators: %s: form name */ |
875 | - esc_attr__( 'View Form %s.', 'give' ), |
|
875 | + esc_attr__('View Form %s.', 'give'), |
|
876 | 876 | $donation->post_title |
877 | 877 | ), |
878 | - __( 'View Form', 'give' ) |
|
878 | + __('View Form', 'give') |
|
879 | 879 | ); |
880 | 880 | ?> |
881 | 881 | </td> |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | <?php endforeach; ?> |
884 | 884 | <?php } else { ?> |
885 | 885 | <tr> |
886 | - <td colspan="2"><?php _e( 'No completed donations found.', 'give' ); ?></td> |
|
886 | + <td colspan="2"><?php _e('No completed donations found.', 'give'); ?></td> |
|
887 | 887 | </tr> |
888 | 888 | <?php } ?> |
889 | 889 | </tbody> |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | * |
898 | 898 | * @param object $donor The donor object being displayed. |
899 | 899 | */ |
900 | - do_action( 'give_donor_after_tables', $donor ); |
|
900 | + do_action('give_donor_after_tables', $donor); |
|
901 | 901 | ?> |
902 | 902 | |
903 | 903 | </div> |
@@ -910,7 +910,7 @@ discard block |
||
910 | 910 | * |
911 | 911 | * @param object $donor The donor object being displayed. |
912 | 912 | */ |
913 | - do_action( 'give_donor_card_bottom', $donor ); |
|
913 | + do_action('give_donor_card_bottom', $donor); |
|
914 | 914 | |
915 | 915 | } |
916 | 916 | |
@@ -923,31 +923,31 @@ discard block |
||
923 | 923 | * |
924 | 924 | * @return void |
925 | 925 | */ |
926 | -function give_donor_notes_view( $donor ) { |
|
926 | +function give_donor_notes_view($donor) { |
|
927 | 927 | |
928 | - $paged = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1; |
|
929 | - $paged = absint( $paged ); |
|
928 | + $paged = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1; |
|
929 | + $paged = absint($paged); |
|
930 | 930 | $note_count = $donor->get_notes_count(); |
931 | - $per_page = apply_filters( 'give_donor_notes_per_page', 20 ); |
|
932 | - $total_pages = ceil( $note_count / $per_page ); |
|
933 | - $donor_notes = $donor->get_notes( $per_page, $paged ); |
|
931 | + $per_page = apply_filters('give_donor_notes_per_page', 20); |
|
932 | + $total_pages = ceil($note_count / $per_page); |
|
933 | + $donor_notes = $donor->get_notes($per_page, $paged); |
|
934 | 934 | ?> |
935 | 935 | |
936 | 936 | <div id="donor-notes-wrapper"> |
937 | 937 | <div class="donor-notes-header"> |
938 | - <?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span> |
|
938 | + <?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span> |
|
939 | 939 | </div> |
940 | - <h3><?php _e( 'Notes', 'give' ); ?></h3> |
|
940 | + <h3><?php _e('Notes', 'give'); ?></h3> |
|
941 | 941 | |
942 | - <?php if ( 1 == $paged ) : ?> |
|
942 | + <?php if (1 == $paged) : ?> |
|
943 | 943 | <div style="display: block; margin-bottom: 55px;"> |
944 | 944 | <form id="give-add-donor-note" method="post" |
945 | - action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor->id ); ?>"> |
|
945 | + action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor->id); ?>"> |
|
946 | 946 | <textarea id="donor-note" name="donor_note" class="donor-note-input" rows="10"></textarea> |
947 | 947 | <br/> |
948 | 948 | <input type="hidden" id="donor-id" name="customer_id" value="<?php echo $donor->id; ?>"/> |
949 | 949 | <input type="hidden" name="give_action" value="add-donor-note"/> |
950 | - <?php wp_nonce_field( 'add-donor-note', 'add_donor_note_nonce', true, true ); ?> |
|
950 | + <?php wp_nonce_field('add-donor-note', 'add_donor_note_nonce', true, true); ?> |
|
951 | 951 | <input id="add-donor-note" class="right button-primary" type="submit" value="Add Note"/> |
952 | 952 | </form> |
953 | 953 | </div> |
@@ -962,26 +962,26 @@ discard block |
||
962 | 962 | 'show_all' => true, |
963 | 963 | ); |
964 | 964 | |
965 | - echo paginate_links( $pagination_args ); |
|
965 | + echo paginate_links($pagination_args); |
|
966 | 966 | ?> |
967 | 967 | |
968 | 968 | <div id="give-donor-notes" class="postbox"> |
969 | - <?php if ( count( $donor_notes ) > 0 ) { ?> |
|
970 | - <?php foreach ( $donor_notes as $key => $note ) : ?> |
|
969 | + <?php if (count($donor_notes) > 0) { ?> |
|
970 | + <?php foreach ($donor_notes as $key => $note) : ?> |
|
971 | 971 | <div class="donor-note-wrapper dashboard-comment-wrap comment-item"> |
972 | 972 | <span class="note-content-wrap"> |
973 | - <?php echo stripslashes( $note ); ?> |
|
973 | + <?php echo stripslashes($note); ?> |
|
974 | 974 | </span> |
975 | 975 | </div> |
976 | 976 | <?php endforeach; ?> |
977 | 977 | <?php } else { ?> |
978 | 978 | <div class="give-no-donor-notes"> |
979 | - <?php _e( 'No donor notes found.', 'give' ); ?> |
|
979 | + <?php _e('No donor notes found.', 'give'); ?> |
|
980 | 980 | </div> |
981 | 981 | <?php } ?> |
982 | 982 | </div> |
983 | 983 | |
984 | - <?php echo paginate_links( $pagination_args ); ?> |
|
984 | + <?php echo paginate_links($pagination_args); ?> |
|
985 | 985 | |
986 | 986 | </div> |
987 | 987 | |
@@ -997,9 +997,9 @@ discard block |
||
997 | 997 | * |
998 | 998 | * @return void |
999 | 999 | */ |
1000 | -function give_donor_delete_view( $donor ) { |
|
1000 | +function give_donor_delete_view($donor) { |
|
1001 | 1001 | |
1002 | - $donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' ); |
|
1002 | + $donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments'); |
|
1003 | 1003 | |
1004 | 1004 | /** |
1005 | 1005 | * Fires in donor delete screen, above the content. |
@@ -1008,16 +1008,16 @@ discard block |
||
1008 | 1008 | * |
1009 | 1009 | * @param object $donor The donor object being displayed. |
1010 | 1010 | */ |
1011 | - do_action( 'give_donor_delete_top', $donor ); |
|
1011 | + do_action('give_donor_delete_top', $donor); |
|
1012 | 1012 | ?> |
1013 | 1013 | |
1014 | 1014 | <div class="info-wrapper donor-section"> |
1015 | 1015 | |
1016 | 1016 | <form id="delete-donor" method="post" |
1017 | - action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor->id ); ?>"> |
|
1017 | + action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$donor->id); ?>"> |
|
1018 | 1018 | |
1019 | 1019 | <div class="donor-notes-header"> |
1020 | - <?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span> |
|
1020 | + <?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span> |
|
1021 | 1021 | </div> |
1022 | 1022 | |
1023 | 1023 | |
@@ -1025,20 +1025,20 @@ discard block |
||
1025 | 1025 | |
1026 | 1026 | <span class="delete-donor-options"> |
1027 | 1027 | <p> |
1028 | - <?php echo Give()->html->checkbox( array( |
|
1028 | + <?php echo Give()->html->checkbox(array( |
|
1029 | 1029 | 'name' => 'give-donor-delete-confirm', |
1030 | - ) ); ?> |
|
1031 | - <label for="give-donor-delete-confirm"><?php _e( 'Are you sure you want to delete this donor?', 'give' ); ?></label> |
|
1030 | + )); ?> |
|
1031 | + <label for="give-donor-delete-confirm"><?php _e('Are you sure you want to delete this donor?', 'give'); ?></label> |
|
1032 | 1032 | </p> |
1033 | 1033 | |
1034 | 1034 | <p> |
1035 | - <?php echo Give()->html->checkbox( array( |
|
1035 | + <?php echo Give()->html->checkbox(array( |
|
1036 | 1036 | 'name' => 'give-donor-delete-records', |
1037 | 1037 | 'options' => array( |
1038 | 1038 | 'disabled' => true, |
1039 | 1039 | ), |
1040 | - ) ); ?> |
|
1041 | - <label for="give-donor-delete-records"><?php _e( 'Delete all associated donations and records?', 'give' ); ?></label> |
|
1040 | + )); ?> |
|
1041 | + <label for="give-donor-delete-records"><?php _e('Delete all associated donations and records?', 'give'); ?></label> |
|
1042 | 1042 | </p> |
1043 | 1043 | |
1044 | 1044 | <?php |
@@ -1051,19 +1051,19 @@ discard block |
||
1051 | 1051 | * |
1052 | 1052 | * @param object $donor The donor object being displayed. |
1053 | 1053 | */ |
1054 | - do_action( 'give_donor_delete_inputs', $donor ); |
|
1054 | + do_action('give_donor_delete_inputs', $donor); |
|
1055 | 1055 | ?> |
1056 | 1056 | </span> |
1057 | 1057 | |
1058 | 1058 | <span id="donor-edit-actions"> |
1059 | 1059 | <input type="hidden" name="customer_id" value="<?php echo $donor->id; ?>"/> |
1060 | - <?php wp_nonce_field( 'delete-donor', '_wpnonce', false, true ); ?> |
|
1060 | + <?php wp_nonce_field('delete-donor', '_wpnonce', false, true); ?> |
|
1061 | 1061 | <input type="hidden" name="give_action" value="delete-donor"/> |
1062 | 1062 | <input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary" |
1063 | - value="<?php _e( 'Delete Donor', 'give' ); ?>"/> |
|
1063 | + value="<?php _e('Delete Donor', 'give'); ?>"/> |
|
1064 | 1064 | <a id="give-delete-donor-cancel" |
1065 | - href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>" |
|
1066 | - class="delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
1065 | + href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>" |
|
1066 | + class="delete"><?php _e('Cancel', 'give'); ?></a> |
|
1067 | 1067 | </span> |
1068 | 1068 | |
1069 | 1069 | </div> |
@@ -1079,5 +1079,5 @@ discard block |
||
1079 | 1079 | * |
1080 | 1080 | * @param object $donor The donor object being displayed. |
1081 | 1081 | */ |
1082 | - do_action( 'give_donor_delete_bottom', $donor ); |
|
1082 | + do_action('give_donor_delete_bottom', $donor); |
|
1083 | 1083 | } |
@@ -406,8 +406,11 @@ |
||
406 | 406 | <span class="donor-user-id info-item editable"> |
407 | 407 | <?php if ( ! empty( $userdata ) ) : ?> |
408 | 408 | <span data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span> |
409 | - <?php else: ?> |
|
410 | - <span data-key="user_id"><?php _e( 'Unregistered', 'give' ); ?></span> |
|
409 | + <?php else { |
|
410 | + : ?> |
|
411 | + <span data-key="user_id"><?php _e( 'Unregistered', 'give' ); |
|
412 | +} |
|
413 | +?></span> |
|
411 | 414 | <?php endif; ?> |
412 | 415 | <?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ): |
413 | 416 |