mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
Fixed problem with UNDEFINE
git-svn-id: file:///svn/phpbb/trunk@4940 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
d2271ab249
commit
56efd0b5d2
1 changed files with 27 additions and 29 deletions
|
@ -646,45 +646,43 @@ class template
|
|||
|
||||
function compile_tag_define($tag_args, $op)
|
||||
{
|
||||
preg_match('#^(([a-z0-9\-_]+?\.)+?)?\$([A-Z][A-Z0-9_\-]*?) = (\'?)(.*?)(\'?)$#', $tag_args, $match);
|
||||
preg_match('#^(([a-z0-9\-_]+?\.)+?)?\$([A-Z][A-Z0-9_\-]*?)( = (\'?)(.*?)(\'?))?$#', $tag_args, $match);
|
||||
|
||||
if (empty($match[3]) || empty($match[5]))
|
||||
if (empty($match[3]) || (empty($match[6]) && $op))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Are we a string?
|
||||
if ($match[4] && $match[6])
|
||||
if (!$op)
|
||||
{
|
||||
$match[5] = "'" . addslashes(str_replace(array('\\\'', '\\\\'), array('\'', '\\'), $match[5])) . "'";
|
||||
return 'unset(' . (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[3] . '\']' : '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $match[3] . '\']') . ');';
|
||||
}
|
||||
|
||||
// Are we a string?
|
||||
if ($match[5] && $match[7])
|
||||
{
|
||||
$match[6] = "'" . addslashes(str_replace(array('\\\'', '\\\\'), array('\'', '\\'), $match[6])) . "'";
|
||||
}
|
||||
else
|
||||
{
|
||||
preg_match('#(true|false|\.)#i', $match[5], $type);
|
||||
preg_match('#(true|false|\.)#i', $match[6], $type);
|
||||
|
||||
switch (strtolower($type[1]))
|
||||
{
|
||||
case 'true':
|
||||
case 'false':
|
||||
$match[5] = strtoupper($match[5]);
|
||||
$match[6] = strtoupper($match[6]);
|
||||
break;
|
||||
case '.';
|
||||
$match[5] = doubleval($match[5]);
|
||||
$match[6] = doubleval($match[6]);
|
||||
break;
|
||||
default:
|
||||
$match[5] = intval($match[5]);
|
||||
$match[6] = intval($match[6]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($op)
|
||||
{
|
||||
return (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[3] . '\']' : '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $match[3] . '\']') . ' = ' . $match[5] . ';';
|
||||
}
|
||||
else
|
||||
{
|
||||
return 'unset(' . (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[3] . '\']' : '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $match[3] . '\']') . ');';
|
||||
}
|
||||
return (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[3] . '\']' : '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $match[3] . '\']') . ' = ' . $match[6] . ';';
|
||||
}
|
||||
|
||||
function compile_tag_include($tag_args)
|
||||
|
|
Loading…
Add table
Reference in a new issue