diff options
author | mattpiwik <matthieu.aubry@gmail.com> | 2012-11-22 11:30:06 +0400 |
---|---|---|
committer | mattpiwik <matthieu.aubry@gmail.com> | 2012-11-22 11:30:06 +0400 |
commit | 71aa12d6247d944f10f25faecd3639480e6e17ca (patch) | |
tree | f4806ce0187970a38918caddb104e0ffc4aae1ac /plugins/Live/Visitor.php | |
parent | bf0025569239156e657ae1e1a1bb0a37b2341911 (diff) |
Fixes #3566 , #3567
git-svn-id: http://dev.piwik.org/svn/trunk@7526 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'plugins/Live/Visitor.php')
-rw-r--r-- | plugins/Live/Visitor.php | 60 |
1 files changed, 48 insertions, 12 deletions
diff --git a/plugins/Live/Visitor.php b/plugins/Live/Visitor.php index 9cf0aff607..a82e4fdfbe 100644 --- a/plugins/Live/Visitor.php +++ b/plugins/Live/Visitor.php @@ -71,12 +71,17 @@ class Piwik_Live_Visitor 'daysSinceLastVisit' => $this->getDaysSinceLastVisit(), 'daysSinceFirstVisit' => $this->getDaysSinceFirstVisit(), 'daysSinceLastEcommerceOrder' => $this->getDaysSinceLastEcommerceOrder(), + 'continent' => $this->getContinent(), 'country' => $this->getCountryName(), 'countryFlag' => $this->getCountryFlag(), - 'continent' => $this->getContinent(), + 'region' => $this->getRegionName(), + 'city' => $this->getCityName(), 'location' => $this->getPrettyLocation(), + 'latitude' => $this->getLatitude(), + 'longitude' => $this->getLongitude(), 'provider' => $this->getProvider(), 'providerUrl' => $this->getProviderUrl(), + 'referrerType' => $this->getRefererType(), 'referrerTypeName' => $this->getRefererTypeName(), 'referrerName' => $this->getRefererName(), @@ -217,30 +222,61 @@ class Piwik_Live_Visitor { return Piwik_ContinentTranslate(Piwik_Common::getContinent($this->details['location_country'])); } - - function getPrettyLocation() + + function getCityName() { - $parts = array(); - - // add city if it's known - if ($this->details['location_city'] != '') + if (!empty($this->details['location_city'])) { - $parts[] = $this->details['location_city']; + return $this->details['location_city']; } - - // add region if it's known + return null; + } + + public function getRegionName() + { $region = $this->details['location_region']; if ($region != '' && $region != Piwik_Tracker_Visit::UNKNOWN_CODE) { - $parts[] = Piwik_UserCountry_LocationProvider_GeoIp::getRegionNameFromCodes( + return Piwik_UserCountry_LocationProvider_GeoIp::getRegionNameFromCodes( $this->details['location_country'], $region); } - + return null; + } + + function getPrettyLocation() + { + $parts = array(); + + $city = $this->getCityName(); + if(!empty($city)) { + $parts[] = $city; + } + $region = $this->getRegionName(); + if(!empty($region)) { + $parts[] = $region; + } + // add country & return concatenated result $parts[] = $this->getCountryName(); return implode(', ', $parts); } + function getLatitude() + { + if(!empty($this->details['location_latitude'])) { + return $this->details['location_latitude']; + } + return null; + } + + function getLongitude() + { + if(!empty($this->details['location_longitude'])) { + return $this->details['location_longitude']; + } + return null; + } + function getCustomVariables() { $customVariables = array(); |