mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 19:34:27 +02:00
- bugfix removed PHP 5.5 deprecated preg_replace /e option in modifier capitalize (forum topic 24389)
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
===== trunk =====
|
||||
27.06.2013
|
||||
- bugfix removed PHP 5.5 deprecated preg_replace /e option in modifier capitalize (forum topic 24389)
|
||||
|
||||
17.06.2013
|
||||
- fixed spelling in sources and documentation (from smarty-developers forum Veres Lajos)
|
||||
- enhancement added constant SMARTY::CLEAR_EXPIRED for the change of 26.05.2013 (forum topic 24310)
|
||||
|
@@ -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 );
|
||||
} else {
|
||||
// uppercase word breaks
|
||||
$upper_string = preg_replace("!(^|[^\p{L}'])([\p{Ll}])!eS" . Smarty::$_UTF8_MODIFIER, "stripslashes('\\1').mb_convert_case(stripslashes('\\2'),MB_CASE_UPPER, '" . addslashes(Smarty::$_CHARSET) . "')", $string);
|
||||
$upper_string = preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, create_function ('$matches', 'return stripslashes($matches[1]).mb_convert_case(stripslashes($matches[2]),MB_CASE_UPPER, "' . addslashes(Smarty::$_CHARSET) . '");'), $string);
|
||||
}
|
||||
// check uc_digits case
|
||||
if (!$uc_digits) {
|
||||
@@ -40,7 +40,7 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals
|
||||
}
|
||||
}
|
||||
}
|
||||
$upper_string = preg_replace("!((^|\s)['\"])(\w)!e" . Smarty::$_UTF8_MODIFIER, "stripslashes('\\1').mb_convert_case(stripslashes('\\3'),MB_CASE_UPPER, '" . addslashes(Smarty::$_CHARSET) . "')", $upper_string);
|
||||
$upper_string = preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, create_function ('$matches', 'return stripslashes($matches[1]).mb_convert_case(stripslashes($matches[3]),MB_CASE_UPPER, "' . addslashes(Smarty::$_CHARSET) . '");'), $upper_string);
|
||||
return $upper_string;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = fals
|
||||
$string = strtolower($string);
|
||||
}
|
||||
// uppercase (including hyphenated words)
|
||||
$upper_string = preg_replace("!(^|[^\p{L}'])([\p{Ll}])!eS" . Smarty::$_UTF8_MODIFIER, "stripslashes('\\1').ucfirst(stripslashes('\\2'))", $string);
|
||||
$upper_string = preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, create_function ('$matches', 'return stripslashes($matches[1]).ucfirst(stripslashes($matches[2]));'), $string);
|
||||
// check uc_digits case
|
||||
if (!$uc_digits) {
|
||||
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("!((^|\s)['\"])(\w)!e" . Smarty::$_UTF8_MODIFIER, "stripslashes('\\1').strtoupper(stripslashes('\\3'))", $upper_string);
|
||||
$upper_string = preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, create_function ('$matches', 'return stripslashes($matches[1]).ucfirst(stripslashes($matches[3]));'), $upper_string);
|
||||
return $upper_string;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user