Esempio n. 1
0
/**
 * Render all the ajax comments
 */
function siteorigin_ajax_comments_ajax_comment_rerender($location, $comment)
{
    if (empty($_POST['is_ajax'])) {
        return $location;
    }
    $post_id = isset($_POST['comment_post_ID']) ? intval($_POST['comment_post_ID']) : '';
    // We're going to pretend this is a single
    $query = array('post_id' => $post_id);
    if (get_option('page_comments')) {
        $args['per_page'] = get_option('comments_per_page');
        $cpage = get_page_of_comment($comment->comment_ID, $args);
        $query['cpage'] = $cpage;
    }
    // Prevents a conflict with older versions of Page Builder.
    remove_filter('the_posts', 'siteorigin_panels_prepare_post_content');
    query_posts($query);
    global $wp_query;
    $wp_query->is_single = true;
    $wp_query->is_singular = true;
    ob_start();
    comments_template();
    $comment_html = ob_get_clean();
    wp_reset_query();
    echo json_encode(array('status' => 'success', 'html' => $comment_html));
    exit;
}
Esempio n. 2
0
 public function test_last_comment()
 {
     $p = $this->factory->post->create();
     // page 4
     $comment_last = $this->factory->comment->create_post_comments($p, 1, array('comment_date' => '2013-09-24 00:00:00'));
     $this->factory->comment->create_post_comments($p, 1, array('comment_date' => '2013-09-23 00:00:00'));
     // page 3
     $this->factory->comment->create_post_comments($p, 1, array('comment_date' => '2013-09-22 00:00:00'));
     $this->factory->comment->create_post_comments($p, 1, array('comment_date' => '2013-09-21 00:00:00'));
     $this->factory->comment->create_post_comments($p, 1, array('comment_date' => '2013-09-20 00:00:00'));
     // page 2
     $this->factory->comment->create_post_comments($p, 1, array('comment_date' => '2013-09-19 00:00:00'));
     $this->factory->comment->create_post_comments($p, 1, array('comment_date' => '2013-09-18 00:00:00'));
     $this->factory->comment->create_post_comments($p, 1, array('comment_date' => '2013-09-17 00:00:00'));
     // page 1
     $this->factory->comment->create_post_comments($p, 1, array('comment_date' => '2013-09-16 00:00:00'));
     $this->factory->comment->create_post_comments($p, 1, array('comment_date' => '2013-09-15 00:00:00'));
     $comment_first = $this->factory->comment->create_post_comments($p, 1, array('comment_date' => '2013-09-14 00:00:00'));
     $this->assertEquals(4, get_page_of_comment($comment_last[0], array('per_page' => 3)));
     $this->assertEquals(2, get_page_of_comment($comment_last[0], array('per_page' => 10)));
     $this->assertEquals(1, get_page_of_comment($comment_first[0], array('per_page' => 3)));
     $this->assertEquals(1, get_page_of_comment($comment_first[0], array('per_page' => 10)));
 }
Esempio n. 3
0
function mytheme_comment($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    global $commentcount;
    if (!$commentcount) {
        $page = !empty($in_comment_loop) ? get_query_var('cpage') - 1 : get_page_of_comment($comment->comment_ID, $args) - 1;
        $cpp = get_option('comments_per_page');
        $commentcount = $cpp * $page;
    }
    ?>
   <li <?php 
    comment_class();
    ?>
 id="li-comment-<?php 
    comment_ID();
    ?>
">
		<div id="comment-<?php 
    comment_ID();
    ?>
" class="comment-body">
			<div class="comment-author"><?php 
    echo get_avatar($comment, $size = '36');
    ?>
</div>
			<div class="comment-head">
				<span class="name"><?php 
    printf(__('%s'), get_comment_author_link());
    ?>
</span>
				<span class="date"><?php 
    if (!($parent_id = $comment->comment_parent)) {
        printf(__('%1$s %2$s'), get_comment_date('Y-n-j'), get_comment_time('H:i'));
    }
    ?>
 <?php 
    if (!($parent_id = $comment->comment_parent)) {
        printf('#%1$s', ++$commentcount);
    }
    ?>
</span>
				<span class="comment-entry"><?php 
    comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'], 'reply_text' => __('回复TA'))));
    ?>
</span>
			</div>
			<div class="comment-text"><?php 
    comment_text();
    ?>
</div>
     </div>
<?php 
}
function Gztro_comment($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    global $commentcount;
    $page = !empty($in_comment_loop) ? get_query_var('cpage') : get_page_of_comment($comment->comment_ID, $args);
    $cpp = get_option('comments_per_page');
    if (!$commentcount) {
        if ($page > 1) {
            $commentcount = $cpp * ($page - 1);
        } else {
            $commentcount = 0;
        }
    }
    ?>
	<li <?php 
    comment_class();
    ?>
 <?php 
    if ($depth > 1) {
        echo ' style="margin-left:' . ceil(80 / $depth) . 'px;"';
    }
    ?>
 id="li-comment-<?php 
    comment_ID();
    ?>
" >
		<div id="comment-<?php 
    comment_ID();
    ?>
" class="comment-body">
			<div class="commentmeta">
			<?php 
    echo get_avatar($comment->comment_author_email, $size = '42', $default);
    ?>
			</div>
				<?php 
    if ($comment->comment_approved == '0') {
        ?>
				<em><?php 
        _e('Your comment is awaiting moderation.');
        ?>
</em><br />
				<?php 
    }
    ?>
			<div class="Floor">&nbsp;&nbsp;<span><?php 
    if (!($parent_id = $comment->comment_parent)) {
        printf('%1$sF', ++$commentcount);
    }
    if ($depth > 1) {
        printf('%1$sB', $depth - 1);
    }
    ?>
</span></div>
			<div class="reply"><?php 
    comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'], 'reply_text' => __('@回复Ta'))));
    ?>
</div>
			<div class="vcard"><span class="vcard-uid"><?php 
    printf(__('%s'), get_comment_author_link());
    ?>
</span>&nbsp;&nbsp;<font style="color:#DDD;">于&nbsp;&nbsp;<?php 
    printf(__('%1$s - %2$s'), get_comment_date(), get_comment_time());
    ?>
说:</font>
			
			<?php 
    if (function_exists("CID_init")) {
        CID_print_comment_flag();
        echo ' ';
        CID_print_comment_browser();
    }
    ?>
</div>
			<?php 
    comment_text();
    ?>
		</div>
<?php 
}
Esempio n. 5
0
/**
 * Theme comment walker
 *
 * @param $comment
 * @param $args
 * @param $depth
 */
function mutheme_comment($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    global $commentcount;
    if (!$commentcount) {
        $page = !empty($in_comment_loop) ? get_query_var('cpage') - 1 : get_page_of_comment($comment->comment_ID, $args) - 1;
        $cpp = get_option('comments_per_page');
        $commentcount = $cpp * $page;
    }
    if (!$comment->comment_parent) {
        //$email  = $comment->comment_author_email;
        $avatar = get_avatar($comment, $size = '50');
        ?>
		<li <?php 
        comment_class();
        ?>
 id="li-comment-<?php 
        comment_ID();
        ?>
">
		<div id="comment-<?php 
        comment_ID();
        ?>
" class="comment-body">
			<div class="comment-avatar"><?php 
        echo $avatar;
        ?>
</div>
					<span class="comment-floor"><?php 
        ++$commentcount;
        switch ($commentcount) {
            case 1:
                print_r("沙发");
                break;
            case 2:
                print_r("板凳");
                break;
            case 3:
                print_r("地板");
                break;
            default:
                printf(__('%s楼'), $commentcount);
        }
        ?>
</span>

			<div class="comment-data">
				<span class="comment-span <?php 
        if ($comment->user_id == 1) {
            echo "comment-author";
        }
        ?>
"><?php 
        printf(__('%s'), get_comment_author_link());
        ?>
</span>
				<span
					class="comment-span comment-date"><?php 
        echo mutheme_time_since(abs(strtotime($comment->comment_date_gmt . "GMT")), true);
        ?>
</span>
			</div>
			<div class="comment-text"><?php 
        comment_text();
        ?>
</div>
			<div class="comment-reply"><?php 
        comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'], 'reply_text' => __('回复'))));
        ?>
</div>
		</div>
	<?php 
    } else {
        ?>
	<li <?php 
        comment_class();
        ?>
 id="li-comment-<?php 
        comment_ID();
        ?>
">
		<div id="comment-<?php 
        comment_ID();
        ?>
" class="comment-body comment-children-body">
			<div class="comment-avatar"><?php 
        echo get_avatar($comment, $size = '30');
        ?>
</div>
			<span
				class="comment-floor"><?php 
        comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'], 'reply_text' => __('回复'))));
        ?>
</span>

			<div class="comment-data">
				<span class="comment-span <?php 
        if ($comment->user_id == 1) {
            echo "comment-author";
        }
        ?>
">
					<?php 
        $parent_id = $comment->comment_parent;
        $comment_parent = get_comment($parent_id);
        printf(__('%s'), get_comment_author_link());
        ?>
				</span>
				<span
					class="comment-span comment-date"><?php 
        echo mutheme_time_since(abs(strtotime($comment->comment_date_gmt . "GMT")), true);
        ?>
</span>
			</div>
			<div class="comment-text">
				<span class="comment-to"><a href="<?php 
        echo "#comment-" . $parent_id;
        ?>
"
				                            title="<?php 
        echo mb_strimwidth(strip_tags(apply_filters('the_content', $comment_parent->comment_content)), 0, 100, "...");
        ?>
">@<?php 
        echo $comment_parent->comment_author;
        ?>
</a>:</span>
				<?php 
        echo get_comment_text();
        ?>
			</div>
		</div>
	<?php 
    }
}
Esempio n. 6
0
/**
 * Calculate what page number a comment will appear on for comment paging.
 *
 * @since 0.0.1
 *
 * @global hqdb $hqdb
 *
 * @param int $comment_ID Comment ID.
 * @param array $args Optional args.
 * @return int|null Comment page number or null on error.
 */
function get_page_of_comment($comment_ID, $args = array())
{
    global $hqdb;
    if (!($comment = get_comment($comment_ID))) {
        return;
    }
    $defaults = array('type' => 'all', 'page' => '', 'per_page' => '', 'max_depth' => '');
    $args = hq_parse_args($args, $defaults);
    if ('' === $args['per_page'] && get_option('page_comments')) {
        $args['per_page'] = get_query_var('comments_per_page');
    }
    if (empty($args['per_page'])) {
        $args['per_page'] = 0;
        $args['page'] = 0;
    }
    if ($args['per_page'] < 1) {
        return 1;
    }
    if ('' === $args['max_depth']) {
        if (get_option('thread_comments')) {
            $args['max_depth'] = get_option('thread_comments_depth');
        } else {
            $args['max_depth'] = -1;
        }
    }
    // Find this comment's top level parent if threading is enabled
    if ($args['max_depth'] > 1 && 0 != $comment->comment_parent) {
        return get_page_of_comment($comment->comment_parent, $args);
    }
    $allowedtypes = array('comment' => '', 'pingback' => 'pingback', 'trackback' => 'trackback');
    $comtypewhere = 'all' != $args['type'] && isset($allowedtypes[$args['type']]) ? " AND comment_type = '" . $allowedtypes[$args['type']] . "'" : '';
    // Count comments older than this one
    $oldercoms = $hqdb->get_var($hqdb->prepare("SELECT COUNT(comment_ID) FROM {$hqdb->comments} WHERE comment_post_ID = %d AND comment_parent = 0 AND comment_approved = '1' AND comment_date_gmt < '%s'" . $comtypewhere, $comment->comment_post_ID, $comment->comment_date_gmt));
    // No older comments? Then it's page #1.
    if (0 == $oldercoms) {
        return 1;
    }
    // Divide comments older than this one by comments per page to get this comment's page number
    return ceil(($oldercoms + 1) / $args['per_page']);
}
Esempio n. 7
0
/**
 * Retrieve the link to a given comment.
 *
 * @since 1.5.0
 * @since 4.4.0 Added the ability for `$comment` to also accept a WP_Comment object. Added `$cpage` argument.
 *
 * @see get_page_of_comment()
 *
 * @global WP_Rewrite $wp_rewrite
 * @global bool       $in_comment_loop
 *
 * @param WP_Comment|int|null $comment Comment to retrieve. Default current comment.
 * @param array               $args {
 *     An array of optional arguments to override the defaults.
 *
 *     @type string     $type      Passed to get_page_of_comment().
 *     @type int        $page      Current page of comments, for calculating comment pagination.
 *     @type int        $per_page  Per-page value for comment pagination.
 *     @type int        $max_depth Passed to get_page_of_comment().
 *     @type int|string $cpage     Value to use for the comment's "comment-page" or "cpage" value.
 *                                 If provided, this value overrides any value calculated from `$page`
 *                                 and `$per_page`.
 * }
 * @return string The permalink to the given comment.
 */
function get_comment_link($comment = null, $args = array())
{
    global $wp_rewrite, $in_comment_loop;
    $comment = get_comment($comment);
    // Back-compat.
    if (!is_array($args)) {
        $args = array('page' => $args);
    }
    $defaults = array('type' => 'all', 'page' => '', 'per_page' => '', 'max_depth' => '', 'cpage' => null);
    $args = wp_parse_args($args, $defaults);
    $link = get_permalink($comment->comment_post_ID);
    // The 'cpage' param takes precedence.
    if (!is_null($args['cpage'])) {
        $cpage = $args['cpage'];
        // No 'cpage' is provided, so we calculate one.
    } else {
        if ('' === $args['per_page'] && get_option('page_comments')) {
            $args['per_page'] = get_option('comments_per_page');
        }
        if (empty($args['per_page'])) {
            $args['per_page'] = 0;
            $args['page'] = 0;
        }
        $cpage = $args['page'];
        if ('' == $cpage) {
            if (!empty($in_comment_loop)) {
                $cpage = get_query_var('cpage');
            } else {
                // Requires a database hit, so we only do it when we can't figure out from context.
                $cpage = get_page_of_comment($comment->comment_ID, $args);
            }
        }
        /*
         * If the default page displays the oldest comments, the permalinks for comments on the default page
         * do not need a 'cpage' query var.
         */
        if ('oldest' === get_option('default_comments_page') && 1 === $cpage) {
            $cpage = '';
        }
    }
    if ($cpage && get_option('page_comments')) {
        if ($wp_rewrite->using_permalinks()) {
            if ($cpage) {
                $link = trailingslashit($link) . $wp_rewrite->comments_pagination_base . '-' . $cpage;
            }
            $link = user_trailingslashit($link, 'comment');
        } elseif ($cpage) {
            $link = add_query_arg('cpage', $cpage, $link);
        }
    }
    if ($wp_rewrite->using_permalinks()) {
        $link = user_trailingslashit($link, 'comment');
    }
    $link = $link . '#comment-' . $comment->comment_ID;
    /**
     * Filter the returned single comment permalink.
     *
     * @since 2.8.0
     * @since 4.4.0 Added the `$cpage` parameter.
     *
     * @see get_page_of_comment()
     *
     * @param string     $link    The comment permalink with '#comment-$id' appended.
     * @param WP_Comment $comment The current comment object.
     * @param array      $args    An array of arguments to override the defaults.
     * @param int        $cpage   The calculated 'cpage' value.
     */
    return apply_filters('get_comment_link', $link, $comment, $args, $cpage);
}
Esempio n. 8
0
/**
 * Calculate what page number a comment will appear on for comment paging.
 *
 * @since 2.7.0
 *
 * @global wpdb $wpdb
 * @param int   $comment_ID Comment ID.
 * @param array $args {
 *      Array of optional arguments.
 *      @type string     $type      Limit paginated comments to those matching a given type. Accepts 'comment',
 *                                  'trackback', 'pingback', 'pings' (trackbacks and pingbacks), or 'all'.
 *                                  Default is 'all'.
 *      @type int        $per_page  Per-page count to use when calculating pagination. Defaults to the value of the
 *                                  'comments_per_page' option.
 *      @type int|string $max_depth If greater than 1, comment page will be determined for the top-level parent of
 *                                  `$comment_ID`. Defaults to the value of the 'thread_comments_depth' option.
 * } *
 * @return int|null Comment page number or null on error.
 */
function get_page_of_comment($comment_ID, $args = array())
{
    global $wpdb;
    if (!($comment = get_comment($comment_ID))) {
        return;
    }
    $defaults = array('type' => 'all', 'page' => '', 'per_page' => '', 'max_depth' => '');
    $args = wp_parse_args($args, $defaults);
    if ('' === $args['per_page']) {
        $args['per_page'] = get_query_var('comments_per_page');
    }
    if (empty($args['per_page'])) {
        $args['per_page'] = 0;
        $args['page'] = 0;
    }
    if ($args['per_page'] < 1) {
        return 1;
    }
    if ('' === $args['max_depth']) {
        if (get_option('thread_comments')) {
            $args['max_depth'] = get_option('thread_comments_depth');
        } else {
            $args['max_depth'] = -1;
        }
    }
    // Find this comment's top level parent if threading is enabled
    if ($args['max_depth'] > 1 && 0 != $comment->comment_parent) {
        return get_page_of_comment($comment->comment_parent, $args);
    }
    $comment_args = array('type' => $args['type'], 'post_id' => $comment->comment_post_ID, 'fields' => 'ids', 'count' => true, 'status' => 'approve', 'date_query' => array(array('column' => "{$wpdb->comments}.comment_date_gmt", 'before' => $comment->comment_date_gmt)));
    $comment_query = new WP_Comment_Query();
    $older_comment_count = $comment_query->query($comment_args);
    // No older comments? Then it's page #1.
    if (0 == $older_comment_count) {
        return 1;
    }
    // Divide comments older than this one by comments per page to get this comment's page number
    return ceil(($older_comment_count + 1) / $args['per_page']);
}
Esempio n. 9
0
    function hmjblog_comment($comment, $args, $depth)
    {
        $GLOBALS['comment'] = $comment;
        global $commentcount, $page;
        if ((int) get_option('page_comments') === 1 && (int) get_option('thread_comments') === 1) {
            if (!$commentcount) {
                $page = !empty($in_comment_loop) ? get_query_var('cpage') : get_page_of_comment($comment->comment_ID, $args);
                $cpp = get_option('comments_per_page');
                if (!$post_id) {
                    $post_id = get_the_ID();
                }
                if (get_option('comment_order') === 'desc') {
                    $cnt = get_comments(array('status' => 'approve', 'parent' => '0', 'post_id' => $post_id, 'count' => true));
                    if (ceil($cnt / $cpp) == 1 || $page > 1 && $page == ceil($cnt / $cpp)) {
                        $commentcount = $cnt + 1;
                    } else {
                        $commentcount = $cpp * $page + 1;
                    }
                } else {
                    $commentcount = $cpp * ($page - 1);
                }
            }
            if (!($parent_id = $comment->comment_parent)) {
                $commentcountText = '';
                if (get_option('comment_order') === 'desc') {
                    $commentcountText .= '#' . --$commentcount;
                } else {
                    $commentcountText .= '#' . ++$commentcount;
                }
            }
        }
        switch ($comment->comment_type) {
            case 'pingback':
            case 'trackback':
                ?>
	<li <?php 
                comment_class();
                ?>
 id="comment-<?php 
                comment_ID();
                ?>
">
		<p><?php 
                _e('Pingback:', 'hmjblog');
                ?>
 <?php 
                comment_author_link();
                ?>
 <?php 
                edit_comment_link(__('(编辑)', 'hmjblog'), '<span class="edit-link">', '</span>');
                ?>
</p>
	<?php 
                break;
            default:
                global $post;
                ?>
	<li <?php 
                comment_class();
                ?>
 id="li-comment-<?php 
                comment_ID();
                ?>
">
		<article id="comment-<?php 
                comment_ID();
                ?>
" class="comment">
			<header class="comment-meta comment-author vcard">
				<?php 
                echo get_avatar($comment, 44);
                printf('<cite><b class="fn">%1$s</b> %2$s</cite>', get_comment_author_link(), $comment->user_id === $post->post_author ? '<span>' . __('管理员', 'hmjblog') . '</span>' : '');
                CID_print_comment_browser();
                printf('<time datetime="%2$s">%3$s</time>', esc_url(get_comment_link($comment->comment_ID)), get_comment_time('c'), sprintf(__('%1$s %2$s', 'hmjblog'), get_comment_date(), get_comment_time()));
                ?>
<div class="louceng"><?php 
                echo $commentcountText;
                ?>
</div>
			</header>
			<?php 
                if ('0' == $comment->comment_approved) {
                    ?>
				<p class="comment-awaiting-moderation"><?php 
                    _e('你的评论正在等待审核...', 'hmjblog');
                    ?>
</p>
			<?php 
                }
                ?>
			<section class="comment-content comment">
				<?php 
                comment_text();
                ?>
				<?php 
Esempio n. 10
0
function thematic_get_comment_link($link, $comment, $args)
{
    global $wp_rewrite;
    $args['type'] = 'comment';
    $args['page'] = get_page_of_comment($comment->comment_ID, $args);
    if ($wp_rewrite->using_permalinks()) {
        $link = user_trailingslashit(trailingslashit(get_permalink($comment->comment_post_ID)) . 'comment-page-' . $args['page'], 'comment');
    } else {
        $link = add_query_arg('cpage', $args['page'], get_permalink($comment->comment_post_ID));
    }
    return $link;
}
Esempio n. 11
0
function bymt_comment($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    global $commentcount;
    if (!$commentcount) {
        $page = !empty($in_comment_loop) ? get_query_var('cpage') - 1 : get_page_of_comment($comment->comment_ID, $args) - 1;
        $cpp = get_option('comments_per_page');
        $commentcount = $cpp * $page;
    }
    ?>
<li <?php 
    comment_class();
    ?>
 id="comment-<?php 
    comment_ID();
    ?>
" <?php 
    if ($depth > get_option('thread_comments_depth') && !wp_is_mobile()) {
        echo ' style="margin-left:0px;"';
    }
    ?>
>
   <div id="div-comment-<?php 
    comment_ID();
    ?>
" class="comment-body">
   	<?php 
    $add_below = 'div-comment';
    ?>
   	<div class="comment-author vcard gravatar"><?php 
    echo bymt_avatar($comment->comment_author_email);
    ?>
</div>
	<div class="floor">
	<?php 
    if (!($parent_id = $comment->comment_parent)) {
        ++$commentcount;
        switch ($commentcount) {
            case 1:
                print_r("沙发");
                break;
            case 2:
                print_r("板凳");
                break;
            case 3:
                print_r("地板");
                break;
            default:
                printf(__('%s楼'), $commentcount);
        }
    }
    ?>
	</div>
	 <div class="commenttext">
		 <span class="commentid"><?php 
    comment_author_link();
    ?>
</span>
		 <?php 
    get_author_class($comment->comment_author_email, $comment->comment_author_url);
    ?>
		 <span class="datetime"><?php 
    bymt_time_diff($time_type = 'comment');
    ?>
</span>
		 <?php 
    if ($comment->comment_approved != '0') {
        ?>
		 <span class="reply"><?php 
        comment_reply_link(array_merge($args, array('reply_text' => '回复', 'add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'])));
        ?>
</span>
		 <?php 
    }
    ?>
		 <span class="edit_comment"><?php 
    edit_post_link('编辑');
    ?>
</span>
		<div class="comment_text">
		<?php 
    if ($comment->comment_approved == '0') {
        ?>
			<span style="color:#f00;">您的评论正在等待审核中...</span>		
			<?php 
        comment_text();
        ?>
			<?php 
    } else {
        ?>
			<?php 
        comment_text();
        ?>
			<?php 
    }
    ?>
		</div>
	</div>
  </div>
<?php 
}
 /**
  * @ticket 31101
  */
 public function test_should_respect_comment_order_newest()
 {
     $now = time();
     $p = self::factory()->post->create();
     $c1 = self::factory()->comment->create(array('comment_post_ID' => $p, 'comment_date_gmt' => date('Y-m-d H:i:s', $now)));
     $c2 = self::factory()->comment->create(array('comment_post_ID' => $p, 'comment_date_gmt' => date('Y-m-d H:i:s', $now - 20)));
     $c3 = self::factory()->comment->create(array('comment_post_ID' => $p, 'comment_date_gmt' => date('Y-m-d H:i:s', $now - 30)));
     update_option('comment_order', 'desc');
     update_option('page_comments', 1);
     update_option('comments_per_page', 2);
     $this->assertEquals(2, get_page_of_comment($c3));
 }
 /**
  * @ticket 13939
  */
 public function test_comments_per_page_option_should_be_fallback_when_query_var_is_not_available()
 {
     $now = time();
     $p = self::factory()->post->create();
     $c1 = self::factory()->comment->create(array('comment_post_ID' => $p, 'comment_date_gmt' => date('Y-m-d H:i:s', $now)));
     $c2 = self::factory()->comment->create(array('comment_post_ID' => $p, 'comment_date_gmt' => date('Y-m-d H:i:s', $now - 20)));
     $c3 = self::factory()->comment->create(array('comment_post_ID' => $p, 'comment_date_gmt' => date('Y-m-d H:i:s', $now - 30)));
     update_option('page_comments', 1);
     update_option('comments_per_page', 2);
     $this->assertEquals(2, get_page_of_comment($c1));
 }
Esempio n. 14
0
function mytheme_comment($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    global $commentcount;
    if (!$commentcount) {
        $page = !empty($in_comment_loop) ? get_query_var('cpage') - 1 : get_page_of_comment($comment->comment_ID, $args) - 1;
        $cpp = get_option('comments_per_page');
        $commentcount = $cpp * $page;
    }
    if (current_time('timestamp') - get_comment_time('U') < 518400) {
        $cmt_time = human_time_diff(get_comment_time('U'), current_time('timestamp')) . '前';
    } else {
        $cmt_time = get_comment_date('Y/n/j');
    }
    ?>
<li class="comments" <?php 
    if ($depth > 2) {
        echo ' style="margin-left:-40px;"';
    }
    ?>
 id="li-comment-<?php 
    comment_ID();
    ?>
">
		<div id="comment-<?php 
    comment_ID();
    ?>
" class="comment-body">
			<?php 
    echo get_avatar($comment, $size = '52');
    ?>
			<div class="comment-head">
				<span class="name"><?php 
    printf(__('%s'), get_comment_author_link());
    ?>
</span>
				<?php 
    if (user_can($comment->user_id, 1)) {
        echo "(作者)";
    }
    ?>
				<?php 
    if ($comment->comment_parent) {
        // 如果存在父级评论
        $comment_parent_href = get_comment_ID($comment->comment_parent);
        $comment_parent = get_comment($comment->comment_parent);
        ?>
    回复 <a href="#comment-<?php 
        echo $comment_parent_href;
        ?>
"><?php 
        echo $comment_parent->comment_author;
        ?>
</a>
    <?php 
    }
    ?>
				<span class="date"> <?php 
    echo $cmt_time;
    ?>
</span>
				<span class="floor"><?php 
    if (!($parent_id = $comment->comment_parent)) {
        printf('#%1$s', ++$commentcount);
    }
    ?>
</span>
<?php 
    comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'], 'reply_text' => "[REPLY]")));
    ?>
       </div>
     <div class="comment-entry"><?php 
    comment_text();
    ?>
</div>
   	</div> 
<?php 
}
Esempio n. 15
0
    /**
     * Template for comments and pingbacks.
     *
     * To override this walker in a child theme without modifying the comments template
     * simply create your own twentyten_comment(), and that function will be used instead.
     *
     * Used as a callback by wp_list_comments() for displaying the comments.
     *
     * @since Twenty Ten 1.0
     */
    function mytheme_comment($comment, $args, $depth)
    {
        $GLOBALS['comment'] = $comment;
        global $commentcount;
        $page = !empty($in_comment_loop) ? get_query_var('cpage') : get_page_of_comment($comment->comment_ID, $args);
        $cpp = get_option('comments_per_page');
        //获取每页评论显示数量
        if (!$commentcount) {
            //初始化楼层计数器
            if ($page > 1) {
                $commentcount = $cpp * ($page - 1);
            } else {
                $commentcount = 0;
                //如果评论还没有分页,初始值为0
            }
        }
        ?>
	<li <?php 
        comment_class();
        ?>
 id="li-comment-<?php 
        comment_ID();
        ?>
">
		<div id="comment-<?php 
        comment_ID();
        ?>
" class="comment-wrap"><div class="inner-wrap">
		<div class="comment-author vcard">
			<?php 
        echo get_avatar($comment, 40);
        ?>
			<?php 
        printf(sprintf('<cite class="fn">%s</cite>', get_comment_author_link()));
        ?>
			<?php 
        if (!($parent_id = $comment->comment_parent)) {
            ?>
				<span class="meta-sep"> | </span>
				<span class="comment-count"><a href="#comment-<?php 
            comment_ID();
            ?>
"><?php 
            printf('#%1$s', ++$commentcount);
            ?>
</a></span>
			<?php 
        }
        ?>
		</div><!-- .comment-author .vcard -->

		<div class="comment-meta commentmetadata"><a href="<?php 
        echo esc_url(get_comment_link($comment->comment_ID));
        ?>
">
			<?php 
        /* translators: 1: date, 2: time */
        printf(__('On %1$s %2$s', 'twentyten'), get_comment_date(), get_comment_time());
        ?>
</a><?php 
        edit_comment_link(__('(Edit)', 'twentyten'), ' ');
        ?>
		</div><!-- .comment-meta .commentmetadata -->

		<div class="comment-body">
			<?php 
        if ($comment->comment_approved == '0') {
            ?>
				<p><em><?php 
            _e('Your comment is awaiting moderation.', 'twentyten');
            ?>
</em></p>
			<?php 
        }
        ?>
			<?php 
        comment_text();
        ?>
		</div>

		<div class="reply">
			<?php 
        comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'])));
        ?>
		</div><!-- .reply -->
	</div></div><!-- #comment-##  -->

	<?php 
    }
function island_comment($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    global $commentcount, $page;
    if ((int) get_option('page_comments') === 1 && (int) get_option('thread_comments') === 1) {
        //开启嵌套评论和分页才启用
        if (!$commentcount) {
            //初始化楼层计数器
            $page = !empty($in_comment_loop) ? get_query_var('cpage') : get_page_of_comment($comment->comment_ID, $args);
            //获取当前评论列表页码
            $cpp = get_option('comments_per_page');
            //获取每页评论显示数量
            if (!$post_id) {
                $post_id = get_the_ID();
            }
            if (get_option('comment_order') === 'desc') {
                //倒序
                $cnt = get_comments(array('status' => 'approve', 'parent' => '0', 'post_id' => $post_id, 'count' => true));
                if (ceil($cnt / $cpp) == 1 || $page > 1 && $page == ceil($cnt / $cpp)) {
                    $commentcount = $cnt + 1;
                } else {
                    $commentcount = $cpp * $page + 1;
                }
            } else {
                $commentcount = $cpp * ($page - 1);
            }
        }
        if (!($parent_id = $comment->comment_parent)) {
            $commentcountText = '';
            if (get_option('comment_order') === 'desc') {
                //倒序
                $commentcountText .= --$commentcount . '楼';
            } else {
                $commentcountText .= ++$commentcount . '楼';
            }
        }
    }
    ?>
	<li <?php 
    comment_class('clearfix');
    ?>
 id="li-comment-<?php 
    comment_ID();
    ?>
">
	<span class="commentcount"><?php 
    echo $commentcountText;
    ?>
</span>
		<div class="comment-block" id="comment-<?php 
    comment_ID();
    ?>
">
			<div class="author-img"><?php 
    echo get_avatar($comment->comment_author_email, 50);
    ?>
</div>
			<div class="comment-body">
				<div class="comment-name"><?php 
    printf(__('<cite class="fn">%s</cite>', 'island'), get_comment_author_link());
    comment_admin_title($comment->comment_author_email);
    ?>
</div>
				<div class="comment-text">
					<?php 
    comment_text();
    ?>
			
				</div>
				<div class="comment-info">
					<span class="comment-date">
							<a class="comment-time" href="<?php 
    echo esc_url(get_comment_link($comment->comment_ID));
    ?>
">
							<?php 
    printf(__('%1$s - %2$s', 'island'), get_comment_date('m/d/Y'), get_comment_time());
    ?>
</a>
					</span>
					<span class="comment-reply">
						<?php 
    comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'])));
    ?>
					</span>		
					<span class="comment-edit">
						<?php 
    edit_comment_link(__('(Edit)', 'island'), '  ', '');
    ?>
					</span>	
					<div class="clearfix"></div>
				</div>
				
				<?php 
    if ($comment->comment_approved == '0') {
        ?>
					<em class="comment-awaiting-moderation">
					<?php 
        _e('Your comment is awaiting moderation.', 'island');
        ?>
</em>
				<?php 
    }
    ?>
 
				<div class="clearfix"></div>
			</div>
		</div>
<?php 
}
Esempio n. 17
0
 function get_discussion_link($link, $comment, $args)
 {
     if (isset($comment->post_type) && $comment->post_type == 'pacowiki') {
         // start of get_comment_link() with add_query_arg() to add action=discussion to arguments
         global $wp_rewrite, $in_comment_loop;
         $comment = get_comment($comment);
         // Backwards compat
         if (!is_array($args)) {
             $args = array('page' => $args);
         }
         $defaults = array('type' => 'all', 'page' => '', 'per_page' => '', 'max_depth' => '');
         $args = wp_parse_args($args, $defaults);
         if ('' === $args['per_page'] && get_option('page_comments')) {
             $args['per_page'] = get_option('comments_per_page');
         }
         if (empty($args['per_page'])) {
             $args['per_page'] = 0;
             $args['page'] = 0;
         }
         if ($args['per_page']) {
             if ('' == $args['page']) {
                 $args['page'] = !empty($in_comment_loop) ? get_query_var('cpage') : get_page_of_comment($comment->comment_ID, $args);
             }
             if ($wp_rewrite->using_permalinks()) {
                 $link = user_trailingslashit(trailingslashit(get_permalink($comment->comment_post_ID)) . 'comment-page-' . $args['page'], 'comment');
             } else {
                 $link = add_query_arg('cpage', $args['page'], get_permalink($comment->comment_post_ID));
             }
         } else {
             $link = get_permalink($comment->comment_post_ID);
         }
         $link = add_query_arg('action', 'discussion', get_permalink($comment->comment_post_ID));
         $link = $link . '#comment-' . $comment->comment_ID;
         return $link;
     }
     return $link;
 }
Esempio n. 18
0
/**
 * Retrieve the link to a given comment.
 *
 * @since 1.5.0
 * @uses $comment
 *
 * @param object|string|int $comment Comment to retrieve.
 * @param array $args Optional args.
 * @return string The permalink to the given comment.
 */
function get_comment_link($comment = null, $args = array())
{
    global $wp_rewrite, $in_comment_loop;
    $comment = get_comment($comment);
    // Backwards compat
    if (!is_array($args)) {
        $page = $args;
        $args = array();
        $args['page'] = $page;
    }
    $defaults = array('type' => 'all', 'page' => '', 'per_page' => '', 'max_depth' => '');
    $args = wp_parse_args($args, $defaults);
    if ('' === $args['per_page'] && get_option('page_comments')) {
        $args['per_page'] = get_option('comments_per_page');
    }
    if (empty($args['per_page'])) {
        $args['per_page'] = 0;
        $args['page'] = 0;
    }
    if ($args['per_page']) {
        if ('' == $args['page']) {
            $args['page'] = !empty($in_comment_loop) ? get_query_var('cpage') : get_page_of_comment($comment->comment_ID, $args);
        }
        if ($wp_rewrite->using_permalinks()) {
            $link = user_trailingslashit(trailingslashit(get_permalink($comment->comment_post_ID)) . 'comment-page-' . $args['page'], 'comment');
        } else {
            $link = add_query_arg('cpage', $args['page'], get_permalink($comment->comment_post_ID));
        }
    } else {
        $link = get_permalink($comment->comment_post_ID);
    }
    return apply_filters('get_comment_link', $link . '#comment-' . $comment->comment_ID, $comment, $args);
}
function cleanyetibasic_get_comment_link($link, $comment, $args)
{
    global $wp_rewrite;
    $args['type'] = 'comment';
    $args['page'] = get_page_of_comment($comment->comment_ID, $args);
    if ($args['per_page']) {
        if ('' == $args['page']) {
            $args['page'] = !empty($in_comment_loop) ? get_query_var('cpage') : get_page_of_comment($comment->comment_ID, $args);
        }
        if ($wp_rewrite->using_permalinks()) {
            $link = user_trailingslashit(trailingslashit(get_permalink($comment->comment_post_ID)) . 'comment-page-' . $args['page'], 'comment');
        } else {
            $link = add_query_arg('cpage', $args['page'], get_permalink($comment->comment_post_ID));
        }
    } else {
        $link = get_permalink($comment->comment_post_ID);
    }
    return $link . '#comment-' . $comment->comment_ID;
}
/**
 * Retrieve the link to a given comment.
 *
 * @since 1.5.0
 *
 * @see get_page_of_comment()
 *
 * @global WP_Rewrite $wp_rewrite
 * @global bool $in_comment_loop
 *
 * @param mixed $comment Comment to retrieve. Default current comment.
 * @param array $args Optional. An array of arguments to override the defaults.
 * @return string The permalink to the given comment.
 */
function get_comment_link($comment = null, $args = array())
{
    global $wp_rewrite, $in_comment_loop;
    $comment = get_comment($comment);
    // Backwards compat
    if (!is_array($args)) {
        $args = array('page' => $args);
    }
    $defaults = array('type' => 'all', 'page' => '', 'per_page' => '', 'max_depth' => '');
    $args = wp_parse_args($args, $defaults);
    if ('' === $args['per_page'] && get_option('page_comments')) {
        $args['per_page'] = get_option('comments_per_page');
    }
    if (empty($args['per_page'])) {
        $args['per_page'] = 0;
        $args['page'] = 0;
    }
    if ($args['per_page']) {
        if ('' == $args['page']) {
            $args['page'] = !empty($in_comment_loop) ? get_query_var('cpage') : get_page_of_comment($comment->comment_ID, $args);
        }
        if ($wp_rewrite->using_permalinks()) {
            $link = user_trailingslashit(trailingslashit(get_permalink($comment->comment_post_ID)) . $wp_rewrite->comments_pagination_base . '-' . $args['page'], 'comment');
        } else {
            $link = add_query_arg('cpage', $args['page'], get_permalink($comment->comment_post_ID));
        }
    } else {
        $link = get_permalink($comment->comment_post_ID);
    }
    $link = $link . '#comment-' . $comment->comment_ID;
    /**
     * Filter the returned single comment permalink.
     *
     * @since 2.8.0
     *
     * @see get_page_of_comment()
     *
     * @param string $link The comment permalink with '#comment-$id' appended.
     * @param object $comment The current comment object.
     * @param array $args An array of arguments to override the defaults.
     */
    return apply_filters('get_comment_link', $link, $comment, $args);
}
Esempio n. 21
0
    function lovnvns_comment($comment, $args, $depth)
    {
        $GLOBALS['comment'] = $comment;
        switch ($comment->comment_type) {
            case '':
                //主评论计数器初始化 begin
                global $commentcount;
                $page = !empty($in_comment_loop) ? get_query_var('cpage') : get_page_of_comment($comment->comment_ID, $args);
                $cpp = get_option('comments_per_page');
                //获取每页评论显示数量
                if (!$commentcount) {
                    //初始化楼层计数器
                    if ($page > 1) {
                        $commentcount = $cpp * ($page - 1);
                    } else {
                        $commentcount = 0;
                        //如果评论还没有分页,初始值为0
                    }
                }
                //主评论计数器初始化 end
                ?>
	<li <?php 
                comment_class();
                ?>
 id="li-comment-<?php 
                comment_ID();
                ?>
">
		<div id="comment-<?php 
                comment_ID();
                ?>
">
		<div class="comment_author">
			<?php 
                echo get_avatar($comment, 32);
                ?>
		</div>
		<?php 
                if ($comment->comment_approved == '0') {
                    ?>
			<p style="color:#e75814"><?php 
                    _e('您的评论正在等待审核中...', 'lovnvns');
                    ?>
</p><br />
		<?php 
                }
                ?>
		<p class="commet_text">
                <?php 
                if ($comment->user_id == 1) {
                    echo "<span style='color:#ff6600'>【管理员】</span>";
                }
                printf(__('%s:', 'lovnvns'), sprintf('%s', get_comment_author_link()));
                ?>
					<div class="floor"><!-- 主评论楼层号 -->
					<?php 
                if (!($parent_id = $comment->comment_parent)) {
                    printf('%1$s', ++$commentcount);
                    echo "楼";
                }
                ?>
					</div>
			<?php 
                printf(__('%1$s %2$s', 'lovnvns'), get_comment_date(), get_comment_time());
                ?>
 <?php 
                comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'])));
                ?>
            <br />
			<?php 
                comment_text();
                ?>
        </p>
	</div>
	<?php 
                break;
            case 'pingback':
            case 'trackback':
                ?>
	<li class="post pingback">
		<p><?php 
                _e('Pingback:', 'lovnvns');
                ?>
 <?php 
                comment_author_link();
                ?>
</p>
	<?php 
                break;
        }
    }
Esempio n. 22
0
/**
 * Calculate what page number a comment will appear on for comment paging.
 *
 * @since 2.7.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int   $comment_ID Comment ID.
 * @param array $args {
 *      Array of optional arguments.
 *      @type string     $type      Limit paginated comments to those matching a given type. Accepts 'comment',
 *                                  'trackback', 'pingback', 'pings' (trackbacks and pingbacks), or 'all'.
 *                                  Default is 'all'.
 *      @type int        $per_page  Per-page count to use when calculating pagination. Defaults to the value of the
 *                                  'comments_per_page' option.
 *      @type int|string $max_depth If greater than 1, comment page will be determined for the top-level parent of
 *                                  `$comment_ID`. Defaults to the value of the 'thread_comments_depth' option.
 * } *
 * @return int|null Comment page number or null on error.
 */
function get_page_of_comment($comment_ID, $args = array())
{
    global $wpdb;
    $page = null;
    if (!($comment = get_comment($comment_ID))) {
        return;
    }
    $defaults = array('type' => 'all', 'page' => '', 'per_page' => '', 'max_depth' => '');
    $args = wp_parse_args($args, $defaults);
    $original_args = $args;
    // Order of precedence: 1. `$args['per_page']`, 2. 'comments_per_page' query_var, 3. 'comments_per_page' option.
    if (get_option('page_comments')) {
        if ('' === $args['per_page']) {
            $args['per_page'] = get_query_var('comments_per_page');
        }
        if ('' === $args['per_page']) {
            $args['per_page'] = get_option('comments_per_page');
        }
    }
    if (empty($args['per_page'])) {
        $args['per_page'] = 0;
        $args['page'] = 0;
    }
    if ($args['per_page'] < 1) {
        $page = 1;
    }
    if (null === $page) {
        if ('' === $args['max_depth']) {
            if (get_option('thread_comments')) {
                $args['max_depth'] = get_option('thread_comments_depth');
            } else {
                $args['max_depth'] = -1;
            }
        }
        // Find this comment's top level parent if threading is enabled
        if ($args['max_depth'] > 1 && 0 != $comment->comment_parent) {
            return get_page_of_comment($comment->comment_parent, $args);
        }
        $comment_args = array('type' => $args['type'], 'post_id' => $comment->comment_post_ID, 'fields' => 'ids', 'count' => true, 'status' => 'approve', 'parent' => 0, 'date_query' => array(array('column' => "{$wpdb->comments}.comment_date_gmt", 'before' => $comment->comment_date_gmt)));
        $comment_query = new WP_Comment_Query();
        $older_comment_count = $comment_query->query($comment_args);
        // No older comments? Then it's page #1.
        if (0 == $older_comment_count) {
            $page = 1;
            // Divide comments older than this one by comments per page to get this comment's page number
        } else {
            $page = ceil(($older_comment_count + 1) / $args['per_page']);
        }
    }
    /**
     * Filters the calculated page on which a comment appears.
     *
     * @since 4.4.0
     *
     * @param int   $page          Comment page.
     * @param array $args {
     *     Arguments used to calculate pagination. These include arguments auto-detected by the function,
     *     based on query vars, system settings, etc. For pristine arguments passed to the function,
     *     see `$original_args`.
     *
     *     @type string $type      Type of comments to count.
     *     @type int    $page      Calculated current page.
     *     @type int    $per_page  Calculated number of comments per page.
     *     @type int    $max_depth Maximum comment threading depth allowed.
     * }
     * @param array $original_args {
     *     Array of arguments passed to the function. Some or all of these may not be set.
     *
     *     @type string $type      Type of comments to count.
     *     @type int    $page      Current comment page.
     *     @type int    $per_page  Number of comments per page.
     *     @type int    $max_depth Maximum comment threading depth allowed.
     * }
     */
    return apply_filters('get_page_of_comment', (int) $page, $args, $original_args);
}
function themecomment($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    global $commentcount;
    if (!$commentcount) {
        $page = !empty($in_comment_loop) ? get_query_var('cpage') - 1 : get_page_of_comment($comment->comment_ID, $args) - 1;
        $cpp = get_option('comments_per_page');
        $commentcount = $cpp * $page;
    }
    /* 区分普通评论和Pingback */
    switch ($pingtype = $comment->comment_type) {
        case 'pingback':
            /* 标识Pingback */
        /* 标识Pingback */
        case 'trackback':
            /* 标识Trackback */
            ?>

<li <?php 
            comment_class();
            ?>
 id="li-comment-<?php 
            comment_ID();
            ?>
">
  <div id="comment-<?php 
            comment_ID();
            ?>
">
    <div class="comment-author vcard pingback">
      <span class="fn pingback"><?php 
            comment_date('Y-m-d');
            ?>
 &raquo; <?php 
            comment_author_link();
            ?>
</span>
    </div>
  </div>

  <?php 
            break;
            /* 标识完毕 */
        /* 标识完毕 */
        default:
            /* 普通评论部分 */
            if (!$comment->comment_parent) {
                ?>

<li <?php 
                comment_class();
                ?>
 id="li-comment-<?php 
                comment_ID();
                ?>
">

  <article id="comment-<?php 
                comment_ID();
                ?>
" class="comment-body" data-floor="<?php 
                printf('%1$s L', ++$commentcount);
                ?>
">
    <footer class="comment-meta">
      <div class="commenet-author vcard">
        <?php 
                echo get_avatar($comment, $size = '44');
                ?>
        <?php 
                printf('<b class="fn">%s</b><span class="says"> 说:</span>', get_comment_author_link());
                ?>
      </div>
      <div class="comment-metadata">
        <a href="<?php 
                echo htmlspecialchars(get_comment_link($comment->comment_ID));
                ?>
">
          <time datetime="<?php 
                comment_time('c');
                ?>
"><?php 
                comment_date('Y-m-d');
                ?>
 <?php 
                comment_time('H:i');
                ?>
</time>
        </a>
      </div>
    </footer>

    <div class="comment-content">
      <?php 
                if ($comment->comment_approved == '0') {
                    ?>
        <p style="color:#C00;">您的评论正在等待审核中。</p>
      <?php 
                }
                ?>
      <?php 
                comment_text();
                ?>
    </div>
    <div class="reply">
      <?php 
                comment_reply_link(array('depth' => $depth, 'max_depth' => $args['max_depth'], 'reply_text' => __('Reply')));
                ?>
    </div>

  </article>

<?php 
            } else {
                ?>

<li <?php 
                comment_class();
                ?>
 id="li-comment-<?php 
                comment_ID();
                ?>
">

  <article id="comment-<?php 
                comment_ID();
                ?>
" class="comment-body comment-children-body" data-floor="<?php 
                if ($depth > 1) {
                    printf('B%1$s', $depth - 1);
                }
                ?>
">
    <footer class="comment-meta">
      <div class="commenet-author vcard">
        <?php 
                echo get_avatar($comment, $size = '44');
                ?>
        <?php 
                $parent_id = $comment->comment_parent;
                $comment_parent = get_comment($parent_id);
                printf('<b class="fn">%s</b>', get_comment_author_link());
                ?>
 回复 <a href="<?php 
                echo "#comment-" . $parent_id;
                ?>
"><b class="fn"><?php 
                echo $comment_parent->comment_author;
                ?>
</b></a><span class="says">:</span>
      </div>
      <div class="comment-metadata">
        <a href="<?php 
                echo htmlspecialchars(get_comment_link($comment->comment_ID));
                ?>
">
          <time datetime="<?php 
                comment_time('c');
                ?>
"><?php 
                comment_date('Y-m-d');
                ?>
 <?php 
                comment_time('H:i');
                ?>
</time>
        </a>
      </div>
    </footer>

    <div class="comment-content">
      <?php 
                if ($comment->comment_approved == '0') {
                    ?>
        <p style="color:#C00;">您的评论正在等待审核中。</p>
      <?php 
                }
                ?>
      <?php 
                comment_text();
                ?>
    </div>

    <div class="reply">
      <?php 
                comment_reply_link(array('depth' => $depth, 'max_depth' => $args['max_depth'], 'reply_text' => __('Reply')));
                ?>
    </div>

  </article>


<?php 
            }
            break;
            /* 普通评论标识完毕 */
    }
}