JApplication
class JApplication extends BaseApplication
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.
Properties
Methods
Class constructor.
Registers a handler to a particular event group.
Calls all handlers associated with an event group.
Allows the application to load a custom or default dispatcher.
Allows the application to load a custom or default identity.
Returns the global JApplicationCms object, only creating it if it doesn't already exist.
Initialise the application.
Route the application.
Dispatch the application.
Render the application.
Redirect to another URL.
Enqueue a system message.
Get the system message queue.
Gets a configuration value.
Method to get the application name.
Gets a user state.
Sets the value of a user state variable.
Gets the value of a user state variable.
Login authentication function.
Logout authentication function.
Gets the name of the current template.
Returns the application JRouter object.
This method transliterates a string into a URL safe string or returns a URL safe UTF-8 string based on the global configuration
Returns the application JPathway object.
Returns the application JPathway object.
Provides a secure hash based on a seed
Checks the user session.
After the session has been started we need to populate it with some default values.
Gets the client id of the current running application.
Is admin interface?
Is site interface?
Check the client interface by name.
Method to determine if the host OS is Windows
Determine if we are using a secure (SSL) connection.
Returns the response as a string.
Details
BaseApplication
registerEvent(
string $event,
callable $handler)
Registers a handler to a particular event group.
array
triggerEvent(
string $event,
array $args = null)
Calls all handlers associated with an event group.
BaseApplication
loadDispatcher(
JEventDispatcher $dispatcher = null)
Allows the application to load a custom or default dispatcher.
The logic and options for creating this object are adequately generic for default cases but for many applications it will make sense to override this method and create event dispatchers, if required, based on more specific needs.
BaseApplication
loadIdentity(
JUser $identity = null)
Allows the application to load a custom or default identity.
The logic and options for creating this object are adequately generic for default cases but for many applications it will make sense to override this method and create an identity, if required, based on more specific needs.
static
JApplicationCms
getInstance(
mixed $client,
array $config = array(),
string $prefix = 'J')
Returns the global JApplicationCms object, only creating it if it doesn't already exist.
void
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.
void
dispatch(
string $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.
void
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.
void
redirect(
string $url,
string $msg = '',
string $msgType = 'message',
boolean $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.
mixed
getCfg(
string $varname,
string $default = null)
Gets a configuration value.
An example is in application/japplication-getcfg.php Getting a configuration
string
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.
mixed
getUserStateFromRequest(
string $key,
string $request,
string $default = null,
string $type = 'none')
Gets the value of a user state variable.
boolean|JException
login(
array $credentials,
array $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.
boolean
logout(
integer $userid = null,
array $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.
static
JRouter|null
getRouter(
string $name = null,
array $options = array())
Returns the application JRouter object.
static
string
stringURLSafe(
string $string)
This method transliterates a string into a URL safe string or returns a URL safe UTF-8 string based on the global configuration
JPathway|null
getPathway(
string $name = null,
array $options = array())
Returns the application JPathway object.
JMenu|null
getMenu(
string $name = null,
array $options = array())
Returns the application JPathway object.
void
checkSession()
Checks the user session.
If the session record doesn't exist, initialise it. If session is new, create session variables