introduce WP_List_Table::comments_bubble(); revert to edit-comments.php?p=123. See #14579
git-svn-id: http://svn.automattic.com/wordpress/trunk@15504 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e55cf70e35
commit
eec59d35bb
|
@ -225,7 +225,7 @@ foreach ( $stati as $status => $label ) {
|
|||
$num_comments->$status = 10;
|
||||
$link = add_query_arg( 'comment_status', $status, $link );
|
||||
if ( $post_id )
|
||||
$link = add_query_arg( 'post_ID', absint( $post_id ), $link );
|
||||
$link = add_query_arg( 'p', absint( $post_id ), $link );
|
||||
/*
|
||||
// I toyed with this, but decided against it. Leaving it in here in case anyone thinks it is a good idea. ~ Mark
|
||||
if ( !empty( $_REQUEST['s'] ) )
|
||||
|
@ -252,7 +252,7 @@ unset($status_links);
|
|||
|
||||
<input type="hidden" name="mode" value="<?php echo esc_attr($mode); ?>" />
|
||||
<?php if ( $post_id ) : ?>
|
||||
<input type="hidden" name="post_ID" value="<?php echo esc_attr( intval( $post_id ) ); ?>" />
|
||||
<input type="hidden" name="p" value="<?php echo esc_attr( intval( $post_id ) ); ?>" />
|
||||
<?php endif; ?>
|
||||
<input type="hidden" name="comment_status" value="<?php echo esc_attr($comment_status); ?>" />
|
||||
<input type="hidden" name="pagegen_timestamp" value="<?php echo esc_attr(current_time('mysql', 1)); ?>" />
|
||||
|
@ -280,7 +280,7 @@ unset($status_links);
|
|||
<input type="hidden" name="comment_status" value="<?php echo esc_attr($comment_status); ?>" />
|
||||
<input type="hidden" name="page" value="<?php echo esc_attr($page); ?>" />
|
||||
<input type="hidden" name="per_page" value="<?php echo esc_attr($comments_per_page); ?>" />
|
||||
<input type="hidden" name="post_ID" value="<?php echo esc_attr( $post_id ); ?>" />
|
||||
<input type="hidden" name="p" value="<?php echo esc_attr( $post_id ); ?>" />
|
||||
<input type="hidden" name="comment_type" value="<?php echo esc_attr( $comment_type ); ?>" />
|
||||
<?php wp_nonce_field( 'add-comment', '_ajax_nonce', false ); ?>
|
||||
</form>
|
||||
|
|
|
@ -555,19 +555,8 @@ class WP_Posts_Table extends WP_List_Table {
|
|||
<td <?php echo $attributes ?>><div class="post-com-count-wrapper">
|
||||
<?php
|
||||
$pending_comments = isset( $this->comment_pending_count[$post->ID] ) ? $this->comment_pending_count[$post->ID] : 0;
|
||||
$pending_phrase = sprintf( __( '%s pending' ), number_format( $pending_comments ) );
|
||||
if ( $pending_comments )
|
||||
echo '<strong>';
|
||||
comments_number(
|
||||
"<a href='edit-comments.php?post_ID=$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?post_ID=$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?post_ID=$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>';
|
||||
|
||||
$this->comments_bubble( $post->ID, $pending_comments );
|
||||
?>
|
||||
</div></td>
|
||||
<?php
|
||||
|
@ -1216,21 +1205,10 @@ foreach ( $columns as $column_name => $column_display_name ) {
|
|||
<td <?php echo $attributes ?>>
|
||||
<div class="post-com-count-wrapper">
|
||||
<?php
|
||||
$left = get_pending_comments_num( $post->ID );
|
||||
$pending_phrase = sprintf( __( '%s pending' ), number_format( $left ) );
|
||||
if ( $left )
|
||||
echo '<strong>';
|
||||
comments_number(
|
||||
"<a href='edit-comments.php?post_ID=$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?post_ID=$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?post_ID=$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 ( $left )
|
||||
echo '</strong>';
|
||||
?>
|
||||
$pending_comments = get_pending_comments_num( $post->ID );
|
||||
|
||||
$this->comments_bubble( $post->ID, $pending_comments );
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
<?php
|
||||
|
@ -1965,7 +1943,7 @@ class WP_Comments_Table extends WP_List_Table {
|
|||
function prepare_items() {
|
||||
global $post_id, $comment_status, $mode;
|
||||
|
||||
$post_id = isset( $_REQUEST['post_ID'] ) ? absint( $_REQUEST['post_ID'] ) : 0;
|
||||
$post_id = isset( $_REQUEST['p'] ) ? absint( $_REQUEST['p'] ) : 0;
|
||||
|
||||
$mode = ( empty( $_REQUEST['mode'] ) ) ? 'detail' : $_REQUEST['mode'];
|
||||
|
||||
|
@ -2338,19 +2316,7 @@ class WP_Comments_Table extends WP_List_Table {
|
|||
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?post_ID=$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?post_ID=$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?post_ID=$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>';
|
||||
$this->comments_bubble( $post->ID, $pending_comments );
|
||||
echo '</span> ';
|
||||
echo "<a href='" . get_permalink( $post->ID ) . "'>#</a>";
|
||||
echo '</div>';
|
||||
|
|
|
@ -268,6 +268,33 @@ class WP_List_Table {
|
|||
<?php
|
||||
}
|
||||
|
||||
/** Display a comment count bubble
|
||||
*
|
||||
*
|
||||
* @since 3.1.0
|
||||
* @access protected
|
||||
*
|
||||
* @param int $post_id
|
||||
* @param int $pending_comments
|
||||
*/
|
||||
function comments_bubble( $post_id, $pending_comments ) {
|
||||
$pending_phrase = sprintf( __( '%s pending' ), number_format( $pending_comments ) );
|
||||
|
||||
if ( $pending_comments )
|
||||
echo '<strong>';
|
||||
|
||||
$link = "<a href='edit-comments.php?p=$post->ID' title='$pending_phrase' class='post-com-count'><span class='comment-count'>%s</span></a>";
|
||||
|
||||
comments_number(
|
||||
sprintf( $link, /* translators: comment count link */ _x( '0', 'comment count' ) ),
|
||||
sprintf( $link, /* translators: comment count link */ _x( '1', 'comment count' ) ),
|
||||
sprintf( $link, /* translators: comment count link: % will be substituted by comment count */ _x( '%', 'comment count' ) )
|
||||
);
|
||||
|
||||
if ( $pending_comments )
|
||||
echo '</strong>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current page number
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue