@@ -398,6 +398,7 @@ |
||
398 | 398 | * |
399 | 399 | * @since 1.6 |
400 | 400 | * |
401 | + * @param Give_Payment $payment |
|
401 | 402 | * @return mixed|void |
402 | 403 | */ |
403 | 404 | function get_row_actions( $payment ) { |
@@ -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 | /** |
@@ -118,37 +118,37 @@ discard block |
||
118 | 118 | public function __construct() { |
119 | 119 | |
120 | 120 | // Set parent defaults |
121 | - parent::__construct( array( |
|
122 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
123 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
121 | + parent::__construct(array( |
|
122 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
123 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
124 | 124 | 'ajax' => false // Does this table support ajax? |
125 | - ) ); |
|
125 | + )); |
|
126 | 126 | |
127 | 127 | $this->get_payment_counts(); |
128 | 128 | $this->process_bulk_action(); |
129 | - $this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
129 | + $this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | public function advanced_filters() { |
133 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
134 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null; |
|
135 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
133 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
134 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null; |
|
135 | + $status = isset($_GET['status']) ? $_GET['status'] : ''; |
|
136 | 136 | ?> |
137 | 137 | <div id="give-payment-filters"> |
138 | 138 | <span id="give-payment-date-filters"> |
139 | - <label for="start-date" class="give-start-date-label"><?php esc_html_e( 'Start Date:', 'give' ); ?></label> |
|
139 | + <label for="start-date" class="give-start-date-label"><?php esc_html_e('Start Date:', 'give'); ?></label> |
|
140 | 140 | <input type="text" id="start-date" name="start-date" class="give_datepicker" value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy"/> |
141 | - <label for="end-date" class="give-end-date-label"><?php esc_html_e( 'End Date:', 'give' ); ?></label> |
|
141 | + <label for="end-date" class="give-end-date-label"><?php esc_html_e('End Date:', 'give'); ?></label> |
|
142 | 142 | <input type="text" id="end-date" name="end-date" class="give_datepicker" value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy"/> |
143 | - <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Apply', 'give' ); ?>"/> |
|
143 | + <input type="submit" class="button-secondary" value="<?php esc_attr_e('Apply', 'give'); ?>"/> |
|
144 | 144 | </span> |
145 | - <?php if ( ! empty( $status ) ) : ?> |
|
146 | - <input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>"/> |
|
145 | + <?php if ( ! empty($status)) : ?> |
|
146 | + <input type="hidden" name="status" value="<?php echo esc_attr($status); ?>"/> |
|
147 | 147 | <?php endif; ?> |
148 | - <?php if ( ! empty( $start_date ) || ! empty( $end_date ) ) : ?> |
|
149 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" class="button-secondary"><?php esc_html_e( 'Clear Filter', 'give' ); ?></a> |
|
148 | + <?php if ( ! empty($start_date) || ! empty($end_date)) : ?> |
|
149 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" class="button-secondary"><?php esc_html_e('Clear Filter', 'give'); ?></a> |
|
150 | 150 | <?php endif; ?> |
151 | - <?php $this->search_box( esc_html__( 'Search', 'give' ), 'give-payments' ); ?> |
|
151 | + <?php $this->search_box(esc_html__('Search', 'give'), 'give-payments'); ?> |
|
152 | 152 | </div> |
153 | 153 | |
154 | 154 | <?php |
@@ -165,18 +165,18 @@ discard block |
||
165 | 165 | * |
166 | 166 | * @return void |
167 | 167 | */ |
168 | - public function search_box( $text, $input_id ) { |
|
169 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
168 | + public function search_box($text, $input_id) { |
|
169 | + if (empty($_REQUEST['s']) && ! $this->has_items()) { |
|
170 | 170 | return; |
171 | 171 | } |
172 | 172 | |
173 | - $input_id = $input_id . '-search-input'; |
|
173 | + $input_id = $input_id.'-search-input'; |
|
174 | 174 | |
175 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
176 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
175 | + if ( ! empty($_REQUEST['orderby'])) { |
|
176 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
177 | 177 | } |
178 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
179 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
178 | + if ( ! empty($_REQUEST['order'])) { |
|
179 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
180 | 180 | } |
181 | 181 | ?> |
182 | 182 | <p class="search-box"> |
@@ -188,11 +188,11 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @since 1.0 |
190 | 190 | */ |
191 | - do_action( 'give_payment_history_search' ); |
|
191 | + do_action('give_payment_history_search'); |
|
192 | 192 | ?> |
193 | 193 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
194 | 194 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
195 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?><br/> |
|
195 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?><br/> |
|
196 | 196 | </p> |
197 | 197 | <?php |
198 | 198 | } |
@@ -206,52 +206,52 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function get_views() { |
208 | 208 | |
209 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
210 | - $total_count = ' <span class="count">(' . $this->total_count . ')</span>'; |
|
211 | - $complete_count = ' <span class="count">(' . $this->complete_count . ')</span>'; |
|
212 | - $cancelled_count = ' <span class="count">(' . $this->cancelled_count . ')</span>'; |
|
213 | - $pending_count = ' <span class="count">(' . $this->pending_count . ')</span>'; |
|
214 | - $refunded_count = ' <span class="count">(' . $this->refunded_count . ')</span>'; |
|
215 | - $failed_count = ' <span class="count">(' . $this->failed_count . ')</span>'; |
|
216 | - $abandoned_count = ' <span class="count">(' . $this->abandoned_count . ')</span>'; |
|
217 | - $revoked_count = ' <span class="count">(' . $this->revoked_count . ')</span>'; |
|
209 | + $current = isset($_GET['status']) ? $_GET['status'] : ''; |
|
210 | + $total_count = ' <span class="count">('.$this->total_count.')</span>'; |
|
211 | + $complete_count = ' <span class="count">('.$this->complete_count.')</span>'; |
|
212 | + $cancelled_count = ' <span class="count">('.$this->cancelled_count.')</span>'; |
|
213 | + $pending_count = ' <span class="count">('.$this->pending_count.')</span>'; |
|
214 | + $refunded_count = ' <span class="count">('.$this->refunded_count.')</span>'; |
|
215 | + $failed_count = ' <span class="count">('.$this->failed_count.')</span>'; |
|
216 | + $abandoned_count = ' <span class="count">('.$this->abandoned_count.')</span>'; |
|
217 | + $revoked_count = ' <span class="count">('.$this->revoked_count.')</span>'; |
|
218 | 218 | |
219 | 219 | $views = array( |
220 | - 'all' => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array( |
|
220 | + 'all' => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array( |
|
221 | 221 | 'status', |
222 | 222 | 'paged' |
223 | - ) ), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__( 'All', 'give' ) . $total_count ), |
|
224 | - 'publish' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
223 | + )), $current === 'all' || $current == '' ? ' class="current"' : '', esc_html__('All', 'give').$total_count), |
|
224 | + 'publish' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
225 | 225 | 'status' => 'publish', |
226 | 226 | 'paged' => false |
227 | - ) ) ), $current === 'publish' ? ' class="current"' : '', esc_html__( 'Completed', 'give' ) . $complete_count ), |
|
228 | - 'pending' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
227 | + ))), $current === 'publish' ? ' class="current"' : '', esc_html__('Completed', 'give').$complete_count), |
|
228 | + 'pending' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
229 | 229 | 'status' => 'pending', |
230 | 230 | 'paged' => false |
231 | - ) ) ), $current === 'pending' ? ' class="current"' : '', esc_html__( 'Pending', 'give' ) . $pending_count ), |
|
232 | - 'refunded' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
231 | + ))), $current === 'pending' ? ' class="current"' : '', esc_html__('Pending', 'give').$pending_count), |
|
232 | + 'refunded' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
233 | 233 | 'status' => 'refunded', |
234 | 234 | 'paged' => false |
235 | - ) ) ), $current === 'refunded' ? ' class="current"' : '', esc_html__( 'Refunded', 'give' ) . $refunded_count ), |
|
236 | - 'revoked' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
235 | + ))), $current === 'refunded' ? ' class="current"' : '', esc_html__('Refunded', 'give').$refunded_count), |
|
236 | + 'revoked' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
237 | 237 | 'status' => 'revoked', |
238 | 238 | 'paged' => false |
239 | - ) ) ), $current === 'revoked' ? ' class="current"' : '', esc_html__( 'Revoked', 'give' ) . $revoked_count ), |
|
240 | - 'failed' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
239 | + ))), $current === 'revoked' ? ' class="current"' : '', esc_html__('Revoked', 'give').$revoked_count), |
|
240 | + 'failed' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
241 | 241 | 'status' => 'failed', |
242 | 242 | 'paged' => false |
243 | - ) ) ), $current === 'failed' ? ' class="current"' : '', esc_html__( 'Failed', 'give' ) . $failed_count ), |
|
244 | - 'cancelled' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
243 | + ))), $current === 'failed' ? ' class="current"' : '', esc_html__('Failed', 'give').$failed_count), |
|
244 | + 'cancelled' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
245 | 245 | 'status' => 'cancelled', |
246 | 246 | 'paged' => false |
247 | - ) ) ), $current === 'cancelled' ? ' class="current"' : '', esc_html__( 'Cancelled', 'give' ) . $cancelled_count ), |
|
248 | - 'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
247 | + ))), $current === 'cancelled' ? ' class="current"' : '', esc_html__('Cancelled', 'give').$cancelled_count), |
|
248 | + 'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
249 | 249 | 'status' => 'abandoned', |
250 | 250 | 'paged' => false |
251 | - ) ) ), $current === 'abandoned' ? ' class="current"' : '', esc_html__( 'Abandoned', 'give' ) . $abandoned_count ) |
|
251 | + ))), $current === 'abandoned' ? ' class="current"' : '', esc_html__('Abandoned', 'give').$abandoned_count) |
|
252 | 252 | ); |
253 | 253 | |
254 | - return apply_filters( 'give_payments_table_views', $views ); |
|
254 | + return apply_filters('give_payments_table_views', $views); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
@@ -264,15 +264,15 @@ discard block |
||
264 | 264 | public function get_columns() { |
265 | 265 | $columns = array( |
266 | 266 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
267 | - 'donation' => esc_html__( 'Donation', 'give' ), |
|
268 | - 'donation_form' => esc_html__( 'Donation Form', 'give' ), |
|
269 | - 'status' => esc_html__( 'Status', 'give' ), |
|
270 | - 'date' => esc_html__( 'Date', 'give' ), |
|
271 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
272 | - 'details' => esc_html__( 'Details', 'give' ), |
|
267 | + 'donation' => esc_html__('Donation', 'give'), |
|
268 | + 'donation_form' => esc_html__('Donation Form', 'give'), |
|
269 | + 'status' => esc_html__('Status', 'give'), |
|
270 | + 'date' => esc_html__('Date', 'give'), |
|
271 | + 'amount' => esc_html__('Amount', 'give'), |
|
272 | + 'details' => esc_html__('Details', 'give'), |
|
273 | 273 | ); |
274 | 274 | |
275 | - return apply_filters( 'give_payments_table_columns', $columns ); |
|
275 | + return apply_filters('give_payments_table_columns', $columns); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
@@ -284,12 +284,12 @@ discard block |
||
284 | 284 | */ |
285 | 285 | public function get_sortable_columns() { |
286 | 286 | $columns = array( |
287 | - 'donation' => array( 'ID', true ), |
|
288 | - 'amount' => array( 'amount', false ), |
|
289 | - 'date' => array( 'date', false ) |
|
287 | + 'donation' => array('ID', true), |
|
288 | + 'amount' => array('amount', false), |
|
289 | + 'date' => array('date', false) |
|
290 | 290 | ); |
291 | 291 | |
292 | - return apply_filters( 'give_payments_table_sortable_columns', $columns ); |
|
292 | + return apply_filters('give_payments_table_sortable_columns', $columns); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
@@ -315,59 +315,59 @@ discard block |
||
315 | 315 | * |
316 | 316 | * @return string Column Name |
317 | 317 | */ |
318 | - public function column_default( $payment, $column_name ) { |
|
318 | + public function column_default($payment, $column_name) { |
|
319 | 319 | |
320 | - $single_transaction_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details' ) ) ); |
|
321 | - $row_actions = $this->get_row_actions( $payment ); |
|
320 | + $single_transaction_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details'))); |
|
321 | + $row_actions = $this->get_row_actions($payment); |
|
322 | 322 | |
323 | - switch ( $column_name ) { |
|
323 | + switch ($column_name) { |
|
324 | 324 | case 'donation' : |
325 | 325 | ob_start(); |
326 | 326 | ?> |
327 | 327 | <a href="<?php echo $single_transaction_url; ?>">#<?php echo $payment->ID; ?></a> |
328 | - <?php _e( 'by', 'give' ); ?> <?php echo $this->get_donor( $payment ); ?><br> |
|
329 | - <?php echo $this->get_donor_email( $payment ); ?> |
|
330 | - <?php echo $this->row_actions( $row_actions ); ?> |
|
328 | + <?php _e('by', 'give'); ?> <?php echo $this->get_donor($payment); ?><br> |
|
329 | + <?php echo $this->get_donor_email($payment); ?> |
|
330 | + <?php echo $this->row_actions($row_actions); ?> |
|
331 | 331 | <?php |
332 | 332 | $value = ob_get_clean(); |
333 | 333 | break; |
334 | 334 | |
335 | 335 | case 'amount' : |
336 | - $amount = ! empty( $payment->total ) ? $payment->total : 0; |
|
337 | - $value = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) ); |
|
336 | + $amount = ! empty($payment->total) ? $payment->total : 0; |
|
337 | + $value = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID)); |
|
338 | 338 | break; |
339 | 339 | |
340 | 340 | case 'donation_form' : |
341 | 341 | |
342 | - $value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $payment->form_title . '</a>'; |
|
343 | - $level = give_get_payment_form_title( $payment->meta, true ); |
|
342 | + $value = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$payment->form_title.'</a>'; |
|
343 | + $level = give_get_payment_form_title($payment->meta, true); |
|
344 | 344 | |
345 | - if ( ! empty( $level ) ) { |
|
345 | + if ( ! empty($level)) { |
|
346 | 346 | $value .= $level; |
347 | 347 | } |
348 | 348 | |
349 | 349 | break; |
350 | 350 | |
351 | 351 | case 'date' : |
352 | - $date = strtotime( $payment->date ); |
|
353 | - $value = date_i18n( get_option( 'date_format' ), $date ); |
|
352 | + $date = strtotime($payment->date); |
|
353 | + $value = date_i18n(get_option('date_format'), $date); |
|
354 | 354 | break; |
355 | 355 | |
356 | 356 | case 'status' : |
357 | - $value = $this->get_payment_status( $payment ); |
|
357 | + $value = $this->get_payment_status($payment); |
|
358 | 358 | break; |
359 | 359 | |
360 | 360 | case 'details' : |
361 | - $value = '<div class="give-payment-details-link-wrap"><a href="' . $single_transaction_url . '" data-tooltip="' . __( 'View details', 'give' ) . '" class="give-payment-details-link button button-small" title="' . __( 'View Details', 'give' ) . '"><span class="dashicons dashicons-visibility"></span></a></div>'; |
|
361 | + $value = '<div class="give-payment-details-link-wrap"><a href="'.$single_transaction_url.'" data-tooltip="'.__('View details', 'give').'" class="give-payment-details-link button button-small" title="'.__('View Details', 'give').'"><span class="dashicons dashicons-visibility"></span></a></div>'; |
|
362 | 362 | break; |
363 | 363 | |
364 | 364 | default: |
365 | - $value = isset( $payment->$column_name ) ? $payment->$column_name : ''; |
|
365 | + $value = isset($payment->$column_name) ? $payment->$column_name : ''; |
|
366 | 366 | break; |
367 | 367 | |
368 | 368 | } |
369 | 369 | |
370 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name ); |
|
370 | + return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | /** |
@@ -380,17 +380,17 @@ discard block |
||
380 | 380 | * |
381 | 381 | * @return string Data shown in the Email column |
382 | 382 | */ |
383 | - public function get_donor_email( $payment ) { |
|
383 | + public function get_donor_email($payment) { |
|
384 | 384 | |
385 | - $email = give_get_payment_user_email( $payment->ID ); |
|
385 | + $email = give_get_payment_user_email($payment->ID); |
|
386 | 386 | |
387 | - if ( empty( $email ) ) { |
|
388 | - $email = esc_html__( '(unknown)', 'give' ); |
|
387 | + if (empty($email)) { |
|
388 | + $email = esc_html__('(unknown)', 'give'); |
|
389 | 389 | } |
390 | 390 | |
391 | - $value = '<a href="mailto:' . $email . '" data-tooltip="' . __( 'Email donor', 'give' ) . '">' . $email . '</a>'; |
|
391 | + $value = '<a href="mailto:'.$email.'" data-tooltip="'.__('Email donor', 'give').'">'.$email.'</a>'; |
|
392 | 392 | |
393 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' ); |
|
393 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'email'); |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | /** |
@@ -400,31 +400,31 @@ discard block |
||
400 | 400 | * |
401 | 401 | * @return mixed|void |
402 | 402 | */ |
403 | - function get_row_actions( $payment ) { |
|
403 | + function get_row_actions($payment) { |
|
404 | 404 | |
405 | 405 | $row_actions = array(); |
406 | - $email = give_get_payment_user_email( $payment->ID ); |
|
406 | + $email = give_get_payment_user_email($payment->ID); |
|
407 | 407 | |
408 | 408 | // Add search term string back to base URL |
409 | - $search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' ); |
|
410 | - if ( ! empty( $search_terms ) ) { |
|
411 | - $this->base_url = add_query_arg( 's', $search_terms, $this->base_url ); |
|
409 | + $search_terms = (isset($_GET['s']) ? trim($_GET['s']) : ''); |
|
410 | + if ( ! empty($search_terms)) { |
|
411 | + $this->base_url = add_query_arg('s', $search_terms, $this->base_url); |
|
412 | 412 | } |
413 | 413 | |
414 | - if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) { |
|
415 | - $row_actions['email_links'] = '<a href="' . add_query_arg( array( |
|
414 | + if (give_is_payment_complete($payment->ID) && ! empty($email)) { |
|
415 | + $row_actions['email_links'] = '<a href="'.add_query_arg(array( |
|
416 | 416 | 'give-action' => 'email_links', |
417 | 417 | 'purchase_id' => $payment->ID |
418 | - ), $this->base_url ) . '">' . esc_html__( 'Resend Donation Receipt', 'give' ) . '</a>'; |
|
418 | + ), $this->base_url).'">'.esc_html__('Resend Donation Receipt', 'give').'</a>'; |
|
419 | 419 | |
420 | 420 | } |
421 | 421 | |
422 | - $row_actions['delete'] = '<a href="' . wp_nonce_url( add_query_arg( array( |
|
422 | + $row_actions['delete'] = '<a href="'.wp_nonce_url(add_query_arg(array( |
|
423 | 423 | 'give-action' => 'delete_payment', |
424 | 424 | 'purchase_id' => $payment->ID |
425 | - ), $this->base_url ), 'give_payment_nonce' ) . '">' . esc_html__( 'Delete', 'give' ) . '</a>'; |
|
425 | + ), $this->base_url), 'give_payment_nonce').'">'.esc_html__('Delete', 'give').'</a>'; |
|
426 | 426 | |
427 | - return apply_filters( 'give_payment_row_actions', $row_actions, $payment ); |
|
427 | + return apply_filters('give_payment_row_actions', $row_actions, $payment); |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | /** |
@@ -437,10 +437,10 @@ discard block |
||
437 | 437 | * |
438 | 438 | * @return string Data shown in the Email column |
439 | 439 | */ |
440 | - function get_payment_status( $payment ) { |
|
441 | - $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>'; |
|
442 | - if ( $payment->mode == 'test' ) { |
|
443 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . esc_attr__( 'This payment was made in test mode', 'give' ) . '">' . esc_html__( 'Test', 'give' ) . '</span>'; |
|
440 | + function get_payment_status($payment) { |
|
441 | + $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>'; |
|
442 | + if ($payment->mode == 'test') { |
|
443 | + $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.esc_attr__('This payment was made in test mode', 'give').'">'.esc_html__('Test', 'give').'</span>'; |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | return $value; |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | * |
457 | 457 | * @return string Displays a checkbox |
458 | 458 | */ |
459 | - public function column_cb( $payment ) { |
|
459 | + public function column_cb($payment) { |
|
460 | 460 | return sprintf( |
461 | 461 | '<input type="checkbox" name="%1$s[]" value="%2$s" />', |
462 | 462 | 'payment', |
@@ -474,8 +474,8 @@ discard block |
||
474 | 474 | * |
475 | 475 | * @return string Displays a checkbox |
476 | 476 | */ |
477 | - public function get_payment_id( $payment ) { |
|
478 | - return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>'; |
|
477 | + public function get_payment_id($payment) { |
|
478 | + return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>'; |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | /** |
@@ -488,19 +488,19 @@ discard block |
||
488 | 488 | * |
489 | 489 | * @return string Data shown in the User column |
490 | 490 | */ |
491 | - public function get_donor( $payment ) { |
|
491 | + public function get_donor($payment) { |
|
492 | 492 | |
493 | - $customer_id = give_get_payment_customer_id( $payment->ID ); |
|
493 | + $customer_id = give_get_payment_customer_id($payment->ID); |
|
494 | 494 | |
495 | - if ( ! empty( $customer_id ) ) { |
|
496 | - $customer = new Give_Customer( $customer_id ); |
|
497 | - $value = '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id" ) ) . '">' . $customer->name . '</a>'; |
|
495 | + if ( ! empty($customer_id)) { |
|
496 | + $customer = new Give_Customer($customer_id); |
|
497 | + $value = '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$customer_id")).'">'.$customer->name.'</a>'; |
|
498 | 498 | } else { |
499 | - $email = give_get_payment_user_email( $payment->ID ); |
|
500 | - $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>'; |
|
499 | + $email = give_get_payment_user_email($payment->ID); |
|
500 | + $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>'; |
|
501 | 501 | } |
502 | 502 | |
503 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' ); |
|
503 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor'); |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | /** |
@@ -512,18 +512,18 @@ discard block |
||
512 | 512 | */ |
513 | 513 | public function get_bulk_actions() { |
514 | 514 | $actions = array( |
515 | - 'delete' => esc_html__( 'Delete', 'give' ), |
|
516 | - 'set-status-publish' => esc_html__( 'Set To Completed', 'give' ), |
|
517 | - 'set-status-pending' => esc_html__( 'Set To Pending', 'give' ), |
|
518 | - 'set-status-refunded' => esc_html__( 'Set To Refunded', 'give' ), |
|
519 | - 'set-status-revoked' => esc_html__( 'Set To Revoked', 'give' ), |
|
520 | - 'set-status-failed' => esc_html__( 'Set To Failed', 'give' ), |
|
521 | - 'set-status-cancelled' => esc_html__( 'Set To Cancelled', 'give' ), |
|
522 | - 'set-status-abandoned' => esc_html__( 'Set To Abandoned', 'give' ), |
|
523 | - 'resend-receipt' => esc_html__( 'Resend Email Receipts', 'give' ) |
|
515 | + 'delete' => esc_html__('Delete', 'give'), |
|
516 | + 'set-status-publish' => esc_html__('Set To Completed', 'give'), |
|
517 | + 'set-status-pending' => esc_html__('Set To Pending', 'give'), |
|
518 | + 'set-status-refunded' => esc_html__('Set To Refunded', 'give'), |
|
519 | + 'set-status-revoked' => esc_html__('Set To Revoked', 'give'), |
|
520 | + 'set-status-failed' => esc_html__('Set To Failed', 'give'), |
|
521 | + 'set-status-cancelled' => esc_html__('Set To Cancelled', 'give'), |
|
522 | + 'set-status-abandoned' => esc_html__('Set To Abandoned', 'give'), |
|
523 | + 'resend-receipt' => esc_html__('Resend Email Receipts', 'give') |
|
524 | 524 | ); |
525 | 525 | |
526 | - return apply_filters( 'give_payments_table_bulk_actions', $actions ); |
|
526 | + return apply_filters('give_payments_table_bulk_actions', $actions); |
|
527 | 527 | } |
528 | 528 | |
529 | 529 | /** |
@@ -534,59 +534,59 @@ discard block |
||
534 | 534 | * @return void |
535 | 535 | */ |
536 | 536 | public function process_bulk_action() { |
537 | - $ids = isset( $_GET['payment'] ) ? $_GET['payment'] : false; |
|
537 | + $ids = isset($_GET['payment']) ? $_GET['payment'] : false; |
|
538 | 538 | $action = $this->current_action(); |
539 | 539 | |
540 | - if ( ! is_array( $ids ) ) { |
|
541 | - $ids = array( $ids ); |
|
540 | + if ( ! is_array($ids)) { |
|
541 | + $ids = array($ids); |
|
542 | 542 | } |
543 | 543 | |
544 | - if ( empty( $action ) ) { |
|
544 | + if (empty($action)) { |
|
545 | 545 | return; |
546 | 546 | } |
547 | 547 | |
548 | - foreach ( $ids as $id ) { |
|
548 | + foreach ($ids as $id) { |
|
549 | 549 | |
550 | 550 | // Detect when a bulk action is being triggered... |
551 | - switch ( $this->current_action() ) { |
|
551 | + switch ($this->current_action()) { |
|
552 | 552 | |
553 | 553 | case'delete': |
554 | - give_delete_purchase( $id ); |
|
554 | + give_delete_purchase($id); |
|
555 | 555 | break; |
556 | 556 | |
557 | 557 | case 'set-status-publish': |
558 | - give_update_payment_status( $id, 'publish' ); |
|
558 | + give_update_payment_status($id, 'publish'); |
|
559 | 559 | break; |
560 | 560 | |
561 | 561 | case 'set-status-pending': |
562 | - give_update_payment_status( $id, 'pending' ); |
|
562 | + give_update_payment_status($id, 'pending'); |
|
563 | 563 | break; |
564 | 564 | |
565 | 565 | case 'set-status-refunded': |
566 | - give_update_payment_status( $id, 'refunded' ); |
|
566 | + give_update_payment_status($id, 'refunded'); |
|
567 | 567 | break; |
568 | 568 | case 'set-status-revoked': |
569 | - give_update_payment_status( $id, 'revoked' ); |
|
569 | + give_update_payment_status($id, 'revoked'); |
|
570 | 570 | break; |
571 | 571 | |
572 | 572 | case 'set-status-failed': |
573 | - give_update_payment_status( $id, 'failed' ); |
|
573 | + give_update_payment_status($id, 'failed'); |
|
574 | 574 | break; |
575 | 575 | |
576 | 576 | case 'set-status-cancelled': |
577 | - give_update_payment_status( $id, 'cancelled' ); |
|
577 | + give_update_payment_status($id, 'cancelled'); |
|
578 | 578 | break; |
579 | 579 | |
580 | 580 | case 'set-status-abandoned': |
581 | - give_update_payment_status( $id, 'abandoned' ); |
|
581 | + give_update_payment_status($id, 'abandoned'); |
|
582 | 582 | break; |
583 | 583 | |
584 | 584 | case 'set-status-preapproval': |
585 | - give_update_payment_status( $id, 'preapproval' ); |
|
585 | + give_update_payment_status($id, 'preapproval'); |
|
586 | 586 | break; |
587 | 587 | |
588 | 588 | case 'resend-receipt': |
589 | - give_email_donation_receipt( $id, false ); |
|
589 | + give_email_donation_receipt($id, false); |
|
590 | 590 | break; |
591 | 591 | } |
592 | 592 | |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | * @param int $id The ID of the payment. |
599 | 599 | * @param string $current_action The action that is being triggered. |
600 | 600 | */ |
601 | - do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() ); |
|
601 | + do_action('give_payments_table_do_bulk_action', $id, $this->current_action()); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | } |
@@ -614,27 +614,27 @@ discard block |
||
614 | 614 | |
615 | 615 | $args = array(); |
616 | 616 | |
617 | - if ( isset( $_GET['user'] ) ) { |
|
618 | - $args['user'] = urldecode( $_GET['user'] ); |
|
619 | - } elseif ( isset( $_GET['s'] ) ) { |
|
620 | - $is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false; |
|
621 | - if ( $is_user ) { |
|
622 | - $args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) ); |
|
623 | - unset( $args['s'] ); |
|
617 | + if (isset($_GET['user'])) { |
|
618 | + $args['user'] = urldecode($_GET['user']); |
|
619 | + } elseif (isset($_GET['s'])) { |
|
620 | + $is_user = strpos($_GET['s'], strtolower('user:')) !== false; |
|
621 | + if ($is_user) { |
|
622 | + $args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s'])))); |
|
623 | + unset($args['s']); |
|
624 | 624 | } else { |
625 | - $args['s'] = sanitize_text_field( $_GET['s'] ); |
|
625 | + $args['s'] = sanitize_text_field($_GET['s']); |
|
626 | 626 | } |
627 | 627 | } |
628 | 628 | |
629 | - if ( ! empty( $_GET['start-date'] ) ) { |
|
630 | - $args['start-date'] = urldecode( $_GET['start-date'] ); |
|
629 | + if ( ! empty($_GET['start-date'])) { |
|
630 | + $args['start-date'] = urldecode($_GET['start-date']); |
|
631 | 631 | } |
632 | 632 | |
633 | - if ( ! empty( $_GET['end-date'] ) ) { |
|
634 | - $args['end-date'] = urldecode( $_GET['end-date'] ); |
|
633 | + if ( ! empty($_GET['end-date'])) { |
|
634 | + $args['end-date'] = urldecode($_GET['end-date']); |
|
635 | 635 | } |
636 | 636 | |
637 | - $payment_count = give_count_payments( $args ); |
|
637 | + $payment_count = give_count_payments($args); |
|
638 | 638 | $this->complete_count = $payment_count->publish; |
639 | 639 | $this->pending_count = $payment_count->pending; |
640 | 640 | $this->refunded_count = $payment_count->refunded; |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | $this->cancelled_count = $payment_count->cancelled; |
644 | 644 | $this->abandoned_count = $payment_count->abandoned; |
645 | 645 | |
646 | - foreach ( $payment_count as $count ) { |
|
646 | + foreach ($payment_count as $count) { |
|
647 | 647 | $this->total_count += $count; |
648 | 648 | } |
649 | 649 | } |
@@ -658,26 +658,26 @@ discard block |
||
658 | 658 | public function payments_data() { |
659 | 659 | |
660 | 660 | $per_page = $this->per_page; |
661 | - $orderby = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID'; |
|
662 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
663 | - $user = isset( $_GET['user'] ) ? $_GET['user'] : null; |
|
664 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys(); |
|
665 | - $meta_key = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null; |
|
666 | - $year = isset( $_GET['year'] ) ? $_GET['year'] : null; |
|
667 | - $month = isset( $_GET['m'] ) ? $_GET['m'] : null; |
|
668 | - $day = isset( $_GET['day'] ) ? $_GET['day'] : null; |
|
669 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null; |
|
670 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
671 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date; |
|
672 | - |
|
673 | - if ( ! empty( $search ) ) { |
|
661 | + $orderby = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID'; |
|
662 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
663 | + $user = isset($_GET['user']) ? $_GET['user'] : null; |
|
664 | + $status = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys(); |
|
665 | + $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; |
|
666 | + $year = isset($_GET['year']) ? $_GET['year'] : null; |
|
667 | + $month = isset($_GET['m']) ? $_GET['m'] : null; |
|
668 | + $day = isset($_GET['day']) ? $_GET['day'] : null; |
|
669 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null; |
|
670 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
671 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date; |
|
672 | + |
|
673 | + if ( ! empty($search)) { |
|
674 | 674 | $status = 'any'; // Force all payment statuses when searching |
675 | 675 | } |
676 | 676 | |
677 | 677 | $args = array( |
678 | 678 | 'output' => 'payments', |
679 | 679 | 'number' => $per_page, |
680 | - 'page' => isset( $_GET['paged'] ) ? $_GET['paged'] : null, |
|
680 | + 'page' => isset($_GET['paged']) ? $_GET['paged'] : null, |
|
681 | 681 | 'orderby' => $orderby, |
682 | 682 | 'order' => $order, |
683 | 683 | 'user' => $user, |
@@ -691,14 +691,14 @@ discard block |
||
691 | 691 | 'end_date' => $end_date, |
692 | 692 | ); |
693 | 693 | |
694 | - if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) { |
|
694 | + if (is_string($search) && false !== strpos($search, 'txn:')) { |
|
695 | 695 | |
696 | 696 | $args['search_in_notes'] = true; |
697 | - $args['s'] = trim( str_replace( 'txn:', '', $args['s'] ) ); |
|
697 | + $args['s'] = trim(str_replace('txn:', '', $args['s'])); |
|
698 | 698 | |
699 | 699 | } |
700 | 700 | |
701 | - $p_query = new Give_Payments_Query( $args ); |
|
701 | + $p_query = new Give_Payments_Query($args); |
|
702 | 702 | |
703 | 703 | return $p_query->get_payments(); |
704 | 704 | |
@@ -718,17 +718,17 @@ discard block |
||
718 | 718 | */ |
719 | 719 | public function prepare_items() { |
720 | 720 | |
721 | - wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) ); |
|
721 | + wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's')); |
|
722 | 722 | |
723 | 723 | $columns = $this->get_columns(); |
724 | 724 | $hidden = array(); // No hidden columns |
725 | 725 | $sortable = $this->get_sortable_columns(); |
726 | 726 | $data = $this->payments_data(); |
727 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any'; |
|
727 | + $status = isset($_GET['status']) ? $_GET['status'] : 'any'; |
|
728 | 728 | |
729 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
729 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
730 | 730 | |
731 | - switch ( $status ) { |
|
731 | + switch ($status) { |
|
732 | 732 | case 'publish': |
733 | 733 | $total_items = $this->complete_count; |
734 | 734 | break; |
@@ -755,19 +755,19 @@ discard block |
||
755 | 755 | break; |
756 | 756 | default: |
757 | 757 | // Retrieve the count of the non-default-Give status |
758 | - $count = wp_count_posts( 'give_payment' ); |
|
758 | + $count = wp_count_posts('give_payment'); |
|
759 | 759 | $total_items = $count->{$status}; |
760 | 760 | break; |
761 | 761 | } |
762 | 762 | |
763 | 763 | $this->items = $data; |
764 | 764 | |
765 | - $this->set_pagination_args( array( |
|
765 | + $this->set_pagination_args(array( |
|
766 | 766 | 'total_items' => $total_items, |
767 | 767 | // WE have to calculate the total number of items |
768 | 768 | 'per_page' => $this->per_page, |
769 | 769 | // WE have to determine how many items to show on a page |
770 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
770 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
771 | 771 | // WE have to calculate the total number of pages |
772 | 772 | ) |
773 | 773 | ); |