/** * Create a uri based on a full or partial url string * * @param string $url The URI * * @return JUri * * @since 3.2 */ protected function createURI($url) { // Create the URI $uri = parent::createURI($url); // Set URI defaults $app = JApplication::getInstance('site'); $menu = $app->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')) { if ($item = $menu->getItem($itemid)) { $uri->setVar('option', $item->component); } } } return $uri; }
/** * Create a uri based on a full or partial url string * * @param string $url The URI * * @return JUri * * @since 3.2 */ protected function createURI($url) { // Create the URI $uri = parent::createURI($url); // Get the itemid form the URI $itemid = $uri->getVar('Itemid'); if (is_null($itemid)) { if ($option = $uri->getVar('option')) { $item = $this->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')) { if ($item = $this->menu->getItem($itemid)) { $uri->setVar('option', $item->component); } } } return $uri; }