diff --git a/src/wp-admin/includes/class-wp-screen.php b/src/wp-admin/includes/class-wp-screen.php index e983ffef8007..e3a2fcd7a6d2 100644 --- a/src/wp-admin/includes/class-wp-screen.php +++ b/src/wp-admin/includes/class-wp-screen.php @@ -228,27 +228,27 @@ public static function get( $hook_name = '' ) { $post_type = $id; $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 ) { + if ( in_array( $id, array( 'post-new', 'link-add', 'media-new', 'user-new' ), true ) ) { $id = substr( $id, 0, -4 ); $action = 'add'; } } if ( ! $post_type && $hook_name ) { - if ( '-network' == substr( $id, -8 ) ) { + if ( '-network' === substr( $id, -8 ) ) { $id = substr( $id, 0, -8 ); $in_admin = 'network'; - } elseif ( '-user' == substr( $id, -5 ) ) { + } elseif ( '-user' === substr( $id, -5 ) ) { $id = substr( $id, 0, -5 ); $in_admin = 'user'; } $id = sanitize_key( $id ); - if ( 'edit-comments' != $id && 'edit-tags' != $id && 'edit-' == substr( $id, 0, 5 ) ) { + if ( 'edit-comments' !== $id && 'edit-tags' !== $id && 'edit-' === substr( $id, 0, 5 ) ) { $maybe = substr( $id, 5 ); if ( taxonomy_exists( $maybe ) ) { $id = 'edit-tags'; @@ -272,9 +272,9 @@ public static function get( $hook_name = '' ) { } } - if ( 'index' == $id ) { + if ( 'index' === $id ) { $id = 'dashboard'; - } elseif ( 'front' == $id ) { + } elseif ( 'front' === $id ) { $in_admin = false; } @@ -363,10 +363,10 @@ public static function get( $hook_name = '' ) { break; } - if ( 'network' == $in_admin ) { + if ( 'network' === $in_admin ) { $id .= '-network'; $base .= '-network'; - } elseif ( 'user' == $in_admin ) { + } elseif ( 'user' === $in_admin ) { $id .= '-user'; $base .= '-user'; } @@ -385,8 +385,8 @@ public static function get( $hook_name = '' ) { $screen->action = $action; $screen->post_type = (string) $post_type; $screen->taxonomy = (string) $taxonomy; - $screen->is_user = ( 'user' == $in_admin ); - $screen->is_network = ( 'network' == $in_admin ); + $screen->is_user = ( 'user' === $in_admin ); + $screen->is_network = ( 'network' === $in_admin ); $screen->in_admin = $in_admin; $screen->is_block_editor = $is_block_editor; @@ -442,7 +442,7 @@ public function in_admin( $admin = null ) { return (bool) $this->in_admin; } - return ( $admin == $this->in_admin ); + return ( $admin === $this->in_admin ); } /** @@ -1120,8 +1120,8 @@ public function render_meta_boxes_preferences() { $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 = (int) 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; } } @@ -1242,12 +1242,12 @@ public function render_per_page_options() { } } - if ( 'edit_comments_per_page' == $option ) { + if ( 'edit_comments_per_page' === $option ) { $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all'; /** This filter is documented in wp-admin/includes/class-wp-comments-list-table.php */ $per_page = apply_filters( 'comments_per_page', $per_page, $comment_status ); - } elseif ( 'categories_per_page' == $option ) { + } elseif ( 'categories_per_page' === $option ) { /** This filter is documented in wp-admin/includes/class-wp-terms-list-table.php */ $per_page = apply_filters( 'edit_categories_per_page', $per_page ); } else {