gglnltcs_settings_page

The WordPress Core gglnltcs settings page function.

Description

gglnltcs_settings_page(); 

Usage

  1. if ( !function_exists( 'gglnltcs_settings_page' ) ) { 
  2. require_once '/bws-google-analytics.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = gglnltcs_settings_page(); 
  7.  

Defined (1)

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

/bws-google-analytics.php  
  1. function gglnltcs_settings_page() { 
  2. global $gglnltcs_options, $gglnltcs_plugin_info; 
  3. $curl_enabled = function_exists( 'curl_init' ); 
  4.  
  5. $message = $error = ''; 
  6. static $this_plugin; 
  7. if ( ! $this_plugin ) 
  8. $this_plugin = plugin_basename( __FILE__ ); 
  9. /** 
  10. * @since 1.6.7 
  11. * hide ad block 
  12. */ 
  13. if ( isset( $_POST['bws_hide_premium_options'] ) && check_admin_referer( $this_plugin, 'gglnltcs_nonce_name' ) ) { 
  14. $hide_result = bws_hide_premium_options( $gglnltcs_options ); 
  15. $gglnltcs_options = $hide_result['options']; 
  16. if ( ! empty( $hide_result['message'] ) ) 
  17. $message .= ' ' . $hide_result['message']; 
  18. update_option( 'gglnltcs_options', $gglnltcs_options ); 
  19. $hide_pro_block = bws_hide_premium_options_check( $gglnltcs_options ); 
  20. if ( isset( $_POST['gglnltcs_form_submit'] ) && check_admin_referer( $this_plugin, 'gglnltcs_nonce_name' ) ) { 
  21.  
  22. $gglnltcs_options_submit['add_tracking_code'] = isset( $_POST['gglnltcs_add_tracking_code'] ) ? 1 : 0; 
  23. $gglnltcs_options_submit['tracking_id'] = isset( $_POST['gglnltcs_tracking_id'] ) ? stripslashes( esc_html( $_POST['gglnltcs_tracking_id'] ) ) : ''; 
  24. if ( $gglnltcs_options_submit['add_tracking_code'] == 1 && $gglnltcs_options_submit['tracking_id'] == '' ) { 
  25. $error .= __( "Tracking code is empty. You must enter a tracking code to add it to your blog.", 'bws-google-analytics' ); 
  26. if ( empty( $error ) ) { 
  27. $gglnltcs_options = array_merge( $gglnltcs_options, $gglnltcs_options_submit ); 
  28. update_option( 'gglnltcs_options', $gglnltcs_options ); 
  29. $message .= __( "Settings saved.", 'bws-google-analytics' ); 
  30. } else { 
  31. $error .= ' ' . __( "Settings are not saved.", 'bws-google-analytics' ); 
  32. /** If user pressed log out button delete his Access Token from database. */ 
  33. if ( isset( $_POST['gglnltcs_log_out'] ) && check_admin_referer( $this_plugin, 'gglnltcs_nonce_name' ) ) { 
  34. unset( $gglnltcs_options['token'] ); 
  35. unset( $gglnltcs_options['settings'] ); 
  36. update_option( 'gglnltcs_options', $gglnltcs_options ); 
  37. if ( $curl_enabled ) 
  38. $analytics = gglnltcs_get_analytics(); 
  39. elseif ( ! isset( $_GET['action'] ) ) 
  40. $error = __( 'It is impossible to get any information from Google Analytics due to the fact that cURL has been disabled. Please contact with the administrator of your server', 'bws-google-analytics' ) . '.'; 
  41. /** Print Tab Navigation */ ?> 
  42. <div class="wrap"> 
  43. <h1 id="gglnltcs-main-header"><?php _e( 'Google Analytics Settings', 'bws-google-analytics' ); ?></h1> 
  44. <h2 class="nav-tab-wrapper"> 
  45. <a class="nav-tab<?php if ( ! isset( $_GET['action'] ) ) echo ' nav-tab-active'; ?>" href="admin.php?page=bws-google-analytics.php"><?php _e( 'Statistics', 'bws-google-analytics' ); ?></a> 
  46. <a class="nav-tab<?php if ( isset( $_GET['action'] ) && 'settings' == $_GET['action'] ) echo ' nav-tab-active'; ?>" href="admin.php?page=bws-google-analytics.php&action=settings"><?php _e( 'Settings', 'bws-google-analytics' ); ?></a> 
  47. <a class="nav-tab bws_go_pro_tab<?php if ( isset( $_GET['action'] ) && 'go_pro' == $_GET['action'] ) echo ' nav-tab-active'; ?>" href="admin.php?page=bws-google-analytics.php&action=go_pro"><?php _e( 'Go PRO', 'bws-google-analytics' ); ?></a> 
  48. </h2> 
  49. <div id="gglnltcs-settings-message" class="updated fade below-h2" <?php if ( empty( $message ) ) echo "style=\"display:none\""; ?>><p><strong><?php echo $message; ?></strong></p></div> 
  50. <div id="gglnltcs-settings-error" class="error below-h2" <?php if ( empty( $error ) ) echo "style=\"display:none\""; ?>><p><strong><?php echo $error; ?></strong></p></div> 
  51. <?php bws_show_settings_notice(); ?> 
  52. <div id="gglnltcs-main-content"> 
  53. <?php if ( ! isset( $_GET['action'] ) && $curl_enabled ) { 
  54. if ( isset( $gglnltcs_options['token'] ) ) 
  55. gglnltcs_statistics_tab( $analytics, $hide_pro_block ); 
  56. else 
  57. gglnltcs_authenticate( $curl_enabled ); 
  58. } elseif ( isset( $_GET['action'] ) ) { 
  59. switch( $_GET['action'] ) { 
  60. case 'settings': 
  61. gglnltcs_settings_tab( $analytics ); 
  62. break; 
  63. case 'go_pro': 
  64. gglnltcs_go_pro_tab( $hide_pro_block ); 
  65. break; 
  66. default: 
  67. break; 
  68. bws_plugin_reviews_block( $gglnltcs_plugin_info['Name'], 'bws-google-analytics' ); ?> 
  69. </div> 
  70. </div> 
  71. <?php } /** close gglnltcs_settings_page function.*/