Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

プラグインや決済モジュールの Smarty テンプレートで利用している PHP 関数 #911

Open
nanasess opened this issue Apr 24, 2024 · 4 comments

Comments

@nanasess
Copy link
Contributor

refs #876
refs #684

Smarty5 から Smarty テンプレートで PHP 関数を利用する場合、Smarty::registerPlugin() を使用して、 modifier の登録が必須となります。
https://smarty-php.github.io/smarty/stable/upgrading/#using-native-php-functions-or-userland-functions-in-your-templates

EC-CUBE本体で使用している PHP 関数は以下にて登録済みですが、互換性維持のため、プラグインや決済モジュールの Smarty テンプレートで利用している PHP 関数があればコメントにてお知らせください

$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');

@bbkids
Copy link
Contributor

bbkids commented Apr 26, 2024

admin/products/product_class_confirm.tpl で array_key_exists が使われてます。

@bbkids
Copy link
Contributor

bbkids commented May 1, 2024

empty や is_array は登録なしで利用できているようなのですがどうしてなのでしょう?

file_exists、is_numeric、array_key_exists 等は登録しないと利用できませんが、違いってなんでしょうか?

@nanasess
Copy link
Contributor Author

nanasess commented May 1, 2024

@bbkids まだ調べられてないのですが、 Smarty 側で許可されている関数があるのだと思われます
こちらで設定されているようですね
https://github.com/smarty-php/smarty/blob/master/src/Extension/DefaultExtension.php#L21-L48

@bbkids
Copy link
Contributor

bbkids commented May 1, 2024

@nanasess なるほど、Smarty側で設定されてるんですね。有難う御座います。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants