/app/addon/bbpress/rule/class-ms-addon-bbpress-rule.php

  1. <?php 
  2.  
  3. class MS_Addon_Bbpress_Rule extends MS_Controller { 
  4.  
  5. /** 
  6. * The rule ID. 
  7. * 
  8. * @type string 
  9. */ 
  10. const RULE_ID = 'bbpress'; 
  11.  
  12. /** 
  13. * Setup the rule. 
  14. * 
  15. * @since 1.0.0 
  16. */ 
  17. public function prepare_obj() { 
  18. MS_Model_Rule::register_rule( 
  19. self::RULE_ID,  
  20. __CLASS__,  
  21. __( 'bbPress', 'membership2' ),  
  22. 100 
  23. ); 
  24.  
  25. $this->add_filter( 
  26. 'ms_view_protectedcontent_define-' . self::RULE_ID,  
  27. 'handle_render_callback', 10, 2 
  28. ); 
  29.  
  30. /** 
  31. * Tells Membership2 Admin to display this form to manage this rule. 
  32. * 
  33. * @since 1.0.0 
  34. * 
  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_Addon_Bbpress_Rule_View' ); 
  41.  
  42. $view->data = $data; 
  43. $callback = array( $view, 'to_html' ); 
  44.  
  45. return $callback; 
  46.  
.