Skip to content

Commit

Permalink
Smarty5 対応
Browse files Browse the repository at this point in the history
  • Loading branch information
nanasess committed Apr 5, 2024
1 parent fadb5b1 commit 662aac4
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 39 deletions.
4 changes: 2 additions & 2 deletions data/class/SC_AdminView.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public function init()
{
parent::init();

$this->_smarty->template_dir = realpath(TEMPLATE_ADMIN_REALDIR);
$this->_smarty->compile_dir = realpath(COMPILE_ADMIN_REALDIR);
$this->_smarty->setTemplateDir(realpath(TEMPLATE_ADMIN_REALDIR));
$this->_smarty->setCompileDir(realpath(COMPILE_ADMIN_REALDIR));
$this->assign('TPL_URLPATH_PC', ROOT_URLPATH . USER_DIR . USER_PACKAGE_DIR . TEMPLATE_NAME . '/');
$this->assign('TPL_URLPATH_DEFAULT', ROOT_URLPATH . USER_DIR . USER_PACKAGE_DIR . DEFAULT_TEMPLATE_NAME . '/');
$this->assign('TPL_URLPATH', ROOT_URLPATH . USER_DIR . USER_PACKAGE_DIR . 'admin/');
Expand Down
4 changes: 2 additions & 2 deletions data/class/SC_InstallView.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct($template_dir, $compile_dir = COMPILE_REALDIR)
{
parent::__construct();

$this->_smarty->template_dir = realpath($template_dir);
$this->_smarty->compile_dir = realpath($compile_dir);
$this->_smarty->setTemplateDir(realpath($template_dir));
$this->_smarty->setCompileDir(realpath($compile_dir));
}
}
4 changes: 2 additions & 2 deletions data/class/SC_MobileView.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public function init()
{
parent::init();

$this->_smarty->template_dir = realpath(MOBILE_TEMPLATE_REALDIR);
$this->_smarty->compile_dir = realpath(MOBILE_COMPILE_REALDIR);
$this->_smarty->setTemplateDir(realpath(MOBILE_TEMPLATE_REALDIR));
$this->_smarty->setCompileDir(realpath(MOBILE_COMPILE_REALDIR));
$this->assignTemplatePath(DEVICE_TYPE_MOBILE);
}
}
8 changes: 4 additions & 4 deletions data/class/SC_SiteView.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public function init()
{
parent::init();

$this->_smarty->template_dir = realpath(TEMPLATE_REALDIR);
$this->_smarty->compile_dir = realpath(COMPILE_REALDIR);
$this->_smarty->setTemplateDir(realpath(TEMPLATE_REALDIR));
$this->_smarty->setCompileDir(realpath(COMPILE_REALDIR));

$this->assignTemplatePath(DEVICE_TYPE_PC);
}
Expand All @@ -38,7 +38,7 @@ public function init()
*/
public function setPrevURL()
{
$objCartSess = new SC_CartSession_Ex();
$objCartSess->setPrevURL($_SERVER['REQUEST_URI']);
$objCartSess = new SC_CartSession_Ex();
$objCartSess->setPrevURL($_SERVER['REQUEST_URI']);
}
}
4 changes: 2 additions & 2 deletions data/class/SC_SmartphoneView.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public function init()
{
parent::init();

$this->_smarty->template_dir = realpath(SMARTPHONE_TEMPLATE_REALDIR);
$this->_smarty->compile_dir = realpath(SMARTPHONE_COMPILE_REALDIR);
$this->_smarty->setTemplateDir(realpath(SMARTPHONE_TEMPLATE_REALDIR));
$this->_smarty->setCompileDir(realpath(SMARTPHONE_COMPILE_REALDIR));
$this->assignTemplatePath(DEVICE_TYPE_SMARTPHONE);
}
}
23 changes: 13 additions & 10 deletions data/class/SC_View.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

class SC_View
{
/** @var Smarty */
/** @var \Smarty\Smarty */
public $_smarty;

/** @var LC_Page */
Expand All @@ -41,9 +41,9 @@ public function __construct()
public function init()
{
// include_phpの利用のためSmartyBCを呼び出す、ホントはinclude_phpをなくしたいそうすれば、blank.tplもなくせる
$this->_smarty = new Smarty;
$this->_smarty->left_delimiter = '<!--{';
$this->_smarty->right_delimiter = '}-->';
$this->_smarty = new \Smarty\Smarty();
$this->_smarty->setLeftDelimiter('<!--{');
$this->_smarty->setRightDelimiter('}-->');
$this->_smarty->registerPlugin('modifier', 'sfDispDBDate', function ($dbdate, $time = true) { return SC_Utils_Ex::sfDispDBDate($dbdate, $time); });
$this->_smarty->registerPlugin('modifier', 'sfGetErrorColor', array('SC_Utils_Ex', 'sfGetErrorColor'));
$this->_smarty->registerPlugin('modifier', 'sfTrim', array('SC_Utils_Ex', 'sfTrim'));
Expand All @@ -58,6 +58,9 @@ public function init()
$this->_smarty->registerPlugin('modifier', 'sfMbConvertEncoding', array('SC_Utils_Ex', 'sfMbConvertEncoding'));
$this->_smarty->registerPlugin('modifier', 'sfGetEnabled', array('SC_Utils_Ex', 'sfGetEnabled'));
$this->_smarty->registerPlugin('modifier', 'sfNoImageMainList', array('SC_Utils_Ex', 'sfNoImageMainList'));
$this->_smarty->registerPlugin('modifier', 'file_exists', 'file_exists');
$this->_smarty->registerPlugin('modifier', 'function_exists', 'function_exists');
$this->_smarty->registerPlugin('modifier', 'preg_quote', 'preg_quote');
// XXX register_function で登録すると if で使用できないのではないか?
$this->_smarty->registerPlugin('function','sfIsHTTPS', array('SC_Utils_Ex', 'sfIsHTTPS'));
$this->_smarty->registerPlugin('function','sfSetErrorStyle', array('SC_Utils_Ex', 'sfSetErrorStyle'));
Expand Down Expand Up @@ -141,10 +144,10 @@ public function registFilter()
/**
* prefilter用のフィルタ関数。プラグイン用のフックポイント処理を実行
* @param string $source ソース
* @param Smarty_Internal_Template $smarty Smartyのコンパイラクラス
* @param \Smarty\Template $smarty Smartyのコンパイラクラス
* @return string $source ソース
*/
public function prefilter_transform($source, Smarty_Internal_Template $template)
public function prefilter_transform($source, \Smarty\Template $template)
{
if (!is_null($this->objPage)) {
// フックポイントを実行.
Expand All @@ -160,10 +163,10 @@ public function prefilter_transform($source, Smarty_Internal_Template $template)
/**
* outputfilter用のフィルタ関数。プラグイン用のフックポイント処理を実行
* @param string $source ソース
* @param Smarty_Internal_Template $smarty Smartyのコンパイラクラス
* @param \Smarty\Template $smarty Smartyのコンパイラクラス
* @return string $source ソース
*/
public function outputfilter_transform($source, Smarty_Internal_Template $template)
public function outputfilter_transform($source, \Smarty\Template $template)
{
if (!is_null($this->objPage)) {
// フックポイントを実行.
Expand Down Expand Up @@ -281,9 +284,9 @@ public function lower_compatibility_smarty($tpl_source, $smarty)
* @param Smarty_Internal_Template $template
* @return string 現在のテンプレートファイルパス
*/
public function getCurrentTemplateFile(Smarty_Internal_Template $template)
public function getCurrentTemplateFile(\Smarty\Template $template)
{
$current_file = str_replace($template->smarty->getTemplateDir(), '', $template->source->filepath);
$current_file = str_replace($template->getSmarty()->getTemplateDir(), '', $template->getSource()->getFilepath());
return str_replace('\\', '/', $current_file); // Windows 向けにパスの区切り文字を正規化する
}
}
17 changes: 0 additions & 17 deletions data/smarty_extends/function.html_radios_ex.php

This file was deleted.

0 comments on commit 662aac4

Please sign in to comment.