mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 09:26:35 +02:00
Merge branch 'wip-mdl-42491-master' of git://github.com/deraadt/moodle
This commit is contained in:
commit
96d0198b8a
2 changed files with 16 additions and 0 deletions
|
@ -499,6 +499,9 @@ class core_useragent {
|
||||||
// See: http://www.useragentstring.com/pages/Internet%20Explorer/.
|
// See: http://www.useragentstring.com/pages/Internet%20Explorer/.
|
||||||
if (preg_match("/MSIE ([0-9\.]+)/", $useragent, $match)) {
|
if (preg_match("/MSIE ([0-9\.]+)/", $useragent, $match)) {
|
||||||
$browser = $match[1];
|
$browser = $match[1];
|
||||||
|
// See: http://msdn.microsoft.com/en-us/library/ie/bg182625%28v=vs.85%29.aspx for IE11+ useragent details.
|
||||||
|
} else if (preg_match("/Trident\/[0-9\.]+/", $useragent) && preg_match("/rv:([0-9\.]+)/", $useragent, $match)) {
|
||||||
|
$browser = $match[1];
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,9 @@ class core_useragent_testcase extends basic_testcase {
|
||||||
'10.0i' => array(
|
'10.0i' => array(
|
||||||
'Windows 8' => 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.2; Trident/6.0; Touch; .NET4.0E; .NET4.0C; Tablet PC 2.0)'
|
'Windows 8' => 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.2; Trident/6.0; Touch; .NET4.0E; .NET4.0C; Tablet PC 2.0)'
|
||||||
),
|
),
|
||||||
|
'11.0' => array(
|
||||||
|
'Windows 8.1' => 'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0)'
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'Firefox' => array(
|
'Firefox' => array(
|
||||||
'1.0.6' => array(
|
'1.0.6' => array(
|
||||||
|
@ -258,6 +261,16 @@ class core_useragent_testcase extends basic_testcase {
|
||||||
$this->assertTrue(core_useragent::check_ie_version('10'));
|
$this->assertTrue(core_useragent::check_ie_version('10'));
|
||||||
$this->assertFalse(core_useragent::check_ie_version('11'));
|
$this->assertFalse(core_useragent::check_ie_version('11'));
|
||||||
|
|
||||||
|
core_useragent::instance(true, $this->user_agents['MSIE']['11.0']['Windows 8.1']);
|
||||||
|
$this->assertTrue(core_useragent::is_ie());
|
||||||
|
$this->assertTrue(core_useragent::check_ie_version());
|
||||||
|
$this->assertTrue(core_useragent::check_ie_version(0));
|
||||||
|
$this->assertTrue(core_useragent::check_ie_version('5.0'));
|
||||||
|
$this->assertTrue(core_useragent::check_ie_version('9.0'));
|
||||||
|
$this->assertTrue(core_useragent::check_ie_version('10'));
|
||||||
|
$this->assertTrue(core_useragent::check_ie_version('11'));
|
||||||
|
$this->assertFalse(core_useragent::check_ie_version('12'));
|
||||||
|
|
||||||
core_useragent::instance(true, $this->user_agents['Firefox']['2.0']['Windows XP']);
|
core_useragent::instance(true, $this->user_agents['Firefox']['2.0']['Windows XP']);
|
||||||
$this->assertTrue(core_useragent::is_firefox());
|
$this->assertTrue(core_useragent::is_firefox());
|
||||||
$this->assertTrue(core_useragent::check_firefox_version());
|
$this->assertTrue(core_useragent::check_firefox_version());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue