function beforeCreate(&$uri) { // Remove the part after ':' from variables if (!is_null($uri->getVar('id'))) { SEFTools::fixVariable($uri, 'id'); } if (!is_null($uri->getVar('catid'))) { SEFTools::fixVariable($uri, 'catid'); } $view = $uri->getVar('view'); $id = (int) $uri->getVar('id'); $catid = (int) $uri->getVar('catid'); switch ($view) { case 'category': case 'categories': // Remove view and catid if they point to empty category/categories if (!$id) { $uri->delVar('view'); $uri->delVar('id'); } case 'contact': if ($id && $catid) { $uri->delVar('catid'); } } return; }
function beforeCreate(&$uri) { // Remove the part after ':' from variables if (!is_null($uri->getVar('id'))) { SEFTools::fixVariable($uri, 'id'); } if (!is_null($uri->getVar('catid'))) { SEFTools::fixVariable($uri, 'catid'); } return; }
function beforeCreate(&$uri) { // Remove the part after ':' from variables if (!is_null($uri->getVar('id'))) { SEFTools::fixVariable($uri, 'id'); } if (!is_null($uri->getVar('catid'))) { SEFTools::fixVariable($uri, 'catid'); } if ($uri->getVar('view') == 'categories' && !(int) $uri->getVar('id')) { $uri->delVar('id'); } if (is_null($uri->getVar('view'))) { $uri->setVar('view', 'categories'); } return; }
function beforeCreate(&$uri) { // Remove the part after ':' from variables if (!is_null($uri->getVar('id'))) { SEFTools::fixVariable($uri, 'id'); } if (!is_null($uri->getVar('catid'))) { SEFTools::fixVariable($uri, 'catid'); } // Remove view and catid if they point to empty category if (!is_null($uri->getVar('view')) && $uri->getVar('view') == 'category') { if (is_null($uri->getVar('catid')) || $uri->getVar('catid') == 0) { $uri->delVar('view'); $uri->delVar('catid'); } } return; }
public function beforeCreate(&$uri) { // remove the limitstart and limit variables if they point to the first page if (!is_null($uri->getVar('limitstart')) && $uri->getVar('limitstart') == '0') { $uri->delVar('limitstart'); $uri->delVar('limit'); } // Remove empty variables if ($uri->getVar('limitstart') == '') { $uri->delVar('limitstart'); } if ($uri->getVar('showall') == '') { $uri->delVar('showall'); } // Try to guess the correct Itemid if set to if ($this->params->get('guessId', '0') != '0') { if (!is_null($uri->getVar('Itemid')) && !is_null($uri->getVar('id'))) { $itemid = SefExtContentRouteHelper::getItemid($uri->getVar('id')); if (!is_null($itemid)) { $uri->setVar('Itemid', $itemid); } } } // Remove the part after ':' from variables if (!is_null($uri->getVar('id'))) { SEFTools::fixVariable($uri, 'id'); } if (!is_null($uri->getVar('catid'))) { SEFTools::fixVariable($uri, 'catid'); } // TODO: We should remove this, as it generates 1 unnecessary SQL query for each article link, // instead the catid should just be always removed from article URL (but when updating JoomSEF, // we'll need to update URLs already in database to reflect such change = remove catid from them!) // If catid not given, try to find it $catid = $uri->getVar('catid'); if (!is_null($uri->getVar('view')) && $uri->getVar('view') == 'article' && !is_null($uri->getVar('id')) && empty($catid)) { $id = $uri->getVar('id'); $query = "SELECT `catid` FROM `#__content` WHERE `id` = '{$id}'"; $this->_db->setQuery($query); $catid = $this->_db->loadResult(); if (is_null($catid)) { JoomSefLogger::Log("Article with ID {$id} could not be found.", $this, 'com_content'); } if (!empty($catid)) { $uri->setVar('catid', $catid); } } // remove empty id in categories list if ($uri->getVar('view') == 'categories' && !(int) $uri->getVar('id')) { $uri->delVar('id'); } return; }
public function beforeCreate(&$uri) { // Fix IDs SEFTools::fixVariable($uri, 'id'); }
function beforeCreate(&$uri) { $db =& JFactory::getDBO(); $params = SEFTools::GetExtParams('com_content'); // Compatibility mode $comp = $params->get('compatibility', '0'); // Change task=view to view=article for old urls if (!is_null($uri->getVar('task')) && $uri->getVar('task') == 'view') { if ($comp == '0') { $uri->delVar('task'); } $uri->setVar('view', 'article'); } // Add the task=view in compatibility mode if ($comp != '0') { if (is_null($uri->getVar('task')) && !is_null($uri->getVar('view')) && $uri->getVar('view') == 'article') { $uri->setVar('task', 'view'); } } // remove the limitstart and limit variables if they point to the first page if (!is_null($uri->getVar('limitstart')) && $uri->getVar('limitstart') == '0') { $uri->delVar('limitstart'); $uri->delVar('limit'); } // Try to guess the correct Itemid if set to if ($params->get('guessId', '0') != '0') { if (!is_null($uri->getVar('Itemid')) && !is_null($uri->getVar('id'))) { $mainframe =& JFactory::getApplication(); $i = $mainframe->getItemid($uri->getVar('id')); $uri->setVar('Itemid', $i); } } // Remove the part after ':' from variables if (!is_null($uri->getVar('id'))) { SEFTools::fixVariable($uri, 'id'); } if (!is_null($uri->getVar('catid'))) { SEFTools::fixVariable($uri, 'catid'); } // If catid not given, try to find it $catid = $uri->getVar('catid'); if (!is_null($uri->getVar('view')) && $uri->getVar('view') == 'article' && !is_null($uri->getVar('id')) && empty($catid)) { $id = intval($uri->getVar('id')); $query = "SELECT `catid` FROM `#__content` WHERE `id` = '{$id}'"; $db->setQuery($query); $catid = $db->loadResult(); if (is_null($catid)) { JoomSefLogger::Log("Article with ID {$id} could not be found.", $this, 'com_content'); } else { $uri->setVar('catid', $catid); } } // add the view variable if it's not set if (is_null($uri->getVar('view'))) { if (is_null($uri->getVar('id'))) { $uri->setVar('view', 'frontpage'); } else { $uri->setVar('view', 'article'); } } return; }