MS_Addon_Taxamo_View

The Settings-Form.

Defined (1)

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

/app/addon/taxamo/class-ms-addon-taxamo-view.php  
  1. class MS_Addon_Taxamo_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( 'title' => __( 'Taxamo Settings', 'membership2' ) ) 
  11. ); 
  12.  
  13. foreach ( $fields as $field ) { 
  14. MS_Helper_Html::html_element( $field ); 
  15. ?> 
  16. </div> 
  17. <?php 
  18. $html = ob_get_clean(); 
  19. echo $html; 
  20.  
  21. public function prepare_fields() { 
  22. $model = MS_Addon_Taxamo::model(); 
  23.  
  24. $action = MS_Addon_Taxamo::AJAX_SAVE_SETTING; 
  25. $domain_name = $_SERVER['SERVER_NAME']; 
  26.  
  27. $fields = array( 
  28. 'info' => array( 
  29. 'type' => MS_Helper_Html::TYPE_HTML_TEXT,  
  30. 'title' => __( 'Setup Taxamo', 'membership2' ),  
  31. 'desc' => sprintf( 
  32. __( 'Before you can use the <strong>Taxamo API</strong> you must <a href="%1$s">get an Taxamo account</a> here.<br />After you login to Taxamo you can <a href="%2$s">find your API keys here</a>.<br />Also remember to add your domain "<code>%3$s</code>" in <a href="%4$s">your taxamo javascript settings</a>!', 'membership2' ),  
  33. 'http://www.taxamo.com/" target="_blank',  
  34. 'https://dashboard.taxamo.com/merchant/app.html#/account/api" target="_blank',  
  35. esc_html( $domain_name ),  
  36. 'https://dashboard.taxamo.com/merchant/app.html#/account/api/javascript" target="_blank' 
  37. ),  
  38. 'label_class' => 'no-click',  
  39. ),  
  40.  
  41. 'sep0' => array( 
  42. 'type' => MS_Helper_Html::TYPE_HTML_SEPARATOR,  
  43. ),  
  44.  
  45. 'is_live' => array( 
  46. 'id' => 'is_live',  
  47. 'type' => MS_Helper_Html::INPUT_TYPE_RADIO_SLIDER,  
  48. 'before' => __( 'I\'m testing', 'membership2' ),  
  49. 'after' => __( 'Live mode', 'membership2' ),  
  50. 'value' => $model->get( 'is_live' ),  
  51. 'ajax_data' => array( 
  52. 'field' => 'is_live',  
  53. 'action' => $action,  
  54. ),  
  55. ),  
  56.  
  57. 'sep1' => array( 
  58. 'type' => MS_Helper_Html::TYPE_HTML_SEPARATOR,  
  59. ),  
  60.  
  61. 'test_public_key' => array( 
  62. 'id' => 'test_public_key',  
  63. 'type' => MS_Helper_Html::INPUT_TYPE_TEXT,  
  64. 'title' => __( 'Test mode', 'membership2' ),  
  65. 'desc' => __( 'Public Token', 'membership2' ),  
  66. 'placeholder' => __( 'public_test_...', 'membership2' ),  
  67. 'value' => $model->get( 'test_public_key' ),  
  68. 'class' => 'ms-text-large',  
  69. 'ajax_data' => array( 
  70. 'field' => 'test_public_key',  
  71. 'action' => $action,  
  72. ),  
  73. ),  
  74.  
  75. 'test_private_key' => array( 
  76. 'id' => 'test_private_key',  
  77. 'type' => MS_Helper_Html::INPUT_TYPE_TEXT,  
  78. 'desc' => __( 'Private Token', 'membership2' ),  
  79. 'placeholder' => __( 'priv_test_...', 'membership2' ),  
  80. 'value' => $model->get( 'test_private_key' ),  
  81. 'class' => 'ms-text-large',  
  82. 'ajax_data' => array( 
  83. 'field' => 'test_private_key',  
  84. 'action' => $action,  
  85. ),  
  86. ),  
  87.  
  88. 'sep2' => array( 
  89. 'type' => MS_Helper_Html::TYPE_HTML_SEPARATOR,  
  90. ),  
  91.  
  92. 'live_public_key' => array( 
  93. 'id' => 'live_public_key',  
  94. 'type' => MS_Helper_Html::INPUT_TYPE_TEXT,  
  95. 'title' => __( 'Live mode', 'membership2' ),  
  96. 'desc' => __( 'Public Token', 'membership2' ),  
  97. 'placeholder' => __( 'public_...', 'membership2' ),  
  98. 'value' => $model->get( 'live_public_key' ),  
  99. 'class' => 'ms-text-large',  
  100. 'ajax_data' => array( 
  101. 'field' => 'live_public_key',  
  102. 'action' => $action,  
  103. ),  
  104. ),  
  105.  
  106. 'live_private_key' => array( 
  107. 'id' => 'live_private_key',  
  108. 'type' => MS_Helper_Html::INPUT_TYPE_TEXT,  
  109. 'desc' => __( 'Private Token', 'membership2' ),  
  110. 'placeholder' => __( 'priv_...', 'membership2' ),  
  111. 'value' => $model->get( 'live_private_key' ),  
  112. 'class' => 'ms-text-large',  
  113. 'ajax_data' => array( 
  114. 'field' => 'live_private_key',  
  115. 'action' => $action,  
  116. ),  
  117. ),  
  118. ); 
  119.  
  120. return $fields;