X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;f=wwwroot%2Finc%2Fsmarty%2Fnode_methodz%2Fmodifier.count_paragraphs.php;fp=wwwroot%2Finc%2Fsmarty%2Fnode_methodz%2Fmodifier.count_paragraphs.php;h=6a9833c97ca009f4a963095cc6bf8d6d6d2f1276;hb=51ff32267c4949bad6a8dddc502cbc01ed56edc8;hp=0000000000000000000000000000000000000000;hpb=dcee763368a1e3f380d07320a5254d91a09304e6;p=mirrors%2FKyberia-bloodline.git diff --git a/wwwroot/inc/smarty/node_methodz/modifier.count_paragraphs.php b/wwwroot/inc/smarty/node_methodz/modifier.count_paragraphs.php new file mode 100644 index 0000000..6a9833c --- /dev/null +++ b/wwwroot/inc/smarty/node_methodz/modifier.count_paragraphs.php @@ -0,0 +1,28 @@ + + * Name: count_paragraphs
+ * Purpose: count the number of paragraphs in a text + * @link http://smarty.php.net/manual/en/language.modifier.count.paragraphs.php + * count_paragraphs (Smarty online manual) + * @param string + * @return integer + */ +function smarty_modifier_count_paragraphs($string) +{ + // count \r or \n characters + return count(preg_split('/[\r\n]+/', $string)); +} + +/* vim: set expandtab: */ + +?>