mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 19:34:27 +02:00
Restoring ?> in patterns.
This commit is contained in:
@@ -580,9 +580,9 @@ class Smarty
|
|||||||
|
|
||||||
/* If the tag name matches a variable or section property definition,
|
/* If the tag name matches a variable or section property definition,
|
||||||
we simply process it. */
|
we simply process it. */
|
||||||
if (preg_match('!^\$(\w+/)*\w+(?>\.\w+)*(\|@?\w+(:(' . $qstr_regexp . '|[^|]+))?)*$!', $tag_command) || // if a variable
|
if (preg_match('!^\$(\w+/)*\w+(?>\.\w+)*(?>\|@?\w+(:(' . $qstr_regexp . '|[^|]+))*)*$!', $tag_command) || // if a variable
|
||||||
preg_match('!^#(\w+)#(\|@?\w+(:(' . $qstr_regexp . '|[^|]+))?)*$!', $tag_command) || // or a configuration variable
|
preg_match('!^#(\w+)#(?>\|@?\w+(:(' . $qstr_regexp . '|[^|]+))*)*$!', $tag_command) || // or a configuration variable
|
||||||
preg_match('!^%\w+\.\w+%(\|@?\w+(:(' . $qstr_regexp . '|[^|]+))?)*$!', $tag_command)) { // or a section property
|
preg_match('!^%\w+\.\w+%(?>\|@?\w+(:(' . $qstr_regexp . '|[^|]+))*)*$!', $tag_command)) { // or a section property
|
||||||
settype($tag_command, 'array');
|
settype($tag_command, 'array');
|
||||||
$this->_parse_vars_props($tag_command);
|
$this->_parse_vars_props($tag_command);
|
||||||
return "<?php echo $tag_command[0]; ?>";
|
return "<?php echo $tag_command[0]; ?>";
|
||||||
@@ -1046,13 +1046,13 @@ class Smarty
|
|||||||
allow people to use older versions of PHP we emulate preg_grep() and
|
allow people to use older versions of PHP we emulate preg_grep() and
|
||||||
use the version check to see what function to call. */
|
use the version check to see what function to call. */
|
||||||
if (strnatcmp(PHP_VERSION, '4.0.4') >= 0) {
|
if (strnatcmp(PHP_VERSION, '4.0.4') >= 0) {
|
||||||
$var_exprs = preg_grep('!^\$(\w+/)*\w+(?>\.\w+)*(\|@?\w+(:(' . $qstr_regexp . '|[^|]+))?)*$!', $tokens);
|
$var_exprs = preg_grep('!^\$(\w+/)*\w+(?>\.\w+)*(?>\|@?\w+(:(' . $qstr_regexp . '|[^|]+))*)*$!', $tokens);
|
||||||
$conf_var_exprs = preg_grep('!^#(\w+)#(\|@?\w+(:(' . $qstr_regexp . '|[^|]+))?)*$!', $tokens);
|
$conf_var_exprs = preg_grep('!^#(\w+)#(?>\|@?\w+(:(' . $qstr_regexp . '|[^|]+))*)*$!', $tokens);
|
||||||
$sect_prop_exprs = preg_grep('!^%\w+\.\w+%(\|@?\w+(:(' . $qstr_regexp . '|[^|]+))?)*$!', $tokens);
|
$sect_prop_exprs = preg_grep('!^%\w+\.\w+%(?>\|@?\w+(:(' . $qstr_regexp . '|[^|]+))*)*$!', $tokens);
|
||||||
} else {
|
} else {
|
||||||
$var_exprs = $this->_preg_grep('!^\$(\w+/)*\w+(?>\.\w+)*(\|@?\w+(:(' . $qstr_regexp . '|[^|]+))?)*$!', $tokens);
|
$var_exprs = $this->_preg_grep('!^\$(\w+/)*\w+(?>\.\w+)*(?>\|@?\w+(:(' . $qstr_regexp . '|[^|]+))*)*$!', $tokens);
|
||||||
$conf_var_exprs = $this->_preg_grep('!^#(\w+)#(\|@?\w+(:(' . $qstr_regexp . '|[^|]+))?)*$!', $tokens);
|
$conf_var_exprs = $this->_preg_grep('!^#(\w+)#(?>\|@?\w+(:(' . $qstr_regexp . '|[^|]+))*)*$!', $tokens);
|
||||||
$sect_prop_exprs = $this->_preg_grep('!^%\w+\.\w+%(\|@?\w+(:(' . $qstr_regexp . '|[^|]+))?)*$!', $tokens);
|
$sect_prop_exprs = $this->_preg_grep('!^%\w+\.\w+%(?>\|@?\w+(:(' . $qstr_regexp . '|[^|]+))*)*$!', $tokens);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($var_exprs)) {
|
if (count($var_exprs)) {
|
||||||
@@ -1127,7 +1127,7 @@ class Smarty
|
|||||||
function _parse_modifiers(&$output, $modifier_string)
|
function _parse_modifiers(&$output, $modifier_string)
|
||||||
{
|
{
|
||||||
$qstr_regexp = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'';
|
$qstr_regexp = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'';
|
||||||
preg_match_all('!\|@?(\w+)((?::(?:'. $qstr_regexp . '|[^|]+))*)!', '|' . $modifier_string, $match);
|
preg_match_all('!\|@?(\w+)((?>:(?:'. $qstr_regexp . '|[^|]+))*)!', '|' . $modifier_string, $match);
|
||||||
list(, $modifiers, $modifier_arg_strings) = $match;
|
list(, $modifiers, $modifier_arg_strings) = $match;
|
||||||
|
|
||||||
for ($i = 0; $i < count($modifiers); $i++) {
|
for ($i = 0; $i < count($modifiers); $i++) {
|
||||||
|
@@ -580,9 +580,9 @@ class Smarty
|
|||||||
|
|
||||||
/* If the tag name matches a variable or section property definition,
|
/* If the tag name matches a variable or section property definition,
|
||||||
we simply process it. */
|
we simply process it. */
|
||||||
if (preg_match('!^\$(\w+/)*\w+(?>\.\w+)*(\|@?\w+(:(' . $qstr_regexp . '|[^|]+))?)*$!', $tag_command) || // if a variable
|
if (preg_match('!^\$(\w+/)*\w+(?>\.\w+)*(?>\|@?\w+(:(' . $qstr_regexp . '|[^|]+))*)*$!', $tag_command) || // if a variable
|
||||||
preg_match('!^#(\w+)#(\|@?\w+(:(' . $qstr_regexp . '|[^|]+))?)*$!', $tag_command) || // or a configuration variable
|
preg_match('!^#(\w+)#(?>\|@?\w+(:(' . $qstr_regexp . '|[^|]+))*)*$!', $tag_command) || // or a configuration variable
|
||||||
preg_match('!^%\w+\.\w+%(\|@?\w+(:(' . $qstr_regexp . '|[^|]+))?)*$!', $tag_command)) { // or a section property
|
preg_match('!^%\w+\.\w+%(?>\|@?\w+(:(' . $qstr_regexp . '|[^|]+))*)*$!', $tag_command)) { // or a section property
|
||||||
settype($tag_command, 'array');
|
settype($tag_command, 'array');
|
||||||
$this->_parse_vars_props($tag_command);
|
$this->_parse_vars_props($tag_command);
|
||||||
return "<?php echo $tag_command[0]; ?>";
|
return "<?php echo $tag_command[0]; ?>";
|
||||||
@@ -1046,13 +1046,13 @@ class Smarty
|
|||||||
allow people to use older versions of PHP we emulate preg_grep() and
|
allow people to use older versions of PHP we emulate preg_grep() and
|
||||||
use the version check to see what function to call. */
|
use the version check to see what function to call. */
|
||||||
if (strnatcmp(PHP_VERSION, '4.0.4') >= 0) {
|
if (strnatcmp(PHP_VERSION, '4.0.4') >= 0) {
|
||||||
$var_exprs = preg_grep('!^\$(\w+/)*\w+(?>\.\w+)*(\|@?\w+(:(' . $qstr_regexp . '|[^|]+))?)*$!', $tokens);
|
$var_exprs = preg_grep('!^\$(\w+/)*\w+(?>\.\w+)*(?>\|@?\w+(:(' . $qstr_regexp . '|[^|]+))*)*$!', $tokens);
|
||||||
$conf_var_exprs = preg_grep('!^#(\w+)#(\|@?\w+(:(' . $qstr_regexp . '|[^|]+))?)*$!', $tokens);
|
$conf_var_exprs = preg_grep('!^#(\w+)#(?>\|@?\w+(:(' . $qstr_regexp . '|[^|]+))*)*$!', $tokens);
|
||||||
$sect_prop_exprs = preg_grep('!^%\w+\.\w+%(\|@?\w+(:(' . $qstr_regexp . '|[^|]+))?)*$!', $tokens);
|
$sect_prop_exprs = preg_grep('!^%\w+\.\w+%(?>\|@?\w+(:(' . $qstr_regexp . '|[^|]+))*)*$!', $tokens);
|
||||||
} else {
|
} else {
|
||||||
$var_exprs = $this->_preg_grep('!^\$(\w+/)*\w+(?>\.\w+)*(\|@?\w+(:(' . $qstr_regexp . '|[^|]+))?)*$!', $tokens);
|
$var_exprs = $this->_preg_grep('!^\$(\w+/)*\w+(?>\.\w+)*(?>\|@?\w+(:(' . $qstr_regexp . '|[^|]+))*)*$!', $tokens);
|
||||||
$conf_var_exprs = $this->_preg_grep('!^#(\w+)#(\|@?\w+(:(' . $qstr_regexp . '|[^|]+))?)*$!', $tokens);
|
$conf_var_exprs = $this->_preg_grep('!^#(\w+)#(?>\|@?\w+(:(' . $qstr_regexp . '|[^|]+))*)*$!', $tokens);
|
||||||
$sect_prop_exprs = $this->_preg_grep('!^%\w+\.\w+%(\|@?\w+(:(' . $qstr_regexp . '|[^|]+))?)*$!', $tokens);
|
$sect_prop_exprs = $this->_preg_grep('!^%\w+\.\w+%(?>\|@?\w+(:(' . $qstr_regexp . '|[^|]+))*)*$!', $tokens);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($var_exprs)) {
|
if (count($var_exprs)) {
|
||||||
@@ -1127,7 +1127,7 @@ class Smarty
|
|||||||
function _parse_modifiers(&$output, $modifier_string)
|
function _parse_modifiers(&$output, $modifier_string)
|
||||||
{
|
{
|
||||||
$qstr_regexp = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'';
|
$qstr_regexp = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'';
|
||||||
preg_match_all('!\|@?(\w+)((?::(?:'. $qstr_regexp . '|[^|]+))*)!', '|' . $modifier_string, $match);
|
preg_match_all('!\|@?(\w+)((?>:(?:'. $qstr_regexp . '|[^|]+))*)!', '|' . $modifier_string, $match);
|
||||||
list(, $modifiers, $modifier_arg_strings) = $match;
|
list(, $modifiers, $modifier_arg_strings) = $match;
|
||||||
|
|
||||||
for ($i = 0; $i < count($modifiers); $i++) {
|
for ($i = 0; $i < count($modifiers); $i++) {
|
||||||
|
Reference in New Issue
Block a user