Skip to content

Commit 9d8aa28

Browse files
committed
upgrade to Dotclear 2.28
1 parent b6ac8bd commit 9d8aa28

8 files changed

+100
-107
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
countdown 2.4 - 2023.10.15
2+
===========================================================
3+
* Require Dotclear 2.28
4+
* Require PHP 8.1
5+
* Upgrade to Dotclear 2.28
6+
17
countdown 2.3 - 2023.08.06
28
===========================================================
39
* Require Dotclear 2.27

README.md

+23-24
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
# README
22

3-
[![Release](https://img.shields.io/badge/release-2.3-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/countdown/releases)
4-
[![Date](https://img.shields.io/badge/date-2023.08.06-c44d58.svg)](https://git.dotclear.watch/JcDenis/countdown/releases)
5-
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-137bbb.svg)](https://fr.dotclear.org/download)
3+
[![Release](https://img.shields.io/badge/release-2.4-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/countdown/releases)
4+
![Date](https://img.shields.io/badge/date-2023.10.15-c44d58.svg)
5+
[![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download)
66
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/countdown)
7-
[![License](https://img.shields.io/github/license/JcDenis/countdown)](https://git.dotclear.watch/JcDenis/countdown/blob/master/LICENSE)
7+
[![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/countdown/src/branch/master/LICENSE)
88

9-
## WHAT IS COUNTDOWN ?
9+
## ABOUT
1010

11-
_countdown_ is a plugin for the open-source
12-
web publishing software called Dotclear.
11+
_countdown_ is a plugin for the open-source web publishing software called [Dotclear](https://www.dotclear.org).
1312

14-
It adds widget showing a countdown since/from a predefined date.
13+
> Add widget showing a countdown since/from a predefined date.
1514
1615
## REQUIREMENTS
1716

18-
_countdown_ requires:
19-
20-
* permissions to manage widgets
21-
* Dotclear 2.27
17+
* Dotclear 2.28
18+
* PHP 8.1
19+
* Dotclear permissions to manage widgets
2220

2321
## USAGE
2422

@@ -30,22 +28,23 @@ It uses jquery for dynamic countdown.
3028

3129
## LINKS
3230

33-
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
34-
* Source & contribution : [Gitea Page](https://git.dotclear.watch/JcDenis/countdown) or [GitHub Page](https://github.com/JcDenis/countdown)
35-
* Packages & details : [Gitea Page](https://git.dotclear.watch/JcDenis/countdown/releases) or [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/countdown)
36-
* Discuss & help : [Dotclear forum](https://forum.dotclear.org/viewforum.php?id=16)
31+
* [License](https://git.dotclear.watch/JcDenis/countdown/src/branch/master/LICENSE)
32+
* [Packages & details](https://git.dotclear.watch/JcDenis/countdown/releases) (or on [Dotaddict](https://plugins.dotaddict.org/dc2/details/countdown))
33+
* [Sources & contributions](https://git.dotclear.watch/JcDenis/countdown) (or on [GitHub](https://github.com/JcDenis/countdown))
34+
* [Issues & security](https://git.dotclear.watch/JcDenis/countdown/issues) (or on [GitHub](https://github.com/JcDenis/countdown/issues))
35+
* [Discuss & help](https://forum.dotclear.org/viewforum.php?id=16)
3736

3837
## CONTRIBUTORS
3938

40-
* [Moe](http://gniark.net/) (author)
41-
* Pierre Van Glabeke
42-
* Jean-Christian Denis
39+
* [Moe](http://gniark.net/) (author)
40+
* Pierre Van Glabeke
41+
* Jean-Christian Denis (latest)
4342

44-
You are welcome to contribute to this code.
43+
You are welcome to contribute to this code.
4544

46-
## JQUERY PLUGIN
45+
## JQUERY PLUGIN
4746

4847
Dynamic display uses plugin jQuery Countdown; See:
49-
* [Plugin](http://keith-wood.name/countdown.html)
50-
* [Formats](http://keith-wood.name/countdownRef.html#format)
51-
* [Display](http://keith-wood.name/countdownRef.html#layout)
48+
* [Plugin](http://keith-wood.name/countdown.html)
49+
* [Formats](http://keith-wood.name/countdownRef.html#format)
50+
* [Display](http://keith-wood.name/countdownRef.html#layout)

_define.php

+16-18
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,30 @@
11
<?php
22
/**
3-
* @brief countdown, a plugin for Dotclear 2
3+
* @file
4+
* @brief The plugin countdown definition
5+
* @ingroup countdown
46
*
5-
* @package Dotclear
6-
* @subpackage Plugin
7+
* @defgroup countdown Plugin countdown.
78
*
8-
* @author Moe (http://gniark.net/) and contributors
9+
* Countdown and stopwatch.
910
*
10-
* @copyright Jean-Christian Denis
11-
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
11+
* @author Moe (author)
12+
* @author Jean-Christian Denis (latest)
13+
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
1214
*/
13-
if (!defined('DC_RC_PATH')) {
14-
return;
15-
}
15+
declare(strict_types=1);
1616

1717
$this->registerModule(
1818
'CountDown',
1919
'Countdown and stopwatch',
2020
'Moe (http://gniark.net/) and contributors',
21-
'2.3',
21+
'2.4',
2222
[
23-
'requires' => [['core', '2.27']],
24-
'permissions' => dcCore::app()->auth->makePermissions([
25-
dcCore::app()->auth::PERMISSION_ADMIN,
26-
]),
27-
'type' => 'plugin',
28-
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
29-
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',
30-
'repository' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/raw/branch/master/dcstore.xml',
23+
'requires' => [['core', '2.28']],
24+
'permissions' => 'My',
25+
'type' => 'plugin',
26+
'support' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/issues',
27+
'details' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/src/branch/master/README.md',
28+
'repository' => 'https://git.dotclear.watch/JcDenis/' . basename(__DIR__) . '/raw/branch/master/dcstore.xml',
3129
]
3230
);

dcstore.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
<modules xmlns:da="http://dotaddict.org/da/">
33
<module id="countdown">
44
<name>CountDown</name>
5-
<version>2.3</version>
5+
<version>2.4</version>
66
<author>Moe (http://gniark.net/) and contributors</author>
77
<desc>Countdown and stopwatch</desc>
8-
<file>https://git.dotclear.watch/JcDenis/countdown/releases/download/v2.3/plugin-countdown.zip</file>
9-
<da:dcmin>2.27</da:dcmin>
8+
<file>https://git.dotclear.watch/JcDenis/countdown/releases/download/v2.4/plugin-countdown.zip</file>
9+
<da:dcmin>2.28</da:dcmin>
1010
<da:details>https://git.dotclear.watch/JcDenis/countdown/src/branch/master/README.md</da:details>
1111
<da:support>https://git.dotclear.watch/JcDenis/countdown/issues</da:support>
1212
</module>

src/Backend.php

+11-13
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
<?php
2-
/**
3-
* @brief countdown, a plugin for Dotclear 2
4-
*
5-
* @package Dotclear
6-
* @subpackage Plugin
7-
*
8-
* @author Moe (http://gniark.net/) and contributors
9-
*
10-
* @copyright Jean-Christian Denis
11-
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
12-
*/
2+
133
declare(strict_types=1);
144

155
namespace Dotclear\Plugin\countdown;
166

17-
use dcCore;
7+
use Dotclear\App;
188
use Dotclear\Core\Process;
199

10+
/**
11+
* @brief countdown backend class.
12+
* @ingroup countdown
13+
*
14+
* @author Moe (author)
15+
* @author Jean-Christian Denis (latest)
16+
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
17+
*/
2018
class Backend extends Process
2119
{
2220
public static function init(): bool
@@ -30,7 +28,7 @@ public static function process(): bool
3028
return false;
3129
}
3230

33-
dcCore::app()->addBehavior('initWidgets', [Widgets::class, 'initWidgets']);
31+
App::behavior()->addBehavior('initWidgets', Widgets::initWidgets(...));
3432

3533
return true;
3634
}

src/Frontend.php

+11-13
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
<?php
2-
/**
3-
* @brief countdown, a plugin for Dotclear 2
4-
*
5-
* @package Dotclear
6-
* @subpackage Plugin
7-
*
8-
* @author Moe (http://gniark.net/) and contributors
9-
*
10-
* @copyright Jean-Christian Denis
11-
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
12-
*/
2+
133
declare(strict_types=1);
144

155
namespace Dotclear\Plugin\countdown;
166

17-
use dcCore;
7+
use Dotclear\App;
188
use Dotclear\Core\Process;
199

10+
/**
11+
* @brief countdown frontend class.
12+
* @ingroup countdown
13+
*
14+
* @author Moe (author)
15+
* @author Jean-Christian Denis (latest)
16+
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
17+
*/
2018
class Frontend extends Process
2119
{
2220
public static function init(): bool
@@ -30,7 +28,7 @@ public static function process(): bool
3028
return false;
3129
}
3230

33-
dcCore::app()->addBehavior('initWidgets', [Widgets::class, 'initWidgets']);
31+
App::behavior()->addBehavior('initWidgets', Widgets::initWidgets(...));
3432

3533
return true;
3634
}

src/My.php

+8-12
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
<?php
2-
/**
3-
* @brief countdown, a plugin for Dotclear 2
4-
*
5-
* @package Dotclear
6-
* @subpackage Plugin
7-
*
8-
* @author Moe (http://gniark.net/) and contributors
9-
*
10-
* @copyright Jean-Christian Denis
11-
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
12-
*/
2+
133
declare(strict_types=1);
144

155
namespace Dotclear\Plugin\countdown;
166

177
use Dotclear\Module\MyPlugin;
188

199
/**
20-
* This module definitions.
10+
* @brief countdown My helper.
11+
* @ingroup countdown
12+
*
13+
* @author Moe (author)
14+
* @author Jean-Christian Denis (latest)
15+
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
2116
*/
2217
class My extends MyPlugin
2318
{
19+
// Use default permissions
2420
}

src/Widgets.php

+22-24
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,32 @@
11
<?php
2-
/**
3-
* @brief countdown, a plugin for Dotclear 2
4-
*
5-
* @package Dotclear
6-
* @subpackage Plugin
7-
*
8-
* @author Moe (http://gniark.net/) and contributors
9-
*
10-
* @copyright Jean-Christian Denis
11-
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
12-
*/
2+
133
declare(strict_types=1);
144

155
namespace Dotclear\Plugin\countdown;
166

17-
use dcCore;
7+
use Dotclear\App;
188
use Dotclear\Helper\Date;
199
use Dotclear\Helper\Html\Html;
2010
use Dotclear\Plugin\widgets\WidgetsStack;
2111
use Dotclear\Plugin\widgets\WidgetsElement;
2212

13+
/**
14+
* @brief countdown widgets class.
15+
* @ingroup countdown
16+
*
17+
* @author Moe (author)
18+
* @author Jean-Christian Denis (latest)
19+
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
20+
*/
2321
class Widgets
2422
{
2523
public static function initWidgets(WidgetsStack $w): void
2624
{
27-
if (is_null(dcCore::app()->blog)) {
25+
if (!App::blog()->isDefined()) {
2826
return;
2927
}
3028

31-
$tz = dcCore::app()->blog->settings->get('system')->get('blog_timezone');
29+
$tz = App::blog()->settings()->get('system')->get('blog_timezone');
3230

3331
$array_year = $array_month = $array_day = $array_hour = [];
3432
$array_minute = $array_number_of_times = [];
@@ -59,7 +57,7 @@ public static function initWidgets(WidgetsStack $w): void
5957
$w->create(
6058
'CountDown',
6159
__('Countdown'),
62-
[self::class, 'parseWidget'],
60+
self::parseWidget(...),
6361
null,
6462
__('A countdown to a future date or stopwatch to a past date')
6563
)
@@ -145,15 +143,15 @@ public static function initWidgets(WidgetsStack $w): void
145143

146144
public static function parseWidget(WidgetsElement $w): string
147145
{
148-
if (is_null(dcCore::app()->blog)
146+
if (!App::blog()->isDefined()
149147
|| $w->__get('offline')
150-
|| !$w->checkHomeOnly(dcCore::app()->url->type)
148+
|| !$w->checkHomeOnly(App::url()->type)
151149
) {
152150
return '';
153151
}
154152

155153
# get local time
156-
$local_time = Date::addTimeZone(dcCore::app()->blog->settings->get('system')->get('blog_timezone'));
154+
$local_time = Date::addTimeZone(App::blog()->settings()->get('system')->get('blog_timezone'));
157155

158156
$ts = mktime((int) $w->hour, (int) $w->minute, (int) $w->second, (int) $w->month, (int) $w->day, (int) $w->year);
159157
# get difference
@@ -197,19 +195,19 @@ public static function parseWidget(WidgetsElement $w): string
197195
$str = implode('', $times);
198196
}
199197

200-
if (!$w->dynamic || is_null(dcCore::app()->ctx)) {
198+
if (!$w->dynamic) {
201199
$res = ($w->title ? $w->renderTitle(Html::escapeHTML($w->title)) : '') .
202200
'<p>' . $text . '<span>' . $str . '</span></p>';
203201

204202
return $w->renderDiv((bool) $w->content_only, 'countdown ' . $w->class, '', $res);
205203
}
206204

207205
# dynamic display with Countdown for jQuery
208-
if (!is_numeric(dcCore::app()->ctx->__get('countdown'))) {
209-
dcCore::app()->ctx->__set('countdown', 0);
206+
if (!is_numeric(App::frontend()->context()->__get('countdown'))) {
207+
App::frontend()->context()->__set('countdown', 0);
210208
}
211-
$id = (int) dcCore::app()->ctx->__get('countdown');
212-
dcCore::app()->ctx->__set('countdown', $id + 1);
209+
$id = (int) App::frontend()->context()->__get('countdown');
210+
App::frontend()->context()->__set('countdown', $id + 1);
213211

214212
$script = '';
215213

@@ -218,7 +216,7 @@ public static function parseWidget(WidgetsElement $w): string
218216
My::jsLoad('jquery.plugin.min.js') .
219217
My::jsLoad('jquery.countdown.min.js');
220218

221-
$l10n_file = 'jquery.countdown-' . dcCore::app()->blog->settings->get('system')->get('lang') . '.js';
219+
$l10n_file = 'jquery.countdown-' . App::blog()->settings()->get('system')->get('lang') . '.js';
222220
if (file_exists(__DIR__ . '/../js/' . $l10n_file)) {
223221
$script .= My::jsLoad($l10n_file);
224222
}

0 commit comments

Comments
 (0)