_once $path; $function = substr($component, 4).'BuildRoute'; $parts = $function($query); // encode the route segments if ($component != "com_search") { // Cheep fix on searches $parts = $this->_encodeSegments($parts); } else { // fix up search for URL $total = count($parts); for($i=0; $i<$total; $i++) { // urlencode twice because it is decoded once after redirect $parts[$i] = urlencode(urlencode(stripcslashes($parts[$i]))); } } $result = implode('/', $parts); $tmp = ($result != "") ? '/'.$result : ''; } /* * Build the application route */ $built = false; if (isset($query['Itemid']) && !empty($query['Itemid'])) { $item = $menu->getItem($query['Itemid']); if (is_object($item) && $query['option'] == $item->component) { $tmp = !empty($tmp) ? $item->route.'/'.$tmp : $item->route; $built = true; } } if(!$built) { $tmp = 'component/'.substr($query['option'], 4).'/'.$tmp; } $route .= '/'.$tmp; // Unset unneeded query information unset($query['Itemid']); unset($query['option']); //Set query again in the URI $uri->setQuery($query); $uri->setPath($route); } function _processParseRules(&$uri) { // Process the attached parse rules $vars = parent::_processParseRules($uri); // Process the pagination support if($this->_mode == JROUTER_MODE_SEF) { $app =& JFactory::getApplication(); if($start = $uri->getVar('start')) { $uri->delVar('start'); $vars['limitstart'] = $start; } } return $vars; } function _processBuildRules(&$uri) { // Make sure any menu vars are used if no others are specified if(($this->_mode != JROUTER_MODE_SEF) && $uri->getVar('Itemid') && count($uri->getQuery(true)) == 2) { $menu =& JSite::getMenu(); // Get the active menu item $itemid = $uri->getVar('Itemid'); $item = $menu->getItem($itemid); $uri->setQuery($item->query); $uri->setVar('Itemid', $itemid); } // Process the attached build rules parent::_processBuildRules($uri); // Get the path data $route = $uri->getPath(); if($this->_mode == JROUTER_MODE_SEF && $route) { $app =& JFactory::getApplication(); if ($limitstart = $uri->getVar('limitstart')) { $uri->setVar('start', (int) $limitstart); $uri->delVar('limitstart'); } } $uri->setPath($route); } function &_createURI($url) { //Create the URI $uri =& parent::_createURI($url); // Set URI defaults $menu =& JSite::getMenu(); // Get the itemid form the URI $itemid = $uri->getVar('Itemid'); if(is_null($itemid)) { if($option = $uri->getVar('option')) { $item = $menu->getItem($this->getVar('Itemid')); if(isset($item) && $item->component == $option) { $uri->setVar('Itemid', $item->id); } } else { if($option = $this->getVar('option')) { $uri->setVar('option', $option); } if($itemid = $this->getVar('Itemid')) { $uri->setVar('Itemid', $itemid); } } } else { if(!$uri->getVar('option')) { $item = $menu->getItem($itemid); $uri->setVar('option', $item->component); } } return $uri; } }