aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2015-05-27 15:21:30 +0200
committerMario Vavti <mario@mariovavti.com>2015-05-27 15:21:30 +0200
commit5ccc9e1b8d90969c699d5b6520fd0c720bfcf26c (patch)
tree3399e31f199cbff1facddcc7a866662d36806043
parentbd25f8577f812f02a054d7b9b2e3c7b28e6852b6 (diff)
downloadvolse-hubzilla-5ccc9e1b8d90969c699d5b6520fd0c720bfcf26c.tar.gz
volse-hubzilla-5ccc9e1b8d90969c699d5b6520fd0c720bfcf26c.tar.bz2
volse-hubzilla-5ccc9e1b8d90969c699d5b6520fd0c720bfcf26c.zip
make it possible to include menus in blocks - this will only work in html blocks of course
-rw-r--r--include/comanche.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/comanche.php b/include/comanche.php
index 65f64be5c..cb46985eb 100644
--- a/include/comanche.php
+++ b/include/comanche.php
@@ -168,6 +168,21 @@ function comanche_block($s, $class = '') {
);
if($r) {
+ //check for eventual menus in the block and parse them
+ $cnt = preg_match_all("/\[menu\](.*?)\[\/menu\]/ism", $r[0]['body'], $matches, PREG_SET_ORDER);
+ if($cnt) {
+ foreach($matches as $mtch) {
+ $r[0]['body'] = str_replace($mtch[0], comanche_menu(trim($mtch[1])), $r[0]['body']);
+ }
+ }
+ $cnt = preg_match_all("/\[menu=(.*?)\](.*?)\[\/menu\]/ism", $r[0]['body'], $matches, PREG_SET_ORDER);
+ if($cnt) {
+ foreach($matches as $mtch) {
+ $r[0]['body'] = str_replace($mtch[0],comanche_menu(trim($mtch[2]),$mtch[1]),$r[0]['body']);
+ }
+ }
+
+ //emit the block
$o .= (($var['wrap'] == 'none') ? '' : '<div class="' . $class . '">');
if($r[0]['title'] && trim($r[0]['body']) != '$content') {