Skip to content

Commit

Permalink
4.0.2
Browse files Browse the repository at this point in the history
* [change] Updated compatibility information
* [change] Updated action links
  • Loading branch information
adegans committed Mar 4, 2025
1 parent f73f598 commit a2759a6
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 22 deletions.
2 changes: 1 addition & 1 deletion analytics-spam-blocker-dashboard.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/* ------------------------------------------------------------------------------------
* COPYRIGHT NOTICE
* Copyright 2016-2024 Arnan de Gans. All Rights Reserved.
* Copyright 2016-2025 Arnan de Gans. All Rights Reserved.
* COPYRIGHT NOTICES AND ALL THE COMMENTS SHOULD REMAIN INTACT.
* By using this code you agree to indemnify Arnan de Gans from any
Expand Down
24 changes: 12 additions & 12 deletions analytics-spam-blocker-functions.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/* ------------------------------------------------------------------------------------
* COPYRIGHT NOTICE
* Copyright 2016-2023 Arnan de Gans. All Rights Reserved.
* Copyright 2016-2025 Arnan de Gans. All Rights Reserved.
* COPYRIGHT NOTICES AND ALL THE COMMENTS SHOULD REMAIN INTACT.
* By using this code you agree to indemnify Arnan de Gans from any
Expand Down Expand Up @@ -106,7 +106,7 @@ function spamblocker_report_submit() {
$new_domain = $new_domain['host'];

// Load existing domains
$custom_domains = get_option('ajdg_spamblocker_domains');
$custom_domains = get_option('ajdg_spamblocker_domains');
$remote_domains = spamblocker_load_remote_domains();

// Process and response
Expand All @@ -122,11 +122,11 @@ function spamblocker_report_submit() {
if(!in_array($new_domain, $custom_domains['domains'])) {
$custom_domains['domains'][] = $new_domain;
}

update_option('ajdg_spamblocker_domains', $custom_domains);

spamblocker_edit_htaccess();

spamblocker_return(200);
}
} else {
Expand Down Expand Up @@ -205,7 +205,7 @@ function spamblocker_clean_htaccess($start, $end) {
-------------------------------------------------------------*/
function spamblocker_load_remote_domains() {
$domain_file = WP_CONTENT_DIR.'/spamblocker_remote_domains.data';

if(!is_file($domain_file)) {
// Create file if it doesn't exist
$domains = array('updated' => 0, 'domain_count' => 0, 'domains' => array());
Expand All @@ -214,7 +214,7 @@ function spamblocker_load_remote_domains() {
// Read file
$domains = unserialize(file_get_contents($domain_file));
}

return $domains;
}

Expand All @@ -235,14 +235,14 @@ function spamblocker_get_spam_domains() {
// Get latest blocklist
$args = array('headers' => array('Accept' => 'multipart/form-data'), 'user-agent' => 'analytics-spam-blocker/'.$plugin_version.';', 'sslverify' => false, 'timeout' => 5);
$response = wp_remote_get('https://raw.githubusercontent.com/matomo-org/referrer-spam-list/master/spammers.txt', $args);

if(!is_wp_error($response) AND !empty($response['body'])) {
$new_domains = array();

// Turn string into an array
$new_domains['domains'] = explode("\n", trim($response['body']));
$how_many = count($new_domains['domains']);

if($how_many > 0) {
$domains['updated'] = current_time('timestamp');
$domains['domain_count'] = $how_many;
Expand Down Expand Up @@ -288,7 +288,7 @@ function spamblocker_notifications_dashboard() {
if($birthday_banner < current_time('timestamp') AND date('M', current_time('timestamp')) == 'Feb') {
echo '<div class="ajdg-spamblocker-notification notice" style="">';
echo ' <div class="ajdg-spamblocker-notification-logo" style="background-image: url(\''.plugins_url('/images/birthday.png', __FILE__).'\');"><span></span></div>';
echo ' <div class="ajdg-spamblocker-notification-message">Hey <strong>'.$displayname.'</strong>! Did you know it is Arnan his birtyday this month? February 9th to be exact. Wish him a happy birthday via Telegram!<br />Who is Arnan? He made Analytics Spam Blocker for you - Check out his <a href="https://www.arnan.me/?mtm_campaign=ajdg_spamblocker&mtm_keyword=birthday_banner" target="_blank">website</a> or <a href="https://www.arnan.me/donate.html?mtm_campaign=ajdg_spamblocker&mtm_keyword=birthday_banner" target="_blank">send a gift</a>.</div>';
echo ' <div class="ajdg-spamblocker-notification-message">Hey <strong>'.$displayname.'</strong>! Did you know it is Arnan his birtyday this month? February 9th to be exact. Wish him a happy birthday via Telegram!<br />Who is Arnan? He made Analytics Spam Blocker for you - Check out his <a href="https://www.arnan.me/" target="_blank">website</a> or <a href="https://www.arnan.me/donate.html" target="_blank">send a gift</a>.</div>';
echo ' <div class="ajdg-spamblocker-notification-cta">';
echo ' <a href="https://t.me/arnandegans" target="_blank" class="ajdg-spamblocker-notification-act button-primary"><i class="icn-tg"></i>Wish Happy Birthday</a>';
echo ' <a href="tools.php?page=analytics-spam-blocker&hide=2" class="ajdg-spamblocker-notification-dismiss">Done it</a>';
Expand All @@ -303,8 +303,8 @@ function spamblocker_notifications_dashboard() {
-------------------------------------------------------------*/
function spamblocker_action_links($links) {
$links['ajdg-spamblocker-settings'] = sprintf('<a href="%s">%s</a>', admin_url('tools.php?page=analytics-spam-blocker'), 'Settings');
$links['ajdg-spamblocker-help'] = sprintf('<a href="%s" target="_blank">%s</a>', 'https://ajdg.solutions/forums/?mtm_campaign=ajdg_spamblocker', 'Support');
$links['ajdg-spamblocker-more'] = sprintf('<a href="%s" target="_blank">%s</a>', 'https://ajdg.solutions/plugins/?mtm_campaign=ajdg_spamblocker', 'More plugins');
$links['ajdg-spamblocker-help'] = sprintf('<a href="%s" target="_blank">%s</a>', 'https://support.ajdg.net/', 'Support');
$links['ajdg-spamblocker-more'] = sprintf('<a href="%s" target="_blank">%s</a>', 'https://ajdg.solutions/plugins/', 'More plugins');

return $links;
}
Expand Down
8 changes: 4 additions & 4 deletions analytics-spam-blocker.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?php
/*
Plugin Name: Analytics Spam Blocker
Plugin URI: https://ajdg.solutions/product/analytics-spam-blocker/?mtm_campaign=ajdg_spamblocker
Plugin URI: https://ajdg.solutions/product/analytics-spam-blocker/
Author: Arnan de Gans
Author URI: https://www.arnan.me/?mtm_campaign=ajdg_spamblocker
Author URI: https://www.arnan.me/
Description: Stop referrer spam from affecting your website analytics. Easily create a local blocklist and report new domains to stay on top of the issue.
Text Domain: analytics-spam-blocker
Domain Path: /languages/
Version: 4.0
Version: 4.0.2
License: GPLv3
*/

/* ------------------------------------------------------------------------------------
* COPYRIGHT NOTICE
* Copyright 2016-2024 Arnan de Gans. All Rights Reserved.
* Copyright 2016-2025 Arnan de Gans. All Rights Reserved.
* COPYRIGHT NOTICES AND ALL THE COMMENTS SHOULD REMAIN INTACT.
* By using this code you agree to indemnify Arnan de Gans from any
Expand Down
18 changes: 13 additions & 5 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ Contributors: adegans
Tags: analytics, spam, referral spam, referrer spam, antispam
Donate link: https://www.arnan.me/donate.html
Requires at least: 4.9
Tested up to: 6.5.2
Stable tag: 4.0
Tested up to: 6.7.2
Stable tag: 4.0.2
License: GPLv3

Prevent referrer spam from affecting your website analytics. Easily create a local blocklist and receive new domains weekly to stay on top of the issue.

== Description ==
Installing **Analytics Spam Blocker** is almost a must-have for any WordPress or ClassicPress website that collects visitor analytics with something like Matomo Analytics, Google Analytics or similar services. Accurate analytics are often a vital tool to track your website's performance or just to see how many visitors you get.
Installing **Analytics Spam Blocker** is almost a must-have for any WordPress or ClassicPress website that collects visitor analytics with something like Matomo Analytics, Google Analytics or similar services. Accurate analytics are often a vital tool to track your website's performance or just to see how many visitors you get.

Unfortunately there are lots of spambots from every shady corner of the internet that bounce off your website and give you false records in your analytics - This is called 'referral spam' or 'referrer spam'.

Expand All @@ -20,7 +20,15 @@ With **Analytics Spam Blocker** you can easily add new domains that you find and

== Changelog ==

= 4.0 - June 21, 2024 =
= 4.0.2 - March 4, 2025 =
* [change] Updated compatibility information
* [change] Updated action links

= 4.0.1 - December 17, 2024 =
* [change] Updated compatibility information
* [change] Updated copyright notices

= 4.0 - June 21, 2024 =
* [new] Referral spam list from Matomo
* [new] Weekly update referrel spam list from Matomo
* [new] Check if domain already is blocked
Expand Down Expand Up @@ -186,4 +194,4 @@ Yep, check out my website [AJdG Solutions](https://ajdg.solutions/plugins/?mtm_c

== Screenshots ==

1. Dashboard
1. Dashboard

0 comments on commit a2759a6

Please sign in to comment.