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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. * @access private
  14. *
  15. * @see WP_Comments_List_Table
  16. */
  17. class WP_Post_Comments_List_Table extends WP_Comments_List_Table {
  18. /**
  19. * @return array
  20. */
  21. protected function get_column_info() {
  22. return array(
  23. array(
  24. 'author' => __( 'Author' ),
  25. 'comment' => _x( 'Comment', 'column name' ),
  26. ),
  27. array(),
  28. array(),
  29. 'comment',
  30. );
  31. }
  32. /**
  33. * @return array
  34. */
  35. protected function get_table_classes() {
  36. $classes = parent::get_table_classes();
  37. $classes[] = 'wp-list-table';
  38. $classes[] = 'comments-box';
  39. return $classes;
  40. }
  41. /**
  42. * @param bool $output_empty
  43. */
  44. public function display( $output_empty = false ) {
  45. $singular = $this->_args['singular'];
  46. wp_nonce_field( 'fetch-list-' . get_class( $this ), '_ajax_fetch_list_nonce' );
  47. ?>
  48. <table class="<?php echo implode( ' ', $this->get_table_classes() ); ?>" style="display:none;">
  49. <tbody id="the-comment-list"
  50. <?php
  51. if ( $singular ) {
  52. echo " data-wp-lists='list:$singular'";
  53. }
  54. ?>
  55. >
  56. <?php
  57. if ( ! $output_empty ) {
  58. $this->display_rows_or_placeholder();
  59. }
  60. ?>
  61. </tbody>
  62. </table>
  63. <?php
  64. }
  65. /**
  66. * @param bool $comment_status
  67. * @return int
  68. */
  69. public function get_per_page( $comment_status = false ) {
  70. return 10;
  71. }
  72. }