release 2.1

This commit is contained in:
Jean-Christian Paul Denis 2022-12-31 11:21:18 +01:00
parent f1ca48f87e
commit 2bf8a23185
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
11 changed files with 418 additions and 331 deletions

13
CHANGELOG.md Normal file
View File

@ -0,0 +1,13 @@
2.1 - 2022.12.31
* update to dotclear 2.24
* update to jquery plugin 2.1.0 (2016)
* fix phpstan and php-cs-fixer errors
* fix js call
1.6 - 2022.12.28 - Pierre Van Glabeke
* màj partielle dc2.24
1.5 - 2016.07.29 - Pierre Van Glabeke
* mise à jour script jquery 1.6.3 -> 2.0.2
* mise à jour pour compatibilité avec dc2.9
* dc2.9 requis

View File

@ -1,7 +1,52 @@
# Countdown # README
Le plugin propose un widget qui affiche un compte à rebours vers une date à venir ou un chronomètre vers une date passée. [![Release](https://img.shields.io/github/v/release/JcDenis/countdown)](https://github.com/JcDenis/countdown/releases)
[![Date](https://img.shields.io/github/release-date/JcDenis/countdown)](https://github.com/JcDenis/countdown/releases)
[![Issues](https://img.shields.io/github/issues/JcDenis/countdown)](https://github.com/JcDenis/countdown/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/countdown)
[![License](https://img.shields.io/github/license/JcDenis/countdown)](https://github.com/JcDenis/countdown/blob/master/LICENSE)
Documentation ## WHAT IS COUNTDOWN ?
L'affichage dynamique utilise le plugin jQuery Countdown (http://keith-wood.name/countdown.html) qui propose une syntaxe riche pour le formatage (http://keith-wood.name/countdownRef.html#format) et l'affichage (http://keith-wood.name/countdownRef.html#layout). _countdown_ is a plugin for the open-source
web publishing software called Dotclear.
It adds widget showing a countdown since/from a predefined date.
## REQUIREMENTS
_countdown_ requires:
* permissions to manage widgets
* Dotclear 2.24
* jQuery libs
## USAGE
First install _countdown_, manualy from a zip package or from
Dotaddict repository. (See Dotclear's documentation to know how do this)
Add and configure "Countdown" from widgets manager.
## LINKS
* License : [GNU GPL v2](https://www.gnu.org/licenses/old-licenses/lgpl-2.0.html)
* Source & contribution : [GitHub Page](https://github.com/JcDenis/countdown)
* Packages & details : [Dotaddict Page](https://plugins.dotaddict.org/dc2/details/countdown)
* Discuss & help : [Dotclear forum](https://forum.dotclear.org/viewforum.php?id=16)
## CONTRIBUTORS
* [Moe](http://gniark.net/) (author)
* Pierre Van Glabeke
* Jean-Christian Denis
You are welcome to contribute to this code.
## JQUERY PLUGIN
Dynamic display uses plugin jQuery Countdown; See:
* [Plugin](http://keith-wood.name/countdown.html)
* [Formats](http://keith-wood.name/countdownRef.html#format)
* [Display](http://keith-wood.name/countdownRef.html#layout)

17
_admin.php Normal file
View File

@ -0,0 +1,17 @@
<?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
*/
if (!defined('DC_CONTEXT_ADMIN')) {
return;
}
require __DIR__ . '/_widget.php';

View File

@ -1,31 +1,24 @@
<?php <?php
# ***** BEGIN LICENSE BLOCK ***** /**
# * @brief countdown, a plugin for Dotclear 2
# This file is part of CountDown, a plugin for Dotclear 2 *
# Copyright 2007,2010 Moe (http://gniark.net/) * @package Dotclear
# * @subpackage Plugin
# CountDown is free software; you can redistribute it and/or *
# modify it under the terms of the GNU General Public License v2.0 * @author Moe (http://gniark.net/) and contributors
# as published by the Free Software Foundation. *
# * @copyright Jean-Christian Denis
# CountDown is distributed in the hope that it will be useful, * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
# but WITHOUT ANY WARRANTY; without even the implied warranty of */
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the if (!defined('DC_RC_PATH')) {
# GNU General Public License for more details. return;
# }
# You should have received a copy of the GNU General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#
# ***** END LICENSE BLOCK *****
if (!defined('DC_RC_PATH')) {return;}
$this->registerModule( $this->registerModule(
'CountDown', 'CountDown',
'Countdown and stopwatch', 'Countdown and stopwatch',
'Moe (http://gniark.net/), Pierre Van Glabeke', 'Moe (http://gniark.net/) and contributors',
'2.0.0', '2.1',
[ [
'requires' => [['core', '2.24']], 'requires' => [['core', '2.24']],
'permissions' => dcCore::app()->auth->makePermissions([ 'permissions' => dcCore::app()->auth->makePermissions([
@ -33,6 +26,7 @@ $this->registerModule(
]), ]),
'type' => 'plugin', 'type' => 'plugin',
'support' => 'https://forum.dotclear.org/viewforum.php?id=16', 'support' => 'https://forum.dotclear.org/viewforum.php?id=16',
'details' => 'http://plugins.dotaddict.org/dc2/details/countdown' 'details' => 'https://plugins.dotaddict.org/dc2/details/' . basename(__DIR__),
'repository' => 'https://raw.githubusercontent.com/JcDenis/' . basename(__DIR__) . '/master/dcstore.xml',
] ]
); );

View File

@ -1,24 +0,0 @@
<?php
# ***** BEGIN LICENSE BLOCK *****
#
# This file is part of CountDown, a plugin for Dotclear 2
# Copyright 2007,2010 Moe (http://gniark.net/)
#
# CountDown is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License v2.0
# as published by the Free Software Foundation.
#
# CountDown is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#
# ***** END LICENSE BLOCK *****
if (!defined('DC_RC_PATH')) {return;}
require_once(dirname(__FILE__).'/_widget.php');

17
_public.php Normal file
View File

@ -0,0 +1,17 @@
<?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
*/
if (!defined('DC_RC_PATH')) {
return;
}
require __DIR__ . '/_widget.php';

View File

@ -1,286 +1,265 @@
<?php <?php
# ***** BEGIN LICENSE BLOCK ***** /**
# * @brief countdown, a plugin for Dotclear 2
# This file is part of CountDown, a plugin for Dotclear 2 *
# Copyright 2007,2010 Moe (http://gniark.net/) * @package Dotclear
# * @subpackage Plugin
# CountDown is free software; you can redistribute it and/or *
# modify it under the terms of the GNU General Public License v2.0 * @author Moe (http://gniark.net/) and contributors
# as published by the Free Software Foundation. *
# * @copyright Jean-Christian Denis
# CountDown is distributed in the hope that it will be useful, * @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
# but WITHOUT ANY WARRANTY; without even the implied warranty of */
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the if (!defined('DC_RC_PATH')) {
# GNU General Public License for more details. return null;
# }
# You should have received a copy of the GNU General Public
# License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#
# ***** END LICENSE BLOCK *****
if (!defined('DC_RC_PATH')) {return;} dcCore::app()->addBehavior(
'initWidgets',
dcCore::app()->addBehavior('initWidgets', ['CountDownBehaviors','initWidgets']
array('CountDownBehaviors','initWidgets')); );
class CountDownBehaviors class CountDownBehaviors
{ {
public static function initWidgets($w) public static function initWidgets($w)
{ {
# set timezone $tz = dcCore::app()->blog->settings->get('system')->get('blog_timezone');
dcCore::app();
$tz = dcCore::app()->blog->settings->system->blog_timezone;
$w->create('CountDown',__('Countdown'), $array_year = $array_month = $array_day = $array_hour = [];
array('CountDownBehaviors','Show'), $array_minute = $array_number_of_times = [];
null, for ($i = 1902;$i <= 2037;$i++) {
__('A countdown to a future date or stopwatch to a past date'));
$w->CountDown->setting('title',__('Title:'),__('CountDown'),'text');
$w->CountDown->setting('text_before',
__('Text displayed if the date is in the future:'),__('In'),'text');
$w->CountDown->setting('text_after',
__('Text displayed if the date is in the past:'),__('For'),'text');
# create arrays for year, month, day, hour, minute and second
$array_year = $array_month = $array_day = $array_hour = array();
$array_minute = $array_number_of_times = array();
for ($i = 1902;$i <= 2037;$i++)
{
$array_year[$i] = $i; $array_year[$i] = $i;
} }
for ($i = 1;$i <= 12;$i++) for ($i = 1;$i <= 12;$i++) {
{ $i = str_repeat('0', (2 - strlen($i))) . $i;
$i = str_repeat('0',(2-strlen($i))).$i; $array_month[ucfirst(__(strftime('%B', mktime(0, 0, 0, (int) $i, 1, 1970)))) . ' (' . $i . ')'] = $i;
$array_month[ucfirst(__(strftime('%B', mktime(0, 0, 0, $i, 1, 1970)))).' ('.$i.')'] = $i;
} }
for ($i = 1;$i <= 31;$i++) for ($i = 1;$i <= 31;$i++) {
{ $i = str_repeat('0', (2 - strlen($i))) . $i;
$i = str_repeat('0',(2-strlen($i))).$i;
$array_day[$i] = $i; $array_day[$i] = $i;
} }
for ($i = 0;$i <= 23;$i++) for ($i = 0;$i <= 23;$i++) {
{ $i = str_repeat('0', (2 - strlen($i))) . $i;
$i = str_repeat('0',(2-strlen($i))).$i;
$array_hour[$i] = $i; $array_hour[$i] = $i;
} }
for ($i = 0;$i <= 60;$i++) for ($i = 0;$i <= 60;$i++) {
{ $i = str_repeat('0', (2 - strlen($i))) . $i;
$i = str_repeat('0',(2-strlen($i))).$i;
$array_minute[$i] = $i; $array_minute[$i] = $i;
} }
for ($i = 1;$i <= 5;$i++) for ($i = 1;$i <= 5;$i++) {
{
$array_number_of_times[$i] = $i; $array_number_of_times[$i] = $i;
} }
$array_number_of_times['6 ('.__('all').')'] = 6; $array_number_of_times['6 (' . __('all') . ')'] = 6;
# /create arrays
$w->CountDown->setting('year',ucfirst(__('year')).':', $w->create(
dt::str('%Y',null,$tz),'combo',$array_year); 'CountDown',
$w->CountDown->setting('month',ucfirst(__('month')).':', __('Countdown'),
dt::str('%m',null,$tz),'combo',$array_month); ['CountDownBehaviors', 'Show'],
$w->CountDown->setting('day',ucfirst(__('day')).':', null,
dt::str('%d',null,$tz),'combo',$array_day); __('A countdown to a future date or stopwatch to a past date')
$w->CountDown->setting('hour',ucfirst(__('hour')).':',
dt::str('%H',null,$tz),'combo',$array_hour);
$w->CountDown->setting('minute',ucfirst(__('minute')).':',
dt::str('%M',null,$tz),'combo',$array_minute);
$w->CountDown->setting('second',ucfirst(__('second')).':',
dt::str('%S',null,$tz),'combo',$array_minute);
$w->CountDown->setting('number_of_times',
__('Number of values to be displayed:'),'6','combo',
$array_number_of_times);
$w->CountDown->setting('zeros',
__('Show zeros before hours, minutes and seconds'),false,'check');
$w->CountDown->setting('dynamic',
__('Enable dynamic display'),false,'check');
$w->CountDown->setting('dynamic_format',
sprintf(__('Dynamic display format (see <a href="%1$s" %2$s>jQuery Countdown Reference</a>):'),
'http://keith-wood.name/countdownRef.html#format',
'onclick="return window.confirm(\''.
__('Are you sure you want to leave this page?').'\')"'),
__('yowdHMS'),'text');
$w->CountDown->setting('dynamic_layout_before',
sprintf(__('Dynamic display layout if the date is in the future (see <a href="%1$s" %2$s>jQuery Countdown Reference</a>):'),
'http://keith-wood.name/countdownRef.html#layout',
'onclick="return window.confirm(\''.
__('Are you sure you want to leave this page?').'\')"'),
__('In {y<}{yn} {yl}, {y>} {o<}{on} {ol}, {o>} {w<}{wn} {wl}, {w>} {d<}{dn} {dl}, {d>} {hn} {hl}, {mn} {ml} and {sn} {sl}'),
'textarea');
$w->CountDown->setting('dynamic_layout_after',
sprintf(__('Dynamic display layout if the date is in the past (see <a href="%1$s" %2$s>jQuery Countdown Reference</a>):'),
'http://keith-wood.name/countdownRef.html#layout',
'onclick="return window.confirm(\''.
__('Are you sure you want to leave this page?').'\')"'),
__('For {y<}{yn} {yl}, {y>} {o<}{on} {ol}, {o>} {w<}{wn} {wl}, {w>} {d<}{dn} {dl}, {d>} {hn} {hl}, {mn} {ml} and {sn} {sl}'),
'textarea');
$w->CountDown->setting('homeonly',__('Display on:'),0,'combo',
array(
__('All pages') => 0,
__('Home page only') => 1,
__('Except on home page') => 2
) )
); ->addTitle(__('CountDown'))
$w->CountDown->setting('content_only',__('Content only'),0,'check'); ->setting(
$w->CountDown->setting('class',__('CSS class:'),''); 'text_before',
$w->CountDown->setting('offline',__('Offline'),0,'check'); __('Text displayed if the date is in the future:'),
__('In'),
'text'
)
->setting(
'text_after',
__('Text displayed if the date is in the past:'),
__('For'),
'text'
)
->setting('year', ucfirst(__('year')) . ':', dt::str('%Y', null, $tz), 'combo', $array_year)
->setting('month', ucfirst(__('month')) . ':', dt::str('%m', null, $tz), 'combo', $array_month)
->setting('day', ucfirst(__('day')) . ':', dt::str('%d', null, $tz), 'combo', $array_day)
->setting('hour', ucfirst(__('hour')) . ':', dt::str('%H', null, $tz), 'combo', $array_hour)
->setting('minute', ucfirst(__('minute')) . ':', dt::str('%M', null, $tz), 'combo', $array_minute)
->setting('second', ucfirst(__('second')) . ':', dt::str('%S', null, $tz), 'combo', $array_minute)
->setting(
'number_of_times',
__('Number of values to be displayed:'),
'6',
'combo',
$array_number_of_times
)
->setting(
'zeros',
__('Show zeros before hours, minutes and seconds'),
false,
'check'
)
->setting(
'dynamic',
__('Enable dynamic display'),
false,
'check'
)
->setting(
'dynamic_format',
sprintf(
__('Dynamic display format (see <a href="%1$s" %2$s>jQuery Countdown Reference</a>):'),
'http://keith-wood.name/countdownRef.html#format',
'onclick="return window.confirm(\'' .
__('Are you sure you want to leave this page?') . '\')"'
),
__('yowdHMS'),
'text'
)
->setting(
'dynamic_layout_before',
sprintf(
__('Dynamic display layout if the date is in the future (see <a href="%1$s" %2$s>jQuery Countdown Reference</a>):'),
'http://keith-wood.name/countdownRef.html#layout',
'onclick="return window.confirm(\'' .
__('Are you sure you want to leave this page?') . '\')"'
),
__('In {y<}{yn} {yl}, {y>} {o<}{on} {ol}, {o>} {w<}{wn} {wl}, {w>} {d<}{dn} {dl}, {d>} {hn} {hl}, {mn} {ml} and {sn} {sl}'),
'textarea'
)
->setting(
'dynamic_layout_after',
sprintf(
__('Dynamic display layout if the date is in the past (see <a href="%1$s" %2$s>jQuery Countdown Reference</a>):'),
'http://keith-wood.name/countdownRef.html#layout',
'onclick="return window.confirm(\'' .
__('Are you sure you want to leave this page?') . '\')"'
),
__('For {y<}{yn} {yl}, {y>} {o<}{on} {ol}, {o>} {w<}{wn} {wl}, {w>} {d<}{dn} {dl}, {d>} {hn} {hl}, {mn} {ml} and {sn} {sl}'),
'textarea'
)
->addHomeOnly()
->addContentOnly()
->addClass()
->addOffline();
} }
# escape quotes but not XHTML tags # escape quotes but not XHTML tags
# inspired by html::escapeJS() # inspired by html::escapeJS()
public static function escapeQuotes($str) public static function escapeQuotes($str)
{ {
$str = str_replace("'","\'",$str); $str = str_replace("'", "\'", $str);
$str = str_replace('"','\"',$str); $str = str_replace('"', '\"', $str);
return $str; return $str;
} }
public static function Show($w) public static function Show($w)
{ {
# set timezone if ($w->offline) {
dcCore::app(); return null;
}
if ($w->offline) if (!$w->checkHomeOnly(dcCore::app()->url->type)) {
return; return null;
if (($w->homeonly == 1 && dcCore::app()->url->type != 'default') ||
($w->homeonly == 2 && dcCore::app()->url->type == 'default')) {
return;
} }
# get local time # get local time
$local_time = dt::addTimeZone(dcCore::app()->blog->settings->system->blog_timezone); $local_time = dt::addTimeZone(dcCore::app()->blog->settings->get('system')->get('blog_timezone'));
$ts = mktime($w->hour,$w->minute,$w->second,$w->month,$w->day, $ts = mktime($w->hour, $w->minute, $w->second, $w->month, $w->day, $w->year);
$w->year);
# get difference # get difference
(int)$diff = ($local_time - $ts); (int) $diff = ($local_time - $ts);
$after = ($diff > 0) ? true : false; $after = ($diff > 0) ? true : false;
$diff = abs($diff); $diff = abs($diff);
$times = array(); $times = [];
$intervals = array $intervals = [
( (3600 * 24 * 365.24) => ['one' => __('year'), 'more' => __('years'), 'zeros' => false],
(3600*24*365.24) => array('one'=>__('year'),'more'=>__('years'), (3600 * 24 * 30.4) => ['one' => __('month'), 'more' => __('months'), 'zeros' => false],
'zeros'=>false), (3600 * 24) => ['one' => __('day'), 'more' => __('days'), 'zeros' => false],
(3600*24*30.4) => array('one'=>__('month'),'more'=>__('months'), (3600) => ['one' => __('hour'), 'more' => __('hours'), 'zeros' => true],
'zeros'=>false), (60) => ['one' => __('minute'), 'more' => __('minutes'), 'zeros' => true],
(3600*24) => array('one'=>__('day'),'more'=>__('days'), (1) => ['one' => __('second'), 'more' => __('seconds'), 'zeros' => true],
'zeros'=>false), ];
(3600) => array('one'=>__('hour'),'more'=>__('hours'),
'zeros'=>true),
(60) => array('one'=>__('minute'),'more'=>__('minutes'),
'zeros'=>true),
(1) => array('one'=>__('second'),'more'=>__('seconds'),
'zeros'=>true),
);
foreach ($intervals as $k => $v) foreach ($intervals as $k => $v) {
{ if ($diff >= $k) {
if ($diff >= $k) $time = floor($diff / $k);
{ $times[] = (($w->zeros and $v['zeros'])
$time = floor($diff/$k); ? sprintf('%02d', $time) : $time) . ' ' . (($time <= 1) ? $v['one']
$times[] = (($w->zeros AND $v['zeros'])
? sprintf('%02d',$time) : $time).' '.(($time <= 1) ? $v['one']
: $v['more']); : $v['more']);
$diff = $diff%$k; $diff = $diff % $k;
} }
} }
# output # output
$text = ($after) ? $w->text_after : $w->text_before; $text = ($after) ? $w->text_after : $w->text_before;
if (strlen($text) > 0) {$text .= ' ';} if (strlen($text) > 0) {
$text .= ' ';
}
# get times and make a string # get times and make a string
$times = array_slice($times,0,$w->number_of_times); $times = array_slice($times, 0, $w->number_of_times);
if (count($times) > 1) if (count($times) > 1) {
{
$last = array_pop($times); $last = array_pop($times);
$str = implode(', ',$times).' '.__('and').' '.$last; $str = implode(', ', $times) . ' ' . __('and') . ' ' . $last;
} } else {
else {$str = implode('',$times);} $str = implode('', $times);
}
if (!$w->dynamic)
{ 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>';
return $w->renderDiv($w->content_only,'countdown '.$w->class,'',$res); return $w->renderDiv($w->content_only, 'countdown ' . $w->class, '', $res);
} }
else
{
# dynamic display with Countdown for jQuery # dynamic display with Countdown for jQuery
if (!is_numeric(dcCore::app()->ctx->countdown)) if (!is_numeric(dcCore::app()->ctx->__get('countdown'))) {
{ dcCore::app()->ctx->__set('countdown', 0);
dcCore::app()->ctx->countdown = 0;
} }
$id = dcCore::app()->ctx->countdown; $id = (int) dcCore::app()->ctx->__get('countdown');
dcCore::app()->ctx->countdown += 1; dcCore::app()->ctx->__set('countdown', $id + 1);
$script = ''; $script = '';
if (!defined('COUNTDOWN_SCRIPT')) if (!defined('COUNTDOWN_SCRIPT')) {
{ $script .= dcUtils::cssLoad(dcCore::app()->blog->getPF(basename(__DIR__) . '/css/jquery.countdown.css')) .
$script = dcUtils::jsLoad(dcCore::app()->blog->getPF(basename(__DIR__) . '/js/jquery.plugin.min.js')) .
'<script type="text/javascript" src="'. dcUtils::jsLoad(dcCore::app()->blog->getPF(basename(__DIR__) . '/js/jquery.countdown.min.js'));
dcCore::app()->blog->getQmarkURL().
'pf=countdown/js/jquery.countdown.min.js"></script>'."\n";
$l10n_file = $l10n_file = 'jquery.countdown-' . dcCore::app()->blog->settings->get('system')->get('lang') . '.js';
'jquery.countdown-'.dcCore::app()->blog->settings->system->lang.'.js'; if (file_exists(__DIR__ . '/js/' . $l10n_file)) {
if (file_exists(dirname(__FILE__).'/js/'.$l10n_file)) $script .= dcUtils::jsLoad(dcCore::app()->blog->getPF(basename(__DIR__) . '/js/' . $l10n_file));
{
$script .=
'<script type="text/javascript" src="'.dcCore::app()->blog->getQmarkURL().
'pf=countdown/js/'.$l10n_file.'"></script>'."\n";
} }
define('COUNTDOWN_SCRIPT',(bool)true); define('COUNTDOWN_SCRIPT', (bool) true);
} }
if ($after) if ($after) {
{
$to = 'since'; $to = 'since';
$layout = $w->dynamic_layout_after; $layout = $w->dynamic_layout_after;
} } else {
else
{
$to = 'until'; $to = 'until';
$layout = $w->dynamic_layout_before; $layout = $w->dynamic_layout_before;
} }
$res = ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : ''). $res = ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') .
'<p id="countdown-'.$id.'">'.$text.$str.'</p>'. '<p id="countdown-' . $id . '">' . $text . $str . '</p>' .
'<script type="text/javascript">'."\n". $script .
'//<![CDATA['."\n". '<script type="text/javascript">' . "\n" .
'$().ready(function() {'. '//<![CDATA[' . "\n" .
"$('#countdown-".$id."').countdown({". '$().ready(function() {' .
"$('#countdown-" . $id . "').countdown({" .
# In Javascript, 0 = January, 11 = December # In Javascript, 0 = January, 11 = December
$to.": new Date(".(int)$w->year.",".(int)$w->month."-1,". $to . ': new Date(' . (int) $w->year . ',' . (int) $w->month . '-1,' .
(int)$w->day.",".(int)$w->hour.",".(int)$w->minute.",". (int) $w->day . ',' . (int) $w->hour . ',' . (int) $w->minute . ',' .
(int)$w->second."), (int) $w->second . "),
description: '".html::escapeJS($text)."', description: '" . html::escapeJS($text) . "',
format: '".$w->dynamic_format."', format: '" . $w->dynamic_format . "',
layout: '".$layout."', layout: '" . $layout . "',
expiryText: '".html::escapeJS($w->text_after)."' expiryText: '" . html::escapeJS($w->text_after) . "'
});". });" .
'});'."\n". '});' . "\n" .
'//]]>'. '//]]>' .
'</script>'."\n"; '</script>' . "\n";
return $w->renderDiv($w->content_only,'countdown '.$w->class,'',$res);
} return $w->renderDiv($w->content_only, 'countdown ' . $w->class, '', $res);
} }
} }

View File

@ -1,7 +0,0 @@
v1.6 - 28-12-2022 - Pierre Van Glabeke
* màj partielle dc2.24
v1.5 - 29-07-2016 - Pierre Van Glabeke
* mise à jour script jquery 1.6.3 -> 2.0.2
* mise à jour pour compatibilité avec dc2.9
* dc2.9 requis

13
dcstore.xml Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0"?>
<modules xmlns:da="http://dotaddict.org/da/">
<module id="countdown">
<name>CountDown</name>
<version>2.1</version>
<author>Moe (http://gniark.net/) and contributors</author>
<desc>Countdown and stopwatch</desc>
<file>https://github.com/JcDenis/countdown/releases/download/v2.1/plugin-countdown.zip</file>
<da:dcmin>2.24</da:dcmin>
<da:details>https://plugins.dotaddict.org/dc2/details/countdown</da:details>
<da:support>https://forum.dotclear.org/viewforum.php?id=16</da:support>
</module>
</modules>

40
locales/fr/main.lang.php Normal file
View File

@ -0,0 +1,40 @@
<?php
/**
* @package Dotclear
*
* @copyright Olivier Meunier & Association Dotclear
* @copyright GPL-2.0-only
*/
#
# DOT NOT MODIFY THIS FILE !
#
l10n::$locales['Countdown and stopwatch'] = 'Compte à rebours ou chronomètre';
l10n::$locales['A countdown to a future date or stopwatch to a past date'] = 'Un compte à rebours vers une date à venir ou un chronomètre vers une date passée';
l10n::$locales['Countdown'] = 'Chronomètre';
l10n::$locales['Text displayed if the date is in the future:'] = 'Texte affiché si la date est dans le futur&nbsp;:';
l10n::$locales['In'] = 'Dans';
l10n::$locales['Text displayed if the date is in the past:'] = 'Texte affiché si la date est passée&nbsp;:';
l10n::$locales['For'] = 'Depuis';
l10n::$locales['all'] = 'tous';
l10n::$locales['year'] = 'an';
l10n::$locales['month'] = 'mois';
l10n::$locales['day'] = 'jour';
l10n::$locales['hour'] = 'heure';
l10n::$locales['minute'] = 'minute';
l10n::$locales['second'] = 'seconde';
l10n::$locales['Number of values to be displayed:'] = 'Nombre de valeurs à afficher&nbsp;:';
l10n::$locales['Show zeros before hours, minutes and seconds'] = 'Afficher des zéros devant les heures, les minutes et les secondes';
l10n::$locales['Enable dynamic display'] = 'Activer l\'affichage dynamique';
l10n::$locales['Dynamic display format (see <a href="%1$s" %2$s>jQuery Countdown Reference</a>):'] = 'Format de l\'affichage dynamique (voir <a href="%1$s" %2$s>jQuery Countdown Reference</a>)&nbsp;:';
l10n::$locales['Dynamic display layout if the date is in the future (see <a href="%1$s" %2$s>jQuery Countdown Reference</a>):'] = 'Mise en page de l\'affichage dynamique si la date est dans le futur (voir <a href="%1$s" %2$s>jQuery Countdown Reference</a>)&nbsp;:';
l10n::$locales['In {y<}{yn} {yl}, {y>} {o<}{on} {ol}, {o>} {w<}{wn} {wl}, {w>} {d<}{dn} {dl}, {d>} {hn} {hl}, {mn} {ml} and {sn} {sl}'] = 'Dans {y<}{yn} {yl}, {y>}{o<}{on} {ol}, {o>}{d<}{dn} {dl}, {d>}{hn} {hl}, {mn} {ml} et {sn} {sl}';
l10n::$locales['Dynamic display layout if the date is in the past (see <a href="%1$s" %2$s>jQuery Countdown Reference</a>):'] = 'Mise en page de l\'affichage dynamique si la date est passée (voir <a href="%1$s" %2$s>jQuery Countdown Reference</a>)&nbsp;:';
l10n::$locales['For {y<}{yn} {yl}, {y>} {o<}{on} {ol}, {o>} {w<}{wn} {wl}, {w>} {d<}{dn} {dl}, {d>} {hn} {hl}, {mn} {ml} and {sn} {sl}'] = 'Depuis {y<}{yn} {yl}, {y>} {o<}{on} {ol}, {o>} {w<}{wn} {wl}, {w>} {d<}{dn} {dl}, {d>} {hn} {hl}, {mn} {ml} et {sn} {sl}';
l10n::$locales['years'] = 'ans';
l10n::$locales['months'] = 'mois';
l10n::$locales['days'] = 'jours';
l10n::$locales['hours'] = 'heures';
l10n::$locales['minutes'] = 'minutes';
l10n::$locales['seconds'] = 'secondes';
l10n::$locales['and'] = 'et';