diff options
Diffstat (limited to 'plugins/UserSettings/functions.php')
-rw-r--r-- | plugins/UserSettings/functions.php | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/plugins/UserSettings/functions.php b/plugins/UserSettings/functions.php index c2aebe7b64..95d19e4817 100644 --- a/plugins/UserSettings/functions.php +++ b/plugins/UserSettings/functions.php @@ -10,6 +10,9 @@ * @package Piwik_UserSettings */ +// no direct access +defined('PIWIK_INCLUDE_PATH') or die; + /** * @see libs/UserAgentParser/UserAgentParser.php */ @@ -29,7 +32,7 @@ function Piwik_getOSLabel($osId) } if( $osId == 'UNK') { - return html_entity_decode(Piwik_Translate('General_Unknown'), ENT_COMPAT, 'UTF-8'); + return Piwik_Translate('General_Unknown'); } return $osId; } @@ -43,7 +46,7 @@ function Piwik_getOSShortLabel($osId) } if( $osId == 'UNK') { - return html_entity_decode(Piwik_Translate('General_Unknown'), ENT_COMPAT, 'UTF-8'); + return Piwik_Translate('General_Unknown'); } return $osId; } @@ -56,7 +59,7 @@ function Piwik_getBrowserTypeLabel($oldLabel) } if($oldLabel == 'unknown') { - return html_entity_decode(Piwik_Translate('General_Unknown'), ENT_COMPAT, 'UTF-8'); + return Piwik_Translate('General_Unknown'); } return $oldLabel; } @@ -75,7 +78,7 @@ function Piwik_getConfigurationLabel($str) $browser = UserAgentParser::getBrowserNameFromId($name); if($browser === false) { - $browser = html_entity_decode(Piwik_Translate('General_Unknown'), ENT_COMPAT, 'UTF-8'); + $browser = Piwik_Translate('General_Unknown'); } $resolution = $values[2]; return $os . " / " . $browser . " / " . $resolution; @@ -92,7 +95,7 @@ function Piwik_getBrowserLabel($oldLabel) } if( $browserId == 'UNK') { - return html_entity_decode(Piwik_Translate('General_Unknown'), ENT_COMPAT, 'UTF-8'); + return Piwik_Translate('General_Unknown'); } return $oldLabel; } @@ -108,7 +111,7 @@ function Piwik_getBrowserShortLabel($oldLabel) } if( $browserId == 'UNK') { - return html_entity_decode(Piwik_Translate('General_Unknown'), ENT_COMPAT, 'UTF-8'); + return Piwik_Translate('General_Unknown'); } return $oldLabel; } @@ -126,19 +129,11 @@ function Piwik_getBrowserVersion($str) function Piwik_getBrowsersLogo($label) { $id = Piwik_getBrowserId($label); - // For aggregated row 'Others' - if(empty($id)) { - $id = 'UNK'; - } return 'plugins/UserSettings/images/browsers/'. $id . '.gif'; } function Piwik_getOSLogo($label) { - // For aggregated row 'Others' - if(empty($label)) { - $label = 'UNK'; - } $path = 'plugins/UserSettings/images/os/'. $label . '.gif'; return $path; } @@ -176,6 +171,14 @@ function Piwik_getScreenTypeFromResolution($resolution) function Piwik_getBrowserFamily($browserLabel) { - $familyNameToUse = UserAgentParser::getBrowserFamilyFromId(substr($browserLabel, 0, 2)); + $familyNameToUse = 'unknown'; + foreach(Piwik_UserSettings::$browserType as $familyName => $aBrowsers) + { + if(in_array(substr($browserLabel, 0, 2), $aBrowsers)) + { + $familyNameToUse = $familyName; + break; + } + } return $familyNameToUse; -} +} |