mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
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:
parent
c9cd07139c
commit
2f6d2d313a
2 changed files with 5 additions and 2 deletions
|
@ -279,6 +279,8 @@
|
||||||
}
|
}
|
||||||
if(strpos($name, '.') !== false){
|
if(strpos($name, '.') !== false){
|
||||||
list($plugin, $name) = explode('.', $name);
|
list($plugin, $name) = explode('.', $name);
|
||||||
|
loadPluginController($plugin, $name);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$className = $name . 'Controller';
|
$className = $name . 'Controller';
|
||||||
|
@ -326,6 +328,7 @@
|
||||||
*/
|
*/
|
||||||
function loadPluginController($plugin, $controller) {
|
function loadPluginController($plugin, $controller) {
|
||||||
$pluginAppController = Inflector::camelize($plugin . '_app_controller');
|
$pluginAppController = Inflector::camelize($plugin . '_app_controller');
|
||||||
|
$plugin = Inflector::underscore($plugin);
|
||||||
$pluginAppControllerFile = APP . 'plugins' . DS . $plugin . DS . $plugin . '_app_controller.php';
|
$pluginAppControllerFile = APP . 'plugins' . DS . $plugin . DS . $plugin . '_app_controller.php';
|
||||||
if (!class_exists($pluginAppController)) {
|
if (!class_exists($pluginAppController)) {
|
||||||
if (file_exists($pluginAppControllerFile)) {
|
if (file_exists($pluginAppControllerFile)) {
|
||||||
|
@ -336,7 +339,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($controller)) {
|
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')) {
|
if (file_exists(APP . 'plugins' . DS . $plugin . DS . 'controllers' . DS . $plugin . '_controller.php')) {
|
||||||
require(APP . 'plugins' . DS . $plugin . DS . 'controllers' . DS . $plugin . '_controller.php');
|
require(APP . 'plugins' . DS . $plugin . DS . 'controllers' . DS . $plugin . '_controller.php');
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -96,7 +96,7 @@ class Dispatcher extends Object {
|
||||||
|
|
||||||
if (!loadController($ctrlName)) {
|
if (!loadController($ctrlName)) {
|
||||||
$pluginName = Inflector::camelize($params['action']);
|
$pluginName = Inflector::camelize($params['action']);
|
||||||
if (!loadPluginController(Inflector::underscore($ctrlName), $pluginName)) {
|
if (!loadController($ctrlName . '.' . $pluginName)) {
|
||||||
if(preg_match('/([\\.]+)/', $ctrlName)) {
|
if(preg_match('/([\\.]+)/', $ctrlName)) {
|
||||||
Router::setRequestInfo(array($params, array('base' => $this->base, 'webroot' => $this->webroot)));
|
Router::setRequestInfo(array($params, array('base' => $this->base, 'webroot' => $this->webroot)));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue