Make WordPress Core

Changeset 47802 for trunk


Ignore:
Timestamp:
05/15/2020 06:11:40 PM (7 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Fix WPCS issues in wp-admin/includes/class-wp-screen.php.

See #49542.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-screen.php

    r47550 r47802  
    229229                        $id        = 'post'; // Changes later. Ends up being $base.
    230230                } else {
    231                         if ( '.php' == substr( $id, -4 ) ) {
     231                        if ( '.php' === substr( $id, -4 ) ) {
    232232                                $id = substr( $id, 0, -4 );
    233233                        }
    234234
    235                         if ( 'post-new' == $id || 'link-add' == $id || 'media-new' == $id || 'user-new' == $id ) {
     235                        if ( in_array( $id, array( 'post-new', 'link-add', 'media-new', 'user-new' ), true ) ) {
    236236                                $id     = substr( $id, 0, -4 );
    237237                                $action = 'add';
    … …  
    240240
    241241                if ( ! $post_type && $hook_name ) {
    242                         if ( '-network' == substr( $id, -8 ) ) {
     242                        if ( '-network' === substr( $id, -8 ) ) {
    243243                                $id       = substr( $id, 0, -8 );
    244244                                $in_admin = 'network';
    245                         } elseif ( '-user' == substr( $id, -5 ) ) {
     245                        } elseif ( '-user' === substr( $id, -5 ) ) {
    246246                                $id       = substr( $id, 0, -5 );
    247247                                $in_admin = 'user';
    … …  
    249249
    250250                        $id = sanitize_key( $id );
    251                         if ( 'edit-comments' != $id && 'edit-tags' != $id && 'edit-' == substr( $id, 0, 5 ) ) {
     251                        if ( 'edit-comments' !== $id && 'edit-tags' !== $id && 'edit-' === substr( $id, 0, 5 ) ) {
    252252                                $maybe = substr( $id, 5 );
    253253                                if ( taxonomy_exists( $maybe ) ) {
    … …  
    273273                }
    274274
    275                 if ( 'index' == $id ) {
     275                if ( 'index' === $id ) {
    276276                        $id = 'dashboard';
    277                 } elseif ( 'front' == $id ) {
     277                } elseif ( 'front' === $id ) {
    278278                        $in_admin = false;
    279279                }
    … …  
    364364                }
    365365
    366                 if ( 'network' == $in_admin ) {
     366                if ( 'network' === $in_admin ) {
    367367                        $id   .= '-network';
    368368                        $base .= '-network';
    369                 } elseif ( 'user' == $in_admin ) {
     369                } elseif ( 'user' === $in_admin ) {
    370370                        $id   .= '-user';
    371371                        $base .= '-user';
    … …  
    386386                $screen->post_type       = (string) $post_type;
    387387                $screen->taxonomy        = (string) $taxonomy;
    388                 $screen->is_user         = ( 'user' == $in_admin );
    389                 $screen->is_network      = ( 'network' == $in_admin );
     388                $screen->is_user         = ( 'user' === $in_admin );
     389                $screen->is_network      = ( 'network' === $in_admin );
    390390                $screen->in_admin        = $in_admin;
    391391                $screen->is_block_editor = $is_block_editor;
    … …  
    443443                }
    444444
    445                 return ( $admin == $this->in_admin );
     445                return ( $admin === $this->in_admin );
    446446        }
    447447
    … …  
    11211121                                update_user_meta( get_current_user_id(), 'show_welcome_panel', $welcome_checked );
    11221122                        } else {
    1123                                 $welcome_checked = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
    1124                                 if ( 2 == $welcome_checked && wp_get_current_user()->user_email != get_option( 'admin_email' ) ) {
     1123                                $welcome_checked = (int) get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
     1124                                if ( 2 === $welcome_checked && wp_get_current_user()->user_email !== get_option( 'admin_email' ) ) {
    11251125                                        $welcome_checked = false;
    11261126                                }
    … …  
    12431243                }
    12441244
    1245                 if ( 'edit_comments_per_page' == $option ) {
     1245                if ( 'edit_comments_per_page' === $option ) {
    12461246                        $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all';
    12471247
    12481248                        /** This filter is documented in wp-admin/includes/class-wp-comments-list-table.php */
    12491249                        $per_page = apply_filters( 'comments_per_page', $per_page, $comment_status );
    1250                 } elseif ( 'categories_per_page' == $option ) {
     1250                } elseif ( 'categories_per_page' === $option ) {
    12511251                        /** This filter is documented in wp-admin/includes/class-wp-terms-list-table.php */
    12521252                        $per_page = apply_filters( 'edit_categories_per_page', $per_page );
Note: See TracChangeset for help on using the changeset viewer.