API16:JRegistryFormat/getInstance
From Joomla! Documentation
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.
Contents |
Description
Returns a Format object, only creating it if it doesn't already exist.
Description:JRegistryFormat/getInstance
Syntax
static getInstance($format)
| Parameter Name | Default Value | Description |
|---|---|---|
| $format | The format to load |
Returns
object Registry format handler
Defined in
libraries/joomla/registry/format.php
Importing
jimport( 'joomla.registry.format' );
Source Body
public static function getInstance($format) { static $instances; if (!isset ($instances)) { $instances = array (); } $format = strtolower(JFilterInput::getInstance()->clean($format, 'word')); if (empty ($instances[$format])) { $class = 'JRegistryFormat'.$format; if (!class_exists($class)) { $path = dirname(__FILE__).DS.'format'.DS.$format.'.php'; if (file_exists($path)) { require_once $path; } else { JError::raiseError(500,JText::_('Unable to load format class')); } } $instances[$format] = new $class (); } return $instances[$format]; }
[Edit See Also] SeeAlso:JRegistryFormat/getInstance
Examples
<CodeExamplesForm />
