Esempio n. 1
0
 public function list_supported_urls(array $urls, array $options = array())
 {
     $extensions = $this->get_supported_extensions();
     $result = array();
     foreach ($urls as $url) {
         $ext = core_media::get_extension($url);
         if (in_array($ext, $extensions)) {
             if ($ext === 'ogg' || $ext === 'oga') {
                 // Formats .ogg and .oga are not supported in IE, Edge, or Safari.
                 if (core_useragent::is_ie() || core_useragent::is_edge() || core_useragent::is_safari()) {
                     continue;
                 }
             } else {
                 // Formats .aac, .mp3, and .m4a are not supported in Opera.
                 if (core_useragent::is_opera()) {
                     continue;
                 }
                 // Formats .mp3 and .m4a were not reliably supported in Firefox before 27.
                 // https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats
                 // has the details. .aac is still not supported.
                 if (core_useragent::is_firefox() && ($ext === 'aac' || !core_useragent::check_firefox_version(27))) {
                     continue;
                 }
             }
             // Old Android versions (pre 2.3.3) 'support' audio tag but no codecs.
             if (core_useragent::is_webkit_android() && !core_useragent::is_webkit_android('533.1')) {
                 continue;
             }
             $result[] = $url;
         }
     }
     return $result;
 }
Esempio n. 2
0
 public function list_supported_urls(array $urls, array $options = array())
 {
     $extensions = $this->get_supported_extensions();
     $result = array();
     foreach ($urls as $url) {
         $ext = core_media::get_extension($url);
         if (in_array($ext, $extensions)) {
             if ($ext === 'ogg' || $ext === 'oga') {
                 // Formats .ogg and .oga are not supported in IE or Safari.
                 if (core_useragent::is_ie() || core_useragent::is_safari()) {
                     continue;
                 }
             } else {
                 // Formats .aac, .mp3, and .m4a are not supported in Firefox or Opera.
                 if (core_useragent::is_firefox() || core_useragent::is_opera()) {
                     continue;
                 }
             }
             // Old Android versions (pre 2.3.3) 'support' audio tag but no codecs.
             if (core_useragent::is_webkit_android() && !core_useragent::is_webkit_android('533.1')) {
                 continue;
             }
             $result[] = $url;
         }
     }
     return $result;
 }
Esempio n. 3
0
 /**
  * @dataProvider user_agents_providers
  */
 public function test_useragent_safari($useragent, $tests)
 {
     // Setup the core_useragent instance.
     core_useragent::instance(true, $useragent);
     if (isset($tests['is_safari']) && $tests['is_safari']) {
         $this->assertTrue(core_useragent::is_safari(), "Browser was not identified as a safari browser");
         $this->assertTrue(core_useragent::check_safari_version());
     } else {
         $this->assertFalse(core_useragent::is_safari(), "Browser was incorrectly identified as a safari browser");
         $this->assertFalse(core_useragent::check_safari_version());
     }
     // Check Safari (generic).
     $versions = array('1' => false, '312' => false, '500' => false);
     if (isset($tests['check_safari_version'])) {
         // The test provider has overwritten some of the above checks.
         // Must use the '+' operator, because array_merge will incorrectly rewrite the array keys for integer-based indexes.
         $versions = $tests['check_safari_version'] + $versions;
     }
     foreach ($versions as $version => $result) {
         $this->assertEquals($result, core_useragent::check_safari_version($version), "Version incorrectly determined for Safari (generic) version '{$version}'");
     }
 }
Esempio n. 4
0
 /**
  * Modifies $_SERVER['HTTP_USER_AGENT'] manually to check if check_browser_version
  * works as expected.
  */
 public function test_check_browser_version()
 {
     core_useragent::instance(true, $this->user_agents['Safari']['412']['Mac OS X']);
     $this->assertTrue(core_useragent::is_safari());
     $this->assertTrue(core_useragent::check_safari_version());
     $this->assertTrue(core_useragent::is_webkit());
     $this->assertTrue(core_useragent::check_webkit_version());
     $this->assertTrue(core_useragent::check_safari_version('312'));
     $this->assertFalse(core_useragent::check_safari_version('500'));
     $this->assertFalse(core_useragent::is_chrome());
     $this->assertFalse(core_useragent::check_chrome_version());
     $this->assertFalse(core_useragent::is_safari_ios());
     $this->assertFalse(core_useragent::check_safari_ios_version());
     core_useragent::instance(true, $this->user_agents['Safari iOS']['528']['iPhone']);
     $this->assertTrue(core_useragent::is_safari_ios());
     $this->assertTrue(core_useragent::check_safari_ios_version());
     $this->assertTrue(core_useragent::is_webkit());
     $this->assertTrue(core_useragent::check_webkit_version());
     $this->assertTrue(core_useragent::check_safari_ios_version('527'));
     $this->assertFalse(core_useragent::check_safari_ios_version(590));
     $this->assertFalse(core_useragent::check_safari_version('312'));
     $this->assertFalse(core_useragent::check_safari_version('500'));
     $this->assertFalse(core_useragent::is_chrome());
     $this->assertFalse(core_useragent::check_chrome_version());
     core_useragent::instance(true, $this->user_agents['WebKit Android']['530']['Nexus']);
     $this->assertTrue(core_useragent::is_webkit());
     $this->assertTrue(core_useragent::check_webkit_version());
     $this->assertTrue(core_useragent::check_webkit_android_version('527'));
     $this->assertFalse(core_useragent::check_webkit_android_version(590));
     $this->assertFalse(core_useragent::is_safari());
     $this->assertFalse(core_useragent::check_safari_version());
     $this->assertFalse(core_useragent::is_chrome());
     $this->assertFalse(core_useragent::check_chrome_version());
     core_useragent::instance(true, $this->user_agents['WebKit Android']['537']['Samsung GT-9505']);
     $this->assertTrue(core_useragent::is_webkit());
     $this->assertTrue(core_useragent::check_webkit_version());
     $this->assertTrue(core_useragent::check_webkit_android_version('527'));
     $this->assertTrue(core_useragent::is_chrome());
     $this->assertTrue(core_useragent::check_chrome_version());
     $this->assertFalse(core_useragent::check_webkit_android_version(590));
     $this->assertFalse(core_useragent::is_safari());
     $this->assertFalse(core_useragent::check_safari_version());
     core_useragent::instance(true, $this->user_agents['WebKit Android']['537']['Nexus 5']);
     $this->assertTrue(core_useragent::is_webkit());
     $this->assertTrue(core_useragent::check_webkit_version());
     $this->assertTrue(core_useragent::check_webkit_android_version('527'));
     $this->assertTrue(core_useragent::is_chrome());
     $this->assertTrue(core_useragent::check_chrome_version());
     $this->assertFalse(core_useragent::check_webkit_android_version(590));
     $this->assertFalse(core_useragent::is_safari());
     $this->assertFalse(core_useragent::check_safari_version());
     core_useragent::instance(true, $this->user_agents['Chrome']['8']['Mac OS X']);
     $this->assertTrue(core_useragent::is_chrome());
     $this->assertTrue(core_useragent::check_chrome_version());
     $this->assertTrue(core_useragent::is_webkit());
     $this->assertTrue(core_useragent::check_webkit_version());
     $this->assertTrue(core_useragent::check_chrome_version(8));
     $this->assertFalse(core_useragent::check_chrome_version(10));
     $this->assertFalse(core_useragent::check_safari_version('1'));
     core_useragent::instance(true, $this->user_agents['Opera']['9.0']['Windows XP']);
     $this->assertTrue(core_useragent::is_opera());
     $this->assertTrue(core_useragent::check_opera_version());
     $this->assertTrue(core_useragent::check_opera_version('8.0'));
     $this->assertFalse(core_useragent::check_opera_version('10.0'));
     core_useragent::instance(true, $this->user_agents['MSIE']['6.0']['Windows XP SP2']);
     $this->assertTrue(core_useragent::is_ie());
     $this->assertTrue(core_useragent::check_ie_version());
     $this->assertTrue(core_useragent::check_ie_version('5.0'));
     $this->assertFalse(core_useragent::check_ie_compatibility_view());
     $this->assertFalse(core_useragent::check_ie_version('7.0'));
     core_useragent::instance(true, $this->user_agents['MSIE']['5.0']['Windows 98']);
     $this->assertFalse(core_useragent::is_ie());
     $this->assertFalse(core_useragent::check_ie_version());
     $this->assertTrue(core_useragent::check_ie_version(0));
     $this->assertTrue(core_useragent::check_ie_version('5.0'));
     $this->assertFalse(core_useragent::check_ie_compatibility_view());
     $this->assertFalse(core_useragent::check_ie_version('7.0'));
     core_useragent::instance(true, $this->user_agents['MSIE']['9.0']['Windows 7']);
     $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->assertFalse(core_useragent::check_ie_compatibility_view());
     $this->assertFalse(core_useragent::check_ie_version('10'));
     core_useragent::instance(true, $this->user_agents['MSIE']['9.0i']['Windows 7']);
     $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_compatibility_view());
     $this->assertFalse(core_useragent::check_ie_version('10'));
     core_useragent::instance(true, $this->user_agents['MSIE']['10.0']['Windows 8']);
     $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->assertFalse(core_useragent::check_ie_compatibility_view());
     $this->assertFalse(core_useragent::check_ie_version('11'));
     core_useragent::instance(true, $this->user_agents['MSIE']['10.0i']['Windows 8']);
     $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_compatibility_view());
     $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_compatibility_view());
     $this->assertFalse(core_useragent::check_ie_version('12'));
     core_useragent::instance(true, $this->user_agents['MSIE']['11.0i']['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->assertTrue(core_useragent::check_ie_compatibility_view());
     $this->assertFalse(core_useragent::check_ie_version('12'));
     core_useragent::instance(true, $this->user_agents['Firefox']['2.0']['Windows XP']);
     $this->assertTrue(core_useragent::is_firefox());
     $this->assertTrue(core_useragent::check_firefox_version());
     $this->assertTrue(core_useragent::check_firefox_version('1.5'));
     $this->assertFalse(core_useragent::check_firefox_version('3.0'));
     $this->assertTrue(core_useragent::check_gecko_version('2'));
     $this->assertTrue(core_useragent::check_gecko_version(20030516));
     $this->assertTrue(core_useragent::check_gecko_version(20051106));
     $this->assertTrue(core_useragent::check_gecko_version(2006010100));
     core_useragent::instance(true, $this->user_agents['Firefox']['1.0.6']['Windows XP']);
     $this->assertTrue(core_useragent::is_firefox());
     $this->assertTrue(core_useragent::check_firefox_version());
     $this->assertTrue(core_useragent::check_gecko_version('1'));
     $this->assertFalse(core_useragent::check_gecko_version(20030516));
     $this->assertFalse(core_useragent::check_gecko_version(20051106));
     $this->assertFalse(core_useragent::check_gecko_version(2006010100));
     $this->assertFalse(core_useragent::check_firefox_version('1.5'));
     $this->assertFalse(core_useragent::check_firefox_version('3.0'));
     $this->assertFalse(core_useragent::check_gecko_version('2'));
     core_useragent::instance(true, $this->user_agents['Firefox']['2.0']['Windows XP']);
     $this->assertTrue(core_useragent::is_firefox());
     $this->assertTrue(core_useragent::check_firefox_version());
     $this->assertTrue(core_useragent::check_firefox_version('1.5'));
     $this->assertTrue(core_useragent::check_gecko_version('1'));
     $this->assertTrue(core_useragent::check_gecko_version('2'));
     $this->assertTrue(core_useragent::check_gecko_version(20030516));
     $this->assertTrue(core_useragent::check_gecko_version(20051106));
     $this->assertTrue(core_useragent::check_gecko_version(2006010100));
     $this->assertFalse(core_useragent::check_firefox_version('3.0'));
     core_useragent::instance(true, $this->user_agents['Firefox']['3.6']['Linux']);
     $this->assertTrue(core_useragent::is_firefox());
     $this->assertTrue(core_useragent::check_firefox_version());
     $this->assertTrue(core_useragent::check_firefox_version('1.5'));
     $this->assertTrue(core_useragent::check_firefox_version('3.0'));
     $this->assertTrue(core_useragent::check_gecko_version('2'));
     $this->assertTrue(core_useragent::check_gecko_version('3.6'));
     $this->assertTrue(core_useragent::check_gecko_version(20030516));
     $this->assertTrue(core_useragent::check_gecko_version(20051106));
     $this->assertTrue(core_useragent::check_gecko_version(2006010100));
     $this->assertFalse(core_useragent::check_firefox_version('4'));
     $this->assertFalse(core_useragent::check_firefox_version('10'));
     core_useragent::instance(true, $this->user_agents['Firefox']['3.6']['Linux']);
     $this->assertTrue(core_useragent::is_firefox());
     $this->assertTrue(core_useragent::check_firefox_version());
     $this->assertTrue(core_useragent::check_firefox_version('1.5'));
     $this->assertTrue(core_useragent::check_firefox_version('3.0'));
     $this->assertTrue(core_useragent::check_gecko_version('2'));
     $this->assertTrue(core_useragent::check_gecko_version('3.6'));
     $this->assertTrue(core_useragent::check_gecko_version(20030516));
     $this->assertTrue(core_useragent::check_gecko_version(20051106));
     $this->assertTrue(core_useragent::check_gecko_version(2006010100));
     $this->assertFalse(core_useragent::check_firefox_version('4'));
     $this->assertFalse(core_useragent::check_firefox_version('10'));
     $this->assertFalse(core_useragent::check_firefox_version('18'));
     $this->assertFalse(core_useragent::check_gecko_version('4'));
     core_useragent::instance(true, $this->user_agents['Firefox']['15.0a2']['Windows']);
     $this->assertTrue(core_useragent::is_firefox());
     $this->assertTrue(core_useragent::check_firefox_version());
     $this->assertTrue(core_useragent::check_firefox_version('1.5'));
     $this->assertTrue(core_useragent::check_firefox_version('3.0'));
     $this->assertTrue(core_useragent::check_gecko_version('2'));
     $this->assertTrue(core_useragent::check_gecko_version('3.6'));
     $this->assertTrue(core_useragent::check_gecko_version('15.0'));
     $this->assertTrue(core_useragent::check_gecko_version(20030516));
     $this->assertTrue(core_useragent::check_gecko_version(20051106));
     $this->assertTrue(core_useragent::check_gecko_version(2006010100));
     $this->assertTrue(core_useragent::check_firefox_version('4'));
     $this->assertTrue(core_useragent::check_firefox_version('10'));
     $this->assertTrue(core_useragent::check_firefox_version('15'));
     $this->assertFalse(core_useragent::check_firefox_version('18'));
     $this->assertFalse(core_useragent::check_gecko_version('18'));
     core_useragent::instance(true, $this->user_agents['Firefox']['18.0']['Mac OS X']);
     $this->assertTrue(core_useragent::is_firefox());
     $this->assertTrue(core_useragent::check_firefox_version());
     $this->assertTrue(core_useragent::check_firefox_version('1.5'));
     $this->assertTrue(core_useragent::check_firefox_version('3.0'));
     $this->assertTrue(core_useragent::check_gecko_version('2'));
     $this->assertTrue(core_useragent::check_gecko_version('3.6'));
     $this->assertTrue(core_useragent::check_gecko_version('15.0'));
     $this->assertTrue(core_useragent::check_gecko_version('18.0'));
     $this->assertTrue(core_useragent::check_gecko_version(20030516));
     $this->assertTrue(core_useragent::check_gecko_version(20051106));
     $this->assertTrue(core_useragent::check_gecko_version(2006010100));
     $this->assertTrue(core_useragent::check_firefox_version('4'));
     $this->assertTrue(core_useragent::check_firefox_version('10'));
     $this->assertTrue(core_useragent::check_firefox_version('15'));
     $this->assertTrue(core_useragent::check_firefox_version('18'));
     $this->assertFalse(core_useragent::check_firefox_version('19'));
     $this->assertFalse(core_useragent::check_gecko_version('19'));
     core_useragent::instance(true, $this->user_agents['SeaMonkey']['2.0']['Windows']);
     $this->assertTrue(core_useragent::check_gecko_version('2'));
     $this->assertTrue(core_useragent::check_gecko_version(20030516));
     $this->assertTrue(core_useragent::check_gecko_version(20051106));
     $this->assertTrue(core_useragent::check_gecko_version(2006010100));
     $this->assertFalse(core_useragent::check_gecko_version('3.6'));
     $this->assertFalse(core_useragent::check_gecko_version('4.0'));
     $this->assertFalse(core_useragent::is_firefox());
     $this->assertFalse(core_useragent::check_firefox_version());
     core_useragent::instance(true, $this->user_agents['SeaMonkey']['2.1']['Linux']);
     $this->assertTrue(core_useragent::check_gecko_version('2'));
     $this->assertTrue(core_useragent::check_gecko_version('3.6'));
     $this->assertTrue(core_useragent::check_gecko_version('4.0'));
     $this->assertTrue(core_useragent::check_gecko_version(20030516));
     $this->assertTrue(core_useragent::check_gecko_version(20051106));
     $this->assertTrue(core_useragent::check_gecko_version(2006010100));
     $this->assertTrue(core_useragent::is_firefox());
     $this->assertTrue(core_useragent::check_firefox_version());
     $this->assertTrue(core_useragent::check_firefox_version(4.0));
     $this->assertFalse(core_useragent::check_firefox_version(5));
     $this->assertFalse(core_useragent::check_gecko_version('18.0'));
 }
Esempio n. 5
0
 /**
  * Modifies $_SERVER['HTTP_USER_AGENT'] manually to check if check_browser_version
  * works as expected.
  */
 public function test_check_browser_version()
 {
     core_useragent::instance(true, $this->user_agents['Safari']['412']['Mac OS X']);
     $this->assertTrue(core_useragent::is_safari());
     $this->assertTrue(core_useragent::check_safari_version());
     $this->assertTrue(core_useragent::is_webkit());
     $this->assertTrue(core_useragent::check_webkit_version());
     $this->assertTrue(core_useragent::check_safari_version('312'));
     $this->assertFalse(core_useragent::check_safari_version('500'));
     $this->assertFalse(core_useragent::is_chrome());
     $this->assertFalse(core_useragent::check_chrome_version());
     $this->assertFalse(core_useragent::is_safari_ios());
     $this->assertFalse(core_useragent::check_safari_ios_version());
     $this->assertFalse(core_useragent::is_msword());
     core_useragent::instance(true, $this->user_agents['Safari iOS']['528']['iPhone']);
     $this->assertTrue(core_useragent::is_safari_ios());
     $this->assertTrue(core_useragent::check_safari_ios_version());
     $this->assertTrue(core_useragent::is_webkit());
     $this->assertTrue(core_useragent::check_webkit_version());
     $this->assertTrue(core_useragent::check_safari_ios_version('527'));
     $this->assertFalse(core_useragent::check_safari_ios_version(590));
     $this->assertFalse(core_useragent::check_safari_version('312'));
     $this->assertFalse(core_useragent::check_safari_version('500'));
     $this->assertFalse(core_useragent::is_chrome());
     $this->assertFalse(core_useragent::check_chrome_version());
     $this->assertFalse(core_useragent::is_msword());
     core_useragent::instance(true, $this->user_agents['WebKit Android']['530']['Nexus']);
     $this->assertTrue(core_useragent::is_webkit());
     $this->assertTrue(core_useragent::check_webkit_version());
     $this->assertTrue(core_useragent::check_webkit_android_version('527'));
     $this->assertFalse(core_useragent::check_webkit_android_version(590));
     $this->assertFalse(core_useragent::is_safari());
     $this->assertFalse(core_useragent::check_safari_version());
     $this->assertFalse(core_useragent::is_chrome());
     $this->assertFalse(core_useragent::check_chrome_version());
     $this->assertFalse(core_useragent::is_msword());
     core_useragent::instance(true, $this->user_agents['WebKit Android']['537']['Samsung GT-9505']);
     $this->assertTrue(core_useragent::is_webkit());
     $this->assertTrue(core_useragent::check_webkit_version());
     $this->assertTrue(core_useragent::check_webkit_android_version('527'));
     $this->assertTrue(core_useragent::is_chrome());
     $this->assertTrue(core_useragent::check_chrome_version());
     $this->assertFalse(core_useragent::check_webkit_android_version(590));
     $this->assertFalse(core_useragent::is_safari());
     $this->assertFalse(core_useragent::check_safari_version());
     core_useragent::instance(true, $this->user_agents['WebKit Android']['537']['Nexus 5']);
     $this->assertTrue(core_useragent::is_webkit());
     $this->assertTrue(core_useragent::check_webkit_version());
     $this->assertTrue(core_useragent::check_webkit_android_version('527'));
     $this->assertTrue(core_useragent::is_chrome());
     $this->assertTrue(core_useragent::check_chrome_version());
     $this->assertFalse(core_useragent::check_webkit_android_version(590));
     $this->assertFalse(core_useragent::is_safari());
     $this->assertFalse(core_useragent::check_safari_version());
     core_useragent::instance(true, $this->user_agents['Chrome']['8']['Mac OS X']);
     $this->assertTrue(core_useragent::is_chrome());
     $this->assertTrue(core_useragent::check_chrome_version());
     $this->assertTrue(core_useragent::is_webkit());
     $this->assertTrue(core_useragent::check_webkit_version());
     $this->assertTrue(core_useragent::check_chrome_version(8));
     $this->assertFalse(core_useragent::check_chrome_version(10));
     $this->assertFalse(core_useragent::check_safari_version('1'));
     $this->assertFalse(core_useragent::is_msword());
     core_useragent::instance(true, $this->user_agents['Opera']['9.0']['Windows XP']);
     $this->assertTrue(core_useragent::is_opera());
     $this->assertTrue(core_useragent::check_opera_version());
     $this->assertTrue(core_useragent::check_opera_version('8.0'));
     $this->assertFalse(core_useragent::check_opera_version('10.0'));
     $this->assertFalse(core_useragent::is_msword());
     core_useragent::instance(true, $this->user_agents['MSIE']['6.0']['Windows XP SP2']);
     $this->assertTrue(core_useragent::is_ie());
     $this->assertTrue(core_useragent::check_ie_version());
     $this->assertTrue(core_useragent::check_ie_version('5.0'));
     $this->assertFalse(core_useragent::check_ie_compatibility_view());
     $this->assertFalse(core_useragent::check_ie_version('7.0'));
     $this->assertFalse(core_useragent::is_msword());
     core_useragent::instance(true, $this->user_agents['MSIE']['5.0']['Windows 98']);
     $this->assertFalse(core_useragent::is_ie());
     $this->assertFalse(core_useragent::check_ie_version());
     $this->assertTrue(core_useragent::check_ie_version(0));
     $this->assertTrue(core_useragent::check_ie_version('5.0'));
     $this->assertFalse(core_useragent::check_ie_compatibility_view());
     $this->assertFalse(core_useragent::check_ie_version('7.0'));
     $this->assertFalse(core_useragent::is_msword());
     core_useragent::instance(true, $this->user_agents['MSIE']['7.0']['Windows XP SP2']);
     $this->assertTrue(core_useragent::is_ie());
     $this->assertTrue(core_useragent::check_ie_version());
     $this->assertTrue(core_useragent::check_ie_version('7.0'));
     $this->assertFalse(core_useragent::check_ie_compatibility_view());
     $this->assertFalse(core_useragent::check_ie_version('8.0'));
     $this->assertFalse(core_useragent::is_msword());
     core_useragent::instance(true, $this->user_agents['MSIE']['7.0b']['Windows XP']);
     $this->assertTrue(core_useragent::is_ie());
     $this->assertTrue(core_useragent::check_ie_version());
     $this->assertTrue(core_useragent::check_ie_version('7.0'));
     $this->assertFalse(core_useragent::check_ie_compatibility_view());
     $this->assertFalse(core_useragent::check_ie_version('8.0'));
     $this->assertFalse(core_useragent::is_msword());
     core_useragent::instance(true, $this->user_agents['MSIE']['9.0']['Windows 7']);
     $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->assertFalse(core_useragent::check_ie_compatibility_view());
     $this->assertFalse(core_useragent::check_ie_version('10'));
     $this->assertFalse(core_useragent::is_msword());
     core_useragent::instance(true, $this->user_agents['MSIE']['9.0i']['Windows 7']);
     $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_compatibility_view());
     $this->assertFalse(core_useragent::check_ie_version('10'));
     $this->assertFalse(core_useragent::is_msword());
     core_useragent::instance(true, $this->user_agents['MSIE']['10.0']['Windows 8']);
     $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->assertFalse(core_useragent::check_ie_compatibility_view());
     $this->assertFalse(core_useragent::check_ie_version('11'));
     $this->assertFalse(core_useragent::is_msword());
     core_useragent::instance(true, $this->user_agents['MSIE']['10.0i']['Windows 8']);
     $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_compatibility_view());
     $this->assertFalse(core_useragent::check_ie_version('11'));
     $this->assertFalse(core_useragent::is_msword());
     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_compatibility_view());
     $this->assertFalse(core_useragent::check_ie_version('12'));
     $this->assertFalse(core_useragent::is_msword());
     core_useragent::instance(true, $this->user_agents['MSIE']['11.0i']['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->assertTrue(core_useragent::check_ie_compatibility_view());
     $this->assertFalse(core_useragent::check_ie_version('12'));
     $this->assertFalse(core_useragent::is_msword());
     core_useragent::instance(true, $this->user_agents['Firefox']['2.0']['Windows XP']);
     $this->assertTrue(core_useragent::is_firefox());
     $this->assertTrue(core_useragent::check_firefox_version());
     $this->assertTrue(core_useragent::check_firefox_version('1.5'));
     $this->assertFalse(core_useragent::check_firefox_version('3.0'));
     $this->assertTrue(core_useragent::check_gecko_version('2'));
     $this->assertTrue(core_useragent::check_gecko_version(20030516));
     $this->assertTrue(core_useragent::check_gecko_version(20051106));
     $this->assertTrue(core_useragent::check_gecko_version(2006010100));
     $this->assertFalse(core_useragent::is_msword());
     core_useragent::instance(true, $this->user_agents['Firefox']['1.0.6']['Windows XP']);
     $this->assertTrue(core_useragent::is_firefox());
     $this->assertTrue(core_useragent::check_firefox_version());
     $this->assertTrue(core_useragent::check_gecko_version('1'));
     $this->assertFalse(core_useragent::check_gecko_version(20030516));
     $this->assertFalse(core_useragent::check_gecko_version(20051106));
     $this->assertFalse(core_useragent::check_gecko_version(2006010100));
     $this->assertFalse(core_useragent::check_firefox_version('1.5'));
     $this->assertFalse(core_useragent::check_firefox_version('3.0'));
     $this->assertFalse(core_useragent::check_gecko_version('2'));
     $this->assertFalse(core_useragent::is_msword());
     core_useragent::instance(true, $this->user_agents['Firefox']['2.0']['Windows XP']);
     $this->assertTrue(core_useragent::is_firefox());
     $this->assertTrue(core_useragent::check_firefox_version());
     $this->assertTrue(core_useragent::check_firefox_version('1.5'));
     $this->assertTrue(core_useragent::check_gecko_version('1'));
     $this->assertTrue(core_useragent::check_gecko_version('2'));
     $this->assertTrue(core_useragent::check_gecko_version(20030516));
     $this->assertTrue(core_useragent::check_gecko_version(20051106));
     $this->assertTrue(core_useragent::check_gecko_version(2006010100));
     $this->assertFalse(core_useragent::check_firefox_version('3.0'));
     $this->assertFalse(core_useragent::is_msword());
     core_useragent::instance(true, $this->user_agents['Firefox']['3.6']['Linux']);
     $this->assertTrue(core_useragent::is_firefox());
     $this->assertTrue(core_useragent::check_firefox_version());
     $this->assertTrue(core_useragent::check_firefox_version('1.5'));
     $this->assertTrue(core_useragent::check_firefox_version('3.0'));
     $this->assertTrue(core_useragent::check_gecko_version('2'));
     $this->assertTrue(core_useragent::check_gecko_version('3.6'));
     $this->assertTrue(core_useragent::check_gecko_version(20030516));
     $this->assertTrue(core_useragent::check_gecko_version(20051106));
     $this->assertTrue(core_useragent::check_gecko_version(2006010100));
     $this->assertFalse(core_useragent::check_firefox_version('4'));
     $this->assertFalse(core_useragent::check_firefox_version('10'));
     $this->assertFalse(core_useragent::is_msword());
     core_useragent::instance(true, $this->user_agents['Firefox']['3.6']['Linux']);
     $this->assertTrue(core_useragent::is_firefox());
     $this->assertTrue(core_useragent::check_firefox_version());
     $this->assertTrue(core_useragent::check_firefox_version('1.5'));
     $this->assertTrue(core_useragent::check_firefox_version('3.0'));
     $this->assertTrue(core_useragent::check_gecko_version('2'));
     $this->assertTrue(core_useragent::check_gecko_version('3.6'));
     $this->assertTrue(core_useragent::check_gecko_version(20030516));
     $this->assertTrue(core_useragent::check_gecko_version(20051106));
     $this->assertTrue(core_useragent::check_gecko_version(2006010100));
     $this->assertFalse(core_useragent::check_firefox_version('4'));
     $this->assertFalse(core_useragent::check_firefox_version('10'));
     $this->assertFalse(core_useragent::check_firefox_version('18'));
     $this->assertFalse(core_useragent::check_gecko_version('4'));
     $this->assertFalse(core_useragent::is_msword());
     core_useragent::instance(true, $this->user_agents['Firefox']['15.0a2']['Windows']);
     $this->assertTrue(core_useragent::is_firefox());
     $this->assertTrue(core_useragent::check_firefox_version());
     $this->assertTrue(core_useragent::check_firefox_version('1.5'));
     $this->assertTrue(core_useragent::check_firefox_version('3.0'));
     $this->assertTrue(core_useragent::check_gecko_version('2'));
     $this->assertTrue(core_useragent::check_gecko_version('3.6'));
     $this->assertTrue(core_useragent::check_gecko_version('15.0'));
     $this->assertTrue(core_useragent::check_gecko_version(20030516));
     $this->assertTrue(core_useragent::check_gecko_version(20051106));
     $this->assertTrue(core_useragent::check_gecko_version(2006010100));
     $this->assertTrue(core_useragent::check_firefox_version('4'));
     $this->assertTrue(core_useragent::check_firefox_version('10'));
     $this->assertTrue(core_useragent::check_firefox_version('15'));
     $this->assertFalse(core_useragent::check_firefox_version('18'));
     $this->assertFalse(core_useragent::check_gecko_version('18'));
     $this->assertFalse(core_useragent::is_msword());
     core_useragent::instance(true, $this->user_agents['Firefox']['18.0']['Mac OS X']);
     $this->assertTrue(core_useragent::is_firefox());
     $this->assertTrue(core_useragent::check_firefox_version());
     $this->assertTrue(core_useragent::check_firefox_version('1.5'));
     $this->assertTrue(core_useragent::check_firefox_version('3.0'));
     $this->assertTrue(core_useragent::check_gecko_version('2'));
     $this->assertTrue(core_useragent::check_gecko_version('3.6'));
     $this->assertTrue(core_useragent::check_gecko_version('15.0'));
     $this->assertTrue(core_useragent::check_gecko_version('18.0'));
     $this->assertTrue(core_useragent::check_gecko_version(20030516));
     $this->assertTrue(core_useragent::check_gecko_version(20051106));
     $this->assertTrue(core_useragent::check_gecko_version(2006010100));
     $this->assertTrue(core_useragent::check_firefox_version('4'));
     $this->assertTrue(core_useragent::check_firefox_version('10'));
     $this->assertTrue(core_useragent::check_firefox_version('15'));
     $this->assertTrue(core_useragent::check_firefox_version('18'));
     $this->assertFalse(core_useragent::check_firefox_version('19'));
     $this->assertFalse(core_useragent::check_gecko_version('19'));
     $this->assertFalse(core_useragent::is_msword());
     core_useragent::instance(true, $this->user_agents['SeaMonkey']['2.0']['Windows']);
     $this->assertTrue(core_useragent::check_gecko_version('2'));
     $this->assertTrue(core_useragent::check_gecko_version(20030516));
     $this->assertTrue(core_useragent::check_gecko_version(20051106));
     $this->assertTrue(core_useragent::check_gecko_version(2006010100));
     $this->assertFalse(core_useragent::check_gecko_version('3.6'));
     $this->assertFalse(core_useragent::check_gecko_version('4.0'));
     $this->assertFalse(core_useragent::is_firefox());
     $this->assertFalse(core_useragent::check_firefox_version());
     $this->assertFalse(core_useragent::is_msword());
     core_useragent::instance(true, $this->user_agents['SeaMonkey']['2.1']['Linux']);
     $this->assertTrue(core_useragent::check_gecko_version('2'));
     $this->assertTrue(core_useragent::check_gecko_version('3.6'));
     $this->assertTrue(core_useragent::check_gecko_version('4.0'));
     $this->assertTrue(core_useragent::check_gecko_version(20030516));
     $this->assertTrue(core_useragent::check_gecko_version(20051106));
     $this->assertTrue(core_useragent::check_gecko_version(2006010100));
     $this->assertTrue(core_useragent::is_firefox());
     $this->assertTrue(core_useragent::check_firefox_version());
     $this->assertTrue(core_useragent::check_firefox_version(4.0));
     $this->assertFalse(core_useragent::check_firefox_version(5));
     $this->assertFalse(core_useragent::check_gecko_version('18.0'));
     $this->assertFalse(core_useragent::is_msword());
     // We're not really interested in what MS Word gets identified as beyond MS Word itself.
     core_useragent::instance(true, $this->user_agents['MS Word']['2010']['Windows 7']);
     $this->assertTrue(core_useragent::is_msword());
     core_useragent::instance(true, $this->user_agents['MS Word']['2010']['Mac OS X']);
     $this->assertTrue(core_useragent::is_msword());
     // Outlook should not be considered to be MS Word.
     core_useragent::instance(true, $this->user_agents['MS Outlook']['2010']['Windows 7']);
     $this->assertFalse(core_useragent::is_msword());
     // Meridio should not be considered to be MS Word.
     core_useragent::instance(true, $this->user_agents['Meridio']['5.0.251']['Windows XP']);
     $this->assertFalse(core_useragent::is_msword());
 }