function go()
 {
     global $_adsensem;
     $upgraded = false;
     /* List of possible upgrade paths here: Ensure that versions automagically stack on top of one another
     			e.g. v1.x to v3.x should be possilbe v1.x > v2.x > v3.x */
     if (adsensem_admin::version_upgrade($_adsensem['version'], "3.0")) {
         adsensem_upgrade::v2_x_to_3_0();
         $upgraded = true;
     }
     //Previous version bugfix
     if (!is_numeric($_adsensem['be-nice'])) {
         $_adsensem['be-nice'] = ADSENSEM_BE_NICE;
     }
     //Write notice, ONLY IF UPGRADE HAS OCCURRED
     if ($upgraded) {
         adsensem_admin::add_notice('upgrade adsense-manager', 'AdSense Manager has detected a previous installation and automatically upgraded your settings', 'ok');
     }
     $_adsensem['version'] = ADSENSEM_VERSION;
 }
 function init_admin()
 {
     global $_adsensem;
     add_action('admin_head', array('adsensem_admin', 'add_header_script'));
     add_action('admin_footer', array('adsensem_admin', 'admin_callback_editor'));
     wp_enqueue_script('prototype');
     wp_enqueue_script('postbox');
     add_submenu_page('edit.php', "Ad Units", "Ad Units", 10, "adsense-manager-manage-ads", array('adsensem_admin', 'admin_manage'));
     add_options_page("AdSense Manager Options", "AdSense Manager", 10, "adsense-manager-options", array('adsensem_admin', 'admin_options'));
     add_action('admin_notices', array('adsensem_admin', 'admin_notices'), 1);
     if (adsensem::setup_is_valid() == false) {
         //No startup data found, fill it out now.
         /* Wipe basic data  */
         $_adsensem['ads'] = array();
         //'demo-adroll' => new Ad_ShoppingAds,
         $_adsensem['defaults'] = array();
         $_adsensem['account-ids'] = array();
         $_adsensem['default-ad'] == '';
         $_adsensem['be-nice'] = ADSENSEM_BE_NICE;
         $_adsensem['version'] = ADSENSEM_VERSION;
         $deluxe = get_option('acmetech_adsensedeluxe');
         if (is_array($deluxe)) {
             adsensem_admin::add_notice('upgrade adsense-deluxe', 'AdSense Manager has detected a previous installation of <strong>AdSense Deluxe</strong>. Import settings?', 'yn');
         }
         $update_adsensem = true;
     } else {
         if (adsensem_admin::version_upgrade($_adsensem['version'], ADSENSEM_VERSION)) {
             require 'class-upgrade.php';
             //Backup cycle
             $backup = get_option('plugin_adsensem_backup');
             $backup[adsensem_admin::major_version($_adsensem['version'])] = $_adsensem;
             update_option('plugin_adsensem_backup', $backup);
             unset($backup);
             adsensem_upgrade::go();
             $update_adsensem = true;
         }
     }
     if ($update_adsensem) {
         update_option('plugin_adsensem', $_adsensem);
     }
 }