Wordpress 3.5
[autoinstalls/wordpress.git] / wp-admin / includes / class-wp-comments-list-table.php
1 <?php
2 /**
3  * Comments and Post Comments List Table classes.
4  *
5  * @package WordPress
6  * @subpackage List_Table
7  * @since 3.1.0
8  */
9
10 /**
11  * Comments List Table class.
12  *
13  * @package WordPress
14  * @subpackage List_Table
15  * @since 3.1.0
16  * @access private
17  */
18 class WP_Comments_List_Table extends WP_List_Table {
19
20         var $checkbox = true;
21
22         var $pending_count = array();
23
24         function __construct( $args = array() ) {
25                 global $post_id;
26
27                 $post_id = isset( $_REQUEST['p'] ) ? absint( $_REQUEST['p'] ) : 0;
28
29                 if ( get_option('show_avatars') )
30                         add_filter( 'comment_author', 'floated_admin_avatar' );
31
32                 parent::__construct( array(
33                         'plural' => 'comments',
34                         'singular' => 'comment',
35                         'ajax' => true,
36                         'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
37                 ) );
38         }
39
40         function ajax_user_can() {
41                 return current_user_can('edit_posts');
42         }
43
44         function prepare_items() {
45                 global $post_id, $comment_status, $search, $comment_type;
46
47                 $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all';
48                 if ( !in_array( $comment_status, array( 'all', 'moderated', 'approved', 'spam', 'trash' ) ) )
49                         $comment_status = 'all';
50
51                 $comment_type = !empty( $_REQUEST['comment_type'] ) ? $_REQUEST['comment_type'] : '';
52
53                 $search = ( isset( $_REQUEST['s'] ) ) ? $_REQUEST['s'] : '';
54
55                 $user_id = ( isset( $_REQUEST['user_id'] ) ) ? $_REQUEST['user_id'] : '';
56
57                 $orderby = ( isset( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : '';
58                 $order = ( isset( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : '';
59
60                 $comments_per_page = $this->get_per_page( $comment_status );
61
62                 $doing_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
63
64                 if ( isset( $_REQUEST['number'] ) ) {
65                         $number = (int) $_REQUEST['number'];
66                 }
67                 else {
68                         $number = $comments_per_page + min( 8, $comments_per_page ); // Grab a few extra
69                 }
70
71                 $page = $this->get_pagenum();
72
73                 if ( isset( $_REQUEST['start'] ) ) {
74                         $start = $_REQUEST['start'];
75                 } else {
76                         $start = ( $page - 1 ) * $comments_per_page;
77                 }
78
79                 if ( $doing_ajax && isset( $_REQUEST['offset'] ) ) {
80                         $start += $_REQUEST['offset'];
81                 }
82
83                 $status_map = array(
84                         'moderated' => 'hold',
85                         'approved' => 'approve',
86                         'all' => '',
87                 );
88
89                 $args = array(
90                         'status' => isset( $status_map[$comment_status] ) ? $status_map[$comment_status] : $comment_status,
91                         'search' => $search,
92                         'user_id' => $user_id,
93                         'offset' => $start,
94                         'number' => $number,
95                         'post_id' => $post_id,
96                         'type' => $comment_type,
97                         'orderby' => $orderby,
98                         'order' => $order,
99                 );
100
101                 $_comments = get_comments( $args );
102
103                 update_comment_cache( $_comments );
104
105                 $this->items = array_slice( $_comments, 0, $comments_per_page );
106                 $this->extra_items = array_slice( $_comments, $comments_per_page );
107
108                 $total_comments = get_comments( array_merge( $args, array('count' => true, 'offset' => 0, 'number' => 0) ) );
109
110                 $_comment_post_ids = array();
111                 foreach ( $_comments as $_c ) {
112                         $_comment_post_ids[] = $_c->comment_post_ID;
113                 }
114
115                 $_comment_post_ids = array_unique( $_comment_post_ids );
116
117                 $this->pending_count = get_pending_comments_num( $_comment_post_ids );
118
119                 $this->set_pagination_args( array(
120                         'total_items' => $total_comments,
121                         'per_page' => $comments_per_page,
122                 ) );
123         }
124
125         function get_per_page( $comment_status = 'all' ) {
126                 $comments_per_page = $this->get_items_per_page( 'edit_comments_per_page' );
127                 $comments_per_page = apply_filters( 'comments_per_page', $comments_per_page, $comment_status );
128                 return $comments_per_page;
129         }
130
131         function no_items() {
132                 global $comment_status;
133
134                 if ( 'moderated' == $comment_status )
135                         _e( 'No comments awaiting moderation.' );
136                 else
137                         _e( 'No comments found.' );
138         }
139
140         function get_views() {
141                 global $post_id, $comment_status, $comment_type;
142
143                 $status_links = array();
144                 $num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments();
145                 //, number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"),
146                 //, number_format_i18n($num_comments->spam) ), "<span class='spam-comment-count'>" . number_format_i18n($num_comments->spam) . "</span>")
147                 $stati = array(
148                                 'all' => _nx_noop('All', 'All', 'comments'), // singular not used
149                                 'moderated' => _n_noop('Pending <span class="count">(<span class="pending-count">%s</span>)</span>', 'Pending <span class="count">(<span class="pending-count">%s</span>)</span>'),
150                                 'approved' => _n_noop('Approved', 'Approved'), // singular not used
151                                 'spam' => _n_noop('Spam <span class="count">(<span class="spam-count">%s</span>)</span>', 'Spam <span class="count">(<span class="spam-count">%s</span>)</span>'),
152                                 'trash' => _n_noop('Trash <span class="count">(<span class="trash-count">%s</span>)</span>', 'Trash <span class="count">(<span class="trash-count">%s</span>)</span>')
153                         );
154
155                 if ( !EMPTY_TRASH_DAYS )
156                         unset($stati['trash']);
157
158                 $link = 'edit-comments.php';
159                 if ( !empty($comment_type) && 'all' != $comment_type )
160                         $link = add_query_arg( 'comment_type', $comment_type, $link );
161
162                 foreach ( $stati as $status => $label ) {
163                         $class = ( $status == $comment_status ) ? ' class="current"' : '';
164
165                         if ( !isset( $num_comments->$status ) )
166                                 $num_comments->$status = 10;
167                         $link = add_query_arg( 'comment_status', $status, $link );
168                         if ( $post_id )
169                                 $link = add_query_arg( 'p', absint( $post_id ), $link );
170                         /*
171                         // I toyed with this, but decided against it. Leaving it in here in case anyone thinks it is a good idea. ~ Mark
172                         if ( !empty( $_REQUEST['s'] ) )
173                                 $link = add_query_arg( 's', esc_attr( stripslashes( $_REQUEST['s'] ) ), $link );
174                         */
175                         $status_links[$status] = "<a href='$link'$class>" . sprintf(
176                                 translate_nooped_plural( $label, $num_comments->$status ),
177                                 number_format_i18n( $num_comments->$status )
178                         ) . '</a>';
179                 }
180
181                 $status_links = apply_filters( 'comment_status_links', $status_links );
182                 return $status_links;
183         }
184
185         function get_bulk_actions() {
186                 global $comment_status;
187
188                 $actions = array();
189                 if ( in_array( $comment_status, array( 'all', 'approved' ) ) )
190                         $actions['unapprove'] = __( 'Unapprove' );
191                 if ( in_array( $comment_status, array( 'all', 'moderated' ) ) )
192                         $actions['approve'] = __( 'Approve' );
193                 if ( in_array( $comment_status, array( 'all', 'moderated', 'approved' ) ) )
194                         $actions['spam'] = _x( 'Mark as Spam', 'comment' );
195
196                 if ( 'trash' == $comment_status )
197                         $actions['untrash'] = __( 'Restore' );
198                 elseif ( 'spam' == $comment_status )
199                         $actions['unspam'] = _x( 'Not Spam', 'comment' );
200
201                 if ( in_array( $comment_status, array( 'trash', 'spam' ) ) || !EMPTY_TRASH_DAYS )
202                         $actions['delete'] = __( 'Delete Permanently' );
203                 else
204                         $actions['trash'] = __( 'Move to Trash' );
205
206                 return $actions;
207         }
208
209         function extra_tablenav( $which ) {
210                 global $comment_status, $comment_type;
211 ?>
212                 <div class="alignleft actions">
213 <?php
214                 if ( 'top' == $which ) {
215 ?>
216                         <select name="comment_type">
217                                 <option value=""><?php _e( 'Show all comment types' ); ?></option>
218 <?php
219                                 $comment_types = apply_filters( 'admin_comment_types_dropdown', array(
220                                         'comment' => __( 'Comments' ),
221                                         'pings' => __( 'Pings' ),
222                                 ) );
223
224                                 foreach ( $comment_types as $type => $label )
225                                         echo "\t<option value='" . esc_attr( $type ) . "'" . selected( $comment_type, $type, false ) . ">$label</option>\n";
226                         ?>
227                         </select>
228 <?php
229                         do_action( 'restrict_manage_comments' );
230                         submit_button( __( 'Filter' ), 'button', false, false, array( 'id' => 'post-query-submit' ) );
231                 }
232
233                 if ( ( 'spam' == $comment_status || 'trash' == $comment_status ) && current_user_can( 'moderate_comments' ) ) {
234                         wp_nonce_field( 'bulk-destroy', '_destroy_nonce' );
235                         $title = ( 'spam' == $comment_status ) ? esc_attr__( 'Empty Spam' ) : esc_attr__( 'Empty Trash' );
236                         submit_button( $title, 'apply', 'delete_all', false );
237                 }
238                 do_action( 'manage_comments_nav', $comment_status );
239                 echo '</div>';
240         }
241
242         function current_action() {
243                 if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) )
244                         return 'delete_all';
245
246                 return parent::current_action();
247         }
248
249         function get_columns() {
250                 global $post_id;
251
252                 $columns = array();
253
254                 if ( $this->checkbox )
255                         $columns['cb'] = '<input type="checkbox" />';
256
257                 $columns['author'] = __( 'Author' );
258                 $columns['comment'] = _x( 'Comment', 'column name' );
259
260                 if ( !$post_id )
261                         $columns['response'] = _x( 'In Response To', 'column name' );
262
263                 return $columns;
264         }
265
266         function get_sortable_columns() {
267                 return array(
268                         'author'   => 'comment_author',
269                         'response' => 'comment_post_ID'
270                 );
271         }
272
273         function display() {
274                 extract( $this->_args );
275
276                 wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
277
278                 $this->display_tablenav( 'top' );
279
280 ?>
281 <table class="<?php echo implode( ' ', $this->get_table_classes() ); ?>" cellspacing="0">
282         <thead>
283         <tr>
284                 <?php $this->print_column_headers(); ?>
285         </tr>
286         </thead>
287
288         <tfoot>
289         <tr>
290                 <?php $this->print_column_headers( false ); ?>
291         </tr>
292         </tfoot>
293
294         <tbody id="the-comment-list" data-wp-lists="list:comment">
295                 <?php $this->display_rows_or_placeholder(); ?>
296         </tbody>
297
298         <tbody id="the-extra-comment-list" data-wp-lists="list:comment" style="display: none;">
299                 <?php $this->items = $this->extra_items; $this->display_rows(); ?>
300         </tbody>
301 </table>
302 <?php
303
304                 $this->display_tablenav( 'bottom' );
305         }
306
307         function single_row( $a_comment ) {
308                 global $post, $comment;
309
310                 $comment = $a_comment;
311                 $the_comment_class = join( ' ', get_comment_class( wp_get_comment_status( $comment->comment_ID ) ) );
312
313                 $post = get_post( $comment->comment_post_ID );
314
315                 $this->user_can = current_user_can( 'edit_comment', $comment->comment_ID );
316
317                 echo "<tr id='comment-$comment->comment_ID' class='$the_comment_class'>";
318                 echo $this->single_row_columns( $comment );
319                 echo "</tr>\n";
320         }
321
322         function column_cb( $comment ) {
323                 if ( $this->user_can ) { ?>
324                 <label class="screen-reader-text" for="cb-select-<?php echo $comment->comment_ID; ?>"><?php _e( 'Select comment' ); ?></label>
325                 <input id="cb-select-<?php echo $comment->comment_ID; ?>" type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" />
326                 <?php
327                 }
328         }
329
330         function column_comment( $comment ) {
331                 global $comment_status;
332                 $post = get_post();
333
334                 $user_can = $this->user_can;
335
336                 $comment_url = esc_url( get_comment_link( $comment->comment_ID ) );
337                 $the_comment_status = wp_get_comment_status( $comment->comment_ID );
338
339                 $ptime = date( 'G', strtotime( $comment->comment_date ) );
340                 if ( ( abs( time() - $ptime ) ) < DAY_IN_SECONDS )
341                         $ptime = sprintf( __( '%s ago' ), human_time_diff( $ptime ) );
342                 else
343                         $ptime = mysql2date( __( 'Y/m/d \a\t g:i A' ), $comment->comment_date );
344
345                 if ( $user_can ) {
346                         $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) );
347                         $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) );
348
349                         $url = "comment.php?c=$comment->comment_ID";
350
351                         $approve_url = esc_url( $url . "&action=approvecomment&$approve_nonce" );
352                         $unapprove_url = esc_url( $url . "&action=unapprovecomment&$approve_nonce" );
353                         $spam_url = esc_url( $url . "&action=spamcomment&$del_nonce" );
354                         $unspam_url = esc_url( $url . "&action=unspamcomment&$del_nonce" );
355                         $trash_url = esc_url( $url . "&action=trashcomment&$del_nonce" );
356                         $untrash_url = esc_url( $url . "&action=untrashcomment&$del_nonce" );
357                         $delete_url = esc_url( $url . "&action=deletecomment&$del_nonce" );
358                 }
359
360                 echo '<div class="submitted-on">';
361                 /* translators: 2: comment date, 3: comment time */
362                 printf( __( 'Submitted on <a href="%1$s">%2$s at %3$s</a>' ), $comment_url,
363                         /* translators: comment date format. See http://php.net/date */ get_comment_date( __( 'Y/m/d' ) ),
364                         /* translators: comment time format. See http://php.net/date */ get_comment_date( get_option( 'time_format' ) ) );
365
366                 if ( $comment->comment_parent ) {
367                         $parent = get_comment( $comment->comment_parent );
368                         $parent_link = esc_url( get_comment_link( $comment->comment_parent ) );
369                         $name = get_comment_author( $parent->comment_ID );
370                         printf( ' | '.__( 'In reply to <a href="%1$s">%2$s</a>.' ), $parent_link, $name );
371                 }
372
373                 echo '</div>';
374                 comment_text();
375                 if ( $user_can ) { ?>
376                 <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden">
377                 <textarea class="comment" rows="1" cols="1"><?php echo esc_textarea( apply_filters( 'comment_edit_pre', $comment->comment_content ) ); ?></textarea>
378                 <div class="author-email"><?php echo esc_attr( $comment->comment_author_email ); ?></div>
379                 <div class="author"><?php echo esc_attr( $comment->comment_author ); ?></div>
380                 <div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div>
381                 <div class="comment_status"><?php echo $comment->comment_approved; ?></div>
382                 </div>
383                 <?php
384                 }
385
386                 if ( $user_can ) {
387                         // preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash
388                         $actions = array(
389                                 'approve' => '', 'unapprove' => '',
390                                 'reply' => '',
391                                 'quickedit' => '',
392                                 'edit' => '',
393                                 'spam' => '', 'unspam' => '',
394                                 'trash' => '', 'untrash' => '', 'delete' => ''
395                         );
396
397                         if ( $comment_status && 'all' != $comment_status ) { // not looking at all comments
398                                 if ( 'approved' == $the_comment_status )
399                                         $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=unapproved' class='vim-u vim-destructive' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
400                                 else if ( 'unapproved' == $the_comment_status )
401                                         $actions['approve'] = "<a href='$approve_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=approved' class='vim-a vim-destructive' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
402                         } else {
403                                 $actions['approve'] = "<a href='$approve_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' class='vim-a' title='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
404                                 $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' class='vim-u' title='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
405                         }
406
407                         if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) {
408                                 $actions['spam'] = "<a href='$spam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::spam=1' class='vim-s vim-destructive' title='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
409                         } elseif ( 'spam' == $the_comment_status ) {
410                                 $actions['unspam'] = "<a href='$unspam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:66cc66:unspam=1' class='vim-z vim-destructive'>" . _x( 'Not Spam', 'comment' ) . '</a>';
411                         } elseif ( 'trash' == $the_comment_status ) {
412                                 $actions['untrash'] = "<a href='$untrash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:66cc66:untrash=1' class='vim-z vim-destructive'>" . __( 'Restore' ) . '</a>';
413                         }
414
415                         if ( 'spam' == $the_comment_status || 'trash' == $the_comment_status || !EMPTY_TRASH_DAYS ) {
416                                 $actions['delete'] = "<a href='$delete_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::delete=1' class='delete vim-d vim-destructive'>" . __( 'Delete Permanently' ) . '</a>';
417                         } else {
418                                 $actions['trash'] = "<a href='$trash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' title='" . esc_attr__( 'Move this comment to the trash' ) . "'>" . _x( 'Trash', 'verb' ) . '</a>';
419                         }
420
421                         if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) {
422                                 $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . esc_attr__( 'Edit comment' ) . "'>". __( 'Edit' ) . '</a>';
423                                 $actions['quickedit'] = '<a onclick="commentReply.open( \''.$comment->comment_ID.'\',\''.$post->ID.'\',\'edit\' );return false;" class="vim-q" title="'.esc_attr__( 'Quick Edit' ).'" href="#">' . __( 'Quick&nbsp;Edit' ) . '</a>';
424                                 $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>';
425                         }
426
427                         $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment );
428
429                         $i = 0;
430                         echo '<div class="row-actions">';
431                         foreach ( $actions as $action => $link ) {
432                                 ++$i;
433                                 ( ( ( 'approve' == $action || 'unapprove' == $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
434
435                                 // Reply and quickedit need a hide-if-no-js span when not added with ajax
436                                 if ( ( 'reply' == $action || 'quickedit' == $action ) && ! defined('DOING_AJAX') )
437                                         $action .= ' hide-if-no-js';
438                                 elseif ( ( $action == 'untrash' && $the_comment_status == 'trash' ) || ( $action == 'unspam' && $the_comment_status == 'spam' ) ) {
439                                         if ( '1' == get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) )
440                                                 $action .= ' approve';
441                                         else
442                                                 $action .= ' unapprove';
443                                 }
444
445                                 echo "<span class='$action'>$sep$link</span>";
446                         }
447                         echo '</div>';
448                 }
449         }
450
451         function column_author( $comment ) {
452                 global $comment_status;
453
454                 $author_url = get_comment_author_url();
455                 if ( 'http://' == $author_url )
456                         $author_url = '';
457                 $author_url_display = preg_replace( '|http://(www\.)?|i', '', $author_url );
458                 if ( strlen( $author_url_display ) > 50 )
459                         $author_url_display = substr( $author_url_display, 0, 49 ) . '...';
460
461                 echo "<strong>"; comment_author(); echo '</strong><br />';
462                 if ( !empty( $author_url ) )
463                         echo "<a title='$author_url' href='$author_url'>$author_url_display</a><br />";
464
465                 if ( $this->user_can ) {
466                         if ( !empty( $comment->comment_author_email ) ) {
467                                 comment_author_email_link();
468                                 echo '<br />';
469                         }
470                         echo '<a href="edit-comments.php?s=';
471                         comment_author_IP();
472                         echo '&amp;mode=detail';
473                         if ( 'spam' == $comment_status )
474                                 echo '&amp;comment_status=spam';
475                         echo '">';
476                         comment_author_IP();
477                         echo '</a>';
478                 }
479         }
480
481         function column_date( $comment ) {
482                 return get_comment_date( __( 'Y/m/d \a\t g:ia' ) );
483         }
484
485         function column_response( $comment ) {
486                 $post = get_post();
487
488                 if ( isset( $this->pending_count[$post->ID] ) ) {
489                         $pending_comments = $this->pending_count[$post->ID];
490                 } else {
491                         $_pending_count_temp = get_pending_comments_num( array( $post->ID ) );
492                         $pending_comments = $this->pending_count[$post->ID] = $_pending_count_temp[$post->ID];
493                 }
494
495                 if ( current_user_can( 'edit_post', $post->ID ) ) {
496                         $post_link = "<a href='" . get_edit_post_link( $post->ID ) . "'>";
497                         $post_link .= get_the_title( $post->ID ) . '</a>';
498                 } else {
499                         $post_link = get_the_title( $post->ID );
500                 }
501
502                 echo '<div class="response-links"><span class="post-com-count-wrapper">';
503                 echo $post_link . '<br />';
504                 $this->comments_bubble( $post->ID, $pending_comments );
505                 echo '</span> ';
506                 $post_type_object = get_post_type_object( $post->post_type );
507                 echo "<a href='" . get_permalink( $post->ID ) . "'>" . $post_type_object->labels->view_item . '</a>';
508                 echo '</div>';
509                 if ( 'attachment' == $post->post_type && ( $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ) ) )
510                         echo $thumb;
511         }
512
513         function column_default( $comment, $column_name ) {
514                 do_action( 'manage_comments_custom_column', $column_name, $comment->comment_ID );
515         }
516 }
517
518 /**
519  * Post Comments List Table class.
520  *
521  * @package WordPress
522  * @subpackage List_Table
523  * @since 3.1.0
524  * @access private
525  *
526  * @see WP_Comments_Table
527  */
528 class WP_Post_Comments_List_Table extends WP_Comments_List_Table {
529
530         function get_column_info() {
531                 $this->_column_headers = array(
532                         array(
533                         'author'   => __( 'Author' ),
534                         'comment'  => _x( 'Comment', 'column name' ),
535                         ),
536                         array(),
537                         array(),
538                 );
539
540                 return $this->_column_headers;
541         }
542
543         function get_table_classes() {
544                 $classes = parent::get_table_classes();
545                 $classes[] = 'comments-box';
546                 return $classes;
547         }
548
549         function display( $output_empty = false ) {
550                 extract( $this->_args );
551
552                 wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
553 ?>
554 <table class="<?php echo implode( ' ', $this->get_table_classes() ); ?>" cellspacing="0" style="display:none;">
555         <tbody id="the-comment-list"<?php if ( $singular ) echo " data-wp-lists='list:$singular'"; ?>>
556                 <?php if ( ! $output_empty ) $this->display_rows_or_placeholder(); ?>
557         </tbody>
558 </table>
559 <?php
560         }
561
562         function get_per_page( $comment_status = false ) {
563                 return 10;
564         }
565 }