diff options
author | Michael <icarus@dabo.de> | 2012-03-03 13:21:11 +0100 |
---|---|---|
committer | Michael <icarus@dabo.de> | 2012-03-03 13:21:11 +0100 |
commit | 81a8d4f9dbd32de133e647c87a5394dd52f009fe (patch) | |
tree | f1264d57804d810758163bdddf734f82e7d1091f /include/template_processor.php | |
parent | ccfe402fb0b92dc8e62dc87137743851441e27f6 (diff) | |
parent | 9d885c4801e74205dc958aaf4a17f44c4d9134d6 (diff) | |
download | volse-hubzilla-81a8d4f9dbd32de133e647c87a5394dd52f009fe.tar.gz volse-hubzilla-81a8d4f9dbd32de133e647c87a5394dd52f009fe.tar.bz2 volse-hubzilla-81a8d4f9dbd32de133e647c87a5394dd52f009fe.zip |
Merge remote branch 'upstream/master'
Diffstat (limited to 'include/template_processor.php')
-rwxr-xr-x | include/template_processor.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/include/template_processor.php b/include/template_processor.php index 111fc5849..8671587fc 100755 --- a/include/template_processor.php +++ b/include/template_processor.php @@ -160,7 +160,16 @@ private function var_replace($s){ $m = array(); - if (preg_match_all('/\$\[{0,1}([a-zA-Z0-9-_]+\.*)+\]{0,1}/', $s,$m)){ + /** regexp: + * \$ literal $ + * (\[)? optional open square bracket + * ([a-zA-Z0-9-_]+\.?)+ var name, followed by optional + * dot, repeated at least 1 time + * (?(1)\]) if there was opened square bracket + * (subgrup 1), match close bracket + */ + if (preg_match_all('/\$(\[)?([a-zA-Z0-9-_]+\.?)+(?(1)\])/', $s,$m)){ + foreach($m[0] as $var){ $varn = str_replace(array("[","]"), array("",""), $var); $val = $this->_get_var($varn, true); |