diff --git a/app/config/localhosts.php b/app/config/localhosts.php new file mode 100644 index 0000000..86edd40 --- /dev/null +++ b/app/config/localhosts.php @@ -0,0 +1,7 @@ +get('referrer'), $result)) { + if (env('APP_STATSFILTERLOCAL', false)) { + if (static::assumed_localhost($item->get('referrer'))) { + continue; + } + } + $entry['ref'] = $item->get('referrer'); $entry['count'] = $item->get('count'); $result[] = $entry; @@ -131,6 +137,19 @@ class HitsModel extends \Asatru\Database\Model return false; } + /** + * Check if the given referrer is a local address + * + * @param $referrer + * @return bool + */ + private static function assumed_localhost($referrer) + { + $localhosts = config('localhosts'); + + return in_array($referrer, $localhosts); + } + /** * Get initial start date *