gglnltcs_get_options_from_db

The BestWebSoft Google Analytics gglnltcs get options from db function.

Description

gglnltcs_get_options_from_db(); 

Usage

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

Defined (1)

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

/bws-google-analytics.php  
  1. function gglnltcs_get_options_from_db() { 
  2. global $gglnltcs_options, $gglnltcs_plugin_info; 
  3.  
  4. if ( ! $gglnltcs_plugin_info ) { 
  5. if ( ! function_exists( 'get_plugin_data' ) ) { 
  6. require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 
  7. $gglnltcs_plugin_info = get_plugin_data( __FILE__ ); 
  8.  
  9. $gglnltcs_option_defaults = array( 
  10. 'plugin_option_version' => $gglnltcs_plugin_info["Version"],  
  11. 'tracking_id' => '',  
  12. 'add_tracking_code' => 1,  
  13. ); 
  14. /** get options from DB if exist */ 
  15. $gglnltcs_options = get_option( 'gglnltcs_options' ); 
  16.  
  17. if ( ! $gglnltcs_options ) { 
  18. $gglnltcs_options = $gglnltcs_option_defaults; 
  19. update_option( 'gglnltcs_options', $gglnltcs_options ); 
  20. } elseif ( ! isset( $gglnltcs_options['plugin_option_version'] ) || $gglnltcs_options['plugin_option_version'] != $gglnltcs_plugin_info['Version'] ) { 
  21. $gglnltcs_options = array_merge( $gglnltcs_option_defaults, $gglnltcs_options ); 
  22. $gglnltcs_options['plugin_option_version'] = $gglnltcs_plugin_info['Version']; 
  23. update_option( 'gglnltcs_options', $gglnltcs_options );