Fix #6: hook returns NULL instead of FALSE
This commit is contained in:
parent
d5a947cfbb
commit
35b00ac485
@ -2,7 +2,7 @@
|
|||||||
* Contributors: Stefan Kalscheuer
|
* Contributors: Stefan Kalscheuer
|
||||||
* Requires at least: 3.9
|
* Requires at least: 3.9
|
||||||
* Tested up to: 4.7
|
* Tested up to: 4.7
|
||||||
* Stable tag: 1.3.0
|
* Stable tag: 1.3.1
|
||||||
* License: GPLv3 or later
|
* License: GPLv3 or later
|
||||||
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
* 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 ##
|
## Changelog ##
|
||||||
|
|
||||||
|
### 1.3.1 / 09.12.2016 ###
|
||||||
|
* Continue filtering if no filter applies (#6)
|
||||||
|
|
||||||
### 1.3.0 / 17.10.2016 ###
|
### 1.3.0 / 17.10.2016 ###
|
||||||
* Regular expressions filtering implemented
|
* Regular expressions filtering implemented
|
||||||
|
|
||||||
|
@ -113,12 +113,12 @@ class StatifyBlacklist {
|
|||||||
* @return TRUE if referer matches blacklist.
|
* @return TRUE if referer matches blacklist.
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @changed 1.3.0
|
* @changed 1.3.1
|
||||||
*/
|
*/
|
||||||
public static function apply_blacklist_filter() {
|
public static function apply_blacklist_filter() {
|
||||||
/* Skip if blacklist is inactive */
|
/* Skip if blacklist is inactive */
|
||||||
if ( self::$_options['active_referer'] != 1 ) {
|
if ( self::$_options['active_referer'] != 1 ) {
|
||||||
return false;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Regular Expression filtering since 1.3.0 */
|
/* Regular Expression filtering since 1.3.0 */
|
||||||
@ -130,8 +130,8 @@ class StatifyBlacklist {
|
|||||||
if ( self::$_options['referer_regexp'] == 2 ) {
|
if ( self::$_options['referer_regexp'] == 2 ) {
|
||||||
$regexp .= 'i';
|
$regexp .= 'i';
|
||||||
}
|
}
|
||||||
/* Check blacklist */
|
/* Check blacklist (return NULL to continue filtering) */
|
||||||
return preg_match( $regexp, $referer) === 1;
|
return (preg_match( $regexp, $referer) === 1) ? true : NULL;
|
||||||
} else {
|
} else {
|
||||||
/* Extract relevant domain parts */
|
/* Extract relevant domain parts */
|
||||||
$referer = strtolower( ( isset( $_SERVER['HTTP_REFERER'] ) ? parse_url( $_SERVER['HTTP_REFERER'], PHP_URL_HOST ) : '' ) );
|
$referer = strtolower( ( isset( $_SERVER['HTTP_REFERER'] ) ? parse_url( $_SERVER['HTTP_REFERER'], PHP_URL_HOST ) : '' ) );
|
||||||
@ -139,8 +139,8 @@ class StatifyBlacklist {
|
|||||||
/* Get blacklist */
|
/* Get blacklist */
|
||||||
$blacklist = self::$_options['referer'];
|
$blacklist = self::$_options['referer'];
|
||||||
|
|
||||||
/* Check blacklist */
|
/* Check blacklist (return NULL to continue filtering) */
|
||||||
return isset( $blacklist[ $referer ] );
|
return isset($blacklist[ $referer]) ? true : NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ Author: Stefan Kalscheuer
|
|||||||
Author URI: https://stklcode.de
|
Author URI: https://stklcode.de
|
||||||
Plugin URI: https://wordpress.org/plugins/statify-blacklist
|
Plugin URI: https://wordpress.org/plugins/statify-blacklist
|
||||||
License: GPLv3 or later
|
License: GPLv3 or later
|
||||||
Version: 1.3.0
|
Version: 1.3.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Quit */
|
/* Quit */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user