Changeset 812


Ignore:
Timestamp:
11/19/08 16:05:12 (3 years ago)
Author:
CrawfordCurrie
Message:

Item175: corrected references to TWiki in comments and error messages

Location:
trunk
Files:
1 added
59 edited

Legend:

Unmodified
Added
Removed
  • trunk/TWikiCompatibilityPlugin/lib/TWiki/Plugins/TWikiCompatibilityPlugin.pm

    r807 r812  
    2525use strict; 
    2626 
    27 require TWiki::Func;    # The plugins API 
    28 require TWiki::Plugins; # For the API version 
     27require Foswiki::Func;    # The plugins API 
     28require Foswiki::Plugins; # For the API version 
    2929use vars qw( $VERSION $RELEASE $SHORTDESCRIPTION $debug $pluginName $NO_PREFS_IN_TOPIC ); 
    3030$VERSION = '$Rev$'; 
     
    4646sub initPlugin { 
    4747    my( $topic, $web, $user, $installWeb ) = @_; 
    48  
    49     # check for Plugins.pm versions 
    50     if( $TWiki::Plugins::VERSION < 1.026 ) { 
    51         TWiki::Func::writeWarning( "Version mismatch between $pluginName and Plugins.pm" ); 
    52         return 0; 
    53     } 
    54  
    55     my $setting = $TWiki::cfg{Plugins}{TWikiCompatibilityPlugin}{ExampleSetting} || 0; 
    56     $debug = $TWiki::cfg{Plugins}{TWikiCompatibilityPlugin}{Debug} || 0; 
    57  
    58     TWiki::Func::registerTagHandler( 'EXAMPLETAG', \&_EXAMPLETAG ); 
    59     TWiki::Func::registerRESTHandler('example', \&restExample); 
    60  
    6148    return 1; 
    62 } 
    63  
    64 # The function used to handle the %EXAMPLETAG{...}% variable 
    65 # You would have one of these for each variable you want to process. 
    66 sub _EXAMPLETAG { 
    67     my($session, $params, $theTopic, $theWeb) = @_; 
    68     # $session  - a reference to the TWiki session object (if you don't know 
    69     #             what this is, just ignore it) 
    70     # $params=  - a reference to a TWiki::Attrs object containing parameters. 
    71     #             This can be used as a simple hash that maps parameter names 
    72     #             to values, with _DEFAULT being the name for the default 
    73     #             parameter. 
    74     # $theTopic - name of the topic in the query 
    75     # $theWeb   - name of the web in the query 
    76     # Return: the result of processing the variable 
    77  
    78     # For example, %EXAMPLETAG{'hamburger' sideorder="onions"}% 
    79     # $params->{_DEFAULT} will be 'hamburger' 
    80     # $params->{sideorder} will be 'onions' 
    8149} 
    8250 
     
    8755If the TWiki web does not exist, change the request to the %SYSTEMWEB% 
    8856 
    89 This may not be enough for Plugins that do have intopic preferences. 
     57This may not be enough for Plugins that do have in topic preferences. 
    9058 
    9159=cut 
    9260 
    9361sub earlyInitPlugin { 
    94     if (($TWiki::Plugins::SESSION->{webName} eq 'TWiki') && 
    95             (!TWiki::Func::webExists($TWiki::Plugins::SESSION->{webName}))) { 
    96         my $TWikiWebTopicNameConversion = $TWiki::cfg{Plugins}{TWikiCompatibilityPlugin}{TWikiWebTopicNameConversion}; 
    97         $TWiki::Plugins::SESSION->{webName} = $TWiki::cfg{SystemWebName}; 
    98         if (defined($TWikiWebTopicNameConversion->{$TWiki::Plugins::SESSION->{topicName}})) { 
    99             $TWiki::Plugins::SESSION->{topicName} = 
    100                     $TWikiWebTopicNameConversion->{$TWiki::Plugins::SESSION->{topicName}}; 
     62 
     63=pod 
     64 
     65Commented out because it redirects requests to value plugin topics for TWiki plugins, which are still in TWiki web - CDot 
     66 
     67    if (($Foswiki::Plugins::SESSION->{webName} eq 'TWiki') && 
     68            (!Foswiki::Func::webExists($Foswiki::Plugins::SESSION->{webName}))) { 
     69        my $TWikiWebTopicNameConversion = $Foswiki::cfg{Plugins}{TWikiCompatibilityPlugin}{TWikiWebTopicNameConversion}; 
     70        $Foswiki::Plugins::SESSION->{webName} = $Foswiki::cfg{SystemWebName}; 
     71        if (defined($TWikiWebTopicNameConversion->{$Foswiki::Plugins::SESSION->{topicName}})) { 
     72            $Foswiki::Plugins::SESSION->{topicName} = 
     73                    $TWikiWebTopicNameConversion->{$Foswiki::Plugins::SESSION->{topicName}}; 
    10174        } 
    10275    } 
    103     my $MainWebTopicNameConversion = $TWiki::cfg{Plugins}{TWikiCompatibilityPlugin}{MainWebTopicNameConversion}; 
    104     if (($TWiki::Plugins::SESSION->{webName} eq 'Main') && 
    105             (defined($MainWebTopicNameConversion->{$TWiki::Plugins::SESSION->{topicName}}))) { 
    106         $TWiki::Plugins::SESSION->{topicName} = 
    107             $MainWebTopicNameConversion->{$TWiki::Plugins::SESSION->{topicName}}; 
     76    my $MainWebTopicNameConversion = $Foswiki::cfg{Plugins}{TWikiCompatibilityPlugin}{MainWebTopicNameConversion}; 
     77    if (($Foswiki::Plugins::SESSION->{webName} eq 'Main') && 
     78            (defined($MainWebTopicNameConversion->{$Foswiki::Plugins::SESSION->{topicName}}))) { 
     79        $Foswiki::Plugins::SESSION->{topicName} = 
     80            $MainWebTopicNameConversion->{$Foswiki::Plugins::SESSION->{topicName}}; 
    10881    } 
    10982     
    11083    #Map TWIKIWEB to SYSTEMWEB and MAINWEB to USERSWEB 
    11184    #TODO: should we test for existance and other things? 
    112     TWiki::Func::setPreferencesValue('TWIKIWEB', 'SYSTEMWEB'); 
    113     TWiki::Func::setPreferencesValue('MAINWEB', 'USERSWEB'); 
    114      
     85    Foswiki::Func::setPreferencesValue('TWIKIWEB', 'SYSTEMWEB'); 
     86    Foswiki::Func::setPreferencesValue('MAINWEB', 'USERSWEB'); 
     87 
     88=cut 
     89 
    11590    return; 
    11691} 
    11792 
    118 =pod 
    119  
    120 ---++ initializeUserHandler( $loginName, $url, $pathInfo ) 
    121    * =$loginName= - login name recovered from $ENV{REMOTE_USER} 
    122    * =$url= - request url 
    123    * =$pathInfo= - pathinfo from the CGI query 
    124 Allows a plugin to set the username. Normally TWiki gets the username 
    125 from the login manager. This handler gives you a chance to override the 
    126 login manager. 
    127  
    128 Return the *login* name. 
    129  
    130 This handler is called very early, immediately after =earlyInitPlugin=. 
    131  
    132 *Since:* TWiki::Plugins::VERSION = '1.010' 
    133  
    134 =cut 
    135  
    136 sub DISABLE_initializeUserHandler { 
    137     # do not uncomment, use $_[0], $_[1]... instead 
    138     ### my ( $loginName, $url, $pathInfo ) = @_; 
    139  
    140     TWiki::Func::writeDebug( "- ${pluginName}::initializeUserHandler( $_[0], $_[1] )" ) if $debug; 
    141 } 
    142  
    143 =pod 
    144  
    145 ---++ registrationHandler($web, $wikiName, $loginName ) 
    146    * =$web= - the name of the web in the current CGI query 
    147    * =$wikiName= - users wiki name 
    148    * =$loginName= - users login name 
    149  
    150 Called when a new user registers with this TWiki. 
    151  
    152 *Since:* TWiki::Plugins::VERSION = '1.010' 
    153  
    154 =cut 
    155  
    156 sub DISABLE_registrationHandler { 
    157     # do not uncomment, use $_[0], $_[1]... instead 
    158     ### my ( $web, $wikiName, $loginName ) = @_; 
    159  
    160     TWiki::Func::writeDebug( "- ${pluginName}::registrationHandler( $_[0], $_[1] )" ) if $debug; 
    161 } 
    162  
    163 =pod 
    164  
    165 ---++ commonTagsHandler($text, $topic, $web, $included, $meta ) 
    166    * =$text= - text to be processed 
    167    * =$topic= - the name of the topic in the current CGI query 
    168    * =$web= - the name of the web in the current CGI query 
    169    * =$included= - Boolean flag indicating whether the handler is invoked on an included topic 
    170    * =$meta= - meta-data object for the topic MAY BE =undef= 
    171 This handler is called by the code that expands %<nop>TAGS% syntax in 
    172 the topic body and in form fields. It may be called many times while 
    173 a topic is being rendered. 
    174  
    175 For variables with trivial syntax it is far more efficient to use 
    176 =TWiki::Func::registerTagHandler= (see =initPlugin=). 
    177  
    178 Plugins that have to parse the entire topic content should implement 
    179 this function. Internal TWiki 
    180 variables (and any variables declared using =TWiki::Func::registerTagHandler=) 
    181 are expanded _before_, and then again _after_, this function is called 
    182 to ensure all %<nop>TAGS% are expanded. 
    183  
    184 __NOTE:__ when this handler is called, &lt;verbatim> blocks have been 
    185 removed from the text (though all other blocks such as &lt;pre> and 
    186 &lt;noautolink> are still present). 
    187  
    188 __NOTE:__ meta-data is _not_ embedded in the text passed to this 
    189 handler. Use the =$meta= object. 
    190  
    191 *Since:* $TWiki::Plugins::VERSION 1.000 
    192  
    193 =cut 
    194  
    195 sub DISABLE_commonTagsHandler { 
    196     # do not uncomment, use $_[0], $_[1]... instead 
    197     ### my ( $text, $topic, $web, $included, $meta ) = @_; 
    198      
    199     # If you don't want to be called from nested includes... 
    200     #   if( $_[3] ) { 
    201     #   # bail out, handler called from an %INCLUDE{}% 
    202     #         return; 
    203     #   } 
    204  
    205     TWiki::Func::writeDebug( "- ${pluginName}::commonTagsHandler( $_[2].$_[1] )" ) if $debug; 
    206  
    207     # do custom extension rule, like for example: 
    208     # $_[0] =~ s/%XYZ%/&handleXyz()/ge; 
    209     # $_[0] =~ s/%XYZ{(.*?)}%/&handleXyz($1)/ge; 
    210 } 
    211  
    212 =pod 
    213  
    214 ---++ beforeCommonTagsHandler($text, $topic, $web, $meta ) 
    215    * =$text= - text to be processed 
    216    * =$topic= - the name of the topic in the current CGI query 
    217    * =$web= - the name of the web in the current CGI query 
    218    * =$meta= - meta-data object for the topic MAY BE =undef= 
    219 This handler is called before TWiki does any expansion of it's own 
    220 internal variables. It is designed for use by cache plugins. Note that 
    221 when this handler is called, &lt;verbatim> blocks are still present 
    222 in the text. 
    223  
    224 __NOTE__: This handler is called once for each call to 
    225 =commonTagsHandler= i.e. it may be called many times during the 
    226 rendering of a topic. 
    227  
    228 __NOTE:__ meta-data is _not_ embedded in the text passed to this 
    229 handler. 
    230  
    231 __NOTE:__ This handler is not separately called on included topics. 
    232  
    233 =cut 
    234  
    235 sub DISABLE_beforeCommonTagsHandler { 
    236     # do not uncomment, use $_[0], $_[1]... instead 
    237     ### my ( $text, $topic, $web, $meta ) = @_; 
    238  
    239     TWiki::Func::writeDebug( "- ${pluginName}::beforeCommonTagsHandler( $_[2].$_[1] )" ) if $debug; 
    240 } 
    241  
    242 =pod 
    243  
    244 ---++ afterCommonTagsHandler($text, $topic, $web, $meta ) 
    245    * =$text= - text to be processed 
    246    * =$topic= - the name of the topic in the current CGI query 
    247    * =$web= - the name of the web in the current CGI query 
    248    * =$meta= - meta-data object for the topic MAY BE =undef= 
    249 This handler is after TWiki has completed expansion of %TAGS%. 
    250 It is designed for use by cache plugins. Note that when this handler 
    251 is called, &lt;verbatim> blocks are present in the text. 
    252  
    253 __NOTE__: This handler is called once for each call to 
    254 =commonTagsHandler= i.e. it may be called many times during the 
    255 rendering of a topic. 
    256  
    257 __NOTE:__ meta-data is _not_ embedded in the text passed to this 
    258 handler. 
    259  
    260 =cut 
    261  
    262 sub DISABLE_afterCommonTagsHandler { 
    263     # do not uncomment, use $_[0], $_[1]... instead 
    264     ### my ( $text, $topic, $web, $meta ) = @_; 
    265  
    266     TWiki::Func::writeDebug( "- ${pluginName}::afterCommonTagsHandler( $_[2].$_[1] )" ) if $debug; 
    267 } 
    268  
    269 =pod 
    270  
    271 ---++ preRenderingHandler( $text, \%map ) 
    272    * =$text= - text, with the head, verbatim and pre blocks replaced with placeholders 
    273    * =\%removed= - reference to a hash that maps the placeholders to the removed blocks. 
    274  
    275 Handler called immediately before TWiki syntax structures (such as lists) are 
    276 processed, but after all variables have been expanded. Use this handler to  
    277 process special syntax only recognised by your plugin. 
    278  
    279 Placeholders are text strings constructed using the tag name and a  
    280 sequence number e.g. 'pre1', "verbatim6", "head1" etc. Placeholders are  
    281 inserted into the text inside &lt;!--!marker!--&gt; characters so the  
    282 text will contain &lt;!--!pre1!--&gt; for placeholder pre1. 
    283  
    284 Each removed block is represented by the block text and the parameters  
    285 passed to the tag (usually empty) e.g. for 
    286 <verbatim> 
    287 <pre class='slobadob'> 
    288 XYZ 
    289 </pre> 
    290 the map will contain: 
    291 <pre> 
    292 $removed->{'pre1'}{text}:   XYZ 
    293 $removed->{'pre1'}{params}: class="slobadob" 
    294 </pre> 
    295 Iterating over blocks for a single tag is easy. For example, to prepend a  
    296 line number to every line of every pre block you might use this code: 
    297 <verbatim> 
    298 foreach my $placeholder ( keys %$map ) { 
    299     if( $placeholder =~ /^pre/i ) { 
    300        my $n = 1; 
    301        $map->{$placeholder}{text} =~ s/^/$n++/gem; 
    302     } 
    303 } 
    304 </verbatim> 
    305  
    306 __NOTE__: This handler is called once for each rendered block of text i.e.  
    307 it may be called several times during the rendering of a topic. 
    308  
    309 __NOTE:__ meta-data is _not_ embedded in the text passed to this 
    310 handler. 
    311  
    312 Since TWiki::Plugins::VERSION = '1.026' 
    313  
    314 =cut 
    315  
    316 sub DISABLE_preRenderingHandler { 
    317     # do not uncomment, use $_[0], $_[1]... instead 
    318     #my( $text, $pMap ) = @_; 
    319 } 
    320  
    321 =pod 
    322  
    323 ---++ postRenderingHandler( $text ) 
    324    * =$text= - the text that has just been rendered. May be modified in place. 
    325  
    326 __NOTE__: This handler is called once for each rendered block of text i.e.  
    327 it may be called several times during the rendering of a topic. 
    328  
    329 __NOTE:__ meta-data is _not_ embedded in the text passed to this 
    330 handler. 
    331  
    332 Since TWiki::Plugins::VERSION = '1.026' 
    333  
    334 =cut 
    335  
    336 sub DISABLE_postRenderingHandler { 
    337     # do not uncomment, use $_[0], $_[1]... instead 
    338     #my $text = shift; 
    339 } 
    340  
    341 =pod 
    342  
    343 ---++ beforeEditHandler($text, $topic, $web ) 
    344    * =$text= - text that will be edited 
    345    * =$topic= - the name of the topic in the current CGI query 
    346    * =$web= - the name of the web in the current CGI query 
    347 This handler is called by the edit script just before presenting the edit text 
    348 in the edit box. It is called once when the =edit= script is run. 
    349  
    350 __NOTE__: meta-data may be embedded in the text passed to this handler  
    351 (using %META: tags) 
    352  
    353 *Since:* TWiki::Plugins::VERSION = '1.010' 
    354  
    355 =cut 
    356  
    357 sub DISABLE_beforeEditHandler { 
    358     # do not uncomment, use $_[0], $_[1]... instead 
    359     ### my ( $text, $topic, $web ) = @_; 
    360  
    361     TWiki::Func::writeDebug( "- ${pluginName}::beforeEditHandler( $_[2].$_[1] )" ) if $debug; 
    362 } 
    363  
    364 =pod 
    365  
    366 ---++ afterEditHandler($text, $topic, $web, $meta ) 
    367    * =$text= - text that is being previewed 
    368    * =$topic= - the name of the topic in the current CGI query 
    369    * =$web= - the name of the web in the current CGI query 
    370    * =$meta= - meta-data for the topic. 
    371 This handler is called by the preview script just before presenting the text. 
    372 It is called once when the =preview= script is run. 
    373  
    374 __NOTE:__ this handler is _not_ called unless the text is previewed. 
    375  
    376 __NOTE:__ meta-data is _not_ embedded in the text passed to this 
    377 handler. Use the =$meta= object. 
    378  
    379 *Since:* $TWiki::Plugins::VERSION 1.010 
    380  
    381 =cut 
    382  
    383 sub DISABLE_afterEditHandler { 
    384     # do not uncomment, use $_[0], $_[1]... instead 
    385     ### my ( $text, $topic, $web ) = @_; 
    386  
    387     TWiki::Func::writeDebug( "- ${pluginName}::afterEditHandler( $_[2].$_[1] )" ) if $debug; 
    388 } 
    389  
    390 =pod 
    391  
    392 ---++ beforeSaveHandler($text, $topic, $web, $meta ) 
    393    * =$text= - text _with embedded meta-data tags_ 
    394    * =$topic= - the name of the topic in the current CGI query 
    395    * =$web= - the name of the web in the current CGI query 
    396    * =$meta= - the metadata of the topic being saved, represented by a TWiki::Meta object. 
    397  
    398 This handler is called each time a topic is saved. 
    399  
    400 __NOTE:__ meta-data is embedded in =$text= (using %META: tags). If you modify 
    401 the =$meta= object, then it will override any changes to the meta-data 
    402 embedded in the text. Modify *either* the META in the text *or* the =$meta= 
    403 object, never both. You are recommended to modify the =$meta= object rather 
    404 than the text, as this approach is proof against changes in the embedded 
    405 text format. 
    406  
    407 *Since:* TWiki::Plugins::VERSION = '1.010' 
    408  
    409 =cut 
    410  
    411 sub DISABLE_beforeSaveHandler { 
    412     # do not uncomment, use $_[0], $_[1]... instead 
    413     ### my ( $text, $topic, $web ) = @_; 
    414  
    415     TWiki::Func::writeDebug( "- ${pluginName}::beforeSaveHandler( $_[2].$_[1] )" ) if $debug; 
    416 } 
    417  
    418 =pod 
    419  
    420 ---++ afterSaveHandler($text, $topic, $web, $error, $meta ) 
    421    * =$text= - the text of the topic _excluding meta-data tags_ 
    422      (see beforeSaveHandler) 
    423    * =$topic= - the name of the topic in the current CGI query 
    424    * =$web= - the name of the web in the current CGI query 
    425    * =$error= - any error string returned by the save. 
    426    * =$meta= - the metadata of the saved topic, represented by a TWiki::Meta object  
    427  
    428 This handler is called each time a topic is saved. 
    429  
    430 __NOTE:__ meta-data is embedded in $text (using %META: tags) 
    431  
    432 *Since:* TWiki::Plugins::VERSION 1.025 
    433  
    434 =cut 
    435  
    436 sub DISABLE_afterSaveHandler { 
    437     # do not uncomment, use $_[0], $_[1]... instead 
    438     ### my ( $text, $topic, $web, $error, $meta ) = @_; 
    439  
    440     TWiki::Func::writeDebug( "- ${pluginName}::afterSaveHandler( $_[2].$_[1] )" ) if $debug; 
    441 } 
    442  
    443 =pod 
    444  
    445 ---++ afterRenameHandler( $oldWeb, $oldTopic, $oldAttachment, $newWeb, $newTopic, $newAttachment ) 
    446  
    447    * =$oldWeb= - name of old web 
    448    * =$oldTopic= - name of old topic (empty string if web rename) 
    449    * =$oldAttachment= - name of old attachment (empty string if web or topic rename) 
    450    * =$newWeb= - name of new web 
    451    * =$newTopic= - name of new topic (empty string if web rename) 
    452    * =$newAttachment= - name of new attachment (empty string if web or topic rename) 
    453  
    454 This handler is called just after the rename/move/delete action of a web, topic or attachment. 
    455  
    456 *Since:* TWiki::Plugins::VERSION = '1.11' 
    457  
    458 =cut 
    459  
    460 sub DISABLE_afterRenameHandler { 
    461     # do not uncomment, use $_[0], $_[1]... instead 
    462     ### my ( $oldWeb, $oldTopic, $oldAttachment, $newWeb, $newTopic, $newAttachment ) = @_; 
    463  
    464     TWiki::Func::writeDebug( "- ${pluginName}::afterRenameHandler( " . 
    465                              "$_[0].$_[1] $_[2] -> $_[3].$_[4] $_[5] )" ) if $debug; 
    466 } 
    467  
    468 =pod 
    469  
    470 ---++ beforeAttachmentSaveHandler(\%attrHash, $topic, $web ) 
    471    * =\%attrHash= - reference to hash of attachment attribute values 
    472    * =$topic= - the name of the topic in the current CGI query 
    473    * =$web= - the name of the web in the current CGI query 
    474 This handler is called once when an attachment is uploaded. When this 
    475 handler is called, the attachment has *not* been recorded in the database. 
    476  
    477 The attributes hash will include at least the following attributes: 
    478    * =attachment= => the attachment name 
    479    * =comment= - the comment 
    480    * =user= - the user id 
    481    * =tmpFilename= - name of a temporary file containing the attachment data 
    482  
    483 *Since:* TWiki::Plugins::VERSION = 1.025 
    484  
    485 =cut 
    486  
    487 sub DISABLE_beforeAttachmentSaveHandler { 
    488     # do not uncomment, use $_[0], $_[1]... instead 
    489     ###   my( $attrHashRef, $topic, $web ) = @_; 
    490     TWiki::Func::writeDebug( "- ${pluginName}::beforeAttachmentSaveHandler( $_[2].$_[1] )" ) if $debug; 
    491 } 
    492  
    493 =pod 
    494  
    495 ---++ afterAttachmentSaveHandler(\%attrHash, $topic, $web, $error ) 
    496    * =\%attrHash= - reference to hash of attachment attribute values 
    497    * =$topic= - the name of the topic in the current CGI query 
    498    * =$web= - the name of the web in the current CGI query 
    499    * =$error= - any error string generated during the save process 
    500 This handler is called just after the save action. The attributes hash 
    501 will include at least the following attributes: 
    502    * =attachment= => the attachment name 
    503    * =comment= - the comment 
    504    * =user= - the user id 
    505  
    506 *Since:* TWiki::Plugins::VERSION = 1.025 
    507  
    508 =cut 
    509  
    510 sub DISABLE_afterAttachmentSaveHandler { 
    511     # do not uncomment, use $_[0], $_[1]... instead 
    512     ###   my( $attrHashRef, $topic, $web ) = @_; 
    513     TWiki::Func::writeDebug( "- ${pluginName}::afterAttachmentSaveHandler( $_[2].$_[1] )" ) if $debug; 
    514 } 
    515  
    516 =pod 
    517  
    518 ---++ mergeHandler( $diff, $old, $new, \%info ) -> $text 
    519 Try to resolve a difference encountered during merge. The =differences=  
    520 array is an array of hash references, where each hash contains the  
    521 following fields: 
    522    * =$diff= => one of the characters '+', '-', 'c' or ' '. 
    523       * '+' - =new= contains text inserted in the new version 
    524       * '-' - =old= contains text deleted from the old version 
    525       * 'c' - =old= contains text from the old version, and =new= text 
    526         from the version being saved 
    527       * ' ' - =new= contains text common to both versions, or the change 
    528         only involved whitespace 
    529    * =$old= => text from version currently saved 
    530    * =$new= => text from version being saved 
    531    * =\%info= is a reference to the form field description { name, title, 
    532      type, size, value, tooltip, attributes, referenced }. It must _not_ 
    533      be wrtten to. This parameter will be undef when merging the body 
    534      text of the topic. 
    535  
    536 Plugins should try to resolve differences and return the merged text.  
    537 For example, a radio button field where we have  
    538 ={ diff=>'c', old=>'Leafy', new=>'Barky' }= might be resolved as  
    539 ='Treelike'=. If the plugin cannot resolve a difference it should return  
    540 undef. 
    541  
    542 The merge handler will be called several times during a save; once for  
    543 each difference that needs resolution. 
    544  
    545 If any merges are left unresolved after all plugins have been given a  
    546 chance to intercede, the following algorithm is used to decide how to  
    547 merge the data: 
    548    1 =new= is taken for all =radio=, =checkbox= and =select= fields to  
    549      resolve 'c' conflicts 
    550    1 '+' and '-' text is always included in the the body text and text 
    551      fields 
    552    1 =&lt;del>conflict&lt;/del> &lt;ins>markers&lt;/ins>= are used to  
    553      mark 'c' merges in text fields 
    554  
    555 The merge handler is called whenever a topic is saved, and a merge is  
    556 required to resolve concurrent edits on a topic. 
    557  
    558 *Since:* TWiki::Plugins::VERSION = 1.1 
    559  
    560 =cut 
    561  
    562 sub DISABLE_mergeHandler { 
    563 } 
    564  
    565 =pod 
    566  
    567 ---++ modifyHeaderHandler( \%headers, $query ) 
    568    * =\%headers= - reference to a hash of existing header values 
    569    * =$query= - reference to CGI query object 
    570 Lets the plugin modify the HTTP headers that will be emitted when a 
    571 page is written to the browser. \%headers= will contain the headers 
    572 proposed by the core, plus any modifications made by other plugins that also 
    573 implement this method that come earlier in the plugins list. 
    574 <verbatim> 
    575 $headers->{expires} = '+1h'; 
    576 </verbatim> 
    577  
    578 Note that this is the HTTP header which is _not_ the same as the HTML 
    579 &lt;HEAD&gt; tag. The contents of the &lt;HEAD&gt; tag may be manipulated 
    580 using the =TWiki::Func::addToHEAD= method. 
    581  
    582 *Since:* TWiki::Plugins::VERSION 1.1 
    583  
    584 =cut 
    585  
    586 sub DISABLE_modifyHeaderHandler { 
    587     my ( $headers, $query ) = @_; 
    588  
    589     TWiki::Func::writeDebug( "- ${pluginName}::modifyHeaderHandler()" ) if $debug; 
    590 } 
    591  
    592 =pod 
    593  
    594 ---++ redirectCgiQueryHandler($query, $url ) 
    595    * =$query= - the CGI query 
    596    * =$url= - the URL to redirect to 
    597  
    598 This handler can be used to replace TWiki's internal redirect function. 
    599  
    600 If this handler is defined in more than one plugin, only the handler 
    601 in the earliest plugin in the INSTALLEDPLUGINS list will be called. All 
    602 the others will be ignored. 
    603  
    604 *Since:* TWiki::Plugins::VERSION 1.010 
    605  
    606 =cut 
    607  
    608 sub DISABLE_redirectCgiQueryHandler { 
    609     # do not uncomment, use $_[0], $_[1] instead 
    610     ### my ( $query, $url ) = @_; 
    611  
    612     TWiki::Func::writeDebug( "- ${pluginName}::redirectCgiQueryHandler( query, $_[1] )" ) if $debug; 
    613 } 
    614  
    615 =pod 
    616  
    617 ---++ renderFormFieldForEditHandler($name, $type, $size, $value, $attributes, $possibleValues) -> $html 
    618  
    619 This handler is called before built-in types are considered. It generates  
    620 the HTML text rendering this form field, or false, if the rendering  
    621 should be done by the built-in type handlers. 
    622    * =$name= - name of form field 
    623    * =$type= - type of form field (checkbox, radio etc) 
    624    * =$size= - size of form field 
    625    * =$value= - value held in the form field 
    626    * =$attributes= - attributes of form field  
    627    * =$possibleValues= - the values defined as options for form field, if 
    628      any. May be a scalar (one legal value) or a ref to an array 
    629      (several legal values) 
    630  
    631 Return HTML text that renders this field. If false, form rendering 
    632 continues by considering the built-in types. 
    633  
    634 *Since:* TWiki::Plugins::VERSION 1.1 
    635  
    636 Note that since TWiki-4.2, you can also extend the range of available 
    637 types by providing a subclass of =TWiki::Form::FieldDefinition= to implement 
    638 the new type (see =TWiki::Plugins.JSCalendarContrib= and 
    639 =TWiki::Plugins.RatingContrib= for examples). This is the preferred way to 
    640 extend the form field types, but does not work for TWiki < 4.2. 
    641  
    642 =cut 
    643  
    644 sub DISABLE_renderFormFieldForEditHandler { 
    645 } 
    646  
    647 =pod 
    648  
    649 ---++ renderWikiWordHandler($linkText, $hasExplicitLinkLabel, $web, $topic) -> $linkText 
    650    * =$linkText= - the text for the link i.e. for =[<nop>[Link][blah blah]]= 
    651      it's =blah blah=, for =BlahBlah= it's =BlahBlah=, and for [[Blah Blah]] it's =Blah Blah=. 
    652    * =$hasExplicitLinkLabel= - true if the link is of the form =[<nop>[Link][blah blah]]= (false if it's ==<nop>[Blah]] or =BlahBlah=) 
    653    * =$web=, =$topic= - specify the topic being rendered (only since TWiki 4.2) 
    654  
    655 Called during rendering, this handler allows the plugin a chance to change 
    656 the rendering of labels used for links. 
    657  
    658 Return the new link text. 
    659  
    660 *Since:* TWiki::Plugins::VERSION 1.1 
    661  
    662 =cut 
    663  
    664 sub DISABLE_renderWikiWordHandler { 
    665     my( $linkText, $hasExplicitLinkLabel, $web, $topic ) = @_; 
    666     return $linkText; 
    667 } 
    668  
    669 =pod 
    670  
    671 ---++ completePageHandler($html, $httpHeaders) 
    672  
    673 This handler is called on the ingredients of every page that is 
    674 output by the standard TWiki scripts. It is designed primarily for use by 
    675 cache and security plugins. 
    676    * =$html= - the body of the page (normally &lt;html>..$lt;/html>) 
    677    * =$httpHeaders= - the HTTP headers. Note that the headers do not contain 
    678      a =Content-length=. That will be computed and added immediately before 
    679      the page is actually written. This is a string, which must end in \n\n. 
    680  
    681 *Since:* TWiki::Plugins::VERSION 1.2 
    682  
    683 =cut 
    684  
    685 sub DISABLE_completePageHandler { 
    686     #my($html, $httpHeaders) = @_; 
    687     # modify $_[0] or $_[1] if you must change the HTML or headers 
    688 } 
    689  
    690 =pod 
    691  
    692 ---++ restExample($session) -> $text 
    693  
    694 This is an example of a sub to be called by the =rest= script. The parameter is: 
    695    * =$session= - The TWiki object associated to this session. 
    696  
    697 Additional parameters can be recovered via de query object in the $session. 
    698  
    699 For more information, check %SYSTEMWEB%.CommandAndCGIScripts#rest 
    700  
    701 *Since:* TWiki::Plugins::VERSION 1.1 
    702  
    703 =cut 
    704  
    705 sub restExample { 
    706    #my ($session) = @_; 
    707    return "This is an example of a REST invocation\n\n"; 
    708 } 
    709  
    710931; 
  • trunk/core/data/System/Plugins.txt

    r700 r812  
    33---+ Plugins 
    44 
    5 _Add functionality to TWiki with readily available plugins; create plugins based on APIs_ 
     5_Add functionality to Foswiki with readily available plugins; create plugins based on APIs_ 
    66 
    77%TOC% 
     
    99---++ Overview 
    1010 
    11 You can add plugins to extend TWiki functionality, without altering the core code. A plug-in approach lets you: 
    12  
    13    * add virtually unlimited features while keeping the main TWiki code compact and efficient; 
    14    * heavily customize an installation and still do clean updates to new versions of TWiki; 
    15    * rapidly develop new TWiki functions in Perl using the plugin API. 
    16  
    17 Everything to do with TWiki plugins - demos, new releases, downloads, development, general discussion - is available at TWiki.org, in the <b> TWiki:Plugins </b> web. 
    18  
    19 TWiki plugins are developed and contributed by interested members of the community. Plugins are provided on an 'as is' basis; they are not a part of TWiki, but are independently developed and maintained. 
    20  
    21 __Relevant links on TWiki.org:__ 
    22    * TWiki:Support.PluginsSupplement - __%T% tip:__ supplemental documentation on plugins 
    23    * TWiki:Plugins.PluginPackage - list of all contributed plugin packages 
    24    * TWiki:Plugins.PluginDevelopment - discussion and feedback on contributed plugins 
    25    * TWiki:Plugins.PluginBrainstorming - open forum for new plugin ideas 
    26    * TWiki:Plugins.PluginPackageHowTo - template to create a new plugin package 
     11You can add plugins to extend Foswiki functionality, without altering the core code. A plug-in approach lets you: 
     12 
     13   * add virtually unlimited features while keeping the main Foswiki code compact and efficient; 
     14   * heavily customize an installation and still do clean updates to new versions of Foswiki; 
     15   * rapidly develop new Foswiki functions in Perl using the plugin API. 
     16 
     17Everything to do with Foswiki plugins - demos, new releases, downloads, development, general discussion - is available at Foswiki.org, in the <b> Foswiki:Extensions </b> web. 
     18 
     19Foswiki plugins are developed and contributed by interested members of the community. Plugins are provided on an 'as is' basis; they are not a part of Foswiki, but are independently developed and maintained. 
     20 
     21Most TWiki&trade; plugins can also be used with Foswiki if the TWikiCompatibilityPlugin is installed. 
    2722 
    2823__See other types of extensions:__ ContributedAddOns, [[Contribs]], [[Skins]] 
     
    3126---++ Installing Plugins 
    3227 
    33 Each TWiki plugin comes with its own documentation: step-by-step installation instructions, a detailed description of any special requirements, version details, and a working example for testing. Many plugins have an install script that automates these steps for you. 
     28Each Foswiki plugin comes with its own documentation: step-by-step installation instructions, a detailed description of any special requirements, version details, and a working example for testing. Many plugins have an install script that automates these steps for you. 
    3429 
    3530*Special Requirements:* Some plugins need certain Perl modules to be preinstalled on the host system. Plugins may also use other resources, like graphics, other modules, applications, and templates. You should be able to find detailed instructions in the plugin's documentation. 
    3631 
    37 Each plugin has a standard release topic, located in the TWiki:Plugins web at TWiki.org. There's usually a number of other related topics, such as a developers page, and an appraisal page. 
     32Each plugin has a standard release topic, located in the Foswiki:Extensions web at Foswiki.org. There's usually a number of other related topics, such as a developers page, and an appraisal page. 
    3833 
    3934#PreTesting 
    4035---+++ On-Site Pretesting 
    4136 
    42 The recommended approach to testing new plugins before making them public is to create a second local TWiki installation, and test the plugin there. You can allow selected users access to the test area. Once you are satisfied that it won't compromise your main installation, you can install it there as well. 
    43  
    44 InstalledPlugins shows which plugins are: 1) installed, 2) loading properly, and 3) what TWiki:Codev.PluginHandlers they invoke. Any failures are shown in the Errors section. The =[[VarFAILEDPLUGINS][%<nop>FAILEDPLUGINS%]]= macro can be used to debug failures. You may also want to check your webserver error log and the various TWiki log files. 
     37The recommended approach to testing new plugins before making them public is to create a second local Foswiki installation, and test the plugin there. You can allow selected users access to the test area. Once you are satisfied that it won't compromise your main installation, you can install it there as well. 
     38 
     39InstalledPlugins shows which plugins are: 1) installed, 2) loading properly, and 3) what plugin handlers they invoke. Any failures are shown in the Errors section. The =[[VarFAILEDPLUGINS][%<nop>FAILEDPLUGINS%]]= macro can be used to debug failures. You may also want to check your webserver error log and the various Foswiki log files. 
    4540 
    4641---+++ Some Notes on Plugin Performance 
    4742 
    48 The performance of the system depends to some extent on the number of plugins installed and on the plugin implementation. Some plugins impose no measurable performance decrease, some do. For example, a Plugin might use many Perl libraries that need to be initialized with each page view (unless you run mod_perl). You can only really tell the performance impact by installing the plugin and by measuring the performance with and without the new plugin. Use the TWiki:Plugins.PluginBenchmarkAddOn, or test manually with the Apache =ab= utility. Example on Unix:%BR% =time wget -qO /dev/null <nop>%SCRIPTURLPATH{"view"}%/%SYSTEMWEB%/AbcPlugin= 
     43The performance of the system depends to some extent on the number of plugins installed and on the plugin implementation. Some plugins impose no measurable performance decrease, some do. For example, a Plugin might use many Perl libraries that need to be initialized with each page view (unless you run mod_perl). You can only really tell the performance impact by installing the plugin and by measuring the performance with and without the new plugin, on real data. 
    4944 
    5045%T% If you need to install an "expensive" plugin, but you only need its functionality only in a subset of your data, you can disable it elsewhere by defining the %<nop>DISABLEDPLUGINS% setting. 
     
    7873   * =Set SHORTDESCRIPTION = Control attributes of tables and sorting of table columns= 
    7974  
    80 [[Preference settings]] of active plugins can be retrieved anywhere in TWiki with =%&lt;pluginname&gt;_&lt;var&gt;%=, such as =%<nop>TABLEPLUGIN_SHORTDESCRIPTION%=. They can also be redefined with the =%&lt;pluginname&gt;_&lt;var&gt;%= setting at a lower level in the [[%LOCALSITEPREFS%]] or at the web level. For an easier upgrade it is recommended to customize plugin preference settings in <nop>%LOCALSITEPREFS% only. 
     75[[Preference settings]] of active plugins can be retrieved anywhere in Foswiki with =%&lt;pluginname&gt;_&lt;var&gt;%=, such as =%<nop>TABLEPLUGIN_SHORTDESCRIPTION%=. They can also be redefined with the =%&lt;pluginname&gt;_&lt;var&gt;%= setting at a lower level in the [[%LOCALSITEPREFS%]] or at the web level. For an easier upgrade it is recommended to customize plugin preference settings in <nop>%LOCALSITEPREFS% only. 
    8176 
    8277---+++ Listing Active Plugins 
     
    8479Plugin status macros let you list all active plugins wherever needed. 
    8580 
    86 This site is running TWiki version *%WIKIVERSION%*, plugin API version 
     81This site is running Foswiki version *%WIKIVERSION%*, plugin API version 
    8782*%PLUGINVERSION{}%* 
    8883 
    8984#ActivatedPlugins 
    9085---++++ =%<nop>ACTIVATEDPLUGINS%= 
    91 On this TWiki site, the enabled plugins are: %ACTIVATEDPLUGINS%. 
     86On this Foswiki site, the enabled plugins are: %ACTIVATEDPLUGINS%. 
    9287 
    9388---++++ =%<nop>PLUGINDESCRIPTIONS%= 
     
    9994 
    10095#PluginAPI 
    101 ---++ The TWiki Plugin API 
    102  
    103 The Application Programming Interface (API) for TWiki plugins provides the specifications for hooking into the core TWiki code from your external Perl plugin module. 
     96---++ The Foswiki Plugin API 
     97 
     98The Application Programming Interface (API) for Foswiki plugins provides the specifications for hooking into the core Foswiki code from your external Perl plugin module. 
    10499 
    105100---+++ Available Core Functions 
    106101 
    107 The TWikiFuncDotPm module (=lib/TWiki/Func.pm=) describes *all* the interfaces available to plugins. Plugins should *only* use the interfaces described in this module. 
    108  
    109 __%X% Note:__ If you use other core functions not described in =Func.pm=, you run the risk of creating security holes. Also, your plugin will likely break and require updating when you upgrade to a new version of TWiki. 
     102The FoswikiFuncDotPm module (=lib/Foswiki/Func.pm=) describes *all* the interfaces available to plugins. Plugins should *only* use the interfaces described in this module. 
     103 
     104__%X% Note:__ If you use other core functions not described in =Func.pm=, you run the risk of creating security holes. Also, your plugin will likely break and require updating when you upgrade to a new version of Foswiki. 
    110105 
    111106---+++ Predefined Hooks 
    112107 
    113 In addition to TWiki core functions, plugins can use *predefined hooks*, or *callbacks*, as described in the =lib/TWiki/Plugins/EmptyPlugin.pm= module. 
     108In addition to Foswiki core functions, plugins can use *predefined hooks*, or *callbacks*, as described in the =lib/Foswiki/Plugins/EmptyPlugin.pm= module. 
    114109 
    115110   * All but the initPlugin are disabled. To enable a callback, remove =DISABLE_= from the function name. 
    116111 
    117 TWiki:Codev/StepByStepRenderingOrder helps you decide which rendering handler to use. 
     112Foswiki:Codev/StepByStepRenderingOrder helps you decide which rendering handler to use. 
    118113 
    119114#FastPluginHints 
     
    124119        =eval { require IPC::Run }= %BR% 
    125120        =return "&lt;font color=\"red\"&gt;SamplePlugin: Can't load required modules ($@)&lt;/font&gt;" if $@;= 
    126    * Keep the main plugin package as small as possible; create other packages that are loaded if and only if they are used. For example, create sub-packages of !BathPlugin in =lib/TWiki/Plugins/BathPlugin/=. 
    127    * Avoid using preferences in the plugin topic; set =$NO_PREFS_IN_TOPIC= if you possibly can, as that will stop TWiki from reading the plugin topic for every page. Use [[#ConfigSpec][Config.spec]] instead.  
     121   * Keep the main plugin package as small as possible; create other packages that are loaded if and only if they are used. For example, create sub-packages of !BathPlugin in =lib/Foswiki/Plugins/BathPlugin/=. 
     122   * Avoid using preferences in the plugin topic; set =$NO_PREFS_IN_TOPIC= if you possibly can, as that will stop Foswiki from reading the plugin topic for every page. Use [[#ConfigSpec][Config.spec]] instead.  
    128123   * Use registered tag handlers 
    129124   * [[#MeasurePerformance][Measure the performance]] to see the difference 
     
    138133      * The plugin initialization code does not register a plugin that returns 0 (or that has no =initPlugin= handler). 
    139134 
    140    * =$TWiki::Plugins::VERSION= in the =TWiki::Plugins= module contains the TWiki plugin API version, currently *%PLUGINVERSION{}%*. 
     135   * =$Foswiki::Plugins::VERSION= in the =Foswiki::Plugins= module contains the Foswiki plugin API version, currently *%PLUGINVERSION{}%*. 
    141136      * You can also use the =[[VarPLUGINVERSION][%<nop>PLUGINVERSION{}%]]= macro to query the plugin API version or the version of installed plugins. 
    142137 
    143138---+++ Security 
    144139 
    145    * Badly written plugins can open huge security holes in TWiki. This is especially true if care isn't taken to prevent execution of arbitrary commands on the server. 
    146    * Don't allow sensitive configuration data to be edited by users. it is better to add sensitive configuration options to the =%TWiki::cfg= hash than adding it as preferences in the plugin topic. 
     140   * Badly written plugins can open huge security holes in Foswiki. This is especially true if care isn't taken to prevent execution of arbitrary commands on the server. 
     141   * Don't allow sensitive configuration data to be edited by users. it is better to add sensitive configuration options to the =%Foswiki::cfg= hash than adding it as preferences in the plugin topic. 
    147142      * [[#ConfigSpec][Integrating with <code>configure</code>]] describes the steps 
    148       * TWiki:Plugins.MailInContrib has an example 
    149       * TWiki:Plugins.BuildContrib can help you with this 
    150    * Always use the TWiki::Sandbox to execute commands. 
     143      * Foswiki:Plugins.MailInContrib has an example 
     144      * Foswiki:Plugins.BuildContrib can help you with this 
     145   * Always use the Foswiki::Sandbox to execute commands. 
    151146   * Always audit the plugins you install, and make sure you are happy with the level of security provided. While every effort is made to monitor plugin authors activities, at the end of the day they are uncontrolled user contributions. 
    152147 
     
    154149---++ Creating Plugins 
    155150 
    156 With a reasonable knowledge of the Perl scripting language, you can create new plugins or modify and extend existing ones. Basic plug-in architecture uses an Application Programming Interface (API), a set of software instructions that allow external code to interact with the main program. The [[#PluginAPI][TWiki Plugin API]] provides the programming interface for TWiki. 
     151With a reasonable knowledge of the Perl scripting language, you can create new plugins or modify and extend existing ones. Basic plug-in architecture uses an Application Programming Interface (API), a set of software instructions that allow external code to interact with the main program. The [[#PluginAPI][Foswiki Plugin API]] provides the programming interface for Foswiki. 
    157152 
    158153---+++ Anatomy of a Plugin 
    159154 
    160 A (very) basic TWiki plugin consists of two files: 
     155A (very) basic Foswiki plugin consists of two files: 
    161156 
    162157   * a Perl module, e.g. =MyFirstPlugin.pm= 
    163158   * a documentation topic, e.g. =MyFirstPlugin.txt= 
    164159 
    165 The Perl module can be a block of code that talks to with TWiki alone, or it can include other elements, like other Perl modules (including other plugins), graphics, TWiki templates, external applications (ex: a Java applet), or just about anything else it can call. 
    166 In particular, files that should be web-accessible (graphics, Java applets ...) are best placed as attachments of the =MyFirstPlugin= topic. Other needed Perl code is best placed in a =lib/TWiki/Plugins/MyFirstPlugin/= directory. 
    167  
    168 The plugin API handles the details of connecting your Perl module with main TWiki code. When you're familiar with the [[#PluginAPI][Plugin API]], you're ready to develop plugins. 
    169  
    170 _The TWiki:Plugins.BuildContrib module provides a lot of support for plugins development, including a plugin creator, automatic publishing support, and automatic installation script writer. If you plan on writing more than one plugin, you probably need it_. 
     160The Perl module can be a block of code that talks to with Foswiki alone, or it can include other elements, like other Perl modules (including other plugins), graphics, Foswiki templates, external applications (ex: a Java applet), or just about anything else it can call. 
     161In particular, files that should be web-accessible (graphics, Java applets ...) are best placed as attachments of the =MyFirstPlugin= topic. Other needed Perl code is best placed in a =lib/Foswiki/Plugins/MyFirstPlugin/= directory. 
     162 
     163The plugin API handles the details of connecting your Perl module with main Foswiki code. When you're familiar with the [[#PluginAPI][Plugin API]], you're ready to develop plugins. 
     164 
     165_The Foswiki:Plugins.BuildContrib module provides a lot of support for plugins development, including a plugin creator, automatic publishing support, and automatic installation script writer. If you plan on writing more than one plugin, you probably need it_. 
    171166 
    172167---+++ Creating the Perl Module  
    173168 
    174 Copy file =lib/TWiki/Plugins/EmptyPlugin.pm= to =&lt;name&gt;Plugin.pm=. The =EmptyPlugin.pm= module contains mostly empty functions, so it does nothing, but it's ready to be used. Customize it. Refer to the [[#PluginAPI][Plugin API]] specs for more information. 
     169Copy file =lib/Foswiki/Plugins/EmptyPlugin.pm= to =&lt;name&gt;Plugin.pm=. The =EmptyPlugin.pm= module contains mostly empty functions, so it does nothing, but it's ready to be used. Customize it. Refer to the [[#PluginAPI][Plugin API]] specs for more information. 
    175170 
    176171If your plugin uses its own modules and objects, you must include the name of the plugin in the package name. For example, write =Package <nop>MyFirstPlugin::Attrs;= instead of just =Package Attrs;=. Then call it using: 
    177172<pre> 
    178 use TWiki::Plugins::MyFirstPlugin::Attrs; 
     173use Foswiki::Plugins::MyFirstPlugin::Attrs; 
    179174$var = MyFirstPlugin::Attrs->new(); 
    180175</pre> 
     
    185180The plugin documentation topic contains usage instructions and version details. It serves the plugin files as %SYSTEMWEB%.FileAttachments for downloading. (The doc topic is also included _in_ the [[#CreatePluginPackage][distribution package]].) To create a documentation topic: 
    186181 
    187    1. *Copy* the plugin topic template from TWiki.org. To copy the text, go to TWiki:Plugins/PluginPackage and: 
     182   1. *Copy* the plugin topic template from Foswiki.org. To copy the text, go to Foswiki:Plugins/PluginPackage and: 
    188183      * enter the plugin name in the "How to Create a Plugin" section 
    189184      * click Create 
     
    194189      * paste &amp; save new plugin topic on your site 
    195190   1. *Customize* your plugin topic. 
    196       * Important: In case you plan to publish your plugin on TWiki.org, use Interwiki names for author names and links to TWiki.org topics, such as TWiki:Main/%WIKINAME%. This is important because links should work properly in a plugin topic installed on any TWiki, not just on TWiki.org. 
     191      * Important: In case you plan to publish your plugin on Foswiki.org, use Interwiki names for author names and links to Foswiki.org topics, such as Foswiki:Main/%WIKINAME%. This is important because links should work properly in a plugin topic installed on any Foswiki, not just on Foswiki.org. 
    197192   1. *Document* the performance data you gathered while [[#MeasurePerformance][measuring the performance]] 
    198193   1. *Save* your topic, for use in [[#CreatePluginPackage][packaging]] and [[#PublishPlugin][publishing]] your plugin. 
     
    200195<blockquote style="background-color:#f5f5f5"> 
    201196*OUTLINE: Doc Topic Contents* <br /> 
    202 Check the plugins web on TWiki.org for the latest plugin doc topic template. Here's a quick overview of what's covered: 
     197Check the plugins web on Foswiki.org for the latest plugin doc topic template. Here's a quick overview of what's covered: 
    203198 
    204199*Syntax Rules:* &lt;<i>Describe any special text formatting that will be rendered.</i>&gt;"  
     
    206201*Example:* &lt;<i>Include an example of the plugin in action. Possibly include a static HTML version of the example to compare if the installation was a success!</i>&gt;" 
    207202 
    208 *Plugin Settings:* &lt;<i>Description and settings for custom plugin settings, and those required by TWiki.</i>&gt;" 
    209  
    210    * *Plugins Preferences* &lt;<i>If user settings are needed, link to [[%SYSTEMWEB%.PreferenceSettings][preference settings]] and explain the role of the plugin name prefix 
     203*Plugin Settings:* &lt;<i>Description and settings for custom plugin settings, and those required by Foswiki.</i>&gt;" 
     204 
     205   * *Plugins Preferences* &lt;<i>If user settings are needed, link to [[%SYSTEMWEB%.PreferenceSettings][preference settings]] and explain the role of the plugin name prefix</i> 
    211206 
    212207*Plugin Installation Instructions:* &lt;<i>Step-by-step set-up guide, user help, whatever it takes to install and run, goes here.</i>&gt;" 
    213208 
    214 *Plugin Info:* &lt;<i>Version, credits, history, requirements - entered in a form, displayed as a table. Both are automatically generated when you create or edit a page in the TWiki:Plugins web.</i>&gt;" 
     209*Plugin Info:* &lt;<i>Version, credits, history, requirements - entered in a form, displayed as a table. Both are automatically generated when you create or edit a page in the Foswiki:Plugins web.</i>&gt; 
    215210</blockquote> 
    216211 
     
    218213---+++ Packaging for Distribution 
    219214 
    220 The TWiki:Plugins.BuildContrib is a powerful build environment that is used by the TWiki project to build TWiki itself, as well as many of the plugins. You don't *have* to use it, but it is highly recommended! 
     215The Foswiki:Plugins.BuildContrib is a powerful build environment that is used by the Foswiki project to build Foswiki itself, as well as many of the plugins. You don't *have* to use it, but it is highly recommended! 
    221216 
    222217If you don't want (or can't) use the !BuildContrib, then a minimum plugin release consists of a Perl module with a WikiName that ends in =Plugin=, ex: =MyFirstPlugin.pm=, and a documentation page with the same name(=MyFirstPlugin.txt=). 
    223218 
    224    1. Distribute the plugin files in a directory structure that mirrors TWiki. If your plugin uses additional files, include them all: 
    225       * =lib/TWiki/Plugins/MyFirstPlugin.pm= 
    226       * =data/TWiki/MyFirstPlugin.txt= 
    227       * =pub/TWiki/MyFirstPlugin/uparrow.gif= [a required graphic] 
     219   1. Distribute the plugin files in a directory structure that mirrors Foswiki. If your plugin uses additional files, include them all: 
     220      * =lib/Foswiki/Plugins/MyFirstPlugin.pm= 
     221      * =data/Foswiki/MyFirstPlugin.txt= 
     222      * =pub/Foswiki/MyFirstPlugin/uparrow.gif= [a required graphic] 
    228223   2. Create a zip archive with the plugin name (=MyFirstPlugin.zip=) and add the entire directory structure from Step 1. The archive should look like this: 
    229       * =lib/TWiki/Plugins/MyFirstPlugin.pm= 
    230       * =data/TWiki/MyFirstPlugin.txt= 
    231       * =pub/TWiki/MyFirstPlugin/uparrow.gif= 
     224      * =lib/Foswiki/Plugins/MyFirstPlugin.pm= 
     225      * =data/Foswiki/MyFirstPlugin.txt= 
     226      * =pub/Foswiki/MyFirstPlugin/uparrow.gif= 
    232227 
    233228#MeasurePerformance 
    234229---+++ Measuring and Improving the Plugin Performance 
    235230 
    236 A high quality plugin performs well. You can use the TWiki:Plugins.PluginBenchmarkAddOn to measure your TWiki:Plugins.PluginBenchmarks. The data is needed as part of the Documentation Topic. 
     231A high quality plugin performs well. You can use the Foswiki:Plugins.PluginBenchmarkAddOn to measure your Foswiki:Plugins.PluginBenchmarks. The data is needed as part of the Documentation Topic. 
    237232 
    238233See also [[#FastPluginHints][Hints on Writing Fast Plugins]]. 
     
    241236---+++ Publishing for Public Use 
    242237 
    243 You can release your tested, packaged plugin to the TWiki community through the TWiki:Plugins web. All plugins submitted to TWiki.org are available for download and further development in TWiki:Plugins/PluginPackage. 
     238You can release your tested, packaged plugin to the Foswiki community through the Foswiki:Plugins web. All plugins submitted to Foswiki.org are available for download and further development in Foswiki:Plugins/PluginPackage. 
    244239 
    245240Publish your plugin by following these steps: 
    246    1. *Post* the plugin documentation topic in the TWiki:Plugins/PluginPackage: 
     241   1. *Post* the plugin documentation topic in the Foswiki:Plugins/PluginPackage: 
    247242      * enter the plugin name in the "How to Create a Plugin" section, for example =MyFirstPlugin= 
    248243      * paste in the topic text from [[#CreatePluginTopic][Writing the Documentation Topic]] and save 
    249244   1. *Attach* the distribution zip file to the topic, ex: =MyFirstPlugin.zip= 
    250    1. *Link* from the doc page to a new, blank page named after the plugin, and ending in =Dev=, ex: =MyFirstPluginDev=. This is the discussion page for future development. (User support for plugins is handled in TWiki:Support.) 
    251    1. *Put* the plugin into the SVN repository, see TWiki:Plugins/ReadmeFirst (optional) 
     245   1. *Link* from the doc page to a new, blank page named after the plugin, and ending in =Dev=, ex: =MyFirstPluginDev=. This is the discussion page for future development. (User support for plugins is handled in Foswiki:Support.) 
     246   1. *Put* the plugin into the SVN repository, see Foswiki:Plugins/ReadmeFirst (optional) 
    252247 
    253248%N% Once you have done the above steps once, you can use the !BuildContrib to upload updates to your plugin. 
    254249 
    255 Thank you very much for sharing your plugin with the TWiki community :-) 
     250Thank you very much for sharing your plugin with the Foswiki community :-) 
    256251 
    257252#RecommendedStorageOfPluginData 
    258253---++ Recommended Storage of Plugin Specific Data 
    259254 
    260 Plugins sometimes need to store data. This can be plugin internal data such as cache data, or data generated for browser consumption such as images. Plugins should store data using TWikiFuncDotPm functions that support saving and loading of topics and attachments. 
     255Plugins sometimes need to store data. This can be plugin internal data such as cache data, or data generated for browser consumption such as images. Plugins should store data using FoswikiFuncDotPm functions that support saving and loading of topics and attachments. 
    261256 
    262257---+++ Plugin Internal Data 
    263258 
    264 You can create a plugin "work area" using the =TWiki::Func::getWorkArea()= function, which gives you a persistent directory where you can store data files. By default they will not be web accessible. The directory is guaranteed to exist, and to be writable by the webserver user. For convenience, =TWiki::Func::storeFile()= and =TWiki::Func::readFile()= are provided to persistently store and retrieve simple data in this area. 
     259You can create a plugin "work area" using the =Foswiki::Func::getWorkArea()= function, which gives you a persistent directory where you can store data files. By default they will not be web accessible. The directory is guaranteed to exist, and to be writable by the webserver user. For convenience, =Foswiki::Func::storeFile()= and =Foswiki::Func::readFile()= are provided to persistently store and retrieve simple data in this area. 
    265260 
    266261---+++ Web Accessible Data 
    267262 
    268 __Topic-specific data__ such as generated images can be stored in the topic's attachment area, which is web accessible. Use the =TWiki::Func::saveAttachment()= function to store the data. 
     263__Topic-specific data__ such as generated images can be stored in the topic's attachment area, which is web accessible. Use the =Foswiki::Func::saveAttachment()= function to store the data. 
    269264 
    270265Recommendation for file name: 
     
    274269   * Example: =_GaugePlugin_img123.gif= 
    275270 
    276 __Web specific data__ can be stored in the plugin's attachment area, which is web accessible. Use the =TWiki::Func::saveAttachment()= function to store the data. 
     271__Web specific data__ can be stored in the plugin's attachment area, which is web accessible. Use the =Foswiki::Func::saveAttachment()= function to store the data. 
    277272 
    278273Recommendation for file names in plugin attachment area: 
     
    286281Some extensions have setup requirements that are best integrated into =configure= rather than trying to use [[%SYSTEMWEB%.PreferenceSettings][preference settings]]. These extensions use =Config.spec= files to publish their configuration requirements. 
    287282 
    288 =Config.spec= files are read during configuration. Once a =Config.spec= has defined a configuration item, it is available for edit through the standard =configure= interface. =Config.spec= files are stored in the 'plugin directory' e.g. =lib/TWiki/Plugins/BathPlugin/Config.spec=. 
     283=Config.spec= files are read during configuration. Once a =Config.spec= has defined a configuration item, it is available for edit through the standard =configure= interface. =Config.spec= files are stored in the 'plugin directory' e.g. =lib/Foswiki/Plugins/BathPlugin/Config.spec=. 
    289284 
    290285---+++ Structure of a <code>Config.spec</code> file 
     
    299294# **SELECT Plastic,Rubber,Metal** 
    300295# Select the plug type 
    301 $TWiki::cfg{BathPlugin}{PlugType} = 'Plastic'; 
     296$Foswiki::cfg{BathPlugin}{PlugType} = 'Plastic'; 
    302297 
    303298# **NUMBER** 
    304299# Enter the chain length in cm 
    305 $TWiki::cfg{BathPlugin}{ChainLength} = '30'; 
     300$Foswiki::cfg{BathPlugin}{ChainLength} = '30'; 
    306301 
    307302# **BOOLEAN EXPERT** 
    308303# Turn this option off to disable the water temperature alarm 
    309 $TWiki::cfg{BathPlugin}{TempSensorEnabled} = '1'; 
     304$Foswiki::cfg{BathPlugin}{TempSensorEnabled} = '1'; 
    310305</verbatim> 
    311 The type (e.g. =**SELECT**= ) tells =configure= to how to prompt for the value. It also tells configure how to do some basic checking on the value you actually enter. All the comments between the type and the configuration item are taken as part of the description. The configuration item itself defines the default value for the configuration item. The above spec defines the configuration items =$TWiki::cfg{BathPlugin}{PlugType}=, =$TWiki::cfg{BathPlugin}{ChainLength}=, and =$TWiki::cfg{BathPlugin}{TempSensorEnabled}= for use in your plugin. For example, 
    312 <verbatim> 
    313 if( $TWiki::cfg{BathPlugin}{TempSensorEnabled} && $curTemperature > 50 ) { 
     306The type (e.g. =**SELECT**= ) tells =configure= to how to prompt for the value. It also tells configure how to do some basic checking on the value you actually enter. All the comments between the type and the configuration item are taken as part of the description. The configuration item itself defines the default value for the configuration item. The above spec defines the configuration items =$Foswiki::cfg{BathPlugin}{PlugType}=, =$Foswiki::cfg{BathPlugin}{ChainLength}=, and =$Foswiki::cfg{BathPlugin}{TempSensorEnabled}= for use in your plugin. For example, 
     307<verbatim> 
     308if( $Foswiki::cfg{BathPlugin}{TempSensorEnabled} && $curTemperature > 50 ) { 
    314309    die "The bathwater is too hot for comfort"; 
    315310} 
     
    340335| H | means the option is not visible in =configure= | 
    341336 
    342 See =lib/TWiki.spec= for many more examples. 
     337See =lib/Foswiki.spec= for many more examples. 
    343338 
    344339=Config.spec= files are also used for other (non-plugin) extensions. in this case they are stored under the =Contrib= directory instead of the =Plugins= directory. 
    345340 
    346 TWiki:TWiki/SpecifyingConfigurationItemsForExtensions has supplemental documentation on configure settings. 
     341Foswiki:Foswiki/SpecifyingConfigurationItemsForExtensions has supplemental documentation on configure settings. 
    347342 
    348343#MaintainPlugins 
     
    351346---+++ Discussions and Feedback on Plugins 
    352347 
    353 Each published plugin has a plugin development topic on TWiki.org. Plugin development topics are named after your plugin and end in =Dev=, such as =MyFirstPluginDev=. The plugin development topic is a great resource to discuss feature enhancements and to get feedback from the TWiki community. 
    354  
    355 ---+++ Maintaining Compatibility with Earlier TWiki Versions 
    356  
    357 The plugin interface (TWikiFuncDotPm functions and plugin handlers) evolve over time. TWiki introduces new API functions to address the needs of plugin authors. Plugins using unofficial TWiki internal functions may no longer work on a TWiki upgrade. 
    358  
    359 Organizations typically do not upgrade to the latest TWiki for many months. However, many administrators still would like to install the latest versions of a plugin on their older TWiki installation. This need is fulfilled if plugins are maintained in a compatible manner.  
    360  
    361 __%T% Tip:__ Plugins can be written to be compatible with older and newer TWiki releases. This can be done also for plugins using unofficial TWiki internal functions of an earlier release that no longer work on the latest TWiki codebase.  
    362 Here is an example; the TWiki:Support.PluginsSupplement has more details. 
    363  
    364 <verbatim> 
    365     if( $TWiki::Plugins::VERSION >= 1.1 ) { 
    366         @webs = TWiki::Func::getListOfWebs( 'user,public' ); 
     348Each published plugin has a plugin development topic on Foswiki.org. Plugin development topics are named after your plugin and end in =Dev=, such as =MyFirstPluginDev=. The plugin development topic is a great resource to discuss feature enhancements and to get feedback from the Foswiki community. 
     349 
     350---+++ Maintaining Compatibility with Earlier Foswiki Versions 
     351 
     352The plugin interface (FoswikiFuncDotPm functions and plugin handlers) evolve over time. Foswiki introduces new API functions to address the needs of plugin authors. Plugins using unofficial Foswiki internal functions may no longer work on a Foswiki upgrade. 
     353 
     354Organizations typically do not upgrade to the latest Foswiki for many months. However, many administrators still would like to install the latest versions of a plugin on their older Foswiki installation. This need is fulfilled if plugins are maintained in a compatible manner.  
     355 
     356__%T% Tip:__ Plugins can be written to be compatible with older and newer Foswiki releases. This can be done also for plugins using unofficial Foswiki internal functions of an earlier release that no longer work on the latest Foswiki codebase.  
     357Here is an example; the Foswiki:Support.PluginsSupplement has more details. 
     358 
     359<verbatim> 
     360    if( $Foswiki::Plugins::VERSION >= 1.1 ) { 
     361        @webs = Foswiki::Func::getListOfWebs( 'user,public' ); 
    367362    } else { 
    368         @webs = TWiki::Func::getPublicWebList( ); 
     363        @webs = Foswiki::Func::getPublicWebList( ); 
    369364    } 
    370365</verbatim> 
     
    372367---+++ Handling deprecated functions 
    373368 
    374 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 TWiki release, and probably longer, though this cannot be guaranteed. 
    375  
    376 When a plugin defines deprecated handlers, a warning will be shown in the list generated by %<nop>FAILEDPLUGINS%. Admins who see these warnings should check TWiki.org and if necessary, contact the plugin author, for an updated version of the plugin. 
    377  
    378 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%. 
    379  
    380 This is done by defining a map from the handler name to the =TWiki::Plugins= version _in which the handler was first deprecated_. For example, if we need to define the =endRenderingHandler= for compatibility with =TWiki::Plugins= versions before 1.1, we would add this to the plugin: 
    381  
    382 <verbatim> 
    383 package TWiki::Plugins::SinkPlugin; 
    384 use vars qw( %TWikiCompatibility ); 
    385 $TWikiCompatibility{endRenderingHandler} = 1.1; 
     369From time-to-time, the Foswiki developers will add new functions to the interface (either to FoswikiFuncDotPm, 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 Foswiki release, and probably longer, though this cannot be guaranteed. 
     370 
     371When a plugin defines deprecated handlers, a warning will be shown in the list generated by %<nop>FAILEDPLUGINS%. Admins who see these warnings should check Foswiki.org and if necessary, contact the plugin author, for an updated version of the plugin. 
     372 
     373Updated 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%. 
     374 
     375This 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: 
     376 
     377<verbatim> 
     378package Foswiki::Plugins::SinkPlugin; 
     379use vars qw( %FoswikiCompatibility ); 
     380$FoswikiCompatibility{endRenderingHandler} = 1.1; 
    386381</verbatim> 
    387 If the currently-running TWiki version is 1.1 _or later_, then the _handler will not be called_ and _the warning will not be issued_. TWiki with versions of =TWiki::Plugins= before 1.1 will still call the handler as required. 
     382If the currently-running Foswiki version is 1.1 _or later_, then the _handler will not be called_ and _the warning will not be issued_. Foswiki with versions of =Foswiki::Plugins= before 1.1 will still call the handler as required. 
    388383 
    389384%STOPINCLUDE% 
    390 __Related Topics:__ DeveloperDocumentationCategory, AdminDocumentationCategory, TWiki:Support.PluginsSupplement 
    391  
     385__Related Topics:__ DeveloperDocumentationCategory, AdminDocumentationCategory, Foswiki:Support.PluginsSupplement 
     386 
  • trunk/core/lib/Foswiki.pm

    r811 r812  
    44=pod 
    55 
    6 ---+ package TWiki 
    7  
    8 TWiki operates by creating a singleton object (known as the Session 
     6---+ package Foswiki 
     7 
     8Foswiki operates by creating a singleton object (known as the Session 
    99object) that acts as a point of reference for all the different 
    1010modules in the system. This package is the class for this singleton, 
     
    3131                        not consistently used. Avoid. 
    3232   * =security=         Foswiki::Access singleton 
    33    * =SESSION_TAGS=     Hash of TWiki variables whose value is specific to 
     33   * =SESSION_TAGS=     Hash of preference settings whose value is specific to 
    3434                        the current request. 
    3535   * =store=            Foswiki::Store singleton 
     
    8888# Token character that must not occur in any normal text - converted 
    8989# to a flag character if it ever does occur (very unlikely) 
    90 # TWiki uses $TranslationToken to mark points in the text. This is 
     90# Foswiki uses $TranslationToken to mark points in the text. This is 
    9191# normally \0, which is not a useful character in any 8-bit character 
    9292# set we can find, nor in UTF-8. But if you *do* encounter problems 
     
    100100=pod 
    101101 
    102 ---++ StaticMethod getTWikiLibDir() -> $path 
     102---++ StaticMethod getLibDir() -> $path 
    103103 
    104104Returns the full path of the directory containing Foswiki.pm 
     
    106106=cut 
    107107 
    108 sub getTWikiLibDir { 
     108sub getLibDir { 
    109109    if ($twikiLibDir) { 
    110110        return $twikiLibDir; 
     
    124124    if ( $twikiLibDir =~ /^\./ ) { 
    125125        print STDERR 
    126 "WARNING: TWiki lib path $twikiLibDir is relative; you should make it absolute, otherwise some scripts may not run from the command line."; 
     126"WARNING: Foswiki lib path $twikiLibDir is relative; you should make it absolute, otherwise some scripts may not run from the command line."; 
    127127        my $bin; 
    128128 
     
    356356        import POSIX qw( locale_h LC_CTYPE LC_COLLATE ); 
    357357 
    358         # SMELL: mod_perl compatibility note: If TWiki is running under Apache, 
     358        # SMELL: mod_perl compatibility note: If Foswiki is running under Apache, 
    359359        # won't this play with the Apache process's locale settings too? 
    360360        # What effects would this have? 
     
    388388 
    389389        # No locales needed/working, or Perl 5.005, so just use 
    390         # any additional national characters defined in TWiki.cfg 
     390        # any additional national characters defined in LocalSite.cfg 
    391391        $regex{upperAlpha} = 'A-Z' . $Foswiki::cfg{UpperNational}; 
    392392        $regex{lowerAlpha} = 'a-z' . $Foswiki::cfg{LowerNational}; 
     
    423423    $regex{headerPatternNoTOC} = '(\!\!+|%NOTOC%)'; 
    424424 
    425     # TWiki concept regexes 
     425    # Foswiki concept regexes 
    426426    $regex{wikiWordRegex} = 
    427427qr/[$regex{upperAlpha}]+[$regex{lowerAlphaNum}]+[$regex{upperAlpha}]+[$regex{mixedAlphaNum}]*/o; 
     
    511511 
    512512    # initialize lib directory early because of later 'cd's 
    513     getTWikiLibDir(); 
     513    getLibDir(); 
    514514 
    515515    # initialize the runtime engine 
     
    567567        # We still don't have Codev.UnicodeSupport 
    568568        $this->writeWarning( 'UTF-8 not yet supported as site charset -' 
    569               . 'TWiki is likely to have problems' ); 
     569              . 'Foswiki is likely to have problems' ); 
    570570        return $text; 
    571571    } 
     
    11151115---++ ObjectMethod getScriptUrl( $absolute, $script, $web, $topic, ... ) -> $scriptURL 
    11161116 
    1117 Returns the URL to a TWiki script, providing the web and topic as 
     1117Returns the URL to a Foswiki script, providing the web and topic as 
    11181118"path info" parameters.  The result looks something like this: 
    11191119"http://host/twiki/bin/$script/$web/$topic". 
     
    11211121 
    11221122If $absolute is set, generates an absolute URL. $absolute is advisory only; 
    1123 TWiki can decide to generate absolute URLs (for example when run from the 
     1123Foswiki can decide to generate absolute URLs (for example when run from the 
    11241124command-line) even when relative URLs have been requested. 
    11251125 
     
    11671167 
    11681168        # See http://www.ietf.org/rfc/rfc2396.txt for the definition of 
    1169         # "absolute URI". TWiki bastardises this definition by assuming 
     1169        # "absolute URI". Foswiki bastardises this definition by assuming 
    11701170        # that all relative URLs lack the <authority> component as well. 
    11711171        $url = $this->{urlHost} . $url; 
     
    12101210Composes a pub url. If $absolute is set, returns an absolute URL. 
    12111211If $absolute is set, generates an absolute URL. $absolute is advisory only; 
    1212 TWiki can decide to generate absolute URLs (for example when run from the 
     1212Foswiki can decide to generate absolute URLs (for example when run from the 
    12131213command-line) even when relative URLs have been requested. 
    12141214 
     
    12311231 
    12321232        # See http://www.ietf.org/rfc/rfc2396.txt for the definition of 
    1233         # "absolute URI". TWiki bastardises this definition by assuming 
     1233        # "absolute URI". Foswiki bastardises this definition by assuming 
    12341234        # that all relative URLs lack the <authority> component as well. 
    12351235        $url = $this->{urlHost} . $url; 
     
    13211321Normalize a Web<nop>.<nop>TopicName 
    13221322 
    1323 See TWikiFuncDotPm for a full specification of the expansion (not duplicated 
     1323See =Foswiki::Func= for a full specification of the expansion (not duplicated 
    13241324here) 
    13251325 
     
    13551355---++ ClassMethod new( $loginName, $query, \%initialContext ) 
    13561356 
    1357 Constructs a new TWiki object. Parameters are taken from the query object. 
     1357Constructs a new Foswiki object. Parameters are taken from the query object. 
    13581358 
    13591359   * =$loginName= is the login username (*not* the wikiname) of the user you 
     
    14151415    # SMELL: can this be done in a BEGIN block? Or is the environment 
    14161416    # set per-query? 
    1417     # Item4382: Default $ENV{PATH} must be untainted because TWiki runs 
     1417    # TWikibug:Item4382: Default $ENV{PATH} must be untainted because Foswiki runs 
    14181418    # with use strict and calling external programs that writes on the disk 
    14191419    # will fail unless Perl seens it as set to safe value. 
     
    15401540    } 
    15411541 
    1542     # Item3270 - here's the appropriate place to enforce TWiki spec: 
     1542    # Item3270 - here's the appropriate place to enforce Foswiki spec: 
    15431543    # All topic name sources are evaluated, site charset applied 
    15441544    # SMELL: This untaint unchecked is duplicate of one just above 
     
    15991599    $Foswiki::Plugins::SESSION = $this; 
    16001600 
    1601     Monitor::MARK("TWiki session created"); 
     1601    Monitor::MARK("Foswiki session created"); 
    16021602 
    16031603    return $this; 
     
    21132113# Return value: $tableOfContents 
    21142114# Handles %<nop>TOC{...}% syntax.  Creates a table of contents 
    2115 # using TWiki bulleted 
     2115# using Foswiki bulleted 
    21162116# list markup, linked to the section headings of a topic. A section heading is 
    21172117# entered in one of the following forms: 
     
    23292329    else { 
    23302330        $text = 
    2331             CGI::h1('TWiki Installation Error') 
     2331            CGI::h1('Foswiki Installation Error') 
    23322332          . 'Template "' 
    23332333          . $template 
     
    25512551 
    25522552Escape special characters to HTML numeric entities. This is *not* a generic 
    2553 encoding, it is tuned specifically for use in TWiki. 
     2553encoding, it is tuned specifically for use in Foswiki. 
    25542554 
    25552555HTML4.0 spec: 
     
    25682568characters (except for \n and \r) using numeric entities. 
    25692569 
    2570 FURTHER this method also encodes characters that are special in TWiki 
     2570FURTHER this method also encodes characters that are special in Foswiki 
    25712571meta-language. 
    25722572 
     
    26282628In two cases, no URL encoding is needed:  For EBCDIC mainframes, we assume that  
    26292629site charset URLs will be translated (outbound and inbound) by the web server to/from an 
    2630 EBCDIC character set. For sites running in UTF-8, there's no need for TWiki to 
     2630EBCDIC character set. For sites running in UTF-8, there's no need for Foswiki to 
    26312631do anything since all URLs and attachment filenames are already in UTF-8. 
    26322632 
     
    28092809} 
    28102810 
    2811 # Process TWiki %TAGS{}% by parsing the input tokenised into 
     2811# Process Foswiki %TAGS{}% by parsing the input tokenised into 
    28122812# % separated sections. The parser is a simple stack-based parse, 
    28132813# sufficient to ensure nesting of tags is correct, but no more 
     
    30953095 
    30963096Adds a function to the dispatch table of the REST interface  
    3097 for a given subject. See TWikiScripts#rest for more info. 
     3097for a given subject. See System.CommandAndCGIScripts#rest for more info. 
    30983098 
    30993099   * =$subject= - The subject under which the function will be registered. 
     
    31063106</verbatim> 
    31073107where: 
    3108    * =\%session= - a reference to the TWiki session object (may be ignored) 
     3108   * =\%session= - a reference to the Foswiki session object (may be ignored) 
    31093109   * =$subject= - The invoked subject (may be ignored) 
    31103110   * =$verb= - The invoked verb (may be ignored) 
     
    31903190    $this->renderer->putBackBlocks( \$text, $verbatim, 'verbatim' ); 
    31913191 
    3192     # TWiki Plugin Hook (for cache Plugins only) 
     3192    # Foswiki Plugin Hook (for cache Plugins only) 
    31933193    $this->{plugins} 
    31943194      ->dispatch( 'afterCommonTagsHandler', $text, $theTopic, $theWeb, $meta ); 
     
    32033203Add =$html= to the HEAD tag of the page currently being generated. 
    32043204 
    3205 Note that TWiki variables may be used in the HEAD. They will be expanded 
     3205Note that macros may be used in the HEAD. They will be expanded 
    32063206according to normal variable expansion rules. 
    32073207 
     
    32103210   * =_DEFAULT= optional, id of the head block. Used to generate a comment in the output HTML. 
    32113211   * =text= optional, text to use for the head block. Mutually exclusive with =topic=. 
    3212    * =topic= optional, full TWiki path name of a topic that contains the full text to use for the head block. Mutually exclusive with =text=. Example: =topic="%WEB%.MyTopic"=. 
     3212   * =topic= optional, full Foswiki path name of a topic that contains the full text to use for the head block. Mutually exclusive with =text=. Example: =topic="%WEB%.MyTopic"=. 
    32133213   * =requires= optional, comma-separated list of id's of other head blocks this one depends on. 
    32143214=%<nop>ADDTOHEAD%= expands in-place to the empty string, unless there is an error in which case the variable expands to an error string. 
     
    32413241    my ( $this, $tag, $header, $requires ) = @_; 
    32423242 
    3243     # Expand TWiki variables in the header 
     3243    # Expand macros in the header 
    32443244    $header = 
    32453245      $this->handleCommonTags( $header, $this->{webName}, $this->{topicName} ); 
     
    33323332 
    33333333Static method to construct a new singleton session instance. 
    3334 It creates a new TWiki and sets the Plugins $SESSION variable to 
     3334It creates a new Foswiki and sets the Plugins $SESSION variable to 
    33353335point to it, so that Foswiki::Func methods will work. 
    33363336 
     
    33593359    if ( $theUrl && $theUrl ne $query->url() ) { 
    33603360        die 
    3361 'Sorry, this version of TWiki does not support the url parameter to Foswiki::initialize being different to the url in the query'; 
     3361'Sorry, this version of Foswiki does not support the url parameter to Foswiki::initialize being different to the url in the query'; 
    33623362    } 
    33633363    my $twiki = new Foswiki( $theRemoteUser, $query ); 
     
    37493749 
    37503750#deprecated functionality, now implemented using %ENV% 
    3751 #move to compatibility plugin in TWiki5 
     3751#move to compatibility plugin in Foswiki 2.0 
    37523752sub HTTP_HOST_deprecated { 
    37533753    return $_[0]->{request}->header('Host') || ''; 
     
    37553755 
    37563756#deprecated functionality, now implemented using %ENV% 
    3757 #move to compatibility plugin in TWiki5 
     3757#move to compatibility plugin in Foswiki 2.0 
    37583758sub REMOTE_ADDR_deprecated { 
    37593759    return $_[0]->{request}->remoteAddress() || ''; 
     
    37613761 
    37623762#deprecated functionality, now implemented using %ENV% 
    3763 #move to compatibility plugin in TWiki5 
     3763#move to compatibility plugin in Foswiki 2.0 
    37643764sub REMOTE_PORT_deprecated { 
    37653765 
    37663766    # CGI/1.1 (RFC 3875) doesn't specify REMOTE_PORT, 
    37673767    # but some webservers implement it. However, since 
    3768     # it's not RFC compliant, TWiki should not rely on 
     3768    # it's not RFC compliant, Foswiki should not rely on 
    37693769    # it. So we get more portability. 
    37703770    return ''; 
     
    37723772 
    37733773#deprecated functionality, now implemented using %ENV% 
    3774 #move to compatibility plugin in TWiki5 
     3774#move to compatibility plugin in Foswiki 
    37753775sub REMOTE_USER_deprecated { 
    37763776    return $_[0]->{request}->remoteUser() || ''; 
     
    41304130# Spacing of WikiWords is now done with %SPACEOUT% 
    41314131# (and the private routine _SPACEOUT). 
    4132 # Move to compatibility module in TWiki5 
     4132# Move to compatibility module in Foswiki 2.0 
    41334133sub SPACEDTOPIC_deprecated { 
    41344134    my ( $this, $params, $theTopic ) = @_; 
     
    43814381 
    43824382#deprecated functionality, now implemented using %USERINFO% 
    4383 #move to compatibility plugin in TWiki5 
     4383#move to compatibility plugin in Foswiki 2.0 
    43844384sub WIKINAME_deprecated { 
    43854385    my ( $this, $params ) = @_; 
     
    43924392 
    43934393#deprecated functionality, now implemented using %USERINFO% 
    4394 #move to compatibility plugin in TWiki5 
     4394#move to compatibility plugin in Foswiki 2.0 
    43954395sub USERNAME_deprecated { 
    43964396    my ( $this, $params ) = @_; 
     
    44034403 
    44044404#deprecated functionality, now implemented using %USERINFO% 
    4405 #move to compatibility plugin in TWiki5 
     4405#move to compatibility plugin in Foswiki 2.0 
    44064406sub WIKIUSERNAME_deprecated { 
    44074407    my ( $this, $params ) = @_; 
  • trunk/core/lib/Foswiki/Attach.pm

    r809 r812  
    312312        # Some browsers wait with rendering a page until the size of 
    313313        # embedded images is known, e.g. after all images of a page are 
    314         # downloaded. When you upload an image to TWiki and checkmark 
    315         # the link checkbox, TWiki will generate the width and height 
     314        # downloaded. When you upload an image to Foswiki and checkmark 
     315        # the link checkbox, Foswiki will generate the width and height 
    316316        # img parameters, speeding up the page rendering. 
    317317        my $stream = 
  • trunk/core/lib/Foswiki/Attrs.pm

    r809 r812  
    2727 
    2828Class of attribute sets, designed for parsing and storing attribute values 
    29 from a TWiki tag e.g. =%<nop>TAG{"joe" fred="bad" joe="mad"}%= 
     29from a macro e.g. =%<nop>MACRO{"joe" fred="bad" joe="mad"}%= 
    3030 
    3131An attribute set is a hash containing an entry for each parameter. The 
     
    3636the _first_ instance is always taken. 
    3737 
    38 As well as the default TWiki syntax (parameter values double-quoted) 
     38As well as the default Foswiki syntax (parameter values double-quoted) 
    3939this class also parses single-quoted values, unquoted spaceless 
    4040values, spaces around the =, and commas as well as spaces separating values. 
     
    6060 
    6161   * =$string= - String containing attribute specification 
    62    * =$friendly= - if true, the parse will be according to the extended syntax pioneered by the original Contrib::Attrs. Otherwise it will be strict as per traditional TWiki syntax. 
     62   * =$friendly= - if true, the parse will be according to the extended syntax pioneered by the original Contrib::Attrs. Otherwise it will be strict as per traditional syntax. 
    6363 
    6464Parse a standard attribute string containing name=value pairs and create a new 
  • trunk/core/lib/Foswiki/Compatibility.pm

    r809 r812  
    2626---+ package Foswiki::Compatibility 
    2727 
    28 Support for compatibility with old TWiki versions. Packaged 
     28Support for compatibility with old versions. Packaged 
    2929separately because 99.999999% of the time this won't be needed. 
    3030 
  • trunk/core/lib/Foswiki/Configure/CSS.pm

    r809 r812  
    1313__DATA__ 
    1414 
    15 /* TWiki base CSS */ 
     15/* Foswiki base CSS */ 
    1616 
    1717.twikiMakeVisible, 
     
    9696the css and html code. 
    9797 
    98 Reworked for TWiki: (c) Arthur Clemens @ visiblearea.com 
     98Reworked for Foswiki: (c) Arthur Clemens @ visiblearea.com 
    9999*/ 
    100100 
     
    440440 
    441441/*      ----------------------------------------------------------- 
    442         TWiki styles 
     442        Foswiki styles 
    443443        -----------------------------------------------------------     */ 
    444444 
     
    13401340 
    13411341/*      ----------------------------------------------------------- 
    1342         TWiki styles 
     1342        Foswiki styles 
    13431343        -----------------------------------------------------------     */ 
    13441344 
  • trunk/core/lib/Foswiki/Configure/Checker.pm

    r809 r812  
    145145# Since Windows (without Cygwin) makes it hard to capture stderr 
    146146# ('2>&1' works only on Win2000 or higher), and Windows will usually have 
    147 # GNU tools in any case (installed for TWiki since there's no built-in 
     147# GNU tools in any case (installed for Foswiki since there's no built-in 
    148148# diff, grep, patch, etc), we only check for these tools on Unix/Linux 
    149149# and Cygwin. 
     
    343343        $mess .= $this->ERROR( 
    344344            $err . <<HERE 
    345 TWiki will probably not work with this RCS setup. Either correct the setup, or 
     345Foswiki will probably not work with this RCS setup. Either correct the setup, or 
    346346switch to RcsLite. To enable RCSLite you need to change the setting of 
    347347{StoreImpl} to 'RcsLite'. 
  • trunk/core/lib/Foswiki/Configure/Checkers/BasicSanity.pm

    r809 r812  
    4444    unless ( $this->{LocalSiteDotCfg} ) { 
    4545        $this->{LocalSiteDotCfg} = Foswiki::findFileOnPath('Foswiki.spec') || ''; 
    46         $this->{LocalSiteDotCfg} =~ s/TWiki\.spec/LocalSite.cfg/; 
     46        $this->{LocalSiteDotCfg} =~ s/Foswiki\.spec/LocalSite.cfg/; 
    4747    } 
    4848 
  • trunk/core/lib/Foswiki/Configure/Checkers/CGISetup.pm

    r809 r812  
    5555is risky because mod_perl will remember old values of configuration 
    5656variables. You are *highly* recommended not to run configure under 
    57 mod_perl (though the rest of TWiki can be run with mod_perl, of course) 
     57mod_perl (though the rest of Foswiki can be run with mod_perl, of course) 
    5858HERE 
    5959    } 
     
    102102        $n .= $this->WARN(<<HERE); 
    103103Perl version is older than 5.6.0. 
    104 TWiki has only been successfully tested on Perl 5.6.X and 5.8.X, 
     104Foswiki has only been successfully tested on Perl 5.6.X and 5.8.X, 
    105105and there have been reports that it does not run on 5.5. 
    106 You will need to upgrade Perl libraries and tweak the TWiki 
    107 code to make TWiki work on older versions of Perl 
     106You will need to upgrade Perl libraries and tweak the Foswiki 
     107code to make Foswiki work on older versions of Perl 
    108108HERE 
    109109    } 
     
    148148    $block .= $this->setting( '@INC library path', 
    149149        join( CGI::br(), @INC ) . $this->NOTE(<<HERE) ); 
    150 This is the Perl library path, used to load TWiki modules, 
     150This is the Perl library path, used to load Foswiki modules, 
    151151third-party modules used by some plugins, and Perl built-in modules. 
    152152HERE 
     
    177177          'Foswiki.pm (Version: <strong>' . $Foswiki::VERSION . '</strong>) found'; 
    178178    } 
    179     $block .= $this->setting( 'TWiki module in @INC path', $mess ); 
     179    $block .= $this->setting( 'Foswiki module in @INC path', $mess ); 
    180180 
    181181    # Check that each of the required Perl modules can be loaded, and 
     
    241241        $n .= $this->ERROR(<<HERE); 
    242242Version $Foswiki::cfg{DETECTED}{ModPerlVersion} of mod_perl is known to have major bugs that prevent 
    243 its use with TWiki. 1.99_12 or higher is recommended. 
     243its use with Foswiki. 1.99_12 or higher is recommended. 
    244244HERE 
    245245    } 
     
    259259        $Foswiki::cfg{DETECTED}{originalPath} . $this->NOTE(<<HERE) ); 
    260260This is the PATH value passed in from the web server to this 
    261 script - it is reset by TWiki scripts to the PATH below, and 
     261script - it is reset by Foswiki scripts to the PATH below, and 
    262262is provided here for comparison purposes only. 
    263263HERE 
     
    306306} 
    307307 
    308 # The perl modules that are required by TWiki. 
     308# The perl modules that are required by Foswiki. 
    309309sub _loadDEPENDENCIES { 
    310310    my $this = shift; 
  • trunk/core/lib/Foswiki/Configure/Checkers/MSWin32.pm

    r809 r812  
    1515    my $n = $perl5shell . $this->NOTE(<<HERE); 
    1616This environment variable is used by Win32 Perls to run 
    17 commands from TWiki scripts - it determines which shell program is used to run 
     17commands from Foswiki scripts - it determines which shell program is used to run 
    1818commands that use 'pipes'.  Examples of shell programs are cmd.exe, 
    1919command.com (aka 'DOS Prompt'), and Cygwin's 'bash' 
     
    2929    if ($isActivePerl) { 
    3030        $n .= $this->WARN(<<HERE); 
    31 ActiveState Perl on IIS does not support safe pipes, which is the mechanism used by TWiki to prevent a range 
     31ActiveState Perl on IIS does not support safe pipes, which is the mechanism used by Foswiki to prevent a range 
    3232of attacks aimed at arbitrary command execution on the server. You are <b>highly</b> recommended not to use this 
    3333particular configuration on a public server (one exposed to the internet) 
  • trunk/core/lib/Foswiki/Configure/Checkers/Sessions/ExpireAfter.pm

    r809 r812  
    3131    if ( $Foswiki::cfg{Sessions}{ExpireAfter} < 0 ) { 
    3232        $e .= $this->WARN(<<'MESSAGE'); 
    33 TWiki will *not* clean up sessions automatically. Make sure you 
     33Foswiki will *not* clean up sessions automatically. Make sure you 
    3434have a cron job running. 
    3535MESSAGE 
  • trunk/core/lib/Foswiki/Configure/Checkers/Site/Locale.pm

    r809 r812  
    5959    # Check for unusable multi-byte encodings as site character set 
    6060    # - anything that enables a single ASCII character such as '[' to be 
    61     # matched within a multi-byte character cannot be used for TWiki. 
    62     # Refuse to work with character sets that allow TWiki syntax 
     61    # matched within a multi-byte character cannot be used for Foswiki. 
     62    # Refuse to work with character sets that allow Foswiki syntax 
    6363    # to be recognised within multi-byte characters. 
    6464    # FIXME: match other problematic multi-byte character sets 
  • trunk/core/lib/Foswiki/Configure/Checkers/UseLocale.pm

    r809 r812  
    110110    # Warn against Perl 5.6 or lower for UTF-8 
    111111    if ( $] < 5.008 ) { 
    112         $n .= $this->WARN( "Perl 5.8 is required if you are using TWiki's", 
    113             "experimental UTF-8 support\n" ); 
     112        $n .= $this->WARN( "Perl 5.8 is required if you are using Foswiki", 
     113            " experimental UTF-8 support\n" ); 
    114114    } 
    115115 
     
    127127not set in Config.pm, see <i>Perl's Unicode Model</i> in 'perldoc 
    128128perluniintro') - re-compilation of Perl will be required before it can be 
    129 used to enable TWiki's experimental UTF-8 support. 
     129used to enable Foswiki's experimental UTF-8 support. 
    130130HERE 
    131131        ); 
     
    145145This version of Perl was not compiled with locale support ('d_setlocale' not 
    146146set in Config.pm) - re-compilation of Perl will be required before it can be 
    147 used to support TWiki internationalisation. 
     147used to support internationalisation. 
    148148HERE 
    149149        ); 
  • trunk/core/lib/Foswiki/Configure/FoswikiCfg.pm

    r809 r812  
    298298        # If not found on the path, park it beside Foswiki.spec 
    299299        $lsc = Foswiki::findFileOnPath('Foswiki.spec') || ''; 
    300         $lsc =~ s/TWiki\.spec/LocalSite.cfg/; 
     300        $lsc =~ s/Foswiki\.spec/LocalSite.cfg/; 
    301301    } 
    302302 
     
    308308    else { 
    309309        $this->{content} = <<'HERE'; 
    310 # Local site settings for TWiki. This file is managed by the 'configure' 
     310# Local site settings for Foswiki. This file is managed by the 'configure' 
    311311# CGI script, though you can also make (careful!) manual changes with a 
    312312# text editor. 
  • trunk/core/lib/Foswiki/Configure/Load.pm

    r809 r812  
    2828This module consists of just a single subroutine =readConfig=.  It allows to 
    2929safely modify configuration variables _for one single run_ without affecting 
    30 normal TWiki operation. 
     30normal Foswiki operation. 
    3131 
    3232=cut 
     
    4040---++ StaticMethod readConfig() 
    4141 
    42 In normal TWiki operations as a web server this routine is called by the 
     42In normal Foswiki operations as a web server this routine is called by the 
    4343=BEGIN= block of =Foswiki.pm=.  However, when benchmarking/debugging it can be 
    4444replaced by custom code which sets the configuration hash.  To prevent us from 
     
    4646=$cfg{ConfigurationFinished}= as an indicator. 
    4747 
    48 Note that this method is called by TWiki and configure, and *only* reads 
     48Note that this method is called by Foswiki and configure, and *only* reads 
    4949Foswiki.spec= to get defaults. Other spec files (those for extensions) are 
    5050*not* read. 
     
    8989      PubDir TemplateDir ScriptUrlPath LocalesDir ) { 
    9090 
    91         # We can't do this, because it prevents TWiki being run without 
     91        # We can't do this, because it prevents Foswiki being run without 
    9292        # a LocalSite.cfg, which we don't want 
    9393        # die "$var must be defined in LocalSite.cfg" 
     
    121121---++ StaticMethod expandValue($string) -> $boolean 
    122122 
    123 Expands references to TWiki configuration items which occur in the 
     123Expands references to Foswiki configuration items which occur in the 
    124124value of other configuration items.  Use expand($hashref) if the item 
    125125is not a plain scalar. 
     
    138138---++ StaticMethod readDefaults() -> \@errors 
    139139 
    140 This is only called by =configure= to initialise the TWiki config hash with 
     140This is only called by =configure= to initialise the Foswiki config hash with 
    141141default values from the .spec files. 
    142142 
  • trunk/core/lib/Foswiki/Configure/UIs/AUTH.pm

    r809 r812  
    102102 </li> 
    103103 <li> 
    104   If you are running TWiki on a public website, you are 
     104  If you are running Foswiki on a public website, you are 
    105105  <strong>strongly</strong> advised to totally disable saving from 
    106106  <code>configure</code> by making <code>lib/LocalSite.cfg</code> readonly once 
  • trunk/core/lib/Foswiki/Configure/UIs/EXTENSIONS.pm

    r809 r812  
    2929    version          => 'Most Recent Version', 
    3030    installedVersion => 'Installed Version', 
    31     testedOn         => 'Tested On TWiki', 
     31    testedOn         => 'Tested On Foswiki', 
    3232    testedOnOS       => 'Tested On OS', 
    3333    install          => 'Action', 
     
    159159    my $page = <<INTRO; 
    160160To install an extension from this page, click on the link in the 'Action' column.<p />Note that the webserver user has to be able to 
    161 write files everywhere in your TWiki installation. Otherwise you may see 
     161write files everywhere in your Foswiki installation. Otherwise you may see 
    162162'No permission to write' errors during extension installation. 
    163163INTRO 
  • trunk/core/lib/Foswiki/Configure/UIs/UPDATE.pm

    r809 r812  
    4747    } 
    4848 
    49     # Put in a link to the front page of the TWiki 
     49    # Put in a link to the front page of the Foswiki 
    5050    my $url = 
    5151"$Foswiki::cfg{DefaultUrlHost}$Foswiki::cfg{ScriptUrlPath}/view$Foswiki::cfg{ScriptSuffix}/"; 
     
    5959          . '.' ) 
    6060      . CGI::p() 
    61       . CGI::a( { href => $url }, "Go to the TWiki front page" ) . " or "; 
     61      . CGI::a( { href => $url }, "Go to the Foswiki front page" ) . " or "; 
    6262} 
    6363 
  • trunk/core/lib/Foswiki/Engine.pm

    r809 r812  
    2828---+!! package Foswiki::Engine 
    2929 
    30 The engine class is a singleton that implements details about TWiki's 
     30The engine class is a singleton that implements details about Foswiki's 
    3131execution mode. This is the base class and implements basic behavior. 
    3232 
     
    7373---++ ObjectMethod run() 
    7474 
    75 Start point to TWiki Runtime Engines. 
     75Start point to Runtime Engines. 
    7676 
    7777=cut 
     
    139139            # tell the browser where to look for more help 
    140140            my $text = 
    141 'TWiki detected an internal error - please check your TWiki logs and webserver logs for more information.' 
     141'Foswiki detected an internal error - please check your Foswiki logs and webserver logs for more information.' 
    142142              . "\n\n"; 
    143143            $mess =~ s/ at .*$//s; 
  • trunk/core/lib/Foswiki/Form.pm

    r809 r812  
    1515derived from Foswiki::Form::FieldDefinition. These objects are responsible 
    1616for the actual syntax and semantics of the field type. Form definitions 
    17 are parsed from TWiki tables, and the types are mapped by name to a 
     17are parsed from Foswiki tables, and the types are mapped by name to a 
    1818class declared in Foswiki::Form::* - for example, the =text= type is mapped 
    1919to =Foswiki::Form::Text= and the =checkbox= type to =Foswiki::Form::Checkbox=. 
  • trunk/core/lib/Foswiki/Form/Label.pm

    r809 r812  
    1212    my ( $this, $web, $topic, $value ) = @_; 
    1313 
    14     # Changing labels through the URL is a feature for TWiki applications, 
     14    # Changing labels through the URL is a feature for Foswiki applications, 
    1515    # even though it's not accessible for standard edits. Some contribs 
    1616    # may want to override this to make labels editable. 
  • trunk/core/lib/Foswiki/Form/Select.pm

    r809 r812  
    2929---++ getDefaultValue() -> $value 
    3030The default for a select is always the empty string, as there is no way in 
    31 TWiki form definitions to indicate selected values. This defers the decision 
     31Foswiki form definitions to indicate selected values. This defers the decision 
    3232on a value to the browser. 
    3333 
  • trunk/core/lib/Foswiki/Func.pm

    r809 r812  
    88%STARTINCLUDE% 
    99 
    10 _Official list of stable TWiki functions for Plugin developers_ 
     10_Official list of stable Foswiki functions for Plugin developers_ 
    1111 
    1212This 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 and lib/Foswiki/Plugins/EmptyPlugin.pm for a template Plugin and documentation on how to write a Plugin. 
     13can use to interact with the Foswiki engine and content. 
     14 
     15Refer to lib/Foswiki/Plugins/EmptyPlugin.pm for a template Plugin and documentation on how to write a Plugin. 
    1616 
    1717Plugins should *only* use functions published in this module. If you use 
    18 functions in other TWiki libraries you might create a security hole and 
    19 you will probably need to change your Plugin when you upgrade TWiki. 
     18functions in other Foswiki libraries you might create a security hole and 
     19you will probably need to change your Plugin when you upgrade Foswiki. 
    2020 
    2121Deprecated functions will still work in older code, though they should 
     
    2626of the Foswiki::Plugins module. 
    2727 
    28 Notes on use of =$Foswiki::Plugins::VERSION= (from TWiki 1.2 forwards): 
     28Notes on use of =$Foswiki::Plugins::VERSION=: 
    2929   * If the *major* version (e.g. =1.=) is the same then any plugin coded 
    3030     to use any *earlier* revision of the =1.= API will still work. No 
     
    329329 
    330330The context is a set of identifiers that are set 
    331 during specific phases of TWiki processing. For example, each of 
     331during specific phases of processing. For example, each of 
    332332the standard scripts in the 'bin' directory each has a context 
    333333identifier - the view script has 'view', the edit script has 'edit' 
     
    380380   * =$web= - new web 
    381381   * =$topic= - new topic 
    382 Change the TWiki context so it behaves as if it was processing =$web.$topic= 
     382Change the Foswiki context so it behaves as if it was processing =$web.$topic= 
    383383from now on. All the preferences will be reset to those of the new topic. 
    384384Note that if the new topic is not readable by the logged in user due to 
     
    420420---+++ popTopicContext() 
    421421 
    422 Returns the TWiki context to the state it was in before the 
     422Returns the Foswiki context to the state it was in before the 
    423423=pushTopicContext= was called. 
    424424 
     
    447447---+++ getPreferencesValue( $key, $web ) -> $value 
    448448 
    449 Get a preferences value from TWiki or from a Plugin 
     449Get a preferences value from Foswiki or from a Plugin 
    450450   * =$key= - Preferences key 
    451451   * =$web= - Name of web, optional. Current web if not specified; does not apply to settings of Plugin topics 
     
    463463      * =my $webColor = Foswiki::Func::getPreferencesValue( 'WEBBGCOLOR', 'Sandbox' );= 
    464464 
    465 *NOTE:* As of TWiki4.1, if =$NO_PREFS_IN_TOPIC= is enabled in the plugin, then 
     465*NOTE:* If =$NO_PREFS_IN_TOPIC= is enabled in the plugin, then 
    466466preferences set in the plugin topic will be ignored. 
    467467 
     
    492492*Since:* Foswiki::Plugins::VERSION 1.021 (27 Mar 2004) 
    493493 
    494 *NOTE:* As of TWiki4.1, if =$NO_PREFS_IN_TOPIC= is enabled in the plugin, then 
     494*NOTE:* If =$NO_PREFS_IN_TOPIC= is enabled in the plugin, then 
    495495preferences set in the plugin topic will be ignored. 
    496496 
     
    510510---+++ getPreferencesFlag( $key, $web ) -> $value 
    511511 
    512 Get a preferences flag from TWiki or from a Plugin 
     512Get a preferences flag from Foswiki or from a Plugin 
    513513   * =$key= - Preferences key 
    514514   * =$web= - Name of web, optional. Current web if not specified; does not apply to settings of Plugin topics 
     
    522522      * =my $showHelp = Foswiki::Func::getPreferencesFlag( "MYPLUGIN_SHOWHELP" );= 
    523523 
    524 *NOTE:* As of TWiki4.1, if =$NO_PREFS_IN_TOPIC= is enabled in the plugin, then 
     524*NOTE:* If =$NO_PREFS_IN_TOPIC= is enabled in the plugin, then 
    525525preferences set in the plugin topic will be ignored. 
    526526 
     
    546546*Since:* Foswiki::Plugins::VERSION 1.021 (27 Mar 2004) 
    547547 
    548 *NOTE:* As of TWiki4.1, if =$NO_PREFS_IN_TOPIC= is enabled in the plugin, then 
     548*NOTE:* If =$NO_PREFS_IN_TOPIC= is enabled in the plugin, then 
    549549preferences set in the plugin topic will be ignored. 
    550550 
     
    579579=pod 
    580580 
    581 ---+++ getWikiToolName( ) -> $name 
    582  
    583 Get toolname as defined in TWiki.cfg 
    584  
    585 Return: =$name= Name of tool, e.g. ='TWiki'= 
    586  
    587 *Since:* Foswiki::Plugins::VERSION 1.000 (27 Feb 2001) 
    588  
    589 =cut 
    590  
    591 sub getWikiToolName { 
    592     return $Foswiki::cfg{WikiToolName}; 
    593 } 
    594  
    595 =pod 
    596  
    597 ---+++ getMainWebname( ) -> $name 
    598  
    599 Get name of Main web as defined in TWiki.cfg 
    600  
    601 Return: =$name= Name, e.g. ='Main'= 
    602  
    603 *Since:* Foswiki::Plugins::VERSION 1.000 (27 Feb 2001) 
    604  
    605 =cut 
    606  
    607 sub getMainWebname { 
    608     return $Foswiki::cfg{UsersWebName}; 
    609 } 
    610  
    611 =pod 
    612  
    613 ---+++ getTwikiWebname( ) -> $name 
    614  
    615 Get name of TWiki documentation web as defined in TWiki.cfg 
    616  
    617 Return: =$name= Name, e.g. ='TWiki'= 
    618  
    619 *Since:* Foswiki::Plugins::VERSION 1.000 (27 Feb 2001) 
    620  
    621 =cut 
    622  
    623 sub getTwikiWebname { 
    624     return $Foswiki::cfg{SystemWebName}; 
    625 } 
    626  
    627 =pod 
    628  
    629581---++ User Handling and Access Control 
    630582---+++ getDefaultUserName( ) -> $loginName 
     
    646598   * =$user= can be a login, wikiname or web.wikiname 
    647599Return the cUID of the specified user. A cUID is a unique identifier which 
    648 is assigned by TWiki for each user. 
     600is assigned by Foswiki for each user. 
    649601BEWARE: While the default TopicUserMapping uses a cUID that looks like a user's 
    650602LoginName, some characters are modified to make them compatible with rcs. 
     
    776728---+++ userToWikiName( $loginName, $dontAddWeb ) -> $wikiName 
    777729Translate a login name to a Wiki name 
    778    * =$loginName=  - Login name, e.g. ='jdoe'=. Since TWiki 4.2.1 this may 
     730   * =$loginName=  - Login name, e.g. ='jdoe'=. This may 
    779731     also be a wiki name. This will normally be transparent, but may be 
    780732     relevant if you have login names that are also valid wiki names. 
     
    845797undef, returns the registered email addresses for the logged-in user. 
    846798 
    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. 
    848800 
    849801*Since:* Foswiki::Plugins::VERSION 1.2 
     
    1029981---+++ isGroup( $group ) -> $boolean 
    1030982 
    1031 Checks if =$group= is the name of a group known to TWiki. 
     983Checks if =$group= is the name of a user group. 
    1032984 
    1033985=cut 
     
    10791031[[%SYSTEMWEB%.AccessControl]] rules 
    10801032   * =$type=     - Access type, required, e.g. ='VIEW'=, ='CHANGE'=. 
    1081    * =$id=  - WikiName of remote user, required, e.g. ="PeterThoeny"=. From 
    1082      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. 
    10831035     If =$id= is '', 0 or =undef= then access is *always permitted*. 
    10841036   * =$text=     - Topic text, optional. If 'perl false' (undef, 0 or ''), 
     
    10871039      1 You are setting different access controls in the text to those defined 
    10881040      in the stored topic, 
    1089       1 You already have the topic text in hand, and want to help TWiki avoid 
     1041      1 You already have the topic text in hand, and want to help avoid 
    10901042        having to read it again, 
    10911043      1 You are providing a =$meta= parameter. 
     
    11001052 
    11011053*Note* the weird parameter order is due to compatibility constraints with 
    1102 earlier TWiki releases. 
     1054earlier releases. 
    11031055 
    11041056*Tip* if you want, you can use this method to check your own access control types. For example, if you: 
     
    19361888list of loaded templates, overwriting any previous definition. 
    19371889 
    1938 How TWiki searches for templates is described in SkinTemplates. 
     1890How Foswiki searches for templates is described in SkinTemplates. 
    19391891 
    19401892If template text is found, extracts include statements and fully expands them. 
     
    19581910 
    19591911A template is defined using a %TMPL:DEF% statement in a template 
    1960 file. See the documentation on TWiki templates for more information. 
     1912file. See the documentation on Foswiki templates for more information. 
    19611913 
    19621914=cut 
     
    20021954The =$passthru= parameter allows you to pass the parameters that were passed 
    20031955to 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 TWiki 
     1956same installation. If =$passthru= is set to a true value, then Foswiki 
    20051957will save the current URL parameters, and then try to restore them on the 
    20061958other side of the redirect. Parameters are stored on the server in a cache 
     
    20181970</verbatim> 
    20191971=$passthru= does nothing if =$url= does not point to a script in the current 
    2020 TWiki installation. 
     1972Foswiki installation. 
    20211973 
    20221974*Since:* Foswiki::Plugins::VERSION 1.000 (7 Dec 2002) 
     
    20391991   * =$header= - the HTML to be added to the <head> section. The HTML must be valid in a HEAD tag - no checks are performed. 
    20401992   * =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 
     1994All macros present in =$header= will be expanded before being inserted into the =<head>= section. 
    20431995 
    20441996Note that this is _not_ the same as the HTTP header, which is modified through the Plugins =modifyHeaderHandler=. 
     
    20892041---+++ renderText( $text, $web ) -> $text 
    20902042 
    2091 Render text from TWiki markup into XHTML as defined in [[%SYSTEMWEB%.TextFormattingRules]] 
     2043Render text from TML into XHTML as defined in [[%SYSTEMWEB%.TextFormattingRules]] 
    20922044   * =$text= - Text to render, e.g. ='*bold* text and =fixed font='= 
    20932045   * =$web=  - Web name, optional, e.g. ='Main'=. The current web is taken if missing 
     
    21102062 
    21112063Render 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 TWiki link syntax, optional 
     2064   * =$pre=        - Text occuring before the link syntax, optional 
    21132065   * =$web=        - Web name, required, e.g. ='Main'= 
    21142066   * =$topic=      - Topic name to link to, required, e.g. ='WebNotify'= 
     
    21822134returns a single email address, where a user may in fact have several. 
    21832135 
    2184 Since TWiki 4.2.1, $wikiName may also be a login name. 
     2136$wikiName may also be a login name. 
    21852137 
    21862138=cut 
     
    22382190---++ Special handlers 
    22392191 
    2240 Special handlers can be defined to make functions in plugins behave as if they were built-in to TWiki. 
     2192Special handlers can be defined to make functions in plugins behave as if they were built-in. 
    22412193 
    22422194=cut 
     
    22482200Should only be called from initPlugin. 
    22492201 
    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=. 
     2202Register 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=. 
    22512203   * =$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. 
    22522204   * =\&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 TWiki 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"}% 
     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"}% 
    22542206 
    22552207*Since:* Foswiki::Plugins::VERSION 1.1 
     
    22602212</verbatim> 
    22612213where: 
    2262    * =\%session= - a reference to the TWiki session object (may be ignored) 
     2214   * =\%session= - a reference to the session object (may be ignored) 
    22632215   * =\%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. 
    22642216   * =$topic= - name of the topic in the query 
     
    22842236=%<nop>EXEC{"ps -Af" silent="on"}%= 
    22852237 
    2286 Registered tags differ from tags implemented using the old TWiki approach (text substitution in =commonTagsHandler=) in the following ways: 
     2238Registered tags differ from tags implemented using the old approach (text substitution in =commonTagsHandler=) in the following ways: 
    22872239   * 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). 
    22882240   * registered tag names can only contain alphanumerics and _ (underscore) 
     
    23282280</verbatim> 
    23292281where: 
    2330    * =\%session= - a reference to the TWiki session object (may be ignored) 
     2282   * =\%session= - a reference to the Foswiki session object (may be ignored) 
    23312283 
    23322284From the REST interface, the name of the plugin must be used 
     
    23792331---+++ decodeFormatTokens($str) -> $unencodedString 
    23802332 
    2381 TWiki has an informal standard set of tokens used in =format= 
     2333Foswiki has an informal standard set of tokens used in =format= 
    23822334parameters that are used to block evaluation of paramater strings. 
    23832335For example, if you were to write 
     
    23862338 
    23872339then %<nop>WURBLE would be expanded *before* %<NOP>MYTAG is evaluated. To avoid 
    2388 this TWiki uses escapes in the format string. For example: 
     2340this Foswiki uses escapes in the format string. For example: 
    23892341 
    23902342=%<nop>MYTAG{format="$percntWURBLE$percnt"}%= 
    23912343 
    23922344This lets you enter arbitrary strings into parameters without worrying that 
    2393 TWiki will expand them before your plugin gets a chance to deal with them 
     2345Foswiki will expand them before your plugin gets a chance to deal with them 
    23942346properly. Once you have processed your tag, you will want to expand these 
    23952347tokens to their proper value. That's what this function does. 
     
    24682420 
    24692421Gets 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. 
     2422for managing this directory; Foswiki will not read from it, or write to it. 
    24712423 
    24722424The directory is guaranteed to exist, and to be writable by the webserver 
     
    25462498---+++ getRegularExpression( $name ) -> $expr 
    25472499 
    2548 Retrieves a TWiki predefined regular expression or character class. 
     2500Retrieves a Foswiki predefined regular expression or character class. 
    25492501   * =$name= - Name of the expression to retrieve.  See notes below 
    25502502Return: String or precompiled regular expression matching as described below. 
     
    25522504*Since:* Foswiki::Plugins::VERSION 1.020 (9 Feb 2004) 
    25532505 
    2554 __Note:__ TWiki internally precompiles several regular expressions to 
     2506__Note:__ Foswiki internally precompiles several regular expressions to 
    25552507represent various string entities in an <nop>I18N-compatible manner. Plugins 
    25562508authors are encouraged to use these in matching where appropriate. The 
    25572509following are guaranteed to be present. Others may exist, but their use 
    2558 is unsupported and they may be removed in future TWiki versions. 
     2510is unsupported and they may be removed in future Foswiki versions. 
    25592511 
    25602512In the table below, the expression marked type 'String' are intended for 
     
    26202572| *Input*                               | *Return* | 
    26212573| <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>  | 
    26242576 
    26252577=cut 
     
    28332785---++ Deprecated functions 
    28342786 
    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 TWiki release, 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%. 
     2787From 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 
     2789Updated 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%. 
    28382790 
    28392791This 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: 
    28402792<verbatim> 
    28412793package Foswiki::Plugins::SinkPlugin; 
    2842 use vars qw( %TWikiCompatibility ); 
    2843 $TWikiCompatibility{endRenderingHandler} = 1.1; 
    2844 </verbatim> 
    2845 If the currently-running TWiki 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. 
     2794use vars qw( %FoswikiCompatibility ); 
     2795$FoswikiCompatibility{endRenderingHandler} = 1.1; 
     2796</verbatim> 
     2797If 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. 
    28462798 
    28472799The following functions are retained for compatibility only. You should 
     
    28542806*DEPRECATED* since 1.1 - use =getScriptUrl= instead. 
    28552807 
    2856 Return: =$path= URL path of TWiki scripts, e.g. ="/cgi-bin"= 
     2808Return: =$path= URL path of bin scripts, e.g. ="/cgi-bin"= 
    28572809 
    28582810*WARNING:* you are strongly recommended *not* to use this function, as the 
     
    28682820    return $Foswiki::Plugins::SESSION->getScriptUrl( 0, '' ); 
    28692821} 
     2822 
     2823 
     2824=pod 
     2825 
     2826---+++ getWikiToolName( ) -> $name 
     2827 
     2828*DEPRECATED* in Foswiki; use $Foswiki::cfg{WikiToolName} instead 
     2829 
     2830=cut 
     2831 
     2832sub 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 
     2842sub 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 
     2852sub getTwikiWebname { return $Foswiki::cfg{SystemWebName}; } 
    28702853 
    28712854=pod 
     
    28802863Return: =$url=                     URL, e.g. ="http://example.com:80/cgi-bin/oops.pl/ Main/WebNotify?template=oopslocked&amp;param1=joe"= 
    28812864 
    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. 
    28832866<verbatim> 
    28842867   use Error qw( :try ); 
     
    29642947*DEPRECATED* since 1.1 - use =getListOfWebs= instead. 
    29652948 
    2966 Get list of all public webs, e.g. all webs that do not have the =NOSEARCHALL= flag set in the WebPreferences 
    2967  
    2968 Return: =@webs= List of all public webs, e.g. =( 'Main',  'Know', 'TWiki' )= 
     2949Get list of all public webs, e.g. all webs *and subwebs* that do not have the =NOSEARCHALL= flag set in the WebPreferences 
     2950 
     2951Return: =@webs= List of all public webs *and subwebs* 
    29692952 
    29702953*Since:* Foswiki::Plugins::VERSION 1.000 (07 Dec 2002) 
     
    30092992*DEPRECATED* since 1.1 - use the "Webs, Topics and Attachments" functions to manipulate topics instead 
    30102993 
    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  
    30192994=cut 
    30202995 
     
    30293004*DEPRECATED* since 1.1 - use the "Webs, Topics and Attachments" functions to manipulateattachments instead 
    30303005 
    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 
     3008sub getPubDir { return $Foswiki::cfg{PubDir}; } 
     3009 
     3010# Removed; it was never used 
    30583011sub 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"; 
    30983013} 
    30993014 
     
    31203035 
    31213036As per the GPL, removal of this notice is prohibited. 
    3122  
    3123 ---++ API History 
    3124  
    3125 ---+++ twiki-20010901-release (Athens) 
    3126 $Foswiki::Plugins::VERSION 1.000 
    3127 ---++++ EmptyPlugin.pm 
    3128    * =commonTagsHandler($text, $topic, $web)= 
    3129    * =endRenderingHandler($text)= 
    3130    * =outsidePREHandler($text)= 
    3131    * =insidePREHandler($text)= 
    3132    * =startRenderingHandler($text, $web)= 
    3133 ---++++ Func.pm 
    3134    * =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.010 
    3180 ---++++ EmptyPlugin.pm 
    3181    * =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.pm 
    3189    * =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.025 
    3196 ---++++ EmptyPlugin.pm 
    3197    * =afterCommonTagsHandler($text, $topic, $web)= 
    3198    * =afterSaveHandler($text, $topic, $web, $error)= 
    3199    * =beforeCommonTagsHandler($text, $topic, $web)= 
    3200    * =earlyInitPlugin()= 
    3201 ---++++ Func.pm 
    3202    * =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.1 
    3213 ---++++ EmptyPlugin.pm 
    3214    * =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.pm 
    3224    * =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    * =isValidWikiWor