6 * @subpackage PluginsModifierCompiler
10 * Smarty wordwrap modifier plugin
13 * Purpose: wrap a string of text at a given length
15 * @link http://smarty.php.net/manual/en/language.modifier.wordwrap.php wordwrap (Smarty online manual)
18 * @param array $params parameters
21 * @return string with compiled code
23 function smarty_modifiercompiler_wordwrap($params, $compiler)
25 if (!isset($params[1])) {
28 if (!isset($params[2])) {
31 if (!isset($params[3])) {
34 $function = 'wordwrap';
35 if (Smarty::$_MBSTRING) {
36 if ($compiler->template->caching && ($compiler->tag_nocache | $compiler->nocache)) {
37 $compiler->template->required_plugins['nocache']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php';
38 $compiler->template->required_plugins['nocache']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap';
40 $compiler->template->required_plugins['compiled']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php';
41 $compiler->template->required_plugins['compiled']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap';
43 $function = 'smarty_mb_wordwrap';
46 return $function . '(' . $params[0] . ',' . $params[1] . ',' . $params[2] . ',' . $params[3] . ')';