Joomla Platform  13.1
Documentation des API du framework Joomla Platform
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
Référence de la classe JApplication
+ Graphe d'héritage de JApplication:
+ Graphe de collaboration de JApplication:

Liste de tous les membres

Fonctions membres publiques

 __construct ($config=array())
 initialise ($options=array())
 route ()
 dispatch ($component=null)
 render ()
 redirect ($url, $msg= '', $msgType= 'message', $moved=false)
 enqueueMessage ($msg, $type= 'message')
 getMessageQueue ()
 getCfg ($varname, $default=null)
 getName ()
 getUserState ($key, $default=null)
 setUserState ($key, $value)
 getUserStateFromRequest ($key, $request, $default=null, $type= 'none')
 login ($credentials, $options=array())
 logout ($userid=null, $options=array())
 getTemplate ($params=false)
 getPathway ($name=null, $options=array())
 getMenu ($name=null, $options=array())
 checkSession ()
 afterSessionStart ()
 getClientId ()
 isAdmin ()
 isSite ()
 isSSLConnection ()
 __toString ()
- Fonctions membres publiques inherited from JApplicationBase
 close ($code=0)
 getIdentity ()
 registerEvent ($event, $handler)
 triggerEvent ($event, array $args=null)
 loadDispatcher (JEventDispatcher $dispatcher=null)
 loadIdentity (JUser $identity=null)

Fonctions membres publiques statiques

static getInstance ($client, $config=array(), $prefix= 'J')
static getRouter ($name=null, array $options=array())
static stringURLSafe ($string)
static getHash ($seed)
static isWinOS ()

Attributs publics

 $scope = null
 $requestTime = null
 $startTime = null
 $client
- Attributs publics inherited from JApplicationBase
 $input = null

Fonctions membres protégées

 _createConfiguration ($file)
 _createSession ($name)

Attributs protégés

 $_clientId = null
 $_messageQueue = array()
 $_name = null
 $useStrongEncryption = false
- Attributs protégés inherited from JApplicationBase
 $dispatcher
 $identity

Attributs protégés statiques

static $instances = array()

Description détaillée

Définition à la ligne 26 du fichier application.php.


Documentation des constructeurs et destructeur

JApplication::__construct (   $config = array())

Class constructor.

Paramètres:
array$configA configuration array including optional elements such as session session_name, clientId and others. This is not exhaustive.
Depuis:
11.1
Obsolète:
4.0

Définition à la ligne 113 du fichier application.php.

Références JProfiler\getmicrotime().

{
// Set the view name.
$this->_name = $this->getName();
// Only set the clientId if available.
if (isset($config['clientId']))
{
$this->_clientId = $config['clientId'];
}
// Enable sessions by default.
if (!isset($config['session']))
{
$config['session'] = true;
}
// Create the input object
$this->input = new JInput;
$this->client = new JApplicationWebClient;
$this->loadDispatcher();
// Set the session default name.
if (!isset($config['session_name']))
{
$config['session_name'] = $this->_name;
}
// Set the default configuration file.
if (!isset($config['config_file']))
{
$config['config_file'] = 'configuration.php';
}
// Create the configuration object.
if (file_exists(JPATH_CONFIGURATION . '/' . $config['config_file']))
{
$this->_createConfiguration(JPATH_CONFIGURATION . '/' . $config['config_file']);
}
// Create the session if a session name is passed.
if ($config['session'] !== false)
{
$this->_createSession(self::getHash($config['session_name']));
}
$this->requestTime = gmdate('Y-m-d H:i');
// Used by task system to ensure that the system doesn't go over time.
$this->startTime = JProfiler::getmicrotime();
}

+ Voici le graphe d'appel pour cette fonction :


Documentation des fonctions membres

JApplication::__toString ( )

Returns the response as a string.

Renvoie:
string The response
Depuis:
11.1
Obsolète:
4.0

Définition à la ligne 1200 du fichier application.php.

Références JResponse\toString().

{
$compress = $this->getCfg('gzip', false);
return JResponse::toString($compress);
}

+ Voici le graphe d'appel pour cette fonction :

JApplication::_createConfiguration (   $file)
protected

Create the configuration registry.

Paramètres:
string$fileThe path to the configuration file
Renvoie:
JConfig A JConfig object
Depuis:
11.1
Obsolète:
4.0

Définition à la ligne 952 du fichier application.php.

Références JFactory\getConfig(), et JLoader\register().

{
JLoader::register('JConfig', $file);
// Create the JConfig object.
$config = new JConfig;
// Get the global configuration object.
$registry = JFactory::getConfig();
// Load the configuration values into the registry.
$registry->loadObject($config);
return $config;
}

+ Voici le graphe d'appel pour cette fonction :

JApplication::_createSession (   $name)
protected

Create the user session.

Old sessions are flushed based on the configuration value for the cookie lifetime. If an existing session, then the last access time is updated. If a new session, a session id is generated and a record is created in the #__sessions table.

Paramètres:
string$nameThe sessions name.
Renvoie:
JSession JSession on success. May call exit() on database error.
Depuis:
11.1
Obsolète:
4.0

Définition à la ligne 983 du fichier application.php.

Références JFactory\getDbo(), et JFactory\getSession().

{
$options = array();
$options['name'] = $name;
switch ($this->_clientId)
{
case 0:
if ($this->getCfg('force_ssl') == 2)
{
$options['force_ssl'] = true;
}
break;
case 1:
if ($this->getCfg('force_ssl') >= 1)
{
$options['force_ssl'] = true;
}
break;
}
$this->registerEvent('onAfterSessionStart', array($this, 'afterSessionStart'));
$session = JFactory::getSession($options);
$session->initialise($this->input, $this->dispatcher);
$session->start();
// TODO: At some point we need to get away from having session data always in the db.
// Remove expired sessions from the database.
$time = time();
if ($time % 2)
{
// The modulus introduces a little entropy, making the flushing less accurate
// but fires the query less than half the time.
$query = $db->getQuery(true)
->delete($db->quoteName('#__session'))
->where($db->quoteName('time') . ' < ' . $db->quote((int) ($time - $session->getExpire())));
$db->setQuery($query);
$db->execute();
}
// Check to see the the session already exists.
$handler = $this->getCfg('session_handler');
if (($handler != 'database' && ($time % 2 || $session->isNew()))
|| ($handler == 'database' && $session->isNew()))
{
$this->checkSession();
}
return $session;
}

+ Voici le graphe d'appel pour cette fonction :

JApplication::afterSessionStart ( )

After the session has been started we need to populate it with some default values.

Renvoie:
void
Depuis:
12.2
Obsolète:
4.0

Définition à la ligne 1114 du fichier application.php.

Références JFactory\getSession().

{
$session = JFactory::getSession();
if ($session->isNew())
{
$session->set('registry', new JRegistry('session'));
$session->set('user', new JUser);
}
}

+ Voici le graphe d'appel pour cette fonction :

JApplication::checkSession ( )

Checks the user session.

If the session record doesn't exist, initialise it. If session is new, create session variables

Renvoie:
void
Depuis:
11.1
Obsolète:
4.0

Définition à la ligne 1053 du fichier application.php.

Références JFactory\getDbo(), JFactory\getSession(), JFactory\getUser(), et jexit().

{
$session = JFactory::getSession();
$user = JFactory::getUser();
$query = $db->getQuery(true)
->select($db->quoteName('session_id'))
->from($db->quoteName('#__session'))
->where($db->quoteName('session_id') . ' = ' . $db->quote($session->getId()));
$db->setQuery($query, 0, 1);
$exists = $db->loadResult();
// If the session record doesn't exist initialise it.
if (!$exists)
{
$query->clear();
if ($session->isNew())
{
$query->insert($db->quoteName('#__session'))
->columns($db->quoteName('session_id') . ', ' . $db->quoteName('client_id') . ', ' . $db->quoteName('time'))
->values($db->quote($session->getId()) . ', ' . (int) $this->getClientId() . ', ' . $db->quote((int) time()));
$db->setQuery($query);
}
else
{
$query->insert($db->quoteName('#__session'))
->columns(
$db->quoteName('session_id') . ', ' . $db->quoteName('client_id') . ', ' . $db->quoteName('guest') . ', ' .
$db->quoteName('time') . ', ' . $db->quoteName('userid') . ', ' . $db->quoteName('username')
)
->values(
$db->quote($session->getId()) . ', ' . (int) $this->getClientId() . ', ' . (int) $user->get('guest') . ', ' .
$db->quote((int) $session->get('session.timer.start')) . ', ' . (int) $user->get('id') . ', ' . $db->quote($user->get('username'))
);
$db->setQuery($query);
}
// If the insert failed, exit the application.
try
{
$db->execute();
}
catch (RuntimeException $e)
{
jexit($e->getMessage());
}
}
}

+ Voici le graphe d'appel pour cette fonction :

JApplication::dispatch (   $component = null)

Dispatch the application.

Dispatching is the process of pulling the option from the request object and mapping them to a component. If the component does not exist, it handles determining a default component to dispatch.

Paramètres:
string$componentThe component to dispatch.
Renvoie:
void
Depuis:
11.1
Obsolète:
4.0

Définition à la ligne 285 du fichier application.php.

Références JFactory\getDocument().

{
$document = JFactory::getDocument();
$contents = JComponentHelper::renderComponent($component);
$document->setBuffer($contents, 'component');
// Trigger the onAfterDispatch event.
JPluginHelper::importPlugin('system');
$this->triggerEvent('onAfterDispatch');
}

+ Voici le graphe d'appel pour cette fonction :

JApplication::enqueueMessage (   $msg,
  $type = 'message' 
)

Enqueue a system message.

Paramètres:
string$msgThe message to enqueue.
string$typeThe message type. Default is message.
Renvoie:
void
Depuis:
11.1
Obsolète:
4.0

Définition à la ligne 443 du fichier application.php.

{
// For empty queue, if messages exists in the session, enqueue them first.
if (!count($this->_messageQueue))
{
$session = JFactory::getSession();
$sessionQueue = $session->get('application.queue');
if (count($sessionQueue))
{
$this->_messageQueue = $sessionQueue;
$session->set('application.queue', null);
}
}
// Enqueue the message.
$this->_messageQueue[] = array('message' => $msg, 'type' => strtolower($type));
}
JApplication::getCfg (   $varname,
  $default = null 
)

Gets a configuration value.

An example is in application/japplication-getcfg.php Getting a configuration

Paramètres:
string$varnameThe name of the value to get.
string$defaultDefault value to return
Renvoie:
mixed The user state.
Depuis:
11.1
Obsolète:
4.0

Définition à la ligne 501 du fichier application.php.

{
$config = JFactory::getConfig();
return $config->get('' . $varname, $default);
}
JApplication::getClientId ( )

Gets the client id of the current running application.

Renvoie:
integer A client identifier.
Depuis:
11.1
Obsolète:
4.0

Définition à la ligne 1133 du fichier application.php.

{
}
static JApplication::getHash (   $seed)
static

Provides a secure hash based on a seed

Paramètres:
string$seedSeed string.
Renvoie:
string A secure hash
Depuis:
11.1
Obsolète:
4.0 Use JApplicationHelper::getHash instead

Définition à la ligne 937 du fichier application.php.

Référencé par JSession\getFormToken().

{
}

+ Voici le graphe des appelants de cette fonction :

static JApplication::getInstance (   $client,
  $config = array(),
  $prefix = 'J' 
)
static

Returns the global JApplicationCms object, only creating it if it doesn't already exist.

Paramètres:
mixed$clientA client identifier or name.
array$configAn optional associative array of configuration settings.
string$prefixA prefix for class names
Renvoie:
JApplicationCms A JApplicationCms object.
Depuis:
11.1
Obsolète:
4.0 Use JApplicationCms::getInstance() instead
Note:
As of 3.2, this proxies to JApplicationCms::getInstance()

Définition à la ligne 181 du fichier application.php.

JApplication::getMenu (   $name = null,
  $options = array() 
)

Returns the application JPathway object.

Paramètres:
string$nameThe name of the application/client.
array$optionsAn optional associative array of configuration settings.
Renvoie:
JMenu JMenu object.
Depuis:
11.1
Obsolète:
4.0

Définition à la ligne 908 du fichier application.php.

{
if (!isset($name))
{
$name = $this->_name;
}
try
{
$menu = JMenu::getInstance($name, $options);
}
catch (Exception $e)
{
return null;
}
return $menu;
}
JApplication::getMessageQueue ( )

Get the system message queue.

Renvoie:
array The system message queue.
Depuis:
11.1
Obsolète:
4.0

Définition à la ligne 470 du fichier application.php.

{
// For empty queue, if messages exists in the session, enqueue them.
if (!count($this->_messageQueue))
{
$session = JFactory::getSession();
$sessionQueue = $session->get('application.queue');
if (count($sessionQueue))
{
$this->_messageQueue = $sessionQueue;
$session->set('application.queue', null);
}
}
}
JApplication::getName ( )

Method to get the application name.

The dispatcher name is by default parsed using the classname, or it can be set by passing a $config['name'] in the class constructor.

Renvoie:
string The name of the dispatcher.
Depuis:
11.1
Obsolète:
4.0

Définition à la ligne 519 du fichier application.php.

{
$name = $this->_name;
if (empty($name))
{
$r = null;
if (!preg_match('/J(.*)/i', get_class($this), $r))
{
JLog::add(JText::_('JLIB_APPLICATION_ERROR_APPLICATION_GET_NAME'), JLog::WARNING, 'jerror');
}
$name = strtolower($r[1]);
}
return $name;
}
JApplication::getPathway (   $name = null,
  $options = array() 
)

Returns the application JPathway object.

Paramètres:
string$nameThe name of the application.
array$optionsAn optional associative array of configuration settings.
Renvoie:
JPathway A JPathway object
Depuis:
11.1
Obsolète:
4.0

Définition à la ligne 878 du fichier application.php.

{
if (!isset($name))
{
$name = $this->_name;
}
try
{
$pathway = JPathway::getInstance($name, $options);
}
catch (Exception $e)
{
return null;
}
return $pathway;
}
static JApplication::getRouter (   $name = null,
array  $options = array() 
)
static

Returns the application JRouter object.

Paramètres:
string$nameThe name of the application.
array$optionsAn optional associative array of configuration settings.
Renvoie:
JRouter A JRouter object
Depuis:
11.1
Obsolète:
4.0

Définition à la ligne 830 du fichier application.php.

Références JFactory\getApplication().

{
if (!isset($name))
{
$name = $app->getName();
}
try
{
$router = JRouter::getInstance($name, $options);
}
catch (Exception $e)
{
return null;
}
return $router;
}

+ Voici le graphe d'appel pour cette fonction :

JApplication::getTemplate (   $params = false)

Gets the name of the current template.

Paramètres:
boolean$paramsAn optional associative array of configuration settings
Renvoie:
mixed System is the fallback.
Depuis:
11.1
Obsolète:
4.0

Définition à la ligne 804 du fichier application.php.

{
$template = new stdClass;
$template->template = 'system';
$template->params = new JRegistry;
if ($params)
{
return $template;
}
return $template->template;
}
JApplication::getUserState (   $key,
  $default = null 
)

Gets a user state.

Paramètres:
string$keyThe path of the state.
mixed$defaultOptional default value, returned if the internal value is null.
Renvoie:
mixed The user state or null.
Depuis:
11.1
Obsolète:
4.0

Définition à la ligne 549 du fichier application.php.

{
$session = JFactory::getSession();
$registry = $session->get('registry');
if (!is_null($registry))
{
return $registry->get($key, $default);
}
return $default;
}
JApplication::getUserStateFromRequest (   $key,
  $request,
  $default = null,
  $type = 'none' 
)

Gets the value of a user state variable.

Paramètres:
string$keyThe key of the user state variable.
string$requestThe name of the variable passed in a request.
string$defaultThe default value for the variable if not found. Optional.
string$typeFilter for the variable, for valid values see JFilterInput::clean(). Optional.
Renvoie:
The request user state.
Depuis:
11.1
Obsolète:
4.0

Définition à la ligne 599 du fichier application.php.

{
$cur_state = $this->getUserState($key, $default);
$new_state = $this->input->get($request, null, $type);
// Save the new value only if it was set in this request.
if ($new_state !== null)
{
$this->setUserState($key, $new_state);
}
else
{
$new_state = $cur_state;
}
return $new_state;
}
JApplication::initialise (   $options = array())

Initialise the application.

Paramètres:
array$optionsAn optional associative array of configuration settings.
Renvoie:
void
Depuis:
11.1
Obsolète:
4.0

Définition à la ligne 196 du fichier application.php.

Références JFactory\getConfig(), JFactory\getUser(), et JRegistry\loadString().

{
// Set the language in the class.
$config = JFactory::getConfig();
// Check that we were given a language in the array (since by default may be blank).
if (isset($options['language']))
{
$config->set('language', $options['language']);
}
// Set user specific editor.
$user = JFactory::getUser();
$editor = $user->getParam('editor', $this->getCfg('editor'));
if (!JPluginHelper::isEnabled('editors', $editor))
{
$editor = $this->getCfg('editor');
if (!JPluginHelper::isEnabled('editors', $editor))
{
$editor = 'none';
}
}
$config->set('editor', $editor);
// Set the encryption to use. The availability of strong encryption must always be checked separately.
// Use JCrypt::hasStrongPasswordSupport() to check PHP for this support.
if (JPluginHelper::isEnabled('user', 'joomla'))
{
$userPlugin = JPluginHelper::getPlugin('user', 'joomla');
$userPluginParams = new JRegistry;
$userPluginParams->loadString($userPlugin->params);
$useStrongEncryption = $userPluginParams->get('strong_passwords', 0);
$config->set('useStrongEncryption', $useStrongEncryption);
}
// Trigger the onAfterInitialise event.
JPluginHelper::importPlugin('system');
$this->triggerEvent('onAfterInitialise');
}

+ Voici le graphe d'appel pour cette fonction :

JApplication::isAdmin ( )

Is admin interface?

Renvoie:
boolean True if this application is administrator.
Depuis:
11.1
Obsolète:
4.0

Définition à la ligne 1146 du fichier application.php.

{
return ($this->_clientId == 1);
}
JApplication::isSite ( )

Is site interface?

Renvoie:
boolean True if this application is site.
Depuis:
11.1
Obsolète:
4.0

Définition à la ligne 1159 du fichier application.php.

{
return ($this->_clientId == 0);
}
JApplication::isSSLConnection ( )

Determine if we are using a secure (SSL) connection.

Renvoie:
boolean True if using SSL, false if not.
Depuis:
12.2
Obsolète:
4.0

Définition à la ligne 1187 du fichier application.php.

{
return ((isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == 'on')) || getenv('SSL_PROTOCOL_VERSION'));
}
static JApplication::isWinOS ( )
static

Method to determine if the host OS is Windows

Renvoie:
boolean True if Windows OS
Depuis:
11.1
Obsolète:
13.3 (Platform) & 4.0 (CMS) Use the IS_WIN constant instead.

Définition à la ligne 1172 du fichier application.php.

Références JLog\add(), et JLog\WARNING.

{
JLog::add('JApplication::isWinOS() is deprecated. Use the IS_WIN constant instead.', JLog::WARNING, 'deprecated');
return IS_WIN;
}

+ Voici le graphe d'appel pour cette fonction :

JApplication::login (   $credentials,
  $options = array() 
)

Login authentication function.

Username and encoded password are passed the onUserLogin event which is responsible for the user validation. A successful validation updates the current session record with the user's details.

Username and encoded password are sent as credentials (along with other possibilities) to each observer (authentication plugin) for user validation. Successful validation will update the current session with the user details.

Paramètres:
array$credentialsArray('username' => string, 'password' => string)
array$optionsArray('remember' => boolean)
Renvoie:
boolean True on success.
Depuis:
11.1
Obsolète:
4.0

Définition à la ligne 637 du fichier application.php.

{
// Get the global JAuthentication object.
jimport('joomla.user.authentication');
$authenticate = JAuthentication::getInstance();
$response = $authenticate->authenticate($credentials, $options);
if ($response->status === JAuthentication::STATUS_SUCCESS)
{
// Validate that the user should be able to login (different to being authenticated).
// This permits authentication plugins blocking the user
$authorisations = $authenticate->authorise($response, $options);
foreach ($authorisations as $authorisation)
{
if (in_array($authorisation->status, $denied_states))
{
// Trigger onUserAuthorisationFailure Event.
$this->triggerEvent('onUserAuthorisationFailure', array((array) $authorisation));
// If silent is set, just return false.
if (isset($options['silent']) && $options['silent'])
{
return false;
}
// Return the error.
switch ($authorisation->status)
{
return JError::raiseWarning('102002', JText::_('JLIB_LOGIN_EXPIRED'));
break;
return JError::raiseWarning('102003', JText::_('JLIB_LOGIN_DENIED'));
break;
default:
return JError::raiseWarning('102004', JText::_('JLIB_LOGIN_AUTHORISATION'));
break;
}
}
}
// Import the user plugin group.
JPluginHelper::importPlugin('user');
// OK, the credentials are authenticated and user is authorised. Let's fire the onLogin event.
$results = $this->triggerEvent('onUserLogin', array((array) $response, $options));
/*
* If any of the user plugins did not successfully complete the login routine
* then the whole method fails.
*
* Any errors raised should be done in the plugin as this provides the ability
* to provide much more information about why the routine may have failed.
*/
$user = JFactory::getUser();
if ($response->type == 'Cookie')
{
$user->set('cookieLogin', true);
}
if (in_array(false, $results, true) == false)
{
$options['user'] = $user;
$options['responseType'] = $response->type;
if (isset($response->length) && isset($response->secure) && isset($response->lifetime))
{
$options['length'] = $response->length;
$options['secure'] = $response->secure;
$options['lifetime'] = $response->lifetime;
}
// The user is successfully logged in. Run the after login events
$this->triggerEvent('onUserAfterLogin', array($options));
}
return true;
}
// Trigger onUserLoginFailure Event.
$this->triggerEvent('onUserLoginFailure', array((array) $response));
// If silent is set, just return false.
if (isset($options['silent']) && $options['silent'])
{
return false;
}
// If status is success, any error will have been raised by the user plugin
if ($response->status !== JAuthentication::STATUS_SUCCESS)
{
JLog::add($response->error_message, JLog::WARNING, 'jerror');
}
return false;
}
JApplication::logout (   $userid = null,
  $options = array() 
)

Logout authentication function.

Passed the current user information to the onUserLogout event and reverts the current session record back to 'anonymous' parameters. If any of the authentication plugins did not successfully complete the logout routine then the whole method fails. Any errors raised should be done in the plugin as this provides the ability to give much more information about why the routine may have failed.

Paramètres:
integer$useridThe user to load - Can be an integer or string - If string, it is converted to ID automatically
array$optionsArray('clientid' => array of client id's)
Renvoie:
boolean True on success
Depuis:
11.1
Obsolète:
4.0

Définition à la ligne 759 du fichier application.php.

Références JFactory\getUser().

{
// Get a user object from the JApplication.
$user = JFactory::getUser($userid);
// Build the credentials array.
$parameters['username'] = $user->get('username');
$parameters['id'] = $user->get('id');
// Set clientid in the options array if it hasn't been set already.
if (!isset($options['clientid']))
{
$options['clientid'] = $this->getClientId();
}
// Import the user plugin group.
JPluginHelper::importPlugin('user');
// OK, the credentials are built. Lets fire the onLogout event.
$results = $this->triggerEvent('onUserLogout', array($parameters, $options));
if (!in_array(false, $results, true))
{
$options['username'] = $user->get('username');
$results = $this->triggerEvent('onUserAfterLogout', array($options));
return true;
}
// Trigger onUserLoginFailure Event.
$this->triggerEvent('onUserLogoutFailure', array($parameters));
return false;
}

+ Voici le graphe d'appel pour cette fonction :

JApplication::redirect (   $url,
  $msg = '',
  $msgType = 'message',
  $moved = false 
)

Redirect to another URL.

Optionally enqueues a message in the system message queue (which will be displayed the next time a page is loaded) using the enqueueMessage method. If the headers have not been sent the redirect will be accomplished using a "301 Moved Permanently" code in the header pointing to the new location. If the headers have already been sent this will be accomplished using a JavaScript statement.

Paramètres:
string$urlThe URL to redirect to. Can only be http/https URL
string$msgAn optional message to display on redirect.
string$msgTypeAn optional message type. Defaults to message.
boolean$movedTrue if the page is 301 Permanently Moved, otherwise 303 See Other is assumed.
Renvoie:
void Calls exit().
Depuis:
11.1
Obsolète:
4.0
Voir également:
JApplication::enqueueMessage()

Définition à la ligne 352 du fichier application.php.

Références JUri\base(), JFactory\getDocument(), JUri\getInstance(), JFactory\getSession(), jimport(), JApplicationWebClient\TRIDENT, et utf8_is_ascii().

{
// Check for relative internal links.
if (preg_match('#^index2?\.php#', $url))
{
$url = JUri::base() . $url;
}
// Strip out any line breaks.
$url = preg_split("/[\r\n]/", $url);
$url = $url[0];
/*
* If we don't start with a http we need to fix this before we proceed.
* We could validly start with something else (e.g. ftp), though this would
* be unlikely and isn't supported by this API.
*/
if (!preg_match('#^http#i', $url))
{
$prefix = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
if ($url[0] == '/')
{
// We just need the prefix since we have a path relative to the root.
$url = $prefix . $url;
}
else
{
// It's relative to where we are now, so lets add that.
$parts = explode('/', $uri->toString(array('path')));
array_pop($parts);
$path = implode('/', $parts) . '/';
$url = $prefix . $path . $url;
}
}
// If the message exists, enqueue it.
if (trim($msg))
{
$this->enqueueMessage($msg, $msgType);
}
// Persist messages if they exist.
if (count($this->_messageQueue))
{
$session = JFactory::getSession();
$session->set('application.queue', $this->_messageQueue);
}
// If the headers have been sent, then we cannot send an additional location header
// so we will output a javascript redirect statement.
if (headers_sent())
{
echo "<script>document.location.href='" . str_replace("'", "&apos;", $url) . "';</script>\n";
}
else
{
$document = JFactory::getDocument();
jimport('phputf8.utils.ascii');
if (($this->client->engine == JApplicationWebClient::TRIDENT) && !utf8_is_ascii($url))
{
// MSIE type browser and/or server cause issues when url contains utf8 character,so use a javascript redirect method
echo '<html><head><meta http-equiv="content-type" content="text/html; charset=' . $document->getCharset() . '" />'
. '<script>document.location.href=\'' . str_replace("'", "&apos;", $url) . '\';</script></head></html>';
}
else
{
// All other browsers, use the more efficient HTTP header method
header($moved ? 'HTTP/1.1 301 Moved Permanently' : 'HTTP/1.1 303 See other');
header('Location: ' . $url);
header('Content-Type: text/html; charset=' . $document->getCharset());
}
}
$this->close();
}

+ Voici le graphe d'appel pour cette fonction :

JApplication::render ( )

Render the application.

Rendering is the process of pushing the document buffers into the template placeholders, retrieving data from the document and pushing it into the JResponse buffer.

Renvoie:
void
Depuis:
11.1
Obsolète:
4.0

Définition à la ligne 309 du fichier application.php.

Références JFactory\getDocument(), et JResponse\setBody().

{
$template = $this->getTemplate(true);
$params = array('template' => $template->template, 'file' => 'index.php', 'directory' => JPATH_THEMES, 'params' => $template->params);
// Parse the document.
$document = JFactory::getDocument();
$document->parse($params);
// Trigger the onBeforeRender event.
JPluginHelper::importPlugin('system');
$this->triggerEvent('onBeforeRender');
// Render the document.
$caching = ($this->getCfg('caching') >= 2) ? true : false;
JResponse::setBody($document->render($caching, $params));
// Trigger the onAfterRender event.
$this->triggerEvent('onAfterRender');
}

+ Voici le graphe d'appel pour cette fonction :

JApplication::route ( )

Route the application.

Routing is the process of examining the request environment to determine which component should receive the request. The component optional parameters are then set in the request object to be processed when the application is being dispatched.

Renvoie:
void
Depuis:
11.1
Obsolète:
4.0

Définition à la ligne 253 du fichier application.php.

Références JUri\getInstance().

{
// Get the full request URI.
$uri = clone JUri::getInstance();
$router = $this->getRouter();
$result = $router->parse($uri);
foreach ($result as $key => $value)
{
$this->input->def($key, $value);
}
// Trigger the onAfterRoute event.
JPluginHelper::importPlugin('system');
$this->triggerEvent('onAfterRoute');
}

+ Voici le graphe d'appel pour cette fonction :

JApplication::setUserState (   $key,
  $value 
)

Sets the value of a user state variable.

Paramètres:
string$keyThe path of the state.
string$valueThe value of the variable.
Renvoie:
mixed The previous state, if one existed.
Depuis:
11.1
Obsolète:
4.0

Définition à la ligne 573 du fichier application.php.

{
$session = JFactory::getSession();
$registry = $session->get('registry');
if (!is_null($registry))
{
return $registry->set($key, $value);
}
return null;
}
static JApplication::stringURLSafe (   $string)
static

This method transliterates a string into an URL safe string or returns a URL safe UTF-8 string based on the global configuration

Paramètres:
string$stringString to process
Renvoie:
string Processed string
Depuis:
11.1
Obsolète:
4.0 Use JApplicationHelper::stringURLSafe instead

Définition à la ligne 862 du fichier application.php.

Référencé par JTableMenuType\check(), JTableMenu\check(), JTableCategory\check(), et JTableContent\check().

{
}

+ Voici le graphe des appelants de cette fonction :


Documentation des données membres

JApplication::$_clientId = null
protected

Définition à la ligne 35 du fichier application.php.

JApplication::$_messageQueue = array()
protected

Définition à la ligne 44 du fichier application.php.

JApplication::$_name = null
protected

Définition à la ligne 53 du fichier application.php.

JApplication::$client

Définition à la ligne 87 du fichier application.php.

JApplication::$instances = array()
staticprotected

Définition à la ligne 94 du fichier application.php.

JApplication::$requestTime = null

Définition à la ligne 71 du fichier application.php.

JApplication::$scope = null

Définition à la ligne 62 du fichier application.php.

JApplication::$startTime = null

Définition à la ligne 80 du fichier application.php.

JApplication::$useStrongEncryption = false
protected

Définition à la ligne 102 du fichier application.php.


La documentation de cette classe a été générée à partir du fichier suivant :