WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/16/2020 06:40:52 PM (11 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison where static strings are involved.

This reduces the number of WordPress.PHP.StrictComparisons.LooseComparison issues in half, from 1897 to 890.

Includes minor code layout fixes for better readability.

See #49542.

File:
1 edited

Legend:

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

    r47600 r47808  
    702702        $current_screen = get_current_screen();
    703703        $post           = get_post();
    704         if ( 'post' == $current_screen->base ) {
     704
     705        if ( 'post' === $current_screen->base ) {
    705706            $post_type_object = get_post_type_object( $post->post_type );
    706         } elseif ( 'edit' == $current_screen->base ) {
     707        } elseif ( 'edit' === $current_screen->base ) {
    707708            $post_type_object = get_post_type_object( $current_screen->post_type );
    708709        }
    709710
    710         if ( 'post' == $current_screen->base
    711             && 'add' != $current_screen->action
     711        if ( 'post' === $current_screen->base
     712            && 'add' !== $current_screen->action
    712713            && ( $post_type_object )
    713714            && current_user_can( 'read_post', $post->ID )
    714715            && ( $post_type_object->public )
    715716            && ( $post_type_object->show_in_admin_bar ) ) {
    716             if ( 'draft' == $post->post_status ) {
     717            if ( 'draft' === $post->post_status ) {
    717718                $preview_link = get_preview_post_link( $post );
    718719                $wp_admin_bar->add_node(
     
    733734                );
    734735            }
    735         } elseif ( 'edit' == $current_screen->base
     736        } elseif ( 'edit' === $current_screen->base
    736737            && ( $post_type_object )
    737738            && ( $post_type_object->public )
     
    746747                )
    747748            );
    748         } elseif ( 'term' == $current_screen->base && isset( $tag ) && is_object( $tag ) && ! is_wp_error( $tag ) ) {
     749        } elseif ( 'term' === $current_screen->base && isset( $tag ) && is_object( $tag ) && ! is_wp_error( $tag ) ) {
    749750            $tax = get_taxonomy( $tag->taxonomy );
    750751            if ( is_taxonomy_viewable( $tax ) ) {
     
    757758                );
    758759            }
    759         } elseif ( 'user-edit' == $current_screen->base && isset( $user_id ) ) {
     760        } elseif ( 'user-edit' === $current_screen->base && isset( $user_id ) ) {
    760761            $user_object = get_userdata( $user_id );
    761762            $view_link   = get_author_posts_url( $user_object->ID );
     
    12051206
    12061207    if ( ! isset( $show_admin_bar ) ) {
    1207         if ( ! is_user_logged_in() || 'wp-login.php' == $pagenow ) {
     1208        if ( ! is_user_logged_in() || 'wp-login.php' === $pagenow ) {
    12081209            $show_admin_bar = false;
    12091210        } else {
Note: See TracChangeset for help on using the changeset viewer.