PluginProbe ʕ •ᴥ•ʔ
GiveWP – Donation Plugin and Fundraising Platform / 2.3.2
GiveWP – Donation Plugin and Fundraising Platform v2.3.2
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 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 7 years ago class-batch-export.php 7 years ago class-core-settings-export.php 7 years ago class-export-earnings.php 7 years ago class-export.php 7 years ago class-give-export-donations.php 7 years ago export-actions.php 7 years ago export-functions.php 7 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
388 lines
1 <?php
2 /**
3 * Give Export Donations Settings
4 *
5 * @package Give
6 * @subpackage Classes/Give_Settings_Data
7 * @copyright Copyright (c) 2016, GiveWP
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 * Class Give_Export_Donations
20 *
21 * @sine 2.1
22 */
23 final class Give_Export_Donations {
24
25 /**
26 * Importer type
27 *
28 * @since 2.1
29 *
30 * @var string
31 */
32 private $exporter_type = 'export_donations';
33
34 /**
35 * Instance.
36 *
37 * @since 2.1
38 */
39 static private $instance;
40
41 /**
42 * Singleton pattern.
43 *
44 * @since 2.1
45 *
46 * @access private
47 */
48 private function __construct() {
49 }
50
51 /**
52 * Get instance.
53 *
54 * @since 2.1
55 *
56 * @access public
57 *
58 * @return static
59 */
60 public static function get_instance() {
61 if ( null === static::$instance ) {
62 self::$instance = new static();
63 }
64
65 return self::$instance;
66 }
67
68 /**
69 * Setup
70 *
71 * @since 2.1
72 *
73 * @return void
74 */
75 public function setup() {
76 $this->setup_hooks();
77 }
78
79
80 /**
81 * Setup Hooks.
82 *
83 * @since 2.1
84 *
85 * @return void
86 */
87 private function setup_hooks() {
88 if ( ! $this->is_donations_export_page() ) {
89 return;
90 }
91
92 // Do not render main export tools page.
93 remove_action(
94 'give_admin_field_tools_export',
95 array(
96 'Give_Settings_Export',
97 'render_export_field',
98 ),
99 10
100 );
101
102 // Render donation export page
103 add_action( 'give_admin_field_tools_export', array( $this, 'render_page' ) );
104
105 // Print the HTML.
106 add_action( 'give_tools_export_donations_form_start', array( $this, 'html' ) );
107 }
108
109 /**
110 * Filter to modity the Taxonomy args
111 *
112 * @since 2.1
113 *
114 * @param array $args args for Taxonomy
115 *
116 * @return array args for Taxonomy
117 */
118 function give_forms_taxonomy_dropdown( $args ) {
119 $args['number'] = 30;
120
121 return $args;
122 }
123
124 /**
125 * Print the HTML for core setting exporter.
126 *
127 * @since 2.1
128 */
129 public function html() {
130 ?>
131 <section id="give-export-donations">
132 <table class="widefat export-options-table give-table">
133 <tbody>
134 <tr class="top">
135 <td colspan="2">
136 <h2 id="give-export-title"><?php _e( 'Export Donation History and Custom Fields to CSV', 'give' ); ?></h2>
137 <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>
138 </td>
139 </tr>
140
141 <?php
142 if ( give_is_setting_enabled( give_get_option( 'categories' ) ) ) {
143 add_filter( 'give_forms_category_dropdown', array( $this, 'give_forms_taxonomy_dropdown' ) );
144 ?>
145 <tr>
146 <td scope="row" class="row-title">
147 <label
148 for="give_forms_categories"><?php _e( 'Filter by Categories:', 'give' ); ?></label>
149 </td>
150 <td class="give-field-wrap">
151 <div class="give-clearfix">
152 <?php
153 echo Give()->html->category_dropdown(
154 'give_forms_categories[]',
155 0,
156 array(
157 'id' => 'give_forms_categories',
158 'class' => 'give_forms_categories',
159 'chosen' => true,
160 'multiple' => true,
161 'selected' => array(),
162 'show_option_all' => false,
163 'placeholder' => __( 'Choose one or more from categories', 'give' ),
164 'data' => array( 'search-type' => 'categories' ),
165 )
166 );
167 ?>
168 </div>
169 </td>
170 </tr>
171 <?php
172 remove_filter( 'give_forms_category_dropdown', array( $this, 'give_forms_taxonomy_dropdown' ) );
173 }
174
175 if ( give_is_setting_enabled( give_get_option( 'tags' ) ) ) {
176 add_filter( 'give_forms_tag_dropdown', array( $this, 'give_forms_taxonomy_dropdown' ) );
177 ?>
178 <tr>
179 <td scope="row" class="row-title">
180 <label
181 for="give_forms_tags"><?php _e( 'Filter by Tags:', 'give' ); ?></label>
182 </td>
183 <td class="give-field-wrap">
184 <div class="give-clearfix">
185 <?php
186 echo Give()->html->tags_dropdown(
187 'give_forms_tags[]',
188 0,
189 array(
190 'id' => 'give_forms_tags',
191 'class' => 'give_forms_tags',
192 'chosen' => true,
193 'multiple' => true,
194 'selected' => array(),
195 'show_option_all' => false,
196 'placeholder' => __( 'Choose one or more from tags', 'give' ),
197 'data' => array( 'search-type' => 'tags' ),
198 )
199 );
200 ?>
201 </div>
202 </td>
203 </tr>
204 <?php
205 remove_filter( 'give_forms_tag_dropdown', array( $this, 'give_forms_taxonomy_dropdown' ) );
206 }
207 ?>
208
209 <tr class="give-export-donation-form">
210 <td scope="row" class="row-title">
211 <label
212 for="give_payment_form_select"><?php _e( 'Filter by Donation Form:', 'give' ); ?></label>
213 </td>
214 <td class="give-field-wrap">
215 <div class="give-clearfix">
216 <?php
217 $args = array(
218 'name' => 'forms',
219 'id' => 'give-payment-form-select',
220 'chosen' => true,
221 'placeholder' => __( 'All Forms', 'give' ),
222 'data' => array( 'no-form' => __( 'No donation forms found', 'give' ) ),
223 );
224 echo Give()->html->forms_dropdown( $args );
225 ?>
226
227 <input type="hidden" name="form_ids" class="form_ids" />
228 </div>
229 </td>
230 </tr>
231
232 <tr>
233 <td scope="row" class="row-title">
234 <label for="give-payment-export-start"><?php _e( 'Filter by Date:', 'give' ); ?></label>
235 </td>
236 <td class="give-field-wrap">
237 <div class="give-clearfix">
238 <?php
239 $args = array(
240 'id' => 'give-payment-export-start',
241 'name' => 'start',
242 'placeholder' => __( 'Start Date', 'give' ),
243 'autocomplete' => 'off',
244 );
245 echo Give()->html->date_field( $args );
246 ?>
247 <?php
248 $args = array(
249 'id' => 'give-payment-export-end',
250 'name' => 'end',
251 'placeholder' => __( 'End Date', 'give' ),
252 'autocomplete' => 'off'
253 );
254 echo Give()->html->date_field( $args );
255 ?>
256 </div>
257 </td>
258 </tr>
259
260 <tr>
261 <td scope="row" class="row-title">
262 <label
263 for="give-export-donations-status"><?php _e( 'Filter by Status:', 'give' ); ?></label>
264 </td>
265 <td>
266 <div class="give-clearfix">
267 <select name="status" id="give-export-donations-status">
268 <option value="any"><?php _e( 'All Statuses', 'give' ); ?></option>
269 <?php
270 $statuses = give_get_payment_statuses();
271 foreach ( $statuses as $status => $label ) {
272 echo '<option value="' . $status . '">' . $label . '</option>';
273 }
274 ?>
275 </select>
276 </div>
277 </td>
278 </tr>
279
280 <?php
281 /**
282 * Add fields columns that are going to be exported when exporting donations
283 *
284 * @since 2.1
285 */
286 do_action( 'give_export_donation_fields' );
287 ?>
288
289 <tr class="end">
290 <td>
291 </td>
292 <td>
293 <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
294 <input type="hidden" name="give-export-class" value="Give_Export_Donations_CSV"/>
295 <input type="button" value="<?php esc_attr_e( 'Deselect All Fields', 'give' ); ?>" data-value="<?php esc_attr_e( 'Select All Fields', 'give' ); ?>" class="give-toggle-checkbox-selection button button-secondary">
296 <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="give-export-donation-button button button-primary">
297 <div class="add-notices"></div>
298 </td>
299 </tr>
300 </tbody>
301 </table>
302 </section>
303 <?php
304 }
305
306 /**
307 * Render donations export page
308 *
309 * @since 2.1
310 */
311 public function render_page() {
312 /**
313 * Fires before displaying the export div tools.
314 *
315 * @since 2.1
316 */
317 do_action( 'give_tools_export_donations_main_before' );
318 ?>
319 <div id="poststuff">
320 <div class="postbox">
321 <h1 class="give-export-h1" align="center"><?php _e( 'Export Donations', 'give' ); ?></h1>
322 <div class="inside give-tools-setting-page-export give-export_donations">
323 <?php
324 /**
325 * Fires before from start.
326 *
327 * @since 2.1
328 */
329 do_action( 'give_tools_export_donations_form_before_start' );
330 ?>
331 <form method="post"
332 id="give-export_donations-form"
333 class="give-export-form tools-setting-page-export tools-setting-page-export"
334 enctype="multipart/form-data">
335
336 <?php
337 /**
338 * Fires just after form start.
339 *
340 * @since 2.1
341 */
342 do_action( 'give_tools_export_donations_form_start' );
343 ?>
344
345 <?php
346 /**
347 * Fires just after before form end.
348 *
349 * @since 2.1
350 */
351 do_action( 'give_tools_export_donations_form_end' );
352 ?>
353 </form>
354 <?php
355 /**
356 * Fires just after form end.
357 *
358 * @since 2.1
359 */
360 do_action( 'give_tools_export_donations_form_after_end' );
361 ?>
362 </div><!-- .inside -->
363 </div><!-- .postbox -->
364 </div><!-- #poststuff -->
365 <?php
366 /**
367 * Fires after displaying the export div tools.
368 *
369 * @since 2.1
370 */
371 do_action( 'give_tools_export_donations_main_after' );
372 }
373
374 /**
375 * Get if current page export donations page or not
376 *
377 * @since 2.1
378 *
379 * @return bool
380 */
381 private function is_donations_export_page() {
382 return 'export' === give_get_current_setting_tab() && isset( $_GET['type'] ) && $this->exporter_type === give_clean( $_GET['type'] );
383 }
384 }
385
386 Give_Export_Donations::get_instance()->setup();
387 }
388