From 15d8761bed78052604cef17a953e4632f008316c Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sun, 15 Oct 2023 22:48:23 +0200 Subject: [PATCH] cosmetic clean --- CHANGELOG.md | 6 ++++++ README.md | 8 ++++---- _define.php | 2 +- dcstore.xml | 4 ++-- src/Backend.php | 14 ++++++-------- src/Frontend.php | 8 +++----- src/Install.php | 4 ++-- src/My.php | 4 ++-- src/Uninstall.php | 4 ++-- src/Widgets.php | 17 ++++++++--------- 10 files changed, 36 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6b2508..26d90cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +dcLatestVersions 2023.10.15 +=========================================================== +* Require Dotclear 2.28 +* Require PHP 8.1 +* Cosmetic clean + dcLatestVersions 2023.10.11 =========================================================== * Require Dotclear 2.28 diff --git a/README.md b/README.md index 217a3bb..1f1eac9 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # README -[![Release](https://img.shields.io/badge/release-2023.10.11-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/dcLatestVersions/releases) -![Date](https://img.shields.io/badge/date-2023.10.11-c44d58.svg) +[![Release](https://img.shields.io/badge/release-2023.10.15-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/dcLatestVersions/releases) +![Date](https://img.shields.io/badge/date-2023.10.15-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/dcLatestVersions) -[![License](https://img.shields.io/github/license/JcDenis/dcLatestVersions)](https://git.dotclear.watch/JcDenis/dcLatestVersions/blob/master/LICENSE) +[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/dcLatestVersions/src/branch/master/LICENSE) ## ABOUT @@ -14,9 +14,9 @@ _dcLatestVersions_ is a plugin for the open-source web publishing software calle ## REQUIREMENTS -* permissions to manage widgets * Dotclear 2.28 * PHP 8.1 +* Dotclear permissions to manage widgets ## USAGE diff --git a/_define.php b/_define.php index c17210c..2828080 100644 --- a/_define.php +++ b/_define.php @@ -16,7 +16,7 @@ $this->registerModule( "Dotclear's latest versions", 'Show the latest available versions of Dotclear', 'Jean-Christian Denis, Pierre Van Glabeke', - '2023.10.11', + '2023.10.15', [ 'requires' => [['core', '2.28']], 'permissions' => 'My', diff --git a/dcstore.xml b/dcstore.xml index 40506fb..1f9ac1d 100644 --- a/dcstore.xml +++ b/dcstore.xml @@ -2,10 +2,10 @@ Dotclear's latest versions - 2023.10.11 + 2023.10.15 Jean-Christian Denis, Pierre Van Glabeke Show the latest available versions of Dotclear - https://git.dotclear.watch/JcDenis/dcLatestVersions/releases/download/v2023.10.11/plugin-dcLatestVersions.zip + https://git.dotclear.watch/JcDenis/dcLatestVersions/releases/download/v2023.10.15/plugin-dcLatestVersions.zip 2.28 https://git.dotclear.watch/JcDenis/dcLatestVersions/src/branch/master/README.md https://git.dotclear.watch/JcDenis/dcLatestVersions/issues diff --git a/src/Backend.php b/src/Backend.php index dad406c..69f8d0b 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -16,8 +16,8 @@ use Dotclear\Helper\Html\Form\{ use Dotclear\Helper\Html\Html; /** - * @brief dcLatestVersions backend class. - * @ingroup dcLatestVersions + * @brief dcLatestVersions backend class. + * @ingroup dcLatestVersions * * @author Jean-Christian Denis * @copyright Jean-Christian Denis @@ -37,13 +37,11 @@ class Backend extends Process } App::behavior()->addBehaviors([ - 'initWidgets' => [Widgets::class, 'initWidgets'], + 'initWidgets' => Widgets::initWidgets(...), 'adminDashboardItemsV2' => function (ArrayObject $__dashboard_items): void { - if (!App::blog()->isDefined()) { - return; - } - - if (!My::prefs()->get('dashboard_items')) { + if (!App::blog()->isDefined() + || !My::prefs()->get('dashboard_items') + ) { return; } diff --git a/src/Frontend.php b/src/Frontend.php index b6be59d..14d538c 100644 --- a/src/Frontend.php +++ b/src/Frontend.php @@ -8,8 +8,8 @@ use Dotclear\App; use Dotclear\Core\Process; /** - * @brief dcLatestVersions frontend class. - * @ingroup dcLatestVersions + * @brief dcLatestVersions frontend class. + * @ingroup dcLatestVersions * * @author Jean-Christian Denis * @copyright Jean-Christian Denis @@ -28,9 +28,7 @@ class Frontend extends Process return false; } - App::behavior()->addBehaviors([ - 'initWidgets' => [Widgets::class, 'initWidgets'], - ]); + App::behavior()->addBehavior('initWidgets', Widgets::initWidgets(...)); return true; } diff --git a/src/Install.php b/src/Install.php index f392703..e3e63dd 100644 --- a/src/Install.php +++ b/src/Install.php @@ -7,8 +7,8 @@ namespace Dotclear\Plugin\dcLatestVersions; use Dotclear\Core\Process; /** - * @brief dcLatestVersions installation class. - * @ingroup dcLatestVersions + * @brief dcLatestVersions installation class. + * @ingroup dcLatestVersions * * @author Jean-Christian Denis * @copyright Jean-Christian Denis diff --git a/src/My.php b/src/My.php index 5b2224e..9a5c9a3 100644 --- a/src/My.php +++ b/src/My.php @@ -7,8 +7,8 @@ namespace Dotclear\Plugin\dcLatestVersions; use Dotclear\Module\MyPlugin; /** - * @brief dcLatestVersions My helper. - * @ingroup dcLatestVersions + * @brief dcLatestVersions My helper. + * @ingroup dcLatestVersions * * @author Jean-Christian Denis * @copyright Jean-Christian Denis diff --git a/src/Uninstall.php b/src/Uninstall.php index 0759dce..e618a74 100644 --- a/src/Uninstall.php +++ b/src/Uninstall.php @@ -8,8 +8,8 @@ use Dotclear\Core\Process; use Dotclear\Plugin\Uninstaller\Uninstaller; /** - * @brief dcLatestVersions uninstall class. - * @ingroup dcLatestVersions + * @brief dcLatestVersions uninstall class. + * @ingroup dcLatestVersions * * @author Jean-Christian Denis * @copyright Jean-Christian Denis diff --git a/src/Widgets.php b/src/Widgets.php index cc32c62..f288182 100644 --- a/src/Widgets.php +++ b/src/Widgets.php @@ -11,8 +11,8 @@ use Dotclear\Plugin\widgets\WidgetsStack; use Dotclear\Plugin\widgets\WidgetsElement; /** - * @brief dcLatestVersions widgets class. - * @ingroup dcLatestVersions + * @brief dcLatestVersions widgets class. + * @ingroup dcLatestVersions * * @author Jean-Christian Denis * @copyright Jean-Christian Denis @@ -26,7 +26,7 @@ class Widgets ->create( My::id() . 'widget', My::name(), - [self::class, 'parseWidget'], + self::parseWidget(...), null, __('Show the latest available versions of Dotclear') ) @@ -47,12 +47,11 @@ class Widgets public static function parseWidget(WidgetsElement $w): string { - if ($w->__get('offline') || !$w->checkHomeOnly(App::url()->type) || $w->__get('text') == '') { - return ''; - } - - // nullsafe PHP < 8.0 - if (!App::blog()->isDefined()) { + if ($w->__get('offline') + || !$w->checkHomeOnly(App::url()->type) + || $w->__get('text') == '' + || !App::blog()->isDefined() + ) { return ''; }