MS_Rule_Special

The Membership 2 MS Rule Special class.

Defined (1)

The class is defined in the following location(s).

/app/rule/special/class-ms-rule-special.php  
  1. class MS_Rule_Special extends MS_Controller { 
  2.  
  3. /** 
  4. * The rule ID. 
  5. * @type string 
  6. */ 
  7. const RULE_ID = 'special'; 
  8.  
  9. /** 
  10. * Setup the rule. 
  11. * @since 1.0.0 
  12. */ 
  13. public function prepare_obj() { 
  14. if ( MS_Rule_Special_Model::is_active() ) { 
  15. MS_Model_Rule::register_rule( 
  16. self::RULE_ID,  
  17. __CLASS__,  
  18. __( 'Special Pages', 'membership2' ),  
  19. 10 
  20. ); 
  21.  
  22. $this->add_filter( 
  23. 'ms_view_protectedcontent_define-' . self::RULE_ID,  
  24. 'handle_render_callback', 10, 2 
  25. ); 
  26.  
  27. $this->add_filter( 
  28. 'ms_rule_listtable-' . self::RULE_ID,  
  29. 'return_listtable' 
  30. ); 
  31.  
  32. /** 
  33. * Tells Membership2 Admin to display this form to manage this rule. 
  34. * @since 1.0.0 
  35. * @param array $callback (Invalid callback) 
  36. * @param array $data The data collection. 
  37. * @return array Correct callback. 
  38. */ 
  39. public function handle_render_callback( $callback, $data ) { 
  40. $view = MS_Factory::load( 'MS_Rule_Special_View' ); 
  41.  
  42. $view->data = $data; 
  43. $callback = array( $view, 'to_html' ); 
  44.  
  45. return $callback; 
  46.  
  47. /** 
  48. * Returns the ListTable object for this rule. 
  49. * @since 1.0.0 
  50. * @return MS_Helper_ListTable 
  51. */ 
  52. public function return_listtable( $empty ) { 
  53. $base = MS_Model_Membership::get_base(); 
  54. $rule = $base->get_rule( self::RULE_ID ); 
  55. return new MS_Rule_Special_ListTable( $rule ); 
  56.