6 * @subpackage PluginsModifierCompiler
\r
10 * Smarty count_sentences modifier plugin
\r
12 * Type: modifier<br>
\r
13 * Name: count_sentences
\r
14 * Purpose: count the number of sentences in a text
\r
16 * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
\r
17 * count_sentences (Smarty online manual)
\r
19 * @param array $params parameters
\r
20 * @return string with compiled code
\r
22 function smarty_modifiercompiler_count_sentences($params, $compiler)
\r
24 // find periods, question marks, exclamation marks with a word before but not after.
\r
25 return 'preg_match_all("#\w[\.\?\!](\W|$)#S' . Smarty::$_UTF8_MODIFIER . '", ' . $params[0] . ', $tmp)';
\r