@@ -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,104 +80,102 @@ 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( false === $payments ) { |
|
105 | - $args = apply_filters( 'give_recount_form_stats_args', array( |
|
104 | + if (false === $payments) { |
|
105 | + $args = apply_filters('give_recount_form_stats_args', array( |
|
106 | 106 | 'post_parent__in' => $all_forms, |
107 | 107 | 'number' => $this->per_step, |
108 | 108 | 'status' => 'publish', |
109 | 109 | 'paged' => $this->step, |
110 | 110 | 'output' => '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 ( $payments ) { |
|
117 | + if ($payments) { |
|
118 | 118 | |
119 | 119 | //Loop through payments |
120 | - foreach ( $payments as $payment ) { |
|
120 | + foreach ($payments as $payment) { |
|
121 | 121 | |
122 | 122 | // Prevent payments that have all ready been retrieved from a previous sales log from counting again. |
123 | - if ( in_array( $payment->ID, $processed_payments ) ) { |
|
123 | + if (in_array($payment->ID, $processed_payments)) { |
|
124 | 124 | continue; |
125 | 125 | } |
126 | 126 | |
127 | 127 | // Verify accepted status |
128 | - if ( ! in_array( $payment->post_status, $accepted_statuses ) ) { |
|
128 | + if ( ! in_array($payment->post_status, $accepted_statuses)) { |
|
129 | 129 | $processed_payments[] = $payment->ID; |
130 | 130 | continue; |
131 | 131 | } |
132 | 132 | |
133 | - $payment_item = $payment_items[ $payment->ID ]; |
|
133 | + $payment_item = $payment_items[$payment->ID]; |
|
134 | 134 | |
135 | - $form_id = isset( $payment_item['id'] ) ? $payment_item['id'] : ''; |
|
135 | + $form_id = isset($payment_item['id']) ? $payment_item['id'] : ''; |
|
136 | 136 | |
137 | 137 | //Must have a form ID |
138 | - if ( empty( $form_id ) ) { |
|
138 | + if (empty($form_id)) { |
|
139 | 139 | continue; |
140 | 140 | } |
141 | 141 | |
142 | 142 | //Form ID must be within $all_forms array to be validated |
143 | - if ( ! in_array( $form_id, $all_forms ) ) { |
|
143 | + if ( ! in_array($form_id, $all_forms)) { |
|
144 | 144 | continue; |
145 | 145 | } |
146 | 146 | |
147 | 147 | // Set Sales count |
148 | - $totals[ $form_id ]['sales'] = isset( $totals[ $form_id ]['sales'] ) ? |
|
149 | - ++ $totals[ $form_id ]['sales'] : |
|
150 | - 1; |
|
148 | + $totals[$form_id]['sales'] = isset($totals[$form_id]['sales']) ? |
|
149 | + ++$totals[$form_id]['sales'] : 1; |
|
151 | 150 | |
152 | 151 | // Set Total Earnings |
153 | - $totals[ $form_id ]['earnings'] = isset( $totals[ $form_id ]['earnings'] ) ? |
|
154 | - ( $totals[ $form_id ]['earnings'] + $payment_item['price'] ) : |
|
155 | - $payment_item['price']; |
|
152 | + $totals[$form_id]['earnings'] = isset($totals[$form_id]['earnings']) ? |
|
153 | + ($totals[$form_id]['earnings'] + $payment_item['price']) : $payment_item['price']; |
|
156 | 154 | |
157 | 155 | $processed_payments[] = $payment->ID; |
158 | 156 | } |
159 | 157 | |
160 | 158 | // Get the list of form ids which does not contain any payment record. |
161 | - $remaining_form_ids = array_diff( $all_forms, array_keys($totals) ); |
|
162 | - foreach( $remaining_form_ids as $form_id) { |
|
159 | + $remaining_form_ids = array_diff($all_forms, array_keys($totals)); |
|
160 | + foreach ($remaining_form_ids as $form_id) { |
|
163 | 161 | //If array key doesn't exist, create it |
164 | - if ( ! array_key_exists( $form_id, $totals ) ) { |
|
165 | - $totals[ $form_id ] = array( |
|
162 | + if ( ! array_key_exists($form_id, $totals)) { |
|
163 | + $totals[$form_id] = array( |
|
166 | 164 | 'sales' => (int) 0, |
167 | 165 | 'earnings' => (float) 0, |
168 | 166 | ); |
169 | 167 | } |
170 | 168 | } |
171 | 169 | |
172 | - $this->store_data( 'give_temp_processed_payments', $processed_payments ); |
|
173 | - $this->store_data( 'give_temp_recount_all_stats', $totals ); |
|
170 | + $this->store_data('give_temp_processed_payments', $processed_payments); |
|
171 | + $this->store_data('give_temp_recount_all_stats', $totals); |
|
174 | 172 | |
175 | 173 | return true; |
176 | 174 | } |
177 | 175 | |
178 | - foreach ( $totals as $key => $stats ) { |
|
179 | - give_update_meta( $key, '_give_form_sales', $stats['sales'] ); |
|
180 | - give_update_meta( $key, '_give_form_earnings', $stats['earnings'] ); |
|
176 | + foreach ($totals as $key => $stats) { |
|
177 | + give_update_meta($key, '_give_form_sales', $stats['sales']); |
|
178 | + give_update_meta($key, '_give_form_earnings', $stats['earnings']); |
|
181 | 179 | } |
182 | 180 | |
183 | 181 | return false; |
@@ -192,20 +190,20 @@ discard block |
||
192 | 190 | */ |
193 | 191 | public function get_percentage_complete() { |
194 | 192 | |
195 | - $total = $this->get_stored_data( 'give_recount_all_total' ); |
|
193 | + $total = $this->get_stored_data('give_recount_all_total'); |
|
196 | 194 | |
197 | - if ( false === $total ) { |
|
195 | + if (false === $total) { |
|
198 | 196 | $this->pre_fetch(); |
199 | - $total = $this->get_stored_data( 'give_recount_all_total' ); |
|
197 | + $total = $this->get_stored_data('give_recount_all_total'); |
|
200 | 198 | } |
201 | 199 | |
202 | 200 | $percentage = 100; |
203 | 201 | |
204 | - if ( $total > 0 ) { |
|
205 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
202 | + if ($total > 0) { |
|
203 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
206 | 204 | } |
207 | 205 | |
208 | - if ( $percentage > 100 ) { |
|
206 | + if ($percentage > 100) { |
|
209 | 207 | $percentage = 100; |
210 | 208 | } |
211 | 209 | |
@@ -219,8 +217,8 @@ discard block |
||
219 | 217 | * |
220 | 218 | * @param array $request The Form Data passed into the batch processing |
221 | 219 | */ |
222 | - public function set_properties( $request ) { |
|
223 | - $this->form_id = isset( $request['form_id'] ) ? sanitize_text_field( $request['form_id'] ) : false; |
|
220 | + public function set_properties($request) { |
|
221 | + $this->form_id = isset($request['form_id']) ? sanitize_text_field($request['form_id']) : false; |
|
224 | 222 | } |
225 | 223 | |
226 | 224 | /** |
@@ -231,35 +229,35 @@ discard block |
||
231 | 229 | */ |
232 | 230 | public function process_step() { |
233 | 231 | |
234 | - if ( ! $this->can_export() ) { |
|
235 | - wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
232 | + if ( ! $this->can_export()) { |
|
233 | + wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
236 | 234 | } |
237 | 235 | |
238 | 236 | $had_data = $this->get_data(); |
239 | 237 | |
240 | - if ( $had_data ) { |
|
238 | + if ($had_data) { |
|
241 | 239 | $this->done = false; |
242 | 240 | |
243 | 241 | return true; |
244 | 242 | } else { |
245 | - $this->delete_data( 'give_recount_total_' . $this->form_id ); |
|
246 | - $this->delete_data( 'give_recount_all_total' ); |
|
247 | - $this->delete_data( 'give_temp_recount_all_stats' ); |
|
248 | - $this->delete_data( 'give_temp_payment_items' ); |
|
249 | - $this->delete_data( 'give_temp_form_ids' ); |
|
250 | - $this->delete_data( 'give_temp_processed_payments' ); |
|
243 | + $this->delete_data('give_recount_total_'.$this->form_id); |
|
244 | + $this->delete_data('give_recount_all_total'); |
|
245 | + $this->delete_data('give_temp_recount_all_stats'); |
|
246 | + $this->delete_data('give_temp_payment_items'); |
|
247 | + $this->delete_data('give_temp_form_ids'); |
|
248 | + $this->delete_data('give_temp_processed_payments'); |
|
251 | 249 | $this->done = true; |
252 | - $this->message = esc_html__( 'Donation form income amounts and donation counts stats successfully recounted.', 'give' ); |
|
250 | + $this->message = esc_html__('Donation form income amounts and donation counts stats successfully recounted.', 'give'); |
|
253 | 251 | |
254 | 252 | return false; |
255 | 253 | } |
256 | 254 | } |
257 | 255 | |
258 | 256 | public function headers() { |
259 | - ignore_user_abort( true ); |
|
257 | + ignore_user_abort(true); |
|
260 | 258 | |
261 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
262 | - set_time_limit( 0 ); |
|
259 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
260 | + set_time_limit(0); |
|
263 | 261 | } |
264 | 262 | } |
265 | 263 | |
@@ -286,69 +284,69 @@ discard block |
||
286 | 284 | */ |
287 | 285 | public function pre_fetch() { |
288 | 286 | |
289 | - if ( $this->step == 1 ) { |
|
290 | - $this->delete_data( 'give_temp_recount_all_total' ); |
|
291 | - $this->delete_data( 'give_temp_recount_all_stats' ); |
|
292 | - $this->delete_data( 'give_temp_payment_items' ); |
|
293 | - $this->delete_data( 'give_temp_processed_payments' ); |
|
294 | - $this->delete_data( 'give_temp_all_payments_data' ); |
|
287 | + if ($this->step == 1) { |
|
288 | + $this->delete_data('give_temp_recount_all_total'); |
|
289 | + $this->delete_data('give_temp_recount_all_stats'); |
|
290 | + $this->delete_data('give_temp_payment_items'); |
|
291 | + $this->delete_data('give_temp_processed_payments'); |
|
292 | + $this->delete_data('give_temp_all_payments_data'); |
|
295 | 293 | } |
296 | 294 | |
297 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
298 | - $total = $this->get_stored_data( 'give_temp_recount_all_total' ); |
|
295 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
296 | + $total = $this->get_stored_data('give_temp_recount_all_total'); |
|
299 | 297 | |
300 | - if ( false === $total ) { |
|
298 | + if (false === $total) { |
|
301 | 299 | $total = 0; |
302 | - $payment_items = $this->get_stored_data( 'give_temp_payment_items' ); |
|
300 | + $payment_items = $this->get_stored_data('give_temp_payment_items'); |
|
303 | 301 | |
304 | - if ( false === $payment_items ) { |
|
302 | + if (false === $payment_items) { |
|
305 | 303 | $payment_items = array(); |
306 | - $this->store_data( 'give_temp_payment_items', $payment_items ); |
|
304 | + $this->store_data('give_temp_payment_items', $payment_items); |
|
307 | 305 | } |
308 | 306 | |
309 | 307 | $args = array( |
310 | 308 | 'post_status' => 'publish', |
311 | 309 | 'post_type' => 'give_forms', |
312 | - 'posts_per_page' => - 1, |
|
310 | + 'posts_per_page' => -1, |
|
313 | 311 | 'fields' => 'ids', |
314 | 312 | ); |
315 | 313 | |
316 | - $all_forms = get_posts( $args ); |
|
317 | - $this->store_data( 'give_temp_form_ids', $all_forms ); |
|
314 | + $all_forms = get_posts($args); |
|
315 | + $this->store_data('give_temp_form_ids', $all_forms); |
|
318 | 316 | |
319 | - $args = apply_filters( 'give_recount_form_stats_total_args', array( |
|
317 | + $args = apply_filters('give_recount_form_stats_total_args', array( |
|
320 | 318 | 'post_parent__in' => $all_forms, |
321 | 319 | 'number' => $this->per_step, |
322 | 320 | 'status' => 'publish', |
323 | 321 | 'page' => $this->step, |
324 | 322 | 'output' => 'payments', |
325 | - ) ); |
|
323 | + )); |
|
326 | 324 | |
327 | - $payments_query = new Give_Payments_Query( $args ); |
|
325 | + $payments_query = new Give_Payments_Query($args); |
|
328 | 326 | $payments = $payments_query->get_payments(); |
329 | - $total = wp_count_posts( 'give_payment' )->publish; |
|
327 | + $total = wp_count_posts('give_payment')->publish; |
|
330 | 328 | |
331 | - $this->store_data( 'give_temp_all_payments_data', $payments ); |
|
329 | + $this->store_data('give_temp_all_payments_data', $payments); |
|
332 | 330 | |
333 | - if ( $payments ) { |
|
331 | + if ($payments) { |
|
334 | 332 | |
335 | - foreach ( $payments as $payment ) { |
|
333 | + foreach ($payments as $payment) { |
|
336 | 334 | |
337 | - $payment = new Give_Payment( $payment->ID ); |
|
335 | + $payment = new Give_Payment($payment->ID); |
|
338 | 336 | $form_id = $payment->form_id; |
339 | 337 | |
340 | 338 | //If for some reason somehow the form_ID isn't set check payment meta |
341 | - if ( empty( $payment->form_id ) ) { |
|
339 | + if (empty($payment->form_id)) { |
|
342 | 340 | $payment_meta = $payment->get_meta(); |
343 | - $form_id = isset( $payment_meta['form_id'] ) ? $payment_meta['form_id'] : 0; |
|
341 | + $form_id = isset($payment_meta['form_id']) ? $payment_meta['form_id'] : 0; |
|
344 | 342 | } |
345 | 343 | |
346 | - if ( ! in_array( $payment->post_status, $accepted_statuses ) ) { |
|
344 | + if ( ! in_array($payment->post_status, $accepted_statuses)) { |
|
347 | 345 | continue; |
348 | 346 | } |
349 | 347 | |
350 | - if ( ! array_key_exists( $payment->ID, $payment_items ) ) { |
|
351 | - $payment_items[ $payment->ID ] = array( |
|
348 | + if ( ! array_key_exists($payment->ID, $payment_items)) { |
|
349 | + $payment_items[$payment->ID] = array( |
|
352 | 350 | 'id' => $form_id, |
353 | 351 | 'payment_id' => $payment->ID, |
354 | 352 | 'price' => $payment->total |
@@ -359,8 +357,8 @@ discard block |
||
359 | 357 | |
360 | 358 | } |
361 | 359 | |
362 | - $this->store_data( 'give_temp_payment_items', $payment_items ); |
|
363 | - $this->store_data( 'give_recount_all_total', $total ); |
|
360 | + $this->store_data('give_temp_payment_items', $payment_items); |
|
361 | + $this->store_data('give_recount_all_total', $total); |
|
364 | 362 | } |
365 | 363 | |
366 | 364 | } |
@@ -374,11 +372,11 @@ discard block |
||
374 | 372 | * |
375 | 373 | * @return mixed Returns the data from the database |
376 | 374 | */ |
377 | - private function get_stored_data( $key ) { |
|
375 | + private function get_stored_data($key) { |
|
378 | 376 | global $wpdb; |
379 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
377 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
380 | 378 | |
381 | - return empty( $value ) ? false : maybe_unserialize( $value ); |
|
379 | + return empty($value) ? false : maybe_unserialize($value); |
|
382 | 380 | } |
383 | 381 | |
384 | 382 | /** |
@@ -391,10 +389,10 @@ discard block |
||
391 | 389 | * |
392 | 390 | * @return void |
393 | 391 | */ |
394 | - private function store_data( $key, $value ) { |
|
392 | + private function store_data($key, $value) { |
|
395 | 393 | global $wpdb; |
396 | 394 | |
397 | - $value = maybe_serialize( $value ); |
|
395 | + $value = maybe_serialize($value); |
|
398 | 396 | |
399 | 397 | $data = array( |
400 | 398 | 'option_name' => $key, |
@@ -408,7 +406,7 @@ discard block |
||
408 | 406 | '%s', |
409 | 407 | ); |
410 | 408 | |
411 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
409 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
412 | 410 | } |
413 | 411 | |
414 | 412 | /** |
@@ -420,9 +418,9 @@ discard block |
||
420 | 418 | * |
421 | 419 | * @return void |
422 | 420 | */ |
423 | - private function delete_data( $key ) { |
|
421 | + private function delete_data($key) { |
|
424 | 422 | global $wpdb; |
425 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
423 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
426 | 424 | } |
427 | 425 | |
428 | 426 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
11 | 11 | */ |
12 | 12 | |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_process_batch_export_form() { |
24 | 24 | |
25 | - if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'give-batch-export' ) ) { |
|
26 | - wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
25 | + if ( ! wp_verify_nonce($_REQUEST['nonce'], 'give-batch-export')) { |
|
26 | + wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array( |
|
27 | 27 | 'response' => 403, |
28 | - ) ); |
|
28 | + )); |
|
29 | 29 | } |
30 | 30 | |
31 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export.php'; |
|
31 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export.php'; |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Fires before batch export. |
@@ -37,14 +37,14 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param string $class Export class. |
39 | 39 | */ |
40 | - do_action( 'give_batch_export_class_include', $_REQUEST['class'] ); |
|
40 | + do_action('give_batch_export_class_include', $_REQUEST['class']); |
|
41 | 41 | |
42 | 42 | $export = new $_REQUEST['class']; |
43 | 43 | $export->export(); |
44 | 44 | |
45 | 45 | } |
46 | 46 | |
47 | -add_action( 'give_form_batch_export', 'give_process_batch_export_form' ); |
|
47 | +add_action('give_form_batch_export', 'give_process_batch_export_form'); |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Exports earnings for a specified time period. |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | * @return void |
56 | 56 | */ |
57 | 57 | function give_export_earnings() { |
58 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export-earnings.php'; |
|
58 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export-earnings.php'; |
|
59 | 59 | |
60 | 60 | $earnings_export = new Give_Earnings_Export(); |
61 | 61 | |
62 | 62 | $earnings_export->export(); |
63 | 63 | } |
64 | 64 | |
65 | -add_action( 'give_earnings_export', 'give_export_earnings' ); |
|
65 | +add_action('give_earnings_export', 'give_export_earnings'); |
|
66 | 66 | |
67 | 67 | |
68 | 68 | /** |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @return void |
73 | 73 | */ |
74 | 74 | function give_register_batch_exporters() { |
75 | - if ( is_admin() ) { |
|
75 | + if (is_admin()) { |
|
76 | 76 | /** |
77 | 77 | * Fires in the admin, while plugins loaded. |
78 | 78 | * |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @param string $class Export class. |
84 | 84 | */ |
85 | - do_action( 'give_register_batch_exporter' ); |
|
85 | + do_action('give_register_batch_exporter'); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
89 | -add_action( 'plugins_loaded', 'give_register_batch_exporters' ); |
|
89 | +add_action('plugins_loaded', 'give_register_batch_exporters'); |
|
90 | 90 | |
91 | 91 | /** |
92 | 92 | * Register the payments batch exporter |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | * @since 1.5 |
95 | 95 | */ |
96 | 96 | function give_register_payments_batch_export() { |
97 | - add_action( 'give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1 ); |
|
97 | + add_action('give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1); |
|
98 | 98 | } |
99 | 99 | |
100 | -add_action( 'give_register_batch_exporter', 'give_register_payments_batch_export', 10 ); |
|
100 | +add_action('give_register_batch_exporter', 'give_register_payments_batch_export', 10); |
|
101 | 101 | |
102 | 102 | /** |
103 | 103 | * Loads the payments batch process if needed |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return void |
110 | 110 | */ |
111 | -function give_include_payments_batch_processor( $class ) { |
|
111 | +function give_include_payments_batch_processor($class) { |
|
112 | 112 | |
113 | - if ( 'Give_Batch_Payments_Export' === $class ) { |
|
114 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-payments.php'; |
|
113 | + if ('Give_Batch_Payments_Export' === $class) { |
|
114 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-payments.php'; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | } |
@@ -122,10 +122,10 @@ discard block |
||
122 | 122 | * @since 1.5.2 |
123 | 123 | */ |
124 | 124 | function give_register_donors_batch_export() { |
125 | - add_action( 'give_batch_export_class_include', 'give_include_donors_batch_processor', 10, 1 ); |
|
125 | + add_action('give_batch_export_class_include', 'give_include_donors_batch_processor', 10, 1); |
|
126 | 126 | } |
127 | 127 | |
128 | -add_action( 'give_register_batch_exporter', 'give_register_donors_batch_export', 10 ); |
|
128 | +add_action('give_register_batch_exporter', 'give_register_donors_batch_export', 10); |
|
129 | 129 | |
130 | 130 | /** |
131 | 131 | * Loads the donors batch process if needed. |
@@ -136,10 +136,10 @@ discard block |
||
136 | 136 | * |
137 | 137 | * @return void |
138 | 138 | */ |
139 | -function give_include_donors_batch_processor( $class ) { |
|
139 | +function give_include_donors_batch_processor($class) { |
|
140 | 140 | |
141 | - if ( 'Give_Batch_Donors_Export' === $class ) { |
|
142 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-donors.php'; |
|
141 | + if ('Give_Batch_Donors_Export' === $class) { |
|
142 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-donors.php'; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | } |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | * @since 1.5 |
151 | 151 | */ |
152 | 152 | function give_register_forms_batch_export() { |
153 | - add_action( 'give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1 ); |
|
153 | + add_action('give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1); |
|
154 | 154 | } |
155 | 155 | |
156 | -add_action( 'give_register_batch_exporter', 'give_register_forms_batch_export', 10 ); |
|
156 | +add_action('give_register_batch_exporter', 'give_register_forms_batch_export', 10); |
|
157 | 157 | |
158 | 158 | /** |
159 | 159 | * Loads the file downloads batch process if needed |
@@ -164,10 +164,10 @@ discard block |
||
164 | 164 | * |
165 | 165 | * @return void |
166 | 166 | */ |
167 | -function give_include_forms_batch_processor( $class ) { |
|
167 | +function give_include_forms_batch_processor($class) { |
|
168 | 168 | |
169 | - if ( 'Give_Batch_Forms_Export' === $class ) { |
|
170 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-forms.php'; |
|
169 | + if ('Give_Batch_Forms_Export' === $class) { |
|
170 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export-forms.php'; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | } |
@@ -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 | |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_do_ajax_export() { |
27 | 27 | |
28 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export.php'; |
|
28 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export.php'; |
|
29 | 29 | |
30 | - parse_str( $_POST['form'], $form ); |
|
30 | + parse_str($_POST['form'], $form); |
|
31 | 31 | |
32 | 32 | $_REQUEST = $form = (array) $form; |
33 | 33 | |
34 | - if ( ! wp_verify_nonce( $_REQUEST['give_ajax_export'], 'give_ajax_export' ) ) { |
|
35 | - die( '-2' ); |
|
34 | + if ( ! wp_verify_nonce($_REQUEST['give_ajax_export'], 'give_ajax_export')) { |
|
35 | + die('-2'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -42,28 +42,28 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @param string $class Export class. |
44 | 44 | */ |
45 | - do_action( 'give_batch_export_class_include', $form['give-export-class'] ); |
|
45 | + do_action('give_batch_export_class_include', $form['give-export-class']); |
|
46 | 46 | |
47 | - $step = absint( $_POST['step'] ); |
|
48 | - $class = sanitize_text_field( $form['give-export-class'] ); |
|
47 | + $step = absint($_POST['step']); |
|
48 | + $class = sanitize_text_field($form['give-export-class']); |
|
49 | 49 | |
50 | 50 | /* @var Give_Batch_Export $export */ |
51 | - $export = new $class( $step ); |
|
51 | + $export = new $class($step); |
|
52 | 52 | |
53 | - if ( ! $export->can_export() ) { |
|
54 | - die( '-1' ); |
|
53 | + if ( ! $export->can_export()) { |
|
54 | + die('-1'); |
|
55 | 55 | } |
56 | 56 | |
57 | - if ( ! $export->is_writable ) { |
|
57 | + if ( ! $export->is_writable) { |
|
58 | 58 | $json_args = array( |
59 | 59 | 'error' => true, |
60 | - 'message' => esc_html__( 'Export location or file not writable.', 'give' ) |
|
60 | + 'message' => esc_html__('Export location or file not writable.', 'give') |
|
61 | 61 | ); |
62 | 62 | echo json_encode($json_args); |
63 | 63 | exit; |
64 | 64 | } |
65 | 65 | |
66 | - $export->set_properties( give_clean( $_REQUEST ) ); |
|
66 | + $export->set_properties(give_clean($_REQUEST)); |
|
67 | 67 | |
68 | 68 | $export->pre_fetch(); |
69 | 69 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | $percentage = $export->get_percentage_complete(); |
73 | 73 | |
74 | - if ( $ret ) { |
|
74 | + if ($ret) { |
|
75 | 75 | |
76 | 76 | $step += 1; |
77 | 77 | $json_data = array( |
@@ -79,18 +79,17 @@ discard block |
||
79 | 79 | 'percentage' => $percentage |
80 | 80 | ); |
81 | 81 | |
82 | - } elseif ( true === $export->is_empty ) { |
|
82 | + } elseif (true === $export->is_empty) { |
|
83 | 83 | |
84 | 84 | $json_data = array( |
85 | 85 | 'error' => true, |
86 | - 'message' => esc_html__( 'No data found for export parameters.', 'give' ) |
|
86 | + 'message' => esc_html__('No data found for export parameters.', 'give') |
|
87 | 87 | ); |
88 | 88 | |
89 | - } elseif ( true === $export->done && true === $export->is_void ) { |
|
89 | + } elseif (true === $export->done && true === $export->is_void) { |
|
90 | 90 | |
91 | - $message = ! empty( $export->message ) ? |
|
92 | - $export->message : |
|
93 | - esc_html__( 'Batch Processing Complete', 'give' ); |
|
91 | + $message = ! empty($export->message) ? |
|
92 | + $export->message : esc_html__('Batch Processing Complete', 'give'); |
|
94 | 93 | |
95 | 94 | $json_data = array( |
96 | 95 | 'success' => true, |
@@ -99,23 +98,23 @@ discard block |
||
99 | 98 | |
100 | 99 | } else { |
101 | 100 | |
102 | - $args = array_merge( $_REQUEST, array( |
|
101 | + $args = array_merge($_REQUEST, array( |
|
103 | 102 | 'step' => $step, |
104 | 103 | 'class' => $class, |
105 | - 'nonce' => wp_create_nonce( 'give-batch-export' ), |
|
104 | + 'nonce' => wp_create_nonce('give-batch-export'), |
|
106 | 105 | 'give_action' => 'form_batch_export', |
107 | - ) ); |
|
106 | + )); |
|
108 | 107 | |
109 | 108 | $json_data = array( |
110 | 109 | 'step' => 'done', |
111 | - 'url' => add_query_arg( $args, admin_url() ) |
|
110 | + 'url' => add_query_arg($args, admin_url()) |
|
112 | 111 | ); |
113 | 112 | |
114 | 113 | } |
115 | 114 | |
116 | - $export->unset_properties( give_clean( $_REQUEST ), $export ); |
|
117 | - echo json_encode( $json_data ); |
|
115 | + $export->unset_properties(give_clean($_REQUEST), $export); |
|
116 | + echo json_encode($json_data); |
|
118 | 117 | exit; |
119 | 118 | } |
120 | 119 | |
121 | -add_action( 'wp_ajax_give_do_ajax_export', 'give_do_ajax_export' ); |
|
120 | +add_action('wp_ajax_give_do_ajax_export', 'give_do_ajax_export'); |
@@ -245,7 +245,7 @@ |
||
245 | 245 | |
246 | 246 | // Continue if donor already included. |
247 | 247 | if ( empty( $payment->customer_id ) || |
248 | - in_array( $payment->customer_id, $cached_donor_ids ) |
|
248 | + in_array( $payment->customer_id, $cached_donor_ids ) |
|
249 | 249 | ) { |
250 | 250 | continue; |
251 | 251 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -70,23 +70,23 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @param array $request The Form Data passed into the batch processing |
72 | 72 | */ |
73 | - public function set_properties( $request ) { |
|
73 | + public function set_properties($request) { |
|
74 | 74 | |
75 | 75 | // Set data from form submission |
76 | - if ( isset( $_POST['form'] ) ) { |
|
77 | - parse_str( $_POST['form'], $this->data ); |
|
76 | + if (isset($_POST['form'])) { |
|
77 | + parse_str($_POST['form'], $this->data); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | $this->form = $this->data['forms']; |
81 | 81 | |
82 | 82 | // Setup donor ids cache. |
83 | - if ( ! empty( $this->form ) ) { |
|
83 | + if ( ! empty($this->form)) { |
|
84 | 84 | // Cache donor ids to output unique list of donor. |
85 | - $this->query_id = give_clean( $_REQUEST['give_export_option']['query_id'] ); |
|
85 | + $this->query_id = give_clean($_REQUEST['give_export_option']['query_id']); |
|
86 | 86 | $this->cache_donor_ids(); |
87 | 87 | } |
88 | 88 | |
89 | - $this->price_id = ! empty( $request['give_price_option'] ) && 'all' !== $request['give_price_option'] ? absint( $request['give_price_option'] ) : null; |
|
89 | + $this->price_id = ! empty($request['give_price_option']) && 'all' !== $request['give_price_option'] ? absint($request['give_price_option']) : null; |
|
90 | 90 | |
91 | 91 | } |
92 | 92 | |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | // Fetch already cached donor ids. |
102 | 102 | $donor_ids = $this->donor_ids; |
103 | 103 | |
104 | - if ( $cached_donor_ids = Give_Cache::get( $this->query_id, true ) ) { |
|
105 | - $donor_ids = array_unique( array_merge( $cached_donor_ids, $this->donor_ids ) ); |
|
104 | + if ($cached_donor_ids = Give_Cache::get($this->query_id, true)) { |
|
105 | + $donor_ids = array_unique(array_merge($cached_donor_ids, $this->donor_ids)); |
|
106 | 106 | } |
107 | 107 | |
108 | - $donor_ids = array_values( $donor_ids ); |
|
109 | - Give_Cache::set( $this->query_id, $donor_ids, HOUR_IN_SECONDS, true ); |
|
108 | + $donor_ids = array_values($donor_ids); |
|
109 | + Give_Cache::set($this->query_id, $donor_ids, HOUR_IN_SECONDS, true); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -118,14 +118,14 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function csv_cols() { |
120 | 120 | |
121 | - $columns = isset( $this->data['give_export_option'] ) ? $this->data['give_export_option'] : array(); |
|
121 | + $columns = isset($this->data['give_export_option']) ? $this->data['give_export_option'] : array(); |
|
122 | 122 | |
123 | 123 | // We need columns. |
124 | - if ( empty( $columns ) ) { |
|
124 | + if (empty($columns)) { |
|
125 | 125 | return false; |
126 | 126 | } |
127 | 127 | |
128 | - $cols = $this->get_cols( $columns ); |
|
128 | + $cols = $this->get_cols($columns); |
|
129 | 129 | |
130 | 130 | return $cols; |
131 | 131 | } |
@@ -137,41 +137,41 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @return array |
139 | 139 | */ |
140 | - private function get_cols( $columns ) { |
|
140 | + private function get_cols($columns) { |
|
141 | 141 | |
142 | 142 | $cols = array(); |
143 | 143 | |
144 | - foreach ( $columns as $key => $value ) { |
|
144 | + foreach ($columns as $key => $value) { |
|
145 | 145 | |
146 | - switch ( $key ) { |
|
146 | + switch ($key) { |
|
147 | 147 | case 'full_name' : |
148 | - $cols['full_name'] = esc_html__( 'Full Name', 'give' ); |
|
148 | + $cols['full_name'] = esc_html__('Full Name', 'give'); |
|
149 | 149 | break; |
150 | 150 | case 'email' : |
151 | - $cols['email'] = esc_html__( 'Email Address', 'give' ); |
|
151 | + $cols['email'] = esc_html__('Email Address', 'give'); |
|
152 | 152 | break; |
153 | 153 | case 'address' : |
154 | - $cols['address_line1'] = esc_html__( 'Address', 'give' ); |
|
155 | - $cols['address_line2'] = esc_html__( 'Address 2', 'give' ); |
|
156 | - $cols['address_city'] = esc_html__( 'City', 'give' ); |
|
157 | - $cols['address_state'] = esc_html__( 'State', 'give' ); |
|
158 | - $cols['address_zip'] = esc_html__( 'Zip', 'give' ); |
|
159 | - $cols['address_country'] = esc_html__( 'Country', 'give' ); |
|
154 | + $cols['address_line1'] = esc_html__('Address', 'give'); |
|
155 | + $cols['address_line2'] = esc_html__('Address 2', 'give'); |
|
156 | + $cols['address_city'] = esc_html__('City', 'give'); |
|
157 | + $cols['address_state'] = esc_html__('State', 'give'); |
|
158 | + $cols['address_zip'] = esc_html__('Zip', 'give'); |
|
159 | + $cols['address_country'] = esc_html__('Country', 'give'); |
|
160 | 160 | break; |
161 | 161 | case 'userid' : |
162 | - $cols['userid'] = esc_html__( 'User ID', 'give' ); |
|
162 | + $cols['userid'] = esc_html__('User ID', 'give'); |
|
163 | 163 | break; |
164 | 164 | case 'donation_form' : |
165 | - $cols['donation_form'] = esc_html__( 'Donation Form', 'give' ); |
|
165 | + $cols['donation_form'] = esc_html__('Donation Form', 'give'); |
|
166 | 166 | break; |
167 | 167 | case 'date_first_donated' : |
168 | - $cols['date_first_donated'] = esc_html__( 'First Donation Date', 'give' ); |
|
168 | + $cols['date_first_donated'] = esc_html__('First Donation Date', 'give'); |
|
169 | 169 | break; |
170 | 170 | case 'donations' : |
171 | - $cols['donations'] = esc_html__( 'Number of Donations', 'give' ); |
|
171 | + $cols['donations'] = esc_html__('Number of Donations', 'give'); |
|
172 | 172 | break; |
173 | 173 | case 'donation_sum' : |
174 | - $cols['donation_sum'] = esc_html__( 'Sum of Donations', 'give' ); |
|
174 | + $cols['donation_sum'] = esc_html__('Sum of Donations', 'give'); |
|
175 | 175 | break; |
176 | 176 | } |
177 | 177 | } |
@@ -192,29 +192,29 @@ discard block |
||
192 | 192 | $i = 0; |
193 | 193 | |
194 | 194 | $data = array(); |
195 | - $cached_donor_ids = Give_Cache::get( $this->query_id, true ); |
|
195 | + $cached_donor_ids = Give_Cache::get($this->query_id, true); |
|
196 | 196 | |
197 | - if ( ! empty( $this->form ) ) { |
|
197 | + if ( ! empty($this->form)) { |
|
198 | 198 | |
199 | 199 | // Export donors for a specific donation form and also within specified timeframe |
200 | 200 | $args = array( |
201 | 201 | 'output' => 'payments', // Use 'posts' to get standard post objects |
202 | - 'post_type' => array( 'give_payment' ), |
|
202 | + 'post_type' => array('give_payment'), |
|
203 | 203 | 'number' => 30, |
204 | 204 | 'paged' => $this->step, |
205 | 205 | 'status' => 'publish', |
206 | 206 | 'meta_key' => '_give_payment_form_id', |
207 | - 'meta_value' => absint( $this->form ), |
|
207 | + 'meta_value' => absint($this->form), |
|
208 | 208 | ); |
209 | 209 | |
210 | 210 | // Check for date option filter |
211 | - if ( ! empty( $this->data['donor_export_start_date'] ) || ! empty( $this->data['donor_export_end_date'] ) ) { |
|
212 | - $args['start_date'] = ! empty( $this->data['donor_export_start_date'] ) ? date( 'Y-n-d 00:00:00', strtotime( $this->data['donor_export_start_date'] ) ) : date( 'Y-n-d 23:59:59', '1970-1-01 00:00:00' ); |
|
213 | - $args['end_date'] = ! empty( $this->data['donor_export_end_date'] ) ? date( 'Y-n-d 23:59:59', strtotime( $this->data['donor_export_end_date'] ) ) : date( 'Y-n-d 23:59:59', current_time( 'timestamp' ) ); |
|
211 | + if ( ! empty($this->data['donor_export_start_date']) || ! empty($this->data['donor_export_end_date'])) { |
|
212 | + $args['start_date'] = ! empty($this->data['donor_export_start_date']) ? date('Y-n-d 00:00:00', strtotime($this->data['donor_export_start_date'])) : date('Y-n-d 23:59:59', '1970-1-01 00:00:00'); |
|
213 | + $args['end_date'] = ! empty($this->data['donor_export_end_date']) ? date('Y-n-d 23:59:59', strtotime($this->data['donor_export_end_date'])) : date('Y-n-d 23:59:59', current_time('timestamp')); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | // Check for price option. |
217 | - if ( null !== $this->price_id ) { |
|
217 | + if (null !== $this->price_id) { |
|
218 | 218 | $args['meta_query'] = array( |
219 | 219 | array( |
220 | 220 | 'key' => '_give_payment_price_id', |
@@ -223,45 +223,43 @@ discard block |
||
223 | 223 | ); |
224 | 224 | } |
225 | 225 | |
226 | - $payments_query = new Give_Payments_Query( $args ); |
|
226 | + $payments_query = new Give_Payments_Query($args); |
|
227 | 227 | $payments = $payments_query->get_payments(); |
228 | 228 | |
229 | - if ( $payments ) { |
|
229 | + if ($payments) { |
|
230 | 230 | /* @var Give_Payment $payment */ |
231 | - foreach ( $payments as $payment ) { |
|
231 | + foreach ($payments as $payment) { |
|
232 | 232 | // Set donation sum. |
233 | - $this->payment_stats[ $payment->customer_id ]['donation_sum'] = isset( $this->payment_stats[ $payment->customer_id ]['donation_sum'] ) ? |
|
234 | - $this->payment_stats[ $payment->customer_id ]['donation_sum'] : |
|
235 | - 0; |
|
236 | - $this->payment_stats[ $payment->customer_id ]['donation_sum'] += $payment->total; |
|
233 | + $this->payment_stats[$payment->customer_id]['donation_sum'] = isset($this->payment_stats[$payment->customer_id]['donation_sum']) ? |
|
234 | + $this->payment_stats[$payment->customer_id]['donation_sum'] : 0; |
|
235 | + $this->payment_stats[$payment->customer_id]['donation_sum'] += $payment->total; |
|
237 | 236 | |
238 | 237 | // Set donation count. |
239 | - $this->payment_stats[ $payment->customer_id ]['donations'] = isset( $this->payment_stats[ $payment->customer_id ]['donations'] ) ? |
|
240 | - ++ $this->payment_stats[ $payment->customer_id ]['donations'] : |
|
241 | - 1; |
|
238 | + $this->payment_stats[$payment->customer_id]['donations'] = isset($this->payment_stats[$payment->customer_id]['donations']) ? |
|
239 | + ++$this->payment_stats[$payment->customer_id]['donations'] : 1; |
|
242 | 240 | |
243 | 241 | // Set donation form name. |
244 | - $this->payment_stats[ $payment->customer_id ]['form_title'] = $payment->form_title; |
|
242 | + $this->payment_stats[$payment->customer_id]['form_title'] = $payment->form_title; |
|
245 | 243 | |
246 | 244 | // Continue if donor already included. |
247 | - if ( empty( $payment->customer_id ) || |
|
248 | - in_array( $payment->customer_id, $cached_donor_ids ) |
|
245 | + if (empty($payment->customer_id) || |
|
246 | + in_array($payment->customer_id, $cached_donor_ids) |
|
249 | 247 | ) { |
250 | 248 | continue; |
251 | 249 | } |
252 | 250 | |
253 | 251 | $this->donor_ids[] = $cached_donor_ids[] = $payment->customer_id; |
254 | 252 | |
255 | - $i ++; |
|
253 | + $i++; |
|
256 | 254 | } |
257 | 255 | |
258 | - if ( ! empty( $this->donor_ids ) ) { |
|
259 | - foreach ( $this->donor_ids as $donor_id ) { |
|
260 | - $donor = Give()->donors->get_donor_by( 'id', $donor_id ); |
|
261 | - $donor->donation_form_title = $this->payment_stats[ $donor_id ]['form_title']; |
|
262 | - $donor->purchase_count = $this->payment_stats[ $donor_id ]['donations']; |
|
263 | - $donor->purchase_value = $this->payment_stats[ $donor_id ]['donation_sum']; |
|
264 | - $data[] = $this->set_donor_data( $i, $data, $donor ); |
|
256 | + if ( ! empty($this->donor_ids)) { |
|
257 | + foreach ($this->donor_ids as $donor_id) { |
|
258 | + $donor = Give()->donors->get_donor_by('id', $donor_id); |
|
259 | + $donor->donation_form_title = $this->payment_stats[$donor_id]['form_title']; |
|
260 | + $donor->purchase_count = $this->payment_stats[$donor_id]['donations']; |
|
261 | + $donor->purchase_value = $this->payment_stats[$donor_id]['donation_sum']; |
|
262 | + $data[] = $this->set_donor_data($i, $data, $donor); |
|
265 | 263 | } |
266 | 264 | |
267 | 265 | // Cache donor ids only if admin export donor for specific form. |
@@ -271,7 +269,7 @@ discard block |
||
271 | 269 | } else { |
272 | 270 | |
273 | 271 | // Export all donors. |
274 | - $offset = 30 * ( $this->step - 1 ); |
|
272 | + $offset = 30 * ($this->step - 1); |
|
275 | 273 | |
276 | 274 | $args = array( |
277 | 275 | 'number' => 30, |
@@ -279,31 +277,31 @@ discard block |
||
279 | 277 | ); |
280 | 278 | |
281 | 279 | // Check for date option filter |
282 | - if ( ! empty( $this->data['donor_export_start_date'] ) || ! empty( $this->data['donor_export_end_date'] ) ) { |
|
280 | + if ( ! empty($this->data['donor_export_start_date']) || ! empty($this->data['donor_export_end_date'])) { |
|
283 | 281 | $args['date'] = array( |
284 | - 'start' => ! empty( $this->data['donor_export_start_date'] ) ? date( 'Y-n-d 00:00:00', strtotime( $this->data['donor_export_start_date'] ) ) : date( 'Y-n-d 23:59:59', '1970-1-01 00:00:00' ), |
|
285 | - 'end' => ! empty( $this->data['donor_export_end_date'] ) ? date( 'Y-n-d 23:59:59', strtotime( $this->data['donor_export_end_date'] ) ) : date( 'Y-n-d 23:59:59', current_time( 'timestamp' ) ), |
|
282 | + 'start' => ! empty($this->data['donor_export_start_date']) ? date('Y-n-d 00:00:00', strtotime($this->data['donor_export_start_date'])) : date('Y-n-d 23:59:59', '1970-1-01 00:00:00'), |
|
283 | + 'end' => ! empty($this->data['donor_export_end_date']) ? date('Y-n-d 23:59:59', strtotime($this->data['donor_export_end_date'])) : date('Y-n-d 23:59:59', current_time('timestamp')), |
|
286 | 284 | ); |
287 | 285 | } |
288 | 286 | |
289 | - $donors = Give()->donors->get_donors( $args ); |
|
287 | + $donors = Give()->donors->get_donors($args); |
|
290 | 288 | |
291 | - foreach ( $donors as $donor ) { |
|
289 | + foreach ($donors as $donor) { |
|
292 | 290 | |
293 | 291 | // Continue if donor already included. |
294 | - if ( empty( $donor->id ) || empty( $donor->payment_ids ) ) { |
|
292 | + if (empty($donor->id) || empty($donor->payment_ids)) { |
|
295 | 293 | continue; |
296 | 294 | } |
297 | 295 | |
298 | - $payment = new Give_Payment( $donor->payment_ids ); |
|
296 | + $payment = new Give_Payment($donor->payment_ids); |
|
299 | 297 | $donor->donation_form_title = $payment->form_title; |
300 | - $data[] = $this->set_donor_data( $i, $data, $donor ); |
|
301 | - $i ++; |
|
298 | + $data[] = $this->set_donor_data($i, $data, $donor); |
|
299 | + $i++; |
|
302 | 300 | } |
303 | 301 | }// End if(). |
304 | 302 | |
305 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
306 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
303 | + $data = apply_filters('give_export_get_data', $data); |
|
304 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
307 | 305 | |
308 | 306 | return $data; |
309 | 307 | } |
@@ -319,18 +317,18 @@ discard block |
||
319 | 317 | $percentage = 0; |
320 | 318 | |
321 | 319 | // We can't count the number when getting them for a specific form. |
322 | - if ( empty( $this->form ) ) { |
|
320 | + if (empty($this->form)) { |
|
323 | 321 | |
324 | 322 | $total = Give()->donors->count(); |
325 | 323 | |
326 | - if ( $total > 0 ) { |
|
324 | + if ($total > 0) { |
|
327 | 325 | |
328 | - $percentage = ( ( 30 * $this->step ) / $total ) * 100; |
|
326 | + $percentage = ((30 * $this->step) / $total) * 100; |
|
329 | 327 | |
330 | 328 | } |
331 | 329 | } |
332 | 330 | |
333 | - if ( $percentage > 100 ) { |
|
331 | + if ($percentage > 100) { |
|
334 | 332 | $percentage = 100; |
335 | 333 | } |
336 | 334 | |
@@ -346,49 +344,49 @@ discard block |
||
346 | 344 | * |
347 | 345 | * @return mixed |
348 | 346 | */ |
349 | - private function set_donor_data( $i, $data, $donor ) { |
|
347 | + private function set_donor_data($i, $data, $donor) { |
|
350 | 348 | |
351 | 349 | $columns = $this->csv_cols(); |
352 | 350 | |
353 | 351 | // Set address variable |
354 | 352 | $address = ''; |
355 | - if ( isset( $donor->user_id ) && $donor->user_id > 0 ) { |
|
356 | - $address = give_get_donor_address( $donor->user_id ); |
|
353 | + if (isset($donor->user_id) && $donor->user_id > 0) { |
|
354 | + $address = give_get_donor_address($donor->user_id); |
|
357 | 355 | } |
358 | 356 | |
359 | 357 | // Set columns |
360 | - if ( ! empty( $columns['full_name'] ) ) { |
|
361 | - $data[ $i ]['full_name'] = $donor->name; |
|
358 | + if ( ! empty($columns['full_name'])) { |
|
359 | + $data[$i]['full_name'] = $donor->name; |
|
362 | 360 | } |
363 | - if ( ! empty( $columns['email'] ) ) { |
|
364 | - $data[ $i ]['email'] = $donor->email; |
|
361 | + if ( ! empty($columns['email'])) { |
|
362 | + $data[$i]['email'] = $donor->email; |
|
365 | 363 | } |
366 | - if ( ! empty( $columns['address_line1'] ) ) { |
|
367 | - |
|
368 | - $data[ $i ]['address_line1'] = isset( $address['line1'] ) ? $address['line1'] : ''; |
|
369 | - $data[ $i ]['address_line2'] = isset( $address['line2'] ) ? $address['line2'] : ''; |
|
370 | - $data[ $i ]['address_city'] = isset( $address['city'] ) ? $address['city'] : ''; |
|
371 | - $data[ $i ]['address_state'] = isset( $address['state'] ) ? $address['state'] : ''; |
|
372 | - $data[ $i ]['address_zip'] = isset( $address['zip'] ) ? $address['zip'] : ''; |
|
373 | - $data[ $i ]['address_country'] = isset( $address['country'] ) ? $address['country'] : ''; |
|
364 | + if ( ! empty($columns['address_line1'])) { |
|
365 | + |
|
366 | + $data[$i]['address_line1'] = isset($address['line1']) ? $address['line1'] : ''; |
|
367 | + $data[$i]['address_line2'] = isset($address['line2']) ? $address['line2'] : ''; |
|
368 | + $data[$i]['address_city'] = isset($address['city']) ? $address['city'] : ''; |
|
369 | + $data[$i]['address_state'] = isset($address['state']) ? $address['state'] : ''; |
|
370 | + $data[$i]['address_zip'] = isset($address['zip']) ? $address['zip'] : ''; |
|
371 | + $data[$i]['address_country'] = isset($address['country']) ? $address['country'] : ''; |
|
374 | 372 | } |
375 | - if ( ! empty( $columns['userid'] ) ) { |
|
376 | - $data[ $i ]['userid'] = ! empty( $donor->user_id ) ? $donor->user_id : ''; |
|
373 | + if ( ! empty($columns['userid'])) { |
|
374 | + $data[$i]['userid'] = ! empty($donor->user_id) ? $donor->user_id : ''; |
|
377 | 375 | } |
378 | - if ( ! empty( $columns['donation_form'] ) ) { |
|
379 | - $data[ $i ]['donation_form'] = ! empty( $donor->donation_form_title ) ? $donor->donation_form_title : ''; |
|
376 | + if ( ! empty($columns['donation_form'])) { |
|
377 | + $data[$i]['donation_form'] = ! empty($donor->donation_form_title) ? $donor->donation_form_title : ''; |
|
380 | 378 | } |
381 | - if ( ! empty( $columns['date_first_donated'] ) ) { |
|
382 | - $data[ $i ]['date_first_donated'] = date_i18n( give_date_format(), strtotime( $donor->date_created ) ); |
|
379 | + if ( ! empty($columns['date_first_donated'])) { |
|
380 | + $data[$i]['date_first_donated'] = date_i18n(give_date_format(), strtotime($donor->date_created)); |
|
383 | 381 | } |
384 | - if ( ! empty( $columns['donations'] ) ) { |
|
385 | - $data[ $i ]['donations'] = $donor->purchase_count; |
|
382 | + if ( ! empty($columns['donations'])) { |
|
383 | + $data[$i]['donations'] = $donor->purchase_count; |
|
386 | 384 | } |
387 | - if ( ! empty( $columns['donation_sum'] ) ) { |
|
388 | - $data[ $i ]['donation_sum'] = give_format_amount( $donor->purchase_value ); |
|
385 | + if ( ! empty($columns['donation_sum'])) { |
|
386 | + $data[$i]['donation_sum'] = give_format_amount($donor->purchase_value); |
|
389 | 387 | } |
390 | 388 | |
391 | - return $data[ $i ]; |
|
389 | + return $data[$i]; |
|
392 | 390 | |
393 | 391 | } |
394 | 392 | |
@@ -398,9 +396,9 @@ discard block |
||
398 | 396 | * @param array $request |
399 | 397 | * @param Give_Batch_Export $export |
400 | 398 | */ |
401 | - public function unset_properties( $request, $export ) { |
|
402 | - if ( $export->done ) { |
|
403 | - Give_Cache::delete( "give_cache_{$this->query_id}" ); |
|
399 | + public function unset_properties($request, $export) { |
|
400 | + if ($export->done) { |
|
401 | + Give_Cache::delete("give_cache_{$this->query_id}"); |
|
404 | 402 | } |
405 | 403 | } |
406 | 404 | } |
407 | 405 | \ No newline at end of file |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -118,14 +118,14 @@ discard block |
||
118 | 118 | * |
119 | 119 | * @param int $_step |
120 | 120 | */ |
121 | - public function __construct( $_step = 1 ) { |
|
121 | + public function __construct($_step = 1) { |
|
122 | 122 | |
123 | 123 | $upload_dir = wp_upload_dir(); |
124 | 124 | $this->filetype = '.csv'; |
125 | - $this->filename = 'give-' . $this->export_type . $this->filetype; |
|
126 | - $this->file = trailingslashit( $upload_dir['basedir'] ) . $this->filename; |
|
125 | + $this->filename = 'give-'.$this->export_type.$this->filetype; |
|
126 | + $this->file = trailingslashit($upload_dir['basedir']).$this->filename; |
|
127 | 127 | |
128 | - if ( ! is_writeable( $upload_dir['basedir'] ) ) { |
|
128 | + if ( ! is_writeable($upload_dir['basedir'])) { |
|
129 | 129 | $this->is_writable = false; |
130 | 130 | } |
131 | 131 | |
@@ -141,22 +141,22 @@ discard block |
||
141 | 141 | */ |
142 | 142 | public function process_step() { |
143 | 143 | |
144 | - if ( ! $this->can_export() ) { |
|
145 | - wp_die( esc_html__( 'You do not have permission to export data.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
144 | + if ( ! $this->can_export()) { |
|
145 | + wp_die(esc_html__('You do not have permission to export data.', 'give'), esc_html__('Error', 'give'), array( |
|
146 | 146 | 'response' => 403, |
147 | - ) ); |
|
147 | + )); |
|
148 | 148 | } |
149 | 149 | |
150 | - if ( $this->step < 2 ) { |
|
150 | + if ($this->step < 2) { |
|
151 | 151 | |
152 | 152 | // Make sure we start with a fresh file on step 1. |
153 | - @unlink( $this->file ); |
|
153 | + @unlink($this->file); |
|
154 | 154 | $this->print_csv_cols(); |
155 | 155 | } |
156 | 156 | |
157 | 157 | $rows = $this->print_csv_rows(); |
158 | 158 | |
159 | - if ( $rows ) { |
|
159 | + if ($rows) { |
|
160 | 160 | return true; |
161 | 161 | } else { |
162 | 162 | return false; |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | $col_data = ''; |
177 | 177 | $cols = $this->get_csv_cols(); |
178 | 178 | $i = 1; |
179 | - foreach ( $cols as $col_id => $column ) { |
|
180 | - $col_data .= '"' . addslashes( $column ) . '"'; |
|
181 | - $col_data .= $i == count( $cols ) ? '' : ','; |
|
182 | - $i ++; |
|
179 | + foreach ($cols as $col_id => $column) { |
|
180 | + $col_data .= '"'.addslashes($column).'"'; |
|
181 | + $col_data .= $i == count($cols) ? '' : ','; |
|
182 | + $i++; |
|
183 | 183 | } |
184 | 184 | $col_data .= "\r\n"; |
185 | 185 | |
186 | - $this->stash_step_data( $col_data ); |
|
186 | + $this->stash_step_data($col_data); |
|
187 | 187 | |
188 | 188 | return $col_data; |
189 | 189 | |
@@ -202,23 +202,23 @@ discard block |
||
202 | 202 | $data = $this->get_data(); |
203 | 203 | $cols = $this->get_csv_cols(); |
204 | 204 | |
205 | - if ( $data ) { |
|
205 | + if ($data) { |
|
206 | 206 | |
207 | 207 | // Output each row |
208 | - foreach ( $data as $row ) { |
|
208 | + foreach ($data as $row) { |
|
209 | 209 | $i = 1; |
210 | - foreach ( $row as $col_id => $column ) { |
|
210 | + foreach ($row as $col_id => $column) { |
|
211 | 211 | // Make sure the column is valid |
212 | - if ( array_key_exists( $col_id, $cols ) ) { |
|
213 | - $row_data .= '"' . addslashes( preg_replace( '/"/', "'", $column ) ) . '"'; |
|
214 | - $row_data .= $i == count( $cols ) ? '' : ','; |
|
215 | - $i ++; |
|
212 | + if (array_key_exists($col_id, $cols)) { |
|
213 | + $row_data .= '"'.addslashes(preg_replace('/"/', "'", $column)).'"'; |
|
214 | + $row_data .= $i == count($cols) ? '' : ','; |
|
215 | + $i++; |
|
216 | 216 | } |
217 | 217 | } |
218 | 218 | $row_data .= "\r\n"; |
219 | 219 | } |
220 | 220 | |
221 | - $this->stash_step_data( $row_data ); |
|
221 | + $this->stash_step_data($row_data); |
|
222 | 222 | |
223 | 223 | return $row_data; |
224 | 224 | } |
@@ -246,18 +246,18 @@ discard block |
||
246 | 246 | |
247 | 247 | $file = ''; |
248 | 248 | |
249 | - if ( @file_exists( $this->file ) ) { |
|
249 | + if (@file_exists($this->file)) { |
|
250 | 250 | |
251 | - if ( ! is_writeable( $this->file ) ) { |
|
251 | + if ( ! is_writeable($this->file)) { |
|
252 | 252 | $this->is_writable = false; |
253 | 253 | } |
254 | 254 | |
255 | - $file = @file_get_contents( $this->file ); |
|
255 | + $file = @file_get_contents($this->file); |
|
256 | 256 | |
257 | 257 | } else { |
258 | 258 | |
259 | - @file_put_contents( $this->file, '' ); |
|
260 | - @chmod( $this->file, 0664 ); |
|
259 | + @file_put_contents($this->file, ''); |
|
260 | + @chmod($this->file, 0664); |
|
261 | 261 | |
262 | 262 | } |
263 | 263 | |
@@ -273,18 +273,18 @@ discard block |
||
273 | 273 | * |
274 | 274 | * @return void |
275 | 275 | */ |
276 | - protected function stash_step_data( $data = '' ) { |
|
276 | + protected function stash_step_data($data = '') { |
|
277 | 277 | |
278 | 278 | $file = $this->get_file(); |
279 | 279 | $file .= $data; |
280 | - @file_put_contents( $this->file, $file ); |
|
280 | + @file_put_contents($this->file, $file); |
|
281 | 281 | |
282 | 282 | // If we have no rows after this step, mark it as an empty export. |
283 | - $file_rows = file( $this->file, FILE_SKIP_EMPTY_LINES ); |
|
283 | + $file_rows = file($this->file, FILE_SKIP_EMPTY_LINES); |
|
284 | 284 | $default_cols = $this->get_csv_cols(); |
285 | - $default_cols = empty( $default_cols ) ? 0 : 1; |
|
285 | + $default_cols = empty($default_cols) ? 0 : 1; |
|
286 | 286 | |
287 | - $this->is_empty = count( $file_rows ) == $default_cols ? true : false; |
|
287 | + $this->is_empty = count($file_rows) == $default_cols ? true : false; |
|
288 | 288 | |
289 | 289 | } |
290 | 290 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | |
303 | 303 | $file = $this->get_file(); |
304 | 304 | |
305 | - @unlink( $this->file ); |
|
305 | + @unlink($this->file); |
|
306 | 306 | |
307 | 307 | echo $file; |
308 | 308 | |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | * |
312 | 312 | * @since 1.8 |
313 | 313 | */ |
314 | - do_action( 'give_file_export_complete', $_REQUEST ); |
|
314 | + do_action('give_file_export_complete', $_REQUEST); |
|
315 | 315 | |
316 | 316 | give_die(); |
317 | 317 | } |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * |
324 | 324 | * @param array $request The Form Data passed into the batch processing. |
325 | 325 | */ |
326 | - public function set_properties( $request ) { |
|
326 | + public function set_properties($request) { |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | * @param array $request The Form Data passed into the batch processing. |
335 | 335 | * @param Give_Batch_Export $export |
336 | 336 | */ |
337 | - public function unset_properties( $request, $export ) { |
|
337 | + public function unset_properties($request, $export) { |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | /** |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Exit if accessed directly. |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
16 | 16 | // Load WP_List_Table if not loaded |
17 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
18 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
17 | +if ( ! class_exists('WP_List_Table')) { |
|
18 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | global $status, $page; |
45 | 45 | |
46 | 46 | // Set parent defaults |
47 | - parent::__construct( array( |
|
48 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
49 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
50 | - 'ajax' => false,// Does this table support ajax? |
|
51 | - ) ); |
|
47 | + parent::__construct(array( |
|
48 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
49 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
50 | + 'ajax' => false, // Does this table support ajax? |
|
51 | + )); |
|
52 | 52 | |
53 | - add_action( 'give_log_view_actions', array( $this, 'give_forms_filter' ) ); |
|
53 | + add_action('give_log_view_actions', array($this, 'give_forms_filter')); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -64,39 +64,39 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return string Column Name |
66 | 66 | */ |
67 | - public function column_default( $item, $column_name ) { |
|
67 | + public function column_default($item, $column_name) { |
|
68 | 68 | |
69 | - $payment = give_get_payment_by( 'id', $item['payment_id'] ); |
|
69 | + $payment = give_get_payment_by('id', $item['payment_id']); |
|
70 | 70 | |
71 | - switch ( $column_name ) { |
|
71 | + switch ($column_name) { |
|
72 | 72 | case 'form' : |
73 | - $form_title = get_the_title( $item[ $column_name ] ); |
|
74 | - $form_title = empty( $form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $item[ $column_name ] ) : $form_title; |
|
75 | - return '<a href="' . esc_url( add_query_arg( 'form', $item[ $column_name ] ) ) . '" >' . $form_title . '</a>'; |
|
73 | + $form_title = get_the_title($item[$column_name]); |
|
74 | + $form_title = empty($form_title) ? sprintf(__('Untitled (#%s)', 'give'), $item[$column_name]) : $form_title; |
|
75 | + return '<a href="'.esc_url(add_query_arg('form', $item[$column_name])).'" >'.$form_title.'</a>'; |
|
76 | 76 | |
77 | 77 | case 'user_id' : |
78 | - return '<a href="' . |
|
79 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . ( ! empty( $item['user_id'] ) ? urlencode( $item['user_id'] ) : give_get_payment_user_email( $item['payment_id'] ) ) ) . |
|
80 | - '">' . $item['user_name'] . '</a>'; |
|
78 | + return '<a href="'. |
|
79 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.( ! empty($item['user_id']) ? urlencode($item['user_id']) : give_get_payment_user_email($item['payment_id']))). |
|
80 | + '">'.$item['user_name'].'</a>'; |
|
81 | 81 | |
82 | 82 | case 'amount' : |
83 | - return give_currency_filter( give_format_amount( $item['amount'] ) ); |
|
83 | + return give_currency_filter(give_format_amount($item['amount'])); |
|
84 | 84 | |
85 | 85 | case 'status' : |
86 | 86 | |
87 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
87 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
88 | 88 | |
89 | - if ( $payment->mode == 'test' ) { |
|
90 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . __( 'Test', 'give' ) . '</span>'; |
|
89 | + if ($payment->mode == 'test') { |
|
90 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.__('Test', 'give').'</span>'; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | return $value; |
94 | 94 | |
95 | 95 | case 'payment_id' : |
96 | - return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $item['payment_id'] ) . '">' . give_get_payment_number( $item['payment_id'] ) . '</a>'; |
|
96 | + return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$item['payment_id']).'">'.give_get_payment_number($item['payment_id']).'</a>'; |
|
97 | 97 | |
98 | 98 | default: |
99 | - return $item[ $column_name ]; |
|
99 | + return $item[$column_name]; |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
@@ -109,13 +109,13 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function get_columns() { |
111 | 111 | $columns = array( |
112 | - 'ID' => __( 'Log ID', 'give' ), |
|
113 | - 'user_id' => __( 'Donor', 'give' ), |
|
114 | - 'form' => __( 'Form', 'give' ), |
|
115 | - 'amount' => __( 'Donation Amount', 'give' ), |
|
116 | - 'status' => __( 'Status', 'give' ), |
|
117 | - 'payment_id' => __( 'Donation ID', 'give' ), |
|
118 | - 'date' => __( 'Date', 'give' ), |
|
112 | + 'ID' => __('Log ID', 'give'), |
|
113 | + 'user_id' => __('Donor', 'give'), |
|
114 | + 'form' => __('Form', 'give'), |
|
115 | + 'amount' => __('Donation Amount', 'give'), |
|
116 | + 'status' => __('Status', 'give'), |
|
117 | + 'payment_id' => __('Donation ID', 'give'), |
|
118 | + 'date' => __('Date', 'give'), |
|
119 | 119 | ); |
120 | 120 | |
121 | 121 | return $columns; |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * @return int Current page number |
130 | 130 | */ |
131 | 131 | public function get_paged() { |
132 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
132 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @return mixed int If User ID, string If Email/Login |
141 | 141 | */ |
142 | 142 | public function get_filtered_user() { |
143 | - return isset( $_GET['user'] ) ? absint( $_GET['user'] ) : false; |
|
143 | + return isset($_GET['user']) ? absint($_GET['user']) : false; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @return int Download ID |
152 | 152 | */ |
153 | 153 | public function get_filtered_give_form() { |
154 | - return ! empty( $_GET['form'] ) ? absint( $_GET['form'] ) : false; |
|
154 | + return ! empty($_GET['form']) ? absint($_GET['form']) : false; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @return string|bool string If search is present, false otherwise |
163 | 163 | */ |
164 | 164 | public function get_search() { |
165 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
165 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | |
@@ -178,20 +178,20 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @param string $which |
180 | 180 | */ |
181 | - protected function display_tablenav( $which ) { |
|
181 | + protected function display_tablenav($which) { |
|
182 | 182 | |
183 | - if ( 'top' === $which ) { |
|
184 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
183 | + if ('top' === $which) { |
|
184 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
185 | 185 | } |
186 | 186 | ?> |
187 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
187 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
188 | 188 | |
189 | 189 | <div class="alignleft actions bulkactions"> |
190 | - <?php $this->bulk_actions( $which ); ?> |
|
190 | + <?php $this->bulk_actions($which); ?> |
|
191 | 191 | </div> |
192 | 192 | <?php |
193 | - $this->extra_tablenav( $which ); |
|
194 | - $this->pagination( $which ); |
|
193 | + $this->extra_tablenav($which); |
|
194 | + $this->pagination($which); |
|
195 | 195 | ?> |
196 | 196 | |
197 | 197 | <br class="clear"/> |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | $meta_query = array(); |
216 | 216 | |
217 | - if ( $user ) { |
|
217 | + if ($user) { |
|
218 | 218 | // Show only logs from a specific user |
219 | 219 | $meta_query[] = array( |
220 | 220 | 'key' => '_give_log_user_id', |
@@ -223,8 +223,8 @@ discard block |
||
223 | 223 | } |
224 | 224 | |
225 | 225 | $search = $this->get_search(); |
226 | - if ( $search ) { |
|
227 | - if ( is_email( $search ) ) { |
|
226 | + if ($search) { |
|
227 | + if (is_email($search)) { |
|
228 | 228 | // This is an email search. We use this to ensure it works for guest users and logged-in users |
229 | 229 | $key = '_give_log_user_info'; |
230 | 230 | $compare = 'LIKE'; |
@@ -233,32 +233,32 @@ discard block |
||
233 | 233 | $key = '_give_log_user_id'; |
234 | 234 | $compare = 'LIKE'; |
235 | 235 | |
236 | - if ( ! is_numeric( $search ) ) { |
|
236 | + if ( ! is_numeric($search)) { |
|
237 | 237 | // Searching for user by username |
238 | - $user = get_user_by( 'login', $search ); |
|
238 | + $user = get_user_by('login', $search); |
|
239 | 239 | |
240 | - if ( $user ) { |
|
240 | + if ($user) { |
|
241 | 241 | // Found one, set meta value to user's ID |
242 | 242 | $search = $user->ID; |
243 | 243 | } else { |
244 | 244 | // No user found so let's do a real search query |
245 | - $users = new WP_User_Query( array( |
|
245 | + $users = new WP_User_Query(array( |
|
246 | 246 | 'search' => $search, |
247 | - 'search_columns' => array( 'user_url', 'user_nicename' ), |
|
247 | + 'search_columns' => array('user_url', 'user_nicename'), |
|
248 | 248 | 'number' => 1, |
249 | 249 | 'fields' => 'ids', |
250 | - ) ); |
|
250 | + )); |
|
251 | 251 | |
252 | 252 | $found_user = $users->get_results(); |
253 | 253 | |
254 | - if ( $found_user ) { |
|
254 | + if ($found_user) { |
|
255 | 255 | $search = $found_user[0]; |
256 | 256 | } |
257 | 257 | } |
258 | 258 | } |
259 | 259 | } |
260 | 260 | |
261 | - if ( ! $this->file_search ) { |
|
261 | + if ( ! $this->file_search) { |
|
262 | 262 | // Meta query only works for non file name searche |
263 | 263 | $meta_query[] = array( |
264 | 264 | 'key' => $key, |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | * @since 1.0 |
280 | 280 | * @return void |
281 | 281 | */ |
282 | - function bulk_actions( $which = '' ) { |
|
282 | + function bulk_actions($which = '') { |
|
283 | 283 | give_log_views(); |
284 | 284 | } |
285 | 285 | |
@@ -291,24 +291,24 @@ discard block |
||
291 | 291 | * @return void |
292 | 292 | */ |
293 | 293 | public function give_forms_filter() { |
294 | - $give_forms = get_posts( array( |
|
294 | + $give_forms = get_posts(array( |
|
295 | 295 | 'post_type' => 'give_forms', |
296 | 296 | 'post_status' => 'any', |
297 | - 'posts_per_page' => - 1, |
|
297 | + 'posts_per_page' => -1, |
|
298 | 298 | 'orderby' => 'title', |
299 | 299 | 'order' => 'ASC', |
300 | 300 | 'fields' => 'ids', |
301 | 301 | 'update_post_meta_cache' => false, |
302 | 302 | 'update_post_term_cache' => false, |
303 | - ) ); |
|
303 | + )); |
|
304 | 304 | |
305 | - if ( $give_forms ) { |
|
305 | + if ($give_forms) { |
|
306 | 306 | echo '<select name="form" id="give-log-form-filter">'; |
307 | - echo '<option value="0">' . __( 'All', 'give' ) . '</option>'; |
|
308 | - foreach ( $give_forms as $form ) { |
|
309 | - $form_title = get_the_title( $form ); |
|
310 | - $form_title = empty( $form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $form ) : $form_title; |
|
311 | - echo '<option value="' . $form . '"' . selected( $form, $this->get_filtered_give_form() ) . '>' . esc_html( $form_title ) . '</option>'; |
|
307 | + echo '<option value="0">'.__('All', 'give').'</option>'; |
|
308 | + foreach ($give_forms as $form) { |
|
309 | + $form_title = get_the_title($form); |
|
310 | + $form_title = empty($form_title) ? sprintf(__('Untitled (#%s)', 'give'), $form) : $form_title; |
|
311 | + echo '<option value="'.$form.'"'.selected($form, $this->get_filtered_give_form()).'>'.esc_html($form_title).'</option>'; |
|
312 | 312 | } |
313 | 313 | echo '</select>'; |
314 | 314 | } |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | |
329 | 329 | $logs_data = array(); |
330 | 330 | $paged = $this->get_paged(); |
331 | - $give_form = empty( $_GET['s'] ) ? $this->get_filtered_give_form() : null; |
|
331 | + $give_form = empty($_GET['s']) ? $this->get_filtered_give_form() : null; |
|
332 | 332 | $user = $this->get_filtered_user(); |
333 | 333 | |
334 | 334 | $log_query = array( |
@@ -338,38 +338,38 @@ discard block |
||
338 | 338 | 'meta_query' => $this->get_meta_query(), |
339 | 339 | ); |
340 | 340 | |
341 | - $cache_key = Give_Cache::get_key( 'get_logs', $log_query ); |
|
341 | + $cache_key = Give_Cache::get_key('get_logs', $log_query); |
|
342 | 342 | |
343 | 343 | // Return result from cache if exist. |
344 | - if ( ! ( $logs_data = Give_Cache::get( $cache_key ) ) ) { |
|
345 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
344 | + if ( ! ($logs_data = Give_Cache::get($cache_key))) { |
|
345 | + $logs = $give_logs->get_connected_logs($log_query); |
|
346 | 346 | |
347 | - if ( $logs ) { |
|
348 | - foreach ( $logs as $log ) { |
|
349 | - $payment_id = give_get_meta( $log->ID, '_give_log_payment_id', true ); |
|
347 | + if ($logs) { |
|
348 | + foreach ($logs as $log) { |
|
349 | + $payment_id = give_get_meta($log->ID, '_give_log_payment_id', true); |
|
350 | 350 | |
351 | 351 | // Make sure this payment hasn't been deleted |
352 | - if ( get_post( $payment_id ) ) : |
|
353 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
354 | - $payment_meta = give_get_payment_meta( $payment_id ); |
|
355 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
352 | + if (get_post($payment_id)) : |
|
353 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
354 | + $payment_meta = give_get_payment_meta($payment_id); |
|
355 | + $payment_amount = give_get_payment_amount($payment_id); |
|
356 | 356 | |
357 | 357 | $logs_data[] = array( |
358 | - 'ID' => '<span class="give-item-label give-item-label-gray">' . $log->ID . '</span>', |
|
358 | + 'ID' => '<span class="give-item-label give-item-label-gray">'.$log->ID.'</span>', |
|
359 | 359 | 'payment_id' => $payment_id, |
360 | 360 | 'form' => $log->post_parent, |
361 | 361 | 'amount' => $payment_amount, |
362 | 362 | 'user_id' => $user_info['id'], |
363 | - 'user_name' => $user_info['first_name'] . ' ' . $user_info['last_name'], |
|
364 | - 'date' => get_post_field( 'post_date', $payment_id ), |
|
363 | + 'user_name' => $user_info['first_name'].' '.$user_info['last_name'], |
|
364 | + 'date' => get_post_field('post_date', $payment_id), |
|
365 | 365 | ); |
366 | 366 | |
367 | 367 | endif; |
368 | 368 | } |
369 | 369 | |
370 | 370 | // Cache results. |
371 | - if ( ! empty( $logs_data ) ) { |
|
372 | - Give_Cache::set( $cache_key, $logs_data ); |
|
371 | + if ( ! empty($logs_data)) { |
|
372 | + Give_Cache::set($cache_key, $logs_data); |
|
373 | 373 | } |
374 | 374 | } |
375 | 375 | } |
@@ -397,15 +397,15 @@ discard block |
||
397 | 397 | $columns = $this->get_columns(); |
398 | 398 | $hidden = array(); |
399 | 399 | $sortable = $this->get_sortable_columns(); |
400 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
400 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
401 | 401 | $current_page = $this->get_pagenum(); |
402 | 402 | $this->items = $this->get_logs(); |
403 | - $total_items = $give_logs->get_log_count( $this->get_filtered_give_form(), 'sale', $this->get_meta_query() ); |
|
403 | + $total_items = $give_logs->get_log_count($this->get_filtered_give_form(), 'sale', $this->get_meta_query()); |
|
404 | 404 | |
405 | - $this->set_pagination_args( array( |
|
405 | + $this->set_pagination_args(array( |
|
406 | 406 | 'total_items' => $total_items, |
407 | 407 | 'per_page' => $this->per_page, |
408 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
408 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
409 | 409 | ) |
410 | 410 | ); |
411 | 411 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * Admin View: Exports |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } ?> |
9 | 9 | |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @since 1.0 |
20 | 20 | */ |
21 | - do_action( 'give_tools_tab_export_content_top' ); |
|
21 | + do_action('give_tools_tab_export_content_top'); |
|
22 | 22 | ?> |
23 | 23 | |
24 | 24 | <table class="widefat export-options-table give-table"> |
25 | 25 | <thead> |
26 | 26 | <tr> |
27 | - <th scope="col"><?php esc_html_e( 'Export Type', 'give' ); ?></th> |
|
28 | - <th scope="col"><?php esc_html_e( 'Export Options', 'give' ); ?></th> |
|
27 | + <th scope="col"><?php esc_html_e('Export Type', 'give'); ?></th> |
|
28 | + <th scope="col"><?php esc_html_e('Export Options', 'give'); ?></th> |
|
29 | 29 | </tr> |
30 | 30 | </thead> |
31 | 31 | <tbody> |
@@ -38,42 +38,42 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @since 1.0 |
40 | 40 | */ |
41 | - do_action( 'give_tools_tab_export_table_top' ); |
|
41 | + do_action('give_tools_tab_export_table_top'); |
|
42 | 42 | ?> |
43 | 43 | <tr class="give-export-pdf-sales-earnings"> |
44 | 44 | <td scope="row" class="row-title"> |
45 | 45 | <h3> |
46 | - <span><?php esc_html_e( 'Export PDF of Donations and Income', 'give' ); ?></span> |
|
46 | + <span><?php esc_html_e('Export PDF of Donations and Income', 'give'); ?></span> |
|
47 | 47 | </h3> |
48 | - <p><?php esc_html_e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p> |
|
48 | + <p><?php esc_html_e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p> |
|
49 | 49 | </td> |
50 | 50 | <td> |
51 | - <a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"> |
|
52 | - <?php esc_html_e( 'Generate PDF', 'give' ); ?> |
|
51 | + <a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"> |
|
52 | + <?php esc_html_e('Generate PDF', 'give'); ?> |
|
53 | 53 | </a> |
54 | 54 | </td> |
55 | 55 | </tr> |
56 | 56 | <tr class="alternate give-export-sales-earnings"> |
57 | 57 | <td scope="row" class="row-title"> |
58 | 58 | <h3> |
59 | - <span><?php esc_html_e( 'Export Income and Donation Stats', 'give' ); ?></span> |
|
59 | + <span><?php esc_html_e('Export Income and Donation Stats', 'give'); ?></span> |
|
60 | 60 | </h3> |
61 | - <p><?php esc_html_e( 'Download a CSV of income and donations over time.', 'give' ); ?></p> |
|
61 | + <p><?php esc_html_e('Download a CSV of income and donations over time.', 'give'); ?></p> |
|
62 | 62 | </td> |
63 | 63 | <td> |
64 | 64 | <form method="post"> |
65 | 65 | <?php |
66 | 66 | printf( |
67 | 67 | /* translators: 1: start date dropdown 2: end date dropdown */ |
68 | - esc_html__( '%1$s to %2$s', 'give' ), |
|
69 | - Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ), |
|
70 | - Give()->html->year_dropdown( 'end_year' ) . ' ' . Give()->html->month_dropdown( 'end_month' ) |
|
68 | + esc_html__('%1$s to %2$s', 'give'), |
|
69 | + Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'), |
|
70 | + Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month') |
|
71 | 71 | ); |
72 | 72 | ?> |
73 | 73 | <input type="hidden" name="give-action" |
74 | 74 | value="earnings_export"/> |
75 | 75 | <input type="submit" |
76 | - value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" |
|
76 | + value="<?php esc_attr_e('Generate CSV', 'give'); ?>" |
|
77 | 77 | class="button-secondary"/> |
78 | 78 | </form> |
79 | 79 | </td> |
@@ -81,37 +81,37 @@ discard block |
||
81 | 81 | <tr class="give-export-payment-history"> |
82 | 82 | <td scope="row" class="row-title"> |
83 | 83 | <h3> |
84 | - <span><?php esc_html_e( 'Export Donation History', 'give' ); ?></span> |
|
84 | + <span><?php esc_html_e('Export Donation History', 'give'); ?></span> |
|
85 | 85 | </h3> |
86 | - <p><?php esc_html_e( 'Download a CSV of all donations recorded.', 'give' ); ?></p> |
|
86 | + <p><?php esc_html_e('Download a CSV of all donations recorded.', 'give'); ?></p> |
|
87 | 87 | </td> |
88 | 88 | <td> |
89 | 89 | <form id="give-export-payments" |
90 | 90 | class="give-export-form" method="post"> |
91 | 91 | <?php |
92 | - echo Give()->html->date_field( array( |
|
92 | + echo Give()->html->date_field(array( |
|
93 | 93 | 'id' => 'give-payment-export-start', |
94 | 94 | 'name' => 'start', |
95 | - 'placeholder' => esc_attr__( 'Start date', 'give' ), |
|
96 | - ) ); |
|
95 | + 'placeholder' => esc_attr__('Start date', 'give'), |
|
96 | + )); |
|
97 | 97 | |
98 | - echo Give()->html->date_field( array( |
|
98 | + echo Give()->html->date_field(array( |
|
99 | 99 | 'id' => 'give-payment-export-end', |
100 | 100 | 'name' => 'end', |
101 | - 'placeholder' => esc_attr__( 'End date', 'give' ), |
|
102 | - ) ); |
|
101 | + 'placeholder' => esc_attr__('End date', 'give'), |
|
102 | + )); |
|
103 | 103 | ?> |
104 | 104 | <select name="status"> |
105 | - <option value="any"><?php esc_html_e( 'All Statuses', 'give' ); ?></option> |
|
105 | + <option value="any"><?php esc_html_e('All Statuses', 'give'); ?></option> |
|
106 | 106 | <?php |
107 | 107 | $statuses = give_get_payment_statuses(); |
108 | - foreach ( $statuses as $status => $label ) { |
|
109 | - echo '<option value="' . $status . '">' . $label . '</option>'; |
|
108 | + foreach ($statuses as $status => $label) { |
|
109 | + echo '<option value="'.$status.'">'.$label.'</option>'; |
|
110 | 110 | } |
111 | 111 | ?> |
112 | 112 | </select> |
113 | 113 | <?php |
114 | - if ( give_is_setting_enabled( give_get_option( 'categories' ) ) ) { |
|
114 | + if (give_is_setting_enabled(give_get_option('categories'))) { |
|
115 | 115 | echo Give()->html->category_dropdown( |
116 | 116 | 'give_forms_categories[]', |
117 | 117 | 0, |
@@ -121,12 +121,12 @@ discard block |
||
121 | 121 | 'multiple' => true, |
122 | 122 | 'selected' => array(), |
123 | 123 | 'show_option_all' => false, |
124 | - 'placeholder' => __( 'Choose one or more from categories', 'give' ), |
|
124 | + 'placeholder' => __('Choose one or more from categories', 'give'), |
|
125 | 125 | ) |
126 | 126 | ); |
127 | 127 | } |
128 | 128 | |
129 | - if ( give_is_setting_enabled( give_get_option( 'tags' ) ) ) { |
|
129 | + if (give_is_setting_enabled(give_get_option('tags'))) { |
|
130 | 130 | echo Give()->html->tags_dropdown( |
131 | 131 | 'give_forms_tags[]', |
132 | 132 | 0, |
@@ -136,18 +136,18 @@ discard block |
||
136 | 136 | 'multiple' => true, |
137 | 137 | 'selected' => array(), |
138 | 138 | 'show_option_all' => false, |
139 | - 'placeholder' => __( 'Choose one or more from tags', 'give' ), |
|
139 | + 'placeholder' => __('Choose one or more from tags', 'give'), |
|
140 | 140 | ) |
141 | 141 | ); |
142 | 142 | } |
143 | 143 | |
144 | - wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); |
|
144 | + wp_nonce_field('give_ajax_export', 'give_ajax_export'); |
|
145 | 145 | ?> |
146 | 146 | <input type="hidden" name="give-export-class" |
147 | 147 | value="Give_Batch_Payments_Export"/> |
148 | 148 | <span> |
149 | 149 | <input type="submit" |
150 | - value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" |
|
150 | + value="<?php esc_attr_e('Generate CSV', 'give'); ?>" |
|
151 | 151 | class="button-secondary"/> |
152 | 152 | <span class="spinner"></span> |
153 | 153 | </span> |
@@ -157,9 +157,9 @@ discard block |
||
157 | 157 | <tr class="alternate give-export-donors"> |
158 | 158 | <td scope="row" class="row-title"> |
159 | 159 | <h3> |
160 | - <span><?php esc_html_e( 'Export Donors in CSV', 'give' ); ?></span> |
|
160 | + <span><?php esc_html_e('Export Donors in CSV', 'give'); ?></span> |
|
161 | 161 | </h3> |
162 | - <p><?php esc_html_e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p> |
|
162 | + <p><?php esc_html_e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p> |
|
163 | 163 | </td> |
164 | 164 | <td> |
165 | 165 | <form method="post" id="give_donor_export" |
@@ -167,99 +167,99 @@ discard block |
||
167 | 167 | |
168 | 168 | <?php |
169 | 169 | // Start Date form field for donors |
170 | - echo Give()->html->date_field( array( |
|
170 | + echo Give()->html->date_field(array( |
|
171 | 171 | 'id' => 'give_donor_export_start_date', |
172 | 172 | 'name' => 'donor_export_start_date', |
173 | - 'placeholder' => esc_attr__( 'Start date', 'give' ), |
|
174 | - ) ); |
|
173 | + 'placeholder' => esc_attr__('Start date', 'give'), |
|
174 | + )); |
|
175 | 175 | |
176 | 176 | // End Date form field for donors |
177 | - echo Give()->html->date_field( array( |
|
177 | + echo Give()->html->date_field(array( |
|
178 | 178 | 'id' => 'give_donor_export_end_date', |
179 | 179 | 'name' => 'donor_export_end_date', |
180 | - 'placeholder' => esc_attr__( 'End date', 'give' ), |
|
181 | - ) ); |
|
180 | + 'placeholder' => esc_attr__('End date', 'give'), |
|
181 | + )); |
|
182 | 182 | |
183 | 183 | // Donation forms dropdown for donors export |
184 | - echo Give()->html->forms_dropdown( array( |
|
184 | + echo Give()->html->forms_dropdown(array( |
|
185 | 185 | 'name' => 'forms', |
186 | 186 | 'id' => 'give_donor_export_form', |
187 | 187 | 'chosen' => true, |
188 | - ) ); |
|
188 | + )); |
|
189 | 189 | ?> |
190 | 190 | |
191 | 191 | <input type="submit" |
192 | - value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" |
|
192 | + value="<?php esc_attr_e('Generate CSV', 'give'); ?>" |
|
193 | 193 | class="button-secondary"/> |
194 | 194 | |
195 | 195 | <div id="export-donor-options-wrap" |
196 | 196 | class="give-clearfix"> |
197 | - <p><?php esc_html_e( 'Export Columns:', 'give' ); ?></p> |
|
197 | + <p><?php esc_html_e('Export Columns:', 'give'); ?></p> |
|
198 | 198 | <ul id="give-export-option-ul"> |
199 | 199 | <li> |
200 | 200 | <label for="give-export-fullname"> |
201 | 201 | <input type="checkbox" checked |
202 | 202 | name="give_export_option[full_name]" |
203 | - id="give-export-fullname"><?php esc_html_e( 'Name', 'give' ); ?> |
|
203 | + id="give-export-fullname"><?php esc_html_e('Name', 'give'); ?> |
|
204 | 204 | </label> |
205 | 205 | </li> |
206 | 206 | <li> |
207 | 207 | <label for="give-export-email"> |
208 | 208 | <input type="checkbox" checked |
209 | 209 | name="give_export_option[email]" |
210 | - id="give-export-email"><?php esc_html_e( 'Email', 'give' ); ?> |
|
210 | + id="give-export-email"><?php esc_html_e('Email', 'give'); ?> |
|
211 | 211 | </label> |
212 | 212 | </li> |
213 | 213 | <li> |
214 | 214 | <label for="give-export-address"> |
215 | 215 | <input type="checkbox" checked |
216 | 216 | name="give_export_option[address]" |
217 | - id="give-export-address"><?php esc_html_e( 'Address', 'give' ); ?> |
|
217 | + id="give-export-address"><?php esc_html_e('Address', 'give'); ?> |
|
218 | 218 | </label> |
219 | 219 | </li> |
220 | 220 | <li> |
221 | 221 | <label for="give-export-userid"> |
222 | 222 | <input type="checkbox" checked |
223 | 223 | name="give_export_option[userid]" |
224 | - id="give-export-userid"><?php esc_html_e( 'User ID', 'give' ); ?> |
|
224 | + id="give-export-userid"><?php esc_html_e('User ID', 'give'); ?> |
|
225 | 225 | </label> |
226 | 226 | </li> |
227 | 227 | <li> |
228 | 228 | <label for="give-export-donation-form"> |
229 | 229 | <input type="checkbox" checked |
230 | 230 | name="give_export_option[donation_form]" |
231 | - id="give-export-donation-form"><?php esc_html_e( 'Donation Form', 'give' ); ?> |
|
231 | + id="give-export-donation-form"><?php esc_html_e('Donation Form', 'give'); ?> |
|
232 | 232 | </label> |
233 | 233 | </li> |
234 | 234 | <li> |
235 | 235 | <label for="give-export-first-donation-date"> |
236 | 236 | <input type="checkbox" checked |
237 | 237 | name="give_export_option[date_first_donated]" |
238 | - id="give-export-first-donation-date"><?php esc_html_e( 'First Donation Date', 'give' ); ?> |
|
238 | + id="give-export-first-donation-date"><?php esc_html_e('First Donation Date', 'give'); ?> |
|
239 | 239 | </label> |
240 | 240 | </li> |
241 | 241 | <li> |
242 | 242 | <label for="give-export-donation-number"> |
243 | 243 | <input type="checkbox" checked |
244 | 244 | name="give_export_option[donations]" |
245 | - id="give-export-donation-number"><?php esc_html_e( 'Number of Donations', 'give' ); ?> |
|
245 | + id="give-export-donation-number"><?php esc_html_e('Number of Donations', 'give'); ?> |
|
246 | 246 | </label> |
247 | 247 | </li> |
248 | 248 | <li> |
249 | 249 | <label for="give-export-donation-sum"> |
250 | 250 | <input type="checkbox" checked |
251 | 251 | name="give_export_option[donation_sum]" |
252 | - id="give-export-donation-sum"><?php esc_html_e( 'Total Donated', 'give' ); ?> |
|
252 | + id="give-export-donation-sum"><?php esc_html_e('Total Donated', 'give'); ?> |
|
253 | 253 | </label> |
254 | 254 | </li> |
255 | 255 | </ul> |
256 | 256 | </div> |
257 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
257 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
258 | 258 | <input type="hidden" name="give-export-class" |
259 | 259 | value="Give_Batch_Donors_Export"/> |
260 | 260 | <input type="hidden" |
261 | 261 | name="give_export_option[query_id]" |
262 | - value="<?php echo uniqid( 'give_' ); ?>"/> |
|
262 | + value="<?php echo uniqid('give_'); ?>"/> |
|
263 | 263 | </form> |
264 | 264 | </td> |
265 | 265 | </tr> |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * |
273 | 273 | * @since 1.0 |
274 | 274 | */ |
275 | - do_action( 'give_tools_tab_export_table_bottom' ); |
|
275 | + do_action('give_tools_tab_export_table_bottom'); |
|
276 | 276 | ?> |
277 | 277 | </tbody> |
278 | 278 | </table> |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | * |
284 | 284 | * @since 1.0 |
285 | 285 | */ |
286 | - do_action( 'give_tools_tab_export_content_bottom' ); |
|
286 | + do_action('give_tools_tab_export_content_bottom'); |
|
287 | 287 | ?> |
288 | 288 | |
289 | 289 | </div> |
@@ -3,11 +3,11 @@ discard block |
||
3 | 3 | * Admin View: Exports |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
10 | -if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
10 | +if ( ! current_user_can('manage_give_settings')) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -16,27 +16,27 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @since 1.5 |
18 | 18 | */ |
19 | -do_action( 'give_tools_recount_stats_before' ); |
|
19 | +do_action('give_tools_recount_stats_before'); |
|
20 | 20 | ?> |
21 | 21 | <div id="poststuff"> |
22 | 22 | <div class="postbox"> |
23 | 23 | |
24 | - <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2> |
|
24 | + <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2> |
|
25 | 25 | |
26 | 26 | <div class="inside recount-stats-controls"> |
27 | - <p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p> |
|
27 | + <p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p> |
|
28 | 28 | <form method="post" id="give-tools-recount-form" class="give-export-form"> |
29 | 29 | |
30 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
30 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
31 | 31 | |
32 | 32 | <select name="give-export-class" id="recount-stats-type"> |
33 | - <option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option> |
|
34 | - <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option> |
|
35 | - <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option> |
|
36 | - <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option> |
|
37 | - <option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option> |
|
38 | - <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Transactions', 'give' ); ?></option> |
|
39 | - <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option> |
|
33 | + <option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option> |
|
34 | + <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option> |
|
35 | + <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option> |
|
36 | + <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option> |
|
37 | + <option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option> |
|
38 | + <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Transactions', 'give'); ?></option> |
|
39 | + <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option> |
|
40 | 40 | <?php |
41 | 41 | /** |
42 | 42 | * Fires in the recount stats selectbox. |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @since 1.5 |
47 | 47 | */ |
48 | - do_action( 'give_recount_tool_options' ); |
|
48 | + do_action('give_recount_tool_options'); |
|
49 | 49 | ?> |
50 | 50 | </select> |
51 | 51 | |
@@ -53,22 +53,22 @@ discard block |
||
53 | 53 | <?php |
54 | 54 | $args = array( |
55 | 55 | 'name' => 'form_id', |
56 | - 'number' => - 1, |
|
56 | + 'number' => -1, |
|
57 | 57 | 'chosen' => true, |
58 | 58 | ); |
59 | - echo Give()->html->forms_dropdown( $args ); |
|
59 | + echo Give()->html->forms_dropdown($args); |
|
60 | 60 | ?> |
61 | 61 | </span> |
62 | 62 | |
63 | - <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/> |
|
63 | + <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/> |
|
64 | 64 | |
65 | 65 | <br/> |
66 | 66 | |
67 | 67 | <span class="give-recount-stats-descriptions"> |
68 | - <span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span> |
|
69 | - <span id="recount-form"><?php esc_html_e( 'Recalculates the donation and income stats for a specific form.', 'give' ); ?></span> |
|
70 | - <span id="recount-all"><?php esc_html_e( 'Recalculates the earnings and sales stats for all forms.', 'give' ); ?></span> |
|
71 | - <span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span> |
|
68 | + <span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span> |
|
69 | + <span id="recount-form"><?php esc_html_e('Recalculates the donation and income stats for a specific form.', 'give'); ?></span> |
|
70 | + <span id="recount-all"><?php esc_html_e('Recalculates the earnings and sales stats for all forms.', 'give'); ?></span> |
|
71 | + <span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span> |
|
72 | 72 | <?php |
73 | 73 | /** |
74 | 74 | * Fires in the recount stats description area. |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @since 1.5 |
79 | 79 | */ |
80 | - do_action( 'give_recount_tool_descriptions' ); |
|
80 | + do_action('give_recount_tool_descriptions'); |
|
81 | 81 | ?> |
82 | - <span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give' ); ?></span> |
|
83 | - <span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span> |
|
82 | + <span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give'); ?></span> |
|
83 | + <span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give'); ?></span> |
|
84 | 84 | </span> |
85 | 85 | |
86 | 86 | <span class="spinner"></span> |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @since 1.5 |
96 | 96 | */ |
97 | - do_action( 'give_tools_recount_forms' ); |
|
97 | + do_action('give_tools_recount_forms'); |
|
98 | 98 | ?> |
99 | 99 | </div><!-- .inside --> |
100 | 100 | </div><!-- .postbox --> |
@@ -105,4 +105,4 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @since 1.5 |
107 | 107 | */ |
108 | -do_action( 'give_tools_recount_stats_after' ); |
|
108 | +do_action('give_tools_recount_stats_after'); |
@@ -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 | |
@@ -33,17 +33,17 @@ discard block |
||
33 | 33 | global $give_settings_page, $give_payments_page, $give_reports_page, $give_add_ons_page, $give_upgrades_screen, $give_donors_page, $give_tools_page; |
34 | 34 | |
35 | 35 | //Payments |
36 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
37 | - $give_payments_page = add_submenu_page( 'edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page' ); |
|
36 | + $give_payment = get_post_type_object('give_payment'); |
|
37 | + $give_payments_page = add_submenu_page('edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page'); |
|
38 | 38 | |
39 | 39 | //Donors |
40 | - $give_donors_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Donors', 'give' ), esc_html__( 'Donors', 'give' ), 'view_give_reports', 'give-donors', 'give_donors_page' ); |
|
40 | + $give_donors_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Donors', 'give'), esc_html__('Donors', 'give'), 'view_give_reports', 'give-donors', 'give_donors_page'); |
|
41 | 41 | |
42 | 42 | //Reports` |
43 | 43 | $give_reports_page = add_submenu_page( |
44 | 44 | 'edit.php?post_type=give_forms', |
45 | - esc_html__( 'Donation Reports', 'give' ), |
|
46 | - esc_html__( 'Reports', 'give' ), |
|
45 | + esc_html__('Donation Reports', 'give'), |
|
46 | + esc_html__('Reports', 'give'), |
|
47 | 47 | 'view_give_reports', |
48 | 48 | 'give-reports', |
49 | 49 | array( |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | //Settings |
56 | 56 | $give_settings_page = add_submenu_page( |
57 | 57 | 'edit.php?post_type=give_forms', |
58 | - esc_html__( 'Give Settings', 'give' ), |
|
59 | - esc_html__( 'Settings', 'give' ), |
|
58 | + esc_html__('Give Settings', 'give'), |
|
59 | + esc_html__('Settings', 'give'), |
|
60 | 60 | 'manage_give_settings', |
61 | 61 | 'give-settings', |
62 | 62 | array( |
@@ -66,21 +66,21 @@ discard block |
||
66 | 66 | ); |
67 | 67 | |
68 | 68 | //Tools. |
69 | - $give_tools_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Tools', 'give' ), esc_html__( 'Tools', 'give' ), 'manage_give_settings', 'give-tools', array( |
|
69 | + $give_tools_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Tools', 'give'), esc_html__('Tools', 'give'), 'manage_give_settings', 'give-tools', array( |
|
70 | 70 | Give()->give_settings, |
71 | 71 | 'output' |
72 | - ) ); |
|
72 | + )); |
|
73 | 73 | |
74 | 74 | //Add-ons |
75 | - $give_add_ons_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Add-ons', 'give' ), esc_html__( 'Add-ons', 'give' ), 'install_plugins', 'give-addons', 'give_add_ons_page' ); |
|
75 | + $give_add_ons_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Add-ons', 'give'), esc_html__('Add-ons', 'give'), 'install_plugins', 'give-addons', 'give_add_ons_page'); |
|
76 | 76 | |
77 | 77 | //Upgrades |
78 | - $give_upgrades_screen = add_submenu_page( null, esc_html__( 'Give Upgrades', 'give' ), esc_html__( 'Give Upgrades', 'give' ), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen' ); |
|
78 | + $give_upgrades_screen = add_submenu_page(null, esc_html__('Give Upgrades', 'give'), esc_html__('Give Upgrades', 'give'), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen'); |
|
79 | 79 | |
80 | 80 | |
81 | 81 | } |
82 | 82 | |
83 | -add_action( 'admin_menu', 'give_add_options_links', 10 ); |
|
83 | +add_action('admin_menu', 'give_add_options_links', 10); |
|
84 | 84 | |
85 | 85 | /** |
86 | 86 | * Determines whether the current admin page is a Give admin page. |
@@ -95,224 +95,224 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @return bool True if Give admin page. |
97 | 97 | */ |
98 | -function give_is_admin_page( $passed_page = '', $passed_view = '' ) { |
|
98 | +function give_is_admin_page($passed_page = '', $passed_view = '') { |
|
99 | 99 | |
100 | 100 | global $pagenow, $typenow; |
101 | 101 | |
102 | 102 | $found = false; |
103 | - $post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false; |
|
104 | - $action = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false; |
|
105 | - $taxonomy = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false; |
|
106 | - $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false; |
|
107 | - $view = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false; |
|
108 | - $tab = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false; |
|
109 | - |
|
110 | - switch ( $passed_page ) { |
|
103 | + $post_type = isset($_GET['post_type']) ? strtolower($_GET['post_type']) : false; |
|
104 | + $action = isset($_GET['action']) ? strtolower($_GET['action']) : false; |
|
105 | + $taxonomy = isset($_GET['taxonomy']) ? strtolower($_GET['taxonomy']) : false; |
|
106 | + $page = isset($_GET['page']) ? strtolower($_GET['page']) : false; |
|
107 | + $view = isset($_GET['view']) ? strtolower($_GET['view']) : false; |
|
108 | + $tab = isset($_GET['tab']) ? strtolower($_GET['tab']) : false; |
|
109 | + |
|
110 | + switch ($passed_page) { |
|
111 | 111 | case 'give_forms': |
112 | - switch ( $passed_view ) { |
|
112 | + switch ($passed_view) { |
|
113 | 113 | case 'list-table': |
114 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' ) { |
|
114 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php') { |
|
115 | 115 | $found = true; |
116 | 116 | } |
117 | 117 | break; |
118 | 118 | case 'edit': |
119 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post.php' ) { |
|
119 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post.php') { |
|
120 | 120 | $found = true; |
121 | 121 | } |
122 | 122 | break; |
123 | 123 | case 'new': |
124 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post-new.php' ) { |
|
124 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post-new.php') { |
|
125 | 125 | $found = true; |
126 | 126 | } |
127 | 127 | break; |
128 | 128 | default: |
129 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) || 'give_forms' === $post_type || ( 'post-new.php' == $pagenow && 'give_forms' === $post_type ) ) { |
|
129 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) || 'give_forms' === $post_type || ('post-new.php' == $pagenow && 'give_forms' === $post_type)) { |
|
130 | 130 | $found = true; |
131 | 131 | } |
132 | 132 | break; |
133 | 133 | } |
134 | 134 | break; |
135 | 135 | case 'categories': |
136 | - switch ( $passed_view ) { |
|
136 | + switch ($passed_view) { |
|
137 | 137 | case 'list-table': |
138 | 138 | case 'new': |
139 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy ) { |
|
139 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy) { |
|
140 | 140 | $found = true; |
141 | 141 | } |
142 | 142 | break; |
143 | 143 | case 'edit': |
144 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy ) { |
|
144 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy) { |
|
145 | 145 | $found = true; |
146 | 146 | } |
147 | 147 | break; |
148 | 148 | default: |
149 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy ) { |
|
149 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy) { |
|
150 | 150 | $found = true; |
151 | 151 | } |
152 | 152 | break; |
153 | 153 | } |
154 | 154 | break; |
155 | 155 | case 'tags': |
156 | - switch ( $passed_view ) { |
|
156 | + switch ($passed_view) { |
|
157 | 157 | case 'list-table': |
158 | 158 | case 'new': |
159 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy ) { |
|
159 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy) { |
|
160 | 160 | $found = true; |
161 | 161 | } |
162 | 162 | break; |
163 | 163 | case 'edit': |
164 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy ) { |
|
164 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy) { |
|
165 | 165 | $found = true; |
166 | 166 | } |
167 | 167 | break; |
168 | 168 | default: |
169 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy ) { |
|
169 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy) { |
|
170 | 170 | $found = true; |
171 | 171 | } |
172 | 172 | break; |
173 | 173 | } |
174 | 174 | break; |
175 | 175 | case 'payments': |
176 | - switch ( $passed_view ) { |
|
176 | + switch ($passed_view) { |
|
177 | 177 | case 'list-table': |
178 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view ) { |
|
178 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view) { |
|
179 | 179 | $found = true; |
180 | 180 | } |
181 | 181 | break; |
182 | 182 | case 'edit': |
183 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-payment-details' === $view ) { |
|
183 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-payment-details' === $view) { |
|
184 | 184 | $found = true; |
185 | 185 | } |
186 | 186 | break; |
187 | 187 | default: |
188 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page ) { |
|
188 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page) { |
|
189 | 189 | $found = true; |
190 | 190 | } |
191 | 191 | break; |
192 | 192 | } |
193 | 193 | break; |
194 | 194 | case 'reports': |
195 | - switch ( $passed_view ) { |
|
195 | + switch ($passed_view) { |
|
196 | 196 | // If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ] |
197 | 197 | case 'earnings': |
198 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) { |
|
198 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && ('earnings' === $view || '-1' === $view || false === $view)) { |
|
199 | 199 | $found = true; |
200 | 200 | } |
201 | 201 | break; |
202 | 202 | case 'donors': |
203 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view ) { |
|
203 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view) { |
|
204 | 204 | $found = true; |
205 | 205 | } |
206 | 206 | break; |
207 | 207 | case 'gateways': |
208 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view ) { |
|
208 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view) { |
|
209 | 209 | $found = true; |
210 | 210 | } |
211 | 211 | break; |
212 | 212 | case 'export': |
213 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view ) { |
|
213 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view) { |
|
214 | 214 | $found = true; |
215 | 215 | } |
216 | 216 | break; |
217 | 217 | case 'logs': |
218 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view ) { |
|
218 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view) { |
|
219 | 219 | $found = true; |
220 | 220 | } |
221 | 221 | break; |
222 | 222 | default: |
223 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
223 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
224 | 224 | $found = true; |
225 | 225 | } |
226 | 226 | break; |
227 | 227 | } |
228 | 228 | break; |
229 | 229 | case 'settings': |
230 | - switch ( $passed_view ) { |
|
230 | + switch ($passed_view) { |
|
231 | 231 | case 'general': |
232 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && ( 'general' === $tab || false === $tab ) ) { |
|
232 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && ('general' === $tab || false === $tab)) { |
|
233 | 233 | $found = true; |
234 | 234 | } |
235 | 235 | break; |
236 | 236 | case 'gateways': |
237 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab ) { |
|
237 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab) { |
|
238 | 238 | $found = true; |
239 | 239 | } |
240 | 240 | break; |
241 | 241 | case 'emails': |
242 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab ) { |
|
242 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab) { |
|
243 | 243 | $found = true; |
244 | 244 | } |
245 | 245 | break; |
246 | 246 | case 'display': |
247 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab ) { |
|
247 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab) { |
|
248 | 248 | $found = true; |
249 | 249 | } |
250 | 250 | break; |
251 | 251 | case 'licenses': |
252 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab ) { |
|
252 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab) { |
|
253 | 253 | $found = true; |
254 | 254 | } |
255 | 255 | break; |
256 | 256 | case 'api': |
257 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab ) { |
|
257 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab) { |
|
258 | 258 | $found = true; |
259 | 259 | } |
260 | 260 | break; |
261 | 261 | case 'advanced': |
262 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab ) { |
|
262 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab) { |
|
263 | 263 | $found = true; |
264 | 264 | } |
265 | 265 | break; |
266 | 266 | case 'system_info': |
267 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab ) { |
|
267 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab) { |
|
268 | 268 | $found = true; |
269 | 269 | } |
270 | 270 | break; |
271 | 271 | default: |
272 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page ) { |
|
272 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page) { |
|
273 | 273 | $found = true; |
274 | 274 | } |
275 | 275 | break; |
276 | 276 | } |
277 | 277 | break; |
278 | 278 | case 'addons': |
279 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-addons' === $page ) { |
|
279 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-addons' === $page) { |
|
280 | 280 | $found = true; |
281 | 281 | } |
282 | 282 | break; |
283 | 283 | case 'donors': |
284 | - switch ( $passed_view ) { |
|
284 | + switch ($passed_view) { |
|
285 | 285 | case 'list-table': |
286 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view ) { |
|
286 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view) { |
|
287 | 287 | $found = true; |
288 | 288 | } |
289 | 289 | break; |
290 | 290 | case 'overview': |
291 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view ) { |
|
291 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view) { |
|
292 | 292 | $found = true; |
293 | 293 | } |
294 | 294 | break; |
295 | 295 | case 'notes': |
296 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view ) { |
|
296 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view) { |
|
297 | 297 | $found = true; |
298 | 298 | } |
299 | 299 | break; |
300 | 300 | default: |
301 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page ) { |
|
301 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page) { |
|
302 | 302 | $found = true; |
303 | 303 | } |
304 | 304 | break; |
305 | 305 | } |
306 | 306 | break; |
307 | 307 | case 'reports': |
308 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
308 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
309 | 309 | $found = true; |
310 | 310 | } |
311 | 311 | break; |
312 | 312 | default: |
313 | 313 | global $give_payments_page, $give_settings_page, $give_reports_page, $give_system_info_page, $give_add_ons_page, $give_settings_export, $give_upgrades_screen, $give_donors_page, $give_tools_page; |
314 | 314 | |
315 | - $admin_pages = apply_filters( 'give_admin_pages', array( |
|
315 | + $admin_pages = apply_filters('give_admin_pages', array( |
|
316 | 316 | $give_payments_page, |
317 | 317 | $give_settings_page, |
318 | 318 | $give_reports_page, |
@@ -323,19 +323,19 @@ discard block |
||
323 | 323 | $give_donors_page, |
324 | 324 | $give_tools_page, |
325 | 325 | 'widgets.php' |
326 | - ) ); |
|
327 | - if ( 'give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) { |
|
326 | + )); |
|
327 | + if ('give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow) { |
|
328 | 328 | $found = true; |
329 | - if ( 'give-upgrades' === $page ) { |
|
329 | + if ('give-upgrades' === $page) { |
|
330 | 330 | $found = false; |
331 | 331 | } |
332 | - } elseif ( in_array( $pagenow, $admin_pages ) ) { |
|
332 | + } elseif (in_array($pagenow, $admin_pages)) { |
|
333 | 333 | $found = true; |
334 | 334 | } |
335 | 335 | break; |
336 | 336 | } |
337 | 337 | |
338 | - return (bool) apply_filters( 'give_is_admin_page', $found, $page, $view, $passed_page, $passed_view ); |
|
338 | + return (bool) apply_filters('give_is_admin_page', $found, $page, $view, $passed_page, $passed_view); |
|
339 | 339 | |
340 | 340 | } |
341 | 341 | |
@@ -347,37 +347,37 @@ discard block |
||
347 | 347 | * @param array $settings |
348 | 348 | * @return array |
349 | 349 | */ |
350 | -function give_settings_page_pages( $settings ) { |
|
351 | - include( 'abstract-admin-settings-page.php' ); |
|
352 | - include( 'settings/class-settings-cmb2-backward-compatibility.php' ); |
|
350 | +function give_settings_page_pages($settings) { |
|
351 | + include('abstract-admin-settings-page.php'); |
|
352 | + include('settings/class-settings-cmb2-backward-compatibility.php'); |
|
353 | 353 | |
354 | 354 | $settings = array( |
355 | 355 | // General settings. |
356 | - include( 'settings/class-settings-general.php' ), |
|
356 | + include('settings/class-settings-general.php'), |
|
357 | 357 | |
358 | 358 | // Payment Gateways Settings. |
359 | - include( 'settings/class-settings-gateways.php' ), |
|
359 | + include('settings/class-settings-gateways.php'), |
|
360 | 360 | |
361 | 361 | // Display settings. |
362 | - include( 'settings/class-settings-display.php' ), |
|
362 | + include('settings/class-settings-display.php'), |
|
363 | 363 | |
364 | 364 | // Emails settings. |
365 | - include( 'settings/class-settings-email.php' ), |
|
365 | + include('settings/class-settings-email.php'), |
|
366 | 366 | |
367 | 367 | // Addons settings. |
368 | - include( 'settings/class-settings-addon.php' ), |
|
368 | + include('settings/class-settings-addon.php'), |
|
369 | 369 | |
370 | 370 | // License settings. |
371 | - include( 'settings/class-settings-license.php' ), |
|
371 | + include('settings/class-settings-license.php'), |
|
372 | 372 | |
373 | 373 | // Advanced settinns. |
374 | - include( 'settings/class-settings-advanced.php' ) |
|
374 | + include('settings/class-settings-advanced.php') |
|
375 | 375 | ); |
376 | 376 | |
377 | 377 | // Output. |
378 | 378 | return $settings; |
379 | 379 | } |
380 | -add_filter( 'give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1 ); |
|
380 | +add_filter('give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1); |
|
381 | 381 | |
382 | 382 | |
383 | 383 | /** |
@@ -387,28 +387,28 @@ discard block |
||
387 | 387 | * @param array $settings |
388 | 388 | * @return array |
389 | 389 | */ |
390 | -function give_reports_page_pages( $settings ) { |
|
391 | - include( 'abstract-admin-settings-page.php' ); |
|
390 | +function give_reports_page_pages($settings) { |
|
391 | + include('abstract-admin-settings-page.php'); |
|
392 | 392 | |
393 | 393 | $settings = array( |
394 | 394 | // Earnings. |
395 | - include( 'reporting/class-settings-earnings.php' ), |
|
395 | + include('reporting/class-settings-earnings.php'), |
|
396 | 396 | |
397 | 397 | // Forms. |
398 | - include( 'reporting/class-settings-forms.php' ), |
|
398 | + include('reporting/class-settings-forms.php'), |
|
399 | 399 | |
400 | 400 | // Donors. |
401 | - include( 'reporting/class-settings-donors.php' ), |
|
401 | + include('reporting/class-settings-donors.php'), |
|
402 | 402 | |
403 | 403 | // Gateways. |
404 | - include( 'reporting/class-settings-gateways.php' ), |
|
404 | + include('reporting/class-settings-gateways.php'), |
|
405 | 405 | |
406 | 406 | ); |
407 | 407 | |
408 | 408 | // Output. |
409 | 409 | return $settings; |
410 | 410 | } |
411 | -add_filter( 'give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1 ); |
|
411 | +add_filter('give-reports_get_settings_pages', 'give_reports_page_pages', 0, 1); |
|
412 | 412 | |
413 | 413 | /** |
414 | 414 | * Add setting tab to give-settings page |
@@ -417,31 +417,31 @@ discard block |
||
417 | 417 | * @param array $settings |
418 | 418 | * @return array |
419 | 419 | */ |
420 | -function give_tools_page_pages( $settings ) { |
|
421 | - include( 'abstract-admin-settings-page.php' ); |
|
420 | +function give_tools_page_pages($settings) { |
|
421 | + include('abstract-admin-settings-page.php'); |
|
422 | 422 | |
423 | 423 | $settings = array( |
424 | 424 | // System Info. |
425 | - include( 'tools/class-settings-system-info.php' ), |
|
425 | + include('tools/class-settings-system-info.php'), |
|
426 | 426 | |
427 | 427 | // Logs. |
428 | - include( 'tools/class-settings-logs.php' ), |
|
428 | + include('tools/class-settings-logs.php'), |
|
429 | 429 | |
430 | 430 | // API. |
431 | - include( 'tools/class-settings-api.php' ), |
|
431 | + include('tools/class-settings-api.php'), |
|
432 | 432 | |
433 | 433 | // Data. |
434 | - include( 'tools/class-settings-data.php' ), |
|
434 | + include('tools/class-settings-data.php'), |
|
435 | 435 | |
436 | 436 | // Export. |
437 | - include( 'tools/class-settings-export.php' ), |
|
437 | + include('tools/class-settings-export.php'), |
|
438 | 438 | |
439 | 439 | ); |
440 | 440 | |
441 | 441 | // Output. |
442 | 442 | return $settings; |
443 | 443 | } |
444 | -add_filter( 'give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1 ); |
|
444 | +add_filter('give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1); |
|
445 | 445 | |
446 | 446 | /** |
447 | 447 | * Set default tools page tab. |
@@ -450,10 +450,10 @@ discard block |
||
450 | 450 | * @param string $default_tab Default tab name. |
451 | 451 | * @return string |
452 | 452 | */ |
453 | -function give_set_default_tab_form_tools_page( $default_tab ) { |
|
453 | +function give_set_default_tab_form_tools_page($default_tab) { |
|
454 | 454 | return 'system-info'; |
455 | 455 | } |
456 | -add_filter( 'give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1 ); |
|
456 | +add_filter('give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1); |
|
457 | 457 | |
458 | 458 | |
459 | 459 | /** |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | * @param string $default_tab Default tab name. |
464 | 464 | * @return string |
465 | 465 | */ |
466 | -function give_set_default_tab_form_reports_page( $default_tab ) { |
|
466 | +function give_set_default_tab_form_reports_page($default_tab) { |
|
467 | 467 | return 'earnings'; |
468 | 468 | } |
469 | -add_filter( 'give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1 ); |
|
470 | 469 | \ No newline at end of file |
470 | +add_filter('give_default_setting_tab_give-reports', 'give_set_default_tab_form_reports_page', 10, 1); |
|
471 | 471 | \ No newline at end of file |