if ($adrotate_config['stats'] == 1) { add_action('wp_ajax_adrotate_impression', 'adrotate_impression_callback'); add_action('wp_ajax_nopriv_adrotate_impression', 'adrotate_impression_callback'); add_action('wp_ajax_adrotate_click', 'adrotate_click_callback'); add_action('wp_ajax_nopriv_adrotate_click', 'adrotate_click_callback'); } if (!is_admin()) { add_shortcode('adrotate', 'adrotate_shortcode'); add_action("wp_enqueue_scripts", 'adrotate_custom_scripts'); add_action('wp_head', 'adrotate_custom_css'); add_filter('the_content', 'adrotate_inject_posts', 12); } /*-----------------------------------------------------------*/ /*--- Back End ----------------------------------------------*/ if (is_admin()) { adrotate_check_config(); add_action('admin_menu', 'adrotate_dashboard'); add_action("admin_enqueue_scripts", 'adrotate_dashboard_scripts'); add_action("admin_print_styles", 'adrotate_dashboard_styles'); add_action('admin_notices', 'adrotate_notifications_dashboard'); /*--- Internal redirects ------------------------------------*/ if (isset($_POST['adrotate_ad_submit'])) { add_action('init', 'adrotate_insert_input'); } if (isset($_POST['adrotate_group_submit'])) { add_action('init', 'adrotate_insert_group'); } if (isset($_POST['adrotate_action_submit'])) { add_action('init', 'adrotate_request_action'); } if (isset($_POST['adrotate_disabled_action_submit'])) {
function adrotate_core_upgrade() { global $wp_roles; $firstrun = date('U') + 3600; $adrotate_version = get_option("adrotate_version"); if($adrotate_version['current'] < 323) { delete_option('adrotate_notification_timer'); } if($adrotate_version['current'] < 340) { add_option('adrotate_db_timer', date('U')); } if($adrotate_version['current'] < 350) { update_option('adrotate_debug', array('general' => false, 'stats' => false)); } if($adrotate_version['current'] < 351) { wp_clear_scheduled_hook('adrotate_prepare_cache_statistics'); delete_option('adrotate_stats'); } if($adrotate_version['current'] < 352) { adrotate_remove_capability("adrotate_userstatistics"); // OBSOLETE IN 3.5 adrotate_remove_capability("adrotate_globalstatistics"); // OBSOLETE IN 3.5 $role = get_role('administrator'); $role->add_cap("adrotate_advertiser_report"); // NEW IN 3.5 $role->add_cap("adrotate_global_report"); // NEW IN 3.5 } if($adrotate_version['current'] < 353) { if(!is_dir(ABSPATH.'/wp-content/plugins/adrotate/language')) { mkdir(ABSPATH.'/wp-content/plugins/adrotate/language', 0755); } } if($adrotate_version['current'] < 354) { $crawlers = array("Teoma", "alexa", "froogle", "Gigabot", "inktomi","looksmart", "URL_Spider_SQL", "Firefly", "NationalDirectory","Ask Jeeves", "TECNOSEEK", "InfoSeek", "WebFindBot", "girafabot","www.galaxy.com", "Googlebot", "Scooter", "Slurp","msnbot", "appie", "FAST", "WebBug", "Spade", "ZyBorg", "rabaz","Baiduspider", "Feedfetcher-Google", "TechnoratiSnoop", "Rankivabot","Mediapartners-Google", "Sogou web spider", "WebAlta Crawler","bot", "crawler", "yahoo", "msn", "ask", "ia_archiver"); update_option('adrotate_crawlers', $crawlers); } if($adrotate_version['current'] < 355) { if(!is_dir(ABSPATH.'/wp-content/reports')) { mkdir(ABSPATH.'/wp-content/reports', 0755); } } if($adrotate_version['current'] < 356) { adrotate_remove_capability("adrotate_advertiser_report"); $role = get_role('administrator'); $role->add_cap("adrotate_advertiser"); } if($adrotate_version['current'] < 357) { $role = get_role('administrator'); $role->add_cap("adrotate_moderate"); $role->add_cap("adrotate_moderate_approve"); } // 3.8.3.3 if($adrotate_version['current'] < 363) { // Set defaults for internal versions $adrotate_db_version = get_option("adrotate_db_version"); if(empty($adrotate_db_version)) update_option('adrotate_db_version', array('current' => ADROTATE_DB_VERSION, 'previous' => $adrotate_db_version['current'])); } // 3.8.4 if($adrotate_version['current'] < 364) { // Reset wp-cron tasks wp_clear_scheduled_hook('adrotate_ad_notification'); wp_clear_scheduled_hook('adrotate_prepare_cache_statistics'); // OBSOLETE IN 3.6 - REMOVE IN 4.0 wp_clear_scheduled_hook('adrotate_clean_trackerdata'); wp_clear_scheduled_hook('adrotate_evaluate_ads'); if(!wp_next_scheduled('adrotate_clean_trackerdata')) wp_schedule_event($firstrun, 'twicedaily', 'adrotate_clean_trackerdata'); } // 3.8.5.1 if($adrotate_version['current'] < 367) { if(!wp_next_scheduled('adrotate_evaluate_ads')) wp_schedule_event($firstrun, 'twicedaily', 'adrotate_evaluate_ads'); } // 3.8.9 if($adrotate_version['current'] < 368) { if(!is_dir(ABSPATH.'/wp-content/banners')) mkdir(ABSPATH.'/wp-content/banners', 0755); if(!is_dir(ABSPATH.'/wp-content/reports')) mkdir(ABSPATH.'/wp-content/reports', 0755); } // 3.9.9 if($adrotate_version['current'] < 371) { // Reset wp-cron tasks if(!wp_next_scheduled('adrotate_clean_trackerdata')) wp_schedule_event($firstrun + 1800, 'twicedaily', 'adrotate_clean_trackerdata'); if(!wp_next_scheduled('adrotate_evaluate_ads')) wp_schedule_event($firstrun + 3600, 'twicedaily', 'adrotate_evaluate_ads'); } // 3.10 if($adrotate_version['current'] < 373) { add_option('adrotate_responsive_required', 0); } // 3.10.10 (Pro 3.11) if($adrotate_version['current'] < 374) { add_option('adrotate_dynamic_required', 1); } // 3.10.13 if($adrotate_version['current'] < 375) { wp_clear_scheduled_hook('adrotate_clean_trackerdata'); } // 3.10.14 if($adrotate_version['current'] < 376) { adrotate_check_config(); } // 3.11.1 if($adrotate_version['current'] < 377) { delete_option('adrotate_server'); delete_option('adrotate_server_hide'); } // 3.11.2 if($adrotate_version['current'] < 378) { // Reset wp-cron tasks if(!wp_next_scheduled('adrotate_notification')) wp_schedule_event($firstrun, 'daily', 'adrotate_notification'); if(!wp_next_scheduled('adrotate_clean_trackerdata')) wp_schedule_event($firstrun + 1800, 'twicedaily', 'adrotate_clean_trackerdata'); if(!wp_next_scheduled('adrotate_evaluate_ads')) wp_schedule_event($firstrun + 3600, 'twicedaily', 'adrotate_evaluate_ads'); } // 3.11.4 if($adrotate_version['current'] < 379) { $config379 = get_option('adrotate_config'); if($config379['enable_stats'] == 'Y') { $config379['stats'] = 1; } else { $config379['stats'] = 0; } unset($config379['enable_stats']); update_option('adrotate_config', $config379); } // 3.12 if($adrotate_version['current'] < 380) { delete_option('adrotate_roles'); update_option('adrotate_debug', array('general' => false, 'publisher' => false, 'timers' => false, 'track' => false)); if(get_option('adrotate_hide_banner') == 1) update_option('adrotate_hide_banner', adrotate_now()); } update_option("adrotate_version", array('current' => ADROTATE_VERSION, 'previous' => $adrotate_version['current'])); }