gl_plugin_options_page

Plugin Options page: using the gl_plugin_options_tabs method to render the tabs.

Description

gl_plugin_options_page(); 

Usage

  1. if ( !function_exists( 'gl_plugin_options_page' ) ) { 
  2. require_once '/admin/pages.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = gl_plugin_options_page(); 
  7.  

Defined (1)

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

/admin/pages.php  
  1. function gl_plugin_options_page( ) { 
  2. // Options page 
  3. $tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : gl_get_general_settings_key(); 
  4.  
  5. // Get options value after user press "Save Settings" button 
  6. $update_settings = isset( $_GET[ "settings-updated" ] ) ? $_GET[ "settings-updated" ] : ""; 
  7. if ( $update_settings == "true" ) {  
  8. $general_settings = gl_get_general_settings_values(); 
  9. $parts = explode('_', $general_settings[ 'language' ]); 
  10. $general_settings = array_merge( $general_settings, array( 
  11. 'short_language' => $parts[0] 
  12. ) ); 
  13.  
  14. delete_option( gl_get_general_settings_key() ); 
  15. update_option( gl_get_general_settings_key(), $general_settings ); 
  16.  
  17. // reset settings 
  18. $reset_settings = isset( $_GET[ "reset" ] ) ? $_GET[ "reset" ] : ""; 
  19. if ( $reset_settings == "true" ) {  
  20. if ( $tab == gl_get_general_settings_key() ) { 
  21. delete_option( gl_get_general_settings_key() ); 
  22. update_option( gl_get_general_settings_key(), gl_general_default_settings() ); 
  23.  
  24. $msg = "Reset General Settings Successfully."; 
  25. } else if ( $tab == gl_get_social_lock_settings_key() ) { 
  26. delete_option( gl_get_social_lock_settings_key() ); 
  27. update_option( gl_get_social_lock_settings_key(), gl_social_lock_default_settings() ); 
  28.  
  29. $msg = "Reset Social Locker Settings Successfully."; 
  30. } else if ( $tab == gl_get_content_lock_settings_key() ) { 
  31. delete_option( gl_get_content_lock_settings_key() ); 
  32. update_option( gl_get_content_lock_settings_key(), gl_content_lock_default_settings() ); 
  33.  
  34. $msg = "Reset Content Locker Settings Successfully."; 
  35. } else if ( $tab == gl_get_time_lock_settings_key() ) { 
  36. delete_option( gl_get_time_lock_settings_key() ); 
  37. update_option( gl_get_time_lock_settings_key(), gl_time_lock_default_settings() ); 
  38.  
  39. $msg = "Reset Time Locker Settings Successfully."; 
  40. ?> 
  41. <div class="wrap"> 
  42. <?php gl_plugin_options_tabs(); ?> 
  43. <?php if ($msg != "") { 
  44. echo '<div class="updated" style="padding: 10px;">' . $msg . '</div>'; 
  45. ?> 
  46. <form method="post" action="options.php"> 
  47. <?php if ( $tab == gl_get_howtouse_settings_key() ) { 
  48. echo gl_plugin_howtouse_tab(); 
  49. }  
  50. else { 
  51. ?> 
  52. <?php wp_nonce_field( 'update-options' ); ?> 
  53. <?php settings_fields( $tab ); ?> 
  54. <?php do_settings_sections( $tab ); ?> 
  55. <a href="options-general.php?page=<?php echo gl_get_plugin_options_key(); ?>&tab=<?php echo $tab ?>&reset=true" class="button">Reset configuration to default values</a> 
  56. <input type="submit" name="submit" id="submit" class="button-primary" value="Save settings" > 
  57. <?php } ?> 
  58. </form> 
  59. </div> 
  60. <?php