1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

Simple parser supports arrays in a proper way

This commit is contained in:
SecretR
2014-07-09 16:32:17 +03:00
parent 0227c86fe6
commit 632e85745f

View File

@@ -791,11 +791,11 @@ class e_parse extends e_parser
* Simple parser * Simple parser
* *
* @param string $template * @param string $template
* @param e_vars $vars * @param e_vars|array $vars
* @param string $replaceUnset string to be used if replace variable is not set, false - don't replace * @param string $replaceUnset string to be used if replace variable is not set, false - don't replace
* @return string parsed content * @return string parsed content
*/ */
function simpleParse($template, e_vars $vars, $replaceUnset='') function simpleParse($template, $vars, $replaceUnset='')
{ {
$this->replaceVars = $vars; $this->replaceVars = $vars;
$this->replaceUnset = $replaceUnset; $this->replaceUnset = $replaceUnset;
@@ -808,8 +808,9 @@ class e_parse extends e_parser
$key = $tmp[1]; $key = $tmp[1];
if(is_array($this->replaceVars)) if(is_array($this->replaceVars))
{ {
return ($this->replaceVars[$key] !== null ? $this->replaceVars[$key]: $unset); $this->replaceVars = new e_vars($this->replaceVars);
} //return ($this->replaceVars[$key] !== null ? $this->replaceVars[$key]: $unset);
}
// //
return ($this->replaceVars->$tmp[1] !== null ? $this->replaceVars->$tmp[1] : $unset); // Doesn't work. return ($this->replaceVars->$tmp[1] !== null ? $this->replaceVars->$tmp[1] : $unset); // Doesn't work.
} }