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