/app/view/settings/page/class-ms-view-settings-page-general.php

  1. <?php 
  2.  
  3. class MS_View_Settings_Page_General extends MS_View_Settings_Edit { 
  4.  
  5. public function to_html() { 
  6. $settings = $this->data['settings']; 
  7.  
  8. $fields = array( 
  9. 'plugin_enabled' => array( 
  10. 'id' => 'plugin_enabled',  
  11. 'type' => MS_Helper_Html::INPUT_TYPE_RADIO_SLIDER,  
  12. 'title' => __( 'Content Protection', 'membership2' ),  
  13. 'desc' => __( 'This setting toggles the content protection on this site.', 'membership2' ),  
  14. 'value' => MS_Plugin::is_enabled(),  
  15. 'data_ms' => array( 
  16. 'action' => MS_Controller_Settings::AJAX_ACTION_TOGGLE_SETTINGS,  
  17. 'setting' => 'plugin_enabled',  
  18. ),  
  19. ),  
  20.  
  21. 'hide_admin_bar' => array( 
  22. 'id' => 'hide_admin_bar',  
  23. 'type' => MS_Helper_Html::INPUT_TYPE_RADIO_SLIDER,  
  24. 'title' => __( 'Hide admin toolbar', 'membership2' ),  
  25. 'desc' => __( 'Hide the admin toolbar for non administrator users.', 'membership2' ),  
  26. 'value' => $settings->hide_admin_bar,  
  27. 'data_ms' => array( 
  28. 'action' => MS_Controller_Settings::AJAX_ACTION_TOGGLE_SETTINGS,  
  29. 'setting' => 'hide_admin_bar',  
  30. ),  
  31. ),  
  32. ); 
  33.  
  34. $fields = apply_filters( 'ms_view_settings_prepare_general_fields', $fields ); 
  35. $setup = MS_Factory::create( 'MS_View_Settings_Page_Setup' ); 
  36. $action_url = esc_url_raw( remove_query_arg( array( 'msg' ) ) ); 
  37.  
  38. ob_start(); 
  39.  
  40. MS_Helper_Html::settings_tab_header(); 
  41. ?> 
  42.  
  43. <form action="<?php echo esc_url( $action_url ); ?>" method="post" class="cf"> 
  44. <div class="cf"> 
  45. <div class="ms-half"> 
  46. <?php MS_Helper_Html::html_element( $fields['plugin_enabled'] ); ?> 
  47. </div> 
  48. <div class="ms-half"> 
  49. <?php MS_Helper_Html::html_element( $fields['hide_admin_bar'] ); ?> 
  50. </div> 
  51. </div> 
  52. <?php 
  53. MS_Helper_Html::html_separator(); 
  54. MS_Helper_Html::html_element( $setup->html_full_form() ); 
  55. ?> 
  56. </form> 
  57. <?php 
  58. return ob_get_clean(); 
  59.  
.