← All changes
|
includes/admin/views/donations-page/export-form.php
+35
-28
1.7.0.12
→
1.8.13
View file →
| @@ -1,5 +1,11 @@ | ||
| 1 | 1 | <?php |
| 2 | + | |
| 3 | +// Exit if accessed directly. | |
| 4 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 5 | + exit; | |
| 6 | +} | |
| 7 | + | |
| 2 | 8 | /** |
| 3 | 9 | * Display the export button in the donation filters box. |
| 4 | 10 | * |
| 5 | 11 | * @author WP Charitable LLC |
| @@ -5,8 +11,9 @@ | ||
| 5 | 11 | * @author WP Charitable LLC |
| 6 | 12 | * @package Charitable/Admin View/Donations Page |
| 7 | 13 | * @since 1.0.0 |
| 8 | 14 | * @version 1.6.39 |
| 15 | + * @version 1.8.8.6 | |
| 9 | 16 | */ |
| 10 | 17 | |
| 11 | 18 | /** |
| 12 | 19 | * Filter the class to use for the modal window. |
| @@ -14,16 +21,16 @@ | ||
| 14 | 21 | * @since 1.0.0 |
| 15 | 22 | * |
| 16 | 23 | * @param string $class The class name. |
| 17 | 24 | */ |
| 18 | -$modal_class = apply_filters( 'charitable_modal_window_class', 'charitable-modal' ); | |
| 25 | +$charitable_modal_class = apply_filters( 'charitable_modal_window_class', 'charitable-modal' ); | |
| 19 | 26 | |
| 20 | -$start_date = isset( $_GET['start_date'] ) ? charitable_sanitize_date_export_format( $_GET['start_date'] ) : null; | |
| 21 | -$end_date = isset( $_GET['end_date'] ) ? charitable_sanitize_date_export_format( $_GET['end_date'] ) : null; | |
| 22 | -$post_status = isset( $_GET['post_status'] ) ? esc_html( $_GET['post_status'] ) : 'all'; | |
| 23 | -$report_type = isset( $_GET['report_type'] ) ? esc_html( $_GET['report_type'] ) : 'donations'; | |
| 27 | +$charitable_start_date = isset( $_GET['start_date'] ) ? charitable_sanitize_date_export_format( $_GET['start_date'] ) : null; // phpcs:ignore | |
| 28 | +$charitable_end_date = isset( $_GET['end_date'] ) ? charitable_sanitize_date_export_format( $_GET['end_date'] ) : null; // phpcs:ignore | |
| 29 | +$charitable_post_status = isset( $_GET['post_status'] ) ? esc_html( $_GET['post_status'] ) : 'all'; // phpcs:ignore | |
| 30 | +$charitable_report_type = isset( $_GET['report_type'] ) ? esc_html( $_GET['report_type'] ) : 'donations'; // phpcs:ignore | |
| 24 | 31 | |
| 25 | -$campaigns = get_posts( | |
| 32 | +$charitable_campaigns = get_posts( | |
| 26 | 33 | array( |
| 27 | 34 | 'post_type' => 'campaign', |
| 28 | 35 | 'post_status' => array( 'draft', 'pending', 'private', 'publish' ), |
| 29 | 36 | 'perm' => 'readable', |
| @@ -37,9 +44,9 @@ | ||
| 37 | 44 | * @since 1.6.0 |
| 38 | 45 | * |
| 39 | 46 | * @param array $types Types of reports. |
| 40 | 47 | */ |
| 41 | -$report_types = apply_filters( | |
| 48 | +$charitable_report_types = apply_filters( | |
| 42 | 49 | 'charitable_donation_export_report_types', |
| 43 | 50 | array( |
| 44 | 51 | 'donations' => __( 'Donations', 'charitable' ), |
| 45 | 52 | ) |
| @@ -44,45 +51,45 @@ | ||
| 44 | 51 | 'donations' => __( 'Donations', 'charitable' ), |
| 45 | 52 | ) |
| 46 | 53 | ); |
| 47 | 54 | ?> |
| 48 | -<div id="charitable-donations-export-modal" style="display: none;" class="charitable-donations-modal <?php echo esc_attr( $modal_class ); ?>" tabindex="0"> | |
| 55 | +<div id="charitable-donations-export-modal" style="display: none;" class="charitable-donations-modal <?php echo esc_attr( $charitable_modal_class ); ?>" tabindex="0"> | |
| 49 | 56 | <a class="modal-close"></a> |
| 50 | - <h3><?php _e( 'Export Donations', 'charitable' ); ?></h3> | |
| 51 | - <form class="charitable-donations-modal-form charitable-modal-form" method="get" action="<?php echo admin_url( 'admin.php' ); ?>"> | |
| 57 | + <h3><?php esc_html_e( 'Export Donations', 'charitable' ); ?></h3> | |
| 58 | + <form class="charitable-donations-modal-form charitable-modal-form" method="get" action="<?php echo esc_url( admin_url( 'admin.php' ) ); ?>"> | |
| 52 | 59 | <?php wp_nonce_field( 'charitable_export_donations', '_charitable_export_nonce' ); ?> |
| 53 | 60 | <input type="hidden" name="charitable_action" value="export_donations" /> |
| 54 | 61 | <input type="hidden" name="page" value="charitable-donations-table" /> |
| 55 | 62 | <fieldset> |
| 56 | - <legend><?php _e( 'Filter by Date', 'charitable' ); ?></legend> | |
| 57 | - <input type="text" id="charitable-export-start_date" name="start_date" class="charitable-datepicker" autocomplete="off" value="<?php echo $start_date; ?>" placeholder="<?php esc_attr_e( 'From:', 'charitable' ); ?>" /> | |
| 58 | - <input type="text" id="charitable-export-end_date" name="end_date" class="charitable-datepicker" autocomplete="off" value="<?php echo $end_date; ?>" placeholder="<?php esc_attr_e( 'To:', 'charitable' ); ?>" /> | |
| 63 | + <legend><?php esc_html_e( 'Filter by Date', 'charitable' ); ?></legend> | |
| 64 | + <input type="text" id="charitable-export-start_date" name="start_date" class="charitable-datepicker" autocomplete="off" value="<?php echo esc_attr( $charitable_start_date ); ?>" placeholder="<?php esc_attr_e( 'From:', 'charitable' ); ?>" /> | |
| 65 | + <input type="text" id="charitable-export-end_date" name="end_date" class="charitable-datepicker" autocomplete="off" value="<?php echo esc_attr( $charitable_end_date ); ?>" placeholder="<?php esc_attr_e( 'To:', 'charitable' ); ?>" /> | |
| 59 | 66 | </fieldset> |
| 60 | - <label for="charitable-donations-export-status"><?php _e( 'Filter by Status', 'charitable' ); ?></label> | |
| 61 | - <select id="charitable-donations-export-status" name="post_status"> | |
| 62 | - <option value="all" <?php selected( $post_status, 'all' ); ?>><?php _e( 'All', 'charitable' ); ?></option> | |
| 63 | - <?php foreach ( charitable_get_valid_donation_statuses() as $key => $status ) : ?> | |
| 64 | - <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $post_status, $key ); ?>><?php echo $status; ?></option> | |
| 67 | + <label for="charitable-donations-export-status"><?php esc_html_e( 'Filter by Status', 'charitable' ); ?></label> | |
| 68 | + <select id="charitable-donations-export-status" name="status"> | |
| 69 | + <option value="all" <?php selected( $charitable_post_status, 'all' ); ?>><?php esc_html_e( 'All', 'charitable' ); ?></option> | |
| 70 | + <?php foreach ( charitable_get_valid_donation_statuses() as $charitable_key => $status ) : // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited ?> | |
| 71 | + <option value="<?php echo esc_attr( $charitable_key ); ?>" <?php selected( $charitable_post_status, $charitable_key ); ?>><?php echo esc_html( $status ); ?></option> | |
| 65 | 72 | <?php endforeach ?> |
| 66 | 73 | </select> |
| 67 | - <label for="charitable-donations-export-campaign"><?php _e( 'Filter by Campaign', 'charitable' ); ?></label> | |
| 74 | + <label for="charitable-donations-export-campaign"><?php esc_html_e( 'Filter by Campaign', 'charitable' ); ?></label> | |
| 68 | 75 | <select id="charitable-donations-export-campaign" name="campaign_id"> |
| 69 | - <option value="all"><?php _e( 'All Campaigns', 'charitable' ); ?></option> | |
| 76 | + <option value="all"><?php esc_html_e( 'All Campaigns', 'charitable' ); ?></option> | |
| 70 | 77 | <?php |
| 71 | - foreach ( $campaigns as $campaign ) : | |
| 78 | + foreach ( $charitable_campaigns as $charitable_campaign ) : | |
| 72 | 79 | ?> |
| 73 | - <option value="<?php echo $campaign->ID; ?>"><?php echo get_the_title( $campaign->ID ); ?></option> | |
| 80 | + <option value="<?php echo esc_attr( $charitable_campaign->ID ); ?>"><?php echo esc_html( get_the_title( $charitable_campaign->ID ) ); ?></option> | |
| 74 | 81 | <?php endforeach ?> |
| 75 | 82 | </select> |
| 76 | - <?php if ( count( $report_types ) > 1 ) : ?> | |
| 77 | - <label for="charitable-donations-export-report-type"><?php _e( 'Type of Report', 'charitable' ); ?></label> | |
| 83 | + <?php if ( count( $charitable_report_types ) > 1 ) : ?> | |
| 84 | + <label for="charitable-donations-export-report-type"><?php esc_html_e( 'Type of Report', 'charitable' ); ?></label> | |
| 78 | 85 | <select id="charitable-donations-export-report-type" name="report_type"> |
| 79 | - <?php foreach ( $report_types as $key => $report_label ) : ?> | |
| 80 | - <option value="<?php echo esc_attr( $key ); ?>"><?php echo $report_label; ?></option> | |
| 86 | + <?php foreach ( $charitable_report_types as $charitable_key => $charitable_report_label ) : ?> | |
| 87 | + <option value="<?php echo esc_attr( $charitable_key ); ?>"><?php echo esc_html( $charitable_report_label ); ?></option> | |
| 81 | 88 | <?php endforeach; ?> |
| 82 | 89 | </select> |
| 83 | 90 | <?php else : ?> |
| 84 | - <input type="hidden" name="report_type" value="<?php echo esc_attr( key( $report_types ) ); ?>" /> | |
| 91 | + <input type="hidden" name="report_type" value="<?php echo esc_attr( key( $charitable_report_types ) ); ?>" /> | |
| 85 | 92 | <?php endif ?> |
| 86 | 93 | <?php |
| 87 | 94 | /** |
| 88 | 95 | * Add additional fields to the end of the donations export form. |
| @@ -90,7 +97,7 @@ | ||
| 90 | 97 | * @since 1.4.0 |
| 91 | 98 | */ |
| 92 | 99 | do_action( 'charitable_export_donations_form' ); |
| 93 | 100 | ?> |
| 94 | - <button name="charitable-export-donations" class="button button-primary"><?php _e( 'Export', 'charitable' ); ?></button> | |
| 101 | + <button name="charitable-export-donations" class="button button-primary"><?php esc_html_e( 'Export', 'charitable' ); ?></button> | |
| 95 | 102 | </form> |
| 96 | 103 | </div> |