diff options
author | friendica <info@friendica.com> | 2013-08-28 20:03:01 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-08-28 20:03:01 -0700 |
commit | 03e1a0cc152ec8ea8fccefa746686d05758c7f5b (patch) | |
tree | b946505a740d18a829949a8cdf2ee3a453462df3 /include | |
parent | 1dbfb311b711e0e345909945a9ec7ede249d798e (diff) | |
download | volse-hubzilla-03e1a0cc152ec8ea8fccefa746686d05758c7f5b.tar.gz volse-hubzilla-03e1a0cc152ec8ea8fccefa746686d05758c7f5b.tar.bz2 volse-hubzilla-03e1a0cc152ec8ea8fccefa746686d05758c7f5b.zip |
really truly bare-bones comanche
Diffstat (limited to 'include')
-rw-r--r-- | include/comanche.php | 58 | ||||
-rw-r--r-- | include/menu.php | 1 |
2 files changed, 59 insertions, 0 deletions
diff --git a/include/comanche.php b/include/comanche.php index 33e93d2c9..21182175e 100644 --- a/include/comanche.php +++ b/include/comanche.php @@ -46,3 +46,61 @@ function pdl_selector($uid,$current="") { return $o; } + + +function comanche_parser(&$a,$s) { + + + $cnt = preg_match("/\[layout\](.*?)\[\/layout\]/ism", $matches, $s); + if($cnt) + $a->page['template'] = trim($matches[1]); + + $cnt = preg_match("/\[theme\](.*?)\[\/theme\]/ism", $matches, $s); + if($cnt) + $a->layout['theme'] = trim($matches[1]); + + $cnt = preg_match_all("/\[region=(.*?)\](.*?)\[\/region\]/ism", $matches, $s, PREG_SET_ORDER); + if($cnt) { + foreach($matches as $mtch) { + $a->layout['region_' . $mtch[1]] = comanche_region($a,$mtch[2]); + } + } + +} + + +function comanche_menu($name) { + $a = get_app(); + $m = menu_fetch($name,$a->profile['profile_uid'],get_observer_hash()); + return render_menu($m); +} + +function comanche_widget($name) { + $a = get_app(); + // placeholder for now + $m = menu_fetch($name,$a->profile['profile_uid'],get_observer_hash()); + return render_menu($m); +} + + +function comanche_region(&$a,$s) { + + + $cnt = preg_match_all("/\[menu\](.*?)\[\/menu\]/ism", $matches, $s, PREG_SET_ORDER); + if($cnt) { + foreach($matches as $mtch) { + $s = str_replace($mtch[0],comanche_menu(trim($mtch[1])),$s); + } + } + + // need to modify this to accept parameters + + $cnt = preg_match_all("/\[widget\](.*?)\[\/widget\]/ism", $matches, $s, PREG_SET_ORDER); + if($cnt) { + foreach($matches as $mtch) { + $s = str_replace($mtch[0],comanche_widget(trim($mtch[1])),$s); + } + } + + return $s; +}
\ No newline at end of file diff --git a/include/menu.php b/include/menu.php index 8d4664385..6d614055a 100644 --- a/include/menu.php +++ b/include/menu.php @@ -40,6 +40,7 @@ function menu_render($menu) { } + function menu_fetch_id($menu_id,$channel_id) { $r = q("select * from menu where menu_id = %d and menu_channel_id = %d limit 1", |