public function build(&$query) { $segments = array(); $app = JFactory::getApplication('site'); $menus = $app->getMenu('site'); $activeMenu = $menus->getActive(); $params = JUDirectoryHelper::getParams(); $homeItemId = JUDirectoryHelperRoute::getHomeMenuItemId(); if (empty($query['Itemid']) && isset($query['view']) && $query['view'] != 'category' && $query['view'] != 'listing') { $query['Itemid'] = JUDirectoryHelperRoute::findJUDirectoryTreeItemId(); } if (isset($query['view'])) { $menuItem = $menus->getItem($query['Itemid']); if (isset($menuItem) && ($menuItem->component != 'com_judirectory' && $menuItem->id != $homeItemId)) { unset($query['Itemid']); } } if (!$query || !isset($query['view']) && !isset($query['task'])) { if (isset($query['start'])) { $sefPageConfig = JApplication::stringURLSafe('page'); $pageX = JUDirectoryHelperRoute::getPage($query['start'], $activeMenu->query['view']); $segments[] = $sefPageConfig . ':' . $pageX; unset($query['start']); } JUDirectoryHelperRoute::seoFormat($query, $params, $segments); $total = count($segments); for ($i = 0; $i < $total; $i++) { $segments[$i] = str_replace(':', '-', $segments[$i]); } if (isset($query['limit'])) { unset($query['limit']); } return $segments; } $hasActiveMenu = false; if (is_object($activeMenu) && isset($activeMenu->query)) { if (isset($query['Itemid']) && $query['Itemid'] == $activeMenu->id) { $hasActiveMenu = JUDirectoryHelperRoute::compareQuery($activeMenu, $query); } } if (isset($query['view']) && $query['view'] == 'categories') { if (!$hasActiveMenu) { if (isset($query['id'])) { if (isset($query['Itemid'])) { if ($query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } } $sefCategoriesConfig = JApplication::stringURLSafe('categories'); $segments[] = JApplication::stringURLSafe($sefCategoriesConfig); $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); $segments[] = $query['id'] . ":" . (isset($categoryObject->alias) ? $categoryObject->alias : ''); unset($query['id']); } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['id'])) { unset($query['id']); } if (isset($query['layout'])) { unset($query['layout']); } } unset($query['view']); } if (isset($query['view']) && $query['view'] == 'category') { if (!$hasActiveMenu) { $fullPathCategory = $params->get('sef_category_full_path', 0); if (isset($query['id'])) { $segments = JUDirectoryHelperRoute::getCategorySegment($query['id'], $query, $fullPathCategory); if ($segments !== false) { unset($query['id']); } } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['id'])) { unset($query['id']); } if (isset($query['layout'])) { unset($query['layout']); } } if (isset($query['format'])) { $segments[] = JApplication::stringURLSafe('rss'); unset($query['format']); } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'advsearch') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('advanced-search'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'collection') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } if (isset($query['id']) && $query['id']) { if (isset($query['user_id'])) { $user = JFactory::getUser($query['user_id']); $userAlias = JApplication::stringURLSafe($user->username); $segments[] = $query['user_id'] . ':' . $userAlias; unset($query['user_id']); } $segments[] = JApplication::stringURLSafe('collection'); $collectionObject = JUDirectoryFrontHelper::getCollectionById($query['id']); $segments[] = $query['id'] . ':' . (isset($collectionObject->alias) ? $collectionObject->alias : ''); unset($query['id']); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { $segments[] = JApplication::stringURLSafe('collection'); $segments[] = JApplication::stringURLSafe('new-collection'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); if (isset($query['id'])) { unset($query['id']); } } } else { if (isset($query['user_id'])) { unset($query['user_id']); } if (isset($query['id'])) { unset($query['id']); } } if (isset($query['format'])) { $segments[] = JApplication::stringURLSafe('rss'); unset($query['format']); } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'collections') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } if (isset($query['id'])) { $user = JFactory::getUser($query['id']); $userAlias = JApplication::stringURLSafe($user->username); $segments[] = $query['id'] . ':' . $userAlias; unset($query['id']); } $segments[] = JApplication::stringURLSafe('collections'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['id'])) { unset($query['id']); } if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'commenttree' && isset($query['id'])) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('comment-tree'); $commentObject = JUDirectoryFrontHelperComment::getCommentObject($query['id']); $commentAlias = JApplication::stringURLSafe($commentObject->title); $segments[] = $query['id'] . ':' . $commentAlias; if (isset($query['tmpl'])) { $segments[] = JApplication::stringURLSafe('component'); unset($query['tmpl']); } unset($query['id']); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'contact' && isset($query['listing_id'])) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments = JUDirectoryHelperRoute::getListingSegment($query['listing_id'], $query, $params); $segments[] = JApplication::stringURLSafe('contact'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['listing_id']); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'dashboard') { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } if (isset($query['id'])) { $user = JFactory::getUser($query['id']); $userAlias = JApplication::stringURLSafe($user->username); $segments[] = $query['id'] . ':' . $userAlias; unset($query['id']); } $segments[] = JApplication::stringURLSafe('dashboard'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'listing') { if (!$hasActiveMenu) { $seoLayout = true; if (isset($query['id'])) { $segments = JUDirectoryHelperRoute::getListingSegment($query['id'], $query, $params); unset($query['id']); } if (isset($query['print'])) { $seoLayout = false; $segments[] = JApplication::stringURLSafe('print'); unset($query['print']); unset($query['layout']); unset($query['tmpl']); } if ($seoLayout) { JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } } else { if (isset($query['id'])) { unset($query['id']); } if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'listings') { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('modal-listings'); if (isset($query['tmpl'])) { $segments[] = $query['tmpl']; unset($query['tmpl']); } if (isset($query['function'])) { $segments[] = $query['function']; unset($query['function']); } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'featured') { if (!$hasActiveMenu) { $addCategoryToSegment = true; if (isset($query['Itemid'])) { if ($query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); if ($categoryObject->level > 0) { $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); } unset($query['id']); } $addCategoryToSegment = false; } else { $assignMenuFeatured = $menus->getItem($query['Itemid']); if ($assignMenuFeatured && isset($assignMenuFeatured->query) && $assignMenuFeatured->query['view'] == 'tree' && isset($assignMenuFeatured->query['id'])) { if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); if ($assignMenuFeatured->query['id'] != $categoryObject->id) { $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); } unset($query['id']); } $addCategoryToSegment = false; } } } if ($addCategoryToSegment) { if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); unset($query['id']); } } $segments[] = JApplication::stringURLSafe('featured'); if (isset($query['all'])) { if ($query['all'] == 1) { $segments[] = JApplication::stringURLSafe('all'); } unset($query['all']); } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['id'])) { unset($query['id']); } if (isset($query['all'])) { unset($query['all']); } if (isset($query['layout'])) { unset($query['layout']); } } if (isset($query['format'])) { $segments[] = JApplication::stringURLSafe('rss'); unset($query['format']); } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'form' && isset($query['layout']) && $query['layout'] == 'edit' && (!isset($query['id']) || isset($query['id']) && !$query['id'])) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } if (isset($query['cat_id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['cat_id']); $segments[] = $query['cat_id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); unset($query['cat_id']); } else { $categoryRoot = JUDirectoryFrontHelperCategory::getRootCategory(); if (is_object($categoryRoot)) { $segments[] = $categoryRoot->id . ':' . (isset($categoryRoot->alias) ? $categoryRoot->alias : ''); } } $segments[] = JApplication::stringURLSafe('new-listing'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'form' && isset($query['layout']) && $query['layout'] == 'edit' && isset($query['id']) && $query['id']) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments = JUDirectoryHelperRoute::getListingSegment($query['id'], $query, $params); if (isset($query['approve']) && $query['approve'] == 1) { $segments[] = JApplication::stringURLSafe('approve'); unset($query['approve']); } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['id']); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'listall') { if (!$hasActiveMenu) { $addCategoryToSegment = true; if (isset($query['Itemid'])) { if ($query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); if ($categoryObject->level > 0) { $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); unset($query['id']); } } $addCategoryToSegment = false; } else { $assignMenuListAll = $menus->getItem($query['Itemid']); if ($assignMenuListAll && isset($assignMenuListAll->query) && $assignMenuListAll->query['view'] == 'tree' && isset($assignMenuListAll->query['id'])) { if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); if ($assignMenuListAll->query['id'] != $categoryObject->id) { $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); } unset($query['id']); } $addCategoryToSegment = false; } } } if ($addCategoryToSegment) { if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); unset($query['id']); } } $segments[] = JApplication::stringURLSafe('list-all'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['id'])) { unset($query['id']); } } if (isset($query['format'])) { $segments[] = JApplication::stringURLSafe('rss'); unset($query['format']); } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'listalpha') { if (!$hasActiveMenu) { $addCategoryToSegment = true; if (isset($query['Itemid'])) { if ($query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); if ($categoryObject->level > 0) { $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); } unset($query['id']); } $addCategoryToSegment = false; } else { $assignMenuListAlpha = $menus->getItem($query['Itemid']); if ($assignMenuListAlpha && isset($assignMenuListAlpha->query) && $assignMenuListAlpha->query['view'] == 'tree' && isset($assignMenuListAlpha->query['id'])) { if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); if ($assignMenuListAlpha->query['id'] != $categoryObject->id) { $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); } unset($query['id']); } $addCategoryToSegment = false; } } } if ($addCategoryToSegment) { if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); unset($query['id']); } } $segments[] = JApplication::stringURLSafe('list-alpha'); if (isset($query['alpha'])) { $segments[] = $query['alpha']; unset($query['alpha']); } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['id'])) { unset($query['id']); } if (isset($query['alpha'])) { unset($query['alpha']); } if (isset($query['layout'])) { unset($query['layout']); } } if (isset($query['format'])) { $segments[] = JApplication::stringURLSafe('rss'); unset($query['format']); } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'maintenance') { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('maintenance'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'modcomment' && isset($query['layout']) && $query['layout'] == 'edit' && isset($query['id']) && $query['id']) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('mod-comment'); $commentObject = JUDirectoryFrontHelperComment::getCommentObject($query['id']); if (is_object($commentObject)) { $commentAlias = JApplication::stringURLSafe($commentObject->title); $segments[] = $query['id'] . ':' . $commentAlias; unset($query['id']); } if (isset($query['approve']) && $query['approve']) { $segments[] = JApplication::stringURLSafe('approve'); unset($query['approve']); } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['view']); unset($query['layout']); } if (isset($query['view']) && $query['view'] == 'modcomments') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('mod-comments'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'modlistings') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('mod-listings'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'modpermission' && isset($query['id'])) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = JApplication::stringURLSafe('root'); $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('mod-permission'); $segments[] = $query['id']; JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['id']); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'modpermissions') { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('mod-permissions'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'modpendingcomments') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('mod-pending-comments'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'modpendinglistings') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('mod-pending-listings'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'profile') { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('profile'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'claim' && isset($query['listing_id'])) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments = JUDirectoryHelperRoute::getListingSegment($query['listing_id'], $query, $params); $segments[] = JApplication::stringURLSafe('claim'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['listing_id']); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'report' && isset($query['listing_id'])) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments = JUDirectoryHelperRoute::getListingSegment($query['listing_id'], $query, $params); $segments[] = JApplication::stringURLSafe('report'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['listing_id']); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'report' && isset($query['comment_id'])) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('comment'); $commentObject = JUDirectoryFrontHelperComment::getCommentObject($query['comment_id']); $commentAlias = JApplication::stringURLSafe($commentObject->title); $segments[] = $query['comment_id'] . ':' . $commentAlias; unset($query['comment_id']); $segments[] = JApplication::stringURLSafe('report'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['comment_id']); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'search') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } if (isset($query['cat_id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['cat_id']); $segments[] = $query['cat_id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); unset($query['cat_id']); } if (isset($query['sub_cat'])) { $segments[] = JApplication::stringURLSafe('all'); unset($query['sub_cat']); } $segments[] = JApplication::stringURLSafe('search'); if (isset($query['searchword'])) { $segments[] = $query['searchword']; unset($query['searchword']); } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['cat_id'])) { unset($query['cat_id']); } if (isset($query['searchword'])) { unset($query['searchword']); } if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'searchby') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('search-by'); if (isset($query['field_id'])) { $fieldObject = JUDirectoryFrontHelperField::getFieldById($query['field_id']); $segments[] = $query['field_id'] . ':' . (isset($fieldObject->alias) ? $fieldObject->alias : ''); unset($query['field_id']); } if (isset($query['value'])) { $segments[] = $query['value']; unset($query['value']); } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['field_id'])) { unset($query['field_id']); } if (isset($query['value'])) { unset($query['value']); } if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'subscribe' && isset($query['listing_id'])) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments = JUDirectoryHelperRoute::getListingSegment($query['listing_id'], $query, $params); $segments[] = JApplication::stringURLSafe('guest-subscribe'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); unset($query['listing_id']); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'tag' && isset($query['id'])) { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('tag'); $tagObject = JUDirectoryFrontHelper::getTagById($query['id']); $segments[] = $query['id'] . ':' . (isset($tagObject->alias) ? $tagObject->alias : ''); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['id'])) { unset($query['id']); } if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoFormat($query, $params, $segments); JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['id']); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'tags') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('tags'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'topcomments') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('top-comments'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'customlist') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('custom-list'); if (isset($query['id'])) { if ($query['id']) { $customListObject = JUDirectoryHelper::getCustomListById($query['id']); $segments[] = $query['id'] . ':' . (isset($customListObject->alias) ? $customListObject->alias : ''); } unset($query['id']); } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['id'])) { unset($query['id']); } if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoFormat($query, $params, $segments); JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'compare') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $segments[] = JApplication::stringURLSafe('compare'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'toplistings') { $addCategoryToSegment = true; if (!$hasActiveMenu) { if (isset($query['Itemid'])) { if ($query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); if ($categoryObject->level > 0) { $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); } unset($query['id']); } $addCategoryToSegment = false; } else { $assignMenuTopListings = $menus->getItem($query['Itemid']); if ($assignMenuTopListings && isset($assignMenuTopListings->query) && $assignMenuTopListings->query['view'] == 'tree' && isset($assignMenuTopListings->query['id'])) { if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); if ($assignMenuTopListings->query['id'] != $categoryObject->id) { $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); } unset($query['id']); } $addCategoryToSegment = false; } } } if ($addCategoryToSegment) { if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); unset($query['id']); } } if (isset($query['ordertype'])) { switch ($query['ordertype']) { case 'new': $segments[] = JApplication::stringURLSafe('latest-listings'); break; case 'featured': $segments[] = JApplication::stringURLSafe('top-featured-listings'); break; case 'recent_modified': $segments[] = JApplication::stringURLSafe('recent-modified-listings'); break; case 'recent_updated': $segments[] = JApplication::stringURLSafe('recent-updated-listings'); break; case 'popular': $segments[] = JApplication::stringURLSafe('popular-listings'); break; case 'most_rated': $segments[] = JApplication::stringURLSafe('most-rated-listings'); break; case 'top_rated': $segments[] = JApplication::stringURLSafe('top-rated-listings'); break; case 'latest_rated': $segments[] = JApplication::stringURLSafe('latest-rated-listings'); break; case 'most_commented': $segments[] = JApplication::stringURLSafe('most-commented-listings'); break; case 'latest_commented': $segments[] = JApplication::stringURLSafe('latest-commented-listings'); break; case 'recently_viewed': $segments[] = JApplication::stringURLSafe('recent-viewed-listings'); break; case 'alpha_ordered': $segments[] = JApplication::stringURLSafe('alpha-ordered-listings'); break; case 'random': $segments[] = JApplication::stringURLSafe('random-listings'); break; case 'random_fast': $segments[] = JApplication::stringURLSafe('random-fast-listings'); break; case 'random_featured': $segments[] = JApplication::stringURLSafe('random-featured-listings'); break; default: $segments[] = JApplication::stringURLSafe('latest-listings'); } unset($query['ordertype']); } if (isset($query['all'])) { if ($query['all'] == 1) { $segments[] = JApplication::stringURLSafe('all'); } unset($query['all']); } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['id'])) { unset($query['id']); } if (isset($query['ordertype'])) { unset($query['ordertype']); } if (isset($query['all'])) { unset($query['all']); } if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoFormat($query, $params, $segments); JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'tree' && isset($query['id'])) { if (!$hasActiveMenu) { $addCategoryToSegment = true; if (isset($query['Itemid'])) { if ($query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); if ($categoryObject->level > 0) { $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); } unset($query['id']); } $addCategoryToSegment = false; } else { $assignMenuTree = $menus->getItem($query['Itemid']); if ($assignMenuTree && isset($assignMenuTree->query) && $assignMenuTree->query['view'] == 'tree' && isset($assignMenuTree->query['id'])) { if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); if ($assignMenuTree->query['id'] != $categoryObject->id) { $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); } unset($query['id']); } $addCategoryToSegment = false; } } } $segments[] = 'tree'; if ($addCategoryToSegment) { if (isset($query['id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['id']); $segments[] = $query['id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); } } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['id'])) { unset($query['id']); } if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoFormat($query, $params, $segments); JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['id']); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'usercomments') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } if (isset($query['id'])) { $user = JFactory::getUser($query['id']); $userAlias = JApplication::stringURLSafe($user->username); $segments[] = $query['id'] . ':' . $userAlias; unset($query['id']); } $segments[] = JApplication::stringURLSafe('comments'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['id'])) { unset($query['id']); } if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'userlistings') { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } if (isset($query['id'])) { $user = JFactory::getUser($query['id']); $userAlias = JApplication::stringURLSafe($user->username); $segments[] = $query['id'] . ':' . $userAlias; unset($query['id']); } $segments[] = JApplication::stringURLSafe('listings'); if (isset($query['filter'])) { if ($query['filter'] == 'pending') { $segments[] = JApplication::stringURLSafe('pending'); } elseif ($query['filter'] == 'unpublished') { $segments[] = JApplication::stringURLSafe('unpublished'); } else { $segments[] = JApplication::stringURLSafe('published'); } unset($query['filter']); } JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if (isset($query['id'])) { unset($query['id']); } if (isset($query['filter'])) { unset($query['filter']); } if (isset($query['layout'])) { unset($query['layout']); } } JUDirectoryHelperRoute::seoFormat($query, $params, $segments); JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['view']); } if (isset($query['view']) && $query['view'] == 'usersubscriptions' && isset($query['id'])) { if (!$hasActiveMenu) { if (isset($query['Itemid']) && $query['Itemid'] == $homeItemId) { $sefRootCategory = 'root'; $segments[] = JApplication::stringURLSafe($sefRootCategory); } $user = JFactory::getUser($query['id']); $userAlias = JApplication::stringURLSafe($user->username); $segments[] = $query['id'] . ':' . $userAlias; $segments[] = JApplication::stringURLSafe('user-subscriptions'); JUDirectoryHelperRoute::seoLayout($query, $segments, $params); } else { if ($query['layout']) { unset($query['layout']); } } JUDirectoryHelperRoute::seoPagination($query, $params, $segments); unset($query['id']); unset($query['view']); } if (isset($query['task']) && $query['task'] == 'form.add') { if (isset($query['cat_id'])) { $categoryObject = JUDirectoryHelper::getCategoryById($query['cat_id']); if (is_object($categoryObject)) { $segments[] = $query['cat_id'] . ':' . (isset($categoryObject->alias) ? $categoryObject->alias : ''); unset($query['cat_id']); } } $segments[] = JApplication::stringURLSafe('add'); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'form.edit' && isset($query['id'])) { $segments = JUDirectoryHelperRoute::getListingSegment($query['id'], $query, $params); $segments[] = JApplication::stringURLSafe('edit'); if (isset($query['layout'])) { unset($query['layout']); } unset($query['id']); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'forms.delete' && isset($query['id'])) { $segments = JUDirectoryHelperRoute::getListingSegment($query['id'], $query, $params); $segments[] = JApplication::stringURLSafe('delete'); unset($query['id']); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'forms.checkin' && isset($query['id'])) { $segments = JUDirectoryHelperRoute::getListingSegment($query['id'], $query, $params); $segments[] = JApplication::stringURLSafe('checkin'); unset($query['id']); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'listing.removeCompare' && isset($query['listing_id'])) { $segments = JUDirectoryHelperRoute::getListingSegment($query['listing_id'], $query, $params); $segments[] = JApplication::stringURLSafe('remove-compare'); unset($query['listing_id']); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'listing.removeCompare' && isset($query['all']) && $query['all'] == 1) { $segments[] = JApplication::stringURLSafe('remove-compare'); $segments[] = JApplication::stringURLSafe('all'); unset($query['all']); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'modpendinglisting.edit' && isset($query['id'])) { $segments = JUDirectoryHelperRoute::getListingSegment($query['id'], $query, $params); if (isset($query['approve'])) { $segments[] = JApplication::stringURLSafe('approve'); unset($query['approve']); } if (isset($query['layout'])) { unset($query['layout']); } unset($query['id']); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'forms.unpublish' && isset($query['id'])) { $segments = JUDirectoryHelperRoute::getListingSegment($query['id'], $query, $params); $segments[] = JApplication::stringURLSafe('unpublish'); unset($query['id']); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'forms.publish' && isset($query['id'])) { $segments = JUDirectoryHelperRoute::getListingSegment($query['id'], $query, $params); $segments[] = JApplication::stringURLSafe('publish'); unset($query['id']); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'subscribe.save' && isset($query['listing_id']) && !isset($query['comment_id'])) { $segments = JUDirectoryHelperRoute::getListingSegment($query['listing_id'], $query, $params); $segments[] = JApplication::stringURLSafe('subscribe'); unset($query['listing_id']); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'listing.redirecturl') { if (isset($query['listing_id'])) { $segments = JUDirectoryHelperRoute::getListingSegment($query['listing_id'], $query, $params); unset($query['listing_id']); } if (isset($query['field_id'])) { $fieldObject = JUDirectoryFrontHelperField::getFieldById($query['field_id']); $segments[] = $query['field_id'] . ':' . (isset($fieldObject->alias) ? $fieldObject->alias : ''); unset($query['field_id']); } $segments[] = JApplication::stringURLSafe('redirect-url'); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'modcomment.edit' && isset($query['id'])) { $segments[] = JApplication::stringURLSafe('comment'); $commentObject = JUDirectoryFrontHelperComment::getCommentObject($query['id']); $commentAlias = JApplication::stringURLSafe($commentObject->title); $segments[] = $query['id'] . ':' . $commentAlias; unset($query['id']); $segments[] = JApplication::stringURLSafe('edit'); if (isset($query['layout'])) { unset($query['layout']); } unset($query['task']); } if (isset($query['task']) && $query['task'] == 'modpendingcomment.edit' && isset($query['id'])) { $segments[] = JApplication::stringURLSafe('comment'); $commentObject = JUDirectoryFrontHelperComment::getCommentObject($query['id']); $commentAlias = JApplication::stringURLSafe($commentObject->title); $segments[] = $query['id'] . ':' . $commentAlias; unset($query['id']); $segments[] = JApplication::stringURLSafe('approve'); if (isset($query['layout'])) { unset($query['layout']); } unset($query['id']); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'subscribe.save' && isset($query['comment_id'])) { $segments[] = JApplication::stringURLSafe('comment'); $commentObject = JUDirectoryFrontHelperComment::getCommentObject($query['comment_id']); $commentAlias = JApplication::stringURLSafe($commentObject->title); $segments[] = $query['comment_id'] . ':' . $commentAlias; unset($query['comment_id']); $segments[] = JApplication::stringURLSafe('subscribe'); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'subscribe.remove' && isset($query['sub_id'])) { $subscriptionObject = JUDirectoryFrontHelper::getSubscriptionObject($query['sub_id']); if ($subscriptionObject->type == 'listing') { $segments = JUDirectoryHelperRoute::getListingSegment($subscriptionObject->item_id, $query, $params); $segments[] = JApplication::stringURLSafe('unsubscribe'); $segments[] = $query['sub_id']; if ($query['code']) { $segments[] = $query['code']; unset($query['code']); } unset($query['listing_id']); unset($query['task']); unset($query['sub_id']); unset($query['task']); } elseif ($subscriptionObject->type == 'comment') { $segments[] = JApplication::stringURLSafe('comment'); $commentObject = JUDirectoryFrontHelperComment::getCommentObject($subscriptionObject->item_id); if (is_object($commentObject)) { $commentAlias = JApplication::stringURLSafe($commentObject->title); $segments[] = $commentObject->id . ':' . $commentAlias; } $segments[] = JApplication::stringURLSafe('unsubscribe'); $segments[] = $query['sub_id']; if ($query['code']) { $segments[] = $query['code']; unset($query['code']); } unset($query['sub_id']); unset($query['task']); } } if (isset($query['task']) && $query['task'] == 'listing.deleteComment' && isset($query['comment_id'])) { $segments[] = JApplication::stringURLSafe('comment'); $commentObject = JUDirectoryFrontHelperComment::getCommentObject($query['comment_id']); $commentAlias = JApplication::stringURLSafe($commentObject->title); $segments[] = $query['comment_id'] . ':' . $commentAlias; unset($query['comment_id']); $segments[] = JApplication::stringURLSafe('delete'); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'collection.add') { $segments[] = JApplication::stringURLSafe('collection'); $segments[] = JApplication::stringURLSafe('add'); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'collection.edit' && isset($query['id'])) { if (isset($query['user_id'])) { $user = JFactory::getUser($query['user_id']); $userAlias = JApplication::stringURLSafe($user->username); $segments[] = $query['user_id'] . ':' . $userAlias; unset($query['user_id']); } $segments[] = JApplication::stringURLSafe('collection'); $collectionObject = JUDirectoryFrontHelper::getCollectionById($query['id']); $segments[] = $query['id'] . ':' . (isset($collectionObject->alias) ? $collectionObject->alias : ''); unset($query['id']); $segments[] = JApplication::stringURLSafe('edit'); if (isset($query['layout'])) { unset($query['layout']); } unset($query['task']); } if (isset($query['task']) && $query['task'] == 'collections.delete' && isset($query['cid'])) { $segments[] = JApplication::stringURLSafe('collection'); $collectionObject = JUDirectoryFrontHelper::getCollectionById($query['cid']); $segments[] = $query['cid'] . ':' . (isset($collectionObject->alias) ? $collectionObject->alias : ''); unset($query['cid']); $segments[] = JApplication::stringURLSafe('delete'); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'usersubscriptions.unsubscribe' && isset($query['sub_id'])) { $segments[] = JApplication::stringURLSafe('user-subscriptions'); $segments[] = $query['sub_id']; $segments[] = JApplication::stringURLSafe('unsubscribe'); unset($query['sub_id']); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'rawdata') { if (isset($query['listing_id'])) { $segments = JUDirectoryHelperRoute::getListingSegment($query['listing_id'], $query, $params); unset($query['listing_id']); } if (isset($query['field_id'])) { $fieldObject = JUDirectoryFrontHelperField::getFieldById($query['field_id']); $segments[] = $query['field_id'] . ':' . (isset($fieldObject->alias) ? $fieldObject->alias : ''); unset($query['field_id']); } $segments[] = JApplication::stringURLSafe('raw-data'); unset($query['task']); } if (isset($query['task']) && $query['task'] == 'subscribe.activate') { $segments[] = JApplication::stringURLSafe('activate-subscription'); if ($query['id']) { $segments[] = $query['id']; } if (isset($query['code'])) { $segments[] = $query['code']; } unset($query['task']); } if (isset($query['task']) && $query['task'] == 'email.downloadattachment') { $segments[] = JApplication::stringURLSafe('email'); $segments[] = JApplication::stringURLSafe('download-attachment'); if (isset($query['mail_id'])) { $segments[] = $query['mail_id']; unset($query['mail_id']); } if (isset($query['file'])) { $segments[] = $query['file']; unset($query['file']); } if (isset($query['code'])) { $segments[] = $query['code']; unset($query['code']); } unset($query['task']); } $total = count($segments); for ($i = 0; $i < $total; $i++) { $segments[$i] = str_replace(':', '-', $segments[$i]); } if (isset($query['limit'])) { unset($query['limit']); } return $segments; }