MS_View_Membership_PaymentSetup

Payment Setup page (only used when creating a new membership).

Defined (1)

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

/app/view/membership/class-ms-view-membership-paymentsetup.php  
  1. class MS_View_Membership_PaymentSetup extends MS_View { 
  2.  
  3. /** 
  4. * Create view output. 
  5. * @since 1.0.0 
  6. * @return string 
  7. */ 
  8. public function to_html() { 
  9. $fields = $this->get_fields(); 
  10. $wrapper_class = $this->data['is_global_payments_set'] ? '' : 'wide'; 
  11.  
  12. ob_start(); 
  13. ?> 
  14.  
  15. <div class="wrap ms-wrap"> 
  16. <?php 
  17. MS_Helper_Html::settings_header( 
  18. array( 
  19. 'title' => __( 'Payment', 'membership2' ),  
  20. 'title_icon_class' => 'wpmui-fa wpmui-fa-money',  
  21. 'desc' => __( 'Set up your payment gateways and Membership Price' ),  
  22. ); 
  23. ?> 
  24. <div class="ms-settings ms-wrapper-center ms-membership-payment cf <?php echo esc_attr( $wrapper_class ); ?>"> 
  25. <?php 
  26. $this->global_payment_settings(); 
  27. $this->specific_payment_settings(); 
  28.  
  29. MS_Helper_Html::settings_footer( 
  30. $this->fields['control_fields'],  
  31. $this->data['show_next_button'] 
  32. ); 
  33. ?> 
  34. </div> 
  35. </div> 
  36.  
  37. <?php 
  38. $html = ob_get_clean(); 
  39.  
  40. echo $html; 
  41.  
  42. private function get_fields() { 
  43. $membership = $this->data['membership']; 
  44.  
  45. $action = MS_Controller_Membership::AJAX_ACTION_UPDATE_MEMBERSHIP; 
  46. $nonce = wp_create_nonce( $action ); 
  47.  
  48. $fields = array( 
  49. 'control_fields' => array( 
  50. 'membership_id' => array( 
  51. 'id' => 'membership_id',  
  52. 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN,  
  53. 'value' => $membership->id,  
  54. ),  
  55. 'step' => array( 
  56. 'id' => 'step',  
  57. 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN,  
  58. 'value' => $this->data['step'],  
  59. ),  
  60. 'action' => array( 
  61. 'id' => 'action',  
  62. 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN,  
  63. 'value' => $this->data['action'],  
  64. ),  
  65. '_wpnonce' => array( 
  66. 'id' => '_wpnonce',  
  67. 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN,  
  68. 'value' => wp_create_nonce( $this->data['action'] ),  
  69. ),  
  70. ),  
  71. ); 
  72.  
  73. return apply_filters( 
  74. 'ms_view_membership_payment_get_fields',  
  75. $fields 
  76. ); 
  77.  
  78. /** 
  79. * Render the Payment settings the first time the user creates a membership. 
  80. * After the user set up a payment gateway these options are not displayed 
  81. * anymore 
  82. * @since 1.0.0 
  83. */ 
  84. public function global_payment_settings() { 
  85. if ( $this->data['is_global_payments_set'] ) { 
  86. return; 
  87.  
  88. $view = MS_Factory::create( 'MS_View_Settings_Page_Payment' ); 
  89.  
  90. echo '<div class="ms-half space">'; 
  91. $view->render(); 
  92. MS_Helper_Html::html_separator( 'vertical' ); 
  93. echo '</div>'; 
  94.  
  95. /** 
  96. * Render the payment box for a single Membership subscription. 
  97. * @since 1.0.0 
  98. */ 
  99. public function specific_payment_settings() { 
  100. $membership = $this->data['membership']; 
  101.  
  102. $title = sprintf( 
  103. __( 'Payment settings for %s', 'membership2' ),  
  104. $membership->get_name_tag() 
  105. ); 
  106.  
  107. $type_class = $this->data['is_global_payments_set'] ? '' : 'ms-half right'; 
  108. ?> 
  109. <div class="ms-specific-payment-wrapper <?php echo esc_attr( $type_class ); ?>"> 
  110. <div class="ms-header"> 
  111. <div class="ms-settings-tab-title"> 
  112. <h3><?php echo $title; ?></h3> 
  113. </div> 
  114. <?php MS_Helper_Html::html_separator(); ?> 
  115. </div> 
  116.  
  117. <div class="inside"> 
  118. <?php 
  119. $view = MS_Factory::create( 'MS_View_Membership_Tab_Payment' ); 
  120. $view->data = $this->data; 
  121. echo $view->to_html(); 
  122. ?> 
  123. </div> 
  124. <?php MS_Helper_Html::save_text(); ?> 
  125. </div> 
  126. <?php 
  127.