[ Index ]

PHP Cross Reference of Joomla 1.5.26 DE

title

Body

[close]

/administrator/components/com_config/models/ -> component.php (source)

   1  <?php
   2  /**
   3   * @version        $Id: component.php 14401 2010-01-26 14:10:00Z louis $
   4   * @package        Joomla
   5   * @subpackage    Config
   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 to the
   9   * GNU General Public License, and as distributed it includes or is derivative
  10   * of works licensed under the GNU General Public License or other free or open
  11   * source software licenses. See COPYRIGHT.php for copyright notices and
  12   * details.
  13   */
  14  
  15  // Check to ensure this file is included in Joomla!
  16  defined('_JEXEC') or die( 'Restricted access' );
  17  
  18  jimport( 'joomla.application.component.model' );
  19  
  20  /**
  21   * @package        Joomla
  22   * @subpackage    Config
  23   */
  24  class ConfigModelComponent extends JModel
  25  {
  26      /**
  27       * Get the params for the configuration variables
  28       */
  29      function &getParams()
  30      {
  31          static $instance;
  32  
  33          if ($instance == null)
  34          {
  35              $component    = JRequest::getCmd( 'component' );
  36  
  37              $table =& JTable::getInstance('component');
  38              $table->loadByOption( $component );
  39  
  40              // work out file path
  41              if ($path = JRequest::getString( 'path' )) {
  42                  $path = JPath::clean( JPATH_SITE.DS.$path );
  43                  JPath::check( $path );
  44              } else {
  45                  $option    = preg_replace( '#\W#', '', $table->option );
  46                  $path    = JPATH_ADMINISTRATOR.DS.'components'.DS.$option.DS.'config.xml';
  47              }
  48  
  49              if (file_exists( $path )) {
  50                  $instance = new JParameter( $table->params, $path );
  51              } else {
  52                  $instance = new JParameter( $table->params );
  53              }
  54          }
  55          return $instance;
  56      }
  57  }


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