Make WordPress Core


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

Coding Standards: Use Yoda conditions where appropriate.

See #49222.

File:
1 edited

Legend:

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

    r47202 r47219  
    7171                $max_width  = $size[0];
    7272                $max_height = $size[1];
    73         } elseif ( $size === 'thumb' || $size === 'thumbnail' ) {
     73        } elseif ( 'thumb' === $size || 'thumbnail' === $size ) {
    7474                $max_width  = intval( get_option( 'thumbnail_size_w' ) );
    7575                $max_height = intval( get_option( 'thumbnail_size_h' ) );
     
    7979                        $max_height = 96;
    8080                }
    81         } elseif ( $size === 'medium' ) {
     81        } elseif ( 'medium' === $size ) {
    8282                $max_width  = intval( get_option( 'medium_size_w' ) );
    8383                $max_height = intval( get_option( 'medium_size_h' ) );
    8484
    85         } elseif ( $size === 'medium_large' ) {
     85        } elseif ( 'medium_large' === $size ) {
    8686                $max_width  = intval( get_option( 'medium_large_size_w' ) );
    8787                $max_height = intval( get_option( 'medium_large_size_h' ) );
     
    9090                        $max_width = min( intval( $content_width ), $max_width );
    9191                }
    92         } elseif ( $size === 'large' ) {
     92        } elseif ( 'large' === $size ) {
    9393                /*
    9494                 * We're inserting a large size image into the editor. If it's a really
     
    239239                $height          = $intermediate['height'];
    240240                $is_intermediate = true;
    241         } elseif ( $size === 'thumbnail' ) {
     241        } elseif ( 'thumbnail' === $size ) {
    242242                // Fall back to the old thumbnail.
    243243                $thumb_file = wp_get_attachment_thumb_file( $id );
     
    11171117 */
    11181118function _wp_get_image_size_from_meta( $size_name, $image_meta ) {
    1119         if ( $size_name === 'full' ) {
     1119        if ( 'full' === $size_name ) {
    11201120                return array(
    11211121                        absint( $image_meta['width'] ),
     
    15551555                $image_filename = wp_basename( $image_src );
    15561556
    1557                 if ( $image_filename === wp_basename( $image_meta['file'] ) ) {
     1557                if ( wp_basename( $image_meta['file'] ) === $image_filename ) {
    15581558                        $width  = (int) $image_meta['width'];
    15591559                        $height = (int) $image_meta['height'];
     
    20552055                $output .= "</{$itemtag}>";
    20562056
    2057                 if ( ! $html5 && $columns > 0 && ++$i % $columns === 0 ) {
     2057                if ( ! $html5 && $columns > 0 && 0 === ++$i % $columns ) {
    20582058                        $output .= '<br style="clear: both" />';
    20592059                }
    20602060        }
    20612061
    2062         if ( ! $html5 && $columns > 0 && $i % $columns !== 0 ) {
     2062        if ( ! $html5 && $columns > 0 && 0 !== $i % $columns ) {
    20632063                $output .= "
    20642064                        <br style='clear: both' />";
     
    22272227        $id = intval( $atts['id'] );
    22282228
    2229         if ( $atts['type'] !== 'audio' ) {
     2229        if ( 'audio' !== $atts['type'] ) {
    22302230                $atts['type'] = 'video';
    22312231        }
Note: See TracChangeset for help on using the changeset viewer.