JApplication
Base class for a Joomla! application.
Acts as a Factory class for application specific objects and provides many supporting API functions. Derived clases should supply the route(), dispatch() and render() functions.
Located in /libraries/joomla/application/application.php (line 28)
JObject (Subpackage Base)
![]()
JApplication (Subpackage Application)
The
getUserStateFromRequest
(string $key, string $request, [string $default = null], [string $type = 'none'])
void
redirect
(string $url, [string $msg = ''], [string $msgType = 'message'], [boolean $moved = false])
integer
$clientId
= null (line 36)
The client identifier.
array
$instances
= array() (line 117)
array
$messageQueue
= array() (line 53)
The application message queue.
array
$name
= null (line 70)
The name of the application.
date
$requestTime
= null (line 95)
The time the request was made.
string
$scope
= null (line 87)
The scope of the application.
integer
$startTime
= null (line 103)
The time the request was made as Unix timestamp.
integer
$_clientId
= null (line 45)
The client identifier.
array
$_messageQueue
= array() (line 62)
The application message queue.
array
$_name
= null (line 79)
The name of the application.
Inherited Variables
Inherited from JObject
JObject::$_errors
Class constructor.
- array $config: A configuration array including optional elements such as session session_name, clientId and others. This is not exhaustive.
- JObject::__construct()
- Class constructor, overridden in descendant classes.
Checks the user session.
If the session record doesn't exist, initialise it. If session is new, create session variables
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.
- string $component: The component to dispatch.
Enqueue a system message.
- string $msg: The message to enqueue.
- string $type: The message type. Default is message.
Gets a configuration value.
An example is in application/japplication-getcfg.php Getting a configuration
- string $varname: The name of the value to get.
- string $default: Default value to return
Gets the client id of the current running application.
Provides a secure hash based on a seed
- string $seed: Seed string.
Returns the global JApplication object, only creating it if it doesn't already exist.
- mixed $client: A client identifier or name.
- array $config: An optional associative array of configuration settings.
- string $prefix: A prefix for class names
Returns the application JPathway object.
- string $name: The name of the application/client.
- array $options: An optional associative array of configuration settings.
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.
Returns the application JPathway object.
- string $name: The name of the application.
- array $options: An optional associative array of configuration settings.
Returns the application JRouter object.
- string $name: The name of the application.
- array $options: An optional associative array of configuration settings.
Gets the name of the current template.
- array $params: An optional associative array of configuration settings
Gets a user state.
- string $key: The path of the state.
- mixed $default: Optional default value, returned if the internal value is null.
Gets the value of a user state variable.
- string $key: The key of the user state variable.
- string $request: The name of the variable passed in a request.
- string $default: The default value for the variable if not found. Optional.
- string $type: Filter for the variable, for valid values see JFilterInput::clean(). Optional.
Initialise the application.
- array $options: An optional associative array of configuration settings.
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.
- array $credentials: Array('username' => string, 'password' => string)
- array $options: Array('remember' => boolean)
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.
- integer $userid: The user to load - Can be an integer or string - If string, it is converted to ID automatically
- array $options: Array('clientid' => array of client id's)
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.
- string $url: The URL to redirect to. Can only be http/https URL
- string $msg: An optional message to display on redirect.
- string $msgType: An optional message type. Defaults to message.
- boolean $moved: True if the page is 301 Permanently Moved, otherwise 303 See Other is assumed.
Registers a handler to a particular event group.
- string $event: The event name.
- mixed $handler: The handler, a function or an instance of a event object.
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.
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.
Sets the value of a user state variable.
- string $key: The path of the state.
- string $value: The value of the variable.
This method transliterates a string into an URL safe string or returns a URL safe UTF-8 string based on the global configuration
- string $string: String to process
Calls all handlers associated with an event group.
- string $event: The event name.
- array $args: An array of arguments.
Create the configuration registry.
- string $file: The path to the configuration file
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.
- string $name: The sessions name.
Returns the response as a string.
- JObject::__toString()
- Magic method to convert the object to a string gracefully.
Inherited Methods
Inherited From JObject
JObject::__construct()
JObject::def()
JObject::get()
JObject::getError()
JObject::getErrors()
JObject::getProperties()
JObject::set()
JObject::setError()
JObject::setProperties()
JObject::toString()
JObject::__toString()

static
static