class-batch-export-donors.php
7 years ago
class-batch-export-forms.php
8 years ago
class-batch-export.php
8 years ago
class-core-settings-export.php
8 years ago
class-export-earnings.php
8 years ago
class-export.php
8 years ago
class-give-export-donations.php
8 years ago
export-actions.php
8 years ago
export-functions.php
8 years ago
give-export-donations-exporter.php
7 years ago
give-export-donations-functions.php
7 years ago
pdf-reports.php
7 years ago
export-actions.php
164 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Exports Actions |
| 4 | * |
| 5 | * These are actions related to exporting data from Give. |
| 6 | * |
| 7 | * @package Give |
| 8 | * @subpackage Admin/Export |
| 9 | * @copyright Copyright (c) 2016, WordImpress |
| 10 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
| 11 | */ |
| 12 | |
| 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | exit; |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * Process the download file generated by a batch export. |
| 19 | * |
| 20 | * @since 1.5 |
| 21 | * @return void |
| 22 | */ |
| 23 | function give_process_batch_export_form() { |
| 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( |
| 27 | 'response' => 403, |
| 28 | ) ); |
| 29 | } |
| 30 | |
| 31 | require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export.php'; |
| 32 | |
| 33 | /** |
| 34 | * Fires before batch export. |
| 35 | * |
| 36 | * @since 1.5 |
| 37 | * |
| 38 | * @param string $class Export class. |
| 39 | */ |
| 40 | do_action( 'give_batch_export_class_include', $_REQUEST['class'] ); |
| 41 | |
| 42 | $export = new $_REQUEST['class']; |
| 43 | $export->export(); |
| 44 | |
| 45 | } |
| 46 | |
| 47 | add_action( 'give_form_batch_export', 'give_process_batch_export_form' ); |
| 48 | |
| 49 | /** |
| 50 | * Exports earnings for a specified time period. |
| 51 | * |
| 52 | * Give_Earnings_Export class. |
| 53 | * |
| 54 | * @since 1.5 |
| 55 | * @return void |
| 56 | */ |
| 57 | function give_export_earnings() { |
| 58 | require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export-earnings.php'; |
| 59 | |
| 60 | $earnings_export = new Give_Earnings_Export(); |
| 61 | |
| 62 | $earnings_export->export(); |
| 63 | } |
| 64 | |
| 65 | add_action( 'give_earnings_export', 'give_export_earnings' ); |
| 66 | |
| 67 | /** |
| 68 | * Exports Give's core settings. |
| 69 | * |
| 70 | * Give_Core_Settings class. |
| 71 | * |
| 72 | * @since 1.8.17 |
| 73 | * @return void |
| 74 | */ |
| 75 | function give_core_settings_export() { |
| 76 | require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-core-settings-export.php'; |
| 77 | |
| 78 | $core_settings = new Give_Core_Settings_Export(); |
| 79 | |
| 80 | $core_settings->export(); |
| 81 | } |
| 82 | |
| 83 | add_action( 'give_core_settings_export', 'give_core_settings_export' ); |
| 84 | |
| 85 | |
| 86 | /** |
| 87 | * Add a hook allowing extensions to register a hook on the batch export process. |
| 88 | * |
| 89 | * @since 1.5 |
| 90 | * @return void |
| 91 | */ |
| 92 | function give_register_batch_exporters() { |
| 93 | if ( is_admin() ) { |
| 94 | /** |
| 95 | * Fires in the admin, while plugins loaded. |
| 96 | * |
| 97 | * Allowing extensions to register a hook on the batch export process. |
| 98 | * |
| 99 | * @since 1.5 |
| 100 | * |
| 101 | * @param string $class Export class. |
| 102 | */ |
| 103 | do_action( 'give_register_batch_exporter' ); |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | add_action( 'plugins_loaded', 'give_register_batch_exporters' ); |
| 108 | |
| 109 | /** |
| 110 | * Register the donors batch exporter. |
| 111 | * |
| 112 | * @since 1.5.2 |
| 113 | */ |
| 114 | function give_register_donors_batch_export() { |
| 115 | add_action( 'give_batch_export_class_include', 'give_include_donors_batch_processor', 10, 1 ); |
| 116 | } |
| 117 | |
| 118 | add_action( 'give_register_batch_exporter', 'give_register_donors_batch_export', 10 ); |
| 119 | |
| 120 | /** |
| 121 | * Loads the donors batch process if needed. |
| 122 | * |
| 123 | * @since 1.5.2 |
| 124 | * |
| 125 | * @param string $class The class being requested to run for the batch export. |
| 126 | * |
| 127 | * @return void |
| 128 | */ |
| 129 | function give_include_donors_batch_processor( $class ) { |
| 130 | |
| 131 | if ( 'Give_Batch_Donors_Export' === $class ) { |
| 132 | require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-donors.php'; |
| 133 | } |
| 134 | |
| 135 | } |
| 136 | |
| 137 | /** |
| 138 | * Register the download products batch exporter |
| 139 | * |
| 140 | * @since 1.5 |
| 141 | */ |
| 142 | function give_register_forms_batch_export() { |
| 143 | add_action( 'give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1 ); |
| 144 | } |
| 145 | |
| 146 | add_action( 'give_register_batch_exporter', 'give_register_forms_batch_export', 10 ); |
| 147 | |
| 148 | /** |
| 149 | * Loads the file downloads batch process if needed |
| 150 | * |
| 151 | * @since 1.5 |
| 152 | * |
| 153 | * @param string $class The class being requested to run for the batch export |
| 154 | * |
| 155 | * @return void |
| 156 | */ |
| 157 | function give_include_forms_batch_processor( $class ) { |
| 158 | |
| 159 | if ( 'Give_Batch_Forms_Export' === $class ) { |
| 160 | require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export-forms.php'; |
| 161 | } |
| 162 | |
| 163 | } |
| 164 |