]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/includes/class-wp-list-table-compat.php
WordPress 4.7.2
[autoinstalls/wordpress.git] / wp-admin / includes / class-wp-list-table-compat.php
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          * @access protected
33          *
34          * @return array
35          */
36         protected function get_column_info() {
37                 $columns = get_column_headers( $this->_screen );
38                 $hidden = get_hidden_columns( $this->_screen );
39                 $sortable = array();
40                 $primary = $this->get_default_primary_column_name();
41
42                 return array( $columns, $hidden, $sortable, $primary );
43         }
44
45         /**
46          * @access public
47          *
48          * @return array
49          */
50         public function get_columns() {
51                 return $this->_columns;
52         }
53 }