Passed
Push — dev ( 396b23...3b84be )
by Eric
02:58
created

comments.php (20 issues)

1
<?php
2
/**
3
 * The template for displaying comments.
4
 *
5
 * This is the template that displays the area of the page that contains both the current comments
6
 * and the comment form.
7
 *
8
 * @link https://codex.wordpress.org/Template_Hierarchy
9
 *
10
 * @package bitsy
11
 */
12
13
/*
14
 * If the current post is protected by a password and
15
 * the visitor has not yet entered the password we will
16
 * return early without loading the comments.
17
 */
18
if ( post_password_required() ) {
1 ignored issue
show
The function post_password_required was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

18
if ( /** @scrutinizer ignore-call */ post_password_required() ) {
Loading history...
19
	return;
20
}
21
?>
22
23
<div id="comments" class="comments-area">
24
25
	<?php
26
	// You can start editing here -- including this comment!
27
	if ( have_comments() ) : ?>
1 ignored issue
show
The function have_comments was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

27
	if ( /** @scrutinizer ignore-call */ have_comments() ) : ?>
Loading history...
28
		<h2 class="comments-title">
29
			<?php
30
				printf( // WPCS: XSS OK.
31
					esc_html( _nx( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'bitsy' ) ),
3 ignored issues
show
The function _nx was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

31
					esc_html( /** @scrutinizer ignore-call */ _nx( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'bitsy' ) ),
Loading history...
The function get_comments_number was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

31
					esc_html( _nx( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', /** @scrutinizer ignore-call */ get_comments_number(), 'comments title', 'bitsy' ) ),
Loading history...
The function esc_html was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

31
					/** @scrutinizer ignore-call */ 
32
     esc_html( _nx( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'bitsy' ) ),
Loading history...
32
					number_format_i18n( get_comments_number() ),
1 ignored issue
show
The function number_format_i18n was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

32
					/** @scrutinizer ignore-call */ 
33
     number_format_i18n( get_comments_number() ),
Loading history...
33
					'<span>' . get_the_title() . '</span>'
1 ignored issue
show
The function get_the_title was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

33
					'<span>' . /** @scrutinizer ignore-call */ get_the_title() . '</span>'
Loading history...
34
				);
35
			?>
36
		</h2>
37
38 View Code Duplication
		<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
2 ignored issues
show
The function get_option was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

38
		<?php if ( get_comment_pages_count() > 1 && /** @scrutinizer ignore-call */ get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
Loading history...
The function get_comment_pages_count was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

38
		<?php if ( /** @scrutinizer ignore-call */ get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
Loading history...
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
39
		<nav id="comment-nav-above" class="navigation comment-navigation" role="navigation">
40
			<h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'bitsy' ); ?></h2>
1 ignored issue
show
The function esc_html_e was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

40
			<h2 class="screen-reader-text"><?php /** @scrutinizer ignore-call */ esc_html_e( 'Comment navigation', 'bitsy' ); ?></h2>
Loading history...
41
			<div class="nav-links">
42
43
				<div class="nav-previous"><?php previous_comments_link( esc_html__( 'Older Comments', 'bitsy' ) ); ?></div>
2 ignored issues
show
The function esc_html__ was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

43
				<div class="nav-previous"><?php previous_comments_link( /** @scrutinizer ignore-call */ esc_html__( 'Older Comments', 'bitsy' ) ); ?></div>
Loading history...
The function previous_comments_link was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

43
				<div class="nav-previous"><?php /** @scrutinizer ignore-call */ previous_comments_link( esc_html__( 'Older Comments', 'bitsy' ) ); ?></div>
Loading history...
44
				<div class="nav-next"><?php next_comments_link( esc_html__( 'Newer Comments', 'bitsy' ) ); ?></div>
1 ignored issue
show
The function next_comments_link was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

44
				<div class="nav-next"><?php /** @scrutinizer ignore-call */ next_comments_link( esc_html__( 'Newer Comments', 'bitsy' ) ); ?></div>
Loading history...
45
46
			</div><!-- .nav-links -->
47
		</nav><!-- #comment-nav-above -->
48
		<?php endif; // Check for comment navigation. ?>
49
50
		<ol class="comment-list">
51
			<?php
52
				wp_list_comments( array(
1 ignored issue
show
The function wp_list_comments was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

52
				/** @scrutinizer ignore-call */ 
53
    wp_list_comments( array(
Loading history...
53
					'style'      => 'ol',
54
					'short_ping' => true,
55
				) );
56
			?>
57
		</ol><!-- .comment-list -->
58
59 View Code Duplication
		<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
60
		<nav id="comment-nav-below" class="navigation comment-navigation" role="navigation">
61
			<h2 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'bitsy' ); ?></h2>
62
			<div class="nav-links">
63
64
				<div class="nav-previous"><?php previous_comments_link( esc_html__( 'Older Comments', 'bitsy' ) ); ?></div>
65
				<div class="nav-next"><?php next_comments_link( esc_html__( 'Newer Comments', 'bitsy' ) ); ?></div>
66
67
			</div><!-- .nav-links -->
68
		</nav><!-- #comment-nav-below -->
69
		<?php
70
		endif; // Check for comment navigation.
71
72
	endif; // Check for have_comments().
73
74
75
	// If comments are closed and there are comments, let's leave a little note, shall we?
76
	if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
3 ignored issues
show
The function post_type_supports was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

76
	if ( ! comments_open() && get_comments_number() && /** @scrutinizer ignore-call */ post_type_supports( get_post_type(), 'comments' ) ) : ?>
Loading history...
The function get_post_type was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

76
	if ( ! comments_open() && get_comments_number() && post_type_supports( /** @scrutinizer ignore-call */ get_post_type(), 'comments' ) ) : ?>
Loading history...
The function comments_open was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

76
	if ( ! /** @scrutinizer ignore-call */ comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
Loading history...
77
78
		<p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'bitsy' ); ?></p>
79
	<?php
80
	endif;
81
82
	comment_form();
1 ignored issue
show
The function comment_form was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

82
	/** @scrutinizer ignore-call */ 
83
 comment_form();
Loading history...
83
	?>
84
85
</div><!-- #comments -->
86