Difference: TWikiFuncDotPm (9 vs. 10)

Revision 102010-05-29 - TWikiContributor

Line: 5 to 5
  Official list of stable TWiki functions for Plugin developers
Changed:
<
<
This module defines official functions that Plugins
>
>
This module defines official functions that TWiki plugins
 can use to interact with the TWiki engine and content.
Changed:
<
<
Refer to EmptyPlugin and lib/TWiki/Plugins/EmptyPlugin.pm for a template Plugin and documentation on how to write a Plugin.
>
>
Refer to EmptyPlugin and lib/TWiki/Plugins/EmptyPlugin.pm for a template plugin and documentation on how to write a plugin.
  Plugins should only use functions published in this module. If you use functions in other TWiki libraries you might create a security hole and
Changed:
<
<
you will probably need to change your Plugin when you upgrade TWiki.
>
>
you will probably need to change your plugin when you upgrade TWiki.
  Deprecated functions will still work in older code, though they should
Changed:
<
<
not be called in new Plugins and should be replaced in older Plugins
>
>
not be called in new plugins and should be replaced in older plugins
 as soon as possible.

The version of the TWiki::Func module is defined by the VERSION number of the

Line: 611 to 612
  Tip if you want, you can use this method to check your own access control types. For example, if you:
Changed:
<
<
in ThatWeb.ThisTopic, then a call to checkAccessPermissions('SPIN', 'IncyWincy', undef, 'ThisTopic', 'ThatWeb', undef) will return true.
>
>
in ThatWeb.ThisTopic, then a call to checkAccessPermission('SPIN', 'IncyWincy', undef, 'ThisTopic', 'ThatWeb', undef) will return true.
  Since: TWiki::Plugins::VERSION 1.000 (27 Feb 2001)
Line: 912 to 913
 release, or can be inspected in the lib/TWiki/Meta.pm file.

This method ignores topic access permissions. You should be careful to use

Changed:
<
<
checkAccessPermissions to ensure the current user has read access to the
>
>
checkAccessPermission to ensure the current user has read access to the
 topic.

Since: TWiki::Plugins::VERSION 1.000 (7 Dec 2002)

Line: 1087 to 1088
 file. See the documentation on TWiki templates for more information.
Changed:
<
<

writeHeader( $query, $contentLength )

>
>

writeHeader( )

 
Changed:
<
<
Prints a basic content-type HTML header for text/html to standard out
  • $query - CGI query object. If not given, the default CGI query will be used (optional, in most cases you should not pass this parameter)
  • $contentLength - Length of content (optional, in most cases you should not pass this parameter)
Return: none
>
>
Print a basic content-type HTML header for text/html to standard out. No return value.

Note: In TWiki versions earlier than TWiki::Plugins::VERSION 1.3, this function used to have $query and $contentLength parameters. Both were marked "you should not pass this parameter".

  Since: TWiki::Plugins::VERSION 1.000 (7 Dec 2002)
Line: 1132 to 1132
 Since: TWiki::Plugins::VERSION 1.000 (7 Dec 2002)
Changed:
<
<

addToHEAD( $id, $header )

>
>

addToHEAD( $id, $header, $requires )

  Adds $header to the HTML header (the tag). This is useful for Plugins that want to include some javascript custom css.
  • $id - Unique ID to prevent the same HTML from being duplicated. Plugins should use a prefix to prevent name clashes (e.g EDITTABLEPLUGIN_JSCALENDAR)
  • $header - the HTML to be added to the section. The HTML must be valid in a HEAD tag - no checks are performed.
Added:
>
>
  • requires optional, comma-separated list of id's of other head blocks this one depends on.
  All TWiki variables present in $header will be expanded before being inserted into the section.
Line: 1147 to 1148
  example:
Changed:
<
<
TWiki::Func::addToHEAD('PATTERN_STYLE','')
>
>
TWiki::Func::addToHEAD('PATTERN_STYLE','');
 
Line: 1542 to 1543
 
Added:
>
>

buildWikiWord( $text ) -> $text

Converts arbitrary text to a WikiWord.

  • $pre - Arbitrary Text
Return: $text

Since: TWiki::Plugins::VERSION 1.3 (18 Jan 2010)

 

spaceOutWikiWord( $word, $sep ) -> $text

Spaces out a wiki word by inserting a string (default: one space) between each word component.

Line: 1786 to 1796
  Since: TWiki::Plugins::VERSION 1.025 (01 Aug 2004)
Added:
>
>

TWiki API History

TWiki-2001-09-01 (Athens Release)

$TWiki::Plugins::VERSION 1.000

EmptyPlugin.pm

  • commonTagsHandler($text, $topic, $web)
  • endRenderingHandler($text)
  • outsidePREHandler($text)
  • insidePREHandler($text)
  • startRenderingHandler($text, $web)

Func.pm

  • checkAccessPermission($type, $login, $topicText, $topicName, $webName) -> $boolean
  • expandCommonVariables($text, $topic, $web) -> $text
  • extractNameValuePair($attrs, $name) -> $value
  • formatGmTime($time) -> $text
  • getCgiQuery() -> $query
  • getDataDir() -> $dir
  • getDefaultUserName() -> $loginName
  • getMainWebname() -> $name
  • getOopsUrl($web, $topic, $template, @theParams) -> $url
  • getPreferencesFlag($key) -> $boolean
  • getPreferencesValue($key, $web) -> $value
  • getPublicWebList() -> @webs
  • getPubDir() -> $dir
  • getPubUrlPath() -> $path
  • getRevisionInfo($webName, $topic, $rev, $attachment) -> ($date, $user, $rev, $comment)
  • getScriptUrl($web, $topic, $script) -> $url
  • getScriptUrlPath() -> $path
  • getSessionValue($key) -> $value
  • getSkin() -> $skin
  • getTopicList($web) -> @topics
  • getTwikiWebname() -> $name
  • getUrlHost() -> $host
  • getViewUrl($web, $topic) -> $url
  • getWikiName() -> $wikiName
  • getWikiUserName($text) -> $wikiName
  • getWikiToolName() -> $name
  • internalLink($preamble, $web, $topic, $linkText, $anchor, $createLink) -> $text
  • isGuest() -> $boolean
  • permissionsSet($web) -> $boolean
  • readFile($filename) -> $text
  • readTemplate($name, $skin) -> $text
  • readTopic($webName, $topic) -> ($meta, $text)
  • redirectCgiQuery($query, $url)
  • renderText($text, $web) -> $text
  • saveFile($filename, $text)
  • setSessionValue($key, $value)
  • topicExists($web, $topic) -> $boolean
  • userToWikiName($user, $dontAddWeb) -> $wikiName
  • webExists($web) -> $boolean
  • wikiToUserName($wiki) -> $loginName
  • writeDebug($text)
  • writeHeader()
  • writeWarning($text)

TWiki-2003-02-01 (Beijing Release)

$TWiki::Plugins::VERSION 1.010

EmptyPlugin.pm

  • afterEditHandler($text, $topic, $web)
  • beforeEditHandler($text, $topic, $web)
  • beforeSaveHandler($text, $topic, $web)
  • initializeUserHandler($loginName, $url, $pathInfo)
  • redirectCgiQueryHandler($query, $url)
  • registrationHandler($web, $wikiName, $loginName)
  • writeHeaderHandler($query)

Func.pm

  • checkTopicEditLock($web, $topic) ->($oopsUrl, $loginName, $unlockTime)
  • readTopicText($web, $topic, $rev, $ignorePermissions) -> $text
  • saveTopicText($web, $topic, $text, $ignorePermissions, $dontNotify) -> $oopsUrl
  • setTopicEditLock($web, $topic, $lock) -> $oopsUrl

TWiki-2004-09-02 (Cairo Release)

$TWiki::Plugins::VERSION 1.025

EmptyPlugin.pm

  • afterCommonTagsHandler($text, $topic, $web)
  • afterSaveHandler($text, $topic, $web, $error)
  • beforeCommonTagsHandler($text, $topic, $web)
  • earlyInitPlugin()

Func.pm

  • afterAttachmentSaveHandler(\%attrHash, $topic, $web, $error)
  • beforeAttachmentSaveHandler(\%attrHash, $topic, $web)
  • checkDependencies($moduleName, $dependenciesRef) -> $error
  • extractParameters($attr) -> %params
  • formatTime($time, $format, $timezone) -> $text
  • getPluginPreferencesFlag($key) -> $boolean
  • getPluginPreferencesValue($key) -> $value
  • getRegularExpression($regexName) -> $pattern

TWiki-4.0.0 (Dakar Release)

$TWiki::Plugins::VERSION 1.1

EmptyPlugin.pm

  • mergeHandler($diff, $old, $new, \%info) -> $text
  • modifyHeaderHandler(\%headers, $query)
  • postRenderingHandler($text)
  • preRenderingHandler($text, \%map)
  • renderFormFieldForEditHandler($name, $type, $size, $value, $attributes, $possibleValues) -> $html
  • renderWikiWordHandler($linkText, $hasExplicitLinkLabel, $web, $topic) -> $linkText

  • endRenderingHandler($text)
  • startRenderingHandler($text, $web)

Func.pm

  • addToHEAD($id, $header)
  • attachmentExists($web, $topic, $attachment) -> $boolean
  • clearSessionValue($key) -> $boolean
  • checkDependencies($moduleName, $dependenciesRef) -> $error
  • createWeb($newWeb, $baseWeb, $opts)
  • expandTemplate($def ) -> $string
  • expandVariablesOnTopicCreation($text) -> $text
  • getContext() -> \%hash
  • getListOfWebs($filter) -> @webs
  • getScriptUrl($web, $topic, $script, @params) -> $url
  • getRevisionAtTime($web, $topic, $time) -> $rev
  • getWorkArea($pluginName) -> $directorypath
  • isValidWikiWord($text) -> $boolean
  • loadTemplate($name, $skin, $web) -> $text
  • moveAttachment($web, $topic, $attachment, $newWeb, $newTopic, $newAttachment)
  • moveTopic($web, $topic, $newWeb, $newTopic)
  • moveWeb($oldName, $newName)
  • normalizeWebTopicName($web, $topic) ->($web, $topic)
  • readAttachment($web, $topic, $name, $rev) -> $data
  • registerRESTHandler($alias, \&fn,)
  • registerTagHandler($var, \&fn, $syntax)
  • saveAttachment($web, $topic, $attachment, $opts)
  • saveTopic($web, $topic, $meta, $text, $options) -> $error
  • searchInWebContent($searchString, $web, \@topics, \%options) -> \%map
  • sendEmail($text, $retries) -> $error
  • wikiToEmail($wikiName) -> $email
  • writeHeader($query, $contentLength)

  • checkDependencies($moduleName, $dependenciesRef) -> $error
  • formatGmTime($time, $format) -> $text
  • getDataDir() -> $dir
  • getOopsUrl( $web, $topic, $template, @params ) -> $url
  • getPubDir() -> $dir
  • getPublicWebList() -> @webs
  • getScriptUrlPath() -> $path

TWiki-4.0.1 (Dakar Patch Release)

$TWiki::Plugins::VERSION 1.1

EmptyPlugin.pm

  • afterSaveHandler($text, $topic, $web, $error, $meta)
  • beforeSaveHandler($text, $topic, $web, $meta)

Func.pm

TWiki-4.1 (Edinburgh Release)

$TWiki::Plugins::VERSION 1.11

EmptyPlugin.pm

  • afterRenameHandler($oldWeb, $oldTopic, $oldAttachment, $newWeb, $newTopic, $newAttachment)

Func.pm

No changes

TWiki-4.2 (Freetown Release)

$TWiki::Plugins::VERSION 1.2

EmptyPlugin.pm

  • afterCommonTagsHandler($text, $topic, $web, $meta)
  • beforeCommonTagsHandler($text, $topic, $web, $meta)
  • commonTagsHandler($text, $topic, $web, $included, $meta)

Func.pm

  • decodeFormatTokens($str) -> $unencodedString
  • eachChangeSince($web, $time) -> $iterator
  • eachGroup() -> $iterator
  • eachGroupMember($group) -> $iterator
  • eachMembership($wikiname) -> $iterator
  • eachUser() -> $iterator
  • emailToWikiNames($email, $dontAddWeb) -> @wikiNames
  • expandCommonVariables($text, $topic, $web, $meta) -> $text
  • getCanonicalUserID( $user ) -> $cUID
  • getExternalResource($url) -> $response
  • getSessionKeys() -> @keys
  • isAnAdmin($login) -> $boolean
  • isGroup($group) -> $boolean
  • isGroupMember($group, $login) -> $boolean
  • isTrue($value, $default) -> $boolean
  • popTopicContext()
  • pushTopicContext($web, $topic)
  • sanitizeAttachmentName($fname) -> ($fileName, $origName)
  • setPreferencesValue($name, $val)
  • spaceOutWikiWord($word, $sep) -> $text
  • wikiNameToEmails($wikiname) -> @emails
  • permissionsSet($web) -> $boolean
  • getOopsUrl( $web, $topic, $template, $param1, $param2, $param3, $param4 ) -> $url

TWiki-4.3 (Georgetown Release)

$TWiki::Plugins::VERSION 1.2

EmptyPlugin.pm

No changes

Func.pm

No changes

TWiki-5.0 (Helsinki Release)

$TWiki::Plugins::VERSION 1.3

EmptyPlugin.pm

No changes

Func.pm

  • buildWikiWord( $text ) -> $text
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.TWikiFuncDotPm.