本文整理汇总了PHP中Net_UserAgent_Mobile::isMobile方法的典型用法代码示例。如果您正苦于以下问题:PHP Net_UserAgent_Mobile::isMobile方法的具体用法?PHP Net_UserAgent_Mobile::isMobile怎么用?PHP Net_UserAgent_Mobile::isMobile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Net_UserAgent_Mobile
的用法示例。
在下文中一共展示了Net_UserAgent_Mobile::isMobile方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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";
}
}
示例2: isMobile
/**
* 携帯かどうか確認
*
* @return bool
* @access public
*/
function isMobile()
{
$container =& DIContainerFactory::getContainer();
$session =& $container->getComponent("Session");
$reader_flag = intval($session->getParameter("_reader_flag"));
$pcviewer_flag = intval($session->getParameter("_pcviewer_flag"));
if ($reader_flag == _ON) {
return true;
} else {
if ($pcviewer_flag == _ON) {
return false;
} else {
if (MobileCheck::isSmartPhone()) {
return true;
} else {
return Net_UserAgent_Mobile::isMobile();
}
}
}
}
示例3: 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;
}
示例4: detectDevice
/**
* 端末種別を判別する。
*
* SC_Display::MOBILE = ガラケー = 1
* SC_Display::SMARTPHONE = スマホ = 2
* SC_Display::PC = PC = 10
*
* @static
* @param $reset boolean
* @return integer 端末種別ID
*/
public static function detectDevice($reset = FALSE)
{
if (is_null(SC_Display_Ex::$device) || $reset) {
$nu = new Net_UserAgent_Mobile();
$su = new SC_SmartphoneUserAgent_Ex();
if ($nu->isMobile()) {
SC_Display_Ex::$device = DEVICE_TYPE_MOBILE;
} elseif ($su->isSmartphone()) {
SC_Display_Ex::$device = DEVICE_TYPE_SMARTPHONE;
} else {
SC_Display_Ex::$device = DEVICE_TYPE_PC;
}
}
return SC_Display_Ex::$device;
}
示例5: sfSendOrderMail
function sfSendOrderMail($order_id, $template_id, $subject = "", $header = "", $footer = "", $send = true)
{
$arrTplVar = new stdClass();
$arrInfo = SC_Helper_DB_Ex::sfGetBasisData();
$arrTplVar->arrInfo = $arrInfo;
$objQuery = new SC_Query_Ex();
if ($subject == "" && $header == "" && $footer == "") {
// メールテンプレート情報の取得
$where = "template_id = ?";
$arrRet = $objQuery->select("subject, header, footer", "dtb_mailtemplate", $where, array($template_id));
$arrTplVar->tpl_header = $arrRet[0]['header'];
$arrTplVar->tpl_footer = $arrRet[0]['footer'];
$tmp_subject = $arrRet[0]['subject'];
} else {
$arrTplVar->tpl_header = $header;
$arrTplVar->tpl_footer = $footer;
$tmp_subject = $subject;
}
// 受注情報の取得
$where = "order_id = ?";
$arrRet = $objQuery->select("*", "dtb_order", $where, array($order_id));
$arrOrder = $arrRet[0];
$objQuery->setOrder('order_detail_id');
$arrTplVar->arrOrderDetail = $objQuery->select("*", "dtb_order_detail", $where, array($order_id));
$objProduct = new SC_Product_Ex();
$objQuery->setOrder('shipping_id');
$arrRet = $objQuery->select("*", "dtb_shipping", "order_id = ?", array($order_id));
foreach (array_keys($arrRet) as $key) {
$objQuery->setOrder('shipping_id');
$arrItems = $objQuery->select("*", "dtb_shipment_item", "order_id = ? AND shipping_id = ?", array($order_id, $arrRet[$key]['shipping_id']));
foreach ($arrItems as $itemKey => $arrDetail) {
foreach ($arrDetail as $detailKey => $detailVal) {
$arrRet[$key]['shipment_item'][$arrDetail['product_class_id']][$detailKey] = $detailVal;
}
$arrRet[$key]['shipment_item'][$arrDetail['product_class_id']]['productsClass'] =& $objProduct->getDetailAndProductsClass($arrDetail['product_class_id']);
}
}
$arrTplVar->arrShipping = $arrRet;
$arrTplVar->Message_tmp = $arrOrder['message'];
// 会員情報の取得
$customer_id = $arrOrder['customer_id'];
$objQuery->setOrder('customer_id');
$arrRet = $objQuery->select('point', "dtb_customer", "customer_id = ?", array($customer_id));
$arrCustomer = isset($arrRet[0]) ? $arrRet[0] : "";
$arrTplVar->arrCustomer = $arrCustomer;
$arrTplVar->arrOrder = $arrOrder;
//その他決済情報
if ($arrOrder['memo02'] != "") {
$arrOther = unserialize($arrOrder['memo02']);
foreach ($arrOther as $other_key => $other_val) {
if (SC_Utils_Ex::sfTrim($other_val['value']) == "") {
$arrOther[$other_key]['value'] = "";
}
}
$arrTplVar->arrOther = $arrOther;
}
// 都道府県変換
$arrTplVar->arrPref = $this->arrPref;
$objCustomer = new SC_Customer_Ex();
$arrTplVar->tpl_user_point = $objCustomer->getValue('point');
if (Net_UserAgent_Mobile::isMobile() === true) {
$objMailView = new SC_MobileView_Ex();
} else {
$objMailView = new SC_SiteView_Ex();
}
// メール本文の取得
$objMailView->assignobj($arrTplVar);
$body = $objMailView->fetch($this->arrMAILTPLPATH[$template_id]);
// メール送信処理
$objSendMail = new SC_SendMail_Ex();
$bcc = $arrInfo['email01'];
$from = $arrInfo['email03'];
$error = $arrInfo['email04'];
$tosubject = $this->sfMakeSubject($tmp_subject, $objMailView);
$objSendMail->setItem('', $tosubject, $body, $from, $arrInfo['shop_name'], $from, $error, $error, $bcc);
$objSendMail->setTo($arrOrder["order_email"], $arrOrder["order_name01"] . " " . $arrOrder["order_name02"] . " 様");
// 送信フラグ:trueの場合は、送信する。
if ($send) {
if ($objSendMail->sendMail()) {
$this->sfSaveMailHistory($order_id, $template_id, $tosubject, $body);
}
}
return $objSendMail;
}
示例6: detectDevice
/**
* 機種を判別する。
*
* SC_Display::MOBILE = ガラケー = 1
* SC_Display::SMARTPHONE = スマホ = 2
* SC_Display::PC = PC = 10
*
* @static
* @return integer 端末種別ID
*/
function detectDevice()
{
$nu = new Net_UserAgent_Mobile();
$su = new SC_SmartphoneUserAgent_Ex();
$retDevice = 0;
if ($nu->isMobile()) {
return DEVICE_TYPE_MOBILE;
} elseif ($su->isSmartphone()) {
return DEVICE_TYPE_SMARTPHONE;
} else {
return DEVICE_TYPE_PC;
}
}
示例7: _prefilter
//.........这里部分代码省略.........
// ---Cookieパラメータセット ---
//-------------------------------------------------------------------------------
$path = $config_obj[_SERVER_CONF_CATID]['cookie_path']['conf_value'];
if ($path == "") {
$path = "/";
$pathList = explode("_", $action_name);
if (!(isset($pathList[0]) && $pathList[0] == "install")) {
$path = strstr(preg_replace("/^(http:\\/\\/|https:\\/\\/)/i", "", BASE_URL), "/");
if ($path === false) {
$path = '/';
} else {
$buf_path = preg_replace('/^' . preg_quote($_SERVER['DOCUMENT_ROOT'], '/') . '/i', "", BASE_DIR);
if ($buf_path != BASE_DIR && $buf_path != "") {
if (strstr($path, $buf_path)) {
$path = substr($buf_path, 0, 1) == '/' ? $buf_path : "/" . $buf_path;
}
}
}
}
//$path = strstr(preg_replace("/^(http:\/\/|https:\/\/)/i","", BASE_URL), "/");
}
$domain = $config_obj[_SERVER_CONF_CATID]['cookie_domain']['conf_value'];
$secure = intval($config_obj[_SERVER_CONF_CATID]['cookie_secure']['conf_value']);
session_set_cookie_params(0, $path, $domain, $secure);
//session_set_cookie_params($config_obj[_GENERAL_CONF_CATID]['session_gc_maxlifetime']['conf_value'] * 60, $path, $domain, $secure);
//ini_set("session.cookie_path", $path);
//ini_set("session.cookie_domain", $domain);
//ini_set("session.cookie_secure", $secure);
//ini_set("session.cookie_lifetime", $config_obj[_GENERAL_CONF_CATID]['session_gc_maxlifetime']['conf_value'] * 60);
//setcookie($this->_session->getName(), $this->_session->getID(), time()+($config_obj[_GENERAL_CONF_CATID]['session_gc_maxlifetime']['conf_value'] * 60));
// ----------------------------------------------
// --- セッションスタート ---
// ----------------------------------------------
if (Net_UserAgent_Mobile::isMobile()) {
ini_set('session.use_only_cookies', _OFF);
}
if (isset($attributes["regenerate_flag"]) && $attributes["regenerate_flag"] == _OFF) {
$this->_session->start(_OFF);
} else {
$this->_session->start(intval($config_obj[_SERVER_CONF_CATID]['session_regenerate']['conf_value']));
}
$user_id = $this->_session->getParameter("_user_id");
if (!isset($user_id)) {
$user_id = "0";
$this->_session->setParameter("_user_id", "0");
$this->_session->setParameter("_handle", '');
}
// ----------------------------------------------
// --- 固定リンク ---
// ----------------------------------------------
if (isset($config_obj[_SERVER_CONF_CATID]['use_permalink']['conf_value']) && $config_obj[_SERVER_CONF_CATID]['use_permalink']['conf_value'] == _ON) {
$this->_session->setParameter("_permalink_flag", _ON);
} else {
$this->_session->setParameter("_permalink_flag", _OFF);
}
// 言語セット
$_lang = $this->_request->getParameter('lang');
if (!empty($_lang)) {
$languages = $this->_languagesView->getLanguages(array("lang_dirname" => $_lang));
if (!isset($languages[0])) {
$_lang = null;
} else {
$this->_session->setParameter('_lang', $_lang);
}
}
if (empty($_lang)) {
示例8: copyFromCustomer
/**
* 会員情報を受注情報にコピーする.
*
* ユーザーがログインしていない場合は何もしない.
* 会員情報を $dest の order_* へコピーする.
* customer_id は強制的にコピーされる.
*
* @param array $dest コピー先の配列
* @param SC_Customer $objCustomer SC_Customer インスタンス
* @param string $prefix コピー先の接頭辞. デフォルト order
* @param array $keys コピー対象のキー
* @return void
*/
function copyFromCustomer(&$dest, &$objCustomer, $prefix = 'order', $keys = array('name01', 'name02', 'kana01', 'kana02', 'sex', 'zip01', 'zip02', 'pref', 'addr01', 'addr02', 'tel01', 'tel02', 'tel03', 'job', 'birth', 'email'))
{
if ($objCustomer->isLoginSuccess(true)) {
foreach ($keys as $key) {
if (in_array($key, $keys)) {
$dest[$prefix . '_' . $key] = $objCustomer->getValue($key);
}
}
if (Net_UserAgent_Mobile::isMobile() && in_array('email', $keys)) {
$email_mobile = $objCustomer->getValue('email_mobile');
if (empty($email_mobile)) {
$dest[$prefix . '_email'] = $objCustomer->getValue('email');
} else {
$dest[$prefix . '_email'] = $email_mobile;
}
}
$dest['customer_id'] = $objCustomer->getValue('customer_id');
$dest['update_date'] = 'CURRENT_TIMESTAMP';
}
}