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 4059be1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 32 deletions.
9 changes: 4 additions & 5 deletions data/class/SC_SiteView.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ class SC_SiteView extends SC_View_Ex
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 +37,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']);
}
}
20 changes: 10 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 Down Expand Up @@ -141,10 +141,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 +160,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 +281,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 4059be1

Please sign in to comment.