Skip to content

Commit

Permalink
Coding Standards: Use strict comparison in `wp-includes/post-template…
Browse files Browse the repository at this point in the history
….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
  • Loading branch information
SergeyBiryukov committed Jun 1, 2024
1 parent 2c81850 commit 802f924
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/wp-includes/post-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -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, '<!--noteaser-->' ) && ( ! $elements['multipage'] || 1 == $elements['page'] ) ) {
if ( str_contains( $_post->post_content, '<!--noteaser-->' )
&& ( ! $elements['multipage'] || 1 === $elements['page'] )
) {
$strip_teaser = true;
}

Expand Down Expand Up @@ -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 . '</a>';
} elseif ( $i === $page ) {
$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.
*
Expand Down Expand Up @@ -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' );
Expand Down Expand Up @@ -1815,7 +1819,7 @@ function is_page_template( $template = '' ) {
return (bool) $page_template;
}

if ( $template == $page_template ) {
if ( $template === $page_template ) {
return true;
}

Expand Down

0 comments on commit 802f924

Please sign in to comment.