release 2.5
This commit is contained in:
parent
7060aef4bf
commit
e6f0d1b167
11 changed files with 149 additions and 153 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
moreCSS 2.5 - 2023.10.11
|
||||||
|
===========================================================
|
||||||
|
* Require Dotclear 2.28
|
||||||
|
* Require PHP 8.1
|
||||||
|
* Upgrade to Dotclear 2.28
|
||||||
|
|
||||||
moreCSS 2.4 - 2023.08.13
|
moreCSS 2.4 - 2023.08.13
|
||||||
===========================================================
|
===========================================================
|
||||||
* Require Dotclear 2.27
|
* Require Dotclear 2.27
|
||||||
|
|
31
README.md
31
README.md
|
@ -1,26 +1,22 @@
|
||||||
# README
|
# README
|
||||||
|
|
||||||
[![Release](https://img.shields.io/badge/release-2.4-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/moreCSS/releases)
|
[![Release](https://img.shields.io/badge/release-2.5-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/moreCSS/releases)
|
||||||
[![Date](https://img.shields.io/badge/date-2023.08.13-c44d58.svg)](https://git.dotclear.watch/JcDenis/moreCSS/releases)
|
![Date](https://img.shields.io/badge/date-2023.10.11-c44d58.svg)
|
||||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-137bbb.svg)](https://fr.dotclear.org/download)
|
[![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download)
|
||||||
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/moreCSS)
|
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/moreCSS)
|
||||||
[![License](https://img.shields.io/github/license/JcDenis/moreCSS)](https://git.dotclear.watch/JcDenis/moreCSS/blob/master/LICENSE)
|
[![License](https://img.shields.io/github/license/JcDenis/moreCSS)](https://git.dotclear.watch/JcDenis/moreCSS/blob/master/LICENSE)
|
||||||
|
|
||||||
## WHAT IS MORECSS ?
|
## ABOUT
|
||||||
|
|
||||||
_moreCSS_ is a plugin for the open-source
|
_moreCSS_ is a plugin for the open-source web publishing software called [Dotclear](https://www.dotclear.org).
|
||||||
web publishing software called Dotclear.
|
|
||||||
|
|
||||||
It helps admin to add more CSS rules to current theme
|
> It helps admin to add more CSS rules to current theme without editing it.
|
||||||
without editing it.
|
|
||||||
|
|
||||||
## REQUIREMENTS
|
## REQUIREMENTS
|
||||||
|
|
||||||
_moreCSS_ requires:
|
* Dotclear 2.28
|
||||||
|
* PHP 8.1+
|
||||||
* content admin permissions to manage CSS
|
* content admin permissions to manage CSS
|
||||||
* Dotclear 2.27
|
|
||||||
* PHP 7.4+
|
|
||||||
|
|
||||||
## USAGE
|
## USAGE
|
||||||
|
|
||||||
|
@ -32,16 +28,17 @@ or by adding a favorites icon on dashboard.
|
||||||
|
|
||||||
## LINKS
|
## LINKS
|
||||||
|
|
||||||
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
|
* [License](https://git.dotclear.watch/JcDenis/moreCSS/src/branch/master/LICENSE)
|
||||||
* Source & contribution : [Gitea Page](https://git.dotclear.watch/JcDenis/moreCSS) or [GitHub Page](https://github.com/JcDenis/moreCSS)
|
* [Packages & details](https://git.dotclear.watch/JcDenis/moreCSS/releases) (or on [Dotaddict](https://plugins.dotaddict.org/dc2/details/moreCSS))
|
||||||
* Packages & details: [Gitea Page](https://git.dotclear.watch/JcDenis/moreCSS/releases) or [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/moreCSS)
|
* [Sources & contributions](https://git.dotclear.watch/JcDenis/moreCSS) (or on [GitHub](https://github.com/JcDenis/moreCSS))
|
||||||
* Discuss & help : [Dotclear forum](http://forum.dotclear.org/viewtopic.php?id=44908)
|
* [Issues & security](https://git.dotclear.watch/JcDenis/moreCSS/issues) (or on [GitHub](https://github.com/JcDenis/moreCSS/issues))
|
||||||
|
* [Discuss & help](http://forum.dotclear.org/viewtopic.php?id=44908)
|
||||||
|
|
||||||
## CONTRIBUTORS
|
## CONTRIBUTORS
|
||||||
|
|
||||||
* Osku (author)
|
* Osku (author)
|
||||||
* Pierre Van Glabeke
|
* Pierre Van Glabeke
|
||||||
* Jean-Christian Denis
|
* Jean-Christian Denis (latest)
|
||||||
|
|
||||||
You are welcome to contribute to this code.
|
You are welcome to contribute to this code.
|
||||||
|
|
||||||
|
|
43
_define.php
43
_define.php
|
@ -1,32 +1,29 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @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
|
|
||||||
*/
|
|
||||||
if (!defined('DC_RC_PATH')) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @brief The plugin moreCSS definition
|
||||||
|
* @ingroup moreCSS
|
||||||
|
*
|
||||||
|
* @defgroup moreCSS Plugin moreCSS.
|
||||||
|
*
|
||||||
|
* Another CSS stylesheet for the active theme.
|
||||||
|
*
|
||||||
|
* @author Osku (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
$this->registerModule(
|
$this->registerModule(
|
||||||
'Style sheet',
|
'Style sheet',
|
||||||
'Another CSS stylesheet for the active theme',
|
'Another CSS stylesheet for the active theme',
|
||||||
'Osku and contributors',
|
'Osku and contributors',
|
||||||
'2.4',
|
'2.5',
|
||||||
[
|
[
|
||||||
'requires' => [['core', '2.27']],
|
'requires' => [['core', '2.28']],
|
||||||
'permissions' => dcCore::app()->auth->makePermissions([
|
'permissions' => 'My',
|
||||||
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN,
|
'type' => 'plugin',
|
||||||
]),
|
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
|
||||||
'type' => 'plugin',
|
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',
|
||||||
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
|
'repository' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/raw/branch/master/dcstore.xml',
|
||||||
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',
|
|
||||||
'repository' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/raw/branch/master/dcstore.xml',
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
<modules xmlns:da="http://dotaddict.org/da/">
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
<module id="moreCSS">
|
<module id="moreCSS">
|
||||||
<name>Style sheet</name>
|
<name>Style sheet</name>
|
||||||
<version>2.4</version>
|
<version>2.5</version>
|
||||||
<author>Osku and contributors</author>
|
<author>Osku and contributors</author>
|
||||||
<desc>Another CSS stylesheet for the active theme</desc>
|
<desc>Another CSS stylesheet for the active theme</desc>
|
||||||
<file>https://git.dotclear.watch/JcDenis/moreCSS/releases/download/v2.4/plugin-moreCSS.zip</file>
|
<file>https://git.dotclear.watch/JcDenis/moreCSS/releases/download/v2.5/plugin-moreCSS.zip</file>
|
||||||
<da:dcmin>2.27</da:dcmin>
|
<da:dcmin>2.28</da:dcmin>
|
||||||
<da:details>https://git.dotclear.watch/JcDenis/moreCSS/src/branch/master/README.md</da:details>
|
<da:details>https://git.dotclear.watch/JcDenis/moreCSS/src/branch/master/README.md</da:details>
|
||||||
<da:support>https://git.dotclear.watch/JcDenis/moreCSS/issues</da:support>
|
<da:support>https://git.dotclear.watch/JcDenis/moreCSS/issues</da:support>
|
||||||
</module>
|
</module>
|
||||||
|
|
|
@ -14,13 +14,18 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\moreCSS;
|
namespace Dotclear\Plugin\moreCSS;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
use Dotclear\Core\Backend\{
|
use Dotclear\Core\Backend\Favorites;
|
||||||
Favorites,
|
|
||||||
Menus
|
|
||||||
};
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief moreCSS manage class.
|
||||||
|
* @ingroup moreCSS
|
||||||
|
*
|
||||||
|
* @author Osku (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Backend extends Process
|
class Backend extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
|
@ -34,15 +39,15 @@ class Backend extends Process
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
My::addBackendMenuItem(Menus::MENU_BLOG);
|
My::addBackendMenuItem(App::backend()->menus::MENU_BLOG);
|
||||||
|
|
||||||
dcCore::app()->addBehavior('adminDashboardFavoritesV2', function (Favorites $favs): void {
|
App::behavior()->addBehavior('adminDashboardFavoritesV2', function (Favorites $favs): void {
|
||||||
$favs->register(My::id(), [
|
$favs->register(My::id(), [
|
||||||
'title' => My::name(),
|
'title' => My::name(),
|
||||||
'url' => My::manageUrl(),
|
'url' => My::manageUrl(),
|
||||||
'small-icon' => My::icons(),
|
'small-icon' => My::icons(),
|
||||||
'large-icon' => My::icons(),
|
'large-icon' => My::icons(),
|
||||||
'permissions' => dcCore::app()->auth->makePermissions([dcCore::app()->auth::PERMISSION_CONTENT_ADMIN]),
|
'permissions' => App::auth()->makePermissions([App::auth()::PERMISSION_CONTENT_ADMIN]),
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,20 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @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
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\moreCSS;
|
namespace Dotclear\Plugin\moreCSS;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use dcUtils;
|
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief moreCSS frontend class.
|
||||||
|
* @ingroup moreCSS
|
||||||
|
*
|
||||||
|
* @author Osku (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Frontend extends Process
|
class Frontend extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
|
@ -27,15 +24,15 @@ class Frontend extends Process
|
||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!self::status() || !dcCore::app()->blog->settings->get('themes')->get('morecss_active')) {
|
if (!self::status() || !App::blog()->settings()->get('themes')->get('morecss_active')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dcCore::app()->addBehavior('publicHeadContent', function (): void {
|
App::behavior()->addBehavior('publicHeadContent', function (): void {
|
||||||
$css = (string) base64_decode((string) dcCore::app()->blog->settings->get('themes')->get('morecss_min'));
|
$css = (string) base64_decode((string) App::blog()->settings()->get('themes')->get('morecss_min'));
|
||||||
if (!empty($css)) {
|
if (!empty($css)) {
|
||||||
echo dcUtils::cssLoad(
|
echo App::plugins()->cssLoad(
|
||||||
dcCore::app()->blog->url . dcCore::app()->url->getURLFor(My::id()),
|
App::blog()->url() . App::url()->getURLFor(My::id()),
|
||||||
'screen',
|
'screen',
|
||||||
md5($css) //no cache on content change
|
md5($css) //no cache on content change
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,23 +1,21 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @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
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\moreCSS;
|
namespace Dotclear\Plugin\moreCSS;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief moreCSS install class.
|
||||||
|
* @ingroup moreCSS
|
||||||
|
*
|
||||||
|
* @author Osku (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Install extends Process
|
class Install extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
|
@ -27,19 +25,19 @@ class Install extends Process
|
||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!self::status() || is_null(dcCore::app()->blog)) {
|
if (!self::status() || !App::blog()->isDefined()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$s = dcCore::app()->blog->settings->get('themes');
|
$s = App::blog()->settings()->get('themes');
|
||||||
$s->put('morecss_active', true, 'boolean', 'Enable additionnal CSS for the active theme', false, true);
|
$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', '', 'string', 'Additionnal CSS for the active theme', false, true);
|
||||||
$s->put('morecss_min', '', 'string', 'Minified addtionnal CSS for the active theme', false, true);
|
$s->put('morecss_min', '', 'string', 'Minified addtionnal CSS for the active theme', false, true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
dcCore::app()->error->add($e->getMessage());
|
App::error()->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,20 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @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
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\moreCSS;
|
namespace Dotclear\Plugin\moreCSS;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
use Dotclear\Core\Backend\{
|
use Dotclear\Core\Backend\{
|
||||||
Notices,
|
Notices,
|
||||||
|
@ -32,6 +22,14 @@ use Dotclear\Helper\Html\Form\{
|
||||||
use Dotclear\Helper\Html\Html;
|
use Dotclear\Helper\Html\Html;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief moreCSS manage class.
|
||||||
|
* @ingroup moreCSS
|
||||||
|
*
|
||||||
|
* @author Osku (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Manage extends Process
|
class Manage extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
|
@ -45,7 +43,7 @@ class Manage extends Process
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$s = dcCore::app()->blog->settings->get('themes');
|
$s = App::blog()->settings()->get('themes');
|
||||||
|
|
||||||
if (isset($_POST['morecss'])) {
|
if (isset($_POST['morecss'])) {
|
||||||
try {
|
try {
|
||||||
|
@ -70,7 +68,7 @@ class Manage extends Process
|
||||||
);
|
);
|
||||||
My::redirect();
|
My::redirect();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
dcCore::app()->error->add($e->getMessage());
|
App::error()->add($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,26 +81,26 @@ class Manage extends Process
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$s = dcCore::app()->blog->settings->get('themes');
|
$s = App::blog()->settings()->get('themes');
|
||||||
|
|
||||||
Page::openModule(
|
Page::openModule(
|
||||||
My::name(),
|
My::name(),
|
||||||
(
|
(
|
||||||
dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax') ?
|
App::auth()->prefs()->get('interface')->get('colorsyntax') ?
|
||||||
Page::jsJson('dotclear_colorsyntax', ['colorsyntax' => dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax')]) .
|
Page::jsJson('dotclear_colorsyntax', ['colorsyntax' => App::auth()->prefs()->get('interface')->get('colorsyntax')]) .
|
||||||
Page::jsLoadCodeMirror(dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax_theme'))
|
Page::jsLoadCodeMirror(App::auth()->prefs()->get('interface')->get('colorsyntax_theme'))
|
||||||
: ''
|
: ''
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
echo
|
echo
|
||||||
Page::breadcrumb([
|
Page::breadcrumb([
|
||||||
Html::escapeHTML(dcCore::app()->blog->name) => '',
|
Html::escapeHTML(App::blog()->name()) => '',
|
||||||
My::name() => '',
|
My::name() => '',
|
||||||
]) .
|
]) .
|
||||||
Notices::getNotices() .
|
Notices::getNotices() .
|
||||||
|
|
||||||
(new Form('file-form'))->method('post')->action(dcCore::app()->admin->getPageURL())->fields([
|
(new Form('file-form'))->method('post')->action(App::backend()->getPageURL())->fields([
|
||||||
(new Para())->items([
|
(new Para())->items([
|
||||||
(new Label(__('Style sheet:')))->for('morecss'),
|
(new Label(__('Style sheet:')))->for('morecss'),
|
||||||
(new Textarea('morecss', Html::escapeHTML((string) base64_decode((string) $s->get('morecss')))))->class('maximal')->cols(72)->rows(25),
|
(new Textarea('morecss', Html::escapeHTML((string) base64_decode((string) $s->get('morecss')))))->class('maximal')->cols(72)->rows(25),
|
||||||
|
@ -112,17 +110,17 @@ class Manage extends Process
|
||||||
(new Label(__('Enable additionnal CSS for the active theme'), Label::OUTSIDE_LABEL_AFTER))->for('morecss_active')->class('classic'),
|
(new Label(__('Enable additionnal CSS for the active theme'), Label::OUTSIDE_LABEL_AFTER))->for('morecss_active')->class('classic'),
|
||||||
]),
|
]),
|
||||||
(new Para())->items([
|
(new Para())->items([
|
||||||
dcCore::app()->formNonce(false),
|
App::nonce()->formNonce(),
|
||||||
(new Hidden('p', 'moreCSS')),
|
(new Hidden('p', 'moreCSS')),
|
||||||
(new Submit(['write']))->value(__('Save') . ' (s)')->accesskey('s'),
|
(new Submit(['write']))->value(__('Save') . ' (s)')->accesskey('s'),
|
||||||
]),
|
]),
|
||||||
])->render();
|
])->render();
|
||||||
|
|
||||||
if (dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax')) {
|
if (App::auth()->prefs()->get('interface')->get('colorsyntax')) {
|
||||||
echo
|
echo
|
||||||
Page::jsJson('theme_editor_mode', ['mode' => 'css']) .
|
Page::jsJson('theme_editor_mode', ['mode' => 'css']) .
|
||||||
Page::jsLoad(dcCore::app()->blog->getPF('themeEditor/js/mode.js')) .
|
Page::jsLoad(App::blog()->getPF('themeEditor/js/mode.js')) .
|
||||||
Page::jsRunCodeMirror('editor', 'morecss', 'dotclear', dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax_theme'));
|
Page::jsRunCodeMirror('editor', 'morecss', 'dotclear', App::auth()->prefs()->get('interface')->get('colorsyntax_theme'));
|
||||||
}
|
}
|
||||||
|
|
||||||
Page::closeModule();
|
Page::closeModule();
|
||||||
|
|
37
src/My.php
37
src/My.php
|
@ -1,31 +1,34 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @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
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\moreCSS;
|
namespace Dotclear\Plugin\moreCSS;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Module\MyPlugin;
|
use Dotclear\Module\MyPlugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This module definitions.
|
* @brief moreCSS My helper.
|
||||||
|
* @ingroup moreCSS
|
||||||
|
*
|
||||||
|
* @author Osku (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
class My extends MyPlugin
|
class My extends MyPlugin
|
||||||
{
|
{
|
||||||
public static function checkCustomContext(int $context): ?bool
|
protected static function checkCustomContext(int $context): ?bool
|
||||||
{
|
{
|
||||||
return in_array($context, [My::BACKEND, My::MENU]) ?
|
return match ($context) {
|
||||||
dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([dcCore::app()->auth::PERMISSION_CONTENT_ADMIN]), dcCore::app()->blog->id)
|
// Allow BACKEND and MANAGE and MENU to also content admin
|
||||||
: null;
|
self::MANAGE, self::MENU => App::task()->checkContext('BACKEND')
|
||||||
|
&& App::blog()->isDefined()
|
||||||
|
&& App::auth()->check(App::auth()->makePermissions([
|
||||||
|
App::auth()::PERMISSION_ADMIN,
|
||||||
|
App::auth()::PERMISSION_CONTENT_ADMIN,
|
||||||
|
]), App::blog()->id()),
|
||||||
|
|
||||||
|
default => null,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,20 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @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
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\moreCSS;
|
namespace Dotclear\Plugin\moreCSS;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief moreCSS prepend class.
|
||||||
|
* @ingroup moreCSS
|
||||||
|
*
|
||||||
|
* @author Osku (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Prepend extends Process
|
class Prepend extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
|
@ -30,7 +28,7 @@ class Prepend extends Process
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dcCore::app()->url->register(
|
App::url()->register(
|
||||||
My::id(),
|
My::id(),
|
||||||
'morecss.css',
|
'morecss.css',
|
||||||
'^morecss\.css(.*?)$',
|
'^morecss\.css(.*?)$',
|
||||||
|
@ -38,7 +36,7 @@ class Prepend extends Process
|
||||||
header('Content-Type: text/css; charset=UTF-8');
|
header('Content-Type: text/css; charset=UTF-8');
|
||||||
|
|
||||||
echo "/* CSS for plugin moreCss */ \n";
|
echo "/* CSS for plugin moreCss */ \n";
|
||||||
echo (string) base64_decode((string) dcCore::app()->blog->settings->get('themes')->get('morecss_min'));
|
echo (string) base64_decode((string) App::blog()->settings()->get('themes')->get('morecss_min'));
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,20 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @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
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\moreCSS;
|
namespace Dotclear\Plugin\moreCSS;
|
||||||
|
|
||||||
use dcCore;
|
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
use Dotclear\Plugin\Uninstaller\Uninstaller;
|
use Dotclear\Plugin\Uninstaller\Uninstaller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief moreCSS uninstall class.
|
||||||
|
* @ingroup moreCSS
|
||||||
|
*
|
||||||
|
* @author Osku (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
class Uninstall extends Process
|
class Uninstall extends Process
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
|
@ -27,7 +24,7 @@ class Uninstall extends Process
|
||||||
|
|
||||||
public static function process(): bool
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!self::status() || !dcCore::app()->plugins->moduleExists('Uninstaller')) {
|
if (!self::status()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue