'not_registered')); update_option('asb_domains', array('updated' => 0, 'domains' => array())); update_option('asb_stats', array('active_subscribers' => 'n/a', 'active_sites' => 'n/a', 'reported_sites' => 'n/a', 'reports_submitted' => 'n/a', 'reports_user' => 'n/a')); update_option('asb_error', false); update_option('asb_hide_review', current_time('timestamp')); update_option('asb_hide_register', current_time('timestamp')); // Set up htaccess if((!file_exists(ABSPATH.'.htaccess') AND is_writable(ABSPATH)) OR is_writable(ABSPATH.'.htaccess')) { // Edit htaccess asb_edit_htaccess(); // Clean old config (Remove in 3.0 or so) asb_clean_htaccess('# BEGIN Analytics Spam Blocker', '# END Analytics Spam Blocker'); } else { // Not writable wp_die(_e('Your .htaccess file or root WordPress directory is not writable')); } } /*------------------------------------------------------------- Name: asb_deactivate Since: 2.0 -------------------------------------------------------------*/ function asb_deactivate() { // Cancel API subscription $subscription = get_option('asb_subscription'); if($subscription['status'] == 'reg') { asb_api_deactivate(); wp_clear_scheduled_hook('asb_blocklist_update'); } // Delete data delete_option('asb_subscription'); delete_option('asb_domains'); delete_option('asb_reports'); // Obsolete delete_option('asb_stats'); delete_option('asb_error'); delete_option('asb_hide_review'); delete_option('asb_hide_register'); // Clean .htaccess if(is_writable(ABSPATH.'.htaccess')) { asb_clean_htaccess('# Analytics Spam Blocker - Start', '# Analytics Spam Blocker - End'); } else { // Not writable wp_die(_e('Your .htaccess file is not writable!')); } } /*------------------------------------------------------------- Name: asb_check_config Purpose: Verify or reset settings Since: 2.5 -------------------------------------------------------------*/ function asb_check_config() { $two_days = current_time('timestamp') + (2 * 86400); $review = get_option('asb_hide_review'); if(!$review) update_option('asb_hide_review', $two_days); $register = get_option('asb_hide_register'); if(!$register) update_option('asb_hide_register', $two_days); } /*------------------------------------------------------------- Name: asb_schedule_updates Since: 2.0 -------------------------------------------------------------*/ function asb_schedule_updates() { if(!wp_next_scheduled('asb_blocklist_update')) wp_schedule_event(time() + 120, 'daily', 'asb_blocklist_update'); } /*------------------------------------------------------------- Name: asb_rules Since: 2.0 -------------------------------------------------------------*/ function asb_rules() { $rules[] = "\n# Analytics Spam Blocker - Start\n"; $rules[] = "SetEnvIfNoCase Referer semalt.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer darodar.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer buttons-for-website.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer fbdownloader.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer descargar-musicas-gratis.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer baixar-musicas-gratis.comsavetubevideo.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer srecorder.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer kambasoft.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer ilovevitaly.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer ilovevitaly.co spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer ilovevitaly.ru spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer blackhatworth.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer priceg.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer backgroundpictures.net spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer embedle.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer extener.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer extener.org spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer fbfreegifts.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer feedouble.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer feedouble.net spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer japfm.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer joinandplay.me spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer joingames.org spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer iskalko.ru spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer musicprojectfoundation.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer myprintscreen.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer slftsdybbg.ru spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer edakgfvwql.ru spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer openfrost.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer openfrost.net spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer openmediasoft.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer serw.clicksor.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer socialseet.ru spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer sharebutton.net spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer cityadspix.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer screentoolkit.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer softomix.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer softomix.net spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer softomix.ru spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer gobongo.info spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer myftpupload.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer websocial.me spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer luxup.ru spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer ykecwqlixx.ru spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer soundfrost.org spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer seoexperimenty.ru spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer cenokos.ru spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer star61.de spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer superiends.org spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer vapmedia.org spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer econom.co spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer vodkoved.ru spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer adcash.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer videofrost.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer youtubedownload.org spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer zazagames.org spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer 7makemoneyonline.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer ranksonic.info spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer yougetsignal.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer cenoval.ru spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer simple-share-buttons.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer o-o-6-o-o.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer o-o-8-o-o.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer s.click.aliexpress.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer social-buttons.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer best-seo-offer.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer best-seo-solution.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer buttons-for-your-website.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer www.get-free-traffic-now.com spambot=yes\n"; $rules[] = "SetEnvIfNoCase Referer free-share-buttons.co spambot=yes\n"; $rules[] = "Order allow,deny\n"; $rules[] = "Allow from all\n"; $rules[] = "Deny from env=spambot\n"; $rules[] = "# Analytics Spam Blocker - End"; return $rules; } /*------------------------------------------------------------- Name: asb_edit_htaccess Since: 2.0 -------------------------------------------------------------*/ function asb_edit_htaccess($rules = false) { // Defaults $formatted = false; $file_content = $new_rules = array(); // Remove current rules asb_clean_htaccess('# Analytics Spam Blocker - Start', '# Analytics Spam Blocker - End'); // Read current file without rules if(file_exists(ABSPATH.'.htaccess')){ $file_content = file(ABSPATH.'.htaccess'); } // Format downloaded rules if any if($rules) { $formatted[] = "# Analytics Spam Blocker - Start\n"; foreach($rules as $rule) { $formatted[] = "SetEnvIfNoCase Referer $rule spambot=yes\n"; } $formatted[] = "Order allow,deny\n"; $formatted[] = "Allow from all\n"; $formatted[] = "Deny from env=spambot\n"; $formatted[] = "# Analytics Spam Blocker - End"; } $new_rules = (!is_array($formatted)) ? asb_rules() : $formatted; $lines = array_merge($file_content, $new_rules); unset($file_content, $new_rules); // Write new rules $fp = fopen(ABSPATH.'.htaccess', 'w'); foreach($lines as $line){ fwrite($fp, "$line"); } fclose($fp); unset($fp); } /*------------------------------------------------------------- Name: asb_clean_htaccess Since: 2.0 -------------------------------------------------------------*/ function asb_clean_htaccess($start, $end) { $file_content = file_get_contents(ABSPATH.'.htaccess'); $beginning_position = strpos($file_content, $start); $ending_position = strpos($file_content, $end); if($beginning_position !== false AND $ending_position !== false) { $delete_old = substr($file_content, $beginning_position, ($ending_position + strlen($end)) - $beginning_position); $clean_content = str_replace($delete_old, '', $file_content); $fp = fopen(ABSPATH.'.htaccess', 'w'); fwrite($fp, $clean_content); fclose($fp); unset($delete_old, $clean_content, $fp); } unset($file_content); } /*------------------------------------------------------------- Name: asb_notifications_dashboard Since: 2.1 -------------------------------------------------------------*/ function asb_notifications_dashboard() { if(isset($_GET['hide'])) { if($_GET['hide'] == 1) update_option('asb_hide_review', 1); if($_GET['hide'] == 2) update_option('asb_hide_register', 1); } $review_banner = get_option('asb_hide_review'); if($review_banner != 1 AND $review_banner < (current_time('timestamp') - 1214600)) { echo '
.')
We all want accurate and true analytics for our websites. With the growing trend of Analytics Referral Spam monitoring analytics can be a cumbersome and misleading affair. Analytics dashboards such as those from Google Analytics are increasingly irrelevant if you do not counter against spam domains showing up in your referrals. Your reports are important to combat referral spam!
'. 'Analytics Spam Blocker has a unique system to report referral spam straight from your dashboard. This makes it really easy to report and get rid of referral spam domains. Simply enter the domain name, indicate how sure you are of the domain being spam and click report. After a few people report the domain it will be distributed to all users of Analytics Spam Blocker every 24 hours.
'. ''.__('Need help?', 'analytics-spam-blocker').' '.__('Support Forum', 'analytics-spam-blocker').' & '.__('Contact Form', 'analytics-spam-blocker').'.
' )); $screen->add_help_tab(array( 'id' => 'asb_thanks', 'title' => 'Thank You', 'content' => 'Analytics Spam Blocker is growing to be a popular WordPress plugins for protecting your website. Analytics Spam Blocker wouldn\'t be possible without your support and my life wouldn\'t be what it is today without your help.
- Arnan
'. 'Add me: Facebook, LinkedIn More Plugins: ajdg.solutions Arnan\'s Site: arnan.me
' )); } /*------------------------------------------------------------- Name: asb_action_links Since: 2.7.1 -------------------------------------------------------------*/ function asb_action_links($links) { $custom_actions = array(); $custom_actions['asb-help'] = sprintf('%s', 'https://ajdg.solutions/support/', 'Support'); $custom_actions['asb-arnan'] = sprintf('%s', 'https://www.arnan.me/', 'arnan.me'); return array_merge($custom_actions, $links); } /*------------------------------------------------------------- Name: asb_return Since: 2.0 -------------------------------------------------------------*/ function asb_return($page, $status, $args = null) { if(strlen($page) > 0 AND ($status > 0 AND $status < 1000)) { $defaults = array( 'status' => $status ); $arguments = wp_parse_args($args, $defaults); $redirect = 'tools.php?page=' . $page . '&'.http_build_query($arguments); } else { $redirect = 'tools.php?page=analytics-spam-blocker'; } wp_redirect($redirect); } /*------------------------------------------------------------- Name: asb_status Since: 2.0 -------------------------------------------------------------*/ function asb_status($status) { $error = get_option('asb_error'); $before = ''; $between = ''; $after = ''.__('Something went wrong registering your website. Please review the error below and try again.', 'analytics-spam-blocker').'
'.$status.' - '.$text.'
'.__('Your name, email address and a referral domain name are required. Please try again.', 'analytics-spam-blocker').'
'.__('Something went wrong reporting the domain. Please try again.', 'analytics-spam-blocker').'
'.__('The domain you are trying to report is not valid. Please try again.', 'analytics-spam-blocker').'
'.__('Please use your valid email address', 'analytics-spam-blocker').'
'.__('Unexpected error', 'analytics-spam-blocker').'
'.__('WordPress was unable to verify the authenticity of the url you have clicked. Verify if the url used is valid or log in via your browser.', 'analytics-spam-blocker').'
'; echo ''.__('If you have received the url you want to visit via email, you are being tricked!', 'analytics-spam-blocker').'
'; echo ''.__('Contact support if the issue persists:', 'analytics-spam-blocker').' AJdG Solutions Support.
'; } ?>