diff options
author | sgiehl <stefan@piwik.org> | 2014-07-17 13:20:34 +0400 |
---|---|---|
committer | sgiehl <stefan@piwik.org> | 2014-07-17 13:20:42 +0400 |
commit | 9322c518cda57e2b0aea869a2f8da6afd4062ea8 (patch) | |
tree | fcb1a8e2f7dad124ac5a3bbf87f613bdaed58a5a /core/UrlHelper.php | |
parent | ca84f227dc1de30fd96e76ab5e7f61d5d5adca87 (diff) |
fixes #5851 - allow empty keyword parameter for all search engines, as more and more are starting to hide the keywords in referrer
Diffstat (limited to 'core/UrlHelper.php')
-rw-r--r-- | core/UrlHelper.php | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/core/UrlHelper.php b/core/UrlHelper.php index b2bbd229bb..9262ec392d 100644 --- a/core/UrlHelper.php +++ b/core/UrlHelper.php @@ -394,20 +394,18 @@ class UrlHelper $key = self::getParameterFromQueryString($query, $variableName); $key = trim(urldecode($key)); - // Special case: Google & empty q parameter + // Special cases: empty or no keywords if (empty($key) - && $variableName == 'q' - && ( // Google search with no keyword ($searchEngineName == 'Google' - && ( // First, they started putting an empty q= parameter - strpos($query, '&q=') !== false - || strpos($query, '?q=') !== false - // then they started sending the full host only (no path/query string) - || (empty($query) && (empty($referrerPath) || $referrerPath == '/') && empty($referrerParsed['fragment'])) - ) + && (empty($query) && (empty($referrerPath) || $referrerPath == '/') && empty($referrerParsed['fragment'])) ) + + // empty keyword parameter + || strpos($query, sprintf('&%s=', $variableName)) !== false + || strpos($query, sprintf('?%s=', $variableName)) !== false + // search engines with no keyword || $searchEngineName == 'Google Images' || $searchEngineName == 'DuckDuckGo') |