MS_Gateway_Manual_View_Settings

The Membership 2 MS Gateway Manual View Settings class.

Defined (1)

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

/app/gateway/manual/view/class-ms-gateway-manual-view-settings.php  
  1. class MS_Gateway_Manual_View_Settings extends MS_View { 
  2.  
  3. public function to_html() { 
  4. $fields = $this->prepare_fields(); 
  5. $gateway = $this->data['model']; 
  6.  
  7. $msg = __( 
  8. 'Instruct your users how to proceed with manual payments. This might include things like your bank account number and an email address where the payment confirmation should be sent.',  
  9. 'membership2' 
  10. ) . '<br /> <br /><em>' . __( 
  11. 'When using this payment method the user will see the following payment instructions. Since the payment cannot be confirmed automatically his membership will <b>not</b> be activated instantly! You have to manually check if the payment was made and set the members bill to "paid" to complete the payment.',  
  12. 'membership2' 
  13. ) . 
  14. '</em>'; 
  15.  
  16. ob_start(); 
  17. // Render tabbed interface. 
  18. ?> 
  19. <form class="ms-gateway-settings-form ms-form"> 
  20. <?php 
  21. MS_Helper_Html::settings_box_header( '', $msg ); 
  22. foreach ( $fields as $field ) { 
  23. MS_Helper_Html::html_element( $field ); 
  24. MS_Helper_Html::settings_box_footer(); 
  25. ?> 
  26. </form> 
  27. <?php 
  28. $html = ob_get_clean(); 
  29. return $html; 
  30.  
  31. protected function prepare_fields() { 
  32. $gateway = $this->data['model']; 
  33. $action = MS_Controller_Gateway::AJAX_ACTION_UPDATE_GATEWAY; 
  34. $nonce = wp_create_nonce( $action ); 
  35.  
  36. $fields = array( 
  37. 'payment_info' => array( 
  38. 'id' => 'payment_info',  
  39. 'title' => apply_filters( 
  40. 'ms_translation_flag',  
  41. __( 'Payment Info', 'membership2' ),  
  42. 'gateway-button' . $gateway->id 
  43. ),  
  44. 'type' => MS_Helper_Html::INPUT_TYPE_TEXT_AREA,  
  45. 'value' => $gateway->payment_info,  
  46. 'field_options' => array( 'editor_class' => 'ms-field-wp-editor' ),  
  47. 'class' => 'ms-text-large',  
  48. 'ajax_data' => array( 1 ),  
  49. ),  
  50.  
  51. 'pay_button_url' => array( 
  52. 'id' => 'pay_button_url',  
  53. 'title' => apply_filters( 
  54. 'ms_translation_flag',  
  55. __( 'Payment button label or URL', 'membership2' ),  
  56. 'gateway-button' . $gateway->id 
  57. ),  
  58. 'type' => MS_Helper_Html::INPUT_TYPE_TEXT,  
  59. 'value' => $gateway->pay_button_url,  
  60. 'class' => 'ms-text-large',  
  61. 'ajax_data' => array( 1 ),  
  62. ),  
  63. ); 
  64.  
  65. // Process the fields and add missing default attributes. 
  66. foreach ( $fields as $key => $field ) { 
  67. if ( ! empty( $field['ajax_data'] ) ) { 
  68. $fields[ $key ]['ajax_data']['field'] = $fields[ $key ]['id']; 
  69. $fields[ $key ]['ajax_data']['_wpnonce'] = $nonce; 
  70. $fields[ $key ]['ajax_data']['action'] = $action; 
  71. $fields[ $key ]['ajax_data']['gateway_id'] = $gateway->id; 
  72.  
  73. return apply_filters( 
  74. 'ms_gateway_manual_view_settings_prepare_fields',  
  75. $fields 
  76. );