From d021cb8bc08b1c7dd8d9121e163e0dd332afa7a7 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sat, 10 Oct 2015 15:20:24 +0000 Subject: [PATCH] WP Screen: after [34991], avoid unnecessary nesting levels and remove unused global import. See #33646. Built from https://develop.svn.wordpress.org/trunk@35010 git-svn-id: http://core.svn.wordpress.org/trunk@34975 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-screen.php | 109 ++++++++++++++------------ wp-includes/version.php | 2 +- 2 files changed, 58 insertions(+), 53 deletions(-) diff --git a/wp-admin/includes/class-wp-screen.php b/wp-admin/includes/class-wp-screen.php index a01d94be3f..311bdd0b54 100644 --- a/wp-admin/includes/class-wp-screen.php +++ b/wp-admin/includes/class-wp-screen.php @@ -965,11 +965,8 @@ final class WP_Screen { * @param array $options { * @type bool $wrap Whether the screen-options-wrap div will be included. Defaults to true. * } - * @global array $wp_meta_boxes */ public function render_screen_options( $options = array() ) { - global $wp_meta_boxes; - $options = wp_parse_args( $options, array( 'wrap' => true, ) ); @@ -1003,32 +1000,38 @@ final class WP_Screen { * Render the meta boxes preferences. * * @since 4.4.0 + * + * @global array $wp_meta_boxes */ public function render_meta_boxes_preferences() { global $wp_meta_boxes; - if ( isset( $wp_meta_boxes[ $this->id ] ) ) : ?> -
- - id ] ) ) { + return; + } + ?> +
+ + 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; + 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 '\n"; } - ?> -
- '; + echo ''; + echo _x( 'Welcome', 'Welcome panel' ) . "\n"; + } + ?> +
+ -
- - $title ) { - // Can't hide these for they are special - if ( in_array( $column, $special ) ) { - continue; - } - - if ( empty( $title ) ) { - continue; - } - - if ( 'comments' == $column ) { - $title = __( 'Comments' ); - } - - $id = "$column-hide"; - echo '\n"; - } - ?> -
- +
+ + $title ) { + // Can't hide these for they are special + if ( in_array( $column, $special ) ) { + continue; + } + + if ( empty( $title ) ) { + continue; + } + + if ( 'comments' == $column ) { + $title = __( 'Comments' ); + } + + $id = "$column-hide"; + echo '\n"; + } + ?> +
+