Class JApplication

Description

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.

  • deprecated: 4.0 Use JApplicationCms instead unless specified otherwise
  • since: 11.1

Located in /libraries/legacy/application/application.php (line 26)

JApplicationBase
   |
   --JApplication
Variable Summary
Method Summary
 static string getHash (string $seed)
 static JApplicationCms getInstance (mixed $client, [array $config = array()], [string $prefix = 'J'])
 static JRouter getRouter ([string $name = null], [array $options = array()])
 static boolean isWinOS ()
 static string stringURLSafe (string $string)
 JApplication __construct ([array $config = array()])
 void checkSession ()
 void dispatch ([string $component = null])
 void enqueueMessage (string $msg, [string $type = 'message'])
 mixed getCfg (string $varname, [string $default = null])
 integer getClientId ()
 JMenu getMenu ([string $name = null], [array $options = array()])
 array getMessageQueue ()
 string getName ()
 JPathway getPathway ([string $name = null], [array $options = array()])
 mixed getTemplate ([boolean $params = false])
 mixed getUserState (string $key, [mixed $default = null])
 The getUserStateFromRequest (string $key, string $request, [string $default = null], [string $type = 'none'])
 void initialise ([array $options = array()])
 boolean isAdmin ()
 boolean isSite ()
 boolean isSSLConnection ()
 boolean login (array $credentials, [array $options = array()])
 boolean logout ([integer $userid = null], [array $options = array()])
 void redirect (string $url, [string $msg = ''], [string $msgType = 'message'], [boolean $moved = false])
 void render ()
 void route ()
 mixed setUserState (string $key, string $value)
 JConfig _createConfiguration (string $file)
 JSession _createSession (string $name)
 string __toString ()
Variables
static array $instances = array() (line 94)
  • var: JApplication instances container.
  • deprecated: 4.0
  • since: 11.3
  • access: protected
JApplicationWebClient $client (line 87)
  • var: The application client object.
  • deprecated: 4.0
  • since: 12.2
  • access: public
date $requestTime = null (line 71)

The time the request was made.

  • deprecated: 4.0
  • since: 11.1
  • access: public
string $scope = null (line 62)

The scope of the application.

  • deprecated: 4.0
  • since: 11.1
  • access: public
integer $startTime = null (line 80)

The time the request was made as Unix timestamp.

  • deprecated: 4.0
  • since: 11.1
  • access: public
boolean $useStrongEncryption = false (line 102)
  • var: Indicates that strong encryption should be used.
  • deprecated: 4.0
  • since: 3.2
  • access: protected
integer $_clientId = null (line 35)

The client identifier.

  • deprecated: 4.0
  • since: 11.1
  • access: protected
array $_messageQueue = array() (line 44)

The application message queue.

  • deprecated: 4.0
  • since: 11.1
  • access: protected
array $_name = null (line 53)

The name of the application.

  • deprecated: 4.0
  • since: 11.1
  • access: protected

Inherited Variables

Inherited from JApplicationBase

JApplicationBase::$dispatcher
JApplicationBase::$identity
JApplicationBase::$input
Methods
static getHash (line 937)

Provides a secure hash based on a seed

  • return: A secure hash
  • deprecated: 4.0 Use JApplicationHelper::getHash instead
  • since: 11.1
  • access: public
static string getHash (string $seed)
  • string $seed: Seed string.
static getInstance (line 181)

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

  • return: A JApplicationCms object.
  • deprecated: 4.0 Use JApplicationCms::getInstance() instead
  • since: 11.1
  • access: public
static JApplicationCms getInstance (mixed $client, [array $config = array()], [string $prefix = 'J'])
  • mixed $client: A client identifier or name.
  • array $config: An optional associative array of configuration settings.
  • string $prefix: A prefix for class names
static getRouter (line 830)

Returns the application JRouter object.

  • return: A JRouter object
  • deprecated: 4.0
  • since: 11.1
  • access: public
static JRouter getRouter ([string $name = null], [array $options = array()])
  • string $name: The name of the application.
  • array $options: An optional associative array of configuration settings.
static isWinOS (line 1172)

Method to determine if the host OS is Windows

  • return: True if Windows OS
  • deprecated: 13.3 (Platform) & 4.0 (CMS) Use the IS_WIN constant instead.
  • since: 11.1
  • access: public
static boolean isWinOS ()
static stringURLSafe (line 862)

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

  • return: Processed string
  • deprecated: 4.0 Use JApplicationHelper::stringURLSafe instead
  • since: 11.1
  • access: public
static string stringURLSafe (string $string)
  • string $string: String to process
Constructor __construct (line 113)

Class constructor.

  • deprecated: 4.0
  • since: 11.1
  • access: public
JApplication __construct ([array $config = array()])
  • array $config: A configuration array including optional elements such as session session_name, clientId and others. This is not exhaustive.
afterSessionStart (line 1114)

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

  • deprecated: 4.0
  • since: 12.2
  • access: public
void afterSessionStart ()
checkSession (line 1053)

Checks the user session.

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

  • deprecated: 4.0
  • since: 11.1
  • access: public
void checkSession ()
dispatch (line 285)

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.

  • deprecated: 4.0
  • since: 11.1
  • access: public
void dispatch ([string $component = null])
  • string $component: The component to dispatch.
enqueueMessage (line 443)

Enqueue a system message.

  • deprecated: 4.0
  • since: 11.1
  • access: public
void enqueueMessage (string $msg, [string $type = 'message'])
  • string $msg: The message to enqueue.
  • string $type: The message type. Default is message.
getCfg (line 501)

Gets a configuration value.

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

  • return: The user state.
  • deprecated: 4.0
  • since: 11.1
  • access: public
mixed getCfg (string $varname, [string $default = null])
  • string $varname: The name of the value to get.
  • string $default: Default value to return
getClientId (line 1133)

Gets the client id of the current running application.

  • return: A client identifier.
  • deprecated: 4.0
  • since: 11.1
  • access: public
integer getClientId ()
getMenu (line 908)

Returns the application JPathway object.

  • return: JMenu object.
  • deprecated: 4.0
  • since: 11.1
  • access: public
JMenu getMenu ([string $name = null], [array $options = array()])
  • string $name: The name of the application/client.
  • array $options: An optional associative array of configuration settings.
getMessageQueue (line 470)

Get the system message queue.

  • return: The system message queue.
  • deprecated: 4.0
  • since: 11.1
  • access: public
array getMessageQueue ()
getName (line 519)

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.

  • return: The name of the dispatcher.
  • deprecated: 4.0
  • since: 11.1
  • access: public
string getName ()
getPathway (line 878)

Returns the application JPathway object.

  • return: A JPathway object
  • deprecated: 4.0
  • since: 11.1
  • access: public
JPathway getPathway ([string $name = null], [array $options = array()])
  • string $name: The name of the application.
  • array $options: An optional associative array of configuration settings.
getTemplate (line 804)

Gets the name of the current template.

  • return: System is the fallback.
  • deprecated: 4.0
  • since: 11.1
  • access: public
mixed getTemplate ([boolean $params = false])
  • boolean $params: An optional associative array of configuration settings
getUserState (line 549)

Gets a user state.

  • return: The user state or null.
  • deprecated: 4.0
  • since: 11.1
  • access: public
mixed getUserState (string $key, [mixed $default = null])
  • string $key: The path of the state.
  • mixed $default: Optional default value, returned if the internal value is null.
getUserStateFromRequest (line 599)

Gets the value of a user state variable.

  • return: request user state.
  • deprecated: 4.0
  • since: 11.1
  • access: public
The getUserStateFromRequest (string $key, string $request, [string $default = null], [string $type = 'none'])
  • 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 (line 196)

Initialise the application.

  • deprecated: 4.0
  • since: 11.1
  • access: public
void initialise ([array $options = array()])
  • array $options: An optional associative array of configuration settings.
isAdmin (line 1146)

Is admin interface?

  • return: True if this application is administrator.
  • deprecated: 4.0
  • since: 11.1
  • access: public
boolean isAdmin ()
isSite (line 1159)

Is site interface?

  • return: True if this application is site.
  • deprecated: 4.0
  • since: 11.1
  • access: public
boolean isSite ()
isSSLConnection (line 1187)

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

  • return: True if using SSL, false if not.
  • deprecated: 4.0
  • since: 12.2
  • access: public
boolean isSSLConnection ()
login (line 637)

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.

  • return: True on success.
  • deprecated: 4.0
  • since: 11.1
  • access: public
boolean login (array $credentials, [array $options = array()])
  • array $credentials: Array('username' => string, 'password' => string)
  • array $options: Array('remember' => boolean)
logout (line 759)

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.

  • return: True on success
  • deprecated: 4.0
  • since: 11.1
  • access: public
boolean logout ([integer $userid = null], [array $options = array()])
  • 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 (line 352)

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.

void redirect (string $url, [string $msg = ''], [string $msgType = 'message'], [boolean $moved = false])
  • 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.
render (line 309)

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.

  • deprecated: 4.0
  • since: 11.1
  • access: public
void render ()
route (line 253)

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.

  • deprecated: 4.0
  • since: 11.1
  • access: public
void route ()
setUserState (line 573)

Sets the value of a user state variable.

  • return: The previous state, if one existed.
  • deprecated: 4.0
  • since: 11.1
  • access: public
mixed setUserState (string $key, string $value)
  • string $key: The path of the state.
  • string $value: The value of the variable.
_createConfiguration (line 952)

Create the configuration registry.

  • return: A JConfig object
  • deprecated: 4.0
  • since: 11.1
  • access: protected
JConfig _createConfiguration (string $file)
  • string $file: The path to the configuration file
_createSession (line 983)

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.

  • return: JSession on success. May call exit() on database error.
  • deprecated: 4.0
  • since: 11.1
  • access: protected
JSession _createSession (string $name)
  • string $name: The sessions name.
__toString (line 1200)

Returns the response as a string.

  • return: The response
  • deprecated: 4.0
  • since: 11.1
  • access: public
string __toString ()

Inherited Methods

Inherited From JApplicationBase

 JApplicationBase::close()
 JApplicationBase::getIdentity()
 JApplicationBase::loadDispatcher()
 JApplicationBase::loadIdentity()
 JApplicationBase::registerEvent()
 JApplicationBase::triggerEvent()

Documentation generated on Tue, 19 Nov 2013 14:53:46 +0100 by phpDocumentor 1.4.3