/** * Process the build uri query data based on custom defined rules * * @param JUri &$uri The URI * * @return void * * @since 3.2 */ protected 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) { $app = JApplication::getInstance('site'); $menu = $app->getMenu(); // Get the active menu item $itemid = $uri->getVar('Itemid'); $item = $menu->getItem($itemid); if ($item) { $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) { if ($limitstart = $uri->getVar('limitstart')) { $uri->setVar('start', (int) $limitstart); $uri->delVar('limitstart'); } } $uri->setPath($route); }
/** * Process the build uri query data based on custom defined rules * * @param JUri &$uri The URI * @param string $stage The stage that should be processed. * Possible values: 'preprocess', 'postprocess' * and '' for the main build stage * * @return void * * @since 3.2 * @deprecated 4.0 The special logic should be implemented as rule */ protected function processBuildRules(&$uri, $stage = self::PROCESS_DURING) { if ($stage == self::PROCESS_DURING) { // Make sure any menu vars are used if no others are specified $query = $uri->getQuery(true); if ($this->_mode != 1 && isset($query['Itemid']) && (count($query) == 2 || count($query) == 3 && isset($query['lang']))) { // Get the active menu item $itemid = $uri->getVar('Itemid'); $lang = $uri->getVar('lang'); $item = $this->menu->getItem($itemid); if ($item) { $uri->setQuery($item->query); } $uri->setVar('Itemid', $itemid); if ($lang) { $uri->setVar('lang', $lang); } } } // Process the attached build rules parent::processBuildRules($uri, $stage); if ($stage == self::PROCESS_BEFORE) { // Get the query data $query = $uri->getQuery(true); if (!isset($query['option'])) { return; } // Build the component route $component = preg_replace('/[^A-Z0-9_\\.-]/i', '', $query['option']); $router = $this->getComponentRouter($component); $query = $router->preprocess($query); $uri->setQuery($query); } if ($stage == self::PROCESS_DURING) { // Get the path data $route = $uri->getPath(); if ($this->_mode == JROUTER_MODE_SEF && $route) { if ($limitstart = $uri->getVar('limitstart')) { $uri->setVar('start', (int) $limitstart); $uri->delVar('limitstart'); } } $uri->setPath($route); } }