diff options
author | Fabio Comuni <fabrix.xm@gmail.com> | 2012-03-02 15:53:48 +0100 |
---|---|---|
committer | Fabio Comuni <fabrix.xm@gmail.com> | 2012-03-02 15:53:48 +0100 |
commit | aef737f37637270b4f79ea390ee23a61f7fcb4ba (patch) | |
tree | 1260f003b2351627ef0fa8fe0c1cb6f8ef630bdf | |
parent | 5fc3c3ab854d1e2100fc5fdeb82298c60e320c92 (diff) | |
download | volse-hubzilla-aef737f37637270b4f79ea390ee23a61f7fcb4ba.tar.gz volse-hubzilla-aef737f37637270b4f79ea390ee23a61f7fcb4ba.tar.bz2 volse-hubzilla-aef737f37637270b4f79ea390ee23a61f7fcb4ba.zip |
template proc: allow isolation of var name between [ and ]
$var.name -> $[var.name]
-rwxr-xr-x | include/template_processor.php | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/template_processor.php b/include/template_processor.php index 9ac0a1313..111fc5849 100755 --- a/include/template_processor.php +++ b/include/template_processor.php @@ -160,13 +160,15 @@ private function var_replace($s){ $m = array(); - if (preg_match_all('/\$([a-zA-Z0-9-_]+\.*)+/', $s,$m)){ + if (preg_match_all('/\$\[{0,1}([a-zA-Z0-9-_]+\.*)+\]{0,1}/', $s,$m)){ foreach($m[0] as $var){ - $val = $this->_get_var($var, true); + $varn = str_replace(array("[","]"), array("",""), $var); + $val = $this->_get_var($varn, true); if ($val!=KEY_NOT_EXISTS) $s = str_replace($var, $val, $s); } } + return $s; } |