CMSApplication
class CMSApplication extends WebApplication
Joomla! CMS Application class
Properties
string | $charSet | from WebApplication | |
string | $mimeType | from WebApplication | |
JDate | $modifiedDate | from WebApplication | |
JApplicationWebClient | $client | from WebApplication | |
string | $scope | The scope of the application. |
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 a reference to the global CMSApplication object, only creating it if it doesn't already exist.
Initialise the application.
Execute the application.
Redirect to another URL.
Load an object or array into the application configuration object.
Set/get cachable state for the response. If $allow is set, sets the cachable state of the response. Always returns the current state.
Method to set a response header. If the replace flag is set then all headers with the given name will be replaced by the new one. The headers are stored in an internal array to be sent when the site is sent to the browser.
Method to get the array of response headers to be sent when the response is sent to the client.
Set body content. If body content already defined, this will replace it.
Prepend content to the body content
Allows the application to load a custom or default document.
Allows the application to load a custom or default language.
Allows the application to load a custom or default session.
After the session has been started we need to populate it with some default values.
Checks the user session.
Enqueue a system message.
Gets a configuration value.
Gets the client id of the current running application.
Returns the application \JMenu object.
Get the system message queue.
Gets the name of the current running application.
Returns the application \JPathway object.
Returns the application \JRouter object.
Gets the name of the current template.
Gets a user state.
Gets the value of a user state variable.
Is admin interface?
Is site interface?
Checks if HTTPS is forced in the client configuration.
Check the client interface by name.
Login authentication function.
Logout authentication function.
Sets the value of a user state variable.
Sends all headers prior to returning the string
Details
__construct(
Input $input = null,
Registry $config = null,
JApplicationWebClient $client = null)
Class constructor.
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
WebApplication
getInstance(
string $name = null)
Returns a reference to the global CMSApplication object, only creating it if it doesn't already exist.
This method must be invoked as: $web = CMSApplication::getInstance();
WebApplication
initialise(
mixed $session = null,
mixed $document = null,
mixed $language = null,
mixed $dispatcher = null)
Initialise the application.
void
redirect(
string $url,
integer $status = 303)
Redirect to another URL.
If the headers have not been sent the redirect will be accomplished using a "301 Moved Permanently" or "303 See Other" code in the header pointing to the new location. If the headers have already been sent this will be accomplished using a JavaScript statement.
WebApplication
loadConfiguration(
mixed $data)
Load an object or array into the application configuration object.
boolean
allowCache(
boolean $allow = null)
Set/get cachable state for the response. If $allow is set, sets the cachable state of the response. Always returns the current state.
WebApplication
setHeader(
string $name,
string $value,
boolean $replace = false)
Method to set a response header. If the replace flag is set then all headers with the given name will be replaced by the new one. The headers are stored in an internal array to be sent when the site is sent to the browser.
array
getHeaders()
Method to get the array of response headers to be sent when the response is sent to the client.
WebApplication
setBody(
string $content)
Set body content. If body content already defined, this will replace it.
WebApplication
loadDocument(
JDocument $document = null)
Allows the application to load a custom or default document.
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 a document, if required, based on more specific needs.
WebApplication
loadLanguage(
JLanguage $language = null)
Allows the application to load a custom or default language.
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 a language, if required, based on more specific needs.
WebApplication
loadSession(
JSession $session = null)
Allows the application to load a custom or default session.
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 a session, if required, based on more specific needs.
void
afterSessionStart()
After the session has been started we need to populate it with some default values.
void
checkSession()
Checks the user session.
If the session record doesn't exist, initialise it. If session is new, create session variables
JMenu|null
getMenu(
string $name = null,
array $options = array())
Returns the application \JMenu object.
JPathway|null
getPathway(
string $name = null,
array $options = array())
Returns the application \JPathway object.
static
JRouter|null
getRouter(
string $name = null,
array $options = array())
Returns the application \JRouter object.
mixed
getUserStateFromRequest(
string $key,
string $request,
string $default = null,
string $type = 'none')
Gets the value of a user state variable.
boolean
isHttpsForced(
integer $clientId = null)
Checks if HTTPS is forced in the client configuration.
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.