[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-admin/includes/ -> class-wp-list-table.php (source)

   1  <?php
   2  /**
   3   * Administration API: WP_List_Table class
   4   *
   5   * @package WordPress
   6   * @subpackage List_Table
   7   * @since 3.1.0
   8   */
   9  
  10  /**
  11   * Base class for displaying a list of items in an ajaxified HTML table.
  12   *
  13   * @since 3.1.0
  14   * @access private
  15   */
  16  class WP_List_Table {
  17  
  18      /**
  19       * The current list of items.
  20       *
  21       * @since 3.1.0
  22       * @var array
  23       */
  24      public $items;
  25  
  26      /**
  27       * Various information about the current table.
  28       *
  29       * @since 3.1.0
  30       * @var array
  31       */
  32      protected $_args;
  33  
  34      /**
  35       * Various information needed for displaying the pagination.
  36       *
  37       * @since 3.1.0
  38       * @var array
  39       */
  40      protected $_pagination_args = array();
  41  
  42      /**
  43       * The current screen.
  44       *
  45       * @since 3.1.0
  46       * @var object
  47       */
  48      protected $screen;
  49  
  50      /**
  51       * Cached bulk actions.
  52       *
  53       * @since 3.1.0
  54       * @var array
  55       */
  56      private $_actions;
  57  
  58      /**
  59       * Cached pagination output.
  60       *
  61       * @since 3.1.0
  62       * @var string
  63       */
  64      private $_pagination;
  65  
  66      /**
  67       * The view switcher modes.
  68       *
  69       * @since 4.1.0
  70       * @var array
  71       */
  72      protected $modes = array();
  73  
  74      /**
  75       * Stores the value returned by ->get_column_info().
  76       *
  77       * @since 4.1.0
  78       * @var array
  79       */
  80      protected $_column_headers;
  81  
  82      /**
  83       * {@internal Missing Summary}
  84       *
  85       * @var array
  86       */
  87      protected $compat_fields = array( '_args', '_pagination_args', 'screen', '_actions', '_pagination' );
  88  
  89      /**
  90       * {@internal Missing Summary}
  91       *
  92       * @var array
  93       */
  94      protected $compat_methods = array(
  95          'set_pagination_args',
  96          'get_views',
  97          'get_bulk_actions',
  98          'bulk_actions',
  99          'row_actions',
 100          'months_dropdown',
 101          'view_switcher',
 102          'comments_bubble',
 103          'get_items_per_page',
 104          'pagination',
 105          'get_sortable_columns',
 106          'get_column_info',
 107          'get_table_classes',
 108          'display_tablenav',
 109          'extra_tablenav',
 110          'single_row_columns',
 111      );
 112  
 113      /**
 114       * Constructor.
 115       *
 116       * The child class should call this constructor from its own constructor to override
 117       * the default $args.
 118       *
 119       * @since 3.1.0
 120       *
 121       * @param array|string $args {
 122       *     Array or string of arguments.
 123       *
 124       *     @type string $plural   Plural value used for labels and the objects being listed.
 125       *                            This affects things such as CSS class-names and nonces used
 126       *                            in the list table, e.g. 'posts'. Default empty.
 127       *     @type string $singular Singular label for an object being listed, e.g. 'post'.
 128       *                            Default empty
 129       *     @type bool   $ajax     Whether the list table supports Ajax. This includes loading
 130       *                            and sorting data, for example. If true, the class will call
 131       *                            the _js_vars() method in the footer to provide variables
 132       *                            to any scripts handling Ajax events. Default false.
 133       *     @type string $screen   String containing the hook name used to determine the current
 134       *                            screen. If left null, the current screen will be automatically set.
 135       *                            Default null.
 136       * }
 137       */
 138  	public function __construct( $args = array() ) {
 139          $args = wp_parse_args(
 140              $args,
 141              array(
 142                  'plural'   => '',
 143                  'singular' => '',
 144                  'ajax'     => false,
 145                  'screen'   => null,
 146              )
 147          );
 148  
 149          $this->screen = convert_to_screen( $args['screen'] );
 150  
 151          add_filter( "manage_{$this->screen->id}_columns", array( $this, 'get_columns' ), 0 );
 152  
 153          if ( ! $args['plural'] ) {
 154              $args['plural'] = $this->screen->base;
 155          }
 156  
 157          $args['plural']   = sanitize_key( $args['plural'] );
 158          $args['singular'] = sanitize_key( $args['singular'] );
 159  
 160          $this->_args = $args;
 161  
 162          if ( $args['ajax'] ) {
 163              // wp_enqueue_script( 'list-table' );
 164              add_action( 'admin_footer', array( $this, '_js_vars' ) );
 165          }
 166  
 167          if ( empty( $this->modes ) ) {
 168              $this->modes = array(
 169                  'list'    => __( 'Compact view' ),
 170                  'excerpt' => __( 'Extended view' ),
 171              );
 172          }
 173      }
 174  
 175      /**
 176       * Make private properties readable for backward compatibility.
 177       *
 178       * @since 4.0.0
 179       *
 180       * @param string $name Property to get.
 181       * @return mixed Property.
 182       */
 183  	public function __get( $name ) {
 184          if ( in_array( $name, $this->compat_fields, true ) ) {
 185              return $this->$name;
 186          }
 187      }
 188  
 189      /**
 190       * Make private properties settable for backward compatibility.
 191       *
 192       * @since 4.0.0
 193       *
 194       * @param string $name  Property to check if set.
 195       * @param mixed  $value Property value.
 196       * @return mixed Newly-set property.
 197       */
 198  	public function __set( $name, $value ) {
 199          if ( in_array( $name, $this->compat_fields, true ) ) {
 200              return $this->$name = $value;
 201          }
 202      }
 203  
 204      /**
 205       * Make private properties checkable for backward compatibility.
 206       *
 207       * @since 4.0.0
 208       *
 209       * @param string $name Property to check if set.
 210       * @return bool Whether the property is set.
 211       */
 212  	public function __isset( $name ) {
 213          if ( in_array( $name, $this->compat_fields, true ) ) {
 214              return isset( $this->$name );
 215          }
 216      }
 217  
 218      /**
 219       * Make private properties un-settable for backward compatibility.
 220       *
 221       * @since 4.0.0
 222       *
 223       * @param string $name Property to unset.
 224       */
 225  	public function __unset( $name ) {
 226          if ( in_array( $name, $this->compat_fields, true ) ) {
 227              unset( $this->$name );
 228          }
 229      }
 230  
 231      /**
 232       * Make private/protected methods readable for backward compatibility.
 233       *
 234       * @since 4.0.0
 235       *
 236       * @param string $name      Method to call.
 237       * @param array  $arguments Arguments to pass when calling.
 238       * @return mixed|bool Return value of the callback, false otherwise.
 239       */
 240  	public function __call( $name, $arguments ) {
 241          if ( in_array( $name, $this->compat_methods, true ) ) {
 242              return $this->$name( ...$arguments );
 243          }
 244          return false;
 245      }
 246  
 247      /**
 248       * Checks the current user's permissions
 249       *
 250       * @since 3.1.0
 251       * @abstract
 252       */
 253  	public function ajax_user_can() {
 254          die( 'function WP_List_Table::ajax_user_can() must be overridden in a subclass.' );
 255      }
 256  
 257      /**
 258       * Prepares the list of items for displaying.
 259       *
 260       * @uses WP_List_Table::set_pagination_args()
 261       *
 262       * @since 3.1.0
 263       * @abstract
 264       */
 265  	public function prepare_items() {
 266          die( 'function WP_List_Table::prepare_items() must be overridden in a subclass.' );
 267      }
 268  
 269      /**
 270       * An internal method that sets all the necessary pagination arguments
 271       *
 272       * @since 3.1.0
 273       *
 274       * @param array|string $args Array or string of arguments with information about the pagination.
 275       */
 276  	protected function set_pagination_args( $args ) {
 277          $args = wp_parse_args(
 278              $args,
 279              array(
 280                  'total_items' => 0,
 281                  'total_pages' => 0,
 282                  'per_page'    => 0,
 283              )
 284          );
 285  
 286          if ( ! $args['total_pages'] && $args['per_page'] > 0 ) {
 287              $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] );
 288          }
 289  
 290          // Redirect if page number is invalid and headers are not already sent.
 291          if ( ! headers_sent() && ! wp_doing_ajax() && $args['total_pages'] > 0 && $this->get_pagenum() > $args['total_pages'] ) {
 292              wp_redirect( add_query_arg( 'paged', $args['total_pages'] ) );
 293              exit;
 294          }
 295  
 296          $this->_pagination_args = $args;
 297      }
 298  
 299      /**
 300       * Access the pagination args.
 301       *
 302       * @since 3.1.0
 303       *
 304       * @param string $key Pagination argument to retrieve. Common values include 'total_items',
 305       *                    'total_pages', 'per_page', or 'infinite_scroll'.
 306       * @return int Number of items that correspond to the given pagination argument.
 307       */
 308  	public function get_pagination_arg( $key ) {
 309          if ( 'page' === $key ) {
 310              return $this->get_pagenum();
 311          }
 312  
 313          if ( isset( $this->_pagination_args[ $key ] ) ) {
 314              return $this->_pagination_args[ $key ];
 315          }
 316      }
 317  
 318      /**
 319       * Whether the table has items to display or not
 320       *
 321       * @since 3.1.0
 322       *
 323       * @return bool
 324       */
 325  	public function has_items() {
 326          return ! empty( $this->items );
 327      }
 328  
 329      /**
 330       * Message to be displayed when there are no items
 331       *
 332       * @since 3.1.0
 333       */
 334  	public function no_items() {
 335          _e( 'No items found.' );
 336      }
 337  
 338      /**
 339       * Displays the search box.
 340       *
 341       * @since 3.1.0
 342       *
 343       * @param string $text     The 'submit' button label.
 344       * @param string $input_id ID attribute value for the search input field.
 345       */
 346  	public function search_box( $text, $input_id ) {
 347          if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
 348              return;
 349          }
 350  
 351          $input_id = $input_id . '-search-input';
 352  
 353          if ( ! empty( $_REQUEST['orderby'] ) ) {
 354              echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
 355          }
 356          if ( ! empty( $_REQUEST['order'] ) ) {
 357              echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
 358          }
 359          if ( ! empty( $_REQUEST['post_mime_type'] ) ) {
 360              echo '<input type="hidden" name="post_mime_type" value="' . esc_attr( $_REQUEST['post_mime_type'] ) . '" />';
 361          }
 362          if ( ! empty( $_REQUEST['detached'] ) ) {
 363              echo '<input type="hidden" name="detached" value="' . esc_attr( $_REQUEST['detached'] ) . '" />';
 364          }
 365          ?>
 366  <p class="search-box">
 367      <label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo $text; ?>:</label>
 368      <input type="search" id="<?php echo esc_attr( $input_id ); ?>" name="s" value="<?php _admin_search_query(); ?>" />
 369          <?php submit_button( $text, '', '', false, array( 'id' => 'search-submit' ) ); ?>
 370  </p>
 371          <?php
 372      }
 373  
 374      /**
 375       * Gets the list of views available on this table.
 376       *
 377       * The format is an associative array:
 378       * - `'id' => 'link'`
 379       *
 380       * @since 3.1.0
 381       *
 382       * @return array
 383       */
 384  	protected function get_views() {
 385          return array();
 386      }
 387  
 388      /**
 389       * Displays the list of views available on this table.
 390       *
 391       * @since 3.1.0
 392       */
 393  	public function views() {
 394          $views = $this->get_views();
 395          /**
 396           * Filters the list of available list table views.
 397           *
 398           * The dynamic portion of the hook name, `$this->screen->id`, refers
 399           * to the ID of the current screen, usually a string.
 400           *
 401           * @since 3.1.0
 402           *
 403           * @param string[] $views An array of available list table views.
 404           */
 405          $views = apply_filters( "views_{$this->screen->id}", $views );
 406  
 407          if ( empty( $views ) ) {
 408              return;
 409          }
 410  
 411          $this->screen->render_screen_reader_content( 'heading_views' );
 412  
 413          echo "<ul class='subsubsub'>\n";
 414          foreach ( $views as $class => $view ) {
 415              $views[ $class ] = "\t<li class='$class'>$view";
 416          }
 417          echo implode( " |</li>\n", $views ) . "</li>\n";
 418          echo '</ul>';
 419      }
 420  
 421      /**
 422       * Gets the list of bulk actions available on this table.
 423       *
 424       * The format is an associative array:
 425       * - `'option_name' => 'option_title'`
 426       *
 427       * @since 3.1.0
 428       *
 429       * @return array
 430       */
 431  	protected function get_bulk_actions() {
 432          return array();
 433      }
 434  
 435      /**
 436       * Displays the bulk actions dropdown.
 437       *
 438       * @since 3.1.0
 439       *
 440       * @param string $which The location of the bulk actions: 'top' or 'bottom'.
 441       *                      This is designated as optional for backward compatibility.
 442       */
 443  	protected function bulk_actions( $which = '' ) {
 444          if ( is_null( $this->_actions ) ) {
 445              $this->_actions = $this->get_bulk_actions();
 446  
 447              /**
 448               * Filters the list table bulk actions drop-down.
 449               *
 450               * The dynamic portion of the hook name, `$this->screen->id`, refers
 451               * to the ID of the current screen, usually a string.
 452               *
 453               * @since 3.1.0
 454               *
 455               * @param string[] $actions An array of the available bulk actions.
 456               */
 457              $this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
 458  
 459              $two = '';
 460          } else {
 461              $two = '2';
 462          }
 463  
 464          if ( empty( $this->_actions ) ) {
 465              return;
 466          }
 467  
 468          echo '<label for="bulk-action-selector-' . esc_attr( $which ) . '" class="screen-reader-text">' . __( 'Select bulk action' ) . '</label>';
 469          echo '<select name="action' . $two . '" id="bulk-action-selector-' . esc_attr( $which ) . "\">\n";
 470          echo '<option value="-1">' . __( 'Bulk actions' ) . "</option>\n";
 471  
 472          foreach ( $this->_actions as $name => $title ) {
 473              $class = 'edit' === $name ? ' class="hide-if-no-js"' : '';
 474  
 475              echo "\t" . '<option value="' . $name . '"' . $class . '>' . $title . "</option>\n";
 476          }
 477  
 478          echo "</select>\n";
 479  
 480          submit_button( __( 'Apply' ), 'action', "doaction$two", false, array( 'id' => "doaction$two" ) );
 481          echo "\n";
 482      }
 483  
 484      /**
 485       * Gets the current action selected from the bulk actions dropdown.
 486       *
 487       * @since 3.1.0
 488       *
 489       * @return string|false The action name. False if no action was selected.
 490       */
 491  	public function current_action() {
 492          if ( isset( $_REQUEST['filter_action'] ) && ! empty( $_REQUEST['filter_action'] ) ) {
 493              return false;
 494          }
 495  
 496          if ( isset( $_REQUEST['doaction2'] ) && isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'] ) {
 497              return $_REQUEST['action2'];
 498          }
 499  
 500          if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] ) {
 501              return $_REQUEST['action'];
 502          }
 503  
 504          return false;
 505      }
 506  
 507      /**
 508       * Generates the required HTML for a list of row action links.
 509       *
 510       * @since 3.1.0
 511       *
 512       * @param string[] $actions        An array of action links.
 513       * @param bool     $always_visible Whether the actions should be always visible.
 514       * @return string The HTML for the row actions.
 515       */
 516  	protected function row_actions( $actions, $always_visible = false ) {
 517          $action_count = count( $actions );
 518  
 519          if ( ! $action_count ) {
 520              return '';
 521          }
 522  
 523          $mode = get_user_setting( 'posts_list_mode', 'list' );
 524  
 525          if ( 'excerpt' === $mode ) {
 526              $always_visible = true;
 527          }
 528  
 529          $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
 530  
 531          $i = 0;
 532  
 533          foreach ( $actions as $action => $link ) {
 534              ++$i;
 535  
 536              $sep = ( $i < $action_count ) ? ' | ' : '';
 537  
 538              $out .= "<span class='$action'>$link$sep</span>";
 539          }
 540  
 541          $out .= '</div>';
 542  
 543          $out .= '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>';
 544  
 545          return $out;
 546      }
 547  
 548      /**
 549       * Displays a dropdown for filtering items in the list table by month.
 550       *
 551       * @since 3.1.0
 552       *
 553       * @global wpdb      $wpdb      WordPress database abstraction object.
 554       * @global WP_Locale $wp_locale WordPress date and time locale object.
 555       *
 556       * @param string $post_type The post type.
 557       */
 558  	protected function months_dropdown( $post_type ) {
 559          global $wpdb, $wp_locale;
 560  
 561          /**
 562           * Filters whether to remove the 'Months' drop-down from the post list table.
 563           *
 564           * @since 4.2.0
 565           *
 566           * @param bool   $disable   Whether to disable the drop-down. Default false.
 567           * @param string $post_type The post type.
 568           */
 569          if ( apply_filters( 'disable_months_dropdown', false, $post_type ) ) {
 570              return;
 571          }
 572  
 573          $extra_checks = "AND post_status != 'auto-draft'";
 574          if ( ! isset( $_GET['post_status'] ) || 'trash' !== $_GET['post_status'] ) {
 575              $extra_checks .= " AND post_status != 'trash'";
 576          } elseif ( isset( $_GET['post_status'] ) ) {
 577              $extra_checks = $wpdb->prepare( ' AND post_status = %s', $_GET['post_status'] );
 578          }
 579  
 580          $months = $wpdb->get_results(
 581              $wpdb->prepare(
 582                  "
 583              SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
 584              FROM $wpdb->posts
 585              WHERE post_type = %s
 586              $extra_checks
 587              ORDER BY post_date DESC
 588          ",
 589                  $post_type
 590              )
 591          );
 592  
 593          /**
 594           * Filters the 'Months' drop-down results.
 595           *
 596           * @since 3.7.0
 597           *
 598           * @param object[] $months    Array of the months drop-down query results.
 599           * @param string   $post_type The post type.
 600           */
 601          $months = apply_filters( 'months_dropdown_results', $months, $post_type );
 602  
 603          $month_count = count( $months );
 604  
 605          if ( ! $month_count || ( 1 == $month_count && 0 == $months[0]->month ) ) {
 606              return;
 607          }
 608  
 609          $m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0;
 610          ?>
 611          <label for="filter-by-date" class="screen-reader-text"><?php _e( 'Filter by date' ); ?></label>
 612          <select name="m" id="filter-by-date">
 613              <option<?php selected( $m, 0 ); ?> value="0"><?php _e( 'All dates' ); ?></option>
 614          <?php
 615          foreach ( $months as $arc_row ) {
 616              if ( 0 == $arc_row->year ) {
 617                  continue;
 618              }
 619  
 620              $month = zeroise( $arc_row->month, 2 );
 621              $year  = $arc_row->year;
 622  
 623              printf(
 624                  "<option %s value='%s'>%s</option>\n",
 625                  selected( $m, $year . $month, false ),
 626                  esc_attr( $arc_row->year . $month ),
 627                  /* translators: 1: Month name, 2: 4-digit year. */
 628                  sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month ), $year )
 629              );
 630          }
 631          ?>
 632          </select>
 633          <?php
 634      }
 635  
 636      /**
 637       * Displays a view switcher.
 638       *
 639       * @since 3.1.0
 640       *
 641       * @param string $current_mode
 642       */
 643  	protected function view_switcher( $current_mode ) {
 644          ?>
 645          <input type="hidden" name="mode" value="<?php echo esc_attr( $current_mode ); ?>" />
 646          <div class="view-switch">
 647          <?php
 648          foreach ( $this->modes as $mode => $title ) {
 649              $classes      = array( 'view-' . $mode );
 650              $aria_current = '';
 651  
 652              if ( $current_mode === $mode ) {
 653                  $classes[]    = 'current';
 654                  $aria_current = ' aria-current="page"';
 655              }
 656  
 657              printf(
 658                  "<a href='%s' class='%s' id='view-switch-$mode'$aria_current><span class='screen-reader-text'>%s</span></a>\n",
 659                  esc_url( remove_query_arg( 'attachment-filter', add_query_arg( 'mode', $mode ) ) ),
 660                  implode( ' ', $classes ),
 661                  $title
 662              );
 663          }
 664          ?>
 665          </div>
 666          <?php
 667      }
 668  
 669      /**
 670       * Displays a comment count bubble.
 671       *
 672       * @since 3.1.0
 673       *
 674       * @param int $post_id          The post ID.
 675       * @param int $pending_comments Number of pending comments.
 676       */
 677  	protected function comments_bubble( $post_id, $pending_comments ) {
 678          $approved_comments = get_comments_number();
 679  
 680          $approved_comments_number = number_format_i18n( $approved_comments );
 681          $pending_comments_number  = number_format_i18n( $pending_comments );
 682  
 683          $approved_only_phrase = sprintf(
 684              /* translators: %s: Number of comments. */
 685              _n( '%s comment', '%s comments', $approved_comments ),
 686              $approved_comments_number
 687          );
 688  
 689          $approved_phrase = sprintf(
 690              /* translators: %s: Number of comments. */
 691              _n( '%s approved comment', '%s approved comments', $approved_comments ),
 692              $approved_comments_number
 693          );
 694  
 695          $pending_phrase = sprintf(
 696              /* translators: %s: Number of comments. */
 697              _n( '%s pending comment', '%s pending comments', $pending_comments ),
 698              $pending_comments_number
 699          );
 700  
 701          if ( ! $approved_comments && ! $pending_comments ) {
 702              // No comments at all.
 703              printf(
 704                  '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">%s</span>',
 705                  __( 'No comments' )
 706              );
 707          } elseif ( $approved_comments && 'trash' === get_post_status( $post_id ) ) {
 708              // Don't link the comment bubble for a trashed post.
 709              printf(
 710                  '<span class="post-com-count post-com-count-approved"><span class="comment-count-approved" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
 711                  $approved_comments_number,
 712                  $pending_comments ? $approved_phrase : $approved_only_phrase
 713              );
 714          } elseif ( $approved_comments ) {
 715              // Link the comment bubble to approved comments.
 716              printf(
 717                  '<a href="%s" class="post-com-count post-com-count-approved"><span class="comment-count-approved" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
 718                  esc_url(
 719                      add_query_arg(
 720                          array(
 721                              'p'              => $post_id,
 722                              'comment_status' => 'approved',
 723                          ),
 724                          admin_url( 'edit-comments.php' )
 725                      )
 726                  ),
 727                  $approved_comments_number,
 728                  $pending_comments ? $approved_phrase : $approved_only_phrase
 729              );
 730          } else {
 731              // Don't link the comment bubble when there are no approved comments.
 732              printf(
 733                  '<span class="post-com-count post-com-count-no-comments"><span class="comment-count comment-count-no-comments" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
 734                  $approved_comments_number,
 735                  $pending_comments ? __( 'No approved comments' ) : __( 'No comments' )
 736              );
 737          }
 738  
 739          if ( $pending_comments ) {
 740              printf(
 741                  '<a href="%s" class="post-com-count post-com-count-pending"><span class="comment-count-pending" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
 742                  esc_url(
 743                      add_query_arg(
 744                          array(
 745                              'p'              => $post_id,
 746                              'comment_status' => 'moderated',
 747                          ),
 748                          admin_url( 'edit-comments.php' )
 749                      )
 750                  ),
 751                  $pending_comments_number,
 752                  $pending_phrase
 753              );
 754          } else {
 755              printf(
 756                  '<span class="post-com-count post-com-count-pending post-com-count-no-pending"><span class="comment-count comment-count-no-pending" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
 757                  $pending_comments_number,
 758                  $approved_comments ? __( 'No pending comments' ) : __( 'No comments' )
 759              );
 760          }
 761      }
 762  
 763      /**
 764       * Gets the current page number.
 765       *
 766       * @since 3.1.0
 767       *
 768       * @return int
 769       */
 770  	public function get_pagenum() {
 771          $pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0;
 772  
 773          if ( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] ) {
 774              $pagenum = $this->_pagination_args['total_pages'];
 775          }
 776  
 777          return max( 1, $pagenum );
 778      }
 779  
 780      /**
 781       * Gets the number of items to display on a single page.
 782       *
 783       * @since 3.1.0
 784       *
 785       * @param string $option
 786       * @param int    $default
 787       * @return int
 788       */
 789  	protected function get_items_per_page( $option, $default = 20 ) {
 790          $per_page = (int) get_user_option( $option );
 791          if ( empty( $per_page ) || $per_page < 1 ) {
 792              $per_page = $default;
 793          }
 794  
 795          /**
 796           * Filters the number of items to be displayed on each page of the list table.
 797           *
 798           * The dynamic hook name, `$option`, refers to the `per_page` option depending
 799           * on the type of list table in use. Possible filter names include:
 800           *
 801           *  - `edit_comments_per_page`
 802           *  - `sites_network_per_page`
 803           *  - `site_themes_network_per_page`
 804           *  - `themes_network_per_page'`
 805           *  - `users_network_per_page`
 806           *  - `edit_post_per_page`
 807           *  - `edit_page_per_page'`
 808           *  - `edit_{$post_type}_per_page`
 809           *  - `edit_post_tag_per_page`
 810           *  - `edit_category_per_page`
 811           *  - `edit_{$taxonomy}_per_page`
 812           *  - `site_users_network_per_page`
 813           *  - `users_per_page`
 814           *
 815           * @since 2.9.0
 816           *
 817           * @param int $per_page Number of items to be displayed. Default 20.
 818           */
 819          return (int) apply_filters( "{$option}", $per_page );
 820      }
 821  
 822      /**
 823       * Displays the pagination.
 824       *
 825       * @since 3.1.0
 826       *
 827       * @param string $which
 828       */
 829  	protected function pagination( $which ) {
 830          if ( empty( $this->_pagination_args ) ) {
 831              return;
 832          }
 833  
 834          $total_items     = $this->_pagination_args['total_items'];
 835          $total_pages     = $this->_pagination_args['total_pages'];
 836          $infinite_scroll = false;
 837          if ( isset( $this->_pagination_args['infinite_scroll'] ) ) {
 838              $infinite_scroll = $this->_pagination_args['infinite_scroll'];
 839          }
 840  
 841          if ( 'top' === $which && $total_pages > 1 ) {
 842              $this->screen->render_screen_reader_content( 'heading_pagination' );
 843          }
 844  
 845          $output = '<span class="displaying-num">' . sprintf(
 846              /* translators: %s: Number of items. */
 847              _n( '%s item', '%s items', $total_items ),
 848              number_format_i18n( $total_items )
 849          ) . '</span>';
 850  
 851          $current              = $this->get_pagenum();
 852          $removable_query_args = wp_removable_query_args();
 853  
 854          $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
 855  
 856          $current_url = remove_query_arg( $removable_query_args, $current_url );
 857  
 858          $page_links = array();
 859  
 860          $total_pages_before = '<span class="paging-input">';
 861          $total_pages_after  = '</span></span>';
 862  
 863          $disable_first = false;
 864          $disable_last  = false;
 865          $disable_prev  = false;
 866          $disable_next  = false;
 867  
 868          if ( 1 == $current ) {
 869              $disable_first = true;
 870              $disable_prev  = true;
 871          }
 872          if ( 2 == $current ) {
 873              $disable_first = true;
 874          }
 875          if ( $total_pages == $current ) {
 876              $disable_last = true;
 877              $disable_next = true;
 878          }
 879          if ( $total_pages - 1 == $current ) {
 880              $disable_last = true;
 881          }
 882  
 883          if ( $disable_first ) {
 884              $page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">&laquo;</span>';
 885          } else {
 886              $page_links[] = sprintf(
 887                  "<a class='first-page button' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
 888                  esc_url( remove_query_arg( 'paged', $current_url ) ),
 889                  __( 'First page' ),
 890                  '&laquo;'
 891              );
 892          }
 893  
 894          if ( $disable_prev ) {
 895              $page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">&lsaquo;</span>';
 896          } else {
 897              $page_links[] = sprintf(
 898                  "<a class='prev-page button' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
 899                  esc_url( add_query_arg( 'paged', max( 1, $current - 1 ), $current_url ) ),
 900                  __( 'Previous page' ),
 901                  '&lsaquo;'
 902              );
 903          }
 904  
 905          if ( 'bottom' === $which ) {
 906              $html_current_page  = $current;
 907              $total_pages_before = '<span class="screen-reader-text">' . __( 'Current Page' ) . '</span><span id="table-paging" class="paging-input"><span class="tablenav-paging-text">';
 908          } else {
 909              $html_current_page = sprintf(
 910                  "%s<input class='current-page' id='current-page-selector' type='text' name='paged' value='%s' size='%d' aria-describedby='table-paging' /><span class='tablenav-paging-text'>",
 911                  '<label for="current-page-selector" class="screen-reader-text">' . __( 'Current Page' ) . '</label>',
 912                  $current,
 913                  strlen( $total_pages )
 914              );
 915          }
 916          $html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
 917          $page_links[]     = $total_pages_before . sprintf(
 918              /* translators: 1: Current page, 2: Total pages. */
 919              _x( '%1$s of %2$s', 'paging' ),
 920              $html_current_page,
 921              $html_total_pages
 922          ) . $total_pages_after;
 923  
 924          if ( $disable_next ) {
 925              $page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">&rsaquo;</span>';
 926          } else {
 927              $page_links[] = sprintf(
 928                  "<a class='next-page button' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
 929                  esc_url( add_query_arg( 'paged', min( $total_pages, $current + 1 ), $current_url ) ),
 930                  __( 'Next page' ),
 931                  '&rsaquo;'
 932              );
 933          }
 934  
 935          if ( $disable_last ) {
 936              $page_links[] = '<span class="tablenav-pages-navspan button disabled" aria-hidden="true">&raquo;</span>';
 937          } else {
 938              $page_links[] = sprintf(
 939                  "<a class='last-page button' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
 940                  esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
 941                  __( 'Last page' ),
 942                  '&raquo;'
 943              );
 944          }
 945  
 946          $pagination_links_class = 'pagination-links';
 947          if ( ! empty( $infinite_scroll ) ) {
 948              $pagination_links_class .= ' hide-if-js';
 949          }
 950          $output .= "\n<span class='$pagination_links_class'>" . join( "\n", $page_links ) . '</span>';
 951  
 952          if ( $total_pages ) {
 953              $page_class = $total_pages < 2 ? ' one-page' : '';
 954          } else {
 955              $page_class = ' no-pages';
 956          }
 957          $this->_pagination = "<div class='tablenav-pages{$page_class}'>$output</div>";
 958  
 959          echo $this->_pagination;
 960      }
 961  
 962      /**
 963       * Gets a list of columns.
 964       *
 965       * The format is:
 966       * - `'internal-name' => 'Title'`
 967       *
 968       * @since 3.1.0
 969       * @abstract
 970       *
 971       * @return array
 972       */
 973  	public function get_columns() {
 974          die( 'function WP_List_Table::get_columns() must be overridden in a subclass.' );
 975      }
 976  
 977      /**
 978       * Gets a list of sortable columns.
 979       *
 980       * The format is:
 981       * - `'internal-name' => 'orderby'`
 982       * - `'internal-name' => array( 'orderby', 'asc' )` - The second element sets the initial sorting order.
 983       * - `'internal-name' => array( 'orderby', true )`  - The second element makes the initial order descending.
 984       *
 985       * @since 3.1.0
 986       *
 987       * @return array
 988       */
 989  	protected function get_sortable_columns() {
 990          return array();
 991      }
 992  
 993      /**
 994       * Gets the name of the default primary column.
 995       *
 996       * @since 4.3.0
 997       *
 998       * @return string Name of the default primary column, in this case, an empty string.
 999       */
1000  	protected function get_default_primary_column_name() {
1001          $columns = $this->get_columns();
1002          $column  = '';
1003  
1004          if ( empty( $columns ) ) {
1005              return $column;
1006          }
1007  
1008          // We need a primary defined so responsive views show something,
1009          // so let's fall back to the first non-checkbox column.
1010          foreach ( $columns as $col => $column_name ) {
1011              if ( 'cb' === $col ) {
1012                  continue;
1013              }
1014  
1015              $column = $col;
1016              break;
1017          }
1018  
1019          return $column;
1020      }
1021  
1022      /**
1023       * Public wrapper for WP_List_Table::get_default_primary_column_name().
1024       *
1025       * @since 4.4.0
1026       *
1027       * @return string Name of the default primary column.
1028       */
1029  	public function get_primary_column() {
1030          return $this->get_primary_column_name();
1031      }
1032  
1033      /**
1034       * Gets the name of the primary column.
1035       *
1036       * @since 4.3.0
1037       *
1038       * @return string The name of the primary column.
1039       */
1040  	protected function get_primary_column_name() {
1041          $columns = get_column_headers( $this->screen );
1042          $default = $this->get_default_primary_column_name();
1043  
1044          // If the primary column doesn't exist,
1045          // fall back to the first non-checkbox column.
1046          if ( ! isset( $columns[ $default ] ) ) {
1047              $default = WP_List_Table::get_default_primary_column_name();
1048          }
1049  
1050          /**
1051           * Filters the name of the primary column for the current list table.
1052           *
1053           * @since 4.3.0
1054           *
1055           * @param string $default Column name default for the specific list table, e.g. 'name'.
1056           * @param string $context Screen ID for specific list table, e.g. 'plugins'.
1057           */
1058          $column = apply_filters( 'list_table_primary_column', $default, $this->screen->id );
1059  
1060          if ( empty( $column ) || ! isset( $columns[ $column ] ) ) {
1061              $column = $default;
1062          }
1063  
1064          return $column;
1065      }
1066  
1067      /**
1068       * Gets a list of all, hidden and sortable columns, with filter applied.
1069       *
1070       * @since 3.1.0
1071       *
1072       * @return array
1073       */
1074  	protected function get_column_info() {
1075          // $_column_headers is already set / cached.
1076          if ( isset( $this->_column_headers ) && is_array( $this->_column_headers ) ) {
1077              // Back-compat for list tables that have been manually setting $_column_headers for horse reasons.
1078              // In 4.3, we added a fourth argument for primary column.
1079              $column_headers = array( array(), array(), array(), $this->get_primary_column_name() );
1080              foreach ( $this->_column_headers as $key => $value ) {
1081                  $column_headers[ $key ] = $value;
1082              }
1083  
1084              return $column_headers;
1085          }
1086  
1087          $columns = get_column_headers( $this->screen );
1088          $hidden  = get_hidden_columns( $this->screen );
1089  
1090          $sortable_columns = $this->get_sortable_columns();
1091          /**
1092           * Filters the list table sortable columns for a specific screen.
1093           *
1094           * The dynamic portion of the hook name, `$this->screen->id`, refers
1095           * to the ID of the current screen, usually a string.
1096           *
1097           * @since 3.1.0
1098           *
1099           * @param array $sortable_columns An array of sortable columns.
1100           */
1101          $_sortable = apply_filters( "manage_{$this->screen->id}_sortable_columns", $sortable_columns );
1102  
1103          $sortable = array();
1104          foreach ( $_sortable as $id => $data ) {
1105              if ( empty( $data ) ) {
1106                  continue;
1107              }
1108  
1109              $data = (array) $data;
1110              if ( ! isset( $data[1] ) ) {
1111                  $data[1] = false;
1112              }
1113  
1114              $sortable[ $id ] = $data;
1115          }
1116  
1117          $primary               = $this->get_primary_column_name();
1118          $this->_column_headers = array( $columns, $hidden, $sortable, $primary );
1119  
1120          return $this->_column_headers;
1121      }
1122  
1123      /**
1124       * Returns the number of visible columns.
1125       *
1126       * @since 3.1.0
1127       *
1128       * @return int
1129       */
1130  	public function get_column_count() {
1131          list ( $columns, $hidden ) = $this->get_column_info();
1132          $hidden                    = array_intersect( array_keys( $columns ), array_filter( $hidden ) );
1133          return count( $columns ) - count( $hidden );
1134      }
1135  
1136      /**
1137       * Prints column headers, accounting for hidden and sortable columns.
1138       *
1139       * @since 3.1.0
1140       *
1141       * @param bool $with_id Whether to set the ID attribute or not
1142       */
1143  	public function print_column_headers( $with_id = true ) {
1144          list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
1145  
1146          $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
1147          $current_url = remove_query_arg( 'paged', $current_url );
1148  
1149          if ( isset( $_GET['orderby'] ) ) {
1150              $current_orderby = $_GET['orderby'];
1151          } else {
1152              $current_orderby = '';
1153          }
1154  
1155          if ( isset( $_GET['order'] ) && 'desc' === $_GET['order'] ) {
1156              $current_order = 'desc';
1157          } else {
1158              $current_order = 'asc';
1159          }
1160  
1161          if ( ! empty( $columns['cb'] ) ) {
1162              static $cb_counter = 1;
1163              $columns['cb']     = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All' ) . '</label>'
1164                  . '<input id="cb-select-all-' . $cb_counter . '" type="checkbox" />';
1165              $cb_counter++;
1166          }
1167  
1168          foreach ( $columns as $column_key => $column_display_name ) {
1169              $class = array( 'manage-column', "column-$column_key" );
1170  
1171              if ( in_array( $column_key, $hidden, true ) ) {
1172                  $class[] = 'hidden';
1173              }
1174  
1175              if ( 'cb' === $column_key ) {
1176                  $class[] = 'check-column';
1177              } elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ), true ) ) {
1178                  $class[] = 'num';
1179              }
1180  
1181              if ( $column_key === $primary ) {
1182                  $class[] = 'column-primary';
1183              }
1184  
1185              if ( isset( $sortable[ $column_key ] ) ) {
1186                  list( $orderby, $desc_first ) = $sortable[ $column_key ];
1187  
1188                  if ( $current_orderby === $orderby ) {
1189                      $order = 'asc' === $current_order ? 'desc' : 'asc';
1190  
1191                      $class[] = 'sorted';
1192                      $class[] = $current_order;
1193                  } else {
1194                      $order = strtolower( $desc_first );
1195  
1196                      if ( ! in_array( $order, array( 'desc', 'asc' ), true ) ) {
1197                          $order = $desc_first ? 'desc' : 'asc';
1198                      }
1199  
1200                      $class[] = 'sortable';
1201                      $class[] = 'desc' === $order ? 'asc' : 'desc';
1202                  }
1203  
1204                  $column_display_name = sprintf(
1205                      '<a href="%s"><span>%s</span><span class="sorting-indicator"></span></a>',
1206                      esc_url( add_query_arg( compact( 'orderby', 'order' ), $current_url ) ),
1207                      $column_display_name
1208                  );
1209              }
1210  
1211              $tag   = ( 'cb' === $column_key ) ? 'td' : 'th';
1212              $scope = ( 'th' === $tag ) ? 'scope="col"' : '';
1213              $id    = $with_id ? "id='$column_key'" : '';
1214  
1215              if ( ! empty( $class ) ) {
1216                  $class = "class='" . join( ' ', $class ) . "'";
1217              }
1218  
1219              echo "<$tag $scope $id $class>$column_display_name</$tag>";
1220          }
1221      }
1222  
1223      /**
1224       * Displays the table.
1225       *
1226       * @since 3.1.0
1227       */
1228  	public function display() {
1229          $singular = $this->_args['singular'];
1230  
1231          $this->display_tablenav( 'top' );
1232  
1233          $this->screen->render_screen_reader_content( 'heading_list' );
1234          ?>
1235  <table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
1236      <thead>
1237      <tr>
1238          <?php $this->print_column_headers(); ?>
1239      </tr>
1240      </thead>
1241  
1242      <tbody id="the-list"
1243          <?php
1244          if ( $singular ) {
1245              echo " data-wp-lists='list:$singular'";
1246          }
1247          ?>
1248          >
1249          <?php $this->display_rows_or_placeholder(); ?>
1250      </tbody>
1251  
1252      <tfoot>
1253      <tr>
1254          <?php $this->print_column_headers( false ); ?>
1255      </tr>
1256      </tfoot>
1257  
1258  </table>
1259          <?php
1260          $this->display_tablenav( 'bottom' );
1261      }
1262  
1263      /**
1264       * Gets a list of CSS classes for the WP_List_Table table tag.
1265       *
1266       * @since 3.1.0
1267       *
1268       * @return string[] Array of CSS classes for the table tag.
1269       */
1270  	protected function get_table_classes() {
1271          $mode = get_user_setting( 'posts_list_mode', 'list' );
1272  
1273          $mode_class = esc_attr( 'table-view-' . $mode );
1274  
1275          return array( 'widefat', 'fixed', 'striped', $mode_class, $this->_args['plural'] );
1276      }
1277  
1278      /**
1279       * Generates the table navigation above or below the table
1280       *
1281       * @since 3.1.0
1282       * @param string $which
1283       */
1284  	protected function display_tablenav( $which ) {
1285          if ( 'top' === $which ) {
1286              wp_nonce_field( 'bulk-' . $this->_args['plural'] );
1287          }
1288          ?>
1289      <div class="tablenav <?php echo esc_attr( $which ); ?>">
1290  
1291          <?php if ( $this->has_items() ) : ?>
1292          <div class="alignleft actions bulkactions">
1293              <?php $this->bulk_actions( $which ); ?>
1294          </div>
1295              <?php
1296          endif;
1297          $this->extra_tablenav( $which );
1298          $this->pagination( $which );
1299          ?>
1300  
1301          <br class="clear" />
1302      </div>
1303          <?php
1304      }
1305  
1306      /**
1307       * Extra controls to be displayed between bulk actions and pagination.
1308       *
1309       * @since 3.1.0
1310       *
1311       * @param string $which
1312       */
1313  	protected function extra_tablenav( $which ) {}
1314  
1315      /**
1316       * Generates the tbody element for the list table.
1317       *
1318       * @since 3.1.0
1319       */
1320  	public function display_rows_or_placeholder() {
1321          if ( $this->has_items() ) {
1322              $this->display_rows();
1323          } else {
1324              echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
1325              $this->no_items();
1326              echo '</td></tr>';
1327          }
1328      }
1329  
1330      /**
1331       * Generates the table rows.
1332       *
1333       * @since 3.1.0
1334       */
1335  	public function display_rows() {
1336          foreach ( $this->items as $item ) {
1337              $this->single_row( $item );
1338          }
1339      }
1340  
1341      /**
1342       * Generates content for a single row of the table.
1343       *
1344       * @since 3.1.0
1345       *
1346       * @param object $item The current item
1347       */
1348  	public function single_row( $item ) {
1349          echo '<tr>';
1350          $this->single_row_columns( $item );
1351          echo '</tr>';
1352      }
1353  
1354      /**
1355       * @param object $item
1356       * @param string $column_name
1357       */
1358  	protected function column_default( $item, $column_name ) {}
1359  
1360      /**
1361       * @param object $item
1362       */
1363  	protected function column_cb( $item ) {}
1364  
1365      /**
1366       * Generates the columns for a single row of the table.
1367       *
1368       * @since 3.1.0
1369       *
1370       * @param object $item The current item.
1371       */
1372  	protected function single_row_columns( $item ) {
1373          list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
1374  
1375          foreach ( $columns as $column_name => $column_display_name ) {
1376              $classes = "$column_name column-$column_name";
1377              if ( $primary === $column_name ) {
1378                  $classes .= ' has-row-actions column-primary';
1379              }
1380  
1381              if ( in_array( $column_name, $hidden, true ) ) {
1382                  $classes .= ' hidden';
1383              }
1384  
1385              // Comments column uses HTML in the display name with screen reader text.
1386              // Instead of using esc_attr(), we strip tags to get closer to a user-friendly string.
1387              $data = 'data-colname="' . wp_strip_all_tags( $column_display_name ) . '"';
1388  
1389              $attributes = "class='$classes' $data";
1390  
1391              if ( 'cb' === $column_name ) {
1392                  echo '<th scope="row" class="check-column">';
1393                  echo $this->column_cb( $item );
1394                  echo '</th>';
1395              } elseif ( method_exists( $this, '_column_' . $column_name ) ) {
1396                  echo call_user_func(
1397                      array( $this, '_column_' . $column_name ),
1398                      $item,
1399                      $classes,
1400                      $data,
1401                      $primary
1402                  );
1403              } elseif ( method_exists( $this, 'column_' . $column_name ) ) {
1404                  echo "<td $attributes>";
1405                  echo call_user_func( array( $this, 'column_' . $column_name ), $item );
1406                  echo $this->handle_row_actions( $item, $column_name, $primary );
1407                  echo '</td>';
1408              } else {
1409                  echo "<td $attributes>";
1410                  echo $this->column_default( $item, $column_name );
1411                  echo $this->handle_row_actions( $item, $column_name, $primary );
1412                  echo '</td>';
1413              }
1414          }
1415      }
1416  
1417      /**
1418       * Generates and display row actions links for the list table.
1419       *
1420       * @since 4.3.0
1421       *
1422       * @param object $item        The item being acted upon.
1423       * @param string $column_name Current column name.
1424       * @param string $primary     Primary column name.
1425       * @return string The row actions HTML, or an empty string
1426       *                if the current column is not the primary column.
1427       */
1428  	protected function handle_row_actions( $item, $column_name, $primary ) {
1429          return $column_name === $primary ? '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>' : '';
1430      }
1431  
1432      /**
1433       * Handles an incoming ajax request (called from admin-ajax.php)
1434       *
1435       * @since 3.1.0
1436       */
1437  	public function ajax_response() {
1438          $this->prepare_items();
1439  
1440          ob_start();
1441          if ( ! empty( $_REQUEST['no_placeholder'] ) ) {
1442              $this->display_rows();
1443          } else {
1444              $this->display_rows_or_placeholder();
1445          }
1446  
1447          $rows = ob_get_clean();
1448  
1449          $response = array( 'rows' => $rows );
1450  
1451          if ( isset( $this->_pagination_args['total_items'] ) ) {
1452              $response['total_items_i18n'] = sprintf(
1453                  /* translators: Number of items. */
1454                  _n( '%s item', '%s items', $this->_pagination_args['total_items'] ),
1455                  number_format_i18n( $this->_pagination_args['total_items'] )
1456              );
1457          }
1458          if ( isset( $this->_pagination_args['total_pages'] ) ) {
1459              $response['total_pages']      = $this->_pagination_args['total_pages'];
1460              $response['total_pages_i18n'] = number_format_i18n( $this->_pagination_args['total_pages'] );
1461          }
1462  
1463          die( wp_json_encode( $response ) );
1464      }
1465  
1466      /**
1467       * Sends required variables to JavaScript land.
1468       *
1469       * @since 3.1.0
1470       */
1471  	public function _js_vars() {
1472          $args = array(
1473              'class'  => get_class( $this ),
1474              'screen' => array(
1475                  'id'   => $this->screen->id,
1476                  'base' => $this->screen->base,
1477              ),
1478          );
1479  
1480          printf( "<script type='text/javascript'>list_args = %s;</script>\n", wp_json_encode( $args ) );
1481      }
1482  }


Generated: Wed Aug 12 01:00:03 2020 Cross-referenced by PHPXref 0.7.1