Code

Readded smarty
[gosa.git] / gosa-core / include / smarty / plugins / modifiercompiler.count_paragraphs.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 count_paragraphs modifier plugin\r
11  *\r
12  * Type:     modifier<br>\r
13  * Name:     count_paragraphs<br>\r
14  * Purpose:  count the number of paragraphs in a text\r
15  *\r
16  * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php\r
17  *          count_paragraphs (Smarty online manual)\r
18  * @author Uwe Tews\r
19  * @param array $params parameters\r
20  * @return string with compiled code\r
21  */\r
22 function smarty_modifiercompiler_count_paragraphs($params, $compiler)\r
23 {\r
24     // count \r or \n characters\r
25     return '(preg_match_all(\'#[\r\n]+#\', ' . $params[0] . ', $tmp)+1)';\r
26 }\r
27 \r
28 ?>