当前位置: 首页>>代码示例>>PHP>>正文


PHP get_page_of_comment函数代码示例

本文整理汇总了PHP中get_page_of_comment函数的典型用法代码示例。如果您正苦于以下问题:PHP get_page_of_comment函数的具体用法?PHP get_page_of_comment怎么用?PHP get_page_of_comment使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_page_of_comment函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: siteorigin_ajax_comments_ajax_comment_rerender

/**
 * 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;
}
开发者ID:craighays,项目名称:wpcraighays,代码行数:29,代码来源:ajax-comments.php

示例2: test_last_comment

 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)));
 }
开发者ID:Benrajalu,项目名称:philRaj,代码行数:23,代码来源:getPageOfComment.php

示例3: mytheme_comment

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 
}
开发者ID:Nsking-xs,项目名称:rccoder,代码行数:53,代码来源:functions.php

示例4: Gztro_comment

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 
}
开发者ID:surmon-china,项目名称:Wordpress_Theme_Think,代码行数:80,代码来源:functions.php

示例5: mutheme_comment

/**
 * 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' => __('回复'))));
        ?>
//.........这里部分代码省略.........
开发者ID:52M,项目名称:kunkka,代码行数:101,代码来源:mutheme-function.php

示例6: get_page_of_comment

/**
 * 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']);
}
开发者ID:gcorral,项目名称:hivequeen,代码行数:51,代码来源:comment.php

示例7: get_comment_link

/**
 * 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);
}
开发者ID:qaryas,项目名称:qaryas_site,代码行数:94,代码来源:comment-template.php

示例8: get_page_of_comment

/**
 * 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']);
}
开发者ID:RussWilkie,项目名称:WordPress,代码行数:58,代码来源:comment-functions.php

示例9: hmjblog_comment

    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 
开发者ID:ericzuobin,项目名称:sahinn-blog,代码行数:95,代码来源:functions.php

示例10: thematic_get_comment_link

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;
}
开发者ID:rowatt,项目名称:Thematic,代码行数:12,代码来源:comments-extensions.php

示例11: bymt_comment

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 
//.........这里部分代码省略.........
开发者ID:wdq233,项目名称:BYMT2,代码行数:101,代码来源:bymt-comment.php

示例12: test_should_respect_comment_order_newest

 /**
  * @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));
 }
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:15,代码来源:getPageOfComment.php

示例13: test_comments_per_page_option_should_be_fallback_when_query_var_is_not_available

 /**
  * @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));
 }
开发者ID:boonebgorges,项目名称:develop.wordpress,代码行数:14,代码来源:getPageOfComment.php

示例14: mytheme_comment

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 
}
开发者ID:doio,项目名称:jianux_core,代码行数:78,代码来源:commentplus.php

示例15: mytheme_comment

    /**
     * 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 
    }
开发者ID:shuaica,项目名称:97world_GWhite,代码行数:99,代码来源:functions.php


注:本文中的get_page_of_comment函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。