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() ) : ?>
|
<?php if ( have_comments() ) : ?>
|
||||||
<h2 id="comments-title">
|
<h2 id="comments-title">
|
||||||
<?php
|
<?php
|
||||||
if ( 1 === get_comments_number() ) {
|
if ( '1' === get_comments_number() ) {
|
||||||
printf(
|
printf(
|
||||||
/* translators: %s: The post title. */
|
/* translators: %s: The post title. */
|
||||||
__( 'One thought on “%1$s”', 'twentyeleven' ),
|
__( 'One thought on “%1$s”', 'twentyeleven' ),
|
||||||
|
|
|
@ -322,7 +322,7 @@ if ( ! function_exists( 'twentyeleven_header_style' ) ) :
|
||||||
$text_color = get_header_textcolor();
|
$text_color = get_header_textcolor();
|
||||||
|
|
||||||
// If no custom options for text are set, let's bail.
|
// If no custom options for text are set, let's bail.
|
||||||
if ( HEADER_TEXTCOLOR == $text_color ) {
|
if ( HEADER_TEXTCOLOR === $text_color ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,7 +386,7 @@ if ( ! function_exists( 'twentyeleven_admin_header_style' ) ) :
|
||||||
}
|
}
|
||||||
<?php
|
<?php
|
||||||
// If the user has set a custom color for the text, use that.
|
// 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-title a,
|
||||||
#site-description {
|
#site-description {
|
||||||
|
@ -724,7 +724,7 @@ if ( ! function_exists( 'twentyeleven_comment' ) ) :
|
||||||
<?php
|
<?php
|
||||||
$avatar_size = 68;
|
$avatar_size = 68;
|
||||||
|
|
||||||
if ( '0' != $comment->comment_parent ) {
|
if ( '0' !== $comment->comment_parent ) {
|
||||||
$avatar_size = 39;
|
$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>
|
<em class="comment-awaiting-moderation"><?php echo $moderation_note; ?></em>
|
||||||
<br />
|
<br />
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
|
@ -70,7 +70,7 @@ get_header(); ?>
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
foreach ( $attachments as $k => $attachment ) {
|
foreach ( $attachments as $k => $attachment ) {
|
||||||
if ( $attachment->ID == $post->ID ) {
|
if ( $attachment->ID === $post->ID ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -446,7 +446,7 @@ function twentyeleven_print_link_color_style() {
|
||||||
$default_options = twentyeleven_get_default_theme_options();
|
$default_options = twentyeleven_get_default_theme_options();
|
||||||
|
|
||||||
// Don't do anything if the current link color is the default.
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -154,7 +154,7 @@ get_header(); ?>
|
||||||
while ( $featured->have_posts() ) :
|
while ( $featured->have_posts() ) :
|
||||||
$featured->the_post();
|
$featured->the_post();
|
||||||
$counter_slider++;
|
$counter_slider++;
|
||||||
if ( 1 == $counter_slider ) {
|
if ( 1 === $counter_slider ) {
|
||||||
$class = ' class="active"';
|
$class = ' class="active"';
|
||||||
} else {
|
} else {
|
||||||
$class = '';
|
$class = '';
|
||||||
|
|
|
@ -471,7 +471,7 @@ if ( ! function_exists( 'twentyfourteen_the_attached_image' ) ) :
|
||||||
// If there is more than 1 attachment in a gallery...
|
// If there is more than 1 attachment in a gallery...
|
||||||
if ( count( $attachment_ids ) > 1 ) {
|
if ( count( $attachment_ids ) > 1 ) {
|
||||||
foreach ( $attachment_ids as $idx => $attachment_id ) {
|
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 ) ];
|
$next_id = $attachment_ids[ ( $idx + 1 ) % count( $attachment_ids ) ];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ if ( ! function_exists( 'twentyfourteen_header_style' ) ) :
|
||||||
}
|
}
|
||||||
<?php
|
<?php
|
||||||
// If the user has set a custom color for the text, use that.
|
// 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 {
|
.site-title a {
|
||||||
color: #<?php echo esc_attr( $text_color ); ?>;
|
color: #<?php echo esc_attr( $text_color ); ?>;
|
||||||
|
|
|
@ -262,7 +262,7 @@ class Featured_Content {
|
||||||
public static function delete_post_tag( $tag_id ) {
|
public static function delete_post_tag( $tag_id ) {
|
||||||
$settings = self::get_setting();
|
$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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ class TwentyNineteen_Walker_Comment extends Walker_Comment {
|
||||||
$comment_author_url = get_comment_author_url( $comment );
|
$comment_author_url = get_comment_author_url( $comment );
|
||||||
$comment_author = get_comment_author( $comment );
|
$comment_author = get_comment_author( $comment );
|
||||||
$avatar = get_avatar( $comment, $args['avatar_size'] );
|
$avatar = get_avatar( $comment, $args['avatar_size'] );
|
||||||
if ( 0 != $args['avatar_size'] ) {
|
if ( 0 !== (int) $args['avatar_size'] ) {
|
||||||
if ( empty( $comment_author_url ) ) {
|
if ( empty( $comment_author_url ) ) {
|
||||||
echo $avatar;
|
echo $avatar;
|
||||||
} else {
|
} 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>
|
<p class="comment-awaiting-moderation"><?php echo $moderation_note; ?></p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ $discussion = twentynineteen_get_discussion_data();
|
||||||
_e( 'Leave a comment', 'twentynineteen' );
|
_e( 'Leave a comment', 'twentynineteen' );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ( '1' == $discussion->responses ) {
|
if ( '1' === (string) $discussion->responses ) {
|
||||||
/* translators: %s: Post title. */
|
/* translators: %s: Post title. */
|
||||||
printf( _x( 'One reply on “%s”', 'comments title', 'twentynineteen' ), get_the_title() );
|
printf( _x( 'One reply on “%s”', 'comments title', 'twentynineteen' ), get_the_title() );
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<?php if ( have_comments() ) : ?>
|
<?php if ( have_comments() ) : ?>
|
||||||
<h3 id="comments-title">
|
<h3 id="comments-title">
|
||||||
<?php
|
<?php
|
||||||
if ( 1 === get_comments_number() ) {
|
if ( '1' === get_comments_number() ) {
|
||||||
printf(
|
printf(
|
||||||
/* translators: %s: The post title. */
|
/* translators: %s: The post title. */
|
||||||
__( 'One Response to %s', 'twentyten' ),
|
__( '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>
|
<em class="comment-awaiting-moderation"><?php echo $moderation_note; ?></em>
|
||||||
<br />
|
<br />
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
|
@ -100,7 +100,7 @@ if ( have_posts() ) {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
foreach ( $attachments as $k => $attachment ) {
|
foreach ( $attachments as $k => $attachment ) {
|
||||||
if ( $attachment->ID == $post->ID ) {
|
if ( $attachment->ID === $post->ID ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ if ( post_password_required() ) {
|
||||||
<?php if ( have_comments() ) : ?>
|
<?php if ( have_comments() ) : ?>
|
||||||
<h2 class="comments-title">
|
<h2 class="comments-title">
|
||||||
<?php
|
<?php
|
||||||
if ( 1 === get_comments_number() ) {
|
if ( '1' === get_comments_number() ) {
|
||||||
printf(
|
printf(
|
||||||
/* translators: %s: The post title. */
|
/* translators: %s: The post title. */
|
||||||
_x( 'One thought on “%s”', 'comments title', 'twentythirteen' ),
|
_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 there is more than 1 attachment in a gallery...
|
||||||
if ( count( $attachment_ids ) > 1 ) {
|
if ( count( $attachment_ids ) > 1 ) {
|
||||||
foreach ( $attachment_ids as $idx => $attachment_id ) {
|
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 ) ];
|
$next_id = $attachment_ids[ ( $idx + 1 ) % count( $attachment_ids ) ];
|
||||||
break;
|
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 = __( '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>';
|
$published_text = '<span class="attachment-meta">' . $published_text . '</span>';
|
||||||
$post_title = get_the_title( $post->post_parent );
|
$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>';
|
$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();
|
$text_color = get_header_textcolor();
|
||||||
|
|
||||||
// If no custom options for text are set, let's bail.
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ function twentythirteen_header_style() {
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
// If the user has set a custom color for the text, use that.
|
// 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-title,
|
||||||
.site-description {
|
.site-description {
|
||||||
|
|
|
@ -29,7 +29,7 @@ if ( post_password_required() ) {
|
||||||
<?php if ( have_comments() ) : ?>
|
<?php if ( have_comments() ) : ?>
|
||||||
<h2 class="comments-title">
|
<h2 class="comments-title">
|
||||||
<?php
|
<?php
|
||||||
if ( 1 === get_comments_number() ) {
|
if ( '1' === get_comments_number() ) {
|
||||||
printf(
|
printf(
|
||||||
/* translators: %s: The post title. */
|
/* translators: %s: The post title. */
|
||||||
__( 'One thought on “%s”', 'twentytwelve' ),
|
__( '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>
|
<p class="comment-awaiting-moderation"><?php echo $moderation_note; ?></p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ get_header(); ?>
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
foreach ( $attachments as $k => $attachment ) :
|
foreach ( $attachments as $k => $attachment ) :
|
||||||
if ( $attachment->ID == $post->ID ) {
|
if ( $attachment->ID === $post->ID ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|
|
@ -71,7 +71,7 @@ function twentytwelve_header_style() {
|
||||||
$text_color = get_header_textcolor();
|
$text_color = get_header_textcolor();
|
||||||
|
|
||||||
// If no custom options for text are set, let's bail.
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ if ( $comments ) {
|
||||||
<div class="comments" id="comments">
|
<div class="comments" id="comments">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$comments_number = absint( get_comments_number() );
|
$comments_number = get_comments_number();
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="comments-header section-inner small max-percentage">
|
<div class="comments-header section-inner small max-percentage">
|
||||||
|
@ -32,7 +32,7 @@ if ( $comments ) {
|
||||||
<?php
|
<?php
|
||||||
if ( ! have_comments() ) {
|
if ( ! have_comments() ) {
|
||||||
_e( 'Leave a comment', 'twentytwenty' );
|
_e( 'Leave a comment', 'twentytwenty' );
|
||||||
} elseif ( 1 === $comments_number ) {
|
} elseif ( '1' === $comments_number ) {
|
||||||
/* translators: %s: Post title. */
|
/* translators: %s: Post title. */
|
||||||
printf( _x( 'One reply on “%s”', 'comments title', 'twentytwenty' ), get_the_title() );
|
printf( _x( 'One reply on “%s”', 'comments title', 'twentytwenty' ), get_the_title() );
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue