Code

Readded smarty
[gosa.git] / gosa-core / include / smarty / plugins / modifiercompiler.wordwrap.php
1 <?php\r
2 /**\r
3  * Smarty plugin\r
4  *\r
5  * @package Smarty\r
6  * @subpackage PluginsModifierCompiler\r
7  */\r
8 \r
9 /**\r
10  * Smarty wordwrap modifier plugin\r
11  * \r
12  * Type:     modifier<br>\r
13  * Name:     wordwrap<br>\r
14  * Purpose:  wrap a string of text at a given length\r
15  * \r
16  * @link http://smarty.php.net/manual/en/language.modifier.wordwrap.php wordwrap (Smarty online manual)\r
17  * @author Uwe Tews \r
18  * @param array $params parameters\r
19  * @return string with compiled code\r
20  */\r
21 function smarty_modifiercompiler_wordwrap($params, $compiler)\r
22 {\r
23     if (!isset($params[1])) {\r
24         $params[1] = 80;\r
25     } \r
26     if (!isset($params[2])) {\r
27         $params[2] = '"\n"';\r
28     } \r
29     if (!isset($params[3])) {\r
30         $params[3] = 'false';\r
31     } \r
32     $function = 'wordwrap';\r
33     if (SMARTY_MBSTRING /* ^phpunit */&&empty($_SERVER['SMARTY_PHPUNIT_DISABLE_MBSTRING'])/* phpunit$ */) {\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
37         } else {\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
40         }\r
41         $function = 'smarty_mb_wordwrap';\r
42     }\r
43     return $function . '(' . $params[0] . ',' . $params[1] . ',' . $params[2] . ',' . $params[3] . ')';\r
44\r
45 \r
46 ?>