|
1
|
|
|
<?php |
|
|
|
|
|
|
2
|
|
|
/** |
|
3
|
|
|
* Tools Actions |
|
4
|
|
|
* |
|
5
|
|
|
* @package Give |
|
6
|
|
|
* @subpackage Admin/Tools |
|
7
|
|
|
* @copyright Copyright (c) 2016, WordImpress |
|
8
|
|
|
* @license https://opensource.org/licenses/gpl-license GNU Public License |
|
9
|
|
|
* @since 1.5 |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
|
|
13
|
|
|
if ( ! defined( 'ABSPATH' ) ) { |
|
14
|
|
|
exit; |
|
15
|
|
|
} |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Register the recount batch processor |
|
19
|
|
|
* |
|
20
|
|
|
* @since 1.5 |
|
21
|
|
|
*/ |
|
22
|
|
|
function give_register_batch_recount_export_classes() { |
|
23
|
|
|
add_action( 'give_batch_export_class_include', 'give_include_batch_export_class', 10, 1 ); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
add_action( 'give_register_batch_exporter', 'give_register_batch_recount_export_classes', 10 ); |
|
27
|
|
|
|
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Loads the tools batch processing classes |
|
31
|
|
|
* |
|
32
|
|
|
* @since 1.8 |
|
33
|
|
|
* |
|
34
|
|
|
* @param string $class The class being requested to run for the batch export |
|
35
|
|
|
* |
|
36
|
|
|
* @return void |
|
37
|
|
|
*/ |
|
38
|
|
|
function give_include_batch_export_class( $class ) { |
|
39
|
|
|
switch ( $class ) { |
|
40
|
|
|
|
|
41
|
|
|
case 'Give_Tools_Delete_Test_Transactions': |
|
42
|
|
|
require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-delete-test-transactions.php'; |
|
43
|
|
|
break; |
|
44
|
|
|
|
|
45
|
|
|
case 'Give_Tools_Recount_Customer_Stats': |
|
46
|
|
|
require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-recount-customer-stats.php'; |
|
47
|
|
|
break; |
|
48
|
|
|
|
|
49
|
|
|
case 'Give_Tools_Reset_Stats': |
|
50
|
|
|
require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-reset-stats.php'; |
|
51
|
|
|
break; |
|
52
|
|
|
|
|
53
|
|
|
case 'Give_Tools_Recount_All_Stats': |
|
54
|
|
|
require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-recount-all-stats.php'; |
|
55
|
|
|
break; |
|
56
|
|
|
|
|
57
|
|
|
case 'Give_Tools_Recount_Form_Stats': |
|
58
|
|
|
require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-recount-form-stats.php'; |
|
59
|
|
|
break; |
|
60
|
|
|
|
|
61
|
|
|
case 'Give_Tools_Recount_Income': |
|
62
|
|
|
require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/class-give-tools-recount-income.php'; |
|
63
|
|
|
break; |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.