PageRenderTime 67ms CodeModel.GetById 38ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-admin/includes/class-wp-comments-list-table.php

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