From 68faa3427c05de5c5127b13a58dcbbcbf6f54a37 Mon Sep 17 00:00:00 2001 From: Chuck Hagenbuch Date: Mon, 12 Oct 2009 23:05:28 -0400 Subject: [PATCH] One take on a simple module implementation. Not sure I'm sticking with this yet. --- framework/Controller/lib/Horde/Controller/Dispatcher.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/framework/Controller/lib/Horde/Controller/Dispatcher.php b/framework/Controller/lib/Horde/Controller/Dispatcher.php index 991f7e78b..f58da88b7 100644 --- a/framework/Controller/lib/Horde/Controller/Dispatcher.php +++ b/framework/Controller/lib/Horde/Controller/Dispatcher.php @@ -156,7 +156,7 @@ class Horde_Controller_Dispatcher // try to load the class $controllerName = $hash[':controller']; if (!class_exists($controllerName, false)) { - $path = $this->_controllerDir . $controllerName . '.php'; + $path = $this->_controllerDir . str_replace('_', '/', $controllerName) . '.php'; if (file_exists($path)) { require $path; } else { @@ -189,10 +189,17 @@ class Horde_Controller_Dispatcher $ret[':controller'] = $this->_inflector->camelize($val) . 'Controller'; } elseif ($key == 'action') { $ret[':action'] = $this->_inflector->camelize($val, 'lower'); + } elseif ($key == 'module') { + $ret[':module'] = $this->_inflector->camelize($val); } $ret[$key] = $val; } + + if (!empty($ret[':module'])) { + $ret[':controller'] = $ret[':module'] . '_' . $ret[':controller']; + } + return !empty($ret) && isset($ret['controller']) ? $ret : false; } -- 2.11.0