*
* @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
*/
/**
* 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.
*
* @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;
$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
*
* @since 3.1.0
*
+ * @global WP_Screen $current_screen
+ *
* @return WP_Screen Current screen object
*/
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();
/**
* Stores old string-based help.
+ *
+ * @static
+ * @access private
+ *
+ * @var array
*/
private static $_old_compat_help = array();
* The screen object registry.
*
* @since 3.3.0
- * @var array
+ *
+ * @static
* @access private
+ *
+ * @var array
*/
private static $_registry = array();
* @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;
*
* @see set_current_screen()
* @since 3.3.0
+ *
+ * @global WP_Screen $current_screen
+ * @global string $taxnow
+ * @global string $typenow
*/
public function set_current_screen() {
global $current_screen, $taxnow, $typenow;
* @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 ) )
*
* @since 3.3.0
*
+ * @static
+ *
* @param WP_Screen $screen A screen object.
* @param string $help Help text.
*/
*
* @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 ] ) )
* This will trigger the deprecated filters for backwards compatibility.
*
* @since 3.3.0
+ *
+ * @global string $screen_layout_columns
*/
public function render_screen_meta() {
<div id="screen-meta-links">
<?php if ( $this->get_help_tabs() ) : ?>
<div id="contextual-help-link-wrap" class="hide-if-no-js screen-meta-toggle">
- <a href="#contextual-help-wrap" id="contextual-help-link" class="show-settings" aria-controls="contextual-help-wrap" aria-expanded="false"><?php _e( 'Help' ); ?></a>
+ <button type="button" id="contextual-help-link" class="button show-settings" aria-controls="contextual-help-wrap" aria-expanded="false"><?php _e( 'Help' ); ?></button>
</div>
<?php endif;
if ( $this->show_screen_options() ) : ?>
<div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle">
- <a href="#screen-options-wrap" id="show-settings-link" class="show-settings" aria-controls="screen-options-wrap" aria-expanded="false"><?php _e( 'Screen Options' ); ?></a>
+ <button type="button" id="show-settings-link" class="button show-settings" aria-controls="screen-options-wrap" aria-expanded="false"><?php _e( 'Screen Options' ); ?></button>
</div>
<?php endif; ?>
</div>
<?php
}
+ /**
+ *
+ * @global array $wp_meta_boxes
+ *
+ * @return bool
+ */
public function show_screen_options() {
global $wp_meta_boxes;
case 'post' :
$expand = '<div class="editor-expand hidden"><label for="editor-expand-toggle">';
$expand .= '<input type="checkbox" id="editor-expand-toggle"' . checked( get_user_setting( 'editor_expand', 'on' ), 'on', false ) . ' />';
- $expand .= __( 'Expand the editor to match the window height.' ) . '</label></div>';
+ $expand .= __( 'Enable full-height editor and distraction-free functionality.' ) . '</label></div>';
$this->_screen_settings = $expand;
break;
default:
* Render the screen options tab.
*
* @since 3.3.0
+ *
+ * @global array $wp_meta_boxes
*/
public function render_screen_options() {
global $wp_meta_boxes;
?>
<div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="<?php esc_attr_e('Screen Options Tab'); ?>">
- <form id="adv-settings" action="" method="post">
+ <form id="adv-settings" method="post">
<?php if ( isset( $wp_meta_boxes[ $this->id ] ) || $this->get_option( 'per_page' ) || ( $columns && empty( $columns['_title'] ) ) ) : ?>
<h5><?php _e( 'Show on screen' ); ?></h5>
<?php
* @since 3.3.0
*/
public function render_per_page_options() {
- if ( ! $this->get_option( 'per_page' ) )
+ if ( null === $this->get_option( 'per_page' ) ) {
return;
+ }
$per_page_label = $this->get_option( 'per_page', 'label' );
+ if ( null === $per_page_label ) {
+ $per_page_label = __( 'Number of items per page:' );
+ }
$option = $this->get_option( 'per_page', 'option' );
- if ( ! $option )
+ if ( ! $option ) {
$option = str_replace( '-', '_', "{$this->id}_per_page" );
+ }
$per_page = (int) get_user_option( $option );
if ( empty( $per_page ) || $per_page < 1 ) {
$per_page = $this->get_option( 'per_page', 'default' );
- if ( ! $per_page )
+ if ( ! $per_page ) {
$per_page = 20;
+ }
}
if ( 'edit_comments_per_page' == $option ) {
?>
<div class="screen-options">
<?php if ( $per_page_label ) : ?>
+ <label for="<?php echo esc_attr( $option ); ?>"><?php echo $per_page_label; ?></label>
<input type="number" step="1" min="1" max="999" class="screen-per-page" name="wp_screen_options[value]"
id="<?php echo esc_attr( $option ); ?>" maxlength="3"
value="<?php echo esc_attr( $per_page ); ?>" />
- <label for="<?php echo esc_attr( $option ); ?>">
- <?php echo esc_html( $per_page_label ); ?>
- </label>
<?php endif;
echo get_submit_button( __( 'Apply' ), 'button', 'screen-options-apply', false ); ?>
- <input type='hidden' name='wp_screen_options[option]' value='<?php echo esc_attr($option); ?>' />
+ <input type="hidden" name="wp_screen_options[option]" value="<?php echo esc_attr( $option ); ?>" />
</div>
<?php
}