Passed
Pull Request — master (#982)
by
unknown
09:04 queued 04:38
created

comment.php (5 issues)

1
<?php
2
/**
3
 * The template for displaying Comment.
4
 *
5
 * @package lsx
6
 */
7
8
if ( isset( $GLOBALS['comment_depth'] ) ) {
9
	$depth = intval( $GLOBALS['comment_depth'] );
10
} else {
11
	$depth = 1;
12
}
13
14
$max_depth = intval( get_option( 'thread_comments_depth' ) );
15
16
echo get_avatar( $comment, '128' );
0 ignored issues
show
Are you sure get_avatar($comment, '128') of type false|string can be used in echo? ( Ignorable by Annotation )

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

16
echo /** @scrutinizer ignore-type */ get_avatar( $comment, '128' );
Loading history...
17
?>
18
<div class="media-body">
19
	<h4 class="media-heading"><?php echo get_comment_author_link(); ?></h4>
20
21
	<time datetime="<?php echo comment_date( 'c' ); ?>">
0 ignored issues
show
Are you sure the usage of comment_date('c') is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'comment_date'.
Loading history...
22
		<a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
23
			<?php
24
				printf(
25
					/* Translators: 1: post date, 2: post time */
26
					esc_html__( '%1$s on %2$s', 'lsx' ),
27
					get_comment_date(),
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'get_comment_date'.
Loading history...
28
					get_comment_time()
0 ignored issues
show
All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'get_comment_time'.
Loading history...
29
				);
30
				?>
31
		</a>
32
	</time>
33
34
	<?php edit_comment_link( esc_html__( '(Edit)', 'lsx' ), '', '' ); ?>
35
36
	<?php if ( ! $comment->comment_approved ) : ?>
37
		<div class="alert alert-info">
38
			<?php esc_html_e( 'Your comment is awaiting moderation.', 'lsx' ); ?>
39
		</div>
40
	<?php endif; ?>
41
42
<?php
43
comment_text();
44
45
comment_reply_link(
46
	array(
47
		'depth'     => $depth,
48
		'max_depth' => $max_depth,
49
	)
50
);
51