3 * Helper functions for displaying a list of items in an ajaxified HTML table.
6 * @subpackage List_Table
11 * Fetch an instance of a WP_List_Table class.
16 * @param string $class The type of the list table, which is the class name.
17 * @return object|bool Object on success, false if the class does not exist.
19 function _get_list_table( $class ) {
20 $core_classes = array(
22 'WP_Posts_List_Table' => 'posts',
23 'WP_Media_List_Table' => 'media',
24 'WP_Terms_List_Table' => 'terms',
25 'WP_Users_List_Table' => 'users',
26 'WP_Comments_List_Table' => 'comments',
27 'WP_Post_Comments_List_Table' => 'comments',
28 'WP_Links_List_Table' => 'links',
29 'WP_Plugin_Install_List_Table' => 'plugin-install',
30 'WP_Themes_List_Table' => 'themes',
31 'WP_Theme_Install_List_Table' => 'theme-install',
32 'WP_Plugins_List_Table' => 'plugins',
34 'WP_MS_Sites_List_Table' => 'ms-sites',
35 'WP_MS_Users_List_Table' => 'ms-users',
36 'WP_MS_Themes_List_Table' => 'ms-themes',
39 if ( isset( $core_classes[ $class ] ) ) {
40 require_once( ABSPATH . 'wp-admin/includes/class-wp-' . $core_classes[ $class ] . '-list-table.php' );
48 * Register column headers for a particular screen.
52 * @param string $screen The handle for the screen to add help to. This is usually the hook name returned by the add_*_page() functions.
53 * @param array $columns An array of columns with column IDs as the keys and translated column names as the values
54 * @see get_column_headers(), print_column_headers(), get_hidden_columns()
56 function register_column_headers($screen, $columns) {
57 $wp_list_table = new _WP_List_Table_Compat($screen, $columns);
61 * Prints column headers for a particular screen.
65 function print_column_headers($screen, $id = true) {
66 $wp_list_table = new _WP_List_Table_Compat($screen);
68 $wp_list_table->print_column_headers($id);
72 * Helper class to be used only by back compat functions
76 class _WP_List_Table_Compat extends WP_List_Table {
80 function _WP_List_Table_Compat( $screen, $columns = array() ) {
81 if ( is_string( $screen ) )
82 $screen = convert_to_screen( $screen );
84 $this->_screen = $screen;
86 if ( !empty( $columns ) ) {
87 $this->_columns = $columns;
88 add_filter( 'manage_' . $screen->id . '_columns', array( &$this, 'get_columns' ), 0 );
92 function get_column_info() {
93 $columns = get_column_headers( $this->_screen );
94 $hidden = get_hidden_columns( $this->_screen );
97 return array( $columns, $hidden, $sortable );
100 function get_columns() {
101 return $this->_columns;