$uid, 'current' => $current, 'entries' => $r); call_hooks('pdl_selector',$arr); $entries = $arr['entries']; $current = $arr['current']; $o .= "'; return $o; } function comanche_parser(&$a,$s) { $cnt = preg_match("/\[layout\](.*?)\[\/layout\]/ism", $s, $matches); if($cnt) $a->page['template'] = trim($matches[1]); $cnt = preg_match("/\[theme\](.*?)\[\/theme\]/ism", $s, $matches); if($cnt) $a->layout['theme'] = trim($matches[1]); $cnt = preg_match_all("/\[region=(.*?)\](.*?)\[\/region\]/ism", $s, $matches, 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_replace_region($match) { $a = get_app(); if(array_key_exists($match[1],$a->page)) { return $a->page[$match[1]]; } } function comanche_block($name) { $o = ''; $r = q("select * from item left join item_id on iid = item_id and item_id.uid = item.uid and service = 'BUILDBLOCK' and sid = '%s' limit 1", dbesc($name) ); if($r) { $o = '
'; } return $o; } // Widgets will have to get any operational arguments from the session, // the global app environment, or config storage until we implement argument passing function comanche_widget($name,$args = null) { $a = get_app(); $func = 'widget_' . trim($name); if(function_exists($func)) return $func($args); } function comanche_region(&$a,$s) { $cnt = preg_match_all("/\[menu\](.*?)\[\/menu\]/ism", $s, $matches, PREG_SET_ORDER); if($cnt) { foreach($matches as $mtch) { $s = str_replace($mtch[0],comanche_menu(trim($mtch[1])),$s); } } $cnt = preg_match_all("/\[block\](.*?)\[\/block\]/ism", $s, $matches, PREG_SET_ORDER); if($cnt) { foreach($matches as $mtch) { $s = str_replace($mtch[0],comanche_block(trim($mtch[1])),$s); } } // need to modify this to accept parameters $cnt = preg_match_all("/\[widget\](.*?)\[\/widget\]/ism", $s, $matches, PREG_SET_ORDER); if($cnt) { foreach($matches as $mtch) { $s = str_replace($mtch[0],comanche_widget(trim($mtch[1])),$s); } } return $s; } function widget_profile($args) { $a = get_app(); $block = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false); return profile_sidebar($a->profile, $block, true); }