- bugfix correction of modifier capitalize fix from 3.10.2013 (issue 159)

This commit is contained in:
Uwe.Tews@googlemail.com
2013-10-28 23:56:41 +00:00
parent c3e6823f5d
commit 5dc4b61771
2 changed files with 7 additions and 6 deletions

View File

@@ -2,6 +2,7 @@
28.10.2013 28.10.2013
- bugfix variable resource name at custom resource plugin did not work within {block} tags (Issue 163) - bugfix variable resource name at custom resource plugin did not work within {block} tags (Issue 163)
- bugfix notice "Trying to get property of non-object" removed (Issue 163) - bugfix notice "Trying to get property of non-object" removed (Issue 163)
- bugfix correction of modifier capitalize fix from 3.10.2013 (issue 159)
20.10.2013 20.10.2013
- bugfix a variable file name at {extends} tag did fail (forum topic 24618) - bugfix a variable file name at {extends} tag did fail (forum topic 24618)

View File

@@ -30,7 +30,7 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals
$upper_string = mb_convert_case( $string, MB_CASE_TITLE, Smarty::$_CHARSET ); $upper_string = mb_convert_case( $string, MB_CASE_TITLE, Smarty::$_CHARSET );
} else { } else {
// uppercase word breaks // uppercase word breaks
$upper_string = preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, smarty_mod_cap_mbconvert_cb('$matches'), $string); $upper_string = preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_mbconvert_cb', $string);
} }
// check uc_digits case // check uc_digits case
if (!$uc_digits) { if (!$uc_digits) {
@@ -40,7 +40,7 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals
} }
} }
} }
$upper_string = preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, smarty_mod_cap_mbconvert2_cb('$matches'), $upper_string); $upper_string = preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_mbconvert2_cb', $upper_string);
return $upper_string; return $upper_string;
} }
@@ -49,7 +49,7 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals
$string = strtolower($string); $string = strtolower($string);
} }
// uppercase (including hyphenated words) // uppercase (including hyphenated words)
$upper_string = preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, smarty_mod_cap_ucfirst_cb('$matches'), $string); $upper_string = preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst_cb', $string);
// check uc_digits case // check uc_digits case
if (!$uc_digits) { if (!$uc_digits) {
if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches, PREG_OFFSET_CAPTURE)) { if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches, PREG_OFFSET_CAPTURE)) {
@@ -58,7 +58,7 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals
} }
} }
} }
$upper_string = preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, smarty_mod_cap_ucfirst2_cb('$matches'), $upper_string); $upper_string = preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst2_cb', $upper_string);
return $upper_string; return $upper_string;
} }
@@ -71,11 +71,11 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals
* @author Kyle Renfrow * @author Kyle Renfrow
*/ */
function smarty_mod_cap_mbconvert_cb($matches){ function smarty_mod_cap_mbconvert_cb($matches){
return stripslashes($matches[1]).mb_convert_case(stripslashes($matches[2]),MB_CASE_UPPER, "' . addslashes(Smarty::$_CHARSET) . '"); return stripslashes($matches[1]).mb_convert_case(stripslashes($matches[2]),MB_CASE_UPPER, Smarty::$_CHARSET);
} }
function smarty_mod_cap_mbconvert2_cb($matches){ function smarty_mod_cap_mbconvert2_cb($matches){
return stripslashes($matches[1]).mb_convert_case(stripslashes($matches[3]),MB_CASE_UPPER, "' . addslashes(Smarty::$_CHARSET) . '"); return stripslashes($matches[1]).mb_convert_case(stripslashes($matches[3]),MB_CASE_UPPER, Smarty::$_CHARSET);
} }
function smarty_mod_cap_ucfirst_cb($matches){ function smarty_mod_cap_ucfirst_cb($matches){