Leading Supplier of Fresh Coconuts

Fresh from our Coconut Plantation in Malaysia

Hong Heng Food Industries Sdn Bhd
12, Jalan Parit Betak
82200 Benut Pontian
Johor, Malaysia
Tel: +607-4258888

Hong Heng Food Marketing
(Sole Agent)
Blk 15 Woodlands Loop
#04-55 Singapore 738322
Tel: +65 67565088

defined('_JEXEC') or die; abstract class ContactHelperRoute { protected static $lookup; public static function getContactRoute($id, $catid, $language = 0) { $needles = array( 'contact' => array((int) $id) ); //Create the link $link = 'index.php?option=com_contact&view=contact&id=' . $id; if ($catid > 1) { $categories = JCategories::getInstance('Contact'); $category = $categories->get($catid); if ($category) { $needles['category'] = array_reverse($category->getPath()); $needles['categories'] = $needles['category']; $link .= '&catid=' . $catid; } } if ($language && $language != "*" && JLanguageMultilang::isEnabled()) { $link .= '&lang=' . $language; $needles['language'] = $language; } if ($item = self::_findItem($needles)) { $link .= '&Itemid=' . $item; } return $link; } public static function getCategoryRoute($catid, $language = 0) { if ($catid instanceof JCategoryNode) { $id = $catid->id; $category = $catid; } else { $id = (int) $catid; $category = JCategories::getInstance('Contact')->get($id); } if ($id < 1 || !($category instanceof JCategoryNode)) { $link = ''; } else { $needles = array(); // Create the link $link = 'index.php?option=com_contact&view=category&id=' . $id; $catids = array_reverse($category->getPath()); $needles['category'] = $catids; $needles['categories'] = $catids; if ($language && $language != "*" && JLanguageMultilang::isEnabled()) { $link .= '&lang=' . $language; $needles['language'] = $language; } if ($item = self::_findItem($needles)) { $link .= '&Itemid=' . $item; } } return $link; } protected static function _findItem($needles = null) { $app = JFactory::getApplication(); $menus = $app->getMenu('site'); $language = isset($needles['language']) ? $needles['language'] : '*'; // Prepare the reverse lookup array. if (!isset(self::$lookup[$language])) { self::$lookup[$language] = array(); $component = JComponentHelper::getComponent('com_contact'); $attributes = array('component_id'); $values = array($component->id); if ($language != '*') { $attributes[] = 'language'; $values[] = array($needles['language'], '*'); } $items = $menus->getItems($attributes, $values); foreach ($items as $item) { if (isset($item->query) && isset($item->query['view'])) { $view = $item->query['view']; if (!isset(self::$lookup[$language][$view])) { self::$lookup[$language][$view] = array(); } if (isset($item->query['id'])) { if (!isset(self::$lookup[$language][$view][$item->query['id']]) || $item->language != '*') { self::$lookup[$language][$view][$item->query['id']] = $item->id; } } } } } if ($needles) { foreach ($needles as $view => $ids) { if (isset(self::$lookup[$language][$view])) { foreach ($ids as $id) { if (isset(self::$lookup[$language][$view][(int) $id])) { return self::$lookup[$language][$view][(int) $id]; } } } } } // Check if the active menuitem matches the requested language $active = $menus->getActive(); if ($active && ($language == '*' || in_array($active->language, array('*', $language)) || !JLanguageMultilang::isEnabled())) { return $active->id; } // If not found, return language specific home link $default = $menus->getDefault($language); return !empty($default->id) ? $default->id : null; } }
Copyright (c) 2015 Hong Heng Food Marketing. All rights reserved.