Make WordPress Core

Changeset 57867 for trunk


Ignore:
Timestamp:
03/22/2024 10:05:25 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison in wp-includes/link-template.php.

Follow-up to [4475], [6365], [8706], [9296], [9318], [14141], [15819], [21364], [27802].

Props aristath, poena, afercia, SergeyBiryukov.
See #60700.

File:
1 edited

Legend:

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

    r57371 r57867  
    392392        $post = get_post( $post );
    393393
    394         if ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $post->ID ) {
     394        if ( 'page' === get_option( 'show_on_front' ) && (int) get_option( 'page_on_front' ) === $post->ID ) {
    395395                $link = home_url( '/' );
    396396        } else {
    … …  
    702702                }
    703703
    704                 if ( get_default_feed() == $feed ) {
     704                if ( get_default_feed() === $feed ) {
    705705                        $feed = '';
    706706                }
    … …  
    764764
    765765        if ( get_option( 'permalink_structure' ) ) {
    766                 if ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $post_id ) {
     766                if ( 'page' === get_option( 'show_on_front' ) && (int) get_option( 'page_on_front' ) === $post_id ) {
    767767                        $url = _get_page_link( $post_id );
    768768                } else {
    … …  
    778778                } else {
    779779                        $url = trailingslashit( $url ) . 'feed';
    780                         if ( get_default_feed() != $feed ) {
     780                        if ( get_default_feed() !== $feed ) {
    781781                                $url .= "/$feed";
    782782                        }
    … …  
    880880        } else {
    881881                $link = get_author_posts_url( $author_id );
    882                 if ( get_default_feed() == $feed ) {
     882                if ( get_default_feed() === $feed ) {
    883883                        $feed_link = 'feed';
    884884                } else {
    … …  
    963963        } else {
    964964                $link = get_term_link( $term, $term->taxonomy );
    965                 if ( get_default_feed() == $feed ) {
     965                if ( get_default_feed() === $feed ) {
    966966                        $feed_link = 'feed';
    967967                } else {
    … …  
    13751375                $link  = trailingslashit( $link );
    13761376                $link .= 'feed/';
    1377                 if ( $feed != $default_feed ) {
     1377                if ( $feed !== $default_feed ) {
    13781378                        $link .= "$feed/";
    13791379                }
    … …  
    17381738        }
    17391739
    1740         if ( get_current_user_id() == $user->ID ) {
     1740        if ( get_current_user_id() === $user->ID ) {
    17411741                $link = get_edit_profile_url( $user->ID );
    17421742        } else {
    … …  
    30573057        global $wp_rewrite;
    30583058
    3059         $pagenum = (int) $pagenum;
     3059        $pagenum  = (int) $pagenum;
     3060        $max_page = (int) $max_page;
    30603061
    30613062        $result = get_permalink();
    30623063
    30633064        if ( 'newest' === get_option( 'default_comments_page' ) ) {
    3064                 if ( $pagenum != $max_page ) {
     3065                if ( $pagenum !== $max_page ) {
    30653066                        if ( $wp_rewrite->using_permalinks() ) {
    30663067                                $result = user_trailingslashit( trailingslashit( $result ) . $wp_rewrite->comments_pagination_base . '-' . $pagenum, 'commentpaged' );
    … …  
    41554156                $post_type = get_post_type_object( $post->post_type );
    41564157
    4157                 if ( 'page' === $post->post_type && get_option( 'page_on_front' ) == $post->ID && 'page' === get_option( 'show_on_front' ) ) {
     4158                if ( 'page' === $post->post_type
     4159                        && 'page' === get_option( 'show_on_front' ) && (int) get_option( 'page_on_front' ) === $post->ID
     4160                ) {
    41584161                        $shortlink = home_url( '/' );
    41594162                } elseif ( $post_type && $post_type->public ) {
Note: See TracChangeset for help on using the changeset viewer.