6 * @subpackage PluginsModifierCompiler
\r
10 * Smarty wordwrap modifier plugin
\r
12 * Type: modifier<br>
\r
13 * Name: wordwrap<br>
\r
14 * Purpose: wrap a string of text at a given length
\r
16 * @link http://smarty.php.net/manual/en/language.modifier.wordwrap.php wordwrap (Smarty online manual)
\r
18 * @param array $params parameters
\r
19 * @return string with compiled code
\r
21 function smarty_modifiercompiler_wordwrap($params, $compiler)
\r
23 if (!isset($params[1])) {
\r
26 if (!isset($params[2])) {
\r
27 $params[2] = '"\n"';
\r
29 if (!isset($params[3])) {
\r
30 $params[3] = 'false';
\r
32 $function = 'wordwrap';
\r
33 if (Smarty::$_MBSTRING) {
\r
34 if ($compiler->tag_nocache | $compiler->nocache) {
\r
35 $compiler->template->required_plugins['nocache']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR .'shared.mb_wordwrap.php';
\r
36 $compiler->template->required_plugins['nocache']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap';
\r
38 $compiler->template->required_plugins['compiled']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR .'shared.mb_wordwrap.php';
\r
39 $compiler->template->required_plugins['compiled']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap';
\r
41 $function = 'smarty_mb_wordwrap';
\r
43 return $function . '(' . $params[0] . ',' . $params[1] . ',' . $params[2] . ',' . $params[3] . ')';
\r