Skip to content
Extraits de code Groupes Projets
Valider 170e5e3a rédigé par sgiehl's avatar sgiehl
Parcourir les fichiers

added shortlabel again to keep BC

parent dff3519b
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -136,9 +136,12 @@ class API extends \Piwik\Plugin\API ...@@ -136,9 +136,12 @@ class API extends \Piwik\Plugin\API
* @param bool|string $segment * @param bool|string $segment
* @return DataTable * @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); $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('ColumnCallbackAddMetadata', array('label', 'logo', __NAMESPACE__ . '\getOsLogo'));
$dataTable->filter('ColumnCallbackReplace', array('label', __NAMESPACE__ . '\getOsFullName')); $dataTable->filter('ColumnCallbackReplace', array('label', __NAMESPACE__ . '\getOsFullName'));
return $dataTable; return $dataTable;
......
...@@ -36,35 +36,7 @@ class Visitor ...@@ -36,35 +36,7 @@ class Visitor
public function getOperatingSystemShortName() public function getOperatingSystemShortName()
{ {
$shortNameMapping = array( return getOsShortName($this->details['config_os']);
'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() public function getOperatingSystemIcon()
......
...@@ -217,6 +217,38 @@ function getOsFullName($label) ...@@ -217,6 +217,38 @@ function getOsFullName($label)
return Piwik::translate('General_Unknown'); 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 * Returns the path to the logo for the given OS
* *
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter