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


PHP Net_UserAgent_Mobile::factory方法代码示例

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


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

示例1: __construct

 protected function __construct()
 {
     require_once 'Net/UserAgent/Mobile.php';
     self::$mobile = Net_UserAgent_Mobile::factory();
     if (self::$mobile instanceof Net_UserAgent_Mobile_Error) {
         self::$mobile = new Net_UserAgent_Mobile_NonMobile('');
     }
 }
开发者ID:Kazuhiro-Murota,项目名称:OpenPNE3,代码行数:8,代码来源:opMobileUserAgent.class.php

示例2: detect

 /**
  * detect
  *
  * @param  Symfony\Component\HttpFoundation\Request $request
  *
  * @return string  The type name of the user agent (ex. 'docomo')
  */
 public function detect(Request $request)
 {
     $ua = parent::detect($request);
     if (!$ua) {
         $mobile = \Net_UserAgent_Mobile::factory($request->server->get('HTTP_USER_AGENT'));
         $ua = strtolower($mobile->getCarrierlongName());
     }
     return $ua;
 }
开发者ID:hidenorigoto,项目名称:Dua,代码行数:16,代码来源:NetUserAgentMobileAdapter.php

示例3: __construct

 protected function __construct()
 {
     require_once 'Net/UserAgent/Mobile.php';
     require_once 'Net/UserAgent/Mobile/NonMobile.php';
     // ignore `Non-static method Net_UserAgent_Mobile::factory()' error
     $oldErrorLevel = error_reporting(error_reporting() & ~E_STRICT);
     self::$mobile = Net_UserAgent_Mobile::factory();
     error_reporting($oldErrorLevel);
     if (self::$mobile instanceof Net_UserAgent_Mobile_Error) {
         self::$mobile = new Net_UserAgent_Mobile_NonMobile('');
     }
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:12,代码来源:opMobileUserAgent.class.php

示例4: after

function after($output)
{
    require_once 'Net/UserAgent/Mobile.php';
    if (Net_UserAgent_Mobile::factory()->isDoCoMo()) {
        $output = after_render_docomo($output);
    } elseif (Net_UserAgent_Mobile::factory()->isSoftBank()) {
        $output = after_render_softbank($output);
    } elseif (Net_UserAgent_Mobile::factory()->isEZweb()) {
        $output = after_render_au($output);
    } else {
        $output = after_render_pc($output);
    }
    return $output;
}
开发者ID:sanemat,项目名称:ktsukishima,代码行数:14,代码来源:index.php

示例5: factory

 /**
  * ファクトリー
  *
  * @return Net_UserAgent_Mobile
  */
 public function factory()
 {
     $userAgent = $this->_config['user_agent'];
     $netUserAgentMobile = Net_UserAgent_Mobile::factory($userAgent);
     if (PEAR::isError($netUserAgentMobile)) {
         switch (true) {
             case strstr($userAgent, 'DoCoMo'):
                 $botAgent = BEAR_Agent::BOT_DOCOMO;
                 break;
             case strstr($userAgent, 'KDDI-'):
                 $botAgent = BEAR_Agent::BOT_AU;
                 break;
             case preg_match('/(SoftBank|Vodafone|J-PHONE|MOT-)/', $userAgent):
                 $botAgent = BEAR_Agent::BOT_SOFTBANK;
                 break;
             default:
                 $botAgent = '';
         }
         $netUserAgentMobile = Net_UserAgent_Mobile::factory($botAgent);
     }
     return $netUserAgentMobile;
 }
开发者ID:ryo88c,项目名称:BEAR.Saturday,代码行数:27,代码来源:Mobile.php

示例6: ZenCart_Mobile

 function ZenCart_Mobile($strUserAgent, $db)
 {
     $this->mobile =& Net_UserAgent_Mobile::factory($strUserAgent);
     $this->db = $db;
 }
开发者ID:homework-bazaar,项目名称:zencart-sugu,代码行数:5,代码来源:Mobile.php

示例7: array

 /**
  * creates a new {@link Net_UserAgent_Mobile_Common} subclass instance or returns
  * a instance from existent ones
  *
  * @param string $userAgent User-Agent string
  * @return Net_UserAgent_Mobile_Common a newly created or an existing
  *     Net_UserAgent_Mobile_Common object
  * @throws Net_UserAgent_Mobile_Error
  */
 function &singleton($userAgent = null)
 {
     static $instances;
     if (!isset($instances)) {
         $instances = array();
     }
     if (is_null($userAgent)) {
         $userAgent = @$_SERVER['HTTP_USER_AGENT'];
     }
     if (!array_key_exists($userAgent, $instances)) {
         $instances[$userAgent] = Net_UserAgent_Mobile::factory($userAgent);
     }
     return $instances[$userAgent];
 }
开发者ID:casan,项目名称:eccube-2_13,代码行数:23,代码来源:Mobile.php

示例8: _checkUA

 /**
  * UAでセッションの妥当性をチェックする
  *
  * @return bool
  */
 private function _checkUA()
 {
     // {{{ docomoはUTN時にUA後部が変わるので機種名で検証する
     $mobile = Net_UserAgent_Mobile::singleton();
     if ($mobile->isDoCoMo()) {
         $mobile_b = Net_UserAgent_Mobile::factory($_SESSION[$this->sess_array]['ua']);
         if ($mobile_b->getModel() == $mobile->getModel()) {
             return true;
         }
     }
     // }}}
     // $offset = 12;
     if (empty($offset)) {
         $offset = strlen($_SERVER['HTTP_USER_AGENT']);
     }
     if (substr($_SERVER['HTTP_USER_AGENT'], 0, $offset) == substr($_SESSION[$this->sess_array]['ua'], 0, $offset)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:unpush,项目名称:p2-php,代码行数:26,代码来源:Session.php

示例9: _checkAgent

 /**
  * ユーザーエージェントチェック
  *
  * @access  private
  */
 function _checkAgent()
 {
     if (!$this->isMobile()) {
         return;
     }
     static $userAgent;
     if ($userAgent === NULL) {
         $userAgent = Net_UserAgent_Mobile::factory();
     }
     $container =& DIContainerFactory::getContainer();
     $getdata =& $container->getComponent("GetData");
     $config =& $getdata->getParameter("config");
     //$configView =& $container->getComponent("configView");
     //$config = $configView->getConfigByCatid(_SYS_CONF_MODID, _GENERAL_CONF_CATID);
     $session =& $container->getComponent("Session");
     $tel_id = $userAgent->getSerialNumber() . $userAgent->getUID();
     $tel_id = !empty($tel_id) ? $userAgent->getUserAgent() . " " . $tel_id : "";
     if (empty($tel_id)) {
         $tel_id = $session->getParameter("_mobile_tel_id");
     }
     $this->_mobile_info = array("currier" => $userAgent->getCarrierLongName(), "user_agent" => $userAgent->getUserAgent(), "tel_id" => $tel_id, "utn" => $userAgent->isDoCoMo() ? " utn" : "", "model" => $userAgent->getModel(), "autologin" => $config[0]['autologin_use']['conf_value'] == _AUTOLOGIN_OK ? _AUTOLOGIN_OK : _OFF);
     $session->setParameter("_mobile_tel_id", $tel_id);
     if ($userAgent->isDoCoMo()) {
         if (empty($_SERVER["HTTP_REFERER"])) {
             $_SERVER["HTTP_REFERER"] = BASE_URL;
         }
     }
     /*
      * IPチェック(調査日 2010.09.01)
      */
     $mobile_ip["DoCoMo"] = array("210.153.84.0/24", "210.136.161.0/24", "210.153.86.0/24", "124.146.174.0/24", "124.146.175.0/24", "202.229.176.0/24", "202.229.177.0/24", "202.229.178.0/24", "202.229.179.0/24", "111.89.188.0/24", "111.89.189.0/24", "111.89.190.0/24", "111.89.191.0/24", "210.153.87.0/24", "203.138.180.0/24", "203.138.181.0/24", "203.138.203.0/24");
     $mobile_ip["EZWeb"] = array("210.230.128.224/28", "121.111.227.160/27", "61.117.1.0/28", "219.108.158.0/27", "219.125.146.0/28", "61.117.2.32/29", "61.117.2.40/29", "219.108.158.40/29", "219.125.148.0/25", "222.5.63.0/25", "222.5.63.128/25", "222.5.62.128/25", "59.135.38.128/25", "219.108.157.0/25", "219.125.145.0/25", "121.111.231.0/25", "121.111.227.0/25", "118.152.214.192/26", "118.159.131.0/25", "118.159.133.0/25", "118.159.132.160/27", "111.86.142.0/26", "111.86.141.64/26", "111.86.141.128/26", "111.86.141.192/26", "118.159.133.192/26", "111.86.143.192/27", "111.86.143.224/27", "111.86.147.0/27", "111.86.142.128/26", "111.86.142.192/26", "111.86.143.0/26", "61.117.0.128/25", "61.117.1.128/25", "218.222.1.0/25", "218.222.1.128/28", "218.222.1.160/28", "61.202.3.64/28", "219.125.148.160/27", "121.111.231.160/27", "219.125.148.192/27", "222.7.56.0/27", "222.7.56.32/27", "222.7.56.96/27", "222.7.56.128/27", "222.7.56.192/27", "222.7.56.224/27", "222.7.57.64/27", "222.7.57.96/27", "222.7.57.128/27", "222.7.57.160/27", "222.7.57.192/27", "222.7.57.224/27", "219.125.151.128/27", "219.125.151.160/27", "219.125.151.192/27", "222.7.57.32/27", "222.15.68.192/26", "59.135.39.128/27", "118.152.214.160/27", "118.152.214.128/27", "222.1.136.96/27", "222.1.136.64/27", "59.128.128.0/20", "210.169.40.0/24", "211.5.2.128/25", "222.7.57.0/24", "210.196.3.192/26", "211.5.7.0/24", "59.135.38.128/25", "210.196.5.192/26", "218.222.1.0/24", "61.117.0.0/24", "210.230.128.0/24", "61.117.1.0/24", "219.125.148.0/24", "210.230.141.192/26", "219.108.158.0/26", "61.117.2.0/26", "210.234.105.32/29", "210.251.1.192/26", "219.125.151.128/25", "210.234.108.64/26", "61.202.3.0/24", "210.251.2.0/27", "222.5.63.0/24", "211.5.1.0/24", "222.7.56.0/24");
     $mobile_ip["Softbank"] = array("123.108.237.0/27", "202.253.96.224/27", "210.146.7.192/26", "210.175.1.128/25", "123.108.237.224/27", "202.253.96.0/27", "123.108.236.0/24", "202.179.203.0/24", "202.179.203.0/24", "210.146.60.128/25", "210.169.171.0/24", "210.169.176.0/24", "210.175.1.128/25", "210.169.130.112/28", "210.228.189.0/24", "123.108.236.0/24", "202.179.204.0/24", "210.146.60.192/26", "210.151.9.128/26", "210.228.189.0/24", "211.8.159.128/25", "123.108.237.240/28", "202.253.96.0/28", "123.108.237.240/28", "202.253.96.0/28", "219.73.128.0/17", "117.46.128.0/17");
     $mobile_ip["WILLCOM"] = array("61.198.128.0/24", "61.198.129.0/24", "61.198.130.0/24", "61.198.131.0/24", "61.198.132.0/24", "61.198.133.0/24", "61.198.134.0/24", "61.198.135.0/24", "61.198.136.0/24", "61.198.137.0/24", "61.198.138.100/32", "61.198.138.101/32", "61.198.138.102/32", "61.198.138.103/32", "61.198.139.0/29", "61.198.139.128/27", "61.198.139.160/28", "61.198.140.0/24", "61.198.141.0/24", "61.198.142.0/24", "61.198.143.0/24", "61.198.160.0/24", "61.198.161.0/24", "61.198.162.0/24", "61.198.163.0/24", "61.198.164.0/24", "61.198.165.0/24", "61.198.166.0/24", "61.198.168.0/24", "61.198.169.0/24", "61.198.170.0/24", "61.198.171.0/24", "61.198.172.0/24", "61.198.173.0/24", "61.198.174.0/24", "61.198.175.0/24", "61.198.248.0/24", "61.198.249.0/24", "61.198.250.0/24", "61.198.251.0/24", "61.198.252.0/24", "61.198.253.0/24", "61.198.254.0/24", "61.198.255.0/24", "61.204.0.0/24", "61.204.2.0/24", "61.204.3.0/25", "61.204.3.128/25", "61.204.4.0/24", "61.204.5.0/24", "61.204.6.0/25", "61.204.6.128/25", "61.204.7.0/25", "61.204.92.0/24", "61.204.93.0/24", "61.204.94.0/24", "61.204.95.0/24", "125.28.0.0/24", "125.28.1.0/24", "125.28.15.0/24", "125.28.16.0/24", "125.28.17.0/24", "125.28.2.0/24", "125.28.3.0/24", "125.28.4.0/24", "125.28.5.0/24", "125.28.8.0/24", "210.168.246.0/24", "210.168.247.0/24", "210.169.92.0/24", "210.169.93.0/24", "210.169.94.0/24", "210.169.95.0/24", "210.169.96.0/24", "210.169.97.0/24", "210.169.98.0/24", "210.169.99.0/24", "211.126.192.128/25", "211.18.232.0/24", "211.18.233.0/24", "211.18.234.0/24", "211.18.235.0/24", "211.18.236.0/24", "211.18.237.0/24", "219.108.10.0/24", "219.108.11.0/24", "219.108.12.0/24", "219.108.13.0/24", "219.108.14.0/24", "219.108.15.0/24", "219.108.7.0/24", "219.108.8.0/24", "219.108.9.0/24", "221.119.0.0/24", "221.119.1.0/24", "221.119.2.0/24", "221.119.3.0/24", "221.119.4.0/24", "221.119.6.0/24", "221.119.7.0/24", "221.119.8.0/24", "221.119.9.0/24", "114.20.49.0/24", "114.20.50.0/24", "114.20.51.0/24", "114.20.52.0/24", "114.20.53.0/24", "114.20.54.0/24", "114.20.55.0/24", "114.20.56.0/24", "114.20.57.0/24", "114.20.58.0/24", "114.20.59.0/24", "114.20.60.0/24", "114.20.61.0/24", "114.20.62.0/24", "114.20.63.0/24", "114.20.64.0/24", "114.20.65.0/24", "114.20.66.0/24", "114.20.67.0/24", "114.21.255.0/27", "219.108.2.0/24", "219.108.3.0/24", "125.28.6.0/24", "125.28.7.0/24", "125.28.11.0/24", "125.28.12.0/24", "125.28.13.0/24", "125.28.14.0/24", "211.18.238.0/24", "211.18.239.0/24", "219.108.4.0/24", "219.108.5.0/24", "219.108.6.0/24", "221.119.5.0/24", "124.211.23.0/26");
     $this->_mobile_info["ip_address"] = $_SERVER['REMOTE_ADDR'];
     $this->_mobile_info["ip_addr_zone"] = "";
     $this->_mobile_info["proper_route"] = _OFF;
     foreach ($mobile_ip as $key => $ip_list) {
         foreach ($ip_list as $zone) {
             $valid = Net_IPv4::ipInNetwork($this->_mobile_info["ip_address"], $zone);
             if ($valid) {
                 $this->_mobile_info["ip_addr_zone"] = $zone;
                 $this->_mobile_info["proper_route"] = _ON;
                 break;
             }
         }
         if ($valid) {
             break;
         }
     }
     if (empty($this->_mobile_info['proper_route'])) {
         $this->_mobile_info['autologin'] = _OFF;
     }
 }
开发者ID:RikaFujiwara,项目名称:NetCommons2,代码行数:59,代码来源:MobileCheck.class.php

示例10: checkUA

 /**
  * UAでセッションの妥当性をチェックする
  *
  * @access  private
  * @return  boolean
  */
 function checkUA()
 {
     // ibisBrowser 219.117.203.9
     // Mozilla/4.0 (compatible; ibisBrowser; ip210.153.84.0; ser0123456789ABCDE)
     // http://qb5.2ch.net/test/read.cgi/operate/1141521195/748
     if ($_SERVER['REMOTE_ADDR'] == '219.117.203.9') {
         return true;
     }
     // {{{ docomoはUTN時にUA後部が変わるので機種名で検証する
     $mobile =& Net_UserAgent_Mobile::singleton();
     if ($mobile->isDoCoMo()) {
         $mobile_b =& Net_UserAgent_Mobile::factory($_SESSION[$this->sess_array]['ua']);
         if ($mobile_b->getModel() == $mobile->getModel()) {
             return true;
         }
     }
     // }}}
     $ua = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null;
     // $offset = 12;
     if (empty($offset)) {
         $offset = strlen($ua);
     }
     if (substr($ua, 0, $offset) == substr($_SESSION[$this->sess_array]['ua'], 0, $offset)) {
         return true;
     }
     return false;
 }
开发者ID:poppen,项目名称:p2,代码行数:33,代码来源:Session.php

示例11: getNet_UserAgent_Mobile

 /**
  * Net_UserAgent_Mobile::singleton() の結果を取得する。
  * REAR Error は false に変換される。
  *
  * @param   string  $ua
  * @return  Net_UserAgent_Mobile|false
  */
 public static function getNet_UserAgent_Mobile($ua = null)
 {
     static $cache_ = null;
     if (is_null($ua) and !is_null($cache_)) {
         return $cache_;
     }
     if (!is_null($ua)) {
         $nuam = Net_UserAgent_Mobile::factory($ua);
     } else {
         $nuam = Net_UserAgent_Mobile::singleton();
     }
     if (PEAR::isError($nuam)) {
         trigger_error($nuam->toString, E_USER_WARNING);
         $return = false;
     } elseif (!$nuam) {
         $return = false;
         // null
     } else {
         $return = $nuam;
     }
     if (is_null($ua)) {
         $cache_ = $return;
     }
     return $return;
 }
开发者ID:xingskycn,项目名称:p2-php,代码行数:32,代码来源:UA.php


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