Skip to content

Commit 30420b6

Browse files
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. git-svn-id: https://develop.svn.wordpress.org/trunk@57867 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 84c21ab commit 30420b6

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

‎src/wp-includes/link-template.php‎

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ function get_post_permalink( $post = 0, $leavename = false, $sample = false ) {
391391
function get_page_link( $post = false, $leavename = false, $sample = false ) {
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 {
397397
$link = _get_page_link( $post, $leavename, $sample );
@@ -701,7 +701,7 @@ function get_feed_link( $feed = '' ) {
701701
$permalink = $wp_rewrite->get_comment_feed_permastruct();
702702
}
703703

704-
if ( get_default_feed() == $feed ) {
704+
if ( get_default_feed() === $feed ) {
705705
$feed = '';
706706
}
707707

@@ -763,7 +763,7 @@ function get_post_comments_feed_link( $post_id = 0, $feed = '' ) {
763763
$unattached = 'attachment' === $post->post_type && 0 === (int) $post->post_parent;
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 {
769769
$url = get_permalink( $post_id );
@@ -777,7 +777,7 @@ function get_post_comments_feed_link( $post_id = 0, $feed = '' ) {
777777
$url = add_query_arg( 'attachment_id', $post_id, $url );
778778
} else {
779779
$url = trailingslashit( $url ) . 'feed';
780-
if ( get_default_feed() != $feed ) {
780+
if ( get_default_feed() !== $feed ) {
781781
$url .= "/$feed";
782782
}
783783
$url = user_trailingslashit( $url, 'single_feed' );
@@ -879,7 +879,7 @@ function get_author_feed_link( $author_id, $feed = '' ) {
879879
$link = home_url( "?feed=$feed&author=" . $author_id );
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 {
885885
$feed_link = "feed/$feed";
@@ -962,7 +962,7 @@ function get_term_feed_link( $term, $taxonomy = '', $feed = '' ) {
962962
}
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 {
968968
$feed_link = "feed/$feed";
@@ -1374,7 +1374,7 @@ function get_post_type_archive_feed_link( $post_type, $feed = '' ) {
13741374
if ( get_option( 'permalink_structure' ) && is_array( $post_type_obj->rewrite ) && $post_type_obj->rewrite['feeds'] ) {
13751375
$link = trailingslashit( $link );
13761376
$link .= 'feed/';
1377-
if ( $feed != $default_feed ) {
1377+
if ( $feed !== $default_feed ) {
13781378
$link .= "$feed/";
13791379
}
13801380
} else {
@@ -1737,7 +1737,7 @@ function get_edit_user_link( $user_id = null ) {
17371737
return '';
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 {
17431743
$link = add_query_arg( 'user_id', $user->ID, self_admin_url( 'user-edit.php' ) );
@@ -3056,12 +3056,13 @@ function _navigation_markup( $links, $css_class = 'posts-navigation', $screen_re
30563056
function get_comments_pagenum_link( $pagenum = 1, $max_page = 0 ) {
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' );
30673068
} else {
@@ -4154,7 +4155,9 @@ function wp_get_shortlink( $id = 0, $context = 'post', $allow_slugs = true ) {
41544155
if ( ! empty( $post_id ) ) {
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 ) {
41604163
$shortlink = home_url( '?p=' . $post_id );

0 commit comments

Comments
 (0)