MS_Gateway_Authorize_View_Settings

The Membership 2 MS Gateway Authorize View Settings class.

Defined (1)

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

/app/gateway/authorize/view/class-ms-gateway-authorize-view-settings.php  
  1. class MS_Gateway_Authorize_View_Settings extends MS_View { 
  2.  
  3. public function to_html() { 
  4. $fields = $this->prepare_fields(); 
  5. $gateway = $this->data['model']; 
  6.  
  7. ob_start(); 
  8. // Render tabbed interface. 
  9. ?> 
  10. <form class="ms-gateway-settings-form ms-form"> 
  11. <?php 
  12. MS_Helper_Html::settings_box_header( '', '' ); 
  13. foreach ( $fields as $field ) { 
  14. MS_Helper_Html::html_element( $field ); 
  15. MS_Helper_Html::settings_box_footer(); 
  16. ?> 
  17. </form> 
  18. <?php 
  19. $html = ob_get_clean(); 
  20. return $html; 
  21.  
  22. protected function prepare_fields() { 
  23. $gateway = $this->data['model']; 
  24. $action = MS_Controller_Gateway::AJAX_ACTION_UPDATE_GATEWAY; 
  25. $nonce = wp_create_nonce( $action ); 
  26.  
  27. $fields = array( 
  28. 'mode' => array( 
  29. 'id' => 'mode',  
  30. 'title' => __( 'Mode', 'membership2' ),  
  31. 'type' => MS_Helper_Html::INPUT_TYPE_SELECT,  
  32. 'value' => $gateway->mode,  
  33. 'field_options' => $gateway->get_mode_types(),  
  34. 'class' => 'ms-text-large',  
  35. 'ajax_data' => array( 1 ),  
  36. ),  
  37.  
  38. 'api_login_id' => array( 
  39. 'id' => 'api_login_id',  
  40. 'title' => __( 'API Login ID', 'membership2' ),  
  41. 'type' => MS_Helper_Html::INPUT_TYPE_TEXT,  
  42. 'value' => $gateway->api_login_id,  
  43. 'class' => 'ms-text-large',  
  44. 'ajax_data' => array( 1 ),  
  45. ),  
  46.  
  47. 'api_transaction_key' => array( 
  48. 'id' => 'api_transaction_key',  
  49. 'title' => __( 'API Transaction Key', 'membership2' ),  
  50. 'type' => MS_Helper_Html::INPUT_TYPE_TEXT,  
  51. 'value' => $gateway->api_transaction_key,  
  52. 'class' => 'ms-text-large',  
  53. 'ajax_data' => array( 1 ),  
  54. ),  
  55.  
  56. 'pay_button_url' => array( 
  57. 'id' => 'pay_button_url',  
  58. 'title' => apply_filters( 
  59. 'ms_translation_flag',  
  60. __( 'Payment button label or URL', 'membership2' ),  
  61. 'gateway-button' . $gateway->id 
  62. ),  
  63. 'type' => MS_Helper_Html::INPUT_TYPE_TEXT,  
  64. 'value' => $gateway->pay_button_url,  
  65. 'class' => 'ms-text-large',  
  66. 'ajax_data' => array( 1 ),  
  67. ),  
  68.  
  69. 'secure_cc' => array( 
  70. 'id' => 'secure_cc',  
  71. 'title' => __( 'Secure Payments', 'membership2' ),  
  72. 'type' => MS_Helper_Html::INPUT_TYPE_RADIO_SLIDER,  
  73. 'value' => $gateway->secure_cc,  
  74. 'ajax_data' => array( 1 ),  
  75. ),  
  76.  
  77. 'secure_cc_off' => array( 
  78. 'id' => 'secure_cc_off',  
  79. 'type' => MS_Helper_Html::TYPE_HTML_TEXT,  
  80. 'value' => __( 'Default payment option: Credit card details need to be entered once and can be reused without entering the CVC number again.', 'membership2' ),  
  81. 'class' => 'hidden secure_cc_off',  
  82. ),  
  83.  
  84. 'secure_cc_on' => array( 
  85. 'id' => 'secure_cc_on',  
  86. 'type' => MS_Helper_Html::TYPE_HTML_TEXT,  
  87. 'value' => __( 'Secure payment option: The user needs to enter the credit cards CVC number for every transaction - even for saved credit cards and every recurring payment.', 'membership2' ),  
  88. 'class' => 'hidden secure_cc_on',  
  89. ),  
  90. ); 
  91.  
  92. // Process the fields and add missing default attributes. 
  93. foreach ( $fields as $key => $field ) { 
  94. if ( ! empty( $field['ajax_data'] ) ) { 
  95. $fields[ $key ]['ajax_data']['field'] = $fields[ $key ]['id']; 
  96. $fields[ $key ]['ajax_data']['_wpnonce'] = $nonce; 
  97. $fields[ $key ]['ajax_data']['action'] = $action; 
  98. $fields[ $key ]['ajax_data']['gateway_id'] = $gateway->id; 
  99.  
  100. return $fields; 
  101.