Source for file data.countdown.php
Documentation is available at data.countdown.php
* @subpackage plugins_data
// +----------------------------------------------------------------------+
// | Copyright (c) 2004, bitweaver.org
// +----------------------------------------------------------------------+
// | All Rights Reserved. See below for details and a complete list of authors.
// | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
// | For comments, please use phpdocu.sourceforge.net documentation standards!!!
// | -> see http://phpdocu.sourceforge.net/
// +----------------------------------------------------------------------+
// | Author (TikiWiki): Stephan Borg <wolff_borg@users.sourceforge.net>
// | Reworked for Bitweaver (& Undoubtedly Screwed-Up)
// | by: StarRider <starrrider@users.sourceforge.net>
// +----------------------------------------------------------------------+
define( 'PLUGIN_GUID_DATACOUNTDOWN', 'datacountdown' );
'auto_activate' => FALSE,
'requires_pair' => FALSE,
'load_function' => 'data_countdown',
'help_page' => 'DataPluginCountDown',
'description' => tra("Displays a Count-Down until a date:time is reached - then - negative numbers indicate how long it has been since that date. The Count-Down is displayed in the format of (X days, X hours, X minutes and X seconds)."),
'help_function' => 'data_countdown_help',
'syntax' => "{COUNTDOWN enddate= localtime= class= punct= text=}",
'<table class="data help">'
. '<th>' . tra( "Key" ) . '</th>'
. '<th>' . tra( "Type" ) . '</th>'
. '<th>' . tra( "Comments" ) . '</th>'
. '<td>' . tra( "string") . '<br />' . tra("(mandatory)") . '</td>'
. '<td>' . tra( "A date used to compare to the present date. Several date formats are accepted, but spelling it out like this: <strong>May 10 2004</strong> is probably the simplest. A time can be include with the date like this: <strong>20:02:00 or 8:02pm</strong> . There is <strong>NO</strong> Default.") . '</td>'
. '<td>' . tra( "boolean") . '<br />' . tra("(optional)") . '</td>'
. '<td>' . tra( "Determins if Local Time is displayed or not. Passing any value in this parameter will make it <strong>TRUE</strong>. The Default = <strong>FALSE</strong> so Local Time will not be displayed") . '</td>'
. '<td>' . tra( "string") . '<br />' . tra("(optional)") . '</td>'
. '<td>' . tra( "Classname of the SPAN surrounding the countdown. The date/time segments are each wrapped in a VAR-Tag. Default = countdown") . '</td>'
. '<td>' . tra( "string") . '<br />' . tra("(optional)") . '</td>'
. '<td>' . tra( "Any kind of punctuation to divide the date/time segments from each other, a comma, a colon, a pipe ... Default = space. To put a non breaking space, use HTML: &nbsp;") . '</td>'
. '<td>' . tra( "string") . '<br />' . tra("(optional)") . '</td>'
. '<td>' . tra( "Text to be displayed after the date/time string. It's wrapped in <em>.") . '</td>'
. '<p>' . tra("Example 1: ") . '<input value="{COUNTDOWN enddate=\'8:02pm May 10 2004\' localtime=\'on\' text=\'' . tra(" - Time Passes So Slowly") . '\'}" type="text" size="40" /></p>'
. '<p>' . tra("Example 2: ") . '<input value="{COUNTDOWN enddate=\'2012-12-22 00:01\' class=\'alert red\' punct=\', \' text=\'Purple Haze\'}" type="text" size="40" /></p>'
// The next 2 lines allow access to the $pluginParams given above
if (!isset ($enddate) ) { // The Mandatory Parameter is missing
$ret = tra("The required parameter ") . "<strong>enddate</strong>" . tra(" was missing from the plugin ") . '<strong>"' . $pluginParams['tag'] . '"</strong>';
if ($then == - 1) { // strtotime failed so enddate was not a valid date
$ret = tra("__Error__ - The plugin ") . '<strong>"' . $pluginParams['tag'] . '"</strong>' . tra(" was not given a valid date. The date given was:\n") . "enddate=$enddate";
if (isset ($localtime) && $localtime == 'on' && isset ($_COOKIE['tz_offset'])) {
$tz = $_COOKIE['tz_offset'];
$difference = $then - $now;
$num = $difference/ 86400;
$num2 = ($num - $days)* 24;
$num3 = ($num2 - $hours)* 60;
$num4 = ($num3 - $mins)* 60;
<span class='". $class. "'>"
. "<var>" . $days . " " . tra("days") . "</var>" . $punct
. "<var>" . $hours . " " . tra("hours") . "</var>" . $punct
. "<var>" . $mins . " " . tra("minutes") . "</var>" . $punct
. "<var>" . $secs . " " . tra("seconds") . "</var>" . " "
. "<em>" . $text . "</em>"
|