Code

Updated smarty to 1.0.9
[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  * @link http://smarty.php.net/manual/en/language.modifier.count.paragraphs.php\r
16  *          count_paragraphs (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_count_paragraphs($params, $compiler)\r
22 {\r
23     // count \r or \n characters\r
24     return '(preg_match_all(\'#[\r\n]+#\', ' . $params[0] . ', $tmp)+1)';\r
25 }\r
26 \r
27 ?>