本文整理汇总了PHP中_wp_get_comment_list函数的典型用法代码示例。如果您正苦于以下问题:PHP _wp_get_comment_list函数的具体用法?PHP _wp_get_comment_list怎么用?PHP _wp_get_comment_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_wp_get_comment_list函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _wp_comment_row
_wp_comment_row($comment->comment_ID, $mode, $status, true, true);
$comment_list_item = ob_get_contents();
ob_end_clean();
$x->add(array('what' => 'comment', 'id' => $comment->comment_ID, 'data' => $comment_list_item));
}
$x->send();
break;
case 'get-comments':
check_ajax_referer($action);
$post_ID = (int) $_POST['post_ID'];
if (!current_user_can('edit_post', $post_ID)) {
die('-1');
}
$start = isset($_POST['start']) ? intval($_POST['start']) : 0;
$num = isset($_POST['num']) ? intval($_POST['num']) : 10;
list($comments, $total) = _wp_get_comment_list(false, false, $start, $num, $post_ID);
if (!$comments) {
die('1');
}
$comment_list_item = '';
$x = new WP_Ajax_Response();
foreach ((array) $comments as $comment) {
get_comment($comment);
ob_start();
_wp_comment_row($comment->comment_ID, 'single', false, false);
$comment_list_item .= ob_get_contents();
ob_end_clean();
}
$x->add(array('what' => 'comments', 'data' => $comment_list_item));
$x->send();
break;
示例2: if
<li <?php if ( 'detail' == $mode ) echo "class='current'" ?>><a href="<?php echo clean_url(add_query_arg('mode', 'detail', $_SERVER['REQUEST_URI'])) ?>"><?php _e('Detail View') ?></a></li>
<li <?php if ( 'list' == $mode ) echo "class='current'" ?>><a href="<?php echo clean_url(add_query_arg('mode', 'list', $_SERVER['REQUEST_URI'])) ?>"><?php _e('List View') ?></a></li>
</ul>
<?php
$comments_per_page = apply_filters('comments_per_page', 20, $comment_status);
if ( isset( $_GET['apage'] ) )
$page = abs( (int) $_GET['apage'] );
else
$page = 1;
$start = $offset = ( $page - 1 ) * $comments_per_page;
list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, $comments_per_page + 5 ); // Grab a few extra
$comments = array_slice($_comments, 0, $comments_per_page);
$extra_comments = array_slice($_comments, $comments_per_page);
$page_links = paginate_links( array(
'base' => add_query_arg( 'apage', '%#%' ),
'format' => '',
'total' => ceil($total / $comments_per_page),
'current' => $page
));
?>
<form id="comments-form" action="" method="post">
示例3: get_user_option
" class="button" />
</p>
<?php
$comments_per_page = (int) get_user_option('edit_comments_per_page');
if (empty($comments_per_page) || $comments_per_page < 1) {
$comments_per_page = 20;
}
$comments_per_page = apply_filters('comments_per_page', $comments_per_page, $comment_status);
if (isset($_GET['apage'])) {
$page = abs((int) $_GET['apage']);
} else {
$page = 1;
}
$start = $offset = ($page - 1) * $comments_per_page;
list($_comments, $total) = _wp_get_comment_list($comment_status, $search_dirty, $start, $comments_per_page + 8, $post_id, $comment_type);
// Grab a few extra
$_comment_post_ids = array();
foreach ($_comments as $_c) {
$_comment_post_ids[] = $_c->comment_post_ID;
}
$_comment_pending_count = get_pending_comments_num($_comment_post_ids);
$comments = array_slice($_comments, 0, $comments_per_page);
$extra_comments = array_slice($_comments, $comments_per_page);
$page_links = paginate_links(array('base' => add_query_arg('apage', '%#%'), 'format' => '', 'prev_text' => __('«'), 'next_text' => __('»'), 'total' => ceil($total / $comments_per_page), 'current' => $page));
?>
<input type="hidden" name="mode" value="<?php
echo esc_attr($mode);
?>
" />
示例4: rgb
echo '<div style="background-color: rgb(207, 235, 247);" id="message" class="updated fade"><p>';
if ( !empty( $_POST['spam_button'] ) ) {
printf(__ngettext('%s comment marked as spam', '%s comments marked as spam.', $i), $i);
} else {
printf(__ngettext('%s comment deleted.', '%s comments deleted.', $i), $i);
}
echo '</p></div>';
endif;
if ( isset( $_GET['apage'] ) )
$page = (int) $_GET['apage'];
else
$page = 1;
$start = $offset = ( $page - 1 ) * 20;
list($_comments, $total) = _wp_get_comment_list( isset($_GET['s']) ? $_GET['s'] : false, $start, 25 ); // Grab a few extra
$comments = array_slice($_comments, 0, 20);
$extra_comments = array_slice($_comments, 20);
$page_links = paginate_links( array(
'base' => 'edit-comments.php?%_%',
'format' => 'apage=%#%',
'total' => ceil($total / 20),
'current' => $page
));
if ( $page_links )
echo "<p class='pagenav'>$page_links</p>";
if ('view' == $mode) {
示例5: WP_Ajax_Response
$x = new WP_Ajax_Response( array(
'what' => 'cat',
'id' => $cat->cat_ID,
'data' => _cat_row( $cat, $level, $cat_full_name ),
'supplemental' => array('name' => $cat_full_name, 'show-link' => sprintf(__( 'Category <a href="#%s">%s</a> added' ), "cat-$cat->cat_ID", $cat_full_name))
) );
$x->send();
break;
case 'add-comment' :
if ( !current_user_can( 'edit_post', $id ) )
die('-1');
$search = isset($_POST['s']) ? $_POST['s'] : false;
$start = isset($_POST['page']) ? intval($_POST['page']) * 25 : 25;
list($comments, $total) = _wp_get_comment_list( $search, $start, 1 );
if ( !$comments )
die('1');
$x = new WP_Ajax_Response();
foreach ( (array) $comments as $comment ) {
get_comment( $comment );
ob_start();
_wp_comment_list_item( $comment->comment_ID );
$comment_list_item = ob_get_contents();
ob_end_clean();
$x->add( array(
'what' => 'comment',
'id' => $comment->comment_ID,
'data' => $comment_list_item
) );
示例6: clean_url
echo clean_url(add_query_arg('mode', 'list', $_SERVER['REQUEST_URI']));
?>
"><?php
_e('List View');
?>
</a></li>
</ul>
<?php
if (isset($_GET['apage'])) {
$page = abs((int) $_GET['apage']);
} else {
$page = 1;
}
$start = $offset = ($page - 1) * 20;
list($_comments, $total) = _wp_get_comment_list($comment_status, $search_dirty, $start, 25);
// Grab a few extra
$comments = array_slice($_comments, 0, 20);
$extra_comments = array_slice($_comments, 20);
$page_links = paginate_links(array('base' => add_query_arg('apage', '%#%'), 'format' => '', 'total' => ceil($total / 20), 'current' => $page));
?>
<form id="comments-form" action="" method="post">
<div class="tablenav">
<?php
if ($page_links) {
echo "<div class='tablenav-pages'>{$page_links}</div>";
}
?>
示例7: output
private function output()
{
global $title, $parent_file, $wpdb;
if ($this->post_id > 0) {
$title = sprintf(__('Comments for %s', 'ktai_style'), wp_html_excerpt($this->get_post_title($this->post_id), 50));
$this->post_status = $wpdb->get_var($wpdb->prepare("SELECT post_status FROM {$wpdb->posts} WHERE ID = %d", $this->post_id));
} else {
$title = __('Edit Comment');
$this->post_status = NULL;
}
$parent_file = 'edit-comments.php';
include dirname(__FILE__) . '/admin-header.php';
$mode = !isset($_GET['mode']) || empty($_GET['mode']) ? 'detail' : esc_attr($_GET['mode']);
$comment_status = !empty($_GET['comment_status']) ? esc_attr($_GET['comment_status']) : '';
$comment_type = !empty($_GET['comment_type']) ? esc_attr($_GET['comment_type']) : '';
$search_dirty = isset($_GET['s']) ? $_GET['s'] : '';
$search = stripslashes($search_dirty);
if ($search_dirty) {
printf('<h2>' . __('Search results for “%s”', 'ktai_style') . '</h2>', esc_attr($search));
}
if (isset($_GET['approved']) || isset($_GET['deleted']) || isset($_GET['trashed']) || isset($_GET['untrashed']) || isset($_GET['spammed']) || isset($_GET['unspammed'])) {
$approved = isset($_GET['approved']) ? (int) $_GET['approved'] : 0;
$deleted = isset($_GET['deleted']) ? (int) $_GET['deleted'] : 0;
$trashed = isset($_GET['trashed']) ? (int) $_GET['trashed'] : 0;
$untrashed = isset($_GET['untrashed']) ? (int) $_GET['untrashed'] : 0;
$spammed = isset($_GET['spammed']) ? (int) $_GET['spammed'] : 0;
$unspammed = isset($_GET['unspammed']) ? (int) $_GET['unspammed'] : 0;
if ($approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0) {
echo '<p><font color="olive">';
if ($approved > 0) {
printf(_n('%s comment approved.', '%s comments approved.', $approved, 'ktai_style'), $approved);
echo '<br />';
}
if ($spammed > 0) {
printf(_n('%s comment marked as spam.', '%s comments marked as spam.', $spammed, 'ktai_style'), $spammed);
if (isset($_GET['ids']) && function_exists('wp_unspam_comment')) {
$undo_url = 'edit-comments.php?doaction=undo&action=unspam&ids=' . $_GET['ids'];
$undo_url = wp_nonce_url($undo_url, 'bulk-comments');
// does html escape
printf(' <a href="%s">%s</a><br />', $undo_url, __('Undo'));
}
}
if ($unspammed > 0) {
printf(_n('%s comment restored from the spam', '%s comments restored from the spam', $unspammed, 'ktai_style'), $unspammed);
echo '<br />';
}
if ($trashed > 0) {
printf(_n('%s comment moved to the trash.', '%s comments moved to the trash.', $trashed, 'ktai_style'), $trashed);
if (isset($_GET['ids']) && function_exists('wp_untrash_comment')) {
$undo_url = 'edit-comments.php?doaction=undo&action=untrash&ids=' . $_GET['ids'];
$undo_url = wp_nonce_url($undo_url, 'bulk-comments');
// does html escape
printf('<a href="%s">%s</a><br />', $undo_url, __('Undo'));
}
}
if ($untrashed > 0) {
printf(_n('%s comment restored from the trash.', '%s comments restored from the trash.', $untrashed, 'ktai_style'), $untrashed);
echo '<br />';
}
if ($deleted > 0) {
printf(_n('%s comment deleted.', '%s comments deleted.', $deleted, 'ktai_style'), $deleted);
echo '<br />';
}
echo '</font></p>';
}
}
if (!$this->base->admin_available_wp_upper()) {
return;
}
if ($this->post_id > 0) {
$num_comments = wp_count_comments($this->post_id);
} else {
$num_comments = wp_count_comments();
}
$this->comments_stati($num_comments, $comment_status, $comment_type);
$comments_per_page = intval(($this->base->get('page_size') - self::HEADER_FOOTER_SIZE) / (self::COMMENT_EXCERPT_SIZE + self::COMMENT_NAV_SIZE));
$comments_per_page = apply_filters('comments_per_page', $comments_per_page, $comment_status);
if ($comments_per_page < 1) {
$comments_per_page = 1;
} elseif ($comments_per_page > self::COMMENTS_PER_PAGE) {
$comments_per_page = self::COMMENTS_PER_PAGE;
}
if (isset($_GET['filter'])) {
$page = 1;
} else {
$page = isset($_GET['apage']) ? abs((int) $_GET['apage']) : 1;
}
$start = $offset = ($page - 1) * $comments_per_page;
list($_comments, $total) = _wp_get_comment_list($comment_status, $search_dirty, $start, $comments_per_page + 8, $this->post_id, $comment_type);
// Grab a few extra
$_comment_post_ids = array();
foreach ($_comments as $_c) {
$_comment_post_ids[] = $_c->comment_post_ID;
}
$_comment_pending_count_temp = (array) get_pending_comments_num($_comment_post_ids);
foreach ((array) $_comment_post_ids as $_cpid) {
$_comment_pending_count[$_cpid] = isset($_comment_pending_count_temp[$_cpid]) ? $_comment_pending_count_temp[$_cpid] : 0;
}
if (empty($_comment_pending_count)) {
$_comment_pending_count = array();
//.........这里部分代码省略.........