JRegistry
JRegistry class
package |
Joomla.Platform |
---|---|
subpackage |
Registry |
since |
11.1 |
Methods
__clone
Magic function to clone the registry object.
__clone() : \JRegistry
__construct
Constructor
__construct(mixed $data = null)
since |
11.1 |
---|
Arguments
- $data
mixed
The 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
object
An object of data to return as an array.
Response
array
Array 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
mixed
An 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
string
The name of the parameter.- $default
string
An optional value for the parameter.
Response
string
The 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
string
Registry 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
string
Registry path (e.g. joomla.content.showauthor)- $default
mixed
Optional default value, returned if the internal value is null.
Response
mixed
Value 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
This method must be invoked as:
$registry = JRegistry::getInstance($id);
since |
11.1 |
---|
Arguments
- $id
string
An ID for the registry instance
Response
object
The JRegistry object.
getNameSpaces
Get the list of namespaces
getNameSpaces() : array
deprecated |
12.1 |
---|---|
note |
Namespaces are no longer supported. |
since |
11.1 |
Response
array
List of namespaces
getValue
Get a registry value
getValue(string $path, mixed $default = null) : mixed
deprecated |
12.1 |
---|---|
note |
Use get instead. |
since |
11.1 |
Arguments
- $path
string
Registry path (e.g. joomla.content.showauthor)- $default
mixed
Optional default value
Response
mixed
Value of entry or null
loadArray
Load a associative array of values into the default namespace
loadArray(array $array) : boolean
since |
11.1 |
---|
Arguments
- $array
array
Associative array of value to load
Response
boolean
True 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
string
Path to file to load- $format
string
Format of the file [optional: defaults to JSON]- $options
mixed
Options used by the formatter
Response
boolean
True 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
since |
11.1 |
---|---|
deprecated |
12.1 Use loadString passing INI as the format instead. |
Arguments
- $data
string
INI formatted string to load into the registry- $namespace
string
Namespace to load the INI string into [optional]- $options
mixed
An array of options for the formatter, or boolean to process sections.
Response
boolean
True 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 |
12.1 Use loadString passing JSON as the format instead. |
---|---|
note |
Use loadString instead. |
since |
11.1 |
Arguments
- $data
string
JSON formatted string to load into the registry
Response
boolean
True on success
loadObject
Load the public variables of the object into the default namespace.
loadObject(object $object) : boolean
since |
11.1 |
---|
Arguments
- $object
object
The object holding the publics to load
Response
boolean
True 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 |
12.1 |
---|---|
note |
Load no longer supported. |
since |
11.1 |
Response
boolean
True.
loadString
Load a string into the registry
loadString(string $data, string $format = 'JSON', mixed $options = array()) : boolean
since |
11.1 |
---|
Arguments
- $data
string
String to load into the registry- $format
string
Format of the string- $options
mixed
Options used by the formatter
Response
boolean
True 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
since |
11.1 |
---|---|
deprecated |
12.1 Use loadString passing XML as the format instead. |
note |
Arguments
- $data
string
XML formatted string to load into the registry- $namespace
string
Namespace to load the XML string into [optional]
Response
boolean
True on success
makeNameSpace
Create a namespace
makeNameSpace(string $namespace) : boolean
deprecated |
12.1 |
---|---|
note |
Namespaces are no longer supported. |
since |
11.1 |
Arguments
- $namespace
string
Name of the namespace to create
Response
boolean
True on success
merge
Merge a JRegistry object into this one
merge( &$source) : boolean
since |
11.1 |
---|
Arguments
- $source
Response
boolean
True on success
set
Set a registry value.
set(string $path, mixed $value) : mixed
since |
11.1 |
---|
Arguments
- $path
string
Registry Path (e.g. joomla.content.showauthor)- $value
mixed
Value of entry
Response
mixed
The value of the that has been set.
setValue
Set a registry value
setValue(string $path, mixed $value) : mixed
deprecated |
12.1 |
---|---|
note |
Use set instead. |
since |
11.1 |
Arguments
- $path
string
Registry Path (e.g. joomla.content.showauthor)- $value
mixed
Value of entry
Response
mixed
The value after setting.
toArray
Transforms a namespace to an array
toArray() : array
since |
11.1 |
---|
Response
array
An associative array holding the namespace data
toObject
Transforms a namespace to an object
toObject() : object
since |
11.1 |
---|
Response
object
An 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
string
Format to return the string in- $options
mixed
Parameters used by the formatter, see formatters for more info
Response
string
Namespace in string format
Properties
data
Registry Object
since |
11.1 |
---|
Type(s)
object
instances
JRegistry instances container.
since |
11.3 |
---|
Type(s)
array