X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/41578db67d72562346e4dbb2a14889b23d522813..dc1231b7312fbdca99e9e887cc2bb35a28f85cdc:/wp-admin/includes/screen.php diff --git a/wp-admin/includes/screen.php b/wp-admin/includes/screen.php index 7d4ec881..fba5dc9d 100644 --- a/wp-admin/includes/screen.php +++ b/wp-admin/includes/screen.php @@ -11,6 +11,8 @@ * * @since 2.7.0 * + * @staticvar array $column_headers + * * @param string|WP_Screen $screen The screen you want the headers for * @return array Containing the headers in the format id => UI String */ @@ -25,7 +27,7 @@ function get_column_headers( $screen ) { /** * Filter the column headers for a list table on a specific screen. * - * The dynamic portion of the hook name, $screen->id, refers to the + * The dynamic portion of the hook name, `$screen->id`, refers to the * ID of a specific screen. For example, the screen ID for the Posts * list table is edit-post, so the filter for that screen would be * manage_edit-post_columns. @@ -34,7 +36,7 @@ function get_column_headers( $screen ) { * * @param array $columns An array of column headers. Default empty. */ - $column_headers[ $screen->id ] = apply_filters( 'manage_' . $screen->id . '_columns', array() ); + $column_headers[ $screen->id ] = apply_filters( "manage_{$screen->id}_columns", array() ); } return $column_headers[ $screen->id ]; @@ -60,7 +62,9 @@ function get_hidden_columns( $screen ) { * * @since 2.7.0 * - * @param string|WP_Screen $screen + * @global array $wp_meta_boxes + * + * @param WP_Screen $screen */ function meta_box_prefs( $screen ) { global $wp_meta_boxes; @@ -73,9 +77,12 @@ function meta_box_prefs( $screen ) { $hidden = get_hidden_meta_boxes($screen); - foreach ( array_keys($wp_meta_boxes[$screen->id]) as $context ) { - foreach ( array_keys($wp_meta_boxes[$screen->id][$context]) as $priority ) { - foreach ( $wp_meta_boxes[$screen->id][$context][$priority] as $box ) { + foreach ( array_keys( $wp_meta_boxes[ $screen->id ] ) as $context ) { + foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { + if ( ! isset( $wp_meta_boxes[ $screen->id ][ $context ][ $priority ] ) ) { + continue; + } + foreach ( $wp_meta_boxes[ $screen->id ][ $context ][ $priority ] as $box ) { if ( false == $box || ! $box['title'] ) continue; // Submit box cannot be hidden @@ -162,6 +169,8 @@ function add_screen_option( $option, $args = array() ) { * * @since 3.1.0 * + * @global WP_Screen $current_screen + * * @return WP_Screen Current screen object */ function get_current_screen() { @@ -177,10 +186,9 @@ function get_current_screen() { * Set the current screen object * * @since 3.0.0 - * @uses $current_screen * * @param mixed $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen, - * or an existing screen object. + * or an existing screen object. */ function set_current_screen( $hook_name = '' ) { WP_Screen::get( $hook_name )->set_current_screen(); @@ -324,6 +332,11 @@ final class WP_Screen { /** * Stores old string-based help. + * + * @static + * @access private + * + * @var array */ private static $_old_compat_help = array(); @@ -340,8 +353,11 @@ final class WP_Screen { * The screen object registry. * * @since 3.3.0 - * @var array + * + * @static * @access private + * + * @var array */ private static $_registry = array(); @@ -369,14 +385,18 @@ final class WP_Screen { * @since 3.3.0 * @access public * - * @param string $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen. - * Defaults to the current $hook_suffix global. + * @static + * + * @global string $hook_suffix + * + * @param string|WP_Screen $hook_name Optional. The hook name (also known as the hook suffix) used to determine the screen. + * Defaults to the current $hook_suffix global. * @return WP_Screen Screen object. */ public static function get( $hook_name = '' ) { - - if ( is_a( $hook_name, 'WP_Screen' ) ) + if ( $hook_name instanceof WP_Screen ) { return $hook_name; + } $post_type = $taxonomy = null; $in_admin = false; @@ -529,8 +549,12 @@ final class WP_Screen { * * @see set_current_screen() * @since 3.3.0 + * + * @global WP_Screen $current_screen + * @global string $taxnow + * @global string $typenow */ - function set_current_screen() { + public function set_current_screen() { global $current_screen, $taxnow, $typenow; $current_screen = $this; $taxnow = $this->taxonomy; @@ -560,9 +584,8 @@ final class WP_Screen { * @since 3.5.0 * * @param string $admin The admin to check against (network | user | site). - * If empty any of the three admins will result in true. - * @return boolean True if the screen is in the indicated admin, false otherwise. - * + * If empty any of the three admins will result in true. + * @return bool True if the screen is in the indicated admin, false otherwise. */ public function in_admin( $admin = null ) { if ( empty( $admin ) ) @@ -578,10 +601,12 @@ final class WP_Screen { * * @since 3.3.0 * + * @static + * * @param WP_Screen $screen A screen object. * @param string $help Help text. */ - static function add_old_compat_help( $screen, $help ) { + public static function add_old_compat_help( $screen, $help ) { self::$_old_compat_help[ $screen->id ] = $help; } @@ -593,7 +618,7 @@ final class WP_Screen { * * @param string $parent_file The parent file of the screen. Typically the $parent_file global. */ - function set_parentage( $parent_file ) { + public function set_parentage( $parent_file ) { $this->parent_file = $parent_file; list( $this->parent_base ) = explode( '?', $parent_file ); $this->parent_base = str_replace( '.php', '', $this->parent_base ); @@ -648,8 +673,10 @@ final class WP_Screen { * * @since 3.3.0 * - * @param string $option Option ID. - * @param mixed $key Optional. Specific array key for when the option is an array. + * @param string $option Option name. + * @param string $key Optional. Specific array key for when the option is an array. + * Default false. + * @return string The option value if set, null otherwise. */ public function get_option( $option, $key = false ) { if ( ! isset( $this->_options[ $option ] ) ) @@ -785,6 +812,8 @@ final class WP_Screen { * This will trigger the deprecated filters for backwards compatibility. * * @since 3.3.0 + * + * @global string $screen_layout_columns */ public function render_screen_meta() { @@ -945,18 +974,24 @@ final class WP_Screen { id ] ) || $columns || $this->get_option( 'per_page' ); - switch ( $this->id ) { + switch ( $this->base ) { case 'widgets': $this->_screen_settings = '

' . __('Enable accessibility mode') . '' . __('Disable accessibility mode') . "

\n"; break; + case 'post' : + $expand = ''; + $this->_screen_settings = $expand; + break; default: $this->_screen_settings = ''; break; @@ -1009,17 +1050,18 @@ final class WP_Screen { * Render the screen options tab. * * @since 3.3.0 + * + * @global array $wp_meta_boxes */ public function render_screen_options() { - global $wp_meta_boxes, $wp_list_table; + global $wp_meta_boxes; $columns = get_column_headers( $this ); $hidden = get_hidden_columns( $this ); - $post = get_post(); ?>