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-admin/includes/dashboard.php

    r47592 r47808  
    138138    }
    139139
    140     if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget_id'] ) ) {
     140    if ( 'POST' === $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget_id'] ) ) {
    141141        check_admin_referer( 'edit-dashboard-widget_' . $_POST['widget_id'], 'dashboard-widget-nonce' );
    142142        ob_start(); // Hack - but the same hack wp-admin/widgets.php uses.
     
    283283        $num_posts = wp_count_posts( $post_type );
    284284        if ( $num_posts && $num_posts->publish ) {
    285             if ( 'post' == $post_type ) {
     285            if ( 'post' === $post_type ) {
    286286                /* translators: %s: Number of posts. */
    287287                $text = _n( '%s Post', '%s Posts', $num_posts->publish );
     
    759759        foreach ( $actions as $action => $link ) {
    760760            ++$i;
    761             ( ( ( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
     761
     762            if ( ( ( 'approve' === $action || 'unapprove' === $action ) && 2 === $i ) || 1 === $i ) {
     763                $sep = '';
     764            } else {
     765                $sep = ' | ';
     766            }
    762767
    763768            // Reply and quickedit need a hide-if-no-js span.
    764             if ( 'reply' == $action || 'quickedit' == $action ) {
     769            if ( 'reply' === $action || 'quickedit' === $action ) {
    765770                $action .= ' hide-if-no-js';
    766771            }
     
    769774                $action .= ' hidden';
    770775            }
     776
    771777            $actions_string .= "<span class='$action'>$sep$link</span>";
    772778        }
     
    785791            ?>
    786792
    787             <?php if ( ! $comment->comment_type || 'comment' == $comment->comment_type ) : ?>
     793            <?php if ( ! $comment->comment_type || 'comment' === $comment->comment_type ) : ?>
    788794
    789795            <div class="dashboard-comment-wrap has-row-actions <?php echo $comment_row_class; ?>">
     
    11751181    $widget_options[ $widget_id ]['number'] = $number;
    11761182
    1177     if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget-rss'][ $number ] ) ) {
     1183    if ( 'POST' === $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget-rss'][ $number ] ) ) {
    11781184        $_POST['widget-rss'][ $number ]         = wp_unslash( $_POST['widget-rss'][ $number ] );
    11791185        $widget_options[ $widget_id ]           = wp_widget_rss_process( $_POST['widget-rss'][ $number ] );
     
    18921898        <h3><?php _e( 'Next Steps' ); ?></h3>
    18931899        <ul>
    1894         <?php if ( 'page' == get_option( 'show_on_front' ) && ! get_option( 'page_for_posts' ) ) : ?>
     1900        <?php if ( 'page' === get_option( 'show_on_front' ) && ! get_option( 'page_for_posts' ) ) : ?>
    18951901            <li><?php printf( '<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Edit your front page' ) . '</a>', get_edit_post_link( get_option( 'page_on_front' ) ) ); ?></li>
    18961902            <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add additional pages' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
    1897         <?php elseif ( 'page' == get_option( 'show_on_front' ) ) : ?>
     1903        <?php elseif ( 'page' === get_option( 'show_on_front' ) ) : ?>
    18981904            <li><?php printf( '<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Edit your front page' ) . '</a>', get_edit_post_link( get_option( 'page_on_front' ) ) ); ?></li>
    18991905            <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add additional pages' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
Note: See TracChangeset for help on using the changeset viewer.