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


PHP Net_UserAgent_Mobile类代码示例

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


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

示例1: _is_keitai

	/**
	 * Browser detection
	 */
	private function _is_keitai()
	{
        $agent = Net_UserAgent_Mobile::singleton(); 
        switch( true )
        {
          case ($agent->isDoCoMo()):   // DoCoMoかどうか
            return true;
            if( $agent->isFOMA() )
              return true;
            break;
          case ($agent->isVodafone()): // softbankかどうか
            return true;
            if( $agent->isType3GC() )
              return true;
            break;
          case ($agent->isEZweb()):    // ezwebかどうか
            return true;
            if( $agent->isWIN() )
              return true;
            break;
          default:
            return false;
            break;
        }
	}
开发者ID:rindou240,项目名称:Ushahidi_Web,代码行数:28,代码来源:keitai.php

示例2: from_tumblr

function from_tumblr()
{
    global $sessionkey;
    $db = get_db_connectiuon();
    list($sessionkey, $cookies, $u) = get_login_cookie($db);
    $page = getPage();
    $agent = Net_UserAgent_Mobile::singleton();
    // paging a page
    if ($agent->isDoCoMo()) {
        $page = ceil($page / 2);
    }
    //$postid = getPostId();
    $url = 'http://www.tumblr.com/dashboard/';
    if ($page > 1) {
        $url .= $page;
    }
    if ($postid > 1) {
        $url .= "/{$postid}";
    }
    #print "<!--$url-->";
    $retry = 2;
    while ($retry--) {
        $req =& new HTTP_Request($url);
        $req->setMethod(HTTP_REQUEST_METHOD_GET);
        foreach ($cookies as $v) {
            $req->addCookie($v['name'], $v['value']);
        }
        if (PEAR::isError($req->sendRequest())) {
            $err = 1;
        }
        $code = $req->getResponseCode();
        if ($code == 302) {
            $err = true;
            if ($u['email']) {
                list($err, $cookies) = update_cookie_info($u['email'], $u['password'], true, $u['hash']);
            }
            if ($err) {
                $retry = 0;
                break;
            }
        } else {
            if ($code == 200) {
                return $req->getResponseBody();
            } else {
                print '<html><body><pre>x_x';
                print " {$code} ";
                print '</body></html>';
                exit;
            }
        }
    }
    if ($retry == 0) {
        header('Location: /login');
    } else {
        print '<html><body><pre>x_x';
        print '</body></html>';
    }
    exit;
}
开发者ID:ku,项目名称:reblog.ido.nu,代码行数:59,代码来源:dashboard.php

示例3: __construct

 function __construct($content)
 {
     $html = $this->wash($content);
     $dom = new DOMDocument();
     $dom->loadXML($html);
     $this->dom = $dom;
     $this->agent = Net_UserAgent_Mobile::singleton();
 }
开发者ID:ku,项目名称:reblog.ido.nu,代码行数:8,代码来源:Dashboard_Class.php

示例4: __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

示例5: smarty_function_emoji

/**
 * Copyright (C) 2012 Vizualizer All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @author    Naohisa Minagawa <info@vizualizer.jp>
 * @copyright Copyright (c) 2010, Vizualizer
 * @license http://www.apache.org/licenses/LICENSE-2.0.html Apache License, Version 2.0
 * @since PHP 5.3
 * @version   1.0.0
 */
function smarty_function_emoji($params, $smarty, $template)
{
    // codeパラメータは必須です。
    if (empty($params['code'])) {
        trigger_error("emoji: missing code parameter", E_USER_WARNING);
        return;
    }
    // パラメータを変数にコピー
    $code = $params['code'];
    if (preg_match("/[0-9]{1,3}/", $code) && is_numeric($code) && 0 < $code && $code < 253) {
        // 変換表を配列に格納
        $emoji_array = array();
        $emoji_array[] = "";
        $contents = @file(dirname(__FILE__) . "/emojix.csv");
        foreach ($contents as $line) {
            $line = rtrim($line);
            $emoji_array[] = explode(",", $line);
        }
        if (Net_UserAgent_Mobile::isMobile()) {
            // モバイルユーザーエージェントのインスタンスを取得
            $agent = Net_UserAgent_Mobile::singleton();
            if ($agent->isDoCoMo()) {
                // DoCoMo
                echo mb_convert_encoding($emoji_array[$code][1], "UTF-8", "SJIS");
            } elseif ($agent->isEZweb()) {
                // au
                if (preg_match("/[^0-9]/", $emoji_array[$code][2])) {
                    echo $emoji_array[$code][2];
                } else {
                    echo "<img localsrc=\"" . $emoji_array[$code][2] . "\" />";
                }
            } elseif ($agent->isSoftbank()) {
                if ($agent->isType3GC()) {
                    // Softbank-UTF8
                    $e = new Emoji();
                    if (preg_match("/^[A-Z]{1}?/", $emoji_array[$code][3])) {
                        echo "\$" . $emoji_array[$code][3] . "";
                    } else {
                        echo $emoji_array[$code][3];
                    }
                } else {
                    // Softbank-SJIS
                    if (preg_match("/^[A-Z]{1}?/", $emoji_array[$code][3])) {
                        echo "\$" . mb_convert_encoding($emoji_array[$code][3], "SJIS", "UTF-8") . "";
                    } else {
                        echo mb_convert_encoding($emoji_array[$code][3], "SJIS", "UTF-8");
                    }
                }
            }
        } else {
            echo "<img src=\"/emoji_images/" . $emoji_array[$code][0] . ".gif\" width=\"12\" height=\"12\" border=\"0\" alt=\"\" />";
        }
    } else {
        // 絵文字のコードが規定値以外
        return "[Error!]\n";
    }
}
开发者ID:naonaox1126,项目名称:vizualizer,代码行数:78,代码来源:function.emoji.php

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

示例7: execute

 public function execute($filterChain)
 {
     $response = $this->getContext()->getResponse();
     if ($this->isFirstCall()) {
         $agent = Net_UserAgent_Mobile::singleton();
         $this->getContext()->getRequest()->setAttribute("userAgent", $agent);
         $this->getContext()->getResponse()->setSlot("carrier_css", $agent);
     }
     $filterChain->execute();
 }
开发者ID:pontuyo,项目名称:takutomo-mixi-appli,代码行数:10,代码来源:mobileCheckFilter.class.php

示例8: __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

示例9: initialize

 public function initialize($context, $parameters = null)
 {
     parent::initialize($context, $parameters);
     // UserAgent取得
     $agent = new Net_UserAgent_Mobile();
     //$agent = $this->getContext()->getRequest()->getAttribute('userAgent');
     if ($agent->isDoCoMo()) {
         ini_set("session.use_trans_sid", 1);
         ini_set("session.use_cookies", 0);
     } else {
         if ($agent->isSoftBank()) {
             ini_set("session.use_trans_sid", 0);
             ini_set("session.use_cookies", 1);
         } else {
             if ($agent->isEZweb()) {
                 ini_set("session.use_trans_sid", 0);
                 ini_set("session.use_cookies", 1);
             }
         }
     }
 }
开发者ID:pontuyo,项目名称:takutomo-mixi-appli,代码行数:21,代码来源:mobileSessionStorage.class.php

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

示例11: __construct

 public function __construct()
 {
     $uri = Mage::app()->getRequest();
     if (preg_match("/extensions_(custom|local)/i", $uri->getRequestUri())) {
         $this->_isAdmin = true;
     }
     if (!$this->_isAdmin) {
         $error = error_reporting(E_ALL);
         $include_path = get_include_path();
         set_include_path($include_path . PS . BP . DS . 'lib/PEAR');
         require_once 'Net/UserAgent/Mobile.php';
         $this->_agent = Net_UserAgent_Mobile::singleton();
     }
 }
开发者ID:vuhung,项目名称:Magento-Rack-Ketai,代码行数:14,代码来源:Agent.php

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

示例13: getInstance

 /**
  * パラメーター管理で設定したセッション維持設定に従って適切なオブジェクトを返す.
  *
  * @return SC_SessionFactory
  */
 function getInstance()
 {
     $type = defined('SESSION_KEEP_METHOD') ? SESSION_KEEP_METHOD : '';
     switch ($type) {
         // セッションの維持にリクエストパラメーターを使用する
         case 'useRequest':
             $session = new SC_SessionFactory_UseRequest();
             SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE ? $session->setState('mobile') : $session->setState('pc');
             break;
             // クッキーを使用する
         // クッキーを使用する
         case 'useCookie':
             // モバイルの場合はSC_SessionFactory_UseRequestを使用する
             if (Net_UserAgent_Mobile::isMobile() === true) {
                 $session = new SC_SessionFactory_UseRequest();
                 $session->setState('mobile');
                 break;
             }
         default:
             $session = new SC_SessionFactory_UseCookie();
             break;
     }
     return $session;
 }
开发者ID:nanasess,项目名称:ec-azure,代码行数:29,代码来源:SC_SessionFactory.php

示例14: isMobile

 /**
  * Checks whether or not the user agent is mobile by a given user agent string.
  *
  * @param string $userAgent
  * @return boolean
  * @since Method available since Release 0.31.0
  */
 function isMobile($userAgent = null)
 {
     if (Net_UserAgent_Mobile::isDoCoMo($userAgent)) {
         return true;
     } elseif (Net_UserAgent_Mobile::isEZweb($userAgent)) {
         return true;
     } elseif (Net_UserAgent_Mobile::isSoftBank($userAgent)) {
         return true;
     } elseif (Net_UserAgent_Mobile::isWillcom($userAgent)) {
         return true;
     }
     return false;
 }
开发者ID:casan,项目名称:eccube-2_13,代码行数:20,代码来源:Mobile.php

示例15: ic2_display

function ic2_display($path, $params)
{
    global $_conf, $ini, $thumb, $dpr, $redirect, $id, $uri, $file, $thumbnailer;
    if (P2_OS_WINDOWS) {
        $path = str_replace('\\', '/', $path);
    }
    if (strncmp($path, '/', 1) == 0) {
        $s = empty($_SERVER['HTTPS']) ? '' : 's';
        $to = 'http' . $s . '://' . $_SERVER['HTTP_HOST'] . $path;
    } else {
        $dir = dirname(P2Util::getMyUrl());
        if (strncasecmp($path, './', 2) == 0) {
            $to = $dir . substr($path, 1);
        } elseif (strncasecmp($path, '../', 3) == 0) {
            $to = dirname($dir) . substr($path, 2);
        } else {
            $to = $dir . '/' . $path;
        }
    }
    $name = basename($path);
    $ext = strrchr($name, '.');
    switch ($redirect) {
        case 1:
            header("Location: {$to}");
            exit;
        case 2:
            switch ($ext) {
                case '.jpg':
                    header("Content-Type: image/jpeg; name=\"{$name}\"");
                    break;
                case '.png':
                    header("Content-Type: image/png; name=\"{$name}\"");
                    break;
                case '.gif':
                    header("Content-Type: image/gif; name=\"{$name}\"");
                    break;
                default:
                    if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false) {
                        header("Content-Type: application/octetstream; name=\"{$name}\"");
                    } else {
                        header("Content-Type: application/octet-stream; name=\"{$name}\"");
                    }
            }
            header("Content-Disposition: inline; filename=\"{$name}\"");
            header('Content-Length: ' . filesize($path));
            readfile($path);
            exit;
        default:
            if (!class_exists('HTML_Template_Flexy', false)) {
                require 'HTML/Template/Flexy.php';
            }
            if (!class_exists('HTML_QuickForm', false)) {
                require 'HTML/QuickForm.php';
            }
            if (!class_exists('HTML_QuickForm_Renderer_ObjectFlexy', false)) {
                require 'HTML/QuickForm/Renderer/ObjectFlexy.php';
            }
            if (isset($uri)) {
                $img_o = 'uri';
                $img_p = $uri;
            } elseif (isset($id)) {
                $img_o = 'id';
                $img_p = $id;
            } else {
                $img_o = 'file';
                $img_p = $file;
            }
            $img_q = $img_o . '=' . rawurlencode($img_p);
            // QuickFormの初期化
            $_size = explode('x', $thumbnailer->calc($params['width'], $params['height']));
            $_constants = array('o' => sprintf('原寸 (%dx%d)', $params['width'], $params['height']), 's' => '作成', 't' => $thumb, 'd' => $dpr, 'u' => $img_p, 'v' => $img_o, 'x' => $_size[0], 'y' => $_size[1]);
            $_defaults = array('q' => $ini["Thumb{$thumb}"]['quality'], 'r' => '0');
            $mobile = Net_UserAgent_Mobile::singleton();
            $qa = 'size=3 maxlength=3';
            if ($mobile->isDoCoMo()) {
                $qa .= ' istyle=4';
            } elseif ($mobile->isEZweb()) {
                $qa .= ' format=*N';
            } elseif ($mobile->isSoftBank()) {
                $qa .= ' mode=numeric';
            }
            $_presets = array('' => 'サイズ・品質');
            foreach ($ini['Dynamic']['presets'] as $_preset_name => $_preset_params) {
                $_presets[$_preset_name] = $_preset_name;
            }
            $qf = new HTML_QuickForm('imgmaker', 'get', 'ic2_mkthumb.php');
            $qf->setConstants($_constants);
            $qf->setDefaults($_defaults);
            $qf->addElement('hidden', 't');
            $qf->addElement('hidden', 'u');
            $qf->addElement('hidden', 'v');
            $qf->addElement('text', 'x', '高さ', $qa);
            $qf->addElement('text', 'y', '横幅', $qa);
            $qf->addElement('text', 'q', '品質', $qa);
            $qf->addElement('select', 'p', 'プリセット', $_presets);
            $qf->addElement('select', 'r', '回転', array('0' => 'なし', '90' => '右に90°', '270' => '左に90°', '180' => '180°'));
            $qf->addElement('checkbox', 'w', 'トリム');
            $qf->addElement('checkbox', 'z', 'DL');
            $qf->addElement('submit', 's');
            $qf->addElement('submit', 'o');
//.........这里部分代码省略.........
开发者ID:nyarla,项目名称:fluxflex-rep2ex,代码行数:101,代码来源:ic2.php


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