release 2.5

main v2.5
Jean-Christian Paul Denis 2023-10-11 22:17:24 +02:00
parent 7060aef4bf
commit e6f0d1b167
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
11 changed files with 149 additions and 153 deletions

View File

@ -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
===========================================================
* Require Dotclear 2.27

View File

@ -1,26 +1,22 @@
# README
[![Release](https://img.shields.io/badge/release-2.4-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)
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-137bbb.svg)](https://fr.dotclear.org/download)
[![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.10.11-c44d58.svg)
[![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)
[![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
web publishing software called Dotclear.
_moreCSS_ is a plugin for the open-source web publishing software called [Dotclear](https://www.dotclear.org).
It helps admin to add more CSS rules to current theme
without editing it.
> It helps admin to add more CSS rules to current theme without editing it.
## REQUIREMENTS
_moreCSS_ requires:
* Dotclear 2.28
* PHP 8.1+
* content admin permissions to manage CSS
* Dotclear 2.27
* PHP 7.4+
## USAGE
@ -32,16 +28,17 @@ or by adding a favorites icon on dashboard.
## LINKS
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
* Source & contribution : [Gitea Page](https://git.dotclear.watch/JcDenis/moreCSS) or [GitHub Page](https://github.com/JcDenis/moreCSS)
* Packages & details: [Gitea Page](https://git.dotclear.watch/JcDenis/moreCSS/releases) or [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/moreCSS)
* Discuss & help : [Dotclear forum](http://forum.dotclear.org/viewtopic.php?id=44908)
* [License](https://git.dotclear.watch/JcDenis/moreCSS/src/branch/master/LICENSE)
* [Packages & details](https://git.dotclear.watch/JcDenis/moreCSS/releases) (or on [Dotaddict](https://plugins.dotaddict.org/dc2/details/moreCSS))
* [Sources & contributions](https://git.dotclear.watch/JcDenis/moreCSS) (or on [GitHub](https://github.com/JcDenis/moreCSS))
* [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
* Osku (author)
* Pierre Van Glabeke
* Jean-Christian Denis
* Jean-Christian Denis (latest)
You are welcome to contribute to this code.

View File

@ -1,32 +1,29 @@
<?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(
'Style sheet',
'Another CSS stylesheet for the active theme',
'Osku and contributors',
'2.4',
'2.5',
[
'requires' => [['core', '2.27']],
'permissions' => dcCore::app()->auth->makePermissions([
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN,
]),
'type' => 'plugin',
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
'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',
'requires' => [['core', '2.28']],
'permissions' => 'My',
'type' => 'plugin',
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
'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',
]
);

View File

@ -2,11 +2,11 @@
<modules xmlns:da="http://dotaddict.org/da/">
<module id="moreCSS">
<name>Style sheet</name>
<version>2.4</version>
<version>2.5</version>
<author>Osku and contributors</author>
<desc>Another CSS stylesheet for the active theme</desc>
<file>https://git.dotclear.watch/JcDenis/moreCSS/releases/download/v2.4/plugin-moreCSS.zip</file>
<da:dcmin>2.27</da:dcmin>
<file>https://git.dotclear.watch/JcDenis/moreCSS/releases/download/v2.5/plugin-moreCSS.zip</file>
<da:dcmin>2.28</da:dcmin>
<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>
</module>

View File

@ -14,13 +14,18 @@ declare(strict_types=1);
namespace Dotclear\Plugin\moreCSS;
use dcCore;
use Dotclear\App;
use Dotclear\Core\Process;
use Dotclear\Core\Backend\{
Favorites,
Menus
};
use Dotclear\Core\Backend\Favorites;
/**
* @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
{
public static function init(): bool
@ -34,15 +39,15 @@ class Backend extends Process
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(), [
'title' => My::name(),
'url' => My::manageUrl(),
'small-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]),
]);
});

View File

@ -1,23 +1,20 @@
<?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);
namespace Dotclear\Plugin\moreCSS;
use dcCore;
use dcUtils;
use Dotclear\App;
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
{
public static function init(): bool
@ -27,15 +24,15 @@ class Frontend extends Process
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;
}
dcCore::app()->addBehavior('publicHeadContent', function (): void {
$css = (string) base64_decode((string) dcCore::app()->blog->settings->get('themes')->get('morecss_min'));
App::behavior()->addBehavior('publicHeadContent', function (): void {
$css = (string) base64_decode((string) App::blog()->settings()->get('themes')->get('morecss_min'));
if (!empty($css)) {
echo dcUtils::cssLoad(
dcCore::app()->blog->url . dcCore::app()->url->getURLFor(My::id()),
echo App::plugins()->cssLoad(
App::blog()->url() . App::url()->getURLFor(My::id()),
'screen',
md5($css) //no cache on content change
);

View File

@ -1,23 +1,21 @@
<?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);
namespace Dotclear\Plugin\moreCSS;
use dcCore;
use Dotclear\App;
use Dotclear\Core\Process;
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
{
public static function init(): bool
@ -27,19 +25,19 @@ class Install extends Process
public static function process(): bool
{
if (!self::status() || is_null(dcCore::app()->blog)) {
if (!self::status() || !App::blog()->isDefined()) {
return false;
}
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', '', '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());
App::error()->add($e->getMessage());
}
return true;

View File

@ -1,20 +1,10 @@
<?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);
namespace Dotclear\Plugin\moreCSS;
use dcCore;
use Dotclear\App;
use Dotclear\Core\Process;
use Dotclear\Core\Backend\{
Notices,
@ -32,6 +22,14 @@ use Dotclear\Helper\Html\Form\{
use Dotclear\Helper\Html\Html;
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
{
public static function init(): bool
@ -45,7 +43,7 @@ class Manage extends Process
return false;
}
$s = dcCore::app()->blog->settings->get('themes');
$s = App::blog()->settings()->get('themes');
if (isset($_POST['morecss'])) {
try {
@ -70,7 +68,7 @@ class Manage extends Process
);
My::redirect();
} catch (Exception $e) {
dcCore::app()->error->add($e->getMessage());
App::error()->add($e->getMessage());
}
}
@ -83,26 +81,26 @@ class Manage extends Process
return;
}
$s = dcCore::app()->blog->settings->get('themes');
$s = App::blog()->settings()->get('themes');
Page::openModule(
My::name(),
(
dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax') ?
Page::jsJson('dotclear_colorsyntax', ['colorsyntax' => dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax')]) .
Page::jsLoadCodeMirror(dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax_theme'))
App::auth()->prefs()->get('interface')->get('colorsyntax') ?
Page::jsJson('dotclear_colorsyntax', ['colorsyntax' => App::auth()->prefs()->get('interface')->get('colorsyntax')]) .
Page::jsLoadCodeMirror(App::auth()->prefs()->get('interface')->get('colorsyntax_theme'))
: ''
)
);
echo
Page::breadcrumb([
Html::escapeHTML(dcCore::app()->blog->name) => '',
My::name() => '',
Html::escapeHTML(App::blog()->name()) => '',
My::name() => '',
]) .
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 Label(__('Style sheet:')))->for('morecss'),
(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 Para())->items([
dcCore::app()->formNonce(false),
App::nonce()->formNonce(),
(new Hidden('p', 'moreCSS')),
(new Submit(['write']))->value(__('Save') . ' (s)')->accesskey('s'),
]),
])->render();
if (dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax')) {
if (App::auth()->prefs()->get('interface')->get('colorsyntax')) {
echo
Page::jsJson('theme_editor_mode', ['mode' => 'css']) .
Page::jsLoad(dcCore::app()->blog->getPF('themeEditor/js/mode.js')) .
Page::jsRunCodeMirror('editor', 'morecss', 'dotclear', dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax_theme'));
Page::jsLoad(App::blog()->getPF('themeEditor/js/mode.js')) .
Page::jsRunCodeMirror('editor', 'morecss', 'dotclear', App::auth()->prefs()->get('interface')->get('colorsyntax_theme'));
}
Page::closeModule();

View File

@ -1,31 +1,34 @@
<?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);
namespace Dotclear\Plugin\moreCSS;
use dcCore;
use Dotclear\App;
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
{
public static function checkCustomContext(int $context): ?bool
protected static function checkCustomContext(int $context): ?bool
{
return in_array($context, [My::BACKEND, My::MENU]) ?
dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([dcCore::app()->auth::PERMISSION_CONTENT_ADMIN]), dcCore::app()->blog->id)
: null;
return match ($context) {
// Allow BACKEND and MANAGE and MENU to also content admin
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,
};
}
}

View File

@ -1,22 +1,20 @@
<?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);
namespace Dotclear\Plugin\moreCSS;
use dcCore;
use Dotclear\App;
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
{
public static function init(): bool
@ -30,7 +28,7 @@ class Prepend extends Process
return false;
}
dcCore::app()->url->register(
App::url()->register(
My::id(),
'morecss.css',
'^morecss\.css(.*?)$',
@ -38,7 +36,7 @@ class Prepend extends Process
header('Content-Type: text/css; charset=UTF-8');
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;
}

View File

@ -1,23 +1,20 @@
<?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);
namespace Dotclear\Plugin\moreCSS;
use dcCore;
use Dotclear\Core\Process;
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
{
public static function init(): bool
@ -27,7 +24,7 @@ class Uninstall extends Process
public static function process(): bool
{
if (!self::status() || !dcCore::app()->plugins->moduleExists('Uninstaller')) {
if (!self::status()) {
return false;
}