2022-12-28 23:31:24 +00:00
|
|
|
<?php
|
2022-12-31 13:28:34 +00:00
|
|
|
/**
|
|
|
|
* @brief moreCSS, a plugin for Dotclear 2
|
|
|
|
*
|
|
|
|
* @package Dotclear
|
|
|
|
* @subpackage Plugin
|
|
|
|
*
|
|
|
|
* @author Osku and contributors
|
|
|
|
*
|
|
|
|
* @copyright Jean-Christian Denis
|
|
|
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
*/
|
2023-03-24 23:19:15 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Dotclear\Plugin\moreCSS;
|
|
|
|
|
|
|
|
use dcCore;
|
|
|
|
use dcNsProcess;
|
|
|
|
use Exception;
|
|
|
|
|
|
|
|
class Install extends dcNsProcess
|
|
|
|
{
|
|
|
|
public static function init(): bool
|
|
|
|
{
|
|
|
|
static::$init = defined('DC_CONTEXT_ADMIN')
|
|
|
|
&& dcCore::app()->newVersion(My::id(), dcCore::app()->plugins->moduleInfo(My::id(), 'version'));
|
2022-12-28 23:31:24 +00:00
|
|
|
|
2023-03-24 23:19:15 +00:00
|
|
|
return static::$init;
|
2022-12-31 13:28:34 +00:00
|
|
|
}
|
|
|
|
|
2023-03-24 23:19:15 +00:00
|
|
|
public static function process(): bool
|
|
|
|
{
|
|
|
|
if (!static::$init) {
|
|
|
|
return false;
|
|
|
|
}
|
2022-12-28 23:31:24 +00:00
|
|
|
|
2023-03-24 23:19:15 +00:00
|
|
|
try {
|
|
|
|
$s = dcCore::app()->blog->settings->get('themes');
|
|
|
|
$s->put('morecss_active', true, 'boolean', 'Enable additionnal CSS for the active theme', false, true);
|
|
|
|
$s->put('morecss', '', 'string', 'Additionnal CSS for the active theme', false, true);
|
|
|
|
$s->put('morecss_min', '', 'string', 'Minified addtionnal CSS for the active theme', false, true);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} catch (Exception $e) {
|
|
|
|
dcCore::app()->error->add($e->getMessage());
|
|
|
|
}
|
2022-12-28 23:31:24 +00:00
|
|
|
|
2023-03-24 23:19:15 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|