class JSite extends JApplication


Located at : UKNOWVA_ROOT/includes/application.php

uKnowva! Application class

Provide many supporting API functions

Properties

string $scope The scope of the application. from JApplication
date $requestTime The time the request was made. from JApplication
integer $startTime The time the request was made as Unix timestamp. from JApplication
JInput $input The application input object. from JApplication

Methods

__construct(array $config = array())

Class constructor

string
__toString()

Returns the response as a string.

mixed
def(string $property, mixed $default = null)

Sets a default value if not alreay assigned

from JObject
mixed
get(string $property, mixed $default = null)

Returns a property of the object or the default value if the property is not set.

from JObject
array
getProperties(boolean $public = true)

Returns an associative array of object properties.

from JObject
string
getError(integer $i = null, boolean $toString = true)

Get the most recent error message.

from JObject
array
getErrors()

Return all errors, if any.

from JObject
mixed
set(string $property, mixed $value = null)

Modifies a property of the object, creating it if it does not already exist.

from JObject
boolean
setProperties(mixed $properties)

Set the object properties based on a named array/hash.

from JObject
void
setError(string $error)

Add an error message.

from JObject
string
toString() deprecated

No description

from JObject
static JApplication
getInstance($client, $config = array(), $prefix = 'J')

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

initialise(array $options = array())

Initialise the application.

void;
route()

Route the application.

void
dispatch(string $component = null)

Dispatch the application

void
render()

Display the application.

void
close(integer $code)

Exit the application.

void
redirect(string $url, string $msg = '', string $msgType = 'message', boolean $moved = false, boolean $persistMsg = true)

Redirect to another URL.

void
enqueueMessage(string $msg, string $type = 'message')

Enqueue a system message.

array
getMessageQueue()

Get the system message queue.

mixed
getCfg(string $varname, string $default = null)

Gets a configuration value.

string
getName()

Method to get the application name.

mixed
getUserState(string $key, mixed $default = null)

Gets a user state.

mixed
setUserState(string $key, string $value)

Sets the value of a user state variable.

The
getUserStateFromRequest(string $key, string $request, string $default = null, string $type = 'none')

Gets the value of a user state variable.

static void
registerEvent(string $event, mixed $handler)

Registers a handler to a particular event group.

array
triggerEvent(string $event, array $args = null)

Calls all handlers associated with an event group.

boolean
login(array $credentials, array $options = array())

Login authentication function

boolean
logout(integer $userid = null, array $options = array())

Logout authentication function.

string
getTemplate(array $params = false)

Get the template

static JRouter
getRouter(string $name = null, array $options = array())

Return a reference to the JRouter object.

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

getPathway(string $name = null, array $options = array())

Return a reference to the JPathway object.

getMenu(string $name = null, array $options = array())

Return a reference to the JPathway object.

static string
getHash(string $seed)

Provides a secure hash based on a seed

void
checkSession()

Checks the user session.

integer
getClientId()

Gets the client id of the current running application.

boolean
isAdmin()

Is admin interface?

boolean
isSite()

Is site interface?

goBack($msg = null, $msg_type = 'warning')

No description

static boolean
isWinOS()

Method to determine if the host OS is Windows

authorize($itemid) deprecated

No description

authorise($itemid)

Check if the user can access the application

object
getParams(string $option = null)

Get the appliaction parameters

object
getPageParameters(string $option = null)

Get the application parameters

setTemplate(string $template, mixed $styleParams = null)

Overrides the default template that would be used

boolean
getLanguageFilter()

Return the current state of the language filter.

boolean
setLanguageFilter($state = false)

Set the current state of the language filter.

boolean
getDetectBrowser()

Return the current state of the detect browser option.

boolean
setDetectBrowser($state = false)

Set the current state of the detect browser option.

Details

at line 45
JObject __construct(array $config = array())

Class constructor

Parameters

array $config A configuration array including optional elements such as session session_name, clientId and others. This is not exhaustive.

Return Value

JObject

in JApplication at line 1137
string __toString()

Returns the response as a string.

Return Value

string The classname.

in JObject at line 70
mixed def(string $property, mixed $default = null)

Sets a default value if not alreay assigned

Parameters

string $property The name of the property.
mixed $default The default value.

Return Value

mixed

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.

Parameters

string $property The name of the property.
mixed $default The default value.

Return Value

mixed The value of the property.

See also

getProperties()

in JObject at line 107
array getProperties(boolean $public = true)

Returns an associative array of object properties.

Parameters

boolean $public If true, returns only the public properties.

Return Value

array

See also

get()

in JObject at line 133
string getError(integer $i = null, boolean $toString = true)

Get the most recent error message.

Parameters

integer $i Option error index.
boolean $toString Indicates if JError objects should return their error message.

Return Value

string Error message

in JObject at line 165
array getErrors()

Return all errors, if any.

Return Value

array Array of error messages or JErrors.

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.

Parameters

string $property The name of the property.
mixed $value The value of the property to set.

Return Value

mixed Previous value of the property.

in JObject at line 198
boolean setProperties(mixed $properties)

Set the object properties based on a named array/hash.

Parameters

mixed $properties Either an associative array or another object.

Return Value

boolean

See also

set()

in JObject at line 222
void setError(string $error)

Add an error message.

Parameters

string $error Error message.

Return Value

void

in JObject at line 235
string toString() deprecated

deprecated 12.1 Use magic method __toString()

Return Value

string

See also

__toString()

in JApplication 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.

Parameters

$client
$config
$prefix

Return Value

JApplication A JApplication object.

at line 56
initialise(array $options = array())

Initialise the application.

Parameters

array $options An optional associative array of configuration settings.

at line 138
void; route()

Route the application.

Return Value

void;

at line 151
void dispatch(string $component = null)

Dispatch the application

Parameters

string $component The component to dispatch.

Return Value

void

at line 209
void render()

Display the application.

Return Value

void

in JApplication at line 324
void close(integer $code)

Exit the application.

Parameters

integer $code Exit code

Return Value

void Exits the application.

at line 634
void redirect(string $url, string $msg = '', string $msgType = 'message', boolean $moved = false, boolean $persistMsg = true)

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.

Parameters

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.
boolean $persistMsg True if the enqueued messages are passed to the redirection, false else.

Return Value

void Calls exit().

See also

JApplication::enqueueMessage()

in JApplication at line 428
void enqueueMessage(string $msg, string $type = 'message')

Enqueue a system message.

Parameters

string $msg The message to enqueue.
string $type The message type. Default is message.

Return Value

void

in JApplication at line 452
array getMessageQueue()

Get the system message queue.

Return Value

array The system message queue.

in JApplication 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

Parameters

string $varname The name of the value to get.
string $default Default value to return

Return Value

mixed The user state.

in JApplication 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.

Return Value

string The name of the dispatcher.

in JApplication at line 521
mixed getUserState(string $key, mixed $default = null)

Gets a user state.

Parameters

string $key The path of the state.
mixed $default Optional default value, returned if the internal value is null.

Return Value

mixed The user state or null.

in JApplication at line 543
mixed setUserState(string $key, string $value)

Sets the value of a user state variable.

Parameters

string $key The path of the state.
string $value The value of the variable.

Return Value

mixed The previous state, if one existed.

in JApplication at line 567
The getUserStateFromRequest(string $key, string $request, string $default = null, string $type = 'none')

Gets the value of a user state variable.

Parameters

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 {@link JFilterInput::clean()}. Optional.

Return Value

The request user state.

in JApplication at line 593
static void registerEvent(string $event, mixed $handler)

Registers a handler to a particular event group.

Parameters

string $event The event name.
mixed $handler The handler, a function or an instance of a event object.

Return Value

void

in JApplication at line 609
array triggerEvent(string $event, array $args = null)

Calls all handlers associated with an event group.

Parameters

string $event The event name.
array $args An array of arguments.

Return Value

array An array of results from each function call.

at line 279
boolean login(array $credentials, array $options = array())

Login authentication function

Parameters

array $credentials Array('username' => string, 'password' => string)
array $options Array('remember' => boolean)

Return Value

boolean True on success.

See also

JApplication::login

in JApplication 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.

Parameters

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)

Return Value

boolean True on success

at line 403
string getTemplate(array $params = false)

Get the template

Parameters

array $params An optional associative array of configuration settings

Return Value

string System is the fallback.

at line 561
static JRouter getRouter(string $name = null, array $options = array())

Return a reference to the JRouter object.

Parameters

string $name The name of the application.
array $options An optional associative array of configuration settings.

Return Value

JRouter A JRouter object

in JApplication 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

Parameters

string $string String to process

Return Value

string Processed string

at line 545
JPathway getPathway(string $name = null, array $options = array())

Return a reference to the JPathway object.

Parameters

string $name The name of the application.
array $options An optional associative array of configuration settings.

Return Value

JPathway A JPathway object

at line 529
JMenu getMenu(string $name = null, array $options = array())

Return a reference to the JPathway object.

Parameters

string $name The name of the application/client.
array $options An optional associative array of configuration settings.

Return Value

JMenu JMenu object.

in JApplication at line 920
static string getHash(string $seed)

Provides a secure hash based on a seed

Parameters

string $seed Seed string.

Return Value

string A secure hash

in JApplication 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

Return Value

void

in JApplication at line 1084
integer getClientId()

Gets the client id of the current running application.

Return Value

integer A client identifier.

in JApplication at line 1096
boolean isAdmin()

Is admin interface?

Return Value

boolean True if this application is administrator.

in JApplication at line 1108
boolean isSite()

Is site interface?

Return Value

boolean True if this application is site.

in JApplication at line 1115
goBack($msg = null, $msg_type = 'warning')

Parameters

$msg
$msg_type

in JApplication at line 1125
static boolean isWinOS()

Method to determine if the host OS is Windows

Return Value

boolean True if Windows OS

at line 295
authorize($itemid) deprecated

deprecated 1.6 Use the authorise method instead.

Parameters

$itemid

at line 303
authorise($itemid)

Check if the user can access the application

Parameters

$itemid

at line 336
object getParams(string $option = null)

Get the appliaction parameters

Parameters

string $option The component option

Return Value

object The parameters object

at line 392
object getPageParameters(string $option = null)

Get the application parameters

Parameters

string $option The component option

Return Value

object The parameters object

at line 498
setTemplate(string $template, mixed $styleParams = null)

Overrides the default template that would be used

Parameters

string $template The template name
mixed $styleParams The template style parameters

at line 575
boolean getLanguageFilter()

Return the current state of the language filter.

Return Value

boolean

at line 586
boolean setLanguageFilter($state = false)

Set the current state of the language filter.

Parameters

$state

Return Value

boolean The old state

at line 598
boolean getDetectBrowser()

Return the current state of the detect browser option.

Return Value

boolean

at line 609
boolean setDetectBrowser($state = false)

Set the current state of the detect browser option.

Parameters

$state

Return Value

boolean The old state