]> git.mxchange.org Git - friendica.git/blob - library/Smarty/libs/plugins/modifiercompiler.count_sentences.php
add smarty engine, remove some obsolete zot1 stuff
[friendica.git] / library / Smarty / libs / plugins / modifiercompiler.count_sentences.php
1 <?php\r
2 /**\r
3  * Smarty plugin\r
4  *\r
5  * @package Smarty\r
6  * @subpackage PluginsModifierCompiler\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  *\r
16  * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php\r
17  *          count_sentences (Smarty online manual)\r
18  * @author Uwe Tews\r
19  * @param array $params parameters\r
20  * @return string with compiled code\r
21  */\r
22 function smarty_modifiercompiler_count_sentences($params, $compiler)\r
23 {\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
26 }\r
27 \r
28 ?>