X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/256a3b381f63716209b3527d0a14442ae570c283..refs/tags/wordpress-4.0:/wp-admin/includes/screen.php diff --git a/wp-admin/includes/screen.php b/wp-admin/includes/screen.php index 85ab7124..35f42671 100644 --- a/wp-admin/includes/screen.php +++ b/wp-admin/includes/screen.php @@ -20,8 +20,22 @@ function get_column_headers( $screen ) { static $column_headers = array(); - if ( ! isset( $column_headers[ $screen->id ] ) ) - $column_headers[ $screen->id ] = apply_filters( 'manage_' . $screen->id . '_columns', array() ); + if ( ! isset( $column_headers[ $screen->id ] ) ) { + + /** + * Filter the column headers for a list table on a specific screen. + * + * 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. + * + * @since 3.0.0 + * + * @param array $columns An array of column headers. Default empty. + */ + $column_headers[ $screen->id ] = apply_filters( "manage_{$screen->id}_columns", array() ); + } return $column_headers[ $screen->id ]; } @@ -101,9 +115,28 @@ function get_hidden_meta_boxes( $screen ) { else $hidden = array( 'slugdiv' ); } + + /** + * Filter the default list of hidden meta boxes. + * + * @since 3.1.0 + * + * @param array $hidden An array of meta boxes hidden by default. + * @param WP_Screen $screen WP_Screen object of the current screen. + */ $hidden = apply_filters( 'default_hidden_meta_boxes', $hidden, $screen ); } + /** + * Filter the list of hidden meta boxes. + * + * @since 3.3.0 + * + * @param array $hidden An array of hidden meta boxes. + * @param WP_Screen $screen WP_Screen object of the current screen. + * @param bool $use_defaults Whether to show the default meta boxes. + * Default true. + */ return apply_filters( 'hidden_meta_boxes', $hidden, $screen, $use_defaults ); } @@ -497,11 +530,19 @@ final class WP_Screen { * @see set_current_screen() * @since 3.3.0 */ - function set_current_screen() { + public function set_current_screen() { global $current_screen, $taxnow, $typenow; $current_screen = $this; $taxnow = $this->taxonomy; $typenow = $this->post_type; + + /** + * Fires after the current screen has been set. + * + * @since 3.0.0 + * + * @param WP_Screen $current_screen Current WP_Screen object. + */ do_action( 'current_screen', $current_screen ); } @@ -540,7 +581,7 @@ final class WP_Screen { * @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; } @@ -552,7 +593,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 ); @@ -747,14 +788,46 @@ final class WP_Screen { */ public function render_screen_meta() { - // Call old contextual_help_list filter. + /** + * Filter the legacy contextual help list. + * + * @since 2.7.0 + * @deprecated 3.3.0 Use get_current_screen()->add_help_tab() or + * get_current_screen()->remove_help_tab() instead. + * + * @param array $old_compat_help Old contextual help. + * @param WP_Screen $this Current WP_Screen instance. + */ self::$_old_compat_help = apply_filters( 'contextual_help_list', self::$_old_compat_help, $this ); $old_help = isset( self::$_old_compat_help[ $this->id ] ) ? self::$_old_compat_help[ $this->id ] : ''; + + /** + * Filter the legacy contextual help text. + * + * @since 2.7.0 + * @deprecated 3.3.0 Use get_current_screen()->add_help_tab() or + * get_current_screen()->remove_help_tab() instead. + * + * @param string $old_help Help text that appears on the screen. + * @param string $screen_id Screen ID. + * @param WP_Screen $this Current WP_Screen instance. + * + */ $old_help = apply_filters( 'contextual_help', $old_help, $this->id, $this ); // Default help only if there is no old-style block of text and no new-style help tabs. if ( empty( $old_help ) && ! $this->get_help_tabs() ) { + + /** + * Filter the default legacy contextual help text. + * + * @since 2.8.0 + * @deprecated 3.3.0 Use get_current_screen()->add_help_tab() or + * get_current_screen()->remove_help_tab() instead. + * + * @param string $old_help_default Default contextual help text. + */ $default_help = apply_filters( 'default_contextual_help', '' ); if ( $default_help ) $old_help = '

' . $default_help . '

'; @@ -835,7 +908,18 @@ final class WP_Screen { id, $this ); if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) ) @@ -883,20 +967,46 @@ final class WP_Screen { $show_screen = ! empty( $wp_meta_boxes[ $this->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; } + /** + * Filter the screen settings text displayed in the Screen Options tab. + * + * This filter is currently only used on the Widgets screen to enable + * accessibility mode. + * + * @since 3.0.0 + * + * @param string $screen_settings Screen settings. + * @param WP_Screen $this WP_Screen object. + */ $this->_screen_settings = apply_filters( 'screen_settings', $this->_screen_settings, $this ); if ( $this->_screen_settings || $this->_options ) $show_screen = true; + /** + * Filter whether to show the Screen Options tab. + * + * @since 3.2.0 + * + * @param bool $show_screen Whether to show Screen Options tab. + * Default true. + * @param WP_Screen $this Current WP_Screen instance. + */ $this->_show_screen_options = apply_filters( 'screen_options_show_screen', $show_screen, $this ); return $this->_show_screen_options; } @@ -907,11 +1017,10 @@ final class WP_Screen { * @since 3.3.0 */ 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(); ?>