PluginProbe
Order Tracking – WordPress Status Tracking Plugin / 3.2.2
Order Tracking – WordPress Status Tracking Plugin v3.2.2
3.5.4 3.5.3 3.5.2 3.5.1 3.5.0 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.3.0 3.3.1 3.3.10 3.3.11 3.3.12 3.3.13 3.3.14 3.3.15 All 235 releases
order-tracking / includes / WP_List_Table.SalesRepsTable.class.php

WP_List_Table.SalesRepsTable.class.php in Order Tracking – WordPress Status Tracking Plugin 3.2.2, at includes/WP_List_Table.SalesRepsTable.class.php

662 lines 19.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) exit;
3
4 if ( ! class_exists( 'WP_List_Table' ) ) {
5 require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
6 }
7
8 if ( !class_exists( 'ewdotpSalesRepsTable' ) ) {
9 /**
10 * SalesReps Table Class
11 *
12 * Extends WP_List_Table to display the list of sales reps in a format similar to
13 * the default WordPress post tables.
14 *
15 * @h/t Easy Digital Downloads by Pippin: https://easydigitaldownloads.com/
16 * @since 3.0.0
17 */
18 class ewdotpSalesRepsTable extends WP_List_Table {
19
20 /**
21 * Number of results to show per page
22 *
23 * @var string
24 * @since 3.0.0
25 */
26 public $per_page = 30;
27
28 /**
29 * URL of this page
30 *
31 * @var string
32 * @since 3.0.0
33 */
34 public $base_url;
35
36 /**
37 * Array of sales rep counts by total and status
38 *
39 * @var array
40 * @since 3.0.0
41 */
42 public $sales_rep_counts;
43
44 /**
45 * Array of sales reps
46 *
47 * @var array
48 * @since 3.0.0
49 */
50 public $sales_reps;
51
52 /**
53 * Current sales rep first name
54 *
55 * @var int
56 * @since 1.6
57 */
58 public $filter_sales_rep_first_name = '';
59
60 /**
61 * Current sales rep last name
62 *
63 * @var int
64 * @since 1.6
65 */
66 public $filter_sales_rep_last_name = '';
67
68 /**
69 * Current sales rep email
70 *
71 * @var int
72 * @since 1.6
73 */
74 public $filter_sales_rep_email = '';
75
76 /**
77 * Current query string
78 *
79 * @var string
80 * @since 3.0.0
81 */
82 public $query_string;
83
84 /**
85 * Results of a bulk or quick action
86 *
87 * @var array
88 * @since 1.4.6
89 */
90 public $action_result = array();
91
92 /**
93 * Type of bulk or quick action last performed
94 *
95 * @var string
96 * @since 1.4.6
97 */
98 public $last_action = '';
99
100 /**
101 * Stored reference to visible columns
102 *
103 * @var string
104 * @since 3.0.0
105 */
106 public $visible_columns = array();
107
108 /**
109 * Initialize the table and perform any requested actions
110 *
111 * @since 3.0.0
112 */
113 public function __construct() {
114
115 global $status, $page;
116
117 // Set parent defaults
118 parent::__construct( array(
119 'singular' => __( 'Sales Rep', 'order-tracking' ),
120 'plural' => __( 'Sales Reps', 'order-tracking' ),
121 'ajax' => false
122 ) );
123
124 // Strip unwanted query vars from the query string or ensure the correct
125 // vars are used
126 $this->query_string_maintenance();
127
128 // Run any bulk action requests
129 $this->process_bulk_action();
130
131 // Retrieve a count of the number of sales reps by status
132 $this->get_sales_rep_counts();
133
134 // Retrieve sales reps data for the table
135 $this->sales_reps_data();
136
137 $this->base_url = admin_url( 'admin.php?page=ewd-otp-sales-reps' );
138 }
139
140 /**
141 * Strip unwanted query vars from the query string or ensure the correct
142 * vars are passed around and those we don't want to preserve are discarded.
143 *
144 * @since 3.0.0
145 */
146 public function query_string_maintenance() {
147
148 $this->query_string = remove_query_arg( array( 'action', 'start_date', 'end_date' ) );
149
150 $this->filter_sales_rep_number = ! isset( $_GET['sales_rep_number'] ) ? '' : sanitize_text_field( $_GET['sales_rep_number'] );
151 $this->filter_sales_rep_number = ! isset( $_POST['sales_rep_number'] ) ? $this->filter_sales_rep_number : sanitize_text_field( $_POST['sales_rep_number'] );
152 $this->query_string = remove_query_arg( 'sales_rep_number', $this->query_string );
153 if ( !empty( $this->filter_sales_rep_number ) ) {
154 $this->query_string = add_query_arg( array( 'sales_rep_number' => $this->filter_sales_rep_number ), $this->query_string );
155 }
156
157 $this->filter_sales_rep_first_name = ! isset( $_GET['sales_rep_first_name'] ) ? '' : sanitize_text_field( $_GET['sales_rep_first_name'] );
158 $this->filter_sales_rep_first_name = ! isset( $_POST['sales_rep_first_name'] ) ? $this->filter_sales_rep_first_name : sanitize_text_field( $_POST['sales_rep_first_name'] );
159 $this->query_string = remove_query_arg( 'sales_rep_first_name', $this->query_string );
160 if ( !empty( $this->filter_sales_rep_first_name ) ) {
161 $this->query_string = add_query_arg( array( 'sales_rep_first_name' => $this->filter_sales_rep_first_name ), $this->query_string );
162 }
163
164 $this->filter_sales_rep_last_name = ! isset( $_GET['sales_rep_last_name'] ) ? '' : sanitize_text_field( $_GET['sales_rep_last_name'] );
165 $this->filter_sales_rep_last_name = ! isset( $_POST['sales_rep_last_name'] ) ? $this->filter_sales_rep_last_name : sanitize_text_field( $_POST['sales_rep_last_name'] );
166 $this->query_string = remove_query_arg( 'sales_rep_last_name', $this->query_string );
167 if ( !empty( $this->filter_sales_rep_last_name ) ) {
168 $this->query_string = add_query_arg( array( 'sales_rep_last_name' => $this->filter_sales_rep_last_name ), $this->query_string );
169 }
170
171 $this->filter_sales_rep_email = ! isset( $_GET['sales_rep_email'] ) ? '' : sanitize_text_field( $_GET['sales_rep_email'] );
172 $this->filter_sales_rep_email = ! isset( $_POST['sales_rep_email'] ) ? $this->filter_sales_rep_email : sanitize_email( $_POST['sales_rep_email'] );
173 $this->query_string = remove_query_arg( 'sales_rep_email', $this->query_string );
174 if ( !empty( $this->filter_sales_rep_email ) ) {
175 $this->query_string = add_query_arg( array( 'sales_rep_email' => $this->filter_sales_rep_email ), $this->query_string );
176 }
177 }
178
179 /**
180 * No advanced filters for sales reps
181 * @since 3.0.0
182 */
183 public function advanced_filters() {}
184
185 /**
186 * Retrieve the view types
187 * @since 3.0.0
188 */
189 public function get_views() {
190 global $ewd_otp_controller;
191
192 $current = isset( $_GET['status'] ) ? sanitize_text_field( $_GET['status'] ) : '';
193
194 $views = array(
195 'all' => sprintf( '<a href="%s"%s>%s</a>', esc_url( remove_query_arg( array( 'status', 'paged' ), $this->query_string ) ), $current === 'all' || $current == '' ? ' class="current"' : '', __( 'All', 'order-tracking' ) . ' <span class="count">(' . $this->sales_rep_counts['total'] . ')</span>' ),
196 );
197
198 return apply_filters( 'ewd_otp_sales_reps_table_views_status', $views );
199 }
200
201 /**
202 * Generates content for a single row of the table
203 * @since 3.0.0
204 */
205 public function single_row( $item ) {
206 static $row_alternate_class = '';
207 $row_alternate_class = ( $row_alternate_class == '' ? 'alternate' : '' );
208
209 $row_classes = ! empty( $item->post_status ) ? array( esc_attr( $item->post_status ) ) : array();
210
211 if ( !empty( $row_alternate_class ) ) {
212 $row_classes[] = $row_alternate_class;
213 }
214
215 $row_classes = apply_filters( 'ewd_otp_admin_sales_reps_list_row_classes', $row_classes, $item );
216
217 echo '<tr class="' . esc_attr( implode( ' ', $row_classes ) ) . '">';
218 $this->single_row_columns( $item );
219 echo '</tr>';
220 }
221
222 /**
223 * Retrieve the table columns
224 *
225 * @since 3.0.0
226 */
227 public function get_columns() {
228 global $ewd_otp_controller;
229
230 // Prevent the lookup from running over and over again on a single
231 // page load
232 if ( !empty( $this->visible_columns ) ) {
233 return $this->visible_columns;
234 }
235
236 $all_default_columns = $this->get_all_default_columns();
237 $all_columns = $this->get_all_columns();
238
239 $visible_columns = $ewd_otp_controller->settings->get_setting( 'sales-reps-table-columns' );
240 if ( empty( $visible_columns ) ) {
241 $columns = $all_default_columns;
242 } else {
243 $columns = array();
244 $columns['cb'] = $all_default_columns['cb'];
245 $columns['date'] = $all_default_columns['date'];
246
247 foreach( $all_columns as $key => $column ) {
248 if ( in_array( $key, $visible_columns ) ) {
249 $columns[$key] = $all_columns[$key];
250 }
251 }
252 $columns['details'] = $all_default_columns['details'];
253 }
254
255 $this->visible_columns = apply_filters( 'ewd_otp_sales_reps_table_columns', $columns );
256
257 return $this->visible_columns;
258 }
259
260 /**
261 * Retrieve all default columns
262 *
263 * @since 3.0.0
264 */
265 public function get_all_default_columns() {
266 global $ewd_otp_controller;
267
268 $columns = array(
269 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
270 'sales_rep_id' => __( 'Sales Rep ID', 'order-tracking' ),
271 'number' => __( 'Number', 'order-tracking' ),
272 'first_name' => __( 'First Name', 'order-tracking' ),
273 'last_name' => __( 'Last Name', 'order-tracking' ),
274 'email' => __( 'Email', 'order-tracking' ),
275 );
276
277 $custom_fields = $ewd_otp_controller->settings->get_sales_rep_custom_fields();
278
279 foreach ( $custom_fields as $custom_field ) {
280
281 if ( ! $custom_field->display ) { continue; }
282
283 $columns[ $custom_field->slug ] = $custom_field->name ;
284 }
285
286 return $columns;
287 }
288
289 /**
290 * Retrieve all available columns
291 *
292 * This is used to get all columns including those deactivated and filtered
293 * out via get_columns().
294 *
295 * @since 3.0.0
296 */
297 public function get_all_columns() {
298 $columns = $this->get_all_default_columns();
299
300 return apply_filters( 'ewd_otp_sales_reps_all_table_columns', $columns );
301 }
302
303 /**
304 * Retrieve the table's sortable columns
305 * @since 3.0.0
306 */
307 public function get_sortable_columns() {
308 global $ewd_otp_controller;
309
310 $columns = array(
311 'number' => array( 'number', true ),
312 'first_name' => array( 'first_name', true ),
313 'last_name' => array( 'last_name', true ),
314 'email' => array( 'email', true ),
315 );
316
317 return apply_filters( 'ewd_otp_sales_reps_table_sortable_columns', $columns );
318 }
319
320 /**
321 * This function renders most of the columns in the list table.
322 * @since 3.0.0
323 */
324 public function column_default( $sales_rep, $column_name ) {
325 global $ewd_otp_controller;
326
327 switch ( $column_name ) {
328
329 case 'sales_rep_id' :
330 $value = esc_html( $sales_rep->id );
331 break;
332
333 case 'number' :
334
335 $value = esc_html( $sales_rep->number );
336
337 $value .= '<div class="actions">';
338 $value .= '<a href="admin.php?page=ewd-otp-add-edit-sales-rep&sales_rep_id=' . $sales_rep->id . '" data-id="' . esc_attr( $sales_rep->id ) . '">' . __( 'Edit', 'order-tracking' ) . '</a>';
339 $value .= ' | <a href="#" class="delete" data-id="' . esc_attr( $sales_rep->id ) . '" data-action="delete">' . __( 'Delete', 'order-tracking' ) . '</a>';
340 $value .= '</div>';
341
342 break;
343
344 case 'first_name' :
345
346 $value = esc_html( $sales_rep->first_name );
347
348 break;
349
350 case 'last_name' :
351 $value = esc_html( $sales_rep->last_name );
352 break;
353
354 case 'email' :
355 $value = esc_html( $sales_rep->email );
356 break;
357
358 default:
359 $custom_fields = $ewd_otp_controller->settings->get_sales_rep_custom_fields();
360
361 foreach ( $custom_fields as $custom_field ) {
362
363 if ( $custom_field->slug != $column_name ) { continue; }
364
365 $value = isset( $sales_rep->custom_fields[ $custom_field->id ] ) ? esc_html( $sales_rep->custom_fields[ $custom_field->id ] ) : '';
366 }
367
368 break;
369
370 }
371
372 return apply_filters( 'ewd_otp_sales_reps_table_column', $value, $sales_rep, $column_name );
373 }
374
375 /**
376 * Render the checkbox column
377 * @since 3.0.0
378 */
379 public function column_cb( $sales_rep ) {
380 return sprintf(
381 '<input type="checkbox" name="%1$s[]" value="%2$s" />',
382 'sales_reps',
383 $sales_rep->id
384 );
385 }
386
387 /**
388 * Retrieve the bulk actions
389 * @since 3.0.0
390 */
391 public function get_bulk_actions() {
392 global $ewd_otp_controller;
393
394 $actions = array(
395 'delete' => __( 'Delete', 'order-tracking' ),
396 );
397
398 return apply_filters( 'ewd_otp_sales_reps_table_bulk_actions', $actions );
399 }
400
401 /**
402 * Process the bulk actions
403 * @since 3.0.0
404 */
405 public function process_bulk_action() {
406 global $ewd_otp_controller;
407
408 $ids = isset( $_POST['sales_reps'] ) ? $_POST['sales_reps'] : false;
409 $action = isset( $_POST['action'] ) ? $_POST['action'] : false;
410
411 // Check bulk actions selector below the table
412 $action = $action == '-1' && isset( $_POST['action2'] ) ? $_POST['action2'] : $action;
413
414 if( empty( $action ) || $action == '-1' ) {
415 return;
416 }
417
418 if ( ! current_user_can( $ewd_otp_controller->settings->get_setting( 'access-role' ) ) ) {
419 return;
420 }
421
422 if ( ! is_array( $ids ) ) {
423 $ids = array( $ids );
424 }
425
426 $results = array();
427 foreach ( $ids as $id ) {
428
429 if ( 'delete' === $action ) {
430 $results[$id] = $ewd_otp_controller->sales_rep_manager->delete_sales_rep( intval( $id ) );
431 }
432
433 $results = apply_filters( 'ewd_otp_sales_reps_table_bulk_action', $results, $id, $action );
434 }
435
436 if( count( $results ) ) {
437 $this->action_result = $results;
438 $this->last_action = $action;
439 add_action( 'ewd_otp_sales_reps_table_top', array( $this, 'admin_notice_bulk_actions' ) );
440 }
441 }
442
443 /**
444 * Display an admin notice when a bulk action is completed
445 * @since 3.0.0
446 */
447 public function admin_notice_bulk_actions() {
448
449 $success = 0;
450 $failure = 0;
451 foreach( $this->action_result as $id => $result ) {
452 if ( $result === true || $result === null ) {
453 $success++;
454 } else {
455 $failure++;
456 }
457 }
458
459 if ( $success > 0 ) :
460 ?>
461
462 <div id="ewd-otp-admin-notice-bulk-<?php esc_attr( $this->last_action ); ?>" class="updated">
463
464 <?php if ( $this->last_action == 'delete' ) : ?>
465 <p><?php echo sprintf( _n( '%d sales rep deleted successfully.', '%d sales reps deleted successfully.', $success, 'order-tracking' ), $success ); ?></p>
466
467 <?php endif; ?>
468 </div>
469
470 <?php
471 endif;
472
473 if ( $failure > 0 ) :
474 ?>
475
476 <div id="ewd-otp-admin-notice-bulk-<?php esc_attr( $this->last_action ); ?>" class="error">
477 <p><?php echo sprintf( _n( '%d sales rep had errors and could not be processed.', '%d sales reps had errors and could not be processed.', $failure, 'order-tracking' ), $failure ); ?></p>
478 </div>
479
480 <?php
481 endif;
482 }
483
484 /**
485 * Generate the table navigation above or below the table
486 *
487 * This outputs a separate set of options above and below the table, in
488 * sales rep to make room for the locations, services and providers.
489 *
490 * @since 1.6
491 */
492 public function display_tablenav( $which ) {
493
494 global $ewd_otp_controller;
495
496
497 // Just call the parent method for the bottom nav
498 if ( 'bottom' == $which ) {
499 parent::display_tablenav( $which );
500 return;
501 }
502 ?>
503
504 <?php $this->add_notification(); ?>
505
506 <div class="ewd-otp-table-header-controls">
507 <div class="ewd-otp-table-header-controls-left">
508 <?php if ( $this->has_items() ) : ?>
509 <div class="actions bulkactions">
510 <?php $this->bulk_actions( $which ); ?>
511 </div>
512 <?php else : ?>
513 <input type="submit" class="hidden" value="Apply">
514 <?php endif; ?>
515 <a id="ewd-otp-table-header-search-filter" href="#"><?php esc_html_e( 'Search', 'order-tracking' ); ?></a>
516 <div class='ewd-otp-admin-table-filter-div ewd-otp-hidden'>
517 <label class='ewd-otp-admin-table-filter-label'><?php esc_html_e( 'Sales Rep Number', 'order-tracking' ); ?></label>
518 <input type='text' name='sales_rep_number' class='ewd-otp-sales-reps-table-filter ewd-otp-sales-rep-number ewd-otp-admin-table-filter-field' value='<?php echo ( empty( $this->filter_sales_rep_number ) ? esc_attr( $this->filter_sales_rep_number ) : '' ); ?>' />
519 </div>
520 <div class='ewd-otp-admin-table-filter-div ewd-otp-hidden'>
521 <label class='ewd-otp-admin-table-filter-label'><?php esc_html_e( 'Sales Rep First Name', 'order-tracking' ); ?></label>
522 <input type='text' name='sales_rep_first_name' class='ewd-otp-sales-reps-table-filter ewd-otp-sales-rep-first-name ewd-otp-admin-table-filter-field' value='<?php echo ( empty( $this->filter_sales_rep_first_name ) ? esc_attr( $this->filter_sales_rep_first_name ) : '' ); ?>' />
523 </div>
524 <div class='ewd-otp-admin-table-filter-div ewd-otp-hidden'>
525 <label class='ewd-otp-admin-table-filter-label'><?php esc_html_e( 'Sales Rep Last Name', 'order-tracking' ); ?></label>
526 <input type='text' name='sales_rep_last_name' class='ewd-otp-sales-reps-table-filter ewd-otp-sales-rep-last-name ewd-otp-admin-table-filter-field' value='<?php echo ( empty( $this->filter_sales_rep_last_name ) ? esc_attr( $this->filter_sales_rep_last_name ) : '' ); ?>' />
527 </div>
528 <div class='ewd-otp-admin-table-filter-div ewd-otp-hidden'>
529 <label class='ewd-otp-admin-table-filter-label'><?php esc_html_e( 'Sales Rep Email', 'order-tracking' ); ?></label>
530 <input type='text' name='sales_rep_email' class='ewd-otp-sales-reps-table-filter ewd-otp-sales-rep-email ewd-otp-admin-table-filter-field' value='<?php echo ( empty( $this->filter_sales_rep_email ) ? esc_attr( $this->filter_sales_rep_email ) : '' ); ?>' />
531 </div>
532 </div>
533 <div class="ewd-otp-table-header-controls-right">
534 <div class="tablenav top ewd-otp-top-actions-wrapper">
535 <?php wp_nonce_field( 'bulk-' . $this->_args['plural'] ); ?>
536 <?php $this->extra_tablenav( $which ); ?>
537 <?php parent::pagination( $which ); ?>
538 </div>
539 </div>
540 </div>
541
542 <?php
543 }
544
545 /**
546 * Extra controls to be displayed between bulk actions and pagination
547 *
548 * @param string pos Position of this tablenav: `top` or `btm`
549 * @since 1.4.1
550 */
551 public function extra_tablenav( $pos ) {
552 do_action( 'ewd_otp_sales_reps_table_actions', $pos );
553 }
554
555 /**
556 * Add notifications above the table to indicate which sales reps are
557 * being shown.
558 * @since 1.3
559 */
560 public function add_notification() {
561
562 global $ewd_otp_controller;
563
564 $notifications = array();
565
566 $notifications = apply_filters( 'ewd_otp_admin_sales_reps_table_filter_notifications', $notifications );
567
568 if ( !empty( $notifications ) ) :
569 ?>
570
571 <div class="ewd-otp-notice <?php echo esc_attr( $status ); ?>">
572 <?php echo join( ' ', $notifications ); ?>
573 </div>
574
575 <?php
576 endif;
577 }
578
579 /**
580 * Retrieve the counts of sales reps
581 * @since 3.0.0
582 */
583 public function get_sales_rep_counts() {
584 global $ewd_otp_controller;
585
586 $args = array();
587
588 if ( $this->filter_sales_rep_number ) { $args['number'] = sanitize_text_field( $this->filter_sales_rep_number ); }
589
590 if ( $this->filter_sales_rep_first_name ) { $args['first_name'] = sanitize_text_field( $this->filter_sales_rep_first_name ); }
591
592 if ( $this->filter_sales_rep_last_name ) { $args['last_name'] = sanitize_text_field( $this->filter_sales_rep_last_name ); }
593
594 if ( $this->filter_sales_rep_email ) { $args['email'] = sanitize_text_field( $this->filter_sales_rep_email ); }
595
596 $this->sales_rep_counts = $ewd_otp_controller->sales_rep_manager->get_sales_rep_counts( $args );
597 }
598
599 /**
600 * Retrieve all the data for all the sales reps
601 * @since 3.0.0
602 */
603 public function sales_reps_data() {
604 global $ewd_otp_controller;
605
606 $args = array(
607 'sales_reps_per_page' => $this->per_page,
608 );
609
610 if ( array_key_exists( 'paged', $_GET ) ) {
611
612 $args['paged'] = intval( $_GET['paged'] );
613 }
614
615 if ( ! empty( $_GET['orderby'] ) ) {
616
617 if ( $_GET['orderby'] == 'number' ) { $args['orderby'] = 'Sales_Rep_Number'; }
618 elseif ( $_GET['orderby'] == 'first_name' ) { $args['orderby'] = 'Sales_Rep_First_Name'; }
619 elseif ( $_GET['orderby'] == 'last_name' ) { $args['orderby'] = 'Sales_Rep_Last_Name'; }
620 elseif ( $_GET['orderby'] == 'email' ) { $args['orderby'] = 'Sales_Rep_Email'; }
621
622 $args['order'] = ! empty( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'asc';
623 }
624
625 if ( $this->filter_sales_rep_number ) { $args['number'] = sanitize_text_field( $this->filter_sales_rep_number ); }
626
627 if ( $this->filter_sales_rep_first_name ) { $args['first_name'] = sanitize_text_field( $this->filter_sales_rep_first_name ); }
628
629 if ( $this->filter_sales_rep_last_name ) { $args['last_name'] = sanitize_text_field( $this->filter_sales_rep_last_name ); }
630
631 if ( $this->filter_sales_rep_email ) { $args['email'] = sanitize_text_field( $this->filter_sales_rep_email ); }
632
633 $this->sales_reps = $ewd_otp_controller->sales_rep_manager->get_matching_sales_reps( $args );
634 }
635
636 /**
637 * Setup the final data for the table
638 * @since 3.0.0
639 */
640 public function prepare_items() {
641
642 $columns = $this->get_columns();
643 $hidden = array(); // No hidden columns
644 $sortable = $this->get_sortable_columns();
645
646 $this->_column_headers = array( $columns, $hidden, $sortable );
647
648 $this->items = $this->sales_reps;
649
650 $total_items = empty( $_GET['status'] ) ? $this->sales_rep_counts['total'] : $this->sales_rep_counts[$_GET['status']];
651
652 $this->set_pagination_args( array(
653 'total_items' => $total_items,
654 'per_page' => $this->per_page,
655 'total_pages' => ceil( $total_items / $this->per_page )
656 )
657 );
658 }
659
660 }
661 } // endif;
662