/**
  * singleton
  *
  * @return sfJpMobile
  */
 public static function getInstance()
 {
     if (!self::$instance instanceof self) {
         self::$instance = new self();
     }
     return self::$instance;
 }
/**
 * generate URI
 * @param   string|array  $param
 * @param   bool          $absolute
 * @return  string
 */
function jpmobile_url_for($param, $absolute = false)
{
    $url = url_for($param, $absolute);
    if (sfJpMobile::isDocomo()) {
        $url .= "?guid=ON";
    }
    return $url;
}
 /**
  * Deviceクラスのファクトリメソッド
  * @param   string
  * @return  sfJpMobileDevice
  */
 private static function _termFactory($term)
 {
     $class = "sfJpMobileDevice{$term}";
     if (!self::$_device instanceof sfDevice) {
         self::$_device = new $class();
     }
     return self::$_device;
 }
 /**
  * constructor
  */
 public function __construct()
 {
     // 絵文字変換テーブルの読み込み
     include sfContext::getInstance()->getConfigCache()->checkConfig('config/jpmobile/emoji/' . strtolower(sfJpMobile::getInstance()->getCarrierName()) . '_dec.yml');
     include sfContext::getInstance()->getConfigCache()->checkConfig('config/jpmobile/emoji/' . strtolower(sfJpMobile::getInstance()->getCarrierName()) . '_enc.yml');
     $this->_decTable = sfConfig::get('jpmobile_emoji_dec', array());
     $this->_encTable = sfConfig::get('jpmobile_emoji_enc', array());
     $this->initialize();
 }
 /**
  * @return null
  */
 public function initialize($options = null)
 {
     if (sfJpMobile::isMobile()) {
         ini_set("session.use_trans_sid", 1);
         ini_set("session.use_cookies", 0);
         ini_set("session.use_only_cookies", 0);
     } else {
         ini_set("session.use_trans_sid", 0);
         ini_set("session.use_cookies", 1);
     }
     parent::initialize($options);
 }
 protected function renderFile($_sfFile)
 {
     $info = pathinfo($_sfFile);
     $base = "{$info['dirname']}/{$info['filename']}";
     $filename = $base . ucfirst(strtolower(sfJpMobile::getCarrierName())) . '.' . $info['extension'];
     if (!is_readable($filename)) {
         $filename = "{$base}Mobile.{$info['extension']}";
         if (!sfJpMobile::isMobile() || !is_readable($filename)) {
             $filename = $_sfFile;
         }
     }
     return parent::renderFile($filename);
 }
 /**
  * @see sfWebController
  */
 public function redirect($url, $delay = 0, $statusCode = 302)
 {
     $url = $this->genUrl($url, true);
     if (sfJpMobile::isMobile() && !preg_match('/(\\?|&)' . preg_quote(SID) . '/', $url)) {
         $url .= (strpos($url, '?') === false ? '?' : '&') . SID;
     }
     if (sfConfig::get('sf_logging_enabled')) {
         $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Redirect to "%s"', $url))));
     }
     // redirect
     $response = $this->context->getResponse();
     $response->clearHttpHeaders();
     $response->setStatusCode($statusCode);
     $response->setHttpHeader('Location', $url);
     $response->setContent(sprintf('<html><head><meta http-equiv="refresh" content="%d;url=%s"/></head></html>', $delay, htmlspecialchars($url, ENT_QUOTES, sfConfig::get('sf_charset'))));
     $response->send();
 }
/**
 * 入力文字種類制御の属性を追加する(Formのattribute用)
 *
 * @param   integer   $style    DoCoMoのistyle属性の値
 * @param   array     $attr     合成元の属性
 * @return  array
 */
function add_istyle($style, $attr = array())
{
    $data = new stdClass();
    $carrier = strtolower(sfJpMobile::getInstance()->getCarrierName());
    $config = sfConfig::get("jpmobile_istyle_{$carrier}");
    foreach ($config as $k => $v) {
        $data->{$k} = $v[$style - 1];
    }
    if (!sfJpMobile::getInstance()->isDocomo()) {
        $data->istyle = $style;
    }
    foreach ($data as $k => $v) {
        if (array_key_exists($k, $attr)) {
            $attr[$k] .= $v;
        } else {
            $attr[$k] = $v;
        }
    }
    return $attr;
}
if ($total > 0) {
    echo "{$view_number}〜{$view_max_number}件目 /全{$total}件<br />";
} else {
    echo "全{$total}件<br />";
}
echo "<hr />";
echo "\n";
$loop = 0;
$driver_count = 0;
//タクシー表示
if (!empty($list)) {
    foreach ($list as $value) {
        //ドライバーカウントが表示件数の値以上かつ最大表示件数以下の時に処理
        if ($value['driver_id'] && $view_number - 1 <= $driver_count && $loop <= $view_limit - 1) {
            if ($value['recomended'] == 1) {
                echo sfJpMobile::getEmoji()->convert('&#xE727;');
                //指でOK;
                echo '<span style="color:red">オススメ</span><br />';
            }
            $image_url = sfConfig::get('sf_mixi_index_url') . '/images/noimage.jpg';
            if (!empty($value['pic1_url'])) {
                $image_url = $value['pic1_url'];
            }
            if ($sf_request->getAttribute('userAgent')->isEZweb()) {
                echo '<table style="margin:0px"><tr><td colspan="2" width="100" height="100">';
                echo '<img src="' . $image_url . '" width="100" height="100" alt="写真"  align="left" style="float:left;" />';
                echo '</td>';
                echo '<td>';
                echo '<span style="font-size:xx-small;"><font size="1">';
                echo '概算運賃<br />';
                echo number_format($value['fare']);
 /**
  * 出力コンテンツの変換
  * @return null
  */
 private function _convertContent()
 {
     $content = $this->getContext()->getResponse()->getContent();
     // 絵文字変換
     if (!sfJpMobile::isDocomo()) {
         $content = sfJpMobile::getEmoji()->convert($content);
     }
     // 出力文字コードの変更
     if (!sfJpMobile::isMobile() || !sfJpMobile::isSoftbank() && !sfJpMobile::isWillcom()) {
         $content = mb_convert_encoding($content, 'SJIS-win', 'UTF-8');
     }
     $this->getContext()->getResponse()->setContent($content);
 }
 /**
  * 出力コンテンツの変換
  * @return null
  */
 private function _convertContent()
 {
     $content = $this->getContext()->getResponse()->getContent();
     // 絵文字変換
     if (!sfJpMobile::getInstance()->isDocomo()) {
         $content = sfJpMobile::getInstance()->getEmoji()->convert($content);
     }
     // 出力文字コードの変更
     if (sfJpMobile::getInstance()->isDocomo() || sfJpMobile::getInstance()->isAu()) {
         $content = mb_convert_encoding($content, 'SJIS-win', 'UTF-8');
     }
     $this->getContext()->getResponse()->setContent($content);
 }
Beispiel #12
0
<?php

if (sfJpMobile::getInstance()->isDocomo()) {
    echo '<?xml version="1.0" encoding="Shift_JIS" ?>';
    ?>
<!DOCTYPE html PUBLIC "-//i-mode group (ja)//DTD XHTML i-XHTML(Locale/Ver.=ja/1.1) 1.0//EN" "i-xhtml_4ja_10.dtd">
<?php 
} elseif (sfJpMobile::getInstance()->isAu()) {
    echo '<?xml version="1.0" encoding="Shift_JIS" ?>';
    ?>
<!DOCTYPE html PUBLIC "-//OPENWAVE//DTD XHTML 1.0//EN" "http://www.openwave.com/DTD/xhtml-basic.dtd">
<?php 
} elseif (sfJpMobile::getInstance()->isSoftbank()) {
    echo '<?xml version="1.0" encoding="UTF-8" ?>';
    ?>
<!DOCTYPE html PUBLIC "-//J-PHONE//DTD XHTML Basic 1.0 Plus//EN" "xhtml-basic10-plus.dtd">
<?php 
} else {
    echo '<?xml version="1.0" encoding="UTF-8"?>';
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php 
}
?>

<?php 
/* $Id$ */
/* vim:set expandtab tabstop=2 softtabstop=2 shiftwidth=2: */
Beispiel #13
0
<?php

echo '<?xml version="1.0" encoding="Shift_JIS"?>';
if (sfJpMobile::isDocomo()) {
    ?>
<!DOCTYPE html PUBLIC "-//i-mode group (ja)//DTD XHTML i-XHTML(Locale/Ver.=ja/1.1) 1.0//EN" "i-xhtml_4ja_10.dtd">
<?php 
} elseif (sfJpMobile::isKddi()) {
    ?>
<!DOCTYPE html PUBLIC "-//OPENWAVE//DTD XHTML 1.0//EN" "http://www.openwave.com/DTD/xhtml-basic.dtd">
<?php 
} elseif (sfJpMobile::isSoftbank()) {
    ?>
<!DOCTYPE html PUBLIC "-//JPHONE//DTD XHTML Basic 1.0 Plus//EN" "xhtml-basic10-plus.dtd">
<?php 
} else {
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php 
}
?>

<?php 
/* $Id$ */
/* vim:set expandtab tabstop=2 softtabstop=2 shiftwidth=2: */
 /**
  * @see sfPluginConfiguration
  */
 public function initialize()
 {
     sfJpMobile::initialize();
 }