public static function getUrlLink($item)
{
if ($item->id == 0) {
return;
}
if (empty($item->component)) {
$item->component = 'com_mymaplocations';
}
$params = JComponentHelper::getParams('com_mymaplocations');
$itemid = MyMaplocationsHelper::getMenuId($item->component);
$globalmenu = $itemid[$item->component];
if ($item->component == "com_k2") {
require_once(JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_k2' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'route.php');
require_once(JPATH_SITE . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_k2' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'utilities.php');
$url = urldecode(JRoute::_(K2HelperRoute::getItemRoute($item->extra_id . ':' . urlencode($item->k2alias), $item->k2catid . ':' . urlencode($item->k2catalias))));
} else if ($item->component == "com_comprofiler") {
global $_CB_framework;
$url = $_CB_framework->userProfileUrl((int) $item->extra_id, false);
} else if ($item->component == "com_hikamarket") {
$furl = 'product&task=show&cid=' . (int) $item->product_id . '&name=' . $item->alias;
if ($globalmenu) {
$furl .= '&Itemid=' . $globalmenu;
}
$url = hikashop_completeLink($furl);
} else if ($item->component == "com_hikashop") {
$furl = 'index.php?option=com_hikamarket&ctrl=vendor&task=show&cid=' . $item->extra_id . '&name=' . $item->vendor_alias;
if ($globalmenu) {
$furl .= '&Itemid=' . $globalmenu;
}
$url = hikashop_completeLink($furl);
} else if ($item->component == "com_community") {
include_once(JPATH_BASE . '/components/com_community/defines.community.php');
require_once(JPATH_BASE . '/components/com_community/libraries/core.php');
$url = CRoute::_('index.php?option=com_community&view=profile&userid=' . $item->id);
} else if ($item->component == "com_easysocial") {
$url = $item->url;
} else if ($item->component == "com_easyblog") {
$url = $item->url;
} else if ($item->component == "com_mytestimonials") {
if (($globalmenu)) {
$url = JRoute::_("index.php?option=com_mytestimonials&view=testimonial&id=" . $item->id . "&Itemid=" . $globalmenu);
} else {
$url = JRoute::_('index.php?option=com_mytestimonials&view=testimonial=' . $item->id);
}
} else if ($item->component == "com_ohanah") {
if (($globalmenu)) {
$url = JRoute::_('index.php?option=com_ohanah&view=event&id=' . $item->id . '&format=html&Itemid=' . $globalmenu);
} else {
$url = JRoute::_('index.php?option=com_ohanah&view=event&id=' . $item->id . '&format=html');
}
} else if ($item->component == "com_eventbooking") {
require_once JPATH_ROOT . '/components/com_eventbooking/helper/helper.php';
require_once JPATH_ROOT . '/components/com_eventbooking/helper/route.php';
require_once JPATH_ROOT . '/components/com_eventbooking/helper/jquery.php';
$url = JRoute::_(EventbookingHelperRoute::getEventRoute($item->id, 0, $globalmenu));
} else if ($item->component == "com_zoo") {
require_once(JPATH_ADMINISTRATOR . '/components/com_zoo/config.php');
$app = App::getInstance('zoo');
$link = 'index.php?option=' . $app->component->self->name . '&task=item&item_id=' . $item->id;
if ($globalmenu) {
$link .= '&Itemid=' . $globalmenu;
}
$link = JRoute::_($link);
return $link;
} else if ($item->component == "com_content") {
if ((JFolder::exists(JPATH_SITE . '/components/com_flexicontent/'))) {
require_once(JPATH_SITE . '/administrator/components/com_flexicontent/defineconstants.php');
require_once(JPATH_SITE . '/components/com_flexicontent/helpers/route.php');
$link = JRoute::_(FlexicontentHelperRoute::getItemRoute($item->slug, $item->categoryslug, null, $item));
} else {
require_once JPATH_SITE . '/components/com_content/helpers/route.php';
$item->slug = $item->alias ? ($item->extra_id . ':' . $item->alias) : $item->extra_id;
$link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catid));
}
return $link;
} else if ($item->component == "com_adsmanager") {
$url = @TRoute::_("index.php?option=com_adsmanager&view=details&id=" . $item->id . "&catid=" . $item->catid);
} else if ($item->component == "com_djclassifieds") {
require_once(JPATH_BASE . '/administrator/components/com_djclassifieds/lib/djseo.php');
$url = JRoute::_(DJClassifiedsSEO::getItemRoute($item->id . ':' . $item->alias, $item->cat_id . ':' . $item->c_alias));
} else {
if ((@$item->extlink) && ($item->exturl)) {
if (strpos($item->exturl, 'menu:') !== false) {
$link = explode(":", $item->exturl);
$menuitem = intval($link[1]);
$url = JRoute::_('index.php?Itemid=' . $menuitem);
} else {
$url = $item->exturl;
}
} else if (!empty($globalmenu)) {
$url = JRoute::_("index.php?option=com_mymaplocations&view=location&id=" . $item->id . "&Itemid=" . $globalmenu);
} else {
$url = JRoute::_("index.php?option=com_mymaplocations&view=location&id=" . $item->id);
}
}
$url = str_replace("'", "'", $url);
return $url;
}