本文整理汇总了PHP中core_useragent::check_webkit_version方法的典型用法代码示例。如果您正苦于以下问题:PHP core_useragent::check_webkit_version方法的具体用法?PHP core_useragent::check_webkit_version怎么用?PHP core_useragent::check_webkit_version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core_useragent
的用法示例。
在下文中一共展示了core_useragent::check_webkit_version方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_useragent_webkit
/**
* @dataProvider user_agents_providers
*/
public function test_useragent_webkit($useragent, $tests)
{
// Setup the core_useragent instance.
core_useragent::instance(true, $useragent);
if (isset($tests['is_webkit']) && $tests['is_webkit']) {
$this->assertTrue(core_useragent::is_webkit(), "Browser was not identified as a webkit browser");
$this->assertTrue(core_useragent::check_webkit_version());
} else {
$this->assertFalse(core_useragent::is_webkit(), "Browser was incorrectly identified as a webkit browser");
$this->assertFalse(core_useragent::check_webkit_version());
}
$versions = array();
if (isset($tests['check_webkit_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_webkit_version'] + $versions;
}
foreach ($versions as $version => $result) {
$this->assertEquals($result, core_useragent::check_webkit_version($version), "Version incorrectly determined for Webkit version '{$version}'");
}
}
示例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());
//.........这里部分代码省略.........
示例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());
//.........这里部分代码省略.........