mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 19:38:26 +00:00
160 lines
3.5 KiB
PHP
160 lines
3.5 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
|
||
|
* @since CakePHP v 1.0.0.2363
|
||
|
*/
|
||
|
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);
|
||
|
}
|
||
|
}
|
||
|
?>
|