XoopsCore icon indicating copy to clipboard operation
XoopsCore copied to clipboard

Allow for Handler classes names without the directory name included

Open mambax7 opened this issue 10 years ago • 0 comments

Currently, when we call getModuleHandler, it checks for the Handler class name that it uses the directory name:

$class = ucfirst(strtolower($module_dir)) . ucfirst($name) . 'Handler';
if (class_exists($class)) {
    $this->moduleHandlers[$module_dir][$name] = new $class($this->db());
}

Since we use Namespaces now, maybe we could change it to allow for only the class name + Handler:

$class = ucfirst(strtolower($module_dir)) . ucfirst($name) . 'Handler';
$classNew = ucfirst($name) . 'Handler';
if (class_exists($class)) {
    $this->moduleHandlers[$module_dir][$name] = new $class($this->db());
} elseif (class_exists($classNew)) {
    $this->moduleHandlers[$module_dir][$name] = new $classNew($this->db());
}

mambax7 avatar Jun 22 '15 03:06 mambax7