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

View file

@ -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.

View file

@ -1,29 +1,27 @@
<?php
/**
* @brief bloganniv, a plugin for Dotclear 2
* @file
* @brief The plugin bloganniv definition
* @ingroup bloganniv
*
* @package Dotclear
* @subpackage Plugin
* @defgroup bloganniv Plugin bloganniv.
*
* @author Fran6t, Pierre Van Glabeke and Contributors
* Show number of days before and after a given date.
*
* @copyright Jean-Christian Denis
* @author Fran6t (author)
* @author Jean-Christian Denis (latest)
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
*/
if (!defined('DC_RC_PATH')) {
return null;
}
declare(strict_types=1);
$this->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,
]),
'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',

View file

@ -2,11 +2,11 @@
<modules xmlns:da="http://dotaddict.org/da/">
<module id="bloganniv">
<name>Blog Anniv</name>
<version>2.3</version>
<version>2.4</version>
<author>Fran6t, Pierre Van Glabeke and Contributors</author>
<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>
<da:dcmin>2.27</da:dcmin>
<file>https://git.dotclear.watch/JcDenis/bloganniv/releases/download/v2.4/plugin-bloganniv.zip</file>
<da:dcmin>2.28</da:dcmin>
<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>
</module>

View file

@ -1,22 +1,20 @@
<?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);
namespace Dotclear\Plugin\bloganniv;
use dcCore;
use Dotclear\App;
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
{
public static function init(): bool
@ -30,9 +28,7 @@ class Backend extends Process
return false;
}
dcCore::app()->addBehaviors([
'initWidgets' => [Widgets::class, 'initWidgets'],
]);
App::behavior()->addBehavior('initWidgets', Widgets::initWidgets(...));
return true;
}

View file

@ -1,22 +1,20 @@
<?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);
namespace Dotclear\Plugin\bloganniv;
use dcCore;
use Dotclear\App;
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
{
public static function init(): bool
@ -30,9 +28,7 @@ class Frontend extends Process
return false;
}
dcCore::app()->addBehaviors([
'initWidgets' => [Widgets::class, 'initWidgets'],
]);
App::behavior()->addBehavior('initWidgets', Widgets::initWidgets(...));
return true;
}

View file

@ -1,15 +1,5 @@
<?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);
namespace Dotclear\Plugin\bloganniv;
@ -17,8 +7,14 @@ namespace Dotclear\Plugin\bloganniv;
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
{
// Use default permissions
}

View file

@ -1,24 +1,22 @@
<?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);
namespace Dotclear\Plugin\bloganniv;
use dcCore;
use Dotclear\App;
use Dotclear\Helper\Html\Html;
use Dotclear\Plugin\widgets\WidgetsStack;
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
{
public static function initWidgets(WidgetsStack $w): void
@ -26,7 +24,7 @@ class Widgets
$w->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);
}