EC-CUBE / ec-cube2

EC-CUBE official repository version 2
https://www.ec-cube.net
Other
86 stars 97 forks source link

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

Open nanasess opened 4 months ago

nanasess commented 4 months ago

refs #876 refs https://github.com/EC-CUBE/ec-cube2/issues/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 関数があればコメントにてお知らせください https://github.com/EC-CUBE/ec-cube2/blob/13a6dacb0693500f413cc164413516f99c328766/data/class/SC_View.php#L61-L65

bbkids commented 4 months ago

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

bbkids commented 4 months ago

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

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

nanasess commented 4 months ago

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

bbkids commented 4 months ago

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