Coding Standards: Use Yoda conditions where appropriate.

See #49222.

git-svn-id: https://develop.svn.wordpress.org/trunk@47219 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-02-09 16:52:28 +00:00
parent 40ffe0ef06
commit 130751cda3
124 changed files with 554 additions and 554 deletions
+7 -7
View File
@@ -432,7 +432,7 @@ function wp_comment_reply( $position = 1, $checkbox = false, $mode = 'single', $
}
if ( ! $wp_list_table ) {
if ( $mode == 'single' ) {
if ( 'single' === $mode ) {
$wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table' );
} else {
$wp_list_table = _get_list_table( 'WP_Comments_List_Table' );
@@ -2195,12 +2195,12 @@ function _media_states( $post ) {
$header_image = get_header_image();
// Display "Header Image" if the image was ever used as a header image.
if ( ! empty( $meta_header ) && $meta_header == $stylesheet && $header_image !== wp_get_attachment_url( $post->ID ) ) {
if ( ! empty( $meta_header ) && $meta_header === $stylesheet && wp_get_attachment_url( $post->ID ) !== $header_image ) {
$media_states[] = __( 'Header Image' );
}
// Display "Current Header Image" if the image is currently the header image.
if ( $header_image && $header_image == wp_get_attachment_url( $post->ID ) ) {
if ( $header_image && wp_get_attachment_url( $post->ID ) === $header_image ) {
$media_states[] = __( 'Current Header Image' );
}
}
@@ -2209,21 +2209,21 @@ function _media_states( $post ) {
if ( current_theme_supports( 'custom-background' ) ) {
$meta_background = get_post_meta( $post->ID, '_wp_attachment_is_custom_background', true );
if ( ! empty( $meta_background ) && $meta_background == $stylesheet ) {
if ( ! empty( $meta_background ) && $meta_background === $stylesheet ) {
$media_states[] = __( 'Background Image' );
$background_image = get_background_image();
if ( $background_image && $background_image == wp_get_attachment_url( $post->ID ) ) {
if ( $background_image && wp_get_attachment_url( $post->ID ) === $background_image ) {
$media_states[] = __( 'Current Background Image' );
}
}
}
if ( $post->ID == get_option( 'site_icon' ) ) {
if ( get_option( 'site_icon' ) == $post->ID ) {
$media_states[] = __( 'Site Icon' );
}
if ( $post->ID == get_theme_mod( 'custom_logo' ) ) {
if ( get_theme_mod( 'custom_logo' ) == $post->ID ) {
$media_states[] = __( 'Logo' );
}