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


PHP core_useragent::check_safari_ios_version方法代码示例

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


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

示例1: fatal_error

 /**
  * Do not call this function directly.
  *
  * To terminate the current script with a fatal error, call the {@link print_error}
  * function, or throw an exception. Doing either of those things will then call this
  * function to display the error, before terminating the execution.
  *
  * @param string $message The message to output
  * @param string $moreinfourl URL where more info can be found about the error
  * @param string $link Link for the Continue button
  * @param array $backtrace The execution backtrace
  * @param string $debuginfo Debugging information
  * @return string the HTML to output.
  */
 public function fatal_error($message, $moreinfourl, $link, $backtrace, $debuginfo = null, $errorcode = "")
 {
     global $CFG;
     $output = '';
     $obbuffer = '';
     if ($this->has_started()) {
         // we can not always recover properly here, we have problems with output buffering,
         // html tables, etc.
         $output .= $this->opencontainers->pop_all_but_last();
     } else {
         // It is really bad if library code throws exception when output buffering is on,
         // because the buffered text would be printed before our start of page.
         // NOTE: this hack might be behave unexpectedly in case output buffering is enabled in PHP.ini
         error_reporting(0);
         // disable notices from gzip compression, etc.
         while (ob_get_level() > 0) {
             $buff = ob_get_clean();
             if ($buff === false) {
                 break;
             }
             $obbuffer .= $buff;
         }
         error_reporting($CFG->debug);
         // Output not yet started.
         $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0';
         if (empty($_SERVER['HTTP_RANGE'])) {
             @header($protocol . ' 404 Not Found');
         } else {
             if (core_useragent::check_safari_ios_version(602) && !empty($_SERVER['HTTP_X_PLAYBACK_SESSION_ID'])) {
                 // Coax iOS 10 into sending the session cookie.
                 @header($protocol . ' 403 Forbidden');
             } else {
                 // Must stop byteserving attempts somehow,
                 // this is weird but Chrome PDF viewer can be stopped only with 407!
                 @header($protocol . ' 407 Proxy Authentication Required');
             }
         }
         $this->page->set_context(null);
         // ugly hack - make sure page context is set to something, we do not want bogus warnings here
         $this->page->set_url('/');
         // no url
         //$this->page->set_pagelayout('base'); //TODO: MDL-20676 blocks on error pages are weird, unfortunately it somehow detect the pagelayout from URL :-(
         $this->page->set_title(get_string('error'));
         $this->page->set_heading($this->page->course->fullname);
         $output .= $this->header();
     }
     $message = '<p class="errormessage">' . $message . '</p>' . '<p class="errorcode"><a href="' . $moreinfourl . '">' . get_string('moreinformation') . '</a></p>';
     if (empty($CFG->rolesactive)) {
         $message .= '<p class="errormessage">' . get_string('installproblem', 'error') . '</p>';
         //It is usually not possible to recover from errors triggered during installation, you may need to create a new database or use a different database prefix for new installation.
     }
     $output .= $this->box($message, 'errorbox', null, array('data-rel' => 'fatalerror'));
     if ($CFG->debugdeveloper) {
         if (!empty($debuginfo)) {
             $debuginfo = s($debuginfo);
             // removes all nasty JS
             $debuginfo = str_replace("\n", '<br />', $debuginfo);
             // keep newlines
             $output .= $this->notification('<strong>Debug info:</strong> ' . $debuginfo, 'notifytiny');
         }
         if (!empty($backtrace)) {
             $output .= $this->notification('<strong>Stack trace:</strong> ' . format_backtrace($backtrace), 'notifytiny');
         }
         if ($obbuffer !== '') {
             $output .= $this->notification('<strong>Output buffer:</strong> ' . s($obbuffer), 'notifytiny');
         }
     }
     if (empty($CFG->rolesactive)) {
         // continue does not make much sense if moodle is not installed yet because error is most probably not recoverable
     } else {
         if (!empty($link)) {
             $output .= $this->continue_button($link);
         }
     }
     $output .= $this->footer();
     // Padding to encourage IE to display our error page, rather than its own.
     $output .= str_repeat(' ', 512);
     return $output;
 }
开发者ID:stronk7,项目名称:moodle,代码行数:93,代码来源:outputrenderers.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_useragent_ios

 /**
  * @dataProvider user_agents_providers
  */
 public function test_useragent_ios($useragent, $tests)
 {
     // Setup the core_useragent instance.
     core_useragent::instance(true, $useragent);
     if (isset($tests['is_ios']) && $tests['is_ios']) {
         $this->assertTrue(core_useragent::is_ios(), "Browser was not identified as an iOS device browser");
         $this->assertTrue(core_useragent::check_safari_ios_version());
     } else {
         $this->assertFalse(core_useragent::is_ios(), "Browser was incorrectly identified as an iOS device browser");
         $this->assertFalse(core_useragent::check_safari_ios_version());
     }
 }
开发者ID:janeklb,项目名称:moodle,代码行数:15,代码来源:useragent_test.php

示例4: test_useragent_ios_safari

 /**
  * @dataProvider user_agents_providers
  */
 public function test_useragent_ios_safari($useragent, $tests)
 {
     // Setup the core_useragent instance.
     core_useragent::instance(true, $useragent);
     if (isset($tests['is_safari_ios']) && $tests['is_safari_ios']) {
         $this->assertTrue(core_useragent::is_safari_ios(), "Browser was not identified as an iOS safari browser");
         $this->assertTrue(core_useragent::check_safari_ios_version());
     } else {
         $this->assertFalse(core_useragent::is_safari_ios(), "Browser was incorrectly identified as an iOS safari browser");
         $this->assertFalse(core_useragent::check_safari_ios_version());
     }
     // Check iOS Safari.
     $versions = array('527' => false, '590' => false, '600' => false);
     if (isset($tests['check_safari_ios_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_ios_version'] + $versions;
     }
     foreach ($versions as $version => $result) {
         $this->assertEquals($result, core_useragent::check_safari_ios_version($version), "Version incorrectly determined for iOS Safari version '{$version}'");
     }
 }
开发者ID:mercysmart,项目名称:naikelas,代码行数:25,代码来源:useragent_test.php

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