home *** CD-ROM | disk | FTP | other *** search
/ HTML Examples / WP.iso / wordpress / wp-admin / includes / class-wp-list-table-compat.php < prev    next >
Encoding:
PHP Script  |  2017-07-26  |  1.0 KB  |  52 lines

  1. <?php
  2. /**
  3.  * Helper functions for displaying a list of items in an ajaxified HTML table.
  4.  *
  5.  * @package WordPress
  6.  * @subpackage List_Table
  7.  * @since 4.7.0
  8.  */
  9.  
  10. /**
  11.  * Helper class to be used only by back compat functions
  12.  *
  13.  * @since 3.1.0
  14.  */
  15. class _WP_List_Table_Compat extends WP_List_Table {
  16.     public $_screen;
  17.     public $_columns;
  18.  
  19.     public function __construct( $screen, $columns = array() ) {
  20.         if ( is_string( $screen ) )
  21.             $screen = convert_to_screen( $screen );
  22.  
  23.         $this->_screen = $screen;
  24.  
  25.         if ( !empty( $columns ) ) {
  26.             $this->_columns = $columns;
  27.             add_filter( 'manage_' . $screen->id . '_columns', array( $this, 'get_columns' ), 0 );
  28.         }
  29.     }
  30.  
  31.     /**
  32.      *
  33.      * @return array
  34.      */
  35.     protected function get_column_info() {
  36.         $columns = get_column_headers( $this->_screen );
  37.         $hidden = get_hidden_columns( $this->_screen );
  38.         $sortable = array();
  39.         $primary = $this->get_default_primary_column_name();
  40.  
  41.         return array( $columns, $hidden, $sortable, $primary );
  42.     }
  43.  
  44.     /**
  45.      *
  46.      * @return array
  47.      */
  48.     public function get_columns() {
  49.         return $this->_columns;
  50.     }
  51. }
  52.