mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-03 18:04:26 +02:00
Fix variable parsing.
This commit is contained in:
@@ -25,9 +25,9 @@ foreach (array_slice($argv, 1) as $template) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (function_exists("preg_replace_callback"))
|
if (function_exists("preg_replace_callback"))
|
||||||
$output = preg_replace_callback('!\$(\w+(\.\w+)?/)*\w+(?>\.\w+)*(?>\|@?\w+(:(?>' . $qstr_regexp . '|[^|]+))*)*!', 'fix_var', $input);
|
$output = preg_replace_callback('!\$(\w+(\.\w+)?/)*\w+(?>\.\w+)*(?>\|@?\w+(:(?>' . $qstr_regexp . '|[^|\s]+))*)*!s', 'fix_var', $input);
|
||||||
else
|
else
|
||||||
$output = preg_replace('!\$(\w+(\.\w+)?/)*\w+(?>\.\w+)*(?>\|@?\w+(:(?>' . $qstr_regexp . '|[^|]+))*)*!F', 'fix_var', $input);
|
$output = preg_replace('!\$(\w+(\.\w+)?/)*\w+(?>\.\w+)*(?>\|@?\w+(:(?>' . $qstr_regexp . '|[^|\s]+))*)*!mF', 'fix_var', $input);
|
||||||
|
|
||||||
fwrite($fp, $output);
|
fwrite($fp, $output);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
@@ -55,6 +55,9 @@ function fix_var($match)
|
|||||||
if (count($props))
|
if (count($props))
|
||||||
$output .= ".".implode('.', $props);
|
$output .= ".".implode('.', $props);
|
||||||
|
|
||||||
|
if ($modifiers)
|
||||||
|
$output .= '|' . $modifiers;
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user