From b98303ae58764ca5a196774fcad3e5904c3ffa4d Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sat, 10 Oct 2015 15:19:54 +0000 Subject: [PATCH] WP Screen: after [34991], avoid unnecessary nesting levels and remove unused global import. See #33646. git-svn-id: https://develop.svn.wordpress.org/trunk@35010 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-screen.php | 109 +++++++++++----------- 1 file changed, 57 insertions(+), 52 deletions(-) diff --git a/src/wp-admin/includes/class-wp-screen.php b/src/wp-admin/includes/class-wp-screen.php index a01d94be3f..311bdd0b54 100644 --- a/src/wp-admin/includes/class-wp-screen.php +++ b/src/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"; + } + ?> +
+