class-wp-post-comments-list-table.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /**
  3. * List Table API: WP_Post_Comments_List_Table class
  4. *
  5. * @package WordPress
  6. * @subpackage Administration
  7. * @since 4.4.0
  8. */
  9. /**
  10. * Core class used to implement displaying post comments in a list table.
  11. *
  12. * @since 3.1.0
  13. *
  14. * @see WP_Comments_List_Table
  15. */
  16. class WP_Post_Comments_List_Table extends WP_Comments_List_Table {
  17. /**
  18. * @return array
  19. */
  20. protected function get_column_info() {
  21. return array(
  22. array(
  23. 'author' => __( 'Author' ),
  24. 'comment' => _x( 'Comment', 'column name' ),
  25. ),
  26. array(),
  27. array(),
  28. 'comment',
  29. );
  30. }
  31. /**
  32. * @return array
  33. */
  34. protected function get_table_classes() {
  35. $classes = parent::get_table_classes();
  36. $classes[] = 'wp-list-table';
  37. $classes[] = 'comments-box';
  38. return $classes;
  39. }
  40. /**
  41. * @param bool $output_empty
  42. */
  43. public function display( $output_empty = false ) {
  44. $singular = $this->_args['singular'];
  45. wp_nonce_field( 'fetch-list-' . get_class( $this ), '_ajax_fetch_list_nonce' );
  46. ?>
  47. <table class="<?php echo implode( ' ', $this->get_table_classes() ); ?>" style="display:none;">
  48. <tbody id="the-comment-list"
  49. <?php
  50. if ( $singular ) {
  51. echo " data-wp-lists='list:$singular'";
  52. }
  53. ?>
  54. >
  55. <?php
  56. if ( ! $output_empty ) {
  57. $this->display_rows_or_placeholder();
  58. }
  59. ?>
  60. </tbody>
  61. </table>
  62. <?php
  63. }
  64. /**
  65. * @param bool $comment_status
  66. * @return int
  67. */
  68. public function get_per_page( $comment_status = false ) {
  69. return 10;
  70. }
  71. }