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); } }
function init() { global $_adsensem; //Only run main site code if setup & functional if (adsensem::setup_is_valid()) { add_filter('the_content', array('adsensem', 'filter_ads')); add_action('wp_footer', array('adsensem', 'footer')); } }