forked from WordPress/theme-check
/
comment_reply.php
27 lines (21 loc) · 1.25 KB
/
comment_reply.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
class Comment_Reply implements themecheck {
protected $error = array();
function check( $php_files, $css_files, $other_files) {
$php = implode( ' ', $php_files );
$ret = true;
checkcount();
if ( ! preg_match( '/wp_enqueue_script\(\s?("|\')comment-reply("|\')/i', $php ) ) {
if ( ! preg_match( '/comment-reply/', $php ) ) {
$check = __( 'See: <a href="http://codex.wordpress.org/Migrating_Plugins_and_Themes_to_2.7/Enhanced_Comment_Display">Migrating Plugins and Themes to 2.7/Enhanced Comment Display</a><pre> <?php if ( is_singular() ) wp_enqueue_script( "comment-reply" ); ?></pre>', 'theme-check' );
$this->error[] = sprintf(__('<span class="tc-lead tc-required">REQUIRED</span>: Could not find the <strong>comment-reply</strong> script enqueued. %1$s', 'theme-check'), $check);
$ret = false;
} else {
$this->error[] = __('<span class="tc-lead tc-info">INFO</span>: Could not find the <strong>comment-reply</strong> script enqueued, however a reference to \'comment-reply\' was found. Make sure that the comment-reply script is being enqueued properly on singular pages.', 'theme-check');
}
}
return $ret;
}
function getError() { return $this->error; }
}
$themechecks[] = new Comment_Reply;