From: <var...@us...> - 2009-01-01 19:38:23
|
Revision: 6357 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6357&view=rev Author: vargenau Date: 2009-01-01 19:37:23 +0000 (Thu, 01 Jan 2009) Log Message: ----------- New plugin: CurrentTime Added Paths: ----------- trunk/lib/plugin/CurrentTime.php trunk/pgsrc/Help%2FCurrentTimePlugin Added: trunk/lib/plugin/CurrentTime.php =================================================================== --- trunk/lib/plugin/CurrentTime.php (rev 0) +++ trunk/lib/plugin/CurrentTime.php 2009-01-01 19:37:23 UTC (rev 6357) @@ -0,0 +1,100 @@ +<?php // -*-php-*- +rcs_id('$Id: CurrentTime.php 6185 2008-08-22 11:40:14Z vargenau $'); +/* + * Copyright 2008 Marc-Etienne Vargenau, Alcatel-Lucent + * + * This file is part of PhpWiki. + * + * PhpWiki is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * PhpWiki 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 PhpWiki; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* + * Standard Alcatel-Lucent disclaimer for contributing to open source + * + * "The CurrentTimePlugin ("Contribution") has not been tested and/or + * validated for release as or in products, combinations with products or + * other commercial use. Any use of the Contribution is entirely made at + * the user's own responsibility and the user can not rely on any features, + * functionalities or performances Alcatel-Lucent has attributed to the + * Contribution. + * + * THE CONTRIBUTION BY ALCATEL-LUCENT IS PROVIDED AS IS, WITHOUT WARRANTY + * OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, COMPLIANCE, + * NON-INTERFERENCE AND/OR INTERWORKING WITH THE SOFTWARE TO WHICH THE + * CONTRIBUTION HAS BEEN MADE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * ALCATEL-LUCENT BE LIABLE FOR ANY DAMAGES OR OTHER LIABLITY, WHETHER IN + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * CONTRIBUTION OR THE USE OR OTHER DEALINGS IN THE CONTRIBUTION, WHETHER + * TOGETHER WITH THE SOFTWARE TO WHICH THE CONTRIBUTION RELATES OR ON A STAND + * ALONE BASIS." + */ + +/** + * A simple plugin that displays current time and date. + * + * Usage: + * <?plugin CurrentTime?> + * <?plugin CurrentTime format=XXX ?> + */ + +class WikiPlugin_CurrentTime +extends WikiPlugin +{ + // Five required functions in a WikiPlugin. + + function getName () { + return _("CurrentTime"); + } + + function getDescription () { + return _("A simple plugin that displays current time and date"); + + } + + function getVersion() { + return preg_replace("/[Revision: $]/", '', + "\$Revision: 6185 $"); + } + + // Establish default values for each of this plugin's arguments. + function getDefaultArguments() { + return array('timezone' => '', + 'format' => '%Y-%m-%d %T'); + } + + function run($dbi, $argstr, &$request, $basepage) { + extract($this->getArgs($argstr, $request)); + + if ($format == 'date') { + $format = '%Y-%m-%d'; + } + if ($format == 'time') { + $format = '%T'; + } + + return HTML::span(strftime($format, time())); + } +}; + +// For emacs users +// Local Variables: +// mode: php +// tab-width: 8 +// c-basic-offset: 4 +// c-hanging-comment-ender-p: nil +// indent-tabs-mode: nil +// End: +?> Added: trunk/pgsrc/Help%FCurrentTimePlugin =================================================================== --- trunk/pgsrc/Help%2FCurrentTimePlugin (rev 0) +++ trunk/pgsrc/Help%2FCurrentTimePlugin 2009-01-01 19:37:23 UTC (rev 6357) @@ -0,0 +1,63 @@ +Date: Mon, 22 Dec 2008 13:19:24 +0000 +Mime-Version: 1.0 (Produced by PhpWiki 1.3.14-20080124) +X-Rcs-Id: $Id: Help%2FCurrentTime 6355 2008-12-13 19:19:17Z vargenau $ +Content-Type: application/x-phpwiki; + pagename=Help%2FCurrentTime; + flags=PAGE_LOCKED; + markup=2; + charset=iso-8859-1 +Content-Transfer-Encoding: binary + +The *~CurrentTime* [plugin|Help:WikiPlugin] displays current time and date (when page was saved). + +!!! Usage +<verbatim> +<?plugin CurrentTime format=xxx ?> +</verbatim> + +!!! Arguments + +{| class="bordered" +|- +| Argument +| Description +| Default value +|- +| <b>format</b> +| Display format (strftime format, or 'date' or 'time') +| Date and time in ISO 8601:2004 format +|} + +!!! Examples + +<verbatim> +<?plugin CurrentTime ?> +</verbatim> + +<?plugin CurrentTime ?> + +<verbatim> +<?plugin CurrentTime format=date ?> +</verbatim> + +<?plugin CurrentTime format=date ?> + +<verbatim> +<?plugin CurrentTime format=time ?> +</verbatim> + +<?plugin CurrentTime format=time ?> + +<verbatim> +<?plugin CurrentTime format='%d %h %Y %H h %M m %S s %Z' ?> +</verbatim> + +<?plugin CurrentTime format='%d %h %Y %H h %M m %S s %Z' ?> + +!!! Author +* Marc-Etienne Vargenau, Alcatel-Lucent + +!!! See Also + +---- +[PhpWikiDocumentation] [CategoryWikiPlugin] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |