0byt3m1n1-V2
Path:
/
home
/
a
/
c
/
a
/
academiac
/
www
/
[
Home
]
File: route.php.tar
home/academiac/www/components/com_users/helpers/route.php 0000644 00000007607 15137411745 0017726 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_users * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Users Route Helper * * @package Joomla.Site * @subpackage com_users * @since 1.6 */ class UsersHelperRoute { /** * Method to get the menu items for the component. * * @return array An array of menu items. * @since 1.6 */ public static function &getItems() { static $items; // Get the menu items for this component. if (!isset($items)) { // Include the site app in case we are loading this from the admin. require_once JPATH_SITE.'/includes/application.php'; $app = JFactory::getApplication(); $menu = $app->getMenu(); $com = JComponentHelper::getComponent('com_users'); $items = $menu->getItems('component_id', $com->id); // If no items found, set to empty array. if (!$items) { $items = array(); } } return $items; } /** * Method to get a route configuration for the login view. * * @return mixed Integer menu id on success, null on failure. * @since 1.6 * @static */ public static function getLoginRoute() { // Get the items. $items = self::getItems(); $itemid = null; // Search for a suitable menu id. foreach ($items as $item) { if (isset($item->query['view']) && $item->query['view'] === 'login') { $itemid = $item->id; break; } } return $itemid; } /** * Method to get a route configuration for the profile view. * * @return mixed Integer menu id on success, null on failure. * @since 1.6 */ public static function getProfileRoute() { // Get the items. $items = self::getItems(); $itemid = null; // Search for a suitable menu id. //Menu link can only go to users own profile. foreach ($items as $item) { if (isset($item->query['view']) && $item->query['view'] === 'profile') { $itemid = $item->id; break; } } return $itemid; } /** * Method to get a route configuration for the registration view. * * @return mixed Integer menu id on success, null on failure. * @since 1.6 */ public static function getRegistrationRoute() { // Get the items. $items = self::getItems(); $itemid = null; // Search for a suitable menu id. foreach ($items as $item) { if (isset($item->query['view']) && $item->query['view'] === 'registration') { $itemid = $item->id; break; } } return $itemid; } /** * Method to get a route configuration for the remind view. * * @return mixed Integer menu id on success, null on failure. * @since 1.6 */ public static function getRemindRoute() { // Get the items. $items = self::getItems(); $itemid = null; // Search for a suitable menu id. foreach ($items as $item) { if (isset($item->query['view']) && $item->query['view'] === 'remind') { $itemid = $item->id; break; } } return $itemid; } /** * Method to get a route configuration for the resend view. * * @return mixed Integer menu id on success, null on failure. * @since 1.6 */ public static function getResendRoute() { // Get the items. $items = self::getItems(); $itemid = null; // Search for a suitable menu id. foreach ($items as $item) { if (isset($item->query['view']) && $item->query['view'] === 'resend') { $itemid = $item->id; break; } } return $itemid; } /** * Method to get a route configuration for the reset view. * * @return mixed Integer menu id on success, null on failure. * @since 1.6 */ public static function getResetRoute() { // Get the items. $items = self::getItems(); $itemid = null; // Search for a suitable menu id. foreach ($items as $item) { if (isset($item->query['view']) && $item->query['view'] === 'reset') { $itemid = $item->id; break; } } return $itemid; } } home/academiac/www/components/com_finder/helpers/route.php 0000644 00000007216 15137642011 0020020 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_finder * * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die; jimport('joomla.application.component.helper'); /** * Finder route helper class. * * @package Joomla.Site * @subpackage com_finder * @since 2.5 */ class FinderHelperRoute { /** * Method to get the route for a search page. * * @param integer $f The search filter id. [optional] * @param string $q The search query string. [optional] * * @return string The search route. * * @since 2.5 */ public static function getSearchRoute($f = null, $q = null) { // Get the menu item id. $query = array('view' => 'search', 'q' => $q, 'f' => $f); $item = self::getItemid($query); // Get the base route. $uri = clone(JUri::getInstance('index.php?option=com_finder&view=search')); // Add the pre-defined search filter if present. if ($f !== null) { $uri->setVar('f', $f); } // Add the search query string if present. if ($q !== null) { $uri->setVar('q', $q); } // Add the menu item id if present. if ($item !== null) { $uri->setVar('Itemid', $item); } return $uri->toString(array('path', 'query')); } /** * Method to get the route for an advanced search page. * * @param integer $f The search filter id. [optional] * @param string $q The search query string. [optional] * * @return string The advanced search route. * * @since 2.5 */ public static function getAdvancedRoute($f = null, $q = null) { // Get the menu item id. $query = array('view' => 'advanced', 'q' => $q, 'f' => $f); $item = self::getItemid($query); // Get the base route. $uri = clone(JUri::getInstance('index.php?option=com_finder&view=advanced')); // Add the pre-defined search filter if present. if ($q !== null) { $uri->setVar('f', $f); } // Add the search query string if present. if ($q !== null) { $uri->setVar('q', $q); } // Add the menu item id if present. if ($item !== null) { $uri->setVar('Itemid', $item); } return $uri->toString(array('path', 'query')); } /** * Method to get the most appropriate menu item for the route based on the * supplied query needles. * * @param array $query An array of URL parameters. * * @return mixed An integer on success, null otherwise. * * @since 2.5 */ public static function getItemid($query) { static $items, $active; // Get the menu items for com_finder. if (!$items || !$active) { $app = JFactory::getApplication('site'); $com = JComponentHelper::getComponent('com_finder'); $menu = $app->getMenu(); $active = $menu->getActive(); $items = $menu->getItems('component_id', $com->id); $items = is_array($items) ? $items : array(); } // Try to match the active view and filter. if ($active && @$active->query['view'] == @$query['view'] && @$active->query['f'] == @$query['f']) { return $active->id; } // Try to match the view, query, and filter. foreach ($items as $item) { if (@$item->query['view'] == @$query['view'] && @$item->query['q'] == @$query['q'] && @$item->query['f'] == @$query['f']) { return $item->id; } } // Try to match the view and filter. foreach ($items as $item) { if (@$item->query['view'] == @$query['view'] && @$item->query['f'] == @$query['f']) { return $item->id; } } // Try to match the view. foreach ($items as $item) { if (@$item->query['view'] == @$query['view']) { return $item->id; } } return null; } } home/academiac/www/components/com_weblinks/helpers/route.php 0000644 00000006551 15137662117 0020401 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_weblinks * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // no direct access defined('_JEXEC') or die; // Component Helper jimport('joomla.application.component.helper'); jimport('joomla.application.categories'); /** * Weblinks Component Route Helper * * @static * @package Joomla.Site * @subpackage com_weblinks * @since 1.5 */ abstract class WeblinksHelperRoute { protected static $lookup; /** * @param int The route of the weblink */ public static function getWeblinkRoute($id, $catid) { $needles = array( 'weblink' => array((int) $id) ); //Create the link $link = 'index.php?option=com_weblinks&view=weblink&id='. $id; if ($catid > 1) { $categories = JCategories::getInstance('Weblinks'); $category = $categories->get($catid); if($category) { $needles['category'] = array_reverse($category->getPath()); $needles['categories'] = $needles['category']; $link .= '&catid='.$catid; } } if ($item = self::_findItem($needles)) { $link .= '&Itemid='.$item; } return $link; } /** * @param int $id The id of the weblink. * @param string $return The return page variable. */ public static function getFormRoute($id, $return = null) { // Create the link. if ($id) { $link = 'index.php?option=com_weblinks&task=weblink.edit&w_id='. $id; } else { $link = 'index.php?option=com_weblinks&task=weblink.add&w_id=0'; } if ($return) { $link .= '&return='.$return; } return $link; } public static function getCategoryRoute($catid) { if ($catid instanceof JCategoryNode) { $id = $catid->id; $category = $catid; } else { $id = (int) $catid; $category = JCategories::getInstance('Weblinks')->get($id); } if ($id < 1 || !($category instanceof JCategoryNode)) { $link = ''; } else { $needles = array(); //Create the link $link = 'index.php?option=com_weblinks&view=category&id='.$id; $catids = array_reverse($category->getPath()); $needles['category'] = $catids; $needles['categories'] = $catids; if ($item = self::_findItem($needles)) { $link .= '&Itemid='.$item; } } return $link; } protected static function _findItem($needles = null) { $app = JFactory::getApplication(); $menus = $app->getMenu('site'); // Prepare the reverse lookup array. if (self::$lookup === null) { self::$lookup = array(); $component = JComponentHelper::getComponent('com_weblinks'); $items = $menus->getItems('component_id', $component->id); if ($items) { foreach ($items as $item) { if (isset($item->query) && isset($item->query['view'])) { $view = $item->query['view']; if (!isset(self::$lookup[$view])) { self::$lookup[$view] = array(); } if (isset($item->query['id'])) { self::$lookup[$view][$item->query['id']] = $item->id; } } } } } if ($needles) { foreach ($needles as $view => $ids) { if (isset(self::$lookup[$view])) { foreach($ids as $id) { if (isset(self::$lookup[$view][(int)$id])) { return self::$lookup[$view][(int)$id]; } } } } } $active = $menus->getActive(); if ($active) { return $active->id; } return null; } } home/academiac/www/components/com_content/helpers/route.php 0000644 00000010252 15140033075 0020213 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_content * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // no direct access defined('_JEXEC') or die; jimport('joomla.application.component.helper'); jimport('joomla.application.categories'); /** * Content Component Route Helper * * @static * @package Joomla.Site * @subpackage com_content * @since 1.5 */ abstract class ContentHelperRoute { protected static $lookup; protected static $lang_lookup = array(); /** * @param int The route of the content item */ public static function getArticleRoute($id, $catid = 0, $language = 0) { $needles = array( 'article' => array((int) $id) ); //Create the link $link = 'index.php?option=com_content&view=article&id='. $id; if ((int)$catid > 1) { $categories = JCategories::getInstance('Content'); $category = $categories->get((int)$catid); if($category) { $needles['category'] = array_reverse($category->getPath()); $needles['categories'] = $needles['category']; $link .= '&catid='.$catid; } } if ($language && $language != "*" && JLanguageMultilang::isEnabled()) { self::buildLanguageLookup(); if(isset(self::$lang_lookup[$language])) { $link .= '&lang='.self::$lang_lookup[$language]; $needles['language'] = $language; } } if ($item = self::_findItem($needles)) { $link .= '&Itemid='.$item; } return $link; } public static function getCategoryRoute($catid) { if ($catid instanceof JCategoryNode) { $id = $catid->id; $category = $catid; } else { $id = (int) $catid; $category = JCategories::getInstance('Content')->get($id); } if ($id < 1 || !($category instanceof JCategoryNode)) { $link = ''; } else { $needles = array(); $link = 'index.php?option=com_content&view=category&id='.$id; $catids = array_reverse($category->getPath()); $needles['category'] = $catids; $needles['categories'] = $catids; if ($item = self::_findItem($needles)) { $link .= '&Itemid='.$item; } } return $link; } public static function getFormRoute($id) { //Create the link if ($id) { $link = 'index.php?option=com_content&task=article.edit&a_id='. $id; } else { $link = 'index.php?option=com_content&task=article.edit&a_id=0'; } return $link; } protected static function buildLanguageLookup() { if(count(self::$lang_lookup) == 0) { $db = JFactory::getDbo(); $query = $db->getQuery(true) ->select('a.sef AS sef') ->select('a.lang_code AS lang_code') ->from('#__languages AS a'); $db->setQuery($query); $langs = $db->loadObjectList(); foreach ($langs as $lang) { self::$lang_lookup[$lang->lang_code] = $lang->sef; } } } 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_content'); $items = $menus->getItems('component_id', $component->id); foreach ($items as $item) { if (isset($item->query) && isset($item->query['view']) && $item->language == $language) { $view = $item->query['view']; if (!isset(self::$lookup[$language][$view])) { self::$lookup[$language][$view] = array(); } if (isset($item->query['id'])) { 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]; } } } } } if ($language != '*') { $needles['language'] = '*'; return self::_findItem($needles); } $active = $menus->getActive(); if ($active && $active->component == 'com_content') { return $active->id; } return null; } } home/academiac/www/components/com_newsfeeds/helpers/route.php 0000644 00000005771 15140044745 0020544 0 ustar 00 <?php /** * @package Joomla.Site * @subpackage com_newsfeeds * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // no direct access defined('_JEXEC') or die; // Component Helper jimport('joomla.application.component.helper'); jimport('joomla.application.categories'); /** * Newsfeeds Component Route Helper * * @package Joomla.Site * @subpackage com_newsfeeds * @since 1.5 */ abstract class NewsfeedsHelperRoute { protected static $lookup; /** * @param int The route of the newsfeed */ public static function getNewsfeedRoute($id, $catid) { $needles = array( 'newsfeed' => array((int) $id) ); //Create the link $link = 'index.php?option=com_newsfeeds&view=newsfeed&id='. $id; if ((int)$catid > 1) { $categories = JCategories::getInstance('Newsfeeds'); $category = $categories->get((int)$catid); if ($category) { //TODO Throw error that the category either not exists or is unpublished $needles['category'] = array_reverse($category->getPath()); $needles['categories'] = $needles['category']; $link .= '&catid='.$catid; } } if ($item = self::_findItem($needles)) { $link .= '&Itemid='.$item; } return $link; } public static function getCategoryRoute($catid) { if ($catid instanceof JCategoryNode) { $id = $catid->id; $category = $catid; } else { $id = (int) $catid; $category = JCategories::getInstance('Newsfeeds')->get($id); } if ($id < 1 || !($category instanceof JCategoryNode)) { $link = ''; } else { $needles = array(); //Create the link $link = 'index.php?option=com_newsfeeds&view=category&id='.$id; $catids = array_reverse($category->getPath()); $needles['category'] = $catids; $needles['categories'] = $catids; if ($item = self::_findItem($needles)) { $link .= '&Itemid='.$item; } } return $link; } protected static function _findItem($needles = null) { $app = JFactory::getApplication(); $menus = $app->getMenu('site'); // Prepare the reverse lookup array. if (self::$lookup === null) { self::$lookup = array(); $component = JComponentHelper::getComponent('com_newsfeeds'); $items = $menus->getItems('component_id', $component->id); foreach ($items as $item) { if (isset($item->query) && isset($item->query['view'])) { $view = $item->query['view']; if (!isset(self::$lookup[$view])) { self::$lookup[$view] = array(); } if (isset($item->query['id'])) { self::$lookup[$view][$item->query['id']] = $item->id; } } } } if ($needles) { foreach ($needles as $view => $ids) { if (isset(self::$lookup[$view])) { foreach($ids as $id) { if (isset(self::$lookup[$view][(int)$id])) { return self::$lookup[$view][(int)$id]; } } } } } $active = $menus->getActive(); if ($active) { return $active->id; } return null; } }
©
2018.