PluginProbe ʕ •ᴥ•ʔ
GiveWP – Donation Plugin and Fundraising Platform / 2.2.0
GiveWP – Donation Plugin and Fundraising Platform v2.2.0
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 2.30.0 2.31.0 2.31.1 2.32.0 2.33.0 2.33.1 2.33.2 2.33.3 2.33.4 2.33.5 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.9.0 2.9.1 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.10.0 3.11.0 3.12.0 3.12.1 3.12.2 3.12.3 3.13.0 3.14.0 3.14.1 3.14.2 3.15.0 3.15.1 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.16.5 3.17.0 3.17.1 3.17.2 3.18.0 3.19.0 3.19.1 3.19.2 3.19.3 3.19.4 3.2.0 3.2.1 3.2.2 3.20.0 3.21.0 3.21.1 3.22.0 3.22.1 3.22.2 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 3.6.0 3.6.1 3.6.2 3.7.0 3.8.0 3.9.0 4.0.0 4.1.0 4.1.1 4.10.0 4.10.1 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.14.5 4.14.6 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.1 4.7.0 4.7.1 4.8.0 4.8.1 4.9.0 trunk 1.9.0 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.10.0 2.10.1 2.10.2 2.10.3 2.10.4 2.11.0 2.11.1 2.11.2 2.11.3 2.12.0 2.12.1 2.12.2 2.12.3 2.13.0 2.13.1 2.13.2 2.13.3 2.13.4 2.14.0 2.15.0 2.16.0 2.16.1 2.17.0 2.17.1 2.17.3 2.18.0 2.18.1 2.19.1 2.19.2 2.19.3 2.19.4 2.19.5 2.19.6 2.19.7 2.19.8 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.20.0 2.20.1 2.20.2 2.21.0 2.21.1 2.21.2 2.21.3 2.21.4 2.22.0 2.22.1 2.22.2 2.22.3 2.23.0 2.23.1 2.23.2 2.24.0 2.24.1 2.24.2 2.25.0 2.25.1 2.25.2 2.25.3 2.26.0 2.27.0 2.27.1 2.27.2 2.27.3 2.28.0 2.29.0 2.29.1 2.29.2
give / includes / admin / tools / export / class-give-export-donations.php
give / includes / admin / tools / export Last commit date
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
class-give-export-donations.php
377 lines
1 <?php
2 /**
3 * Give Export Donations Settings
4 *
5 * @package Give
6 * @subpackage Classes/Give_Settings_Data
7 * @copyright Copyright (c) 2016, WordImpress
8 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 * @since 2.1
10 */
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit; // Exit if accessed directly
14 }
15
16 if ( ! class_exists( 'Give_Export_Donations' ) ) {
17
18 /**
19 * Give_Settings_CSV.
20 *
21 * @sine 2.1
22 */
23 final class Give_Export_Donations {
24 /**
25 * Importer type
26 *
27 * @since 2.1
28 *
29 * @var string
30 */
31 private $exporter_type = 'export_donations';
32
33 /**
34 * Instance.
35 *
36 * @since 2.1
37 */
38 static private $instance;
39
40 /**
41 * Singleton pattern.
42 *
43 * @since 2.1
44 *
45 * @access private
46 */
47 private function __construct() {
48 }
49
50 /**
51 * Get instance.
52 *
53 * @since 2.1
54 *
55 * @access public
56 *
57 * @return static
58 */
59 public static function get_instance() {
60 if ( null === static::$instance ) {
61 self::$instance = new static();
62 }
63
64 return self::$instance;
65 }
66
67 /**
68 * Setup
69 *
70 * @since 2.1
71 *
72 * @return void
73 */
74 public function setup() {
75 $this->setup_hooks();
76 }
77
78
79 /**
80 * Setup Hooks.
81 *
82 * @since 2.1
83 *
84 * @return void
85 */
86 private function setup_hooks() {
87 if ( ! $this->is_donations_export_page() ) {
88 return;
89 }
90
91 // Do not render main export tools page.
92 remove_action( 'give_admin_field_tools_export', array(
93 'Give_Settings_Export',
94 'render_export_field'
95 ), 10 );
96
97 // Render donation export page
98 add_action( 'give_admin_field_tools_export', array( $this, 'render_page' ) );
99
100 // Print the HTML.
101 add_action( 'give_tools_export_donations_form_start', array( $this, 'html' ) );
102 }
103
104 /**
105 * Filter to modity the Taxonomy args
106 *
107 * @since 2.1
108 *
109 * @param array $args args for Taxonomy
110 *
111 * @return array args for Taxonomy
112 */
113 function give_forms_taxonomy_dropdown( $args ) {
114 $args['number'] = 30;
115
116 return $args;
117 }
118
119 /**
120 * Print the HTML for core setting exporter.
121 *
122 * @since 2.1
123 */
124 public function html() {
125 ?>
126 <section id="give-export-donations">
127 <table class="widefat export-options-table give-table">
128 <tbody>
129 <tr class="top">
130 <td colspan="2">
131 <h2 id="give-export-title"><?php _e( 'Export Donation History and Custom Fields to CSV', 'give' ) ?></h2>
132 <p class="give-field-description"><?php _e( 'Download an export of donors for specific donation forms with the option to include custom fields.', 'give' ) ?></p>
133 </td>
134 </tr>
135
136 <?php
137 if ( give_is_setting_enabled( give_get_option( 'categories' ) ) ) {
138 add_filter( 'give_forms_category_dropdown', array( $this, 'give_forms_taxonomy_dropdown' ) );
139 ?>
140 <tr>
141 <td scope="row" class="row-title">
142 <label
143 for="give_forms_categories"><?php _e( 'Filter by Categories:', 'give' ); ?></label>
144 </td>
145 <td class="give-field-wrap">
146 <div class="give-clearfix">
147 <?php
148 echo Give()->html->category_dropdown(
149 'give_forms_categories[]',
150 0,
151 array(
152 'id' => 'give_forms_categories',
153 'class' => 'give_forms_categories',
154 'chosen' => true,
155 'multiple' => true,
156 'selected' => array(),
157 'show_option_all' => false,
158 'placeholder' => __( 'Choose one or more from categories', 'give' ),
159 'data' => array( 'search-type' => 'categories' ),
160 )
161 );
162 ?>
163 </div>
164 </td>
165 </tr>
166 <?php
167 remove_filter( 'give_forms_category_dropdown', array( $this, 'give_forms_taxonomy_dropdown' ) );
168 }
169
170 if ( give_is_setting_enabled( give_get_option( 'tags' ) ) ) {
171 add_filter( 'give_forms_tag_dropdown', array( $this, 'give_forms_taxonomy_dropdown' ) );
172 ?>
173 <tr>
174 <td scope="row" class="row-title">
175 <label
176 for="give_forms_tags"><?php _e( 'Filter by Tags:', 'give' ); ?></label>
177 </td>
178 <td class="give-field-wrap">
179 <div class="give-clearfix">
180 <?php
181 echo Give()->html->tags_dropdown(
182 'give_forms_tags[]',
183 0,
184 array(
185 'id' => 'give_forms_tags',
186 'class' => 'give_forms_tags',
187 'chosen' => true,
188 'multiple' => true,
189 'selected' => array(),
190 'show_option_all' => false,
191 'placeholder' => __( 'Choose one or more from tags', 'give' ),
192 'data' => array( 'search-type' => 'tags' ),
193 )
194 );
195 ?>
196 </div>
197 </td>
198 </tr>
199 <?php
200 remove_filter( 'give_forms_tag_dropdown', array( $this, 'give_forms_taxonomy_dropdown' ) );
201 }
202 ?>
203
204 <tr class="give-export-donation-form">
205 <td scope="row" class="row-title">
206 <label
207 for="give_payment_form_select"><?php _e( 'Filter by Donation Form:', 'give' ); ?></label>
208 </td>
209 <td class="give-field-wrap">
210 <div class="give-clearfix">
211 <?php
212 $args = array(
213 'name' => 'forms',
214 'id' => 'give-payment-form-select',
215 'chosen' => true,
216 'placeholder' => __( 'All Forms', 'give' ),
217 'data' => array( 'no-form' => __( 'No donation forms found', 'give' ), ),
218 );
219 echo Give()->html->forms_dropdown( $args );
220 ?>
221
222 <input type="hidden" name="form_ids" class="form_ids" />
223 </div>
224 </td>
225 </tr>
226
227 <tr>
228 <td scope="row" class="row-title">
229 <label for="give-payment-export-start"><?php _e( 'Filter by Date:', 'give' ); ?></label>
230 </td>
231 <td class="give-field-wrap">
232 <div class="give-clearfix">
233 <?php
234 $args = array(
235 'id' => 'give-payment-export-start',
236 'name' => 'start',
237 'placeholder' => __( 'Start date', 'give' ),
238 );
239 echo Give()->html->date_field( $args ); ?>
240 <?php
241 $args = array(
242 'id' => 'give-payment-export-end',
243 'name' => 'end',
244 'placeholder' => __( 'End date', 'give' ),
245 );
246 echo Give()->html->date_field( $args ); ?>
247 </div>
248 </td>
249 </tr>
250
251 <tr>
252 <td scope="row" class="row-title">
253 <label
254 for="give-export-donations-status"><?php _e( 'Filter by Status:', 'give' ); ?></label>
255 </td>
256 <td>
257 <div class="give-clearfix">
258 <select name="status" id="give-export-donations-status">
259 <option value="any"><?php _e( 'All Statuses', 'give' ); ?></option>
260 <?php
261 $statuses = give_get_payment_statuses();
262 foreach ( $statuses as $status => $label ) {
263 echo '<option value="' . $status . '">' . $label . '</option>';
264 }
265 ?>
266 </select>
267 </div>
268 </td>
269 </tr>
270
271 <?php
272 /**
273 * Add fields columns that are going to be exported when exporting donations
274 *
275 * @since 2.1
276 */
277 do_action( 'give_export_donation_fields' );
278 ?>
279
280 <tr class="end">
281 <td>
282 </td>
283 <td>
284 <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
285 <input type="hidden" name="give-export-class" value="Give_Export_Donations_CSV"/>
286 <input type="submit" value="<?php _e( 'Generate CSV', 'give' ) ?>" class="give-export-donation-button button button-primary">
287 <div class="add-notices"></div>
288 </td>
289 </tr>
290 </tbody>
291 </table>
292 </section>
293 <?php
294 }
295
296 /**
297 * Render donations export page
298 *
299 * @since 2.1
300 */
301 public function render_page() {
302 /**
303 * Fires before displaying the export div tools.
304 *
305 * @since 2.1
306 */
307 do_action( 'give_tools_export_donations_main_before' );
308 ?>
309 <div id="poststuff">
310 <div class="postbox">
311 <h1 class="give-export-h1" align="center"><?php _e( 'Export Donations', 'give' ); ?></h1>
312 <div class="inside give-tools-setting-page-export give-export_donations">
313 <?php
314 /**
315 * Fires before from start.
316 *
317 * @since 2.1
318 */
319 do_action( 'give_tools_export_donations_form_before_start' );
320 ?>
321 <form method="post" id="give-export_donations-form"
322 class="give-export-form tools-setting-page-export tools-setting-page-export"
323 enctype="multipart/form-data">
324
325 <?php
326 /**
327 * Fires just after form start.
328 *
329 * @since 2.1
330 */
331 do_action( 'give_tools_export_donations_form_start' );
332 ?>
333
334 <?php
335 /**
336 * Fires just after before form end.
337 *
338 * @since 2.1
339 */
340 do_action( 'give_tools_export_donations_form_end' );
341 ?>
342 </form>
343 <?php
344 /**
345 * Fires just after form end.
346 *
347 * @since 2.1
348 */
349 do_action( 'give_tools_iexport_donations_form_after_end' );
350 ?>
351 </div><!-- .inside -->
352 </div><!-- .postbox -->
353 </div><!-- #poststuff -->
354 <?php
355 /**
356 * Fires after displaying the export div tools.
357 *
358 * @since 2.1
359 */
360 do_action( 'give_tools_export_donations_main_after' );
361 }
362
363 /**
364 * Get if current page export donations page or not
365 *
366 * @since 2.1
367 *
368 * @return bool
369 */
370 private function is_donations_export_page() {
371 return 'export' === give_get_current_setting_tab() && isset( $_GET['type'] ) && $this->exporter_type === give_clean( $_GET['type'] );
372 }
373 }
374
375 Give_Export_Donations::get_instance()->setup();
376 }
377