Skip to content

Commit

Permalink
Fix #6: hook returns NULL instead of FALSE
Browse files Browse the repository at this point in the history
  • Loading branch information
stklcode committed Dec 9, 2016
1 parent d5a947c commit 35b00ac
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions inc/statifyblacklist.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ public static function update_options( $options = null ) {
* @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 */
Expand All @@ -130,17 +130,17 @@ public static function apply_blacklist_filter() {
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 ) : '' ) );

/* 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;
}
}
}
2 changes: 1 addition & 1 deletion statify-blacklist.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
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 */
Expand Down

0 comments on commit 35b00ac

Please sign in to comment.