diff options
| author | Simon Wisselink <wisskid@users.noreply.github.com> | 2022-09-23 00:09:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-23 00:09:00 +0200 |
| commit | 4550fc03391bd120b4add41ad7934c4c59aa21e8 (patch) | |
| tree | e4c74de17d9033236183daabbf83da0808a7f0de /libs/plugins/modifiercompiler.nl2br.php | |
| parent | 4fc39d59a5d7b3cb3d49b5170eba43ceafcf6074 (diff) | |
| download | smarty-4550fc03391bd120b4add41ad7934c4c59aa21e8.tar.gz smarty-4550fc03391bd120b4add41ad7934c4c59aa21e8.tar.bz2 smarty-4550fc03391bd120b4add41ad7934c4c59aa21e8.zip | |
Using PHP functions as modifiers now triggers a deprecation notice (#814)
Fixes #813
Diffstat (limited to 'libs/plugins/modifiercompiler.nl2br.php')
| -rw-r--r-- | libs/plugins/modifiercompiler.nl2br.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libs/plugins/modifiercompiler.nl2br.php b/libs/plugins/modifiercompiler.nl2br.php new file mode 100644 index 00000000..308c00e4 --- /dev/null +++ b/libs/plugins/modifiercompiler.nl2br.php @@ -0,0 +1,23 @@ +<?php + +/** + * Smarty plugin + * + * @package Smarty + * @subpackage PluginsModifierCompiler + */ +/** + * Smarty nl2br modifier plugin + * Type: modifier + * Name: nl2br + * Purpose: insert HTML line breaks before all newlines in a string + * + * @link https://www.smarty.net/docs/en/language.modifier.nl2br.tpl nl2br (Smarty online manual) + * + * @param array $params parameters + * + * @return string with compiled code + */ +function smarty_modifiercompiler_nl2br($params) { + return 'nl2br((string) ' . $params[0] . ', (bool) ' . ($params[1] ?? true) . ')'; +} |
