aboutsummaryrefslogtreecommitdiffstats
path: root/include/menu.php
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-05-27 21:09:21 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-05-27 21:09:21 -0700
commit12c17f12655d92ef6ec5065fa04e13bc19b68faa (patch)
tree6a91ef782ee0a9e0a8edc55ff8eee1ffee7ff035 /include/menu.php
parent2dd02cc166fbd3704d7a17437a4248388096c458 (diff)
downloadvolse-hubzilla-12c17f12655d92ef6ec5065fa04e13bc19b68faa.tar.gz
volse-hubzilla-12c17f12655d92ef6ec5065fa04e13bc19b68faa.tar.bz2
volse-hubzilla-12c17f12655d92ef6ec5065fa04e13bc19b68faa.zip
menu encoding for sharing/exchange
Diffstat (limited to 'include/menu.php')
-rw-r--r--include/menu.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/include/menu.php b/include/menu.php
index 5c0811437..40ea2b0f4 100644
--- a/include/menu.php
+++ b/include/menu.php
@@ -24,6 +24,45 @@ function menu_fetch($name,$uid,$observer_xchan) {
return null;
}
+function menu_element($menu) {
+
+ $arr = array();
+ $arr['type'] = 'menu';
+ $arr['name'] = $menu['menu_name'];
+ $arr['desc'] = $menu['menu_desc'];
+ $arr['baseurl'] = z_root();
+ if($menu['menu_flags']) {
+ $arr['flags'] = array();
+ if($menu['menu_flags'] & MENU_BOOKMARK)
+ $arr['flags'][] = 'bookmark';
+ if($menu['menu_flags'] & MENU_SYSTEM)
+ $arr['flags'][] = 'system';
+ }
+ if($menu['items']) {
+ $arr['items'] = array();
+ foreach($menu['items'] as $it) {
+ $entry = array();
+ $entry['link'] = str_replace(z_root(),'[baseurl]',$it['mitem_link']);
+ $entry['desc'] = $it['mitem_desc'];
+ $entry['order'] = $it['mitem_order'];
+ if($it['mitem_flags']) {
+ $entry['flags'] = array();
+ if($it['mitem_flags'] & MENU_ITEM_ZID)
+ $entry['flags'][] = 'zid';
+ if($it['mitem_flags'] & MENU_ITEM_NEWWIN)
+ $entry['flags'][] = 'new-window';
+ if($it['mitem_flags'] & MENU_ITEM_CHATROOM)
+ $entry['flags'][] = 'chatroom';
+ }
+ $arr['items'][] = $entry;
+ }
+ }
+
+ return $arr;
+}
+
+
+
function menu_render($menu, $class='', $edit = false, $var = '') {
if(! $menu)