2021-08-18 19:42:30 +00:00
|
|
|
<?php
|
2021-09-02 21:44:01 +00:00
|
|
|
/**
|
|
|
|
* @brief translater, a plugin for Dotclear 2
|
2021-11-01 21:32:32 +00:00
|
|
|
*
|
2021-09-02 21:44:01 +00:00
|
|
|
* @package Dotclear
|
|
|
|
* @subpackage Plugin
|
2021-11-01 21:32:32 +00:00
|
|
|
*
|
2021-09-02 21:44:01 +00:00
|
|
|
* @author Jean-Christian Denis & contributors
|
2021-11-01 21:32:32 +00:00
|
|
|
*
|
2021-09-02 21:44:01 +00:00
|
|
|
* @copyright Jean-Christian Denis
|
|
|
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
*/
|
2023-03-14 23:26:31 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Dotclear\Plugin\translater;
|
|
|
|
|
|
|
|
use dcCore;
|
|
|
|
use dcNsProcess;
|
|
|
|
|
|
|
|
class Prepend extends dcNsProcess
|
|
|
|
{
|
|
|
|
public static function init(): bool
|
|
|
|
{
|
2023-03-19 23:20:41 +00:00
|
|
|
static::$init = defined('DC_CONTEXT_ADMIN')
|
|
|
|
&& dcCore::app()->auth?->isSuperAdmin()
|
|
|
|
&& My::phpCompliant();
|
2023-03-14 23:26:31 +00:00
|
|
|
|
2023-03-19 23:20:41 +00:00
|
|
|
return static::$init;
|
2023-03-14 23:26:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function process(): bool
|
|
|
|
{
|
2023-03-19 23:20:41 +00:00
|
|
|
if (!static::$init) {
|
2023-03-14 23:26:31 +00:00
|
|
|
return false;
|
|
|
|
}
|
2021-08-18 19:42:30 +00:00
|
|
|
|
2023-03-14 23:26:31 +00:00
|
|
|
if (isset(dcCore::app()->adminurl)) {
|
|
|
|
dcCore::app()->adminurl->register(My::id(), 'plugin.php', ['p' => My::id()]);
|
|
|
|
}
|
2021-08-18 19:42:30 +00:00
|
|
|
|
2023-03-14 23:26:31 +00:00
|
|
|
return true;
|
|
|
|
}
|
2021-11-01 21:32:32 +00:00
|
|
|
}
|