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 ABSPATH . PLUGINDIR . 'google-locker-for-wordpress/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.  
  23. $msg = "Reset General Settings Successfully."; 
  24. } else if ( $tab == gl_get_social_lock_settings_key() ) { 
  25. delete_option( gl_get_social_lock_settings_key() ); 
  26.  
  27. $msg = "Reset Social Locker Settings Successfully."; 
  28. } else if ( $tab == gl_get_content_lock_settings_key() ) { 
  29. delete_option( gl_get_content_lock_settings_key() ); 
  30.  
  31. $msg = "Reset Content Locker Settings Successfully."; 
  32. } else if ( $tab == gl_get_time_lock_settings_key() ) { 
  33. delete_option( gl_get_time_lock_settings_key() ); 
  34. update_option( gl_get_time_lock_settings_key(), gl_time_lock_default_settings() ); 
  35.  
  36. $msg = "Reset Time Locker Settings Successfully."; 
  37. ?> 
  38. <div class="wrap"> 
  39. <?php gl_plugin_options_tabs(); ?> 
  40. <?php if ($msg != "") { 
  41. echo '<div class="updated" style="padding: 10px;">' . $msg . '</div>'; 
  42. ?> 
  43. <form method="post" action="options.php"> 
  44. <?php if ( $tab == gl_get_howtouse_settings_key() ) { 
  45. }  
  46. else { 
  47. ?> 
  48. <?php wp_nonce_field( 'update-options' ); ?> 
  49. <?php settings_fields( $tab ); ?> 
  50. <?php do_settings_sections( $tab ); ?> 
  51. <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> 
  52. <input type="submit" name="submit" id="submit" class="button-primary" value="Save settings" > 
  53. <?php } ?> 
  54. </form> 
  55. </div> 
  56. <?php