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


PHP Vtiger_Functions::browerCache方法代码示例

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


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

示例1: getBrowserInfo

 public function getBrowserInfo()
 {
     if (!self::$browerCache) {
         $HTTP_USER_AGENT = strtolower($_SERVER['HTTP_USER_AGENT']);
         $browser = new stdClass();
         $browser->ver = 0;
         $browser->https = false;
         $browser->win = strpos($HTTP_USER_AGENT, 'win') != false;
         $browser->mac = strpos($HTTP_USER_AGENT, 'mac') != false;
         $browser->linux = strpos($HTTP_USER_AGENT, 'linux') != false;
         $browser->unix = strpos($HTTP_USER_AGENT, 'unix') != false;
         $browser->webkit = strpos($HTTP_USER_AGENT, 'applewebkit') !== false;
         $browser->opera = strpos($HTTP_USER_AGENT, 'opera') !== false || $browser->webkit && strpos($HTTP_USER_AGENT, 'opr/') !== false;
         $browser->ns = strpos($HTTP_USER_AGENT, 'netscape') !== false;
         $browser->chrome = !$browser->opera && strpos($HTTP_USER_AGENT, 'chrome') !== false;
         $browser->ie = !$browser->opera && (strpos($HTTP_USER_AGENT, 'compatible; msie') !== false || strpos($HTTP_USER_AGENT, 'trident/') !== false);
         $browser->safari = !$browser->opera && !$browser->chrome && ($browser->webkit || strpos($HTTP_USER_AGENT, 'safari') !== false);
         $browser->mz = !$browser->ie && !$browser->safari && !$browser->chrome && !$browser->ns && !$browser->opera && strpos($HTTP_USER_AGENT, 'mozilla') !== false;
         if ($browser->opera) {
             if (preg_match('/(opera|opr)\\/([0-9.]+)/', $HTTP_USER_AGENT, $regs)) {
                 $browser->ver = (double) $regs[2];
             }
         } else {
             if (preg_match('/(chrome|msie|version|khtml)(\\s*|\\/)([0-9.]+)/', $HTTP_USER_AGENT, $regs)) {
                 $browser->ver = (double) $regs[3];
             } else {
                 if (preg_match('/rv:([0-9.]+)/', $HTTP_USER_AGENT, $regs)) {
                     $browser->ver = (double) $regs[1];
                 }
             }
         }
         if (preg_match('/ ([a-z]{2})-([a-z]{2})/', $HTTP_USER_AGENT, $regs)) {
             $browser->lang = $regs[1];
         } else {
             $browser->lang = 'en';
         }
         if (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off') {
             $browser->https = true;
         }
         if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https') {
             $browser->https = true;
         }
         self::$browerCache = $browser;
     }
     return self::$browerCache;
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:46,代码来源:Functions.php

示例2: getBrowserInfo

 public static function getBrowserInfo()
 {
     if (!self::$browerCache) {
         $HTTP_USER_AGENT = strtolower($_SERVER['HTTP_USER_AGENT']);
         $browser = new stdClass();
         $browser->ver = 0;
         $browser->https = false;
         $browser->win = strpos($HTTP_USER_AGENT, 'win') != false;
         $browser->mac = strpos($HTTP_USER_AGENT, 'mac') != false;
         $browser->linux = strpos($HTTP_USER_AGENT, 'linux') != false;
         $browser->unix = strpos($HTTP_USER_AGENT, 'unix') != false;
         $browser->webkit = strpos($HTTP_USER_AGENT, 'applewebkit') !== false;
         $browser->opera = strpos($HTTP_USER_AGENT, 'opera') !== false || $browser->webkit && strpos($HTTP_USER_AGENT, 'opr/') !== false;
         $browser->ns = strpos($HTTP_USER_AGENT, 'netscape') !== false;
         $browser->chrome = !$browser->opera && strpos($HTTP_USER_AGENT, 'chrome') !== false;
         $browser->ie = !$browser->opera && (strpos($HTTP_USER_AGENT, 'compatible; msie') !== false || strpos($HTTP_USER_AGENT, 'trident/') !== false);
         $browser->safari = !$browser->opera && !$browser->chrome && ($browser->webkit || strpos($HTTP_USER_AGENT, 'safari') !== false);
         $browser->mz = !$browser->ie && !$browser->safari && !$browser->chrome && !$browser->ns && !$browser->opera && strpos($HTTP_USER_AGENT, 'mozilla') !== false;
         if ($browser->opera) {
             if (preg_match('/(opera|opr)\\/([0-9.]+)/', $HTTP_USER_AGENT, $regs)) {
                 $browser->ver = (double) $regs[2];
             }
         } else {
             if (preg_match('/(chrome|msie|version|khtml)(\\s*|\\/)([0-9.]+)/', $HTTP_USER_AGENT, $regs)) {
                 $browser->ver = (double) $regs[3];
             } else {
                 if (preg_match('/rv:([0-9.]+)/', $HTTP_USER_AGENT, $regs)) {
                     $browser->ver = (double) $regs[1];
                 }
             }
         }
         if (preg_match('/ ([a-z]{2})-([a-z]{2})/', $HTTP_USER_AGENT, $regs)) {
             $browser->lang = $regs[1];
         } else {
             $browser->lang = 'en';
         }
         if (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off') {
             $browser->https = true;
         }
         if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https') {
             $browser->https = true;
         }
         $sp = strtolower($_SERVER['SERVER_PROTOCOL']);
         $protocol = substr($sp, 0, strpos($sp, '/')) . ($browser->https ? 's' : '');
         $port = $_SERVER['SERVER_PORT'];
         $port = !$browser->https && $port == '80' || $browser->https && $port == '443' ? '' : ':' . $port;
         $host = isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : null);
         $host = isset($host) ? $host : $_SERVER['SERVER_NAME'] . $port;
         $browser->url = $protocol . '://' . $host . $_SERVER['REQUEST_URI'];
         self::$browerCache = $browser;
     }
     return self::$browerCache;
 }
开发者ID:reeid,项目名称:YetiForceCRM,代码行数:53,代码来源:Functions.php


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