當前位置: 首頁>>代碼示例>>PHP>>正文


PHP core_useragent::check_ie_compatibility_view方法代碼示例

本文整理匯總了PHP中core_useragent::check_ie_compatibility_view方法的典型用法代碼示例。如果您正苦於以下問題:PHP core_useragent::check_ie_compatibility_view方法的具體用法?PHP core_useragent::check_ie_compatibility_view怎麽用?PHP core_useragent::check_ie_compatibility_view使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在core_useragent的用法示例。


在下文中一共展示了core_useragent::check_ie_compatibility_view方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: test_useragent_ie

 /**
  * @dataProvider user_agents_providers
  */
 public function test_useragent_ie($useragent, $tests)
 {
     // Setup the core_useragent instance.
     core_useragent::instance(true, $useragent);
     // IE Tests.
     if (isset($tests['is_ie']) && $tests['is_ie']) {
         $this->assertTrue(core_useragent::is_ie());
     } else {
         $this->assertFalse(core_useragent::is_ie());
     }
     $versions = array('0' => false, '5.0' => false, '5.5' => false, '6.0' => false, '7.0' => false, '8.0' => false, '9.0' => false, '10' => false, '11' => false, '12' => false, '13' => false, '14' => false);
     if (isset($tests['check_ie_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_ie_version'] + $versions;
     }
     foreach ($versions as $version => $result) {
         $this->assertEquals($result, core_useragent::check_ie_version($version), "Version incorrectly determined for IE version '{$version}'");
     }
     // IE Compatibility mode.
     if (isset($tests['iecompatibility']) && $tests['iecompatibility']) {
         $this->assertTrue(core_useragent::check_ie_compatibility_view(), "IE Compability false negative");
     } else {
         $this->assertFalse(core_useragent::check_ie_compatibility_view(), "IE Compability false positive");
     }
 }
開發者ID:Gavinthisisit,項目名稱:Moodle,代碼行數:29,代碼來源:useragent_test.php

示例2: test_check_browser_version

 /**
  * 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());
//.........這裏部分代碼省略.........
開發者ID:nikitskynikita,項目名稱:moodle,代碼行數:101,代碼來源:useragent_test.php

示例3: test_check_browser_version

 /**
  * 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());
//.........這裏部分代碼省略.........
開發者ID:adonm,項目名稱:learning,代碼行數:101,代碼來源:useragent_test.php


注:本文中的core_useragent::check_ie_compatibility_view方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。