upgrade to Dotclear 2.28
This commit is contained in:
parent
b6ac8bdba8
commit
9d8aa28988
@ -1,3 +1,9 @@
|
|||||||
|
countdown 2.4 - 2023.10.15
|
||||||
|
===========================================================
|
||||||
|
* Require Dotclear 2.28
|
||||||
|
* Require PHP 8.1
|
||||||
|
* Upgrade to Dotclear 2.28
|
||||||
|
|
||||||
countdown 2.3 - 2023.08.06
|
countdown 2.3 - 2023.08.06
|
||||||
===========================================================
|
===========================================================
|
||||||
* Require Dotclear 2.27
|
* Require Dotclear 2.27
|
||||||
|
47
README.md
47
README.md
@ -1,24 +1,22 @@
|
|||||||
# README
|
# README
|
||||||
|
|
||||||
[![Release](https://img.shields.io/badge/release-2.3-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/countdown/releases)
|
[![Release](https://img.shields.io/badge/release-2.4-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/countdown/releases)
|
||||||
[![Date](https://img.shields.io/badge/date-2023.08.06-c44d58.svg)](https://git.dotclear.watch/JcDenis/countdown/releases)
|
![Date](https://img.shields.io/badge/date-2023.10.15-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/countdown)
|
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/countdown)
|
||||||
[![License](https://img.shields.io/github/license/JcDenis/countdown)](https://git.dotclear.watch/JcDenis/countdown/blob/master/LICENSE)
|
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/countdown/src/branch/master/LICENSE)
|
||||||
|
|
||||||
## WHAT IS COUNTDOWN ?
|
## ABOUT
|
||||||
|
|
||||||
_countdown_ is a plugin for the open-source
|
_countdown_ is a plugin for the open-source web publishing software called [Dotclear](https://www.dotclear.org).
|
||||||
web publishing software called Dotclear.
|
|
||||||
|
|
||||||
It adds widget showing a countdown since/from a predefined date.
|
> Add widget showing a countdown since/from a predefined date.
|
||||||
|
|
||||||
## REQUIREMENTS
|
## REQUIREMENTS
|
||||||
|
|
||||||
_countdown_ requires:
|
* Dotclear 2.28
|
||||||
|
* PHP 8.1
|
||||||
* permissions to manage widgets
|
* Dotclear permissions to manage widgets
|
||||||
* Dotclear 2.27
|
|
||||||
|
|
||||||
## USAGE
|
## USAGE
|
||||||
|
|
||||||
@ -30,22 +28,23 @@ It uses jquery for dynamic countdown.
|
|||||||
|
|
||||||
## LINKS
|
## LINKS
|
||||||
|
|
||||||
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
|
* [License](https://git.dotclear.watch/JcDenis/countdown/src/branch/master/LICENSE)
|
||||||
* Source & contribution : [Gitea Page](https://git.dotclear.watch/JcDenis/countdown) or [GitHub Page](https://github.com/JcDenis/countdown)
|
* [Packages & details](https://git.dotclear.watch/JcDenis/countdown/releases) (or on [Dotaddict](https://plugins.dotaddict.org/dc2/details/countdown))
|
||||||
* Packages & details : [Gitea Page](https://git.dotclear.watch/JcDenis/countdown/releases) or [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/countdown)
|
* [Sources & contributions](https://git.dotclear.watch/JcDenis/countdown) (or on [GitHub](https://github.com/JcDenis/countdown))
|
||||||
* Discuss & help : [Dotclear forum](https://forum.dotclear.org/viewforum.php?id=16)
|
* [Issues & security](https://git.dotclear.watch/JcDenis/countdown/issues) (or on [GitHub](https://github.com/JcDenis/countdown/issues))
|
||||||
|
* [Discuss & help](https://forum.dotclear.org/viewforum.php?id=16)
|
||||||
|
|
||||||
## CONTRIBUTORS
|
## CONTRIBUTORS
|
||||||
|
|
||||||
* [Moe](http://gniark.net/) (author)
|
* [Moe](http://gniark.net/) (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.
|
||||||
|
|
||||||
## JQUERY PLUGIN
|
## JQUERY PLUGIN
|
||||||
|
|
||||||
Dynamic display uses plugin jQuery Countdown; See:
|
Dynamic display uses plugin jQuery Countdown; See:
|
||||||
* [Plugin](http://keith-wood.name/countdown.html)
|
* [Plugin](http://keith-wood.name/countdown.html)
|
||||||
* [Formats](http://keith-wood.name/countdownRef.html#format)
|
* [Formats](http://keith-wood.name/countdownRef.html#format)
|
||||||
* [Display](http://keith-wood.name/countdownRef.html#layout)
|
* [Display](http://keith-wood.name/countdownRef.html#layout)
|
||||||
|
24
_define.php
24
_define.php
@ -1,29 +1,27 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @brief countdown, a plugin for Dotclear 2
|
* @file
|
||||||
|
* @brief The plugin countdown definition
|
||||||
|
* @ingroup countdown
|
||||||
*
|
*
|
||||||
* @package Dotclear
|
* @defgroup countdown Plugin countdown.
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
*
|
||||||
* @author Moe (http://gniark.net/) and contributors
|
* Countdown and stopwatch.
|
||||||
*
|
*
|
||||||
* @copyright Jean-Christian Denis
|
* @author Moe (author)
|
||||||
|
* @author Jean-Christian Denis (latest)
|
||||||
* @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')) {
|
declare(strict_types=1);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->registerModule(
|
$this->registerModule(
|
||||||
'CountDown',
|
'CountDown',
|
||||||
'Countdown and stopwatch',
|
'Countdown and stopwatch',
|
||||||
'Moe (http://gniark.net/) and contributors',
|
'Moe (http://gniark.net/) and contributors',
|
||||||
'2.3',
|
'2.4',
|
||||||
[
|
[
|
||||||
'requires' => [['core', '2.27']],
|
'requires' => [['core', '2.28']],
|
||||||
'permissions' => dcCore::app()->auth->makePermissions([
|
'permissions' => 'My',
|
||||||
dcCore::app()->auth::PERMISSION_ADMIN,
|
|
||||||
]),
|
|
||||||
'type' => 'plugin',
|
'type' => 'plugin',
|
||||||
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
|
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
|
||||||
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',
|
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
<modules xmlns:da="http://dotaddict.org/da/">
|
<modules xmlns:da="http://dotaddict.org/da/">
|
||||||
<module id="countdown">
|
<module id="countdown">
|
||||||
<name>CountDown</name>
|
<name>CountDown</name>
|
||||||
<version>2.3</version>
|
<version>2.4</version>
|
||||||
<author>Moe (http://gniark.net/) and contributors</author>
|
<author>Moe (http://gniark.net/) and contributors</author>
|
||||||
<desc>Countdown and stopwatch</desc>
|
<desc>Countdown and stopwatch</desc>
|
||||||
<file>https://git.dotclear.watch/JcDenis/countdown/releases/download/v2.3/plugin-countdown.zip</file>
|
<file>https://git.dotclear.watch/JcDenis/countdown/releases/download/v2.4/plugin-countdown.zip</file>
|
||||||
<da:dcmin>2.27</da:dcmin>
|
<da:dcmin>2.28</da:dcmin>
|
||||||
<da:details>https://git.dotclear.watch/JcDenis/countdown/src/branch/master/README.md</da:details>
|
<da:details>https://git.dotclear.watch/JcDenis/countdown/src/branch/master/README.md</da:details>
|
||||||
<da:support>https://git.dotclear.watch/JcDenis/countdown/issues</da:support>
|
<da:support>https://git.dotclear.watch/JcDenis/countdown/issues</da:support>
|
||||||
</module>
|
</module>
|
||||||
|
@ -1,22 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief countdown, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Moe (http://gniark.net/) 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\countdown;
|
namespace Dotclear\Plugin\countdown;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief countdown backend class.
|
||||||
|
* @ingroup countdown
|
||||||
|
*
|
||||||
|
* @author Moe (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,7 +28,7 @@ class Backend extends Process
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dcCore::app()->addBehavior('initWidgets', [Widgets::class, 'initWidgets']);
|
App::behavior()->addBehavior('initWidgets', Widgets::initWidgets(...));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief countdown, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Moe (http://gniark.net/) 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\countdown;
|
namespace Dotclear\Plugin\countdown;
|
||||||
|
|
||||||
use dcCore;
|
use Dotclear\App;
|
||||||
use Dotclear\Core\Process;
|
use Dotclear\Core\Process;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief countdown frontend class.
|
||||||
|
* @ingroup countdown
|
||||||
|
*
|
||||||
|
* @author Moe (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,7 +28,7 @@ class Frontend extends Process
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dcCore::app()->addBehavior('initWidgets', [Widgets::class, 'initWidgets']);
|
App::behavior()->addBehavior('initWidgets', Widgets::initWidgets(...));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
20
src/My.php
20
src/My.php
@ -1,15 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief countdown, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Moe (http://gniark.net/) 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\countdown;
|
namespace Dotclear\Plugin\countdown;
|
||||||
@ -17,8 +7,14 @@ namespace Dotclear\Plugin\countdown;
|
|||||||
use Dotclear\Module\MyPlugin;
|
use Dotclear\Module\MyPlugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This module definitions.
|
* @brief countdown My helper.
|
||||||
|
* @ingroup countdown
|
||||||
|
*
|
||||||
|
* @author Moe (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,34 +1,32 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @brief countdown, a plugin for Dotclear 2
|
|
||||||
*
|
|
||||||
* @package Dotclear
|
|
||||||
* @subpackage Plugin
|
|
||||||
*
|
|
||||||
* @author Moe (http://gniark.net/) 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\countdown;
|
namespace Dotclear\Plugin\countdown;
|
||||||
|
|
||||||
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 countdown widgets class.
|
||||||
|
* @ingroup countdown
|
||||||
|
*
|
||||||
|
* @author Moe (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
|
||||||
{
|
{
|
||||||
if (is_null(dcCore::app()->blog)) {
|
if (!App::blog()->isDefined()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tz = dcCore::app()->blog->settings->get('system')->get('blog_timezone');
|
$tz = App::blog()->settings()->get('system')->get('blog_timezone');
|
||||||
|
|
||||||
$array_year = $array_month = $array_day = $array_hour = [];
|
$array_year = $array_month = $array_day = $array_hour = [];
|
||||||
$array_minute = $array_number_of_times = [];
|
$array_minute = $array_number_of_times = [];
|
||||||
@ -59,7 +57,7 @@ class Widgets
|
|||||||
$w->create(
|
$w->create(
|
||||||
'CountDown',
|
'CountDown',
|
||||||
__('Countdown'),
|
__('Countdown'),
|
||||||
[self::class, 'parseWidget'],
|
self::parseWidget(...),
|
||||||
null,
|
null,
|
||||||
__('A countdown to a future date or stopwatch to a past date')
|
__('A countdown to a future date or stopwatch to a past date')
|
||||||
)
|
)
|
||||||
@ -145,15 +143,15 @@ class Widgets
|
|||||||
|
|
||||||
public static function parseWidget(WidgetsElement $w): string
|
public static function parseWidget(WidgetsElement $w): string
|
||||||
{
|
{
|
||||||
if (is_null(dcCore::app()->blog)
|
if (!App::blog()->isDefined()
|
||||||
|| $w->__get('offline')
|
|| $w->__get('offline')
|
||||||
|| !$w->checkHomeOnly(dcCore::app()->url->type)
|
|| !$w->checkHomeOnly(App::url()->type)
|
||||||
) {
|
) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
# get local time
|
# get local time
|
||||||
$local_time = Date::addTimeZone(dcCore::app()->blog->settings->get('system')->get('blog_timezone'));
|
$local_time = Date::addTimeZone(App::blog()->settings()->get('system')->get('blog_timezone'));
|
||||||
|
|
||||||
$ts = mktime((int) $w->hour, (int) $w->minute, (int) $w->second, (int) $w->month, (int) $w->day, (int) $w->year);
|
$ts = mktime((int) $w->hour, (int) $w->minute, (int) $w->second, (int) $w->month, (int) $w->day, (int) $w->year);
|
||||||
# get difference
|
# get difference
|
||||||
@ -197,7 +195,7 @@ class Widgets
|
|||||||
$str = implode('', $times);
|
$str = implode('', $times);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$w->dynamic || is_null(dcCore::app()->ctx)) {
|
if (!$w->dynamic) {
|
||||||
$res = ($w->title ? $w->renderTitle(Html::escapeHTML($w->title)) : '') .
|
$res = ($w->title ? $w->renderTitle(Html::escapeHTML($w->title)) : '') .
|
||||||
'<p>' . $text . '<span>' . $str . '</span></p>';
|
'<p>' . $text . '<span>' . $str . '</span></p>';
|
||||||
|
|
||||||
@ -205,11 +203,11 @@ class Widgets
|
|||||||
}
|
}
|
||||||
|
|
||||||
# dynamic display with Countdown for jQuery
|
# dynamic display with Countdown for jQuery
|
||||||
if (!is_numeric(dcCore::app()->ctx->__get('countdown'))) {
|
if (!is_numeric(App::frontend()->context()->__get('countdown'))) {
|
||||||
dcCore::app()->ctx->__set('countdown', 0);
|
App::frontend()->context()->__set('countdown', 0);
|
||||||
}
|
}
|
||||||
$id = (int) dcCore::app()->ctx->__get('countdown');
|
$id = (int) App::frontend()->context()->__get('countdown');
|
||||||
dcCore::app()->ctx->__set('countdown', $id + 1);
|
App::frontend()->context()->__set('countdown', $id + 1);
|
||||||
|
|
||||||
$script = '';
|
$script = '';
|
||||||
|
|
||||||
@ -218,7 +216,7 @@ class Widgets
|
|||||||
My::jsLoad('jquery.plugin.min.js') .
|
My::jsLoad('jquery.plugin.min.js') .
|
||||||
My::jsLoad('jquery.countdown.min.js');
|
My::jsLoad('jquery.countdown.min.js');
|
||||||
|
|
||||||
$l10n_file = 'jquery.countdown-' . dcCore::app()->blog->settings->get('system')->get('lang') . '.js';
|
$l10n_file = 'jquery.countdown-' . App::blog()->settings()->get('system')->get('lang') . '.js';
|
||||||
if (file_exists(__DIR__ . '/../js/' . $l10n_file)) {
|
if (file_exists(__DIR__ . '/../js/' . $l10n_file)) {
|
||||||
$script .= My::jsLoad($l10n_file);
|
$script .= My::jsLoad($l10n_file);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user