aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Comuni <fabrix.xm@gmail.com>2012-03-03 00:00:38 +0100
committerFabio Comuni <fabrix.xm@gmail.com>2012-03-03 00:00:38 +0100
commit685686b3e81e53264b4946f54904e8f5323da2ea (patch)
tree62ffbb30386f7b3460a0a12878246b6b1ca933a9
parentaef737f37637270b4f79ea390ee23a61f7fcb4ba (diff)
downloadvolse-hubzilla-685686b3e81e53264b4946f54904e8f5323da2ea.tar.gz
volse-hubzilla-685686b3e81e53264b4946f54904e8f5323da2ea.tar.bz2
volse-hubzilla-685686b3e81e53264b4946f54904e8f5323da2ea.zip
template proc: fix variables regexp
-rwxr-xr-xinclude/template_processor.php11
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);