cakephp2-php8/cake/libs/configure.php
phpnut e5c074a0dc Merging fixes into 1.x.x.x branched code:
Revision: [2955]

Revision: [2951]

Revision: [2918]

Revision: [2911]

git-svn-id: https://svn.cakephp.org/repo/branches/1.x.x.x@2958 3807eeeb-6ff5-0310-8944-8be069107fe0
2006-05-26 05:29:17 +00:00

137 lines
No EOL
3 KiB
PHP

<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
* Long description for file
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2006, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
* @subpackage cake.cake.libs
* @since CakePHP v 1.0.0.2363
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Short description for file.
*
* Long description for file
*
* @package cake
* @subpackage cake.cake.libs
*/
class Configure extends Object{
/**
* Hold array with paths to view files
*
* @var array
* @access public
*/
var $viewPaths = array();
/**
* Hold array with paths to controller files
*
* @var array
* @access public
*/
var $controllerPaths = array();
/**
* Enter description here...
*
* @var array
* @access public
*/
var $modelPaths = array();
/**
* Return a singleton instance of Configure.
*
* @return Configure instance
* @access public
*/
function &getInstance() {
static $instance = array();
if (!$instance) {
$instance[0] =& new Configure;
$instance[0]->__loadBootstrap();
}
return $instance[0];
}
/**
* Sets the var modelPaths
*
* @param array $modelPaths
* @access private
*/
function __buildModelPaths($modelPaths) {
$_this =& Configure::getInstance();
$_this->modelPaths[] = MODELS;
if (isset($modelPaths)) {
foreach($modelPaths as $value) {
$this->modelPaths[] = $value;
}
}
}
/**
* Sets the var viewPaths
*
* @param array $viewPaths
* @access private
*/
function __buildViewPaths($viewPaths) {
$_this =& Configure::getInstance();
$_this->viewPaths[] = VIEWS;
$_this->viewPaths[] = VIEWS . 'errors' . DS;
if (isset($viewPaths)) {
foreach($viewPaths as $value) {
$this->viewPaths[] = $value;
}
}
}
/**
* Sets the var controllerPaths
*
* @param array $controllerPaths
* @access private
*/
function __buildControllerPaths($controllerPaths) {
$_this =& Configure::getInstance();
$_this->controllerPaths[] = CONTROLLERS;
if (isset($controllerPaths)) {
foreach($controllerPaths as $value) {
$this->controllerPaths[] = $value;
}
}
}
/**
* Loads the app/config/bootstrap.php
* If the alternative paths are set in this file
* they will be added to the paths vars
*
* @access private
*/
function __loadBootstrap() {
$_this =&Configure::getInstance();
$modelPaths =null;
$viewPaths =null;
$controllerPaths=null;
require APP_PATH . 'config' . DS . 'bootstrap.php';
$_this->__buildModelPaths($modelPaths);
$_this->__buildViewPaths($viewPaths);
$_this->__buildControllerPaths($controllerPaths);
}
}
?>