Line: 25 to 25 | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
$TWiki::Plugins::VERSION . The 'Since' field in the function
documentation refers to $TWiki::Plugins::VERSION . | |||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||
< < | Notes on use of $TWiki::Plugins::VERSION (from 1.2 forwards): | ||||||||||||||||||||||||||
> > | Notes on use of $TWiki::Plugins::VERSION 6.00 and later: | ||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
Line: 112 to 104 | |||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||
< < | @hea | ||||||||||||||||||||||||||
> > | getExternalResource( $url, \@headers, \%params ) -> $response | ||||||||||||||||||||||||||
Get whatever is at the other end of a URL (using an HTTP GET request). Will
only work for encrypted protocols such as https if the LWP CPAN module is | |||||||||||||||||||||||||||
Line: 121 to 113 | |||||||||||||||||||||||||||
Note that the $url may have an optional user and password, as specified by
the relevant RFC. Any proxy set in configure is honored. | |||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||
< < | Optional headers may be supplied of form 'name1', 'value1', 'name2', 'value2'. Do not add a User-Agent header, it will be added. | ||||||||||||||||||||||||||
> > | Optional parameters may be supplied:
%params . See CPAN:LWP::UserAgent![]()
LWP .
Example:
my $response = getExternalResource($url, ['Cache-Control' => 'max-age=0'], {timeout => 10}); | ||||||||||||||||||||||||||
The $response is an object that is known to implement the following subset of | |||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||
< < | the methods of LWP::Response . It may in fact be an LWP::Response object, | ||||||||||||||||||||||||||
> > | the methods of HTTP::Response . It may in fact be an HTTP::Response object, | ||||||||||||||||||||||||||
but it may also not be if LWP is not available, so callers may only assume
the following subset of methods is available:
| |||||||||||||||||||||||||||
Line: 163 to 184 | |||||||||||||||||||||||||||
Since: TWiki::Plugins::VERSION 1.2 | |||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||
> > | Note: The optional parameters \@headers and \%params were added in
TWiki::Plugins::VERSION 6.00
postExternalResource( $url, $text, \@headers, \%params ) -> $responseThis method is essentially the same asgetExternalResource() except that it uses
an HTTP POST method and that the additional $text parameter is required.
The $text is sent to the server as the body content of the HTTP request.
See getExternalResource() for more details.
Since: TWiki::Plugins::VERSION 6.00 | ||||||||||||||||||||||||||
getCgiQuery( ) -> $query | |||||||||||||||||||||||||||
Line: 307 to 344 | |||||||||||||||||||||||||||
Since: TWiki::Plugins::VERSION 1.000 (7 Dec 2002)
| |||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
Line: 345 to 382 | |||||||||||||||||||||||||||
Since: TWiki::Plugins::VERSION 1.000 (7 Dec 2002)
| |||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
Line: 529 to 566 | |||||||||||||||||||||||||||
isGuest( ) -> $boolean | |||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||
< < | Test if logged in user is a guest (TWikiGuest) | ||||||||||||||||||||||||||
> > | Test if logged in user is a guest (TWikiGuest) | ||||||||||||||||||||||||||
Since: TWiki::Plugins::VERSION 1.000 (7 Dec 2002) | |||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||
< < | isAnAdmin( $id ) -> $boolean | ||||||||||||||||||||||||||
> > | isAnAdmin( $user, $topic, $web ) -> $boolean | ||||||||||||||||||||||||||
Find out if the user is an admin or not. If the user is not given, the currently logged-in user is assumed. | |||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||
Since: TWiki::Plugins::VERSION 1.2 | |||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||
> > | Note: The parameters $topic and $web were added in TWiki::Plugins::VERSION 6.00 | ||||||||||||||||||||||||||
isGroupMember( $group, $id ) -> $boolean | |||||||||||||||||||||||||||
Line: 661 to 705 | |||||||||||||||||||||||||||
earlier TWiki releases. 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 checkAccessPermission('SPIN', 'IncyWincy', undef, 'ThisTopic', 'ThatWeb', undef) will return true .
Since: TWiki::Plugins::VERSION 1.000 (27 Feb 2001) | |||||||||||||||||||||||||||
Line: 798 to 842 | |||||||||||||||||||||||||||
} | |||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||
> > | Since: TWiki::Plugins::VERSION 1.2 | ||||||||||||||||||||||||||
@topics | |||||||||||||||||||||||||||
Line: 1086 to 1132 | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||
$opts may include:
| |||||||||||||||||||||||||||
Line: 1173 to 1220 | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||
< < | Return: expanded template text (what's left after removal of all %TMPL:DEF% statements) | ||||||||||||||||||||||||||
> > | Return: expanded template text (what's left after removal of all %TMPL:DEF% statements) | ||||||||||||||||||||||||||
Since: TWiki::Plugins::VERSION 1.1 | |||||||||||||||||||||||||||
Line: 1188 to 1235 | |||||||||||||||||||||||||||
expandTemplate( $def ) -> $string | |||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||
< < | Do a , only expanding the template (not expanding any variables other than %TMPL) | ||||||||||||||||||||||||||
> > | Do a %TMPL:P{$def}%, only expanding the template (not expanding any variables other than %TMPL) | ||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||
< < | A template is defined using a %TMPL:DEF% statement in a template | ||||||||||||||||||||||||||
> > | A template is defined using a %TMPL:DEF% statement in a template | ||||||||||||||||||||||||||
file. See the documentation on TWiki templates for more information. | |||||||||||||||||||||||||||
Line: 1209 to 1256 | |||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||
< < | redirectCgiQuery( $query, $url, $passthru ) | ||||||||||||||||||||||||||
> > | redirectCgiQuery( $query, $url, $passthru, $viaCache ) | ||||||||||||||||||||||||||
Redirect to URL
| |||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||
Return: none | |||||||||||||||||||||||||||
Line: 1248 to 1296 | |||||||||||||||||||||||||||
addToHEAD( $id, $header, $requires )Adds$header to the HTML header (the tag). | |||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||
< < | This is useful for Plugins that want to include some javascript custom css. | ||||||||||||||||||||||||||
> > | This is useful for Plugins that want to include some javascript and custom css. | ||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||
All TWiki variables present in $header will be expanded before being inserted into the section. | |||||||||||||||||||||||||||
Line: 1357 to 1405 | |||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||
< < | expandVariablesOnTopicCreation ( $text ) -> $text | ||||||||||||||||||||||||||
> > | expandVariablesOnTopicCreation ( $text, $web, $topic ) -> $text | ||||||||||||||||||||||||||
Expand the limited set of variables that are always expanded during topic creation
| |||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||
Return: text with variables expanded Since: TWiki::Plugins::VERSION 1.1 | |||||||||||||||||||||||||||
Line: 1478 to 1528 | |||||||||||||||||||||||||||
(ie, with the name of the function instead of the alias) will not work. | |||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||
> > |
registerExternalHTTPHandler( \&fn )Should only be called from initPlugin. Adds a function to modify all the HTTP requests to any external resources.
sub handler(\%session, $url) -> (\@headers, \%params)where:
\@headers and \%params are added to the request in the same
manner as getExternalResource , except that \%params will not override any
entries that have been set earlier.
All the params explicitly given by the caller of getExternalResource or
postExternalResource will have the highest precedence.
Example:
sub initPlugin { TWiki::Func::registerExternalHTTPHandler( \&handleExternalHTTPRequest ); } sub handleExternalHTTPRequest { my ($session, $url) = @_; my @headers; my %params; # Add any necessary @headers and %params push @headers, 'X-Example-Header' => 'Value'; $params{timeout} = 5; # Return refs to both return (\@headers, \%params); }Since: TWiki::Plugins::VERSION 6.00 | ||||||||||||||||||||||||||
decodeFormatTokens($str) -> $unencodedString | |||||||||||||||||||||||||||
Line: 1501 to 1596 | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||
< < | Note thath $quot, $percnt and $dollar all work *even if they are followed by | ||||||||||||||||||||||||||
> > | Note that $quot, $aquot, $percnt and $dollar all work *even if they are followed by | ||||||||||||||||||||||||||
alphanumeric characters*. You have been warned! Since: TWiki::Plugins::VERSION 1.2 | |||||||||||||||||||||||||||
Line: 1587 to 1685 | |||||||||||||||||||||||||||
Since: TWiki::Plugins::VERSION 1.000 (07 Dec 2002) | |||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||
> > |
Read-only and Mirror WebsThe following functions are for ReadOnlyAndMirrorWebs.getSiteName() -> $siteNameReturns the current site name if it's defined. Otherwise returns the null string.getContentMode( $web ) -> $contentModeReturns the content mode of the specified $web. Please read ReadOnlyAndMirrorWebs about content mode. Since: TWiki::Plugins::VERSION 6.00webWritable( $web ) -> $booleanChecks if the web is wriable on this site - if it's master or local. Returns true if it's writable. Returns false otherwise. Since: TWiki::Plugins::VERSION 6.00Using multiple disksThe following functions are for UsingMultipleDisks.@diskIDs
Returns IDs of disks used by TWiki. An disk ID is "" (a null string) or a decimal number without leading 0.
Since: TWiki::Plugins::VERSION 6.00
| ||||||||||||||||||||||||||
General Utilities | |||||||||||||||||||||||||||
Line: 1656 to 1812 | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||
< < | Note that hierarchical web names (SubWeb) are only available if hierarchical webs are enabled in configure . | ||||||||||||||||||||||||||
> > | Note that hierarchical web names (Web.SubWeb) are only available if hierarchical webs are enabled in configure . | ||||||||||||||||||||||||||
The symbols %USERSWEB%, %SYSTEMWEB% and %DOCWEB% can be used in the input to represent the web names set in $cfg{UsersWebName} and $cfg{SystemWebName}. For example:
| |||||||||||||||||||||||||||
Line: 1724 to 1880 | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||
Return: none Since: TWiki::Plugins::VERSION 1.4 | |||||||||||||||||||||||||||
Line: 1742 to 1898 | |||||||||||||||||||||||||||
if( defined &TWiki::Func::writeLog ) { # use writeLog | |||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||
< < | TWiki::Func::writeLog( $web, $topic, 'myevent', $extra ); | ||||||||||||||||||||||||||
> > | TWiki::Func::writeLog( 'myevent', $extra, $web, $topic ); | ||||||||||||||||||||||||||
} else { # deprecated code if plugin is used in older TWiki releases $TWiki::Plugins::VERSION > 1.1 | |||||||||||||||||||||||||||
Line: 1757 to 1913 | |||||||||||||||||||||||||||
Format the time in seconds into the desired time string
| |||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||
$text Formatted time string | |||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||||
> > | Note: If you used the removed formatGmTime, add a third parameter 'gmtime' | ||||||||||||||||||||||||||
Since: TWiki::Plugins::VERSION 1.020 (26 Feb 2004) | |||||||||||||||||||||||||||
Line: 1811 to 1968 | |||||||||||||||||||||||||||
extractNameValuePair( $attr, $name ) -> $value | |||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||
< < | Extract a named or unnamed value from a variable parameter string - Note: | Function TWiki::Func::extractParameters is more efficient for extracting several parameters | ||||||||||||||||||||||||||
> > | Extract a named or unnamed value from a variable parameter string. | ||||||||||||||||||||||||||
$value Extracted value | |||||||||||||||||||||||||||
Line: 1827 to 1983 | |||||||||||||||||||||||||||
my $val1 = TWiki::Func::extractNameValuePair( $text, "name1" ); my $val2 = TWiki::Func::extractNameValuePair( $text, "name2" ); | |||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||
> > | Note: Function TWiki::Func::extractParameters is more efficient for extracting several parameters
entityEncode( $text, $extra ) -> $textEntity encode text.
$text Entity encoded text
Since: TWiki::Plugins::VERSION 6.00
Escape special characters to HTML numeric entities. This is not a generic
encoding, it is tuned specifically for use in TWiki.
HTML4.0 spec:
"Certain characters in HTML are reserved for use as markup and must be
escaped to appear literally. The "<" character may be represented with
an entity, <. Similarly, ">"
is escaped as >, and "&" is escaped
as &. If an attribute value contains a
double quotation mark and is delimited by double quotation marks, then the
quote should be escaped as ".
Other entities exist for special characters that cannot easily be entered
with some keyboards..."
This method encodes HTML special and any non-printable ASCII
characters (except for \n and \r) using numeric entities.
FURTHER this method also encodes characters that are special in TWiki
meta-language.
$extras is an optional param that may be used to include additional
characters in the set of encoded characters. It should be a string
containing the additional chars.
entityDecode( $text ) -> $textDecode all numeric entities (e.g. {). Does not decode named entities such as & (use HTML::Entities for that)
$text Entity decoded text
Since: TWiki::Plugins::VERSION 6.00
urlEncode( $text ) -> $textURL encode text, mainly used to encode URL parameters.
$text URL encoded text
Since: TWiki::Plugins::VERSION 6.00
Encoding is done by converting characters that are illegal in
URLs to their %NN equivalents. This method is used for encoding
strings that must be embedded verbatim in URLs; it cannot
be applied to URLs themselves, as it escapes reserved
characters such as = and ?.
RFC 1738, Dec. '94:
...Only alphanumerics [0-9a-zA-Z], the special characters $-_.+!*'(), and reserved characters used for their reserved purposes may be used unencoded within a URL.Reserved characters are $&+,/:;=?@ - these are also encoded by this method. This URL-encoding handles all character encodings including ISO-8859-*, KOI8-R, EUC-* and UTF-8. This may not handle EBCDIC properly, as it generates an EBCDIC URL-encoded URL, but mainframe web servers seem to translate this outbound before it hits browser - see CGI::Util::escape for another approach. urlDecode( $text ) -> $textURL decode text, mainly used to decode URL parameters.
$text URL decoded text
Since: TWiki::Plugins::VERSION 6.00 | ||||||||||||||||||||||||||
Deprecated functions | |||||||||||||||||||||||||||
Line: 2191 to 2440 | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||
> > | TWiki-6.0 (Jerusalem Release)$TWiki::Plugins::VERSION 6.00EmptyPlugin.pmNo changesFunc.pm
|