internal package Foswiki::Plugins::LocalTimePlugin

See PublishedAPI for packages intended to be used by Plugin and Contrib authors, or browse all packages.
See also Developing plugins, Developer's Bible, Technical Overview

internal package LocalTimePlugin

Implements the %LOCALTIME% macro to display a formatted date and time possibly adjusted for a given time zone.

Plugin Version: $Rev: 7117 (2010-04-07) $

initPlugin( $topic, $web, $user, $installWeb ) -> $boolean

  • $topic - the name of the topic in the current CGI query
  • $web - the name of the web in the current CGI query
  • $user - the login name of the user
  • $installWeb - the name of the web the plugin topic is in

Initializes and installs the handler routine for the %LOCALTIME% macro.

Returns: 1 on success, 0 on failure

handleLocalTime( $session, $params, $theTopic, $theWeb ) -> $string

Process the %LOCALTIME% macro and return the desired date/time as a formatted string. Uses the Date::Handler and Date:Parse Perl modules.

  • $session - a reference to the Foswiki session object
  • $params - a reference to a Foswiki::Attrs object containing the macro parameters
    • DEFAULT - (optional) the desired timezone in which to render the date/time. Defaults to the LOCALTIMEPLUGIN_TIMEZONE preference setting or UTC.
    • datetime - (optional) the date/time to display, assumed to be in UTC unless the string contains a timezone identifier. Defaults to the current date and time
    • format - (optional) the desired output format specifier string. Defaults to the LOCALTIMEPLUGIN_DATEFORMAT preference or to the Foswiki '$longdate' format
    • locale - (optional) the desired locale definition to use when displaying the date and time. Defaults to the LOCALTIMEPLUGIN_LOCALE preference or to the site's locale defined in $Foswiki::cfg{Site}{Locale}
    • fromtopic - (optional, deprecated) the web.topic from which to set the value of the TIMEZONE variable, use the LOCALTIMEPLUGIN_TIMEZONE preference instead
    • dateGMT - (optional, deprecated) the same as the datetime parameter, use datetime instead
  • $theTopic - the name of the topic being processed
  • $theWeb - the name of the web containing the topic being processed

Returns: the date and/or time as a formatted string or an error message upon failure

_callModPerl2Helper( $date, $format, $topic ) -> $string

Invoke the mod_perl2-safe helper script to format and return the date. Uses the APR::Base64 Perl module.

  • $date - a reference to a Date::Handler object containing the date to format
  • $format - the desired format string
  • $topic - the topic containing the %LOCALTIME% macro

Returns: the date and/or time as a formatted string

_warning( $topic, $msg )

Log a warning and debug message. The topic is prepended to the message.

  • $topic - the web.topic being processed
  • $msg - the message text to write to the warning and debug logs

_debugEntryPoint( $topic, $func, $args )

Write a function entry message to the debug log if debug logging is enabled. The topic is prepended to the message.

  • $topic - the web.topic being processed
  • $func - the name of the function being logged
  • $args - a reference to a hash containing the arguments passed to $func

_debug( $topic, $msg )

Write the supplied message to the debug log if debug logging is enabled. The Perl package name and topic are prepended to the message.

  • $topic - the web.topic being processed
  • $msg - the message text to write to the debug log

Topic revision: r1 - 03 Feb 2016, UnknownUser
This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding DAMASK? Send feedback