diff options
| author | Simon Wisselink <wisskid@users.noreply.github.com> | 2024-02-26 14:33:47 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-26 14:33:47 +0100 |
| commit | de1bc77f7fad0500a8b654203c72bbb49554f55c (patch) | |
| tree | a2213dbe1fa06e3bfe9cc4bae0f08aae2e3a2de5 /libs/plugins/modifiercompiler.json_encode.php | |
| parent | 326b2da8da3cb843de1211d507ba4dea3aa49688 (diff) | |
| download | smarty-de1bc77f7fad0500a8b654203c72bbb49554f55c.tar.gz smarty-de1bc77f7fad0500a8b654203c72bbb49554f55c.tar.bz2 smarty-de1bc77f7fad0500a8b654203c72bbb49554f55c.zip | |
Prevent deprecation notices for implode, json_encode and substr modifiers
* Prevent deprecation notices for implode, json_encode and substr modifiers.
* unit tests
Diffstat (limited to 'libs/plugins/modifiercompiler.json_encode.php')
| -rw-r--r-- | libs/plugins/modifiercompiler.json_encode.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libs/plugins/modifiercompiler.json_encode.php b/libs/plugins/modifiercompiler.json_encode.php new file mode 100644 index 00000000..629277f2 --- /dev/null +++ b/libs/plugins/modifiercompiler.json_encode.php @@ -0,0 +1,11 @@ +<?php + +/** + * Smarty plugin + * + * @package Smarty + * @subpackage PluginsModifierCompiler + */ +function smarty_modifiercompiler_json_encode($params) { + return 'json_encode(' . $params[0] . (isset($params[1]) ? ', (int) ' . $params[1] : '') . ')'; +} |
