From 1fe44df5a14f67f38a81ad149b329ca3f68e7db5 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sun, 15 Oct 2023 19:39:33 +0200 Subject: [PATCH] upgrade to Dotclear 2.28 --- CHANGELOG.md | 6 ++++++ README.md | 16 ++++++++-------- _define.php | 36 +++++++++++++++++------------------- dcstore.xml | 6 +++--- src/Backend.php | 26 +++++++++++--------------- src/Frontend.php | 26 +++++++++++--------------- src/My.php | 20 ++++++++------------ src/Widgets.php | 42 +++++++++++++++++++----------------------- 8 files changed, 83 insertions(+), 95 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0341b60..61d87ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +bloganniv 2.4 - 2023.10.15 +=========================================================== +* Require Dotclear 2.28 +* Require PHP 8.1 +* Upgrade to Dotclear 2.28 + bloganniv 2.3 - 2023.08.06 =========================================================== * Require Dotclear 2.27 diff --git a/README.md b/README.md index b126cc2..0d0ad0f 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # README -[![Release](https://img.shields.io/badge/release-2.3-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/bloganniv/releases) -![Date](https://img.shields.io/badge/date-2023.08.07-c44d58.svg) -[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-137bbb.svg)](https://fr.dotclear.org/download) +[![Release](https://img.shields.io/badge/release-2.4-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/bloganniv/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/bloganniv) -[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/bloganniv/blob/master/LICENSE) +[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/bloganniv/src/branch/master/LICENSE) ## ABOUT @@ -14,8 +14,8 @@ _bloganniv_ is a plugin for the open-source web publishing software called [Dotc ## REQUIREMENTS -* Dotclear 2.27 -* PHP 7.4+ +* Dotclear 2.28 +* PHP 8.1+ * Dotclear permission to manage widgets ## USAGE @@ -32,7 +32,7 @@ It adds widget showing: ## LINKS -* [License](https://git.dotclear.watch/JcDenis/bloganniv/blob/master/LICENSE) +* [License](https://git.dotclear.watch/JcDenis/bloganniv/src/branch/master/LICENSE) * [Packages & details](https://git.dotclear.watch/JcDenis/bloganniv/releases) (or on [Dotaddict](https://plugins.dotaddict.org/dc2/details/bloganniv)) * [Sources & contributions](https://git.dotclear.watch/JcDenis/bloganniv) (or on [GitHub](https://github.com/JcDenis/bloganniv)) * [Issues & security](https://git.dotclear.watch/JcDenis/bloganniv/issues) (or on [GitHub](https://github.com/JcDenis/bloganniv/issues)) @@ -41,6 +41,6 @@ It adds widget showing: * Fran6t (author) * Pierre Van Glabeke -* Jean-Christian Denis +* Jean-Christian Denis (latest) You are welcome to contribute to this code. diff --git a/_define.php b/_define.php index e847729..4a30bbb 100644 --- a/_define.php +++ b/_define.php @@ -1,32 +1,30 @@ registerModule( 'Blog Anniv', - 'Counting the number of days before and after a particular date', + 'Show number of days before and after a given date', 'Fran6t, Pierre Van Glabeke and Contributors', - '2.3', + '2.4', [ - 'requires' => [['core', '2.27']], - 'permissions' => dcCore::app()->auth->makePermissions([ - dcCore::app()->auth::PERMISSION_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', ] ); diff --git a/dcstore.xml b/dcstore.xml index 5fedc0f..30fcc24 100644 --- a/dcstore.xml +++ b/dcstore.xml @@ -2,11 +2,11 @@ Blog Anniv - 2.3 + 2.4 Fran6t, Pierre Van Glabeke and Contributors Counting the number of days before and after a particular date - https://git.dotclear.watch/JcDenis/bloganniv/releases/download/v2.3/plugin-bloganniv.zip - 2.27 + https://git.dotclear.watch/JcDenis/bloganniv/releases/download/v2.4/plugin-bloganniv.zip + 2.28 https://git.dotclear.watch/JcDenis/bloganniv/src/branch/master/README.md https://git.dotclear.watch/JcDenis/bloganniv/issues diff --git a/src/Backend.php b/src/Backend.php index 23b134b..2ef6aa0 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -1,22 +1,20 @@ addBehaviors([ - 'initWidgets' => [Widgets::class, 'initWidgets'], - ]); + App::behavior()->addBehavior('initWidgets', Widgets::initWidgets(...)); return true; } diff --git a/src/Frontend.php b/src/Frontend.php index d02c555..c706d5f 100644 --- a/src/Frontend.php +++ b/src/Frontend.php @@ -1,22 +1,20 @@ addBehaviors([ - 'initWidgets' => [Widgets::class, 'initWidgets'], - ]); + App::behavior()->addBehavior('initWidgets', Widgets::initWidgets(...)); return true; } diff --git a/src/My.php b/src/My.php index 151547c..1a8f8f4 100644 --- a/src/My.php +++ b/src/My.php @@ -1,15 +1,5 @@ create( My::id(), My::name(), - [self::class, 'parseWidget'], + self::parseWidget(...), null, __('Counting the number of days before and after a particular date') ) @@ -42,22 +40,20 @@ class Widgets public static function parseWidget(WidgetsElement $w): string { - if ($w->__get('offline') || !$w->checkHomeOnly(dcCore::app()->url->type)) { - return ''; - } - - // nullsafe PHP < 8.0 - if (is_null(dcCore::app()->blog)) { + if ($w->__get('offline') + || !$w->checkHomeOnly(App::url()->type) + || !App::blog()->isDefined() + ) { return ''; } $ftdatecrea = $w->__get('ftdatecrea'); //Si la date est vide nous recherchons la date en base if (strlen(rtrim($ftdatecrea)) == 0) { - $jour = date('d', dcCore::app()->blog->creadt); - $mois = date('m', dcCore::app()->blog->creadt); - $annee = date('Y', dcCore::app()->blog->creadt); - $ftdatecrea = date('d/m/Y', dcCore::app()->blog->creadt); + $jour = date('d', App::blog()->creadt()); + $mois = date('m', App::blog()->creadt()); + $annee = date('Y', App::blog()->creadt()); + $ftdatecrea = date('d/m/Y', App::blog()->creadt()); } else { [$jour, $mois, $annee] = explode('/', $ftdatecrea); }