public function build(&$query) { $segments = array(); $app = JFactory::getApplication(); $db = JFactory::getDBO(); $menu = $app->getMenu(); $active = $menu->getActive(); $default = $menu->getDefault(); $h = FUFRoute::getInstance(); if ($h->isMenuItem($query) || count($h->menuitems) <= 0) { return $segments; } $unsets = array(); // find a view and a layout list($view, $layout) = $h->getViewLayout($query); if (array_key_exists($view, $h->menuitems)) { if (array_key_exists($layout, $h->menuitems[$view])) { $query['Itemid'] = $h->menuitems[$view][$layout]->id; $unsets['view'] = $unsets['layout'] = true; } else { $query['Itemid'] = reset($h->menuitems[$view])->id; $unsets['view'] = true; } } $query['Itemid'] = $query['Itemid'] > 0 ? $query['Itemid'] : $active->id; //~ switch ($view) { //~ case 'projects': //~ if ($layout=='project'&&$h->akegz('p_id',$query)) { //~ $segments[] = $query['p_id']; //~ $unsets['layout'] = $unsets['p_id'] = true; //~ } //~ break; //~ case 'jobs': //~ if ($layout=='job'&&$h->akegz('j_id',$query)) { //~ $segments[] = $query['j_id']; //~ $unsets['layout'] = $unsets['j_id'] = true; //~ } //~ break; //~ } $h->unsets($query, $unsets); return $segments; }
function FileUploadFormParseRoute($segments) { $vars = FUFRoute::parse($segments); return $vars; }