diff options
author | sgiehl <stefan@piwik.org> | 2014-10-24 00:15:07 +0400 |
---|---|---|
committer | sgiehl <stefan@piwik.org> | 2014-10-24 00:15:07 +0400 |
commit | dcf956506a3712f99864340692d0e94add41f696 (patch) | |
tree | 887ff4aa4dd61dd8320392e1697d9a382df2b93e /plugins/DevicesDetection | |
parent | d34a8769b9f36faa5ab8894ee1abeb938bfe9bf0 (diff) |
extend browser and os details in devicesdetection plugin
Diffstat (limited to 'plugins/DevicesDetection')
-rw-r--r-- | plugins/DevicesDetection/DevicesDetection.php | 13 | ||||
-rw-r--r-- | plugins/DevicesDetection/Visitor.php | 68 |
2 files changed, 76 insertions, 5 deletions
diff --git a/plugins/DevicesDetection/DevicesDetection.php b/plugins/DevicesDetection/DevicesDetection.php index 004fc96721..b27710f7cc 100644 --- a/plugins/DevicesDetection/DevicesDetection.php +++ b/plugins/DevicesDetection/DevicesDetection.php @@ -49,13 +49,16 @@ class DevicesDetection extends \Piwik\Plugin $instance = new Visitor($details); $visitor['deviceType'] = $instance->getDeviceType(); + $visitor['operatingSystem'] = $instance->getOperatingSystem(); + $visitor['operatingSystemCode'] = $instance->getOperatingSystemCode(); + $visitor['operatingSystemShortName'] = $instance->getOperatingSystemShortName(); + $visitor['operatingSystemIcon'] = $instance->getOperatingSystemIcon(); $visitor['browserFamily'] = $instance->getBrowserEngine(); $visitor['browserFamilyDescription'] = $instance->getBrowserEngineDescription(); - - if (!PluginManager::getInstance()->isPluginActivated('UserSettings')) { - $instance = new UserSettings(); - $instance->extendVisitorDetails($visitor, $details); - } + $visitor['browserName'] = $instance->getBrowser(); + $visitor['browserIcon'] = $instance->getBrowserIcon(); + $visitor['browserCode'] = $instance->getBrowserCode(); + $visitor['browserVersion'] = $instance->getBrowserVersion(); } } diff --git a/plugins/DevicesDetection/Visitor.php b/plugins/DevicesDetection/Visitor.php index 478b76deea..efcc69b196 100644 --- a/plugins/DevicesDetection/Visitor.php +++ b/plugins/DevicesDetection/Visitor.php @@ -24,6 +24,54 @@ class Visitor return getDeviceTypeLabel($this->details['config_device_type']); } + public function getOperatingSystemCode() + { + return $this->details['config_os']; + } + + public function getOperatingSystem() + { + return getOsFullName($this->details['config_os']); + } + + public function getOperatingSystemShortName() + { + $shortNameMapping = array( + 'PS3' => 'PS3', + 'PSP' => 'PSP', + 'WII' => 'Wii', + 'WIU' => 'Wii U', + 'NDS' => 'DS', + 'DSI' => 'DSi', + '3DS' => '3DS', + 'PSV' => 'PS Vita', + 'WI8' => 'Win 8', + 'WI7' => 'Win 7', + 'WVI' => 'Win Vista', + 'WS3' => 'Win S2003', + 'WXP' => 'Win XP', + 'W98' => 'Win 98', + 'W2K' => 'Win 2000', + 'WNT' => 'Win NT', + 'WME' => 'Win Me', + 'W95' => 'Win 95', + 'WPH' => 'WinPhone', + 'WMO' => 'WinMo', + 'WCE' => 'Win CE', + 'WOS' => 'webOS', + ); + $osShort = $this->details['config_os']; + if (array_key_exists($osShort, $shortNameMapping)) { + return $shortNameMapping[$osShort]; + } + return getOsFullName($osShort); + } + + public function getOperatingSystemIcon() + { + return getBrowserEngineName($this->details['config_os']); + } + public function getBrowserEngineDescription() { return getBrowserEngineName($this->getBrowserEngine()); @@ -33,4 +81,24 @@ class Visitor { return $this->details['config_browser_engine']; } + + public function getBrowserCode() + { + return $this->details['config_browser_name']; + } + + public function getBrowserVersion() + { + return $this->details['config_browser_version']; + } + + public function getBrowser() + { + return getBrowserName($this->details['config_browser_name'] . ";" . $this->details['config_browser_version']); + } + + public function getBrowserIcon() + { + return getBrowserLogo($this->details['config_browser_name'] . ";" . $this->details['config_browser_version']); + } }
\ No newline at end of file |