From 35b00ac4852d813e00a71d190c8588e58eb4b8c9 Mon Sep 17 00:00:00 2001
From: Stefan Kalscheuer <stefan@stklcode.de>
Date: Fri, 9 Dec 2016 09:37:58 +0100
Subject: [PATCH] Fix #6: hook returns NULL instead of FALSE

---
 README.md                      |  5 ++++-
 inc/statifyblacklist.class.php | 12 ++++++------
 statify-blacklist.php          |  2 +-
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md
index 27232af..c051877 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
 * Contributors:      Stefan Kalscheuer
 * Requires at least: 3.9
 * Tested up to:      4.7
-* Stable tag:        1.3.0
+* Stable tag:        1.3.1
 * License:           GPLv3 or later
 * License URI:       https://www.gnu.org/licenses/gpl-3.0.html
 
@@ -65,6 +65,9 @@ Note, that regular expression matching is significantly slower than the plain do
 
 ## Changelog ##
 
+### 1.3.1 / 09.12.2016 ###
+* Continue filtering if no filter applies (#6)
+
 ### 1.3.0 / 17.10.2016 ###
 * Regular expressions filtering implemented
 
diff --git a/inc/statifyblacklist.class.php b/inc/statifyblacklist.class.php
index 206285e..1b6a7fe 100644
--- a/inc/statifyblacklist.class.php
+++ b/inc/statifyblacklist.class.php
@@ -113,12 +113,12 @@ class StatifyBlacklist {
 	 * @return  TRUE if referer matches blacklist.
 	 *
 	 * @since   1.0.0
-	 * @changed 1.3.0
+	 * @changed 1.3.1
 	 */
 	public static function apply_blacklist_filter() {
 		/* Skip if blacklist is inactive */
 		if ( self::$_options['active_referer'] != 1 ) {
-			return false;
+			return NULL;
 		}
 
 		/* Regular Expression filtering since 1.3.0 */
@@ -130,8 +130,8 @@ class StatifyBlacklist {
 			if ( self::$_options['referer_regexp'] == 2 ) {
 				$regexp .= 'i';
 			}
-			/* Check blacklist */
-			return preg_match( $regexp, $referer) === 1;
+			/* Check blacklist (return NULL to continue filtering) */
+			return (preg_match( $regexp, $referer) === 1) ? true : NULL;
 		} else {
 			/* Extract relevant domain parts */
 			$referer = strtolower( ( isset( $_SERVER['HTTP_REFERER'] ) ? parse_url( $_SERVER['HTTP_REFERER'], PHP_URL_HOST ) : '' ) );
@@ -139,8 +139,8 @@ class StatifyBlacklist {
 			/* Get blacklist */
 			$blacklist = self::$_options['referer'];
 
-			/* Check blacklist */
-			return isset( $blacklist[ $referer ] );
+			/* Check blacklist (return NULL to continue filtering) */
+			return isset($blacklist[ $referer]) ? true : NULL;
 		}
 	}
 }
diff --git a/statify-blacklist.php b/statify-blacklist.php
index 2efcff3..585f929 100644
--- a/statify-blacklist.php
+++ b/statify-blacklist.php
@@ -8,7 +8,7 @@ Author:      Stefan Kalscheuer
 Author URI:  https://stklcode.de
 Plugin URI:  https://wordpress.org/plugins/statify-blacklist
 License:     GPLv3 or later
-Version:     1.3.0
+Version:     1.3.1
 */
 
 /* Quit */