gde_get_options

Get the current options, upgrading or resetting them as needed.

Description

(array) gde_get_options(); 

Returns (array)

Current value of gde_options


Usage

  1. if ( !function_exists( 'gde_get_options' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-doc-embedder/libs/lib-setup.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = gde_get_options(); 
  7.  

Defined (1)

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

/libs/lib-setup.php  
  1. function gde_get_options() { 
  2. $defopts = gde_defaults('options'); 
  3.  
  4. if ( ! $gdeoptions = get_option('gde_options') ) { 
  5. // options don't exist 
  6. gde_dx_log("Writing default options"); 
  7. update_option('gde_options', $defopts); 
  8. } else { 
  9. // check if upgrading from < 2.5 
  10. if ( isset( $gdeoptions['default_width'] ) ) { 
  11. gde_dx_log("Old options found - resetting"); 
  12. $defopts['upgraded'] = "yes"; 
  13. update_option('gde_options', $defopts); 
  14. } else { 
  15. gde_dx_log("Options already exist"); 
  16.  
  17. // check or upgrade options 
  18. $updated = false; 
  19. foreach ( $defopts as $k => $v ) { 
  20. if ( ! array_key_exists( $k, $gdeoptions ) ) { 
  21. $gdeoptions[$k] = $v; 
  22. //gde_dx_log("New option $k added"); 
  23. $updated = true; 
  24.  
  25. if ( $updated ) { 
  26. gde_dx_log('Options were updated'); 
  27. update_option('gde_options', $defopts); 
  28.  
  29. return $gdeoptions;