[ Index ] |
PHP Cross Reference of WordPress |
[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 * Fetches an instance of a WP_List_Table class. 12 * 13 * @access private 14 * @since 3.1.0 15 * 16 * @global string $hook_suffix 17 * 18 * @param string $class_name The type of the list table, which is the class name. 19 * @param array $args Optional. Arguments to pass to the class. Accepts 'screen'. 20 * @return WP_List_Table|false List table object on success, false if the class does not exist. 21 */ 22 function _get_list_table( $class_name, $args = array() ) { 23 $core_classes = array( 24 // Site Admin. 25 'WP_Posts_List_Table' => 'posts', 26 'WP_Media_List_Table' => 'media', 27 'WP_Terms_List_Table' => 'terms', 28 'WP_Users_List_Table' => 'users', 29 'WP_Comments_List_Table' => 'comments', 30 'WP_Post_Comments_List_Table' => array( 'comments', 'post-comments' ), 31 'WP_Links_List_Table' => 'links', 32 'WP_Plugin_Install_List_Table' => 'plugin-install', 33 'WP_Themes_List_Table' => 'themes', 34 'WP_Theme_Install_List_Table' => array( 'themes', 'theme-install' ), 35 'WP_Plugins_List_Table' => 'plugins', 36 'WP_Application_Passwords_List_Table' => 'application-passwords', 37 38 // Network Admin. 39 'WP_MS_Sites_List_Table' => 'ms-sites', 40 'WP_MS_Users_List_Table' => 'ms-users', 41 'WP_MS_Themes_List_Table' => 'ms-themes', 42 43 // Privacy requests tables. 44 'WP_Privacy_Data_Export_Requests_List_Table' => 'privacy-data-export-requests', 45 'WP_Privacy_Data_Removal_Requests_List_Table' => 'privacy-data-removal-requests', 46 ); 47 48 if ( isset( $core_classes[ $class_name ] ) ) { 49 foreach ( (array) $core_classes[ $class_name ] as $required ) { 50 require_once ABSPATH . 'wp-admin/includes/class-wp-' . $required . '-list-table.php'; 51 } 52 53 if ( isset( $args['screen'] ) ) { 54 $args['screen'] = convert_to_screen( $args['screen'] ); 55 } elseif ( isset( $GLOBALS['hook_suffix'] ) ) { 56 $args['screen'] = get_current_screen(); 57 } else { 58 $args['screen'] = null; 59 } 60 61 return new $class_name( $args ); 62 } 63 64 return false; 65 } 66 67 /** 68 * Register column headers for a particular screen. 69 * 70 * @see get_column_headers(), print_column_headers(), get_hidden_columns() 71 * 72 * @since 2.7.0 73 * 74 * @param string $screen The handle for the screen to register column headers for. This is 75 * usually the hook name returned by the `add_*_page()` functions. 76 * @param string[] $columns An array of columns with column IDs as the keys and translated 77 * column names as the values. 78 */ 79 function register_column_headers( $screen, $columns ) { 80 new _WP_List_Table_Compat( $screen, $columns ); 81 } 82 83 /** 84 * Prints column headers for a particular screen. 85 * 86 * @since 2.7.0 87 * 88 * @param string|WP_Screen $screen The screen hook name or screen object. 89 * @param bool $with_id Whether to set the ID attribute or not. 90 */ 91 function print_column_headers( $screen, $with_id = true ) { 92 $wp_list_table = new _WP_List_Table_Compat( $screen ); 93 94 $wp_list_table->print_column_headers( $with_id ); 95 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Dec 22 01:00:02 2024 | Cross-referenced by PHPXref 0.7.1 |