diff options
author | mattab <matthieu.aubry@gmail.com> | 2013-02-17 17:18:40 +0400 |
---|---|---|
committer | Fabian Becker <halfdan@xnorfz.de> | 2013-02-20 04:51:30 +0400 |
commit | 6374b79926667e9115ce880015cf84ecc0fa5bc6 (patch) | |
tree | 890afc2739b5ca18923906f001597c76900d9611 /plugins/UserCountry | |
parent | 808e856e4eca0f684ff845ebbe6151306a4de7ef (diff) |
Fixing more bugs in the build + Mapping visits from China region 14 to Tibet #geohack
Diffstat (limited to 'plugins/UserCountry')
-rwxr-xr-x | plugins/UserCountry/LocationProvider.php | 3 | ||||
-rwxr-xr-x | plugins/UserCountry/LocationProvider/GeoIp.php | 21 | ||||
-rw-r--r-- | plugins/UserCountry/UserCountry.php | 1 |
3 files changed, 19 insertions, 6 deletions
diff --git a/plugins/UserCountry/LocationProvider.php b/plugins/UserCountry/LocationProvider.php index a294b0b25f..a364615338 100755 --- a/plugins/UserCountry/LocationProvider.php +++ b/plugins/UserCountry/LocationProvider.php @@ -375,8 +375,7 @@ abstract class Piwik_UserCountry_LocationProvider { if (is_numeric($location[self::LONGITUDE_KEY])) { - $location[self::LONGITUDE_KEY] = round( - $location[self::LONGITUDE_KEY], self::GEOGRAPHIC_COORD_PRECISION); + $location[self::LONGITUDE_KEY] = round($location[self::LONGITUDE_KEY], self::GEOGRAPHIC_COORD_PRECISION); } else { diff --git a/plugins/UserCountry/LocationProvider/GeoIp.php b/plugins/UserCountry/LocationProvider/GeoIp.php index 54400cacf3..4af024ae96 100755 --- a/plugins/UserCountry/LocationProvider/GeoIp.php +++ b/plugins/UserCountry/LocationProvider/GeoIp.php @@ -52,8 +52,9 @@ abstract class Piwik_UserCountry_LocationProvider_GeoIp extends Piwik_UserCountr */ public function completeLocationResult( &$location ) { + $this->fixupLocation($location); parent::completeLocationResult($location); - + // set region name if region code is set if (empty($location[self::REGION_NAME_KEY]) && !empty($location[self::REGION_CODE_KEY]) @@ -64,8 +65,22 @@ abstract class Piwik_UserCountry_LocationProvider_GeoIp extends Piwik_UserCountr $location[self::REGION_NAME_KEY] = self::getRegionNameFromCodes($countryCode, $regionCode); } } - - + + /** + * Fix up data to work with our SVG maps which include 'Tib' boundaries + */ + protected function fixupLocation( &$location ) + { + if(!empty($location[self::REGION_CODE_KEY]) + && $location[self::REGION_CODE_KEY] == '14' + && !empty($location[self::COUNTRY_CODE_KEY]) + && strtoupper($location[self::COUNTRY_CODE_KEY]) == 'CN') + { + $location[self::COUNTRY_CODE_KEY] = 'ti'; + $location[self::REGION_CODE_KEY] = '1'; + } + } + /** * Returns true if this provider has been setup correctly, the error message if * otherwise. diff --git a/plugins/UserCountry/UserCountry.php b/plugins/UserCountry/UserCountry.php index f9d8ddf143..31bda64852 100644 --- a/plugins/UserCountry/UserCountry.php +++ b/plugins/UserCountry/UserCountry.php @@ -369,7 +369,6 @@ class Piwik_UserCountry extends Piwik_Plugin return; } - $emptyInterestColumns = $archiveProcessing->getNewInterestRow(); while ($row = $query->fetch()) { // get latitude/longitude if there's a city |