Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #3252 Update Thunderbird icon and name #29

Merged
merged 2 commits into from
Feb 15, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions libs/UserAgentParser/UserAgentParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*
* @link http://dev.piwik.org/trac/browser/trunk/libs/UserAgentParser
* @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version $Id$
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
Expand Down Expand Up @@ -114,6 +113,8 @@ class UserAgentParser
'icecat' => 'FF',
'firefox' => 'FF',

'thunderbird' => 'TB',

'flock' => 'FL',
'fluid' => 'FD',
'galeon' => 'GA',
Expand Down Expand Up @@ -173,7 +174,7 @@ class UserAgentParser
// browser family (by layout engine)
static protected $browserType = array(
'ie' => array('IE'),
'gecko' => array('NS', 'PX', 'FF', 'FB', 'CA', 'GA', 'KM', 'MO', 'SM', 'CO', 'FE', 'KP', 'KZ'),
'gecko' => array('NS', 'PX', 'FF', 'FB', 'CA', 'GA', 'KM', 'MO', 'SM', 'CO', 'FE', 'KP', 'KZ', 'TB'),
'khtml' => array('KO'),
'webkit' => array('SF', 'CH', 'OW', 'AR', 'EP', 'FL', 'WO', 'AB', 'IR', 'CS', 'FD', 'HA', 'MI', 'GE', 'DF', 'BB', 'BP', 'TI', 'CF', 'RK', 'B2'),
'opera' => array('OP'),
Expand Down Expand Up @@ -430,7 +431,7 @@ static public function getBrowser($userAgent)
$userAgent = preg_replace('~^BlackBerry\d+/~', 'BlackBerry/', $userAgent);

if (preg_match_all("/($browsersPattern)[\/\sa-z(]*([0-9]+)([\.0-9a-z]+)?/i", $userAgent, $results)
|| (strpos($userAgent, 'Shiira') === false && preg_match_all("/(firefox|safari)[\/\sa-z(]*([0-9]+)([\.0-9a-z]+)?/i", $userAgent, $results))
|| (strpos($userAgent, 'Shiira') === false && preg_match_all("/(firefox|thunderbird|safari)[\/\sa-z(]*([0-9]+)([\.0-9a-z]+)?/i", $userAgent, $results))
|| preg_match_all("/(applewebkit)[\/\sa-z(]*([0-9]+)([\.0-9a-z]+)?/i", $userAgent, $results)
|| preg_match_all("/^(mozilla)\/([0-9]+)([\.0-9a-z-]+)?(?: \[[a-z]{2}\])? (?:\([^)]*\))$/i", $userAgent, $results)
|| preg_match_all("/^(mozilla)\/[0-9]+(?:[\.0-9a-z-]+)?\s\(.* rv:([0-9]+)([.0-9a-z]+)\) gecko(\/[0-9]{8}|$)(?:.*)/i", $userAgent, $results)
Expand Down
1 change: 1 addition & 0 deletions libs/UserAgentParser/UserAgentParser.test.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
'firefox 3.6 alpha on vista' => 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2a2pre) Gecko/20090826 Namoroka/3.6a2pre',
'firefox 3.5 alpha on win7' => 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1b4pre) Gecko/20090420 Shiretoko/3.5b4pre (.NET CLR 3.5.30729)',
'firefox nightly build' => 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:2.0a1pre) Gecko/2008060602 Minefield/4.0a1pre',
'thunderbird 14.0 with lightning 1.6' => 'Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20120713 Thunderbird/14.0 Lightning/1.6',
);
echo "Test with another user agent: ";
foreach($testUserAgent as $name => $userAgent) {
Expand Down
Binary file added plugins/UserSettings/images/browsers/TB.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions tests/PHPUnit/Plugins/UserSettingsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,18 @@ public function getUserAgents()
array('Mozilla/5.0 (X11; U; CrOS i686 9.10.0; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.253.0 Safari/532.5', array(
array('CH', 'Chrome', 'Chrome', '4.0', '4', '0', 'webkit'),
array('LIN', 'Linux', 'Linux'))),


// Email Clients

// Thunderbird
array('Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20120713 Thunderbird/14.0 Lightning/1.6', array(
array('TB', 'Thunderbird', 'Thunderbird', '14.0', '14', '0', 'gecko'),
array('WXP', 'Windows XP', 'Win XP'))),

array('Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20121011 Thunderbird/16.0.1', array(
array('TB', 'Thunderbird', 'Thunderbird', '16.0', '16', '0', 'gecko'),
array('LIN', 'Linux', 'Linux'))),
);
}

Expand Down