gde_setup
Perform activation.
Description
gde_setup();
Usage
if ( !function_exists( 'gde_setup' ) ) { require_once ABSPATH . PLUGINDIR . 'google-doc-embedder/libs/lib-setup.php'; } // NOTICE! Understand what this does before running. $result = gde_setup();
Defined (1)
The function is defined in the following location(s).
- /libs/lib-setup.php
- function gde_setup() {
- if ( GDE_DX_LOGGING > 0 ) {
- gde_dx_log("Dx log manually enabled in functions.php");
- }
- // clear any beta transient
- gde_dx_log("Clearing beta cache");
- delete_site_transient( 'gde_beta_version' );
- delete_transient( 'gde_beta_version' );
- delete_option( 'external_updates-google-document-embedder' );
- gde_dx_log("Activating...");
- if ( is_multisite() ) {
- if ( ! $gdeglobals = get_site_option( 'gde_globals' ) ) {
- gde_dx_log("Writing multisite global options");
- $globalopts = gde_defaults('global');
- update_site_option( 'gde_globals', $globalopts );
- }
- }
- // check for existing or updated options
- $gdeoptions = gde_get_options();
- // check for existence of default profile (re-activation?)
- if ( ! gde_get_profiles( 1 ) ) {
- // new activation - write profile(s)
- $defpros = gde_defaults('profiles');
- foreach ( $defpros as $key => $prodata ) {
- if ( $key == "default" ) {
- $id = 1; // default profile is always ID 1
- } else {
- $id = null; // assign next id
- }
- // prepare profile
- $desc = $prodata['desc'];
- unset( $prodata['desc'] );
- // write profile
- $data = serialize( $prodata );
- $profile = array( $key, $desc, $data );
- if ( gde_write_profile( $profile, $id ) < 1 ) {
- gde_dx_log("Failed to write profile '$key'");
- }
- }
- } else {
- gde_dx_log("Profiles already exist");
- }
- gde_dx_log("Activation complete.");
- }