introduce WP_List_Table::comments_bubble(); revert to edit-comments.php?p=123. See #14579
git-svn-id: https://develop.svn.wordpress.org/trunk@15504 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ad944bb822
commit
0a6cb83e18
@ -225,7 +225,7 @@ foreach ( $stati as $status => $label ) {
|
|||||||
$num_comments->$status = 10;
|
$num_comments->$status = 10;
|
||||||
$link = add_query_arg( 'comment_status', $status, $link );
|
$link = add_query_arg( 'comment_status', $status, $link );
|
||||||
if ( $post_id )
|
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
|
// 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'] ) )
|
if ( !empty( $_REQUEST['s'] ) )
|
||||||
@ -252,7 +252,7 @@ unset($status_links);
|
|||||||
|
|
||||||
<input type="hidden" name="mode" value="<?php echo esc_attr($mode); ?>" />
|
<input type="hidden" name="mode" value="<?php echo esc_attr($mode); ?>" />
|
||||||
<?php if ( $post_id ) : ?>
|
<?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; ?>
|
<?php endif; ?>
|
||||||
<input type="hidden" name="comment_status" value="<?php echo esc_attr($comment_status); ?>" />
|
<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)); ?>" />
|
<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="comment_status" value="<?php echo esc_attr($comment_status); ?>" />
|
||||||
<input type="hidden" name="page" value="<?php echo esc_attr($page); ?>" />
|
<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="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 ); ?>" />
|
<input type="hidden" name="comment_type" value="<?php echo esc_attr( $comment_type ); ?>" />
|
||||||
<?php wp_nonce_field( 'add-comment', '_ajax_nonce', false ); ?>
|
<?php wp_nonce_field( 'add-comment', '_ajax_nonce', false ); ?>
|
||||||
</form>
|
</form>
|
||||||
|
@ -555,19 +555,8 @@ class WP_Posts_Table extends WP_List_Table {
|
|||||||
<td <?php echo $attributes ?>><div class="post-com-count-wrapper">
|
<td <?php echo $attributes ?>><div class="post-com-count-wrapper">
|
||||||
<?php
|
<?php
|
||||||
$pending_comments = isset( $this->comment_pending_count[$post->ID] ) ? $this->comment_pending_count[$post->ID] : 0;
|
$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 )
|
$this->comments_bubble( $post->ID, $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>';
|
|
||||||
?>
|
?>
|
||||||
</div></td>
|
</div></td>
|
||||||
<?php
|
<?php
|
||||||
@ -1216,20 +1205,9 @@ foreach ( $columns as $column_name => $column_display_name ) {
|
|||||||
<td <?php echo $attributes ?>>
|
<td <?php echo $attributes ?>>
|
||||||
<div class="post-com-count-wrapper">
|
<div class="post-com-count-wrapper">
|
||||||
<?php
|
<?php
|
||||||
$left = get_pending_comments_num( $post->ID );
|
$pending_comments = get_pending_comments_num( $post->ID );
|
||||||
$pending_phrase = sprintf( __( '%s pending' ), number_format( $left ) );
|
|
||||||
if ( $left )
|
$this->comments_bubble( $post->ID, $pending_comments );
|
||||||
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>';
|
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -1965,7 +1943,7 @@ class WP_Comments_Table extends WP_List_Table {
|
|||||||
function prepare_items() {
|
function prepare_items() {
|
||||||
global $post_id, $comment_status, $mode;
|
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'];
|
$mode = ( empty( $_REQUEST['mode'] ) ) ? 'detail' : $_REQUEST['mode'];
|
||||||
|
|
||||||
@ -2338,19 +2316,7 @@ class WP_Comments_Table extends WP_List_Table {
|
|||||||
echo "<td $attributes>\n";
|
echo "<td $attributes>\n";
|
||||||
echo '<div class="response-links"><span class="post-com-count-wrapper">';
|
echo '<div class="response-links"><span class="post-com-count-wrapper">';
|
||||||
echo $post_link . '<br />';
|
echo $post_link . '<br />';
|
||||||
$pending_phrase = esc_attr( sprintf( __( '%s pending' ), number_format( $pending_comments ) ) );
|
$this->comments_bubble( $post->ID, $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>';
|
|
||||||
echo '</span> ';
|
echo '</span> ';
|
||||||
echo "<a href='" . get_permalink( $post->ID ) . "'>#</a>";
|
echo "<a href='" . get_permalink( $post->ID ) . "'>#</a>";
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
@ -268,6 +268,33 @@ class WP_List_Table {
|
|||||||
<?php
|
<?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
|
* Get the current page number
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user