diff options
author | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-05-27 03:17:30 +0400 |
---|---|---|
committer | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-05-27 03:17:30 +0400 |
commit | 8a749f135d57244ca8e2b886145e68168f86135f (patch) | |
tree | 0a6bda758915cdfdc75308a33f448604a6554241 /plugins | |
parent | b860c81382926ae7a12102b035bb9e16da57e972 (diff) |
Make sure UserSettings reports getOS & getBrowsers check that a logo image exists before adding it to the report (if a logo does not exist, the unknown image).
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/UserSettings/functions.php | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/plugins/UserSettings/functions.php b/plugins/UserSettings/functions.php index e1c5579608..44b8dafd12 100644 --- a/plugins/UserSettings/functions.php +++ b/plugins/UserSettings/functions.php @@ -153,6 +153,16 @@ function Piwik_getBrowserVersion($str) return substr($str, strpos($str, ';') + 1); } +function Piwik_getLogoImageFromId($dir, $id) +{ + $path = $dir.'/'.$id.'.gif'; + if (file_exists($path)) { + return $path; + } else { + return $dir.'/UNK.gif'; + } +} + function Piwik_getBrowsersLogo($label) { $id = Piwik_getBrowserId($label); @@ -160,7 +170,7 @@ function Piwik_getBrowsersLogo($label) if (empty($id)) { $id = 'UNK'; } - return 'plugins/UserSettings/images/browsers/' . $id . '.gif'; + return Piwik_getLogoImageFromId('plugins/UserSettings/images/browsers', $id); } function Piwik_getOSLogo($label) @@ -169,8 +179,7 @@ function Piwik_getOSLogo($label) if (empty($label)) { $label = 'UNK'; } - $path = 'plugins/UserSettings/images/os/' . $label . '.gif'; - return $path; + return Piwik_getLogoImageFromId('plugins/UserSettings/images/os', $label); } function Piwik_getScreensLogo($label) |