Compare commits
10 Commits
22e13c903c
...
fa8cb9c291
Author | SHA1 | Date |
---|---|---|
Jean-Christian Paul Denis | fa8cb9c291 | |
Jean-Christian Paul Denis | a23361d857 | |
Jean-Christian Paul Denis | fd197a0991 | |
Jean-Christian Paul Denis | 7a3ef270df | |
Jean-Christian Paul Denis | ba6d56332e | |
Jean-Christian Paul Denis | 67413ff5d3 | |
Jean-Christian Paul Denis | d34bbc3878 | |
Jean-Christian Paul Denis | 3dd0260053 | |
Jean-Christian Paul Denis | 6acb50ed54 | |
Jean-Christian Paul Denis | 3c0f633748 |
13
CHANGELOG.md
13
CHANGELOG.md
|
@ -1,3 +1,16 @@
|
||||||
|
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
|
1.6 - 2022.12.16
|
||||||
* update to dotclear 2.24
|
* update to dotclear 2.24
|
||||||
* fix phpstan errors
|
* fix phpstan errors
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
[![Release](https://img.shields.io/github/v/release/JcDenis/bloganniv)](https://github.com/JcDenis/bloganniv/releases)
|
[![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)
|
[![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)
|
[![Issues](https://img.shields.io/github/issues/JcDenis/bloganniv)](https://github.com/JcDenis/bloganniv/issues)
|
||||||
[![Dotclear](https://img.shields.io/badge/dotclear-v2.24-blue.svg)](https://fr.dotclear.org/download)
|
[![Dotclear](https://img.shields.io/badge/dotclear-v2.26-blue.svg)](https://fr.dotclear.org/download)
|
||||||
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-green.svg)](https://plugins.dotaddict.org/dc2/details/bloganniv)
|
[![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)
|
[![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:
|
_bloganniv_ requires:
|
||||||
|
|
||||||
* permissions to manage widgets
|
* permissions to manage widgets
|
||||||
* Dotclear 2.24
|
* Dotclear 2.26
|
||||||
|
|
||||||
## USAGE
|
## USAGE
|
||||||
|
|
||||||
|
|
10
_define.php
10
_define.php
|
@ -7,10 +7,10 @@
|
||||||
*
|
*
|
||||||
* @author Fran6t, Pierre Van Glabeke and Contributors
|
* @author Fran6t, Pierre Van Glabeke and Contributors
|
||||||
*
|
*
|
||||||
* @copyright Jean-Crhistian Denis
|
* @copyright Jean-Christian Denis
|
||||||
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*/
|
*/
|
||||||
if (!defined('DC_RC_PATH')) {
|
if (!defined('DC_RC_PATH') || is_null(dcCore::app()->auth)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,11 +18,11 @@ $this->registerModule(
|
||||||
'Blog Anniv',
|
'Blog Anniv',
|
||||||
'Counting the number of days before and after a particular date',
|
'Counting the number of days before and after a particular date',
|
||||||
'Fran6t, Pierre Van Glabeke and Contributors',
|
'Fran6t, Pierre Van Glabeke and Contributors',
|
||||||
'1.6',
|
'2.2',
|
||||||
[
|
[
|
||||||
'requires' => [['core', '2.24']],
|
'requires' => [['core', '2.26']],
|
||||||
'permissions' => dcCore::app()->auth->makePermissions([
|
'permissions' => dcCore::app()->auth->makePermissions([
|
||||||
dcAuth::PERMISSION_ADMIN,
|
dcCore::app()->auth::PERMISSION_ADMIN,
|
||||||
]),
|
]),
|
||||||
'type' => 'plugin',
|
'type' => 'plugin',
|
||||||
'support' => 'https://github.com/JcDenis/' . basename(__DIR__),
|
'support' => 'https://github.com/JcDenis/' . basename(__DIR__),
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
<modules xmlns:da="http://dotaddict.org/da/">
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
<module id="bloganniv">
|
<module id="bloganniv">
|
||||||
<name>Blog Anniv</name>
|
<name>Blog Anniv</name>
|
||||||
<version>1.6</version>
|
<version>2.2</version>
|
||||||
<author>Fran6t, Pierre Van Glabeke and Contributors</author>
|
<author>Fran6t, Pierre Van Glabeke and Contributors</author>
|
||||||
<desc>Counting the number of days before and after a particular date</desc>
|
<desc>Counting the number of days before and after a particular date</desc>
|
||||||
<file>https://github.com/JcDenis/bloganniv/releases/download/v1.6/plugin-bloganniv.zip</file>
|
<file>https://github.com/JcDenis/bloganniv/releases/download/v2.2/plugin-bloganniv.zip</file>
|
||||||
<da:dcmin>2.24</da:dcmin>
|
<da:dcmin>2.26</da:dcmin>
|
||||||
<da:details>https://plugins.dotaddict.org/dc2/details/bloganniv</da:details>
|
<da:details>https://plugins.dotaddict.org/dc2/details/bloganniv</da:details>
|
||||||
<da:support>https://github.com/JcDenis/bloganniv</da:support>
|
<da:support>https://github.com/JcDenis/bloganniv</da:support>
|
||||||
</module>
|
</module>
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?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
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
static::$init = defined('DC_CONTEXT_ADMIN') && My::phpCompliant();
|
static::$init = defined('DC_CONTEXT_ADMIN');
|
||||||
|
|
||||||
return static::$init;
|
return static::$init;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ class Frontend extends dcNsProcess
|
||||||
{
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
static::$init = My::phpCompliant();
|
static::$init = defined('DC_RC_PATH');
|
||||||
|
|
||||||
return static::$init;
|
return static::$init;
|
||||||
}
|
}
|
||||||
|
|
19
src/My.php
19
src/My.php
|
@ -17,15 +17,12 @@ namespace Dotclear\Plugin\bloganniv;
|
||||||
use dcCore;
|
use dcCore;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plugin definitions
|
* This module definitions.
|
||||||
*/
|
*/
|
||||||
class My
|
class My
|
||||||
{
|
{
|
||||||
/** @var string Required php version */
|
|
||||||
public const PHP_MIN = '7.4';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This module id
|
* This module id.
|
||||||
*/
|
*/
|
||||||
public static function id(): string
|
public static function id(): string
|
||||||
{
|
{
|
||||||
|
@ -33,18 +30,20 @@ class My
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This module name
|
* This module name.
|
||||||
*/
|
*/
|
||||||
public static function name(): string
|
public static function name(): string
|
||||||
{
|
{
|
||||||
return __((string) dcCore::app()->plugins->moduleInfo(self::id(), 'name'));
|
$name = dcCore::app()->plugins->moduleInfo(self::id(), 'name');
|
||||||
|
|
||||||
|
return __(is_string($name) ? $name : self::id());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check php version
|
* This module path.
|
||||||
*/
|
*/
|
||||||
public static function phpCompliant(): bool
|
public static function path(): string
|
||||||
{
|
{
|
||||||
return version_compare(phpversion(), self::PHP_MIN, '>=');
|
return dirname(__DIR__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ class Widgets
|
||||||
null,
|
null,
|
||||||
__('Counting the number of days before and after a particular date')
|
__('Counting the number of days before and after a particular date')
|
||||||
)
|
)
|
||||||
->addTitle('')
|
->addTitle(My::name())
|
||||||
->setting('ftdatecrea', __('Born Date (dd/mm/yyyy) or blank:'), '')
|
->setting('ftdatecrea', __('Born Date (dd/mm/yyyy) or blank:'), '')
|
||||||
->setting('dispyearborn', __('Display Born Date'), 1, 'check')
|
->setting('dispyearborn', __('Display Born Date'), 1, 'check')
|
||||||
->setting('dispyear', __('Display Year(s) Old'), 1, 'check')
|
->setting('dispyear', __('Display Year(s) Old'), 1, 'check')
|
||||||
|
@ -42,11 +42,16 @@ class Widgets
|
||||||
|
|
||||||
public static function parseWidget(WidgetsElement $w): string
|
public static function parseWidget(WidgetsElement $w): string
|
||||||
{
|
{
|
||||||
if ($w->offline || !$w->checkHomeOnly(dcCore::app()->url->type)) {
|
if ($w->__get('offline') || !$w->checkHomeOnly(dcCore::app()->url->type)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$ftdatecrea = $w->ftdatecrea;
|
// nullsafe PHP < 8.0
|
||||||
|
if (is_null(dcCore::app()->blog)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$ftdatecrea = $w->__get('ftdatecrea');
|
||||||
//Si la date est vide nous recherchons la date en base
|
//Si la date est vide nous recherchons la date en base
|
||||||
if (strlen(rtrim($ftdatecrea)) == 0) {
|
if (strlen(rtrim($ftdatecrea)) == 0) {
|
||||||
$jour = date('d', dcCore::app()->blog->creadt);
|
$jour = date('d', dcCore::app()->blog->creadt);
|
||||||
|
@ -92,13 +97,13 @@ class Widgets
|
||||||
}
|
}
|
||||||
|
|
||||||
return $w->renderDiv(
|
return $w->renderDiv(
|
||||||
(bool) $w->content_only,
|
(bool) $w->__get('content_only'),
|
||||||
My::id() . ' ' . $w->class,
|
My::id() . ' ' . $w->__get('class'),
|
||||||
'',
|
'',
|
||||||
($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') .
|
($w->__get('title') ? $w->renderTitle(Html::escapeHTML($w->__get('title'))) : '') .
|
||||||
'<ul>' .
|
'<ul>' .
|
||||||
($w->dispyearborn ? '<li>' . __('Born:') . ' <span class="annivne">' . $ftdatecrea . '</span></li>' : '') .
|
($w->__get('dispyearborn') ? '<li>' . __('Born:') . ' <span class="annivne">' . $ftdatecrea . '</span></li>' : '') .
|
||||||
($w->dispyear ? '<li>' . __('Age:') . ' <span class="annivan">' . $nbreannee . '</span> ' . __('year(s)') . '</li>' : '') .
|
($w->__get('dispyear') ? '<li>' . __('Age:') . ' <span class="annivan">' . $nbreannee . '</span> ' . __('year(s)') . '</li>' : '') .
|
||||||
'<li>' . __('Birthday in') . ' <span class="annivjrs">' . $nbrejours . '</span> ' . __('day(s)') . '</li>' .
|
'<li>' . __('Birthday in') . ' <span class="annivjrs">' . $nbrejours . '</span> ' . __('day(s)') . '</li>' .
|
||||||
'</ul>'
|
'</ul>'
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue