@@ -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_License' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_License')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_License. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'licenses'; |
30 | - $this->label = esc_html__( 'Licenses', 'give' ); |
|
30 | + $this->label = esc_html__('Licenses', 'give'); |
|
31 | 31 | |
32 | 32 | parent::__construct(); |
33 | 33 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * Filter the licenses settings. |
46 | 46 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
47 | 47 | */ |
48 | - $settings = apply_filters( 'give_settings_licenses', $settings ); |
|
48 | + $settings = apply_filters('give_settings_licenses', $settings); |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * Filter the settings. |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @param array $settings |
56 | 56 | */ |
57 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
57 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
58 | 58 | |
59 | 59 | // Output. |
60 | 60 | return $settings; |
@@ -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,55 +53,55 @@ 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' => __( 'Display Settings Docs Link', 'give' ), |
|
101 | + 'name' => __('Display Settings Docs Link', 'give'), |
|
102 | 102 | 'id' => 'display_settings_docs_link', |
103 | - 'url' => esc_url( 'http://docs.givewp.com/form-display-options' ), |
|
104 | - 'title' => __( 'Display Options Settings', 'give' ), |
|
103 | + 'url' => esc_url('http://docs.givewp.com/form-display-options'), |
|
104 | + 'title' => __('Display Options Settings', 'give'), |
|
105 | 105 | 'type' => 'give_docs_link', |
106 | 106 | ), |
107 | 107 | array( |
@@ -118,78 +118,78 @@ discard block |
||
118 | 118 | 'type' => 'title', |
119 | 119 | ), |
120 | 120 | array( |
121 | - 'name' => __( 'Form Single Views', 'give' ), |
|
122 | - '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' ), |
|
121 | + 'name' => __('Form Single Views', 'give'), |
|
122 | + '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'), |
|
123 | 123 | 'id' => 'forms_singular', |
124 | 124 | 'type' => 'radio_inline', |
125 | 125 | 'default' => 'enabled', |
126 | 126 | 'options' => array( |
127 | - 'enabled' => __( 'Enabled', 'give' ), |
|
128 | - 'disabled' => __( 'Disabled', 'give' ), |
|
127 | + 'enabled' => __('Enabled', 'give'), |
|
128 | + 'disabled' => __('Disabled', 'give'), |
|
129 | 129 | ), |
130 | 130 | ), |
131 | 131 | array( |
132 | - 'name' => __( 'Form Archives', 'give' ), |
|
133 | - '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( |
|
132 | + 'name' => __('Form Archives', 'give'), |
|
133 | + '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( |
|
134 | 134 | 'a' => array( |
135 | 135 | 'href' => array(), |
136 | 136 | 'target' => array(), |
137 | 137 | ), |
138 | - ) ), esc_url( admin_url( 'options-permalink.php' ) ) ), |
|
138 | + )), esc_url(admin_url('options-permalink.php'))), |
|
139 | 139 | 'id' => 'forms_archives', |
140 | 140 | 'type' => 'radio_inline', |
141 | 141 | 'default' => 'enabled', |
142 | 142 | 'options' => array( |
143 | - 'enabled' => __( 'Enabled', 'give' ), |
|
144 | - 'disabled' => __( 'Disabled', 'give' ), |
|
143 | + 'enabled' => __('Enabled', 'give'), |
|
144 | + 'disabled' => __('Disabled', 'give'), |
|
145 | 145 | ), |
146 | 146 | ), |
147 | 147 | array( |
148 | - 'name' => __( 'Form Excerpts', 'give' ), |
|
149 | - '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' ), |
|
148 | + 'name' => __('Form Excerpts', 'give'), |
|
149 | + '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'), |
|
150 | 150 | 'id' => 'forms_excerpt', |
151 | 151 | 'type' => 'radio_inline', |
152 | 152 | 'default' => 'enabled', |
153 | 153 | 'options' => array( |
154 | - 'enabled' => __( 'Enabled', 'give' ), |
|
155 | - 'disabled' => __( 'Disabled', 'give' ), |
|
154 | + 'enabled' => __('Enabled', 'give'), |
|
155 | + 'disabled' => __('Disabled', 'give'), |
|
156 | 156 | ), |
157 | 157 | ), |
158 | 158 | array( |
159 | - 'name' => __( 'Form Featured Image', 'give' ), |
|
160 | - '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' ), |
|
159 | + 'name' => __('Form Featured Image', 'give'), |
|
160 | + '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'), |
|
161 | 161 | 'id' => 'form_featured_img', |
162 | 162 | 'type' => 'radio_inline', |
163 | 163 | 'default' => 'enabled', |
164 | 164 | 'options' => array( |
165 | - 'enabled' => __( 'Enabled', 'give' ), |
|
166 | - 'disabled' => __( 'Disabled', 'give' ), |
|
165 | + 'enabled' => __('Enabled', 'give'), |
|
166 | + 'disabled' => __('Disabled', 'give'), |
|
167 | 167 | ), |
168 | 168 | ), |
169 | 169 | array( |
170 | - 'name' => __( 'Featured Image Size', 'give' ), |
|
171 | - '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' ), |
|
170 | + 'name' => __('Featured Image Size', 'give'), |
|
171 | + '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'), |
|
172 | 172 | 'id' => 'featured_image_size', |
173 | 173 | 'type' => 'select', |
174 | 174 | 'default' => 'large', |
175 | 175 | 'options' => give_get_featured_image_sizes(), |
176 | 176 | ), |
177 | 177 | array( |
178 | - 'name' => __( 'Single Form Sidebar', 'give' ), |
|
179 | - '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' ), |
|
178 | + 'name' => __('Single Form Sidebar', 'give'), |
|
179 | + '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'), |
|
180 | 180 | 'id' => 'form_sidebar', |
181 | 181 | 'type' => 'radio_inline', |
182 | 182 | 'default' => 'enabled', |
183 | 183 | 'options' => array( |
184 | - 'enabled' => __( 'Enabled', 'give' ), |
|
185 | - 'disabled' => __( 'Disabled', 'give' ), |
|
184 | + 'enabled' => __('Enabled', 'give'), |
|
185 | + 'disabled' => __('Disabled', 'give'), |
|
186 | 186 | ), |
187 | 187 | ), |
188 | 188 | array( |
189 | - 'name' => __( 'Post Types Docs Link', 'give' ), |
|
189 | + 'name' => __('Post Types Docs Link', 'give'), |
|
190 | 190 | 'id' => 'post_types_settings_docs_link', |
191 | - 'url' => esc_url( 'http://docs.givewp.com/settings-post-types' ), |
|
192 | - 'title' => __( 'Post Types Settings', 'give' ), |
|
191 | + 'url' => esc_url('http://docs.givewp.com/settings-post-types'), |
|
192 | + 'title' => __('Post Types Settings', 'give'), |
|
193 | 193 | 'type' => 'give_docs_link', |
194 | 194 | ), |
195 | 195 | array( |
@@ -206,32 +206,32 @@ discard block |
||
206 | 206 | 'type' => 'title', |
207 | 207 | ), |
208 | 208 | array( |
209 | - 'name' => __( 'Form Categories', 'give' ), |
|
210 | - 'desc' => __( 'Enable Categories for all Give forms.', 'give' ), |
|
209 | + 'name' => __('Form Categories', 'give'), |
|
210 | + 'desc' => __('Enable Categories for all Give forms.', 'give'), |
|
211 | 211 | 'id' => 'categories', |
212 | 212 | 'type' => 'radio_inline', |
213 | 213 | 'default' => 'disabled', |
214 | 214 | 'options' => array( |
215 | - 'enabled' => __( 'Enabled', 'give' ), |
|
216 | - 'disabled' => __( 'Disabled', 'give' ), |
|
215 | + 'enabled' => __('Enabled', 'give'), |
|
216 | + 'disabled' => __('Disabled', 'give'), |
|
217 | 217 | ), |
218 | 218 | ), |
219 | 219 | array( |
220 | - 'name' => __( 'Form Tags', 'give' ), |
|
221 | - 'desc' => __( 'Enable Tags for all Give forms.', 'give' ), |
|
220 | + 'name' => __('Form Tags', 'give'), |
|
221 | + 'desc' => __('Enable Tags for all Give forms.', 'give'), |
|
222 | 222 | 'id' => 'tags', |
223 | 223 | 'type' => 'radio_inline', |
224 | 224 | 'default' => 'disabled', |
225 | 225 | 'options' => array( |
226 | - 'enabled' => __( 'Enabled', 'give' ), |
|
227 | - 'disabled' => __( 'Disabled', 'give' ), |
|
226 | + 'enabled' => __('Enabled', 'give'), |
|
227 | + 'disabled' => __('Disabled', 'give'), |
|
228 | 228 | ), |
229 | 229 | ), |
230 | 230 | array( |
231 | - 'name' => __( 'Taxonomies Docs Link', 'give' ), |
|
231 | + 'name' => __('Taxonomies Docs Link', 'give'), |
|
232 | 232 | 'id' => 'taxonomies_settings_docs_link', |
233 | - 'url' => esc_url( 'http://docs.givewp.com/settings-taxonomies' ), |
|
234 | - 'title' => __( 'Taxonomies Settings', 'give' ), |
|
233 | + 'url' => esc_url('http://docs.givewp.com/settings-taxonomies'), |
|
234 | + 'title' => __('Taxonomies Settings', 'give'), |
|
235 | 235 | 'type' => 'give_docs_link', |
236 | 236 | ), |
237 | 237 | array( |
@@ -248,36 +248,36 @@ discard block |
||
248 | 248 | 'type' => 'title', |
249 | 249 | ), |
250 | 250 | array( |
251 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
252 | - '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' ), |
|
251 | + 'name' => __('Terms and Conditions', 'give'), |
|
252 | + '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'), |
|
253 | 253 | 'id' => 'terms', |
254 | 254 | 'type' => 'radio_inline', |
255 | 255 | 'default' => 'disabled', |
256 | 256 | 'options' => array( |
257 | - 'enabled' => __( 'Enabled', 'give' ), |
|
258 | - 'disabled' => __( 'Disabled', 'give' ), |
|
257 | + 'enabled' => __('Enabled', 'give'), |
|
258 | + 'disabled' => __('Disabled', 'give'), |
|
259 | 259 | ), |
260 | 260 | ), |
261 | 261 | array( |
262 | - 'name' => __( 'Agree to Terms Label', 'give' ), |
|
263 | - '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' ), |
|
262 | + 'name' => __('Agree to Terms Label', 'give'), |
|
263 | + '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'), |
|
264 | 264 | 'id' => 'agree_to_terms_label', |
265 | 265 | 'attributes' => array( |
266 | - 'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ), |
|
266 | + 'placeholder' => esc_attr__('Agree to Terms?', 'give'), |
|
267 | 267 | ), |
268 | 268 | 'type' => 'text', |
269 | 269 | ), |
270 | 270 | array( |
271 | - 'name' => __( 'Agreement Text', 'give' ), |
|
272 | - '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' ), |
|
271 | + 'name' => __('Agreement Text', 'give'), |
|
272 | + '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'), |
|
273 | 273 | 'id' => 'agreement_text', |
274 | 274 | 'type' => 'wysiwyg', |
275 | 275 | ), |
276 | 276 | array( |
277 | - 'name' => __( 'Terms and Conditions Docs Link', 'give' ), |
|
277 | + 'name' => __('Terms and Conditions Docs Link', 'give'), |
|
278 | 278 | 'id' => 'terms_settings_docs_link', |
279 | - 'url' => esc_url( 'http://docs.givewp.com/settings-terms' ), |
|
280 | - 'title' => __( 'Terms and Conditions Settings', 'give' ), |
|
279 | + 'url' => esc_url('http://docs.givewp.com/settings-terms'), |
|
280 | + 'title' => __('Terms and Conditions Settings', 'give'), |
|
281 | 281 | 'type' => 'give_docs_link', |
282 | 282 | ), |
283 | 283 | array( |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | * Filter the display options settings. |
293 | 293 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
294 | 294 | */ |
295 | - $settings = apply_filters( 'give_settings_display', $settings ); |
|
295 | + $settings = apply_filters('give_settings_display', $settings); |
|
296 | 296 | |
297 | 297 | /** |
298 | 298 | * Filter the settings. |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | * |
302 | 302 | * @param array $settings |
303 | 303 | */ |
304 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
304 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
305 | 305 | |
306 | 306 | // Output. |
307 | 307 | return $settings; |
@@ -315,13 +315,13 @@ discard block |
||
315 | 315 | */ |
316 | 316 | public function get_sections() { |
317 | 317 | $sections = array( |
318 | - 'display-settings' => __( 'Display', 'give' ), |
|
319 | - 'post-types' => __( 'Post Types', 'give' ), |
|
320 | - 'taxonomies' => __( 'Taxonomies', 'give' ), |
|
321 | - 'term-and-conditions' => __( 'Terms and Conditions', 'give' ), |
|
318 | + 'display-settings' => __('Display', 'give'), |
|
319 | + 'post-types' => __('Post Types', 'give'), |
|
320 | + 'taxonomies' => __('Taxonomies', 'give'), |
|
321 | + 'term-and-conditions' => __('Terms and Conditions', 'give'), |
|
322 | 322 | ); |
323 | 323 | |
324 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
324 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
325 | 325 | } |
326 | 326 | } |
327 | 327 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -26,34 +26,34 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | -function give_set_settings_with_disable_prefix( $old_settings, $settings ) { |
|
29 | +function give_set_settings_with_disable_prefix($old_settings, $settings) { |
|
30 | 30 | // Bailout. |
31 | - if ( ! function_exists( 'give_v18_renamed_core_settings' ) ) { |
|
31 | + if ( ! function_exists('give_v18_renamed_core_settings')) { |
|
32 | 32 | return; |
33 | 33 | } |
34 | 34 | |
35 | 35 | // Get old setting names. |
36 | - $old_settings = array_flip( give_v18_renamed_core_settings() ); |
|
36 | + $old_settings = array_flip(give_v18_renamed_core_settings()); |
|
37 | 37 | $update_setting = false; |
38 | 38 | |
39 | - foreach ( $settings as $key => $value ) { |
|
39 | + foreach ($settings as $key => $value) { |
|
40 | 40 | |
41 | 41 | // Check 1. Check if new option is really updated or not. |
42 | 42 | // Check 2. Continue if key is not renamed. |
43 | - if ( ! isset( $old_settings[ $key ] ) ) { |
|
43 | + if ( ! isset($old_settings[$key])) { |
|
44 | 44 | continue; |
45 | 45 | } |
46 | 46 | |
47 | 47 | // Set old setting. |
48 | - $settings[ $old_settings[ $key ] ] = 'on'; |
|
48 | + $settings[$old_settings[$key]] = 'on'; |
|
49 | 49 | |
50 | 50 | // Do not need to set old setting if new setting is not set. |
51 | 51 | if ( |
52 | - ( give_is_setting_enabled( $value ) && ( false !== strpos( $old_settings[ $key ], 'disable_' ) ) ) |
|
53 | - || ( ! give_is_setting_enabled( $value ) && ( false !== strpos( $old_settings[ $key ], 'enable_' ) ) ) |
|
52 | + (give_is_setting_enabled($value) && (false !== strpos($old_settings[$key], 'disable_'))) |
|
53 | + || ( ! give_is_setting_enabled($value) && (false !== strpos($old_settings[$key], 'enable_'))) |
|
54 | 54 | |
55 | 55 | ) { |
56 | - unset( $settings[ $old_settings[ $key ] ] ); |
|
56 | + unset($settings[$old_settings[$key]]); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // Tell bot to update setting. |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | // Update setting if any old setting set. |
64 | - if ( $update_setting ) { |
|
65 | - update_option( 'give_settings', $settings ); |
|
64 | + if ($update_setting) { |
|
65 | + update_option('give_settings', $settings); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | -add_action( 'update_option_give_settings', 'give_set_settings_with_disable_prefix', 10, 2 ); |
|
69 | +add_action('update_option_give_settings', 'give_set_settings_with_disable_prefix', 10, 2); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Check spam through Akismet. |
@@ -80,45 +80,45 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return bool|mixed |
82 | 82 | */ |
83 | -function give_akismet( $spam ) { |
|
83 | +function give_akismet($spam) { |
|
84 | 84 | |
85 | 85 | // Bail out, If spam. |
86 | - if ( $spam ) { |
|
86 | + if ($spam) { |
|
87 | 87 | return $spam; |
88 | 88 | } |
89 | 89 | |
90 | 90 | // Bail out, if Akismet key not exist. |
91 | - if ( ! give_check_akismet_key() ) { |
|
91 | + if ( ! give_check_akismet_key()) { |
|
92 | 92 | return false; |
93 | 93 | } |
94 | 94 | |
95 | 95 | // Build args array. |
96 | 96 | $args = array(); |
97 | 97 | |
98 | - $args['comment_author'] = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : ''; |
|
99 | - $args['comment_author_email'] = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false; |
|
100 | - $args['blog'] = get_option( 'home' ); |
|
98 | + $args['comment_author'] = isset($_POST['give_first']) ? strip_tags(trim($_POST['give_first'])) : ''; |
|
99 | + $args['comment_author_email'] = isset($_POST['give_email']) ? $_POST['give_email'] : false; |
|
100 | + $args['blog'] = get_option('home'); |
|
101 | 101 | $args['blog_lang'] = get_locale(); |
102 | - $args['blog_charset'] = get_option( 'blog_charset' ); |
|
102 | + $args['blog_charset'] = get_option('blog_charset'); |
|
103 | 103 | $args['user_ip'] = $_SERVER['REMOTE_ADDR']; |
104 | 104 | $args['user_agent'] = $_SERVER['HTTP_USER_AGENT']; |
105 | 105 | $args['referrer'] = $_SERVER['HTTP_REFERER']; |
106 | 106 | $args['comment_type'] = 'contact-form'; |
107 | 107 | |
108 | - $ignore = array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' ); |
|
108 | + $ignore = array('HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'); |
|
109 | 109 | |
110 | - foreach ( $_SERVER as $key => $value ) { |
|
111 | - if ( ! in_array( $key, (array) $ignore ) ) { |
|
110 | + foreach ($_SERVER as $key => $value) { |
|
111 | + if ( ! in_array($key, (array) $ignore)) { |
|
112 | 112 | $args["$key"] = $value; |
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | 116 | // It will return Akismet spam detect API response. |
117 | - return give_akismet_spam_check( $args ); |
|
117 | + return give_akismet_spam_check($args); |
|
118 | 118 | |
119 | 119 | } |
120 | 120 | |
121 | -add_filter( 'give_spam', 'give_akismet' ); |
|
121 | +add_filter('give_spam', 'give_akismet'); |
|
122 | 122 | |
123 | 123 | /** |
124 | 124 | * Check Akismet API Key. |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | * @return bool |
129 | 129 | */ |
130 | 130 | function give_check_akismet_key() { |
131 | - if ( is_callable( array( 'Akismet', 'get_api_key' ) ) ) { // Akismet v3.0+ |
|
131 | + if (is_callable(array('Akismet', 'get_api_key'))) { // Akismet v3.0+ |
|
132 | 132 | return (bool) Akismet::get_api_key(); |
133 | 133 | } |
134 | 134 | |
135 | - if ( function_exists( 'akismet_get_key' ) ) { |
|
135 | + if (function_exists('akismet_get_key')) { |
|
136 | 136 | return (bool) akismet_get_key(); |
137 | 137 | } |
138 | 138 | |
@@ -148,26 +148,26 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @return bool|mixed |
150 | 150 | */ |
151 | -function give_akismet_spam_check( $args ) { |
|
151 | +function give_akismet_spam_check($args) { |
|
152 | 152 | global $akismet_api_host, $akismet_api_port; |
153 | 153 | |
154 | 154 | $spam = false; |
155 | - $query_string = http_build_query( $args ); |
|
155 | + $query_string = http_build_query($args); |
|
156 | 156 | |
157 | - if ( is_callable( array( 'Akismet', 'http_post' ) ) ) { // Akismet v3.0+ |
|
158 | - $response = Akismet::http_post( $query_string, 'comment-check' ); |
|
157 | + if (is_callable(array('Akismet', 'http_post'))) { // Akismet v3.0+ |
|
158 | + $response = Akismet::http_post($query_string, 'comment-check'); |
|
159 | 159 | } else { |
160 | - $response = akismet_http_post( $query_string, $akismet_api_host, |
|
161 | - '/1.1/comment-check', $akismet_api_port ); |
|
160 | + $response = akismet_http_post($query_string, $akismet_api_host, |
|
161 | + '/1.1/comment-check', $akismet_api_port); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | // It's spam if response status is true. |
165 | - if ( 'true' === $response[1] ) { |
|
165 | + if ('true' === $response[1]) { |
|
166 | 166 | $spam = true; |
167 | 167 | } |
168 | 168 | |
169 | 169 | // Allow developer to modified Akismet spam detection response. |
170 | - return apply_filters( 'give_akismet_spam_check', $spam, $args ); |
|
170 | + return apply_filters('give_akismet_spam_check', $spam, $args); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -180,15 +180,15 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @return array |
182 | 182 | */ |
183 | -function give_bc_v1817_iranian_currency_code( $currencies ) { |
|
184 | - if ( ! give_has_upgrade_completed( 'v1817_update_donation_iranian_currency_code' ) ) { |
|
183 | +function give_bc_v1817_iranian_currency_code($currencies) { |
|
184 | + if ( ! give_has_upgrade_completed('v1817_update_donation_iranian_currency_code')) { |
|
185 | 185 | $currencies['RIAL'] = $currencies['IRR']; |
186 | 186 | } |
187 | 187 | |
188 | 188 | return $currencies; |
189 | 189 | } |
190 | 190 | |
191 | -add_filter( 'give_currencies', 'give_bc_v1817_iranian_currency_code', 0 ); |
|
191 | +add_filter('give_currencies', 'give_bc_v1817_iranian_currency_code', 0); |
|
192 | 192 | |
193 | 193 | |
194 | 194 | /** |
@@ -202,22 +202,20 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @return string |
204 | 204 | */ |
205 | -function give_format_price_for_right_to_left_supported_currency( $formatted_amount, $currency_args, $price ) { |
|
206 | - if ( ! give_is_right_to_left_supported_currency( $currency_args['currency_code'] ) ) { |
|
205 | +function give_format_price_for_right_to_left_supported_currency($formatted_amount, $currency_args, $price) { |
|
206 | + if ( ! give_is_right_to_left_supported_currency($currency_args['currency_code'])) { |
|
207 | 207 | return $formatted_amount; |
208 | 208 | } |
209 | 209 | |
210 | 210 | $formatted_amount = ( |
211 | 211 | 'before' === (string) $currency_args['position'] ? |
212 | - '‫' . $price . $currency_args['symbol'] . '‬' : |
|
213 | - '‪' . $price . $currency_args['symbol'] . '‬' |
|
212 | + '‫'.$price.$currency_args['symbol'].'‬' : '‪'.$price.$currency_args['symbol'].'‬' |
|
214 | 213 | ); |
215 | 214 | |
216 | 215 | $formatted_amount = $currency_args['decode_currency'] ? |
217 | - html_entity_decode( $formatted_amount, ENT_COMPAT, 'UTF-8' ) : |
|
218 | - $formatted_amount; |
|
216 | + html_entity_decode($formatted_amount, ENT_COMPAT, 'UTF-8') : $formatted_amount; |
|
219 | 217 | |
220 | 218 | return $formatted_amount; |
221 | 219 | } |
222 | 220 | |
223 | -add_filter( 'give_currency_filter', 'give_format_price_for_right_to_left_supported_currency', 10, 3 ); |
|
224 | 221 | \ No newline at end of file |
222 | +add_filter('give_currency_filter', 'give_format_price_for_right_to_left_supported_currency', 10, 3); |
|
225 | 223 | \ No newline at end of file |
@@ -186,7 +186,8 @@ discard block |
||
186 | 186 | __( 'View', 'give' ) . ' ' . give_get_payment_status( $post, true ) . ' »' |
187 | 187 | ); |
188 | 188 | |
189 | - else : |
|
189 | + else { |
|
190 | + : |
|
190 | 191 | echo sprintf( |
191 | 192 | '<a href="%1$s">%2$s</a>', |
192 | 193 | esc_url( |
@@ -198,6 +199,7 @@ discard block |
||
198 | 199 | ), |
199 | 200 | __( 'View Receipt »', 'give' ) |
200 | 201 | ); |
202 | + } |
|
201 | 203 | |
202 | 204 | endif; |
203 | 205 | ?> |
@@ -242,6 +244,9 @@ discard block |
||
242 | 244 | </div> |
243 | 245 | </div> |
244 | 246 | <?php wp_reset_postdata(); ?> |
245 | -<?php else : ?> |
|
246 | - <?php Give()->notices->print_frontend_notice( __( 'It looks like you haven\'t made any donations.', 'give' ), true, 'success' ); ?> |
|
247 | +<?php else { |
|
248 | + : ?> |
|
249 | + <?php Give()->notices->print_frontend_notice( __( 'It looks like you haven\'t made any donations.', 'give' ), true, 'success' ); |
|
250 | +} |
|
251 | +?> |
|
247 | 252 | <?php endif; |
248 | 253 | \ No newline at end of file |
@@ -4,56 +4,56 @@ discard block |
||
4 | 4 | */ |
5 | 5 | |
6 | 6 | $donations = array(); |
7 | -$donation_history_args = Give()->session->get( 'give_donation_history_args' ); |
|
7 | +$donation_history_args = Give()->session->get('give_donation_history_args'); |
|
8 | 8 | |
9 | 9 | // User's Donations. |
10 | -if ( is_user_logged_in() ) { |
|
11 | - $donations = give_get_users_donations( get_current_user_id(), 20, true, 'any' ); |
|
12 | -} elseif ( Give()->email_access->token_exists ) { |
|
10 | +if (is_user_logged_in()) { |
|
11 | + $donations = give_get_users_donations(get_current_user_id(), 20, true, 'any'); |
|
12 | +} elseif (Give()->email_access->token_exists) { |
|
13 | 13 | // Email Access Token? |
14 | - $donations = give_get_users_donations( 0, 20, true, 'any' ); |
|
14 | + $donations = give_get_users_donations(0, 20, true, 'any'); |
|
15 | 15 | } elseif ( |
16 | 16 | false !== Give()->session->get_session_expiration() || |
17 | 17 | true === give_get_history_session() |
18 | 18 | ) { |
19 | 19 | // Session active? |
20 | - $email = Give()->session->get( 'give_email' ); |
|
21 | - $donor = Give()->donors->get_donor_by( 'email', $email ); |
|
22 | - $donations_count = count( explode( ',', $donor->payment_ids ) ); |
|
20 | + $email = Give()->session->get('give_email'); |
|
21 | + $donor = Give()->donors->get_donor_by('email', $email); |
|
22 | + $donations_count = count(explode(',', $donor->payment_ids)); |
|
23 | 23 | |
24 | - if( $donations_count > give_get_limit_display_donations() ) { |
|
24 | + if ($donations_count > give_get_limit_display_donations()) { |
|
25 | 25 | |
26 | 26 | // Restrict Security Email Access option, if donation count of a donor is less than or equal to limit. |
27 | - if( true !== Give_Cache::get( "give_cache_email_throttle_limit_exhausted_{$donor->id}" ) ) { |
|
28 | - add_action( 'give_donation_history_table_end', 'give_donation_history_table_end' ); |
|
27 | + if (true !== Give_Cache::get("give_cache_email_throttle_limit_exhausted_{$donor->id}")) { |
|
28 | + add_action('give_donation_history_table_end', 'give_donation_history_table_end'); |
|
29 | 29 | } else { |
30 | 30 | $value = Give()->email_access->verify_throttle / 60; |
31 | 31 | |
32 | - give_set_error( 'give-limited-throttle', sprintf( |
|
33 | - __( 'Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give' ), |
|
34 | - sprintf( _n( '%s minute', '%s minutes', $value, 'give' ), $value ) |
|
35 | - ) ); |
|
32 | + give_set_error('give-limited-throttle', sprintf( |
|
33 | + __('Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give'), |
|
34 | + sprintf(_n('%s minute', '%s minutes', $value, 'give'), $value) |
|
35 | + )); |
|
36 | 36 | |
37 | 37 | } |
38 | 38 | |
39 | - $donations = give_get_users_donations( $email, give_get_limit_display_donations(), true, 'any' ); |
|
39 | + $donations = give_get_users_donations($email, give_get_limit_display_donations(), true, 'any'); |
|
40 | 40 | } else { |
41 | - $donations = give_get_users_donations( $email, 20, true, 'any' ); |
|
41 | + $donations = give_get_users_donations($email, 20, true, 'any'); |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
45 | -Give()->notices->render_frontend_notices( 0 ); |
|
45 | +Give()->notices->render_frontend_notices(0); |
|
46 | 46 | |
47 | -if ( $donations ) : ?> |
|
47 | +if ($donations) : ?> |
|
48 | 48 | <?php |
49 | 49 | $table_headings = array( |
50 | - 'id' => __( 'ID', 'give' ), |
|
51 | - 'date' => __( 'Date', 'give' ), |
|
52 | - 'donor' => __( 'Donor', 'give' ), |
|
53 | - 'amount' => __( 'Amount', 'give' ), |
|
54 | - 'status' => __( 'Status', 'give' ), |
|
55 | - 'payment_method' => __( 'Payment Method', 'give' ), |
|
56 | - 'details' => __( 'Details', 'give' ), |
|
50 | + 'id' => __('ID', 'give'), |
|
51 | + 'date' => __('Date', 'give'), |
|
52 | + 'donor' => __('Donor', 'give'), |
|
53 | + 'amount' => __('Amount', 'give'), |
|
54 | + 'status' => __('Status', 'give'), |
|
55 | + 'payment_method' => __('Payment Method', 'give'), |
|
56 | + 'details' => __('Details', 'give'), |
|
57 | 57 | ); |
58 | 58 | ?> |
59 | 59 | <div class="give_user_history_main" > |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @since 1.7 |
71 | 71 | */ |
72 | - do_action( 'give_donation_history_header_before' ); |
|
72 | + do_action('give_donation_history_header_before'); |
|
73 | 73 | |
74 | - foreach ( $donation_history_args as $index => $value ) { |
|
75 | - if ( filter_var( $donation_history_args[ $index ], FILTER_VALIDATE_BOOLEAN ) ) : |
|
74 | + foreach ($donation_history_args as $index => $value) { |
|
75 | + if (filter_var($donation_history_args[$index], FILTER_VALIDATE_BOOLEAN)) : |
|
76 | 76 | echo sprintf( |
77 | 77 | '<th scope="col" class="give-donation-%1$s>">%2$s</th>', |
78 | 78 | $index, |
79 | - $table_headings[ $index ] |
|
79 | + $table_headings[$index] |
|
80 | 80 | ); |
81 | 81 | endif; |
82 | 82 | } |
@@ -88,13 +88,13 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @since 1.7 |
90 | 90 | */ |
91 | - do_action( 'give_donation_history_header_after' ); |
|
91 | + do_action('give_donation_history_header_after'); |
|
92 | 92 | ?> |
93 | 93 | </tr> |
94 | 94 | </thead> |
95 | - <?php foreach ( $donations as $post ) : |
|
96 | - setup_postdata( $post ); |
|
97 | - $donation_data = give_get_payment_meta( $post->ID ); ?> |
|
95 | + <?php foreach ($donations as $post) : |
|
96 | + setup_postdata($post); |
|
97 | + $donation_data = give_get_payment_meta($post->ID); ?> |
|
98 | 98 | <tr class="give-donation-row"> |
99 | 99 | <?php |
100 | 100 | /** |
@@ -107,36 +107,36 @@ discard block |
||
107 | 107 | * @param int $post_id The ID of the post. |
108 | 108 | * @param mixed $donation_data Payment meta data. |
109 | 109 | */ |
110 | - do_action( 'give_donation_history_row_start', $post->ID, $donation_data ); |
|
110 | + do_action('give_donation_history_row_start', $post->ID, $donation_data); |
|
111 | 111 | |
112 | - if ( filter_var( $donation_history_args['id'], FILTER_VALIDATE_BOOLEAN ) ) : |
|
112 | + if (filter_var($donation_history_args['id'], FILTER_VALIDATE_BOOLEAN)) : |
|
113 | 113 | echo sprintf( |
114 | 114 | '<td class="give-donation-id">#%1$s</td>', |
115 | - give_get_payment_number( $post->ID ) |
|
115 | + give_get_payment_number($post->ID) |
|
116 | 116 | ); |
117 | 117 | endif; |
118 | 118 | |
119 | - if ( filter_var( $donation_history_args['date'], FILTER_VALIDATE_BOOLEAN ) ) : |
|
119 | + if (filter_var($donation_history_args['date'], FILTER_VALIDATE_BOOLEAN)) : |
|
120 | 120 | echo sprintf( |
121 | 121 | '<td class="give-donation-date">%1$s</td>', |
122 | - date_i18n( give_date_format(), strtotime( get_post_field( 'post_date', $post->ID ) ) ) |
|
122 | + date_i18n(give_date_format(), strtotime(get_post_field('post_date', $post->ID))) |
|
123 | 123 | ); |
124 | 124 | endif; |
125 | 125 | |
126 | - if ( filter_var( $donation_history_args['donor'], FILTER_VALIDATE_BOOLEAN ) ) : |
|
126 | + if (filter_var($donation_history_args['donor'], FILTER_VALIDATE_BOOLEAN)) : |
|
127 | 127 | echo sprintf( |
128 | 128 | '<td class="give-donation-donor">%1$s</td>', |
129 | - give_get_donor_name_by( $post->ID ) |
|
129 | + give_get_donor_name_by($post->ID) |
|
130 | 130 | ); |
131 | 131 | endif; |
132 | 132 | ?> |
133 | 133 | |
134 | - <?php if ( filter_var( $donation_history_args['amount'], FILTER_VALIDATE_BOOLEAN ) ) : ?> |
|
134 | + <?php if (filter_var($donation_history_args['amount'], FILTER_VALIDATE_BOOLEAN)) : ?> |
|
135 | 135 | <td class="give-donation-amount"> |
136 | 136 | <span class="give-donation-amount"> |
137 | 137 | <?php |
138 | - $currency_code = give_get_payment_currency_code( $post->ID ); |
|
139 | - $donation_amount = give_donation_amount( $post->ID, true ); |
|
138 | + $currency_code = give_get_payment_currency_code($post->ID); |
|
139 | + $donation_amount = give_donation_amount($post->ID, true); |
|
140 | 140 | |
141 | 141 | /** |
142 | 142 | * Filters the donation amount on Donation History Page. |
@@ -148,42 +148,42 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @return int |
150 | 150 | */ |
151 | - echo apply_filters( 'give_donation_history_row_amount', $donation_amount, $post->ID ); |
|
151 | + echo apply_filters('give_donation_history_row_amount', $donation_amount, $post->ID); |
|
152 | 152 | ?> |
153 | 153 | </span> |
154 | 154 | </td> |
155 | 155 | <?php endif; ?> |
156 | 156 | |
157 | 157 | <?php |
158 | - if ( filter_var( $donation_history_args['status'], FILTER_VALIDATE_BOOLEAN ) ) : |
|
158 | + if (filter_var($donation_history_args['status'], FILTER_VALIDATE_BOOLEAN)) : |
|
159 | 159 | echo sprintf( |
160 | 160 | '<td class="give-donation-status">%1$s</td>', |
161 | - give_get_payment_status( $post, true ) |
|
161 | + give_get_payment_status($post, true) |
|
162 | 162 | ); |
163 | 163 | endif; |
164 | 164 | |
165 | - if ( filter_var( $donation_history_args['payment_method'], FILTER_VALIDATE_BOOLEAN ) ) : |
|
165 | + if (filter_var($donation_history_args['payment_method'], FILTER_VALIDATE_BOOLEAN)) : |
|
166 | 166 | echo sprintf( |
167 | 167 | '<td class="give-donation-payment-method">%1$s</td>', |
168 | - give_get_gateway_checkout_label( give_get_payment_gateway( $post->ID ) ) |
|
168 | + give_get_gateway_checkout_label(give_get_payment_gateway($post->ID)) |
|
169 | 169 | ); |
170 | 170 | endif; |
171 | 171 | ?> |
172 | 172 | <td class="give-donation-details"> |
173 | 173 | <?php |
174 | 174 | // Display View Receipt or. |
175 | - if ( 'publish' !== $post->post_status && 'subscription' !== $post->post_status ) : |
|
175 | + if ('publish' !== $post->post_status && 'subscription' !== $post->post_status) : |
|
176 | 176 | echo sprintf( |
177 | 177 | '<a href="%1$s"><span class="give-donation-status %2$s">%3$s</span></a>', |
178 | 178 | esc_url( |
179 | 179 | add_query_arg( |
180 | 180 | 'payment_key', |
181 | - give_get_payment_key( $post->ID ), |
|
181 | + give_get_payment_key($post->ID), |
|
182 | 182 | give_get_history_page_uri() |
183 | 183 | ) |
184 | 184 | ), |
185 | 185 | $post->post_status, |
186 | - __( 'View', 'give' ) . ' ' . give_get_payment_status( $post, true ) . ' »' |
|
186 | + __('View', 'give').' '.give_get_payment_status($post, true).' »' |
|
187 | 187 | ); |
188 | 188 | |
189 | 189 | else : |
@@ -192,11 +192,11 @@ discard block |
||
192 | 192 | esc_url( |
193 | 193 | add_query_arg( |
194 | 194 | 'payment_key', |
195 | - give_get_payment_key( $post->ID ), |
|
195 | + give_get_payment_key($post->ID), |
|
196 | 196 | give_get_history_page_uri() |
197 | 197 | ) |
198 | 198 | ), |
199 | - __( 'View Receipt »', 'give' ) |
|
199 | + __('View Receipt »', 'give') |
|
200 | 200 | ); |
201 | 201 | |
202 | 202 | endif; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @param int $post_id The ID of the post. |
214 | 214 | * @param mixed $donation_data Payment meta data. |
215 | 215 | */ |
216 | - do_action( 'give_donation_history_row_end', $post->ID, $donation_data ); |
|
216 | + do_action('give_donation_history_row_end', $post->ID, $donation_data); |
|
217 | 217 | ?> |
218 | 218 | </tr> |
219 | 219 | <?php endforeach; ?> |
@@ -226,22 +226,22 @@ discard block |
||
226 | 226 | * |
227 | 227 | * @since 1.8.17 |
228 | 228 | */ |
229 | - do_action( 'give_donation_history_table_end' ); |
|
229 | + do_action('give_donation_history_table_end'); |
|
230 | 230 | ?> |
231 | 231 | </table> |
232 | 232 | <div id="give-donation-history-pagination" class="give_pagination navigation"> |
233 | 233 | <?php |
234 | 234 | $big = 999999; |
235 | - echo paginate_links( array( |
|
236 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
235 | + echo paginate_links(array( |
|
236 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
237 | 237 | 'format' => '?paged=%#%', |
238 | - 'current' => max( 1, get_query_var( 'paged' ) ), |
|
239 | - 'total' => ceil( give_count_donations_of_donor() / 20 ) // 20 items per page |
|
240 | - ) ); |
|
238 | + 'current' => max(1, get_query_var('paged')), |
|
239 | + 'total' => ceil(give_count_donations_of_donor() / 20) // 20 items per page |
|
240 | + )); |
|
241 | 241 | ?> |
242 | 242 | </div> |
243 | 243 | </div> |
244 | 244 | <?php wp_reset_postdata(); ?> |
245 | 245 | <?php else : ?> |
246 | - <?php Give()->notices->print_frontend_notice( __( 'It looks like you haven\'t made any donations.', 'give' ), true, 'success' ); ?> |
|
246 | + <?php Give()->notices->print_frontend_notice(__('It looks like you haven\'t made any donations.', 'give'), true, 'success'); ?> |
|
247 | 247 | <?php endif; |
248 | 248 | \ No newline at end of file |
@@ -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 | /** |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | global $status, $page; |
46 | 46 | |
47 | 47 | // Set parent defaults |
48 | - parent::__construct( array( |
|
49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
48 | + parent::__construct(array( |
|
49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
51 | 51 | 'ajax' => false // Does this table support ajax? |
52 | - ) ); |
|
52 | + )); |
|
53 | 53 | |
54 | 54 | } |
55 | 55 | |
@@ -64,12 +64,12 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return string Column Name |
66 | 66 | */ |
67 | - public function column_default( $item, $column_name ) { |
|
68 | - $donation_list_page_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
67 | + public function column_default($item, $column_name) { |
|
68 | + $donation_list_page_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
69 | 69 | |
70 | - switch ( $column_name ) { |
|
70 | + switch ($column_name) { |
|
71 | 71 | case 'complete_sales': |
72 | - $value = $item[ $column_name ] ? |
|
72 | + $value = $item[$column_name] ? |
|
73 | 73 | sprintf( |
74 | 74 | '<a href="%s">%s</a>', |
75 | 75 | add_query_arg( |
@@ -79,13 +79,12 @@ discard block |
||
79 | 79 | ), |
80 | 80 | $donation_list_page_url |
81 | 81 | ), |
82 | - $item[ $column_name ] |
|
83 | - ) : |
|
84 | - $item[ $column_name ]; |
|
82 | + $item[$column_name] |
|
83 | + ) : $item[$column_name]; |
|
85 | 84 | break; |
86 | 85 | |
87 | 86 | case 'pending_sales': |
88 | - $value = $item[ $column_name ] ? |
|
87 | + $value = $item[$column_name] ? |
|
89 | 88 | sprintf( |
90 | 89 | '<a href="%s">%s</a>', |
91 | 90 | add_query_arg( |
@@ -95,13 +94,12 @@ discard block |
||
95 | 94 | ), |
96 | 95 | $donation_list_page_url |
97 | 96 | ), |
98 | - $item[ $column_name ] |
|
99 | - ) : |
|
100 | - $item[ $column_name ]; |
|
97 | + $item[$column_name] |
|
98 | + ) : $item[$column_name]; |
|
101 | 99 | break; |
102 | 100 | |
103 | 101 | case 'total_sales': |
104 | - $value = $item[ $column_name ] ? |
|
102 | + $value = $item[$column_name] ? |
|
105 | 103 | sprintf( |
106 | 104 | '<a href="%s">%s</a>', |
107 | 105 | add_query_arg( |
@@ -110,14 +108,13 @@ discard block |
||
110 | 108 | ), |
111 | 109 | $donation_list_page_url |
112 | 110 | ), |
113 | - $item[ $column_name ] |
|
114 | - ) : |
|
115 | - $item[ $column_name ]; |
|
111 | + $item[$column_name] |
|
112 | + ) : $item[$column_name]; |
|
116 | 113 | |
117 | 114 | break; |
118 | 115 | |
119 | 116 | default: |
120 | - $value = $item[ $column_name ]; |
|
117 | + $value = $item[$column_name]; |
|
121 | 118 | } |
122 | 119 | |
123 | 120 | return $value; |
@@ -132,11 +129,11 @@ discard block |
||
132 | 129 | */ |
133 | 130 | public function get_columns() { |
134 | 131 | $columns = array( |
135 | - 'label' => esc_attr__( 'Gateway', 'give' ), |
|
136 | - 'complete_sales' => esc_attr__( 'Complete Payments', 'give' ), |
|
137 | - 'pending_sales' => esc_attr__( 'Pending / Failed Payments', 'give' ), |
|
138 | - 'total_sales' => esc_attr__( 'Total Payments', 'give' ), |
|
139 | - 'total_donations' => esc_attr__( 'Total Donated', 'give' ) |
|
132 | + 'label' => esc_attr__('Gateway', 'give'), |
|
133 | + 'complete_sales' => esc_attr__('Complete Payments', 'give'), |
|
134 | + 'pending_sales' => esc_attr__('Pending / Failed Payments', 'give'), |
|
135 | + 'total_sales' => esc_attr__('Total Payments', 'give'), |
|
136 | + 'total_donations' => esc_attr__('Total Donated', 'give') |
|
140 | 137 | ); |
141 | 138 | |
142 | 139 | return $columns; |
@@ -151,7 +148,7 @@ discard block |
||
151 | 148 | */ |
152 | 149 | public function get_sortable_columns() { |
153 | 150 | return array( |
154 | - 'total_donations' => array( 'total_donations', false ) |
|
151 | + 'total_donations' => array('total_donations', false) |
|
155 | 152 | ); |
156 | 153 | } |
157 | 154 | |
@@ -164,7 +161,7 @@ discard block |
||
164 | 161 | * @return int Current page number |
165 | 162 | */ |
166 | 163 | public function get_paged() { |
167 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
164 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
168 | 165 | } |
169 | 166 | |
170 | 167 | |
@@ -175,7 +172,7 @@ discard block |
||
175 | 172 | * @since 1.0 |
176 | 173 | * @return void |
177 | 174 | */ |
178 | - public function bulk_actions( $which = '' ) { |
|
175 | + public function bulk_actions($which = '') { |
|
179 | 176 | |
180 | 177 | } |
181 | 178 | |
@@ -187,27 +184,27 @@ discard block |
||
187 | 184 | * |
188 | 185 | * @param string $which |
189 | 186 | */ |
190 | - protected function display_tablenav( $which ) { |
|
187 | + protected function display_tablenav($which) { |
|
191 | 188 | |
192 | - if ( 'top' === $which ) { |
|
193 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
189 | + if ('top' === $which) { |
|
190 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
194 | 191 | } |
195 | 192 | ?> |
196 | - <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
193 | + <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
197 | 194 | |
198 | - <?php if ( 'top' === $which ) { ?> |
|
195 | + <?php if ('top' === $which) { ?> |
|
199 | 196 | <h2 class="alignleft reports-earnings-title screen-reader-text"> |
200 | - <?php _e( 'Donation Methods Report', 'give' ); ?> |
|
197 | + <?php _e('Donation Methods Report', 'give'); ?> |
|
201 | 198 | </h2> |
202 | 199 | <?php } ?> |
203 | 200 | |
204 | 201 | <div class="alignright tablenav-right"> |
205 | 202 | <div class="actions bulkactions"> |
206 | - <?php $this->bulk_actions( $which ); ?> |
|
203 | + <?php $this->bulk_actions($which); ?> |
|
207 | 204 | </div> |
208 | 205 | <?php |
209 | - $this->extra_tablenav( $which ); |
|
210 | - $this->pagination( $which ); |
|
206 | + $this->extra_tablenav($which); |
|
207 | + $this->pagination($which); |
|
211 | 208 | ?> |
212 | 209 | </div> |
213 | 210 | |
@@ -229,17 +226,17 @@ discard block |
||
229 | 226 | * |
230 | 227 | * @return int |
231 | 228 | */ |
232 | - public function give_sort_total_donations( $old_value, $new_value ) { |
|
229 | + public function give_sort_total_donations($old_value, $new_value) { |
|
233 | 230 | // If no sort, default to label. |
234 | - $orderby = ( ! empty( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : 'label'; |
|
231 | + $orderby = ( ! empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'label'; |
|
235 | 232 | |
236 | 233 | //If no order, default to asc. |
237 | - $order = ( ! empty( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : 'asc'; |
|
234 | + $order = ( ! empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'asc'; |
|
238 | 235 | |
239 | 236 | //Determine sort order. |
240 | - $result = strcmp( $old_value[ $orderby ], $new_value[ $orderby ] ); |
|
237 | + $result = strcmp($old_value[$orderby], $new_value[$orderby]); |
|
241 | 238 | |
242 | - return ( $order === 'asc' ) ? $result : -$result; |
|
239 | + return ($order === 'asc') ? $result : -$result; |
|
243 | 240 | } |
244 | 241 | |
245 | 242 | |
@@ -256,10 +253,10 @@ discard block |
||
256 | 253 | $gateways = give_get_payment_gateways(); |
257 | 254 | $stats = new Give_Payment_Stats(); |
258 | 255 | |
259 | - foreach ( $gateways as $gateway_id => $gateway ) { |
|
256 | + foreach ($gateways as $gateway_id => $gateway) { |
|
260 | 257 | |
261 | - $complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' ); |
|
262 | - $pending_count = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) ); |
|
258 | + $complete_count = give_count_sales_by_gateway($gateway_id, 'publish'); |
|
259 | + $pending_count = give_count_sales_by_gateway($gateway_id, array('pending', 'failed')); |
|
263 | 260 | |
264 | 261 | $reports_data[] = array( |
265 | 262 | 'ID' => $gateway_id, |
@@ -267,7 +264,7 @@ discard block |
||
267 | 264 | 'complete_sales' => $complete_count, |
268 | 265 | 'pending_sales' => $pending_count, |
269 | 266 | 'total_sales' => $complete_count + $pending_count, |
270 | - 'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, strtotime('04/13/2015' ), current_time('timestamp' ), $gateway_id ), array( 'sanitize' => false ) ) ), |
|
267 | + 'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, strtotime('04/13/2015'), current_time('timestamp'), $gateway_id), array('sanitize' => false))), |
|
271 | 268 | ); |
272 | 269 | } |
273 | 270 | |
@@ -288,11 +285,11 @@ discard block |
||
288 | 285 | $columns = $this->get_columns(); |
289 | 286 | $hidden = array(); // No hidden columns |
290 | 287 | $sortable = $this->get_sortable_columns(); |
291 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
288 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
292 | 289 | $this->items = $this->reports_data(); |
293 | 290 | |
294 | 291 | // Sort Array when we are sorting data in array. |
295 | - usort( $this->items, array( $this, 'give_sort_total_donations' ) ); |
|
292 | + usort($this->items, array($this, 'give_sort_total_donations')); |
|
296 | 293 | |
297 | 294 | } |
298 | 295 | } |
@@ -10,17 +10,17 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | ?> |
17 | 17 | <div class="wrap" id="poststuff"> |
18 | 18 | <div id="give-updates"> |
19 | - <h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates Complete', 'give' ); ?></h1> |
|
19 | + <h1 id="give-updates-h1"><?php esc_html_e('Give - Updates Complete', 'give'); ?></h1> |
|
20 | 20 | <hr class="wp-header-end"> |
21 | 21 | |
22 | 22 | <div class="give-update-panel-content"> |
23 | - <p><?php esc_html_e( 'Congratulations! You are running the latest versions of Give and its add-ons.', 'give' ); ?></p> |
|
23 | + <p><?php esc_html_e('Congratulations! You are running the latest versions of Give and its add-ons.', 'give'); ?></p> |
|
24 | 24 | </div> |
25 | 25 | |
26 | 26 | </div> |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -80,108 +80,106 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function get_data() { |
82 | 82 | |
83 | - $totals = $this->get_stored_data( 'give_temp_recount_all_stats' ); |
|
84 | - $payment_items = $this->get_stored_data( 'give_temp_payment_items' ); |
|
85 | - $processed_payments = $this->get_stored_data( 'give_temp_processed_payments' ); |
|
86 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
83 | + $totals = $this->get_stored_data('give_temp_recount_all_stats'); |
|
84 | + $payment_items = $this->get_stored_data('give_temp_payment_items'); |
|
85 | + $processed_payments = $this->get_stored_data('give_temp_processed_payments'); |
|
86 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
87 | 87 | |
88 | - if ( false === $totals ) { |
|
88 | + if (false === $totals) { |
|
89 | 89 | $totals = array(); |
90 | 90 | } |
91 | 91 | |
92 | - if ( false === $payment_items ) { |
|
92 | + if (false === $payment_items) { |
|
93 | 93 | $payment_items = array(); |
94 | 94 | } |
95 | 95 | |
96 | - if ( false === $processed_payments ) { |
|
96 | + if (false === $processed_payments) { |
|
97 | 97 | $processed_payments = array(); |
98 | 98 | } |
99 | 99 | |
100 | - $all_forms = $this->get_stored_data( 'give_temp_form_ids' ); |
|
100 | + $all_forms = $this->get_stored_data('give_temp_form_ids'); |
|
101 | 101 | |
102 | - $payments = $this->get_stored_data( 'give_temp_all_payments_data' ); |
|
102 | + $payments = $this->get_stored_data('give_temp_all_payments_data'); |
|
103 | 103 | |
104 | - if ( empty( $payments ) ) { |
|
105 | - $args = apply_filters( 'give_recount_form_stats_args', array( |
|
104 | + if (empty($payments)) { |
|
105 | + $args = apply_filters('give_recount_form_stats_args', array( |
|
106 | 106 | 'give_forms' => $all_forms, |
107 | 107 | 'number' => $this->per_step, |
108 | 108 | 'status' => $accepted_statuses, |
109 | 109 | 'paged' => $this->step, |
110 | 110 | 'output' => 'give_payments', |
111 | - ) ); |
|
111 | + )); |
|
112 | 112 | |
113 | - $payments_query = new Give_Payments_Query( $args ); |
|
113 | + $payments_query = new Give_Payments_Query($args); |
|
114 | 114 | $payments = $payments_query->get_payments(); |
115 | 115 | } |
116 | 116 | |
117 | - if ( ! empty( $payments ) ) { |
|
117 | + if ( ! empty($payments)) { |
|
118 | 118 | |
119 | 119 | //Loop through payments |
120 | - foreach ( $payments as $payment ) { |
|
120 | + foreach ($payments as $payment) { |
|
121 | 121 | |
122 | - $payment_id = ( ! empty( $payment['ID'] ) ? absint( $payment['ID'] ) : ( ! empty( $payment->ID ) ? absint( $payment->ID ) : false ) ); |
|
123 | - $payment = new Give_Payment( $payment_id ); |
|
122 | + $payment_id = ( ! empty($payment['ID']) ? absint($payment['ID']) : ( ! empty($payment->ID) ? absint($payment->ID) : false)); |
|
123 | + $payment = new Give_Payment($payment_id); |
|
124 | 124 | |
125 | 125 | // Prevent payments that have all ready been retrieved from a previous sales log from counting again. |
126 | - if ( in_array( $payment->ID, $processed_payments ) ) { |
|
126 | + if (in_array($payment->ID, $processed_payments)) { |
|
127 | 127 | continue; |
128 | 128 | } |
129 | 129 | |
130 | 130 | // Verify accepted status. |
131 | - if ( ! in_array( $payment->post_status, $accepted_statuses ) ) { |
|
131 | + if ( ! in_array($payment->post_status, $accepted_statuses)) { |
|
132 | 132 | $processed_payments[] = $payment->ID; |
133 | 133 | continue; |
134 | 134 | } |
135 | 135 | |
136 | - $payment_item = $payment_items[ $payment->ID ]; |
|
136 | + $payment_item = $payment_items[$payment->ID]; |
|
137 | 137 | |
138 | - $form_id = isset( $payment_item['id'] ) ? $payment_item['id'] : ''; |
|
138 | + $form_id = isset($payment_item['id']) ? $payment_item['id'] : ''; |
|
139 | 139 | |
140 | 140 | // Must have a form ID. |
141 | - if ( empty( $form_id ) ) { |
|
141 | + if (empty($form_id)) { |
|
142 | 142 | continue; |
143 | 143 | } |
144 | 144 | |
145 | 145 | // Form ID must be within $all_forms array to be validated. |
146 | - if ( ! in_array( $form_id, $all_forms ) ) { |
|
146 | + if ( ! in_array($form_id, $all_forms)) { |
|
147 | 147 | continue; |
148 | 148 | } |
149 | 149 | |
150 | 150 | // Set Sales count |
151 | - $totals[ $form_id ]['sales'] = isset( $totals[ $form_id ]['sales'] ) ? |
|
152 | - ++ $totals[ $form_id ]['sales'] : |
|
153 | - 1; |
|
151 | + $totals[$form_id]['sales'] = isset($totals[$form_id]['sales']) ? |
|
152 | + ++$totals[$form_id]['sales'] : 1; |
|
154 | 153 | |
155 | 154 | // Set Total Earnings |
156 | - $totals[ $form_id ]['earnings'] = isset( $totals[ $form_id ]['earnings'] ) ? |
|
157 | - ( $totals[ $form_id ]['earnings'] + $payment_item['price'] ) : |
|
158 | - $payment_item['price']; |
|
155 | + $totals[$form_id]['earnings'] = isset($totals[$form_id]['earnings']) ? |
|
156 | + ($totals[$form_id]['earnings'] + $payment_item['price']) : $payment_item['price']; |
|
159 | 157 | |
160 | 158 | $processed_payments[] = $payment->ID; |
161 | 159 | } |
162 | 160 | |
163 | 161 | // Get the list of form ids which does not contain any payment record. |
164 | - $remaining_form_ids = array_diff( $all_forms, array_keys( $totals ) ); |
|
165 | - foreach ( $remaining_form_ids as $form_id ) { |
|
162 | + $remaining_form_ids = array_diff($all_forms, array_keys($totals)); |
|
163 | + foreach ($remaining_form_ids as $form_id) { |
|
166 | 164 | //If array key doesn't exist, create it |
167 | - if ( ! array_key_exists( $form_id, $totals ) ) { |
|
168 | - $totals[ $form_id ] = array( |
|
165 | + if ( ! array_key_exists($form_id, $totals)) { |
|
166 | + $totals[$form_id] = array( |
|
169 | 167 | 'sales' => (int) 0, |
170 | 168 | 'earnings' => (float) 0, |
171 | 169 | ); |
172 | 170 | } |
173 | 171 | } |
174 | 172 | |
175 | - $this->store_data( 'give_temp_processed_payments', $processed_payments ); |
|
176 | - $this->store_data( 'give_temp_recount_all_stats', $totals ); |
|
173 | + $this->store_data('give_temp_processed_payments', $processed_payments); |
|
174 | + $this->store_data('give_temp_recount_all_stats', $totals); |
|
177 | 175 | |
178 | 176 | return true; |
179 | 177 | } |
180 | 178 | |
181 | 179 | |
182 | - foreach ( $totals as $key => $stats ) { |
|
183 | - give_update_meta( $key, '_give_form_sales', $stats['sales'] ); |
|
184 | - give_update_meta( $key, '_give_form_earnings', give_sanitize_amount_for_db( $stats['earnings'] ) ); |
|
180 | + foreach ($totals as $key => $stats) { |
|
181 | + give_update_meta($key, '_give_form_sales', $stats['sales']); |
|
182 | + give_update_meta($key, '_give_form_earnings', give_sanitize_amount_for_db($stats['earnings'])); |
|
185 | 183 | } |
186 | 184 | |
187 | 185 | return false; |
@@ -196,20 +194,20 @@ discard block |
||
196 | 194 | */ |
197 | 195 | public function get_percentage_complete() { |
198 | 196 | |
199 | - $total = $this->get_stored_data( 'give_recount_all_total' ); |
|
197 | + $total = $this->get_stored_data('give_recount_all_total'); |
|
200 | 198 | |
201 | - if ( false === $total ) { |
|
199 | + if (false === $total) { |
|
202 | 200 | $this->pre_fetch(); |
203 | - $total = $this->get_stored_data( 'give_recount_all_total' ); |
|
201 | + $total = $this->get_stored_data('give_recount_all_total'); |
|
204 | 202 | } |
205 | 203 | |
206 | 204 | $percentage = 100; |
207 | 205 | |
208 | - if ( $total > 0 ) { |
|
209 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
206 | + if ($total > 0) { |
|
207 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
210 | 208 | } |
211 | 209 | |
212 | - if ( $percentage > 100 ) { |
|
210 | + if ($percentage > 100) { |
|
213 | 211 | $percentage = 100; |
214 | 212 | } |
215 | 213 | |
@@ -223,8 +221,8 @@ discard block |
||
223 | 221 | * |
224 | 222 | * @param array $request The Form Data passed into the batch processing |
225 | 223 | */ |
226 | - public function set_properties( $request ) { |
|
227 | - $this->form_id = isset( $request['form_id'] ) ? sanitize_text_field( $request['form_id'] ) : false; |
|
224 | + public function set_properties($request) { |
|
225 | + $this->form_id = isset($request['form_id']) ? sanitize_text_field($request['form_id']) : false; |
|
228 | 226 | } |
229 | 227 | |
230 | 228 | /** |
@@ -235,25 +233,25 @@ discard block |
||
235 | 233 | */ |
236 | 234 | public function process_step() { |
237 | 235 | |
238 | - if ( ! $this->can_export() ) { |
|
239 | - wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
236 | + if ( ! $this->can_export()) { |
|
237 | + wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
240 | 238 | } |
241 | 239 | |
242 | 240 | $had_data = $this->get_data(); |
243 | 241 | |
244 | - if ( $had_data ) { |
|
242 | + if ($had_data) { |
|
245 | 243 | $this->done = false; |
246 | 244 | |
247 | 245 | return true; |
248 | 246 | } else { |
249 | - $this->delete_data( 'give_recount_total_' . $this->form_id ); |
|
250 | - $this->delete_data( 'give_recount_all_total' ); |
|
251 | - $this->delete_data( 'give_temp_recount_all_stats' ); |
|
252 | - $this->delete_data( 'give_temp_payment_items' ); |
|
253 | - $this->delete_data( 'give_temp_form_ids' ); |
|
254 | - $this->delete_data( 'give_temp_processed_payments' ); |
|
247 | + $this->delete_data('give_recount_total_'.$this->form_id); |
|
248 | + $this->delete_data('give_recount_all_total'); |
|
249 | + $this->delete_data('give_temp_recount_all_stats'); |
|
250 | + $this->delete_data('give_temp_payment_items'); |
|
251 | + $this->delete_data('give_temp_form_ids'); |
|
252 | + $this->delete_data('give_temp_processed_payments'); |
|
255 | 253 | $this->done = true; |
256 | - $this->message = esc_html__( 'Donation form income amounts and donation counts stats successfully recounted.', 'give' ); |
|
254 | + $this->message = esc_html__('Donation form income amounts and donation counts stats successfully recounted.', 'give'); |
|
257 | 255 | |
258 | 256 | return false; |
259 | 257 | } |
@@ -289,70 +287,70 @@ discard block |
||
289 | 287 | */ |
290 | 288 | public function pre_fetch() { |
291 | 289 | |
292 | - if ( 1 == $this->step ) { |
|
293 | - $this->delete_data( 'give_temp_recount_all_total' ); |
|
294 | - $this->delete_data( 'give_temp_recount_all_stats' ); |
|
295 | - $this->delete_data( 'give_temp_payment_items' ); |
|
296 | - $this->delete_data( 'give_temp_processed_payments' ); |
|
297 | - $this->delete_data( 'give_temp_all_payments_data' ); |
|
290 | + if (1 == $this->step) { |
|
291 | + $this->delete_data('give_temp_recount_all_total'); |
|
292 | + $this->delete_data('give_temp_recount_all_stats'); |
|
293 | + $this->delete_data('give_temp_payment_items'); |
|
294 | + $this->delete_data('give_temp_processed_payments'); |
|
295 | + $this->delete_data('give_temp_all_payments_data'); |
|
298 | 296 | } |
299 | 297 | |
300 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
301 | - $total = $this->get_stored_data( 'give_temp_recount_all_total' ); |
|
298 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
299 | + $total = $this->get_stored_data('give_temp_recount_all_total'); |
|
302 | 300 | |
303 | - if ( false === $total ) { |
|
301 | + if (false === $total) { |
|
304 | 302 | |
305 | - $payment_items = $this->get_stored_data( 'give_temp_payment_items' ); |
|
303 | + $payment_items = $this->get_stored_data('give_temp_payment_items'); |
|
306 | 304 | |
307 | - if ( false === $payment_items ) { |
|
305 | + if (false === $payment_items) { |
|
308 | 306 | $payment_items = array(); |
309 | - $this->store_data( 'give_temp_payment_items', $payment_items ); |
|
307 | + $this->store_data('give_temp_payment_items', $payment_items); |
|
310 | 308 | } |
311 | 309 | |
312 | 310 | $args = array( |
313 | 311 | 'post_status' => 'publish', |
314 | 312 | 'post_type' => 'give_forms', |
315 | - 'posts_per_page' => - 1, |
|
313 | + 'posts_per_page' => -1, |
|
316 | 314 | 'fields' => 'ids', |
317 | 315 | ); |
318 | 316 | |
319 | - $all_forms = get_posts( $args ); |
|
317 | + $all_forms = get_posts($args); |
|
320 | 318 | |
321 | - $this->store_data( 'give_temp_form_ids', $all_forms ); |
|
319 | + $this->store_data('give_temp_form_ids', $all_forms); |
|
322 | 320 | |
323 | - $args = apply_filters( 'give_recount_form_stats_total_args', array( |
|
321 | + $args = apply_filters('give_recount_form_stats_total_args', array( |
|
324 | 322 | 'give_forms' => $all_forms, |
325 | 323 | 'number' => $this->per_step, |
326 | 324 | 'status' => $accepted_statuses, |
327 | 325 | 'page' => $this->step, |
328 | 326 | 'output' => 'payments', |
329 | - ) ); |
|
327 | + )); |
|
330 | 328 | |
331 | - $payments_query = new Give_Payments_Query( $args ); |
|
329 | + $payments_query = new Give_Payments_Query($args); |
|
332 | 330 | $payments = $payments_query->get_payments(); |
333 | 331 | |
334 | - $total = wp_count_posts( 'give_payment' )->publish; |
|
332 | + $total = wp_count_posts('give_payment')->publish; |
|
335 | 333 | |
336 | - $this->store_data( 'give_temp_all_payments_data', $payments ); |
|
334 | + $this->store_data('give_temp_all_payments_data', $payments); |
|
337 | 335 | |
338 | - if ( $payments ) { |
|
336 | + if ($payments) { |
|
339 | 337 | |
340 | - foreach ( $payments as $payment ) { |
|
338 | + foreach ($payments as $payment) { |
|
341 | 339 | |
342 | 340 | $form_id = $payment->form_id; |
343 | 341 | |
344 | 342 | //If for some reason somehow the form_ID isn't set check payment meta |
345 | - if ( empty( $payment->form_id ) ) { |
|
343 | + if (empty($payment->form_id)) { |
|
346 | 344 | $payment_meta = $payment->get_meta(); |
347 | - $form_id = isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : 0; |
|
345 | + $form_id = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : 0; |
|
348 | 346 | } |
349 | 347 | |
350 | - if ( ! in_array( $payment->post_status, $accepted_statuses ) ) { |
|
348 | + if ( ! in_array($payment->post_status, $accepted_statuses)) { |
|
351 | 349 | continue; |
352 | 350 | } |
353 | 351 | |
354 | - if ( ! array_key_exists( $payment->ID, $payment_items ) ) { |
|
355 | - $payment_items[ $payment->ID ] = array( |
|
352 | + if ( ! array_key_exists($payment->ID, $payment_items)) { |
|
353 | + $payment_items[$payment->ID] = array( |
|
356 | 354 | 'id' => $form_id, |
357 | 355 | 'payment_id' => $payment->ID, |
358 | 356 | 'price' => $payment->total, |
@@ -360,8 +358,8 @@ discard block |
||
360 | 358 | } |
361 | 359 | } |
362 | 360 | } |
363 | - $this->store_data( 'give_temp_payment_items', $payment_items ); |
|
364 | - $this->store_data( 'give_recount_all_total', $total ); |
|
361 | + $this->store_data('give_temp_payment_items', $payment_items); |
|
362 | + $this->store_data('give_recount_all_total', $total); |
|
365 | 363 | } |
366 | 364 | |
367 | 365 | } |
@@ -375,17 +373,17 @@ discard block |
||
375 | 373 | * |
376 | 374 | * @return mixed Returns the data from the database |
377 | 375 | */ |
378 | - private function get_stored_data( $key ) { |
|
376 | + private function get_stored_data($key) { |
|
379 | 377 | global $wpdb; |
380 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
381 | - if ( empty( $value ) ) { |
|
378 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
379 | + if (empty($value)) { |
|
382 | 380 | return false; |
383 | 381 | } |
384 | 382 | |
385 | - $maybe_json = json_decode( $value ); |
|
383 | + $maybe_json = json_decode($value); |
|
386 | 384 | |
387 | - if ( ! is_null( $maybe_json ) ) { |
|
388 | - $value = json_decode( $value, true ); |
|
385 | + if ( ! is_null($maybe_json)) { |
|
386 | + $value = json_decode($value, true); |
|
389 | 387 | } |
390 | 388 | |
391 | 389 | return $value; |
@@ -401,10 +399,10 @@ discard block |
||
401 | 399 | * |
402 | 400 | * @return void |
403 | 401 | */ |
404 | - private function store_data( $key, $value ) { |
|
402 | + private function store_data($key, $value) { |
|
405 | 403 | global $wpdb; |
406 | 404 | |
407 | - $value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value ); |
|
405 | + $value = is_array($value) ? wp_json_encode($value) : esc_attr($value); |
|
408 | 406 | |
409 | 407 | $data = array( |
410 | 408 | 'option_name' => $key, |
@@ -418,7 +416,7 @@ discard block |
||
418 | 416 | '%s', |
419 | 417 | ); |
420 | 418 | |
421 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
419 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
422 | 420 | } |
423 | 421 | |
424 | 422 | /** |
@@ -430,9 +428,9 @@ discard block |
||
430 | 428 | * |
431 | 429 | * @return void |
432 | 430 | */ |
433 | - private function delete_data( $key ) { |
|
431 | + private function delete_data($key) { |
|
434 | 432 | global $wpdb; |
435 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
433 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
436 | 434 | } |
437 | 435 | |
438 | 436 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -53,40 +53,40 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function get_data() { |
55 | 55 | |
56 | - $donor = new Give_Donor( $this->customer_id ); |
|
57 | - $payments = $this->get_stored_data( 'give_recount_donor_payments_' . $donor->id ); |
|
56 | + $donor = new Give_Donor($this->customer_id); |
|
57 | + $payments = $this->get_stored_data('give_recount_donor_payments_'.$donor->id); |
|
58 | 58 | |
59 | - $offset = ( $this->step - 1 ) * $this->per_step; |
|
60 | - $step_items = array_slice( $payments, $offset, $this->per_step ); |
|
59 | + $offset = ($this->step - 1) * $this->per_step; |
|
60 | + $step_items = array_slice($payments, $offset, $this->per_step); |
|
61 | 61 | |
62 | - if ( count( $step_items ) > 0 ) { |
|
63 | - $pending_total = (float) $this->get_stored_data( 'give_stats_donor_pending_total' . $donor->id ); |
|
62 | + if (count($step_items) > 0) { |
|
63 | + $pending_total = (float) $this->get_stored_data('give_stats_donor_pending_total'.$donor->id); |
|
64 | 64 | $step_total = 0; |
65 | 65 | |
66 | - $found_payment_ids = $this->get_stored_data( 'give_stats_found_payments_' . $donor->id ); |
|
66 | + $found_payment_ids = $this->get_stored_data('give_stats_found_payments_'.$donor->id); |
|
67 | 67 | |
68 | - foreach ( $step_items as $payment ) { |
|
69 | - $payment = get_post( $payment->ID ); |
|
68 | + foreach ($step_items as $payment) { |
|
69 | + $payment = get_post($payment->ID); |
|
70 | 70 | |
71 | - if ( is_null( $payment ) || is_wp_error( $payment ) || 'give_payment' !== $payment->post_type ) { |
|
71 | + if (is_null($payment) || is_wp_error($payment) || 'give_payment' !== $payment->post_type) { |
|
72 | 72 | |
73 | - $missing_payments = $this->get_stored_data( 'give_stats_missing_payments' . $donor->id ); |
|
73 | + $missing_payments = $this->get_stored_data('give_stats_missing_payments'.$donor->id); |
|
74 | 74 | $missing_payments[] = $payment->ID; |
75 | - $this->store_data( 'give_stats_missing_payments' . $donor->id, $missing_payments ); |
|
75 | + $this->store_data('give_stats_missing_payments'.$donor->id, $missing_payments); |
|
76 | 76 | |
77 | 77 | continue; |
78 | 78 | } |
79 | 79 | |
80 | 80 | $should_process_payment = 'publish' == $payment->post_status ? true : false; |
81 | - $should_process_payment = apply_filters( 'give_donor_recount_should_process_donation', $should_process_payment, $payment ); |
|
81 | + $should_process_payment = apply_filters('give_donor_recount_should_process_donation', $should_process_payment, $payment); |
|
82 | 82 | |
83 | - if ( true === $should_process_payment ) { |
|
83 | + if (true === $should_process_payment) { |
|
84 | 84 | |
85 | 85 | $found_payment_ids[] = $payment->ID; |
86 | 86 | |
87 | - if ( apply_filters( 'give_donor_recount_should_increase_value', true, $payment ) ) { |
|
88 | - $payment_amount = (float) give_donation_amount( $payment->ID, array( 'type' => 'stats' ) ); |
|
89 | - $step_total += $payment_amount; |
|
87 | + if (apply_filters('give_donor_recount_should_increase_value', true, $payment)) { |
|
88 | + $payment_amount = (float) give_donation_amount($payment->ID, array('type' => 'stats')); |
|
89 | + $step_total += $payment_amount; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | } |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | } |
95 | 95 | |
96 | 96 | $updated_total = $pending_total + $step_total; |
97 | - $this->store_data( 'give_stats_donor_pending_total' . $donor->id, $updated_total ); |
|
98 | - $this->store_data( 'give_stats_found_payments_' . $donor->id, $found_payment_ids ); |
|
97 | + $this->store_data('give_stats_donor_pending_total'.$donor->id, $updated_total); |
|
98 | + $this->store_data('give_stats_found_payments_'.$donor->id, $found_payment_ids); |
|
99 | 99 | |
100 | 100 | return true; |
101 | 101 | } |
@@ -112,16 +112,16 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function get_percentage_complete() { |
114 | 114 | |
115 | - $payments = $this->get_stored_data( 'give_recount_donor_payments_' . $this->customer_id ); |
|
116 | - $total = count( $payments ); |
|
115 | + $payments = $this->get_stored_data('give_recount_donor_payments_'.$this->customer_id); |
|
116 | + $total = count($payments); |
|
117 | 117 | |
118 | 118 | $percentage = 100; |
119 | 119 | |
120 | - if ( $total > 0 ) { |
|
121 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
120 | + if ($total > 0) { |
|
121 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
122 | 122 | } |
123 | 123 | |
124 | - if ( $percentage > 100 ) { |
|
124 | + if ($percentage > 100) { |
|
125 | 125 | $percentage = 100; |
126 | 126 | } |
127 | 127 | |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @param array $request The Form Data passed into the batch processing |
137 | 137 | */ |
138 | - public function set_properties( $request ) { |
|
139 | - $this->customer_id = isset( $request['customer_id'] ) ? sanitize_text_field( $request['customer_id'] ) : false; |
|
138 | + public function set_properties($request) { |
|
139 | + $this->customer_id = isset($request['customer_id']) ? sanitize_text_field($request['customer_id']) : false; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -147,53 +147,53 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function process_step() { |
149 | 149 | |
150 | - if ( ! $this->can_export() ) { |
|
151 | - wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
150 | + if ( ! $this->can_export()) { |
|
151 | + wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | $had_data = $this->get_data(); |
155 | 155 | |
156 | - if ( $had_data ) { |
|
156 | + if ($had_data) { |
|
157 | 157 | $this->done = false; |
158 | 158 | |
159 | 159 | return true; |
160 | 160 | } else { |
161 | - $donor = new Give_Donor( $this->customer_id ); |
|
162 | - $payment_ids = get_option( 'give_stats_found_payments_' . $donor->id, array() ); |
|
163 | - $this->delete_data( 'give_stats_found_payments_' . $donor->id ); |
|
161 | + $donor = new Give_Donor($this->customer_id); |
|
162 | + $payment_ids = get_option('give_stats_found_payments_'.$donor->id, array()); |
|
163 | + $this->delete_data('give_stats_found_payments_'.$donor->id); |
|
164 | 164 | |
165 | - $removed_payments = array_unique( get_option( 'give_stats_missing_payments' . $donor->id, array() ) ); |
|
165 | + $removed_payments = array_unique(get_option('give_stats_missing_payments'.$donor->id, array())); |
|
166 | 166 | |
167 | 167 | // Find non-existing payments (deleted) and total up the donation count |
168 | 168 | $purchase_count = 0; |
169 | - foreach ( $payment_ids as $key => $payment_id ) { |
|
170 | - if ( in_array( $payment_id, $removed_payments ) ) { |
|
171 | - unset( $payment_ids[ $key ] ); |
|
169 | + foreach ($payment_ids as $key => $payment_id) { |
|
170 | + if (in_array($payment_id, $removed_payments)) { |
|
171 | + unset($payment_ids[$key]); |
|
172 | 172 | continue; |
173 | 173 | } |
174 | 174 | |
175 | - $payment = get_post( $payment_id ); |
|
176 | - if ( apply_filters( 'give_donor_recount_should_increase_count', true, $payment ) ) { |
|
177 | - $purchase_count ++; |
|
175 | + $payment = get_post($payment_id); |
|
176 | + if (apply_filters('give_donor_recount_should_increase_count', true, $payment)) { |
|
177 | + $purchase_count++; |
|
178 | 178 | } |
179 | 179 | } |
180 | 180 | |
181 | - $this->delete_data( 'give_stats_missing_payments' . $donor->id ); |
|
181 | + $this->delete_data('give_stats_missing_payments'.$donor->id); |
|
182 | 182 | |
183 | - $pending_total = $this->get_stored_data( 'give_stats_donor_pending_total' . $donor->id ); |
|
184 | - $this->delete_data( 'give_stats_donor_pending_total' . $donor->id ); |
|
185 | - $this->delete_data( 'give_recount_donor_stats_' . $donor->id ); |
|
186 | - $this->delete_data( 'give_recount_donor_payments_' . $this->customer_id ); |
|
183 | + $pending_total = $this->get_stored_data('give_stats_donor_pending_total'.$donor->id); |
|
184 | + $this->delete_data('give_stats_donor_pending_total'.$donor->id); |
|
185 | + $this->delete_data('give_recount_donor_stats_'.$donor->id); |
|
186 | + $this->delete_data('give_recount_donor_payments_'.$this->customer_id); |
|
187 | 187 | |
188 | - $payment_ids = implode( ',', $payment_ids ); |
|
189 | - $donor->update( array( |
|
188 | + $payment_ids = implode(',', $payment_ids); |
|
189 | + $donor->update(array( |
|
190 | 190 | 'payment_ids' => $payment_ids, |
191 | 191 | 'purchase_count' => $purchase_count, |
192 | 192 | 'purchase_value' => $pending_total, |
193 | - ) ); |
|
193 | + )); |
|
194 | 194 | |
195 | 195 | $this->done = true; |
196 | - $this->message = esc_html__( 'Donor stats have been successfully recounted.', 'give' ); |
|
196 | + $this->message = esc_html__('Donor stats have been successfully recounted.', 'give'); |
|
197 | 197 | |
198 | 198 | return false; |
199 | 199 | } |
@@ -226,26 +226,26 @@ discard block |
||
226 | 226 | * @return void |
227 | 227 | */ |
228 | 228 | public function pre_fetch() { |
229 | - if ( $this->step === 1 ) { |
|
230 | - $allowed_payment_status = apply_filters( 'give_recount_donors_donation_statuses', give_get_payment_status_keys() ); |
|
229 | + if ($this->step === 1) { |
|
230 | + $allowed_payment_status = apply_filters('give_recount_donors_donation_statuses', give_get_payment_status_keys()); |
|
231 | 231 | |
232 | 232 | // Before we start, let's zero out the customer's data |
233 | - $donor = new Give_Donor( $this->customer_id ); |
|
234 | - $donor->update( array( 'purchase_value' => give_format_amount( 0, array( 'sanitize' => false ) ), 'purchase_count' => 0 ) ); |
|
233 | + $donor = new Give_Donor($this->customer_id); |
|
234 | + $donor->update(array('purchase_value' => give_format_amount(0, array('sanitize' => false)), 'purchase_count' => 0)); |
|
235 | 235 | |
236 | - $attached_payment_ids = explode( ',', $donor->payment_ids ); |
|
236 | + $attached_payment_ids = explode(',', $donor->payment_ids); |
|
237 | 237 | |
238 | 238 | $attached_args = array( |
239 | 239 | 'post__in' => $attached_payment_ids, |
240 | - 'number' => - 1, |
|
240 | + 'number' => -1, |
|
241 | 241 | 'status' => $allowed_payment_status, |
242 | 242 | ); |
243 | 243 | |
244 | - $attached_payments = give_get_payments( $attached_args ); |
|
244 | + $attached_payments = give_get_payments($attached_args); |
|
245 | 245 | |
246 | 246 | $unattached_args = array( |
247 | 247 | 'post__not_in' => $attached_payment_ids, |
248 | - 'number' => - 1, |
|
248 | + 'number' => -1, |
|
249 | 249 | 'status' => $allowed_payment_status, |
250 | 250 | 'meta_query' => array( |
251 | 251 | array( |
@@ -255,11 +255,11 @@ discard block |
||
255 | 255 | ), |
256 | 256 | ); |
257 | 257 | |
258 | - $unattached_payments = give_get_payments( $unattached_args ); |
|
258 | + $unattached_payments = give_get_payments($unattached_args); |
|
259 | 259 | |
260 | - $payments = array_merge( $attached_payments, $unattached_payments ); |
|
260 | + $payments = array_merge($attached_payments, $unattached_payments); |
|
261 | 261 | |
262 | - $this->store_data( 'give_recount_donor_payments_' . $donor->id, $payments ); |
|
262 | + $this->store_data('give_recount_donor_payments_'.$donor->id, $payments); |
|
263 | 263 | } |
264 | 264 | } |
265 | 265 | |
@@ -272,17 +272,17 @@ discard block |
||
272 | 272 | * |
273 | 273 | * @return mixed Returns the data from the database |
274 | 274 | */ |
275 | - private function get_stored_data( $key ) { |
|
275 | + private function get_stored_data($key) { |
|
276 | 276 | global $wpdb; |
277 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
277 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
278 | 278 | |
279 | - if ( empty( $value ) ) { |
|
279 | + if (empty($value)) { |
|
280 | 280 | return false; |
281 | 281 | } |
282 | 282 | |
283 | - $maybe_json = json_decode( $value ); |
|
284 | - if ( ! is_null( $maybe_json ) ) { |
|
285 | - $value = json_decode( $value, true ); |
|
283 | + $maybe_json = json_decode($value); |
|
284 | + if ( ! is_null($maybe_json)) { |
|
285 | + $value = json_decode($value, true); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | return $value; |
@@ -298,10 +298,10 @@ discard block |
||
298 | 298 | * |
299 | 299 | * @return void |
300 | 300 | */ |
301 | - private function store_data( $key, $value ) { |
|
301 | + private function store_data($key, $value) { |
|
302 | 302 | global $wpdb; |
303 | 303 | |
304 | - $value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value ); |
|
304 | + $value = is_array($value) ? wp_json_encode($value) : esc_attr($value); |
|
305 | 305 | |
306 | 306 | $data = array( |
307 | 307 | 'option_name' => $key, |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | '%s', |
316 | 316 | ); |
317 | 317 | |
318 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
318 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | /** |
@@ -327,9 +327,9 @@ discard block |
||
327 | 327 | * |
328 | 328 | * @return void |
329 | 329 | */ |
330 | - private function delete_data( $key ) { |
|
330 | + private function delete_data($key) { |
|
331 | 331 | global $wpdb; |
332 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
332 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -53,49 +53,49 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function get_data() { |
55 | 55 | |
56 | - if ( $this->step == 1 ) { |
|
57 | - $this->delete_data( 'give_temp_recount_earnings' ); |
|
56 | + if ($this->step == 1) { |
|
57 | + $this->delete_data('give_temp_recount_earnings'); |
|
58 | 58 | } |
59 | 59 | |
60 | - $total = get_option( 'give_temp_recount_earnings', false ); |
|
60 | + $total = get_option('give_temp_recount_earnings', false); |
|
61 | 61 | |
62 | - if ( false === $total ) { |
|
62 | + if (false === $total) { |
|
63 | 63 | $total = (float) 0; |
64 | - $this->store_data( 'give_temp_recount_earnings', $total ); |
|
64 | + $this->store_data('give_temp_recount_earnings', $total); |
|
65 | 65 | } |
66 | 66 | |
67 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
67 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
68 | 68 | |
69 | - $args = apply_filters( 'give_recount_earnings_args', array( |
|
69 | + $args = apply_filters('give_recount_earnings_args', array( |
|
70 | 70 | 'number' => $this->per_step, |
71 | 71 | 'page' => $this->step, |
72 | 72 | 'status' => $accepted_statuses, |
73 | 73 | 'fields' => 'ids' |
74 | - ) ); |
|
74 | + )); |
|
75 | 75 | |
76 | - $payments = give_get_payments( $args ); |
|
76 | + $payments = give_get_payments($args); |
|
77 | 77 | |
78 | - if ( ! empty( $payments ) ) { |
|
78 | + if ( ! empty($payments)) { |
|
79 | 79 | |
80 | - foreach ( $payments as $payment ) { |
|
80 | + foreach ($payments as $payment) { |
|
81 | 81 | |
82 | - $total += (float) give_donation_amount( $payment, array( 'type' => 'stats' ) ); |
|
82 | + $total += (float) give_donation_amount($payment, array('type' => 'stats')); |
|
83 | 83 | |
84 | 84 | } |
85 | 85 | |
86 | - if ( $total < 0 ) { |
|
86 | + if ($total < 0) { |
|
87 | 87 | $totals = 0; |
88 | 88 | } |
89 | 89 | |
90 | - $total = round( $total, give_get_price_decimals() ); |
|
90 | + $total = round($total, give_get_price_decimals()); |
|
91 | 91 | |
92 | - $this->store_data( 'give_temp_recount_earnings', $total ); |
|
92 | + $this->store_data('give_temp_recount_earnings', $total); |
|
93 | 93 | |
94 | 94 | return true; |
95 | 95 | |
96 | 96 | } |
97 | 97 | |
98 | - update_option( 'give_earnings_total', $total ); |
|
98 | + update_option('give_earnings_total', $total); |
|
99 | 99 | |
100 | 100 | return false; |
101 | 101 | |
@@ -109,25 +109,25 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function get_percentage_complete() { |
111 | 111 | |
112 | - $total = $this->get_stored_data( 'give_recount_earnings_total' ); |
|
112 | + $total = $this->get_stored_data('give_recount_earnings_total'); |
|
113 | 113 | |
114 | - if ( false === $total ) { |
|
115 | - $args = apply_filters( 'give_recount_earnings_total_args', array() ); |
|
114 | + if (false === $total) { |
|
115 | + $args = apply_filters('give_recount_earnings_total_args', array()); |
|
116 | 116 | |
117 | - $counts = give_count_payments( $args ); |
|
118 | - $total = absint( $counts->publish ); |
|
119 | - $total = apply_filters( 'give_recount_store_earnings_total', $total ); |
|
117 | + $counts = give_count_payments($args); |
|
118 | + $total = absint($counts->publish); |
|
119 | + $total = apply_filters('give_recount_store_earnings_total', $total); |
|
120 | 120 | |
121 | - $this->store_data( 'give_recount_earnings_total', $total ); |
|
121 | + $this->store_data('give_recount_earnings_total', $total); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | $percentage = 100; |
125 | 125 | |
126 | - if ( $total > 0 ) { |
|
127 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
126 | + if ($total > 0) { |
|
127 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
128 | 128 | } |
129 | 129 | |
130 | - if ( $percentage > 100 ) { |
|
130 | + if ($percentage > 100) { |
|
131 | 131 | $percentage = 100; |
132 | 132 | } |
133 | 133 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * |
142 | 142 | * @param array $request The Form Data passed into the batch processing |
143 | 143 | */ |
144 | - public function set_properties( $request ) { |
|
144 | + public function set_properties($request) { |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -152,21 +152,21 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function process_step() { |
154 | 154 | |
155 | - if ( ! $this->can_export() ) { |
|
156 | - wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
155 | + if ( ! $this->can_export()) { |
|
156 | + wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | $had_data = $this->get_data(); |
160 | 160 | |
161 | - if ( $had_data ) { |
|
161 | + if ($had_data) { |
|
162 | 162 | $this->done = false; |
163 | 163 | |
164 | 164 | return true; |
165 | 165 | } else { |
166 | - $this->delete_data( 'give_recount_earnings_total' ); |
|
167 | - $this->delete_data( 'give_temp_recount_earnings' ); |
|
166 | + $this->delete_data('give_recount_earnings_total'); |
|
167 | + $this->delete_data('give_temp_recount_earnings'); |
|
168 | 168 | $this->done = true; |
169 | - $this->message = esc_html__( 'Income stats have been successfully recounted.', 'give' ); |
|
169 | + $this->message = esc_html__('Income stats have been successfully recounted.', 'give'); |
|
170 | 170 | |
171 | 171 | return false; |
172 | 172 | } |
@@ -203,17 +203,17 @@ discard block |
||
203 | 203 | * |
204 | 204 | * @return mixed Returns the data from the database |
205 | 205 | */ |
206 | - private function get_stored_data( $key ) { |
|
206 | + private function get_stored_data($key) { |
|
207 | 207 | global $wpdb; |
208 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
208 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
209 | 209 | |
210 | - if ( empty( $value ) ) { |
|
210 | + if (empty($value)) { |
|
211 | 211 | return false; |
212 | 212 | } |
213 | 213 | |
214 | - $maybe_json = json_decode( $value ); |
|
215 | - if ( ! is_null( $maybe_json ) ) { |
|
216 | - $value = json_decode( $value, true ); |
|
214 | + $maybe_json = json_decode($value); |
|
215 | + if ( ! is_null($maybe_json)) { |
|
216 | + $value = json_decode($value, true); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | return $value; |
@@ -229,10 +229,10 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @return void |
231 | 231 | */ |
232 | - private function store_data( $key, $value ) { |
|
232 | + private function store_data($key, $value) { |
|
233 | 233 | global $wpdb; |
234 | 234 | |
235 | - $value = is_array( $value ) ? wp_json_encode( $value ) : esc_attr( $value ); |
|
235 | + $value = is_array($value) ? wp_json_encode($value) : esc_attr($value); |
|
236 | 236 | |
237 | 237 | $data = array( |
238 | 238 | 'option_name' => $key, |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | '%s', |
247 | 247 | ); |
248 | 248 | |
249 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
249 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
@@ -258,9 +258,9 @@ discard block |
||
258 | 258 | * |
259 | 259 | * @return void |
260 | 260 | */ |
261 | - private function delete_data( $key ) { |
|
261 | + private function delete_data($key) { |
|
262 | 262 | global $wpdb; |
263 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
263 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | } |