DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:countdown

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:countdown [2015-03-25 02:59] – [Feature: Annual Timer] 78.97.226.2plugin: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: Countdown to a specific date.+description: Countdown to a specific date
 author     : Luis Machuca Bezzaza (previous authors) author     : Luis Machuca Bezzaza (previous authors)
 email      : luis.machuca [at] gulix.cl email      : luis.machuca [at] gulix.cl
 type       : syntax type       : syntax
-lastupdate : 2011-06-06 +lastupdate : 2020-11-01 
-compatible : Lemming, Anteater+compatible : Lemming, Anteater, Weatherwax, Binky, Frusterick Manners, Greebo
 depends    : depends    :
 conflicts  : conflicts  :
 similar    : similar    :
 tags       : counter, date tags       : counter, date
 +version    : 3.0
  
-downloadurl: http://ryan.gulix.cl/dw/_media/desarrollo/dokuwiki/dw-plugin-countdown-latest.zip+downloadurl: https://chiselapp.com/user/lmachucab/repository/dokuwiki-plugin-countdown/zip/countdown.zip 
 +sourceurl  : https://chiselapp.com/user/lmachucab/repository/dokuwiki-plugin-countdown 
 +bugtracker : https://chiselapp.com/user/lmachucab/repository/dokuwiki-plugin-countdown/reportlist 
 +donationurl: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=T44AQDXJQJTJQ&source=url
  
 ---- ----
Line 23: Line 27:
 -Based on even earlier work by [[rbpeters@peterro.com|Ron Peters]] (version 1.0).\\ -Based on even earlier work by [[rbpeters@peterro.com|Ron Peters]] (version 1.0).\\
 -Which was itself a modified version of the [[http://wakka.xiffy.nl/countdown|nucleuswiki]] plugin by Trent Adams and Edmond Hui\\ -Which was itself a modified version of the [[http://wakka.xiffy.nl/countdown|nucleuswiki]] plugin by Trent Adams and Edmond Hui\\
 +
 +**Important:** users of versions 2.x should upgrade if they have PHP 7.3 or 7.4.
  
 **Important:** version 2.x is not compatible with version 1.0 (syntax change of date) **Important:** version 2.x is not compatible with version 1.0 (syntax change of date)
  
 ===== Download and Installation ===== ===== Download and Installation =====
 +Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually.
  
-Download and install the plugin via the [[plugin:plugin|Plugin Manager]] using the above link which always points to the **latest version**, or check the [[#Demo|demo page]] for earlier versoins. As of the date of March 2011, the latest version is the version ''2.5rc2'', with a 2.5 //final// planned for May 2011. +:!: It is recommended you upgrade the plugin if you are using PHP>=7.0 to avoid some warnings in the codethanks to Stefan Huehner for the corrections.
- +
-Refer to [[:Plugins]] on how to install plugins manually. +
- +
-:!: If you are using a previous version of the pluginit is recommended that you **uninstall** the previous version before installing the RC.+
  
 ==== Previous Versions ==== ==== Previous Versions ====
  
 **Download links for previous version**: **Download links for previous version**:
-  * [[http://ryan.gulix.cl/dw/desarrollo/dokuwiki/inicio]] (archive of released 2.x versions)+  * [[https://chiselapp.com/user/lmachucab/repository/dokuwiki-plugin-countdown/]] - source control.
   * [[http://www.ekkart.de/wp-content/plugins/download-monitor/download.php?id=6]].   * [[http://www.ekkart.de/wp-content/plugins/download-monitor/download.php?id=6]].
  
-==== Demo ==== 
- 
-:!: [[http://ryan.gulix.cl/dw/desarrollo/dokuwiki/plugin-countdown|(Neo) Demo Site]]. The site is in Spanish, but usage should be pretty obvious and language is neutral enough that even Google Translator shall do fine. An English demo page will be made available for the next release of the plugin. 
- 
-Examples of use and more information can be found on [[http://www.ekkart.de/?page_id=76|ekkart.de]]. 
- 
-^  {{http://ryan.gulix.cl/archivos/dokuwiki/scr-plugin-countdown-01.png?nolink}}  ^ 
-|   The output of the ''countdown'' plugin, showing our remaining time to the\\ Mayan "//End of Days//" (''2012-12-22''). | 
  
 ===== Usage ===== ===== Usage =====
Line 62: Line 57:
   XX days [HH:MM] since description   XX days [HH:MM] since description
  
-(where the ''[HH:MM]'' part is optional)+(where the ''[HH:MM]'' part is controlled via plugin config)
  
 Possible formats of //date// are all [[http://www.gnu.org/software/tar/manual/html_node/tar_115.html#SEC115|GNU date formats]] that are allowed by [[phpfn>strtotime]]. Possible formats of //date// are all [[http://www.gnu.org/software/tar/manual/html_node/tar_115.html#SEC115|GNU date formats]] that are allowed by [[phpfn>strtotime]].
Line 79: 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 six parameters that are configurable, via either ''local.php'' or the Configuration Manager:+There are seven parameters that are configurable, via either ''local.php'' or the Configuration Manager:
  
-**Visibility of Countdown Date**: +Visibility of Target Date  || 
- +^ Parameter ''include_date'' (boolean| If set, the target date is shown in the plugin output.   |
-The parameter ''include_date'' is a Boolean that determines whether to show (''true'') or not (''false'') the target date in the output.+
  
 Example: Example:
Line 91: Line 85:
   XX days until description (mm/dd/yyyy)   XX days until description (mm/dd/yyyy)
  
-**Short form for Today**: +Short form for today  || 
- +| Parameter ''use_today'' (boolean)  | If set, events that are due today are simply shown as "Today" (or a national equivalent for supported languages).   |
-The parameter ''use_today'' is a Boolean that determines whether to switch the output of the countdown to the short, simple form "Today" if the countdown date is due today (''true'').+
  
 Example: Example:
Line 99: Line 92:
   Today is description   Today is description
  
-**Display hours and minutes**: +Display Remaining Hours || 
- +| Parameter ''with_hours'' (boolean)  | If set, the output includes the remaining hours and minutes of the day (''HH:MM'').  \\ It is disabled by default to preserve compatibility with older plugin versions.  |
-The parameter ''with_hours'' is a Boolean that determines whether to show hours and minutes as well as days in the output (''true''). It defaults to **''false''** to maintain output compatibility with previous versions of the plugin.+
  
 Examples: Examples:
Line 107: Line 99:
   XX days HH:MM until description (mm/dd/yyyy)   XX days HH:MM until description (mm/dd/yyyy)
  
-==== Parameters in the Latest Release ====+^ Display All Days || 
 +^ Parameter ''with_alldays'' (boolean)  | If set, the output shows the output as the total amount of days (as if using strftime flag "''%a''"), instead of splitting into years, months and days.  |
  
-**Display business days**+Examples: 
 +  (with option diabled) 
 +  BB months DD days HH:MM until description (mm/dd/yyyy) 
 +  (with option enabled) 
 +  NNNNN days HH:MM until description (mm/dd/yyyy)
  
-The parameter ''business_days'' is a Boolean that determines whether the amount of "business days" will be shown as well as the amount of total days. It defaults to falseThe number of business days is currently calculated by merely omitting Saturdays and Sundays.+^ Display Business Days (estimate)  || 
 +^ Parameter ''business_days'' (boolean)  | If set, the countdown is shown as an estimate of business days (that isweek days not counting Sat and Sun) |
  
 Examples: Examples:
Line 117: Line 115:
   XX (BB) days until description   XX (BB) days until description
  
-**Server Time Message** +^ Announce Server Time  || 
- +^ Parameter ''time_message'' (boolean)  | If set, this plugin will add a notice to DokuWiki's notification bar indicating the current time as read by the **server**\\ This option might be useful for remote servers whose timezone might change periodically.   |
-This parameter is a Boolean that determines whether this plugin will add a notice to DokuWiki's notification bar indicating the current time the server is using for calculations. It defaults to false. This option might be useful for wikis installed in shared or virtual hosting, as they might be located in other timezones or even change timezones periodically.+
  
 Examples: Examples:
Line 148: Line 145:
 ===== Versions ===== ===== Versions =====
  
 +  * :!: version 3.0 (2020-11-01): fixes a number of recorded bugs, fixes a 1-day miscount in some events, and allows using a wider range of dates as supported by PHP's ''DateTime'' classes (instead of being limited to POSIX timestamps).
 +  * version 2.6 (2019-01-13): corrections for PHP >= 7.0. The source code is moved to an online repository as well.
   * 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; plugin.info.txt compatibility.   * 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; plugin.info.txt compatibility.
   * 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>getConf]] capabilities, added README, CHANGELOG and VERSION.   * 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>getConf]] capabilities, added README, CHANGELOG and VERSION.
Line 159: Line 158:
  
 ===== Discussion ===== ===== Discussion =====
 +''with_alldays'' does not work for me. Regardless of whether I set ''with_alldays'' to 0 or 1 in the local.php, something like "288 days until" is still showing in the wiki. All other options appear to work. I also do not see this option exposed in the Configuration Manager page. Using NOCACHE, cleared browser cache, stop/start Doku site. Using latest Doku (Hogfather), PHP 7.4.1, Windows 10, \\ Also, feature request - would LOVE to have a progress bar included in this, like the one in [[https://www.dokuwiki.org/plugin:progrecss|progrecss]]. So user can see a visual of the countdown as well.
  
 Does this plugin work properly with leap years? Does this plugin work properly with leap years?
Line 406: Line 406:
  
  --- [[user>florinko-gmail|Florin]] //2015/03/24//  --- [[user>florinko-gmail|Florin]] //2015/03/24//
 +
 +> 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 //incredibly annoying// to support (requiring extra string for each and every component of a date, in singular and plural).  --- [[user>ryan-chappelle|ryan-chappelle]] //2020-11-02 05:11//
 +
 +==== 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;
 +</code>
 +has to be replaced by the following:
 +<code php>
 +$difference = ceil($diffseconds / 86400);
 +</code>
 +in plugin's **syntax.php** file.
 +
 + --- [[user>florinko-gmail|Anders]] //2015/11/13//
 +
 +> The plugin now uses PHP's ''DateTime'' faciities, so this should in theory no longer be an issue.   --- [[user>ryan-chappelle|ryan-chappelle]] //2020-11-02 05:11//
 +
 +==== Fix for "DateInterval::format() expects exactly 1 parameter, 0 given”  ====
 +Add quotes in format-brackets, Line 89:
 +<code php>
 +$Text1= $dt_diff->format("");
 +</code>
 + --- [[user>kkue|kkue]] //2022-05-31 17:04//
 +
plugin/countdown.1427248799.txt.gz · Last modified: 2015-03-25 03:00 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki