Compare commits
No commits in common. "fa8cb9c2915e20e06db9403a87ff27be7817b762" and "22e13c903ce7a3b2b854323ae6c5458148eadd82" have entirely different histories.
fa8cb9c291
...
22e13c903c
13
CHANGELOG.md
13
CHANGELOG.md
|
@ -1,16 +1,3 @@
|
|||
2.2 - 2023.05.13
|
||||
* require Dotclear 2.26
|
||||
* release for Dotclear 2.26 stable
|
||||
|
||||
2.1 - 2023.04.24
|
||||
* require Dotclear 2.26
|
||||
* fix nullsafe warnings
|
||||
* remove magic
|
||||
|
||||
2.0 - 2023.04.11
|
||||
* require Dotclear 2.26
|
||||
* use namespace
|
||||
|
||||
1.6 - 2022.12.16
|
||||
* update to dotclear 2.24
|
||||
* fix phpstan errors
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
[![Release](https://img.shields.io/github/v/release/JcDenis/bloganniv)](https://github.com/JcDenis/bloganniv/releases)
|
||||
[![Date](https://img.shields.io/github/release-date/JcDenis/bloganniv)](https://github.com/JcDenis/bloganniv/releases)
|
||||
[![Issues](https://img.shields.io/github/issues/JcDenis/bloganniv)](https://github.com/JcDenis/bloganniv/issues)
|
||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.26-blue.svg)](https://fr.dotclear.org/download)
|
||||
[![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/bloganniv)
|
||||
[![License](https://img.shields.io/github/license/JcDenis/bloganniv)](https://github.com/JcDenis/bloganniv/blob/master/LICENSE)
|
||||
|
||||
|
@ -22,7 +22,7 @@ It adds widget showing:
|
|||
_bloganniv_ requires:
|
||||
|
||||
* permissions to manage widgets
|
||||
* Dotclear 2.26
|
||||
* Dotclear 2.24
|
||||
|
||||
## USAGE
|
||||
|
||||
|
|
10
_define.php
10
_define.php
|
@ -7,10 +7,10 @@
|
|||
*
|
||||
* @author Fran6t, Pierre Van Glabeke and Contributors
|
||||
*
|
||||
* @copyright Jean-Christian Denis
|
||||
* @copyright Jean-Crhistian Denis
|
||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||
*/
|
||||
if (!defined('DC_RC_PATH') || is_null(dcCore::app()->auth)) {
|
||||
if (!defined('DC_RC_PATH')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -18,11 +18,11 @@ $this->registerModule(
|
|||
'Blog Anniv',
|
||||
'Counting the number of days before and after a particular date',
|
||||
'Fran6t, Pierre Van Glabeke and Contributors',
|
||||
'2.2',
|
||||
'1.6',
|
||||
[
|
||||
'requires' => [['core', '2.26']],
|
||||
'requires' => [['core', '2.24']],
|
||||
'permissions' => dcCore::app()->auth->makePermissions([
|
||||
dcCore::app()->auth::PERMISSION_ADMIN,
|
||||
dcAuth::PERMISSION_ADMIN,
|
||||
]),
|
||||
'type' => 'plugin',
|
||||
'support' => 'https://github.com/JcDenis/' . basename(__DIR__),
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
<modules xmlns:da="http://dotaddict.org/da/">
|
||||
<module id="bloganniv">
|
||||
<name>Blog Anniv</name>
|
||||
<version>2.2</version>
|
||||
<version>1.6</version>
|
||||
<author>Fran6t, Pierre Van Glabeke and Contributors</author>
|
||||
<desc>Counting the number of days before and after a particular date</desc>
|
||||
<file>https://github.com/JcDenis/bloganniv/releases/download/v2.2/plugin-bloganniv.zip</file>
|
||||
<da:dcmin>2.26</da:dcmin>
|
||||
<file>https://github.com/JcDenis/bloganniv/releases/download/v1.6/plugin-bloganniv.zip</file>
|
||||
<da:dcmin>2.24</da:dcmin>
|
||||
<da:details>https://plugins.dotaddict.org/dc2/details/bloganniv</da:details>
|
||||
<da:support>https://github.com/JcDenis/bloganniv</da:support>
|
||||
</module>
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @package Dotclear
|
||||
*
|
||||
* @copyright Olivier Meunier & Association Dotclear
|
||||
* @copyright GPL-2.0-only
|
||||
*/
|
||||
#
|
||||
# DOT NOT MODIFY THIS FILE !
|
||||
#
|
||||
|
||||
use Dotclear\Helper\L10n;
|
||||
|
||||
L10n::$locales['Counting the number of days before and after a particular date'] = 'Décompte du nombre de jours avant et après une date donnée';
|
||||
L10n::$locales['Born Date (dd/mm/yyyy) or blank:'] = 'Date de naissance (jj/mm/aaaa) ou vide :';
|
||||
L10n::$locales['Display Born Date'] = 'Affichage date de naissance';
|
||||
L10n::$locales['Display Year(s) Old'] = 'Affichage âge en année(s)';
|
||||
L10n::$locales['Born:'] = 'Né le :';
|
||||
L10n::$locales['Age:'] = 'Âge :';
|
||||
L10n::$locales['year(s)'] = 'an(s)';
|
||||
L10n::$locales['Birthday in'] = 'Anniversaire dans';
|
||||
L10n::$locales['day(s)'] = 'jour(s)';
|
|
@ -21,7 +21,7 @@ class Backend extends dcNsProcess
|
|||
{
|
||||
public static function init(): bool
|
||||
{
|
||||
static::$init = defined('DC_CONTEXT_ADMIN');
|
||||
static::$init = defined('DC_CONTEXT_ADMIN') && My::phpCompliant();
|
||||
|
||||
return static::$init;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ class Frontend extends dcNsProcess
|
|||
{
|
||||
public static function init(): bool
|
||||
{
|
||||
static::$init = defined('DC_RC_PATH');
|
||||
static::$init = My::phpCompliant();
|
||||
|
||||
return static::$init;
|
||||
}
|
||||
|
|
19
src/My.php
19
src/My.php
|
@ -17,12 +17,15 @@ namespace Dotclear\Plugin\bloganniv;
|
|||
use dcCore;
|
||||
|
||||
/**
|
||||
* This module definitions.
|
||||
* Plugin definitions
|
||||
*/
|
||||
class My
|
||||
{
|
||||
/** @var string Required php version */
|
||||
public const PHP_MIN = '7.4';
|
||||
|
||||
/**
|
||||
* This module id.
|
||||
* This module id
|
||||
*/
|
||||
public static function id(): string
|
||||
{
|
||||
|
@ -30,20 +33,18 @@ class My
|
|||
}
|
||||
|
||||
/**
|
||||
* This module name.
|
||||
* This module name
|
||||
*/
|
||||
public static function name(): string
|
||||
{
|
||||
$name = dcCore::app()->plugins->moduleInfo(self::id(), 'name');
|
||||
|
||||
return __(is_string($name) ? $name : self::id());
|
||||
return __((string) dcCore::app()->plugins->moduleInfo(self::id(), 'name'));
|
||||
}
|
||||
|
||||
/**
|
||||
* This module path.
|
||||
* Check php version
|
||||
*/
|
||||
public static function path(): string
|
||||
public static function phpCompliant(): bool
|
||||
{
|
||||
return dirname(__DIR__);
|
||||
return version_compare(phpversion(), self::PHP_MIN, '>=');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ class Widgets
|
|||
null,
|
||||
__('Counting the number of days before and after a particular date')
|
||||
)
|
||||
->addTitle(My::name())
|
||||
->addTitle('')
|
||||
->setting('ftdatecrea', __('Born Date (dd/mm/yyyy) or blank:'), '')
|
||||
->setting('dispyearborn', __('Display Born Date'), 1, 'check')
|
||||
->setting('dispyear', __('Display Year(s) Old'), 1, 'check')
|
||||
|
@ -42,16 +42,11 @@ class Widgets
|
|||
|
||||
public static function parseWidget(WidgetsElement $w): string
|
||||
{
|
||||
if ($w->__get('offline') || !$w->checkHomeOnly(dcCore::app()->url->type)) {
|
||||
if ($w->offline || !$w->checkHomeOnly(dcCore::app()->url->type)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// nullsafe PHP < 8.0
|
||||
if (is_null(dcCore::app()->blog)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$ftdatecrea = $w->__get('ftdatecrea');
|
||||
$ftdatecrea = $w->ftdatecrea;
|
||||
//Si la date est vide nous recherchons la date en base
|
||||
if (strlen(rtrim($ftdatecrea)) == 0) {
|
||||
$jour = date('d', dcCore::app()->blog->creadt);
|
||||
|
@ -97,13 +92,13 @@ class Widgets
|
|||
}
|
||||
|
||||
return $w->renderDiv(
|
||||
(bool) $w->__get('content_only'),
|
||||
My::id() . ' ' . $w->__get('class'),
|
||||
(bool) $w->content_only,
|
||||
My::id() . ' ' . $w->class,
|
||||
'',
|
||||
($w->__get('title') ? $w->renderTitle(Html::escapeHTML($w->__get('title'))) : '') .
|
||||
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') .
|
||||
'<ul>' .
|
||||
($w->__get('dispyearborn') ? '<li>' . __('Born:') . ' <span class="annivne">' . $ftdatecrea . '</span></li>' : '') .
|
||||
($w->__get('dispyear') ? '<li>' . __('Age:') . ' <span class="annivan">' . $nbreannee . '</span> ' . __('year(s)') . '</li>' : '') .
|
||||
($w->dispyearborn ? '<li>' . __('Born:') . ' <span class="annivne">' . $ftdatecrea . '</span></li>' : '') .
|
||||
($w->dispyear ? '<li>' . __('Age:') . ' <span class="annivan">' . $nbreannee . '</span> ' . __('year(s)') . '</li>' : '') .
|
||||
'<li>' . __('Birthday in') . ' <span class="annivjrs">' . $nbrejours . '</span> ' . __('day(s)') . '</li>' .
|
||||
'</ul>'
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue