Source code for file /joomla/methods.php
Documentation is available at methods.php
* @version $Id: methods.php 10707 2008-08-21 09:52:47Z eddieajau $
* @package Joomla.Framework
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
// Check to ensure this file is within the rest of the framework
* @package Joomla.Framework
* 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 int $ssl Secure state for the resolved URI
* 1: Make URI secure using global secure site URI
* 0: Leave URI in the same secure state as it was passed to the function
* -1: Make URI unsecure using the global unsecure site URI
* @return The translated humanly readible URL
function _($url, $xhtml =
true, $ssl =
null)
$router =
&$app->getRouter();
// Make sure that we have our router
if ( (strpos($url, '&') !==
0 ) &&
(strpos($url, 'index.php') !==
0) ) {
$uri =
&$router->build($url);
$url =
$uri->toString(array('path', 'query', 'fragment'));
* 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'));
//$prefix .= JURI::base(true);
// Determine which scheme we want
$scheme =
( $ssl ===
1 ) ?
'https' :
'http';
// Make sure our url path begins with a slash
$url =
$scheme .
'://' .
$prefix .
$url;
* @package Joomla.Framework
* Translates a string into the current language
* @param string $string The string to translate
* @param boolean $jsSafe Make the result javascript safe
function _($string, $jsSafe =
false)
return $lang->_($string, $jsSafe);
* Passes a string thru an sprintf
* @param format The format string
* @param mixed Mixed number of arguments for the sprintf function
$args[0] =
$lang->_($args[0]);
* Passes a string thru an printf
* @param format The format string
* @param mixed Mixed number of arguments for the sprintf function
$args[0] =
$lang->_($args[0]);