/**
  * 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::getInstance()->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::getInstance()->getCarrierName())) . '.' . $info['extension'];
     if (!is_readable($filename)) {
         $filename = "{$base}Mobile.{$info['extension']}";
         if (!sfJpMobile::getInstance()->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::getInstance()->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;
}
 /**
  * 出力コンテンツの変換
  * @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);
 }
Пример #7
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: */