mirror of
https://github.com/smarty-php/smarty.git
synced 2025-12-03 15:59:32 +01:00
- update for PHP 5.4 compatibility
- reformat source to PSR-2 standard
This commit is contained in:
@@ -23,13 +23,14 @@
|
||||
*/
|
||||
function smarty_modifier_regex_replace($string, $search, $replace)
|
||||
{
|
||||
if(is_array($search)) {
|
||||
foreach($search as $idx => $s) {
|
||||
if (is_array($search)) {
|
||||
foreach ($search as $idx => $s) {
|
||||
$search[$idx] = _smarty_regex_replace_check($s);
|
||||
}
|
||||
} else {
|
||||
$search = _smarty_regex_replace_check($search);
|
||||
}
|
||||
|
||||
return preg_replace($search, $replace, $string);
|
||||
}
|
||||
|
||||
@@ -49,7 +50,6 @@ function _smarty_regex_replace_check($search)
|
||||
if (preg_match('!([a-zA-Z\s]+)$!s', $search, $match) && (strpos($match[1], 'e') !== false)) {
|
||||
$search = substr($search, 0, -strlen($match[1])) . preg_replace('![e\s]+!', '', $match[1]);
|
||||
}
|
||||
|
||||
return $search;
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user