| @@ -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 | /** | 
| @@ -136,15 +136,15 @@ discard block | ||
| 136 | 136 | // Set parent defaults. | 
| 137 | 137 | parent::__construct( | 
| 138 | 138 | array( | 
| 139 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. | |
| 140 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. | |
| 141 | - 'ajax' => false, // Does this table support ajax? | |
| 139 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. | |
| 140 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. | |
| 141 | + 'ajax' => false, // Does this table support ajax? | |
| 142 | 142 | ) | 
| 143 | 143 | ); | 
| 144 | 144 | |
| 145 | 145 | $this->process_bulk_action(); | 
| 146 | 146 | $this->get_payment_counts(); | 
| 147 | - $this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); | |
| 147 | +		$this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); | |
| 148 | 148 | } | 
| 149 | 149 | |
| 150 | 150 | /** | 
| @@ -153,31 +153,31 @@ discard block | ||
| 153 | 153 | * @return void | 
| 154 | 154 | */ | 
| 155 | 155 |  	public function advanced_filters() { | 
| 156 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; | |
| 157 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null; | |
| 158 | - $status = isset( $_GET['status'] ) ? sanitize_text_field( $_GET['status'] ) : ''; | |
| 159 | - $donor = isset( $_GET['donor'] ) ? sanitize_text_field( $_GET['donor'] ) : ''; | |
| 160 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : ''; | |
| 161 | - $form_id = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0; | |
| 156 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; | |
| 157 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null; | |
| 158 | + $status = isset($_GET['status']) ? sanitize_text_field($_GET['status']) : ''; | |
| 159 | + $donor = isset($_GET['donor']) ? sanitize_text_field($_GET['donor']) : ''; | |
| 160 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : ''; | |
| 161 | + $form_id = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : 0; | |
| 162 | 162 | ?> | 
| 163 | 163 | <div id="give-payment-filters" class="give-filters"> | 
| 164 | - <?php $this->search_box( __( 'Search', 'give' ), 'give-payments' ); ?> | |
| 164 | +			<?php $this->search_box(__('Search', 'give'), 'give-payments'); ?> | |
| 165 | 165 | <div id="give-payment-date-filters"> | 
| 166 | 166 | <div class="give-filter give-filter-half"> | 
| 167 | 167 | <label for="start-date" | 
| 168 | - class="give-start-date-label"><?php _e( 'Start Date', 'give' ); ?></label> | |
| 168 | +						   class="give-start-date-label"><?php _e('Start Date', 'give'); ?></label> | |
| 169 | 169 | <input type="text" id="start-date" name="start-date" class="give_datepicker" | 
| 170 | 170 | value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy" /> | 
| 171 | 171 | </div> | 
| 172 | 172 | <div class="give-filter give-filter-half"> | 
| 173 | - <label for="end-date" class="give-end-date-label"><?php _e( 'End Date', 'give' ); ?></label> | |
| 173 | +					<label for="end-date" class="give-end-date-label"><?php _e('End Date', 'give'); ?></label> | |
| 174 | 174 | <input type="text" id="end-date" name="end-date" class="give_datepicker" | 
| 175 | 175 | value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy" /> | 
| 176 | 176 | </div> | 
| 177 | 177 | </div> | 
| 178 | 178 | <div id="give-payment-form-filter" class="give-filter"> | 
| 179 | 179 | <label for="give-donation-forms-filter" | 
| 180 | - class="give-donation-forms-filter-label"><?php _e( 'Form', 'give' ); ?></label> | |
| 180 | +					   class="give-donation-forms-filter-label"><?php _e('Form', 'give'); ?></label> | |
| 181 | 181 | <?php | 
| 182 | 182 | // Filter Donations by Donation Forms. | 
| 183 | 183 | echo Give()->html->forms_dropdown( | 
| @@ -187,7 +187,7 @@ discard block | ||
| 187 | 187 | 'class' => 'give-donation-forms-filter', | 
| 188 | 188 | 'selected' => $form_id, // Make sure to have $form_id set to 0, if there is no selection. | 
| 189 | 189 | 'chosen' => true, | 
| 190 | - 'number' => - 1, | |
| 190 | + 'number' => -1, | |
| 191 | 191 | ) | 
| 192 | 192 | ); | 
| 193 | 193 | ?> | 
| @@ -199,21 +199,21 @@ discard block | ||
| 199 | 199 | * | 
| 200 | 200 | * @since 1.8.18 | 
| 201 | 201 | */ | 
| 202 | - do_action( 'give_payment_table_advanced_filters' ); | |
| 202 | +			do_action('give_payment_table_advanced_filters'); | |
| 203 | 203 | ?> | 
| 204 | 204 | |
| 205 | - <?php if ( ! empty( $status ) ) : ?> | |
| 206 | - <input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>" /> | |
| 205 | + <?php if ( ! empty($status)) : ?> | |
| 206 | + <input type="hidden" name="status" value="<?php echo esc_attr($status); ?>" /> | |
| 207 | 207 | <?php endif; ?> | 
| 208 | 208 | |
| 209 | 209 | <div class="give-filter"> | 
| 210 | - <?php submit_button( __( 'Apply', 'give' ), 'secondary', '', false ); ?> | |
| 210 | +				<?php submit_button(__('Apply', 'give'), 'secondary', '', false); ?> | |
| 211 | 211 | <?php | 
| 212 | 212 | // Clear active filters button. | 
| 213 | - if ( ! empty( $start_date ) || ! empty( $end_date ) || ! empty( $donor ) || ! empty( $search ) || ! empty( $status ) || ! empty( $form_id ) ) : | |
| 213 | + if ( ! empty($start_date) || ! empty($end_date) || ! empty($donor) || ! empty($search) || ! empty($status) || ! empty($form_id)) : | |
| 214 | 214 | ?> | 
| 215 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" | |
| 216 | - class="button give-clear-filters-button"><?php _e( 'Clear Filters', 'give' ); ?></a> | |
| 215 | +					<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" | |
| 216 | +					   class="button give-clear-filters-button"><?php _e('Clear Filters', 'give'); ?></a> | |
| 217 | 217 | <?php endif; ?> | 
| 218 | 218 | </div> | 
| 219 | 219 | </div> | 
| @@ -232,18 +232,18 @@ discard block | ||
| 232 | 232 | * | 
| 233 | 233 | * @return void | 
| 234 | 234 | */ | 
| 235 | -	public function search_box( $text, $input_id ) { | |
| 236 | -		if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { | |
| 235 | +	public function search_box($text, $input_id) { | |
| 236 | +		if (empty($_REQUEST['s']) && ! $this->has_items()) { | |
| 237 | 237 | return; | 
| 238 | 238 | } | 
| 239 | 239 | |
| 240 | - $input_id = $input_id . '-search-input'; | |
| 240 | + $input_id = $input_id.'-search-input'; | |
| 241 | 241 | |
| 242 | -		if ( ! empty( $_REQUEST['orderby'] ) ) { | |
| 243 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; | |
| 242 | +		if ( ! empty($_REQUEST['orderby'])) { | |
| 243 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; | |
| 244 | 244 | } | 
| 245 | -		if ( ! empty( $_REQUEST['order'] ) ) { | |
| 246 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; | |
| 245 | +		if ( ! empty($_REQUEST['order'])) { | |
| 246 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; | |
| 247 | 247 | } | 
| 248 | 248 | ?> | 
| 249 | 249 | <div class="give-filter give-filter-search" role="search"> | 
| @@ -255,7 +255,7 @@ discard block | ||
| 255 | 255 | * | 
| 256 | 256 | * @since 1.7 | 
| 257 | 257 | */ | 
| 258 | - do_action( 'give_payment_history_search' ); | |
| 258 | +			do_action('give_payment_history_search'); | |
| 259 | 259 | ?> | 
| 260 | 260 | <label class="screen-reader-text" for="<?php echo $input_id; ?>"><?php echo $text; ?>:</label> | 
| 261 | 261 | <input type="search" id="<?php echo $input_id; ?>" name="s" value="<?php _admin_search_query(); ?>" /> | 
| @@ -281,48 +281,48 @@ discard block | ||
| 281 | 281 | */ | 
| 282 | 282 |  	public function get_views() { | 
| 283 | 283 | |
| 284 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : ''; | |
| 284 | + $current = isset($_GET['status']) ? $_GET['status'] : ''; | |
| 285 | 285 | $views = array(); | 
| 286 | 286 | $tabs = array( | 
| 287 | 287 | 'all' => array( | 
| 288 | 288 | 'total_count', | 
| 289 | - __( 'All', 'give' ), | |
| 289 | +				__('All', 'give'), | |
| 290 | 290 | ), | 
| 291 | 291 | 'publish' => array( | 
| 292 | 292 | 'complete_count', | 
| 293 | - __( 'Completed', 'give' ), | |
| 293 | +				__('Completed', 'give'), | |
| 294 | 294 | ), | 
| 295 | 295 | 'pending' => array( | 
| 296 | 296 | 'pending_count', | 
| 297 | - __( 'Pending', 'give' ), | |
| 297 | +				__('Pending', 'give'), | |
| 298 | 298 | ), | 
| 299 | 299 | 'processing' => array( | 
| 300 | 300 | 'processing_count', | 
| 301 | - __( 'Processing', 'give' ), | |
| 301 | +				__('Processing', 'give'), | |
| 302 | 302 | ), | 
| 303 | 303 | 'refunded' => array( | 
| 304 | 304 | 'refunded_count', | 
| 305 | - __( 'Refunded', 'give' ), | |
| 305 | +				__('Refunded', 'give'), | |
| 306 | 306 | ), | 
| 307 | 307 | 'revoked' => array( | 
| 308 | 308 | 'revoked_count', | 
| 309 | - __( 'Revoked', 'give' ), | |
| 309 | +				__('Revoked', 'give'), | |
| 310 | 310 | ), | 
| 311 | 311 | 'failed' => array( | 
| 312 | 312 | 'failed_count', | 
| 313 | - __( 'Failed', 'give' ), | |
| 313 | +				__('Failed', 'give'), | |
| 314 | 314 | ), | 
| 315 | 315 | 'cancelled' => array( | 
| 316 | 316 | 'cancelled_count', | 
| 317 | - __( 'Cancelled', 'give' ), | |
| 317 | +				__('Cancelled', 'give'), | |
| 318 | 318 | ), | 
| 319 | 319 | 'abandoned' => array( | 
| 320 | 320 | 'abandoned_count', | 
| 321 | - __( 'Abandoned', 'give' ), | |
| 321 | +				__('Abandoned', 'give'), | |
| 322 | 322 | ), | 
| 323 | 323 | 'preapproval' => array( | 
| 324 | 324 | 'preapproval_count', | 
| 325 | - __( 'Preapproval Pending', 'give' ), | |
| 325 | +				__('Preapproval Pending', 'give'), | |
| 326 | 326 | ), | 
| 327 | 327 | ); | 
| 328 | 328 | |
| @@ -331,12 +331,12 @@ discard block | ||
| 331 | 331 | * | 
| 332 | 332 | * @since 1.8.18 | 
| 333 | 333 | */ | 
| 334 | - $args = (array) apply_filters( 'give_payments_table_status_remove_query_arg', array( 'paged', '_wpnonce', '_wp_http_referer' ) ); | |
| 334 | +		$args = (array) apply_filters('give_payments_table_status_remove_query_arg', array('paged', '_wpnonce', '_wp_http_referer')); | |
| 335 | 335 | |
| 336 | 336 | // Build URL. | 
| 337 | - $staus_url = remove_query_arg( $args ); | |
| 337 | + $staus_url = remove_query_arg($args); | |
| 338 | 338 | |
| 339 | -		foreach ( $tabs as $key => $tab ) { | |
| 339 | +		foreach ($tabs as $key => $tab) { | |
| 340 | 340 | $count_key = $tab[0]; | 
| 341 | 341 | $name = $tab[1]; | 
| 342 | 342 | $count = $this->$count_key; | 
| @@ -351,16 +351,15 @@ discard block | ||
| 351 | 351 | * | 
| 352 | 352 | * @since 1.8.12 | 
| 353 | 353 | */ | 
| 354 | -			if ( 'all' === $key || $key === $current || apply_filters( 'give_payments_table_show_all_status', 0 < $count, $key, $count ) ) { | |
| 354 | +			if ('all' === $key || $key === $current || apply_filters('give_payments_table_show_all_status', 0 < $count, $key, $count)) { | |
| 355 | 355 | |
| 356 | 356 | $staus_url = 'all' === $key ? | 
| 357 | - add_query_arg( array( 'status' => false ), $staus_url ) : | |
| 358 | - add_query_arg( array( 'status' => $key ), $staus_url ); | |
| 357 | +					add_query_arg(array('status' => false), $staus_url) : add_query_arg(array('status' => $key), $staus_url); | |
| 359 | 358 | |
| 360 | - $views[ $key ] = sprintf( | |
| 359 | + $views[$key] = sprintf( | |
| 361 | 360 | '<a href="%s"%s>%s <span class="count">(%s)</span></a>', | 
| 362 | - esc_url( $staus_url ), | |
| 363 | - ( ( 'all' === $key && empty( $current ) ) ) ? ' class="current"' : ( $current == $key ? 'class="current"' : '' ), | |
| 361 | + esc_url($staus_url), | |
| 362 | +					(('all' === $key && empty($current))) ? ' class="current"' : ($current == $key ? 'class="current"' : ''), | |
| 364 | 363 | $name, | 
| 365 | 364 | $count | 
| 366 | 365 | ); | 
| @@ -375,7 +374,7 @@ discard block | ||
| 375 | 374 | * @param array $views | 
| 376 | 375 | * @param Give_Payment_History_Table | 
| 377 | 376 | */ | 
| 378 | - return apply_filters( 'give_payments_table_views', $views, $this ); | |
| 377 | +		return apply_filters('give_payments_table_views', $views, $this); | |
| 379 | 378 | } | 
| 380 | 379 | |
| 381 | 380 | /** | 
| @@ -389,18 +388,18 @@ discard block | ||
| 389 | 388 |  	public function get_columns() { | 
| 390 | 389 | $columns = array( | 
| 391 | 390 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text. | 
| 392 | - 'donation' => __( 'Donation', 'give' ), | |
| 393 | - 'donation_form' => __( 'Donation Form', 'give' ), | |
| 394 | - 'status' => __( 'Status', 'give' ), | |
| 395 | - 'date' => __( 'Date', 'give' ), | |
| 396 | - 'amount' => __( 'Amount', 'give' ), | |
| 391 | +			'donation'      => __('Donation', 'give'), | |
| 392 | +			'donation_form' => __('Donation Form', 'give'), | |
| 393 | +			'status'        => __('Status', 'give'), | |
| 394 | +			'date'          => __('Date', 'give'), | |
| 395 | +			'amount'        => __('Amount', 'give'), | |
| 397 | 396 | ); | 
| 398 | 397 | |
| 399 | -		if ( current_user_can( 'view_give_payments' ) ) { | |
| 400 | - $columns['details'] = __( 'Details', 'give' ); | |
| 398 | +		if (current_user_can('view_give_payments')) { | |
| 399 | +			$columns['details'] = __('Details', 'give'); | |
| 401 | 400 | } | 
| 402 | 401 | |
| 403 | - return apply_filters( 'give_payments_table_columns', $columns ); | |
| 402 | +		return apply_filters('give_payments_table_columns', $columns); | |
| 404 | 403 | } | 
| 405 | 404 | |
| 406 | 405 | /** | 
| @@ -413,14 +412,14 @@ discard block | ||
| 413 | 412 | */ | 
| 414 | 413 |  	public function get_sortable_columns() { | 
| 415 | 414 | $columns = array( | 
| 416 | - 'donation' => array( 'ID', true ), | |
| 417 | - 'donation_form' => array( 'donation_form', false ), | |
| 418 | - 'status' => array( 'status', false ), | |
| 419 | - 'amount' => array( 'amount', false ), | |
| 420 | - 'date' => array( 'date', false ), | |
| 415 | +			'donation'      => array('ID', true), | |
| 416 | +			'donation_form' => array('donation_form', false), | |
| 417 | +			'status'        => array('status', false), | |
| 418 | +			'amount'        => array('amount', false), | |
| 419 | +			'date'          => array('date', false), | |
| 421 | 420 | ); | 
| 422 | 421 | |
| 423 | - return apply_filters( 'give_payments_table_sortable_columns', $columns ); | |
| 422 | +		return apply_filters('give_payments_table_sortable_columns', $columns); | |
| 424 | 423 | } | 
| 425 | 424 | |
| 426 | 425 | /** | 
| @@ -446,62 +445,62 @@ discard block | ||
| 446 | 445 | * | 
| 447 | 446 | * @return string Column Name | 
| 448 | 447 | */ | 
| 449 | -	public function column_default( $payment, $column_name ) { | |
| 448 | +	public function column_default($payment, $column_name) { | |
| 450 | 449 | |
| 451 | - $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' ) ) ); | |
| 452 | - $row_actions = $this->get_row_actions( $payment ); | |
| 450 | +		$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'))); | |
| 451 | + $row_actions = $this->get_row_actions($payment); | |
| 453 | 452 | $value = ''; | 
| 454 | 453 | |
| 455 | -		switch ( $column_name ) { | |
| 454 | +		switch ($column_name) { | |
| 456 | 455 | case 'donation': | 
| 457 | -				if ( current_user_can( 'view_give_payments' ) ) { | |
| 458 | - $value = sprintf( '<a href="%1$s" data-tooltip="%2$s">#%3$s</a> %4$s %5$s<br>', $single_donation_url, sprintf( __( 'View Donation #%s', 'give' ), $payment->ID ), $payment->ID, __( 'by', 'give' ), $this->get_donor( $payment ) ); | |
| 456 | +				if (current_user_can('view_give_payments')) { | |
| 457 | +					$value = sprintf('<a href="%1$s" data-tooltip="%2$s">#%3$s</a> %4$s %5$s<br>', $single_donation_url, sprintf(__('View Donation #%s', 'give'), $payment->ID), $payment->ID, __('by', 'give'), $this->get_donor($payment)); | |
| 459 | 458 |  				} else { | 
| 460 | - $value = sprintf( '#%1$s ' . __( 'by', 'give' ) . ' %2$s <br/>', $payment->ID, $this->get_donor( $payment ) ); | |
| 459 | +					$value = sprintf('#%1$s '.__('by', 'give').' %2$s <br/>', $payment->ID, $this->get_donor($payment)); | |
| 461 | 460 | } | 
| 462 | - $value .= $this->get_donor_email( $payment ); | |
| 463 | - $value .= $this->row_actions( $row_actions ); | |
| 461 | + $value .= $this->get_donor_email($payment); | |
| 462 | + $value .= $this->row_actions($row_actions); | |
| 464 | 463 | break; | 
| 465 | 464 | |
| 466 | 465 | case 'amount': | 
| 467 | - $amount = ! empty( $payment->total ) ? $payment->total : 0; | |
| 468 | - $value = give_donation_amount( $payment, true ); | |
| 469 | - $value .= sprintf( '<br><small>%1$s %2$s</small>', __( 'via', 'give' ), give_get_gateway_admin_label( $payment->gateway ) ); | |
| 466 | + $amount = ! empty($payment->total) ? $payment->total : 0; | |
| 467 | + $value = give_donation_amount($payment, true); | |
| 468 | +				$value .= sprintf('<br><small>%1$s %2$s</small>', __('via', 'give'), give_get_gateway_admin_label($payment->gateway)); | |
| 470 | 469 | break; | 
| 471 | 470 | |
| 472 | 471 | case 'donation_form': | 
| 473 | - $form_title = empty( $payment->form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $payment->form_id ) : $payment->form_title; | |
| 474 | - $value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $form_title . '</a>'; | |
| 475 | - $level = give_get_payment_form_title( $payment->meta, true ); | |
| 472 | +				$form_title = empty($payment->form_title) ? sprintf(__('Untitled (#%s)', 'give'), $payment->form_id) : $payment->form_title; | |
| 473 | +				$value      = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$form_title.'</a>'; | |
| 474 | + $level = give_get_payment_form_title($payment->meta, true); | |
| 476 | 475 | |
| 477 | -				if ( ! empty( $level ) ) { | |
| 476 | +				if ( ! empty($level)) { | |
| 478 | 477 | $value .= $level; | 
| 479 | 478 | } | 
| 480 | 479 | |
| 481 | 480 | break; | 
| 482 | 481 | |
| 483 | 482 | case 'date': | 
| 484 | - $date = strtotime( $payment->date ); | |
| 485 | - $value = date_i18n( give_date_format(), $date ); | |
| 483 | + $date = strtotime($payment->date); | |
| 484 | + $value = date_i18n(give_date_format(), $date); | |
| 486 | 485 | break; | 
| 487 | 486 | |
| 488 | 487 | case 'status': | 
| 489 | - $value = $this->get_payment_status( $payment ); | |
| 488 | + $value = $this->get_payment_status($payment); | |
| 490 | 489 | break; | 
| 491 | 490 | |
| 492 | 491 | case 'details': | 
| 493 | -				if ( current_user_can( 'view_give_payments' ) ) { | |
| 494 | - $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( __( 'View Donation #%s', 'give' ), $payment->ID ) ); | |
| 492 | +				if (current_user_can('view_give_payments')) { | |
| 493 | +					$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(__('View Donation #%s', 'give'), $payment->ID)); | |
| 495 | 494 | } | 
| 496 | 495 | break; | 
| 497 | 496 | |
| 498 | 497 | default: | 
| 499 | - $value = isset( $payment->$column_name ) ? $payment->$column_name : ''; | |
| 498 | + $value = isset($payment->$column_name) ? $payment->$column_name : ''; | |
| 500 | 499 | break; | 
| 501 | 500 | |
| 502 | 501 | }// End switch(). | 
| 503 | 502 | |
| 504 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name ); | |
| 503 | +		return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); | |
| 505 | 504 | } | 
| 506 | 505 | |
| 507 | 506 | /** | 
| @@ -514,17 +513,17 @@ discard block | ||
| 514 | 513 | * | 
| 515 | 514 | * @return string Data shown in the Email column | 
| 516 | 515 | */ | 
| 517 | -	public function get_donor_email( $payment ) { | |
| 516 | +	public function get_donor_email($payment) { | |
| 518 | 517 | |
| 519 | - $email = give_get_payment_user_email( $payment->ID ); | |
| 518 | + $email = give_get_payment_user_email($payment->ID); | |
| 520 | 519 | |
| 521 | -		if ( empty( $email ) ) { | |
| 522 | - $email = __( '(unknown)', 'give' ); | |
| 520 | +		if (empty($email)) { | |
| 521 | +			$email = __('(unknown)', 'give'); | |
| 523 | 522 | } | 
| 524 | 523 | |
| 525 | - $value = '<a href="mailto:' . $email . '" data-tooltip="' . __( 'Email donor', 'give' ) . '">' . $email . '</a>'; | |
| 524 | +		$value = '<a href="mailto:'.$email.'" data-tooltip="'.__('Email donor', 'give').'">'.$email.'</a>'; | |
| 526 | 525 | |
| 527 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' ); | |
| 526 | +		return apply_filters('give_payments_table_column', $value, $payment->ID, 'email'); | |
| 528 | 527 | } | 
| 529 | 528 | |
| 530 | 529 | /** | 
| @@ -536,18 +535,18 @@ discard block | ||
| 536 | 535 | * | 
| 537 | 536 | * @return array $actions | 
| 538 | 537 | */ | 
| 539 | -	function get_row_actions( $payment ) { | |
| 538 | +	function get_row_actions($payment) { | |
| 540 | 539 | |
| 541 | 540 | $actions = array(); | 
| 542 | - $email = give_get_payment_user_email( $payment->ID ); | |
| 541 | + $email = give_get_payment_user_email($payment->ID); | |
| 543 | 542 | |
| 544 | 543 | // Add search term string back to base URL. | 
| 545 | - $search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' ); | |
| 546 | -		if ( ! empty( $search_terms ) ) { | |
| 547 | - $this->base_url = add_query_arg( 's', $search_terms, $this->base_url ); | |
| 544 | + $search_terms = (isset($_GET['s']) ? trim($_GET['s']) : ''); | |
| 545 | +		if ( ! empty($search_terms)) { | |
| 546 | +			$this->base_url = add_query_arg('s', $search_terms, $this->base_url); | |
| 548 | 547 | } | 
| 549 | 548 | |
| 550 | -		if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) { | |
| 549 | +		if (give_is_payment_complete($payment->ID) && ! empty($email)) { | |
| 551 | 550 | |
| 552 | 551 | $actions['email_links'] = sprintf( | 
| 553 | 552 | '<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( | 
| @@ -557,12 +556,12 @@ discard block | ||
| 557 | 556 | 'purchase_id' => $payment->ID, | 
| 558 | 557 | ), $this->base_url | 
| 559 | 558 | ), 'give_payment_nonce' | 
| 560 | - ), sprintf( __( 'Resend Donation %s Receipt', 'give' ), $payment->ID ), __( 'Resend Receipt', 'give' ) | |
| 559 | +				), sprintf(__('Resend Donation %s Receipt', 'give'), $payment->ID), __('Resend Receipt', 'give') | |
| 561 | 560 | ); | 
| 562 | 561 | |
| 563 | 562 | } | 
| 564 | 563 | |
| 565 | -		if ( current_user_can( 'view_give_payments' ) ) { | |
| 564 | +		if (current_user_can('view_give_payments')) { | |
| 566 | 565 | $actions['delete'] = sprintf( | 
| 567 | 566 | '<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( | 
| 568 | 567 | add_query_arg( | 
| @@ -571,11 +570,11 @@ discard block | ||
| 571 | 570 | 'purchase_id' => $payment->ID, | 
| 572 | 571 | ), $this->base_url | 
| 573 | 572 | ), 'give_donation_nonce' | 
| 574 | - ), sprintf( __( 'Delete Donation %s', 'give' ), $payment->ID ), __( 'Delete', 'give' ) | |
| 573 | +				), sprintf(__('Delete Donation %s', 'give'), $payment->ID), __('Delete', 'give') | |
| 575 | 574 | ); | 
| 576 | 575 | } | 
| 577 | 576 | |
| 578 | - return apply_filters( 'give_payment_row_actions', $actions, $payment ); | |
| 577 | +		return apply_filters('give_payment_row_actions', $actions, $payment); | |
| 579 | 578 | } | 
| 580 | 579 | |
| 581 | 580 | |
| @@ -589,14 +588,14 @@ discard block | ||
| 589 | 588 | * | 
| 590 | 589 | * @return string Data shown in the Email column | 
| 591 | 590 | */ | 
| 592 | -	function get_payment_status( $payment ) { | |
| 593 | - $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>'; | |
| 594 | -		if ( 'test' === $payment->mode ) { | |
| 595 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . __( 'This donation was made in test mode.', 'give' ) . '">' . __( 'Test', 'give' ) . '</span>'; | |
| 591 | +	function get_payment_status($payment) { | |
| 592 | + $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>'; | |
| 593 | +		if ('test' === $payment->mode) { | |
| 594 | +			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.__('This donation was made in test mode.', 'give').'">'.__('Test', 'give').'</span>'; | |
| 596 | 595 | } | 
| 597 | 596 | |
| 598 | -		if ( true === $payment->import && true === (bool) apply_filters( 'give_payment_show_importer_label', false ) ) { | |
| 599 | - $value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="' . __( 'This donation was imported.', 'give' ) . '">' . __( 'Import', 'give' ) . '</span>'; | |
| 597 | +		if (true === $payment->import && true === (bool) apply_filters('give_payment_show_importer_label', false)) { | |
| 598 | +			$value .= ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="'.__('This donation was imported.', 'give').'">'.__('Import', 'give').'</span>'; | |
| 600 | 599 | } | 
| 601 | 600 | |
| 602 | 601 | return $value; | 
| @@ -612,8 +611,8 @@ discard block | ||
| 612 | 611 | * | 
| 613 | 612 | * @return string Displays a checkbox. | 
| 614 | 613 | */ | 
| 615 | -	public function column_cb( $payment ) { | |
| 616 | - return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID ); | |
| 614 | +	public function column_cb($payment) { | |
| 615 | +		return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID); | |
| 617 | 616 | } | 
| 618 | 617 | |
| 619 | 618 | /** | 
| @@ -625,8 +624,8 @@ discard block | ||
| 625 | 624 | * | 
| 626 | 625 | * @return string Displays a checkbox. | 
| 627 | 626 | */ | 
| 628 | -	public function get_payment_id( $payment ) { | |
| 629 | - return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>'; | |
| 627 | +	public function get_payment_id($payment) { | |
| 628 | + return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>'; | |
| 630 | 629 | } | 
| 631 | 630 | |
| 632 | 631 | /** | 
| @@ -639,32 +638,32 @@ discard block | ||
| 639 | 638 | * | 
| 640 | 639 | * @return string Data shown in the User column | 
| 641 | 640 | */ | 
| 642 | -	public function get_donor( $payment ) { | |
| 641 | +	public function get_donor($payment) { | |
| 643 | 642 | |
| 644 | - $donor_id = give_get_payment_donor_id( $payment->ID ); | |
| 645 | - $donor_billing_name = give_get_donor_name_by( $payment->ID, 'donation' ); | |
| 646 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); | |
| 643 | + $donor_id = give_get_payment_donor_id($payment->ID); | |
| 644 | + $donor_billing_name = give_get_donor_name_by($payment->ID, 'donation'); | |
| 645 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); | |
| 647 | 646 | |
| 648 | 647 | $value = ''; | 
| 649 | -		if ( ! empty( $donor_id ) ) { | |
| 648 | +		if ( ! empty($donor_id)) { | |
| 650 | 649 | |
| 651 | 650 | // Check whether the donor name and WP_User name is same or not. | 
| 652 | -			if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) { | |
| 653 | -				$value .= $donor_billing_name . ' ('; | |
| 651 | +			if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { | |
| 652 | +				$value .= $donor_billing_name.' ('; | |
| 654 | 653 | } | 
| 655 | 654 | |
| 656 | - $value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>'; | |
| 655 | +			$value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>'; | |
| 657 | 656 | |
| 658 | 657 | // Check whether the donor name and WP_User name is same or not. | 
| 659 | -			if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) { | |
| 658 | +			if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { | |
| 660 | 659 | $value .= ')'; | 
| 661 | 660 | } | 
| 662 | 661 |  		} else { | 
| 663 | - $email = give_get_payment_user_email( $payment->ID ); | |
| 664 | - $value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . __( '(donor missing)', 'give' ) . '</a>'; | |
| 662 | + $email = give_get_payment_user_email($payment->ID); | |
| 663 | +			$value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.__('(donor missing)', 'give').'</a>'; | |
| 665 | 664 | } | 
| 666 | 665 | |
| 667 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' ); | |
| 666 | +		return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor'); | |
| 668 | 667 | } | 
| 669 | 668 | |
| 670 | 669 | /** | 
| @@ -677,20 +676,20 @@ discard block | ||
| 677 | 676 | */ | 
| 678 | 677 |  	public function get_bulk_actions() { | 
| 679 | 678 | $actions = array( | 
| 680 | - 'delete' => __( 'Delete', 'give' ), | |
| 681 | - 'set-status-publish' => __( 'Set To Completed', 'give' ), | |
| 682 | - 'set-status-pending' => __( 'Set To Pending', 'give' ), | |
| 683 | - 'set-status-processing' => __( 'Set To Processing', 'give' ), | |
| 684 | - 'set-status-refunded' => __( 'Set To Refunded', 'give' ), | |
| 685 | - 'set-status-revoked' => __( 'Set To Revoked', 'give' ), | |
| 686 | - 'set-status-failed' => __( 'Set To Failed', 'give' ), | |
| 687 | - 'set-status-cancelled' => __( 'Set To Cancelled', 'give' ), | |
| 688 | - 'set-status-abandoned' => __( 'Set To Abandoned', 'give' ), | |
| 689 | - 'set-status-preapproval' => __( 'Set To Preapproval', 'give' ), | |
| 690 | - 'resend-receipt' => __( 'Resend Email Receipts', 'give' ), | |
| 679 | +			'delete'                 => __('Delete', 'give'), | |
| 680 | +			'set-status-publish'     => __('Set To Completed', 'give'), | |
| 681 | +			'set-status-pending'     => __('Set To Pending', 'give'), | |
| 682 | +			'set-status-processing'  => __('Set To Processing', 'give'), | |
| 683 | +			'set-status-refunded'    => __('Set To Refunded', 'give'), | |
| 684 | +			'set-status-revoked'     => __('Set To Revoked', 'give'), | |
| 685 | +			'set-status-failed'      => __('Set To Failed', 'give'), | |
| 686 | +			'set-status-cancelled'   => __('Set To Cancelled', 'give'), | |
| 687 | +			'set-status-abandoned'   => __('Set To Abandoned', 'give'), | |
| 688 | +			'set-status-preapproval' => __('Set To Preapproval', 'give'), | |
| 689 | +			'resend-receipt'         => __('Resend Email Receipts', 'give'), | |
| 691 | 690 | ); | 
| 692 | 691 | |
| 693 | - return apply_filters( 'give_payments_table_bulk_actions', $actions ); | |
| 692 | +		return apply_filters('give_payments_table_bulk_actions', $actions); | |
| 694 | 693 | } | 
| 695 | 694 | |
| 696 | 695 | /** | 
| @@ -702,63 +701,63 @@ discard block | ||
| 702 | 701 | * @return void | 
| 703 | 702 | */ | 
| 704 | 703 |  	public function process_bulk_action() { | 
| 705 | - $ids = isset( $_GET['payment'] ) ? $_GET['payment'] : false; | |
| 704 | + $ids = isset($_GET['payment']) ? $_GET['payment'] : false; | |
| 706 | 705 | $action = $this->current_action(); | 
| 707 | 706 | |
| 708 | -		if ( ! is_array( $ids ) ) { | |
| 709 | - $ids = array( $ids ); | |
| 707 | +		if ( ! is_array($ids)) { | |
| 708 | + $ids = array($ids); | |
| 710 | 709 | } | 
| 711 | 710 | |
| 712 | -		if ( empty( $action ) ) { | |
| 711 | +		if (empty($action)) { | |
| 713 | 712 | return; | 
| 714 | 713 | } | 
| 715 | 714 | |
| 716 | -		foreach ( $ids as $id ) { | |
| 715 | +		foreach ($ids as $id) { | |
| 717 | 716 | |
| 718 | 717 | // Detect when a bulk action is being triggered. | 
| 719 | -			switch ( $this->current_action() ) { | |
| 718 | +			switch ($this->current_action()) { | |
| 720 | 719 | |
| 721 | 720 | case 'delete': | 
| 722 | - give_delete_donation( $id ); | |
| 721 | + give_delete_donation($id); | |
| 723 | 722 | break; | 
| 724 | 723 | |
| 725 | 724 | case 'set-status-publish': | 
| 726 | - give_update_payment_status( $id, 'publish' ); | |
| 725 | + give_update_payment_status($id, 'publish'); | |
| 727 | 726 | break; | 
| 728 | 727 | |
| 729 | 728 | case 'set-status-pending': | 
| 730 | - give_update_payment_status( $id, 'pending' ); | |
| 729 | + give_update_payment_status($id, 'pending'); | |
| 731 | 730 | break; | 
| 732 | 731 | |
| 733 | 732 | case 'set-status-processing': | 
| 734 | - give_update_payment_status( $id, 'processing' ); | |
| 733 | + give_update_payment_status($id, 'processing'); | |
| 735 | 734 | break; | 
| 736 | 735 | |
| 737 | 736 | case 'set-status-refunded': | 
| 738 | - give_update_payment_status( $id, 'refunded' ); | |
| 737 | + give_update_payment_status($id, 'refunded'); | |
| 739 | 738 | break; | 
| 740 | 739 | case 'set-status-revoked': | 
| 741 | - give_update_payment_status( $id, 'revoked' ); | |
| 740 | + give_update_payment_status($id, 'revoked'); | |
| 742 | 741 | break; | 
| 743 | 742 | |
| 744 | 743 | case 'set-status-failed': | 
| 745 | - give_update_payment_status( $id, 'failed' ); | |
| 744 | + give_update_payment_status($id, 'failed'); | |
| 746 | 745 | break; | 
| 747 | 746 | |
| 748 | 747 | case 'set-status-cancelled': | 
| 749 | - give_update_payment_status( $id, 'cancelled' ); | |
| 748 | + give_update_payment_status($id, 'cancelled'); | |
| 750 | 749 | break; | 
| 751 | 750 | |
| 752 | 751 | case 'set-status-abandoned': | 
| 753 | - give_update_payment_status( $id, 'abandoned' ); | |
| 752 | + give_update_payment_status($id, 'abandoned'); | |
| 754 | 753 | break; | 
| 755 | 754 | |
| 756 | 755 | case 'set-status-preapproval': | 
| 757 | - give_update_payment_status( $id, 'preapproval' ); | |
| 756 | + give_update_payment_status($id, 'preapproval'); | |
| 758 | 757 | break; | 
| 759 | 758 | |
| 760 | 759 | case 'resend-receipt': | 
| 761 | - give_email_donation_receipt( $id, false ); | |
| 760 | + give_email_donation_receipt($id, false); | |
| 762 | 761 | break; | 
| 763 | 762 | }// End switch(). | 
| 764 | 763 | |
| @@ -770,7 +769,7 @@ discard block | ||
| 770 | 769 | * | 
| 771 | 770 | * @since 1.7 | 
| 772 | 771 | */ | 
| 773 | - do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() ); | |
| 772 | +			do_action('give_payments_table_do_bulk_action', $id, $this->current_action()); | |
| 774 | 773 | }// End foreach(). | 
| 775 | 774 | |
| 776 | 775 | } | 
| @@ -787,32 +786,32 @@ discard block | ||
| 787 | 786 | |
| 788 | 787 | $args = array(); | 
| 789 | 788 | |
| 790 | -		if ( isset( $_GET['user'] ) ) { | |
| 791 | - $args['user'] = urldecode( $_GET['user'] ); | |
| 792 | -		} elseif ( isset( $_GET['donor'] ) ) { | |
| 793 | - $args['donor'] = absint( $_GET['donor'] ); | |
| 794 | -		} elseif ( isset( $_GET['s'] ) ) { | |
| 795 | - $is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false; | |
| 796 | -			if ( $is_user ) { | |
| 797 | - $args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) ); | |
| 798 | - unset( $args['s'] ); | |
| 789 | +		if (isset($_GET['user'])) { | |
| 790 | + $args['user'] = urldecode($_GET['user']); | |
| 791 | +		} elseif (isset($_GET['donor'])) { | |
| 792 | + $args['donor'] = absint($_GET['donor']); | |
| 793 | +		} elseif (isset($_GET['s'])) { | |
| 794 | +			$is_user = strpos($_GET['s'], strtolower('user:')) !== false; | |
| 795 | +			if ($is_user) { | |
| 796 | +				$args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s'])))); | |
| 797 | + unset($args['s']); | |
| 799 | 798 |  			} else { | 
| 800 | - $args['s'] = sanitize_text_field( $_GET['s'] ); | |
| 799 | + $args['s'] = sanitize_text_field($_GET['s']); | |
| 801 | 800 | } | 
| 802 | 801 | } | 
| 803 | 802 | |
| 804 | -		if ( ! empty( $_GET['start-date'] ) ) { | |
| 805 | - $args['start-date'] = urldecode( $_GET['start-date'] ); | |
| 803 | +		if ( ! empty($_GET['start-date'])) { | |
| 804 | + $args['start-date'] = urldecode($_GET['start-date']); | |
| 806 | 805 | } | 
| 807 | 806 | |
| 808 | -		if ( ! empty( $_GET['end-date'] ) ) { | |
| 809 | - $args['end-date'] = urldecode( $_GET['end-date'] ); | |
| 807 | +		if ( ! empty($_GET['end-date'])) { | |
| 808 | + $args['end-date'] = urldecode($_GET['end-date']); | |
| 810 | 809 | } | 
| 811 | 810 | |
| 812 | - $args['form_id'] = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null; | |
| 813 | - $args['gateway'] = ! empty( $_GET['gateway'] ) ? give_clean( $_GET['gateway'] ) : null; | |
| 811 | + $args['form_id'] = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null; | |
| 812 | + $args['gateway'] = ! empty($_GET['gateway']) ? give_clean($_GET['gateway']) : null; | |
| 814 | 813 | |
| 815 | - $payment_count = give_count_payments( $args ); | |
| 814 | + $payment_count = give_count_payments($args); | |
| 816 | 815 | $this->complete_count = $payment_count->publish; | 
| 817 | 816 | $this->pending_count = $payment_count->pending; | 
| 818 | 817 | $this->processing_count = $payment_count->processing; | 
| @@ -823,7 +822,7 @@ discard block | ||
| 823 | 822 | $this->abandoned_count = $payment_count->abandoned; | 
| 824 | 823 | $this->preapproval_count = $payment_count->preapproval; | 
| 825 | 824 | |
| 826 | -		foreach ( $payment_count as $count ) { | |
| 825 | +		foreach ($payment_count as $count) { | |
| 827 | 826 | $this->total_count += $count; | 
| 828 | 827 | } | 
| 829 | 828 | |
| @@ -841,29 +840,29 @@ discard block | ||
| 841 | 840 |  	public function payments_data() { | 
| 842 | 841 | |
| 843 | 842 | $per_page = $this->per_page; | 
| 844 | - $orderby = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID'; | |
| 845 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; | |
| 846 | - $user = isset( $_GET['user'] ) ? $_GET['user'] : null; | |
| 847 | - $donor = isset( $_GET['donor'] ) ? $_GET['donor'] : null; | |
| 848 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys(); | |
| 849 | - $meta_key = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null; | |
| 850 | - $year = isset( $_GET['year'] ) ? $_GET['year'] : null; | |
| 851 | - $month = isset( $_GET['m'] ) ? $_GET['m'] : null; | |
| 852 | - $day = isset( $_GET['day'] ) ? $_GET['day'] : null; | |
| 853 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null; | |
| 854 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; | |
| 855 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date; | |
| 856 | - $form_id = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null; | |
| 857 | - $gateway = ! empty( $_GET['gateway'] ) ? give_clean( $_GET['gateway'] ) : null; | |
| 858 | - | |
| 859 | -		if ( ! empty( $search ) ) { | |
| 843 | + $orderby = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID'; | |
| 844 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; | |
| 845 | + $user = isset($_GET['user']) ? $_GET['user'] : null; | |
| 846 | + $donor = isset($_GET['donor']) ? $_GET['donor'] : null; | |
| 847 | + $status = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys(); | |
| 848 | + $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; | |
| 849 | + $year = isset($_GET['year']) ? $_GET['year'] : null; | |
| 850 | + $month = isset($_GET['m']) ? $_GET['m'] : null; | |
| 851 | + $day = isset($_GET['day']) ? $_GET['day'] : null; | |
| 852 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null; | |
| 853 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; | |
| 854 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date; | |
| 855 | + $form_id = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null; | |
| 856 | + $gateway = ! empty($_GET['gateway']) ? give_clean($_GET['gateway']) : null; | |
| 857 | + | |
| 858 | +		if ( ! empty($search)) { | |
| 860 | 859 | $status = 'any'; // Force all payment statuses when searching. | 
| 861 | 860 | } | 
| 862 | 861 | |
| 863 | 862 | $args = array( | 
| 864 | 863 | 'output' => 'payments', | 
| 865 | 864 | 'number' => $per_page, | 
| 866 | - 'page' => isset( $_GET['paged'] ) ? $_GET['paged'] : null, | |
| 865 | + 'page' => isset($_GET['paged']) ? $_GET['paged'] : null, | |
| 867 | 866 | 'orderby' => $orderby, | 
| 868 | 867 | 'order' => $order, | 
| 869 | 868 | 'user' => $user, | 
| @@ -880,9 +879,9 @@ discard block | ||
| 880 | 879 | 'give_forms' => $form_id, | 
| 881 | 880 | ); | 
| 882 | 881 | |
| 883 | -		if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) { | |
| 882 | +		if (is_string($search) && false !== strpos($search, 'txn:')) { | |
| 884 | 883 | $args['search_in_notes'] = true; | 
| 885 | - $args['s'] = trim( str_replace( 'txn:', '', $args['s'] ) ); | |
| 884 | +			$args['s']               = trim(str_replace('txn:', '', $args['s'])); | |
| 886 | 885 | } | 
| 887 | 886 | |
| 888 | 887 | /** | 
| @@ -890,9 +889,9 @@ discard block | ||
| 890 | 889 | * | 
| 891 | 890 | * @since 1.8.18 | 
| 892 | 891 | */ | 
| 893 | - $args = (array) apply_filters( 'give_payment_table_payments_query', $args ); | |
| 892 | +		$args = (array) apply_filters('give_payment_table_payments_query', $args); | |
| 894 | 893 | |
| 895 | - $p_query = new Give_Payments_Query( $args ); | |
| 894 | + $p_query = new Give_Payments_Query($args); | |
| 896 | 895 | |
| 897 | 896 | return $p_query->get_payments(); | 
| 898 | 897 | |
| @@ -913,17 +912,17 @@ discard block | ||
| 913 | 912 | */ | 
| 914 | 913 |  	public function prepare_items() { | 
| 915 | 914 | |
| 916 | - wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) ); | |
| 915 | +		wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's')); | |
| 917 | 916 | |
| 918 | 917 | $columns = $this->get_columns(); | 
| 919 | 918 | $hidden = array(); // No hidden columns. | 
| 920 | 919 | $sortable = $this->get_sortable_columns(); | 
| 921 | 920 | $data = $this->payments_data(); | 
| 922 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any'; | |
| 921 | + $status = isset($_GET['status']) ? $_GET['status'] : 'any'; | |
| 923 | 922 | |
| 924 | - $this->_column_headers = array( $columns, $hidden, $sortable ); | |
| 923 | + $this->_column_headers = array($columns, $hidden, $sortable); | |
| 925 | 924 | |
| 926 | -		switch ( $status ) { | |
| 925 | +		switch ($status) { | |
| 927 | 926 | case 'publish': | 
| 928 | 927 | $total_items = $this->complete_count; | 
| 929 | 928 | break; | 
| @@ -956,8 +955,8 @@ discard block | ||
| 956 | 955 | break; | 
| 957 | 956 | default: | 
| 958 | 957 | // Retrieve the count of the non-default-Give status. | 
| 959 | - $count = wp_count_posts( 'give_payment' ); | |
| 960 | -				$total_items = isset( $count->{$status} ) ? $count->{$status} : 0; | |
| 958 | +				$count       = wp_count_posts('give_payment'); | |
| 959 | +				$total_items = isset($count->{$status} ) ? $count->{$status} : 0; | |
| 961 | 960 | break; | 
| 962 | 961 | } | 
| 963 | 962 | |
| @@ -968,7 +967,7 @@ discard block | ||
| 968 | 967 | * | 
| 969 | 968 | * @since 1.8.19 | 
| 970 | 969 | */ | 
| 971 | - $total_items = (int) apply_filters( 'give_payment_table_pagination_total_count', $total_items, $this ); | |
| 970 | +		$total_items = (int) apply_filters('give_payment_table_pagination_total_count', $total_items, $this); | |
| 972 | 971 | |
| 973 | 972 | $this->set_pagination_args( | 
| 974 | 973 | array( | 
| @@ -976,7 +975,7 @@ discard block | ||
| 976 | 975 | // We have to calculate the total number of items. | 
| 977 | 976 | 'per_page' => $this->per_page, | 
| 978 | 977 | // We have to determine how many items to show on a page. | 
| 979 | - 'total_pages' => ceil( $total_items / $this->per_page ), | |
| 978 | + 'total_pages' => ceil($total_items / $this->per_page), | |
| 980 | 979 | // We have to calculate the total number of pages. | 
| 981 | 980 | ) | 
| 982 | 981 | ); |