Changeset 812 for trunk/core/lib/Foswiki/Func.pm
- Timestamp:
- 11/19/08 16:05:12 (4 years ago)
- File:
-
- 1 edited
-
trunk/core/lib/Foswiki/Func.pm (modified) (46 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/lib/Foswiki/Func.pm
r809 r812 8 8 %STARTINCLUDE% 9 9 10 _Official list of stable TWiki functions for Plugin developers_10 _Official list of stable Foswiki functions for Plugin developers_ 11 11 12 12 This module defines official functions that [[%SYSTEMWEB%.Plugins][Plugins]] 13 can use to interact with the TWiki engine and content.14 15 Refer to TWiki.EmptyPlugin andlib/Foswiki/Plugins/EmptyPlugin.pm for a template Plugin and documentation on how to write a Plugin.13 can use to interact with the Foswiki engine and content. 14 15 Refer to lib/Foswiki/Plugins/EmptyPlugin.pm for a template Plugin and documentation on how to write a Plugin. 16 16 17 17 Plugins should *only* use functions published in this module. If you use 18 functions in other TWiki libraries you might create a security hole and19 you will probably need to change your Plugin when you upgrade TWiki.18 functions in other Foswiki libraries you might create a security hole and 19 you will probably need to change your Plugin when you upgrade Foswiki. 20 20 21 21 Deprecated functions will still work in older code, though they should … … 26 26 of the Foswiki::Plugins module. 27 27 28 Notes on use of =$Foswiki::Plugins::VERSION= (from TWiki 1.2 forwards):28 Notes on use of =$Foswiki::Plugins::VERSION=: 29 29 * If the *major* version (e.g. =1.=) is the same then any plugin coded 30 30 to use any *earlier* revision of the =1.= API will still work. No … … 329 329 330 330 The context is a set of identifiers that are set 331 during specific phases of TWikiprocessing. For example, each of331 during specific phases of processing. For example, each of 332 332 the standard scripts in the 'bin' directory each has a context 333 333 identifier - the view script has 'view', the edit script has 'edit' … … 380 380 * =$web= - new web 381 381 * =$topic= - new topic 382 Change the TWiki context so it behaves as if it was processing =$web.$topic=382 Change the Foswiki context so it behaves as if it was processing =$web.$topic= 383 383 from now on. All the preferences will be reset to those of the new topic. 384 384 Note that if the new topic is not readable by the logged in user due to … … 420 420 ---+++ popTopicContext() 421 421 422 Returns the TWiki context to the state it was in before the422 Returns the Foswiki context to the state it was in before the 423 423 =pushTopicContext= was called. 424 424 … … 447 447 ---+++ getPreferencesValue( $key, $web ) -> $value 448 448 449 Get a preferences value from TWiki or from a Plugin449 Get a preferences value from Foswiki or from a Plugin 450 450 * =$key= - Preferences key 451 451 * =$web= - Name of web, optional. Current web if not specified; does not apply to settings of Plugin topics … … 463 463 * =my $webColor = Foswiki::Func::getPreferencesValue( 'WEBBGCOLOR', 'Sandbox' );= 464 464 465 *NOTE:* As of TWiki4.1, if =$NO_PREFS_IN_TOPIC= is enabled in the plugin, then465 *NOTE:* If =$NO_PREFS_IN_TOPIC= is enabled in the plugin, then 466 466 preferences set in the plugin topic will be ignored. 467 467 … … 492 492 *Since:* Foswiki::Plugins::VERSION 1.021 (27 Mar 2004) 493 493 494 *NOTE:* As of TWiki4.1, if =$NO_PREFS_IN_TOPIC= is enabled in the plugin, then494 *NOTE:* If =$NO_PREFS_IN_TOPIC= is enabled in the plugin, then 495 495 preferences set in the plugin topic will be ignored. 496 496 … … 510 510 ---+++ getPreferencesFlag( $key, $web ) -> $value 511 511 512 Get a preferences flag from TWiki or from a Plugin512 Get a preferences flag from Foswiki or from a Plugin 513 513 * =$key= - Preferences key 514 514 * =$web= - Name of web, optional. Current web if not specified; does not apply to settings of Plugin topics … … 522 522 * =my $showHelp = Foswiki::Func::getPreferencesFlag( "MYPLUGIN_SHOWHELP" );= 523 523 524 *NOTE:* As of TWiki4.1, if =$NO_PREFS_IN_TOPIC= is enabled in the plugin, then524 *NOTE:* If =$NO_PREFS_IN_TOPIC= is enabled in the plugin, then 525 525 preferences set in the plugin topic will be ignored. 526 526 … … 546 546 *Since:* Foswiki::Plugins::VERSION 1.021 (27 Mar 2004) 547 547 548 *NOTE:* As of TWiki4.1, if =$NO_PREFS_IN_TOPIC= is enabled in the plugin, then548 *NOTE:* If =$NO_PREFS_IN_TOPIC= is enabled in the plugin, then 549 549 preferences set in the plugin topic will be ignored. 550 550 … … 579 579 =pod 580 580 581 ---+++ getWikiToolName( ) -> $name582 583 Get toolname as defined in TWiki.cfg584 585 Return: =$name= Name of tool, e.g. ='TWiki'=586 587 *Since:* Foswiki::Plugins::VERSION 1.000 (27 Feb 2001)588 589 =cut590 591 sub getWikiToolName {592 return $Foswiki::cfg{WikiToolName};593 }594 595 =pod596 597 ---+++ getMainWebname( ) -> $name598 599 Get name of Main web as defined in TWiki.cfg600 601 Return: =$name= Name, e.g. ='Main'=602 603 *Since:* Foswiki::Plugins::VERSION 1.000 (27 Feb 2001)604 605 =cut606 607 sub getMainWebname {608 return $Foswiki::cfg{UsersWebName};609 }610 611 =pod612 613 ---+++ getTwikiWebname( ) -> $name614 615 Get name of TWiki documentation web as defined in TWiki.cfg616 617 Return: =$name= Name, e.g. ='TWiki'=618 619 *Since:* Foswiki::Plugins::VERSION 1.000 (27 Feb 2001)620 621 =cut622 623 sub getTwikiWebname {624 return $Foswiki::cfg{SystemWebName};625 }626 627 =pod628 629 581 ---++ User Handling and Access Control 630 582 ---+++ getDefaultUserName( ) -> $loginName … … 646 598 * =$user= can be a login, wikiname or web.wikiname 647 599 Return the cUID of the specified user. A cUID is a unique identifier which 648 is assigned by TWiki for each user.600 is assigned by Foswiki for each user. 649 601 BEWARE: While the default TopicUserMapping uses a cUID that looks like a user's 650 602 LoginName, some characters are modified to make them compatible with rcs. … … 776 728 ---+++ userToWikiName( $loginName, $dontAddWeb ) -> $wikiName 777 729 Translate a login name to a Wiki name 778 * =$loginName= - Login name, e.g. ='jdoe'=. Since TWiki 4.2.1 this may730 * =$loginName= - Login name, e.g. ='jdoe'=. This may 779 731 also be a wiki name. This will normally be transparent, but may be 780 732 relevant if you have login names that are also valid wiki names. … … 845 797 undef, returns the registered email addresses for the logged-in user. 846 798 847 Since TWiki 4.2.1,$user may also be a login name, or the name of a group.799 $user may also be a login name, or the name of a group. 848 800 849 801 *Since:* Foswiki::Plugins::VERSION 1.2 … … 1029 981 ---+++ isGroup( $group ) -> $boolean 1030 982 1031 Checks if =$group= is the name of a group known to TWiki.983 Checks if =$group= is the name of a user group. 1032 984 1033 985 =cut … … 1079 1031 [[%SYSTEMWEB%.AccessControl]] rules 1080 1032 * =$type= - Access type, required, e.g. ='VIEW'=, ='CHANGE'=. 1081 * =$id= - WikiName of remote user, required, e.g. =" PeterThoeny"=. From1082 TWiki 4.2.1,$id may also be a login name.1033 * =$id= - WikiName of remote user, required, e.g. ="RickShaw"=. 1034 $id may also be a login name. 1083 1035 If =$id= is '', 0 or =undef= then access is *always permitted*. 1084 1036 * =$text= - Topic text, optional. If 'perl false' (undef, 0 or ''), … … 1087 1039 1 You are setting different access controls in the text to those defined 1088 1040 in the stored topic, 1089 1 You already have the topic text in hand, and want to help TWikiavoid1041 1 You already have the topic text in hand, and want to help avoid 1090 1042 having to read it again, 1091 1043 1 You are providing a =$meta= parameter. … … 1100 1052 1101 1053 *Note* the weird parameter order is due to compatibility constraints with 1102 earlier TWikireleases.1054 earlier releases. 1103 1055 1104 1056 *Tip* if you want, you can use this method to check your own access control types. For example, if you: … … 1936 1888 list of loaded templates, overwriting any previous definition. 1937 1889 1938 How TWiki searches for templates is described in SkinTemplates.1890 How Foswiki searches for templates is described in SkinTemplates. 1939 1891 1940 1892 If template text is found, extracts include statements and fully expands them. … … 1958 1910 1959 1911 A template is defined using a %TMPL:DEF% statement in a template 1960 file. See the documentation on TWiki templates for more information.1912 file. See the documentation on Foswiki templates for more information. 1961 1913 1962 1914 =cut … … 2002 1954 The =$passthru= parameter allows you to pass the parameters that were passed 2003 1955 to the current query on to the target URL, as long as it is another URL on the 2004 same TWiki installation. If =$passthru= is set to a true value, then TWiki1956 same installation. If =$passthru= is set to a true value, then Foswiki 2005 1957 will save the current URL parameters, and then try to restore them on the 2006 1958 other side of the redirect. Parameters are stored on the server in a cache … … 2018 1970 </verbatim> 2019 1971 =$passthru= does nothing if =$url= does not point to a script in the current 2020 TWiki installation.1972 Foswiki installation. 2021 1973 2022 1974 *Since:* Foswiki::Plugins::VERSION 1.000 (7 Dec 2002) … … 2039 1991 * =$header= - the HTML to be added to the <head> section. The HTML must be valid in a HEAD tag - no checks are performed. 2040 1992 * =requires= optional, comma-separated list of id's of other head blocks this one depends on. 2041 2042 All TWiki variables present in =$header= will be expanded before being inserted into the =<head>= section.1993 1994 All macros present in =$header= will be expanded before being inserted into the =<head>= section. 2043 1995 2044 1996 Note that this is _not_ the same as the HTTP header, which is modified through the Plugins =modifyHeaderHandler=. … … 2089 2041 ---+++ renderText( $text, $web ) -> $text 2090 2042 2091 Render text from T Wiki markupinto XHTML as defined in [[%SYSTEMWEB%.TextFormattingRules]]2043 Render text from TML into XHTML as defined in [[%SYSTEMWEB%.TextFormattingRules]] 2092 2044 * =$text= - Text to render, e.g. ='*bold* text and =fixed font='= 2093 2045 * =$web= - Web name, optional, e.g. ='Main'=. The current web is taken if missing … … 2110 2062 2111 2063 Render topic name and link label into an XHTML link. Normally you do not need to call this funtion, it is called internally by =renderText()= 2112 * =$pre= - Text occuring before the TWikilink syntax, optional2064 * =$pre= - Text occuring before the link syntax, optional 2113 2065 * =$web= - Web name, required, e.g. ='Main'= 2114 2066 * =$topic= - Topic name to link to, required, e.g. ='WebNotify'= … … 2182 2134 returns a single email address, where a user may in fact have several. 2183 2135 2184 Since TWiki 4.2.1,$wikiName may also be a login name.2136 $wikiName may also be a login name. 2185 2137 2186 2138 =cut … … 2238 2190 ---++ Special handlers 2239 2191 2240 Special handlers can be defined to make functions in plugins behave as if they were built-in to TWiki.2192 Special handlers can be defined to make functions in plugins behave as if they were built-in. 2241 2193 2242 2194 =cut … … 2248 2200 Should only be called from initPlugin. 2249 2201 2250 Register a function to handle a simple variable. Handles both %<nop>VAR% and %<nop>VAR{...}%. Registered variables are treated the same as TWiki internal variables, and are expanded at the same time. This is a _lot_ more efficient than using the =commonTagsHandler=.2202 Register a function to handle a simple variable. Handles both %<nop>VAR% and %<nop>VAR{...}%. Registered variables are treated the same as internal macros, and are expanded at the same time. This is a _lot_ more efficient than using the =commonTagsHandler=. 2251 2203 * =$var= - The name of the variable, i.e. the 'MYVAR' part of %<nop>MYVAR%. The variable name *must* match /^[A-Z][A-Z0-9_]*$/ or it won't work. 2252 2204 * =\&fn= - Reference to the handler function. 2253 * =$syntax= can be 'classic' (the default) or 'context-free'. 'classic' syntax is appropriate where you want the variable to support classic TWikisyntax i.e. to accept the standard =%<nop>MYVAR{ "unnamed" param1="value1" param2="value2" }%= syntax, as well as an unquoted default parameter, such as =%<nop>MYVAR{unquoted parameter}%=. If your variable will only use named parameters, you can use 'context-free' syntax, which supports a more relaxed syntax. For example, %MYVAR{param1=value1, value 2, param3="value 3", param4='value 5"}%2205 * =$syntax= can be 'classic' (the default) or 'context-free'. 'classic' syntax is appropriate where you want the variable to support classic syntax i.e. to accept the standard =%<nop>MYVAR{ "unnamed" param1="value1" param2="value2" }%= syntax, as well as an unquoted default parameter, such as =%<nop>MYVAR{unquoted parameter}%=. If your variable will only use named parameters, you can use 'context-free' syntax, which supports a more relaxed syntax. For example, %MYVAR{param1=value1, value 2, param3="value 3", param4='value 5"}% 2254 2206 2255 2207 *Since:* Foswiki::Plugins::VERSION 1.1 … … 2260 2212 </verbatim> 2261 2213 where: 2262 * =\%session= - a reference to the TWikisession object (may be ignored)2214 * =\%session= - a reference to the session object (may be ignored) 2263 2215 * =\%params= - a reference to a Foswiki::Attrs object containing parameters. This can be used as a simple hash that maps parameter names to values, with _DEFAULT being the name for the default parameter. 2264 2216 * =$topic= - name of the topic in the query … … 2284 2236 =%<nop>EXEC{"ps -Af" silent="on"}%= 2285 2237 2286 Registered tags differ from tags implemented using the old TWikiapproach (text substitution in =commonTagsHandler=) in the following ways:2238 Registered tags differ from tags implemented using the old approach (text substitution in =commonTagsHandler=) in the following ways: 2287 2239 * registered tags are evaluated at the same time as system tags, such as %SERVERTIME. =commonTagsHandler= is only called later, when all system tags have already been expanded (though they are expanded _again_ after =commonTagsHandler= returns). 2288 2240 * registered tag names can only contain alphanumerics and _ (underscore) … … 2328 2280 </verbatim> 2329 2281 where: 2330 * =\%session= - a reference to the TWiki session object (may be ignored)2282 * =\%session= - a reference to the Foswiki session object (may be ignored) 2331 2283 2332 2284 From the REST interface, the name of the plugin must be used … … 2379 2331 ---+++ decodeFormatTokens($str) -> $unencodedString 2380 2332 2381 TWiki has an informal standard set of tokens used in =format=2333 Foswiki has an informal standard set of tokens used in =format= 2382 2334 parameters that are used to block evaluation of paramater strings. 2383 2335 For example, if you were to write … … 2386 2338 2387 2339 then %<nop>WURBLE would be expanded *before* %<NOP>MYTAG is evaluated. To avoid 2388 this TWiki uses escapes in the format string. For example:2340 this Foswiki uses escapes in the format string. For example: 2389 2341 2390 2342 =%<nop>MYTAG{format="$percntWURBLE$percnt"}%= 2391 2343 2392 2344 This lets you enter arbitrary strings into parameters without worrying that 2393 TWiki will expand them before your plugin gets a chance to deal with them2345 Foswiki will expand them before your plugin gets a chance to deal with them 2394 2346 properly. Once you have processed your tag, you will want to expand these 2395 2347 tokens to their proper value. That's what this function does. … … 2468 2420 2469 2421 Gets a private directory for Plugin use. The Plugin is entirely responsible 2470 for managing this directory; TWiki will not read from it, or write to it.2422 for managing this directory; Foswiki will not read from it, or write to it. 2471 2423 2472 2424 The directory is guaranteed to exist, and to be writable by the webserver … … 2546 2498 ---+++ getRegularExpression( $name ) -> $expr 2547 2499 2548 Retrieves a TWiki predefined regular expression or character class.2500 Retrieves a Foswiki predefined regular expression or character class. 2549 2501 * =$name= - Name of the expression to retrieve. See notes below 2550 2502 Return: String or precompiled regular expression matching as described below. … … 2552 2504 *Since:* Foswiki::Plugins::VERSION 1.020 (9 Feb 2004) 2553 2505 2554 __Note:__ TWiki internally precompiles several regular expressions to2506 __Note:__ Foswiki internally precompiles several regular expressions to 2555 2507 represent various string entities in an <nop>I18N-compatible manner. Plugins 2556 2508 authors are encouraged to use these in matching where appropriate. The 2557 2509 following are guaranteed to be present. Others may exist, but their use 2558 is unsupported and they may be removed in future TWiki versions.2510 is unsupported and they may be removed in future Foswiki versions. 2559 2511 2560 2512 In the table below, the expression marked type 'String' are intended for … … 2620 2572 | *Input* | *Return* | 2621 2573 | <tt>( '%<nop>USERSWEB%', 'Topic' )</tt> | <tt>( 'Main', 'Topic' ) </tt> | 2622 | <tt>( '%<nop>SYSTEMWEB%', 'Topic' )</tt> | <tt>( ' TWiki', 'Topic' ) </tt> |2623 | <tt>( '', '%<nop>DOCWEB%.Topic' )</tt> | <tt>( ' TWiki', 'Topic' ) </tt> |2574 | <tt>( '%<nop>SYSTEMWEB%', 'Topic' )</tt> | <tt>( 'System', 'Topic' ) </tt> | 2575 | <tt>( '', '%<nop>DOCWEB%.Topic' )</tt> | <tt>( 'System', 'Topic' ) </tt> | 2624 2576 2625 2577 =cut … … 2833 2785 ---++ Deprecated functions 2834 2786 2835 From time-to-time, the TWiki developers will add new functions to the interface (either to TWikiFuncDotPm, or new handlers). Sometimes these improvements mean that old functions have to be deprecated to keep the code manageable. When this happens, the deprecated functions will be supported in the interface for at least one more TWikirelease, and probably longer, though this cannot be guaranteed.2836 2837 Updated plugins may still need to define deprecated handlers for compatibility with old TWiki versions. In this case, the plugin package that defines old handlers can suppress the warnings in %<nop>FAILEDPLUGINS%.2787 From time-to-time, the Foswiki developers will add new functions to the interface (either to =Foswiki::Func=, or new handlers). Sometimes these improvements mean that old functions have to be deprecated to keep the code manageable. When this happens, the deprecated functions will be supported in the interface for at least one more release, and probably longer, though this cannot be guaranteed. 2788 2789 Updated plugins may still need to define deprecated handlers for compatibility with old Foswiki versions. In this case, the plugin package that defines old handlers can suppress the warnings in %<nop>FAILEDPLUGINS%. 2838 2790 2839 2791 This is done by defining a map from the handler name to the =Foswiki::Plugins= version _in which the handler was first deprecated_. For example, if we need to define the =endRenderingHandler= for compatibility with =Foswiki::Plugins= versions before 1.1, we would add this to the plugin: 2840 2792 <verbatim> 2841 2793 package Foswiki::Plugins::SinkPlugin; 2842 use vars qw( % TWikiCompatibility );2843 $ TWikiCompatibility{endRenderingHandler} = 1.1;2844 </verbatim> 2845 If the currently-running TWikiversion is 1.1 _or later_, then the _handler will not be called_ and _the warning will not be issued_. TWiki with versions of =Foswiki::Plugins= before 1.1 will still call the handler as required.2794 use vars qw( %FoswikiCompatibility ); 2795 $FoswikiCompatibility{endRenderingHandler} = 1.1; 2796 </verbatim> 2797 If the currently-running code version is 1.1 _or later_, then the _handler will not be called_ and _the warning will not be issued_. TWiki with versions of =Foswiki::Plugins= before 1.1 will still call the handler as required. 2846 2798 2847 2799 The following functions are retained for compatibility only. You should … … 2854 2806 *DEPRECATED* since 1.1 - use =getScriptUrl= instead. 2855 2807 2856 Return: =$path= URL path of TWikiscripts, e.g. ="/cgi-bin"=2808 Return: =$path= URL path of bin scripts, e.g. ="/cgi-bin"= 2857 2809 2858 2810 *WARNING:* you are strongly recommended *not* to use this function, as the … … 2868 2820 return $Foswiki::Plugins::SESSION->getScriptUrl( 0, '' ); 2869 2821 } 2822 2823 2824 =pod 2825 2826 ---+++ getWikiToolName( ) -> $name 2827 2828 *DEPRECATED* in Foswiki; use $Foswiki::cfg{WikiToolName} instead 2829 2830 =cut 2831 2832 sub getWikiToolName { return $Foswiki::cfg{WikiToolName}; } 2833 2834 =pod 2835 2836 ---+++ getMainWebname( ) -> $name 2837 2838 *DEPRECATED* in Foswiki; use $Foswiki::cfg{UsersWebName} instead 2839 2840 =cut 2841 2842 sub getMainWebname { return $Foswiki::cfg{UsersWebName}; } 2843 2844 =pod 2845 2846 ---+++ getTwikiWebname( ) -> $name 2847 2848 *DEPRECATED* in Foswiki; use $Foswiki::cfg{SystemWebName} instead 2849 2850 =cut 2851 2852 sub getTwikiWebname { return $Foswiki::cfg{SystemWebName}; } 2870 2853 2871 2854 =pod … … 2880 2863 Return: =$url= URL, e.g. ="http://example.com:80/cgi-bin/oops.pl/ Main/WebNotify?template=oopslocked&param1=joe"= 2881 2864 2882 *DEPRECATED* since 1.1, the recommended approach is to throw an [[TWikiOopsExceptionDotPm][oops exception]].2865 *DEPRECATED* since 1.1, the recommended approach is to throw an oops exception. 2883 2866 <verbatim> 2884 2867 use Error qw( :try ); … … 2964 2947 *DEPRECATED* since 1.1 - use =getListOfWebs= instead. 2965 2948 2966 Get list of all public webs, e.g. all webs that do not have the =NOSEARCHALL= flag set in the WebPreferences2967 2968 Return: =@webs= List of all public webs , e.g. =( 'Main', 'Know', 'TWiki' )=2949 Get list of all public webs, e.g. all webs *and subwebs* that do not have the =NOSEARCHALL= flag set in the WebPreferences 2950 2951 Return: =@webs= List of all public webs *and subwebs* 2969 2952 2970 2953 *Since:* Foswiki::Plugins::VERSION 1.000 (07 Dec 2002) … … 3009 2992 *DEPRECATED* since 1.1 - use the "Webs, Topics and Attachments" functions to manipulate topics instead 3010 2993 3011 Get data directory (topic file root)3012 3013 Return: =$dir= Data directory, e.g. ='/twiki/data'=3014 3015 This function violates store encapsulation and is therefore *deprecated*.3016 3017 *Since:* Foswiki::Plugins::VERSION 1.000 (07 Dec 2002)3018 3019 2994 =cut 3020 2995 … … 3029 3004 *DEPRECATED* since 1.1 - use the "Webs, Topics and Attachments" functions to manipulateattachments instead 3030 3005 3031 Get pub directory (file attachment root). Attachments are in =$dir/Web/TopicName= 3032 3033 Return: =$dir= Pub directory, e.g. ='/htdocs/twiki/pub'= 3034 3035 This function violates store encapsulation and is therefore *deprecated*. 3036 3037 Use =readAttachment= and =saveAttachment= instead. 3038 3039 *Since:* Foswiki::Plugins::VERSION 1.000 (07 Dec 2002) 3040 3041 =cut 3042 3043 sub getPubDir { 3044 return $Foswiki::cfg{PubDir}; 3045 } 3046 3047 =pod 3048 3049 ---+++ checkDependencies( $moduleName, $dependenciesRef ) -> $error 3050 3051 *DEPRECATED* since 1.1 - use TWiki:Plugins.BuildContrib and define DEPENDENCIES that can be statically 3052 evaluated at install time instead. It is a lot more efficient. 3053 3054 *Since:* Foswiki::Plugins::VERSION 1.025 (01 Aug 2004) 3055 3056 =cut 3057 3006 =cut 3007 3008 sub getPubDir { return $Foswiki::cfg{PubDir}; } 3009 3010 # Removed; it was never used 3058 3011 sub checkDependencies { 3059 my ( $context, $deps ) = @_; 3060 my $report = ''; 3061 my $depsOK = 1; 3062 foreach my $dep (@$deps) { 3063 my ( $ok, $ver ) = ( 1, 0 ); 3064 my $msg = ''; 3065 my $const = ''; 3066 3067 eval "require $dep->{package}"; 3068 if ($@) { 3069 $msg .= "it could not be found: $@"; 3070 $ok = 0; 3071 } 3072 else { 3073 if ( defined( $dep->{constraint} ) ) { 3074 $const = $dep->{constraint}; 3075 eval "\$ver = \$$dep->{package}::VERSION;"; 3076 if ($@) { 3077 $msg .= "the VERSION of the package could not be found: $@"; 3078 $ok = 0; 3079 } 3080 else { 3081 eval "\$ok = ( \$ver $const )"; 3082 if ( $@ || !$ok ) { 3083 $msg .= " $ver is currently installed: $@"; 3084 $ok = 0; 3085 } 3086 } 3087 } 3088 } 3089 unless ($ok) { 3090 $report .= 3091 "WARNING: $dep->{package}$const is required for $context, but $msg\n"; 3092 $depsOK = 0; 3093 } 3094 } 3095 return undef if ($depsOK); 3096 3097 return $report; 3012 die "checkDependencies removed; contact plugin author or maintainer and tell them to use BuildContrib DEPENDENCIES instead"; 3098 3013 } 3099 3014 … … 3120 3035 3121 3036 As per the GPL, removal of this notice is prohibited. 3122 3123 ---++ API History3124 3125 ---+++ twiki-20010901-release (Athens)3126 $Foswiki::Plugins::VERSION 1.0003127 ---++++ EmptyPlugin.pm3128 * =commonTagsHandler($text, $topic, $web)=3129 * =endRenderingHandler($text)=3130 * =outsidePREHandler($text)=3131 * =insidePREHandler($text)=3132 * =startRenderingHandler($text, $web)=3133 ---++++ Func.pm3134 * =checkAccessPermission($type, $login, $topicText, $topicName, $webName) -> $boolean=3135 * =expandCommonVariables($text, $topic, $web) -> $text=3136 * =extractNameValuePair($attrs, $name) -> $value=3137 * =formatGmTime($time) -> $text=3138 * =getCgiQuery() -> $query=3139 * =getDataDir() -> $dir=3140 * =getDefaultUserName() -> $loginName=3141 * =getMainWebname() -> $name=3142 * =getOopsUrl($web, $topic, $template, @theParams) -> $url=3143 * =getPreferencesFlag($key) -> $boolean=3144 * =getPreferencesValue($key, $web) -> $value=3145 * =getPublicWebList() -> @webs=3146 * =getPubDir() -> $dir=3147 * =getPubUrlPath() -> $path=3148 * =getRevisionInfo($webName, $topic, $rev, $attachment) -> ($date, $user, $rev, $comment)=3149 * =getScriptUrl($web, $topic, $script) -> $url=3150 * =getScriptUrlPath() -> $path=3151 * =getSessionValue($key) -> $value=3152 * =getSkin() -> $skin=3153 * =getTopicList($web) -> @topics=3154 * =getTwikiWebname() -> $name=3155 * =getUrlHost() -> $host=3156 * =getViewUrl($web, $topic) -> $url=3157 * =getWikiName() -> $wikiName=3158 * =getWikiUserName($text) -> $wikiName=3159 * =getWikiToolName() -> $name=3160 * =internalLink($preamble, $web, $topic, $linkText, $anchor, $createLink) -> $text=3161 * =isGuest() -> $boolean=3162 * =permissionsSet($web) -> $boolean=3163 * =readFile($filename) -> $text=3164 * =readTemplate($name, $skin) -> $text=3165 * =readTopic($webName, $topic) -> ($meta, $text)=3166 * =redirectCgiQuery($query, $url)=3167 * =renderText($text, $web) -> $text=3168 * =saveFile($filename, $text)=3169 * =setSessionValue($key, $value)=3170 * =topicExists($web, $topic) -> $boolean=3171 * =userToWikiName($user, $dontAddWeb) -> $wikiName=3172 * =webExists($web) -> $boolean=3173 * =wikiToUserName($wiki) -> $loginName=3174 * =writeDebug($text)=3175 * =writeHeader($query)=3176 * =writeWarning($text)=3177 3178 ---+++ TWikiRelease01Feb2003 (Beijing)3179 $Foswiki::Plugins::VERSION 1.0103180 ---++++ EmptyPlugin.pm3181 * =afterEditHandler($text, $topic, $web)=3182 * =beforeEditHandler($text, $topic, $web)=3183 * =beforeSaveHandler($text, $topic, $web)=3184 * =initializeUserHandler($loginName, $url, $pathInfo)=3185 * =redirectCgiQueryHandler($query, $url)=3186 * =registrationHandler($web, $wikiName, $loginName)=3187 * =writeHeaderHandler($query)=3188 ---++++ Func.pm3189 * =checkTopicEditLock($web, $topic) ->($oopsUrl, $loginName, $unlockTime)=3190 * =readTopicText($web, $topic, $rev, $ignorePermissions) -> $text=3191 * =saveTopicText($web, $topic, $text, $ignorePermissions, $dontNotify) -> $oopsUrl=3192 * =setTopicEditLock($web, $topic, $lock) -> $oopsUrl=3193 3194 ---+++ twiki-20040902-release (Cairo)3195 $Foswiki::Plugins::VERSION 1.0253196 ---++++ EmptyPlugin.pm3197 * =afterCommonTagsHandler($text, $topic, $web)=3198 * =afterSaveHandler($text, $topic, $web, $error)=3199 * =beforeCommonTagsHandler($text, $topic, $web)=3200 * =earlyInitPlugin()=3201 ---++++ Func.pm3202 * =afterAttachmentSaveHandler(\%attrHash, $topic, $web, $error)=3203 * =beforeAttachmentSaveHandler(\%attrHash, $topic, $web)=3204 * =checkDependencies($moduleName, $dependenciesRef) -> $error=3205 * =extractParameters($attr) -> %params=3206 * =formatTime($time, $format, $timezone) -> $text=3207 * =getPluginPreferencesFlag($key) -> $boolean=3208 * =getPluginPreferencesValue($key) -> $value=3209 * =getRegularExpression($regexName) -> $pattern=3210 3211 ---+++ TWikiRelease04x00x00 (Dakar)3212 $Foswiki::Plugins::VERSION 1.13213 ---++++ EmptyPlugin.pm3214 * =mergeHandler($diff, $old, $new, \%info) -> $text=3215 * =modifyHeaderHandler(\%headers, $query)=3216 * =postRenderingHandler($text)=3217 * =preRenderingHandler($text, \%map)=3218 * =renderFormFieldForEditHandler($name, $type, $size, $value, $attributes, $possibleValues) -> $html=3219 * =renderWikiWordHandler($linkText, $hasExplicitLinkLabel, $web, $topic) -> $linkText=3220 3221 * <strike> =endRenderingHandler($text)= </strike>3222 * <strike> =startRenderingHandler($text, $web)= </strike>3223 ---++++ Func.pm3224 * =addToHEAD($id, $header)=3225 * =attachmentExists($web, $topic, $attachment) -> $boolean=3226 * =clearSessionValue($key) -> $boolean=3227 * =checkDependencies($moduleName, $dependenciesRef) -> $error=3228 * =createWeb($newWeb, $baseWeb, $opts)=3229 * =expandTemplate($def ) -> $string=3230 * =expandVariablesOnTopicCreation($text) -> $text=3231 * =getContext() -> \%hash=3232 * =getListOfWebs($filter) -> @webs=3233 * =getScriptUrl($web, $topic, $script, @params) -> $url=3234 * =getRevisionAtTime($web, $topic, $time) -> $rev=3235 * =getWorkArea($pluginName) -> $directorypath=3236 * =isValidWikiWord($text) -> $boolean=3237 * =loadTemplate($name, $skin, $web) -> $text=3238 * =moveAttachment($web, $topic, $attachment, $newWeb, $newTopic, $newAttachment)=3239 * =moveTopic($web, $topic, $newWeb, $newTopic)=3240 * =moveWeb($oldName, $newName)=3241 * =normalizeWebTopicName($web, $topic) ->($web, $topic)=3242 * =readAttachment($web, $topic, $name, $rev) -> $data=3243 * =registerRESTHandler($alias, \&fn,)=3244 * =registerTagHandler($var, \&fn, $syntax)=3245 * =saveAttachment($web, $topic, $attachment, $opts)=3246 * =saveTopic($web, $topic, $meta, $text, $options) -> $error=3247 * =searchInWebContent($searchString, $web, \@topics, \%options) -> \%map=3248 * =sendEmail($text, $retries) -> $error=3249 * =wikiToEmail($wikiName) -> $email=3250 * =writeHeader($query, $contentLength)=3251 3252 * <strike> =checkDependencies($moduleName, $dependenciesRef) -> $error= </strike>3253 * <strike> =formatGmTime($time, $format) -> $text= </strike>3254 * <strike> =getDataDir() -> $dir= </strike>3255 * <strike> =getOopsUrl( $web, $topic, $template, @params ) -> $url= </strike>3256 * <strike> =getPubDir() -> $dir= </strike>3257 * <strike> =getPublicWebList() -> @webs= </strike>3258 * <strike> =getScriptUrlPath() -> $path= </strike>3259 3260 ---+++ TWikiRelease04x00x013261 $Foswiki::Plugins::VERSION 1.13262 ---++++ EmptyPlugin.pm3263 * =afterSaveHandler($text, $topic, $web, $error, $meta)=3264 * =beforeSaveHandler($text, $topic, $web, $meta)=3265 ---++++ Func.pm3266 3267 ---+++ TWikiRelease04x01x003268 $Foswiki::Plugins::VERSION 1.113269 ---++++ EmptyPlugin.pm3270 * =afterRenameHandler($oldWeb, $oldTopic, $oldAttachment, $newWeb, $newTopic, $newAttachment)=3271 ---++++ Func.pm3272 No changes3273 3274 ---+++ TWikiRelease04x02x003275 $Foswiki::Plugins::VERSION 1.23276 ---++++ EmptyPlugin.pm3277 * =afterCommonTagsHandler($text, $topic, $web, $meta)=3278 * =beforeCommonTagsHandler($text, $topic, $web, $meta)=3279 * =commonTagsHandler($text, $topic, $web, $included, $meta)=3280 ---++++ Func.pm3281 * =decodeFormatTokens($str) -> $unencodedString=3282 * =eachChangeSince($web, $time) -> $iterator=3283 * =eachGroup() -> $iterator=3284 * =eachGroupMember($group) -> $iterator=3285 * =eachMembership($wikiname) -> $iterator=3286 * =eachUser() -> $iterator=3287 * =emailToWikiNames($email, $dontAddWeb) -> @wikiNames=3288 * =expandCommonVariables($text, $topic, $web, $meta) -> $text=3289 * =getCanonicalUserID( $user ) -> $cUID=3290 * =getExternalResource($url) -> $response=3291 * =getSessionKeys() -> @keys=3292 * =isAnAdmin($login) -> $boolean=3293 * =isGroup($group) -> $boolean=3294 * =isGroupMember($group, $login) -> $boolean=3295 * =isTrue($value, $default) -> $boolean=3296 * =popTopicContext()=3297 * =pushTopicContext($web, $topic)=3298 * =sanitizeAttachmentName($fname) -> ($fileName, $origName)=3299 * =setPreferencesValue($name, $val)=3300 * =spaceOutWikiWord($word, $sep) -> $text=3301 * =wikiNameToEmails($wikiname) -> @emails=3302 * <strike> =permissionsSet($web) -> $boolean= </strike>3303 * <strike> =getOopsUrl( $web, $topic, $template, $param1, $param2, $param3, $param4 ) -> $url= </strike>3304
Note: See TracChangeset
for help on using the changeset viewer.
