Fix #3: Compare full referer domain

This commit is contained in:
Stefan Kalscheuer 2016-08-29 10:28:13 +02:00
parent f8ab4214de
commit 993d0dd54c
2 changed files with 7 additions and 5 deletions

View File

@ -49,7 +49,7 @@ No. It only prevent's _Statify_ from tracking, nothing more or less.
### Does live filtering impact performance? ### ### Does live filtering impact performance? ###
Yes, but probalby not noticeable. Checking a single referer string against a (usually small) list should be neglectible compared to the total loading procedure. Yes, but probalby not noticeable. Checking a single referer string against a (usually small) list should be neglectible compared to the total loading procedure.
If this still is an issue for you, consider deactivating the filter and only run the one-time-cleanup. If this still is an issue for you, consider deactivating the filter and only run the one-time-cleanup or activate the cron job.
### Is any personal data collected? ### ### Is any personal data collected? ###
No. The privacy policy of _Statify_ is untouched. Data is only processed, not stored or exposed to anyone. No. The privacy policy of _Statify_ is untouched. Data is only processed, not stored or exposed to anyone.
@ -66,6 +66,7 @@ If you like to have this feature, please leave a feature request in GitHub or th
## Changelog ## ## Changelog ##
### 1.2.0 / (work in progress) ### ### 1.2.0 / (work in progress) ###
* Switched from `in_array()` to faster `isset()` for referer checking * Switched from `in_array()` to faster `isset()` for referer checking
* Optional cron execiton implemented
### 1.1.2 / 17.08.2016 ### ### 1.1.2 / 17.08.2016 ###
* Prepared for localization * Prepared for localization

View File

@ -91,6 +91,7 @@ class StatifyBlacklist {
* Update options * Update options
* *
* @param $options array New options to save * @param $options array New options to save
*
* @since 1.0.0 * @since 1.0.0
* @changed 1.1.1 * @changed 1.1.1
*/ */
@ -122,11 +123,11 @@ class StatifyBlacklist {
/* 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 ) : '' ) );
$referer = explode( '.', $referer ); $referer = explode( '.', $referer );
if ( count( $referer ) > 1 ) { // if ( count( $referer ) > 1 ) {
$referer = implode( '.', array_slice( $referer, - 2 ) ); // $referer = implode( '.', array_slice( $referer, - 2 ) );
} else { // } else {
$referer = implode( '.', $referer ); $referer = implode( '.', $referer );
} // }
/* Get blacklist */ /* Get blacklist */
$blacklist = self::$_options['referer']; $blacklist = self::$_options['referer'];