From 802f924fa2183e81fe13e74caa29c233e655d771 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 1 Jun 2024 17:35:33 +0000 Subject: [PATCH] Coding Standards: Use strict comparison in `wp-includes/post-template.php`. Follow-up to [5017], [5018], [6228], [13494], [15582], [23653], [44941]. Props aristath, poena, afercia, SergeyBiryukov. See #60700. git-svn-id: https://develop.svn.wordpress.org/trunk@58277 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/post-template.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/wp-includes/post-template.php b/src/wp-includes/post-template.php index 127f2919a12d5..7b12bf6c4c602 100644 --- a/src/wp-includes/post-template.php +++ b/src/wp-includes/post-template.php @@ -345,7 +345,9 @@ function get_the_content( $more_link_text = null, $strip_teaser = false, $post = $content = array( $content ); } - if ( str_contains( $_post->post_content, '' ) && ( ! $elements['multipage'] || 1 == $elements['page'] ) ) { + if ( str_contains( $_post->post_content, '' ) + && ( ! $elements['multipage'] || 1 === $elements['page'] ) + ) { $strip_teaser = true; } @@ -978,11 +980,13 @@ function wp_link_pages( $args = '' ) { $output .= $parsed_args['before']; for ( $i = 1; $i <= $numpages; $i++ ) { $link = $parsed_args['link_before'] . str_replace( '%', $i, $parsed_args['pagelink'] ) . $parsed_args['link_after']; - if ( $i != $page || ! $more && 1 == $page ) { + + if ( $i !== $page || ! $more && 1 === $page ) { $link = _wp_link_page( $i ) . $link . ''; } elseif ( $i === $page ) { $link = '' . $link . ''; } + /** * Filters the HTML output of individual page number links. * @@ -1054,12 +1058,12 @@ function _wp_link_page( $i ) { $post = get_post(); $query_args = array(); - if ( 1 == $i ) { + if ( 1 === $i ) { $url = get_permalink(); } else { if ( ! get_option( 'permalink_structure' ) || in_array( $post->post_status, array( 'draft', 'pending' ), true ) ) { $url = add_query_arg( 'page', $i, get_permalink() ); - } elseif ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $post->ID ) { + } elseif ( 'page' === get_option( 'show_on_front' ) && (int) get_option( 'page_on_front' ) === $post->ID ) { $url = trailingslashit( get_permalink() ) . user_trailingslashit( "$wp_rewrite->pagination_base/" . $i, 'single_paged' ); } else { $url = trailingslashit( get_permalink() ) . user_trailingslashit( $i, 'single_paged' ); @@ -1815,7 +1819,7 @@ function is_page_template( $template = '' ) { return (bool) $page_template; } - if ( $template == $page_template ) { + if ( $template === $page_template ) { return true; }