10 * Smarty capitalize modifier plugin
13 * Name: capitalize<br>
14 * Purpose: capitalize words in the string
15 * @link http://smarty.php.net/manual/en/language.modifiers.php#LANGUAGE.MODIFIER.CAPITALIZE
16 * capitalize (Smarty online manual)
17 * @author Monte Ohrt <monte at ohrt dot com>
21 function smarty_modifier_capitalize($string, $uc_digits = false)
23 smarty_modifier_capitalize_ucfirst(null, $uc_digits);
24 return preg_replace_callback('!\'?\b\w(\w|\')*\b!', 'smarty_modifier_capitalize_ucfirst', $string);
27 function smarty_modifier_capitalize_ucfirst($string, $uc_digits = null)
29 static $_uc_digits = false;
31 if(isset($uc_digits)) {
32 $_uc_digits = $uc_digits;
36 if(substr($string[0],0,1) != "'" && !preg_match("!\d!",$string[0]) ||
$_uc_digits)
37 return ucfirst($string[0]);