6 * @subpackage PluginsModifierCompiler
\r
10 * Smarty count_paragraphs modifier plugin
\r
12 * Type: modifier<br>
\r
13 * Name: count_paragraphs<br>
\r
14 * Purpose: count the number of paragraphs in a text
\r
16 * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
\r
17 * count_paragraphs (Smarty online manual)
\r
19 * @param array $params parameters
\r
20 * @return string with compiled code
\r
22 function smarty_modifiercompiler_count_paragraphs($params, $compiler)
\r
24 // count \r or \n characters
\r
25 return '(preg_match_all(\'#[\r\n]+#\', ' . $params[0] . ', $tmp)+1)';
\r