diff options
Diffstat (limited to 'vendor/smarty/smarty/src/Compile/Modifier/WordWrapModifierCompiler.php')
-rw-r--r-- | vendor/smarty/smarty/src/Compile/Modifier/WordWrapModifierCompiler.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/vendor/smarty/smarty/src/Compile/Modifier/WordWrapModifierCompiler.php b/vendor/smarty/smarty/src/Compile/Modifier/WordWrapModifierCompiler.php new file mode 100644 index 000000000..092b95a80 --- /dev/null +++ b/vendor/smarty/smarty/src/Compile/Modifier/WordWrapModifierCompiler.php @@ -0,0 +1,27 @@ +<?php +namespace Smarty\Compile\Modifier; +/** + * Smarty wordwrap modifier plugin + * Type: modifier + * Name: wordwrap + * Purpose: wrap a string of text at a given length + * + * @author Uwe Tews + */ + +class WordWrapModifierCompiler extends Base { + + public function compile($params, \Smarty\Compiler\Template $compiler) { + if (!isset($params[ 1 ])) { + $params[ 1 ] = 80; + } + if (!isset($params[ 2 ])) { + $params[ 2 ] = '"\n"'; + } + if (!isset($params[ 3 ])) { + $params[ 3 ] = 'false'; + } + return 'smarty_mb_wordwrap(' . $params[ 0 ] . ',' . $params[ 1 ] . ',' . $params[ 2 ] . ',' . $params[ 3 ] . ')'; + } + +}
\ No newline at end of file |