Merging fixes and enhancements into trunk

Revision: [1912]
Adding more work arounds for using plugins.

git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1913 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2006-02-03 03:46:27 +00:00
parent 36ccefa51f
commit d09a48d882
3 changed files with 33 additions and 12 deletions

View file

@ -6,4 +6,4 @@
// +---------------------------------------------------------------------------------------------------+ // // +---------------------------------------------------------------------------------------------------+ //
/////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////
0.10.8.1911 RC 4 0.10.8.1913 RC 4

View file

@ -97,7 +97,27 @@ function loadModels()
*/ */
function loadPluginModels ($plugin) function loadPluginModels ($plugin)
{ {
$pluginModelDir = APP.'plugins'.DS.$plugin.'models'.DS; $pluginAppModel = Inflector::camelize($plugin.'_app_model');
$pluginAppModelFile = APP.'plugins'.DS.$plugin.DS.$plugin.'_app_model.php';
if(!class_exists($pluginAppModel))
{
if(file_exists($pluginAppModelFile))
{
require_once($pluginAppModelFile);
}
else
{
die('Plugins must have a class named '. $pluginAppModel);
}
}
if (phpversion() < 5 && function_exists("overload"))
{
overload($pluginAppModel);
}
$pluginModelDir = APP.'plugins'.DS.$plugin.DS.'models'.DS;
foreach (listClasses($pluginModelDir) as $modelFileName) foreach (listClasses($pluginModelDir) as $modelFileName)
{ {
@ -252,19 +272,19 @@ function loadController ($name)
*/ */
function loadPluginController ($plugin, $controller) function loadPluginController ($plugin, $controller)
{ {
if(!class_exists('AppController'))
$pluginAppController = Inflector::camelize($plugin.'_app_controller');
$pluginAppControllerFile = APP.'plugins'.DS.$plugin.DS.$plugin.'_app_controller.php';
if(!class_exists($pluginAppController))
{ {
if(file_exists(APP.'plugins'.DS.$plugin.DS.'app_controller.php')) if(file_exists($pluginAppControllerFile))
{ {
require_once(APP.'plugins'.DS.$plugin.DS.'app_controller.php'); require_once($pluginAppControllerFile);
}
elseif(file_exists(APP.'app_controller.php'))
{
require_once(APP.'app_controller.php');
} }
else else
{ {
require_once(CAKE.'app_controller.php'); die('Plugins must have a class named '. $pluginAppController);
} }
} }

View file

@ -126,8 +126,9 @@ class Dispatcher extends Object
{ {
$ctrlClass = $pluginClass; $ctrlClass = $pluginClass;
$params = $this->_restructureParams($params); $params = $this->_restructureParams($params);
$this->plugin = Inflector::underscore($ctrlName).DS; $plugin = Inflector::underscore($ctrlName);
loadPluginModels($this->plugin); $this->plugin = $plugin.DS;
loadPluginModels($plugin);
$this->base = $this->base.'/'.Inflector::underscore($ctrlName); $this->base = $this->base.'/'.Inflector::underscore($ctrlName);
} }
} }