diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-06-18 07:32:04 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-06-18 07:32:04 +0400 |
commit | 9a53a0c020ac7fb6addf076c62174b944f5e4091 (patch) | |
tree | 7d3095d02102394f0f3cd6ca0f3adc6177a49321 /plugins/UserCountry | |
parent | 88c1b8deeb476fb184f7d9670e74f6cffb6cad35 (diff) |
make sure to highlight the correct report in the menu and fix paging/changing report params via UI did not work correctly
Diffstat (limited to 'plugins/UserCountry')
-rw-r--r-- | plugins/UserCountry/Columns/Base.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/plugins/UserCountry/Columns/Base.php b/plugins/UserCountry/Columns/Base.php index 71720a5655..fed9271543 100644 --- a/plugins/UserCountry/Columns/Base.php +++ b/plugins/UserCountry/Columns/Base.php @@ -21,7 +21,7 @@ use Piwik\Tracker\Request; abstract class Base extends VisitDimension { - private $cachedLocations = array(); + private static $cachedLocations = array(); protected function getUrlOverrideValueIfAllowed($urlParamToOverride, Request $request) { @@ -57,6 +57,7 @@ abstract class Base extends VisitDimension { $ipAddress = $this->getIpAddress($visitor->getVisitorColumn('location_ip'), $request); $language = $visitor->getVisitorColumn('location_browser_lang'); + $userInfo = array('lang' => $language, 'ip' => $ipAddress); return $userInfo; @@ -68,8 +69,8 @@ abstract class Base extends VisitDimension $key = md5(implode(',', $userInfo)); - if (array_key_exists($key, $this->cachedLocations)) { - return $this->cachedLocations[$key]; + if (array_key_exists($key, self::$cachedLocations)) { + return self::$cachedLocations[$key]; } $provider = $this->getProvider(); @@ -86,11 +87,15 @@ abstract class Base extends VisitDimension } } + if (empty($location)) { + $location = array(); + } + if (empty($location['country_code'])) { // sanity check $location['country_code'] = Visit::UNKNOWN_CODE; } - $this->cachedLocations[$key] = $location; + self::$cachedLocations[$key] = $location; return $location; } |