[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/config/src/ -> lmbConf.class.php (source)

   1  <?php
   2  /*
   3   * Limb PHP Framework
   4   *
   5   * @link http://limb-project.com 
   6   * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
   7   * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
   8   */
   9  lmb_require('limb/core/src/lmbSet.class.php');
  10  
  11  /**

  12   * class lmbConf.

  13   *

  14   * @package config

  15   * @version $Id: lmbConf.class.php 5945 2007-06-06 08:31:43Z pachanga $

  16   */
  17  class lmbConf extends lmbSet
  18  {
  19    function __construct($file)
  20    {
  21      $conf = array();
  22  
  23      if(!@include($file))
  24        throw new lmbException("Config file '$file' not found");
  25  
  26      if($override_file = $this->_getOverrideFile($file))
  27      {
  28        $original = $conf;
  29        include($override_file);
  30        $conf = array_merge($original, $conf);
  31      }
  32      parent :: __construct($conf);
  33    }
  34  
  35    protected function _getOverrideFile($file_path)
  36    {
  37      $file_name = substr($file_path, 0, strpos($file_path, '.php'));
  38      $override_file_name = $file_name . '.override.php';
  39  
  40      if(file_exists($override_file_name))
  41        return $override_file_name;
  42      else
  43        return false;
  44    }
  45  }
  46  ?>


Generated: Wed Oct 15 04:31:08 2008 Cross-referenced by PHPXref 0.7