upgrade to Dotclear 2.28

This commit is contained in:
Jean-Christian Denis 2023-10-15 19:39:33 +02:00
parent d9a1feb3b3
commit 1fe44df5a1
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951
8 changed files with 83 additions and 95 deletions

View file

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

View file

@ -1,10 +1,10 @@
# README # README
[![Release](https://img.shields.io/badge/release-2.3-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/bloganniv/releases) [![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.08.07-c44d58.svg) ![Date](https://img.shields.io/badge/date-2023.10.15-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/bloganniv) [![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 ## ABOUT
@ -14,8 +14,8 @@ _bloganniv_ is a plugin for the open-source web publishing software called [Dotc
## REQUIREMENTS ## REQUIREMENTS
* Dotclear 2.27 * Dotclear 2.28
* PHP 7.4+ * PHP 8.1+
* Dotclear permission to manage widgets * Dotclear permission to manage widgets
## USAGE ## USAGE
@ -32,7 +32,7 @@ It adds widget showing:
## LINKS ## 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)) * [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)) * [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)) * [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) * Fran6t (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.

View file

@ -1,32 +1,30 @@
<?php <?php
/** /**
* @brief bloganniv, a plugin for Dotclear 2 * @file
* @brief The plugin bloganniv definition
* @ingroup bloganniv
* *
* @package Dotclear * @defgroup bloganniv Plugin bloganniv.
* @subpackage Plugin
* *
* @author Fran6t, Pierre Van Glabeke and Contributors * Show number of days before and after a given date.
* *
* @copyright Jean-Christian Denis * @author Fran6t (author)
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html * @author Jean-Christian Denis (latest)
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/ */
if (!defined('DC_RC_PATH')) { declare(strict_types=1);
return null;
}
$this->registerModule( $this->registerModule(
'Blog Anniv', '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', 'Fran6t, Pierre Van Glabeke and Contributors',
'2.3', '2.4',
[ [
'requires' => [['core', '2.27']], 'requires' => [['core', '2.28']],
'permissions' => dcCore::app()->auth->makePermissions([ 'permissions' => 'My',
dcCore::app()->auth::PERMISSION_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',
] ]
); );

View file

@ -2,11 +2,11 @@
<modules xmlns:da="http://dotaddict.org/da/"> <modules xmlns:da="http://dotaddict.org/da/">
<module id="bloganniv"> <module id="bloganniv">
<name>Blog Anniv</name> <name>Blog Anniv</name>
<version>2.3</version> <version>2.4</version>
<author>Fran6t, Pierre Van Glabeke and Contributors</author> <author>Fran6t, Pierre Van Glabeke and Contributors</author>
<desc>Counting the number of days before and after a particular date</desc> <desc>Counting the number of days before and after a particular date</desc>
<file>https://git.dotclear.watch/JcDenis/bloganniv/releases/download/v2.3/plugin-bloganniv.zip</file> <file>https://git.dotclear.watch/JcDenis/bloganniv/releases/download/v2.4/plugin-bloganniv.zip</file>
<da:dcmin>2.27</da:dcmin> <da:dcmin>2.28</da:dcmin>
<da:details>https://git.dotclear.watch/JcDenis/bloganniv/src/branch/master/README.md</da:details> <da:details>https://git.dotclear.watch/JcDenis/bloganniv/src/branch/master/README.md</da:details>
<da:support>https://git.dotclear.watch/JcDenis/bloganniv/issues</da:support> <da:support>https://git.dotclear.watch/JcDenis/bloganniv/issues</da:support>
</module> </module>

View file

@ -1,22 +1,20 @@
<?php <?php
/**
* @brief bloganniv, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Fran6t, Pierre Van Glabeke 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\bloganniv; namespace Dotclear\Plugin\bloganniv;
use dcCore; use Dotclear\App;
use Dotclear\Core\Process; use Dotclear\Core\Process;
/**
* @brief bloganniv backend class.
* @ingroup bloganniv
*
* @author Fran6t (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
@ -30,9 +28,7 @@ class Backend extends Process
return false; return false;
} }
dcCore::app()->addBehaviors([ App::behavior()->addBehavior('initWidgets', Widgets::initWidgets(...));
'initWidgets' => [Widgets::class, 'initWidgets'],
]);
return true; return true;
} }

View file

@ -1,22 +1,20 @@
<?php <?php
/**
* @brief bloganniv, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Fran6t, Pierre Van Glabeke 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\bloganniv; namespace Dotclear\Plugin\bloganniv;
use dcCore; use Dotclear\App;
use Dotclear\Core\Process; use Dotclear\Core\Process;
/**
* @brief bloganniv frontend class.
* @ingroup bloganniv
*
* @author Fran6t (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
@ -30,9 +28,7 @@ class Frontend extends Process
return false; return false;
} }
dcCore::app()->addBehaviors([ App::behavior()->addBehavior('initWidgets', Widgets::initWidgets(...));
'initWidgets' => [Widgets::class, 'initWidgets'],
]);
return true; return true;
} }

View file

@ -1,15 +1,5 @@
<?php <?php
/**
* @brief bloganniv, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Fran6t, Pierre Van Glabeke 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\bloganniv; namespace Dotclear\Plugin\bloganniv;
@ -17,8 +7,14 @@ namespace Dotclear\Plugin\bloganniv;
use Dotclear\Module\MyPlugin; use Dotclear\Module\MyPlugin;
/** /**
* This module definitions. * @brief bloganniv My helper.
* @ingroup bloganniv
*
* @author Fran6t (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
{ {
// Use default permissions
} }

View file

@ -1,24 +1,22 @@
<?php <?php
/**
* @brief bloganniv, a plugin for Dotclear 2
*
* @package Dotclear
* @subpackage Plugin
*
* @author Fran6t, Pierre Van Glabeke 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\bloganniv; namespace Dotclear\Plugin\bloganniv;
use dcCore; use Dotclear\App;
use Dotclear\Helper\Html\Html; use Dotclear\Helper\Html\Html;
use Dotclear\Plugin\widgets\WidgetsStack; use Dotclear\Plugin\widgets\WidgetsStack;
use Dotclear\Plugin\widgets\WidgetsElement; use Dotclear\Plugin\widgets\WidgetsElement;
/**
* @brief bloganniv widgets class.
* @ingroup bloganniv
*
* @author Fran6t (author)
* @author Jean-Christian Denis (latest)
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
class Widgets class Widgets
{ {
public static function initWidgets(WidgetsStack $w): void public static function initWidgets(WidgetsStack $w): void
@ -26,7 +24,7 @@ class Widgets
$w->create( $w->create(
My::id(), My::id(),
My::name(), My::name(),
[self::class, 'parseWidget'], self::parseWidget(...),
null, null,
__('Counting the number of days before and after a particular date') __('Counting the number of days before and after a particular date')
) )
@ -42,22 +40,20 @@ class Widgets
public static function parseWidget(WidgetsElement $w): string public static function parseWidget(WidgetsElement $w): string
{ {
if ($w->__get('offline') || !$w->checkHomeOnly(dcCore::app()->url->type)) { if ($w->__get('offline')
return ''; || !$w->checkHomeOnly(App::url()->type)
} || !App::blog()->isDefined()
) {
// nullsafe PHP < 8.0
if (is_null(dcCore::app()->blog)) {
return ''; return '';
} }
$ftdatecrea = $w->__get('ftdatecrea'); $ftdatecrea = $w->__get('ftdatecrea');
//Si la date est vide nous recherchons la date en base //Si la date est vide nous recherchons la date en base
if (strlen(rtrim($ftdatecrea)) == 0) { if (strlen(rtrim($ftdatecrea)) == 0) {
$jour = date('d', dcCore::app()->blog->creadt); $jour = date('d', App::blog()->creadt());
$mois = date('m', dcCore::app()->blog->creadt); $mois = date('m', App::blog()->creadt());
$annee = date('Y', dcCore::app()->blog->creadt); $annee = date('Y', App::blog()->creadt());
$ftdatecrea = date('d/m/Y', dcCore::app()->blog->creadt); $ftdatecrea = date('d/m/Y', App::blog()->creadt());
} else { } else {
[$jour, $mois, $annee] = explode('/', $ftdatecrea); [$jour, $mois, $annee] = explode('/', $ftdatecrea);
} }