1 <?php\r
2 /**\r
3 * Smarty plugin\r
4 * @package Smarty\r
5 * @subpackage PluginsModifierCompiler\r
6 */\r
7 \r
8 /**\r
9 * Smarty indent modifier plugin\r
10 *\r
11 * Type: modifier<br>\r
12 * Name: indent<br>\r
13 * Purpose: indent lines of text\r
14 *\r
15 * @link http://www.smarty.net/manual/en/language.modifier.indent.php indent (Smarty online manual)\r
16 * @author Uwe Tews\r
17 * @param array $params parameters\r
18 * @return string with compiled code\r
19 */\r
20 \r
21 function smarty_modifiercompiler_indent($params, $compiler)\r
22 {\r
23 if (!isset($params[1])) {\r
24 $params[1] = 4;\r
25 }\r
26 if (!isset($params[2])) {\r
27 $params[2] = "' '";\r
28 }\r
29 return 'preg_replace(\'!^!m\',str_repeat(' . $params[2] . ',' . $params[1] . '),' . $params[0] . ')';\r
30 }\r
31 \r
32 ?>