aboutsummaryrefslogtreecommitdiffstats
path: root/include/comanche.php
diff options
context:
space:
mode:
authorAndrew Manning <tamanning@zoho.com>2016-05-05 21:49:24 -0400
committerAndrew Manning <tamanning@zoho.com>2016-05-05 21:49:24 -0400
commit3011d3768cb524ccf795ed64924649a2e30a036b (patch)
tree067cfd2421cddefe882911fe9ef930958ee2eb8a /include/comanche.php
parent6ce939491bf932c20c9777a8518da5875e02a6b1 (diff)
parent5508feb6ce185d4da12adbd38dc2c0e36d244704 (diff)
downloadvolse-hubzilla-3011d3768cb524ccf795ed64924649a2e30a036b.tar.gz
volse-hubzilla-3011d3768cb524ccf795ed64924649a2e30a036b.tar.bz2
volse-hubzilla-3011d3768cb524ccf795ed64924649a2e30a036b.zip
Merge remote-tracking branch 'upstream/dev' into plugin-repo
Diffstat (limited to 'include/comanche.php')
-rw-r--r--include/comanche.php37
1 files changed, 36 insertions, 1 deletions
diff --git a/include/comanche.php b/include/comanche.php
index 4d55aee19..0a52eaf2b 100644
--- a/include/comanche.php
+++ b/include/comanche.php
@@ -53,6 +53,31 @@ function comanche_parser(&$a, $s, $pass = 0) {
}
}
+ $cnt = preg_match_all("/\[if (.*?)\](.*?)\[else\](.*?)\[\/if\]/ism", $s, $matches, PREG_SET_ORDER);
+ if($cnt) {
+ foreach($matches as $mtch) {
+ if(comanche_test_condition($mtch[1])) {
+ $s = str_replace($mtch[0], $mtch[2], $s);
+ }
+ else {
+ $s = str_replace($mtch[0], $mtch[3], $s);
+ }
+ }
+ }
+ else {
+ $cnt = preg_match_all("/\[if (.*?)\](.*?)\[\/if\]/ism", $s, $matches, PREG_SET_ORDER);
+ if($cnt) {
+ foreach($matches as $mtch) {
+ if(comanche_test_condition($mtch[1])) {
+ $s = str_replace($mtch[0], $mtch[2], $s);
+ }
+ else {
+ $s = str_replace($mtch[0], '', $s);
+ }
+ }
+ }
+ }
+
if($pass == 0) {
$cnt = preg_match("/\[layout\](.*?)\[\/layout\]/ism", $s, $matches);
if($cnt)
@@ -86,7 +111,6 @@ function comanche_parser(&$a, $s, $pass = 0) {
App::$layout['webpage'] = comanche_webpage($a,$mtch[1]);
}
}
-
}
else {
$cnt = preg_match_all("/\[region=(.*?)\](.*?)\[\/region\]/ism", $s, $matches, PREG_SET_ORDER);
@@ -100,6 +124,17 @@ function comanche_parser(&$a, $s, $pass = 0) {
}
+function comanche_test_condition($s) {
+
+ if(preg_match("/[\$]config[\.](.*?)/",$s,$matches)) {
+ $x = explode('.',$s);
+ if(get_config($x[1],$x[2]))
+ return true;
+ }
+ return false;
+
+}
+
function comanche_menu($s, $class = '') {