当前位置: 首页>>代码示例>>PHP>>正文


PHP core_useragent::check_ie_version方法代码示例

本文整理汇总了PHP中core_useragent::check_ie_version方法的典型用法代码示例。如果您正苦于以下问题:PHP core_useragent::check_ie_version方法的具体用法?PHP core_useragent::check_ie_version怎么用?PHP core_useragent::check_ie_version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core_useragent的用法示例。


在下文中一共展示了core_useragent::check_ie_version方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: is_legacy_browser

 protected function is_legacy_browser()
 {
     // IE8 and IE9 are the only supported browsers that do not have spellchecker.
     if (core_useragent::is_ie() and !core_useragent::check_ie_version(10)) {
         return true;
     }
     // The rest of browsers supports spellchecking or is horribly outdated and we do not care...
     return false;
 }
开发者ID:pzhu2004,项目名称:moodle,代码行数:9,代码来源:lib.php

示例3: header

if (!empty($PAGE->theme->settings->persistentedit) && $PAGE->user_allowed_editing()) {
    if (property_exists($USER, 'editing') && $USER->editing) {
        $OUTPUT->set_really_editing(true);
    }
    $USER->editing = 1;
    $bodyclasses[] = 'krystle_persistent_edit';
}
if (!empty($PAGE->theme->settings->footnote)) {
    $footnote = $PAGE->theme->settings->footnote;
} else {
    $footnote = '<!-- There was no custom footnote set -->';
}
// Tell IE to use the latest engine (no Compatibility mode), if the user is using IE.
$ie = false;
if (class_exists('core_useragent')) {
    if (core_useragent::check_ie_version()) {
        $ie = true;
    }
} else {
    if (check_browser_version("MSIE", "0")) {
        $ie = true;
    }
}
if ($ie) {
    header('X-UA-Compatible: IE=edge');
}
//Settings for responsive design taken from Zebra theme
$userespond = $PAGE->theme->settings->userespond;
//Check the theme settings to see if respond.js should be called
$usecf = $PAGE->theme->settings->usecf;
//Check the theme settings to see if Chrome Frame should be called
开发者ID:roelmann,项目名称:krystle,代码行数:31,代码来源:general.php

示例4: css_urls

 /**
  * Get the stylesheet URL of this theme.
  *
  * @param moodle_page $page Not used... deprecated?
  * @return moodle_url[]
  */
 public function css_urls(moodle_page $page)
 {
     global $CFG;
     $rev = theme_get_revision();
     $urls = array();
     $svg = $this->use_svg_icons();
     $separate = core_useragent::is_ie() && !core_useragent::check_ie_version('10');
     if ($rev > -1) {
         $url = new moodle_url("{$CFG->httpswwwroot}/theme/styles.php");
         if (!empty($CFG->slasharguments)) {
             $slashargs = '';
             if (!$svg) {
                 // We add a simple /_s to the start of the path.
                 // The underscore is used to ensure that it isn't a valid theme name.
                 $slashargs .= '/_s' . $slashargs;
             }
             $slashargs .= '/' . $this->name . '/' . $rev . '/all';
             if ($separate) {
                 $slashargs .= '/chunk0';
             }
             $url->set_slashargument($slashargs, 'noparam', true);
         } else {
             $params = array('theme' => $this->name, 'rev' => $rev, 'type' => 'all');
             if (!$svg) {
                 // We add an SVG param so that we know not to serve SVG images.
                 // We do this because all modern browsers support SVG and this param will one day be removed.
                 $params['svg'] = '0';
             }
             if ($separate) {
                 $params['chunk'] = '0';
             }
             $url->params($params);
         }
         $urls[] = $url;
     } else {
         $baseurl = new moodle_url($CFG->httpswwwroot . '/theme/styles_debug.php');
         $css = $this->get_css_files(true);
         if (!$svg) {
             // We add an SVG param so that we know not to serve SVG images.
             // We do this because all modern browsers support SVG and this param will one day be removed.
             $baseurl->param('svg', '0');
         }
         if ($separate) {
             // We might need to chunk long files.
             $baseurl->param('chunk', '0');
         }
         if (core_useragent::is_ie()) {
             // Lalala, IE does not allow more than 31 linked CSS files from main document.
             $urls[] = new moodle_url($baseurl, array('theme' => $this->name, 'type' => 'ie', 'subtype' => 'plugins'));
             foreach ($css['parents'] as $parent => $sheets) {
                 // We need to serve parents individually otherwise we may easily exceed the style limit IE imposes (4096).
                 $urls[] = new moodle_url($baseurl, array('theme' => $this->name, 'type' => 'ie', 'subtype' => 'parents', 'sheet' => $parent));
             }
             if (!empty($this->lessfile)) {
                 // No need to define the type as IE here.
                 $urls[] = new moodle_url($baseurl, array('theme' => $this->name, 'type' => 'less'));
             }
             $urls[] = new moodle_url($baseurl, array('theme' => $this->name, 'type' => 'ie', 'subtype' => 'theme'));
         } else {
             foreach ($css['plugins'] as $plugin => $unused) {
                 $urls[] = new moodle_url($baseurl, array('theme' => $this->name, 'type' => 'plugin', 'subtype' => $plugin));
             }
             foreach ($css['parents'] as $parent => $sheets) {
                 foreach ($sheets as $sheet => $unused2) {
                     $urls[] = new moodle_url($baseurl, array('theme' => $this->name, 'type' => 'parent', 'subtype' => $parent, 'sheet' => $sheet));
                 }
             }
             foreach ($css['theme'] as $sheet => $filename) {
                 if ($sheet === $this->lessfile) {
                     // This is the theme LESS file.
                     $urls[] = new moodle_url($baseurl, array('theme' => $this->name, 'type' => 'less'));
                 } else {
                     // Sheet first in order to make long urls easier to read.
                     $urls[] = new moodle_url($baseurl, array('sheet' => $sheet, 'theme' => $this->name, 'type' => 'theme'));
                 }
             }
         }
     }
     return $urls;
 }
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:86,代码来源:outputlib.php

示例5: array

 * Configuration for Moodle's bootstrap theme.
 *
 * DO NOT MODIFY THIS THEME!
 * COPY IT FIRST, THEN RENAME THE COPY AND MODIFY IT INSTEAD.
 *
 * For full information about creating Moodle themes, see:
 * http://docs.moodle.org/dev/Themes_2.0
 *
 * @package   theme_bootstrapbase
 * @copyright 2013 Bas Brands. www.sonsbeekmedia.nl
 * @author    Bas Brands
 * @author    David Scotson
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
$THEME->doctype = 'html5';
$THEME->yuicssmodules = array();
$THEME->name = 'bootstrapbase';
$THEME->parents = array();
$THEME->sheets = array('moodle');
$THEME->supportscssoptimisation = false;
$THEME->enable_dock = false;
$THEME->editor_sheets = array('editor');
$THEME->rendererfactory = 'theme_overridden_renderer_factory';
$THEME->layouts = array('base' => array('file' => 'columns1.php', 'regions' => array()), 'standard' => array('file' => 'columns3.php', 'regions' => array('side-pre', 'side-post'), 'defaultregion' => 'side-pre'), 'course' => array('file' => 'columns3.php', 'regions' => array('side-pre', 'side-post'), 'defaultregion' => 'side-pre', 'options' => array('langmenu' => true)), 'coursecategory' => array('file' => 'columns3.php', 'regions' => array('side-pre', 'side-post'), 'defaultregion' => 'side-pre'), 'incourse' => array('file' => 'columns3.php', 'regions' => array('side-pre', 'side-post'), 'defaultregion' => 'side-pre'), 'frontpage' => array('file' => 'columns3.php', 'regions' => array('side-pre', 'side-post'), 'defaultregion' => 'side-pre', 'options' => array('nonavbar' => true)), 'admin' => array('file' => 'columns2.php', 'regions' => array('side-pre'), 'defaultregion' => 'side-pre'), 'mydashboard' => array('file' => 'columns3.php', 'regions' => array('side-pre', 'side-post'), 'defaultregion' => 'side-pre', 'options' => array('langmenu' => true)), 'mypublic' => array('file' => 'columns3.php', 'regions' => array('side-pre', 'side-post'), 'defaultregion' => 'side-pre'), 'login' => array('file' => 'columns1.php', 'regions' => array(), 'options' => array('langmenu' => true)), 'popup' => array('file' => 'popup.php', 'regions' => array(), 'options' => array('nofooter' => true, 'nonavbar' => true)), 'frametop' => array('file' => 'columns1.php', 'regions' => array(), 'options' => array('nofooter' => true, 'nocoursefooter' => true)), 'embedded' => array('file' => 'embedded.php', 'regions' => array()), 'maintenance' => array('file' => 'maintenance.php', 'regions' => array()), 'print' => array('file' => 'columns1.php', 'regions' => array(), 'options' => array('nofooter' => true, 'nonavbar' => false)), 'redirect' => array('file' => 'embedded.php', 'regions' => array()), 'report' => array('file' => 'columns2.php', 'regions' => array('side-pre'), 'defaultregion' => 'side-pre'), 'secure' => array('file' => 'secure.php', 'regions' => array('side-pre', 'side-post'), 'defaultregion' => 'side-pre'));
$THEME->javascripts = array();
$THEME->javascripts_footer = array('moodlebootstrap', 'dock');
if (core_useragent::is_ie() && !core_useragent::check_ie_version('9.0')) {
    $THEME->javascripts[] = 'html5shiv';
}
$THEME->hidefromselector = true;
$THEME->blockrtlmanipulations = array('side-pre' => 'side-post', 'side-post' => 'side-pre');
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:31,代码来源:config.php

示例6: 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

示例7: css_urls

 /**
  * Get the stylesheet URL of this theme
  *
  * @param moodle_page $page Not used... deprecated?
  * @return array of moodle_url
  */
 public function css_urls(moodle_page $page)
 {
     global $CFG;
     $rev = theme_get_revision();
     $urls = array();
     $svg = $this->use_svg_icons();
     if ($rev > -1) {
         $url = new moodle_url("{$CFG->httpswwwroot}/theme/styles.php");
         $separate = core_useragent::is_ie() && !core_useragent::check_ie_version('10');
         if (!empty($CFG->slasharguments)) {
             $slashargs = '';
             if (!$svg) {
                 // We add a simple /_s to the start of the path.
                 // The underscore is used to ensure that it isn't a valid theme name.
                 $slashargs .= '/_s' . $slashargs;
             }
             $slashargs .= '/' . $this->name . '/' . $rev . '/all';
             if ($separate) {
                 $slashargs .= '/chunk0';
             }
             $url->set_slashargument($slashargs, 'noparam', true);
         } else {
             $params = array('theme' => $this->name, 'rev' => $rev, 'type' => 'all');
             if (!$svg) {
                 // We add an SVG param so that we know not to serve SVG images.
                 // We do this because all modern browsers support SVG and this param will one day be removed.
                 $params['svg'] = '0';
             }
             if ($separate) {
                 $params['chunk'] = '0';
             }
             $url->params($params);
         }
         $urls[] = $url;
     } else {
         // find out the current CSS and cache it now for 5 seconds
         // the point is to construct the CSS only once and pass it through the
         // dataroot to the script that actually serves the sheets
         if (!defined('THEME_DESIGNER_CACHE_LIFETIME')) {
             define('THEME_DESIGNER_CACHE_LIFETIME', 4);
             // this can be also set in config.php
         }
         $candidatedir = "{$CFG->cachedir}/theme/{$this->name}";
         if ($svg) {
             $candidatesheet = "{$candidatedir}/designer.ser";
         } else {
             $candidatesheet = "{$candidatedir}/designer_nosvg.ser";
         }
         $rebuild = true;
         if (file_exists($candidatesheet) and filemtime($candidatesheet) > time() - THEME_DESIGNER_CACHE_LIFETIME) {
             if ($css = file_get_contents($candidatesheet)) {
                 $css = unserialize($css);
                 if (is_array($css)) {
                     $rebuild = false;
                 }
             }
         }
         if ($rebuild) {
             // Prepare the CSS optimiser if it is to be used,
             // please note that it may be very slow and is therefore strongly discouraged in theme designer mode.
             $optimiser = null;
             if (!empty($CFG->enablecssoptimiser) && $this->supportscssoptimisation) {
                 require_once $CFG->dirroot . '/lib/csslib.php';
                 $optimiser = new css_optimiser();
             }
             $css = $this->css_content($optimiser);
             // We do not want any errors here because this may fail easily because of the concurrent access.
             $prevabort = ignore_user_abort(true);
             check_dir_exists($candidatedir);
             $tempfile = tempnam($candidatedir, 'tmpdesigner');
             file_put_contents($tempfile, serialize($css));
             $reporting = error_reporting(0);
             chmod($tempfile, $CFG->filepermissions);
             unlink($candidatesheet);
             // Do not rely on rename() deleting original, they may decide to change it at any time as usually.
             rename($tempfile, $candidatesheet);
             error_reporting($reporting);
             ignore_user_abort($prevabort);
         }
         $baseurl = new moodle_url($CFG->httpswwwroot . '/theme/styles_debug.php');
         if (!$svg) {
             // We add an SVG param so that we know not to serve SVG images.
             // We do this because all modern browsers support SVG and this param will one day be removed.
             $baseurl->param('svg', '0');
         }
         if (core_useragent::is_ie()) {
             // lalala, IE does not allow more than 31 linked CSS files from main document
             $urls[] = new moodle_url($baseurl, array('theme' => $this->name, 'type' => 'ie', 'subtype' => 'plugins'));
             foreach ($css['parents'] as $parent => $sheets) {
                 // We need to serve parents individually otherwise we may easily exceed the style limit IE imposes (4096)
                 $urls[] = new moodle_url($baseurl, array('theme' => $this->name, 'type' => 'ie', 'subtype' => 'parents', 'sheet' => $parent));
             }
             $urls[] = new moodle_url($baseurl, array('theme' => $this->name, 'type' => 'ie', 'subtype' => 'theme'));
         } else {
//.........这里部分代码省略.........
开发者ID:helenagarcia90,项目名称:moodle,代码行数:101,代码来源:outputlib.php

示例8: 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_version方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。