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/post-template.php

    r47550 r47808  
    140140            $protected_title_format = apply_filters( 'protected_title_format', $prepend, $post );
    141141            $title                  = sprintf( $protected_title_format, $title );
    142         } elseif ( isset( $post->post_status ) && 'private' == $post->post_status ) {
     142        } elseif ( isset( $post->post_status ) && 'private' === $post->post_status ) {
    143143
    144144            /* translators: %s: Private post title. */
     
    557557
    558558                // 'post_tag' uses the 'tag' prefix for backward compatibility.
    559                 if ( 'post_tag' == $taxonomy ) {
     559                if ( 'post_tag' === $taxonomy ) {
    560560                    $classes[] = 'tag-' . $term_class;
    561561                } else {
     
    951951    $output = '';
    952952    if ( $multipage ) {
    953         if ( 'number' == $parsed_args['next_or_number'] ) {
     953        if ( 'number' === $parsed_args['next_or_number'] ) {
    954954            $output .= $parsed_args['before'];
    955955            for ( $i = 1; $i <= $numpages; $i++ ) {
     
    10331033        $url = get_permalink();
    10341034    } else {
    1035         if ( '' == get_option( 'permalink_structure' ) || in_array( $post->post_status, array( 'draft', 'pending' ), true ) ) {
     1035        if ( ! get_option( 'permalink_structure' ) || in_array( $post->post_status, array( 'draft', 'pending' ), true ) ) {
    10361036            $url = add_query_arg( 'page', $i, get_permalink() );
    1037         } elseif ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $post->ID ) {
     1037        } elseif ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $post->ID ) {
    10381038            $url = trailingslashit( get_permalink() ) . user_trailingslashit( "$wp_rewrite->pagination_base/" . $i, 'single_paged' );
    10391039        } else {
     
    14371437        $menu .= '<li ' . $class . '><a href="' . home_url( '/' ) . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>';
    14381438        // If the front page is a page, add it to the exclude list.
    1439         if ( get_option( 'show_on_front' ) == 'page' ) {
     1439        if ( 'page' === get_option( 'show_on_front' ) ) {
    14401440            if ( ! empty( $list_args['exclude'] ) ) {
    14411441                $list_args['exclude'] .= ',';
     
    16131613    if ( $text ) {
    16141614        $link_text = $text;
    1615     } elseif ( $size && 'none' != $size ) {
     1615    } elseif ( $size && 'none' !== $size ) {
    16161616        $link_text = wp_get_attachment_image( $_post->ID, $size, $icon, $attr );
    16171617    } else {
     
    17901790    $template = get_post_meta( $post->ID, '_wp_page_template', true );
    17911791
    1792     if ( ! $template || 'default' == $template ) {
     1792    if ( ! $template || 'default' === $template ) {
    17931793        return '';
    17941794    }
Note: See TracChangeset for help on using the changeset viewer.