diff --git a/composer.json b/composer.json index 60d0a0fec9..208cc4d175 100644 --- a/composer.json +++ b/composer.json @@ -46,7 +46,7 @@ "pear/xml_util": "*", "setasign/fpdf": "^1.8", "setasign/fpdi": "^2.6", - "smarty/smarty": "^3.1 || ^4.3" + "smarty/smarty": "^5.0.2" }, "autoload": { "classmap": [ diff --git a/composer.lock b/composer.lock index a95a767743..0bfd8faa4e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "14034a897938f540b2df29261d2c3d21", + "content-hash": "a43896d8a7925355d796f71cd8ea207e", "packages": [ { "name": "mobiledetect/mobiledetectlib", @@ -752,35 +752,39 @@ }, { "name": "smarty/smarty", - "version": "v4.4.1", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/smarty-php/smarty.git", - "reference": "f4152e9b814ae2369b6e4935c05e1e0c3654318d" + "reference": "bbd09c7bfaa6c2c091adc4568a944f765bb4f1d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/smarty-php/smarty/zipball/f4152e9b814ae2369b6e4935c05e1e0c3654318d", - "reference": "f4152e9b814ae2369b6e4935c05e1e0c3654318d", + "url": "https://api.github.com/repos/smarty-php/smarty/zipball/bbd09c7bfaa6c2c091adc4568a944f765bb4f1d9", + "reference": "bbd09c7bfaa6c2c091adc4568a944f765bb4f1d9", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^7.2 || ^8.0", + "symfony/polyfill-mbstring": "^1.27" }, "require-dev": { "phpunit/phpunit": "^8.5 || ^7.5", - "smarty/smarty-lexer": "^3.1" + "smarty/smarty-lexer": "^4.0.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0.x-dev" + "dev-master": "5.0.x-dev" } }, "autoload": { - "classmap": [ - "libs/" - ] + "files": [ + "src/functions.php" + ], + "psr-4": { + "Smarty\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -812,9 +816,89 @@ "support": { "forum": "https://github.com/smarty-php/smarty/discussions", "issues": "https://github.com/smarty-php/smarty/issues", - "source": "https://github.com/smarty-php/smarty/tree/v4.4.1" + "source": "https://github.com/smarty-php/smarty/tree/v5.0.2" + }, + "time": "2024-03-28T10:23:18+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.29.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, - "time": "2024-02-26T13:58:37+00:00" + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-01-29T20:11:03+00:00" } ], "packages-dev": [ diff --git a/data/class/SC_AdminView.php b/data/class/SC_AdminView.php index b53d02ba8d..78b5001da7 100644 --- a/data/class/SC_AdminView.php +++ b/data/class/SC_AdminView.php @@ -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/'); diff --git a/data/class/SC_InstallView.php b/data/class/SC_InstallView.php index 991dac0d02..ce5f8402d3 100644 --- a/data/class/SC_InstallView.php +++ b/data/class/SC_InstallView.php @@ -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)); } } diff --git a/data/class/SC_MobileView.php b/data/class/SC_MobileView.php index 17aff5e401..95c00ee69d 100644 --- a/data/class/SC_MobileView.php +++ b/data/class/SC_MobileView.php @@ -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); } } diff --git a/data/class/SC_SiteView.php b/data/class/SC_SiteView.php index 0d0d58a636..55a052a399 100644 --- a/data/class/SC_SiteView.php +++ b/data/class/SC_SiteView.php @@ -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); } @@ -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']); } } diff --git a/data/class/SC_SmartphoneView.php b/data/class/SC_SmartphoneView.php index 12b540a80a..4796af5380 100644 --- a/data/class/SC_SmartphoneView.php +++ b/data/class/SC_SmartphoneView.php @@ -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); } } diff --git a/data/class/SC_View.php b/data/class/SC_View.php index 7ded6219a4..143fc42ca4 100644 --- a/data/class/SC_View.php +++ b/data/class/SC_View.php @@ -23,7 +23,7 @@ class SC_View { - /** @var Smarty */ + /** @var \Smarty\Smarty */ public $_smarty; /** @var LC_Page */ @@ -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 = new \Smarty\Smarty(); + $this->_smarty->setLeftDelimiter(''); $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')); @@ -58,6 +58,11 @@ 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'); + $this->_smarty->registerPlugin('modifier', 'is_numeric', 'is_numeric'); + $this->_smarty->registerPlugin('modifier', 'php_uname', 'php_uname'); // XXX register_function で登録すると if で使用できないのではないか? $this->_smarty->registerPlugin('function','sfIsHTTPS', array('SC_Utils_Ex', 'sfIsHTTPS')); $this->_smarty->registerPlugin('function','sfSetErrorStyle', array('SC_Utils_Ex', 'sfSetErrorStyle')); @@ -141,10 +146,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)) { // フックポイントを実行. @@ -160,10 +165,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)) { // フックポイントを実行. @@ -281,9 +286,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 向けにパスの区切り文字を正規化する } } diff --git a/data/smarty_extends/function.from_to.php b/data/smarty_extends/function.from_to.php index 98f3cb86ad..b5778a9712 100644 --- a/data/smarty_extends/function.from_to.php +++ b/data/smarty_extends/function.from_to.php @@ -32,10 +32,6 @@ */ function smarty_function_from_to($params, &$smarty) { - if (!is_callable('smarty_function_escape_special_chars')) { - require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'); - } - $from = null; $to = null; $separator = ' ~ '; diff --git a/data/smarty_extends/function.html_radios_ex.php b/data/smarty_extends/function.html_radios_ex.php deleted file mode 100644 index 69487e3955..0000000000 --- a/data/smarty_extends/function.html_radios_ex.php +++ /dev/null @@ -1,17 +0,0 @@ -