Skip to content

Commit

Permalink
Coding Standards: Fix WPCS issues in `wp-admin/includes/class-wp-scre…
Browse files Browse the repository at this point in the history
…en.php`.

See #49542.

git-svn-id: https://develop.svn.wordpress.org/trunk@47802 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed May 15, 2020
1 parent 7edaf9b commit 26a527f
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/wp-admin/includes/class-wp-screen.php
Expand Up @@ -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';
Expand All @@ -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;
}

Expand Down Expand Up @@ -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';
}
Expand All @@ -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;

Expand Down Expand Up @@ -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 );
}

/**
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 26a527f

Please sign in to comment.