mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-05 19:12:42 +00:00
Merging fixes and enhancements into trunk.
Revision: [2369] Added missing doc comments to classes Revision: [2368] Removing core view paths from Configure class Revision: [2367] Updating View class to use new Configure class to search paths for view files Revision:[ 2366] Corrected loadControllers() in basics.php Revision: [2365] Updating function in basics.php to use new Configure class Revision: [2364] removed duplicate loading of app/config/bootstrap.php Revision: [2363] Added new Configure class to hold paths to models, views, and controllers related to Ticket #470. Moved loading of app/config/bootstrap.php to Configure class from app/webroot/index.php. Added creating instance of Configure instance in cake/bootstrap.php Added example of setting custom paths in app/config/bootstrap.php Corrected error in Object::_savePersistent(). Revision: [2362] Added fix for Ticket #534 Revision: [2361] Refactoring persistent code a little more. File now holds a variable with the serialized class and is include vs. reading file contents. Revision: [2360] Refactored persistent methods to use cache() Revision: [2359] Fixing array_combine() Warning in Model::generateList() Revision: [2358] Set var $persistModel to false by default Revision: [2357] Moved persistent code to Object class. Moved $TIME_START variable to top of file. added __sleep methods for models Revision: [2356] Reverting persistent changes to Model class Revision: [2355] Adding fix for Ticket #550 Revision: [2354] Corrected errors in persistent code Revision: [2353] Corrected overwrite in the model/model_php4.php file. Revision: [2352] Adding persistent methods to Model class. This will allow caching of classes. Added app/tmp/persistent directory. Revision: [2351] Reverting changes to dbo_source.php in [2350] Revision: [2350] Removed name pattern matches related to Ticket #534 Revision: [2349] Adding fix for Ticket #548 Revision: [2348] Adding fixes from Ticket #547. Revision: [2347] Adding fixes from Ticket #546. Revision: [2346] Adding fix for Ticket #527 Revision: [2345] Refactored Html::url() Revision: [2344] Last fix for Ticket #483 Revision: [2343] Updating last commit Revision: [2342] Adding fix for Ticket #483 Revision: [2341] Adding fix for Ticket #543, DBO will now only cache SELECT queries Revision: [2340] Adding session_write_close() to the CakeSession::__regenerateId() Revision: [2339] Adding patch from Ticket #544 Revision: [2338] Adding patch from Ticket #529 Revision: [2337] Adding patch from Ticket #528 Revision: [2336] Removing the converting of \n to <br /> in Sanitize::html() Revision: [2335] Added bash script from Ticket #533 Revision: [2334] Added enhancement for Ticket #474 Revision: [2333] Correcting errors introduced with prior fix Revision: [2332] Correcting errors introduced with prior fix Revision: [2331] Performance optimization for NeatArray::findIn(): replaced foreach loop with for Revision: [2330] Minor performance optimization: Replacing all occurrences of low() with strtolower() git-svn-id: https://svn.cakephp.org/repo/trunk/cake@2370 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
d6f056d5c0
commit
23d183e46b
26 changed files with 557 additions and 149 deletions
104
cake/basics.php
104
cake/basics.php
|
@ -55,13 +55,10 @@ if (!function_exists("ob_get_clean"))
|
|||
|
||||
/**
|
||||
* Loads all models.
|
||||
*
|
||||
* @uses listModules()
|
||||
* @uses APP
|
||||
* @uses MODELS
|
||||
*/
|
||||
function loadModels()
|
||||
{
|
||||
$path = Configure::getInstance();
|
||||
if(!class_exists('AppModel'))
|
||||
{
|
||||
if(file_exists(APP.'app_model.php'))
|
||||
|
@ -73,19 +70,25 @@ function loadModels()
|
|||
require(CAKE.'app_model.php');
|
||||
}
|
||||
}
|
||||
|
||||
if (phpversion() < 5 && function_exists("overload"))
|
||||
{
|
||||
overload('AppModel');
|
||||
}
|
||||
|
||||
foreach (listClasses(MODELS) as $model_fn)
|
||||
$loadedModels = array();
|
||||
foreach ($path->modelPaths as $path)
|
||||
{
|
||||
require (MODELS.$model_fn);
|
||||
if (phpversion() < 5 && function_exists("overload"))
|
||||
foreach (listClasses($path) as $model_fn)
|
||||
{
|
||||
list($name) = explode('.', $model_fn);
|
||||
overload(Inflector::camelize($name));
|
||||
if (!key_exists($model_fn, $loadedModels))
|
||||
{
|
||||
require ($path.$model_fn);
|
||||
if (phpversion() < 5 && function_exists("overload"))
|
||||
{
|
||||
list($name) = explode('.', $model_fn);
|
||||
overload(Inflector::camelize($name));
|
||||
}
|
||||
$loadedModels[$model_fn] = $model_fn;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -139,12 +142,16 @@ function loadView ($viewClass)
|
|||
{
|
||||
if(!class_exists($viewClass))
|
||||
{
|
||||
$paths = Configure::getInstance();
|
||||
$file = Inflector::underscore($viewClass).'.php';
|
||||
if(file_exists(VIEWS.$file))
|
||||
foreach ($paths->viewPaths as $path)
|
||||
{
|
||||
return require(VIEWS.$file);
|
||||
if(file_exists($path.$file))
|
||||
{
|
||||
return require($path.$file);
|
||||
}
|
||||
}
|
||||
elseif(file_exists(LIBS.'view'.DS.$file))
|
||||
if(file_exists(LIBS.'view'.DS.$file))
|
||||
{
|
||||
return require(LIBS.'view'.DS.$file);
|
||||
}
|
||||
|
@ -157,16 +164,12 @@ function loadView ($viewClass)
|
|||
|
||||
/**
|
||||
* Loads a model by CamelCase name.
|
||||
*
|
||||
* @uses listModules()
|
||||
* @uses APP
|
||||
* @uses MODELS
|
||||
*/
|
||||
function loadModel($name)
|
||||
{
|
||||
$name = Inflector::underscore($name);
|
||||
$paths = Configure::getInstance();
|
||||
|
||||
// Make sure AppModel is loaded
|
||||
if(!class_exists('AppModel'))
|
||||
{
|
||||
if(file_exists(APP.'app_model.php'))
|
||||
|
@ -179,10 +182,13 @@ function loadModel($name)
|
|||
}
|
||||
}
|
||||
|
||||
if(file_exists(MODELS.$name.'.php'))
|
||||
{
|
||||
require (MODELS.$name.'.php');
|
||||
return true;
|
||||
foreach ($paths->modelPaths as $path)
|
||||
{
|
||||
if(file_exists($path.$name.'.php'))
|
||||
{
|
||||
require ($path.$name.'.php');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -190,14 +196,10 @@ function loadModel($name)
|
|||
|
||||
/**
|
||||
* Loads all controllers.
|
||||
*
|
||||
* @uses APP
|
||||
* @uses listModules()
|
||||
* @uses HELPERS
|
||||
* @uses CONTROLLERS
|
||||
*/
|
||||
function loadControllers ()
|
||||
{
|
||||
$paths = Configure::getInstance();
|
||||
if(!class_exists('AppController'))
|
||||
{
|
||||
if(file_exists(APP.'app_controller.php'))
|
||||
|
@ -209,11 +211,19 @@ function loadControllers ()
|
|||
require(CAKE.'app_controller.php');
|
||||
}
|
||||
}
|
||||
foreach (listClasses(CONTROLLERS) as $controller)
|
||||
$loadedControllers = array();
|
||||
foreach ($paths->controllerPaths as $path)
|
||||
{
|
||||
if(!class_exists($controller))
|
||||
foreach (listClasses($path) as $controller)
|
||||
{
|
||||
require (CONTROLLERS.$controller.'.php');
|
||||
if(file_exists($path.$controller.'.php'))
|
||||
{
|
||||
if (!key_exists($controller, $loadedControllers))
|
||||
{
|
||||
require ($path.$controller.'.php');
|
||||
$loadedControllers[$controller] = $controller;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -226,6 +236,7 @@ function loadControllers ()
|
|||
*/
|
||||
function loadController ($name)
|
||||
{
|
||||
$paths = Configure::getInstance();
|
||||
if(!class_exists('AppController'))
|
||||
{
|
||||
if(file_exists(APP.'app_controller.php'))
|
||||
|
@ -241,23 +252,30 @@ function loadController ($name)
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!class_exists($name.'Controller'))
|
||||
{
|
||||
$name = Inflector::underscore($name);
|
||||
if(file_exists(CONTROLLERS.$name.'_controller.php'))
|
||||
foreach ($paths->controllerPaths as $path)
|
||||
{
|
||||
$controller_fn = CONTROLLERS.$name.'_controller.php';
|
||||
if(file_exists($path.$name.'_controller.php'))
|
||||
{
|
||||
require($path.$name.'_controller.php');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
elseif($controller_fn = fileExistsInPath(LIBS.'controller'.DS.$name.'_controller.php'))
|
||||
if($controller_fn = fileExistsInPath(LIBS.'controller'.DS.$name.'_controller.php'))
|
||||
{
|
||||
|
||||
if(file_exists($controller_fn))
|
||||
{
|
||||
require($controller_fn);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
require($controller_fn);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -390,7 +408,7 @@ function uses ()
|
|||
$args = func_get_args();
|
||||
foreach ($args as $arg)
|
||||
{
|
||||
require_once(LIBS.low($arg).'.php');
|
||||
require_once(LIBS.strtolower($arg).'.php');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -861,7 +879,7 @@ function cache($path, $data = null, $expires = '+1 day', $target = 'cache')
|
|||
$expires = strtotime($expires);
|
||||
}
|
||||
|
||||
switch (low($target))
|
||||
switch (strtolower($target))
|
||||
{
|
||||
case 'cache':
|
||||
$filename = CACHE . $path;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue