class JRegistry


Located at : UKNOWVA_ROOT/libraries/joomla/registry/registry.php

JRegistry class

Methods

void
__construct(mixed $data = null)

Constructor

__clone()

Magic function to clone the registry object.

string
__toString()

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

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

Sets a default value if not already assigned.

boolean
exists(string $path)

Check if a registry path exists.

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

Get a registry value.

static object
getInstance(string $id)

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

boolean
loadArray(array $array)

Load a associative array of values into the default namespace

boolean
loadObject(object $object)

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

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

Load the contents of a file into the registry

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

Load a string into the registry

boolean
merge(object $source)

Merge a JRegistry object into this one

mixed
set(string $path, mixed $value)

Set a registry value.

array
toArray()

Transforms a namespace to an array

object
toObject()

Transforms a namespace to an object

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

Get a namespace in a given string format

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

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

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

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

boolean
loadJSON(string $data) deprecated

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

boolean
makeNameSpace(string $namespace) deprecated

Create a namespace

array
getNameSpaces() deprecated

Get the list of namespaces

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

Get a registry value

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

Set a registry value

boolean
loadSetupFile() deprecated

This method is added as an interim solution for API references in Joomla! 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.7 release.

Details

at line 40
void __construct(mixed $data = null)

Constructor

Parameters

mixed $data The data to bind to the new JRegistry object.

Return Value

void

at line 61
JRegistry __clone()

Magic function to clone the registry object.

Return Value

JRegistry

at line 73
string __toString()

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

Return Value

string

at line 88
string def(string $key, string $default = '')

Sets a default value if not already assigned.

Parameters

string $key The name of the parameter.
string $default An optional value for the parameter.

Return Value

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

at line 104
boolean exists(string $path)

Check if a registry path exists.

Parameters

string $path Registry path (e.g. joomla.content.showauthor)

Return Value

boolean

at line 139
mixed get(string $path, mixed $default = null)

Get a registry value.

Parameters

string $path Registry path (e.g. joomla.content.showauthor)
mixed $default Optional default value, returned if the internal value is null.

Return Value

mixed Value of entry or null

at line 184
static object getInstance(string $id)

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

This method must be invoked as:

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

Parameters

string $id An ID for the registry instance

Return Value

object The JRegistry object.

at line 208
boolean loadArray(array $array)

Load a associative array of values into the default namespace

Parameters

array $array Associative array of value to load

Return Value

boolean True on success

at line 224
boolean loadObject(object $object)

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

Parameters

object $object The object holding the publics to load

Return Value

boolean True on success

at line 242
boolean loadFile(string $file, string $format = 'JSON', mixed $options = array())

Load the contents of a file into the registry

Parameters

string $file Path to file to load
string $format Format of the file [optional: defaults to JSON]
mixed $options Options used by the formatter

Return Value

boolean True on success

at line 262
boolean loadString(string $data, string $format = 'JSON', mixed $options = array())

Load a string into the registry

Parameters

string $data String to load into the registry
string $format Format of the string
mixed $options Options used by the formatter

Return Value

boolean True on success

at line 282
boolean merge(object $source)

Merge a JRegistry object into this one

Parameters

object $source &$source Source JRegistry object to merge.

Return Value

boolean True on success

at line 307
mixed set(string $path, mixed $value)

Set a registry value.

Parameters

string $path Registry Path (e.g. joomla.content.showauthor)
mixed $value Value of entry

Return Value

mixed The value of the that has been set.

at line 339
array toArray()

Transforms a namespace to an array

Return Value

array An associative array holding the namespace data

at line 351
object toObject()

Transforms a namespace to an object

Return Value

object An an object holding the namespace data

at line 366
string toString(string $format = 'JSON', mixed $options = array())

Get a namespace in a given string format

Parameters

string $format Format to return the string in
mixed $options Parameters used by the formatter, see formatters for more info

Return Value

string Namespace in string format

at line 445
boolean loadXML(string $data, string $namespace = null) deprecated

deprecated 12.1

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

Parameters

string $data XML formatted string to load into the registry
string $namespace Namespace to load the XML string into [optional]

Return Value

boolean True on success

at line 463
boolean loadINI(string $data, string $namespace = null, mixed $options = array()) deprecated

deprecated 12.1

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

Parameters

string $data INI formatted string to load into the registry
string $namespace Namespace to load the INI string into [optional]
mixed $options An array of options for the formatter, or boolean to process sections.

Return Value

boolean True on success

at line 479
boolean loadJSON(string $data) deprecated

deprecated 12.1

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

Parameters

string $data JSON formatted string to load into the registry

Return Value

boolean True on success

at line 495
boolean makeNameSpace(string $namespace) deprecated

deprecated 12.1

Create a namespace

Parameters

string $namespace Name of the namespace to create

Return Value

boolean True on success

at line 510
array getNameSpaces() deprecated

deprecated 12.1

Get the list of namespaces

Return Value

array List of namespaces

at line 528
mixed getValue(string $path, mixed $default = null) deprecated

deprecated 12.1

Get a registry value

Parameters

string $path Registry path (e.g. joomla.content.showauthor)
mixed $default Optional default value

Return Value

mixed Value of entry or null

at line 550
mixed setValue(string $path, mixed $value) deprecated

deprecated 12.1

Set a registry value

Parameters

string $path Registry Path (e.g. joomla.content.showauthor)
mixed $value Value of entry

Return Value

mixed The value after setting.

at line 571
boolean loadSetupFile() deprecated

deprecated 12.1

This method is added as an interim solution for API references in Joomla! 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.7 release.

Return Value

boolean True.