mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 11:54:26 +02:00
Fix handling of apostrophes in the capitalize modifier.
Thanks to asmecher from the forums for reporting this and providing a partial solution.
This commit is contained in:
2
NEWS
2
NEWS
@@ -1,3 +1,5 @@
|
|||||||
|
- fix handling of apostrophes in capitalize modifier (Alec Smecher, boots)
|
||||||
|
|
||||||
Version 2.6.14 (May 28th, 2006)
|
Version 2.6.14 (May 28th, 2006)
|
||||||
-------------------------------
|
-------------------------------
|
||||||
- fix compiler bug allowing php tags in secure templates
|
- fix compiler bug allowing php tags in secure templates
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
function smarty_modifier_capitalize($string, $uc_digits = false)
|
function smarty_modifier_capitalize($string, $uc_digits = false)
|
||||||
{
|
{
|
||||||
smarty_modifier_capitalize_ucfirst(null, $uc_digits);
|
smarty_modifier_capitalize_ucfirst(null, $uc_digits);
|
||||||
return preg_replace_callback('!\b\w+\b!', 'smarty_modifier_capitalize_ucfirst', $string);
|
return preg_replace_callback('!\'?\b\w(\w|\')*\b!', 'smarty_modifier_capitalize_ucfirst', $string);
|
||||||
}
|
}
|
||||||
|
|
||||||
function smarty_modifier_capitalize_ucfirst($string, $uc_digits = null)
|
function smarty_modifier_capitalize_ucfirst($string, $uc_digits = null)
|
||||||
@@ -33,7 +33,7 @@ function smarty_modifier_capitalize_ucfirst($string, $uc_digits = null)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!preg_match('!\d!',$string[0]) || $_uc_digits)
|
if(substr($string[0],0,1) != "'" && !preg_match("!\d!",$string[0]) || $_uc_digits)
|
||||||
return ucfirst($string[0]);
|
return ucfirst($string[0]);
|
||||||
else
|
else
|
||||||
return $string[0];
|
return $string[0];
|
||||||
|
Reference in New Issue
Block a user