JApplication
class JApplication extends JObject
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
string | $scope | The scope of the application. | |
date | $requestTime | The time the request was made. | |
integer | $startTime | The time the request was made as Unix timestamp. | |
JInput | $input | The application input object. |
Methods
Class constructor.
Returns the response as a string.
Sets a default value if not alreay assigned
Returns a property of the object or the default value if the property is not set.
Returns an associative array of object properties.
Get the most recent error message.
Modifies a property of the object, creating it if it does not already exist.
Set the object properties based on a named array/hash.
Returns the global JApplication object, only creating it if it doesn't already exist.
Initialise the application.
Route the application.
Dispatch the applicaiton.
Render the application.
Exit 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.
Registers a handler to a particular event group.
Calls all handlers associated with an event group.
Login authentication function.
Logout authentication function.
Gets the name of the current template.
Returns the application JRouter object.
This method transliterates a string into an 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.
Gets the client id of the current running application.
Is admin interface?
Is site interface?
No description
Method to determine if the host OS is Windows
Details
at line 95
JObject
__construct(array $config = array())
Class constructor.
at line 1137
string
__toString()
Returns the response as a string.
in JObject at line 70
mixed
def(string $property, mixed $default = null)
Sets a default value if not alreay assigned
in JObject at line 88
mixed
get(string $property, mixed $default = null)
Returns a property of the object or the default value if the property is not set.
in JObject at line 107
array
getProperties(boolean $public = true)
Returns an associative array of object properties.
in JObject at line 133
string
getError(integer $i = null, boolean $toString = true)
Get the most recent error message.
in JObject at line 165
array
getErrors()
Return all errors, if any.
in JObject at line 180
mixed
set(string $property, mixed $value = null)
Modifies a property of the object, creating it if it does not already exist.
in JObject at line 198
boolean
setProperties(mixed $properties)
Set the object properties based on a named array/hash.
in JObject at line 222
void
setError(string $error)
Add an error message.
in JObject at line 235
string
toString()
deprecated
deprecated
at line 156
static JApplication
getInstance($client, $config = array(), $prefix = 'J')
Returns the global JApplication object, only creating it if it doesn't already exist.
at line 195
initialise(array $options = array())
Initialise the application.
at line 236
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.
at line 264
void
dispatch(string $component = null)
Dispatch the applicaiton.
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.
at line 290
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.
at line 324
void
close(integer $code)
Exit the application.
at line 349
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.
at line 428
void
enqueueMessage(string $msg, string $type = 'message')
Enqueue a system message.
at line 452
array
getMessageQueue()
Get the system message queue.
at line 480
mixed
getCfg(string $varname, string $default = null)
Gets a configuration value.
An example is in application/japplication-getcfg.php Getting a configuration
at line 496
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.
at line 521
mixed
getUserState(string $key, mixed $default = null)
Gets a user state.
at line 543
mixed
setUserState(string $key, string $value)
Sets the value of a user state variable.
at line 567
The
getUserStateFromRequest(string $key, string $request, string $default = null, string $type = 'none')
Gets the value of a user state variable.
at line 593
static void
registerEvent(string $event, mixed $handler)
Registers a handler to a particular event group.
at line 609
array
triggerEvent(string $event, array $args = null)
Calls all handlers associated with an event group.
at line 635
boolean
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.
at line 755
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.
at line 804
string
getTemplate(array $params = false)
Gets the name of the current template.
at line 819
static JRouter
getRouter(string $name = null, array $options = array())
Returns the application JRouter object.
at line 847
static string
stringURLSafe(string $string)
This method transliterates a string into an URL safe string or returns a URL safe UTF-8 string based on the global configuration
at line 869
JPathway
getPathway(string $name = null, array $options = array())
Returns the application JPathway object.
at line 895
JMenu
getMenu(string $name = null, array $options = array())
Returns the application JPathway object.
at line 920
static string
getHash(string $seed)
Provides a secure hash based on a seed
at line 1029
void
checkSession()
Checks the user session.
If the session record doesn't exist, initialise it. If session is new, create session variables
at line 1084
integer
getClientId()
Gets the client id of the current running application.
at line 1096
boolean
isAdmin()
Is admin interface?
at line 1108
boolean
isSite()
Is site interface?
at line 1115
goBack($msg = null, $msg_type = 'warning')
at line 1125
static boolean
isWinOS()
Method to determine if the host OS is Windows