MS_Addon_Redirect_View

The Settings-Form.

Defined (1)

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

/app/addon/redirect/class-ms-addon-redirect-view.php  
  1. class MS_Addon_Redirect_View extends MS_View { 
  2.  
  3. public function render_tab() { 
  4. $fields = $this->prepare_fields(); 
  5. ob_start(); 
  6. ?> 
  7. <div class="ms-addon-wrap"> 
  8. <?php 
  9. MS_Helper_Html::settings_tab_header( 
  10. array( 
  11. 'title' => __( 'Redirect Settings', 'membership2' ),  
  12. 'desc' => array( 
  13. __( 'Specify your custom URLs here. You can use either an absolute URL (starting with "http://") or an site-relative path (like "/some-page/")', 'membership2' ),  
  14. sprintf( 
  15. __( 'The URLs you specify here can always be overwritten in the %slogin shortcode%s using the redirect-attributes. Example: <code>[%s redirect_login="/welcome/" redirect_logout="/good-bye/"]</code>.', 'membership2' ),  
  16. sprintf( 
  17. '<a href="%s#ms-membership-login" target="_blank">',  
  18. MS_Controller_Plugin::get_admin_url( 
  19. 'help',  
  20. array( 'tab' => 'shortcodes' ) 
  21. ),  
  22. '</a>',  
  23. MS_Helper_Shortcode::SCODE_LOGIN 
  24. ),  
  25. ),  
  26. ); 
  27.  
  28. foreach ( $fields as $field ) { 
  29. MS_Helper_Html::html_element( $field ); 
  30. ?> 
  31. </div> 
  32. <?php 
  33. $html = ob_get_clean(); 
  34. echo $html; 
  35.  
  36. public function prepare_fields() { 
  37. $model = MS_Addon_Redirect::model(); 
  38.  
  39. $action = MS_Addon_Redirect::AJAX_SAVE_SETTING; 
  40.  
  41. $fields = array( 
  42. 'redirect_login' => array( 
  43. 'id' => 'redirect_login',  
  44. 'type' => MS_Helper_Html::INPUT_TYPE_TEXT,  
  45. 'title' => __( 'After Login', 'membership2' ),  
  46. 'desc' => __( 'This page is displayed to users right after login.', 'membership2' ),  
  47. 'placeholder' => MS_Model_Pages::get_url_after_login( false ),  
  48. 'value' => $model->get( 'redirect_login' ),  
  49. 'class' => 'ms-text-large',  
  50. 'ajax_data' => array( 
  51. 'field' => 'redirect_login',  
  52. 'action' => $action,  
  53. ),  
  54. ),  
  55.  
  56. 'redirect_logout' => array( 
  57. 'id' => 'redirect_logout',  
  58. 'type' => MS_Helper_Html::INPUT_TYPE_TEXT,  
  59. 'title' => __( 'After Logout', 'membership2' ),  
  60. 'desc' => __( 'This page is displayed to users right after they did log out.', 'membership2' ),  
  61. 'placeholder' => MS_Model_Pages::get_url_after_logout( false ),  
  62. 'value' => $model->get( 'redirect_logout' ),  
  63. 'class' => 'ms-text-large',  
  64. 'ajax_data' => array( 
  65. 'field' => 'redirect_logout',  
  66. 'action' => $action,  
  67. ),  
  68. ),  
  69. ); 
  70.  
  71. return $fields;