Code

Readded smarty
[gosa.git] / gosa-core / include / smarty / plugins / modifiercompiler.indent.php
diff --git a/gosa-core/include/smarty/plugins/modifiercompiler.indent.php b/gosa-core/include/smarty/plugins/modifiercompiler.indent.php
new file mode 100644 (file)
index 0000000..020c4fd
--- /dev/null
@@ -0,0 +1,32 @@
+<?php\r
+/**\r
+ * Smarty plugin\r
+ * @package Smarty\r
+ * @subpackage PluginsModifierCompiler\r
+ */\r
+\r
+/**\r
+ * Smarty indent modifier plugin\r
+ *\r
+ * Type:     modifier<br>\r
+ * Name:     indent<br>\r
+ * Purpose:  indent lines of text\r
+ *\r
+ * @link http://www.smarty.net/manual/en/language.modifier.indent.php indent (Smarty online manual)\r
+ * @author Uwe Tews\r
+ * @param array $params parameters\r
+ * @return string with compiled code\r
+ */\r
+\r
+function smarty_modifiercompiler_indent($params, $compiler)\r
+{\r
+    if (!isset($params[1])) {\r
+        $params[1] = 4;\r
+    }\r
+    if (!isset($params[2])) {\r
+        $params[2] = "' '";\r
+    }\r
+    return 'preg_replace(\'!^!m\',str_repeat(' . $params[2] . ',' . $params[1] . '),' . $params[0] . ')';\r
+}\r
+\r
+?>
\ No newline at end of file