gde_setup

Perform activation.

Description

gde_setup(); 

Usage

  1. if ( !function_exists( 'gde_setup' ) ) { 
  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_setup(); 
  7.  

Defined (1)

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

/libs/lib-setup.php  
  1. function gde_setup() { 
  2. if ( GDE_DX_LOGGING > 0 ) { 
  3. gde_dx_log("Dx log manually enabled in functions.php"); 
  4.  
  5. // clear any beta transient 
  6. gde_dx_log("Clearing beta cache"); 
  7. delete_site_transient( 'gde_beta_version' ); 
  8. delete_transient( 'gde_beta_version' ); 
  9. delete_option( 'external_updates-google-document-embedder' ); 
  10.  
  11. gde_dx_log("Activating..."); 
  12.  
  13. if ( is_multisite() ) { 
  14. if ( ! $gdeglobals = get_site_option( 'gde_globals' ) ) { 
  15. gde_dx_log("Writing multisite global options"); 
  16. $globalopts = gde_defaults('global'); 
  17. update_site_option( 'gde_globals', $globalopts ); 
  18.  
  19. // check for existing or updated options 
  20. $gdeoptions = gde_get_options(); 
  21.  
  22. // check for existence of default profile (re-activation?) 
  23. if ( ! gde_get_profiles( 1 ) ) { 
  24. // new activation - write profile(s) 
  25. $defpros = gde_defaults('profiles'); 
  26. foreach ( $defpros as $key => $prodata ) { 
  27. if ( $key == "default" ) { 
  28. $id = 1; // default profile is always ID 1 
  29. } else { 
  30. $id = null; // assign next id 
  31.  
  32. // prepare profile 
  33. $desc = $prodata['desc']; 
  34. unset( $prodata['desc'] ); 
  35.  
  36. // write profile 
  37. $data = serialize( $prodata ); 
  38. $profile = array( $key, $desc, $data ); 
  39. if ( gde_write_profile( $profile, $id ) < 1 ) { 
  40. gde_dx_log("Failed to write profile '$key'"); 
  41. } else { 
  42. gde_dx_log("Profiles already exist"); 
  43.  
  44. gde_dx_log("Activation complete.");