Skip to content

Commit faff3a2

Browse files
Coding Standards: Use strict comparison in wp-includes/comment-template.php.
Follow-up to [162], [2685], [4494], [8878], [8961], [55660]. Props aristath, poena, afercia, SergeyBiryukov. See #62279. git-svn-id: https://develop.svn.wordpress.org/trunk@59498 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 750f743 commit faff3a2

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/wp-includes/comment-template.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ function comments_number( $zero = false, $one = false, $more = false, $post = 0
961961
* @return string Language string for the number of comments a post has.
962962
*/
963963
function get_comments_number_text( $zero = false, $one = false, $more = false, $post = 0 ) {
964-
$comments_number = get_comments_number( $post );
964+
$comments_number = (int) get_comments_number( $post );
965965

966966
if ( $comments_number > 1 ) {
967967
if ( false === $more ) {
@@ -996,7 +996,7 @@ function get_comments_number_text( $zero = false, $one = false, $more = false, $
996996

997997
$comments_number_text = str_replace( '%', number_format_i18n( $comments_number ), $more );
998998
}
999-
} elseif ( 0 == $comments_number ) {
999+
} elseif ( 0 === $comments_number ) {
10001000
$comments_number_text = ( false === $zero ) ? __( 'No Comments' ) : $zero;
10011001
} else { // Must be one.
10021002
$comments_number_text = ( false === $one ) ? __( '1 Comment' ) : $one;
@@ -1648,7 +1648,7 @@ function comments_template( $file = '/comments.php', $separate_comments = false
16481648
function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) {
16491649
$post_id = get_the_ID();
16501650
$post_title = get_the_title();
1651-
$comments_number = get_comments_number( $post_id );
1651+
$comments_number = (int) get_comments_number( $post_id );
16521652

16531653
if ( false === $zero ) {
16541654
/* translators: %s: Post title. */
@@ -1675,7 +1675,7 @@ function comments_popup_link( $zero = false, $one = false, $more = false, $css_c
16751675
$none = sprintf( __( 'Comments Off<span class="screen-reader-text"> on %s</span>' ), $post_title );
16761676
}
16771677

1678-
if ( 0 == $comments_number && ! comments_open() && ! pings_open() ) {
1678+
if ( 0 === $comments_number && ! comments_open() && ! pings_open() ) {
16791679
printf(
16801680
'<span%1$s>%2$s</span>',
16811681
! empty( $css_class ) ? ' class="' . esc_attr( $css_class ) . '"' : '',
@@ -1689,7 +1689,7 @@ function comments_popup_link( $zero = false, $one = false, $more = false, $css_c
16891689
return;
16901690
}
16911691

1692-
if ( 0 == $comments_number ) {
1692+
if ( 0 === $comments_number ) {
16931693
$respond_link = get_permalink() . '#respond';
16941694
/**
16951695
* Filters the respond link when a post has no comments.
@@ -1773,7 +1773,10 @@ function get_comment_reply_link( $args = array(), $comment = null, $post = null
17731773

17741774
$args = wp_parse_args( $args, $defaults );
17751775

1776-
if ( 0 == $args['depth'] || $args['max_depth'] <= $args['depth'] ) {
1776+
$args['max_depth'] = (int) $args['max_depth'];
1777+
$args['depth'] = (int) $args['depth'];
1778+
1779+
if ( 0 === $args['depth'] || $args['max_depth'] <= $args['depth'] ) {
17771780
return;
17781781
}
17791782

0 commit comments

Comments
 (0)