本文整理汇总了PHP中get_pending_comments_num函数的典型用法代码示例。如果您正苦于以下问题:PHP get_pending_comments_num函数的具体用法?PHP get_pending_comments_num怎么用?PHP get_pending_comments_num使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_pending_comments_num函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _wp_comment_row
//.........这里部分代码省略.........
$actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID::delete=1 delete vim-d vim-destructive'>" . __('Delete Permanently') . '</a>';
} else {
$actions['trash'] = "<a href='$trash_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-d vim-destructive' title='" . esc_attr__( 'Move this comment to the trash' ) . "'>" . _x('Trash', 'verb') . '</a>';
}
if ( 'trash' != $the_comment_status ) {
$actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . esc_attr__('Edit comment') . "'>". __('Edit') . '</a>';
$actions['quickedit'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\',\'edit\');return false;" class="vim-q" title="'.esc_attr__('Quick Edit').'" href="#">' . __('Quick Edit') . '</a>';
if ( 'spam' != $the_comment_status )
$actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\');return false;" class="vim-r" title="'.esc_attr__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
}
$actions = apply_filters( 'comment_row_actions', array_filter($actions), $comment );
$i = 0;
echo '<div class="row-actions">';
foreach ( $actions as $action => $link ) {
++$i;
( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
// Reply and quickedit need a hide-if-no-js span when not added with ajax
if ( ('reply' == $action || 'quickedit' == $action) && ! $from_ajax )
$action .= ' hide-if-no-js';
elseif ( ($action == 'untrash' && $the_comment_status == 'trash') || ($action == 'unspam' && $the_comment_status == 'spam') ) {
if ('1' == get_comment_meta($comment_id, '_wp_trash_meta_status', true))
$action .= ' approve';
else
$action .= ' unapprove';
}
echo "<span class='$action'>$sep$link</span>";
}
echo '</div>';
}
echo '</td>';
break;
case 'author':
echo "<td $attributes><strong>"; comment_author(); echo '</strong><br />';
if ( !empty($author_url) )
echo "<a title='$author_url' href='$author_url'>$author_url_display</a><br />";
if ( $user_can ) {
if ( !empty($comment->comment_author_email) ) {
comment_author_email_link();
echo '<br />';
}
echo '<a href="edit-comments.php?s=';
comment_author_IP();
echo '&mode=detail';
if ( 'spam' == $comment_status )
echo '&comment_status=spam';
echo '">';
comment_author_IP();
echo '</a>';
} //current_user_can
echo '</td>';
break;
case 'date':
echo "<td $attributes>" . get_comment_date(__('Y/m/d \a\t g:ia')) . '</td>';
break;
case 'response':
if ( 'single' !== $mode ) {
if ( isset( $_comment_pending_count[$post->ID] ) ) {
$pending_comments = $_comment_pending_count[$post->ID];
} else {
$_comment_pending_count_temp = get_pending_comments_num( array( $post->ID ) );
$pending_comments = $_comment_pending_count[$post->ID] = $_comment_pending_count_temp[$post->ID];
}
if ( $user_can ) {
$post_link = "<a href='" . get_edit_post_link($post->ID) . "'>";
$post_link .= get_the_title($post->ID) . '</a>';
} else {
$post_link = get_the_title($post->ID);
}
echo "<td $attributes>\n";
echo '<div class="response-links"><span class="post-com-count-wrapper">';
echo $post_link . '<br />';
$pending_phrase = esc_attr(sprintf( __('%s pending'), number_format( $pending_comments ) ));
if ( $pending_comments )
echo '<strong>';
comments_number("<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('0', 'comment count') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link */ _x('1', 'comment count') . '</span></a>', "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . /* translators: comment count link: % will be substituted by comment count */ _x('%', 'comment count') . '</span></a>');
if ( $pending_comments )
echo '</strong>';
echo '</span> ';
echo "<a href='" . get_permalink( $post->ID ) . "'>#</a>";
echo '</div>';
if ( 'attachment' == $post->post_type && ( $thumb = wp_get_attachment_image( $post->ID, array(80, 60), true ) ) )
echo $thumb;
echo '</td>';
}
break;
default:
echo "<td $attributes>\n";
do_action( 'manage_comments_custom_column', $column_name, $comment->comment_ID );
echo "</td>\n";
break;
}
}
echo "</tr>\n";
}
示例2: display_rows
//.........这里部分代码省略.........
echo $h_time;
?>
</td>
<?php
break;
case 'parent':
if ($post->post_parent > 0) {
if (get_post($post->post_parent)) {
$title = _draft_or_post_title($post->post_parent);
}
?>
<td <?php
echo $attributes;
?>
><strong>
<?php
if (current_user_can('edit_post', $post->post_parent)) {
?>
<a href="<?php
echo get_edit_post_link($post->post_parent);
?>
">
<?php
echo $title;
?>
</a><?php
} else {
echo $title;
}
?>
</strong>,
<?php
echo get_the_time(__('Y/m/d'));
?>
</td>
<?php
} else {
?>
<td <?php
echo $attributes;
?>
><?php
_e('(Unattached)');
?>
<br />
<?php
if ($user_can_edit) {
?>
<a class="hide-if-no-js"
onclick="findPosts.open( 'media[]','<?php
echo $post->ID;
?>
' ); return false;"
href="#the-list">
<?php
_e('Attach');
?>
</a>
<?php
}
?>
</td>
<?php
}
break;
case 'comments':
$attributes = 'class="comments column-comments num"' . $style;
?>
<td <?php
echo $attributes;
?>
>
<div class="post-com-count-wrapper">
<?php
$pending_comments = get_pending_comments_num($post->ID);
$this->comments_bubble($post->ID, $pending_comments);
?>
</div>
</td>
<?php
break;
default:
?>
<td <?php
echo $attributes;
?>
>
<?php
do_action('manage_media_custom_column', $column_name, $id);
?>
</td>
<?php
break;
}
}
?>
</tr>
<?php
}
}
示例3: column_response
/**
* @access public
*/
public function column_response()
{
$post = get_post();
if (!$post) {
return;
}
if (isset($this->pending_count[$post->ID])) {
$pending_comments = $this->pending_count[$post->ID];
} else {
$_pending_count_temp = get_pending_comments_num(array($post->ID));
$pending_comments = $this->pending_count[$post->ID] = $_pending_count_temp[$post->ID];
}
if (current_user_can('edit_post', $post->ID)) {
$post_link = "<a href='" . get_edit_post_link($post->ID) . "' class='comments-edit-item-link'>";
$post_link .= esc_html(get_the_title($post->ID)) . '</a>';
} else {
$post_link = esc_html(get_the_title($post->ID));
}
echo '<div class="response-links">';
if ('attachment' == $post->post_type && ($thumb = wp_get_attachment_image($post->ID, array(80, 60), true))) {
echo $thumb;
}
echo $post_link;
$post_type_object = get_post_type_object($post->post_type);
echo "<a href='" . get_permalink($post->ID) . "' class='comments-view-item-link'>" . $post_type_object->labels->view_item . '</a>';
echo '<span class="post-com-count-wrapper post-com-count-', $post->ID, '">';
$this->comments_bubble($post->ID, $pending_comments);
echo '</span> ';
echo '</div>';
}
示例4: _display_rows
/**
* @global string $mode
* @param array $posts
* @param int $level
*/
private function _display_rows($posts, $level = 0)
{
global $mode;
// Create array of post IDs.
$post_ids = array();
foreach ($posts as $a_post) {
$post_ids[] = $a_post->ID;
}
$this->comment_pending_count = get_pending_comments_num($post_ids);
foreach ($posts as $post) {
$this->single_row($post, $level);
}
}
示例5: add_filter
}
?>
</tr>
</thead>
<tbody>
<?php
if (have_posts()) {
$bgcolor = '';
add_filter('the_title', 'wp_specialchars');
// Create array of post IDs.
$post_ids = array();
foreach ($wp_query->posts as $a_post) {
$post_ids[] = $a_post->ID;
}
$comment_pending_count = get_pending_comments_num($post_ids);
while (have_posts()) {
the_post();
$class = 'alternate' == $class ? '' : 'alternate';
global $current_user;
$post_owner = $current_user->ID == $post->post_author ? 'self' : 'other';
$title = get_the_title();
if (empty($title)) {
$title = __('(no title)');
}
?>
<tr id='post-<?php
echo $id;
?>
' class='<?php
echo trim($class . ' author-' . $post_owner . ' status-' . $post->post_status);
示例6: column_comments
/**
* Handles the comments column output.
*
* @since 4.3.0
* @access public
*
* @param WP_Post $post The current WP_Post object.
*/
public function column_comments($post)
{
echo '<div class="post-com-count-wrapper">';
$pending_comments = get_pending_comments_num($post->ID);
$this->comments_bubble($post->ID, $pending_comments);
echo '</div>';
}
示例7: post_rows
public function post_rows()
{
global $wp_query, $post;
$columns = array('dt', 'title', '/dt', 'dd', 'author', 'date', 'comments', '/dd', 'dd-small', 'categories', '/dd-small');
$columns = array_merge($columns, array('dd-small', 'tags', '/dd-small'));
if ('trash' === $_GET['post_status'] && function_exists('wp_untrash_post')) {
$columns = array_merge($columns, array('dd', 'actions', '/dd'));
}
$post_ids = array();
foreach ($wp_query->posts as $a_post) {
$post_ids[] = $a_post->ID;
}
$comment_pending_count = get_pending_comments_num($post_ids);
if (empty($comment_pending_count)) {
$comment_pending_count = array();
}
?>
<dl><?php
while (have_posts()) {
the_post();
foreach ($columns as $column_name) {
switch ($column_name) {
case 'dt':
echo '<dt>';
break;
case '/dt':
echo '</dt>';
break;
case 'dd':
echo '<dd>';
break;
case '/dd':
echo '</dd>';
break;
case 'dd-small':
echo '<dd><small>';
break;
case '/dd-small':
echo '</small></dd>';
break;
case 'title':
$title = $this->admin->draft_or_post_title();
if (current_user_can('edit_post', $post->ID) && $post->post_status != 'trash') {
$title = sprintf(__('<img localsrc="104" alt="" /><a href="%1$s">%2$s</a>', 'ktai_style'), get_edit_post_link($post->ID, 'url'), $title);
}
printf(_c('%1$5d:%2$s%3$s|post_row_title', 'ktai_style'), $post->ID, $title, $this->admin->get_post_states($post));
break;
case 'date':
if ('draft' === $_GET['post_status'] || 'pending' === $_GET['post_status']) {
if ('0000-00-00 00:00:00' == $post->post_modified) {
$time = __('Never');
} else {
$time = ks_get_mod_time();
}
} else {
if ('0000-00-00 00:00:00' == $post->post_date) {
$time = __('Unpublished');
} else {
$time = ks_get_time();
}
}
printf(__('<img localsrc="46" alt=" at " />%s', 'ktai_style'), '<font color="' . ks_option('ks_date_color') . '">' . $time . '</font>');
break;
case 'author':
printf(__('<img localsrc="68" alt="by " />%s', 'ktai_style'), get_the_author());
break;
case 'categories':
$categories = get_the_category();
if (!empty($categories)) {
$cat_links = array();
foreach ($categories as $c) {
$cat_links[] = '<a href="' . basename(__FILE__) . '?cat=' . $c->cat_ID . '"><font color="gray">' . wp_specialchars(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display')) . '</font></a>';
}
echo sprintf(__('<img localsrc="354" alt="%1$s" />%2$s', 'ktai_style'), __('Category:'), implode(', ', $cat_links));
}
break;
case 'tags':
$tags = get_the_tags($post->ID);
if (!empty($tags)) {
$tag_links = array();
foreach ($tags as $t) {
$tag_links[] = '<a href="' . basename(__FILE__) . '?tag=' . $t->slug . '"><font color="gray">' . wp_specialchars(sanitize_term_field('name', $t->name, $t->term_id, 'post_tag', 'display')) . '</font></a>';
}
echo sprintf(__('<img localsrc="77" alt="%1$s" />%2$s', 'ktai_style'), __('Tags:'), implode(', ', $tag_links));
}
break;
case 'comments':
$link = '<a href="edit-comments.php?p=' . $post->ID . '">';
echo ' <img localsrc="86" alt="[' . __('Comments') . '] " />';
if (function_exists('_x')) {
comments_number($comment_pending_count[$post->ID] ? $link . _x('0', 'comment count') . '</a>' : _x('0', 'comment count'), $link . _x('1', 'comment count') . '</a>', $link . _x('%', 'comment count') . '</a>');
} else {
comments_number($comment_pending_count[$post->ID] ? $link . __('0') . '</a>' : __('0'), $link . __('1') . '</a>', $link . __('%') . '</a>');
}
if ($comment_pending_count[$post->ID]) {
echo '<img localsrc="2" alt="[' . sprintf(__('%s pending'), number_format($comment_pending_count[$post->ID])) . ']" />';
}
break;
case 'actions':
$delete_url = 'post.php?action=delete&post=' . $post->ID;
//.........这里部分代码省略.........
示例8: display_rows
/**
*
* @global WP_Post $post
*/
public function display_rows()
{
global $post, $wp_query;
$post_ids = wp_list_pluck($wp_query->posts, 'ID');
reset($wp_query->posts);
$this->comment_pending_count = get_pending_comments_num($post_ids);
add_filter('the_title', 'esc_html');
while (have_posts()) {
the_post();
if ($this->is_trash && $post->post_status != 'trash' || !$this->is_trash && $post->post_status === 'trash') {
continue;
}
$post_owner = get_current_user_id() == $post->post_author ? 'self' : 'other';
?>
<tr id="post-<?php
echo $post->ID;
?>
" class="<?php
echo trim(' author-' . $post_owner . ' status-' . $post->post_status);
?>
">
<?php
$this->single_row_columns($post);
?>
</tr>
<?php
}
}
示例9: _wp_comment_row
//.........这里部分代码省略.........
if ('trash' != $the_comment_status) {
$actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' title='" . esc_attr__('Edit comment') . "'>" . __('Edit') . '</a>';
$actions['quickedit'] = '<a onclick="commentReply.open(\'' . $comment->comment_ID . '\',\'' . $post->ID . '\',\'edit\');return false;" class="vim-q" title="' . esc_attr__('Quick Edit') . '" href="#">' . __('Quick Edit') . '</a>';
if ('spam' != $the_comment_status) {
$actions['reply'] = '<a onclick="commentReply.open(\'' . $comment->comment_ID . '\',\'' . $post->ID . '\');return false;" class="vim-r" title="' . esc_attr__('Reply to this comment') . '" href="#">' . __('Reply') . '</a>';
}
}
$actions = apply_filters('comment_row_actions', array_filter($actions), $comment);
$i = 0;
echo '<div class="row-actions">';
foreach ($actions as $action => $link) {
++$i;
('approve' == $action || 'unapprove' == $action) && 2 === $i || 1 === $i ? $sep = '' : ($sep = ' | ');
// Reply and quickedit need a hide-if-no-js span when not added with ajax
if (('reply' == $action || 'quickedit' == $action) && !$from_ajax) {
$action .= ' hide-if-no-js';
} elseif ($action == 'untrash' && $the_comment_status == 'trash' || $action == 'unspam' && $the_comment_status == 'spam') {
if ('1' == get_comment_meta($comment_id, '_wp_trash_meta_status', true)) {
$action .= ' approve';
} else {
$action .= ' unapprove';
}
}
echo "<span class='{$action}'>{$sep}{$link}</span>";
}
echo '</div>';
}
echo '</td>';
break;
case 'author':
echo "<td {$attributes}><strong>";
comment_author();
echo '</strong><br />';
if (!empty($author_url)) {
echo "<a title='{$author_url}' href='{$author_url}'>{$author_url_display}</a><br />";
}
if ($user_can) {
if (!empty($comment->comment_author_email)) {
comment_author_email_link();
echo '<br />';
}
echo '<a href="edit-comments.php?s=';
comment_author_IP();
echo '&mode=detail';
if ('spam' == $comment_status) {
echo '&comment_status=spam';
}
echo '">';
comment_author_IP();
echo '</a>';
}
//current_user_can
echo '</td>';
break;
case 'date':
echo "<td {$attributes}>" . get_comment_date(__('Y/m/d \\a\\t g:ia')) . '</td>';
break;
case 'response':
if ('single' !== $mode) {
if (isset($_comment_pending_count[$post->ID])) {
$pending_comments = absint($_comment_pending_count[$post->ID]);
} else {
$_comment_pending_count_temp = (array) get_pending_comments_num(array($post->ID));
$pending_comments = $_comment_pending_count[$post->ID] = $_comment_pending_count_temp[$post->ID];
}
if ($user_can) {
$post_link = "<a href='" . get_edit_post_link($post->ID) . "'>";
$post_link .= get_the_title($post->ID) . '</a>';
} else {
$post_link = get_the_title($post->ID);
}
echo "<td {$attributes}>\n";
echo '<div class="response-links"><span class="post-com-count-wrapper">';
echo $post_link . '<br />';
$pending_phrase = esc_attr(sprintf(__('%s pending'), number_format($pending_comments)));
if ($pending_comments) {
echo '<strong>';
}
comments_number("<a href='edit-comments.php?p={$post->ID}' title='{$pending_phrase}' class='post-com-count'><span class='comment-count'>" . _x('0', 'comment count') . '</span></a>', "<a href='edit-comments.php?p={$post->ID}' title='{$pending_phrase}' class='post-com-count'><span class='comment-count'>" . _x('1', 'comment count') . '</span></a>', "<a href='edit-comments.php?p={$post->ID}' title='{$pending_phrase}' class='post-com-count'><span class='comment-count'>" . _x('%', 'comment count') . '</span></a>');
if ($pending_comments) {
echo '</strong>';
}
echo '</span> ';
echo "<a href='" . get_permalink($post->ID) . "'>#</a>";
echo '</div>';
if ('attachment' == $post->post_type && ($thumb = wp_get_attachment_image($post->ID, array(80, 60), true))) {
echo $thumb;
}
echo '</td>';
}
break;
default:
echo "<td {$attributes}>\n";
do_action('manage_comments_custom_column', $column_name, $comment->comment_ID);
echo "</td>\n";
break;
}
}
echo "</tr>\n";
}
示例10: prepare_items
/**
* Prepare reviews for display
*/
function prepare_items()
{
global $post_id, $comment_status, $search, $comment_type;
// Prepare for querying reviews
$meta_query = $meta_key = '';
$comment_status = isset($_REQUEST['comment_status']) ? $_REQUEST['comment_status'] : 'all';
if (!in_array($comment_status, array('all', 'moderated', 'approved', 'spam', 'trash'))) {
$comment_status = 'all';
}
$comment_type = !empty($_REQUEST['comment_type']) ? $_REQUEST['comment_type'] : '';
$search = isset($_REQUEST['s']) ? $_REQUEST['s'] : '';
$user_id = isset($_REQUEST['user_id']) ? $_REQUEST['user_id'] : '';
$orderby = isset($_REQUEST['orderby']) ? $_REQUEST['orderby'] : '';
$order = isset($_REQUEST['order']) ? $_REQUEST['order'] : '';
$comments_per_page = $this->get_per_page($comment_status);
$doing_ajax = defined('DOING_AJAX') && DOING_AJAX;
if (isset($_REQUEST['number'])) {
$number = (int) $_REQUEST['number'];
} else {
$number = $comments_per_page + min(8, $comments_per_page);
// Grab a few extra
}
$page = $this->get_pagenum();
if (isset($_REQUEST['start'])) {
$start = $_REQUEST['start'];
} else {
$start = ($page - 1) * $comments_per_page;
}
if ($doing_ajax && isset($_REQUEST['offset'])) {
$start += $_REQUEST['offset'];
}
$status_map = array('moderated' => 'hold', 'approved' => 'approve', 'all' => '');
$args = array('status' => isset($status_map[$comment_status]) ? $status_map[$comment_status] : $comment_status, 'search' => $search, 'user_id' => $user_id, 'offset' => $start, 'number' => $number, 'post_id' => $post_id, 'type' => $comment_type, 'orderby' => $orderby, 'order' => $order, 'meta_key' => $meta_key, 'meta_query' => $meta_query, 'post_type' => 'product');
$_comments = get_comments($args);
update_comment_cache($_comments);
$this->items = array_slice($_comments, 0, $comments_per_page);
$this->extra_items = array_slice($_comments, $comments_per_page);
$total_comments = get_comments(array_merge($args, array('count' => true, 'offset' => 0, 'number' => 0)));
$_comment_post_ids = array();
foreach ($_comments as $_c) {
$_comment_post_ids[] = $_c->comment_post_ID;
}
$_comment_post_ids = array_unique($_comment_post_ids);
$this->pending_count = get_pending_comments_num($_comment_post_ids);
$this->set_pagination_args(array('total_items' => $total_comments, 'per_page' => $comments_per_page));
}
示例11: 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();
//.........这里部分代码省略.........
示例12: start_el
//.........这里部分代码省略.........
$dhide = in_array('date', $args['hidden']) ? ' style="display:none"' : '';
$flist = $img = '';
if (!empty($files)) {
$post_meta = current(get_post_meta($post->ID, 'webcomic'));
$wc = current(wp_get_object_terms($post->ID, 'webcomic_collection'));
foreach ($files['full'] as $k => $v) {
$faction = '';
if (!empty($files['small'][$k])) {
$file = $files['small'][$k];
} elseif (!empty($files['medium'][$k])) {
$file = $files['medium'][$k];
} elseif (!empty($files['large'][$k])) {
$file = $files['large'][$k];
} else {
$file = $v;
}
$reg = in_array($files['full'][$k]['mime'], array('image/jpeg', 'image/gif', 'image/png')) ? '| <a href="' . wp_nonce_url($args['view'] . '&action=regen_webcomic_file&webcomic_key=' . $k . '&post=' . $post->ID, 'regen_webcomic_file') . '">' . __('Regenerate Thumbnails', 'webcomic') . '</a> | ' : '';
$bind = empty($post_meta['files']) ? '<a href="' . wp_nonce_url($args['view'] . '&action=bind_webcomic_file&post=' . $post->ID, 'bind_webcomic_file') . '">' . __('Bind', 'webcomic') . '</a> | ' : '<a href="' . wp_nonce_url($args['view'] . '&action=unbind_webcomic_file&webcomic_key=' . $k . '&post=' . $post->ID, 'bind_webcomic_file') . '">' . __('Unbind', 'webcomic') . '</a> | ';
$faction = current_user_can('edit_others_posts') || $current_user->ID == $post->post_author ? '<a href="' . admin_url('admin.php?page=webcomic_tools&subpage=edit_files&type=post&src=' . $wc->slug . '&id=' . $post->ID . '&key=' . $k) . '">' . __('Edit', 'webcomic') . '</a>' . $reg . $bind . '<span class="delete"><a href="' . wp_nonce_url($args['view'] . '&action=delete_webcomic_file&webcomic_key=' . $k . '&post=' . $post->ID, 'delete_webcomic_file') . '" onclick="if(confirm(\'' . esc_js(sprintf(__("You are about to delete '%s'\n 'Cancel' to stop, 'OK' to delete.", "webcomic"), $files['full'][$k]['basename'])) . '\')){return true;}return false;">' . __('Delete', 'webcomic') . '</a> | </span><span class="view"><a href="' . $files['full'][$k]['url'] . '" target="_blank">' . __('View', 'webcomic') . '</a></span>' : '<span class="view"><a href="' . $files['full'][$k]['url'] . '" target="_blank">' . __('View', 'webcomic') . '</a></span>';
$flist .= '<a href="' . admin_url('admin.php?page=webcomic_tools&subpage=edit_files&type=post&src=' . $wc->slug . '&id=' . $post->ID . '&key=' . $k) . '" title="' . __('Edit this file', 'webcomic') . '" class="row-title">' . $files['full'][$k]['filename'] . '</a><br>' . $files['full'][$k]['mime'] . '<p class="row-actions">' . $faction . '</p>';
$img .= 'application/x-shockwave-flash' == $file['mime'] ? '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="webcomic-file-' . hash('md5', $file['url']) . '" height="' . $webcomic->option('small_h') . '" width="' . $webcomic->option('small_w') . '"><param name="movie" value="' . $file['url'] . '"><!--[if !IE]>--><object type="application/x-shockwave-flash" data="' . $file['url'] . '" height="' . $webcomic->option('small_h') . '" width="' . $webcomic->option('small_w') . '"><!--<![endif]--><p>' . $file['full'][$k]['filename'] . '</p><!--[if !IE]>--></object><!--<![endif]--></object><script type="text/javascript">swfobject.registerObject("webcomic-file-' . hash('md5', $file['url']) . '","9");</script><br>' : '<img src="' . $file['url'] . '" alt="' . $files['full'][$k]['basename'] . '" ' . $file[3] . '><br>';
}
}
$title = 'trash' != $post->post_status && (current_user_can('edit_others_posts') || $current_user->ID == $post->post_author) ? '<a href="post.php?action=edit&post_type=webcomic_post&post=' . $post->ID . '" title="' . __('Edit this post', 'webcomic') . '" class="row-title">' . $post->post_title . '</a>' : '<span class="row-title">' . $post->post_title . '</span>';
$author = get_userdata($post->post_author);
$state = $cterms = $sterms = array();
$cbox = current_user_can('edit_others_posts') || $current_user->ID == $post->post_author ? '<input type="checkbox" name="bulk[]" value="' . $post->ID . '">' : '';
if ('trash' == $post->post_status) {
$paction = current_user_can('delete_others_posts') || $current_user->ID == $post->post_author ? '<span class="untrash"><a href="' . wp_nonce_url($args['view'] . '&action=undelete_webcomic_post&post=' . $post->ID, 'undelete_webcomic_post') . '">' . __('Restore', 'webcomic') . '</a></span> | <span class="delete"><a href="' . wp_nonce_url($args['view'] . '&action=delete_webcomic_post&post=' . $post->ID, 'delete_webcomic_post') . '">' . __('Delete Permanently', 'webcomic') . '</a></span>' : '';
} else {
$paction = current_user_can('edit_others_posts') || $current_user->ID == $post->post_author ? '<a href="post.php?action=edit&post_type=webcomic_post&post=' . $post->ID . '">' . __('Edit', 'webcomic') . '</a> | <span class="delete"><a href="' . wp_nonce_url($args['view'] . '&action=delete_webcomic_post&post=' . $post->ID, 'delete_webcomic_post') . '">' . __('Trash', 'webcomic') . '</a></span> | <span class="view"><a href="' . get_permalink($post->ID) . '" target="_blank">' . __('View', 'webcomic') . '</a></span>' : '<span class="view"><a href="' . get_permalink($post->ID) . '">' . __('View', 'webcomic') . '</a></span>';
}
if (!empty($post->post_password)) {
$state[] = __('Password Protected', 'webcomic');
} elseif ('private' == $post->post_status) {
$state[] = __('Private', 'webcomic');
}
if ('pending' == $post->post_status) {
$state[] = __('Pending', 'webcomic');
}
if ('draft' == $post->post_status) {
$state[] = __('Draft', 'webcomic');
}
if (is_sticky($post->ID)) {
$state[] = __('Sticky', 'webcomic');
}
$state = !empty($state) ? ' - <strong>' . implode(', ', $state) . '</strong>' : '';
$storylines = wp_get_object_terms($post->ID, 'webcomic_storyline');
if (!empty($storylines) && !is_wp_error($storylines)) {
foreach ($storylines as $storyline) {
$sterms[] = '<a href="' . $args['view'] . '&webcomic_storyline=' . $storyline->term_id . '">' . $storyline->name . '</a>';
}
} else {
$sterms = array(__('No Storylines', 'webcomic'));
}
$characters = wp_get_object_terms($post->ID, 'webcomic_character');
if (!empty($characters) && !is_wp_error($characters)) {
foreach ($characters as $character) {
$cterms[] = '<a href="' . $args['view'] . '&webcomic_character=' . $character->term_id . '">' . $character->name . '</a>';
}
} else {
$cterms = array(__('No Characters', 'webcomic'));
}
if ('0000-00-00 00:00:00' == $post->post_date) {
$t_time = $h_time = __('Unpublished', 'webcomic');
} else {
$t_time = get_the_time(__('Y/m/d g:i:s A', 'webcomic'), $post->ID);
$m_time = $post->post_date;
$time = get_post_time('G', true, $post);
$d_time = time() - $time;
if ('future' == $post->post_status) {
$h_time = $d_time <= 0 ? sprintf(__('%s from now', 'webcomic'), human_time_diff($time)) : $t_time;
} elseif ($d_time > 0 && $d_time < 86400) {
$h_time = sprintf(__('%s ago', 'webcomic'), human_time_diff($time));
} else {
$h_time = mysql2date(__('Y/m/d', 'webcomic'), $m_time);
}
$missed = $h_time == $t_time ? true : false;
}
if ('publish' == $post->post_status) {
$status = __('Published', 'webcomic');
} elseif ('future' == $post->post_status && $missed) {
$status = '<strong class="attention">' . __('Missed Schedule', 'webcomic') . '</strong>';
} elseif ('future' == $post->post_status) {
$status = __('Scheduled', 'webcomic');
} else {
$status = __('Last Modified', 'webcomic');
}
$output .= '<tr' . $alt . '>
<th scope="row" class="check-column">' . $cbox . '</th>
<td class="thumbnails column-thumbnails"' . $thide . '>' . $img . '</td>
<td class="post column-post"' . $phide . '>' . $title . $state . '<br>' . $author->display_name . '<p class="row-actions">' . $paction . '</p></td>
<td class="file column-file">' . $flist . '</td>
<td class="storylines column-storylines"' . $shide . '>' . implode(', ', $sterms) . '</td>
<td class="characters column-characters"' . $chide . '>' . implode(', ', $cterms) . '</td>
<td class="comments column-comments"' . $mhide . '><a href="edit-comments.php?p=' . $post->ID . '" title="' . sprintf(__('%s pending', 'webcomic'), number_format(get_pending_comments_num($post->ID))) . '" class="post-com-count"><span class="comment-count">' . $post->comment_count . '</span></a></td>
<td class="date column-date"' . $dhide . '><abbr title="' . $t_time . '">' . $h_time . '</abbr><br>' . $status . '</td>
</tr>';
$i++;
}
示例13: _display_rows
function _display_rows($fashions)
{
global $fashion, $mode;
// Create array of fashion IDs.
$fashion_ids = array();
foreach ($fashions as $a_fashion) {
$fashion_ids[] = $a_fashion->ID;
}
$this->comment_pending_count = get_pending_comments_num($fashion_ids);
foreach ($fashions as $fashion) {
$this->single_row($fashion);
}
}
示例14: cwp_post_rows
function cwp_post_rows($posts = array(), $page)
{
global $post, $mode;
add_filter('the_title', 'esc_html');
// Create array of post IDs.
$post_ids = array();
foreach ($posts as $a_post) {
$post_ids[] = $a_post->ID;
}
$comment_pending_count = get_pending_comments_num($post_ids);
if (empty($comment_pending_count)) {
$comment_pending_count = array();
}
foreach ($posts as $post) {
if (empty($comment_pending_count[$post->ID])) {
$comment_pending_count[$post->ID] = 0;
}
cwp_post_row($post, $comment_pending_count[$post->ID], $mode, $page);
}
}
示例15: fix_duplicates_admin_main
//.........这里部分代码省略.........
echo absint($value['ID']);
?>
</td>
<td class="author column-author"><a href="edit.php?post_type=post&author=<?php
echo $value['post_author'];
?>
"><?php
the_author_meta('display_name', $value['post_author']);
?>
</a></td>
<td class="categories column-categories">
<?php
$fix_duplicates_category_array = get_the_category(absint($value['ID']));
if ($fix_duplicates_category_array) {
foreach ($fix_duplicates_category_array as $fix_duplicates_cat_key => $fix_duplicates_cat) {
echo '<a href="' . esc_url('edit.php?category_name=' . $fix_duplicates_cat->slug) . '">' . esc_html($fix_duplicates_cat->name) . '</a>';
if (count($fix_duplicates_category_array) > $fix_duplicates_cat_key + 1) {
echo ', ';
}
}
}
?>
</td>
<td class="words column-words"><?php
echo str_word_count(strip_tags($value['post_content']));
?>
</td>
<td class="comments column-comments">
<div class="post-com-count-wrapper">
<a href="<?php
echo admin_url('edit-comments.php?p=' . absint($value['ID']));
?>
" title='<?php
echo number_format_i18n(get_pending_comments_num(absint($value['ID'])));
?>
pending' class='post-com-count'><span class='comment-count'><?php
echo number_format_i18n(get_comments_number(absint($value['ID'])));
?>
</span></a>
</div>
</td>
<?php
do_action('fix_duplicates_td');
?>
<td class="date column-date"><abbr title="<?php
echo $value['post_date'];
?>
"><?php
echo $value['post_date'];
?>
</abbr></td>
</tr>
<!-- End individual title -->
<?php
// if this title doesn't match next row's title, close the tbody
if (!empty($fix_duplicates_result[$key + 1]['post_title']) && trim(strtolower($fix_duplicates_result[$key + 1]['post_title'])) != trim(strtolower($value['post_title']))) {
?>
</tbody>
<?php
}
}
?>
</table>
<!-- End table listing the duplicates -->