/modules/omnisearch/omnisearch-comments.php

  1. <?php 
  2.  
  3. if( ! class_exists( 'WP_Comments_List_Table' ) ) 
  4. require_once( ABSPATH . 'wp-admin/includes/class-wp-comments-list-table.php' ); 
  5.  
  6. class Jetpack_Omnisearch_Comments extends WP_Comments_List_Table { 
  7. static $instance; 
  8. public $checkbox = false; 
  9.  
  10. function __construct() { 
  11. self::$instance = $this; 
  12. add_filter( 'omnisearch_results', array( $this, 'search'), 10, 2 ); 
  13.  
  14. function search( $results, $search_term ) { 
  15. $search_url = esc_url( admin_url( sprintf( 'edit-comments.php?s=%s', urlencode( $search_term ) ) ) ); 
  16. $search_link = sprintf( ' <a href="%s" class="add-new-h2">%s</a>', $search_url, esc_html__('Search Comments', 'jetpack') ); 
  17. $html = '<h2>' . esc_html__('Comments', 'jetpack') . $search_link . '</h2>'; 
  18. parent::__construct(); 
  19.  
  20. ob_start(); 
  21. $this->prepare_items(); 
  22. $this->_column_headers = array( $this->get_columns(), array(), array() ); 
  23. $this->display(); 
  24. $html .= ob_get_clean(); 
  25.  
  26. $label = __( 'Comments', 'jetpack' ); 
  27. $results[ $label ] = $html; 
  28. return $results; 
  29.  
  30. function get_per_page( $comment_status = 'all' ) { 
  31. /** This action is documented in modules/omnisearch/omnisearch-core.php */ 
  32. return apply_filters( 'omnisearch_num_results', 5 ); 
  33.  
  34. function get_sortable_columns() { 
  35. return array(); 
  36.  
  37. function get_bulk_actions() { 
  38. return array(); 
  39.  
  40. function pagination( $which ) {} 
  41.  
  42. function extra_tablenav( $which ) {} 
.