mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 19:04:27 +02:00
fix capitalize modifier to not rely on buggy ucwords() func
This commit is contained in:
1
NEWS
1
NEWS
@@ -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)
|
||||||
|
@@ -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));
|
||||||
}
|
}
|
||||||
|
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Reference in New Issue
Block a user