public static function general_settings_network() { $gadwp = GADWP(); global $wp_version; if (!current_user_can('manage_network_options')) { return; } $options = self::update_options('network'); /* * Include GAPI */ echo '<div id="gapi-warning" class="updated"><p>' . __('Loading the required libraries. If this results in a blank screen or a fatal error, try this solution:', 'google-analytics-dashboard-for-wp') . ' <a href="https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=general_screen&utm_campaign=gadwp">Library conflicts between WordPress plugins</a></p></div>'; if (null === $gadwp->gapi_controller) { $gadwp->gapi_controller = new GADWP_GAPI_Controller(); } echo '<script type="text/javascript">jQuery("#gapi-warning").hide()</script>'; if (isset($_POST['ga_dash_code'])) { if (!stripos('x' . $_POST['ga_dash_code'], 'UA-', 1) == 1) { try { $gadwp->gapi_controller->client->authenticate($_POST['ga_dash_code']); $gadwp->config->options['ga_dash_token'] = $gadwp->gapi_controller->client->getAccessToken(); $gadwp->config->options['automatic_updates_minorversion'] = 1; $gadwp->config->set_plugin_options(true); $options = self::update_options('network'); $message = "<div class='updated'><p>" . __("Plugin authorization succeeded.", 'google-analytics-dashboard-for-wp') . "</p></div>"; if (is_multisite()) { // Cleanup errors on the entire network foreach (wp_get_sites(array('limit' => apply_filters('gadwp_sites_limit', 100))) as $blog) { switch_to_blog($blog['blog_id']); GADWP_Tools::delete_cache('gapi_errors'); restore_current_blog(); } } else { GADWP_Tools::delete_cache('gapi_errors'); } if ($gadwp->config->options['ga_dash_token'] && $gadwp->gapi_controller->client->getAccessToken()) { if (!empty($gadwp->config->options['ga_dash_profile_list'])) { $profiles = $gadwp->config->options['ga_dash_profile_list']; } else { $profiles = $gadwp->gapi_controller->refresh_profiles(); } if ($profiles) { $gadwp->config->options['ga_dash_profile_list'] = $profiles; if (isset($gadwp->config->options['ga_dash_tableid_jail']) && !$gadwp->config->options['ga_dash_tableid_jail']) { $profile = GADWP_Tools::guess_default_domain($profiles); $gadwp->config->options['ga_dash_tableid_jail'] = $profile; $gadwp->config->options['ga_dash_tableid'] = $profile; } $gadwp->config->set_plugin_options(true); $options = self::update_options('network'); } } } catch (Google_IO_Exception $e) { GADWP_Tools::set_cache('last_error', date('Y-m-d H:i:s') . ': ' . esc_html($e), $gadwp->gapi_controller->error_timeout); return false; } catch (Google_Service_Exception $e) { GADWP_Tools::set_cache('last_error', date('Y-m-d H:i:s') . ': ' . esc_html("(" . $e->getCode() . ") " . $e->getMessage()), $gadwp->gapi_controller->error_timeout); GADWP_Tools::set_cache('gapi_errors', $e->getErrors(), $gadwp->gapi_controller->error_timeout); return $e->getCode(); } catch (Exception $e) { GADWP_Tools::set_cache('last_error', date('Y-m-d H:i:s') . ': ' . esc_html($e) . "\nResponseHttpCode:" . $e->getCode(), $gadwp->gapi_controller->error_timeout); $gadwp->gapi_controller->reset_token(false); } } else { $message = "<div class='error'><p>" . __("The access code is <strong>NOT</strong> your <strong>Tracking ID</strong> (UA-XXXXX-X). Try again, and use the red link to get your access code", 'google-analytics-dashboard-for-wp') . ".</p></div>"; } } if (isset($_POST['Refresh'])) { if (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form')) { $gadwp->config->options['ga_dash_profile_list'] = array(); $message = "<div class='updated'><p>" . __("Properties refreshed.", 'google-analytics-dashboard-for-wp') . "</p></div>"; $options = self::update_options('network'); if ($gadwp->config->options['ga_dash_token'] && $gadwp->gapi_controller->client->getAccessToken()) { if (!empty($gadwp->config->options['ga_dash_profile_list'])) { $profiles = $gadwp->config->options['ga_dash_profile_list']; } else { $profiles = $gadwp->gapi_controller->refresh_profiles(); } if ($profiles) { $gadwp->config->options['ga_dash_profile_list'] = $profiles; if (isset($gadwp->config->options['ga_dash_tableid_jail']) && !$gadwp->config->options['ga_dash_tableid_jail']) { $profile = GADWP_Tools::guess_default_domain($profiles); $gadwp->config->options['ga_dash_tableid_jail'] = $profile; $gadwp->config->options['ga_dash_tableid'] = $profile; } $gadwp->config->set_plugin_options(true); $options = self::update_options('network'); } } } else { $message = "<div class='error'><p>" . __("Cheating Huh?", 'google-analytics-dashboard-for-wp') . "</p></div>"; } } if (isset($_POST['Clear'])) { if (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form')) { GADWP_Tools::clear_cache(); $message = "<div class='updated'><p>" . __("Cleared Cache.", 'google-analytics-dashboard-for-wp') . "</p></div>"; } else { $message = "<div class='error'><p>" . __("Cheating Huh?", 'google-analytics-dashboard-for-wp') . "</p></div>"; } } if (isset($_POST['Reset'])) { if (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form')) { $gadwp->gapi_controller->reset_token(true); GADWP_Tools::clear_cache(); $message = "<div class='updated'><p>" . __("Token Reseted and Revoked.", 'google-analytics-dashboard-for-wp') . "</p></div>"; $options = self::update_options('Reset'); } else { $message = "<div class='error'><p>" . __("Cheating Huh?", 'google-analytics-dashboard-for-wp') . "</p></div>"; } } if (isset($_POST['options']['ga_dash_hidden']) && !isset($_POST['Clear']) && !isset($_POST['Reset']) && !isset($_POST['Refresh'])) { $message = "<div class='updated'><p>" . __("Settings saved.", 'google-analytics-dashboard-for-wp') . "</p></div>"; if (!(isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form'))) { $message = "<div class='error'><p>" . __("Cheating Huh?", 'google-analytics-dashboard-for-wp') . "</p></div>"; } } if (isset($_POST['Hide'])) { if (isset($_POST['gadash_security']) && wp_verify_nonce($_POST['gadash_security'], 'gadash_form')) { $message = "<div class='updated'><p>" . __("All other domains/properties were removed.", 'google-analytics-dashboard-for-wp') . "</p></div>"; $lock_profile = GADWP_Tools::get_selected_profile($gadwp->config->options['ga_dash_profile_list'], $gadwp->config->options['ga_dash_tableid_jail']); $gadwp->config->options['ga_dash_profile_list'] = array($lock_profile); $options = self::update_options('network'); } else { $message = "<div class='error'><p>" . __("Cheating Huh?", 'google-analytics-dashboard-for-wp') . "</p></div>"; } } ?> <div class="wrap"> <?php echo "<h2>" . __("Google Analytics Settings", 'google-analytics-dashboard-for-wp') . "</h2>"; ?> <hr> </div> <div id="poststuff" class="gadwp"> <div id="post-body" class="metabox-holder columns-2"> <div id="post-body-content"> <div class="settings-wrapper"> <div class="inside"> <?php if ($gadwp->gapi_controller->gapi_errors_handler() || GADWP_Tools::get_cache('last_error')) { $message = sprintf('<div class="error"><p>%s</p></div>', sprintf(__('Something went wrong, check %1$s or %2$s.', 'google-analytics-dashboard-for-wp'), sprintf('<a href="%1$s">%2$s</a>', menu_page_url('gadash_errors_debugging', false), __('Errors & Debug', 'google-analytics-dashboard-for-wp')), sprintf('<a href="%1$s">%2$s</a>', menu_page_url('gadash_settings', false), __('authorize the plugin', 'google-analytics-dashboard-for-wp')))); } if (isset($_POST['Authorize'])) { GADWP_Tools::clear_cache(); $gadwp->gapi_controller->token_request(); echo "<div class='updated'><p>" . __("Use the red link (see below) to generate and get your access code!", 'google-analytics-dashboard-for-wp') . "</p></div>"; } else { if (isset($message)) { echo $message; } ?> <form name="ga_dash_form" method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?> "> <input type="hidden" name="options[ga_dash_hidden]" value="Y"> <?php wp_nonce_field('gadash_form', 'gadash_security'); ?> <table class="gadwp-settings-options"> <tr> <td colspan="2"><?php echo "<h2>" . __("Network Setup", 'google-analytics-dashboard-for-wp') . "</h2>"; ?> </td> </tr> <tr> <td colspan="2" class="gadwp-settings-title"> <div class="button-primary gadwp-settings-switchoo"> <input type="checkbox" name="options[ga_dash_network]" value="1" class="gadwp-settings-switchoo-checkbox" id="ga_dash_network" <?php checked($options['ga_dash_network'], 1); ?> onchange="this.form.submit()"> <label class="gadwp-settings-switchoo-label" for="ga_dash_network"> <div class="gadwp-settings-switchoo-inner"></div> <div class="gadwp-settings-switchoo-switch"></div> </label> </div> <div class="switch-desc"><?php echo " " . __("use a single Google Analytics account for the entire network", 'google-analytics-dashboard-for-wp'); ?> </div> </td> </tr> <?php if ($options['ga_dash_network']) { //Network Mode check ?> <tr> <td colspan="2"><hr></td> </tr> <tr> <td colspan="2"><?php echo "<h2>" . __("Plugin Authorization", 'google-analytics-dashboard-for-wp') . "</h2>"; ?> </td> </tr> <tr> <td colspan="2" class="gadwp-settings-info"> <?php printf(__('You should watch the %1$s and read this %2$s before proceeding to authorization. This plugin requires a properly configured Google Analytics account!', 'google-analytics-dashboard-for-wp'), sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_video&utm_campaign=gadwp', __("video", 'google-analytics-dashboard-for-wp')), sprintf('<a href="%1$s" target="_blank">%2$s</a>', 'https://deconf.com/google-analytics-dashboard-wordpress/?utm_source=gadwp_config&utm_medium=link&utm_content=top_tutorial&utm_campaign=gadwp', __("tutorial", 'google-analytics-dashboard-for-wp'))); ?> </td> </tr> <?php if (!$options['ga_dash_token'] || $options['ga_dash_userapi']) { ?> <tr> <td colspan="2" class="gadwp-settings-info"><input name="options[ga_dash_userapi]" type="checkbox" id="ga_dash_userapi" value="1" <?php checked($options['ga_dash_userapi'], 1); ?> onchange="this.form.submit()" /><?php echo " " . __("use your own API Project credentials", 'google-analytics-dashboard-for-wp'); ?> </td> </tr> <?php } if ($options['ga_dash_userapi']) { ?> <tr> <td class="gadwp-settings-title"><label for="options[ga_dash_apikey]"><?php _e("API Key:", 'google-analytics-dashboard-for-wp'); ?> </label></td> <td><input type="text" name="options[ga_dash_apikey]" value="<?php echo esc_attr($options['ga_dash_apikey']); ?> " size="40" required="required"></td> </tr> <tr> <td class="gadwp-settings-title"><label for="options[ga_dash_clientid]"><?php _e("Client ID:", 'google-analytics-dashboard-for-wp'); ?> </label></td> <td><input type="text" name="options[ga_dash_clientid]" value="<?php echo esc_attr($options['ga_dash_clientid']); ?> " size="40" required="required"></td> </tr> <tr> <td class="gadwp-settings-title"><label for="options[ga_dash_clientsecret]"><?php _e("Client Secret:", 'google-analytics-dashboard-for-wp'); ?> </label></td> <td><input type="text" name="options[ga_dash_clientsecret]" value="<?php echo esc_attr($options['ga_dash_clientsecret']); ?> " size="40" required="required"> <input type="hidden" name="options[ga_dash_hidden]" value="Y"> <?php wp_nonce_field('gadash_form', 'gadash_security'); ?> </td> </tr> <?php } if ($options['ga_dash_token']) { ?> <tr> <td colspan="2"><input type="submit" name="Reset" class="button button-secondary" value="<?php _e("Clear Authorization", 'google-analytics-dashboard-for-wp'); ?> " /> <input type="submit" name="Clear" class="button button-secondary" value="<?php _e("Clear Cache", 'google-analytics-dashboard-for-wp'); ?> " /> <input type="submit" name="Refresh" class="button button-secondary" value="<?php _e("Refresh Properties", 'google-analytics-dashboard-for-wp'); ?> " /></td> </tr> <tr> <td colspan="2"><hr></td> </tr> <tr> <td colspan="2"><?php echo "<h2>" . __("Properties/Views Settings", 'google-analytics-dashboard-for-wp') . "</h2>"; ?> </td> </tr> <?php if (isset($options['ga_dash_tableid_network'])) { $options['ga_dash_tableid_network'] = json_decode(json_encode($options['ga_dash_tableid_network']), false); } foreach (wp_get_sites(array('limit' => apply_filters('gadwp_sites_limit', 100))) as $blog) { ?> <tr> <td class="gadwp-settings-title-s"><label for="ga_dash_tableid_network"><?php echo '<strong>' . $blog['domain'] . $blog['path'] . '</strong>: '; ?> </label></td> <td><select id="ga_dash_tableid_network" <?php disabled(!empty($options['ga_dash_profile_list']), false); ?> name="options[ga_dash_tableid_network][<?php echo $blog['blog_id']; ?> ]"> <?php if (!empty($options['ga_dash_profile_list'])) { foreach ($options['ga_dash_profile_list'] as $items) { if ($items[3]) { echo '<option value="' . esc_attr($items[1]) . '" ' . selected($items[1], isset($options['ga_dash_tableid_network']->{$blog}['blog_id']) ? $options['ga_dash_tableid_network']->{$blog}['blog_id'] : ''); echo ' title="' . __("View Name:", 'google-analytics-dashboard-for-wp') . ' ' . esc_attr($items[0]) . '">' . esc_html(GADWP_Tools::strip_protocol($items[3])) . ' ⇒ ' . esc_attr($items[0]) . '</option>'; } } } else { echo '<option value="">' . __("Property not found", 'google-analytics-dashboard-for-wp') . '</option>'; } ?> </select> <br /></td> </tr> <?php } ?> <tr> <td colspan="2"><?php echo "<h2>" . __("Automatic Updates", 'google-analytics-dashboard-for-wp') . "</h2>"; ?> </td> </tr> <tr> <td colspan="2" class="gadwp-settings-title"> <div class="button-primary gadwp-settings-switchoo"> <input type="checkbox" name="options[automatic_updates_minorversion]" value="1" class="gadwp-settings-switchoo-checkbox" id="automatic_updates_minorversion" <?php checked($options['automatic_updates_minorversion'], 1); ?> > <label class="gadwp-settings-switchoo-label" for="automatic_updates_minorversion"> <div class="gadwp-settings-switchoo-inner"></div> <div class="gadwp-settings-switchoo-switch"></div> </label> </div> <div class="switch-desc"><?php echo " " . __("automatic updates for minor versions (security and maintenance releases only)", 'google-analytics-dashboard-for-wp'); ?> </div> </td> </tr> <tr> <td colspan="2"><hr><?php echo "<h2>" . __("Exclude Tracking", 'google-analytics-dashboard-for-wp') . "</h2>"; ?> </td> </tr> <tr> <td colspan="2" class="gadwp-settings-title"> <div class="button-primary gadwp-settings-switchoo"> <input type="checkbox" name="options[ga_dash_excludesa]" value="1" class="gadwp-settings-switchoo-checkbox" id="ga_dash_excludesa"<?php checked($options['ga_dash_excludesa'], 1); ?> "> <label class="gadwp-settings-switchoo-label" for="ga_dash_excludesa"> <div class="gadwp-settings-switchoo-inner"></div> <div class="gadwp-settings-switchoo-switch"></div> </label> </div> <div class="switch-desc"><?php echo " " . __("exclude Super Admin tracking for the entire network", 'google-analytics-dashboard-for-wp'); ?> </div> </td> </tr> <tr> <td colspan="2"><hr></td> </tr> <tr> <td colspan="2" class="submit"><input type="submit" name="Submit" class="button button-primary" value="<?php _e('Save Changes', 'google-analytics-dashboard-for-wp'); ?> " /></td> </tr> <?php } else { ?> <tr> <td colspan="2"><hr></td> </tr> <tr> <td colspan="2"><input type="submit" name="Authorize" class="button button-secondary" id="authorize" value="<?php _e("Authorize Plugin", 'google-analytics-dashboard-for-wp'); ?> " /> <input type="submit" name="Clear" class="button button-secondary" value="<?php _e("Clear Cache", 'google-analytics-dashboard-for-wp'); ?> " /></td> </tr> <?php } //Network Mode check ?> <tr> <td colspan="2"><hr></td> </tr> </table> </form> <?php self::output_sidebar(); return; } ?> </table> </form> <?php } self::output_sidebar(); }
private function maintain_compatibility() { $flag = false; if (GADWP_CURRENT_VERSION != get_option('gadwp_version')) { $rebuild_token = json_decode($this->options['ga_dash_token']); // v4.8.2 if (is_object($rebuild_token) && !isset($rebuild_token->token_type)) { if (isset($this->options['ga_dash_refresh_token'])) { $rebuild_token->refresh_token = $this->options['ga_dash_refresh_token']; } $rebuild_token->token_type = "Bearer"; $this->options['ga_dash_token'] = json_encode($rebuild_token); unset($this->options['ga_dash_refresh_token']); $this->set_plugin_options(true); } else { unset($this->options['ga_dash_refresh_token']); } GADWP_Tools::clear_cache(); GADWP_Tools::clear_transients(); // 4.8.3 to be removed after a few months $flag = true; GADWP_Tools::delete_cache('last_error'); update_option('gadwp_version', GADWP_CURRENT_VERSION); update_option('gadwp_got_updated', true); if (is_multisite()) { // Cleanup errors and cookies on the entire network foreach (wp_get_sites(array('limit' => apply_filters('gadwp_sites_limit', 100))) as $blog) { switch_to_blog($blog['blog_id']); GADWP_Tools::delete_cache('gapi_errors'); restore_current_blog(); } } else { GADWP_Tools::delete_cache('gapi_errors'); } GADWP_Tools::unset_cookie('default_metric'); GADWP_Tools::unset_cookie('default_dimension'); } if (!isset($this->options['ga_enhanced_links'])) { $this->options['ga_enhanced_links'] = 0; $flag = true; } if (!isset($this->options['ga_dash_network'])) { $this->options['ga_dash_network'] = 0; $flag = true; } if (!isset($this->options['ga_enhanced_excludesa'])) { $this->options['ga_dash_excludesa'] = 0; $flag = true; } if (!isset($this->options['ga_dash_remarketing'])) { $this->options['ga_dash_remarketing'] = 0; $flag = true; } if (!isset($this->options['ga_dash_adsense'])) { $this->options['ga_dash_adsense'] = 0; $flag = true; } if (!isset($this->options['ga_speed_samplerate'])) { $this->options['ga_speed_samplerate'] = 1; $flag = true; } if (!isset($this->options['automatic_updates_minorversion'])) { $this->options['automatic_updates_minorversion'] = 1; $flag = true; } if (!isset($this->options['ga_event_bouncerate'])) { $this->options['ga_event_bouncerate'] = 0; $flag = true; } if (!is_array($this->options['ga_dash_access_front']) || empty($this->options['ga_dash_access_front'])) { $this->options['ga_dash_access_front'] = array(); $this->options['ga_dash_access_front'][] = 'administrator'; $flag = true; } if (!is_array($this->options['ga_dash_profile_list'])) { $this->options['ga_dash_profile_list'] = array(); $flag = true; } if (!is_array($this->options['ga_dash_access_back']) || empty($this->options['ga_dash_access_back'])) { $this->options['ga_dash_access_back'] = array(); $this->options['ga_dash_access_back'][] = 'administrator'; $flag = true; } if (!is_array($this->options['ga_track_exclude'])) { $this->options['ga_track_exclude'] = array(); $flag = true; } if (!isset($this->options['ga_crossdomain_tracking'])) { $this->options['ga_crossdomain_tracking'] = 0; $flag = true; } if (!isset($this->options['ga_crossdomain_list'])) { $this->options['ga_crossdomain_list'] = ''; $flag = true; } if (!isset($this->options['ga_author_dimindex'])) { $this->options['ga_author_dimindex'] = 0; $flag = true; } if (!isset($this->options['ga_category_dimindex'])) { $this->options['ga_category_dimindex'] = 0; $flag = true; } if (!isset($this->options['ga_user_dimindex'])) { $this->options['ga_user_dimindex'] = 0; $flag = true; } if (!isset($this->options['ga_pubyear_dimindex'])) { $this->options['ga_pubyear_dimindex'] = 0; $flag = true; } if (!isset($this->options['ga_event_affiliates'])) { $this->options['ga_event_affiliates'] = '/out/'; $flag = true; } if (!isset($this->options['ga_aff_tracking'])) { $this->options['ga_aff_tracking'] = 0; $flag = true; } if (!isset($this->options['ga_hash_tracking'])) { $this->options['ga_hash_tracking'] = 0; $flag = true; } if (!isset($this->options['backend_item_reports'])) { // v4.8 $this->options['backend_item_reports'] = 1; $flag = true; } if (isset($this->options['ga_dash_default_metric'])) { // v4.8.1 unset($this->options['ga_dash_default_metric']); $flag = true; } if (isset($this->options['ga_dash_default_dimension'])) { // v4.8.1 unset($this->options['ga_dash_default_dimension']); $flag = true; } if (isset($this->options['item_reports'])) { // v4.8 $this->options['backend_item_reports'] = $this->options['item_reports']; unset($this->options['item_reports']); $flag = true; } if (isset($this->options['ga_dash_frontend_stats'])) { // v4.8 $this->options['frontend_item_reports'] = $this->options['ga_dash_frontend_stats']; unset($this->options['ga_dash_frontend_stats']); $flag = true; } if (!isset($this->options['dashboard_widget'])) { // v4.7 $this->options['dashboard_widget'] = 1; $flag = true; } if (!isset($this->options['api_backoff'])) { // v4.8.1.3 $this->options['api_backoff'] = 0; $flag = true; } if (isset($this->options['ga_tracking_code'])) { unset($this->options['ga_tracking_code']); $flag = true; } if (isset($this->options['ga_dash_frontend_keywords'])) { // v4.8 unset($this->options['ga_dash_frontend_keywords']); $flag = true; } if (isset($this->options['ga_dash_jailadmins'])) { // v4.7 if (isset($this->options['ga_dash_jailadmins'])) { $this->options['switch_profile'] = 0; unset($this->options['ga_dash_jailadmins']); $flag = true; } else { $this->options['switch_profile'] = 1; unset($this->options['ga_dash_jailadmins']); $flag = true; } } if ($flag) { $this->set_plugin_options(false); } }
private function maintain_compatibility() { $flag = false; if (GADWP_CURRENT_VERSION != get_option('gadwp_version')) { GADWP_Tools::clear_cache(); $flag = true; $this->options['automatic_updates_minorversion'] = 1; delete_transient('ga_dash_lasterror'); update_option('gadwp_version', GADWP_CURRENT_VERSION); if (is_multisite()) { // Cleanup errors on the entire network foreach (wp_get_sites(array('limit' => apply_filters('gadwp_sites_limit', 100))) as $blog) { switch_to_blog($blog['blog_id']); delete_transient('ga_dash_gapi_errors'); restore_current_blog(); } } else { delete_transient('ga_dash_gapi_errors'); } } if (!isset($this->options['ga_enhanced_links'])) { $this->options['ga_enhanced_links'] = 0; $flag = true; } if (!isset($this->options['ga_enhanced_network'])) { $this->options['ga_dash_network'] = 0; $flag = true; } if (!isset($this->options['ga_enhanced_excludesa'])) { $this->options['ga_dash_excludesa'] = 0; $flag = true; } if (!isset($this->options['ga_dash_remarketing'])) { $this->options['ga_dash_remarketing'] = 0; $flag = true; } if (!isset($this->options['ga_dash_adsense'])) { $this->options['ga_dash_adsense'] = 0; $flag = true; } if (!isset($this->options['ga_speed_samplerate'])) { $this->options['ga_speed_samplerate'] = 1; $flag = true; } if (!isset($this->options['automatic_updates_minorversion'])) { $this->options['automatic_updates_minorversion'] = 1; $flag = true; } if (!isset($this->options['ga_event_bouncerate'])) { $this->options['ga_event_bouncerate'] = 0; $flag = true; } if (!is_array($this->options['ga_dash_access_front']) || empty($this->options['ga_dash_access_front'])) { $this->options['ga_dash_access_front'] = array(); $this->options['ga_dash_access_front'][] = 'administrator'; $flag = true; } if (!is_array($this->options['ga_dash_profile_list'])) { $this->options['ga_dash_profile_list'] = array(); $flag = true; } if (!is_array($this->options['ga_dash_access_back']) || empty($this->options['ga_dash_access_back'])) { $this->options['ga_dash_access_back'] = array(); $this->options['ga_dash_access_back'][] = 'administrator'; $flag = true; } if (!is_array($this->options['ga_track_exclude'])) { $this->options['ga_track_exclude'] = array(); $flag = true; } if (!isset($this->options['ga_crossdomain_tracking'])) { $this->options['ga_crossdomain_tracking'] = 0; $flag = true; } if (!isset($this->options['ga_crossdomain_list'])) { $this->options['ga_crossdomain_list'] = ''; $flag = true; } if (!isset($this->options['ga_author_dimindex'])) { $this->options['ga_author_dimindex'] = 0; $flag = true; } if (!isset($this->options['ga_category_dimindex'])) { $this->options['ga_category_dimindex'] = 0; $flag = true; } if (!isset($this->options['ga_user_dimindex'])) { $this->options['ga_user_dimindex'] = 0; $flag = true; } if (!isset($this->options['ga_pubyear_dimindex'])) { $this->options['ga_pubyear_dimindex'] = 0; $flag = true; } if (!isset($this->options['ga_event_affiliates'])) { $this->options['ga_event_affiliates'] = '/out/'; $flag = true; } if (!isset($this->options['ga_aff_tracking'])) { $this->options['ga_aff_tracking'] = 0; $flag = true; } if (!isset($this->options['ga_hash_tracking'])) { $this->options['ga_hash_tracking'] = 0; $flag = true; } if (!isset($this->options['item_reports'])) { $this->options['item_reports'] = 1; $flag = true; } if (!isset($this->options['dashboard_widget'])) { $this->options['dashboard_widget'] = 1; $flag = true; } if (isset($this->options['ga_tracking_code'])) { unset($this->options['ga_tracking_code']); $flag = true; } if (isset($this->options['ga_dash_jailadmins'])) { if (isset($this->options['ga_dash_jailadmins'])) { // invert disable with enable and change option name $this->options['switch_profile'] = 0; unset($this->options['ga_dash_jailadmins']); $flag = true; } else { $this->options['switch_profile'] = 1; unset($this->options['ga_dash_jailadmins']); $flag = true; } } if ($flag) { $this->set_plugin_options(false); } }