From dd5b97639edfb5d562ced806e27e64a6bab556b8 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 19 Apr 2015 13:25:05 +0200 Subject: Introduce wrap variable in comanche blocks (if set to none the block will not be wrapped in a div), fix menu item permissions (it was not possible to set them visible for everybody) and a typo --- include/comanche.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'include/comanche.php') diff --git a/include/comanche.php b/include/comanche.php index fcf50d67e..e0d3af985 100644 --- a/include/comanche.php +++ b/include/comanche.php @@ -133,7 +133,19 @@ function comanche_get_channel_id() { return $channel_id; } -function comanche_block($name) { +function comanche_block($s) { + $var = array(); + $matches = array(); + $name = $s; + + $cnt = preg_match_all("/\[var=(.*?)\](.*?)\[\/var\]/ism", $s, $matches, PREG_SET_ORDER); + if($cnt) { + foreach($matches as $mtch) { + $var[$mtch[1]] = $mtch[2]; + $name = str_replace($mtch[0], '', $name); + } + } + $o = ''; $channel_id = comanche_get_channel_id(); @@ -143,12 +155,12 @@ function comanche_block($name) { dbesc($name) ); if($r) { - $o = '
'; + $o .= (($var['wrap'] == 'none') ? '' : '
'); if($r[0]['title']) $o .= '

' . $r[0]['title'] . '

'; $o .= prepare_text($r[0]['body'], $r[0]['mimetype']); - $o .= '
'; + $o .= (($var['wrap'] == 'none') ? '' : '
'); } } -- cgit v1.2.3