improve/inc/Prepend.php

62 lines
1.5 KiB
PHP
Raw Normal View History

2021-09-01 23:35:23 +00:00
<?php
/**
* @brief improve, a plugin for Dotclear 2
*
2021-09-01 23:35:23 +00:00
* @package Dotclear
2021-09-06 21:36:50 +00:00
* @subpackage Plugin
*
2021-09-01 23:35:23 +00:00
* @author Jean-Christian Denis and contributors
*
2021-09-01 23:35:23 +00:00
* @copyright Jean-Christian Denis
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
declare(strict_types=1);
2022-12-21 14:41:27 +00:00
namespace Dotclear\Plugin\improve;
use Clearbricks;
/**
* Improve prepend class
*
* Manage autoload and some action module helpers.
*/
2022-12-21 14:51:43 +00:00
class Prepend
{
2022-12-21 14:41:27 +00:00
private static $init = false;
public static function init(): bool
{
self::$init = defined('DC_RC_PATH') && defined('DC_CONTEXT_ADMIN');
return self::$init;
}
public static function process()
{
2022-12-21 14:41:27 +00:00
if (!self::$init) {
return false;
}
// Core plugin class
foreach (['Core', 'Action', 'Module'] as $class) {
Clearbricks::lib()->autoload(['Dotclear\\Plugin\\improve\\' . $class => implode(DIRECTORY_SEPARATOR, [__DIR__, 'core', $class . '.php'])]);
}
// Dotclear plugin class
foreach (['Admin', 'Config', 'Install', 'Manage', 'Prepend', 'Uninstall'] as $class) {
Clearbricks::lib()->autoload(['Dotclear\\Plugin\\improve\\' . $class => implode(DIRECTORY_SEPARATOR, [__DIR__, $class . '.php'])]);
}
}
public static function getActionsDir(): string
{
2022-12-21 14:41:27 +00:00
return __DIR__ . '/module/';
}
2021-09-01 23:35:23 +00:00
public static function getActionsNS(): string
{
2022-12-21 14:41:27 +00:00
return 'Dotclear\\Plugin\\improve\\Module\\';
}
}