Source for file route.php
Documentation is available at route.php
* @package Joomla.Platform
* @subpackage Application
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* @package Joomla.Platform
* @subpackage Application
* The route object so we don't have to keep fetching it.
private static $_router =
null;
* Translates an internal Joomla URL to a humanly readible URL.
* @param string $url Absolute or Relative URI to Joomla resource.
* @param boolean $xhtml Replace & by & for XML compilance.
* @param integer $ssl Secure state for the resolved URI.
* 1: Make URI secure using global secure site URI.
* 2: Make URI unsecure using the global unsecure site URI.
* @return The translated humanly readible URL.
public static function _($url, $xhtml =
true, $ssl =
null)
self::$_router =
JFactory::getApplication()->getRouter();
// Make sure that we have our router
if ((strpos($url, '&') !==
0) &&
(strpos($url, 'index.php') !==
0))
$uri =
self::$_router->build($url);
$url =
$uri->toString(array('path', 'query', 'fragment'));
$url =
preg_replace('/\s/u', '%20', $url);
* Get the secure/unsecure URLs.
* If the first 5 characters of the BASE are 'https', then we are on an ssl connection over
* https and need to set our secure URL to the current request URL, if not, and the scheme is
* 'http', then we need to do a quick string manipulation to switch schemes.
$prefix =
$uri->toString(array('host', 'port'));
// Determine which scheme we want.
$scheme =
((int)
$ssl ===
1) ?
'https' :
'http';
// Make sure our URL path begins with a slash.
$url =
$scheme .
'://' .
$prefix .
$url;
Documentation generated on Tue, 19 Nov 2013 15:12:19 +0100 by phpDocumentor 1.4.3