[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/libraries/joomla/registry/ -> format.php (source)

   1  <?php
   2  /**
   3   * @version        $Id: format.php 14401 2010-01-26 14:10:00Z louis $
   4   * @package        Joomla.Framework
   5   * @subpackage    Registry
   6   * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
   7   * @license        GNU/GPL, see LICENSE.php
   8   * Joomla! is free software. This version may have been modified pursuant
   9   * to the GNU General Public License, and as distributed it includes or
  10   * is derivative of works licensed under the GNU General Public License or
  11   * other free or open source software licenses.
  12   * See COPYRIGHT.php for copyright notices and details.
  13   */
  14  
  15  // Check to ensure this file is within the rest of the framework
  16  defined('JPATH_BASE') or die();
  17  
  18  /**
  19   * Abstract Format for JRegistry
  20   *
  21   * @abstract
  22   * @package     Joomla.Framework
  23   * @subpackage    Registry
  24   * @since        1.5
  25   */
  26  class JRegistryFormat extends JObject
  27  {
  28      /**
  29       * Returns a reference to a Format object, only creating it
  30       * if it doesn't already exist.
  31       *
  32       * @static
  33       * @param    string    $format    The format to load
  34       * @return    object    Registry format handler
  35       * @since    1.5
  36       */
  37      function &getInstance($format)
  38      {
  39          static $instances;
  40  
  41          if (!isset ($instances)) {
  42              $instances = array ();
  43          }
  44  
  45          $format = strtolower(JFilterInput::clean($format, 'word'));
  46          if (empty ($instances[$format]))
  47          {
  48              $class = 'JRegistryFormat'.$format;
  49              if(!class_exists($class))
  50              {
  51                  $path    = dirname(__FILE__).DS.'format'.DS.$format.'.php';
  52                  if (file_exists($path)) {
  53                      require_once($path);
  54                  } else {
  55                      JError::raiseError(500,JText::_('Unable to load format class'));
  56                  }
  57              }
  58  
  59              $instances[$format] = new $class ();
  60          }
  61          return $instances[$format];
  62      }
  63  
  64      /**
  65       * Converts an XML formatted string into an object
  66       *
  67       * @abstract
  68       * @access    public
  69       * @param    string    $data    Formatted string
  70       * @return    object    Data Object
  71       * @since    1.5
  72       */
  73  	function stringToObject( $data, $namespace='' ) {
  74          return true;
  75      }
  76  
  77      /**
  78       * Converts an object into a formatted string
  79       *
  80       * @abstract
  81       * @access    public
  82       * @param    object    $object    Data Source Object
  83       * @return    string    Formatted string
  84       * @since    1.5
  85       */
  86  	function objectToString( &$object ) {
  87  
  88      }
  89  }


Generated: Wed Mar 28 15:54:07 2012 Cross-referenced by PHPXref 0.7.1