Chris PeBenito 696b41
Chris PeBenito 696b41
/**
Chris PeBenito 696b41
 * Smarty plugin
Chris PeBenito 696b41
 * @package Smarty
Chris PeBenito 696b41
 * @subpackage plugins
Chris PeBenito 696b41
 */
Chris PeBenito 696b41
Chris PeBenito 696b41
Chris PeBenito 696b41
/**
Chris PeBenito 696b41
 * Smarty count_characters modifier plugin
Chris PeBenito 696b41
 *
Chris PeBenito 696b41
 * Type:     modifier
Chris PeBenito 696b41
 * Name:     count_characteres
Chris PeBenito 696b41
 * Purpose:  count the number of characters in a text
Chris PeBenito 696b41
 * @link http://smarty.php.net/manual/en/language.modifier.count.characters.php
Chris PeBenito 696b41
 *          count_characters (Smarty online manual)
Chris PeBenito 696b41
 * @param string
Chris PeBenito 696b41
 * @param boolean include whitespace in the character count
Chris PeBenito 696b41
 * @return integer
Chris PeBenito 696b41
 */
Chris PeBenito 696b41
function smarty_modifier_count_characters($string, $include_spaces = false)
Chris PeBenito 696b41
{
Chris PeBenito 696b41
    if ($include_spaces)
Chris PeBenito 696b41
       return(strlen($string));
Chris PeBenito 696b41
Chris PeBenito 696b41
    return preg_match_all("/[^\s]/",$string, $match);
Chris PeBenito 696b41
}
Chris PeBenito 696b41
Chris PeBenito 696b41
/* vim: set expandtab: */
Chris PeBenito 696b41
Chris PeBenito 696b41
?>