Coding Standards: Use Yoda conditions where appropriate.
See #49222. Built from https://develop.svn.wordpress.org/trunk@47219 git-svn-id: http://core.svn.wordpress.org/trunk@47019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -70,7 +70,7 @@ function image_constrain_size_for_editor( $width, $height, $size = 'medium', $co
|
||||
if ( is_array( $size ) ) {
|
||||
$max_width = $size[0];
|
||||
$max_height = $size[1];
|
||||
} elseif ( $size === 'thumb' || $size === 'thumbnail' ) {
|
||||
} elseif ( 'thumb' === $size || 'thumbnail' === $size ) {
|
||||
$max_width = intval( get_option( 'thumbnail_size_w' ) );
|
||||
$max_height = intval( get_option( 'thumbnail_size_h' ) );
|
||||
// Last chance thumbnail size defaults.
|
||||
@@ -78,18 +78,18 @@ function image_constrain_size_for_editor( $width, $height, $size = 'medium', $co
|
||||
$max_width = 128;
|
||||
$max_height = 96;
|
||||
}
|
||||
} elseif ( $size === 'medium' ) {
|
||||
} elseif ( 'medium' === $size ) {
|
||||
$max_width = intval( get_option( 'medium_size_w' ) );
|
||||
$max_height = intval( get_option( 'medium_size_h' ) );
|
||||
|
||||
} elseif ( $size === 'medium_large' ) {
|
||||
} elseif ( 'medium_large' === $size ) {
|
||||
$max_width = intval( get_option( 'medium_large_size_w' ) );
|
||||
$max_height = intval( get_option( 'medium_large_size_h' ) );
|
||||
|
||||
if ( intval( $content_width ) > 0 ) {
|
||||
$max_width = min( intval( $content_width ), $max_width );
|
||||
}
|
||||
} elseif ( $size === 'large' ) {
|
||||
} elseif ( 'large' === $size ) {
|
||||
/*
|
||||
* We're inserting a large size image into the editor. If it's a really
|
||||
* big image we'll scale it down to fit reasonably within the editor
|
||||
@@ -238,7 +238,7 @@ function image_downsize( $id, $size = 'medium' ) {
|
||||
$width = $intermediate['width'];
|
||||
$height = $intermediate['height'];
|
||||
$is_intermediate = true;
|
||||
} elseif ( $size === 'thumbnail' ) {
|
||||
} elseif ( 'thumbnail' === $size ) {
|
||||
// Fall back to the old thumbnail.
|
||||
$thumb_file = wp_get_attachment_thumb_file( $id );
|
||||
$info = null;
|
||||
@@ -1116,7 +1116,7 @@ function _wp_get_attachment_relative_path( $file ) {
|
||||
* @return array|bool The image meta data as returned by `wp_get_attachment_metadata()`.
|
||||
*/
|
||||
function _wp_get_image_size_from_meta( $size_name, $image_meta ) {
|
||||
if ( $size_name === 'full' ) {
|
||||
if ( 'full' === $size_name ) {
|
||||
return array(
|
||||
absint( $image_meta['width'] ),
|
||||
absint( $image_meta['height'] ),
|
||||
@@ -1554,7 +1554,7 @@ function wp_image_add_srcset_and_sizes( $image, $image_meta, $attachment_id ) {
|
||||
*/
|
||||
$image_filename = wp_basename( $image_src );
|
||||
|
||||
if ( $image_filename === wp_basename( $image_meta['file'] ) ) {
|
||||
if ( wp_basename( $image_meta['file'] ) === $image_filename ) {
|
||||
$width = (int) $image_meta['width'];
|
||||
$height = (int) $image_meta['height'];
|
||||
} else {
|
||||
@@ -2054,12 +2054,12 @@ function gallery_shortcode( $attr ) {
|
||||
|
||||
$output .= "</{$itemtag}>";
|
||||
|
||||
if ( ! $html5 && $columns > 0 && ++$i % $columns === 0 ) {
|
||||
if ( ! $html5 && $columns > 0 && 0 === ++$i % $columns ) {
|
||||
$output .= '<br style="clear: both" />';
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $html5 && $columns > 0 && $i % $columns !== 0 ) {
|
||||
if ( ! $html5 && $columns > 0 && 0 !== $i % $columns ) {
|
||||
$output .= "
|
||||
<br style='clear: both' />";
|
||||
}
|
||||
@@ -2226,7 +2226,7 @@ function wp_playlist_shortcode( $attr ) {
|
||||
|
||||
$id = intval( $atts['id'] );
|
||||
|
||||
if ( $atts['type'] !== 'audio' ) {
|
||||
if ( 'audio' !== $atts['type'] ) {
|
||||
$atts['type'] = 'video';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user