function create(&$uri) { $vars = $uri->getQuery(true); extract($vars); $this->_createNonSefVars($uri); $this->_prepareTexts(); $title = array(); $title[] = JoomSEF::_getMenuTitleLang(@$option, $lang, @$Itemid); if (!empty($view)) { if ($this->params->get('always_en', '0') == '1') { $title[] = self::$textsEn[strtoupper('COM_SEF_USERS_' . $view)]; } else { $title[] = JText::_('COM_SEF_USERS_' . $view); } } if (!empty($layout)) { if ($this->params->get('always_en', '0') == '1') { $title[] = self::$textsEn[strtoupper('COM_SEF_USERS_' . $layout)]; } else { $title[] = JText::_('COM_SEF_USERS_' . $layout); } } if (!empty($task)) { $tasks = explode('.', $task); if ($tasks[0] == 'profile') { if (isset($user_id)) { $title[] = $this->GetUserName($user_id); } } else { if ($this->params->get('always_en', '0') == '1') { $title[] = self::$textsEn[strtoupper('COM_SEF_USERS_' . $tasks[0])]; } else { $title[] = JText::_('COM_SEF_USERS_' . $tasks[0]); } } if (isset($tasks[1])) { if ($tasks[1] == 'remind') { $tasks[1] = 'submit'; } if ($this->params->get('always_en', '0') == '1') { $title[] = self::$textsEn[strtoupper('COM_SEF_USERS_' . $tasks[1])]; } else { $title[] = JText::_('COM_SEF_USERS_' . $tasks[1]); } if (in_array($tasks[1], array('confirm', 'complete'))) { if ($this->params->get('always_en', '0') == '1') { $title[] = self::$textsEn['COM_SEF_USERS_SUBMIT']; } else { $title[] = JText::_('COM_SEF_USERS_SUBMIT'); } } } } $newUri = $uri; if (count($title) > 0) { $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang, $this->nonSefVars); } return $newUri; }
function create(&$uri) { $vars = $uri->getQuery(true); extract($vars); $title = array(); $title[] = JoomSEF::_getMenuTitleLang(@$option, $this->lang, @$Itemid); $newUri = $uri; if (count($title) > 0) { $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang); } return $newUri; }
function create(&$uri) { $sefConfig =& SEFConfig::getConfig(); $database =& JFactory::getDBO(); $vars = $uri->getQuery(true); extract($vars); $title = array(); $title[] = JoomSEF::_getMenuTitleLang($option, $this->lang); switch (@$view) { case 'categories': break; case 'category': $catInfo = $this->getCategoryInfo($id); if ($catInfo === false) { JoomSefLogger::Log("Category with ID {$id} could not be found.", $this, 'com_newsfeeds'); } if (is_array($catInfo->path)) { $title = array_merge($title, $catInfo->path); } break; case 'newsfeed': $title = array_merge($title, $this->getFeedTitle($id)); break; } if (isset($format)) { if ($format == 'feed' && isset($type)) { $title[] = $type; } else { $title[] = $format; } } $newUri = $uri; if (count($title) > 0) { // Generate meta tags $this->metatags = $this->getMetaTags(); $priority = $this->getPriority($uri); $sitemap = $this->getSitemapParams($uri); if (isset($this->lang)) { $lang = $this->lang; } $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang, null, null, $this->metatags, $priority, false, null, $sitemap); } return $newUri; }
function create(&$uri) { $sefConfig =& SEFConfig::getConfig(); $params = SEFTools::GetExtParams('com_content'); $vars = $uri->getQuery(true); extract($vars); // Set title. $title = array(); $title[] = JoomSEF::_getMenuTitleLang(@$option, @$task, @$Itemid); if (!empty($tmpl)) { $title[] = $tmpl; } $newUri = $uri; if (count($title) > 0) { $this->_createNonSefVars($uri); $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang, null, $this->ignoreVars); } return $newUri; }
function create(&$uri) { $vars = $uri->getQuery(true); extract($vars); // Don't SEF opensearch links if (isset($format) && $format == 'opensearch') { return $uri; } $this->params =& SEFTools::getExtParams('com_search'); $newUri = $uri; if (!(isset($task) ? @$task : null)) { $title[] = JoomSEF::_getMenuTitleLang($option, $lang, @$Itemid); if (isset($searchword) && $this->params->get('nonsefphrase', '1') != '1') { $title[] = $searchword; } if (isset($view) && ($view != 'search' || $this->params->get('add_search', '0') == '1')) { $title[] = $view; } if (isset($format)) { $title[] = $format; } $this->_createNonSefVars($uri); if (!isset($searchword) || $this->params->get('nonsefphrase', '1') != '1') { // Generate meta tags $desc = array(); if (isset($searchword)) { $desc[] = $searchword; } if (isset($searchphrase)) { $desc[] = $searchphrase; } $this->metadesc = implode(', ', $desc); unset($desc); } $metatags = $this->getMetaTags(); $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang, $this->nonSefVars, null, $metatags, null, true); } return $newUri; }
function create(&$uri) { $sefConfig =& SEFConfig::getConfig(); $this->params =& SEFTools::getExtParams('com_banners'); $vars = $uri->getQuery(true); extract($vars); $title[] = JoomSEF::_getMenuTitleLang(@$option, @$task, @$Itemid); switch (@$task) { case 'click': $title[] = $this->GetBannerName($id); unset($task); break; } $newUri = $uri; if (isset($this->lang)) { $lang = $this->lang; } if (count($title) > 0) { $newUri = JoomSEF::_sefGetLocation($uri, $title, @$task, null, null, @$lang); } return $newUri; }
function build(&$uri, $check = false) { static $extsCache; if (!isset($extsCache)) { $extsCache = array(); } $mainframe = JFactory::getApplication(); $jRouter = $mainframe->getRouter(); $jRouter->SetMode(JROUTER_MODE_SEF); $config = JFactory::getConfig(); $sefConfig = SEFConfig::getConfig(); $cache = SEFCache::getInstance(); // Restore global "Add suffix to URLs" $sefSuffix = JoomSEF::get('sef.global.orig_sef_suffix'); $config->set('sef_suffix', $sefSuffix); // trigger onSefStart patches $mainframe->triggerEvent('onSefStart'); // Do not SEF URLs with specific format or template according to configuration if (in_array($uri->getVar('format'), array('raw', 'json', 'xml')) || $uri->getVar('tmpl') == 'raw' || !$sefConfig->sefComponentUrls && $uri->getVar('tmpl') == 'component') { $uri = JoomSEF::_createUri($uri); $mainframe->triggerEvent('onSefEnd'); $jRouter->SetMode(JROUTER_MODE_RAW); return; } // check URL for junk if set to $vars = $uri->getQuery(true); if ($sefConfig->checkJunkUrls) { $junkWords =& $sefConfig->getJunkWords(); $seferr = false; if (substr($uri->getVar('option', ''), 0, 4) != 'com_') { $seferr = true; } elseif (count($junkWords)) { $exclude =& $sefConfig->getJunkExclude(); foreach ($vars as $key => $val) { if (in_array($key, $exclude)) { continue; } // Check junk words foreach ($junkWords as $word) { if (is_string($val)) { if (strpos($val, $word) !== false) { $seferr = true; break; } } } if ($seferr) { break; } } } if ($seferr) { // trigger onSefEnd patches $mainframe->triggerEvent('onSefEnd'); $jRouter->SetMode(JROUTER_MODE_RAW); // fix the path $path = $uri->getPath(); return; } } // Handle lang variable if ($sefConfig->langEnable && $check == false) { $langs = JLanguageHelper::getLanguages('sef'); $langsCode = JLanguageHelper::getLanguages('lang_code'); $langVar = $uri->getVar('lang'); if (empty($langVar)) { $langVar = JRequest::getVar('lang'); $uri->setVar('lang', $langVar); } // Check for non-existent language if (!isset($langs[$langVar])) { // Not a SEF code, check for long code if (isset($langsCode[$langVar])) { // Fix the code to short version $uri->setVar('lang', $langsCode[$langVar]->sef); } else { // Non-existent language, use current $curLang = JFactory::getLanguage(); $uri->setVar('lang', $langsCode[$curLang->getTag()]->sef); } } // Check for mismatched language and Itemid? if ($sefConfig->mismatchedLangHandling != _COM_SEF_MISMATCHED_LANG_DONT_HANDLE) { $langVar = $uri->getVar('lang'); $itemidVar = $uri->getVar('Itemid'); if (!empty($langVar) && !empty($itemidVar)) { // Get menu item language $menu = $mainframe->getMenu('site'); $item = $menu->getItem($itemidVar); if (is_object($item) && !empty($item->language) && $item->language != '*') { if ($langsCode[$item->language]->sef != $langVar) { if ($sefConfig->mismatchedLangHandling == _COM_SEF_MISMATCHED_LANG_DONT_SEF) { // Don't SEF $mainframe->triggerEvent('onSefEnd'); $jRouter->SetMode(JROUTER_MODE_RAW); return; } else { // Fix lang variable $uri->setVar('lang', $langsCode[$item->language]->sef); } } } } } } // Correct FaLang support for translations $prevLang = ''; if ($sefConfig->langEnable && $check == false) { $langVar = $uri->getVar('lang'); if (!empty($langVar)) { $langCode = JoomSEF::getLangCode($langVar); if (!is_null($langCode)) { $curCode = JoomSEF::getLangCode(); if ($langCode != $curCode) { // URL language is different from current language, // change current language for correct translations $language = JFactory::getLanguage(); $prevLang = $language->setLanguage($langCode); // 6.12.2012 dajo: Make sure that loaded language overwrites current strings! $language->load('joomla', JPATH_BASE, null, true); } } } } // if there are no variables and only single language is used $vars = $uri->getQuery(true); if (empty($vars) && !isset($lang)) { JoomSEF::_endSef($prevLang); return; } $option = $uri->getVar('option'); if (!is_null($option)) { $params =& SEFTools::getExtParams($option); // Check the stop rule $stopRule = trim($params->get('stopRule', '')); if ($stopRule != '') { if (preg_match('/' . $stopRule . '/', $uri->toString()) > 0) { // Don't SEF this URL $uri = JoomSEF::_createUri($uri); JoomSEF::_endSef($prevLang); $jRouter->SetMode(JROUTER_MODE_RAW); return; } } if (strlen($uri->getVar('Itemid')) == 0) { $uri->delVar('Itemid'); } $handling = $params->get('handling', '0'); switch ($handling) { // skipped extensions case '2': // Check homepage if (JoomSEF::_isHomePage($uri)) { $lang = $uri->getVar('lang'); if (empty($lang)) { JoomSefUri::updateUri($uri, 'index.php'); } else { JoomSefUri::updateUri($uri, 'index.php?lang=' . $lang); } } // Build URL $uri = JoomSEF::_createUri($uri); JoomSEF::_endSef($prevLang); $jRouter->SetMode(JROUTER_MODE_RAW); return; // non-cached extensions // non-cached extensions case '1': // Check homepage if (JoomSEF::_isHomePage($uri)) { $lang = $uri->getVar('lang'); if (empty($lang)) { JoomSefUri::updateUri($uri, 'index.php'); } else { JoomSefUri::updateUri($uri, 'index.php?lang=' . $lang); } } JoomSEF::_endSef($prevLang); return; // default handler or basic rewriting // default handler or basic rewriting default: // if component has its own sef_ext plug-in included. // however, prefer own plugin if exists (added by Michal, 28.11.2006) $compExt = JPATH_ROOT . '/components/' . $option . '/router.php'; $ownExt = JPATH_ROOT . '/components/com_sef/sef_ext/' . $option . '.php'; // compatible extension build block if (file_exists($compExt) && !file_exists($ownExt) && $handling == '0') { // Check homepage if (JoomSEF::_isHomePage($uri)) { $lang = $uri->getVar('lang'); if (empty($lang)) { JoomSefUri::updateUri($uri, 'index.php'); } else { JoomSefUri::updateUri($uri, 'index.php?lang=' . $lang); } // Create homepage SEF URL $title = array(); $data = JoomSEF::_sefGetLocation($uri, $title, null, null, null, $uri->getVar('lang')); $uri = JoomSEF::_storeLocation($data); // remove path as Joomla will add it back $uri->setPath(preg_replace("@^" . $uri->base(true) . "@", "", $uri->getPath())); // Disable global "Add suffix to URLs" again $config->set('sef_suffix', 0); JoomSEF::_endSef($prevLang); return; } // load the plug-in file self::_isolatedRequireOnce($compExt); $app = JFactory::getApplication(); $menu = $app->getMenu('site'); $route = $uri->getPath(); $query = $uri->getQuery(true); $component = preg_replace('/[^A-Z0-9_\\.-]/i', '', $query['option']); $tmp = ''; // Replace limitstart -> start, which is default Joomla's behaviour if (isset($query['limitstart'])) { $query['start'] = (int) $query['limitstart']; unset($query['limitstart']); } // Get component router object if supported $componentRouter = self::getComponentRouter($component); if ($componentRouter) { // Use the new Joomla 3 interface $parts = $componentRouter->build($query); } else { // Use old procedural approach $function = substr($component, 4) . 'BuildRoute'; $parts = $function($query); } if (!is_array($parts)) { if (is_string($parts)) { $parts = array($parts); } else { // Don't SEF JoomSEF::_endSef($prevLang); // Disable global "Add suffix to URLs" again $config->set('sef_suffix', 0); return; } } $total = count($parts); for ($i = 0; $i < $total; $i++) { $parts[$i] = str_replace(':', '-', $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; if ($app->getCfg('sef_suffix') && !(substr($route, -9) == 'index.php' || substr($route, -1) == '/')) { if ($format = $uri->getVar('format', 'html')) { $route .= '.' . $format; $uri->delVar('format'); } } if ($app->getCfg('sef_rewrite')) { // transform the route $route = str_replace('index.php/', '', $route); } // Unset unneeded query information unset($query['Itemid']); unset($query['option']); //Set query again in the URI $uri->setQuery($query); $uri->setPath($route); $uri = JoomSEF::_createUri($uri); JoomSEF::_endSef($prevLang); // Disable global "Add suffix to URLs" again $config->set('sef_suffix', 0); return; } else { // Disable global "Add suffix to URLs" $config->set('sef_suffix', 0); if ($handling == '3') { // Basic rewriting $class = 'SefExt_Basic'; } else { if (file_exists($ownExt)) { $class = 'SefExt_' . $option; } else { $class = 'SefExt'; } } // Extensions cache if (!class_exists($class)) { require $ownExt; } $sef_ext = new $class(); $extsCache[$class] = $sef_ext; // Set currently handled URI $sef_ext->setCurrentUri($uri); // 17.2.2012, dajo: isHomePage should be tested before the beforeCreate() is called // Grr Joomla SEF router adds home Itemid to Items without menu Item assigned $homes = array_keys(SEFTools::getHomeQueries()); if (in_array($uri->getVar('Itemid'), $homes) && !JoomSEF::_isHomePage($uri)) { $uri->setVar('Itemid', JRequest::getInt('Itemid')); } // Let the extension change the url and options $sef_ext->beforeCreate($uri); list($sid, $mosmsg) = self::_prepareUriForCreate($params, $uri); // Get nonsef and ignore vars from extension list($nonSefVars, $ignoreVars) = $sef_ext->getNonSefVars($uri); // Create array of all the non sef vars $nonSefVars = SEFTools::getNonSefVars($uri, $nonSefVars, $ignoreVars); // Create a copy of JURI object $uri2 = clone $uri; // Remove nonsef variables from our JURI copy $nonSefUrl = SEFTools::RemoveVariables($uri2, array_keys($nonSefVars)); // Check homepage if (JoomSEF::_isHomePage($uri2, true)) { $title = array(); $lng = $uri2->getVar('lang'); if ($sefConfig->langEnable && $sefConfig->langPlacementJoomla != _COM_SEF_LANG_DOMAIN && ($sefConfig->alwaysUseLangHomeJoomla || $lng != $sefConfig->mainLanguageJoomla)) { $title[] = $lng; } $pagination = false; if (method_exists($sef_ext, "_processPagination")) { $title = array_merge($title, $sef_ext->_processPagination($uri2)); $pagination = true; } if ($uri2->getVar('format') == 'feed') { $title[] = $uri2->getVar('type'); } $data = JoomSEF::_sefGetLocation($uri2, $title, null, null, null, $uri->getVar('lang'), null, null, null, null, $pagination); unset($data["lang"]); // We need to copy data, otherwise we would return $uri2 object - not working in Joomla 3 JoomSefUri::copyUri(JoomSEF::_storeLocation($data), $uri); // remove path as Joomla will add it back $uri->setPath(preg_replace("@^" . $uri->base(true) . "@", "", $uri->getPath())); // Set non-SEF variables $uri->setQuery($nonSefUrl); // Set domain if ($sefConfig->langEnable && $sefConfig->langPlacementJoomla == _COM_SEF_LANG_DOMAIN) { if (!empty($lng) && isset($sefConfig->subDomainsJoomla[$lng])) { $uri->setHost($sefConfig->subDomainsJoomla[$lng]); } } JoomSEF::_endSef($prevLang); return; } // clean Itemid if desired // David: only if overriding is disabled $override = $params->get('itemid', '0'); if (isset($sefConfig->excludeSource) && $sefConfig->excludeSource && $override == '0') { $Itemid = $uri->getVar('Itemid'); $uri2->delVar('Itemid'); } $url = JoomSEF::_uriToUrl($uri2); // try to get url from cache $sefUrl = false; if ($sefConfig->useCache) { if (!$check) { $sefUrl = $cache->GetSefUrl($url); } } if (!$sefConfig->useCache || !$sefUrl) { // check if the url is already saved in the database $sefUrl = $sef_ext->getSefUrlFromDatabase($uri2); if (is_string($sefUrl)) { // Backward compatibility $sefstring = $sefUrl; $sefUrl = new stdClass(); $sefUrl->sefurl = $sefstring; $sefUrl->sef = 1; $sefUrl->host = ''; } } // unknown URL yet if (!$sefUrl || $check) { // load JoomSEF Language File JFactory::getLanguage()->load('com_sef', JPATH_ADMINISTRATOR); // rewrite the URL, creating new JURI object $data = $sef_ext->create($uri); if (is_object($data) && is_a($data, 'JURI')) { // Backwards compatibility JoomSefUri::copyUri($data, $uri); } else { if ($sefConfig->langPlacementJoomla == _COM_SEF_LANG_PATH) { // if data is not array, then we don't have in lang language from SEF extension, because it's original URL if (is_array($data)) { if ($data['lang'] == '*') { // If we don't want to have language in multilanguage content strip down the language from path to eleminate duplicit pages with same content if ($sefConfig->addLangMulti) { $data["lang"] = $data["uri"]->getVar('lang'); } else { unset($data["lang"]); $data["uri"]->delVar('lang'); } } else { $langs = JLanguageHelper::getLanguages('lang_code'); if (array_key_exists($data["lang"], $langs)) { $data["lang"] = $langs[$data["lang"]]->sef; } if (!strlen($data["lang"])) { $data["lang"] = $data["uri"]->getVar('lang'); } } } if ($sefConfig->alwaysUseLangJoomla == false) { if (isset($data["lang"]) && $data["lang"] == $sefConfig->mainLanguageJoomla) { unset($data["lang"]); $data["uri"]->delVar('lang'); } } } $titlepage = false; $subdomain = SEFTools::getSubdomain($uri->getVar('Itemid'), $uri, $titlepage); if (strlen($subdomain)) { $curHost = JFactory::getURI()->getHost(); if (substr($curHost, 0, 4) == 'www.') { $curHost = substr($curHost, 4); } $uri->setHost($subdomain . '.' . $curHost); } if ($titlepage) { $data["title"] = array(); } if (!isset($data["host"])) { $data["host"] = $uri->getHost(); } if ($check) { $this->_data = $data; } // 12.11.2012 dajo: Itemid must be removed in _storeLocation after the menu title is removed too /*if (isset($sefConfig->excludeSource) && $sefConfig->excludeSource && ($override == '0')) { if (isset($data['uri'])) { $data['uri']->delVar('Itemid'); } }*/ $removeItemid = isset($sefConfig->excludeSource) && $sefConfig->excludeSource && $override == '0'; JoomSefUri::copyUri(JoomSEF::_storeLocation($data, $check, $removeItemid), $uri); } } else { // if SEF is disabled, don't SEF if (isset($sefUrl->sef) && !$sefUrl->sef) { $uri = JoomSEF::_createUri($uri); JoomSEF::_endSef($prevLang); $jRouter->SetMode(JROUTER_MODE_RAW); return; } // Create new JURI object from $sefstring if (!isset($sefUrl->host) || !strlen($sefUrl->host)) { $root = JFactory::getUri()->toString(array('host', 'port')); } else { $root = $sefUrl->host; } $url = JFactory::getURI()->getScheme() . "://" . $root . JURI::root(true); if (substr($url, -1) != '/') { $url .= '/'; } if (isset($sefUrl->sefurl)) { $url .= $sefUrl->sefurl; } // Add nonSef part if set if (!empty($nonSefUrl)) { $url .= '?' . $nonSefUrl; } // Add fragment if set $fragment = $uri->getFragment(); if (!empty($fragment)) { $url .= '#' . $fragment; } JoomSefUri::updateUri($uri, $url); } // Set domain if ($sefConfig->langEnable && $sefConfig->langPlacementJoomla == _COM_SEF_LANG_DOMAIN) { $lng = $uri2->getVar('lang'); if (!empty($lng) && isset($sefConfig->subDomainsJoomla[$lng])) { $uri->setHost($sefConfig->subDomainsJoomla[$lng]); } } // reconnect the sid to the url if (!empty($sid) && COM_SEF_CONFIG_REMOVE_SID) { $uri->setVar('sid', $sid); } // reconnect mosmsg to the url if (!empty($mosmsg)) { $uri->setVar('mosmsg', $mosmsg); } // reconnect ItemID to the url // David: only if extension doesn't set its own Itemid through overrideId parameter if (isset($sefConfig->excludeSource) && $sefConfig->excludeSource && $sefConfig->reappendSource && $override == '0' && !empty($Itemid)) { $uri->setVar('Itemid', $Itemid); } // let the extension change the resulting SEF url $sef_ext->afterCreate($uri); } } } else { if (!is_null($uri->getVar('Itemid'))) { // there is only Itemid present - we must override the Ignore multiple sources option $oldIgnore = $sefConfig->ignoreSource; $sefConfig->ignoreSource = 0; $lang = ""; $title = array(); $title[] = JoomSEF::_getMenuTitleLang(null, $lang, $uri->getVar('Itemid')); $data = JoomSEF::_sefGetLocation($uri, $title, null, null, null, strlen($lang) ? $lang : $uri->getVar('lang')); $uri = JoomSEF::_storeLocation($data); $sefConfig->ignoreSource = $oldIgnore; } } $uri->setPath(preg_replace("@^" . $uri->base(true) . "@", "", $uri->getPath())); JoomSEF::_endSef($prevLang); // Set Joomla's router so it doesn't process URL further $jRouter->SetMode(JROUTER_MODE_RAW); }
function create(&$uri) { $sefConfig =& SEFConfig::getConfig(); $vars = $uri->getQuery(true); extract($vars); $title[] = JoomSEF::_getMenuTitleLang($option, $this->lang, @$Itemid); switch (@$view) { case 'categories': break; case 'category': $catInfo = $this->getCategoryInfo($id); if ($catInfo === false) { JoomSefLogger::Log("Category with ID {$id} could not be found.", $this, 'com_weblinks'); } if (is_array($catInfo->path)) { $title = array_merge($title, $catInfo->path); } break; case 'form': if (isset($w_id)) { $title = array_merge($title, $this->getWeblinkTitle(@$w_id)); } break; case 'weblink': if (!empty($id)) { $title = array_merge($title, $this->getWeblinkTitle($id)); } else { if ($this->params->get('always_en', '0') == '1') { $title[] = 'Submit'; } else { $title[] = JText::_('COM_SEF_SUBMIT'); } } break; } switch (@$task) { case 'weblink.go': if (!empty($id)) { $title = array_merge($title, $this->getWeblinkTitle($id)); } else { if ($this->params->get('always_en', '0') == '1') { $title[] = 'Submit'; } else { $title[] = JText::_('COM_SEF_SUBMIT'); } } break; case 'new': $title[] = 'new' . $sefConfig->suffix; break; case 'weblink.edit': $title = array_merge($title, $this->getWeblinkTitle(@$w_id)); if ($this->params->get('always_en', '0') == '1') { $title[] = 'Edit'; } else { $title[] = JText::_('COM_SEF_EDIT'); } if (@$return) { $nonSefVars['return'] = $return; } break; } if (@$format) { if ($format == 'feed' && @$type) { $title[] = ucfirst($type); } else { $title[] = ucfirst($format); } } $newUri = $uri; if (count($title)) { // Generate meta tags $this->metatags = $this->getMetaTags(); $priority = $this->getPriority($uri); $sitemap = $this->getSitemapParams($uri); if (isset($this->lang)) { $lang = $this->lang; } $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang, @$nonSefVars, null, $this->metatags, $priority, false, null, $sitemap); } return $newUri; }
public function create(&$uri) { $this->metadesc = null; $this->cat_desc = null; $this->item_desc = null; $sefConfig =& SEFConfig::getConfig(); $title = array(); $vars = $uri->getQuery(true); extract($vars); $this->_createNonSefVars($uri); // Set title. $title[] = JoomSEF::_getMenuTitleLang(@$option, $this->lang, @$Itemid); switch (@$view) { case 'form': // 13.2.2012, dajo: Don't SEF return $uri; //$this->nonSefVars = array(); //$this->nonSefVars["return"]=@$return; //if(isset($a_id)) { // $title=array_merge($title,$this->_getArticle($a_id)); //} //$title[] = JText::_('COM_SEF_FORM'); //break; //$this->nonSefVars = array(); //$this->nonSefVars["return"]=@$return; //if(isset($a_id)) { // $title=array_merge($title,$this->_getArticle($a_id)); //} //$title[] = JText::_('COM_SEF_FORM'); //break; case 'featured': if (isset($format) && $format == "feed") { @($title[] = $type); } $title = array_merge($title, $this->_processPagination($uri)); break; case 'categories': break; case 'category': if (isset($id)) { $catInfo = $this->getCategoryInfo($id); if ($catInfo === false) { JoomSefLogger::Log("Category with ID {$id} could not be found.", $this, 'com_content'); return $uri; } if (is_array($catInfo->path) && count($catInfo->path) > 0) { $title = array_merge($title, $catInfo->path); } } if ($this->params->get('add_layout') == 2 || $this->params->get('add_layout') == 1 && $this->params->get('def_layout') != @$layout) { @($title[] = $layout); } if (isset($format) && $format == "feed") { @($title[] = $type); } $title = array_merge($title, $this->_processPagination($uri)); break; case 'article': $articleInfo = $this->_getArticle($id); if (!$articleInfo) { return $uri; } $title = array_merge($title, $articleInfo); $title = array_merge($title, $this->_processPagination($uri)); break; case 'archive': if (!empty($year)) { $title[] = $year; } if (!empty($month)) { $title[] = $month; } $title = array_merge($title, $this->_processPagination($uri)); break; default: switch (@$task) { case 'article.add': if (isset($catid)) { $catInfo = $this->getCategoryInfo($catid); if ($catInfo === false) { JoomSefLogger::Log("Category with ID {$catid} could not be found.", $this, 'com_content'); return $uri; } if (is_array($catInfo->path) && count($catInfo->path) > 0) { $title = array_merge($title, $catInfo->path); } } if ($this->params->get('always_en', '0') == '1') { $title[] = 'New'; } else { $title[] = JText::_('COM_SEF_NEW'); } break; case 'article.edit': if (isset($a_id)) { $title = array_merge($title, $this->_getArticle($a_id)); } if ($this->params->get('always_en', '0') == '1') { $title[] = 'Edit'; } else { $title[] = JText::_('COM_SEF_EDIT'); } break; default: // Don't SEF return $uri; } break; } // Handle printing if (isset($print) && intval($print) == 1) { if ($this->params->get('always_en', '0') == '1') { $title[] = 'Print'; } else { $title[] = JText::_('JGLOBAL_PRINT'); } } $newUri = $uri; if (count($title) > 0) { // Generate meta tags $this->metatags = $this->getMetaTags(); if ($this->params->get('meta_titlepage', '0') == '1' && !empty($this->pageNumberText)) { // Add page number to page title if (!empty($this->metatags["metatitle"])) { $this->metatags["metatitle"] .= ' - ' . $this->pageNumberText; } else { $this->metatags["metatitle"] = (!empty($this->pageTitle) ? $this->pageTitle . ' - ' : '') . $this->pageNumberText; } } $priority = $this->getPriority($uri); $sitemap = $this->getSitemapParams($uri); if (isset($this->lang)) { $lang = $this->lang; } $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang, $this->nonSefVars, null, $this->metatags, $priority, true, null, $sitemap); } return $newUri; }
function create(&$uri) { $vars = $uri->getQuery(true); extract($vars); $title = array(); if ($this->params->get('showMenuTitle', '1') == '1') { $title[] = JoomSEF::_getMenuTitleLang($uri->getVar('option'), @$lang, $uri->getVar('Itemid')); } else { $title[] = substr($uri->getVar('option'), 4); } $noAdd = array('option', 'lang', 'Itemid'); foreach ($vars as $name => $value) { if (in_array($name, $noAdd)) { continue; } // Arrays support $this->_addValue($title, $value); } $newUri = $uri; if (count($title) > 0) { $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang); } return $newUri; }
function create(&$uri) { $this->metadesc = null; // Extract variables $vars = $uri->getQuery(true); extract($vars); $this->params = SEFTools::getExtParams('com_contact'); $title[] = JoomSEF::_getMenuTitleLang(@$option, $this->lang, @$Itemid); if (isset($view)) { switch ($view) { case 'categories': case 'featured': break; case 'category': $catInfo = $this->getCategoryInfo($id); if ($catInfo === false) { JoomSefLogger::Log("Category with ID {$id} could not be found.", $this, 'com_contact'); } if (is_array($catInfo->path)) { $title = array_merge($title, $catInfo->path); } break; case 'contact': $title = array_merge($title, $this->getContactName($id)); break; } } if (!empty($format)) { if ($format == 'feed' && !empty($type)) { $title[] = $type; } elseif ($format == 'vcf') { $title[] = 'vCard'; } } $newUri = $uri; if (count($title) > 0) { // Generate meta tags $this->metatags = $this->getMetaTags(); $priority = $this->getPriority($uri); $sitemap = $this->getSitemapParams($uri); if (isset($this->lang)) { $lang = $this->lang; } $newUri = JoomSEF::_sefGetLocation($uri, $title, null, null, null, @$lang, null, null, $this->metatags, $priority, false, null, $sitemap); } return $newUri; }