Make WordPress Core


Ignore:
Timestamp:
02/09/2020 04:52:28 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use Yoda conditions where appropriate.

See #49222.

File:
1 edited

Legend:

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

    r47207 r47219  
    158158                            <?php
    159159
    160                             if ( 'private' == $post->post_status ) {
     160                            if ( 'private' === $post->post_status ) {
    161161                                $post->post_password = '';
    162162                                $visibility          = 'private';
     
    165165                                $visibility       = 'password';
    166166                                $visibility_trans = __( 'Password protected' );
    167                             } elseif ( $post_type == 'post' && is_sticky( $post->ID ) ) {
     167                            } elseif ( 'post' === $post_type && is_sticky( $post->ID ) ) {
    168168                                $visibility       = 'public';
    169169                                $visibility_trans = __( 'Public, Sticky' );
     
    181181<div id="post-visibility-select" class="hide-if-js">
    182182<input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr( $post->post_password ); ?>" />
    183         <?php if ( $post_type == 'post' ) : ?>
     183        <?php if ( 'post' === $post_type ) : ?>
    184184<input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked( is_sticky( $post->ID ) ); ?> />
    185185<?php endif; ?>
    186186<input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" />
    187187<input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e( 'Public' ); ?></label><br />
    188         <?php if ( $post_type == 'post' && current_user_can( 'edit_others_posts' ) ) : ?>
     188        <?php if ( 'post' === $post_type && current_user_can( 'edit_others_posts' ) ) : ?>
    189189<span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked( is_sticky( $post->ID ) ); ?> /> <label for="sticky" class="selectit"><?php _e( 'Stick this post to the front page' ); ?></label><br /></span>
    190190<?php endif; ?>
     
    264264    <fieldset id="timestampdiv" class="hide-if-js">
    265265        <legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend>
    266         <?php touch_time( ( $action === 'edit' ), 1 ); ?>
     266        <?php touch_time( ( 'edit' === $action ), 1 ); ?>
    267267    </fieldset>
    268268</div><?php // /misc-pub-section ?>
     
    599599        <div id="<?php echo $tax_name; ?>-all" class="tabs-panel">
    600600            <?php
    601             $name = ( $tax_name == 'category' ) ? 'post_category' : 'tax_input[' . $tax_name . ']';
     601            $name = ( 'category' === $tax_name ) ? 'post_category' : 'tax_input[' . $tax_name . ']';
    602602            // Allows for an empty term set to be sent. 0 is an invalid term ID and will be ignored by empty() checks.
    603603            echo "<input type='hidden' name='{$name}[]' value='0' />";
     
    11491149<fieldset><legend class="screen-reader-text"><span><?php _e( 'Target' ); ?></span></legend>
    11501150<p><label for="link_target_blank" class="selectit">
    1151 <input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ( $link->link_target == '_blank' ) ? 'checked="checked"' : '' ); ?> />
     1151<input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ( '_blank' === $link->link_target ) ? 'checked="checked"' : '' ); ?> />
    11521152    <?php _e( '<code>_blank</code> &mdash; new window or tab.' ); ?></label></p>
    11531153<p><label for="link_target_top" class="selectit">
    1154 <input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ( $link->link_target == '_top' ) ? 'checked="checked"' : '' ); ?> />
     1154<input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ( '_top' === $link->link_target ) ? 'checked="checked"' : '' ); ?> />
    11551155    <?php _e( '<code>_top</code> &mdash; current window or tab, with no frames.' ); ?></label></p>
    11561156<p><label for="link_target_none" class="selectit">
    1157 <input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ( $link->link_target == '' ) ? 'checked="checked"' : '' ); ?> />
     1157<input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ( '' === $link->link_target ) ? 'checked="checked"' : '' ); ?> />
    11581158    <?php _e( '<code>_none</code> &mdash; same window or tab.' ); ?></label></p>
    11591159</fieldset>
Note: See TracChangeset for help on using the changeset viewer.