This section details a number of the core classes. Additional documentation can be found at the official API site: http://api.joomla.org.
The following example describes a method called someMethod
with two parameters, anArray
and xyz
, which returns a string. The parameters are of type array and Boolean respectively. The array
type includes associative arrays; more information about array parameters and return types is given in the description of each method. The ampersand denotes that anArray
will be passed by reference:
someMethod( &anArray : array, xyz : boolean ) : string
The next example returns a reference (denoted by the ampersand before the method name) to an instance of a JObject class. Methods and functions that return a reference must use the =&
assignment operator to prevent copying of the returned value.
The returned object can be a subclass of JObject. The string parameter message is optional, and if it is not specified, it will contain the default value foobar
:
&anotherMethod( message : string='foobar' ) : JObject
This last example doesn’t return a value; this is signified by the return type void. The someParameter
parameter is of type mixed. A mixed type means that the value can be any type:
andAnotherMethod( someParameter : mixed ) : void
Note
It is important to remember that all method and property names that begin with an underscore are to be treated as private/protected. There is one exception to this. Methods that are named solely with an underscore, _()
, are not to be considered private. This method name is used when a class has a method that we use frequently, for example JText::_('translate some text')
.
JObject is a common base class. It provides constructor compatibility between PHP 4 and 5, and provides some common methods. For information about using JObject as a parent class, refer to Chapter 2. |
JObject( ) : JObject
This constructor removes the need for subclasses to use the |
__construct( ) : JObject
This constructor is designed to be overridden in subclasses. Overriding methods should always call |
get( property : string, default : mixed=null ) : mixed
Accessor; gets the value of the requested property. If the property is not set, then the optional default value will be returned. This method will not return a reference; in subclasses it can be beneficial to add specific methods where a reference to a property is more suitable. Private properties, identified by an underscore at the start of the name, can be returned using this method. | ||
Parameters |
property |
Name of the property to return |
[default] |
The default value to return if the property has not been initialized | |
Returns |
Value of property |
getError( i : int=null, toString : boolean=true ) : mixed
Returns an error that occurred during the execution of one of the object’s methods. The error can be an object or a string. See JError for more information about errors. | ||
Parameters |
[i] |
Error number; by default the last error is retrieved |
[toString] |
Return a string even if the error is an object | |
Returns |
Error object or string associated with the object |
getErrors( ) : array
Returns a copy of the | |
Returns |
Array of errors associated with the object |
getPublicProperties( assoc : boolean=false ) : array
Gets the names of all the public properties of the object; this includes run-time properties, not just class properties. Names of private properties will not be returned; private properties are identified by an underscore at the start of the name. If assoc is | ||
Parameters |
[assoc] |
Get associative array with values; default is |
Returns |
Array of public property names or associative array of object property values |
set( property : string, value : mixed=null ) : void
Mutator; sets the value of the property in the object. | ||
Parameters |
property |
Name of the property |
[value] |
Value of the property |
setError( error : mixed ) : void
Adds an error to the object’s error history. | ||
Parameters |
[error] |
String or error object |
toString( ) : string
Gets a string representation of the object. This method gets the name of the class. | |
Returns |
String representation of the object |
extends JObject |
---|
Handles a site user. If the user is not logged in, |
_errorMsg : string |
Log of errors, separated by new lines |
_params : JParameter |
Parameters from |
activation : string |
Activation string, used to verify account registration |
aid : int |
Access group ID |
block : int |
Access blocked. 0=not blocked, 1=blocked. |
clearPW : string |
Clear text password, only present when changing password |
email : string |
Email address |
gid : int |
Group ID, relates to the legacy |
id: int |
User ID, relates to the |
lastvisitDate : string |
Date on which the user last visited the site |
name : string |
User’s name, their actual name/nickname, not username |
params : string |
INI parameter string, used when updating and creating users |
password : string |
MD5-hashed password |
registerDate : string |
Date on which the account was registered |
sendEmail : int |
Receive system emails. 0=no, 1=yes. |
username : string |
Username |
usertype : string |
User group that the user is a member of (ARO group). If the user is not logged in this will be null. |
__construct( identifier : int=0 ) : JUser
Builds a new JUser object and loads the user’s details from the database. | ||
Parameters |
[identifier] |
User’s ID |
authorize( acoSection : string, aco : string, axoSection : string=null, axo : string=null ) : boolean
Determines if the user is authorized to perform an action. Acts as a pass-through for JAuthorization. This is only for GACL authorization. | ||
Parameters |
acoSection |
ACO Section (the term ‘section’ does not relate to content sections) |
aco |
ACO value | |
[axoSection] |
AXO Section (the term ‘section’ does not relate to content sections) | |
[axo] |
AXO value | |
Returns |
|
bind( &array : array ) : boolean
Binds an associative array to the object. There are two ways to use this: updating an existing user and creating a new user. Create is assumed if the object property When updating an existing user, When creating a new user the | ||
Parameters |
array |
Associative array with which to bind |
Returns |
|
defParam( key : string, value : mixed) : mixed
If the user’s parameter is not defined, this defines the parameter and sets the value. | ||
Parameters |
key |
Name of the parameter |
value |
Value of the parameter | |
Returns |
Previous value of the user’s parameter |
delete( ) : boolean
Removes user from the Joomla! database. | |
Returns |
|
getError( ) : string
Gets the object’s error log. | |
Returns |
Error log |
static &getInstance( id : mixed=0 ) : JUser
Gets a reference to a global instance of a JUser object. If the object does not exist, it will be created. | ||
Parameters |
[id] |
User’s ID or username |
Returns |
Reference to a JUser object |
getParam( key : string, default : mixed=null) : mixed
Gets a user’s parameter from the | ||
Parameters |
key |
Name of the parameter |
[default] |
Default value | |
Returns |
Value of the parameter, or default value if the parameter does not exist |
&getParameters( ) : JParameter
Gets a refernce to the user’s parameters ( | |
Returns |
Reference to the user’s parameters |
&getTable( ) : JTableUser
Gets a reference to a new JTableUser object loaded with the current user’s details. | |
Returns |
Reference to a new JTableUser object |
load( id : int ) : boolean
Loads a user based on their ID. On failure, a warning will be raised. | ||
Parameters |
id |
User ID |
Returns |
|
save( updateOnly : boolean=false ) : boolean
Saves the user to the database. If Before saving the user a number of sanity checks are made, including data validation and authorization verification. If any of these fail then the method will return | ||
Parameters |
[updateOnly] |
Only save if it is an existing user |
Returns |
|
setLastVisit( timestamp : string ) : boolean
Updates the user’s database record last visit date; note that this does not update the | ||
Parameters |
timestamp |
Timestamp for the last visit |
Returns |
|
setParam( key : string, value : mixed ) : mixed
Sets the value of a user’s parameter. | ||
Parameters |
key |
Name of the parameter |
value |
Value of the parameter | |
Returns |
Previous value of the parameter |
setParameters( data : string, path : string=null ) : void
Loads an INI parameter string. | ||
Parameters |
data |
INI parameter string |
[path] |
XML parameter definition file path |
_bind( from : mixed, ignore : string=” ) : boolean
Used by the | ||
Parameters |
from |
Object or associative array to bind |
[ignore] |
Properties and keys to ignore | |
Returns |
|
_setError( msg : string ) : void
Appends | ||
Parameters |
msg |
Error message |
Base class for model classes that use the MVC implementation. For more information about JModel refer to Chapter 4. |
_db : JDatabase |
Reference to the database connection |
_name: string |
Model name |
_state : JObject |
State of the object |
__construct( config : array=array() ) : JModel
Builds a new JModel object. | ||
Parameters |
[config] |
Associative array of configuration options |
static addIncludePath( path : string=” ) : array
Adds a new path to the array of paths used to find JModel classes. | ||
Parameters |
[path] |
Path to add |
Returns |
Paths to search for JModel subclasses |
static addTablePath( path : mixed=” ) : void
Adds a new path to the array of paths used to find JTable classes. | ||
Parameters |
[path] |
Path or array of paths to add |
&getDBO( ) : JDatabase
Gets a reference to a database connection. | |
Returns |
Reference to a database connection |
static &getInstance( type : string, prefix : string=” ) : JModel
Gets a reference to a new instance of a JModel subclass object. If the class cannot be found, returns | ||
Parameters |
type |
Name of the JTable |
[prefix] |
Prefix of the class name, normally | |
Returns |
Reference to a new instance of a JModel-derived object |
getName( ) : string
Gets the model name. | |
Returns |
Model name |
getState( property : string=null ) : mixed
Gets a model state property. If | ||
Parameters |
[property] |
Name of state property |
Returns |
State property or a complete copy of the model’s state object |
&getTable( name : string=”, prefix : string=‘Table’ ) : JTable
Gets an instance of a JTable subclass object. If | ||
Parameters |
[name] |
Name of the JTable |
[prefix] |
Class prefix | |
Returns |
Reference to a new instance of a JTable subclass object |
setDBO( &db : JDatabase ) : void
Sets the reference to the database connection. | |
Parameters |
Database connection |
setState( property : string, value : mixed=null ) : mixed
Sets a user state property. | ||
Parameters |
property |
Name of state property |
[value] |
Value of state property | |
Returns |
Previous value of state property |
_createFileName( type : string, parts : array=array() ) : string
Gets the name of the file that a class should be located in. | ||
Parameters |
type |
The type of resources; only accepts |
[parts] |
Associative array of name parts | |
Returns |
Name of the file that a class should be located in |
&_createTable( name : string, prefix : string=‘Table’ ) : mixed
Used by | ||
Parameters |
name |
Name of JTable |
[prefix] |
Class prefix, normally | |
Returns |
Reference to a new instance of a JTable subclass object |
&_getList( query : string, limitstart : int =0, limit : int=0 ) : array
Executes a query and gets a reference to an array of resultant objects. | ||
Parameters |
query |
Query to execute |
[limitstart] |
Start record | |
[limit] |
Maximum number of records | |
Returns |
Reference to an array of objects as a result of the query |
_getListCount( query : string ) : int
Gets the number of results obtained from | ||
Parameters |
[query] |
Query to count number of results from |
Returns |
Number of results |
abstract, extends JObject |
Base class for view classes that use the MVC implementation. For more information about JModel refer to Chapter 4. |
Path to view base | |
_defaultModel : string |
Name of the default model |
_escape : array |
Array of names of functions used to escape output. Can also contain arrays with two elements, a class name and method name. For more information see http://php.net/manual/function.call-user-func.php. |
_layout : string |
Template layout, normally |
_layoutExt : string |
Template extension, normally |
_models : array |
Array of models |
_name: string |
Name of view |
_output : string |
Output from the template |
_path : array |
Associative array of arrays of paths for resources |
_template : string |
Path to template |
__construct( config : array=array() ) : JView
Builds a new JView object. | ||
Parameters |
[config] |
Associative array of options. |
addEscape( ) : void
If provided with parameters, the parameters will be used as the function and methods to use with the |
addHelperPath( path : mixed ) : void
Adds paths to search for template files. | ||
Parameters |
path |
A path or array of paths |
addTemplatePath( path : mixed ) : void
Adds paths to search for template files. | ||
Parameters |
path |
A path or array of paths |
assign( arg0 : mixed, arg1 : mixed=null ) : boolean
Dynamically adds properties to the object. If | ||
Parameters |
arg0 |
Object/Array to add or a property name |
[arg1] |
Value if | |
Returns |
|
assignRef( key : string, &val : mixed ) : boolean
Dynamically adds the property, identified by | ||
Parameters |
key |
Name of the property to add |
val |
Value to add a reference to | |
Returns |
|
display( tpl : string=null ) : mixed
Calls the | ||
Parameters |
[tpl] |
The template suffix |
Returns |
Rendered template on success. Error on failure. |
escape( value : mixed ) : mixed
Performs escape functions on | ||
Parameters |
value |
Value to escape |
Returns |
Escaped value |
&get( method : string, model : string=null ) : mixed
Gets the result of a get method, from a registered model. If the model is not defined then the default model will be used. The method is identified as | ||
Parameters |
method |
Method or property to return |
[model] |
Model to run the method on, or default value | |
Returns |
|
getLayout( ) : string
Gets the view layout. | |
Returns |
View layout |
&getModel( name : string=null ) : JModel
Gets a JModel subclass object from the view. | ||
Parameters |
[name] |
Name of model class |
Returns |
Reference to a registered model |
getName( ) : string
Gets the name of the view. | |
Returns |
View name |
loadHelper( hlp : string=null ) : string
Searches known helper paths for the specified helper. | ||
Parameters |
[tpl] |
Template suffix |
Returns |
Rendered template |
loadTemplate( tpl : string=null ) : string
Loads and renders a template. The rendered result is returned and stored in the object output buffer. If | ||
Parameters |
[tpl] |
Template suffix |
Returns |
Rendered template |
setEscape( ) : void
Resets the escape callback functions and methods to use with the |
setLayout( layout : string ) : string
Sets the view layout, normally | ||
Parameters |
layout |
View layout |
Returns |
Previous layout |
setLayoutExt( value : string ) : string
Sets the layout extension to use. | ||
Parameters |
Value |
JModel to associate |
Returns |
Previous value |
&setModel( &model : JModel, default : boolean=false ) : JModel
Registers a JModel subclass object with the view. If | ||
Parameters |
model |
JModel to associate |
[default] |
Set as the default model | |
Returns |
Reference to the newly registered model ( |
_addPath( type : string, path : mixed ) : void
Adds paths to search for subclass files, normally templates. | ||
Parameters |
type |
Type of path |
path |
A path or array of paths |
_createFileName ( type : string, parts : array ) : string
Gets a filename based on | ||
Parameters |
type |
Type of filename |
parts |
Filename parts | |
Returns |
Name of a file |
_setPath( type : string, path : mixed ) : void
Adds paths to search for files, normally templates. | ||
Parameters |
type |
Type of path |
path |
A path or array of paths |
abstract, extends JObject |
Base class for controller classes that use the MVC implementation. For more information about JModel refer to Chapter 4. |
ACO Section (relates to GACL) | |
_acoSectionValue : string |
ACO Section Value (relates to GACL) |
_basePath : string |
Path to controller base |
_doTask : string |
Task method that is being executed |
_message : string |
Message to include in redirect |
_messageType : string |
Type of message to include in redirect |
_methods : array |
Class method names |
_name: string |
Name of the controller |
_path : array |
Directories in which to search for views and models |
_redirect : string |
Redirect URI |
_task : string |
Current or last task to be executed |
_taskMap : array |
Task-to-method map |
__construct( config : array=array() ) : JController
Builds a new JController object. | ||
Parameters |
[config] |
An associative array of configuration options |
addModelPath( path : mixed ) : void
Adds paths to search for JModel subclass files. | ||
Parameters |
path |
Path or array of paths to JModel subclass files |
addViewPath( path : mixed ) : void
Adds paths to search for JView subclass files. | ||
Parameters |
path |
Paths to JView subclass files |
authorize( task : string ) : boolean
If the object ACO Section is not defined authorization is automatically granted. If the object ACO Section has been defined, it determines if the current user has the rights to complete the specified task. If the ACO section value is not specified, | ||
Parameters |
task |
The task to execute |
Returns |
Returns |
display( cachable : boolean=false ) : void
Attempts to display. Uses JRequest ( | ||
Parameters |
[cachable] |
Use cached response |
execute( task : string ) : mixed
Executes the method mapped to | ||
Parameters |
task |
The task to execute |
Returns |
Result of the executed method. Returns error if no mapped method exists. |
&getModel( name : string, prefix : string=” ) : JModel
Gets a new instance of a JModel subclass object. If | ||
Parameters |
name |
Name of model (normally the entity name) |
[prefix] |
Class prefix | |
Returns |
A new instance of a JModel subclass object; |
getName( ) : string
Gets the name of the controller. | |
Returns |
Controller name |
getTask( ) : string
Gets the current task or the last task that was executed. | |
Returns |
Current task or the last task that was executed |
getTasks( ) : array
Gets the different task methods that are available for this controller. | |
Returns |
Array of task methods |
&getView( name : string=”, type : string=”, prefix : string=”, config : array=array() ) : JView
Gets a JView subclass object. If
$view = $SomeController->getView('Item');
This would attempt to instantiate the class SomeViewItem. | ||
Parameters |
[name] |
View name |
[type] |
View type; relates to the document type | |
[prefix] |
View prefix, default is | |
[config] |
Configuration array to pass to the view | |
Returns |
JView subclass object |
redirect( ) : boolean
If a redirect has been set, it redirects the browser and closes the application. | |
Returns |
Returns false on failure |
registerDefaultTask( method : string ) : void
Registers the default task method. The default task is the task that is executed when an attempt is made to execute a task that is not mapped to a method. | ||
Parameters |
method |
Default task method |
registerTask( task : string, method : string ) : void
Registers a task, with a method. | ||
Parameters |
task |
Task name |
method |
Method name |
setAccessControl( section : string, value : string=null ) : void
Sets the object authorization ACO and ACO value. This is used by the authorize method. | ||
Parameters |
section |
ACO section |
[value] |
ACO value |
setMessage( text : string ) : void
Sets the object redirect message. This is only used if the redirect method is called. | ||
Parameters |
text |
Redirect message |
setRedirect( url : string, msg : string=null, type : string=‘message’ ) : void
Sets the object redirect options. This is only used if the redirect method is called. | ||
Parameters |
url |
Redirect URI |
[msg] |
Redirect message | |
[type] |
Message type |
_addPath( type : string, path : mixed ) : void
Adds paths to search for JModel or JView subclass files. | ||
Parameters |
type |
Type of path |
path |
Path or array of paths |
_createFileName ( type : string, parts : array=array() ) : string
Gets a filename based on | ||
Parameters |
type |
Type of filename |
[parts] |
Filename parts | |
Returns |
Name of a file |
&_createModel( name : string, prefix : string=” ) : JModel
Builds a new JModel subclass object. | ||
Parameters |
name |
Model name (normally the entity name) |
[prefix] |
Model class name prefix | |
Returns |
A new JModel subclass object |
&_createView( name : string, prefix : string=”, type : string=”, config : array=array() ) : JView
Builds a new JView subclass object. | ||
Parameters |
name |
View name, normally the entity name |
[prefix] |
View class name prefix | |
[type] |
View output type | |
[config] |
Configuration array to pass to the view | |
Returns |
A new JView subclass object |
_setPath( type : string, path : mixed ) : void
Adds paths to search for JModel or JView subclass files. | ||
Parameters |
type |
Type of path |
path |
Path or array of paths |
abstract, extends JObject |
Class that handles individual database tables. JTable uses a buffering mechanism, which allows it to handle records on an individual basis. For more information about JTable refer to Chapter 3. |
_tbl: string |
Table name |
_tbl_key : array |
Primary key |
_errorNum : int |
Error Number |
_db : JDatabase |
Database connection |
__construct( table : string, key : string, &db : JDatabase ) : JTable
Builds a new JTable object. | ||
Parameters |
table |
Table name |
key |
Primary Key | |
db |
Database connection |
static addIncludePath( path : mixed=” ) : array
Adds paths to search for JTable subclasses. | ||
Parameters |
[paths] |
Path or array of paths to add |
Returns |
Array of paths |
bind( from : mixed, ignore : mixed=array() ) : boolean
Binds a subject (normally a record) to the object. For all the public object properties, this finds a corresponding key or property in | ||
Parameters |
from |
Bind subject, object or associative array |
[ignore] |
Fields to ignore, string or array | |
Returns |
|
canDelete( oid : string=null, joins : array=null ) : boolean
Determines if there are any records linked to the buffered record or, if | ||
Parameters |
[oid] |
Record ID |
[joins] |
Associative array of table join constraints | |
Returns |
|
check( ) : boolean
This method is used to validate the contents of the record buffer. This should be overridden in subclasses. | |
Returns |
|
checkin( oid : string=null ) : boolean
Checks-in the buffered record or, if | ||
Parameters |
[oid] |
Record ID |
Returns |
|
checkout( who : id, oid : string=null ) : boolean
Checks out the buffered record or, if | ||
Parameters |
who |
User’s ID |
[oid] |
Record ID | |
Returns |
|
delete( oid : string=null ) : boolean
Deletes the buffered record or, if | ||
Parameters |
[oid] |
Record ID |
Returns |
|
&getDBO( ) : JDatabase
Gets the database connection object. | |
Returns |
Database connection object |
getErrorNum( ) : int
Gets the object error number. | |
Returns |
Error number |
static &getInstance( type : string, prefix : string=‘JTable’ ) : mixed
Gets a new JTable subclass object. | ||
Parameters |
type |
Class name suffix and file name |
[prefix] |
Class name prefix | |
Returns |
New JTable subclass object |
getKeyName( ) : string
Gets the name of the primary key field. | |
Returns |
Name of the primary key |
getNextOrder( where : string=” ) : int
Gets the next place available in the current ordering. Using | ||
Parameters |
[where] |
|
Returns |
Next place available in the current ordering |
getTableName( ) : string
Gets the name of the table. | |
Returns |
Name of the table |
hit( oid : string=null, log : boolean=false ) : void
Increases the hit counter of the buffered record or, if | ||
Parameters |
[oid] |
Record ID |
[log] |
Has no effect |
[static] isCheckedOut( with : int=0, against : int=null ) : boolean
Determines if the buffered record is checked out by any user other than the current user. If used statically (both | ||
Parameters |
[with] |
Current user’s ID |
[against] |
Record’s | |
Returns |
|
load( oid : string=null ) : boolean
Resets the record buffer and loads a single record into the buffer. | ||
Parameters |
[oid] |
Record ID |
Returns |
|
move( dirn : int, where : string=” ) : void
Moves a record up or down the ordering (table must have an ordering field). -1 = move up, 1 = move down. | ||
Parameters |
dirn |
Direction to move |
[where] |
|
publish( cid : array=null, publish : int=1, user_id : int=0 ) : boolean
Sets the publish value of records identified by | ||
Parameters |
[cid] |
Array of record IDs |
[publish] |
Publish value, | |
[user_id] |
Current user’s ID | |
Returns |
|
reorder( where : string=” ) : boolean
Removes gaps in ordering. | ||
Parameters |
[where] |
|
Returns |
|
reset( ) : void
Resets the object to the initial class option values. |
save( source : mixed, order_filter : string=” ) : boolean
Binds | ||
Parameters |
source |
Record to save |
[order_filter] |
Name of field by which records are ordered | |
Returns |
|
setDBO( &db : JDatabase ) : void
Sets the JDatabase connection object. | ||
Parameters |
db |
Database connection object |
store( updateNulls : boolean=false ) : boolean
Saves the record buffer to the database. If the record buffer primary key property is set, an | ||
Parameters |
[updateNulls] |
Update null values |
Returns |
|
setErrorNum( value : int ) : void
Sets the object error number. | ||
Parameters |
value |
Error number |
toXML( mapKeysToText : boolean=false ) : string
Gets an XML representation of the buffered record. | ||
Parameters |
[mapKeysToText] |
Maps foreign keys to text |
Returns |
XML string |
static |
Error handler. For more information about JError refer to Chapter 11. |
static customErrorPage( &error : JException ) : void
Gets the global instance of JDocumentError and passes it the error, then renders the page. This removes any previous output, and terminates the script. | ||
Parameters |
error |
JException error object |
Return |
|
static &getError( unset : boolean=false ) : mixed
Gets the last error in the global error stack, or false if there are no errors. If | ||
Parameters |
[unset] |
Remove last error from the global error stack |
Returns |
First error in the global error stack, or false if there are no errors |
static getErrorHandling( level : int ) : array
Gets a copy of the associative array used to determine the handling of the specified error level. The array contains the key | ||
Parameters |
level |
Error level |
Return |
Associative array used to determine error handling mechanism of |
static &getErrors( ) : array
Gets a reference to the global error stack. | |
Returns |
Reference to the global error stack |
static &handleCallback( &error : JException, options : array ) : mixed
Calls a method in another class, passes | ||
Parameters |
error |
JException error object |
options |
| |
Return |
Result of the executed method |
static &handleDie( &error : JException, options : array ) : JException
Terminates the script and outputs the JException message to screen in HTML. If | ||
Parameters |
error |
JException error object |
options |
Array of options (ignored) | |
Return |
|
static &handleEcho( &error : JException, options : array ) : JException
Outputs JException message to screen in HTML. If | ||
Parameters |
error |
JException error object |
options |
Array of options (ignored) | |
Return |
|
static &handleIgnore( &error : JException, options : array ) : JException
Handle ignore error. No actions taken, returns | ||
Parameters |
error |
JException error object |
options |
Array of options (ignored) | |
Return |
|
static &handleLog( &error : JException, options : array ) : JException
Adds a log entry to the error log. A new error log is created every day in the format | ||
Parameters |
error |
JException error object |
options |
Array of options (passed to JLog) | |
Return |
|
static &handleMessage( &error : JException, options : array ) : JException
Adds the JExcpetion message to the application message queue. | ||
Parameters |
error |
JException error object |
options |
Array of options (ignored) | |
Return |
|
static &handleTrigger( &error : JException, options : array ) : JException
Triggers a PHP user-level error, warning, or notice. | ||
Parameters |
error |
JException error object |
options |
Array of options (ignored) | |
Return |
|
static &handleVerbose( &error : JException, options : array ) : JException
Outputs JException message, info, and backtrace to screen in HTML. If | ||
Parameters |
error |
JException error object |
options |
Array of options (ignored) | |
Return |
| |
Return |
|
static isError( &object : mixed ) : boolean
Checks if | ||
Parameters |
object |
Object to check |
Returns |
|
static &raise( level : int, code : string, msg : string, info : mixed=null, backtrace : boolean=false ) : mixed
Raises a new error of | ||
Parameters |
level |
Error level |
code |
Error code | |
msg |
Error message | |
[info] |
Additional error information | |
[backtrace] |
Include | |
Returns |
Depends on error handling mechanism; normally a JException object |
static &raiseError( code : string, msg : string, info : mixed=null) : mixed
Raises a new error ( | ||
Parameters |
code |
Error code |
msg |
Error message | |
[info] |
Additional information | |
Return |
Depends on error handling mechanism; normally a JException object |
static &raiseNotice( code : string, msg : string, info : mixed=null) : mixed
Raises a new notice ( | ||
Parameters |
code |
Error code |
msg |
Error message | |
[info] |
Additional information | |
Return |
Depends on error handling mechanism; normally a JException object |
static &raiseWarning( code : string, msg : string, info : mixed=null) : mixed
Raises a new warning ( | ||
Parameters |
code |
Error code |
msg |
Error message | |
[info] |
Additional information | |
Return |
Depends on error handling mechanism; normally a JException object |
static registerErrorLevel( level : int, name : string, handler : string=‘ignore’ ) : boolean
Defines a new error level. If the level already exists it will be rejected. | ||
Parameters |
level |
New error level |
name |
Name | |
[handler] |
Handler (mode) | |
Return |
|
static setErrorHandling( level : int, mode : string, options : array=‘null’ ) : mixed
Sets the error handling mechanism for | ||
Parameters |
level |
Error level |
mode |
Error handler | |
[options] |
Options to pass to the handler method | |
Return |
|
static translateErrorLevel( level : int ) : mixed
Gets the name of the error level. If the error level is not defined, false will be returned. | ||
Parameters |
level |
Error level |
Return |
Name of error level; |
Encapsulates and caches a response during the execution of an application. This enables us to make modifications to any part of the document irrespective of where we are in the output process. For more information about the document please refer to Chapter 2. |
_buffer : string |
Document rendered content buffer |
_charset : string |
Character encoding; default encoding is UTF-8 |
_engine : object |
Rendering engine, used by core subclass JDocumentPDF |
_generator : string |
Generator metadata |
_lineEnd : string |
EOL character/string |
_mdate : string |
Document modified date |
_metaTags : array |
Metadata tags |
_mime : string |
MIME type |
_namespace : string |
Namespace, not used by core JDocument subclasses |
_profile : string |
Document profile, not used by core JDocument subclasses |
_script : array |
Embedded scripts |
_scripts : array |
URIs to linked scripts |
_style : array |
Embedded styles |
_styleSheets : array |
URIs to linked Cascading Style Sheets |
_tab : string |
Tab character/string |
_type : string |
Document type |
description : string |
Document description |
direction : string |
Text direction ( |
language : string |
Language setting, default is |
link : string |
Base URI of the document |
title : string |
Document title |
__construct( options : array=array() ) : JDocument
Builds a new JDocument. Subclasses call | ||
Parameters |
[options] |
Associative array of configuration options |
addLink( url : string ) : void
Sets base URI of the document. | ||
Parameters |
url |
Base URI |
addScript( url : string, type : string=‘text/javascript’ ) : void
Adds a link to a script to the document. | ||
Parameters |
url |
Script URI |
[type] |
MIME type |
addScriptDeclaration( content : string, type : string=‘text/javascript’) : void
Embeds a script in the document. | ||
Parameters |
content |
Script |
[type] |
MIME type |
addStyleSheet( url : string, type : string=‘text/css’, media : string=null, attribs : array=array() ) : void
Links a stylesheet to the document. | ||
Parameters |
url |
Script URI |
[type] |
MIME type | |
[media] |
Link tag media attribute type | |
[attribs] |
Associative array of tag attributes |
addStyleDeclaration( content : string, type : string=‘text/css’ ) : void
Embeds styles in the document. | ||
Parameters |
content |
Style content |
[type] |
MIME type |
getBuffer( ) : string
Gets the buffered contents of the document. | |
Returns |
Document contents |
getCharset() : string
Gets the character set encoding. | |
Returns |
Character set encoding |
getDescription( ) : string
Gets the document description. | |
Returns |
Document description |
getDirection( ) : string
Gets the text direction of the document, | |
Returns |
Text direction |
getGenerator( ) : string
Gets the document generator. | |
Returns |
Document generator |
getHeadData( ) : array
Gets an associative array of header data. Must be implemented in child classes. | |
Returns |
Associative array of header data |
static &getInstance ( type : string=‘html’, attributes : array=array() ) : JDocument
Gets a global instance of a JDocument subclass object, based on | ||
Parameters |
[type] |
JDocument type |
[attributes] |
Associative array of options | |
Returns |
Global instance of a JDocument subclass object |
getLanguage( ) : string
Gets the language of the document. | |
Returns |
Document language |
getLink( ) : string
Gets the document base URI. | |
Returns |
Document base URI |
getMetaData( name : string, http_equiv : boolean=false ) : string
Gets the document metadata. If the metadata is http-equiv (equivalent to an HTTP header) then specify | ||
Parameters |
name |
Metadata name |
[http_equiv] |
Get HTTP header equivalent metadata | |
Returns |
Metadata |
getModifiedDate( ) : string
Gets the document modified date. | |
Returns |
Document modified date |
getTitle( ) : string
Gets the document title. | |
Returns |
Document title |
getType( ) : string
Gets the document type. | |
Returns |
String representation of document type |
&loadRenderer( type : string ) : JDocumentRenderer
Gets a new instance of a JDocumentRenderer subclass object. | ||
Parameters |
type |
Renderer type |
Returns |
Instance of a JDocumentRenderer-derived object |
render( cache : boolean=false, params : array=array() ) : string
Gets the rendered document. This method varies depending upon the subclass. | ||
Parameters |
cache |
Cache document |
params |
Associative array of options | |
Returns |
Rendered document |
setBuffer( content : string ) : void
Sets the buffered contents of the document. | ||
Parameters |
content |
Document contents |
setCharset( type : string=‘utf-8’ ) : void
Sets the character set encoding. This does not convert content to the new character set. | ||
Parameters |
[type] |
Character set |
setDescription( description : string ) : void
Sets the document description. | ||
Parameters |
description |
Document description |
setDirection( dir : string=‘ltr’ ) : void
Sets the text direction of the document, | ||
Parameters |
[dir] |
Text direction |
setGenerator( generator : string ) : void
Sets the document generator; default is | ||
Parameters |
generator |
Generator name |
setLanguage( lang : string=‘en’ ) : void
Sets the language of the document. | ||
Parameters |
[lang] |
Language |
setLineEnd( style : string ) : void
Sets the document EOL character string. | ||
Parameters |
style |
System type or EOL string |
setMetaData( name : string, content : string, http_equiv : boolean=false ) : void
Sets metadata. If the metadata is http-equiv (equivalent to an HTTP header) then specify | ||
Parameters |
name |
Metadata name |
content |
Metadata content | |
[http_equiv] |
Header equivalent |
setMimeEncoding( type : string=‘text/html’ ) : void
Sets the document MIME encoding. | ||
Parameters |
[type] |
MIME encoding |
setModifiedDate( date : string ) : void
Sets the document modified date. | ||
Parameters |
date |
Modified date |
setTab( string : string ) : void
Sets the document indentation string, e.g | ||
Parameters |
string |
Indentation string |
setTitle( title : string ) : void
Sets the document title. | ||
Parameters |
[title] |
Document title |
setType( type : string ) : void
Sets the document type. | ||
Parameters |
type |
JDocument type |
_getLineEnd( ) : string
Gets the EOL character/string. | |
Returns |
EOL character string |
_getTab( ) : string
Gets the indentation character string. | |
Returns |
Indentation character string |
abstract, extends JObject |
Base application class. The frontend and backend application classes both extend this class. This class encapsulates the process from request to response. For more information about the application refer to Chapter 2. |
_clientId : int |
Client type; 0 = site, 1 = admin, 2 = installation |
_router : JRouter |
Application router |
_messageQueue : array |
Queued messages |
__construct( clientId : int=0 ) : JApplication
Builds a new JApplication object with the specified | ||
Parameters |
[clientId] |
0 = site, 1 = admin, 2 = installation |
addCustomHeadTag( html : string ) : void
Deprecated; use of this method is no longer advised. Adds a custom HTML tag to the head if the document type is HTML. Instead use: $document =& JFactory::getDocument(); if($document->getType() == 'html') { $document->addCustomTag('<!—a custom tag-->'); }
| ||
Parameters |
HTML |
HTML to add to the head |
addMetaTag( name : string, content : string, prepend : string=”, append : string=” ) : void
Deprecated; use of this method is no longer advised. Adds metadata to the document. Instead use: $document =& JFactory::getDocument(); $document->setMetadata('metaName', 'metaValue');
| ||
Parameters |
name |
Metadata name |
content |
Metadata value | |
[prepend] |
Deprecated, no effect | |
[append] |
Deprecated, no effect |
appendMetaTag( name : string, content : string ) : void
Deprecated; use of this method is no longer advised. Adds metadata to the document. Instead use: $document=& JFactory::getDocument(); $document->setMetadata('metaName', 'metaValue');
| ||
Parameters |
name |
Metadata name |
content |
Metadata value |
appendPathway( name : string, link : string=null ) : boolean
Deprecated and created during the development of Joomla! 1.5. Appends an item to the pathway. Instead use JPathWay: $pathway = mainframe->getPathWay(); $pathway->addItem($name, $link);
| ||
Parameters |
name |
Item name |
[link] |
Item link | |
Returns |
|
close( code : int=0 ) : void
Closes the application gracefully. | ||
Parameters |
[code] |
|
dispatch( component :string ) : void
Dispatches the request and executes the relevant component, storing the rendered result in the global JDocument object. | ||
Parameters |
[component] |
Component being invoked |
enqueueMessage( msg : string=”, msgType : string=‘message’ ) : void
Adds a new message to the application message queue. Clears the session message queue. | ||
Parameters |
msg |
Message |
[msgType] |
Type of message |
getBasePath( client : int=0, addTrailingSlash : boolean=true ) : string
Deprecated; use of this method is no longer advised. Gets the base path to application entry point, not including the file name. Instead use: $basePath = JURI::base();
Parameters |
[client] |
Deprecated, no effect | ||
[addTrailingSlash] |
Deprecated, no effect | |||
Returns |
Path to application entry point, not including the file name |
getBlogCategoryCount( ) : int
Deprecated; use of this method is no longer advised. Counts the number of menu items that are blog categories (
$menus = &JMenu::getInstance(); $count = count($menus->getItems('type', 'content_blog_category'));
| |
Returns |
Number of menu items that are blog categories |
getBlogSectionCount( ) : int
Deprecated; use of this method is no longer advised. Counts the number of menu items that are blog sections ( $menus = &JMenu::getInstance(); $count = count($menus->getItems('type', 'content_blog_section'));
| |
Returns |
Number of menu items that are blog sections |
getCfg( varname : string ) : mixed
Gets a configuration value. | ||
Parameters |
varname |
Name of config value |
Returns |
Configuration value |
getClientId( ) : int
Gets the client id. 0 = site, 1 = administrator, 2 = installer. | |
Returns |
Client ID |
getContentItemLinkCount( ) : int
Deprecated; use of this method is no longer advised. Counts the number of menu items that are content item links ( $menus = &JMenu::getInstance(); $count = count($menus->getItems('type', 'content_item_link'));
| |
Returns |
Number of menu items that are content item links |
getCustomPathway( ) : array
Deprecated and created during the development of Joomla! 1.5. | |
Instead use JPathWay: $pathway = mainframe->getPathWay(); $customPathway = $pathway->getPathWayNames();
| |
Returns |
Array of breadcrumbs |
getGlobalBlogSectionCount( ) : int
Deprecated; use of this method is no longer advised. Counts the number of menu items that are blog sections ( $menus = &JMenu::getInstance(); $count = count($menus->getItems('type', 'content_blog_section'));
| |
Returns |
Number of menu items that are blog sections |
getHead( ) : string
Deprecated; use of this method is no longer advised. Gets the document head. Instead use: $document =& JFactory::getDocument(); $head = $document->get('head');
| |
Returns |
Document head |
getItemId( id : int ) : int
Deprecated; use of this method is no longer advised. Gets the menu ContentHelper::getItemid($id, $categoryId, $sectionId);
| ||
Parameters |
id |
Content item ID |
Returns |
Menu |
getMessageQueue( ) : array
Gets a copy of the application message queue. If no application messages exist and there are session messages, the session message queue will be moved to the application message queue. | |
Returns |
Array of application messages |
getPageTitle( ) : string
Deprecated; use of this method is no longer advised. Gets the title of the document. Instead use: $document=& JFactory::getDocument(); $title = $document->getTitle();
| |
Returns |
Menu |
getPath( varname : string, user_option : string=null ) : string
Deprecated; use of this method is no longer advised. Determines path to a resource. $path = JApplicationHelper::getPath($varname, $user_option);
| ||
Parameters |
varname |
User_option type |
[user_option] |
User option | |
Returns |
Path |
&getRouter( ) : JRouter
Gets the application router object. | |
Returns |
Application router object |
getStaticContentCount( ) : int
Deprecated; use of this method is no longer advised. Counts the number of menu items that are static content ( $menus = &JMenu::getInstance(); $count = count($menus->getItems('type', 'content_typed'));
| |
Returns |
Number of menu items that are static content |
getTemplate( ) : string
Gets the name of the application template. | |
Returns |
Application template name |
getUser( ) : JUser
Deprecated; use of this method is no longer advised. Gets the current user object. Instead use: $user =& JFactory::getUser();
| |
Returns |
User object |
getUserState( key : string ) : mixed
Gets a value from the user session registry. | ||
Parameters |
key |
Name of the user session registry value |
Returns |
Value from the user session registry |
getUserStateFromRequest( key : string, request : string, default : mixed=null, type : string=‘none’ ) : string
Gets a value from the user session registry, updating with a request value if a request value exists. | ||
Parameters |
key |
Name of the session registry value |
request |
Name of the request value | |
[default] |
Default value | |
[type] |
Name of the hash from which the request value should be retrieved | |
Returns |
Up-to-date value from the user session registry |
initialise( options : array=array() ) : void
Initializes the application. Prepares application language, defines date formats, and builds the application router. | ||
Parameters |
[options] |
Associative array of options |
isAdmin( ) : boolean
Checks if application is administrator (client ID is 1). | |
Returns |
|
isSite( ) : boolean
Checks if application is frontend (client ID is 0). | |
Returns |
|
loadConfiguration( file : string ) : void
Loads the application configuration and sets the database debug mode. | ||
Parameters |
file |
Path to configuration file |
loadSession( name : string ) : void
Loads the session. Creates a new session, if the session does not already exist. | ||
Parameters |
name |
Session name |
login( credentials : array, options : array=array() ) : mixed
Checks Joomla! credentials. | ||
Parameters |
credentials |
Associative array of user credentials |
[options] |
Options to pass to the authentication plugins | |
Returns |
|
logout( ) : boolean
If a user is logged-in, logs them out | |
Returns |
|
prependMetaTag( name : string, content : string ) : void
Deprecated; use of this method is no longer advised. Adds metadata to the document. Instead use: $document=& JFactory::getDocument(); $document->setMetadata('metaName', 'metaValue');
| ||
Parameters |
name |
Metadata name |
content |
Metadata value |
registerEvent( event : string, handler : string ) : void
Registers an event handler with the global event dispatcher. | ||
Parameters |
event |
Name of event |
handler |
Function or class name |
render( ) : void
Renders the response and adds it to the static JResponse body. |
redirect( url : string, msg : string=”, msgType : string=‘message’ ) : void
Redirects to the specified | ||
Parameters |
url |
Redirect URI |
[msg] |
Optional message to enqueue | |
[msgType] |
Type of message |
route( ) : void
Route the applictaion. Chooses the route through the application to take, based on the request URI. |
setPageTitle( title : string=null ) : void
Deprecated; use of this method is no longer advised. Sets the title of the document. Instead use: $document =& JFactory::getDocument(); $document->setTitle($title);
| ||
Parameters |
[title] |
Document title |
setUserState( key : string, value : mixed ) : mixed
Sets a value in the user session registry. | ||
Parameters |
key |
Name of the user session registry value |
value |
Key value | |
Returns |
Value from the user session registry |
triggerEvent( event : string, args : array=null ) : array
Triggers an event. This will notify any registered event handlers associated with the event that the event has occurred. | ||
Parameters |
event |
Event to trigger |
[args] |
Array of arguments to pass to the handlers | |
Returns |
Array of the resultant returns from the event handlers |
&_createConfiguration( file : string ) : JConfig
Loads the global configuration. The configuration file must define the class JConfig. | ||
Parameters |
file |
Path to configuration file |
Returns |
JConfig configuration object |
Gets the application router. If the application router does not exist, it is created. | |
Returns |
Application router |
&_createSession( name : string ) : JTableSession
If a session does not exist, creates a session and adds it to the | ||
Parameters |
name |
Session name |
Returns |
Session JTable object |
extends JObject |
Handles URIs |
_fragment : string |
URI fragment (internal document location) |
_host : string |
Host |
_pass : string |
URI Password (not the Joomla! user’s password) |
_path : string |
Path |
_port : int |
Port number |
_query : string |
GET query |
_scheme : string |
URI scheme (e.g. |
_uri : string |
URI |
_user : string |
URI Username (not the Joomla! user’s username) |
_vars : array |
GET query, associative array |
__construct( uri : string=null ) : JURI
Builds a new JURI object. If | ||
Parameters |
[uri] |
URI to parse |
static base( ) : string
Gets the base URI for the entry point, not including the filename. | |
Returns |
Base URI |
current( ) : string
Gets the URI of the current location including the scheme, host, port, and path. | |
Returns |
Current URI |
delVar( name : string ) : void
Deletes a value from the URI query. | ||
Parameters |
name |
Name of query value |
getFragment( ) : string
Gets the URI fragment identifier (denoted by a hash, #). | |
Returns |
URI fragment identifier |
getHost( ) : string
Gets the URI host name. This does not include the path to the resource. | |
Returns |
Host name or IP address |
static &getInstance( uri : string=‘SERVER’ ) : JURI
Gets a global instance of a JURI object. If | ||
Parameters |
[uri] |
URI object to get |
Returns |
Global instance of a JURI object |
getPass( ) : string
Gets the URI password. This is part of the scheme authorization; it is not the same as Joomla! authorization. | |
Returns |
Scheme password |
getPath( ) : string
Gets the URI path. This does not include the host name. | |
Returns |
URI path |
getPort( ) : int
Gets the URI port. If it is the default port for the scheme, this may not return anything. | |
Returns |
Port number |
getQuery( toArray : boolean=false ) : mixed
Gets the URI query. If | ||
Parameters |
[toArray] |
Get in array format |
Returns |
URI query string |
getScheme( ) : string
Gets the URI scheme, normally | |
Returns |
URI scheme |
getUser( ) : string
Gets the URI username. This is part of HTTP authorization; it is not the same as Joomla! authorization, or Joomla! user’s username. | |
Returns |
Scheme username |
getVar( name : string=null, default : mixed=null ) : string
Gets a value from the URI query. Returns | ||
Parameters |
[name] |
Name of query value |
[default] |
Default value | |
Returns |
Value from the URI query |
isSSL( ) : boolean
Determines if the URI scheme is | |
Returns |
|
parse( uri : string ) : boolean
Attempts to parse a URI, the results of which are stored in the object. | ||
Parameters |
uri |
URI to parse |
Returns |
|
setFragment( anchor : string ) : void
Sets the URI fragment identifier. | ||
Parameters |
anchor |
Fragment identifier |
setHost( host : string ) : void
Sets the URI host name. This does not include the path to the resource. | ||
Parameters |
host |
Host name or IP address |
setPass( pass : string ) : void
Sets the URI password. This is part of the scheme authorization; it is not the same as Joomla! authorization. | ||
Parameters |
pass |
Scheme password |
setPath( path : string ) : void
Sets the URI path. | ||
Parameters |
path |
URI path |
setPort( port : int ) : void
Sets the URI port. | ||
Parameters |
port |
Port number |
setQuery( query : mixed ) : void
Sets the URI query. This can be done using a query string or an associative array. | ||
Parameters |
query |
Query string or associative array |
setScheme( scheme : string ) : string
Sets the URI scheme, normally | ||
Parameters |
scheme |
Scheme to set to |
setUser( user : string ) : void
Sets the URI username. This is part of the scheme authorization; it is not the same as Joomla! authorization. | ||
Parameters |
user |
Scheme username |
setVar( name : string, value : string ) : string
Sets a value in the URI query. Returns the previous value. | ||
Parameters |
name |
Name of query value |
value |
New value | |
Returns |
Previous value |
toString( parts : array=array(’scheme’, ‘user’, ‘pass’, ‘host’, ‘port’, ‘path’, ‘query’, ‘fragment’) ) : string
Returns the URI in string format, including the defined parts. The default value for | ||
Parameters |
[parts] |
Parts to include in the URI |
Returns |
String representation of the JURI object |
_buildQuery( params : array, akey : string=null ) : string
Builds a URI query from the | ||
Parameters |
path |
Path to clean |
[akey] |
Array name | |
Returns |
Cleaned path |
_cleanPath( path : string ) : string
Cleans the passed URI. Removes any unnecessary clutter from the path. | ||
Parameters |
path |
URI to clean |
Returns |
Cleaned path |
extends JObject |
Handles languages and translation. |
_debug : boolean |
Debug mode |
_default : string |
Default language (en-GB) |
_lang : string |
Language name |
_metadata : array |
Language metadata |
_orphans : array |
Strings that failed translation (only maintained during debug) |
_paths : array |
Array of loaded language file paths |
_strings : array |
Associative array of translations |
_used : array |
Array of used strings (only maintained during debug) |
__construct( lang : string=null ) : JLanguage
Builds a new JLanguage object. Loads the specified language; if | ||
Parameters |
[lang] |
Language to load |
exists( lang : string, basePath : string=JPATH_BASE ) : boolean
Checks if a language exists in the default language folder. | ||
Parameters |
lang |
Language to look for |
[basePath] |
Basis for building language path | |
Returns |
|
get( property : string, default : mixed=null ) : mixed
Gets metadata about the language. Common properties include | ||
Parameters |
property |
Property to retrieve |
[default] |
Default if the property is not set | |
Returns |
Value of the property |
getBackwardLang( ) : string
Gets the backward-compatible language name. Used for legacy support. | |
Returns |
Backward-compatible language name |
getDebug( ) : boolean
Checks if the language object is in debug mode. | |
Returns |
|
getDefault( ) : string
Gets the default language. | |
Returns |
Default language |
&getInstance( lang : string ) : JLanguage
Gets a global instance of JLanguage. If an instance for the specified | ||
Parameters |
lang |
Language to load |
Returns |
A global instance of JLanguage |
getKnownLanguages( basePath : string=JPATH_BASE ) : array
Gets a two-dimensional associative array of all the known languages. The array contains keys named the same as the languages, which contain associative arrays of the corresponding language metadata. | ||
Parameters |
[basePath] |
Path on which to look for the languages folder |
Returns |
Two-dimensional associative array languages and metadata |
getLanguagePath( basePath : string=JPATH_BASE, language : string=null ) : string
Gets the path to a language. If | ||
Parameters |
[basePath] |
Basis for building language path |
[language] |
Language name | |
Returns |
Path to a language, or all languages |
getLocale( ) : array
Gets an array of the language locales, for example | |
Returns |
Array of the different language locales |
getMetaData( lang : string ) : array
Returns an associative array containing the metadata about the specified language. | ||
Parameters |
lang |
Language to get metadata for |
Returns |
Associative array of metadata; returns null on failure |
getName( ) : string
Gets the name of the language. | |
Returns |
Language Name |
getOrphans( ) : array
Gets the orphan strings. This is an array of strings that could not be translated. This information is only collated if the language object is in debug mode. | |
Returns |
Array of orphan (not translated) strings |
getPaths( extension : string=null ) : array
Gets an array of loaded language file paths. If | ||
Parameters |
[extension] |
Name of the extension |
Returns |
Array of loaded language file paths |
getPdfFontName( ) : string
Gets the PDF font name. | |
Returns |
PDF font name |
getTag( ) : string
Gets the language tag, for example | |
Returns |
Language tag |
getUsed( ) : array
Gets an array of strings that were successfully translated. | |
Returns |
Array of successfully translated strings |
getWinCP( ) : string
Gets the Windows Code Page name. | |
Returns |
Windows Code Page name |
hasKey( key : string ) : boolean
Checks if a translation exists. | ||
Parameters |
key |
Translation to look for |
Returns |
|
isRTL( ) : boolean
Checks if the language is written right-to-left. | |
Returns |
|
load( extension : string=‘joomla’, basePath : string=JPATH_BASE ) : boolean
Loads a language file. | ||
Parameters |
[extension] |
Name of the extension |
[basePath] |
Basis for building language path | |
Returns |
|
setDebug( debug : boolean ) : boolean
Turns debug on or off. | ||
Parameters |
debug |
Turn debug on or off |
Returns |
Previous debug value |
setDefault( lang : string ) : string
Sets the default language. | ||
Parameters |
lang |
Default language |
Returns |
Previous default language value |
setLanguage( lang : string ) : string
Sets the language and loads the metadata. This does not load the translations; use the | ||
Parameters |
lang |
Language identifier |
Returns |
Returns previous language |
_( string : string, jsSafe : boolean=false ) : string
Attempts to translate | ||
Parameters |
string |
String to translate |
[jsSafe] |
Add slashes to translated string | |
Returns |
Translated string |
_load( filename : string, extension : string=‘unknown’ ) : mixed
Loads a language file and returns an associative array of translations. | ||
Parameters |
filename |
Language path and filename to load |
[extension] |
Name of the extension | |
Returns |
Associative array of translations; |
_getCallerInfo( ) : array
Gets back-trace information that can be used to determine where a method call originated. | |
Returns |
Back-trace information |
_parseLanguageFiles( dir : string=null ) : array
Gets a two-dimensional associative array of all the languages in the path specified by | ||
Parameters |
[dir] |
Path to look for languages in |
Returns |
Two-dimensional associative array of languages and metadata |
_parseXMLLanguageFile( path : string ) : array
Parses an individual XML language information file and returns an array of metadata. | ||
Parameters |
path |
Path to XML language information file |
Returns |
Associative array of metadata |
_parseXMLLanguageFiles( dir : string=null ) : array
Gets a two-dimensional associative array of all the XML language information files in | ||
Parameters |
[dir] |
Path to XML language information files |
Returns |
Two-dimensional associative array of languages and metadata |
static |
Performs language functions that are not specific to an individual language |
static detectLanguage( ) : string
Attempts to detect the language using the HTTP headers. If unable to detect, assumes | |
Returns |
Detected language |
static createLanguageList( actualLanguage : string, basePath : string=JPATH_BASE, caching : boolean=true ) : array
Gets an array of language options. Each element is an associative array with three keys, | ||
Parameters |
actualLanguage |
Current language |
[basePath] |
Path in which to find known languages | |
[caching] |
Use cached response | |
Returns |
Two-dimensional array of language options |
static printf( string : string ) : int
Works like the PHP | ||
Parameters |
string |
String to translate |
(extra arguments) |
Multiple arguments to insert into | |
Returns |
Length of translated string |
static sprintf( string : string ) : string
Works like the PHP | ||
Parameters |
string |
String to translate |
(extra arguments) |
Multiple arguments to insert into | |
Returns |
Translated string |
static _( string : string, jsSafe : boolean=false ) : string
Attempts to translate | ||
Parameters |
string |
String to translate |
[jsSafe] |
Add slashes | |
Returns |
Translated string |
abstract, extends JObject |
This class is used to aid integration of extensions into Joomla!. A core use of this class enables the selection of bespoke parameters options when creating new menu items. The class is used in conjunction with an XML definition of an element, and used extensively by the JParameter class. For more information about JElement refer to the Parameters (Core JElements) section in this Appendix. |
__construct( parent : object=null ) : JElement
Builds a new JElement object and sets the parent object. | ||
Parameters |
[parent] |
Parent object |
fetchElement( name : string, value : string, &xmlElement : JSimpleXMLElement, control_name : string ) : string
Gets the rendered element. This method must be overridden in subclasses. For example, the output could be:
<input type="text" name="controlName[name]" id="controlNamename" value="value" class="text_area" size="20" />
| ||
Parameters |
name |
Name and ID suffix |
value |
Value | |
xmlElement |
JSimpleXMLElement element definition | |
control_name |
Name and ID prefix | |
Returns |
Rendered element |
fetchTooltip( label : string, description : string, &xmlElement : JSimpleXMLElement, control_name : string=”, name : string=” ) : string
Gets a tooltip, encapsulated in HTML label tags. | ||
Parameters |
label |
Content and title |
description |
Title suffix | |
xmlElement |
JSimpleXMLElement element definition | |
[control_name] |
ID prefix | |
[name] |
ID suffix | |
Returns |
HTML tooltip |
Gets the name of the element. | |
Returns |
Element name |
render( &xmlElement : JSimpleXMLElement, value : string, control_name : string=‘params’ ) : array
Gets an array containing the rendered parts and attributes of the element. The array contains six items in order, tooltip | ||
Parameters |
xmlElement |
JSimpleXMLElement element definition |
value |
Element value | |
[control_name] |
Name of the control | |
Returns |
An array containing rendered parts and attributes of the element |
extends JRegistry |
Handles INI string parameters. This class is used in conjunction with JElement subclasses and XML files that define the nature of parameters. INI strings are used in database tables for values that do not have a specific field. An instance of the class can be used to handle multiple INI strings (with different XML definitions), using groups to separate each one. When dealing with one INI string, omitting the group will always use the default group, |
_elementPath : array |
Array of paths in which to find JElement subclasses (not restricted to groups) |
_elements : array |
Associative array of JElement objects (not restricted to groups) |
_raw : string |
INI string |
_xml : array |
Associative array of JSimpleXMLElement objects that define parameters (one object per group) |
__construct( data : string, path : string=” ) : JParameter
Builds a new JParameter object and loads | ||
Parameters |
data |
INI string |
[path] |
Path to XML file |
addElemenrPath( path : mixed ) : void
Adds a path, or array of paths, to search for JElement subclass files. | ||
Parameters |
path |
Path or array of paths |
bind( data : mixed, group : string=’ _default’ ) : boolean
Binds data with parameters in the specified group. | ||
Parameters |
data |
Data to bind |
[group] |
Parameter group | |
Returns |
|
def( key : string, value : string=”, group : string= ‘_default’ ) : string
If the parameter is not defined, sets the value of the parameter in the specified group. | ||
Parameters |
key |
Parameter to get |
[value] |
Value if not defined | |
[group] |
Parameter group | |
Returns |
Up-to-date value of the parameter |
get( key : string, default : string=”, group : string=‘_default’ ) : string
Gets the value of a parameter in the specified group. Returns the default value if the parameter is not set. | ||
Parameters |
key |
Parameter to retrieve |
[default] |
Default value to return | |
[group] |
Parameter group | |
Returns |
Value of the parameter |
getGroups( ) : mixed
Gets an associative array of the group names and the number of parameters in each, defined by the corresponding JSimpleXMLElement object. Groups that do not have a JSimpleXMLElement object will not be included. | |
Returns |
Associative array of group names and number of parameters in each. Returns |
getNumParams( group : string=’ _default’ ) : mixed
Gets the number of parameters defined by the associated JSimpleXMLElement object, in the specified | ||
Parameters |
[group] |
Parameter group |
Returns |
Number of parameters; |
getParam( &node : JSimpleXMLElement, control_name : string=‘params’, group : string=’ _default’ ) : mixed
Gets an array of parameter details from a group. The array contains six items in order: tooltip | ||
Parameters |
Node |
JSimpleXMLElement parameter to render |
[control_name] |
Input names | |
[group] |
Parameter group | |
Returns |
Array of parameter details from a group |
getParams( name : string=‘params’, group : string=’ _default’ ) : mixed
Gets a two-dimensional array of all the parameters in a group. The inner arrays contain six items in order: tooltip | ||
Parameters |
[name] |
Input names and ID prefix |
[group] |
Parameter group | |
Returns |
Two-dimensional array of all the parameters in a group; |
&loadElement( type : string, new : boolean=false ) : mixed
Gets an instance of a JElement subclass object based on | ||
Parameters |
path |
Path to XML file |
[new] |
Force create new instance | |
Returns |
Instance of a JElement object; |
loadSetupFile( path : string ) : boolean
Builds a JSimpleXMLElement object from an XML file. The XML file can include the group name; if it does not, the group | ||
Parameters |
path |
Path to XML file |
Returns |
|
render( name : string=‘params’, group : string=’ _default’ ) : mixed
Renders a group within the parameters and returns an HTML string. | ||
Parameters |
[name] |
Input names and ID prefix |
[group] |
Parameter group | |
Returns |
HTML rendered string; |
renderToArray( name : string=‘params’, group : string=’ _default’ ) : mixed
Renders a group within the parameters and returns an array of HTML strings. | ||
Parameters |
[name] |
Input names and ID prefix |
[group] |
Parameter group | |
Returns |
Array of HTML rendered parameters; |
set( key : string, value : string=”, group : string=‘_default’ ) : string
Sets the value of a parameter in the specified group. | ||
Parameters |
key |
Parameter to set |
[value] |
New value | |
[group] |
Parameter group | |
Returns |
Previous value of the parameter |
setXML( &xml : JSimpleXMLElement ) : void
Sets an XML definition; the group is extracted from the group attribute of the object. | ||
Parameters |
[xml] |
JSimpleXMLElement object to add |
abstract, extends JObject |
Handles caching. Several subclasses exist for caching different items; subclasses are sometimes referred to as JCache types. JCache uses JCacheStorage subclass objects to store and retrieve cache data. |
__construct( options : array ) : JCache
Builds a new JCache object. The | ||
Parameters |
options |
Associative array of options |
clean( group : string=null, mode : string=‘group’ ) : boolean
Removes all cached items in | ||
Parameters |
[group] |
Selected group |
[mode] |
Cleaning mode | |
Returns |
|
gc( ) : boolean
Removes any redundant cached data (data that has expired). | |
Returns |
|
get( id : string, group : string=null ) : mixed
Gets cached data. Cached data is identified by an ID and a group. Returns | ||
Parameters |
id |
Cached data ID |
[group] |
Cached data group | |
Returns |
Cached data; |
static &getInstance( type : string=‘output’, options : array=array() ) : JCache
Gets a new instance of a JCache subclass object based on | ||
Parameters |
[type] |
JRegistry instance identifier |
[options] |
Options to pass to the constructor | |
Returns |
A new instance of a JCache derived object |
Gets an array of storage handler names that will operate correctly in the current environment. | |
Returns |
Array of storage handler names |
remove( id : string, group : string=null ) : boolean
Removes cached data, identified by | ||
Parameters |
id |
Cached data ID |
[group] |
Cached data group | |
Returns |
|
setCacheValidation( ) : void
Deprecated; this method no longer performs any action, and there is no replacement function or method. |
setCaching( enabled : boolean ) : void
Enables and disables caching. | ||
Parameters |
enabled |
Turn caching on or off |
setLifeTime( lt : int ) : void
Sets the maximum lifetime of cached items in seconds. | ||
Parameters |
lt |
Lifetime of cached items in seconds |
store( data : string, id : string, group : string=null ) : boolean
Adds data to the cache, identified by | ||
Parameters |
data |
Data to chache |
id |
Cached data ID | |
[group] |
Cached data group | |
Returns |
|
&_getStorageHandler( ) : JCacheStorage
Gets the cache storage handler. If the handler does not exist it will be created. | |
Returns |
Cache storage object |
extends PHPMailer |
Sends emails. |
addAtachment( attachment : mixed ) : void
Adds one attachment if | ||
Parameters |
attachment |
Attachment file path or array of attachment file paths |
addBCC( bcc : mixed ) : void
Adds one blind carbon copy recipient if | ||
Parameters |
bcc |
Email address string or array of email addresses |
addCC( cc : mixed ) : void
Adds one carbon copy recipient if | ||
Parameters |
cc |
Email address string or array of email addresses |
addRecipient( recipient : mixed ) : void
Adds one recipient if | ||
Parameters |
recipient |
Email address string or array of email addresses |
addReplyTo( replyto : array ) : void
Sets the reply-to email address and name. | ||
Parameters |
from |
Email address array |
static &getInstance( id : string=‘Joomla’ ) : JMail
Gets a reference to a global instance of a JMail object. If the object does not exist it will be created. | ||
Parameters |
[id] |
JMail ID |
Returns |
Reference to a global JMail object |
&Send( ) : mixed
Sends the email. | |
Returns |
|
setBody( content : string ) : void
Sets the email body. | ||
Parameters |
content |
Email body |
setSender( from : mixed ) : void
Sets the sender’s email address and name. | ||
Parameters |
from |
Email address string or array of email address and email name |
setSubject( subject : string ) : void
Sets the email subject line. | ||
Parameters |
subject |
Email subject line |
useSendmail( sendmail : string=null ) : boolean
If | ||
Parameters |
[sendmail] |
Path to sendmail |
Returns |
|
useSMTP( auth : boolean=null, host : string=null, user : string=null, pass : string=null ) : boolean
If all parameters are specified, sets the object to use SMTP. If any of the parameters are not specified, sets the object to use the PHP | ||
Parameters |
[auth] |
Use SMTP authorization |
[host] |
SMTP host | |
[user] |
Username | |
[pass] |
Password | |
Returns |
|
static cleanAddress( address : string ) : mixed
Determines if an email address is clean. An unclean email address may include spaces, semicolons, and commas. | ||
Parameters |
address |
Address to clean |
Returns |
Email address or |
static cleanBody( body : string ) : string
Cleans a multi-line string for use in an email body. Removes unsafe characters and potentially confusing MIME header strings. | ||
Parameters |
body |
String to clean |
Returns |
Cleaned string |
static cleanLine( value : string ) : string
Cleans a line for use in an email. Removes unsafe characters. | ||
Parameters |
value |
String to clean |
Returns |
Cleaned string |
static cleanSubject( subject : string ) : string
Cleans an email subject line. Removes unsafe characters and potentially confusing MIME header strings. | ||
Parameters |
subject |
String to clean |
Returns |
Cleaned string |
static cleanText( value : string) : string
Cleans a multi-line string for use in an email. Removes unsafe characters and potentially confusing MIME header strings. | ||
Parameters |
value |
String to clean |
Returns |
Cleaned string |
static isEmailAddress( email : string ) : boolean
Checks if | ||
Parameters |
|
Email to validate |
Returns |
|
static |
Joomla! static factory class for accessing global objects and building new objects. |
static &getACL( ) : JAuthorization
Gets the global authorization object. If the authorization object does not exist it will be created. | |
Returns |
Global authorization object |
static &getCache( group : string=”, handler : string=‘callback’, storage : string=null ) : JCache
Gets the global cache object. If the cache object does not exist it will be created. | ||
Parameters |
[group] |
Cache group |
[handler] |
Handler type | |
[storage] |
Storage type | |
Returns |
Global cache object |
static &getConfig( file : string=null, type : string=‘PHP’ ) : JRegistry
Gets the global configuration object. If the object does not exist, it will be created. | ||
Parameters |
file |
Path and name of the configuration file |
[type] |
Type of configuration file | |
Returns |
Global configuration object |
static &getDBO( ) : JDatabase
Gets the global database object. If the database object does not exist it will be created. | |
Returns |
Global database object |
static &getDocument( ) : JDocument
Gets the global document object. If the document object does not exist it will be created. | |
Returns |
Global document object |
static &getEditor( editor : string=null ) : JEditor
Gets a new instance of the specified editor. If | ||
Parameters |
[editor] |
Type of editor |
Returns |
A new editor object |
static &getLanguage( ) : JLanguage
Gets the global language object. If the language object does not exist it will be created. | |
Returns |
Global language object |
static &getMailer( ) : JMail
Gets the global mail object loaded with the site mail settings. If the mail object does not exist it will be created. | |
Returns |
Global mail object |
static &getSession( options : array=array() ) : JSession
Gets the global session object. If the session does not exist it will be created. The | ||
Parameters |
[options] |
Options to pass to the session storage handler |
Returns |
Global session object |
static &getTemaplate( ) : JTemplate
Gets the global template object. If the template object does not exist it will be created. | |
Returns |
Global template object |
static &getURI( uri : string=‘SERVER’ ) : JURI
Gets a global instance of the specified JURI object. If | ||
Parameters |
[uri] |
URI |
Returns |
A global JURI object. |
static &getUser( ) : JUser
Gets the current user object. | |
Returns |
Global user object |
static &getXMLParser( type : string=‘DOM’, options : array=array() ) : object
Creates a new XML Parser object. Supported types are | ||
Parameters |
[type] |
Type of Parser |
[options] |
Parser options | |
Returns |
A new XML parser object |
static &_createACL( ) : JAuthorization
Creates the global authorization object. | |
Returns |
New global authorization object |
static &_createConfig( file : string, type : string=‘PHP’ ) : JRegistry
Creates the global configuration object. | ||
Parameters |
file |
Path to the configuration file |
[type] |
Type of configuration file | |
Returns |
New global configuration object |
static &_createDBO( ) : JDatabase
Creates the database object. | |
Returns |
New global database object |
static &_createDocument( ) : JDocument
Creates the global document object. The document type is determined by the value of the | |
Returns |
New global document object |
static &_createLanguage( ) : JLanguage
Creates the language object. | |
Returns |
New global language object |
static &_createMailer( ) : JMail
Creates the global mail object. | |
Returns |
New global mail object |
static &_createSession( options : array=array() ) : JSession
Creates the global session object. If the session has expired, it will be restarted. | ||
Parameters |
[options] |
Session storage handler options |
Returns |
New global session object |
static &_createTemplate( ) : JTemplate
Creates the template object. | |
Returns |
New global template object |
extends JObject |
Handles configuration details in a hierarchy using namespaces. |
__construct( namespace : string=‘default’ ) : JRegistry
Builds a new JRegistry object and adds the namespace, setting it as the default. | ||
Parameters |
[namespace] |
Default namespace |
static &getInstance( id : string, namespace : string=‘default’ ) : JRegistry
Gets a global instance of JRegistry, identified by | ||
Parameters |
id |
JRegistry instance ID |
[namespace] |
Default namespace, only used if the instance does not exist | |
Returns |
A global instance of JRegistry |
getNameSpaces( ) : array
Gets the names of all the namespaces in the registry. | |
Returns |
Array of namespace names |
getValue( regpath : string, default : mixed=null ) : mixed
Gets a value from the registry. | ||
Parameters |
regpath |
Path to value |
[default] |
Default value | |
Returns |
Value of the item identified by |
loadArray( array : array, namespace : string=null ) : boolean
Loads an associative array into the registry namespace. The | ||
Parameters |
array |
Associative array to load |
[namespace] |
The namespace to load the array into | |
Returns |
|
loadFile( file : string, format : string=‘INI’, namespace : string=null ) : boolean
Loads a configuration file into the registry namespace. The file parameter keys must not contain periods. Possible formats are | ||
Parameters |
file |
File path |
[format] |
File format | |
[namespace] |
Namespace to load the file into | |
Returns |
|
loadINI( data : string, namespace : string=null ) : boolean
Loads an INI string into the registry namespace. The INI parameter keys must not contain periods. If the namespace is not specified, the default namespace will be used. | ||
Parameters |
data |
INI string |
[namespace] |
The namespace to load the INI into | |
Returns |
|
loadObject( &object : object, namespace : string=null ) : boolean
Loads public properties of an object into the registry namespace. If the namespace is not specified, the default namespace will be used. | ||
Parameters |
object |
Object to load |
[namespace] |
The namespace to load the object into | |
Returns |
|
loadXML( data : string, namespace : string=null ) : boolean
Loads an XML string into the registry namespace. The XML parameter keys must not contain periods. If the namespace is not specified, the default namespace will be used. | ||
Parameters |
data |
XML string |
[namespace] |
Namespace to load the XML into | |
Returns |
|
makeNameSpace( namespace : string ) : boolean
Creates a new namespace in the registry. If the namespace already exists, it will be overwritten. | ||
Parameters |
namespace |
Namespace to create |
Returns |
|
merge( &source : JRegistry ) : boolean
Merges the registry data with | ||
Parameters |
source |
JRegistry to merge from |
Returns |
|
setValue( regpath : string, value : mixed ) : mixed
Sets a value in the registry. The | ||
Parameters |
regpath |
Path to value |
value |
Value | |
Returns |
Previous value |
toArray( namespace : string=null ) : array
Gets an associative array representation of the registry namespace. If | ||
Parameters |
namespace |
The namespace to get |
Returns |
Array representation of the registry |
toObject( namespace : string=null ) : array
Gets an object (stdClass) representation of the registry namespace. If | ||
Parameters |
[namespace] |
The namespace to load the array into |
Returns |
Object representation of the registry |
toString( format : string=‘INI’, namespace : string=null, params : mixed) : string
Gets a string representation of the registry namespace in the specified format. Possible formats are | ||
Parameters |
[format] |
Registry format handler name |
[namespace] |
The namespace to get | |
[params] |
Options to pass to the format handler | |
Returns |
String representation of the registry |
extends JObject |
Handles a user session and stores session data in namespaces. For more information about sessions refer to Chapter 7. |
_expire : int |
Length of inactive time before session expires. |
_security : array |
Security session validation options. Can include the keys |
_state : string |
State of the session ( |
_store : JSessionStorage |
Session storage handler |
__construct( store : string=‘none’, options : array=array() ) : JSession
Builds a new JSession object. | ||
Parameters |
[store] |
Storage handler type |
[options] |
Options to pass to the storage handler |
clear( name : string, namespace : string=‘default’ ) : mixed
Removes a value from the session. | ||
Parameters |
name |
Name of value to remove |
[namespace] |
Namespace to remove the value from | |
Returns |
Cleared value |
close( ) : void
Closes the session gracefully. |
destroy( ) : boolean
Resets the session removing any existing session data. This does not remove the session cookie or session | |
Returns |
|
fork( ) : boolean
Creates a new session, and copies the exiting session data to the new session. | |
Returns |
|
&get( name : string, default : mixed=‘null’, namespace : string=‘default’ ) : mixed
Gets a value from the session. If the value is not set, | ||
Parameters |
name |
Name of the value to retrieve |
[default] |
Default value | |
[namespace] |
Namespace to retrieve the value from | |
Returns |
Value from the session |
getExpire( ) : int
Gets the number of inactive minutes to wait before the session expires. | |
Returns |
Session lifetime in minutes |
getId( ) : string
Gets the ID of the session. Returns null if the session has been destroyed. | |
Returns |
Session ID |
static &getInstance( handler : string, options : array ) : JSession
Gets the global instance of JSession. If it doesn’t already exist it will be created. | ||
Parameters |
handler |
Storage handler type |
options |
Options to pass to the storage handler | |
Returns |
Global session object |
getName( ) : string
Gets the name of the session. Returns null if the session has been destroyed. | |
Returns |
Session name |
getState( ) : string
Gets the state of the session ( | |
Returns |
State of the session |
getStores( ) : array
Gets the names of session storage handlers that work in the current environment. | |
Returns |
Array of session storage handler names |
getToken( forceNew : boolean=false ) : string
Gets the session token. The token is a random alphanumeric string that can be used to increase security of requests. | ||
Parameters |
[forceNew] |
Create a new token |
Returns |
Token string |
has( name : string, namespace : string=‘default’ ) : boolean
Checks if a value is set in the session. | ||
Parameters |
name |
Name of value to check |
[namespace] |
Namespace to check the value in | |
Returns |
|
hasToken( tCheck : string, forceExpire : boolean=true ) : boolean
Compares the session token with | ||
Parameters |
tCheck |
Token to check session against |
forceExpire |
Expire session if invalid token | |
Returns |
|
isNew( ) : boolean
Dtermines if the session was created during this request. | |
Returns |
|
restart( ) : boolean
Restarts the session. This will remove any existing session data. | |
Returns |
|
set( name : string, value : mixed, namespace : string=‘default’ ) : mixed
Sets a value in the session. | ||
Parameters |
name |
Name of value to set |
value |
Value | |
[namespace] |
Namespace to set the value in | |
Returns |
Previous value |
_createId( ) : string
Creates a new session ID. | |
Returns |
A new session ID |
_createToken( ) : string
Creates a new token. | |
Returns |
New token string |
_setCounter( ) : boolean
Increments the session counter. Must only be invoked once per request. | |
Returns |
|
_setOptions( &options : array ) : boolean
Sets session options. The | ||
Parameters |
options |
Session options |
Returns |
|
_setTimers( ) : boolean
Sets the session timers. Includes the session start time, the last request time, and the current request time. | |
Returns |
|
Starts the session. Continues a previous session or creates a new session. Equivalent to the PHP | |
Returns |
|
_validate( restart : boolean=false ) : boolean
Validates the session. If the session has exceeded the maximum expiry time, the session state will be changed to | ||
Parameters |
[restart] |
Restart the session if the session state is not active |
Returns |
|
static, extends JObject |
Handles internal URIs. |
static _( url : string, xhtml : boolean=true, ssl : int=0 ) : string
Converts a URI into a Search Engine-Friendly (SEF) URI. This method should be used for all internal URIs. No processing will be performed if we are in the administrative area. | ||
Parameters |
url |
URI to convert |
xhtml |
Make URI XHTML standard | |
ssl |
URI is SSL | |
Returns |
Converted URI |
extends JObject |
Handles menus and menu items. |
_active : int |
ID of the current menu item |
_default : int |
ID of the default homepage menu item |
_items : array |
Array of menu items (stdClass objects) |
Builds a new JMenu object and loads all of the published menu items for every menu. |
authorize( id : int, accessid : int=0 ) : boolean
Checks the user group has rights to view the menu item. | ||
Parameters |
id |
Menu item ID |
[accessed] |
Legacy group ID | |
Returns |
|
&getActive( ) : boolean
Gets the current menu item. Gets the default menu item if the current item is not set. | |
Returns |
Active menu item; returns null on failure |
&getDefault( ) : object
Gets the default menu item (homepage). | |
Returns |
Default menu item object |
static &getInstance( ) : JMenu
Gets the global instance of JMenu, creating it if it does not exist. | |
Returns |
Global instance of JMenu |
&getItem( id : int ) : object
Gets a menu item based on | ||
Parameters |
id |
Menu item ID |
Returns |
Menu item object |
getItems( attribute : string, value : string, firstonly : boolean=false) : mixed
Gets an active menu item or an array of menu items. Returned active menu item attributes must match the specified | ||
Parameters |
attribute |
Attribute to check |
value |
Value to check attribute against | |
[firstonly] |
Only get the first matching menu item | |
Returns |
A menu item or an array of menu items |
getMenu( ) : JParameter
Gets a copy of all the menu items. | |
Returns |
Array of menu items |
&getParams( id : int ) : JParameter
Gets the parameters of the specified menu item. If the menu item does not exist, or is not published, returns an empty JParameter object. | ||
Parameters |
id |
Menu item ID |
Returns |
JParameter object populated with the parameters from the specified menu item |
&setActive( id : int ) : boolean
Sets the active menu item. | ||
Parameters |
id |
Menu item ID |
Returns |
|
setDefault( id : int ) : boolean
Sets the default menu item (homepage). | |
Returns |
|
_load( ) : mixed
Loads published menu items from the | |
Returns |
Array of published menu items; |
Handles breadcrumbs. This class is used to model the breadcrumb trail, which is used in most templates as a way of describing a user’s current position within a Joomla! site. For more information about the breadcrumb trail refer to Chapter 9. |
addItem( name : string, link : string=” ) : boolean
Adds a breadcrumb to the end of the trail. | ||
Parameters |
name |
Name of breadcrumb |
[link] |
Breadcrumb URI | |
Returns |
|
getPathWay( ) : array
Gets an array of the breadcrumbs. Breadcrumbs are represented as stdClass objects with two properties, | |
Returns |
Array of breadcrumbs in order of display |
getPathWayNames( ) : array
Gets an array of breadcrumb names. | |
Returns |
Array of breadcrumb names in order |
setItemName( id : int, name : string ) : boolean
Sets the name of a breadcrumb. | ||
Parameters |
id |
Breadcrumb number |
name |
Breadcrumb name | |
Returns |
|
_makeItem( name : string, link : string ) : object
Builds a new menu item and returns it. | ||
Parameters |
name |
Name of new breadcrumb |
link |
Breadcrumb URI | |
Returns |
New breadcrumb object (stdClass) |
abstract, extends JObject |
Handles a database connection. There are two core subclasses (sometimes called drivers or adapters), JDatabaseMySQL and JDatabaseMySQLi. Additional subclasses, enabling support of other database servers, are intended to be added later. For more information about JDatabase refer to Chapter 3. |
_cursor : mixed |
Result of last |
_debug : int |
Debug mode; 0 = disabled, 1 = enabled |
_errorMsg : string |
Error message from last query |
_errorNum : int |
Error number from last query |
_hasQuoted : boolean |
There are specific fieldnames to be quoted |
_limit : int |
Maximum number of records to return from a query |
_log : array |
Query history (only maintained if debug is enabled) |
_nameQuote : string |
Named SQL element quotes (tables, fields, databases) |
_nullDate : string |
Null date string |
_offset : int |
Record offset |
_quoted : array |
Array of values that should be quoted |
_resource : mixed |
Database resource |
_sql : string |
Current query |
_table_prefix : string |
Database table prefix, normally |
_ticker : int |
Number of queries executed (only maintained if debug is enabled) |
_utf : boolean |
Supports UTF-8 |
name : string |
Database driver name |
__construct( options: array ) : JDatabase
Builds a new JDatabase object and prepares the internal properties. Subclasses also connect to the specified database. | ||
Parameters |
options |
Database options |
Destructors
__destruct( ) : boolean
Runs when the object is destroyed. Ensures the database connection is closed cleanly. | |
Returns |
|
addQuoted( quoted : mixed ) : void
Adds a new value that should always be encapsulated in quotes. | ||
Parameters |
quoted |
String or array of values to quote |
BeginTrans( ) : void
Emulates ADOdb functionality. This method must be overridden in subclasses. If you intend to use this, please ensure the database driver supports it. |
CommitTrans( ) : string
Emulates ADOdb functionality. This method must be overridden in subclasses. If you intend to use this, please ensure the database driver supports it. |
connected( ) : boolean
Determines if the database connection is alive. | |
Returns |
|
debug( debug : int ) : void
Sets debug mode; | ||
Parameters |
debug |
Debug mode |
ErrorMsg( ) : string
Emulates ADOdb functionality . Gets the error message from the last query. If no error was encountered, the error message will be an empty string. | |
Returns |
Error message from the last query |
ErrorNo( ) : int
Emulates ADOdb functionality. Error number from the last query. If no error was encountered, the error number will be zero. | |
Returns |
Error number from the last query |
Execute( query : string ) : mixed
Emulates ADOdb functionality. Executes query. If the query is a | ||
Parameters |
query |
Query to execute. |
Returns |
JRecordSet object; |
explain( ) : string
Explains the current query. | |
Returns |
XHTML string describing the active query. |
GenID( foo1 : string=null, foo2 : int=null ) : mixed
Emulates ADOdb functionality. Gets a sequence ID for databases that are sequence aware (sequences are used with databases that allow multiple connections, to reduce the chance of errors). If you are creating an application that relies on sequences, ensure that the JDatabase subclass object supports | ||
Parameters |
foo1 |
Sequence name |
foo2 |
Start ID | |
Returns |
Sequence ID; normally an integer, but sometimes a string |
getAffectedRows( ) : int
Gets the total number of records that were affected by the last query. | |
Returns |
Number of records that were affected by the last query |
GetCol( query : string ) : array
Emulates ADOdb functionality. Executes query and returns an array of the first column from the resultant records. | ||
Parameters |
query |
Query to execute |
Returns |
Array of first column from records |
getCollation( ) : string
Gets the database collation. This method is not infallible for MySQL databases; MySQL allows the collation to be set at four different levels, server, database, table, and column. This method returns the collation used by | |
Returns |
Collation name |
static getConnectors( ) : array
Gets an array of the names of database drivers supported in the current environment. | |
Returns |
Array of available driver names |
getEscaped( text : string ) : string
Escapes a string for use as a value in a query. | ||
Parameters |
text |
String to escape |
Returns |
Escaped string |
getErrorMsg( escaped : boolean=false ) : string
Gets the error message from the last query. If no error was encountered returns an empty string. | ||
Parameters |
[escaped] |
Escape the message with slashes |
Returns |
Error message from the last query |
getErrorNum( ) : int
Gets the error number from the last query. If no error was encountered, returns | |
Returns |
Error number from the last query |
static &getInstance( options : array=array() ) : JDatabase
Gets a global instance of JDatabase, creating it if it does not already exist. An instance exists for every different set of | ||
Parameters |
options |
Database options |
Returns |
A global instance of JDatabase |
getNullDate( ) : string
Gets a null date string specific to the current database driver. | |
Returns |
Null date-time string |
getNumRows( cur : resource=null ) : mixed
Gets the number of records that were returned in the last query. If | ||
Parameters |
[cur] |
Database resource |
Returns |
Number of records that were returned in the last query; |
GetOne( query : string ) : string
Emulates ADOdb functionality. Executes | ||
Parameters |
query |
Query to execute |
Returns |
Value in the first field in the first record of the results |
getPrefix( ) : string
Gets the database table prefix, normally | |
Returns |
Database table prefix |
getQuery( ) : mixed
Gets the active query. | |
Returns |
Active query |
GetRow( query : string ) : array
Emulates ADOdb functionality. Executes | ||
Parameters |
query |
Query to execute |
Returns |
First record as an array |
getTableCreate( tables : array ) : array
Gets an associative array of table creation queries for the tables named in | ||
Parameters |
tables |
Array of table names |
Returns |
Associative array of table creation queries |
getTableFields( tables : array ) : array
Gets an associative array of table fields and types. For example, a table called
Array ( [jos_test] => Array ( [id] => int [name] => varchar ) )
| ||
Parameters |
tables |
Array of table names |
Returns |
Associative array of tables and table fields |
getTableList( ) : array
Gets the names of the tables in the database. | |
Returns |
Array of table names |
getUTFSupport( ) : boolean
Determines if the database supports UTF-8. | |
Returns |
|
getVersion( ) : string
Gets the database server version. | |
Returns |
Database server version |
hasUTF( ) : boolean
Determines if the database supports UTF-8. You should use | |
Returns |
|
insertid( ) : int
If the last query was an | |
Returns |
Inserted ID from the last query |
insertObject( table : string, &object : object, keyName : string=null ) : boolean
Treats | ||
Parameters |
table |
Table name |
object |
Record object | |
[keyName] |
Primary key | |
Returns |
|
isQuoted( fieldname : string ) : boolean
Determines if | ||
Parameters |
fieldname |
Fieldname to check |
Returns |
|
loadAssoc( ) : array
Executes the current query and gets the first record as an associative array. | |
Returns |
First record from query as an associative array |
loadAssocList( key : string=” ) : array
Executes the current query and gets a two-dimensional array of records. Each inner array represents a record as an associative array. If | ||
Parameters |
[key] |
Primary key |
Returns |
Two-dimensional array of records |
loadObject( ) : object
Executes the current query and returns the first record as an object (stdClass). | |
Returns |
First record from query as an object |
loadObjectList( key : string=” ) : array
Executes the current query and returns an array of record objects. Each object represents a record. If | ||
Parameters |
[key] |
Primary key |
Returns |
Array or associative array of record objects |
loadResult( ) : string
Executes the current query and gets the value in the first field of the first record. | |
Returns |
Value in the first field of the first record |
loadResultArray( numinarray : int= 0 ) : array
Executes the current query and gets an array of the specified column/field number from the resultant records. | ||
Parameters |
[numinarray] |
Column/Field number |
Returns |
Array of column from records |
loadRow( ) : array
Executes the current query and returns the first record as an array. | |
Returns |
First record from query as an array |
loadRowList( key : int=” ) : array
Executes the current query and returns a two-dimensional array of records. Each inner array represents a record as an array. If | ||
Parameters |
[key] |
Primary key |
Returns |
Two-dimensional array of records |
nameQuote( s : string ) : string
Encapsulates a string in quotes. This is for strings that are named SQL elements (tables, fields, databases), not values. | ||
Parameters |
s |
String to encapsulate |
Returns |
Quote encapsulated string |
PageExecute( sql : string, nrows : int, page : int, inputarr : boolean=false, sec2cache : int=0 ) : JRecordSet
Emulates ADOdb functionality. Executes query and returns the results in a JRecordSet object. | ||
Parameters |
sql |
Query to execute |
nrows |
Number of records per page | |
page |
Results page (pagination) | |
[inputarr] |
Ignored; emulation purposes only | |
[secs2cache] |
Ignored; emulation purposes only | |
Returns |
JRecordSet object |
query( ) : mixed
Executes the current query. If the query is successful and is a | |
Returns |
Database resource or |
queryBatch( abort_on_error : boolean=true, p_transaction_safe : boolean=false ) : mixed
Executes a batch of queries. If | ||
Parameters |
[abort_on_error] |
Stop batch process on error |
[p_transaction_safe] |
Perform as transaction | |
Returns |
|
Quote( text : string ) : string
Emulates ADOdb functionality. Encapsulates | ||
Parameters |
text |
String to encapsulate in quotes and escape |
Returns |
Quoted string |
replacePrefix( sql : string, prefix : string=‘#__’ ) : string
Substitutes occurrences of | ||
Parameters |
sql |
Query |
prefix |
Database table prefix to replace | |
Returns |
Query with correct table prefixes |
RollbackTrans( ) : string
Emulates ADOdb functionality. This method must be overridden in subclasses. If you intend to use this, please ensure the database driver supports it. |
stderr( showSQL : boolean=false ) : string
Gets an error report of the last error. If | ||
Parameters |
[showSQL] |
Display query |
Returns |
Error report |
SelectLimit( query : string, count : int, offset : int=0 ) : JRecordSet
Emulates ADOdb functionality. Executes query and returns the results in a JRecordSet object. | ||
Parameters |
query |
Query to execute |
count |
Maximum number of records | |
[offset] |
Start record | |
Returns |
JRecordSet object |
setUTF( ) : void
Prepares the database connection for UTF-8 strings. |
setQuery( sql : string, offset : int=0, limit : int=0, prefix : string=‘#__’ ) : void
Sets the next query to execute. | ||
Parameters |
sql |
Query |
[offset] |
Start record | |
[limit] |
Maximum number of records | |
[prefix] |
Table prefix to substitue |
static test( ) : boolean
Determines if the driver (subclass) is compatible with the current environment. | |
Returns |
|
updateObject( table : string, &object : object, keyName : string, updateNulls : boolean=true ) : boolean
Treats | ||
Parameters |
table |
Table name |
object |
Record object | |
keyName |
Primary key | |
[updateNulls] |
Update values even if they are null | |
Returns |
|
We can use the XML tag param
to define different parameters. Every param
tag must include the following attributes:
Attribute |
Description |
---|---|
description |
Description of the parameter |
label |
Human-readable name of the input; this will always be translated by JText |
name |
Name of the input |
type |
Type of parameter; this relates to JElement subclasses |
default |
The default value (this does not work for all elements) |
This is an example of a param
tag:
<param name="title" type="text" default="My Title" label="Title" description="Title of page" size="30" />
When we define the type we are informing Joomla! which JElement subclass to use to render the parameter. There are a number of core JElement subclasses available to us, each of which has its own set of attributes that modify the rendered output.
The following tables describe the parameter types from the core that we can use. Any attributes that are optional are encapsulated in square braces. Remember that when we use the param
tag we also need to include the attributes defined in the previous table.
category | ||
Displays a drop-down selection box of published categories. The first option in the selection box is always | ||
Parameters |
class |
CSS Style |
[section] |
Section ID or component name if using component-specific categories. If not specified, all content categories are displayed. |
editors |
Displays a drop-down selection box of all the published editors. The first option in the selection box is always |
filelist | ||
Displays a drop-down selection box of files in a specified directory. Can optionally include the options | ||
Parameters |
[directory] |
Directory where the files are located, relative to the root of Joomla! |
[exclude] |
RE file exclusion, applied after filter | |
[filter] |
RE filter to apply to file names | |
[hide_default] |
Hide the ‘use default’ option; Boolean | |
[hide_none] |
Hide the ‘do not use’ option; Boolean | |
[stripExt] |
Remove extensions from the file list; Boolean |
folderlist | ||
Displays a drop-down selection box of folders in a specified directory. Can optionally include the options | ||
Parameters |
[directory] |
Directory where the folders are located, relative to the root of Joomla! |
[exclude] |
RE folder exclusion, applied after filter | |
[filter] |
RE filter to apply to folder names | |
[hide_default] |
Hide the ‘use default’ option; Boolean | |
[hide_none] |
Hide the ‘do not use’ option; Boolean | |
[stripExt] |
Remove extensions from the folder list; Boolean |
helpsites |
Displays a drop-down selection box of the different Joomla! help sites. The help sites are defined in the core |
hidden | ||
A hidden field. We cannot define a value here; this type is used in conjunction with an INI string in which the value will be defined. | ||
Parameters |
[class] |
CSS Style |
imagelist | ||
Displays a drop-down selection box of image files in a specified directory. Can optionally include the options | ||
Parameters |
[directory] |
Directory where the folders are located, relative to the root of Joomla! |
[exclude] |
RE file exclusion, applied after filter | |
[hide_default] |
Hide the ‘use default’ option; Boolean | |
[hide_none] |
Hide the ‘do not use’ option; Boolean | |
[stripExt] |
Remove extensions from the file list; Boolean |
languages | ||
Displays a drop-down selection box of known languages from a specific client. | ||
Parameters |
client |
|
list | ||
Displays a drop-down selection box of specified options. Options are defined by sub-tags called | ||
Parameters |
[class] |
CSS Style |
menu |
Displays a drop-down selection box of the different menus. The first option is always |
menuitem | ||
Displays a drop-down selection box of the different menu items grouped by menu. The first option is always | ||
Parameters |
[state] |
Published state of the menu items |
password | ||
Displays a password text box. | ||
Parameters |
[class] |
CSS Style. |
[size] |
Character width of the password box; this is not the same as the maximum number of characters. |
radio | ||
Displays a selection of radio buttons. Options are defined by sub-tags called
<param name="show" type="radio" label="Hide/Show" description="Hide or Show"> <option value="0">Hide</option> <option value="1">Show</option> </param>
| ||
Parameters |
[class] |
CSS Style |
section |
Displays a drop-down selection box of published sections. The first option in the selection box is always |
sql | ||
Displays a drop-down selection box of items. The items are determined by executing the query attribute against the database. The query must return two fields, one called | ||
Parameters |
query |
Query to execute |
text | ||
Displays a text box. | ||
Parameters |
[class] |
CSS Style |
[size] |
Character width of the text box; this is not the same as the maximum number of characters |
textarea | ||
Displays a text box. | ||
Parameters |
[class] |
CSS Style |
cols |
Number of columns | |
rows |
Number of rows |
timezones |
Displays a drop-down selection box of different time zones. Values are identified as plus or minus hours from UTC (Universal Time Code); UTC is the same as GMT (Greenwich Mean Time), and Z (Zulu Time). |
The site settings are located in the config
namespace within the registry. Most of these settings originate from the configuration.php
file. This table details the values we expect to be present in the config
namespace:
Name |
Description |
---|---|
absolute_path |
Full path to the Joomla! installation, for example |
cache_handler |
Mechanism with which to handle caching; Joomla! supports APC, EAccelerator, Memcache, and File |
cachetime |
Cache life expectancy in seconds |
caching |
Caching enabled; |
db |
Database name |
dbprefix |
Database table prefix |
dbtype |
Database driver |
debug |
Site debug status; |
debug_db |
Database debug status; |
debug_lang |
Language debug status; |
editor |
Default editor |
error_reporting |
Error reporting level; |
feed_limit |
Number of content feed items to display |
feed_summary |
Display full text in feeds; |
fromname |
Mail email address alias, see mailfrom |
ftp_enable |
FTP access enabled; |
ftp_host |
FTP host, normally |
ftp_pass |
FTP account password |
ftp_port |
FTP port, normally 21 |
ftp_root |
FTP path to Joomla! installation |
ftp_user |
FTP account username |
gzip |
GZIP compression enabled; |
helpurl |
Joomla! help site |
host |
Host name |
lang |
Default language name |
lang_administrator |
Default backend language tag |
lang_site |
Default frontend language tag |
language |
Default language tag |
lifetime |
Session lifetime in minutes |
list_limit |
Default length of lists (pagination) in the backend |
live_site |
URI to the site |
log_path |
Path to the site LOG files |
mailer |
Email sending mechanism; Joomla! supports: PHP mail, sendmail, and SMTP |
mailfrom |
Default email sender address |
memcache_settings |
Settings for Memcache (serialized PHP data); Memcache is a PHP caching system |
MetaAuthor |
Global option to show the author’s meta tag when viewing a content item; |
MetaDesc |
Site metadata-description-tag content |
MetaKeys |
Site metadata keys tag content |
MetaTitle |
Display the site metadata title tag; |
offline |
Site offline; |
offline_message |
This site is down for maintenance. Please check back again soon. |
offset |
Time zone hours offset from UTC (also known as GMT and Z) |
password |
Database account password |
secret |
Secret site word (random alphanumeric string) |
sef |
SEF enabled; |
sef_rewrite |
Apache SEF mod_rewrite enabled; |
sendmail |
|
session_handler |
Session storage handling mechanism; Joomla! supports: APC, database EAccelerator, and Memcache |
sitename |
Name of the Joomla! installation |
smtpauth |
SMTP requires authorization; |
smtphost |
SMTP host, normally localhost |
smtppass |
SMTP account password |
smtpuser |
SMTP account username |
tmp_path |
Temporary directory; used for archive extraction |
user |
Database account username |
xmlrpc_server |
XMLRPC support; |