Coding Standards: Use strict comparison in bundled themes' PHP files.
This addresses all the remaining WPCS warnings in bundled themes. Includes using the correct type when checking the number of comments, as `get_comments_number()` returns a numeric string, not an integer. Follow-up to [41285], [44562], [47941]. Props aristath, poena, afercia, SergeyBiryukov. See #56791. Built from https://develop.svn.wordpress.org/trunk@55420 git-svn-id: http://core.svn.wordpress.org/trunk@54953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
896f5ef18f
commit
803426a023
|
@ -31,7 +31,7 @@
|
|||
<?php if ( have_comments() ) : ?>
|
||||
<h2 id="comments-title">
|
||||
<?php
|
||||
if ( 1 === get_comments_number() ) {
|
||||
if ( '1' === get_comments_number() ) {
|
||||
printf(
|
||||
/* translators: %s: The post title. */
|
||||
__( 'One thought on “%1$s”', 'twentyeleven' ),
|
||||
|
|
|
@ -322,7 +322,7 @@ if ( ! function_exists( 'twentyeleven_header_style' ) ) :
|
|||
$text_color = get_header_textcolor();
|
||||
|
||||
// If no custom options for text are set, let's bail.
|
||||
if ( HEADER_TEXTCOLOR == $text_color ) {
|
||||
if ( HEADER_TEXTCOLOR === $text_color ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -386,7 +386,7 @@ if ( ! function_exists( 'twentyeleven_admin_header_style' ) ) :
|
|||
}
|
||||
<?php
|
||||
// If the user has set a custom color for the text, use that.
|
||||
if ( get_header_textcolor() != HEADER_TEXTCOLOR ) :
|
||||
if ( get_header_textcolor() !== HEADER_TEXTCOLOR ) :
|
||||
?>
|
||||
#site-title a,
|
||||
#site-description {
|
||||
|
@ -724,7 +724,7 @@ if ( ! function_exists( 'twentyeleven_comment' ) ) :
|
|||
<?php
|
||||
$avatar_size = 68;
|
||||
|
||||
if ( '0' != $comment->comment_parent ) {
|
||||
if ( '0' !== $comment->comment_parent ) {
|
||||
$avatar_size = 39;
|
||||
}
|
||||
|
||||
|
@ -756,7 +756,7 @@ if ( ! function_exists( 'twentyeleven_comment' ) ) :
|
|||
}
|
||||
?>
|
||||
|
||||
<?php if ( '0' == $comment->comment_approved ) : ?>
|
||||
<?php if ( '0' === $comment->comment_approved ) : ?>
|
||||
<em class="comment-awaiting-moderation"><?php echo $moderation_note; ?></em>
|
||||
<br />
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -70,7 +70,7 @@ get_header(); ?>
|
|||
)
|
||||
);
|
||||
foreach ( $attachments as $k => $attachment ) {
|
||||
if ( $attachment->ID == $post->ID ) {
|
||||
if ( $attachment->ID === $post->ID ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -446,7 +446,7 @@ function twentyeleven_print_link_color_style() {
|
|||
$default_options = twentyeleven_get_default_theme_options();
|
||||
|
||||
// Don't do anything if the current link color is the default.
|
||||
if ( $default_options['link_color'] == $link_color ) {
|
||||
if ( $default_options['link_color'] === $link_color ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -154,7 +154,7 @@ get_header(); ?>
|
|||
while ( $featured->have_posts() ) :
|
||||
$featured->the_post();
|
||||
$counter_slider++;
|
||||
if ( 1 == $counter_slider ) {
|
||||
if ( 1 === $counter_slider ) {
|
||||
$class = ' class="active"';
|
||||
} else {
|
||||
$class = '';
|
||||
|
|
|
@ -471,7 +471,7 @@ if ( ! function_exists( 'twentyfourteen_the_attached_image' ) ) :
|
|||
// If there is more than 1 attachment in a gallery...
|
||||
if ( count( $attachment_ids ) > 1 ) {
|
||||
foreach ( $attachment_ids as $idx => $attachment_id ) {
|
||||
if ( $attachment_id == $post->ID ) {
|
||||
if ( $attachment_id === $post->ID ) {
|
||||
$next_id = $attachment_ids[ ( $idx + 1 ) % count( $attachment_ids ) ];
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ if ( ! function_exists( 'twentyfourteen_header_style' ) ) :
|
|||
}
|
||||
<?php
|
||||
// If the user has set a custom color for the text, use that.
|
||||
elseif ( get_theme_support( 'custom-header', 'default-text-color' ) != $text_color ) :
|
||||
elseif ( get_theme_support( 'custom-header', 'default-text-color' ) !== $text_color ) :
|
||||
?>
|
||||
.site-title a {
|
||||
color: #<?php echo esc_attr( $text_color ); ?>;
|
||||
|
|
|
@ -262,7 +262,7 @@ class Featured_Content {
|
|||
public static function delete_post_tag( $tag_id ) {
|
||||
$settings = self::get_setting();
|
||||
|
||||
if ( empty( $settings['tag-id'] ) || $tag_id != $settings['tag-id'] ) {
|
||||
if ( empty( $settings['tag-id'] ) || $tag_id !== $settings['tag-id'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class TwentyNineteen_Walker_Comment extends Walker_Comment {
|
|||
$comment_author_url = get_comment_author_url( $comment );
|
||||
$comment_author = get_comment_author( $comment );
|
||||
$avatar = get_avatar( $comment, $args['avatar_size'] );
|
||||
if ( 0 != $args['avatar_size'] ) {
|
||||
if ( 0 !== (int) $args['avatar_size'] ) {
|
||||
if ( empty( $comment_author_url ) ) {
|
||||
echo $avatar;
|
||||
} else {
|
||||
|
@ -98,7 +98,7 @@ class TwentyNineteen_Walker_Comment extends Walker_Comment {
|
|||
}
|
||||
?>
|
||||
|
||||
<?php if ( '0' == $comment->comment_approved ) : ?>
|
||||
<?php if ( '0' === $comment->comment_approved ) : ?>
|
||||
<p class="comment-awaiting-moderation"><?php echo $moderation_note; ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ $discussion = twentynineteen_get_discussion_data();
|
|||
_e( 'Leave a comment', 'twentynineteen' );
|
||||
}
|
||||
} else {
|
||||
if ( '1' == $discussion->responses ) {
|
||||
if ( '1' === (string) $discussion->responses ) {
|
||||
/* translators: %s: Post title. */
|
||||
printf( _x( 'One reply on “%s”', 'comments title', 'twentynineteen' ), get_the_title() );
|
||||
} else {
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<?php if ( have_comments() ) : ?>
|
||||
<h3 id="comments-title">
|
||||
<?php
|
||||
if ( 1 === get_comments_number() ) {
|
||||
if ( '1' === get_comments_number() ) {
|
||||
printf(
|
||||
/* translators: %s: The post title. */
|
||||
__( 'One Response to %s', 'twentyten' ),
|
||||
|
|
|
@ -439,7 +439,7 @@ if ( ! function_exists( 'twentyten_comment' ) ) :
|
|||
}
|
||||
?>
|
||||
|
||||
<?php if ( '0' == $comment->comment_approved ) : ?>
|
||||
<?php if ( '0' === $comment->comment_approved ) : ?>
|
||||
<em class="comment-awaiting-moderation"><?php echo $moderation_note; ?></em>
|
||||
<br />
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -100,7 +100,7 @@ if ( have_posts() ) {
|
|||
)
|
||||
);
|
||||
foreach ( $attachments as $k => $attachment ) {
|
||||
if ( $attachment->ID == $post->ID ) {
|
||||
if ( $attachment->ID === $post->ID ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ if ( post_password_required() ) {
|
|||
<?php if ( have_comments() ) : ?>
|
||||
<h2 class="comments-title">
|
||||
<?php
|
||||
if ( 1 === get_comments_number() ) {
|
||||
if ( '1' === get_comments_number() ) {
|
||||
printf(
|
||||
/* translators: %s: The post title. */
|
||||
_x( 'One thought on “%s”', 'comments title', 'twentythirteen' ),
|
||||
|
|
|
@ -652,7 +652,7 @@ if ( ! function_exists( 'twentythirteen_the_attached_image' ) ) :
|
|||
// If there is more than 1 attachment in a gallery...
|
||||
if ( count( $attachment_ids ) > 1 ) {
|
||||
foreach ( $attachment_ids as $idx => $attachment_id ) {
|
||||
if ( $attachment_id == $post->ID ) {
|
||||
if ( $attachment_id === $post->ID ) {
|
||||
$next_id = $attachment_ids[ ( $idx + 1 ) % count( $attachment_ids ) ];
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ get_header(); ?>
|
|||
$published_text = __( 'Published on <time class="entry-date" datetime="%1$s">%2$s</time> in <a href="%3$s" title="Go to %4$s" rel="gallery">%5$s</a>', 'twentythirteen' );
|
||||
$published_text = '<span class="attachment-meta">' . $published_text . '</span>';
|
||||
$post_title = get_the_title( $post->post_parent );
|
||||
if ( empty( $post_title ) || 0 == $post->post_parent ) {
|
||||
if ( empty( $post_title ) || 0 === $post->post_parent ) {
|
||||
$published_text = '<span class="attachment-meta"><time class="entry-date" datetime="%1$s">%2$s</time></span>';
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ function twentythirteen_header_style() {
|
|||
$text_color = get_header_textcolor();
|
||||
|
||||
// If no custom options for text are set, let's bail.
|
||||
if ( empty( $header_image ) && get_theme_support( 'custom-header', 'default-text-color' ) == $text_color ) {
|
||||
if ( empty( $header_image ) && get_theme_support( 'custom-header', 'default-text-color' ) === $text_color ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ function twentythirteen_header_style() {
|
|||
endif;
|
||||
|
||||
// If the user has set a custom color for the text, use that.
|
||||
elseif ( get_theme_support( 'custom-header', 'default-text-color' ) != $text_color ) :
|
||||
elseif ( get_theme_support( 'custom-header', 'default-text-color' ) !== $text_color ) :
|
||||
?>
|
||||
.site-title,
|
||||
.site-description {
|
||||
|
|
|
@ -29,7 +29,7 @@ if ( post_password_required() ) {
|
|||
<?php if ( have_comments() ) : ?>
|
||||
<h2 class="comments-title">
|
||||
<?php
|
||||
if ( 1 === get_comments_number() ) {
|
||||
if ( '1' === get_comments_number() ) {
|
||||
printf(
|
||||
/* translators: %s: The post title. */
|
||||
__( 'One thought on “%s”', 'twentytwelve' ),
|
||||
|
|
|
@ -461,7 +461,7 @@ if ( ! function_exists( 'twentytwelve_comment' ) ) :
|
|||
}
|
||||
?>
|
||||
|
||||
<?php if ( '0' == $comment->comment_approved ) : ?>
|
||||
<?php if ( '0' === $comment->comment_approved ) : ?>
|
||||
<p class="comment-awaiting-moderation"><?php echo $moderation_note; ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ get_header(); ?>
|
|||
)
|
||||
);
|
||||
foreach ( $attachments as $k => $attachment ) :
|
||||
if ( $attachment->ID == $post->ID ) {
|
||||
if ( $attachment->ID === $post->ID ) {
|
||||
break;
|
||||
}
|
||||
endforeach;
|
||||
|
|
|
@ -71,7 +71,7 @@ function twentytwelve_header_style() {
|
|||
$text_color = get_header_textcolor();
|
||||
|
||||
// If no custom options for text are set, let's bail.
|
||||
if ( get_theme_support( 'custom-header', 'default-text-color' ) == $text_color ) {
|
||||
if ( get_theme_support( 'custom-header', 'default-text-color' ) === $text_color ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ if ( $comments ) {
|
|||
<div class="comments" id="comments">
|
||||
|
||||
<?php
|
||||
$comments_number = absint( get_comments_number() );
|
||||
$comments_number = get_comments_number();
|
||||
?>
|
||||
|
||||
<div class="comments-header section-inner small max-percentage">
|
||||
|
@ -32,7 +32,7 @@ if ( $comments ) {
|
|||
<?php
|
||||
if ( ! have_comments() ) {
|
||||
_e( 'Leave a comment', 'twentytwenty' );
|
||||
} elseif ( 1 === $comments_number ) {
|
||||
} elseif ( '1' === $comments_number ) {
|
||||
/* translators: %s: Post title. */
|
||||
printf( _x( 'One reply on “%s”', 'comments title', 'twentytwenty' ), get_the_title() );
|
||||
} else {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.2-beta3-55419';
|
||||
$wp_version = '6.2-beta3-55420';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue