diff --git a/src/Action.php b/src/Action.php index 8dae9d2..5780b94 100644 --- a/src/Action.php +++ b/src/Action.php @@ -79,7 +79,7 @@ abstract class Action */ final public function __construct() { - $this->class_name = str_replace(Utils::getActionsNS(), '', get_called_class()); + $this->class_name = str_replace(__NAMESPACE__ . '\\Module\\', '', get_called_class()); $this->module = new dcModuleDefine('undefined'); $settings = dcCore::app()->blog->settings->get(My::id())->get('settings_' . $this->class_name); diff --git a/src/Backend.php b/src/Backend.php index 68075d8..c60f309 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -20,7 +20,6 @@ use dcPage; use dcFavorites; use dcNsProcess; use Dotclear\Helper\File\Files; -use Dotclear\Helper\Clearbricks; /** * Improve admin class @@ -65,10 +64,14 @@ class Backend extends dcNsProcess dcCore::app()->auth->isSuperAdmin() ); - foreach (Files::scandir(Utils::getActionsDir()) as $file) { - if (is_file(Utils::getActionsDir() . $file) && '.php' == substr($file, -4)) { - Clearbricks::lib()->autoload([Utils::getActionsNS() . substr($file, 0, -4) => Utils::getActionsDir() . $file]); - dcCore::app()->addBehavior('improveAddAction', [Utils::getActionsNS() . substr($file, 0, -4), 'create']); /* @phpstan-ignore-line */ + $dir = __DIR__ . DIRECTORY_SEPARATOR . 'module' . DIRECTORY_SEPARATOR; + $ns = __NAMESPACE__ . '\\Module\\'; + + dcCore::app()->autoload->addNamespace($ns, $dir); + + foreach (Files::scandir($dir) as $file) { + if (str_ends_with($file, '.php') && is_file($dir . $file)) { + dcCore::app()->addBehavior('improveAddAction', [$ns . basename($file, '.php'), 'create']); /* @phpstan-ignore-line */ } } diff --git a/src/Utils.php b/src/Utils.php deleted file mode 100644 index 4d7befe..0000000 --- a/src/Utils.php +++ /dev/null @@ -1,31 +0,0 @@ -