~ubuntu-branches/ubuntu/feisty/smarty/feisty-security

« back to all changes in this revision

Viewing changes to libs/plugins/modifier.count_paragraphs.php

  • Committer: Bazaar Package Importer
  • Author(s): Dimitri Fontaine
  • Date: 2004-04-16 17:41:20 UTC
  • Revision ID: james.westby@ubuntu.com-20040416174120-qb9ma0g419hkd25g
Tags: 2.6.2-2
* Adapted dependencies to allow running smarty with apache 2 (Closes: #241147)
* Prepared the template for i18n (Closes: #233098)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * Smarty plugin
 
4
 * @package Smarty
 
5
 * @subpackage plugins
 
6
 */
 
7
 
 
8
 
 
9
/**
 
10
 * Smarty count_paragraphs modifier plugin
 
11
 *
 
12
 * Type:     modifier<br>
 
13
 * Name:     count_paragraphs<br>
 
14
 * Purpose:  count the number of paragraphs in a text
 
15
 * @link http://smarty.php.net/manual/en/language.modifier.count.paragraphs.php
 
16
 *          count_paragraphs (Smarty online manual)
 
17
 * @param string
 
18
 * @return integer
 
19
 */
 
20
function smarty_modifier_count_paragraphs($string)
 
21
{
 
22
    // count \r or \n characters
 
23
    return count(preg_split('/[\r\n]+/', $string));
 
24
}
 
25
 
 
26
/* vim: set expandtab: */
 
27
 
 
28
?>