| [ XREF Home ] [ Index ] |
PHP Cross Reference of WordPress TrunkProvided by Yoast |
[Summary view] [Print] [Text view]
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 3.1.0 8 */ 9 10 /** 11 * Fetch an instance of a WP_List_Table class. 12 * 13 * @access private 14 * @since 3.1.0 15 * 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. 18 */ 19 function _get_list_table( $class ) { 20 $core_classes = array( 21 //Site Admin 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', 33 // Network Admin 34 'WP_MS_Sites_List_Table' => 'ms-sites', 35 'WP_MS_Users_List_Table' => 'ms-users', 36 'WP_MS_Themes_List_Table' => 'ms-themes', 37 ); 38 39 if ( isset( $core_classes[ $class ] ) ) { 40 require_once( ABSPATH . 'wp-admin/includes/class-wp-' . $core_classes[ $class ] . '-list-table.php' ); 41 return new $class; 42 } 43 44 return false; 45 } 46 47 /** 48 * Register column headers for a particular screen. 49 * 50 * @since 2.7.0 51 * 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() 55 */ 56 function register_column_headers($screen, $columns) { 57 $wp_list_table = new _WP_List_Table_Compat($screen, $columns); 58 } 59 60 /** 61 * Prints column headers for a particular screen. 62 * 63 * @since 2.7.0 64 */ 65 function print_column_headers($screen, $id = true) { 66 $wp_list_table = new _WP_List_Table_Compat($screen); 67 68 $wp_list_table->print_column_headers($id); 69 } 70 71 /** 72 * Helper class to be used only by back compat functions 73 * 74 * @since 3.1.0 75 */ 76 class _WP_List_Table_Compat extends WP_List_Table { 77 var $_screen; 78 var $_columns; 79 80 function _WP_List_Table_Compat( $screen, $columns = array() ) { 81 if ( is_string( $screen ) ) 82 $screen = convert_to_screen( $screen ); 83 84 $this->_screen = $screen; 85 86 if ( !empty( $columns ) ) { 87 $this->_columns = $columns; 88 add_filter( 'manage_' . $screen->id . '_columns', array( &$this, 'get_columns' ), 0 ); 89 } 90 } 91 92 function get_column_info() { 93 $columns = get_column_headers( $this->_screen ); 94 $hidden = get_hidden_columns( $this->_screen ); 95 $sortable = array(); 96 97 return array( $columns, $hidden, $sortable ); 98 } 99 100 function get_columns() { 101 return $this->_columns; 102 } 103 } 104 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Jun 1 08:30:02 2011 |
Cross-referenced by PHPXref 0.7 Provided by Yoast and awesome WordPress Hosting |