release 1.9 for dotclear 2.24
This commit is contained in:
parent
830a563e1d
commit
4484d2ed5e
9 changed files with 237 additions and 186 deletions
14
CHANGELOG.md
14
CHANGELOG.md
|
@ -1,19 +1,23 @@
|
||||||
v1.8.1 - 29-06-2015 - Pierre Van Glabeke
|
1.9 - 2022.12.17
|
||||||
|
* update to dotclear 2.24
|
||||||
|
* fix phpstan errors
|
||||||
|
|
||||||
|
1.8.1 - 2015.06.29 - Pierre Van Glabeke
|
||||||
* correction validation html
|
* correction validation html
|
||||||
|
|
||||||
v1.8 - 08-06-2015 - Pierre Van Glabeke
|
1.8 - 2015.06.08 - Pierre Van Glabeke
|
||||||
* ajout lien vers toutes les archives
|
* ajout lien vers toutes les archives
|
||||||
|
|
||||||
v1.7 - 28-05-2015 - Kozlika & Nikrou
|
1.7 - 2015.05.28 - Kozlika & Nikrou
|
||||||
* suppression d'image et gestion de l'indicateur via css
|
* suppression d'image et gestion de l'indicateur via css
|
||||||
* ajout de classes sur chaque liste (année/mois)
|
* ajout de classes sur chaque liste (année/mois)
|
||||||
* application de la class .open sur l'item ouvert par défaut
|
* application de la class .open sur l'item ouvert par défaut
|
||||||
* application de la class .open sur l'item correspondant au mois actif en cas de consulation des archives
|
* application de la class .open sur l'item correspondant au mois actif en cas de consulation des archives
|
||||||
|
|
||||||
v1.6 - 25-04-2015 - Pierre Van Glabeke
|
1.6 - 2015.04.25 - Pierre Van Glabeke
|
||||||
* modif appel css
|
* modif appel css
|
||||||
* ajout localisation
|
* ajout localisation
|
||||||
* ajout identification widget
|
* ajout identification widget
|
||||||
|
|
||||||
v1.5 - 14-12-2014 - Pierre Van Glabeke
|
1.5 - 2014.12.14 - Pierre Van Glabeke
|
||||||
* compatibilité dc2.7
|
* compatibilité dc2.7
|
||||||
|
|
23
LICENSE
23
LICENSE
|
@ -1,12 +1,12 @@
|
||||||
GNU GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
Version 2, June 1991
|
Version 2, June 1991
|
||||||
|
|
||||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/>
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
Preamble
|
Preamble
|
||||||
|
|
||||||
The licenses for most software are designed to take away your
|
The licenses for most software are designed to take away your
|
||||||
freedom to share and change it. By contrast, the GNU General Public
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
@ -56,7 +56,7 @@ patent must be licensed for everyone's free use or not licensed at all.
|
||||||
The precise terms and conditions for copying, distribution and
|
The precise terms and conditions for copying, distribution and
|
||||||
modification follow.
|
modification follow.
|
||||||
|
|
||||||
GNU GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
0. This License applies to any program or other work which contains
|
0. This License applies to any program or other work which contains
|
||||||
|
@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals
|
||||||
of preserving the free status of all derivatives of our free software and
|
of preserving the free status of all derivatives of our free software and
|
||||||
of promoting the sharing and reuse of software generally.
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
NO WARRANTY
|
NO WARRANTY
|
||||||
|
|
||||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
POSSIBILITY OF SUCH DAMAGES.
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
If you develop a new program, and you want it to be of the greatest
|
||||||
possible use to the public, the best way to achieve this is to make it
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
@ -290,8 +290,8 @@ to attach them to the start of each source file to most effectively
|
||||||
convey the exclusion of warranty; and each file should have at least
|
convey the exclusion of warranty; and each file should have at least
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
{description}
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
Copyright (C) {year} {fullname}
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -329,7 +329,7 @@ necessary. Here is a sample; alter the names:
|
||||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
{signature of Ty Coon}, 1 April 1989
|
<signature of Ty Coon>, 1 April 1989
|
||||||
Ty Coon, President of Vice
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
This General Public License does not permit incorporating your program into
|
This General Public License does not permit incorporating your program into
|
||||||
|
@ -337,4 +337,3 @@ proprietary programs. If your program is a subroutine library, you may
|
||||||
consider it more useful to permit linking proprietary applications with the
|
consider it more useful to permit linking proprietary applications with the
|
||||||
library. If this is what you want to do, use the GNU Lesser General
|
library. If this is what you want to do, use the GNU Lesser General
|
||||||
Public License instead of this License.
|
Public License instead of this License.
|
||||||
|
|
||||||
|
|
45
README.md
45
README.md
|
@ -1,7 +1,44 @@
|
||||||
# shortArchives
|
# README
|
||||||
|
|
||||||
Widget d'affichage des archives pour le blog des news de Dotclear. Le principe de l'accordéon originel revisité pour un affichage des mois à côté de la date "ouverte".
|
[![Release](https://img.shields.io/github/v/release/JcDenis/shortArchives)](https://github.com/JcDenis/shortArchives/releases)
|
||||||
|
[![Date](https://img.shields.io/github/release-date/JcDenis/shortArchives)](https://github.com/JcDenis/shortArchives/releases)
|
||||||
|
[![Issues](https://img.shields.io/github/issues/JcDenis/shortArchives)](https://github.com/JcDenis/shortArchives/issues)
|
||||||
|
[![Dotclear](https://img.shields.io/badge/dotclear-v2.24-blue.svg)](https://fr.dotclear.org/download)
|
||||||
|
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/shortArchives)
|
||||||
|
[![License](https://img.shields.io/github/license/JcDenis/shortArchives)](https://github.com/JcDenis/shortArchives/blob/master/LICENSE)
|
||||||
|
|
||||||
Todo:
|
## WHAT IS SHORTARCHIVES ?
|
||||||
|
|
||||||
* Ajouter les attributs ARIA kivonbien.
|
_shortArchives_ is a plugin for the open-source
|
||||||
|
web publishing software called Dotclear.
|
||||||
|
|
||||||
|
Add a public widget that list links to archives by year.
|
||||||
|
|
||||||
|
## REQUIREMENTS
|
||||||
|
|
||||||
|
_shortArchives_ requires:
|
||||||
|
|
||||||
|
* content admin permissions to manage widgets
|
||||||
|
* Dotclear 2.24
|
||||||
|
|
||||||
|
## USAGE
|
||||||
|
|
||||||
|
First install _shortArchives_, manualy from a zip package or from
|
||||||
|
Dotaddict repository. (See Dotclear's documentation to know how do this)
|
||||||
|
|
||||||
|
You should add widget to show lunar phases on your blog.
|
||||||
|
|
||||||
|
## LINKS
|
||||||
|
|
||||||
|
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
|
||||||
|
* Source & contribution : [GitHub Page](https://github.com/JcDenis/shortArchives)
|
||||||
|
* Packages & details : [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/shortArchives)
|
||||||
|
* Discuss and help : [Dotclear Forum](http://forum.dotclear.org/viewtopic.php?pid=321044#p321044)
|
||||||
|
|
||||||
|
## CONTRIBUTORS
|
||||||
|
|
||||||
|
* annso (author)
|
||||||
|
* Pierre Van Glabeke
|
||||||
|
* Jean-Christian Denis
|
||||||
|
|
||||||
|
You are welcome to contribute to this code.
|
28
_admin.php
28
_admin.php
|
@ -1,15 +1,17 @@
|
||||||
<?php
|
<?php
|
||||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
/**
|
||||||
# This file is part of shortArchives, a plugin for Dotclear.
|
* @brief shortArchives, a plugin for Dotclear 2
|
||||||
#
|
*
|
||||||
# Copyright (c) 2009-2015 - annso and contributors
|
* @package Dotclear
|
||||||
# contact@as-i-am.fr
|
* @subpackage Plugin
|
||||||
#
|
*
|
||||||
# Licensed under the GPL version 2.0 license.
|
* @author annso, Pierre Van Glabeke and Contributors
|
||||||
# A copy of this license is available in LICENSE file or at
|
*
|
||||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
* @copyright Jean-Crhistian Denis
|
||||||
# -- END LICENSE BLOCK ------------------------------------
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {return;}
|
require __DIR__ . '/_widgets.php';
|
||||||
|
|
||||||
require dirname(__FILE__).'/_widgets.php';
|
|
||||||
|
|
54
_define.php
54
_define.php
|
@ -1,28 +1,32 @@
|
||||||
<?php
|
<?php
|
||||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
/**
|
||||||
# This file is part of shortArchives, a plugin for Dotclear.
|
* @brief shortArchives, a plugin for Dotclear 2
|
||||||
#
|
*
|
||||||
# Copyright (c) 2009-2015 - annso and contributors
|
* @package Dotclear
|
||||||
# contact@as-i-am.fr
|
* @subpackage Plugin
|
||||||
#
|
*
|
||||||
# Licensed under the GPL version 2.0 license.
|
* @author annso, Pierre Van Glabeke and Contributors
|
||||||
# A copy of this license is available in LICENSE file or at
|
*
|
||||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
* @copyright Jean-Crhistian Denis
|
||||||
# -- END LICENSE BLOCK ------------------------------------
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
if (!defined('DC_RC_PATH')) {return;}
|
if (!defined('DC_RC_PATH')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$this->registerModule(
|
$this->registerModule(
|
||||||
/* Name */ "shortArchives",
|
'shortArchives',
|
||||||
/* Description*/ "Display blog archives in an accordion menu, sorted by year",
|
'Display blog archives in an accordion menu, sorted by year',
|
||||||
/* Author */ "annso, Pierre Van Glabeke",
|
'annso, Pierre Van Glabeke and Contributors',
|
||||||
/* Version */ "1.8.1",
|
'1.9',
|
||||||
/* Properties */
|
[
|
||||||
array(
|
'requires' => [['core', '2.24']],
|
||||||
'permissions' => 'usage,contentadmin',
|
'permissions' => dcCore::app()->auth->makePermissions([
|
||||||
'type' => 'plugin',
|
dcAuth::PERMISSION_ADMIN,
|
||||||
'dc_min' => '2.7',
|
]),
|
||||||
'support' => 'http://forum.dotclear.org/viewtopic.php?pid=321044#p321044',
|
'type' => 'plugin',
|
||||||
'details' => 'http://plugins.dotaddict.org/dc2/details/shortArchives'
|
'support' => 'http://forum.dotclear.org/viewtopic.php?pid=321044#p321044',
|
||||||
)
|
'details' => 'http://plugins.dotaddict.org/dc2/details/' . basename(__DIR__),
|
||||||
);
|
'repository' => 'https://raw.githubusercontent.com/JcDenis/' . basename(__DIR__) . '/master/dcstore.xml',
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
108
_public.php
108
_public.php
|
@ -1,93 +1,23 @@
|
||||||
<?php
|
<?php
|
||||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
/**
|
||||||
# This file is part of shortArchives, a plugin for Dotclear.
|
* @brief shortArchives, a plugin for Dotclear 2
|
||||||
#
|
*
|
||||||
# Copyright (c) 2009-2015 - annso and contributors
|
* @package Dotclear
|
||||||
# contact@as-i-am.fr
|
* @subpackage Plugin
|
||||||
#
|
*
|
||||||
# Licensed under the GPL version 2.0 license.
|
* @author annso, Pierre Van Glabeke and Contributors
|
||||||
# A copy of this license is available in LICENSE file or at
|
*
|
||||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
* @copyright Jean-Crhistian Denis
|
||||||
# -- END LICENSE BLOCK ------------------------------------
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
if (!defined('DC_RC_PATH')) {return;}
|
if (!defined('DC_RC_PATH')) {
|
||||||
|
return null;
|
||||||
require dirname(__FILE__).'/_widgets.php';
|
|
||||||
|
|
||||||
$core->addBehavior('publicHeadContent',array('publicShortArchives','publicHeadContent'));
|
|
||||||
|
|
||||||
class publicShortArchives
|
|
||||||
{
|
|
||||||
public static function publicHeadContent($core)
|
|
||||||
{
|
|
||||||
$url = $core->blog->getQmarkURL().'pf='.basename(dirname(__FILE__));
|
|
||||||
echo '<script type="text/javascript" src="'.$url.'/js/accordion.js"></script>'."\n";
|
|
||||||
echo '<link rel="stylesheet" type="text/css" media="screen" href="'.$url."/css/shortArchives.css\" />\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class tplShortArchives
|
require __DIR__ . '/_widgets.php';
|
||||||
{
|
|
||||||
public static function shortArchivesWidgets($w)
|
|
||||||
{
|
|
||||||
global $core;
|
|
||||||
|
|
||||||
if ($w->offline)
|
dcCore::app()->addBehavior('publicHeadContent', function () {
|
||||||
return;
|
echo
|
||||||
|
dcUtils::jsModuleLoad(basename(__DIR__) . '/js/accordion.js') .
|
||||||
if (($w->homeonly == 1 && $core->url->type != 'default') ||
|
dcUtils::cssModuleLoad(basename(__DIR__) . '/css/shortArchives.css');
|
||||||
($w->homeonly == 2 && $core->url->type == 'default')) {
|
});
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$params = array();
|
|
||||||
$params['type'] = 'month';
|
|
||||||
$rs = $core->blog->getDates($params);
|
|
||||||
unset($params);
|
|
||||||
if ($rs->isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$active_year = null;
|
|
||||||
if (($core->url->type == 'archive') && preg_match('`^/([0-9]{4})/([0-9]{2})$`',$core->url->args,$matches)) {
|
|
||||||
$active_year = $matches[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
$posts = array();
|
|
||||||
while ($rs->fetch()) {
|
|
||||||
$posts[dt::dt2str(__('%Y'),$rs->dt)][] = array('url' => $rs->url($core),
|
|
||||||
'date' => html::escapeHTML(dt::dt2str(__('%B'),$rs->dt)),
|
|
||||||
'nbpost' => $rs->nb_post);
|
|
||||||
}
|
|
||||||
|
|
||||||
$res =
|
|
||||||
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '').
|
|
||||||
'<ul class="arch-years">';
|
|
||||||
|
|
||||||
foreach($posts as $annee => $post) {
|
|
||||||
if (!is_null($active_year) && $active_year == $annee) {
|
|
||||||
$res .= '<li class="open">';
|
|
||||||
} else {
|
|
||||||
$res .= '<li>';
|
|
||||||
}
|
|
||||||
$res .= '<span>'.$annee.'</span><ul class="arch-months">';
|
|
||||||
for($i=0; $i<sizeof($post); $i++) {
|
|
||||||
$res .=
|
|
||||||
'<li><a href="'.$post[$i]['url'].'">'.$post[$i]['date'].'</a>'.
|
|
||||||
($w->postcount ? ' ('.$post[$i]['nbpost'].')' : '').
|
|
||||||
'</li>';
|
|
||||||
}
|
|
||||||
$res .= '</ul></li>';
|
|
||||||
}
|
|
||||||
$res .= '</ul>';
|
|
||||||
|
|
||||||
if ($core->url->getBase('archive') && !is_null($w->allarchivesslinktitle) && $w->allarchivesslinktitle !== '')
|
|
||||||
{
|
|
||||||
$res .=
|
|
||||||
'<p><strong><a href="'.$core->blog->url.$core->url->getURLFor("archive").'">'.
|
|
||||||
html::escapeHTML($w->allarchivesslinktitle).'</a></strong></p>';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $w->renderDiv($w->content_only,'shortArchives '.$w->class,'',$res);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
125
_widgets.php
125
_widgets.php
|
@ -1,37 +1,98 @@
|
||||||
<?php
|
<?php
|
||||||
# -- BEGIN LICENSE BLOCK ----------------------------------
|
/**
|
||||||
# This file is part of shortArchives, a plugin for Dotclear.
|
* @brief shortArchives, a plugin for Dotclear 2
|
||||||
#
|
*
|
||||||
# Copyright (c) 2009-2015 - annso and contributors
|
* @package Dotclear
|
||||||
# contact@as-i-am.fr
|
* @subpackage Plugin
|
||||||
#
|
*
|
||||||
# Licensed under the GPL version 2.0 license.
|
* @author annso, Pierre Van Glabeke and Contributors
|
||||||
# A copy of this license is available in LICENSE file or at
|
*
|
||||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
* @copyright Jean-Crhistian Denis
|
||||||
# -- END LICENSE BLOCK ------------------------------------
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
if (!defined('DC_RC_PATH')) { return; }
|
*/
|
||||||
|
if (!defined('DC_RC_PATH')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$core->addBehavior('initWidgets',array('shortArchivesWidgets','initWidgets'));
|
dcCore::app()->addBehavior('initWidgets', ['shortArchivesWidgets','initWidgets']);
|
||||||
|
|
||||||
class shortArchivesWidgets
|
class shortArchivesWidgets
|
||||||
{
|
{
|
||||||
public static function initWidgets($w)
|
public static function initWidgets($w)
|
||||||
{
|
{
|
||||||
$w->create('shortArchives',__('Short Archives'), array('tplShortArchives','shortArchivesWidgets'),
|
$w->create(
|
||||||
null,
|
'shortArchives',
|
||||||
__('Blog Archive List an accordion menu, sorted by year'));
|
__('Short Archives'),
|
||||||
$w->shortArchives->setting('title',__('Title:'),__('Archives'));
|
['shortArchivesWidgets', 'shortArchivesWidgets'],
|
||||||
$w->shortArchives->setting('postcount',__('With entries counts'),1,'check');
|
null,
|
||||||
$w->shortArchives->setting('allarchivesslinktitle',__('Link to all archives:'),__('All archives'));
|
__('Blog Archive List an accordion menu, sorted by year')
|
||||||
$w->shortArchives->setting('homeonly',__('Display on:'),0,'combo',
|
)
|
||||||
array(
|
->addTitle(__('Archives'))
|
||||||
__('All pages') => 0,
|
->setting('postcount', __('With entries counts'), 1, 'check')
|
||||||
__('Home page only') => 1,
|
->setting('allarchivesslinktitle', __('Link to all archives:'), __('All archives'))
|
||||||
__('Except on home page') => 2
|
->addHomeOnly()
|
||||||
)
|
->addContentOnly()
|
||||||
);
|
->addClass()
|
||||||
$w->shortArchives->setting('content_only',__('Content only'),0,'check');
|
->addOffline();
|
||||||
$w->shortArchives->setting('class',__('CSS class:'),'');
|
}
|
||||||
$w->shortArchives->setting('offline',__('Offline'),0,'check');
|
|
||||||
}
|
public static function shortArchivesWidgets($w)
|
||||||
}
|
{
|
||||||
|
if ($w->offline) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$w->checkHomeOnly(dcCore::app()->url->type)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rs = dcCore::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})$`', dcCore::app()->url->args, $matches)) {
|
||||||
|
$active_year = $matches[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
$posts = [];
|
||||||
|
while ($rs->fetch()) {
|
||||||
|
$posts[dt::dt2str(__('%Y'), $rs->dt)][] = [
|
||||||
|
'url' => $rs->url(),
|
||||||
|
'date' => html::escapeHTML(dt::dt2str(__('%B'), $rs->dt)),
|
||||||
|
'nbpost' => $rs->nb_post,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$res = '<ul class="arch-years">';
|
||||||
|
|
||||||
|
foreach ($posts as $annee => $post) {
|
||||||
|
if (!is_null($active_year) && $active_year == $annee) {
|
||||||
|
$res .= '<li class="open">';
|
||||||
|
} else {
|
||||||
|
$res .= '<li>';
|
||||||
|
}
|
||||||
|
$res .= '<span>' . $annee . '</span><ul class="arch-months">';
|
||||||
|
for ($i = 0; $i < sizeof($post); $i++) {
|
||||||
|
$res .= '<li><a href="' . $post[$i]['url'] . '">' . $post[$i]['date'] . '</a>' .
|
||||||
|
($w->postcount ? ' (' . $post[$i]['nbpost'] . ')' : '') .
|
||||||
|
'</li>';
|
||||||
|
}
|
||||||
|
$res .= '</ul></li>';
|
||||||
|
}
|
||||||
|
$res .= '</ul>';
|
||||||
|
|
||||||
|
if (dcCore::app()->url->getBase('archive') && !is_null($w->allarchivesslinktitle) && $w->allarchivesslinktitle !== '') {
|
||||||
|
$res .= '<p><strong><a href="' . dcCore::app()->blog->url . dcCore::app()->url->getURLFor('archive') . '">' .
|
||||||
|
html::escapeHTML($w->allarchivesslinktitle) . '</a></strong></p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $w->renderDiv(
|
||||||
|
$w->content_only,
|
||||||
|
'shortArchives ' . $w->class,
|
||||||
|
'',
|
||||||
|
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') . $res
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
13
dcstore.xml
Normal file
13
dcstore.xml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
|
<module id="shortArchives">
|
||||||
|
<name>shortArchives</name>
|
||||||
|
<version>1.9</version>
|
||||||
|
<author>annso, Pierre Van Glabeke and Contributors</author>
|
||||||
|
<desc>Display blog archives in an accordion menu, sorted by year</desc>
|
||||||
|
<file>https://github.com/JcDenis/shortArchives/releases/download/v1.9/plugin-shortArchives.zip</file>
|
||||||
|
<da:dcmin>2.24</da:dcmin>
|
||||||
|
<da:details>http://plugins.dotaddict.org/dc2/details/shortArchives</da:details>
|
||||||
|
<da:support>http://forum.dotclear.org/viewtopic.php?pid=321044#p321044</da:support>
|
||||||
|
</module>
|
||||||
|
</modules>
|
|
@ -1,16 +1,14 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Project-Id-Version: \n"
|
"Project-Id-Version: shortArchives 1.9\n"
|
||||||
"POT-Creation-Date: \n"
|
"POT-Creation-Date: \n"
|
||||||
"PO-Revision-Date: \n"
|
"PO-Revision-Date: 2022-12-16T22:00:09+00:00\n"
|
||||||
"Last-Translator: brol <contact@brol.info>\n"
|
"Last-Translator: Jean-Crhistian Denis\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||||
msgid "Display blog archives in an accordion menu, sorted by year"
|
|
||||||
msgstr "Afficher les archives du blog dans un menu accordéon, trié par années"
|
|
||||||
|
|
||||||
msgid "Blog Archive List an accordion menu, sorted by year"
|
msgid "Blog Archive List an accordion menu, sorted by year"
|
||||||
msgstr "Liste des archives du blog dans un menu accordéon, trié par années"
|
msgstr "Liste des archives du blog dans un menu accordéon, trié par années"
|
||||||
|
@ -21,3 +19,6 @@ msgstr "Lien vers toutes les archives :"
|
||||||
msgid "All archives"
|
msgid "All archives"
|
||||||
msgstr "Toutes les archives"
|
msgstr "Toutes les archives"
|
||||||
|
|
||||||
|
msgid "Display blog archives in an accordion menu, sorted by year"
|
||||||
|
msgstr "Afficher les archives du blog dans un menu accordéon, trié par années"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue