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

    r47771 r47808  
    11571157    $url = get_theme_mod( 'header_image', get_theme_support( 'custom-header', 'default-image' ) );
    11581158
    1159     if ( 'remove-header' == $url ) {
     1159    if ( 'remove-header' === $url ) {
    11601160        return false;
    11611161    }
     
    12661266        $headers          = array();
    12671267
    1268         if ( 'random-uploaded-image' == $header_image_mod ) {
     1268        if ( 'random-uploaded-image' === $header_image_mod ) {
    12691269            $headers = get_uploaded_header_images();
    12701270        } elseif ( ! empty( $_wp_default_headers ) ) {
    1271             if ( 'random-default-image' == $header_image_mod ) {
     1271            if ( 'random-default-image' === $header_image_mod ) {
    12721272                $headers = $_wp_default_headers;
    12731273            } else {
     
    12871287        $_wp_random_header->thumbnail_url = sprintf( $_wp_random_header->thumbnail_url, get_template_directory_uri(), get_stylesheet_directory_uri() );
    12881288    }
     1289
    12891290    return $_wp_random_header;
    12901291}
     
    12991300function get_random_header_image() {
    13001301    $random_image = _get_random_header_data();
     1302
    13011303    if ( empty( $random_image->url ) ) {
    13021304        return '';
    13031305    }
     1306
    13041307    return $random_image->url;
    13051308}
     
    13201323    $header_image_mod = get_theme_mod( 'header_image', get_theme_support( 'custom-header', 'default-image' ) );
    13211324
    1322     if ( 'any' == $type ) {
    1323         if ( 'random-default-image' == $header_image_mod || 'random-uploaded-image' == $header_image_mod || ( '' != get_random_header_image() && empty( $header_image_mod ) ) ) {
     1325    if ( 'any' === $type ) {
     1326        if ( 'random-default-image' === $header_image_mod
     1327            || 'random-uploaded-image' === $header_image_mod
     1328            || ( '' !== get_random_header_image() && empty( $header_image_mod ) )
     1329        ) {
    13241330            return true;
    13251331        }
    13261332    } else {
    1327         if ( "random-$type-image" == $header_image_mod ) {
     1333        if ( "random-$type-image" === $header_image_mod ) {
    13281334            return true;
    1329         } elseif ( 'default' == $type && empty( $header_image_mod ) && '' != get_random_header_image() ) {
     1335        } elseif ( 'default' === $type && empty( $header_image_mod ) && '' !== get_random_header_image() ) {
    13301336            return true;
    13311337        }
     
    13421348function header_image() {
    13431349    $image = get_header_image();
     1350
    13441351    if ( $image ) {
    13451352        echo esc_url( $image );
     
    15371544function the_header_video_url() {
    15381545    $video = get_header_video_url();
     1546
    15391547    if ( $video ) {
    15401548        echo esc_url( $video );
     
    29042912    global $_wp_theme_features;
    29052913
    2906     if ( 'custom-header-uploads' == $feature ) {
     2914    if ( 'custom-header-uploads' === $feature ) {
    29072915        return current_theme_supports( 'custom-header', 'uploads' );
    29082916    }
     
    30753083function _wp_customize_include() {
    30763084
    3077     $is_customize_admin_page = ( is_admin() && 'customize.php' == basename( $_SERVER['PHP_SELF'] ) );
     3085    $is_customize_admin_page = ( is_admin() && 'customize.php' === basename( $_SERVER['PHP_SELF'] ) );
    30783086    $should_include          = (
    30793087        $is_customize_admin_page
    30803088        ||
    3081         ( isset( $_REQUEST['wp_customize'] ) && 'on' == $_REQUEST['wp_customize'] )
     3089        ( isset( $_REQUEST['wp_customize'] ) && 'on' === $_REQUEST['wp_customize'] )
    30823090        ||
    30833091        ( ! empty( $_GET['customize_changeset_uuid'] ) || ! empty( $_POST['customize_changeset_uuid'] ) )
Note: See TracChangeset for help on using the changeset viewer.