MS_View_Welcome

Renders the Welcome Page.

Defined (1)

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

/app/view/class-ms-view-welcome.php  
  1. class MS_View_Welcome extends MS_View { 
  2.  
  3. /** 
  4. * Overrides parent's to_html() method. 
  5. * Creates an output buffer, outputs the HTML and grabs the buffer content before releasing it. 
  6. * Creates a wrapper 'ms-wrap' HTML element to contain content and navigation. The content inside 
  7. * the navigation gets loaded with dynamic method calls. 
  8. * e.g. if key is 'settings' then render_settings() gets called, if 'bob' then render_bob(). 
  9. * @since 1.0.0 
  10. * @api 
  11. * @return string 
  12. */ 
  13. public function to_html() { 
  14. $form_fields = $this->prepare_fields(); 
  15. $setup_url = MS_Controller_Plugin::get_admin_url( 'setup' ); 
  16.  
  17. ob_start(); 
  18. // Render tabbed interface. 
  19. ?> 
  20. <div class="ms-wrap wrap"> 
  21. <form class="ms-welcome-box" action="<?php echo esc_url( $setup_url ); ?>" method="POST"> 
  22. <h2 class="ms-welcome-title"> 
  23. <?php _e( 'Welcome!', 'membership2' ); ?> 
  24. </h2> 
  25.  
  26. <div class="ms-welcome-text"> 
  27. <?php _e( 'Hello and welcome to <strong>Membership2</strong> by WPMU DEV. Please follow this simple set-up<br />wizard to help us determine the settings that are most relevant to your needs. Don\'t worry, you<br />can always change these settings in the future.', 'membership2' ); ?> 
  28. </div> 
  29.  
  30. <div class="ms-welcome-image-box"> 
  31. <img src="<?php echo esc_attr( MS_Plugin::instance()->url ); ?>app/assets/images/welcome.png" class="ms-welcome-image" /> 
  32. </div> 
  33.  
  34. <?php 
  35. foreach ( $form_fields as $field ) { 
  36. MS_Helper_Html::html_element( $field ); 
  37. ?> 
  38. </form> 
  39. </div> 
  40. <?php 
  41. return ob_get_clean(); 
  42.  
  43. /** 
  44. * Returns an array of form fields 
  45. * @since 1.0.0 
  46. * @internal 
  47. * @return array 
  48. */ 
  49. protected function prepare_fields() { 
  50. $fields = array(); 
  51.  
  52. $action = MS_Controller_Membership::STEP_ADD_NEW; 
  53. $nonce = wp_create_nonce( $action ); 
  54.  
  55. $fields['step'] = array( 
  56. 'id' => 'step',  
  57. 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN,  
  58. 'value' => MS_Controller_Membership::STEP_ADD_NEW,  
  59. ); 
  60. $fields['button'] = array( 
  61. 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT,  
  62. 'value' => __( 'Let\'s get started', 'membership2' ) . ' »',  
  63. 'class' => 'ms-welcome-start',  
  64. ); 
  65.  
  66. return $fields;