/app/rule/url/class-ms-rule-url-listtable.php

  1. <?php 
  2. /** 
  3. * Membership List Table 
  4. * 
  5. * @since 1.0.0 
  6. */ 
  7. class MS_Rule_Url_ListTable extends MS_Helper_ListTable_Rule { 
  8.  
  9. protected $id = MS_Rule_Url::RULE_ID; 
  10.  
  11. public function __construct( $model ) { 
  12. parent::__construct( $model ); 
  13. $this->name['singular'] = __( 'URL', 'membership2' ); 
  14. $this->name['plural'] = __( 'URLs', 'membership2' ); 
  15. $this->name['default_access'] = __( 'Nobody', 'membership2' ); 
  16.  
  17. public function get_columns() { 
  18. return apply_filters( 
  19. 'membership_helper_listtable_' . $this->id . '_columns',  
  20. array( 
  21. 'cb' => true,  
  22. 'url' => __( 'Page URL', 'membership2' ),  
  23. 'access' => true,  
  24. ); 
  25.  
  26. public function column_url( $item ) { 
  27. $rule_url = esc_url_raw( 
  28. add_query_arg( array( 'item' => $item->id ) ) 
  29. ); 
  30.  
  31. $actions = array(); 
  32.  
  33. if ( $this->list_shows_base_items() ) { 
  34. $trash_url = esc_url_raw( 
  35. add_query_arg( 
  36. array( 
  37. 'rule_action' => MS_Rule_Url::ACTION_DELETE,  
  38. '_wpnonce' => wp_create_nonce( MS_Rule_Url::ACTION_DELETE ),  
  39. ),  
  40. $rule_url 
  41. ); 
  42.  
  43. $actions['trash'] = sprintf( 
  44. '<a href="%s">%s</a>',  
  45. $trash_url,  
  46. __( 'Delete', 'membership2' ) 
  47. ); 
  48.  
  49. $actions = apply_filters( 
  50. 'ms_rule_' . $this->id . '_column_actions',  
  51. $actions,  
  52. $item 
  53. ); 
  54.  
  55. return sprintf( 
  56. '%1$s %2$s',  
  57. $item->url,  
  58. $this->row_actions( $actions ) 
  59. ); 
  60.  
  61. /** 
  62. * Remove the view-filters for this rule. 
  63. * 
  64. * @since 1.0.0 
  65. */ 
  66. public function get_views() { 
  67. return array(); 
  68.  
  69. /** 
  70. * Remove the list-header (with the rule title) for this rule 
  71. * 
  72. * @since 1.0.0 
  73. */ 
  74. public function list_head() { 
  75.  
.