plugin:countdown
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:countdown [2010-10-31 13:04] – [Discussion] 82.243.184.242 | plugin:countdown [2022-05-31 17:08] (current) – [Fix for "DateInterval::format() expects exactly 1 parameter, 0 given”] kkue | ||
---|---|---|---|
Line 2: | Line 2: | ||
---- plugin ---- | ---- plugin ---- | ||
- | description: | + | description: |
- | author | + | author |
email : luis.machuca [at] gulix.cl | email : luis.machuca [at] gulix.cl | ||
type : syntax | type : syntax | ||
- | lastupdate : 2009-12-19 | + | lastupdate : 2020-11-01 |
- | compatible : | + | compatible : Lemming, Anteater, Weatherwax, Binky, Frusterick Manners, Greebo |
depends | depends | ||
conflicts | conflicts | ||
similar | similar | ||
tags : counter, date | tags : counter, date | ||
+ | version | ||
- | downloadurl: | + | downloadurl: |
+ | sourceurl | ||
+ | bugtracker : https:// | ||
+ | donationurl: | ||
---- | ---- | ||
Line 19: | Line 23: | ||
The **Countdown Plugin** shows a countdown to a specific (target) date. | The **Countdown Plugin** shows a countdown to a specific (target) date. | ||
- | **Under new management since June 11, 2009**. | + | **Under new management since June 11, 2009**.\\ |
+ | -Previously maintained by [[ekkart@ekkart.de|Ekkart Kleinod]] (since version 2.x).\\ | ||
+ | -Based on even earlier work by [[rbpeters@peterro.com|Ron Peters]] (version 1.0).\\ | ||
+ | -Which was itself a modified version of the [[http:// | ||
- | Previously maintained by [[ekkart@ekkart.de|Ekkart Kleinod]] (since version | + | **Important: |
- | Based on even earlier work by [[rbpeters@peterro.com|Ron Peters]] (version 1.0). | + | **Important: |
- | Which was itself a modified version of the [[http:// | + | ===== Download and Installation ===== |
+ | Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[: | ||
- | **Important:** version 2.x is not compatible with version 1.0 (syntax change of date) | + | :!: It is recommended you upgrade the plugin if you are using PHP>=7.0 to avoid some warnings in the code, thanks to Stefan Huehner for the corrections. |
- | ===== Attention: new maintainer needed -> found ===== | + | ==== Previous Versions |
- | Due to changes in my homepage backend I no longer develop this plugin. I will host the plugin | + | **Download links for previous version**: |
+ | * [[https:// | ||
+ | * [[http:// | ||
- | Regards, Ekkart. | ||
- | |||
- | >Hi, Ekkart. I've already mailed you asking to take over the development. But of course you might want to wait JIC someone else applies too. Kind regards. | ||
- | >>Hi Luis, sorry for not answering, I'm afraid, your mail was put into the spam folder. It's okay for me if you develop the plugin further. All files are in the zip archive. Regards, Ekkart. | ||
- | >>> | ||
- | ===== Description | + | ===== Usage ===== |
- | With this [[: | + | With this [[: |
The format is: | The format is: | ||
Line 47: | Line 52: | ||
< | < | ||
- | This will be replaced with either | + | This will be replaced with either: |
XX days [HH:MM] until description | XX days [HH:MM] until description | ||
XX days [HH:MM] since description | XX days [HH:MM] since description | ||
- | (where the '' | + | (where the '' |
- | Possible formats of //date// are all [[http:// | + | Possible formats of //date// are all [[http:// |
Examples: | Examples: | ||
< | < | ||
< | < | ||
+ | | ||
+ | Disable Page Caching so the plugin text can remain dynamic, insert this into any page using this plugin: | ||
- | ===== Download/ | + | |
- | + | ||
- | Download and install the plugin using the [[plugin: | + | |
- | + | ||
- | :!: If you are using a previous version of the plugin, it is recommended that you **uninstall** the previous version before installing the RC. | + | |
- | + | ||
- | **Download links for previous version**: | + | |
- | * [[http:// | + | |
- | * [[http:// | + | |
- | + | ||
- | Refer to [[: | + | |
- | + | ||
- | :!: [[http:// | + | |
- | + | ||
- | Examples of use and more information can be found on [[http:// | + | |
- | + | ||
- | ^ {{http:// | + | |
- | | | + | |
Line 84: | Line 74: | ||
The plugin is configurable in some ways since version 2.0. | The plugin is configurable in some ways since version 2.0. | ||
- | There are three parameters that are configurable, | + | There are seven parameters that are configurable, |
- | **Visibility of Countdown | + | ^ Visibility of Target |
- | + | ^ Parameter | |
- | The parameter | + | |
Example: | Example: | ||
- | | + | |
- | results in | + | |
XX days until description | XX days until description | ||
- | + | (with option enabled) | |
- | $conf[' | + | |
- | results in | + | |
XX days until description (mm/ | XX days until description (mm/ | ||
- | **Short for for Today**: | + | ^ Short form for today || |
- | + | | Parameter | |
- | The parameter | + | |
Example: | Example: | ||
- | | + | |
- | results in | + | |
Today is description | Today is description | ||
- | **Display hours and minutes**: | + | ^ Display |
+ | | Parameter '' | ||
- | The parameter '' | + | Examples: |
- | + | | |
- | Example: | + | |
- | | + | |
- | results in | + | |
XX days HH:MM until description (mm/ | XX days HH:MM until description (mm/ | ||
+ | |||
+ | ^ Display All Days || | ||
+ | ^ Parameter '' | ||
+ | |||
+ | Examples: | ||
+ | (with option diabled) | ||
+ | BB months DD days HH:MM until description (mm/ | ||
+ | (with option enabled) | ||
+ | NNNNN days HH:MM until description (mm/ | ||
+ | |||
+ | ^ Display Business Days (estimate) | ||
+ | ^ Parameter '' | ||
+ | |||
+ | Examples: | ||
+ | (with option enabled) | ||
+ | XX (BB) days until description | ||
+ | |||
+ | ^ Announce Server Time || | ||
+ | ^ Parameter '' | ||
+ | |||
+ | Examples: | ||
+ | (with option enabled) | ||
+ | (the following sample message will show on DokuWiki' | ||
+ | Server time for Countdown plugin is: 2011-03-08 12:45 | ||
+ | |||
===== Internationalisation ===== | ===== Internationalisation ===== | ||
Line 126: | Line 133: | ||
The following languages are included: | The following languages are included: | ||
+ | |||
* German (de), English (en) by Ekkart Kleinod | * German (de), English (en) by Ekkart Kleinod | ||
* Estonian (et) by Mikk Leini | * Estonian (et) by Mikk Leini | ||
Line 137: | Line 145: | ||
===== Versions ===== | ===== Versions ===== | ||
+ | * :!: version 3.0 (2020-11-01): | ||
+ | * version 2.6 (2019-01-13): | ||
+ | * version 2.5rc2 (2011-03-11) maintained by Luis Machuca Bezzaza: correction of a one-day-time bug and addition of the option to display business days and server time; minor overall improvements; | ||
* version 2.5rc (2009-12-19) maintained by Luis Machuca Bezzaza: Czech, Spanish and Br-Portuguese language files, ability to display hours, general code rewrite to use getLang(), [[xref> | * version 2.5rc (2009-12-19) maintained by Luis Machuca Bezzaza: Czech, Spanish and Br-Portuguese language files, ability to display hours, general code rewrite to use getLang(), [[xref> | ||
* version 2.1.3 (2009-01-24) maintained by Ekkart Kleinod: French language file | * version 2.1.3 (2009-01-24) maintained by Ekkart Kleinod: French language file | ||
Line 145: | Line 156: | ||
* version 2.0 (2008-02-18) maintained by Ekkart Kleinod: language and configuration options, code rewrite | * version 2.0 (2008-02-18) maintained by Ekkart Kleinod: language and configuration options, code rewrite | ||
* version 1.0 maintained by Ron Peters: basic functionality | * version 1.0 maintained by Ron Peters: basic functionality | ||
+ | |||
===== Discussion ===== | ===== Discussion ===== | ||
+ | '' | ||
Does this plugin work properly with leap years? | Does this plugin work properly with leap years? | ||
Line 173: | Line 186: | ||
The ability to display " | The ability to display " | ||
+ | >This feature has been added, albeit in a simple way, in version 2.5.rc2. | ||
---- | ---- | ||
Line 200: | Line 214: | ||
</ | </ | ||
</ | </ | ||
+ | >This was apparently a bug caused y leftover code, and seems to be fixed in the newest release. | ||
- | ==== Bug line 127 : ==== | + | ==== de-informal ==== |
+ | We set the global wiki language " | ||
+ | |||
+ | |||
+ | ==== Bug line 127 syntax.php | ||
Line 209: | Line 228: | ||
} else { | } else { | ||
| | ||
- | you have to change it to : | + | you have to change it to : (getLand --> getlang) |
| | ||
// check parsed date | // check parsed date | ||
Line 215: | Line 234: | ||
$renderer-> | $renderer-> | ||
} else { | } else { | ||
+ | |||
+ | >Will get to fix it. Thanks for letting me know! --- [[user> | ||
+ | |||
+ | ==== Attention: new maintainer needed -> found ==== | ||
+ | |||
+ | Due to changes in my homepage backend I no longer develop this plugin. I will host the plugin until a new maintainer is found. Please contact me if a new maintainer takes over the development. | ||
+ | |||
+ | Regards, Ekkart. | ||
+ | |||
+ | >Hi, Ekkart. I've already mailed you asking to take over the development. But of course you might want to wait JIC someone else applies too. Kind regards. | ||
+ | >>Hi Luis, sorry for not answering, I'm afraid, your mail was put into the spam folder. It's okay for me if you develop the plugin further. All files are in the zip archive. Regards, Ekkart. | ||
+ | >>> | ||
+ | |||
+ | ==== do not show the Description ==== | ||
+ | |||
+ | I installed the plugin an try it, but the description will not displayed. | ||
+ | have a look to: http:// | ||
+ | |||
+ | Regards, Mark W. | ||
+ | |||
+ | >Fixed in the latest update. Can't believe I just missed one or two lines of code. -- --- [[user> | ||
+ | >> updated and it works, thx --- [[user> | ||
+ | |||
+ | |||
+ | ==== ADDON select language ==== | ||
+ | |||
+ | created by --- [[user> | ||
+ | |||
+ | if your language for the countdown plugin is different from the prefered language | ||
+ | you need to modify the .../ | ||
+ | |||
+ | to select the language during the admin configuration | ||
+ | replace the original .../ | ||
+ | |||
+ | so we have now two ways to change the language | ||
+ | - per default in the config manager | ||
+ | - with the extented syntax: < | ||
+ | |||
+ | i have an example on http:// | ||
+ | |||
+ | === new .../ | ||
+ | |||
+ | |||
+ | <code php> | ||
+ | <?php | ||
+ | /** | ||
+ | * Metadata configuration for countdown plugin. | ||
+ | * | ||
+ | * @license GPL 2 (http:// | ||
+ | * @author | ||
+ | */ | ||
+ | |||
+ | $meta[' | ||
+ | $meta[' | ||
+ | $meta[' | ||
+ | |||
+ | /// The two following configurations are in a beta state | ||
+ | $meta[' | ||
+ | $meta[' | ||
+ | |||
+ | // | ||
+ | /** | ||
+ | * Addon for Metadata configuration for countdown plugin. | ||
+ | * | ||
+ | * @author Mark Wolfgruber | ||
+ | | ||
+ | */ | ||
+ | |||
+ | if(!defined(' | ||
+ | |||
+ | // Source: http:// | ||
+ | // if not exist PHP 5 a function named scandir | ||
+ | if (!function_exists(' | ||
+ | function scandir($directory, | ||
+ | if(!is_dir($directory)) { | ||
+ | return false; | ||
+ | } | ||
+ | $files = array(); | ||
+ | $handle = opendir($directory); | ||
+ | while (false !== ($filename = readdir($handle))) { | ||
+ | $files[] = $filename; | ||
+ | } | ||
+ | closedir($handle); | ||
+ | |||
+ | if($sorting_order == 1) { | ||
+ | rsort($files); | ||
+ | } else { | ||
+ | sort($files); | ||
+ | } | ||
+ | return $files; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // define countdown language directory | ||
+ | $countdown_lang_folder = DOKU_INC.' | ||
+ | |||
+ | // read countdown language directory | ||
+ | foreach(scandir($countdown_lang_folder) as $file) { | ||
+ | if($file[0] != ' | ||
+ | if(is_dir($countdown_lang_folder.'/' | ||
+ | $countdown_lang_folderArray[] = $file; | ||
+ | } else { // read files (not needed at the moment) | ||
+ | $countdown_lang_fileArray[] = $file; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | $meta[' | ||
+ | </ | ||
+ | |||
+ | === modification 1 of the .../ | ||
+ | |||
+ | |||
+ | <code php> | ||
+ | /** | ||
+ | * | ||
+ | * this function is a copy of .../ | ||
+ | * | ||
+ | * only two lines are added | ||
+ | * | ||
+ | */ | ||
+ | function setupLocale() { | ||
+ | if ($this-> | ||
+ | |||
+ | global $conf; | ||
+ | $path = DOKU_PLUGIN.$this-> | ||
+ | |||
+ | // don't include once, in case several plugin components require the same language file | ||
+ | @include($path.' | ||
+ | | ||
+ | if ($conf[' | ||
+ | // add following 2 lines | ||
+ | if ($this-> | ||
+ | if ($this-> | ||
+ | |||
+ | $this-> | ||
+ | $this-> | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | === modification 2 of the .../ | ||
+ | |||
+ | |||
+ | add in function render($mode, | ||
+ | '' | ||
+ | |||
+ | <code php> | ||
+ | // check for new language data | ||
+ | if ($data[2]) { | ||
+ | if ($this-> | ||
+ | $this-> | ||
+ | } else { | ||
+ | if ($this-> | ||
+ | $this-> | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ==== Feature: Annual Timer ==== | ||
+ | Is it possible to have it so the countdown automatically rolls over once it has reached its target so it has a new target of next year. | ||
+ | |||
+ | The idea I have in mind is to have a countdown to someones birthday, and once it has reached the end of the birthday day, it increments the target year by 1 and starts the countdown all over again. | ||
+ | |||
+ | Cheers | ||
+ | |||
+ | --- [[user> | ||
+ | |||
+ | |||
+ | ==== 1250 days? ==== | ||
+ | >Is it a way to show up how many **Years, Month, Days, Hours** - till to the target in 2045? There are too many days to be able to figure out when will take actually place the event... | ||
+ | |||
+ | --- [[user> | ||
+ | |||
+ | > This one is in the plans, but is unfortunately not yet tested, as the strategy used for internationalization inherited from legacy versions of the plugin, makes it // | ||
+ | |||
+ | ==== 1 day miscount ==== | ||
+ | In the latest version there is still a problem with day count. | ||
+ | To fix that problem next code: | ||
+ | <code php> | ||
+ | $difference = $diffseconds / 86400; | ||
+ | </ | ||
+ | has to be replaced by the following: | ||
+ | <code php> | ||
+ | $difference = ceil($diffseconds / 86400); | ||
+ | </ | ||
+ | in plugin' | ||
+ | |||
+ | --- [[user> | ||
+ | |||
+ | > The plugin now uses PHP's '' | ||
+ | |||
+ | ==== Fix for " | ||
+ | Add quotes in format-brackets, | ||
+ | <code php> | ||
+ | $Text1= $dt_diff-> | ||
+ | </ | ||
+ | --- [[user> | ||
plugin/countdown.1288526665.txt.gz · Last modified: 2010-10-31 13:04 by 82.243.184.242