2f3ba65e23773e8ed36830ca14598ff0d28cd327
[atutor.git] / mods / phpdoc2 / PhpDocumentor / phpDocumentor / Smarty-2.6.0 / libs / plugins / modifier.count_sentences.php
1 <?php\r
2 /**\r
3  * Smarty plugin\r
4  * @package Smarty\r
5  * @subpackage plugins\r
6  */\r
7 \r
8 \r
9 /**\r
10  * Smarty count_sentences modifier plugin\r
11  *\r
12  * Type:     modifier<br>\r
13  * Name:     count_sentences\r
14  * Purpose:  count the number of sentences in a text\r
15  * @link http://smarty.php.net/manual/en/language.modifier.count.paragraphs.php\r
16  *          count_sentences (Smarty online manual)\r
17  * @param string\r
18  * @return integer\r
19  */\r
20 function smarty_modifier_count_sentences($string)\r
21 {\r
22     // find periods with a word before but not after.\r
23     return preg_match_all('/[^\s]\.(?!\w)/', $string, $match);\r
24 }\r
25 \r
26 /* vim: set expandtab: */\r
27 \r
28 ?>\r