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