class Factory

Joomla Platform Factory class.

Properties

static CMSApplication $application Global application object
static Cache $cache Global cache object
static JConfig $config Global configuraiton object
static array $dates Container for Date instances
static Session $session Global session object
static Language $language Global language object
static JDocument $document Global document object
static Access $acl Global ACL object
static JDatabaseDriver $database Global database object
static Mail $mailer Global mailer object

Methods

static  CMSApplication
getApplication( mixed $id = null, array $config = array(), string $prefix = 'J')

Get an application object.

static  Registry
getConfig( string $file = null, string $type = 'PHP', string $namespace = '')

Get a configuration object

static  Session
getSession( array $options = array())

Get a session object.

static  Language
getLanguage()

Get a language object.

static  JDocument
getDocument()

Get a document object.

static  User
getUser( integer $id = null)

Get a user object.

static  CacheController
getCache( string $group = '', string $handler = 'callback', string $storage = null)

Get a cache object

static  Access
getAcl()

Get an authorization object

static  JDatabaseDriver
getDbo()

Get a database object.

static  JMail
getMailer()

Get a mailer object.

static  mixed
getFeedParser( string $url, integer $cache_time)

Get a parsed XML Feed Source

static  mixed
getXml( string $data, boolean $isFile = true)

Reads a XML file.

static  Editor
getEditor( string $editor = null)

Get an editor object.

static  Uri
getUri( string $uri = 'SERVER')

Return a reference to the {@link Uri} object

static  Date
getDate( mixed $time = 'now', mixed $tzOffset = null)

Return the {@link Date} object

static  JStream
getStream( boolean $use_prefix = true, boolean $use_network = true, string $ua = null, boolean $uamask = false)

Creates a new stream object with appropriate prefix

Details

static CMSApplication getApplication( mixed $id = null, array $config = array(), string $prefix = 'J')

Get an application object.

Returns the global {@link CMSApplication} object, only creating it if it doesn't already exist.

Parameters

mixed $id A client identifier or name.
array $config An optional associative array of configuration settings.
string $prefix Application prefix

Return Value

CMSApplication object

Exceptions

Exception

See also

JApplication

static Registry getConfig( string $file = null, string $type = 'PHP', string $namespace = '')

Get a configuration object

Returns the global {@link \JConfig} object, only creating it if it doesn't already exist.

Parameters

string $file The path to the configuration file
string $type The type of the configuration file
string $namespace The namespace of the configuration file

Return Value

Registry

See also

Registry

static Session getSession( array $options = array())

Get a session object.

Returns the global {@link Session} object, only creating it if it doesn't already exist.

Parameters

array $options An array containing session options

Return Value

Session object

See also

Session

static Language getLanguage()

Get a language object.

Returns the global {@link Language} object, only creating it if it doesn't already exist.

Return Value

Language object

See also

Language

static JDocument getDocument()

Get a document object.

Returns the global {@link \JDocument} object, only creating it if it doesn't already exist.

Return Value

JDocument object

See also

\JDocument

static User getUser( integer $id = null)

Get a user object.

Returns the global {@link User} object, only creating it if it doesn't already exist.

Parameters

integer $id The user to load - Can be an integer or string - If string, it is converted to ID automatically.

Return Value

User object

See also

User

static CacheController getCache( string $group = '', string $handler = 'callback', string $storage = null)

Get a cache object

Returns the global {@link CacheController} object

Parameters

string $group The cache group name
string $handler The handler to use
string $storage The storage method

Return Value

CacheController object

See also

JCache

static Access getAcl()

Get an authorization object

Returns the global {@link Access} object, only creating it if it doesn't already exist.

Return Value

Access object

static JDatabaseDriver getDbo()

Get a database object.

Returns the global {@link \JDatabaseDriver} object, only creating it if it doesn't already exist.

Return Value

JDatabaseDriver

See also

\JDatabaseDriver

static JMail getMailer()

Get a mailer object.

Returns the global {@link \JMail} object, only creating it if it doesn't already exist.

Return Value

JMail object

See also

JMail

static mixed getFeedParser( string $url, integer $cache_time)

Get a parsed XML Feed Source

Parameters

string $url Url for feed source.
integer $cache_time Time to cache feed for (using internal cache mechanism).

Return Value

mixed SimplePie parsed object on success, false on failure.

Exceptions

BadMethodCallException

static mixed getXml( string $data, boolean $isFile = true)

Reads a XML file.

Parameters

string $data Full path and file name.
boolean $isFile true to load a file or false to load a string.

Return Value

mixed JXMLElement or SimpleXMLElement on success or false on error.

See also

JXMLElement

static Editor getEditor( string $editor = null)

Get an editor object.

Parameters

string $editor The editor to load, depends on the editor plugins that are installed

Return Value

Editor instance of Editor

Exceptions

BadMethodCallException

static Uri getUri( string $uri = 'SERVER')

Return a reference to the {@link Uri} object

Parameters

string $uri Uri name.

Return Value

Uri object

See also

Uri

static Date getDate( mixed $time = 'now', mixed $tzOffset = null)

Return the {@link Date} object

Parameters

mixed $time The initial time for the JDate object
mixed $tzOffset The timezone offset.

Return Value

Date object

See also

Date

static JStream getStream( boolean $use_prefix = true, boolean $use_network = true, string $ua = null, boolean $uamask = false)

Creates a new stream object with appropriate prefix

Parameters

boolean $use_prefix Prefix the connections for writing
boolean $use_network Use network if available for writing; use false to disable (e.g. FTP, SCP)
string $ua UA User agent to use
boolean $uamask User agent masking (prefix Mozilla)

Return Value

JStream

See also

\JStream