diff options
author | sgiehl <stefan@piwik.org> | 2014-11-16 00:07:01 +0300 |
---|---|---|
committer | sgiehl <stefan@piwik.org> | 2014-11-16 00:07:01 +0300 |
commit | 170e5e3a3771c9b29754a051bc4f1ba61413a63a (patch) | |
tree | c33582b0c26445e72599e7175b135fe4e1dbe49f /plugins | |
parent | dff3519bc9152076062b1cd046594103756a5d42 (diff) |
added shortlabel again to keep BC
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/DevicesDetection/API.php | 5 | ||||
-rw-r--r-- | plugins/DevicesDetection/Visitor.php | 30 | ||||
-rw-r--r-- | plugins/DevicesDetection/functions.php | 32 |
3 files changed, 37 insertions, 30 deletions
diff --git a/plugins/DevicesDetection/API.php b/plugins/DevicesDetection/API.php index 3f4ba9c2c4..a90cd37219 100644 --- a/plugins/DevicesDetection/API.php +++ b/plugins/DevicesDetection/API.php @@ -136,9 +136,12 @@ class API extends \Piwik\Plugin\API * @param bool|string $segment * @return DataTable */ - public function getOsVersions($idSite, $period, $date, $segment = false) + public function getOsVersions($idSite, $period, $date, $segment = false, $addShortLabel = true) { $dataTable = $this->getDataTable('DevicesDetection_osVersions', $idSite, $period, $date, $segment); + if ($addShortLabel) { + $dataTable->filter('ColumnCallbackAddMetadata', array('label', 'shortLabel', __NAMESPACE__ . '\getOsShortName')); + } $dataTable->filter('ColumnCallbackAddMetadata', array('label', 'logo', __NAMESPACE__ . '\getOsLogo')); $dataTable->filter('ColumnCallbackReplace', array('label', __NAMESPACE__ . '\getOsFullName')); return $dataTable; diff --git a/plugins/DevicesDetection/Visitor.php b/plugins/DevicesDetection/Visitor.php index efcc69b196..c7a68d1c59 100644 --- a/plugins/DevicesDetection/Visitor.php +++ b/plugins/DevicesDetection/Visitor.php @@ -36,35 +36,7 @@ class Visitor 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); + return getOsShortName($this->details['config_os']); } public function getOperatingSystemIcon() diff --git a/plugins/DevicesDetection/functions.php b/plugins/DevicesDetection/functions.php index cb4c109b22..7a797d42a1 100644 --- a/plugins/DevicesDetection/functions.php +++ b/plugins/DevicesDetection/functions.php @@ -217,6 +217,38 @@ function getOsFullName($label) return Piwik::translate('General_Unknown'); } +function getOsShortName($label) +{ + $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', + ); + if (array_key_exists($label, $shortNameMapping)) { + return $shortNameMapping[$label]; + } + return getOsFullName($label); +} + /** * Returns the path to the logo for the given OS * |