diff options
author | Simon <simon@kisikew.org> | 2012-03-02 16:02:02 -0800 |
---|---|---|
committer | Simon <simon@kisikew.org> | 2012-03-02 16:02:02 -0800 |
commit | d32edf83d3fb3bb4bebdc9d24001eff000c2a660 (patch) | |
tree | e4c68c144bf5a7753c403d28db22e6b896269651 /include/template_processor.php | |
parent | f1efa0991a07b8d382370d80a269de597e378d00 (diff) | |
parent | 333942898782f3e197a660eb841ccbd296a83475 (diff) | |
download | volse-hubzilla-d32edf83d3fb3bb4bebdc9d24001eff000c2a660.tar.gz volse-hubzilla-d32edf83d3fb3bb4bebdc9d24001eff000c2a660.tar.bz2 volse-hubzilla-d32edf83d3fb3bb4bebdc9d24001eff000c2a660.zip |
Merge pull request #61 from fabrixxm/master
fix to variable rexexp and mentions autocomplete in comments
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); |