PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.17.0
GiveWP – Donation Plugin and Fundraising Platform v4.17.0
4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 All 256 releases
← All changes | includes/admin/tools/data/class-give-tools-delete-test-donors.php +47 -22 2.3.0 → 4.17.0 View file →
@@ -4,9 +4,9 @@
4 4 *
5 5 * This class handles batch processing of deleting donor data.
6 6 *
7 7 * @subpackage Admin/Tools/Give_Tools_Delete_Donors
8 - * @copyright Copyright (c) 2016, WordImpress
8 + * @copyright Copyright (c) 2016, GiveWP
9 9 * @license https://opensource.org/licenses/gpl-license GNU Public License
10 10 * @since 1.8.12
11 11 */
12 12
@@ -26,8 +26,9 @@
26 26 var $request;
27 27
28 28 /**
29 29 * Used to store donation id's that are going to get deleted.
30 + *
30 31 * @var string
31 32 * @since 1.8.12
32 33 */
33 34 var $donation_key = 'give_temp_delete_donation_ids';
@@ -33,8 +34,9 @@
33 34 var $donation_key = 'give_temp_delete_donation_ids';
34 35
35 36 /**
36 37 * Used to store donors id's that are going to get deleted.
38 + *
37 39 * @var string
38 40 * @since 1.8.12
39 41 */
40 42 var $donor_key = 'give_temp_delete_donor_ids';
@@ -40,8 +42,9 @@
40 42 var $donor_key = 'give_temp_delete_donor_ids';
41 43
42 44 /**
43 45 * Used to store the step where the step will be. ( 'count', 'donations', 'donors' ).
46 + *
44 47 * @var string
45 48 * @since 1.8.12
46 49 */
47 50 var $step_key = 'give_temp_delete_step';
@@ -47,8 +50,9 @@
47 50 var $step_key = 'give_temp_delete_step';
48 51
49 52 /**
50 53 * Used to store to get the page count in the loop.
54 + *
51 55 * @var string
52 56 * @since 1.8.12
53 57 */
54 58 var $step_on_key = 'give_temp_delete_step_on';
@@ -54,8 +58,9 @@
54 58 var $step_on_key = 'give_temp_delete_step_on';
55 59
56 60 /**
57 61 * Contain total number of step .
62 + *
58 63 * @var string
59 64 * @since 1.8.12
60 65 */
61 66 var $total_step;
@@ -61,8 +66,9 @@
61 66 var $total_step;
62 67
63 68 /**
64 69 * Counting contain total number of step that completed.
70 + *
65 71 * @var int
66 72 * @since 1.8.12
67 73 */
68 74 var $step_completed;
@@ -68,8 +74,9 @@
68 74 var $step_completed;
69 75
70 76 /**
71 77 * Our export type. Used for export-type specific filters/actions
78 + *
72 79 * @var string
73 80 * @since 1.8.12
74 81 */
75 82 public $export_type = '';
@@ -75,8 +82,9 @@
75 82 public $export_type = '';
76 83
77 84 /**
78 85 * Allows for a non-form batch processing to be run.
86 + *
79 87 * @since 1.8.12
80 88 * @var boolean
81 89 */
82 90 public $is_void = true;
@@ -82,8 +90,9 @@
82 90 public $is_void = true;
83 91
84 92 /**
85 93 * Sets the number of items to pull on each step
94 + *
86 95 * @since 1.8.12
87 96 * @var int
88 97 */
89 98 public $per_step = 10;
@@ -89,8 +98,9 @@
89 98 public $per_step = 10;
90 99
91 100 /**
92 101 * Set's all the donors id's
102 + *
93 103 * @since 1.8.12
94 104 * @var array
95 105 */
96 106 public $donor_ids = array();
@@ -150,10 +160,10 @@
150 160 /**
151 161 * Will Update or Add the donation and donors ids in the with option table for there respected key.
152 162 *
153 163 * @param string $step On which the current ajax is running.
154 - * @param array $donation_ids Contain the list of all the donation id's that has being add before this
155 - * @param array $donor_ids Contain the list of all the donors id's that has being add before this
164 + * @param array $donation_ids Contain the list of all the donation id's that has being add before this
165 + * @param array $donor_ids Contain the list of all the donors id's that has being add before this
156 166 */
157 167 private function count( $step, $donation_ids = array(), $donor_ids = array() ) {
158 168
159 169 // Get the Page count by default it's zero.
@@ -163,17 +173,29 @@
163 173
164 174 /**
165 175 * Filter add to alter the argument before the wp quest run
166 176 */
167 - $args = apply_filters( 'give_tools_reset_stats_total_args', array(
168 - 'post_type' => 'give_payment',
169 - 'post_status' => 'any',
170 - 'posts_per_page' => $this->per_step,
171 - 'paged' => $paged,
172 - // ONLY TEST MODE TRANSACTIONS!!!
173 - 'meta_key' => '_give_payment_mode',
174 - 'meta_value' => 'test',
175 - ) );
177 + $args = apply_filters(
178 + 'give_tools_reset_stats_total_args',
179 + array(
180 + 'post_type' => 'give_payment',
181 + 'post_status' => 'any',
182 + 'posts_per_page' => $this->per_step,
183 + 'paged' => $paged,
184 + // ONLY TEST MODE TRANSACTIONS!!!
185 + 'meta_query' => array(
186 + 'relation' => 'OR',
187 + array(
188 + 'key' => '_give_payment_mode',
189 + 'value' => 'test',
190 + ),
191 + array(
192 + 'key' => '_give_payment_gateway',
193 + 'value' => 'manual',
194 + ),
195 + ),
196 + )
197 + );
176 198
177 199 // Reset the post data.
178 200 wp_reset_postdata();
179 201 // Getting the new donation.
@@ -332,16 +354,19 @@
332 354
333 355 $this->total_step = ( ( count( $donation_ids ) / $this->per_step ) * 2 ) + count( $donor_ids );
334 356 $this->step_completed = $page + ( count( $donation_ids ) / $this->per_step );
335 357
336 - $args = apply_filters( 'give_tools_reset_stats_total_args', array(
337 - 'post_type' => 'give_payment',
338 - 'post_status' => 'any',
339 - 'posts_per_page' => 1,
340 - 'meta_key' => '_give_payment_mode',
341 - 'meta_value' => 'live',
342 - 'author' => $donor_ids[ $page ],
343 - ) );
358 + $args = apply_filters(
359 + 'give_tools_reset_stats_total_args',
360 + array(
361 + 'post_type' => 'give_payment',
362 + 'post_status' => 'any',
363 + 'posts_per_page' => 1,
364 + 'meta_key' => '_give_payment_mode',
365 + 'meta_value' => 'live',
366 + 'author' => $donor_ids[ $page ],
367 + )
368 + );
344 369
345 370 $donation_posts = get_posts( $args );
346 371 if ( empty( $donation_posts ) ) {
347 372 Give()->donors->delete_by_user_id( $donor_ids[ $page ] );
@@ -399,9 +424,9 @@
399 424 *
400 425 * @since 1.8.12s
401 426 *
402 427 * @param string $key The option_name
403 - * @param mixed $value The value to store
428 + * @param mixed $value The value to store
404 429 *
405 430 * @return void
406 431 */
407 432 public function update_option( $key, $value ) {
@@ -452,9 +477,9 @@
452 477 * Unset the properties specific to the donors export.
453 478 *
454 479 * @since 2.3.0
455 480 *
456 - * @param array $request
481 + * @param array $request
457 482 * @param Give_Batch_Export $export
458 483 */
459 484 public function unset_properties( $request, $export ) {
460 485 if ( $export->done ) {