← All changes
|
includes/admin/tools/data/class-give-tools-delete-test-donors.php
+45
-29
2.3.2
→
4.17.0
View file →
| @@ -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,26 +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_query' => array( | |
| 174 | - 'relation' => 'OR', | |
| 175 | - array( | |
| 176 | - 'key' => '_give_payment_mode', | |
| 177 | - 'value' => 'test', | |
| 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 | + ), | |
| 178 | 195 | ), |
| 179 | - array( | |
| 180 | - 'key' => '_give_payment_gateway', | |
| 181 | - 'value' => 'manual', | |
| 182 | - ), | |
| 183 | - ), | |
| 184 | - ) ); | |
| 196 | + ) | |
| 197 | + ); | |
| 185 | 198 | |
| 186 | 199 | // Reset the post data. |
| 187 | 200 | wp_reset_postdata(); |
| 188 | 201 | // Getting the new donation. |
| @@ -341,16 +354,19 @@ | ||
| 341 | 354 | |
| 342 | 355 | $this->total_step = ( ( count( $donation_ids ) / $this->per_step ) * 2 ) + count( $donor_ids ); |
| 343 | 356 | $this->step_completed = $page + ( count( $donation_ids ) / $this->per_step ); |
| 344 | 357 | |
| 345 | - $args = apply_filters( 'give_tools_reset_stats_total_args', array( | |
| 346 | - 'post_type' => 'give_payment', | |
| 347 | - 'post_status' => 'any', | |
| 348 | - 'posts_per_page' => 1, | |
| 349 | - 'meta_key' => '_give_payment_mode', | |
| 350 | - 'meta_value' => 'live', | |
| 351 | - 'author' => $donor_ids[ $page ], | |
| 352 | - ) ); | |
| 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 | + ); | |
| 353 | 369 | |
| 354 | 370 | $donation_posts = get_posts( $args ); |
| 355 | 371 | if ( empty( $donation_posts ) ) { |
| 356 | 372 | Give()->donors->delete_by_user_id( $donor_ids[ $page ] ); |
| @@ -408,9 +424,9 @@ | ||
| 408 | 424 | * |
| 409 | 425 | * @since 1.8.12s |
| 410 | 426 | * |
| 411 | 427 | * @param string $key The option_name |
| 412 | - * @param mixed $value The value to store | |
| 428 | + * @param mixed $value The value to store | |
| 413 | 429 | * |
| 414 | 430 | * @return void |
| 415 | 431 | */ |
| 416 | 432 | public function update_option( $key, $value ) { |
| @@ -461,9 +477,9 @@ | ||
| 461 | 477 | * Unset the properties specific to the donors export. |
| 462 | 478 | * |
| 463 | 479 | * @since 2.3.0 |
| 464 | 480 | * |
| 465 | - * @param array $request | |
| 481 | + * @param array $request | |
| 466 | 482 | * @param Give_Batch_Export $export |
| 467 | 483 | */ |
| 468 | 484 | public function unset_properties( $request, $export ) { |
| 469 | 485 | if ( $export->done ) { |