Fix #6: hook returns NULL instead of FALSE

This commit is contained in:
Stefan Kalscheuer 2016-12-09 09:37:58 +01:00
parent d5a947cfbb
commit 35b00ac485
3 changed files with 11 additions and 8 deletions

View File

@ -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

View File

@ -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;
}
}
}

View File

@ -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 */