diff options
Diffstat (limited to 'libs/plugins/modifiercompiler.count_sentences.php')
| -rw-r--r-- | libs/plugins/modifiercompiler.count_sentences.php | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libs/plugins/modifiercompiler.count_sentences.php b/libs/plugins/modifiercompiler.count_sentences.php index cde5c467..7f48a3ec 100644 --- a/libs/plugins/modifiercompiler.count_sentences.php +++ b/libs/plugins/modifiercompiler.count_sentences.php @@ -12,16 +12,17 @@ * Type: modifier<br>
* Name: count_sentences
* Purpose: count the number of sentences in a text
- * @link http://smarty.php.net/manual/en/language.modifier.count.paragraphs.php
+ *
+ * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
* count_sentences (Smarty online manual)
- * @author Uwe Tews
+ * @author Uwe Tews
* @param array $params parameters
* @return string with compiled code
*/
function smarty_modifiercompiler_count_sentences($params, $compiler)
{
- // find periods with a word before but not after.
- return 'preg_match_all(\'/[^\s]\.(?!\w)/\', ' . $params[0] . ', $tmp)';
+ // find periods, question marks, exclamation marks with a word before but not after.
+ return 'preg_match_all("#\w[\.\?\!](\W|$)#uS", ' . $params[0] . ', $tmp)';
}
?>
\ No newline at end of file |
