X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/f9001779751f83dc8a10e478bfecb4d8dd5f964c..61343b82c4f0da4c68e4c6373daafff4a81efdd1:/wp-admin/includes/class-wp-comments-list-table.php
diff --git a/wp-admin/includes/class-wp-comments-list-table.php b/wp-admin/includes/class-wp-comments-list-table.php
index 90c158fe..23f3169d 100644
--- a/wp-admin/includes/class-wp-comments-list-table.php
+++ b/wp-admin/includes/class-wp-comments-list-table.php
@@ -21,7 +21,7 @@ class WP_Comments_List_Table extends WP_List_Table {
var $pending_count = array();
- function WP_Comments_List_Table() {
+ function __construct( $args = array() ) {
global $post_id;
$post_id = isset( $_REQUEST['p'] ) ? absint( $_REQUEST['p'] ) : 0;
@@ -29,10 +29,11 @@ class WP_Comments_List_Table extends WP_List_Table {
if ( get_option('show_avatars') )
add_filter( 'comment_author', 'floated_admin_avatar' );
- parent::WP_List_Table( array(
+ parent::__construct( array(
'plural' => 'comments',
'singular' => 'comment',
'ajax' => true,
+ 'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
) );
}
@@ -81,7 +82,8 @@ class WP_Comments_List_Table extends WP_List_Table {
$status_map = array(
'moderated' => 'hold',
- 'approved' => 'approve'
+ 'approved' => 'approve',
+ 'all' => '',
);
$args = array(
@@ -110,6 +112,8 @@ class WP_Comments_List_Table extends WP_List_Table {
$_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(
@@ -128,13 +132,13 @@ class WP_Comments_List_Table extends WP_List_Table {
global $comment_status;
if ( 'moderated' == $comment_status )
- _e( 'No comments awaiting moderation… yet.' );
+ _e( 'No comments awaiting moderation.' );
else
_e( 'No comments found.' );
}
function get_views() {
- global $post_id, $comment_status;
+ global $post_id, $comment_status, $comment_type;
$status_links = array();
$num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments();
@@ -166,7 +170,7 @@ class WP_Comments_List_Table extends WP_List_Table {
/*
// 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'] ) )
- $link = add_query_arg( 's', esc_attr( stripslashes( $_REQUEST['s'] ) ), $link );
+ $link = add_query_arg( 's', esc_attr( wp_unslash( $_REQUEST['s'] ) ), $link );
*/
$status_links[$status] = "" . sprintf(
translate_nooped_plural( $label, $num_comments->$status ),
@@ -184,7 +188,7 @@ class WP_Comments_List_Table extends WP_List_Table {
$actions = array();
if ( in_array( $comment_status, array( 'all', 'approved' ) ) )
$actions['unapprove'] = __( 'Unapprove' );
- if ( in_array( $comment_status, array( 'all', 'moderated', 'spam' ) ) )
+ if ( in_array( $comment_status, array( 'all', 'moderated' ) ) )
$actions['approve'] = __( 'Approve' );
if ( in_array( $comment_status, array( 'all', 'moderated', 'approved' ) ) )
$actions['spam'] = _x( 'Mark as Spam', 'comment' );
@@ -222,13 +226,14 @@ class WP_Comments_List_Table extends WP_List_Table {
?>
'post-query-submit' ) );
+ do_action( 'restrict_manage_comments' );
+ submit_button( __( 'Filter' ), 'button', false, false, array( 'id' => 'post-query-submit' ) );
}
if ( ( 'spam' == $comment_status || 'trash' == $comment_status ) && current_user_can( 'moderate_comments' ) ) {
wp_nonce_field( 'bulk-destroy', '_destroy_nonce' );
$title = ( 'spam' == $comment_status ) ? esc_attr__( 'Empty Spam' ) : esc_attr__( 'Empty Trash' );
- submit_button( $title, 'button-secondary apply', 'delete_all', false );
+ submit_button( $title, 'apply', 'delete_all', false );
}
do_action( 'manage_comments_nav', $comment_status );
echo '';
@@ -286,11 +291,11 @@ class WP_Comments_List_Table extends WP_List_Table {
-
+
display_rows_or_placeholder(); ?>
-
+
items = $this->extra_items; $this->display_rows(); ?>
@@ -300,37 +305,36 @@ class WP_Comments_List_Table extends WP_List_Table {
}
function single_row( $a_comment ) {
- global $post, $comment, $the_comment_status;
+ global $post, $comment;
$comment = $a_comment;
- $the_comment_status = wp_get_comment_status( $comment->comment_ID );
+ $the_comment_class = join( ' ', get_comment_class( wp_get_comment_status( $comment->comment_ID ) ) );
$post = get_post( $comment->comment_post_ID );
$this->user_can = current_user_can( 'edit_comment', $comment->comment_ID );
- echo "";
- echo $this->single_row_columns( $comment );
- echo " ";
+ echo "";
+ $this->single_row_columns( $comment );
+ echo " \n";
}
function column_cb( $comment ) {
- if ( $this->user_can )
- echo "";
+ if ( $this->user_can ) { ?>
+
+
+ user_can;
$comment_url = esc_url( get_comment_link( $comment->comment_ID ) );
-
- $ptime = date( 'G', strtotime( $comment->comment_date ) );
- if ( ( abs( time() - $ptime ) ) < 86400 )
- $ptime = sprintf( __( '%s ago' ), human_time_diff( $ptime ) );
- else
- $ptime = mysql2date( __( 'Y/m/d \a\t g:i A' ), $comment->comment_date );
+ $the_comment_status = wp_get_comment_status( $comment->comment_ID );
if ( $user_can ) {
$del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) );
@@ -350,8 +354,10 @@ class WP_Comments_List_Table extends WP_List_Table {
echo '
';
if ( !empty( $author_url ) )
@@ -474,7 +479,7 @@ class WP_Comments_List_Table extends WP_List_Table {
}
function column_response( $comment ) {
- global $post;
+ $post = get_post();
if ( isset( $this->pending_count[$post->ID] ) ) {
$pending_comments = $this->pending_count[$post->ID];
@@ -494,7 +499,8 @@ class WP_Comments_List_Table extends WP_List_Table {
echo $post_link . '
';
$this->comments_bubble( $post->ID, $pending_comments );
echo ' ';
- echo "#";
+ $post_type_object = get_post_type_object( $post->post_type );
+ echo "" . $post_type_object->labels->view_item . '';
echo '