Moving loading of plugins controller to use loadController()

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5202 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2007-05-26 23:43:35 +00:00
parent c9cd07139c
commit 2f6d2d313a
2 changed files with 5 additions and 2 deletions

View file

@ -279,6 +279,8 @@
}
if(strpos($name, '.') !== false){
list($plugin, $name) = explode('.', $name);
loadPluginController($plugin, $name);
return;
}
$className = $name . 'Controller';
@ -326,6 +328,7 @@
*/
function loadPluginController($plugin, $controller) {
$pluginAppController = Inflector::camelize($plugin . '_app_controller');
$plugin = Inflector::underscore($plugin);
$pluginAppControllerFile = APP . 'plugins' . DS . $plugin . DS . $plugin . '_app_controller.php';
if (!class_exists($pluginAppController)) {
if (file_exists($pluginAppControllerFile)) {
@ -336,7 +339,7 @@
}
if (empty($controller)) {
if (!class_exists($plugin . 'Controller')) {
if (!class_exists(Inflector::camelize($plugin . 'controller'))) {
if (file_exists(APP . 'plugins' . DS . $plugin . DS . 'controllers' . DS . $plugin . '_controller.php')) {
require(APP . 'plugins' . DS . $plugin . DS . 'controllers' . DS . $plugin . '_controller.php');
return true;

View file

@ -96,7 +96,7 @@ class Dispatcher extends Object {
if (!loadController($ctrlName)) {
$pluginName = Inflector::camelize($params['action']);
if (!loadPluginController(Inflector::underscore($ctrlName), $pluginName)) {
if (!loadController($ctrlName . '.' . $pluginName)) {
if(preg_match('/([\\.]+)/', $ctrlName)) {
Router::setRequestInfo(array($params, array('base' => $this->base, 'webroot' => $this->webroot)));