Parent Directory | Revision Log
no message
1 | cvsjoko | 1.1 | <?php |
2 | |||
3 | /* | ||
4 | * Smarty plugin | ||
5 | * ------------------------------------------------------------- | ||
6 | * Type: modifier | ||
7 | * Name: count_sentences | ||
8 | * Purpose: count the number of sentences in a text | ||
9 | * ------------------------------------------------------------- | ||
10 | */ | ||
11 | function smarty_modifier_count_sentences($string) | ||
12 | { | ||
13 | // find periods with a word before but not after. | ||
14 | return preg_match_all('/[^\s]\.(?!\w)/', $string, $match); | ||
15 | } | ||
16 | |||
17 | /* vim: set expandtab: */ | ||
18 | |||
19 | ?> |
MailToCvsAdmin">MailToCvsAdmin | ViewVC Help |
Powered by ViewVC 1.1.26 |