PluginProbe ʕ •ᴥ•ʔ
GiveWP – Donation Plugin and Fundraising Platform / 2.6.0
GiveWP – Donation Plugin and Fundraising Platform v2.6.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.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 6 years ago export-actions.php 6 years ago export-functions.php 7 years ago give-export-donations-exporter.php 6 years ago give-export-donations-functions.php 6 years ago pdf-reports.php 6 years ago
class-give-export-donations.php
389 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 'class' => 'give-width-25em',
221 'chosen' => true,
222 'placeholder' => __( 'All Forms', 'give' ),
223 'data' => array( 'no-form' => __( 'No donation forms found', 'give' ) ),
224 );
225 echo Give()->html->forms_dropdown( $args );
226 ?>
227
228 <input type="hidden" name="form_ids" class="form_ids" />
229 </div>
230 </td>
231 </tr>
232
233 <tr>
234 <td scope="row" class="row-title">
235 <label for="give-payment-export-start"><?php _e( 'Filter by Date:', 'give' ); ?></label>
236 </td>
237 <td class="give-field-wrap">
238 <div class="give-clearfix">
239 <?php
240 $args = array(
241 'id' => 'give-payment-export-start',
242 'name' => 'start',
243 'placeholder' => __( 'Start Date', 'give' ),
244 'autocomplete' => 'off',
245 );
246 echo Give()->html->date_field( $args );
247 ?>
248 <?php
249 $args = array(
250 'id' => 'give-payment-export-end',
251 'name' => 'end',
252 'placeholder' => __( 'End Date', 'give' ),
253 'autocomplete' => 'off'
254 );
255 echo Give()->html->date_field( $args );
256 ?>
257 </div>
258 </td>
259 </tr>
260
261 <tr>
262 <td scope="row" class="row-title">
263 <label
264 for="give-export-donations-status"><?php _e( 'Filter by Status:', 'give' ); ?></label>
265 </td>
266 <td>
267 <div class="give-clearfix">
268 <select name="status" id="give-export-donations-status">
269 <option value="any"><?php _e( 'All Statuses', 'give' ); ?></option>
270 <?php
271 $statuses = give_get_payment_statuses();
272 foreach ( $statuses as $status => $label ) {
273 echo '<option value="' . $status . '">' . $label . '</option>';
274 }
275 ?>
276 </select>
277 </div>
278 </td>
279 </tr>
280
281 <?php
282 /**
283 * Add fields columns that are going to be exported when exporting donations
284 *
285 * @since 2.1
286 */
287 do_action( 'give_export_donation_fields' );
288 ?>
289
290 <tr class="end">
291 <td>
292 </td>
293 <td>
294 <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?>
295 <input type="hidden" name="give-export-class" value="Give_Export_Donations_CSV"/>
296 <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">
297 <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="give-export-donation-button button button-primary">
298 <div class="add-notices"></div>
299 </td>
300 </tr>
301 </tbody>
302 </table>
303 </section>
304 <?php
305 }
306
307 /**
308 * Render donations export page
309 *
310 * @since 2.1
311 */
312 public function render_page() {
313 /**
314 * Fires before displaying the export div tools.
315 *
316 * @since 2.1
317 */
318 do_action( 'give_tools_export_donations_main_before' );
319 ?>
320 <div id="poststuff" class="give-clearfix">
321 <div class="postbox">
322 <h1 class="give-export-h1" align="center"><?php _e( 'Export Donations', 'give' ); ?></h1>
323 <div class="inside give-tools-setting-page-export give-export_donations">
324 <?php
325 /**
326 * Fires before from start.
327 *
328 * @since 2.1
329 */
330 do_action( 'give_tools_export_donations_form_before_start' );
331 ?>
332 <form method="post"
333 id="give-export_donations-form"
334 class="give-export-form tools-setting-page-export tools-setting-page-export"
335 enctype="multipart/form-data">
336
337 <?php
338 /**
339 * Fires just after form start.
340 *
341 * @since 2.1
342 */
343 do_action( 'give_tools_export_donations_form_start' );
344 ?>
345
346 <?php
347 /**
348 * Fires just after before form end.
349 *
350 * @since 2.1
351 */
352 do_action( 'give_tools_export_donations_form_end' );
353 ?>
354 </form>
355 <?php
356 /**
357 * Fires just after form end.
358 *
359 * @since 2.1
360 */
361 do_action( 'give_tools_export_donations_form_after_end' );
362 ?>
363 </div><!-- .inside -->
364 </div><!-- .postbox -->
365 </div><!-- #poststuff -->
366 <?php
367 /**
368 * Fires after displaying the export div tools.
369 *
370 * @since 2.1
371 */
372 do_action( 'give_tools_export_donations_main_after' );
373 }
374
375 /**
376 * Get if current page export donations page or not
377 *
378 * @since 2.1
379 *
380 * @return bool
381 */
382 private function is_donations_export_page() {
383 return 'export' === give_get_current_setting_tab() && isset( $_GET['type'] ) && $this->exporter_type === give_clean( $_GET['type'] );
384 }
385 }
386
387 Give_Export_Donations::get_instance()->setup();
388 }
389