@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_payment_history_page() { |
27 | 27 | |
28 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
28 | + $give_payment = get_post_type_object('give_payment'); |
|
29 | 29 | |
30 | - if ( isset( $_GET['view'] ) && 'view-payment-details' == $_GET['view'] ) { |
|
31 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/view-payment-details.php'; |
|
30 | + if (isset($_GET['view']) && 'view-payment-details' == $_GET['view']) { |
|
31 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/view-payment-details.php'; |
|
32 | 32 | } else { |
33 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/class-payments-table.php'; |
|
33 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/class-payments-table.php'; |
|
34 | 34 | $payments_table = new Give_Payment_History_Table(); |
35 | 35 | $payments_table->prepare_items(); |
36 | 36 | ?> |
@@ -44,18 +44,18 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @since 1.7 |
46 | 46 | */ |
47 | - do_action( 'give_payments_page_top' ); |
|
47 | + do_action('give_payments_page_top'); |
|
48 | 48 | ?> |
49 | 49 | <hr class="wp-header-end"> |
50 | 50 | |
51 | - <form id="give-payments-advanced-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"> |
|
51 | + <form id="give-payments-advanced-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"> |
|
52 | 52 | <input type="hidden" name="post_type" value="give_forms" /> |
53 | 53 | <input type="hidden" name="page" value="give-payment-history" /> |
54 | 54 | <?php $payments_table->views() ?> |
55 | 55 | <?php $payments_table->advanced_filters(); ?> |
56 | 56 | </form> |
57 | 57 | |
58 | - <form id="give-payments-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"> |
|
58 | + <form id="give-payments-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"> |
|
59 | 59 | <input type="hidden" name="post_type" value="give_forms" /> |
60 | 60 | <input type="hidden" name="page" value="give-payment-history" /> |
61 | 61 | <?php $payments_table->display() ?> |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @since 1.7 |
69 | 69 | */ |
70 | - do_action( 'give_payments_page_bottom' ); |
|
70 | + do_action('give_payments_page_bottom'); |
|
71 | 71 | ?> |
72 | 72 | |
73 | 73 | </div> |
@@ -84,29 +84,29 @@ discard block |
||
84 | 84 | * @param $title |
85 | 85 | * @return string |
86 | 86 | */ |
87 | -function give_view_order_details_title( $admin_title, $title ) { |
|
87 | +function give_view_order_details_title($admin_title, $title) { |
|
88 | 88 | |
89 | - if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) { |
|
89 | + if ('give_forms_page_give-payment-history' != get_current_screen()->base) { |
|
90 | 90 | return $admin_title; |
91 | 91 | } |
92 | 92 | |
93 | - if( ! isset( $_GET['give-action'] ) ) { |
|
93 | + if ( ! isset($_GET['give-action'])) { |
|
94 | 94 | return $admin_title; |
95 | 95 | } |
96 | 96 | |
97 | - switch( $_GET['give-action'] ) : |
|
97 | + switch ($_GET['give-action']) : |
|
98 | 98 | |
99 | 99 | case 'view-payment-details' : |
100 | 100 | $title = sprintf( |
101 | 101 | /* translators: %s: admin title */ |
102 | - esc_html__( 'View Donation Details - %s', 'give' ), |
|
102 | + esc_html__('View Donation Details - %s', 'give'), |
|
103 | 103 | $admin_title |
104 | 104 | ); |
105 | 105 | break; |
106 | 106 | case 'edit-payment' : |
107 | 107 | $title = sprintf( |
108 | 108 | /* translators: %s: admin title */ |
109 | - esc_html__( 'Edit Donation - %s', 'give' ), |
|
109 | + esc_html__('Edit Donation - %s', 'give'), |
|
110 | 110 | $admin_title |
111 | 111 | ); |
112 | 112 | break; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | return $title; |
119 | 119 | } |
120 | -add_filter( 'admin_title', 'give_view_order_details_title', 10, 2 ); |
|
120 | +add_filter('admin_title', 'give_view_order_details_title', 10, 2); |
|
121 | 121 | |
122 | 122 | /** |
123 | 123 | * Intercept default Edit post links for Give payments and rewrite them to the View Order Details screen. |
@@ -129,20 +129,20 @@ discard block |
||
129 | 129 | * @param $context |
130 | 130 | * @return string |
131 | 131 | */ |
132 | -function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) { |
|
132 | +function give_override_edit_post_for_payment_link($url, $post_id = 0, $context) { |
|
133 | 133 | |
134 | - $post = get_post( $post_id ); |
|
134 | + $post = get_post($post_id); |
|
135 | 135 | |
136 | - if( ! $post ) { |
|
136 | + if ( ! $post) { |
|
137 | 137 | return $url; |
138 | 138 | } |
139 | 139 | |
140 | - if( 'give_payment' != $post->post_type ) { |
|
140 | + if ('give_payment' != $post->post_type) { |
|
141 | 141 | return $url; |
142 | 142 | } |
143 | 143 | |
144 | - $url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $post_id ); |
|
144 | + $url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$post_id); |
|
145 | 145 | |
146 | 146 | return $url; |
147 | 147 | } |
148 | -add_filter( 'get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3 ); |
|
148 | +add_filter('get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3); |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded. |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -134,15 +134,15 @@ discard block |
||
134 | 134 | public function __construct() { |
135 | 135 | |
136 | 136 | // Set parent defaults. |
137 | - parent::__construct( array( |
|
138 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
139 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
140 | - 'ajax' => false, // Does this table support ajax? |
|
141 | - ) ); |
|
137 | + parent::__construct(array( |
|
138 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
139 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
140 | + 'ajax' => false, // Does this table support ajax? |
|
141 | + )); |
|
142 | 142 | |
143 | 143 | $this->process_bulk_action(); |
144 | 144 | $this->get_payment_counts(); |
145 | - $this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
145 | + $this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -151,55 +151,55 @@ discard block |
||
151 | 151 | * @return void |
152 | 152 | */ |
153 | 153 | public function advanced_filters() { |
154 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
155 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null; |
|
156 | - $status = isset( $_GET['status'] ) ? sanitize_text_field( $_GET['status'] ) : ''; |
|
157 | - $donor = isset( $_GET['donor'] ) ? sanitize_text_field( $_GET['donor'] ) : ''; |
|
158 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : ''; |
|
159 | - $form_id = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0; |
|
154 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
155 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null; |
|
156 | + $status = isset($_GET['status']) ? sanitize_text_field($_GET['status']) : ''; |
|
157 | + $donor = isset($_GET['donor']) ? sanitize_text_field($_GET['donor']) : ''; |
|
158 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : ''; |
|
159 | + $form_id = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : 0; |
|
160 | 160 | ?> |
161 | 161 | <div id="give-payment-filters" class="give-filters"> |
162 | - <?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?> |
|
162 | + <?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?> |
|
163 | 163 | <div id="give-payment-date-filters"> |
164 | 164 | <div class="give-filter give-filter-half"> |
165 | 165 | <label for="start-date" |
166 | - class="give-start-date-label"><?php esc_html_e( 'Start Date', 'give' ); ?></label> |
|
166 | + class="give-start-date-label"><?php esc_html_e('Start Date', 'give'); ?></label> |
|
167 | 167 | <input type="text" id="start-date" name="start-date" class="give_datepicker" |
168 | 168 | value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy" /> |
169 | 169 | </div> |
170 | 170 | <div class="give-filter give-filter-half"> |
171 | - <label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date', 'give' ); ?></label> |
|
171 | + <label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date', 'give'); ?></label> |
|
172 | 172 | <input type="text" id="end-date" name="end-date" class="give_datepicker" |
173 | 173 | value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy" /> |
174 | 174 | </div> |
175 | 175 | </div> |
176 | 176 | <div id="give-payment-form-filter" class="give-filter"> |
177 | 177 | <label for="give-donation-forms-filter" |
178 | - class="give-donation-forms-filter-label"><?php esc_html_e( 'Form', 'give' ); ?></label> |
|
178 | + class="give-donation-forms-filter-label"><?php esc_html_e('Form', 'give'); ?></label> |
|
179 | 179 | <?php |
180 | 180 | // Filter Donations by Donation Forms. |
181 | - echo Give()->html->forms_dropdown( array( |
|
181 | + echo Give()->html->forms_dropdown(array( |
|
182 | 182 | 'name' => 'form_id', |
183 | 183 | 'id' => 'give-donation-forms-filter', |
184 | 184 | 'class' => 'give-donation-forms-filter', |
185 | 185 | 'selected' => $form_id, // Make sure to have $form_id set to 0, if there is no selection. |
186 | 186 | 'chosen' => true, |
187 | - 'number' => - 1, |
|
188 | - ) ); |
|
187 | + 'number' => -1, |
|
188 | + )); |
|
189 | 189 | ?> |
190 | 190 | </div> |
191 | 191 | |
192 | - <?php if ( ! empty( $status ) ) : ?> |
|
193 | - <input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>" /> |
|
192 | + <?php if ( ! empty($status)) : ?> |
|
193 | + <input type="hidden" name="status" value="<?php echo esc_attr($status); ?>" /> |
|
194 | 194 | <?php endif; ?> |
195 | 195 | |
196 | 196 | <div class="give-filter"> |
197 | - <?php submit_button( __( 'Apply', 'give' ), 'secondary', '', false ); ?> |
|
197 | + <?php submit_button(__('Apply', 'give'), 'secondary', '', false); ?> |
|
198 | 198 | <?php |
199 | 199 | // Clear active filters button. |
200 | - if ( ! empty( $start_date ) || ! empty( $end_date ) || ! empty( $donor ) || ! empty( $search ) || ! empty( $status ) || ! empty( $form_id ) ) : ?> |
|
201 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" |
|
202 | - class="button give-clear-filters-button"><?php esc_html_e( 'Clear Filters', 'give' ); ?></a> |
|
200 | + if ( ! empty($start_date) || ! empty($end_date) || ! empty($donor) || ! empty($search) || ! empty($status) || ! empty($form_id)) : ?> |
|
201 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" |
|
202 | + class="button give-clear-filters-button"><?php esc_html_e('Clear Filters', 'give'); ?></a> |
|
203 | 203 | <?php endif; ?> |
204 | 204 | </div> |
205 | 205 | </div> |
@@ -218,18 +218,18 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @return void |
220 | 220 | */ |
221 | - public function search_box( $text, $input_id ) { |
|
222 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
221 | + public function search_box($text, $input_id) { |
|
222 | + if (empty($_REQUEST['s']) && ! $this->has_items()) { |
|
223 | 223 | return; |
224 | 224 | } |
225 | 225 | |
226 | - $input_id = $input_id . '-search-input'; |
|
226 | + $input_id = $input_id.'-search-input'; |
|
227 | 227 | |
228 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
229 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
228 | + if ( ! empty($_REQUEST['orderby'])) { |
|
229 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
230 | 230 | } |
231 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
232 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
231 | + if ( ! empty($_REQUEST['order'])) { |
|
232 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
233 | 233 | } |
234 | 234 | ?> |
235 | 235 | <div class="give-filter give-filter-search" role="search"> |
@@ -241,13 +241,13 @@ discard block |
||
241 | 241 | * |
242 | 242 | * @since 1.7 |
243 | 243 | */ |
244 | - do_action( 'give_payment_history_search' ); |
|
244 | + do_action('give_payment_history_search'); |
|
245 | 245 | ?> |
246 | 246 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
247 | 247 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
248 | - <?php submit_button( $text, 'button', false, false, array( |
|
248 | + <?php submit_button($text, 'button', false, false, array( |
|
249 | 249 | 'ID' => 'search-submit', |
250 | - ) ); ?><br /> |
|
250 | + )); ?><br /> |
|
251 | 251 | </div> |
252 | 252 | <?php |
253 | 253 | } |
@@ -261,52 +261,52 @@ discard block |
||
261 | 261 | */ |
262 | 262 | public function get_views() { |
263 | 263 | |
264 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
264 | + $current = isset($_GET['status']) ? $_GET['status'] : ''; |
|
265 | 265 | $views = array(); |
266 | 266 | $tabs = array( |
267 | 267 | 'all' => array( |
268 | 268 | 'total_count', |
269 | - esc_html__( 'All', 'give' ), |
|
269 | + esc_html__('All', 'give'), |
|
270 | 270 | ), |
271 | 271 | 'publish' => array( |
272 | 272 | 'complete_count', |
273 | - esc_html__( 'Completed', 'give' ), |
|
273 | + esc_html__('Completed', 'give'), |
|
274 | 274 | ), |
275 | 275 | 'pending' => array( |
276 | 276 | 'pending_count', |
277 | - esc_html__( 'Pending', 'give' ), |
|
277 | + esc_html__('Pending', 'give'), |
|
278 | 278 | ), |
279 | 279 | 'processing' => array( |
280 | 280 | 'processing_count', |
281 | - esc_html__( 'Processing', 'give' ), |
|
281 | + esc_html__('Processing', 'give'), |
|
282 | 282 | ), |
283 | 283 | 'refunded' => array( |
284 | 284 | 'refunded_count', |
285 | - esc_html__( 'Refunded', 'give' ), |
|
285 | + esc_html__('Refunded', 'give'), |
|
286 | 286 | ), |
287 | 287 | 'revoked' => array( |
288 | 288 | 'revoked_count', |
289 | - esc_html__( 'Revoked', 'give' ), |
|
289 | + esc_html__('Revoked', 'give'), |
|
290 | 290 | ), |
291 | 291 | 'failed' => array( |
292 | 292 | 'failed_count', |
293 | - esc_html__( 'Failed', 'give' ), |
|
293 | + esc_html__('Failed', 'give'), |
|
294 | 294 | ), |
295 | 295 | 'cancelled' => array( |
296 | 296 | 'cancelled_count', |
297 | - esc_html__( 'Cancelled', 'give' ), |
|
297 | + esc_html__('Cancelled', 'give'), |
|
298 | 298 | ), |
299 | 299 | 'abandoned' => array( |
300 | 300 | 'abandoned_count', |
301 | - esc_html__( 'Abandoned', 'give' ), |
|
301 | + esc_html__('Abandoned', 'give'), |
|
302 | 302 | ), |
303 | 303 | 'preapproval' => array( |
304 | 304 | 'preapproval_count', |
305 | - esc_html__( 'Preapproval Pending', 'give' ), |
|
305 | + esc_html__('Preapproval Pending', 'give'), |
|
306 | 306 | ), |
307 | 307 | ); |
308 | 308 | |
309 | - foreach ( $tabs as $key => $tab ) { |
|
309 | + foreach ($tabs as $key => $tab) { |
|
310 | 310 | $count_key = $tab[0]; |
311 | 311 | $name = $tab[1]; |
312 | 312 | $count = $this->$count_key; |
@@ -321,19 +321,19 @@ discard block |
||
321 | 321 | * @param string $key Current view tab value. |
322 | 322 | * @param int $count Number of donation inside the tab. |
323 | 323 | */ |
324 | - if ( 'all' === $key || $key === $current || apply_filters( 'give_payments_table_show_all_status', 0 < $count, $key, $count ) ) { |
|
324 | + if ('all' === $key || $key === $current || apply_filters('give_payments_table_show_all_status', 0 < $count, $key, $count)) { |
|
325 | 325 | |
326 | - $views[ $key ] = sprintf( |
|
326 | + $views[$key] = sprintf( |
|
327 | 327 | '<a href="%s" %s >%s <span class="count">(%s)</span></a>', |
328 | - esc_url( ( 'all' === (string) $key ) ? remove_query_arg( array( 'status', 'paged' ) ) : add_query_arg( array( 'status' => $key, 'paged' => false ), admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ) ) ), |
|
329 | - ( ( 'all' === $key && empty( $current ) ) ) ? 'class="current"' : ( $current == $key ) ? 'class="current"' : '', |
|
328 | + esc_url(('all' === (string) $key) ? remove_query_arg(array('status', 'paged')) : add_query_arg(array('status' => $key, 'paged' => false), admin_url('edit.php?post_type=give_forms&page=give-payment-history'))), |
|
329 | + (('all' === $key && empty($current))) ? 'class="current"' : ($current == $key) ? 'class="current"' : '', |
|
330 | 330 | $name, |
331 | 331 | $count |
332 | 332 | ); |
333 | 333 | } |
334 | 334 | } |
335 | 335 | |
336 | - return apply_filters( 'give_payments_table_views', $views ); |
|
336 | + return apply_filters('give_payments_table_views', $views); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | /** |
@@ -346,15 +346,15 @@ discard block |
||
346 | 346 | public function get_columns() { |
347 | 347 | $columns = array( |
348 | 348 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text. |
349 | - 'donation' => esc_html__( 'Donation', 'give' ), |
|
350 | - 'donation_form' => esc_html__( 'Donation Form', 'give' ), |
|
351 | - 'status' => esc_html__( 'Status', 'give' ), |
|
352 | - 'date' => esc_html__( 'Date', 'give' ), |
|
353 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
354 | - 'details' => esc_html__( 'Details', 'give' ), |
|
349 | + 'donation' => esc_html__('Donation', 'give'), |
|
350 | + 'donation_form' => esc_html__('Donation Form', 'give'), |
|
351 | + 'status' => esc_html__('Status', 'give'), |
|
352 | + 'date' => esc_html__('Date', 'give'), |
|
353 | + 'amount' => esc_html__('Amount', 'give'), |
|
354 | + 'details' => esc_html__('Details', 'give'), |
|
355 | 355 | ); |
356 | 356 | |
357 | - return apply_filters( 'give_payments_table_columns', $columns ); |
|
357 | + return apply_filters('give_payments_table_columns', $columns); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | /** |
@@ -366,14 +366,14 @@ discard block |
||
366 | 366 | */ |
367 | 367 | public function get_sortable_columns() { |
368 | 368 | $columns = array( |
369 | - 'donation' => array( 'ID', true ), |
|
370 | - 'donation_form' => array( 'donation_form', false ), |
|
371 | - 'status' => array( 'status', false ), |
|
372 | - 'amount' => array( 'amount', false ), |
|
373 | - 'date' => array( 'date', false ), |
|
369 | + 'donation' => array('ID', true), |
|
370 | + 'donation_form' => array('donation_form', false), |
|
371 | + 'status' => array('status', false), |
|
372 | + 'amount' => array('amount', false), |
|
373 | + 'date' => array('date', false), |
|
374 | 374 | ); |
375 | 375 | |
376 | - return apply_filters( 'give_payments_table_sortable_columns', $columns ); |
|
376 | + return apply_filters('give_payments_table_sortable_columns', $columns); |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | /** |
@@ -399,55 +399,55 @@ discard block |
||
399 | 399 | * |
400 | 400 | * @return string Column Name |
401 | 401 | */ |
402 | - public function column_default( $payment, $column_name ) { |
|
402 | + public function column_default($payment, $column_name) { |
|
403 | 403 | |
404 | - $single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details' ) ) ); |
|
405 | - $row_actions = $this->get_row_actions( $payment ); |
|
404 | + $single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details'))); |
|
405 | + $row_actions = $this->get_row_actions($payment); |
|
406 | 406 | |
407 | - switch ( $column_name ) { |
|
407 | + switch ($column_name) { |
|
408 | 408 | case 'donation' : |
409 | - $value = sprintf( '<a href="%1$s" data-tooltip="%2$s">#%3$s</a> %4$s %5$s<br>', $single_donation_url, sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ), $payment->ID, esc_html__( 'by', 'give' ), $this->get_donor( $payment ) ); |
|
410 | - $value .= $this->get_donor_email( $payment ); |
|
411 | - $value .= $this->row_actions( $row_actions ); |
|
409 | + $value = sprintf('<a href="%1$s" data-tooltip="%2$s">#%3$s</a> %4$s %5$s<br>', $single_donation_url, sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID), $payment->ID, esc_html__('by', 'give'), $this->get_donor($payment)); |
|
410 | + $value .= $this->get_donor_email($payment); |
|
411 | + $value .= $this->row_actions($row_actions); |
|
412 | 412 | break; |
413 | 413 | |
414 | 414 | case 'amount' : |
415 | - $amount = ! empty( $payment->total ) ? $payment->total : 0; |
|
416 | - $value = give_currency_filter( give_format_amount( $amount, array( 'sanitize' => false ) ), give_get_payment_currency_code( $payment->ID ) ); |
|
417 | - $value .= sprintf( '<br><small>%1$s %2$s</small>', __( 'via', 'give' ), give_get_gateway_admin_label( $payment->gateway ) ); |
|
415 | + $amount = ! empty($payment->total) ? $payment->total : 0; |
|
416 | + $value = give_currency_filter(give_format_amount($amount, array('sanitize' => false)), give_get_payment_currency_code($payment->ID)); |
|
417 | + $value .= sprintf('<br><small>%1$s %2$s</small>', __('via', 'give'), give_get_gateway_admin_label($payment->gateway)); |
|
418 | 418 | break; |
419 | 419 | |
420 | 420 | case 'donation_form' : |
421 | - $form_title = empty( $payment->form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $payment->form_id ) : $payment->form_title; |
|
422 | - $value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $form_title . '</a>'; |
|
423 | - $level = give_get_payment_form_title( $payment->meta, true ); |
|
421 | + $form_title = empty($payment->form_title) ? sprintf(__('Untitled (#%s)', 'give'), $payment->form_id) : $payment->form_title; |
|
422 | + $value = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$form_title.'</a>'; |
|
423 | + $level = give_get_payment_form_title($payment->meta, true); |
|
424 | 424 | |
425 | - if ( ! empty( $level ) ) { |
|
425 | + if ( ! empty($level)) { |
|
426 | 426 | $value .= $level; |
427 | 427 | } |
428 | 428 | |
429 | 429 | break; |
430 | 430 | |
431 | 431 | case 'date' : |
432 | - $date = strtotime( $payment->date ); |
|
433 | - $value = date_i18n( give_date_format(), $date ); |
|
432 | + $date = strtotime($payment->date); |
|
433 | + $value = date_i18n(give_date_format(), $date); |
|
434 | 434 | break; |
435 | 435 | |
436 | 436 | case 'status' : |
437 | - $value = $this->get_payment_status( $payment ); |
|
437 | + $value = $this->get_payment_status($payment); |
|
438 | 438 | break; |
439 | 439 | |
440 | 440 | case 'details' : |
441 | - $value = sprintf( '<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', $single_donation_url, sprintf( esc_attr__( 'View Donation #%s', 'give' ), $payment->ID ) ); |
|
441 | + $value = sprintf('<div class="give-payment-details-link-wrap"><a href="%1$s" class="give-payment-details-link button button-small" data-tooltip="%2$s" aria-label="%2$s"><span class="dashicons dashicons-visibility"></span></a></div>', $single_donation_url, sprintf(esc_attr__('View Donation #%s', 'give'), $payment->ID)); |
|
442 | 442 | break; |
443 | 443 | |
444 | 444 | default: |
445 | - $value = isset( $payment->$column_name ) ? $payment->$column_name : ''; |
|
445 | + $value = isset($payment->$column_name) ? $payment->$column_name : ''; |
|
446 | 446 | break; |
447 | 447 | |
448 | 448 | }// End switch(). |
449 | 449 | |
450 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name ); |
|
450 | + return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | /** |
@@ -460,17 +460,17 @@ discard block |
||
460 | 460 | * |
461 | 461 | * @return string Data shown in the Email column |
462 | 462 | */ |
463 | - public function get_donor_email( $payment ) { |
|
463 | + public function get_donor_email($payment) { |
|
464 | 464 | |
465 | - $email = give_get_payment_user_email( $payment->ID ); |
|
465 | + $email = give_get_payment_user_email($payment->ID); |
|
466 | 466 | |
467 | - if ( empty( $email ) ) { |
|
468 | - $email = esc_html__( '(unknown)', 'give' ); |
|
467 | + if (empty($email)) { |
|
468 | + $email = esc_html__('(unknown)', 'give'); |
|
469 | 469 | } |
470 | 470 | |
471 | - $value = '<a href="mailto:' . $email . '" data-tooltip="' . esc_attr__( 'Email donor', 'give' ) . '">' . $email . '</a>'; |
|
471 | + $value = '<a href="mailto:'.$email.'" data-tooltip="'.esc_attr__('Email donor', 'give').'">'.$email.'</a>'; |
|
472 | 472 | |
473 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' ); |
|
473 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'email'); |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | /** |
@@ -482,32 +482,32 @@ discard block |
||
482 | 482 | * |
483 | 483 | * @return array $actions |
484 | 484 | */ |
485 | - function get_row_actions( $payment ) { |
|
485 | + function get_row_actions($payment) { |
|
486 | 486 | |
487 | 487 | $actions = array(); |
488 | - $email = give_get_payment_user_email( $payment->ID ); |
|
488 | + $email = give_get_payment_user_email($payment->ID); |
|
489 | 489 | |
490 | 490 | // Add search term string back to base URL. |
491 | - $search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' ); |
|
492 | - if ( ! empty( $search_terms ) ) { |
|
493 | - $this->base_url = add_query_arg( 's', $search_terms, $this->base_url ); |
|
491 | + $search_terms = (isset($_GET['s']) ? trim($_GET['s']) : ''); |
|
492 | + if ( ! empty($search_terms)) { |
|
493 | + $this->base_url = add_query_arg('s', $search_terms, $this->base_url); |
|
494 | 494 | } |
495 | 495 | |
496 | - if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) { |
|
496 | + if (give_is_payment_complete($payment->ID) && ! empty($email)) { |
|
497 | 497 | |
498 | - $actions['email_links'] = sprintf( '<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( add_query_arg( array( |
|
498 | + $actions['email_links'] = sprintf('<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(add_query_arg(array( |
|
499 | 499 | 'give-action' => 'email_links', |
500 | 500 | 'purchase_id' => $payment->ID, |
501 | - ), $this->base_url ), 'give_payment_nonce' ), sprintf( esc_attr__( 'Resend Donation %s Receipt', 'give' ), $payment->ID ), esc_html__( 'Resend Receipt', 'give' ) ); |
|
501 | + ), $this->base_url), 'give_payment_nonce'), sprintf(esc_attr__('Resend Donation %s Receipt', 'give'), $payment->ID), esc_html__('Resend Receipt', 'give')); |
|
502 | 502 | |
503 | 503 | } |
504 | 504 | |
505 | - $actions['delete'] = sprintf( '<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( add_query_arg( array( |
|
505 | + $actions['delete'] = sprintf('<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url(add_query_arg(array( |
|
506 | 506 | 'give-action' => 'delete_payment', |
507 | 507 | 'purchase_id' => $payment->ID, |
508 | - ), $this->base_url ), 'give_donation_nonce' ), sprintf( esc_attr__( 'Delete Donation %s', 'give' ), $payment->ID ), esc_html__( 'Delete', 'give' ) ); |
|
508 | + ), $this->base_url), 'give_donation_nonce'), sprintf(esc_attr__('Delete Donation %s', 'give'), $payment->ID), esc_html__('Delete', 'give')); |
|
509 | 509 | |
510 | - return apply_filters( 'give_payment_row_actions', $actions, $payment ); |
|
510 | + return apply_filters('give_payment_row_actions', $actions, $payment); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | |
@@ -521,14 +521,14 @@ discard block |
||
521 | 521 | * |
522 | 522 | * @return string Data shown in the Email column |
523 | 523 | */ |
524 | - function get_payment_status( $payment ) { |
|
525 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
526 | - if ( $payment->mode == 'test' ) { |
|
527 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was made in test mode.', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>'; |
|
524 | + function get_payment_status($payment) { |
|
525 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
526 | + if ($payment->mode == 'test') { |
|
527 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was made in test mode.', 'give').'">'.esc_html__('Test', 'give').'</span>'; |
|
528 | 528 | } |
529 | 529 | |
530 | - if ( true === $payment->import && true === (bool) apply_filters( 'give_payment_show_importer_label', false ) ) { |
|
531 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This donation was imported.', 'give' ) . '">' . esc_html__( 'Import', 'give' ) . '</span>'; |
|
530 | + if (true === $payment->import && true === (bool) apply_filters('give_payment_show_importer_label', false)) { |
|
531 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This donation was imported.', 'give').'">'.esc_html__('Import', 'give').'</span>'; |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | return $value; |
@@ -544,8 +544,8 @@ discard block |
||
544 | 544 | * |
545 | 545 | * @return string Displays a checkbox. |
546 | 546 | */ |
547 | - public function column_cb( $payment ) { |
|
548 | - return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID ); |
|
547 | + public function column_cb($payment) { |
|
548 | + return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | /** |
@@ -558,8 +558,8 @@ discard block |
||
558 | 558 | * |
559 | 559 | * @return string Displays a checkbox. |
560 | 560 | */ |
561 | - public function get_payment_id( $payment ) { |
|
562 | - return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>'; |
|
561 | + public function get_payment_id($payment) { |
|
562 | + return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>'; |
|
563 | 563 | } |
564 | 564 | |
565 | 565 | /** |
@@ -572,32 +572,32 @@ discard block |
||
572 | 572 | * |
573 | 573 | * @return string Data shown in the User column |
574 | 574 | */ |
575 | - public function get_donor( $payment ) { |
|
575 | + public function get_donor($payment) { |
|
576 | 576 | |
577 | - $donor_id = give_get_payment_donor_id( $payment->ID ); |
|
578 | - $donor_billing_name = give_get_donor_name_by( $payment->ID, 'donation' ); |
|
579 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
577 | + $donor_id = give_get_payment_donor_id($payment->ID); |
|
578 | + $donor_billing_name = give_get_donor_name_by($payment->ID, 'donation'); |
|
579 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
580 | 580 | |
581 | 581 | $value = ''; |
582 | - if ( ! empty( $donor_id ) ) { |
|
582 | + if ( ! empty($donor_id)) { |
|
583 | 583 | |
584 | 584 | // Check whether the donor name and WP_User name is same or not. |
585 | - if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) { |
|
586 | - $value .= $donor_billing_name . ' ('; |
|
585 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
586 | + $value .= $donor_billing_name.' ('; |
|
587 | 587 | } |
588 | 588 | |
589 | - $value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>'; |
|
589 | + $value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>'; |
|
590 | 590 | |
591 | 591 | // Check whether the donor name and WP_User name is same or not. |
592 | - if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) { |
|
592 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
593 | 593 | $value .= ')'; |
594 | 594 | } |
595 | 595 | } else { |
596 | - $email = give_get_payment_user_email( $payment->ID ); |
|
597 | - $value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . esc_html__( '(donor missing)', 'give' ) . '</a>'; |
|
596 | + $email = give_get_payment_user_email($payment->ID); |
|
597 | + $value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.esc_html__('(donor missing)', 'give').'</a>'; |
|
598 | 598 | } |
599 | 599 | |
600 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' ); |
|
600 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor'); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | /** |
@@ -609,20 +609,20 @@ discard block |
||
609 | 609 | */ |
610 | 610 | public function get_bulk_actions() { |
611 | 611 | $actions = array( |
612 | - 'delete' => __( 'Delete', 'give' ), |
|
613 | - 'set-status-publish' => __( 'Set To Completed', 'give' ), |
|
614 | - 'set-status-pending' => __( 'Set To Pending', 'give' ), |
|
615 | - 'set-status-processing' => __( 'Set To Processing', 'give' ), |
|
616 | - 'set-status-refunded' => __( 'Set To Refunded', 'give' ), |
|
617 | - 'set-status-revoked' => __( 'Set To Revoked', 'give' ), |
|
618 | - 'set-status-failed' => __( 'Set To Failed', 'give' ), |
|
619 | - 'set-status-cancelled' => __( 'Set To Cancelled', 'give' ), |
|
620 | - 'set-status-abandoned' => __( 'Set To Abandoned', 'give' ), |
|
621 | - 'set-status-preapproval' => __( 'Set To Preapproval', 'give' ), |
|
622 | - 'resend-receipt' => __( 'Resend Email Receipts', 'give' ), |
|
612 | + 'delete' => __('Delete', 'give'), |
|
613 | + 'set-status-publish' => __('Set To Completed', 'give'), |
|
614 | + 'set-status-pending' => __('Set To Pending', 'give'), |
|
615 | + 'set-status-processing' => __('Set To Processing', 'give'), |
|
616 | + 'set-status-refunded' => __('Set To Refunded', 'give'), |
|
617 | + 'set-status-revoked' => __('Set To Revoked', 'give'), |
|
618 | + 'set-status-failed' => __('Set To Failed', 'give'), |
|
619 | + 'set-status-cancelled' => __('Set To Cancelled', 'give'), |
|
620 | + 'set-status-abandoned' => __('Set To Abandoned', 'give'), |
|
621 | + 'set-status-preapproval' => __('Set To Preapproval', 'give'), |
|
622 | + 'resend-receipt' => __('Resend Email Receipts', 'give'), |
|
623 | 623 | ); |
624 | 624 | |
625 | - return apply_filters( 'give_payments_table_bulk_actions', $actions ); |
|
625 | + return apply_filters('give_payments_table_bulk_actions', $actions); |
|
626 | 626 | } |
627 | 627 | |
628 | 628 | /** |
@@ -633,63 +633,63 @@ discard block |
||
633 | 633 | * @return void |
634 | 634 | */ |
635 | 635 | public function process_bulk_action() { |
636 | - $ids = isset( $_GET['payment'] ) ? $_GET['payment'] : false; |
|
636 | + $ids = isset($_GET['payment']) ? $_GET['payment'] : false; |
|
637 | 637 | $action = $this->current_action(); |
638 | 638 | |
639 | - if ( ! is_array( $ids ) ) { |
|
640 | - $ids = array( $ids ); |
|
639 | + if ( ! is_array($ids)) { |
|
640 | + $ids = array($ids); |
|
641 | 641 | } |
642 | 642 | |
643 | - if ( empty( $action ) ) { |
|
643 | + if (empty($action)) { |
|
644 | 644 | return; |
645 | 645 | } |
646 | 646 | |
647 | - foreach ( $ids as $id ) { |
|
647 | + foreach ($ids as $id) { |
|
648 | 648 | |
649 | 649 | // Detect when a bulk action is being triggered. |
650 | - switch ( $this->current_action() ) { |
|
650 | + switch ($this->current_action()) { |
|
651 | 651 | |
652 | 652 | case'delete': |
653 | - give_delete_donation( $id ); |
|
653 | + give_delete_donation($id); |
|
654 | 654 | break; |
655 | 655 | |
656 | 656 | case 'set-status-publish': |
657 | - give_update_payment_status( $id, 'publish' ); |
|
657 | + give_update_payment_status($id, 'publish'); |
|
658 | 658 | break; |
659 | 659 | |
660 | 660 | case 'set-status-pending': |
661 | - give_update_payment_status( $id, 'pending' ); |
|
661 | + give_update_payment_status($id, 'pending'); |
|
662 | 662 | break; |
663 | 663 | |
664 | 664 | case 'set-status-processing': |
665 | - give_update_payment_status( $id, 'processing' ); |
|
665 | + give_update_payment_status($id, 'processing'); |
|
666 | 666 | break; |
667 | 667 | |
668 | 668 | case 'set-status-refunded': |
669 | - give_update_payment_status( $id, 'refunded' ); |
|
669 | + give_update_payment_status($id, 'refunded'); |
|
670 | 670 | break; |
671 | 671 | case 'set-status-revoked': |
672 | - give_update_payment_status( $id, 'revoked' ); |
|
672 | + give_update_payment_status($id, 'revoked'); |
|
673 | 673 | break; |
674 | 674 | |
675 | 675 | case 'set-status-failed': |
676 | - give_update_payment_status( $id, 'failed' ); |
|
676 | + give_update_payment_status($id, 'failed'); |
|
677 | 677 | break; |
678 | 678 | |
679 | 679 | case 'set-status-cancelled': |
680 | - give_update_payment_status( $id, 'cancelled' ); |
|
680 | + give_update_payment_status($id, 'cancelled'); |
|
681 | 681 | break; |
682 | 682 | |
683 | 683 | case 'set-status-abandoned': |
684 | - give_update_payment_status( $id, 'abandoned' ); |
|
684 | + give_update_payment_status($id, 'abandoned'); |
|
685 | 685 | break; |
686 | 686 | |
687 | 687 | case 'set-status-preapproval': |
688 | - give_update_payment_status( $id, 'preapproval' ); |
|
688 | + give_update_payment_status($id, 'preapproval'); |
|
689 | 689 | break; |
690 | 690 | |
691 | 691 | case 'resend-receipt': |
692 | - give_email_donation_receipt( $id, false ); |
|
692 | + give_email_donation_receipt($id, false); |
|
693 | 693 | break; |
694 | 694 | }// End switch(). |
695 | 695 | |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | * @param int $id The ID of the payment. |
702 | 702 | * @param string $current_action The action that is being triggered. |
703 | 703 | */ |
704 | - do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() ); |
|
704 | + do_action('give_payments_table_do_bulk_action', $id, $this->current_action()); |
|
705 | 705 | }// End foreach(). |
706 | 706 | |
707 | 707 | } |
@@ -717,31 +717,31 @@ discard block |
||
717 | 717 | |
718 | 718 | $args = array(); |
719 | 719 | |
720 | - if ( isset( $_GET['user'] ) ) { |
|
721 | - $args['user'] = urldecode( $_GET['user'] ); |
|
722 | - } elseif ( isset( $_GET['donor'] ) ) { |
|
723 | - $args['donor'] = absint( $_GET['donor'] ); |
|
724 | - } elseif ( isset( $_GET['s'] ) ) { |
|
725 | - $is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false; |
|
726 | - if ( $is_user ) { |
|
727 | - $args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) ); |
|
728 | - unset( $args['s'] ); |
|
720 | + if (isset($_GET['user'])) { |
|
721 | + $args['user'] = urldecode($_GET['user']); |
|
722 | + } elseif (isset($_GET['donor'])) { |
|
723 | + $args['donor'] = absint($_GET['donor']); |
|
724 | + } elseif (isset($_GET['s'])) { |
|
725 | + $is_user = strpos($_GET['s'], strtolower('user:')) !== false; |
|
726 | + if ($is_user) { |
|
727 | + $args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s'])))); |
|
728 | + unset($args['s']); |
|
729 | 729 | } else { |
730 | - $args['s'] = sanitize_text_field( $_GET['s'] ); |
|
730 | + $args['s'] = sanitize_text_field($_GET['s']); |
|
731 | 731 | } |
732 | 732 | } |
733 | 733 | |
734 | - if ( ! empty( $_GET['start-date'] ) ) { |
|
735 | - $args['start-date'] = urldecode( $_GET['start-date'] ); |
|
734 | + if ( ! empty($_GET['start-date'])) { |
|
735 | + $args['start-date'] = urldecode($_GET['start-date']); |
|
736 | 736 | } |
737 | 737 | |
738 | - if ( ! empty( $_GET['end-date'] ) ) { |
|
739 | - $args['end-date'] = urldecode( $_GET['end-date'] ); |
|
738 | + if ( ! empty($_GET['end-date'])) { |
|
739 | + $args['end-date'] = urldecode($_GET['end-date']); |
|
740 | 740 | } |
741 | 741 | |
742 | - $args['form_id'] = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null; |
|
742 | + $args['form_id'] = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null; |
|
743 | 743 | |
744 | - $payment_count = give_count_payments( $args ); |
|
744 | + $payment_count = give_count_payments($args); |
|
745 | 745 | $this->complete_count = $payment_count->publish; |
746 | 746 | $this->pending_count = $payment_count->pending; |
747 | 747 | $this->processing_count = $payment_count->processing; |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | $this->abandoned_count = $payment_count->abandoned; |
753 | 753 | $this->preapproval_count = $payment_count->preapproval; |
754 | 754 | |
755 | - foreach ( $payment_count as $count ) { |
|
755 | + foreach ($payment_count as $count) { |
|
756 | 756 | $this->total_count += $count; |
757 | 757 | } |
758 | 758 | } |
@@ -767,28 +767,28 @@ discard block |
||
767 | 767 | public function payments_data() { |
768 | 768 | |
769 | 769 | $per_page = $this->per_page; |
770 | - $orderby = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID'; |
|
771 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
772 | - $user = isset( $_GET['user'] ) ? $_GET['user'] : null; |
|
773 | - $donor = isset( $_GET['donor'] ) ? $_GET['donor'] : null; |
|
774 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys(); |
|
775 | - $meta_key = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null; |
|
776 | - $year = isset( $_GET['year'] ) ? $_GET['year'] : null; |
|
777 | - $month = isset( $_GET['m'] ) ? $_GET['m'] : null; |
|
778 | - $day = isset( $_GET['day'] ) ? $_GET['day'] : null; |
|
779 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null; |
|
780 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
781 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date; |
|
782 | - $form_id = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null; |
|
783 | - |
|
784 | - if ( ! empty( $search ) ) { |
|
770 | + $orderby = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID'; |
|
771 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
772 | + $user = isset($_GET['user']) ? $_GET['user'] : null; |
|
773 | + $donor = isset($_GET['donor']) ? $_GET['donor'] : null; |
|
774 | + $status = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys(); |
|
775 | + $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; |
|
776 | + $year = isset($_GET['year']) ? $_GET['year'] : null; |
|
777 | + $month = isset($_GET['m']) ? $_GET['m'] : null; |
|
778 | + $day = isset($_GET['day']) ? $_GET['day'] : null; |
|
779 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null; |
|
780 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
781 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date; |
|
782 | + $form_id = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null; |
|
783 | + |
|
784 | + if ( ! empty($search)) { |
|
785 | 785 | $status = 'any'; // Force all payment statuses when searching. |
786 | 786 | } |
787 | 787 | |
788 | 788 | $args = array( |
789 | 789 | 'output' => 'payments', |
790 | 790 | 'number' => $per_page, |
791 | - 'page' => isset( $_GET['paged'] ) ? $_GET['paged'] : null, |
|
791 | + 'page' => isset($_GET['paged']) ? $_GET['paged'] : null, |
|
792 | 792 | 'orderby' => $orderby, |
793 | 793 | 'order' => $order, |
794 | 794 | 'user' => $user, |
@@ -804,12 +804,12 @@ discard block |
||
804 | 804 | 'give_forms' => $form_id, |
805 | 805 | ); |
806 | 806 | |
807 | - if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) { |
|
807 | + if (is_string($search) && false !== strpos($search, 'txn:')) { |
|
808 | 808 | $args['search_in_notes'] = true; |
809 | - $args['s'] = trim( str_replace( 'txn:', '', $args['s'] ) ); |
|
809 | + $args['s'] = trim(str_replace('txn:', '', $args['s'])); |
|
810 | 810 | } |
811 | 811 | |
812 | - $p_query = new Give_Payments_Query( $args ); |
|
812 | + $p_query = new Give_Payments_Query($args); |
|
813 | 813 | |
814 | 814 | return $p_query->get_payments(); |
815 | 815 | |
@@ -829,17 +829,17 @@ discard block |
||
829 | 829 | */ |
830 | 830 | public function prepare_items() { |
831 | 831 | |
832 | - wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) ); |
|
832 | + wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's')); |
|
833 | 833 | |
834 | 834 | $columns = $this->get_columns(); |
835 | 835 | $hidden = array(); // No hidden columns. |
836 | 836 | $sortable = $this->get_sortable_columns(); |
837 | 837 | $data = $this->payments_data(); |
838 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any'; |
|
838 | + $status = isset($_GET['status']) ? $_GET['status'] : 'any'; |
|
839 | 839 | |
840 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
840 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
841 | 841 | |
842 | - switch ( $status ) { |
|
842 | + switch ($status) { |
|
843 | 843 | case 'publish': |
844 | 844 | $total_items = $this->complete_count; |
845 | 845 | break; |
@@ -872,20 +872,20 @@ discard block |
||
872 | 872 | break; |
873 | 873 | default: |
874 | 874 | // Retrieve the count of the non-default-Give status. |
875 | - $count = wp_count_posts( 'give_payment' ); |
|
876 | - $total_items = isset( $count->{$status} ) ? $count->{$status} : 0; |
|
875 | + $count = wp_count_posts('give_payment'); |
|
876 | + $total_items = isset($count->{$status} ) ? $count->{$status} : 0; |
|
877 | 877 | break; |
878 | 878 | } |
879 | 879 | |
880 | 880 | $this->items = $data; |
881 | 881 | |
882 | - $this->set_pagination_args( array( |
|
882 | + $this->set_pagination_args(array( |
|
883 | 883 | 'total_items' => $total_items, |
884 | 884 | // We have to calculate the total number of items. |
885 | 885 | 'per_page' => $this->per_page, |
886 | 886 | // We have to determine how many items to show on a page. |
887 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
887 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
888 | 888 | // We have to calculate the total number of pages. |
889 | - ) ); |
|
889 | + )); |
|
890 | 890 | } |
891 | 891 | } |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Advanced' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Advanced')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Advanced. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'advanced'; |
30 | - $this->label = __( 'Advanced', 'give' ); |
|
30 | + $this->label = __('Advanced', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'advanced-options'; |
33 | 33 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $current_section = give_get_current_setting_section(); |
47 | 47 | |
48 | - switch ( $current_section ) { |
|
48 | + switch ($current_section) { |
|
49 | 49 | case 'advanced-options': |
50 | 50 | $settings = array( |
51 | 51 | array( |
@@ -53,19 +53,19 @@ discard block |
||
53 | 53 | 'type' => 'title', |
54 | 54 | ), |
55 | 55 | array( |
56 | - 'name' => __( 'Remove Data on Uninstall', 'give' ), |
|
57 | - 'desc' => __( 'When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give' ), |
|
56 | + 'name' => __('Remove Data on Uninstall', 'give'), |
|
57 | + 'desc' => __('When the plugin is deleted, completely remove all Give data. This includes all Give settings, forms, form meta, donor, donor data, donations. Everything.', 'give'), |
|
58 | 58 | 'id' => 'uninstall_on_delete', |
59 | 59 | 'type' => 'radio_inline', |
60 | 60 | 'default' => 'disabled', |
61 | 61 | 'options' => array( |
62 | - 'enabled' => __( 'Yes, Remove all data', 'give' ), |
|
63 | - 'disabled' => __( 'No, keep my Give settings and donation data', 'give' ), |
|
62 | + 'enabled' => __('Yes, Remove all data', 'give'), |
|
63 | + 'disabled' => __('No, keep my Give settings and donation data', 'give'), |
|
64 | 64 | ), |
65 | 65 | ), |
66 | 66 | array( |
67 | - 'name' => __( 'Default User Role', 'give' ), |
|
68 | - 'desc' => __( 'Assign default user roles for donors when donors opt to register as a WP User.', 'give' ), |
|
67 | + 'name' => __('Default User Role', 'give'), |
|
68 | + 'desc' => __('Assign default user roles for donors when donors opt to register as a WP User.', 'give'), |
|
69 | 69 | 'id' => 'donor_default_user_role', |
70 | 70 | 'type' => 'select', |
71 | 71 | 'default' => 'give_donor', |
@@ -73,44 +73,44 @@ discard block |
||
73 | 73 | ), |
74 | 74 | array( |
75 | 75 | /* translators: %s: the_content */ |
76 | - 'name' => sprintf( __( '%s filter', 'give' ), '<code>the_content</code>' ), |
|
76 | + 'name' => sprintf(__('%s filter', 'give'), '<code>the_content</code>'), |
|
77 | 77 | /* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */ |
78 | - 'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ), |
|
78 | + 'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'), |
|
79 | 79 | 'id' => 'the_content_filter', |
80 | 80 | 'default' => 'enabled', |
81 | 81 | 'type' => 'radio_inline', |
82 | 82 | 'options' => array( |
83 | - 'enabled' => __( 'Enabled', 'give' ), |
|
84 | - 'disabled' => __( 'Disabled', 'give' ), |
|
83 | + 'enabled' => __('Enabled', 'give'), |
|
84 | + 'disabled' => __('Disabled', 'give'), |
|
85 | 85 | ), |
86 | 86 | ), |
87 | 87 | array( |
88 | - 'name' => __( 'Script Loading Location', 'give' ), |
|
89 | - 'desc' => __( 'This allows you to load your Give scripts either in the <code><head></code> or footer of your website.', 'give' ), |
|
88 | + 'name' => __('Script Loading Location', 'give'), |
|
89 | + 'desc' => __('This allows you to load your Give scripts either in the <code><head></code> or footer of your website.', 'give'), |
|
90 | 90 | 'id' => 'scripts_footer', |
91 | 91 | 'type' => 'radio_inline', |
92 | 92 | 'default' => 'disabled', |
93 | 93 | 'options' => array( |
94 | - 'enabled' => __( 'Footer', 'give' ), |
|
95 | - 'disabled' => __( 'Head', 'give' ), |
|
94 | + 'enabled' => __('Footer', 'give'), |
|
95 | + 'disabled' => __('Head', 'give'), |
|
96 | 96 | ), |
97 | 97 | ), |
98 | 98 | array( |
99 | - 'name' => __( 'Akismet SPAM Protection', 'give' ), |
|
100 | - 'desc' => __( 'Add a layer of SPAM protection to your donation submissions with Akismet. When enabled, donation submissions will be first sent to Akismet\'s API.', 'give' ), |
|
99 | + 'name' => __('Akismet SPAM Protection', 'give'), |
|
100 | + 'desc' => __('Add a layer of SPAM protection to your donation submissions with Akismet. When enabled, donation submissions will be first sent to Akismet\'s API.', 'give'), |
|
101 | 101 | 'id' => 'akismet_spam_protection', |
102 | 102 | 'type' => 'radio_inline', |
103 | - 'default' => ( give_check_akismet_key() ) ? 'enabled' : 'disabled', |
|
103 | + 'default' => (give_check_akismet_key()) ? 'enabled' : 'disabled', |
|
104 | 104 | 'options' => array( |
105 | - 'enabled' => __( 'Enabled', 'give' ), |
|
106 | - 'disabled' => __( 'Disabled', 'give' ), |
|
105 | + 'enabled' => __('Enabled', 'give'), |
|
106 | + 'disabled' => __('Disabled', 'give'), |
|
107 | 107 | ), |
108 | 108 | ), |
109 | 109 | array( |
110 | - 'name' => __( 'Advanced Settings Docs Link', 'give' ), |
|
110 | + 'name' => __('Advanced Settings Docs Link', 'give'), |
|
111 | 111 | 'id' => 'advanced_settings_docs_link', |
112 | - 'url' => esc_url( 'http://docs.givewp.com/settings-advanced' ), |
|
113 | - 'title' => __( 'Advanced Settings', 'give' ), |
|
112 | + 'url' => esc_url('http://docs.givewp.com/settings-advanced'), |
|
113 | + 'title' => __('Advanced Settings', 'give'), |
|
114 | 114 | 'type' => 'give_docs_link', |
115 | 115 | ), |
116 | 116 | array( |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * Filter the advanced settings. |
127 | 127 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
128 | 128 | */ |
129 | - $settings = apply_filters( 'give_settings_advanced', $settings ); |
|
129 | + $settings = apply_filters('give_settings_advanced', $settings); |
|
130 | 130 | |
131 | 131 | /** |
132 | 132 | * Filter the settings. |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @param array $settings |
137 | 137 | */ |
138 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
138 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
139 | 139 | |
140 | 140 | // Output. |
141 | 141 | return $settings; |
@@ -149,10 +149,10 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public function get_sections() { |
151 | 151 | $sections = array( |
152 | - 'advanced-options' => __( 'Advanced Options', 'give' ), |
|
152 | + 'advanced-options' => __('Advanced Options', 'give'), |
|
153 | 153 | ); |
154 | 154 | |
155 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
155 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
156 | 156 | } |
157 | 157 | } |
158 | 158 |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * Admin View: Imports |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } ?> |
9 | 9 | |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @since 1.8.14 |
20 | 20 | */ |
21 | - do_action( 'give_tools_tab_import_content_top' ); |
|
21 | + do_action('give_tools_tab_import_content_top'); |
|
22 | 22 | ?> |
23 | 23 | |
24 | 24 | <table class="widefat Import-options-table give-table"> |
25 | 25 | <thead> |
26 | 26 | <tr> |
27 | - <th scope="col"><?php esc_html_e( 'Import Type', 'give' ); ?></th> |
|
28 | - <th scope="col"><?php esc_html_e( 'Import Options', 'give' ); ?></th> |
|
27 | + <th scope="col"><?php esc_html_e('Import Type', 'give'); ?></th> |
|
28 | + <th scope="col"><?php esc_html_e('Import Options', 'give'); ?></th> |
|
29 | 29 | </tr> |
30 | 30 | </thead> |
31 | 31 | <tbody> |
@@ -38,19 +38,19 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @since 1.8.14 |
40 | 40 | */ |
41 | - do_action( 'give_tools_tab_import_table_top' ); |
|
41 | + do_action('give_tools_tab_import_table_top'); |
|
42 | 42 | ?> |
43 | 43 | |
44 | 44 | <tr class="give-Import-pdf-sales-earnings"> |
45 | 45 | <td scope="row" class="row-title"> |
46 | 46 | <h3> |
47 | - <span><?php esc_html_e( 'Import Donations', 'give' ); ?></span> |
|
47 | + <span><?php esc_html_e('Import Donations', 'give'); ?></span> |
|
48 | 48 | </h3> |
49 | - <p><?php esc_html_e( 'Import a CSV of Donations.', 'give' ); ?></p> |
|
49 | + <p><?php esc_html_e('Import a CSV of Donations.', 'give'); ?></p> |
|
50 | 50 | </td> |
51 | 51 | <td> |
52 | - <a class="button" href="<?php echo add_query_arg( array( 'importer-type' => 'import_donations' ) ); ?>"> |
|
53 | - <?php esc_html_e( 'Import CSV', 'give' ); ?> |
|
52 | + <a class="button" href="<?php echo add_query_arg(array('importer-type' => 'import_donations')); ?>"> |
|
53 | + <?php esc_html_e('Import CSV', 'give'); ?> |
|
54 | 54 | </a> |
55 | 55 | </td> |
56 | 56 | </tr> |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @since 1.8.14 |
66 | 66 | */ |
67 | - do_action( 'give_tools_tab_import_table_bottom' ); |
|
67 | + do_action('give_tools_tab_import_table_bottom'); |
|
68 | 68 | ?> |
69 | 69 | </tbody> |
70 | 70 | </table> |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @since 1.8.14 |
77 | 77 | */ |
78 | - do_action( 'give_tools_tab_import_content_bottom' ); |
|
78 | + do_action('give_tools_tab_import_content_bottom'); |
|
79 | 79 | ?> |
80 | 80 | |
81 | 81 | </div> |
@@ -3,11 +3,11 @@ discard block |
||
3 | 3 | * Admin View: Exports |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
10 | -if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
10 | +if ( ! current_user_can('manage_give_settings')) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -16,29 +16,29 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @since 1.5 |
18 | 18 | */ |
19 | -do_action( 'give_tools_recount_stats_before' ); |
|
19 | +do_action('give_tools_recount_stats_before'); |
|
20 | 20 | ?> |
21 | 21 | <div id="poststuff"> |
22 | 22 | <div class="postbox"> |
23 | 23 | |
24 | - <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2> |
|
24 | + <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2> |
|
25 | 25 | |
26 | 26 | <div class="inside recount-stats-controls"> |
27 | - <p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p> |
|
27 | + <p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p> |
|
28 | 28 | <form method="post" id="give-tools-recount-form" class="give-export-form"> |
29 | 29 | |
30 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
30 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
31 | 31 | |
32 | 32 | <select name="give-export-class" id="recount-stats-type"> |
33 | - <option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option> |
|
34 | - <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option> |
|
35 | - <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option> |
|
36 | - <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option> |
|
37 | - <option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option> |
|
38 | - <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Payments', 'give' ); ?></option> |
|
39 | - <option data-type="delete-test-donors" value="Give_Tools_Delete_Donors"><?php esc_html_e( 'Delete Test Donors and Payments', 'give' ); ?></option> |
|
40 | - <option data-type="delete-import-donors" value="Give_Tools_Import_Donors"><?php esc_html_e( 'Delete Imported Donors and Payments', 'give' ); ?></option> |
|
41 | - <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option> |
|
33 | + <option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option> |
|
34 | + <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option> |
|
35 | + <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option> |
|
36 | + <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option> |
|
37 | + <option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option> |
|
38 | + <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Payments', 'give'); ?></option> |
|
39 | + <option data-type="delete-test-donors" value="Give_Tools_Delete_Donors"><?php esc_html_e('Delete Test Donors and Payments', 'give'); ?></option> |
|
40 | + <option data-type="delete-import-donors" value="Give_Tools_Import_Donors"><?php esc_html_e('Delete Imported Donors and Payments', 'give'); ?></option> |
|
41 | + <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option> |
|
42 | 42 | <?php |
43 | 43 | /** |
44 | 44 | * Fires in the recount stats selectbox. |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @since 1.5 |
49 | 49 | */ |
50 | - do_action( 'give_recount_tool_options' ); |
|
50 | + do_action('give_recount_tool_options'); |
|
51 | 51 | ?> |
52 | 52 | </select> |
53 | 53 | |
@@ -55,33 +55,33 @@ discard block |
||
55 | 55 | <?php |
56 | 56 | $args = array( |
57 | 57 | 'name' => 'form_id', |
58 | - 'number' => - 1, |
|
58 | + 'number' => -1, |
|
59 | 59 | 'chosen' => true, |
60 | 60 | ); |
61 | - echo Give()->html->forms_dropdown( $args ); |
|
61 | + echo Give()->html->forms_dropdown($args); |
|
62 | 62 | ?> |
63 | 63 | </span> |
64 | 64 | |
65 | 65 | <span class="tools-form-dropdown tools-form-dropdown-delete-import-donors" style="display: none"> |
66 | 66 | <label for="delete-import-donors"> |
67 | 67 | <?php |
68 | - echo Give()->html->checkbox( array( |
|
68 | + echo Give()->html->checkbox(array( |
|
69 | 69 | 'name' => 'delete-import-donors' |
70 | - ) ); |
|
71 | - _e( 'Delete imported WordPress users', 'give' ); |
|
70 | + )); |
|
71 | + _e('Delete imported WordPress users', 'give'); |
|
72 | 72 | ?> |
73 | 73 | </label> |
74 | 74 | </span> |
75 | 75 | |
76 | - <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/> |
|
76 | + <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/> |
|
77 | 77 | |
78 | 78 | <br/> |
79 | 79 | |
80 | 80 | <span class="give-recount-stats-descriptions"> |
81 | - <span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span> |
|
82 | - <span id="recount-form"><?php esc_html_e( 'Recalculates the donation and income stats for a specific form.', 'give' ); ?></span> |
|
83 | - <span id="recount-all"><?php esc_html_e( 'Recalculates the earnings and sales stats for all forms.', 'give' ); ?></span> |
|
84 | - <span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span> |
|
81 | + <span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span> |
|
82 | + <span id="recount-form"><?php esc_html_e('Recalculates the donation and income stats for a specific form.', 'give'); ?></span> |
|
83 | + <span id="recount-all"><?php esc_html_e('Recalculates the earnings and sales stats for all forms.', 'give'); ?></span> |
|
84 | + <span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span> |
|
85 | 85 | <?php |
86 | 86 | /** |
87 | 87 | * Fires in the recount stats description area. |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @since 1.5 |
92 | 92 | */ |
93 | - do_action( 'give_recount_tool_descriptions' ); |
|
93 | + do_action('give_recount_tool_descriptions'); |
|
94 | 94 | ?> |
95 | - <span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give' ); ?></span> |
|
96 | - <span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span> |
|
95 | + <span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give'); ?></span> |
|
96 | + <span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give'); ?></span> |
|
97 | 97 | </span> |
98 | 98 | |
99 | 99 | <span class="spinner"></span> |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @since 1.5 |
109 | 109 | */ |
110 | - do_action( 'give_tools_recount_forms' ); |
|
110 | + do_action('give_tools_recount_forms'); |
|
111 | 111 | ?> |
112 | 112 | </div><!-- .inside --> |
113 | 113 | </div><!-- .postbox --> |
@@ -118,4 +118,4 @@ discard block |
||
118 | 118 | * |
119 | 119 | * @since 1.5 |
120 | 120 | */ |
121 | -do_action( 'give_tools_recount_stats_after' ); |
|
121 | +do_action('give_tools_recount_stats_after'); |
@@ -3,11 +3,11 @@ discard block |
||
3 | 3 | * Admin View: Import Donations |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
10 | -if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
10 | +if ( ! current_user_can('manage_give_settings')) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -16,11 +16,11 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @since 1.8.13 |
18 | 18 | */ |
19 | -do_action( 'give_tools_import_donations_main_before' ); |
|
19 | +do_action('give_tools_import_donations_main_before'); |
|
20 | 20 | ?> |
21 | 21 | <div id="poststuff"> |
22 | 22 | <div class="postbox"> |
23 | - <h1 class="give-importer-h1" align="center"><?php esc_html_e( 'Import Donations', 'give' ); ?></h1> |
|
23 | + <h1 class="give-importer-h1" align="center"><?php esc_html_e('Import Donations', 'give'); ?></h1> |
|
24 | 24 | <div class="inside give-tools-setting-page-import"> |
25 | 25 | <?php |
26 | 26 | /** |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @since 1.8.14 |
30 | 30 | */ |
31 | - do_action( 'give_tools_import_donations_form_before_start' ); |
|
31 | + do_action('give_tools_import_donations_form_before_start'); |
|
32 | 32 | ?> |
33 | 33 | <form method="post" id="give-import-donations-form" class="give-import-form tools-setting-page-import tools-setting-page-import"> |
34 | 34 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @since 1.8.14 |
40 | 40 | */ |
41 | - do_action( 'give_tools_import_donations_form_start' ); |
|
41 | + do_action('give_tools_import_donations_form_start'); |
|
42 | 42 | ?> |
43 | 43 | |
44 | 44 | <?php |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @since 1.8.14 |
49 | 49 | */ |
50 | - do_action( 'give_tools_import_donations_form_end' ); |
|
50 | + do_action('give_tools_import_donations_form_end'); |
|
51 | 51 | ?> |
52 | 52 | </form> |
53 | 53 | <?php |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @since 1.8.14 |
58 | 58 | */ |
59 | - do_action( 'give_tools_import_donations_form_after_end' ); |
|
59 | + do_action('give_tools_import_donations_form_after_end'); |
|
60 | 60 | ?> |
61 | 61 | </div><!-- .inside --> |
62 | 62 | </div><!-- .postbox --> |
@@ -67,4 +67,4 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @since 1.8.13 |
69 | 69 | */ |
70 | -do_action( 'give_tools_import_donations_main_after' ); |
|
70 | +do_action('give_tools_import_donations_main_after'); |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Import' ) ) { |
|
16 | +if ( ! class_exists('Give_Settings_Import')) { |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Import. |
@@ -38,23 +38,23 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function __construct() { |
40 | 40 | $this->id = 'import'; |
41 | - $this->label = __( 'Import', 'give' ); |
|
41 | + $this->label = __('Import', 'give'); |
|
42 | 42 | |
43 | 43 | // Add Import tab in submenu. |
44 | - add_filter( 'give-tools_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
44 | + add_filter('give-tools_tabs_array', array($this, 'add_settings_page'), 20); |
|
45 | 45 | |
46 | 46 | // Will display html of the import donation. |
47 | - add_action( 'give_admin_field_tools_import', array( 'Give_Settings_Import', 'render_import_field' ), 10, 2 ); |
|
47 | + add_action('give_admin_field_tools_import', array('Give_Settings_Import', 'render_import_field'), 10, 2); |
|
48 | 48 | |
49 | 49 | // Will call the function that generated the hook called 'give_admin_field_tools_import'. |
50 | - add_action( "give-tools_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
50 | + add_action("give-tools_settings_{$this->id}_page", array($this, 'output')); |
|
51 | 51 | |
52 | 52 | // Do not use main form for this tab. |
53 | - if ( give_get_current_setting_tab() === $this->id ) { |
|
54 | - add_action( "give-tools_open_form", '__return_empty_string' ); |
|
55 | - add_action( "give-tools_close_form", '__return_empty_string' ); |
|
53 | + if (give_get_current_setting_tab() === $this->id) { |
|
54 | + add_action("give-tools_open_form", '__return_empty_string'); |
|
55 | + add_action("give-tools_close_form", '__return_empty_string'); |
|
56 | 56 | |
57 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/import/class-give-import-donations.php'; |
|
57 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/import/class-give-import-donations.php'; |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @param array $settings |
78 | 78 | */ |
79 | 79 | $settings = apply_filters( |
80 | - 'give_get_settings_' . $this->id, |
|
80 | + 'give_get_settings_'.$this->id, |
|
81 | 81 | array( |
82 | 82 | array( |
83 | 83 | 'id' => 'give_tools_import', |
@@ -86,14 +86,14 @@ discard block |
||
86 | 86 | ), |
87 | 87 | array( |
88 | 88 | 'id' => 'import', |
89 | - 'name' => __( 'Import', 'give' ), |
|
89 | + 'name' => __('Import', 'give'), |
|
90 | 90 | 'type' => 'tools_import', |
91 | 91 | ), |
92 | 92 | array( |
93 | - 'name' => esc_html__( 'Import Docs Link', 'give' ), |
|
93 | + 'name' => esc_html__('Import Docs Link', 'give'), |
|
94 | 94 | 'id' => 'import_docs_link', |
95 | - 'url' => esc_url( 'http://docs.givewp.com/tools-importer' ), |
|
96 | - 'title' => __( 'Import Tab', 'give' ), |
|
95 | + 'url' => esc_url('http://docs.givewp.com/tools-importer'), |
|
96 | + 'title' => __('Import Tab', 'give'), |
|
97 | 97 | 'type' => 'give_docs_link', |
98 | 98 | ), |
99 | 99 | array( |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | * @param $field |
118 | 118 | * @param $option_value |
119 | 119 | */ |
120 | - public static function render_import_field( $field, $option_value ) { |
|
121 | - include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-imports.php'; |
|
120 | + public static function render_import_field($field, $option_value) { |
|
121 | + include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-imports.php'; |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | ob_start(); ?> |
27 | 27 | <div class="wrap" id="give-add-ons"> |
28 | 28 | <h1><?php echo get_admin_page_title(); ?> |
29 | - — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?> |
|
29 | + — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e('View All Add-ons', 'give'); ?> |
|
30 | 30 | <span class="dashicons dashicons-external"></span></a> |
31 | 31 | </h1> |
32 | 32 | |
33 | 33 | <hr class="wp-header-end"> |
34 | 34 | |
35 | - <p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p> |
|
35 | + <p><?php esc_html_e('The following Add-ons extend the functionality of Give.', 'give'); ?></p> |
|
36 | 36 | <?php echo give_add_ons_get_feed(); ?> |
37 | 37 | </div> |
38 | 38 | <?php |
@@ -50,20 +50,20 @@ discard block |
||
50 | 50 | function give_add_ons_get_feed() { |
51 | 51 | |
52 | 52 | $addons_debug = false; //set to true to debug |
53 | - $cache = Give_Cache::get( 'give_add_ons_feed', true ); |
|
53 | + $cache = Give_Cache::get('give_add_ons_feed', true); |
|
54 | 54 | |
55 | - if ( $cache === false || $addons_debug === true && WP_DEBUG === true ) { |
|
56 | - $feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) ); |
|
55 | + if ($cache === false || $addons_debug === true && WP_DEBUG === true) { |
|
56 | + $feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false)); |
|
57 | 57 | |
58 | - if ( ! is_wp_error( $feed ) ) { |
|
59 | - if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) { |
|
60 | - $cache = wp_remote_retrieve_body( $feed ); |
|
61 | - Give_Cache::set( 'give_add_ons_feed', $cache, HOUR_IN_SECONDS, true ); |
|
58 | + if ( ! is_wp_error($feed)) { |
|
59 | + if (isset($feed['body']) && strlen($feed['body']) > 0) { |
|
60 | + $cache = wp_remote_retrieve_body($feed); |
|
61 | + Give_Cache::set('give_add_ons_feed', $cache, HOUR_IN_SECONDS, true); |
|
62 | 62 | } |
63 | 63 | } else { |
64 | 64 | $cache = sprintf( |
65 | 65 | '<div class="error"><p>%s</p></div>', |
66 | - esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' ) |
|
66 | + esc_html__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give') |
|
67 | 67 | ); |
68 | 68 | } |
69 | 69 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | |
18 | 18 | // Exit if accessed directly. |
19 | -if ( ! defined( 'ABSPATH' ) ) { |
|
19 | +if ( ! defined('ABSPATH')) { |
|
20 | 20 | exit; |
21 | 21 | } |
22 | 22 | |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | * @return void |
30 | 30 | */ |
31 | 31 | function give_reports_page() { |
32 | - $current_page = admin_url( 'edit.php?post_type=give_forms&page=give-reports' ); |
|
33 | - $active_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; |
|
32 | + $current_page = admin_url('edit.php?post_type=give_forms&page=give-reports'); |
|
33 | + $active_tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; |
|
34 | 34 | $views = give_reports_default_views(); |
35 | 35 | ?> |
36 | 36 | <div class="wrap give-settings-page"> |
@@ -38,17 +38,17 @@ discard block |
||
38 | 38 | <h1 class="screen-reader-text"><?php echo get_admin_page_title(); ?></h1> |
39 | 39 | |
40 | 40 | <h2 class="nav-tab-wrapper"> |
41 | - <?php foreach ( $views as $tab => $label ) { ?> |
|
42 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
41 | + <?php foreach ($views as $tab => $label) { ?> |
|
42 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
43 | 43 | 'tab' => $tab, |
44 | 44 | 'settings-updated' => false, |
45 | - ), $current_page ) ); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php echo esc_html( $label ); ?></a> |
|
45 | + ), $current_page)); ?>" class="nav-tab <?php echo $tab === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php echo esc_html($label); ?></a> |
|
46 | 46 | <?php } ?> |
47 | - <?php if ( current_user_can( 'export_give_reports' ) ) { ?> |
|
48 | - <a href="<?php echo esc_url( add_query_arg( array( |
|
47 | + <?php if (current_user_can('export_give_reports')) { ?> |
|
48 | + <a href="<?php echo esc_url(add_query_arg(array( |
|
49 | 49 | 'tab' => 'export', |
50 | 50 | 'settings-updated' => false, |
51 | - ), $current_page ) ); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr( 'nav-tab-active' ) : ''; ?>"><?php esc_html_e( 'Export', 'give' ); ?></a> |
|
51 | + ), $current_page)); ?>" class="nav-tab <?php echo 'export' === $active_tab ? esc_attr('nav-tab-active') : ''; ?>"><?php esc_html_e('Export', 'give'); ?></a> |
|
52 | 52 | <?php } |
53 | 53 | /** |
54 | 54 | * Fires in the report tabs. |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @since 1.0 |
59 | 59 | */ |
60 | - do_action( 'give_reports_tabs' ); |
|
60 | + do_action('give_reports_tabs'); |
|
61 | 61 | ?> |
62 | 62 | </h2> |
63 | 63 | |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @since 1.0 |
69 | 69 | */ |
70 | - do_action( 'give_reports_page_top' ); |
|
70 | + do_action('give_reports_page_top'); |
|
71 | 71 | |
72 | 72 | // Set $active_tab prior to hook firing. |
73 | - if ( in_array( $active_tab, array_keys( $views ) ) ) { |
|
73 | + if (in_array($active_tab, array_keys($views))) { |
|
74 | 74 | $active_tab = 'reports'; |
75 | 75 | } |
76 | 76 | |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @since 1.0 |
81 | 81 | */ |
82 | - do_action( "give_reports_tab_{$active_tab}" ); |
|
82 | + do_action("give_reports_tab_{$active_tab}"); |
|
83 | 83 | |
84 | 84 | /** |
85 | 85 | * Fires after the report page. |
86 | 86 | * |
87 | 87 | * @since 1.0 |
88 | 88 | */ |
89 | - do_action( 'give_reports_page_bottom' ); |
|
89 | + do_action('give_reports_page_bottom'); |
|
90 | 90 | ?> |
91 | 91 | </div><!-- .wrap --> |
92 | 92 | <?php |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | */ |
101 | 101 | function give_reports_default_views() { |
102 | 102 | $views = array( |
103 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
104 | - 'forms' => esc_html__( 'Forms', 'give' ), |
|
105 | - 'gateways' => esc_html__( 'Donation Methods', 'give' ), |
|
103 | + 'earnings' => esc_html__('Income', 'give'), |
|
104 | + 'forms' => esc_html__('Forms', 'give'), |
|
105 | + 'gateways' => esc_html__('Donation Methods', 'give'), |
|
106 | 106 | ); |
107 | 107 | |
108 | - $views = apply_filters( 'give_report_views', $views ); |
|
108 | + $views = apply_filters('give_report_views', $views); |
|
109 | 109 | |
110 | 110 | return $views; |
111 | 111 | } |
@@ -120,15 +120,15 @@ discard block |
||
120 | 120 | * @since 1.0 |
121 | 121 | * @return string $view Report View |
122 | 122 | */ |
123 | -function give_get_reporting_view( $default = 'earnings' ) { |
|
123 | +function give_get_reporting_view($default = 'earnings') { |
|
124 | 124 | |
125 | - if ( ! isset( $_GET['view'] ) || ! in_array( $_GET['view'], array_keys( give_reports_default_views() ) ) ) { |
|
125 | + if ( ! isset($_GET['view']) || ! in_array($_GET['view'], array_keys(give_reports_default_views()))) { |
|
126 | 126 | $view = $default; |
127 | 127 | } else { |
128 | 128 | $view = $_GET['view']; |
129 | 129 | } |
130 | 130 | |
131 | - return apply_filters( 'give_get_reporting_view', $view ); |
|
131 | + return apply_filters('give_get_reporting_view', $view); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $current_view = 'earnings'; |
142 | 142 | $views = give_reports_default_views(); |
143 | 143 | |
144 | - if ( isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $views ) ) { |
|
144 | + if (isset($_GET['tab']) && array_key_exists($_GET['tab'], $views)) { |
|
145 | 145 | $current_view = $_GET['tab']; |
146 | 146 | } |
147 | 147 | |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @since 1.0 |
152 | 152 | */ |
153 | - do_action( "give_reports_view_{$current_view}" ); |
|
153 | + do_action("give_reports_view_{$current_view}"); |
|
154 | 154 | } |
155 | 155 | |
156 | -add_action( 'give_reports_tab_reports', 'give_reports_tab_reports' ); |
|
156 | +add_action('give_reports_tab_reports', 'give_reports_tab_reports'); |
|
157 | 157 | |
158 | 158 | /** |
159 | 159 | * Renders the Reports Page Views Drop Downs |
@@ -163,19 +163,19 @@ discard block |
||
163 | 163 | */ |
164 | 164 | function give_report_views() { |
165 | 165 | $views = give_reports_default_views(); |
166 | - $current_view = isset( $_GET['view'] ) ? $_GET['view'] : 'earnings'; |
|
166 | + $current_view = isset($_GET['view']) ? $_GET['view'] : 'earnings'; |
|
167 | 167 | /** |
168 | 168 | * Fires before the report page actions form. |
169 | 169 | * |
170 | 170 | * @since 1.0 |
171 | 171 | */ |
172 | - do_action( 'give_report_view_actions_before' ); |
|
172 | + do_action('give_report_view_actions_before'); |
|
173 | 173 | ?> |
174 | 174 | <form id="give-reports-filter" method="get"> |
175 | 175 | <select id="give-reports-view" name="view"> |
176 | - <option value="-1"><?php esc_html_e( 'Report Type', 'give' ); ?></option> |
|
177 | - <?php foreach ( $views as $view_id => $label ) : ?> |
|
178 | - <option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option> |
|
176 | + <option value="-1"><?php esc_html_e('Report Type', 'give'); ?></option> |
|
177 | + <?php foreach ($views as $view_id => $label) : ?> |
|
178 | + <option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option> |
|
179 | 179 | <?php endforeach; ?> |
180 | 180 | </select> |
181 | 181 | |
@@ -187,12 +187,12 @@ discard block |
||
187 | 187 | * |
188 | 188 | * @since 1.0 |
189 | 189 | */ |
190 | - do_action( 'give_report_view_actions' ); |
|
190 | + do_action('give_report_view_actions'); |
|
191 | 191 | ?> |
192 | 192 | |
193 | 193 | <input type="hidden" name="post_type" value="give_forms"/> |
194 | 194 | <input type="hidden" name="page" value="give-reports"/> |
195 | - <?php submit_button( esc_html__( 'Show', 'give' ), 'secondary', 'submit', false ); ?> |
|
195 | + <?php submit_button(esc_html__('Show', 'give'), 'secondary', 'submit', false); ?> |
|
196 | 196 | </form> |
197 | 197 | <?php |
198 | 198 | /** |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @since 1.0 |
202 | 202 | */ |
203 | - do_action( 'give_report_view_actions_after' ); |
|
203 | + do_action('give_report_view_actions_after'); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -213,11 +213,11 @@ discard block |
||
213 | 213 | */ |
214 | 214 | function give_reports_forms_table() { |
215 | 215 | |
216 | - if ( isset( $_GET['form-id'] ) ) { |
|
216 | + if (isset($_GET['form-id'])) { |
|
217 | 217 | return; |
218 | 218 | } |
219 | 219 | |
220 | - include( dirname( __FILE__ ) . '/class-form-reports-table.php' ); |
|
220 | + include(dirname(__FILE__).'/class-form-reports-table.php'); |
|
221 | 221 | |
222 | 222 | $give_table = new Give_Form_Reports_Table(); |
223 | 223 | $give_table->prepare_items(); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | <?php |
230 | 230 | } |
231 | 231 | |
232 | -add_action( 'give_reports_view_forms', 'give_reports_forms_table' ); |
|
232 | +add_action('give_reports_view_forms', 'give_reports_forms_table'); |
|
233 | 233 | |
234 | 234 | /** |
235 | 235 | * Renders the detailed report for a specific give form. |
@@ -238,20 +238,20 @@ discard block |
||
238 | 238 | * @return void |
239 | 239 | */ |
240 | 240 | function give_reports_form_details() { |
241 | - if ( ! isset( $_GET['form-id'] ) ) { |
|
241 | + if ( ! isset($_GET['form-id'])) { |
|
242 | 242 | return; |
243 | 243 | } |
244 | 244 | ?> |
245 | 245 | <div class="tablenav top reports-forms-details-wrap"> |
246 | 246 | <div class="actions bulkactions"> |
247 | - <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e( 'Go Back', 'give' ); ?></button> |
|
247 | + <button onclick="history.go(-1);" class="button-secondary"><?php esc_html_e('Go Back', 'give'); ?></button> |
|
248 | 248 | </div> |
249 | 249 | </div> |
250 | 250 | <?php |
251 | - give_reports_graph_of_form( absint( $_GET['form-id'] ) ); |
|
251 | + give_reports_graph_of_form(absint($_GET['form-id'])); |
|
252 | 252 | } |
253 | 253 | |
254 | -add_action( 'give_reports_view_forms', 'give_reports_form_details' ); |
|
254 | +add_action('give_reports_view_forms', 'give_reports_form_details'); |
|
255 | 255 | |
256 | 256 | /** |
257 | 257 | * Renders the Gateways Table |
@@ -262,14 +262,14 @@ discard block |
||
262 | 262 | * @return void |
263 | 263 | */ |
264 | 264 | function give_reports_gateways_table() { |
265 | - include( dirname( __FILE__ ) . '/class-gateways-reports-table.php' ); |
|
265 | + include(dirname(__FILE__).'/class-gateways-reports-table.php'); |
|
266 | 266 | |
267 | 267 | $give_table = new Give_Gateway_Reports_Table(); |
268 | 268 | $give_table->prepare_items(); |
269 | 269 | $give_table->display(); |
270 | 270 | } |
271 | 271 | |
272 | -add_action( 'give_reports_view_gateways', 'give_reports_gateways_table' ); |
|
272 | +add_action('give_reports_view_gateways', 'give_reports_gateways_table'); |
|
273 | 273 | |
274 | 274 | /** |
275 | 275 | * Renders the Reports Earnings Graphs |
@@ -280,13 +280,13 @@ discard block |
||
280 | 280 | function give_reports_earnings() { |
281 | 281 | ?> |
282 | 282 | <div class="tablenav top reports-table-nav"> |
283 | - <h2 class="reports-earnings-title"><?php esc_html_e( 'Income Report', 'give' ); ?></h2> |
|
283 | + <h2 class="reports-earnings-title"><?php esc_html_e('Income Report', 'give'); ?></h2> |
|
284 | 284 | </div> |
285 | 285 | <?php |
286 | 286 | give_reports_graph(); |
287 | 287 | } |
288 | 288 | |
289 | -add_action( 'give_reports_view_earnings', 'give_reports_earnings' ); |
|
289 | +add_action('give_reports_view_earnings', 'give_reports_earnings'); |
|
290 | 290 | |
291 | 291 | |
292 | 292 | /** |
@@ -297,9 +297,9 @@ discard block |
||
297 | 297 | */ |
298 | 298 | function give_estimated_monthly_stats() { |
299 | 299 | |
300 | - $estimated = Give_Cache::get( 'give_estimated_monthly_stats', true ); |
|
300 | + $estimated = Give_Cache::get('give_estimated_monthly_stats', true); |
|
301 | 301 | |
302 | - if ( false === $estimated ) { |
|
302 | + if (false === $estimated) { |
|
303 | 303 | |
304 | 304 | $estimated = array( |
305 | 305 | 'earnings' => 0, |
@@ -308,22 +308,22 @@ discard block |
||
308 | 308 | |
309 | 309 | $stats = new Give_Payment_Stats; |
310 | 310 | |
311 | - $to_date_earnings = $stats->get_earnings( 0, 'this_month' ); |
|
312 | - $to_date_sales = $stats->get_sales( 0, 'this_month' ); |
|
311 | + $to_date_earnings = $stats->get_earnings(0, 'this_month'); |
|
312 | + $to_date_sales = $stats->get_sales(0, 'this_month'); |
|
313 | 313 | |
314 | - $current_day = date( 'd', current_time( 'timestamp' ) ); |
|
315 | - $current_month = date( 'n', current_time( 'timestamp' ) ); |
|
316 | - $current_year = date( 'Y', current_time( 'timestamp' ) ); |
|
317 | - $days_in_month = cal_days_in_month( CAL_GREGORIAN, $current_month, $current_year ); |
|
314 | + $current_day = date('d', current_time('timestamp')); |
|
315 | + $current_month = date('n', current_time('timestamp')); |
|
316 | + $current_year = date('Y', current_time('timestamp')); |
|
317 | + $days_in_month = cal_days_in_month(CAL_GREGORIAN, $current_month, $current_year); |
|
318 | 318 | |
319 | - $estimated['earnings'] = ( $to_date_earnings / $current_day ) * $days_in_month; |
|
320 | - $estimated['sales'] = ( $to_date_sales / $current_day ) * $days_in_month; |
|
319 | + $estimated['earnings'] = ($to_date_earnings / $current_day) * $days_in_month; |
|
320 | + $estimated['sales'] = ($to_date_sales / $current_day) * $days_in_month; |
|
321 | 321 | |
322 | 322 | // Cache for one day |
323 | - Give_Cache::set( 'give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true ); |
|
323 | + Give_Cache::set('give_estimated_monthly_stats', $estimated, DAY_IN_SECONDS, true); |
|
324 | 324 | } |
325 | 325 | |
326 | - return maybe_unserialize( $estimated ); |
|
326 | + return maybe_unserialize($estimated); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | function give_reports_set_form_method() { |
337 | 337 | return 'get'; |
338 | 338 | } |
339 | -add_filter( 'give-reports_form_method_tab_forms', 'give_reports_set_form_method', 10 ); |
|
340 | -add_filter( 'give-reports_form_method_tab_donors', 'give_reports_set_form_method', 10 ); |
|
339 | +add_filter('give-reports_form_method_tab_forms', 'give_reports_set_form_method', 10); |
|
340 | +add_filter('give-reports_form_method_tab_donors', 'give_reports_set_form_method', 10); |
|
341 | 341 | |
342 | 342 | // @TODO: After release 1.8 Donations -> Reports generates with new setting api, so we can remove some old code from this file. |