Update WP and plugins
This commit is contained in:
parent
10a4713229
commit
1fb77fc4ff
864 changed files with 101724 additions and 78262 deletions
|
@ -108,6 +108,7 @@ final class WP_Screen {
|
|||
/**
|
||||
* The taxonomy associated with the screen, if any.
|
||||
* The 'edit-tags.php?taxonomy=category' screen has a taxonomy of 'category'.
|
||||
*
|
||||
* @since 3.3.0
|
||||
* @var string
|
||||
*/
|
||||
|
@ -129,7 +130,7 @@ final class WP_Screen {
|
|||
*/
|
||||
private $_help_sidebar = '';
|
||||
|
||||
/**
|
||||
/**
|
||||
* The accessible hidden headings and text associated with the screen, if any.
|
||||
*
|
||||
* @since 4.4.0
|
||||
|
@ -140,8 +141,6 @@ final class WP_Screen {
|
|||
/**
|
||||
* Stores old string-based help.
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $_old_compat_help = array();
|
||||
|
@ -159,8 +158,6 @@ final class WP_Screen {
|
|||
*
|
||||
* @since 3.3.0
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $_registry = array();
|
||||
|
@ -194,12 +191,10 @@ final class WP_Screen {
|
|||
*
|
||||
* @since 3.3.0
|
||||
*
|
||||
* @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.
|
||||
* Defaults to the current $hook_suffix global.
|
||||
* @return WP_Screen Screen object.
|
||||
*/
|
||||
public static function get( $hook_name = '' ) {
|
||||
|
@ -208,34 +203,36 @@ final class WP_Screen {
|
|||
}
|
||||
|
||||
$post_type = $taxonomy = null;
|
||||
$in_admin = false;
|
||||
$action = '';
|
||||
$in_admin = false;
|
||||
$action = '';
|
||||
|
||||
if ( $hook_name )
|
||||
if ( $hook_name ) {
|
||||
$id = $hook_name;
|
||||
else
|
||||
} else {
|
||||
$id = $GLOBALS['hook_suffix'];
|
||||
}
|
||||
|
||||
// For those pesky meta boxes.
|
||||
if ( $hook_name && post_type_exists( $hook_name ) ) {
|
||||
$post_type = $id;
|
||||
$id = 'post'; // changes later. ends up being $base.
|
||||
$id = 'post'; // changes later. ends up being $base.
|
||||
} else {
|
||||
if ( '.php' == substr( $id, -4 ) )
|
||||
if ( '.php' == substr( $id, -4 ) ) {
|
||||
$id = substr( $id, 0, -4 );
|
||||
}
|
||||
|
||||
if ( 'post-new' == $id || 'link-add' == $id || 'media-new' == $id || 'user-new' == $id ) {
|
||||
$id = substr( $id, 0, -4 );
|
||||
$id = substr( $id, 0, -4 );
|
||||
$action = 'add';
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $post_type && $hook_name ) {
|
||||
if ( '-network' == substr( $id, -8 ) ) {
|
||||
$id = substr( $id, 0, -8 );
|
||||
$id = substr( $id, 0, -8 );
|
||||
$in_admin = 'network';
|
||||
} elseif ( '-user' == substr( $id, -5 ) ) {
|
||||
$id = substr( $id, 0, -5 );
|
||||
$id = substr( $id, 0, -5 );
|
||||
$in_admin = 'user';
|
||||
}
|
||||
|
||||
|
@ -243,60 +240,68 @@ final class WP_Screen {
|
|||
if ( 'edit-comments' != $id && 'edit-tags' != $id && 'edit-' == substr( $id, 0, 5 ) ) {
|
||||
$maybe = substr( $id, 5 );
|
||||
if ( taxonomy_exists( $maybe ) ) {
|
||||
$id = 'edit-tags';
|
||||
$id = 'edit-tags';
|
||||
$taxonomy = $maybe;
|
||||
} elseif ( post_type_exists( $maybe ) ) {
|
||||
$id = 'edit';
|
||||
$id = 'edit';
|
||||
$post_type = $maybe;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $in_admin )
|
||||
if ( ! $in_admin ) {
|
||||
$in_admin = 'site';
|
||||
}
|
||||
} else {
|
||||
if ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN )
|
||||
if ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) {
|
||||
$in_admin = 'network';
|
||||
elseif ( defined( 'WP_USER_ADMIN' ) && WP_USER_ADMIN )
|
||||
} elseif ( defined( 'WP_USER_ADMIN' ) && WP_USER_ADMIN ) {
|
||||
$in_admin = 'user';
|
||||
else
|
||||
} else {
|
||||
$in_admin = 'site';
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'index' == $id )
|
||||
if ( 'index' == $id ) {
|
||||
$id = 'dashboard';
|
||||
elseif ( 'front' == $id )
|
||||
} elseif ( 'front' == $id ) {
|
||||
$in_admin = false;
|
||||
}
|
||||
|
||||
$base = $id;
|
||||
|
||||
// If this is the current screen, see if we can be more accurate for post types and taxonomies.
|
||||
if ( ! $hook_name ) {
|
||||
if ( isset( $_REQUEST['post_type'] ) )
|
||||
if ( isset( $_REQUEST['post_type'] ) ) {
|
||||
$post_type = post_type_exists( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : false;
|
||||
if ( isset( $_REQUEST['taxonomy'] ) )
|
||||
}
|
||||
if ( isset( $_REQUEST['taxonomy'] ) ) {
|
||||
$taxonomy = taxonomy_exists( $_REQUEST['taxonomy'] ) ? $_REQUEST['taxonomy'] : false;
|
||||
}
|
||||
|
||||
switch ( $base ) {
|
||||
case 'post' :
|
||||
if ( isset( $_GET['post'] ) && isset( $_POST['post_ID'] ) && (int) $_GET['post'] !== (int) $_POST['post_ID'] )
|
||||
case 'post':
|
||||
if ( isset( $_GET['post'] ) && isset( $_POST['post_ID'] ) && (int) $_GET['post'] !== (int) $_POST['post_ID'] ) {
|
||||
wp_die( __( 'A post ID mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 );
|
||||
elseif ( isset( $_GET['post'] ) )
|
||||
} elseif ( isset( $_GET['post'] ) ) {
|
||||
$post_id = (int) $_GET['post'];
|
||||
elseif ( isset( $_POST['post_ID'] ) )
|
||||
} elseif ( isset( $_POST['post_ID'] ) ) {
|
||||
$post_id = (int) $_POST['post_ID'];
|
||||
else
|
||||
} else {
|
||||
$post_id = 0;
|
||||
}
|
||||
|
||||
if ( $post_id ) {
|
||||
$post = get_post( $post_id );
|
||||
if ( $post )
|
||||
if ( $post ) {
|
||||
$post_type = $post->post_type;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'edit-tags' :
|
||||
case 'term' :
|
||||
if ( null === $post_type && is_object_in_taxonomy( 'post', $taxonomy ? $taxonomy : 'post_tag' ) )
|
||||
case 'edit-tags':
|
||||
case 'term':
|
||||
if ( null === $post_type && is_object_in_taxonomy( 'post', $taxonomy ? $taxonomy : 'post_tag' ) ) {
|
||||
$post_type = 'post';
|
||||
}
|
||||
break;
|
||||
case 'upload':
|
||||
$post_type = 'attachment';
|
||||
|
@ -305,25 +310,29 @@ final class WP_Screen {
|
|||
}
|
||||
|
||||
switch ( $base ) {
|
||||
case 'post' :
|
||||
if ( null === $post_type )
|
||||
case 'post':
|
||||
if ( null === $post_type ) {
|
||||
$post_type = 'post';
|
||||
}
|
||||
$id = $post_type;
|
||||
break;
|
||||
case 'edit' :
|
||||
if ( null === $post_type )
|
||||
case 'edit':
|
||||
if ( null === $post_type ) {
|
||||
$post_type = 'post';
|
||||
}
|
||||
$id .= '-' . $post_type;
|
||||
break;
|
||||
case 'edit-tags' :
|
||||
case 'term' :
|
||||
if ( null === $taxonomy )
|
||||
case 'edit-tags':
|
||||
case 'term':
|
||||
if ( null === $taxonomy ) {
|
||||
$taxonomy = 'post_tag';
|
||||
}
|
||||
// The edit-tags ID does not contain the post type. Look for it in the request.
|
||||
if ( null === $post_type ) {
|
||||
$post_type = 'post';
|
||||
if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) )
|
||||
if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) {
|
||||
$post_type = $_REQUEST['post_type'];
|
||||
}
|
||||
}
|
||||
|
||||
$id = 'edit-' . $taxonomy;
|
||||
|
@ -340,11 +349,12 @@ final class WP_Screen {
|
|||
|
||||
if ( isset( self::$_registry[ $id ] ) ) {
|
||||
$screen = self::$_registry[ $id ];
|
||||
if ( $screen === get_current_screen() )
|
||||
if ( $screen === get_current_screen() ) {
|
||||
return $screen;
|
||||
}
|
||||
} else {
|
||||
$screen = new WP_Screen();
|
||||
$screen->id = $id;
|
||||
$screen = new WP_Screen();
|
||||
$screen->id = $id;
|
||||
}
|
||||
|
||||
$screen->base = $base;
|
||||
|
@ -373,8 +383,8 @@ final class WP_Screen {
|
|||
public function set_current_screen() {
|
||||
global $current_screen, $taxnow, $typenow;
|
||||
$current_screen = $this;
|
||||
$taxnow = $this->taxonomy;
|
||||
$typenow = $this->post_type;
|
||||
$taxnow = $this->taxonomy;
|
||||
$typenow = $this->post_type;
|
||||
|
||||
/**
|
||||
* Fires after the current screen has been set.
|
||||
|
@ -403,8 +413,9 @@ final class WP_Screen {
|
|||
* @return bool True if the screen is in the indicated admin, false otherwise.
|
||||
*/
|
||||
public function in_admin( $admin = null ) {
|
||||
if ( empty( $admin ) )
|
||||
if ( empty( $admin ) ) {
|
||||
return (bool) $this->in_admin;
|
||||
}
|
||||
|
||||
return ( $admin == $this->in_admin );
|
||||
}
|
||||
|
@ -430,8 +441,6 @@ final class WP_Screen {
|
|||
*
|
||||
* @since 3.3.0
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @param WP_Screen $screen A screen object.
|
||||
* @param string $help Help text.
|
||||
*/
|
||||
|
@ -448,9 +457,9 @@ final class WP_Screen {
|
|||
* @param string $parent_file The parent file of the screen. Typically the $parent_file global.
|
||||
*/
|
||||
public function set_parentage( $parent_file ) {
|
||||
$this->parent_file = $parent_file;
|
||||
$this->parent_file = $parent_file;
|
||||
list( $this->parent_base ) = explode( '?', $parent_file );
|
||||
$this->parent_base = str_replace( '.php', '', $this->parent_base );
|
||||
$this->parent_base = str_replace( '.php', '', $this->parent_base );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -508,11 +517,13 @@ final class WP_Screen {
|
|||
* @return string The option value if set, null otherwise.
|
||||
*/
|
||||
public function get_option( $option, $key = false ) {
|
||||
if ( ! isset( $this->_options[ $option ] ) )
|
||||
if ( ! isset( $this->_options[ $option ] ) ) {
|
||||
return null;
|
||||
}
|
||||
if ( $key ) {
|
||||
if ( isset( $this->_options[ $option ][ $key ] ) )
|
||||
if ( isset( $this->_options[ $option ][ $key ] ) ) {
|
||||
return $this->_options[ $option ][ $key ];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return $this->_options[ $option ];
|
||||
|
@ -559,8 +570,9 @@ final class WP_Screen {
|
|||
* @return array Help tab arguments.
|
||||
*/
|
||||
public function get_help_tab( $id ) {
|
||||
if ( ! isset( $this->_help_tabs[ $id ] ) )
|
||||
if ( ! isset( $this->_help_tabs[ $id ] ) ) {
|
||||
return null;
|
||||
}
|
||||
return $this->_help_tabs[ $id ];
|
||||
}
|
||||
|
||||
|
@ -589,13 +601,14 @@ final class WP_Screen {
|
|||
'callback' => false,
|
||||
'priority' => 10,
|
||||
);
|
||||
$args = wp_parse_args( $args, $defaults );
|
||||
$args = wp_parse_args( $args, $defaults );
|
||||
|
||||
$args['id'] = sanitize_html_class( $args['id'] );
|
||||
|
||||
// Ensure we have an ID and title.
|
||||
if ( ! $args['id'] || ! $args['title'] )
|
||||
if ( ! $args['id'] || ! $args['title'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Allows for overriding an existing tab with that ID.
|
||||
$this->_help_tabs[ $args['id'] ] = $args;
|
||||
|
@ -661,7 +674,7 @@ final class WP_Screen {
|
|||
return $this->columns;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Get the accessible hidden headings and text used in the screen.
|
||||
*
|
||||
* @since 4.4.0
|
||||
|
@ -711,7 +724,7 @@ final class WP_Screen {
|
|||
'heading_pagination' => __( 'Items list navigation' ),
|
||||
'heading_list' => __( 'Items list' ),
|
||||
);
|
||||
$content = wp_parse_args( $content, $defaults );
|
||||
$content = wp_parse_args( $content, $defaults );
|
||||
|
||||
$this->_screen_reader_content = $content;
|
||||
}
|
||||
|
@ -760,7 +773,6 @@ final class WP_Screen {
|
|||
* @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 );
|
||||
|
||||
|
@ -777,29 +789,33 @@ final class WP_Screen {
|
|||
* @param string $old_help_default Default contextual help text.
|
||||
*/
|
||||
$default_help = apply_filters( 'default_contextual_help', '' );
|
||||
if ( $default_help )
|
||||
if ( $default_help ) {
|
||||
$old_help = '<p>' . $default_help . '</p>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $old_help ) {
|
||||
$this->add_help_tab( array(
|
||||
'id' => 'old-contextual-help',
|
||||
'title' => __('Overview'),
|
||||
'content' => $old_help,
|
||||
) );
|
||||
$this->add_help_tab(
|
||||
array(
|
||||
'id' => 'old-contextual-help',
|
||||
'title' => __( 'Overview' ),
|
||||
'content' => $old_help,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$help_sidebar = $this->get_help_sidebar();
|
||||
|
||||
$help_class = 'hidden';
|
||||
if ( ! $help_sidebar )
|
||||
if ( ! $help_sidebar ) {
|
||||
$help_class .= ' no-sidebar';
|
||||
}
|
||||
|
||||
// Time to render!
|
||||
?>
|
||||
<div id="screen-meta" class="metabox-prefs">
|
||||
|
||||
<div id="contextual-help-wrap" class="<?php echo esc_attr( $help_class ); ?>" tabindex="-1" aria-label="<?php esc_attr_e('Contextual Help Tab'); ?>">
|
||||
<div id="contextual-help-wrap" class="<?php echo esc_attr( $help_class ); ?>" tabindex="-1" aria-label="<?php esc_attr_e( 'Contextual Help Tab' ); ?>">
|
||||
<div id="contextual-help-back"></div>
|
||||
<div id="contextual-help-columns">
|
||||
<div class="contextual-help-tabs">
|
||||
|
@ -816,7 +832,7 @@ final class WP_Screen {
|
|||
<?php echo esc_html( $tab['title'] ); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
<?php
|
||||
$class = '';
|
||||
endforeach;
|
||||
?>
|
||||
|
@ -832,7 +848,7 @@ final class WP_Screen {
|
|||
<div class="contextual-help-tabs-wrap">
|
||||
<?php
|
||||
$classes = 'help-tab-content active';
|
||||
foreach ( $this->get_help_tabs() as $tab ):
|
||||
foreach ( $this->get_help_tabs() as $tab ) :
|
||||
$panel_id = "tab-panel-{$tab['id']}";
|
||||
?>
|
||||
|
||||
|
@ -842,11 +858,12 @@ final class WP_Screen {
|
|||
echo $tab['content'];
|
||||
|
||||
// If it exists, fire tab callback.
|
||||
if ( ! empty( $tab['callback'] ) )
|
||||
if ( ! empty( $tab['callback'] ) ) {
|
||||
call_user_func_array( $tab['callback'], array( $this, $tab ) );
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
<?php
|
||||
$classes = 'help-tab-content';
|
||||
endforeach;
|
||||
?>
|
||||
|
@ -870,33 +887,39 @@ final class WP_Screen {
|
|||
*/
|
||||
$columns = apply_filters( 'screen_layout_columns', array(), $this->id, $this );
|
||||
|
||||
if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) )
|
||||
$this->add_option( 'layout_columns', array('max' => $columns[ $this->id ] ) );
|
||||
if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) ) {
|
||||
$this->add_option( 'layout_columns', array( 'max' => $columns[ $this->id ] ) );
|
||||
}
|
||||
|
||||
if ( $this->get_option( 'layout_columns' ) ) {
|
||||
$this->columns = (int) get_user_option("screen_layout_$this->id");
|
||||
$this->columns = (int) get_user_option( "screen_layout_$this->id" );
|
||||
|
||||
if ( ! $this->columns && $this->get_option( 'layout_columns', 'default' ) )
|
||||
if ( ! $this->columns && $this->get_option( 'layout_columns', 'default' ) ) {
|
||||
$this->columns = $this->get_option( 'layout_columns', 'default' );
|
||||
}
|
||||
}
|
||||
$GLOBALS[ 'screen_layout_columns' ] = $this->columns; // Set the global for back-compat.
|
||||
$GLOBALS['screen_layout_columns'] = $this->columns; // Set the global for back-compat.
|
||||
|
||||
// Add screen options
|
||||
if ( $this->show_screen_options() )
|
||||
if ( $this->show_screen_options() ) {
|
||||
$this->render_screen_options();
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
if ( ! $this->get_help_tabs() && ! $this->show_screen_options() )
|
||||
if ( ! $this->get_help_tabs() && ! $this->show_screen_options() ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<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">
|
||||
<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() ) : ?>
|
||||
<?php
|
||||
endif;
|
||||
if ( $this->show_screen_options() ) :
|
||||
?>
|
||||
<div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle">
|
||||
<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>
|
||||
|
@ -906,7 +929,6 @@ final class WP_Screen {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @global array $wp_meta_boxes
|
||||
*
|
||||
* @return bool
|
||||
|
@ -914,27 +936,21 @@ final class WP_Screen {
|
|||
public function show_screen_options() {
|
||||
global $wp_meta_boxes;
|
||||
|
||||
if ( is_bool( $this->_show_screen_options ) )
|
||||
if ( is_bool( $this->_show_screen_options ) ) {
|
||||
return $this->_show_screen_options;
|
||||
}
|
||||
|
||||
$columns = get_column_headers( $this );
|
||||
|
||||
$show_screen = ! empty( $wp_meta_boxes[ $this->id ] ) || $columns || $this->get_option( 'per_page' );
|
||||
|
||||
switch ( $this->base ) {
|
||||
case 'widgets':
|
||||
$nonce = wp_create_nonce( 'widgets-access' );
|
||||
$this->_screen_settings = '<p><a id="access-on" href="widgets.php?widgets-access=on&_wpnonce=' . urlencode( $nonce ) . '">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off&_wpnonce=' . urlencode( $nonce ) . '">' . __('Disable accessibility mode') . "</a></p>\n";
|
||||
break;
|
||||
case 'post' :
|
||||
$expand = '<fieldset class="editor-expand hidden"><legend>' . __( 'Additional settings' ) . '</legend><label for="editor-expand-toggle">';
|
||||
$expand .= '<input type="checkbox" id="editor-expand-toggle"' . checked( get_user_setting( 'editor_expand', 'on' ), 'on', false ) . ' />';
|
||||
$expand .= __( 'Enable full-height editor and distraction-free functionality.' ) . '</label></fieldset>';
|
||||
$this->_screen_settings = $expand;
|
||||
break;
|
||||
default:
|
||||
$this->_screen_settings = '';
|
||||
break;
|
||||
$this->_screen_settings = '';
|
||||
|
||||
if ( 'post' === $this->base ) {
|
||||
$expand = '<fieldset class="editor-expand hidden"><legend>' . __( 'Additional settings' ) . '</legend><label for="editor-expand-toggle">';
|
||||
$expand .= '<input type="checkbox" id="editor-expand-toggle"' . checked( get_user_setting( 'editor_expand', 'on' ), 'on', false ) . ' />';
|
||||
$expand .= __( 'Enable full-height editor and distraction-free functionality.' ) . '</label></fieldset>';
|
||||
$this->_screen_settings = $expand;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -950,8 +966,9 @@ final class WP_Screen {
|
|||
*/
|
||||
$this->_screen_settings = apply_filters( 'screen_settings', $this->_screen_settings, $this );
|
||||
|
||||
if ( $this->_screen_settings || $this->_options )
|
||||
if ( $this->_screen_settings || $this->_options ) {
|
||||
$show_screen = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters whether to show the Screen Options tab.
|
||||
|
@ -976,22 +993,25 @@ final class WP_Screen {
|
|||
* }
|
||||
*/
|
||||
public function render_screen_options( $options = array() ) {
|
||||
$options = wp_parse_args( $options, array(
|
||||
'wrap' => true,
|
||||
) );
|
||||
$options = wp_parse_args(
|
||||
$options,
|
||||
array(
|
||||
'wrap' => true,
|
||||
)
|
||||
);
|
||||
|
||||
$wrapper_start = $wrapper_end = $form_start = $form_end = '';
|
||||
|
||||
// Output optional wrapper.
|
||||
if ( $options['wrap'] ) {
|
||||
$wrapper_start = '<div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="' . esc_attr__( 'Screen Options Tab' ) . '">';
|
||||
$wrapper_end = '</div>';
|
||||
$wrapper_end = '</div>';
|
||||
}
|
||||
|
||||
// Don't output the form and nonce for the widgets accessibility mode links.
|
||||
if ( 'widgets' !== $this->base ) {
|
||||
$form_start = "\n<form id='adv-settings' method='post'>\n";
|
||||
$form_end = "\n" . wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false, false ) . "\n</form>\n";
|
||||
$form_end = "\n" . wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false, false ) . "\n</form>\n";
|
||||
}
|
||||
|
||||
echo $wrapper_start . $form_start;
|
||||
|
@ -1040,24 +1060,20 @@ final class WP_Screen {
|
|||
<?php
|
||||
meta_box_prefs( $this );
|
||||
|
||||
if ( 'dashboard' === $this->id && has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) {
|
||||
if ( isset( $_GET['welcome'] ) ) {
|
||||
$welcome_checked = empty( $_GET['welcome'] ) ? 0 : 1;
|
||||
update_user_meta( get_current_user_id(), 'show_welcome_panel', $welcome_checked );
|
||||
} else {
|
||||
$welcome_checked = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
|
||||
if ( '' === $welcome_checked ) {
|
||||
$welcome_checked = '1';
|
||||
}
|
||||
if ( '2' === $welcome_checked && wp_get_current_user()->user_email != get_option( 'admin_email' ) ) {
|
||||
$welcome_checked = false;
|
||||
}
|
||||
if ( 'dashboard' === $this->id && has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) {
|
||||
if ( isset( $_GET['welcome'] ) ) {
|
||||
$welcome_checked = empty( $_GET['welcome'] ) ? 0 : 1;
|
||||
update_user_meta( get_current_user_id(), 'show_welcome_panel', $welcome_checked );
|
||||
} else {
|
||||
$welcome_checked = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
|
||||
if ( 2 == $welcome_checked && wp_get_current_user()->user_email != get_option( 'admin_email' ) ) {
|
||||
$welcome_checked = false;
|
||||
}
|
||||
echo '<label for="wp_welcome_panel-hide">';
|
||||
echo '<input type="checkbox" id="wp_welcome_panel-hide"' . checked( (bool) $welcome_checked, true, false ) . ' />';
|
||||
echo _x( 'Welcome', 'Welcome panel' ) . "</label>\n";
|
||||
}
|
||||
|
||||
echo '<label for="wp_welcome_panel-hide">';
|
||||
echo '<input type="checkbox" id="wp_welcome_panel-hide"' . checked( (bool) $welcome_checked, true, false ) . ' />';
|
||||
echo _x( 'Welcome', 'Welcome panel' ) . "</label>\n";
|
||||
}
|
||||
?>
|
||||
</fieldset>
|
||||
<?php
|
||||
|
@ -1122,20 +1138,22 @@ final class WP_Screen {
|
|||
}
|
||||
|
||||
$screen_layout_columns = $this->get_columns();
|
||||
$num = $this->get_option( 'layout_columns', 'max' );
|
||||
$num = $this->get_option( 'layout_columns', 'max' );
|
||||
|
||||
?>
|
||||
<fieldset class='columns-prefs'>
|
||||
<legend class="screen-layout"><?php _e( 'Layout' ); ?></legend><?php
|
||||
for ( $i = 1; $i <= $num; ++$i ):
|
||||
?>
|
||||
<label class="columns-prefs-<?php echo $i; ?>">
|
||||
<input type='radio' name='screen_columns' value='<?php echo esc_attr( $i ); ?>'
|
||||
<?php checked( $screen_layout_columns, $i ); ?> />
|
||||
<?php printf( _n( '%s column', '%s columns', $i ), number_format_i18n( $i ) ); ?>
|
||||
<legend class="screen-layout"><?php _e( 'Layout' ); ?></legend>
|
||||
<?php
|
||||
for ( $i = 1; $i <= $num; ++$i ) :
|
||||
?>
|
||||
<label class="columns-prefs-<?php echo $i; ?>">
|
||||
<input type='radio' name='screen_columns' value='<?php echo esc_attr( $i ); ?>'
|
||||
<?php checked( $screen_layout_columns, $i ); ?> />
|
||||
<?php printf( _n( '%s column', '%s columns', $i ), number_format_i18n( $i ) ); ?>
|
||||
</label>
|
||||
<?php
|
||||
endfor; ?>
|
||||
<?php
|
||||
endfor;
|
||||
?>
|
||||
</fieldset>
|
||||
<?php
|
||||
}
|
||||
|
@ -1219,15 +1237,20 @@ final class WP_Screen {
|
|||
return;
|
||||
}
|
||||
|
||||
$view_mode_post_types = get_post_types( array( 'hierarchical' => false, 'show_ui' => true ) );
|
||||
$view_mode_post_types = get_post_types(
|
||||
array(
|
||||
'hierarchical' => false,
|
||||
'show_ui' => true,
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Filters the post types that have different view mode options.
|
||||
*
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @param array $view_mode_post_types Array of post types that can change view modes.
|
||||
* Default non-hierarchical post types with show_ui on.
|
||||
* @param string[] $view_mode_post_types Array of post types that can change view modes.
|
||||
* Default non-hierarchical post types with show_ui on.
|
||||
*/
|
||||
$view_mode_post_types = apply_filters( 'view_mode_post_types', $view_mode_post_types );
|
||||
|
||||
|
@ -1239,7 +1262,7 @@ final class WP_Screen {
|
|||
|
||||
// This needs a submit button
|
||||
add_filter( 'screen_options_show_submit', '__return_true' );
|
||||
?>
|
||||
?>
|
||||
<fieldset class="metabox-prefs view-mode">
|
||||
<legend><?php _e( 'View Mode' ); ?></legend>
|
||||
<label for="list-view-mode">
|
||||
|
@ -1251,7 +1274,7 @@ final class WP_Screen {
|
|||
<?php _e( 'Excerpt View' ); ?>
|
||||
</label>
|
||||
</fieldset>
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue