fix capitalize modifier to not rely on buggy ucwords() func

This commit is contained in:
mohrt
2004-08-23 18:34:12 +00:00
parent 0e302cdf6c
commit a50a53c0f5
3 changed files with 3 additions and 3 deletions

1
NEWS
View File

@@ -1,3 +1,4 @@
- fix capitalize modifier, don't rely on buggy ucwords (Monte)
- make html_select_date work with negative timestamps, also - make html_select_date work with negative timestamps, also
force year range to include given date unless explicitly force year range to include given date unless explicitly
set (Garo, Monte) set (Garo, Monte)

View File

@@ -130,8 +130,7 @@ function smarty_function_html_select_date($params, &$smarty)
} }
// If $time is not in format yyyy-mm-dd // If $time is not in format yyyy-mm-dd
if (!preg_match('/^\d{0,4}-\d{0,2}-\d{0,2}$/', $time)) { if (!preg_match('/^\d{0,4}-\d{0,2}-\d{0,2}$/', $time)) {
// then $time is empty or unix timestamp or mysql timestamp // use smarty_make_timestamp to get an unix timestamp and
// using smarty_make_timestamp to get an unix timestamp and
// strftime to make yyyy-mm-dd // strftime to make yyyy-mm-dd
$time = strftime('%Y-%m-%d', smarty_make_timestamp($time)); $time = strftime('%Y-%m-%d', smarty_make_timestamp($time));
} }

View File

@@ -19,7 +19,7 @@
*/ */
function smarty_modifier_capitalize($string) function smarty_modifier_capitalize($string)
{ {
return ucwords($string); return preg_replace_callback('!\b[a-z]!', create_function('$_x', 'return strtoupper($_x[0]);'), $string);
} }
?> ?>