From 16a81287657e0916e0a012ef92fb5b481291b2cc Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 15 May 2020 18:13:09 +0000 Subject: [PATCH] Coding Standards: Fix WPCS issues in `wp-admin/includes/class-wp-screen.php`. See #49542. Built from https://develop.svn.wordpress.org/trunk@47802 git-svn-id: http://core.svn.wordpress.org/trunk@47578 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-screen.php | 32 +++++++++++++-------------- wp-includes/version.php | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/wp-admin/includes/class-wp-screen.php b/wp-admin/includes/class-wp-screen.php index e983ffef80..e3a2fcd7a6 100644 --- a/wp-admin/includes/class-wp-screen.php +++ b/wp-admin/includes/class-wp-screen.php @@ -228,27 +228,27 @@ final class WP_Screen { $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 @@ final class WP_Screen { } } - if ( 'index' == $id ) { + if ( 'index' === $id ) { $id = 'dashboard'; - } elseif ( 'front' == $id ) { + } elseif ( 'front' === $id ) { $in_admin = false; } @@ -363,10 +363,10 @@ final class WP_Screen { 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 @@ final class WP_Screen { $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 @@ final class WP_Screen { return (bool) $this->in_admin; } - return ( $admin == $this->in_admin ); + return ( $admin === $this->in_admin ); } /** @@ -1120,8 +1120,8 @@ final class WP_Screen { $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 @@ final class WP_Screen { } } - 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 { diff --git a/wp-includes/version.php b/wp-includes/version.php index 88ef287585..6060afd35a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-alpha-47801'; +$wp_version = '5.5-alpha-47802'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.