upgrade to dotclear 2.28
This commit is contained in:
parent
74e70beec0
commit
d3b0652ce1
8 changed files with 90 additions and 103 deletions
|
@ -1,3 +1,9 @@
|
|||
shortArchives 2.2 - 2023.10.20
|
||||
===========================================================
|
||||
* Require Dotclear 2.28
|
||||
* Require PHP 8.1
|
||||
* Upgrade to Dotclear 2.28
|
||||
|
||||
shortArchives 2.1 - 2023.08.13
|
||||
===========================================================
|
||||
* Require Dotclear 2.27
|
||||
|
|
33
README.md
33
README.md
|
@ -1,25 +1,22 @@
|
|||
# README
|
||||
|
||||
[![Release](https://img.shields.io/badge/release-2.1-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/shortArchives/releases)
|
||||
[![Date](https://img.shields.io/badge/date-2023.08.13-c44d58.svg)](https://git.dotclear.watch/JcDenis/shortArchives/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.2-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/shortArchives/releases)
|
||||
![Date](https://img.shields.io/badge/date-2023.10.20-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/shortArchives)
|
||||
[![License](https://img.shields.io/github/license/JcDenis/shortArchives)](https://git.dotclear.watch/JcDenis/shortArchives/blob/master/LICENSE)
|
||||
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/shortArchives/src/branch/master/LICENSE)
|
||||
|
||||
## WHAT IS SHORTARCHIVES ?
|
||||
## ABOUT
|
||||
|
||||
_shortArchives_ is a plugin for the open-source
|
||||
web publishing software called Dotclear.
|
||||
_shortArchives_ is a plugin for the open-source web publishing software called [Dotclear](https://www.dotclear.org).
|
||||
|
||||
Add a public widget that list links to archives by year.
|
||||
> Add a public widget that list links to archives by year.
|
||||
|
||||
## REQUIREMENTS
|
||||
|
||||
_shortArchives_ requires:
|
||||
|
||||
* content admin permissions to manage widgets
|
||||
* Dotclear 2.27
|
||||
* PHP 7.4
|
||||
* Dotclear 2.28
|
||||
* PHP 8.1+
|
||||
* Dotclear content admin permissions to manage widgets
|
||||
|
||||
## USAGE
|
||||
|
||||
|
@ -30,15 +27,15 @@ You should add widget to show archives list on your blog.
|
|||
|
||||
## 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/shortArchives) or [GitHub Page](https://github.com/JcDenis/shortArchives)
|
||||
* Packages & details: [Gitea Page](https://git.dotclear.watch/JcDenis/shortArchives/releases) or [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/shortArchives)
|
||||
* Discuss and help : [Dotclear Forum](http://forum.dotclear.org/viewtopic.php?pid=321044#p321044)
|
||||
* [Packages & details](https://git.dotclear.watch/JcDenis/shortArchives/releases) (or on [Dotaddict](https://plugins.dotaddict.org/dc2/details/shortArchives))
|
||||
* [Sources & contributions](https://git.dotclear.watch/JcDenis/shortArchives) (or on [GitHub](https://github.com/JcDenis/shortArchives))
|
||||
* [Issues & security](https://git.dotclear.watch/JcDenis/shortArchives/issues) (or on [GitHub](https://github.com/JcDenis/shortArchives/issues))
|
||||
* [Discuss & help](http://forum.dotclear.org/viewtopic.php?pid=321044#p321044)
|
||||
|
||||
## CONTRIBUTORS
|
||||
|
||||
* annso (author)
|
||||
* Pierre Van Glabeke
|
||||
* Jean-Christian Denis
|
||||
* Jean-Christian Denis (latest)
|
||||
|
||||
You are welcome to contribute to this code.
|
||||
|
|
24
_define.php
24
_define.php
|
@ -1,29 +1,27 @@
|
|||
<?php
|
||||
/**
|
||||
* @brief shortArchives, a plugin for Dotclear 2
|
||||
* @file
|
||||
* @brief The plugin shortArchives definition
|
||||
* @ingroup shortArchives
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
* @defgroup shortArchives Plugin shortArchives.
|
||||
*
|
||||
* @author annso, Pierre Van Glabeke and Contributors
|
||||
* Display blog archives in an accordion menu, sorted by year.
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @author annso (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(
|
||||
'shortArchives',
|
||||
'Display blog archives in an accordion menu, sorted by year',
|
||||
'annso, Pierre Van Glabeke and Contributors',
|
||||
'2.1',
|
||||
'2.2',
|
||||
[
|
||||
'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',
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
<modules xmlns:da="http://dotaddict.org/da/">
|
||||
<module id="shortArchives">
|
||||
<name>shortArchives</name>
|
||||
<version>2.1</version>
|
||||
<version>2.2</version>
|
||||
<author>annso, Pierre Van Glabeke and Contributors</author>
|
||||
<desc>Display blog archives in an accordion menu, sorted by year</desc>
|
||||
<file>https://git.dotclear.watch/JcDenis/shortArchives/releases/download/v2.1/plugin-shortArchives.zip</file>
|
||||
<da:dcmin>2.27</da:dcmin>
|
||||
<file>https://git.dotclear.watch/JcDenis/shortArchives/releases/download/v2.2/plugin-shortArchives.zip</file>
|
||||
<da:dcmin>2.28</da:dcmin>
|
||||
<da:details>https://git.dotclear.watch/JcDenis/shortArchives/src/branch/master/README.md</da:details>
|
||||
<da:support>https://git.dotclear.watch/JcDenis/shortArchives/issues</da:support>
|
||||
</module>
|
||||
|
|
|
@ -1,22 +1,20 @@
|
|||
<?php
|
||||
/**
|
||||
* @brief shortArchives, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author annso, 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\shortArchives;
|
||||
|
||||
use dcCore;
|
||||
use Dotclear\App;
|
||||
use Dotclear\Core\Process;
|
||||
|
||||
/**
|
||||
* @brief shortArchives backend class.
|
||||
* @ingroup shortArchives
|
||||
*
|
||||
* @author annso (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;
|
||||
}
|
||||
|
|
|
@ -1,22 +1,20 @@
|
|||
<?php
|
||||
/**
|
||||
* @brief shortArchives, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author annso, 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\shortArchives;
|
||||
|
||||
use dcCore;
|
||||
use Dotclear\App;
|
||||
use Dotclear\Core\Process;
|
||||
|
||||
/**
|
||||
* @brief shortArchives frontend class.
|
||||
* @ingroup shortArchives
|
||||
*
|
||||
* @author annso (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,8 +28,8 @@ class Frontend extends Process
|
|||
return false;
|
||||
}
|
||||
|
||||
dcCore::app()->addBehaviors([
|
||||
'initWidgets' => [Widgets::class, 'initWidgets'],
|
||||
App::behavior()->addBehaviors([
|
||||
'initWidgets' => Widgets::initWidgets(...),
|
||||
'publicHeadContent' => function (): void {
|
||||
echo
|
||||
My::jsLoad('accordion') .
|
||||
|
|
20
src/My.php
20
src/My.php
|
@ -1,15 +1,5 @@
|
|||
<?php
|
||||
/**
|
||||
* @brief shortArchives, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author annso, 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\shortArchives;
|
||||
|
@ -17,8 +7,14 @@ namespace Dotclear\Plugin\shortArchives;
|
|||
use Dotclear\Module\MyPlugin;
|
||||
|
||||
/**
|
||||
* This module definitions.
|
||||
* @brief shortArchives My helper.
|
||||
* @ingroup shortArchives
|
||||
*
|
||||
* @author annso (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
|
||||
}
|
||||
|
|
|
@ -1,25 +1,23 @@
|
|||
<?php
|
||||
/**
|
||||
* @brief shortArchives, a plugin for Dotclear 2
|
||||
*
|
||||
* @package Dotclear
|
||||
* @subpackage Plugin
|
||||
*
|
||||
* @author annso, 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\shortArchives;
|
||||
|
||||
use dcCore;
|
||||
use Dotclear\App;
|
||||
use Dotclear\Helper\Date;
|
||||
use Dotclear\Helper\Html\Html;
|
||||
use Dotclear\Plugin\widgets\WidgetsStack;
|
||||
use Dotclear\Plugin\widgets\WidgetsElement;
|
||||
|
||||
/**
|
||||
* @brief shortArchives widgets class.
|
||||
* @ingroup shortArchives
|
||||
*
|
||||
* @author annso (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
|
||||
|
@ -28,7 +26,7 @@ class Widgets
|
|||
$w->create(
|
||||
My::id(),
|
||||
My::name(),
|
||||
[self::class, 'parseWidget'],
|
||||
self::parseWidget(...),
|
||||
null,
|
||||
__('Blog Archive List an accordion menu, sorted by year')
|
||||
)
|
||||
|
@ -43,22 +41,20 @@ class Widgets
|
|||
|
||||
public static function parseWidget(WidgetsElement $w): string
|
||||
{
|
||||
// nullsafe
|
||||
if (is_null(dcCore::app()->blog)) {
|
||||
if (!App::blog()->isDefined()
|
||||
|| $w->__get('offline')
|
||||
|| !$w->checkHomeOnly(App::url()->type)
|
||||
) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if ($w->__get('offline') || !$w->checkHomeOnly(dcCore::app()->url->type)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$rs = dcCore::app()->blog->getDates(['type' => 'month']);
|
||||
$rs = App::blog()->getDates(['type' => 'month']);
|
||||
if ($rs->isEmpty()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$active_year = null;
|
||||
if ((dcCore::app()->url->type == 'archive') && preg_match('`^/([0-9]{4})/([0-9]{2})$`', (string) dcCore::app()->url->args, $matches)) {
|
||||
if ((App::url()->type == 'archive') && preg_match('`^/([0-9]{4})/([0-9]{2})$`', (string) App::url()->args, $matches)) {
|
||||
$active_year = $matches[1];
|
||||
}
|
||||
|
||||
|
@ -89,8 +85,8 @@ class Widgets
|
|||
}
|
||||
$res .= '</ul>';
|
||||
|
||||
if (dcCore::app()->url->getBase('archive') && !is_null($w->__get('allarchivesslinktitle')) && $w->__get('allarchivesslinktitle') !== '') {
|
||||
$res .= '<p><strong><a href="' . dcCore::app()->blog->url . dcCore::app()->url->getURLFor('archive') . '">' .
|
||||
if (App::url()->getBase('archive') && !is_null($w->__get('allarchivesslinktitle')) && $w->__get('allarchivesslinktitle') !== '') {
|
||||
$res .= '<p><strong><a href="' . App::blog()->url() . App::url()->getURLFor('archive') . '">' .
|
||||
Html::escapeHTML($w->__get('allarchivesslinktitle')) . '</a></strong></p>';
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue