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.
Built from https://develop.svn.wordpress.org/trunk@58277


git-svn-id: http://core.svn.wordpress.org/trunk@57737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2024-06-01 17:37:18 +00:00
parent aca0884138
commit cd1ba19e52
2 changed files with 10 additions and 6 deletions

View File

@ -345,7 +345,9 @@ function get_the_content( $more_link_text = null, $strip_teaser = false, $post =
$content = array( $content ); $content = array( $content );
} }
if ( str_contains( $_post->post_content, '<!--noteaser-->' ) && ( ! $elements['multipage'] || 1 == $elements['page'] ) ) { if ( str_contains( $_post->post_content, '<!--noteaser-->' )
&& ( ! $elements['multipage'] || 1 === $elements['page'] )
) {
$strip_teaser = true; $strip_teaser = true;
} }
@ -978,11 +980,13 @@ function wp_link_pages( $args = '' ) {
$output .= $parsed_args['before']; $output .= $parsed_args['before'];
for ( $i = 1; $i <= $numpages; $i++ ) { for ( $i = 1; $i <= $numpages; $i++ ) {
$link = $parsed_args['link_before'] . str_replace( '%', $i, $parsed_args['pagelink'] ) . $parsed_args['link_after']; $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 . '</a>'; $link = _wp_link_page( $i ) . $link . '</a>';
} elseif ( $i === $page ) { } elseif ( $i === $page ) {
$link = '<span class="post-page-numbers current" aria-current="' . esc_attr( $parsed_args['aria_current'] ) . '">' . $link . '</span>'; $link = '<span class="post-page-numbers current" aria-current="' . esc_attr( $parsed_args['aria_current'] ) . '">' . $link . '</span>';
} }
/** /**
* Filters the HTML output of individual page number links. * Filters the HTML output of individual page number links.
* *
@ -1054,12 +1058,12 @@ function _wp_link_page( $i ) {
$post = get_post(); $post = get_post();
$query_args = array(); $query_args = array();
if ( 1 == $i ) { if ( 1 === $i ) {
$url = get_permalink(); $url = get_permalink();
} else { } else {
if ( ! get_option( 'permalink_structure' ) || in_array( $post->post_status, array( 'draft', 'pending' ), true ) ) { if ( ! get_option( 'permalink_structure' ) || in_array( $post->post_status, array( 'draft', 'pending' ), true ) ) {
$url = add_query_arg( 'page', $i, get_permalink() ); $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' ); $url = trailingslashit( get_permalink() ) . user_trailingslashit( "$wp_rewrite->pagination_base/" . $i, 'single_paged' );
} else { } else {
$url = trailingslashit( get_permalink() ) . user_trailingslashit( $i, 'single_paged' ); $url = trailingslashit( get_permalink() ) . user_trailingslashit( $i, 'single_paged' );
@ -1815,7 +1819,7 @@ function is_page_template( $template = '' ) {
return (bool) $page_template; return (bool) $page_template;
} }
if ( $template == $page_template ) { if ( $template === $page_template ) {
return true; return true;
} }

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.6-alpha-58275'; $wp_version = '6.6-alpha-58277';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.