JRegistry

JRegistry class

package

Joomla.Platform

subpackage

Registry

since

11.1

Methods

__clone

Magic function to clone the registry object.

__clone() : \JRegistry
since

11.1

Response

\JRegistry

__construct

Constructor

__construct(mixed $data = null) 
since

11.1

Arguments

$data

mixedThe data to bind to the new JRegistry object.

__toString

Magic function to render this object as a string using default args of toString method.

__toString() : string
since

11.1

Response

string

asArray

Method to recursively convert an object of data to an array.

asArray(object $data) : array
since

11.1

Arguments

$data

objectAn object of data to return as an array.

Response

arrayArray representation of the input object.

bindData

Method to recursively bind data to a parent object.

bindData( &$parent, mixed $data) : void
since

11.1

Arguments

$parent

$data

mixedAn array or object of data to bind to the parent object.

def

Sets a default value if not already assigned.

def(string $key, string $default = '') : string
since

11.1

Arguments

$key

stringThe name of the parameter.

$default

stringAn optional value for the parameter.

Response

stringThe value set, or the default if the value was not previously set (or null).

exists

Check if a registry path exists.

exists(string $path) : boolean
since

11.1

Arguments

$path

stringRegistry path (e.g. joomla.content.showauthor)

Response

boolean

get

Get a registry value.

get(string $path, mixed $default = null) : mixed
since

11.1

Arguments

$path

stringRegistry path (e.g. joomla.content.showauthor)

$default

mixedOptional default value, returned if the internal value is null.

Response

mixedValue of entry or null

getInstance

Returns a reference to a global JRegistry object, only creating it if it doesn't already exist.

getInstance(string $id) : object
static

This method must be invoked as:

$registry = JRegistry::getInstance($id);
since

11.1

Arguments

$id

stringAn ID for the registry instance

Response

objectThe JRegistry object.

getNameSpaces

Get the list of namespaces

getNameSpaces() : array
deprecated
deprecated

12.1

note

Namespaces are no longer supported.

since

11.1

Response

arrayList of namespaces

getValue

Get a registry value

getValue(string $path, mixed $default = null) : mixed
deprecated
deprecated

12.1

note

Use get instead.

since

11.1

Arguments

$path

stringRegistry path (e.g. joomla.content.showauthor)

$default

mixedOptional default value

Response

mixedValue of entry or null

loadArray

Load a associative array of values into the default namespace

loadArray(array $array) : boolean
since

11.1

Arguments

$array

arrayAssociative array of value to load

Response

booleanTrue on success

loadFile

Load the contents of a file into the registry

loadFile(string $file, string $format = 'JSON', mixed $options = array()) : boolean
since

11.1

Arguments

$file

stringPath to file to load

$format

stringFormat of the file [optional: defaults to JSON]

$options

mixedOptions used by the formatter

Response

booleanTrue on success

loadINI

Load an INI string into the registry into the given namespace [or default if a namespace is not given]

loadINI(string $data, string $namespace = null, mixed $options = array()) : boolean
deprecated
since

11.1

deprecated

12.1 Use loadString passing INI as the format instead.

Arguments

$data

stringINI formatted string to load into the registry

$namespace

stringNamespace to load the INI string into [optional]

$options

mixedAn array of options for the formatter, or boolean to process sections.

Response

booleanTrue on success

loadJSON

Load an JSON string into the registry into the given namespace [or default if a namespace is not given]

loadJSON(string $data) : boolean
deprecated
deprecated

12.1 Use loadString passing JSON as the format instead.

note

Use loadString instead.

since

11.1

Arguments

$data

stringJSON formatted string to load into the registry

Response

booleanTrue on success

loadObject

Load the public variables of the object into the default namespace.

loadObject(object $object) : boolean
since

11.1

Arguments

$object

objectThe object holding the publics to load

Response

booleanTrue on success

loadSetupFile

This method is added as an interim solution for API references in the Joomla! CMS 1.6 to the JRegistry object where in 1.5 a JParameter object existed. Because many extensions may call this method we add it here as a means of "pain relief" until the 1.8 release.

loadSetupFile() : boolean
deprecated
deprecated

12.1

note

Load no longer supported.

since

11.1

Response

booleanTrue.

loadString

Load a string into the registry

loadString(string $data, string $format = 'JSON', mixed $options = array()) : boolean
since

11.1

Arguments

$data

stringString to load into the registry

$format

stringFormat of the string

$options

mixedOptions used by the formatter

Response

booleanTrue on success

loadXML

Load an XML string into the registry into the given namespace [or default if a namespace is not given]

loadXML(string $data, string $namespace = null) : boolean
deprecated
since

11.1

deprecated

12.1 Use loadString passing XML as the format instead.

note

Arguments

$data

stringXML formatted string to load into the registry

$namespace

stringNamespace to load the XML string into [optional]

Response

booleanTrue on success

makeNameSpace

Create a namespace

makeNameSpace(string $namespace) : boolean
deprecated
deprecated

12.1

note

Namespaces are no longer supported.

since

11.1

Arguments

$namespace

stringName of the namespace to create

Response

booleanTrue on success

merge

Merge a JRegistry object into this one

merge( &$source) : boolean
since

11.1

Arguments

$source

Response

booleanTrue on success

set

Set a registry value.

set(string $path, mixed $value) : mixed
since

11.1

Arguments

$path

stringRegistry Path (e.g. joomla.content.showauthor)

$value

mixedValue of entry

Response

mixedThe value of the that has been set.

setValue

Set a registry value

setValue(string $path, mixed $value) : mixed
deprecated
deprecated

12.1

note

Use set instead.

since

11.1

Arguments

$path

stringRegistry Path (e.g. joomla.content.showauthor)

$value

mixedValue of entry

Response

mixedThe value after setting.

toArray

Transforms a namespace to an array

toArray() : array
since

11.1

Response

arrayAn associative array holding the namespace data

toObject

Transforms a namespace to an object

toObject() : object
since

11.1

Response

objectAn an object holding the namespace data

toString

Get a namespace in a given string format

toString(string $format = 'JSON', mixed $options = array()) : string
since

11.1

Arguments

$format

stringFormat to return the string in

$options

mixedParameters used by the formatter, see formatters for more info

Response

stringNamespace in string format

Properties

data

Registry Object

since

11.1

Type(s)

object

instances

JRegistry instances container.

static
since

11.3

Type(s)

array