function GetMenus() { global $page, $GP_MENU_LINKS, $GP_MENU_CLASS; foreach ($_REQUEST['menus'] as $id => $menu) { $info = gpOutput::GetgpOutInfo($menu); if (!isset($info['method'])) { continue; } $array = array(); $array[0] = 'replacemenu'; $array[1] = '#' . $id; if (!empty($_REQUEST['menuh'][$id])) { $GP_MENU_LINKS = rawurldecode($_REQUEST['menuh'][$id]); } if (!empty($_REQUEST['menuc'][$id])) { $GP_MENU_CLASS = rawurldecode($_REQUEST['menuc'][$id]); } ob_start(); call_user_func($info['method'], $info['arg'], $info); $array[2] = ob_get_clean(); $page->ajaxReplace[] = $array; } }
/** * Insert new content into a layout * */ function AddContent() { global $langmessage, $page; //for ajax responses $page->ajaxReplace = array(); if (!isset($_REQUEST['where'])) { message($langmessage['OOPS']); return false; } //prep destination if (!$this->GetValues($_REQUEST['where'], $to_container, $to_gpOutCmd)) { message($langmessage['OOPS'] . ' (Insert location not found)'); return false; } $handlers = $this->GetAllHandlers(); $this->PrepContainerHandlers($handlers, $to_container, $to_gpOutCmd); //figure out what we're inserting $addtype =& $_REQUEST['addtype']; switch ($_REQUEST['addtype']) { case 'new_extra': $extra_name = $this->NewExtraArea(); if ($extra_name === false) { message($langmessage['OOPS'] . '(2)'); return false; } $insert = 'Extra:' . $extra_name; break; case 'custom_menu': $insert = $this->NewCustomMenu(); break; case 'preset_menu': $insert = $this->NewPresetMenu(); break; default: $insert = $_REQUEST['insert']; break; } if (!$insert) { message($langmessage['OOPS'] . ' (Nothing to insert)'); return false; } //new info $new_gpOutInfo = gpOutput::GetgpOutInfo($insert); if (!$new_gpOutInfo) { message($langmessage['OOPS'] . ' (Nothing to insert)'); return false; } $new_gpOutCmd = rtrim($new_gpOutInfo['key'] . ':' . $new_gpOutInfo['arg'], ':'); if (!$this->AddToContainer($handlers[$to_container], $to_gpOutCmd, $new_gpOutCmd, false)) { return false; } $this->SaveHandlersNew($handlers); return true; }
/** * Return information about the gadgets being used in the current layout * @return array */ static function WhichGadgets($layout) { global $config, $gpLayouts; $gadget_info = $temp_info = array(); if (!isset($config['gadgets'])) { return $gadget_info; } $layout_info =& $gpLayouts[$layout]; $GetAllGadgets = true; if (isset($layout_info['all_gadgets']) && !$layout_info['all_gadgets']) { $GetAllGadgets = false; } if (isset($layout_info['handlers'])) { foreach ($layout_info['handlers'] as $handler => $out_cmds) { //don't prep even if GetAllGadgets is set in the layout's config if ($handler == 'GetAllGadgets' && !$GetAllGadgets) { continue; } foreach ($out_cmds as $gpOutCmd) { $temp_info[$gpOutCmd] = gpOutput::GetgpOutInfo($gpOutCmd); } } } //add all gadgets if $GetAllGadgets is true and the GetAllGadgets handler isn't overwritten if ($GetAllGadgets && !isset($layout_info['handlers']['GetAllGadgets'])) { foreach ($config['gadgets'] as $gadget => $temp) { if (isset($temp['addon'])) { $temp_info[$gadget] = gpOutput::GetgpOutInfo($gadget); } } } foreach ($temp_info as $gpOutCmd => $info) { if (isset($info['is_gadget']) && $info['is_gadget'] && !isset($info['disabled'])) { $gadget_info[$gpOutCmd] = $info; } } return $gadget_info; }