Changeset 812
- Timestamp:
- 11/19/08 16:05:12 (3 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 59 edited
-
TWikiCompatibilityPlugin/lib/TWiki/Plugins/TWikiCompatibilityPlugin.pm (modified) (3 diffs)
-
core/data/System/Plugins.txt (modified) (21 diffs)
-
core/data/TWiki/WebPreferences.txt (added)
-
core/lib/Foswiki.pm (modified) (43 diffs)
-
core/lib/Foswiki/Attach.pm (modified) (1 diff)
-
core/lib/Foswiki/Attrs.pm (modified) (3 diffs)
-
core/lib/Foswiki/Compatibility.pm (modified) (1 diff)
-
core/lib/Foswiki/Configure/CSS.pm (modified) (4 diffs)
-
core/lib/Foswiki/Configure/Checker.pm (modified) (2 diffs)
-
core/lib/Foswiki/Configure/Checkers/BasicSanity.pm (modified) (1 diff)
-
core/lib/Foswiki/Configure/Checkers/CGISetup.pm (modified) (7 diffs)
-
core/lib/Foswiki/Configure/Checkers/MSWin32.pm (modified) (2 diffs)
-
core/lib/Foswiki/Configure/Checkers/Sessions/ExpireAfter.pm (modified) (1 diff)
-
core/lib/Foswiki/Configure/Checkers/Site/Locale.pm (modified) (1 diff)
-
core/lib/Foswiki/Configure/Checkers/UseLocale.pm (modified) (3 diffs)
-
core/lib/Foswiki/Configure/FoswikiCfg.pm (modified) (2 diffs)
-
core/lib/Foswiki/Configure/Load.pm (modified) (6 diffs)
-
core/lib/Foswiki/Configure/UIs/AUTH.pm (modified) (1 diff)
-
core/lib/Foswiki/Configure/UIs/EXTENSIONS.pm (modified) (2 diffs)
-
core/lib/Foswiki/Configure/UIs/UPDATE.pm (modified) (2 diffs)
-
core/lib/Foswiki/Engine.pm (modified) (3 diffs)
-
core/lib/Foswiki/Form.pm (modified) (1 diff)
-
core/lib/Foswiki/Form/Label.pm (modified) (1 diff)
-
core/lib/Foswiki/Form/Select.pm (modified) (1 diff)
-
core/lib/Foswiki/Func.pm (modified) (46 diffs)
-
core/lib/Foswiki/I18N.pm (modified) (4 diffs)
-
core/lib/Foswiki/I18N/Extract.pm (modified) (4 diffs)
-
core/lib/Foswiki/LoginManager.pm (modified) (3 diffs)
-
core/lib/Foswiki/LoginManager/ApacheLogin.pm (modified) (2 diffs)
-
core/lib/Foswiki/LoginManager/Session.pm (modified) (1 diff)
-
core/lib/Foswiki/Merge.pm (modified) (2 diffs)
-
core/lib/Foswiki/Meta.pm (modified) (3 diffs)
-
core/lib/Foswiki/Net.pm (modified) (3 diffs)
-
core/lib/Foswiki/Net/UserCredAgent.pm (modified) (1 diff)
-
core/lib/Foswiki/Plugin.pm (modified) (2 diffs)
-
core/lib/Foswiki/Plugins.pm (modified) (4 diffs)
-
core/lib/Foswiki/Plurals.pm (modified) (1 diff)
-
core/lib/Foswiki/Prefs/PrefsCache.pm (modified) (1 diff)
-
core/lib/Foswiki/Query/HoistREs.pm (modified) (1 diff)
-
core/lib/Foswiki/Query/Node.pm (modified) (1 diff)
-
core/lib/Foswiki/Render.pm (modified) (8 diffs)
-
core/lib/Foswiki/Sandbox.pm (modified) (2 diffs)
-
core/lib/Foswiki/Search.pm (modified) (1 diff)
-
core/lib/Foswiki/Store.pm (modified) (5 diffs)
-
core/lib/Foswiki/Store/RcsFile.pm (modified) (1 diff)
-
core/lib/Foswiki/Store/RcsLite.pm (modified) (1 diff)
-
core/lib/Foswiki/Store/RcsWrap.pm (modified) (1 diff)
-
core/lib/Foswiki/Templates.pm (modified) (2 diffs)
-
core/lib/Foswiki/Time.pm (modified) (3 diffs)
-
core/lib/Foswiki/UI.pm (modified) (5 diffs)
-
core/lib/Foswiki/UI/Oops.pm (modified) (1 diff)
-
core/lib/Foswiki/UI/Register.pm (modified) (2 diffs)
-
core/lib/Foswiki/UI/Rest.pm (modified) (2 diffs)
-
core/lib/Foswiki/UI/Save.pm (modified) (1 diff)
-
core/lib/Foswiki/UI/Statistics.pm (modified) (2 diffs)
-
core/lib/Foswiki/UI/View.pm (modified) (1 diff)
-
core/lib/Foswiki/UserMapping.pm (modified) (2 diffs)
-
core/lib/Foswiki/Users.pm (modified) (5 diffs)
-
core/lib/Foswiki/Users/BaseUserMapping.pm (modified) (5 diffs)
-
core/lib/Foswiki/Users/Password.pm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/TWikiCompatibilityPlugin/lib/TWiki/Plugins/TWikiCompatibilityPlugin.pm
r807 r812 25 25 use strict; 26 26 27 require TWiki::Func; # The plugins API28 require TWiki::Plugins; # For the API version27 require Foswiki::Func; # The plugins API 28 require Foswiki::Plugins; # For the API version 29 29 use vars qw( $VERSION $RELEASE $SHORTDESCRIPTION $debug $pluginName $NO_PREFS_IN_TOPIC ); 30 30 $VERSION = '$Rev$'; … … 46 46 sub initPlugin { 47 47 my( $topic, $web, $user, $installWeb ) = @_; 48 49 # check for Plugins.pm versions50 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 61 48 return 1; 62 }63 64 # The function used to handle the %EXAMPLETAG{...}% variable65 # 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 know69 # 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 names72 # to values, with _DEFAULT being the name for the default73 # parameter.74 # $theTopic - name of the topic in the query75 # $theWeb - name of the web in the query76 # Return: the result of processing the variable77 78 # For example, %EXAMPLETAG{'hamburger' sideorder="onions"}%79 # $params->{_DEFAULT} will be 'hamburger'80 # $params->{sideorder} will be 'onions'81 49 } 82 50 … … 87 55 If the TWiki web does not exist, change the request to the %SYSTEMWEB% 88 56 89 This may not be enough for Plugins that do have in topic preferences.57 This may not be enough for Plugins that do have in topic preferences. 90 58 91 59 =cut 92 60 93 61 sub 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 65 Commented 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}}; 101 74 } 102 75 } 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}}; 108 81 } 109 82 110 83 #Map TWIKIWEB to SYSTEMWEB and MAINWEB to USERSWEB 111 84 #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 115 90 return; 116 91 } 117 92 118 =pod119 120 ---++ initializeUserHandler( $loginName, $url, $pathInfo )121 * =$loginName= - login name recovered from $ENV{REMOTE_USER}122 * =$url= - request url123 * =$pathInfo= - pathinfo from the CGI query124 Allows a plugin to set the username. Normally TWiki gets the username125 from the login manager. This handler gives you a chance to override the126 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 =cut135 136 sub DISABLE_initializeUserHandler {137 # do not uncomment, use $_[0], $_[1]... instead138 ### my ( $loginName, $url, $pathInfo ) = @_;139 140 TWiki::Func::writeDebug( "- ${pluginName}::initializeUserHandler( $_[0], $_[1] )" ) if $debug;141 }142 143 =pod144 145 ---++ registrationHandler($web, $wikiName, $loginName )146 * =$web= - the name of the web in the current CGI query147 * =$wikiName= - users wiki name148 * =$loginName= - users login name149 150 Called when a new user registers with this TWiki.151 152 *Since:* TWiki::Plugins::VERSION = '1.010'153 154 =cut155 156 sub DISABLE_registrationHandler {157 # do not uncomment, use $_[0], $_[1]... instead158 ### my ( $web, $wikiName, $loginName ) = @_;159 160 TWiki::Func::writeDebug( "- ${pluginName}::registrationHandler( $_[0], $_[1] )" ) if $debug;161 }162 163 =pod164 165 ---++ commonTagsHandler($text, $topic, $web, $included, $meta )166 * =$text= - text to be processed167 * =$topic= - the name of the topic in the current CGI query168 * =$web= - the name of the web in the current CGI query169 * =$included= - Boolean flag indicating whether the handler is invoked on an included topic170 * =$meta= - meta-data object for the topic MAY BE =undef=171 This handler is called by the code that expands %<nop>TAGS% syntax in172 the topic body and in form fields. It may be called many times while173 a topic is being rendered.174 175 For variables with trivial syntax it is far more efficient to use176 =TWiki::Func::registerTagHandler= (see =initPlugin=).177 178 Plugins that have to parse the entire topic content should implement179 this function. Internal TWiki180 variables (and any variables declared using =TWiki::Func::registerTagHandler=)181 are expanded _before_, and then again _after_, this function is called182 to ensure all %<nop>TAGS% are expanded.183 184 __NOTE:__ when this handler is called, <verbatim> blocks have been185 removed from the text (though all other blocks such as <pre> and186 <noautolink> are still present).187 188 __NOTE:__ meta-data is _not_ embedded in the text passed to this189 handler. Use the =$meta= object.190 191 *Since:* $TWiki::Plugins::VERSION 1.000192 193 =cut194 195 sub DISABLE_commonTagsHandler {196 # do not uncomment, use $_[0], $_[1]... instead197 ### 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 =pod213 214 ---++ beforeCommonTagsHandler($text, $topic, $web, $meta )215 * =$text= - text to be processed216 * =$topic= - the name of the topic in the current CGI query217 * =$web= - the name of the web in the current CGI query218 * =$meta= - meta-data object for the topic MAY BE =undef=219 This handler is called before TWiki does any expansion of it's own220 internal variables. It is designed for use by cache plugins. Note that221 when this handler is called, <verbatim> blocks are still present222 in the text.223 224 __NOTE__: This handler is called once for each call to225 =commonTagsHandler= i.e. it may be called many times during the226 rendering of a topic.227 228 __NOTE:__ meta-data is _not_ embedded in the text passed to this229 handler.230 231 __NOTE:__ This handler is not separately called on included topics.232 233 =cut234 235 sub DISABLE_beforeCommonTagsHandler {236 # do not uncomment, use $_[0], $_[1]... instead237 ### my ( $text, $topic, $web, $meta ) = @_;238 239 TWiki::Func::writeDebug( "- ${pluginName}::beforeCommonTagsHandler( $_[2].$_[1] )" ) if $debug;240 }241 242 =pod243 244 ---++ afterCommonTagsHandler($text, $topic, $web, $meta )245 * =$text= - text to be processed246 * =$topic= - the name of the topic in the current CGI query247 * =$web= - the name of the web in the current CGI query248 * =$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 handler251 is called, <verbatim> blocks are present in the text.252 253 __NOTE__: This handler is called once for each call to254 =commonTagsHandler= i.e. it may be called many times during the255 rendering of a topic.256 257 __NOTE:__ meta-data is _not_ embedded in the text passed to this258 handler.259 260 =cut261 262 sub DISABLE_afterCommonTagsHandler {263 # do not uncomment, use $_[0], $_[1]... instead264 ### my ( $text, $topic, $web, $meta ) = @_;265 266 TWiki::Func::writeDebug( "- ${pluginName}::afterCommonTagsHandler( $_[2].$_[1] )" ) if $debug;267 }268 269 =pod270 271 ---++ preRenderingHandler( $text, \%map )272 * =$text= - text, with the head, verbatim and pre blocks replaced with placeholders273 * =\%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) are276 processed, but after all variables have been expanded. Use this handler to277 process special syntax only recognised by your plugin.278 279 Placeholders are text strings constructed using the tag name and a280 sequence number e.g. 'pre1', "verbatim6", "head1" etc. Placeholders are281 inserted into the text inside <!--!marker!--> characters so the282 text will contain <!--!pre1!--> for placeholder pre1.283 284 Each removed block is represented by the block text and the parameters285 passed to the tag (usually empty) e.g. for286 <verbatim>287 <pre class='slobadob'>288 XYZ289 </pre>290 the map will contain:291 <pre>292 $removed->{'pre1'}{text}: XYZ293 $removed->{'pre1'}{params}: class="slobadob"294 </pre>295 Iterating over blocks for a single tag is easy. For example, to prepend a296 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 this310 handler.311 312 Since TWiki::Plugins::VERSION = '1.026'313 314 =cut315 316 sub DISABLE_preRenderingHandler {317 # do not uncomment, use $_[0], $_[1]... instead318 #my( $text, $pMap ) = @_;319 }320 321 =pod322 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 this330 handler.331 332 Since TWiki::Plugins::VERSION = '1.026'333 334 =cut335 336 sub DISABLE_postRenderingHandler {337 # do not uncomment, use $_[0], $_[1]... instead338 #my $text = shift;339 }340 341 =pod342 343 ---++ beforeEditHandler($text, $topic, $web )344 * =$text= - text that will be edited345 * =$topic= - the name of the topic in the current CGI query346 * =$web= - the name of the web in the current CGI query347 This handler is called by the edit script just before presenting the edit text348 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 handler351 (using %META: tags)352 353 *Since:* TWiki::Plugins::VERSION = '1.010'354 355 =cut356 357 sub DISABLE_beforeEditHandler {358 # do not uncomment, use $_[0], $_[1]... instead359 ### my ( $text, $topic, $web ) = @_;360 361 TWiki::Func::writeDebug( "- ${pluginName}::beforeEditHandler( $_[2].$_[1] )" ) if $debug;362 }363 364 =pod365 366 ---++ afterEditHandler($text, $topic, $web, $meta )367 * =$text= - text that is being previewed368 * =$topic= - the name of the topic in the current CGI query369 * =$web= - the name of the web in the current CGI query370 * =$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 this377 handler. Use the =$meta= object.378 379 *Since:* $TWiki::Plugins::VERSION 1.010380 381 =cut382 383 sub DISABLE_afterEditHandler {384 # do not uncomment, use $_[0], $_[1]... instead385 ### my ( $text, $topic, $web ) = @_;386 387 TWiki::Func::writeDebug( "- ${pluginName}::afterEditHandler( $_[2].$_[1] )" ) if $debug;388 }389 390 =pod391 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 query395 * =$web= - the name of the web in the current CGI query396 * =$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 modify401 the =$meta= object, then it will override any changes to the meta-data402 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 rather404 than the text, as this approach is proof against changes in the embedded405 text format.406 407 *Since:* TWiki::Plugins::VERSION = '1.010'408 409 =cut410 411 sub DISABLE_beforeSaveHandler {412 # do not uncomment, use $_[0], $_[1]... instead413 ### my ( $text, $topic, $web ) = @_;414 415 TWiki::Func::writeDebug( "- ${pluginName}::beforeSaveHandler( $_[2].$_[1] )" ) if $debug;416 }417 418 =pod419 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 query424 * =$web= - the name of the web in the current CGI query425 * =$error= - any error string returned by the save.426 * =$meta= - the metadata of the saved topic, represented by a TWiki::Meta object427 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.025433 434 =cut435 436 sub DISABLE_afterSaveHandler {437 # do not uncomment, use $_[0], $_[1]... instead438 ### my ( $text, $topic, $web, $error, $meta ) = @_;439 440 TWiki::Func::writeDebug( "- ${pluginName}::afterSaveHandler( $_[2].$_[1] )" ) if $debug;441 }442 443 =pod444 445 ---++ afterRenameHandler( $oldWeb, $oldTopic, $oldAttachment, $newWeb, $newTopic, $newAttachment )446 447 * =$oldWeb= - name of old web448 * =$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 web451 * =$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 =cut459 460 sub DISABLE_afterRenameHandler {461 # do not uncomment, use $_[0], $_[1]... instead462 ### 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 =pod469 470 ---++ beforeAttachmentSaveHandler(\%attrHash, $topic, $web )471 * =\%attrHash= - reference to hash of attachment attribute values472 * =$topic= - the name of the topic in the current CGI query473 * =$web= - the name of the web in the current CGI query474 This handler is called once when an attachment is uploaded. When this475 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 name479 * =comment= - the comment480 * =user= - the user id481 * =tmpFilename= - name of a temporary file containing the attachment data482 483 *Since:* TWiki::Plugins::VERSION = 1.025484 485 =cut486 487 sub DISABLE_beforeAttachmentSaveHandler {488 # do not uncomment, use $_[0], $_[1]... instead489 ### my( $attrHashRef, $topic, $web ) = @_;490 TWiki::Func::writeDebug( "- ${pluginName}::beforeAttachmentSaveHandler( $_[2].$_[1] )" ) if $debug;491 }492 493 =pod494 495 ---++ afterAttachmentSaveHandler(\%attrHash, $topic, $web, $error )496 * =\%attrHash= - reference to hash of attachment attribute values497 * =$topic= - the name of the topic in the current CGI query498 * =$web= - the name of the web in the current CGI query499 * =$error= - any error string generated during the save process500 This handler is called just after the save action. The attributes hash501 will include at least the following attributes:502 * =attachment= => the attachment name503 * =comment= - the comment504 * =user= - the user id505 506 *Since:* TWiki::Plugins::VERSION = 1.025507 508 =cut509 510 sub DISABLE_afterAttachmentSaveHandler {511 # do not uncomment, use $_[0], $_[1]... instead512 ### my( $attrHashRef, $topic, $web ) = @_;513 TWiki::Func::writeDebug( "- ${pluginName}::afterAttachmentSaveHandler( $_[2].$_[1] )" ) if $debug;514 }515 516 =pod517 518 ---++ mergeHandler( $diff, $old, $new, \%info ) -> $text519 Try to resolve a difference encountered during merge. The =differences=520 array is an array of hash references, where each hash contains the521 following fields:522 * =$diff= => one of the characters '+', '-', 'c' or ' '.523 * '+' - =new= contains text inserted in the new version524 * '-' - =old= contains text deleted from the old version525 * 'c' - =old= contains text from the old version, and =new= text526 from the version being saved527 * ' ' - =new= contains text common to both versions, or the change528 only involved whitespace529 * =$old= => text from version currently saved530 * =$new= => text from version being saved531 * =\%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 body534 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 have538 ={ diff=>'c', old=>'Leafy', new=>'Barky' }= might be resolved as539 ='Treelike'=. If the plugin cannot resolve a difference it should return540 undef.541 542 The merge handler will be called several times during a save; once for543 each difference that needs resolution.544 545 If any merges are left unresolved after all plugins have been given a546 chance to intercede, the following algorithm is used to decide how to547 merge the data:548 1 =new= is taken for all =radio=, =checkbox= and =select= fields to549 resolve 'c' conflicts550 1 '+' and '-' text is always included in the the body text and text551 fields552 1 =<del>conflict</del> <ins>markers</ins>= are used to553 mark 'c' merges in text fields554 555 The merge handler is called whenever a topic is saved, and a merge is556 required to resolve concurrent edits on a topic.557 558 *Since:* TWiki::Plugins::VERSION = 1.1559 560 =cut561 562 sub DISABLE_mergeHandler {563 }564 565 =pod566 567 ---++ modifyHeaderHandler( \%headers, $query )568 * =\%headers= - reference to a hash of existing header values569 * =$query= - reference to CGI query object570 Lets the plugin modify the HTTP headers that will be emitted when a571 page is written to the browser. \%headers= will contain the headers572 proposed by the core, plus any modifications made by other plugins that also573 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 HTML579 <HEAD> tag. The contents of the <HEAD> tag may be manipulated580 using the =TWiki::Func::addToHEAD= method.581 582 *Since:* TWiki::Plugins::VERSION 1.1583 584 =cut585 586 sub DISABLE_modifyHeaderHandler {587 my ( $headers, $query ) = @_;588 589 TWiki::Func::writeDebug( "- ${pluginName}::modifyHeaderHandler()" ) if $debug;590 }591 592 =pod593 594 ---++ redirectCgiQueryHandler($query, $url )595 * =$query= - the CGI query596 * =$url= - the URL to redirect to597 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 handler601 in the earliest plugin in the INSTALLEDPLUGINS list will be called. All602 the others will be ignored.603 604 *Since:* TWiki::Plugins::VERSION 1.010605 606 =cut607 608 sub DISABLE_redirectCgiQueryHandler {609 # do not uncomment, use $_[0], $_[1] instead610 ### my ( $query, $url ) = @_;611 612 TWiki::Func::writeDebug( "- ${pluginName}::redirectCgiQueryHandler( query, $_[1] )" ) if $debug;613 }614 615 =pod616 617 ---++ renderFormFieldForEditHandler($name, $type, $size, $value, $attributes, $possibleValues) -> $html618 619 This handler is called before built-in types are considered. It generates620 the HTML text rendering this form field, or false, if the rendering621 should be done by the built-in type handlers.622 * =$name= - name of form field623 * =$type= - type of form field (checkbox, radio etc)624 * =$size= - size of form field625 * =$value= - value held in the form field626 * =$attributes= - attributes of form field627 * =$possibleValues= - the values defined as options for form field, if628 any. May be a scalar (one legal value) or a ref to an array629 (several legal values)630 631 Return HTML text that renders this field. If false, form rendering632 continues by considering the built-in types.633 634 *Since:* TWiki::Plugins::VERSION 1.1635 636 Note that since TWiki-4.2, you can also extend the range of available637 types by providing a subclass of =TWiki::Form::FieldDefinition= to implement638 the new type (see =TWiki::Plugins.JSCalendarContrib= and639 =TWiki::Plugins.RatingContrib= for examples). This is the preferred way to640 extend the form field types, but does not work for TWiki < 4.2.641 642 =cut643 644 sub DISABLE_renderFormFieldForEditHandler {645 }646 647 =pod648 649 ---++ renderWikiWordHandler($linkText, $hasExplicitLinkLabel, $web, $topic) -> $linkText650 * =$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 change656 the rendering of labels used for links.657 658 Return the new link text.659 660 *Since:* TWiki::Plugins::VERSION 1.1661 662 =cut663 664 sub DISABLE_renderWikiWordHandler {665 my( $linkText, $hasExplicitLinkLabel, $web, $topic ) = @_;666 return $linkText;667 }668 669 =pod670 671 ---++ completePageHandler($html, $httpHeaders)672 673 This handler is called on the ingredients of every page that is674 output by the standard TWiki scripts. It is designed primarily for use by675 cache and security plugins.676 * =$html= - the body of the page (normally <html>..$lt;/html>)677 * =$httpHeaders= - the HTTP headers. Note that the headers do not contain678 a =Content-length=. That will be computed and added immediately before679 the page is actually written. This is a string, which must end in \n\n.680 681 *Since:* TWiki::Plugins::VERSION 1.2682 683 =cut684 685 sub DISABLE_completePageHandler {686 #my($html, $httpHeaders) = @_;687 # modify $_[0] or $_[1] if you must change the HTML or headers688 }689 690 =pod691 692 ---++ restExample($session) -> $text693 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#rest700 701 *Since:* TWiki::Plugins::VERSION 1.1702 703 =cut704 705 sub restExample {706 #my ($session) = @_;707 return "This is an example of a REST invocation\n\n";708 }709 710 93 1; -
trunk/core/data/System/Plugins.txt
r700 r812 3 3 ---+ Plugins 4 4 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_ 6 6 7 7 %TOC% … … 9 9 ---++ Overview 10 10 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 11 You 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 17 Everything 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 19 Foswiki 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 21 Most TWiki™ plugins can also be used with Foswiki if the TWikiCompatibilityPlugin is installed. 27 22 28 23 __See other types of extensions:__ ContributedAddOns, [[Contribs]], [[Skins]] … … 31 26 ---++ Installing Plugins 32 27 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.28 Each 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. 34 29 35 30 *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. 36 31 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.32 Each 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. 38 33 39 34 #PreTesting 40 35 ---+++ On-Site Pretesting 41 36 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.37 The 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 39 InstalledPlugins 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. 45 40 46 41 ---+++ Some Notes on Plugin Performance 47 42 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=43 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, on real data. 49 44 50 45 %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. … … 78 73 * =Set SHORTDESCRIPTION = Control attributes of tables and sorting of table columns= 79 74 80 [[Preference settings]] of active plugins can be retrieved anywhere in TWiki with =%<pluginname>_<var>%=, such as =%<nop>TABLEPLUGIN_SHORTDESCRIPTION%=. They can also be redefined with the =%<pluginname>_<var>%= 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 =%<pluginname>_<var>%=, such as =%<nop>TABLEPLUGIN_SHORTDESCRIPTION%=. They can also be redefined with the =%<pluginname>_<var>%= 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. 81 76 82 77 ---+++ Listing Active Plugins … … 84 79 Plugin status macros let you list all active plugins wherever needed. 85 80 86 This site is running TWiki version *%WIKIVERSION%*, plugin API version81 This site is running Foswiki version *%WIKIVERSION%*, plugin API version 87 82 *%PLUGINVERSION{}%* 88 83 89 84 #ActivatedPlugins 90 85 ---++++ =%<nop>ACTIVATEDPLUGINS%= 91 On this TWiki site, the enabled plugins are: %ACTIVATEDPLUGINS%.86 On this Foswiki site, the enabled plugins are: %ACTIVATEDPLUGINS%. 92 87 93 88 ---++++ =%<nop>PLUGINDESCRIPTIONS%= … … 99 94 100 95 #PluginAPI 101 ---++ The TWiki Plugin API102 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 98 The Application Programming Interface (API) for Foswiki plugins provides the specifications for hooking into the core Foswiki code from your external Perl plugin module. 104 99 105 100 ---+++ Available Core Functions 106 101 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.102 The 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. 110 105 111 106 ---+++ Predefined Hooks 112 107 113 In addition to TWiki core functions, plugins can use *predefined hooks*, or *callbacks*, as described in the =lib/TWiki/Plugins/EmptyPlugin.pm= module.108 In addition to Foswiki core functions, plugins can use *predefined hooks*, or *callbacks*, as described in the =lib/Foswiki/Plugins/EmptyPlugin.pm= module. 114 109 115 110 * All but the initPlugin are disabled. To enable a callback, remove =DISABLE_= from the function name. 116 111 117 TWiki:Codev/StepByStepRenderingOrder helps you decide which rendering handler to use.112 Foswiki:Codev/StepByStepRenderingOrder helps you decide which rendering handler to use. 118 113 119 114 #FastPluginHints … … 124 119 =eval { require IPC::Run }= %BR% 125 120 =return "<font color=\"red\">SamplePlugin: Can't load required modules ($@)</font>" 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. 128 123 * Use registered tag handlers 129 124 * [[#MeasurePerformance][Measure the performance]] to see the difference … … 138 133 * The plugin initialization code does not register a plugin that returns 0 (or that has no =initPlugin= handler). 139 134 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{}%*. 141 136 * You can also use the =[[VarPLUGINVERSION][%<nop>PLUGINVERSION{}%]]= macro to query the plugin API version or the version of installed plugins. 142 137 143 138 ---+++ Security 144 139 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. 147 142 * [[#ConfigSpec][Integrating with <code>configure</code>]] describes the steps 148 * TWiki:Plugins.MailInContrib has an example149 * TWiki:Plugins.BuildContrib can help you with this150 * 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. 151 146 * 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. 152 147 … … 154 149 ---++ Creating Plugins 155 150 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.151 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][Foswiki Plugin API]] provides the programming interface for Foswiki. 157 152 158 153 ---+++ Anatomy of a Plugin 159 154 160 A (very) basic TWiki plugin consists of two files:155 A (very) basic Foswiki plugin consists of two files: 161 156 162 157 * a Perl module, e.g. =MyFirstPlugin.pm= 163 158 * a documentation topic, e.g. =MyFirstPlugin.txt= 164 159 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_.160 The 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. 161 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/Foswiki/Plugins/MyFirstPlugin/= directory. 162 163 The 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_. 171 166 172 167 ---+++ Creating the Perl Module 173 168 174 Copy file =lib/ TWiki/Plugins/EmptyPlugin.pm= to =<name>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.169 Copy file =lib/Foswiki/Plugins/EmptyPlugin.pm= to =<name>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. 175 170 176 171 If 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: 177 172 <pre> 178 use TWiki::Plugins::MyFirstPlugin::Attrs;173 use Foswiki::Plugins::MyFirstPlugin::Attrs; 179 174 $var = MyFirstPlugin::Attrs->new(); 180 175 </pre> … … 185 180 The 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: 186 181 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: 188 183 * enter the plugin name in the "How to Create a Plugin" section 189 184 * click Create … … 194 189 * paste & save new plugin topic on your site 195 190 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. 197 192 1. *Document* the performance data you gathered while [[#MeasurePerformance][measuring the performance]] 198 193 1. *Save* your topic, for use in [[#CreatePluginPackage][packaging]] and [[#PublishPlugin][publishing]] your plugin. … … 200 195 <blockquote style="background-color:#f5f5f5"> 201 196 *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:197 Check the plugins web on Foswiki.org for the latest plugin doc topic template. Here's a quick overview of what's covered: 203 198 204 199 *Syntax Rules:* <<i>Describe any special text formatting that will be rendered.</i>>" … … 206 201 *Example:* <<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>>" 207 202 208 *Plugin Settings:* <<i>Description and settings for custom plugin settings, and those required by TWiki.</i>>"209 210 * *Plugins Preferences* <<i>If user settings are needed, link to [[%SYSTEMWEB%.PreferenceSettings][preference settings]] and explain the role of the plugin name prefix 203 *Plugin Settings:* <<i>Description and settings for custom plugin settings, and those required by Foswiki.</i>>" 204 205 * *Plugins Preferences* <<i>If user settings are needed, link to [[%SYSTEMWEB%.PreferenceSettings][preference settings]] and explain the role of the plugin name prefix</i> 211 206 212 207 *Plugin Installation Instructions:* <<i>Step-by-step set-up guide, user help, whatever it takes to install and run, goes here.</i>>" 213 208 214 *Plugin Info:* <<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>>"209 *Plugin Info:* <<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>> 215 210 </blockquote> 216 211 … … 218 213 ---+++ Packaging for Distribution 219 214 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!215 The 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! 221 216 222 217 If 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=). 223 218 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] 228 223 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= 232 227 233 228 #MeasurePerformance 234 229 ---+++ Measuring and Improving the Plugin Performance 235 230 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.231 A 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. 237 232 238 233 See also [[#FastPluginHints][Hints on Writing Fast Plugins]]. … … 241 236 ---+++ Publishing for Public Use 242 237 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.238 You 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. 244 239 245 240 Publish 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: 247 242 * enter the plugin name in the "How to Create a Plugin" section, for example =MyFirstPlugin= 248 243 * paste in the topic text from [[#CreatePluginTopic][Writing the Documentation Topic]] and save 249 244 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) 252 247 253 248 %N% Once you have done the above steps once, you can use the !BuildContrib to upload updates to your plugin. 254 249 255 Thank you very much for sharing your plugin with the TWiki community :-)250 Thank you very much for sharing your plugin with the Foswiki community :-) 256 251 257 252 #RecommendedStorageOfPluginData 258 253 ---++ Recommended Storage of Plugin Specific Data 259 254 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.255 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 FoswikiFuncDotPm functions that support saving and loading of topics and attachments. 261 256 262 257 ---+++ Plugin Internal Data 263 258 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.259 You 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. 265 260 266 261 ---+++ Web Accessible Data 267 262 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. 269 264 270 265 Recommendation for file name: … … 274 269 * Example: =_GaugePlugin_img123.gif= 275 270 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. 277 272 278 273 Recommendation for file names in plugin attachment area: … … 286 281 Some 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. 287 282 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=. 289 284 290 285 ---+++ Structure of a <code>Config.spec</code> file … … 299 294 # **SELECT Plastic,Rubber,Metal** 300 295 # Select the plug type 301 $ TWiki::cfg{BathPlugin}{PlugType} = 'Plastic';296 $Foswiki::cfg{BathPlugin}{PlugType} = 'Plastic'; 302 297 303 298 # **NUMBER** 304 299 # Enter the chain length in cm 305 $ TWiki::cfg{BathPlugin}{ChainLength} = '30';300 $Foswiki::cfg{BathPlugin}{ChainLength} = '30'; 306 301 307 302 # **BOOLEAN EXPERT** 308 303 # Turn this option off to disable the water temperature alarm 309 $ TWiki::cfg{BathPlugin}{TempSensorEnabled} = '1';304 $Foswiki::cfg{BathPlugin}{TempSensorEnabled} = '1'; 310 305 </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 ) {306 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 =$Foswiki::cfg{BathPlugin}{PlugType}=, =$Foswiki::cfg{BathPlugin}{ChainLength}=, and =$Foswiki::cfg{BathPlugin}{TempSensorEnabled}= for use in your plugin. For example, 307 <verbatim> 308 if( $Foswiki::cfg{BathPlugin}{TempSensorEnabled} && $curTemperature > 50 ) { 314 309 die "The bathwater is too hot for comfort"; 315 310 } … … 340 335 | H | means the option is not visible in =configure= | 341 336 342 See =lib/ TWiki.spec= for many more examples.337 See =lib/Foswiki.spec= for many more examples. 343 338 344 339 =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. 345 340 346 TWiki:TWiki/SpecifyingConfigurationItemsForExtensions has supplemental documentation on configure settings.341 Foswiki:Foswiki/SpecifyingConfigurationItemsForExtensions has supplemental documentation on configure settings. 347 342 348 343 #MaintainPlugins … … 351 346 ---+++ Discussions and Feedback on Plugins 352 347 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 Versions356 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' );348 Each 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 352 The 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 354 Organizations 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. 357 Here 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' ); 367 362 } else { 368 @webs = TWiki::Func::getPublicWebList( );363 @webs = Foswiki::Func::getPublicWebList( ); 369 364 } 370 365 </verbatim> … … 372 367 ---+++ Handling deprecated functions 373 368 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;369 From 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 371 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 Foswiki.org and if necessary, contact the plugin author, for an updated version of the plugin. 372 373 Updated plugins may still need to define deprecated handlers for compatibility with old Foswiki versions. In this case, the plugin package that defines old handlers can suppress the warnings in %<nop>FAILEDPLUGINS%. 374 375 This is done by defining a map from the handler name to the =Foswiki::Plugins= version _in which the handler was first deprecated_. For example, if we need to define the =endRenderingHandler= for compatibility with =Foswiki::Plugins= versions before 1.1, we would add this to the plugin: 376 377 <verbatim> 378 package Foswiki::Plugins::SinkPlugin; 379 use vars qw( %FoswikiCompatibility ); 380 $FoswikiCompatibility{endRenderingHandler} = 1.1; 386 381 </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.382 If 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. 388 383 389 384 %STOPINCLUDE% 390 __Related Topics:__ DeveloperDocumentationCategory, AdminDocumentationCategory, TWiki:Support.PluginsSupplement391 385 __Related Topics:__ DeveloperDocumentationCategory, AdminDocumentationCategory, Foswiki:Support.PluginsSupplement 386 -
trunk/core/lib/Foswiki.pm
r811 r812 4 4 =pod 5 5 6 ---+ package TWiki7 8 TWiki operates by creating a singleton object (known as the Session6 ---+ package Foswiki 7 8 Foswiki operates by creating a singleton object (known as the Session 9 9 object) that acts as a point of reference for all the different 10 10 modules in the system. This package is the class for this singleton, … … 31 31 not consistently used. Avoid. 32 32 * =security= Foswiki::Access singleton 33 * =SESSION_TAGS= Hash of TWiki variables whose value is specific to33 * =SESSION_TAGS= Hash of preference settings whose value is specific to 34 34 the current request. 35 35 * =store= Foswiki::Store singleton … … 88 88 # Token character that must not occur in any normal text - converted 89 89 # to a flag character if it ever does occur (very unlikely) 90 # TWiki uses $TranslationToken to mark points in the text. This is90 # Foswiki uses $TranslationToken to mark points in the text. This is 91 91 # normally \0, which is not a useful character in any 8-bit character 92 92 # set we can find, nor in UTF-8. But if you *do* encounter problems … … 100 100 =pod 101 101 102 ---++ StaticMethod get TWikiLibDir() -> $path102 ---++ StaticMethod getLibDir() -> $path 103 103 104 104 Returns the full path of the directory containing Foswiki.pm … … 106 106 =cut 107 107 108 sub get TWikiLibDir {108 sub getLibDir { 109 109 if ($twikiLibDir) { 110 110 return $twikiLibDir; … … 124 124 if ( $twikiLibDir =~ /^\./ ) { 125 125 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."; 127 127 my $bin; 128 128 … … 356 356 import POSIX qw( locale_h LC_CTYPE LC_COLLATE ); 357 357 358 # SMELL: mod_perl compatibility note: If TWiki is running under Apache,358 # SMELL: mod_perl compatibility note: If Foswiki is running under Apache, 359 359 # won't this play with the Apache process's locale settings too? 360 360 # What effects would this have? … … 388 388 389 389 # No locales needed/working, or Perl 5.005, so just use 390 # any additional national characters defined in TWiki.cfg390 # any additional national characters defined in LocalSite.cfg 391 391 $regex{upperAlpha} = 'A-Z' . $Foswiki::cfg{UpperNational}; 392 392 $regex{lowerAlpha} = 'a-z' . $Foswiki::cfg{LowerNational}; … … 423 423 $regex{headerPatternNoTOC} = '(\!\!+|%NOTOC%)'; 424 424 425 # TWiki concept regexes425 # Foswiki concept regexes 426 426 $regex{wikiWordRegex} = 427 427 qr/[$regex{upperAlpha}]+[$regex{lowerAlphaNum}]+[$regex{upperAlpha}]+[$regex{mixedAlphaNum}]*/o; … … 511 511 512 512 # initialize lib directory early because of later 'cd's 513 get TWikiLibDir();513 getLibDir(); 514 514 515 515 # initialize the runtime engine … … 567 567 # We still don't have Codev.UnicodeSupport 568 568 $this->writeWarning( 'UTF-8 not yet supported as site charset -' 569 . ' TWiki is likely to have problems' );569 . 'Foswiki is likely to have problems' ); 570 570 return $text; 571 571 } … … 1115 1115 ---++ ObjectMethod getScriptUrl( $absolute, $script, $web, $topic, ... ) -> $scriptURL 1116 1116 1117 Returns the URL to a TWiki script, providing the web and topic as1117 Returns the URL to a Foswiki script, providing the web and topic as 1118 1118 "path info" parameters. The result looks something like this: 1119 1119 "http://host/twiki/bin/$script/$web/$topic". … … 1121 1121 1122 1122 If $absolute is set, generates an absolute URL. $absolute is advisory only; 1123 TWiki can decide to generate absolute URLs (for example when run from the1123 Foswiki can decide to generate absolute URLs (for example when run from the 1124 1124 command-line) even when relative URLs have been requested. 1125 1125 … … 1167 1167 1168 1168 # See http://www.ietf.org/rfc/rfc2396.txt for the definition of 1169 # "absolute URI". TWiki bastardises this definition by assuming1169 # "absolute URI". Foswiki bastardises this definition by assuming 1170 1170 # that all relative URLs lack the <authority> component as well. 1171 1171 $url = $this->{urlHost} . $url; … … 1210 1210 Composes a pub url. If $absolute is set, returns an absolute URL. 1211 1211 If $absolute is set, generates an absolute URL. $absolute is advisory only; 1212 TWiki can decide to generate absolute URLs (for example when run from the1212 Foswiki can decide to generate absolute URLs (for example when run from the 1213 1213 command-line) even when relative URLs have been requested. 1214 1214 … … 1231 1231 1232 1232 # See http://www.ietf.org/rfc/rfc2396.txt for the definition of 1233 # "absolute URI". TWiki bastardises this definition by assuming1233 # "absolute URI". Foswiki bastardises this definition by assuming 1234 1234 # that all relative URLs lack the <authority> component as well. 1235 1235 $url = $this->{urlHost} . $url; … … 1321 1321 Normalize a Web<nop>.<nop>TopicName 1322 1322 1323 See TWikiFuncDotPmfor a full specification of the expansion (not duplicated1323 See =Foswiki::Func= for a full specification of the expansion (not duplicated 1324 1324 here) 1325 1325 … … 1355 1355 ---++ ClassMethod new( $loginName, $query, \%initialContext ) 1356 1356 1357 Constructs a new TWiki object. Parameters are taken from the query object.1357 Constructs a new Foswiki object. Parameters are taken from the query object. 1358 1358 1359 1359 * =$loginName= is the login username (*not* the wikiname) of the user you … … 1415 1415 # SMELL: can this be done in a BEGIN block? Or is the environment 1416 1416 # set per-query? 1417 # Item4382: Default $ENV{PATH} must be untainted because TWiki runs1417 # TWikibug:Item4382: Default $ENV{PATH} must be untainted because Foswiki runs 1418 1418 # with use strict and calling external programs that writes on the disk 1419 1419 # will fail unless Perl seens it as set to safe value. … … 1540 1540 } 1541 1541 1542 # Item3270 - here's the appropriate place to enforce TWiki spec:1542 # Item3270 - here's the appropriate place to enforce Foswiki spec: 1543 1543 # All topic name sources are evaluated, site charset applied 1544 1544 # SMELL: This untaint unchecked is duplicate of one just above … … 1599 1599 $Foswiki::Plugins::SESSION = $this; 1600 1600 1601 Monitor::MARK(" TWiki session created");1601 Monitor::MARK("Foswiki session created"); 1602 1602 1603 1603 return $this; … … 2113 2113 # Return value: $tableOfContents 2114 2114 # Handles %<nop>TOC{...}% syntax. Creates a table of contents 2115 # using TWiki bulleted2115 # using Foswiki bulleted 2116 2116 # list markup, linked to the section headings of a topic. A section heading is 2117 2117 # entered in one of the following forms: … … 2329 2329 else { 2330 2330 $text = 2331 CGI::h1(' TWiki Installation Error')2331 CGI::h1('Foswiki Installation Error') 2332 2332 . 'Template "' 2333 2333 . $template … … 2551 2551 2552 2552 Escape special characters to HTML numeric entities. This is *not* a generic 2553 encoding, it is tuned specifically for use in TWiki.2553 encoding, it is tuned specifically for use in Foswiki. 2554 2554 2555 2555 HTML4.0 spec: … … 2568 2568 characters (except for \n and \r) using numeric entities. 2569 2569 2570 FURTHER this method also encodes characters that are special in TWiki2570 FURTHER this method also encodes characters that are special in Foswiki 2571 2571 meta-language. 2572 2572 … … 2628 2628 In two cases, no URL encoding is needed: For EBCDIC mainframes, we assume that 2629 2629 site 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 to2630 EBCDIC character set. For sites running in UTF-8, there's no need for Foswiki to 2631 2631 do anything since all URLs and attachment filenames are already in UTF-8. 2632 2632 … … 2809 2809 } 2810 2810 2811 # Process TWiki %TAGS{}% by parsing the input tokenised into2811 # Process Foswiki %TAGS{}% by parsing the input tokenised into 2812 2812 # % separated sections. The parser is a simple stack-based parse, 2813 2813 # sufficient to ensure nesting of tags is correct, but no more … … 3095 3095 3096 3096 Adds a function to the dispatch table of the REST interface 3097 for a given subject. See TWikiScripts#rest for more info.3097 for a given subject. See System.CommandAndCGIScripts#rest for more info. 3098 3098 3099 3099 * =$subject= - The subject under which the function will be registered. … … 3106 3106 </verbatim> 3107 3107 where: 3108 * =\%session= - a reference to the TWiki session object (may be ignored)3108 * =\%session= - a reference to the Foswiki session object (may be ignored) 3109 3109 * =$subject= - The invoked subject (may be ignored) 3110 3110 * =$verb= - The invoked verb (may be ignored) … … 3190 3190 $this->renderer->putBackBlocks( \$text, $verbatim, 'verbatim' ); 3191 3191 3192 # TWiki Plugin Hook (for cache Plugins only)3192 # Foswiki Plugin Hook (for cache Plugins only) 3193 3193 $this->{plugins} 3194 3194 ->dispatch( 'afterCommonTagsHandler', $text, $theTopic, $theWeb, $meta ); … … 3203 3203 Add =$html= to the HEAD tag of the page currently being generated. 3204 3204 3205 Note that TWiki variables may be used in the HEAD. They will be expanded3205 Note that macros may be used in the HEAD. They will be expanded 3206 3206 according to normal variable expansion rules. 3207 3207 … … 3210 3210 * =_DEFAULT= optional, id of the head block. Used to generate a comment in the output HTML. 3211 3211 * =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"=. 3213 3213 * =requires= optional, comma-separated list of id's of other head blocks this one depends on. 3214 3214 =%<nop>ADDTOHEAD%= expands in-place to the empty string, unless there is an error in which case the variable expands to an error string. … … 3241 3241 my ( $this, $tag, $header, $requires ) = @_; 3242 3242 3243 # Expand TWiki variables in the header3243 # Expand macros in the header 3244 3244 $header = 3245 3245 $this->handleCommonTags( $header, $this->{webName}, $this->{topicName} ); … … 3332 3332 3333 3333 Static method to construct a new singleton session instance. 3334 It creates a new TWiki and sets the Plugins $SESSION variable to3334 It creates a new Foswiki and sets the Plugins $SESSION variable to 3335 3335 point to it, so that Foswiki::Func methods will work. 3336 3336 … … 3359 3359 if ( $theUrl && $theUrl ne $query->url() ) { 3360 3360 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'; 3362 3362 } 3363 3363 my $twiki = new Foswiki( $theRemoteUser, $query ); … … 3749 3749 3750 3750 #deprecated functionality, now implemented using %ENV% 3751 #move to compatibility plugin in TWiki53751 #move to compatibility plugin in Foswiki 2.0 3752 3752 sub HTTP_HOST_deprecated { 3753 3753 return $_[0]->{request}->header('Host') || ''; … … 3755 3755 3756 3756 #deprecated functionality, now implemented using %ENV% 3757 #move to compatibility plugin in TWiki53757 #move to compatibility plugin in Foswiki 2.0 3758 3758 sub REMOTE_ADDR_deprecated { 3759 3759 return $_[0]->{request}->remoteAddress() || ''; … … 3761 3761 3762 3762 #deprecated functionality, now implemented using %ENV% 3763 #move to compatibility plugin in TWiki53763 #move to compatibility plugin in Foswiki 2.0 3764 3764 sub REMOTE_PORT_deprecated { 3765 3765 3766 3766 # CGI/1.1 (RFC 3875) doesn't specify REMOTE_PORT, 3767 3767 # but some webservers implement it. However, since 3768 # it's not RFC compliant, TWiki should not rely on3768 # it's not RFC compliant, Foswiki should not rely on 3769 3769 # it. So we get more portability. 3770 3770 return ''; … … 3772 3772 3773 3773 #deprecated functionality, now implemented using %ENV% 3774 #move to compatibility plugin in TWiki53774 #move to compatibility plugin in Foswiki 3775 3775 sub REMOTE_USER_deprecated { 3776 3776 return $_[0]->{request}->remoteUser() || ''; … … 4130 4130 # Spacing of WikiWords is now done with %SPACEOUT% 4131 4131 # (and the private routine _SPACEOUT). 4132 # Move to compatibility module in TWiki54132 # Move to compatibility module in Foswiki 2.0 4133 4133 sub SPACEDTOPIC_deprecated { 4134 4134 my ( $this, $params, $theTopic ) = @_; … … 4381 4381 4382 4382 #deprecated functionality, now implemented using %USERINFO% 4383 #move to compatibility plugin in TWiki54383 #move to compatibility plugin in Foswiki 2.0 4384 4384 sub WIKINAME_deprecated { 4385 4385 my ( $this, $params ) = @_; … … 4392 4392 4393 4393 #deprecated functionality, now implemented using %USERINFO% 4394 #move to compatibility plugin in TWiki54394 #move to compatibility plugin in Foswiki 2.0 4395 4395 sub USERNAME_deprecated { 4396 4396 my ( $this, $params ) = @_; … … 4403 4403 4404 4404 #deprecated functionality, now implemented using %USERINFO% 4405 #move to compatibility plugin in TWiki54405 #move to compatibility plugin in Foswiki 2.0 4406 4406 sub WIKIUSERNAME_deprecated { 4407 4407 my ( $this, $params ) = @_; -
trunk/core/lib/Foswiki/Attach.pm
r809 r812 312 312 # Some browsers wait with rendering a page until the size of 313 313 # embedded images is known, e.g. after all images of a page are 314 # downloaded. When you upload an image to TWiki and checkmark315 # the link checkbox, TWiki will generate the width and height314 # downloaded. When you upload an image to Foswiki and checkmark 315 # the link checkbox, Foswiki will generate the width and height 316 316 # img parameters, speeding up the page rendering. 317 317 my $stream = -
trunk/core/lib/Foswiki/Attrs.pm
r809 r812 27 27 28 28 Class of attribute sets, designed for parsing and storing attribute values 29 from a TWiki tag e.g. =%<nop>TAG{"joe" fred="bad" joe="mad"}%=29 from a macro e.g. =%<nop>MACRO{"joe" fred="bad" joe="mad"}%= 30 30 31 31 An attribute set is a hash containing an entry for each parameter. The … … 36 36 the _first_ instance is always taken. 37 37 38 As well as the default TWiki syntax (parameter values double-quoted)38 As well as the default Foswiki syntax (parameter values double-quoted) 39 39 this class also parses single-quoted values, unquoted spaceless 40 40 values, spaces around the =, and commas as well as spaces separating values. … … 60 60 61 61 * =$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 TWikisyntax.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. 63 63 64 64 Parse a standard attribute string containing name=value pairs and create a new -
trunk/core/lib/Foswiki/Compatibility.pm
r809 r812 26 26 ---+ package Foswiki::Compatibility 27 27 28 Support for compatibility with old TWikiversions. Packaged28 Support for compatibility with old versions. Packaged 29 29 separately because 99.999999% of the time this won't be needed. 30 30 -
trunk/core/lib/Foswiki/Configure/CSS.pm
r809 r812 13 13 __DATA__ 14 14 15 /* TWiki base CSS */15 /* Foswiki base CSS */ 16 16 17 17 .twikiMakeVisible, … … 96 96 the css and html code. 97 97 98 Reworked for TWiki: (c) Arthur Clemens @ visiblearea.com98 Reworked for Foswiki: (c) Arthur Clemens @ visiblearea.com 99 99 */ 100 100 … … 440 440 441 441 /* ----------------------------------------------------------- 442 TWiki styles442 Foswiki styles 443 443 ----------------------------------------------------------- */ 444 444 … … 1340 1340 1341 1341 /* ----------------------------------------------------------- 1342 TWiki styles1342 Foswiki styles 1343 1343 ----------------------------------------------------------- */ 1344 1344 -
trunk/core/lib/Foswiki/Configure/Checker.pm
r809 r812 145 145 # Since Windows (without Cygwin) makes it hard to capture stderr 146 146 # ('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-in147 # GNU tools in any case (installed for Foswiki since there's no built-in 148 148 # diff, grep, patch, etc), we only check for these tools on Unix/Linux 149 149 # and Cygwin. … … 343 343 $mess .= $this->ERROR( 344 344 $err . <<HERE 345 TWiki will probably not work with this RCS setup. Either correct the setup, or345 Foswiki will probably not work with this RCS setup. Either correct the setup, or 346 346 switch to RcsLite. To enable RCSLite you need to change the setting of 347 347 {StoreImpl} to 'RcsLite'. -
trunk/core/lib/Foswiki/Configure/Checkers/BasicSanity.pm
r809 r812 44 44 unless ( $this->{LocalSiteDotCfg} ) { 45 45 $this->{LocalSiteDotCfg} = Foswiki::findFileOnPath('Foswiki.spec') || ''; 46 $this->{LocalSiteDotCfg} =~ s/ TWiki\.spec/LocalSite.cfg/;46 $this->{LocalSiteDotCfg} =~ s/Foswiki\.spec/LocalSite.cfg/; 47 47 } 48 48 -
trunk/core/lib/Foswiki/Configure/Checkers/CGISetup.pm
r809 r812 55 55 is risky because mod_perl will remember old values of configuration 56 56 variables. 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)57 mod_perl (though the rest of Foswiki can be run with mod_perl, of course) 58 58 HERE 59 59 } … … 102 102 $n .= $this->WARN(<<HERE); 103 103 Perl version is older than 5.6.0. 104 TWiki has only been successfully tested on Perl 5.6.X and 5.8.X,104 Foswiki has only been successfully tested on Perl 5.6.X and 5.8.X, 105 105 and there have been reports that it does not run on 5.5. 106 You will need to upgrade Perl libraries and tweak the TWiki107 code to make TWiki work on older versions of Perl106 You will need to upgrade Perl libraries and tweak the Foswiki 107 code to make Foswiki work on older versions of Perl 108 108 HERE 109 109 } … … 148 148 $block .= $this->setting( '@INC library path', 149 149 join( CGI::br(), @INC ) . $this->NOTE(<<HERE) ); 150 This is the Perl library path, used to load TWiki modules,150 This is the Perl library path, used to load Foswiki modules, 151 151 third-party modules used by some plugins, and Perl built-in modules. 152 152 HERE … … 177 177 'Foswiki.pm (Version: <strong>' . $Foswiki::VERSION . '</strong>) found'; 178 178 } 179 $block .= $this->setting( ' TWiki module in @INC path', $mess );179 $block .= $this->setting( 'Foswiki module in @INC path', $mess ); 180 180 181 181 # Check that each of the required Perl modules can be loaded, and … … 241 241 $n .= $this->ERROR(<<HERE); 242 242 Version $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.243 its use with Foswiki. 1.99_12 or higher is recommended. 244 244 HERE 245 245 } … … 259 259 $Foswiki::cfg{DETECTED}{originalPath} . $this->NOTE(<<HERE) ); 260 260 This is the PATH value passed in from the web server to this 261 script - it is reset by TWiki scripts to the PATH below, and261 script - it is reset by Foswiki scripts to the PATH below, and 262 262 is provided here for comparison purposes only. 263 263 HERE … … 306 306 } 307 307 308 # The perl modules that are required by TWiki.308 # The perl modules that are required by Foswiki. 309 309 sub _loadDEPENDENCIES { 310 310 my $this = shift; -
trunk/core/lib/Foswiki/Configure/Checkers/MSWin32.pm
r809 r812 15 15 my $n = $perl5shell . $this->NOTE(<<HERE); 16 16 This environment variable is used by Win32 Perls to run 17 commands from TWiki scripts - it determines which shell program is used to run17 commands from Foswiki scripts - it determines which shell program is used to run 18 18 commands that use 'pipes'. Examples of shell programs are cmd.exe, 19 19 command.com (aka 'DOS Prompt'), and Cygwin's 'bash' … … 29 29 if ($isActivePerl) { 30 30 $n .= $this->WARN(<<HERE); 31 ActiveState Perl on IIS does not support safe pipes, which is the mechanism used by TWiki to prevent a range31 ActiveState Perl on IIS does not support safe pipes, which is the mechanism used by Foswiki to prevent a range 32 32 of attacks aimed at arbitrary command execution on the server. You are <b>highly</b> recommended not to use this 33 33 particular configuration on a public server (one exposed to the internet) -
trunk/core/lib/Foswiki/Configure/Checkers/Sessions/ExpireAfter.pm
r809 r812 31 31 if ( $Foswiki::cfg{Sessions}{ExpireAfter} < 0 ) { 32 32 $e .= $this->WARN(<<'MESSAGE'); 33 TWiki will *not* clean up sessions automatically. Make sure you33 Foswiki will *not* clean up sessions automatically. Make sure you 34 34 have a cron job running. 35 35 MESSAGE -
trunk/core/lib/Foswiki/Configure/Checkers/Site/Locale.pm
r809 r812 59 59 # Check for unusable multi-byte encodings as site character set 60 60 # - 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 syntax61 # matched within a multi-byte character cannot be used for Foswiki. 62 # Refuse to work with character sets that allow Foswiki syntax 63 63 # to be recognised within multi-byte characters. 64 64 # FIXME: match other problematic multi-byte character sets -
trunk/core/lib/Foswiki/Configure/Checkers/UseLocale.pm
r809 r812 110 110 # Warn against Perl 5.6 or lower for UTF-8 111 111 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" ); 114 114 } 115 115 … … 127 127 not set in Config.pm, see <i>Perl's Unicode Model</i> in 'perldoc 128 128 perluniintro') - re-compilation of Perl will be required before it can be 129 used to enable TWiki's experimental UTF-8 support.129 used to enable Foswiki's experimental UTF-8 support. 130 130 HERE 131 131 ); … … 145 145 This version of Perl was not compiled with locale support ('d_setlocale' not 146 146 set in Config.pm) - re-compilation of Perl will be required before it can be 147 used to support TWikiinternationalisation.147 used to support internationalisation. 148 148 HERE 149 149 ); -
trunk/core/lib/Foswiki/Configure/FoswikiCfg.pm
r809 r812 298 298 # If not found on the path, park it beside Foswiki.spec 299 299 $lsc = Foswiki::findFileOnPath('Foswiki.spec') || ''; 300 $lsc =~ s/ TWiki\.spec/LocalSite.cfg/;300 $lsc =~ s/Foswiki\.spec/LocalSite.cfg/; 301 301 } 302 302 … … 308 308 else { 309 309 $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' 311 311 # CGI script, though you can also make (careful!) manual changes with a 312 312 # text editor. -
trunk/core/lib/Foswiki/Configure/Load.pm
r809 r812 28 28 This module consists of just a single subroutine =readConfig=. It allows to 29 29 safely modify configuration variables _for one single run_ without affecting 30 normal TWiki operation.30 normal Foswiki operation. 31 31 32 32 =cut … … 40 40 ---++ StaticMethod readConfig() 41 41 42 In normal TWiki operations as a web server this routine is called by the42 In normal Foswiki operations as a web server this routine is called by the 43 43 =BEGIN= block of =Foswiki.pm=. However, when benchmarking/debugging it can be 44 44 replaced by custom code which sets the configuration hash. To prevent us from … … 46 46 =$cfg{ConfigurationFinished}= as an indicator. 47 47 48 Note that this method is called by TWiki and configure, and *only* reads48 Note that this method is called by Foswiki and configure, and *only* reads 49 49 Foswiki.spec= to get defaults. Other spec files (those for extensions) are 50 50 *not* read. … … 89 89 PubDir TemplateDir ScriptUrlPath LocalesDir ) { 90 90 91 # We can't do this, because it prevents TWiki being run without91 # We can't do this, because it prevents Foswiki being run without 92 92 # a LocalSite.cfg, which we don't want 93 93 # die "$var must be defined in LocalSite.cfg" … … 121 121 ---++ StaticMethod expandValue($string) -> $boolean 122 122 123 Expands references to TWiki configuration items which occur in the123 Expands references to Foswiki configuration items which occur in the 124 124 value of other configuration items. Use expand($hashref) if the item 125 125 is not a plain scalar. … … 138 138 ---++ StaticMethod readDefaults() -> \@errors 139 139 140 This is only called by =configure= to initialise the TWiki config hash with140 This is only called by =configure= to initialise the Foswiki config hash with 141 141 default values from the .spec files. 142 142 -
trunk/core/lib/Foswiki/Configure/UIs/AUTH.pm
r809 r812 102 102 </li> 103 103 <li> 104 If you are running TWiki on a public website, you are104 If you are running Foswiki on a public website, you are 105 105 <strong>strongly</strong> advised to totally disable saving from 106 106 <code>configure</code> by making <code>lib/LocalSite.cfg</code> readonly once -
trunk/core/lib/Foswiki/Configure/UIs/EXTENSIONS.pm
r809 r812 29 29 version => 'Most Recent Version', 30 30 installedVersion => 'Installed Version', 31 testedOn => 'Tested On TWiki',31 testedOn => 'Tested On Foswiki', 32 32 testedOnOS => 'Tested On OS', 33 33 install => 'Action', … … 159 159 my $page = <<INTRO; 160 160 To 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 see161 write files everywhere in your Foswiki installation. Otherwise you may see 162 162 'No permission to write' errors during extension installation. 163 163 INTRO -
trunk/core/lib/Foswiki/Configure/UIs/UPDATE.pm
r809 r812 47 47 } 48 48 49 # Put in a link to the front page of the TWiki49 # Put in a link to the front page of the Foswiki 50 50 my $url = 51 51 "$Foswiki::cfg{DefaultUrlHost}$Foswiki::cfg{ScriptUrlPath}/view$Foswiki::cfg{ScriptSuffix}/"; … … 59 59 . '.' ) 60 60 . 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 "; 62 62 } 63 63 -
trunk/core/lib/Foswiki/Engine.pm
r809 r812 28 28 ---+!! package Foswiki::Engine 29 29 30 The engine class is a singleton that implements details about TWiki's30 The engine class is a singleton that implements details about Foswiki's 31 31 execution mode. This is the base class and implements basic behavior. 32 32 … … 73 73 ---++ ObjectMethod run() 74 74 75 Start point to TWikiRuntime Engines.75 Start point to Runtime Engines. 76 76 77 77 =cut … … 139 139 # tell the browser where to look for more help 140 140 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.' 142 142 . "\n\n"; 143 143 $mess =~ s/ at .*$//s; -
trunk/core/lib/Foswiki/Form.pm
r809 r812 15 15 derived from Foswiki::Form::FieldDefinition. These objects are responsible 16 16 for 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 a17 are parsed from Foswiki tables, and the types are mapped by name to a 18 18 class declared in Foswiki::Form::* - for example, the =text= type is mapped 19 19 to =Foswiki::Form::Text= and the =checkbox= type to =Foswiki::Form::Checkbox=. -
trunk/core/lib/Foswiki/Form/Label.pm
r809 r812 12 12 my ( $this, $web, $topic, $value ) = @_; 13 13 14 # Changing labels through the URL is a feature for TWiki applications,14 # Changing labels through the URL is a feature for Foswiki applications, 15 15 # even though it's not accessible for standard edits. Some contribs 16 16 # may want to override this to make labels editable. -
trunk/core/lib/Foswiki/Form/Select.pm
r809 r812 29 29 ---++ getDefaultValue() -> $value 30 30 The 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 decision31 Foswiki form definitions to indicate selected values. This defers the decision 32 32 on a value to the browser. 33 33 -
trunk/core/lib/Foswiki/Func.pm
r809 r812 8 8 %STARTINCLUDE% 9 9 10 _Official list of stable TWiki functions for Plugin developers_10 _Official list of stable Foswiki functions for Plugin developers_ 11 11 12 12 This module defines official functions that [[%SYSTEMWEB%.Plugins][Plugins]] 13 can use to interact with the TWiki engine and content.14 15 Refer to TWiki.EmptyPlugin andlib/Foswiki/Plugins/EmptyPlugin.pm for a template Plugin and documentation on how to write a Plugin.13 can use to interact with the Foswiki engine and content. 14 15 Refer to lib/Foswiki/Plugins/EmptyPlugin.pm for a template Plugin and documentation on how to write a Plugin. 16 16 17 17 Plugins should *only* use functions published in this module. If you use 18 functions in other TWiki libraries you might create a security hole and19 you will probably need to change your Plugin when you upgrade TWiki.18 functions in other Foswiki libraries you might create a security hole and 19 you will probably need to change your Plugin when you upgrade Foswiki. 20 20 21 21 Deprecated functions will still work in older code, though they should … … 26 26 of the Foswiki::Plugins module. 27 27 28 Notes on use of =$Foswiki::Plugins::VERSION= (from TWiki 1.2 forwards):28 Notes on use of =$Foswiki::Plugins::VERSION=: 29 29 * If the *major* version (e.g. =1.=) is the same then any plugin coded 30 30 to use any *earlier* revision of the =1.= API will still work. No … … 329 329 330 330 The context is a set of identifiers that are set 331 during specific phases of TWikiprocessing. For example, each of331 during specific phases of processing. For example, each of 332 332 the standard scripts in the 'bin' directory each has a context 333 333 identifier - the view script has 'view', the edit script has 'edit' … … 380 380 * =$web= - new web 381 381 * =$topic= - new topic 382 Change the TWiki context so it behaves as if it was processing =$web.$topic=382 Change the Foswiki context so it behaves as if it was processing =$web.$topic= 383 383 from now on. All the preferences will be reset to those of the new topic. 384 384 Note that if the new topic is not readable by the logged in user due to … … 420 420 ---+++ popTopicContext() 421 421 422 Returns the TWiki context to the state it was in before the422 Returns the Foswiki context to the state it was in before the 423 423 =pushTopicContext= was called. 424 424 … … 447 447 ---+++ getPreferencesValue( $key, $web ) -> $value 448 448 449 Get a preferences value from TWiki or from a Plugin449 Get a preferences value from Foswiki or from a Plugin 450 450 * =$key= - Preferences key 451 451 * =$web= - Name of web, optional. Current web if not specified; does not apply to settings of Plugin topics … … 463 463 * =my $webColor = Foswiki::Func::getPreferencesValue( 'WEBBGCOLOR', 'Sandbox' );= 464 464 465 *NOTE:* As of TWiki4.1, if =$NO_PREFS_IN_TOPIC= is enabled in the plugin, then465 *NOTE:* If =$NO_PREFS_IN_TOPIC= is enabled in the plugin, then 466 466 preferences set in the plugin topic will be ignored. 467 467 … … 492 492 *Since:* Foswiki::Plugins::VERSION 1.021 (27 Mar 2004) 493 493 494 *NOTE:* As of TWiki4.1, if =$NO_PREFS_IN_TOPIC= is enabled in the plugin, then494 *NOTE:* If =$NO_PREFS_IN_TOPIC= is enabled in the plugin, then 495 495 preferences set in the plugin topic will be ignored. 496 496 … … 510 510 ---+++ getPreferencesFlag( $key, $web ) -> $value 511 511 512 Get a preferences flag from TWiki or from a Plugin512 Get a preferences flag from Foswiki or from a Plugin 513 513 * =$key= - Preferences key 514 514 * =$web= - Name of web, optional. Current web if not specified; does not apply to settings of Plugin topics … … 522 522 * =my $showHelp = Foswiki::Func::getPreferencesFlag( "MYPLUGIN_SHOWHELP" );= 523 523 524 *NOTE:* As of TWiki4.1, if =$NO_PREFS_IN_TOPIC= is enabled in the plugin, then524 *NOTE:* If =$NO_PREFS_IN_TOPIC= is enabled in the plugin, then 525 525 preferences set in the plugin topic will be ignored. 526 526 … … 546 546 *Since:* Foswiki::Plugins::VERSION 1.021 (27 Mar 2004) 547 547 548 *NOTE:* As of TWiki4.1, if =$NO_PREFS_IN_TOPIC= is enabled in the plugin, then548 *NOTE:* If =$NO_PREFS_IN_TOPIC= is enabled in the plugin, then 549 549 preferences set in the plugin topic will be ignored. 550 550 … … 579 579 =pod 580 580 581 ---+++ getWikiToolName( ) -> $name582 583 Get toolname as defined in TWiki.cfg584 585 Return: =$name= Name of tool, e.g. ='TWiki'=586 587 *Since:* Foswiki::Plugins::VERSION 1.000 (27 Feb 2001)588 589 =cut590 591 sub getWikiToolName {592 return $Foswiki::cfg{WikiToolName};593 }594 595 =pod596 597 ---+++ getMainWebname( ) -> $name598 599 Get name of Main web as defined in TWiki.cfg600 601 Return: =$name= Name, e.g. ='Main'=602 603 *Since:* Foswiki::Plugins::VERSION 1.000 (27 Feb 2001)604 605 =cut606 607 sub getMainWebname {608 return $Foswiki::cfg{UsersWebName};609 }610 611 =pod612 613 ---+++ getTwikiWebname( ) -> $name614 615 Get name of TWiki documentation web as defined in TWiki.cfg616 617 Return: =$name= Name, e.g. ='TWiki'=618 619 *Since:* Foswiki::Plugins::VERSION 1.000 (27 Feb 2001)620 621 =cut622 623 sub getTwikiWebname {624 return $Foswiki::cfg{SystemWebName};625 }626 627 =pod628 629 581 ---++ User Handling and Access Control 630 582 ---+++ getDefaultUserName( ) -> $loginName … … 646 598 * =$user= can be a login, wikiname or web.wikiname 647 599 Return the cUID of the specified user. A cUID is a unique identifier which 648 is assigned by TWiki for each user.600 is assigned by Foswiki for each user. 649 601 BEWARE: While the default TopicUserMapping uses a cUID that looks like a user's 650 602 LoginName, some characters are modified to make them compatible with rcs. … … 776 728 ---+++ userToWikiName( $loginName, $dontAddWeb ) -> $wikiName 777 729 Translate a login name to a Wiki name 778 * =$loginName= - Login name, e.g. ='jdoe'=. Since TWiki 4.2.1 this may730 * =$loginName= - Login name, e.g. ='jdoe'=. This may 779 731 also be a wiki name. This will normally be transparent, but may be 780 732 relevant if you have login names that are also valid wiki names. … … 845 797 undef, returns the registered email addresses for the logged-in user. 846 798 847 Since TWiki 4.2.1,$user may also be a login name, or the name of a group.799 $user may also be a login name, or the name of a group. 848 800 849 801 *Since:* Foswiki::Plugins::VERSION 1.2 … … 1029 981 ---+++ isGroup( $group ) -> $boolean 1030 982 1031 Checks if =$group= is the name of a group known to TWiki.983 Checks if =$group= is the name of a user group. 1032 984 1033 985 =cut … … 1079 1031 [[%SYSTEMWEB%.AccessControl]] rules 1080 1032 * =$type= - Access type, required, e.g. ='VIEW'=, ='CHANGE'=. 1081 * =$id= - WikiName of remote user, required, e.g. =" PeterThoeny"=. From1082 TWiki 4.2.1,$id may also be a login name.1033 * =$id= - WikiName of remote user, required, e.g. ="RickShaw"=. 1034 $id may also be a login name. 1083 1035 If =$id= is '', 0 or =undef= then access is *always permitted*. 1084 1036 * =$text= - Topic text, optional. If 'perl false' (undef, 0 or ''), … … 1087 1039 1 You are setting different access controls in the text to those defined 1088 1040 in the stored topic, 1089 1 You already have the topic text in hand, and want to help TWikiavoid1041 1 You already have the topic text in hand, and want to help avoid 1090 1042 having to read it again, 1091 1043 1 You are providing a =$meta= parameter. … … 1100 1052 1101 1053 *Note* the weird parameter order is due to compatibility constraints with 1102 earlier TWikireleases.1054 earlier releases. 1103 1055 1104 1056 *Tip* if you want, you can use this method to check your own access control types. For example, if you: … … 1936 1888 list of loaded templates, overwriting any previous definition. 1937 1889 1938 How TWiki searches for templates is described in SkinTemplates.1890 How Foswiki searches for templates is described in SkinTemplates. 1939 1891 1940 1892 If template text is found, extracts include statements and fully expands them. … … 1958 1910 1959 1911 A template is defined using a %TMPL:DEF% statement in a template 1960 file. See the documentation on TWiki templates for more information.1912 file. See the documentation on Foswiki templates for more information. 1961 1913 1962 1914 =cut … … 2002 1954 The =$passthru= parameter allows you to pass the parameters that were passed 2003 1955 to the current query on to the target URL, as long as it is another URL on the 2004 same TWiki installation. If =$passthru= is set to a true value, then TWiki1956 same installation. If =$passthru= is set to a true value, then Foswiki 2005 1957 will save the current URL parameters, and then try to restore them on the 2006 1958 other side of the redirect. Parameters are stored on the server in a cache … … 2018 1970 </verbatim> 2019 1971 =$passthru= does nothing if =$url= does not point to a script in the current 2020 TWiki installation.1972 Foswiki installation. 2021 1973 2022 1974 *Since:* Foswiki::Plugins::VERSION 1.000 (7 Dec 2002) … … 2039 1991 * =$header= - the HTML to be added to the <head> section. The HTML must be valid in a HEAD tag - no checks are performed. 2040 1992 * =requires= optional, comma-separated list of id's of other head blocks this one depends on. 2041 2042 All TWiki variables present in =$header= will be expanded before being inserted into the =<head>= section.1993 1994 All macros present in =$header= will be expanded before being inserted into the =<head>= section. 2043 1995 2044 1996 Note that this is _not_ the same as the HTTP header, which is modified through the Plugins =modifyHeaderHandler=. … … 2089 2041 ---+++ renderText( $text, $web ) -> $text 2090 2042 2091 Render text from T Wiki markupinto XHTML as defined in [[%SYSTEMWEB%.TextFormattingRules]]2043 Render text from TML into XHTML as defined in [[%SYSTEMWEB%.TextFormattingRules]] 2092 2044 * =$text= - Text to render, e.g. ='*bold* text and =fixed font='= 2093 2045 * =$web= - Web name, optional, e.g. ='Main'=. The current web is taken if missing … … 2110 2062 2111 2063 Render topic name and link label into an XHTML link. Normally you do not need to call this funtion, it is called internally by =renderText()= 2112 * =$pre= - Text occuring before the TWikilink syntax, optional2064 * =$pre= - Text occuring before the link syntax, optional 2113 2065 * =$web= - Web name, required, e.g. ='Main'= 2114 2066 * =$topic= - Topic name to link to, required, e.g. ='WebNotify'= … … 2182 2134 returns a single email address, where a user may in fact have several. 2183 2135 2184 Since TWiki 4.2.1,$wikiName may also be a login name.2136 $wikiName may also be a login name. 2185 2137 2186 2138 =cut … … 2238 2190 ---++ Special handlers 2239 2191 2240 Special handlers can be defined to make functions in plugins behave as if they were built-in to TWiki.2192 Special handlers can be defined to make functions in plugins behave as if they were built-in. 2241 2193 2242 2194 =cut … … 2248 2200 Should only be called from initPlugin. 2249 2201 2250 Register a function to handle a simple variable. Handles both %<nop>VAR% and %<nop>VAR{...}%. Registered variables are treated the same as TWiki internal variables, and are expanded at the same time. This is a _lot_ more efficient than using the =commonTagsHandler=.2202 Register a function to handle a simple variable. Handles both %<nop>VAR% and %<nop>VAR{...}%. Registered variables are treated the same as internal macros, and are expanded at the same time. This is a _lot_ more efficient than using the =commonTagsHandler=. 2251 2203 * =$var= - The name of the variable, i.e. the 'MYVAR' part of %<nop>MYVAR%. The variable name *must* match /^[A-Z][A-Z0-9_]*$/ or it won't work. 2252 2204 * =\&fn= - Reference to the handler function. 2253 * =$syntax= can be 'classic' (the default) or 'context-free'. 'classic' syntax is appropriate where you want the variable to support classic TWikisyntax i.e. to accept the standard =%<nop>MYVAR{ "unnamed" param1="value1" param2="value2" }%= syntax, as well as an unquoted default parameter, such as =%<nop>MYVAR{unquoted parameter}%=. If your variable will only use named parameters, you can use 'context-free' syntax, which supports a more relaxed syntax. For example, %MYVAR{param1=value1, value 2, param3="value 3", param4='value 5"}%2205 * =$syntax= can be 'classic' (the default) or 'context-free'. 'classic' syntax is appropriate where you want the variable to support classic syntax i.e. to accept the standard =%<nop>MYVAR{ "unnamed" param1="value1" param2="value2" }%= syntax, as well as an unquoted default parameter, such as =%<nop>MYVAR{unquoted parameter}%=. If your variable will only use named parameters, you can use 'context-free' syntax, which supports a more relaxed syntax. For example, %MYVAR{param1=value1, value 2, param3="value 3", param4='value 5"}% 2254 2206 2255 2207 *Since:* Foswiki::Plugins::VERSION 1.1 … … 2260 2212 </verbatim> 2261 2213 where: 2262 * =\%session= - a reference to the TWikisession object (may be ignored)2214 * =\%session= - a reference to the session object (may be ignored) 2263 2215 * =\%params= - a reference to a Foswiki::Attrs object containing parameters. This can be used as a simple hash that maps parameter names to values, with _DEFAULT being the name for the default parameter. 2264 2216 * =$topic= - name of the topic in the query … … 2284 2236 =%<nop>EXEC{"ps -Af" silent="on"}%= 2285 2237 2286 Registered tags differ from tags implemented using the old TWikiapproach (text substitution in =commonTagsHandler=) in the following ways:2238 Registered tags differ from tags implemented using the old approach (text substitution in =commonTagsHandler=) in the following ways: 2287 2239 * registered tags are evaluated at the same time as system tags, such as %SERVERTIME. =commonTagsHandler= is only called later, when all system tags have already been expanded (though they are expanded _again_ after =commonTagsHandler= returns). 2288 2240 * registered tag names can only contain alphanumerics and _ (underscore) … … 2328 2280 </verbatim> 2329 2281 where: 2330 * =\%session= - a reference to the TWiki session object (may be ignored)2282 * =\%session= - a reference to the Foswiki session object (may be ignored) 2331 2283 2332 2284 From the REST interface, the name of the plugin must be used … … 2379 2331 ---+++ decodeFormatTokens($str) -> $unencodedString 2380 2332 2381 TWiki has an informal standard set of tokens used in =format=2333 Foswiki has an informal standard set of tokens used in =format= 2382 2334 parameters that are used to block evaluation of paramater strings. 2383 2335 For example, if you were to write … … 2386 2338 2387 2339 then %<nop>WURBLE would be expanded *before* %<NOP>MYTAG is evaluated. To avoid 2388 this TWiki uses escapes in the format string. For example:2340 this Foswiki uses escapes in the format string. For example: 2389 2341 2390 2342 =%<nop>MYTAG{format="$percntWURBLE$percnt"}%= 2391 2343 2392 2344 This lets you enter arbitrary strings into parameters without worrying that 2393 TWiki will expand them before your plugin gets a chance to deal with them2345 Foswiki will expand them before your plugin gets a chance to deal with them 2394 2346 properly. Once you have processed your tag, you will want to expand these 2395 2347 tokens to their proper value. That's what this function does. … … 2468 2420 2469 2421 Gets a private directory for Plugin use. The Plugin is entirely responsible 2470 for managing this directory; TWiki will not read from it, or write to it.2422 for managing this directory; Foswiki will not read from it, or write to it. 2471 2423 2472 2424 The directory is guaranteed to exist, and to be writable by the webserver … … 2546 2498 ---+++ getRegularExpression( $name ) -> $expr 2547 2499 2548 Retrieves a TWiki predefined regular expression or character class.2500 Retrieves a Foswiki predefined regular expression or character class. 2549 2501 * =$name= - Name of the expression to retrieve. See notes below 2550 2502 Return: String or precompiled regular expression matching as described below. … … 2552 2504 *Since:* Foswiki::Plugins::VERSION 1.020 (9 Feb 2004) 2553 2505 2554 __Note:__ TWiki internally precompiles several regular expressions to2506 __Note:__ Foswiki internally precompiles several regular expressions to 2555 2507 represent various string entities in an <nop>I18N-compatible manner. Plugins 2556 2508 authors are encouraged to use these in matching where appropriate. The 2557 2509 following are guaranteed to be present. Others may exist, but their use 2558 is unsupported and they may be removed in future TWiki versions.2510 is unsupported and they may be removed in future Foswiki versions. 2559 2511 2560 2512 In the table below, the expression marked type 'String' are intended for … … 2620 2572 | *Input* | *Return* | 2621 2573 | <tt>( '%<nop>USERSWEB%', 'Topic' )</tt> | <tt>( 'Main', 'Topic' ) </tt> | 2622 | <tt>( '%<nop>SYSTEMWEB%', 'Topic' )</tt> | <tt>( ' TWiki', 'Topic' ) </tt> |2623 | <tt>( '', '%<nop>DOCWEB%.Topic' )</tt> | <tt>( ' TWiki', 'Topic' ) </tt> |2574 | <tt>( '%<nop>SYSTEMWEB%', 'Topic' )</tt> | <tt>( 'System', 'Topic' ) </tt> | 2575 | <tt>( '', '%<nop>DOCWEB%.Topic' )</tt> | <tt>( 'System', 'Topic' ) </tt> | 2624 2576 2625 2577 =cut … … 2833 2785 ---++ Deprecated functions 2834 2786 2835 From time-to-time, the TWiki developers will add new functions to the interface (either to TWikiFuncDotPm, or new handlers). Sometimes these improvements mean that old functions have to be deprecated to keep the code manageable. When this happens, the deprecated functions will be supported in the interface for at least one more TWikirelease, and probably longer, though this cannot be guaranteed.2836 2837 Updated plugins may still need to define deprecated handlers for compatibility with old TWiki versions. In this case, the plugin package that defines old handlers can suppress the warnings in %<nop>FAILEDPLUGINS%.2787 From time-to-time, the Foswiki developers will add new functions to the interface (either to =Foswiki::Func=, or new handlers). Sometimes these improvements mean that old functions have to be deprecated to keep the code manageable. When this happens, the deprecated functions will be supported in the interface for at least one more release, and probably longer, though this cannot be guaranteed. 2788 2789 Updated plugins may still need to define deprecated handlers for compatibility with old Foswiki versions. In this case, the plugin package that defines old handlers can suppress the warnings in %<nop>FAILEDPLUGINS%. 2838 2790 2839 2791 This is done by defining a map from the handler name to the =Foswiki::Plugins= version _in which the handler was first deprecated_. For example, if we need to define the =endRenderingHandler= for compatibility with =Foswiki::Plugins= versions before 1.1, we would add this to the plugin: 2840 2792 <verbatim> 2841 2793 package Foswiki::Plugins::SinkPlugin; 2842 use vars qw( % TWikiCompatibility );2843 $ TWikiCompatibility{endRenderingHandler} = 1.1;2844 </verbatim> 2845 If the currently-running TWikiversion is 1.1 _or later_, then the _handler will not be called_ and _the warning will not be issued_. TWiki with versions of =Foswiki::Plugins= before 1.1 will still call the handler as required.2794 use vars qw( %FoswikiCompatibility ); 2795 $FoswikiCompatibility{endRenderingHandler} = 1.1; 2796 </verbatim> 2797 If the currently-running code version is 1.1 _or later_, then the _handler will not be called_ and _the warning will not be issued_. TWiki with versions of =Foswiki::Plugins= before 1.1 will still call the handler as required. 2846 2798 2847 2799 The following functions are retained for compatibility only. You should … … 2854 2806 *DEPRECATED* since 1.1 - use =getScriptUrl= instead. 2855 2807 2856 Return: =$path= URL path of TWikiscripts, e.g. ="/cgi-bin"=2808 Return: =$path= URL path of bin scripts, e.g. ="/cgi-bin"= 2857 2809 2858 2810 *WARNING:* you are strongly recommended *not* to use this function, as the … … 2868 2820 return $Foswiki::Plugins::SESSION->getScriptUrl( 0, '' ); 2869 2821 } 2822 2823 2824 =pod 2825 2826 ---+++ getWikiToolName( ) -> $name 2827 2828 *DEPRECATED* in Foswiki; use $Foswiki::cfg{WikiToolName} instead 2829 2830 =cut 2831 2832 sub getWikiToolName { return $Foswiki::cfg{WikiToolName}; } 2833 2834 =pod 2835 2836 ---+++ getMainWebname( ) -> $name 2837 2838 *DEPRECATED* in Foswiki; use $Foswiki::cfg{UsersWebName} instead 2839 2840 =cut 2841 2842 sub getMainWebname { return $Foswiki::cfg{UsersWebName}; } 2843 2844 =pod 2845 2846 ---+++ getTwikiWebname( ) -> $name 2847 2848 *DEPRECATED* in Foswiki; use $Foswiki::cfg{SystemWebName} instead 2849 2850 =cut 2851 2852 sub getTwikiWebname { return $Foswiki::cfg{SystemWebName}; } 2870 2853 2871 2854 =pod … … 2880 2863 Return: =$url= URL, e.g. ="http://example.com:80/cgi-bin/oops.pl/ Main/WebNotify?template=oopslocked&param1=joe"= 2881 2864 2882 *DEPRECATED* since 1.1, the recommended approach is to throw an [[TWikiOopsExceptionDotPm][oops exception]].2865 *DEPRECATED* since 1.1, the recommended approach is to throw an oops exception. 2883 2866 <verbatim> 2884 2867 use Error qw( :try ); … … 2964 2947 *DEPRECATED* since 1.1 - use =getListOfWebs= instead. 2965 2948 2966 Get list of all public webs, e.g. all webs that do not have the =NOSEARCHALL= flag set in the WebPreferences2967 2968 Return: =@webs= List of all public webs , e.g. =( 'Main', 'Know', 'TWiki' )=2949 Get list of all public webs, e.g. all webs *and subwebs* that do not have the =NOSEARCHALL= flag set in the WebPreferences 2950 2951 Return: =@webs= List of all public webs *and subwebs* 2969 2952 2970 2953 *Since:* Foswiki::Plugins::VERSION 1.000 (07 Dec 2002) … … 3009 2992 *DEPRECATED* since 1.1 - use the "Webs, Topics and Attachments" functions to manipulate topics instead 3010 2993 3011 Get data directory (topic file root)3012 3013 Return: =$dir= Data directory, e.g. ='/twiki/data'=3014 3015 This function violates store encapsulation and is therefore *deprecated*.3016 3017 *Since:* Foswiki::Plugins::VERSION 1.000 (07 Dec 2002)3018 3019 2994 =cut 3020 2995 … … 3029 3004 *DEPRECATED* since 1.1 - use the "Webs, Topics and Attachments" functions to manipulateattachments instead 3030 3005 3031 Get pub directory (file attachment root). Attachments are in =$dir/Web/TopicName= 3032 3033 Return: =$dir= Pub directory, e.g. ='/htdocs/twiki/pub'= 3034 3035 This function violates store encapsulation and is therefore *deprecated*. 3036 3037 Use =readAttachment= and =saveAttachment= instead. 3038 3039 *Since:* Foswiki::Plugins::VERSION 1.000 (07 Dec 2002) 3040 3041 =cut 3042 3043 sub getPubDir { 3044 return $Foswiki::cfg{PubDir}; 3045 } 3046 3047 =pod 3048 3049 ---+++ checkDependencies( $moduleName, $dependenciesRef ) -> $error 3050 3051 *DEPRECATED* since 1.1 - use TWiki:Plugins.BuildContrib and define DEPENDENCIES that can be statically 3052 evaluated at install time instead. It is a lot more efficient. 3053 3054 *Since:* Foswiki::Plugins::VERSION 1.025 (01 Aug 2004) 3055 3056 =cut 3057 3006 =cut 3007 3008 sub getPubDir { return $Foswiki::cfg{PubDir}; } 3009 3010 # Removed; it was never used 3058 3011 sub checkDependencies { 3059 my ( $context, $deps ) = @_; 3060 my $report = ''; 3061 my $depsOK = 1; 3062 foreach my $dep (@$deps) { 3063 my ( $ok, $ver ) = ( 1, 0 ); 3064 my $msg = ''; 3065 my $const = ''; 3066 3067 eval "require $dep->{package}"; 3068 if ($@) { 3069 $msg .= "it could not be found: $@"; 3070 $ok = 0; 3071 } 3072 else { 3073 if ( defined( $dep->{constraint} ) ) { 3074 $const = $dep->{constraint}; 3075 eval "\$ver = \$$dep->{package}::VERSION;"; 3076 if ($@) { 3077 $msg .= "the VERSION of the package could not be found: $@"; 3078 $ok = 0; 3079 } 3080 else { 3081 eval "\$ok = ( \$ver $const )"; 3082 if ( $@ || !$ok ) { 3083 $msg .= " $ver is currently installed: $@"; 3084 $ok = 0; 3085 } 3086 } 3087 } 3088 } 3089 unless ($ok) { 3090 $report .= 3091 "WARNING: $dep->{package}$const is required for $context, but $msg\n"; 3092 $depsOK = 0; 3093 } 3094 } 3095 return undef if ($depsOK); 3096 3097 return $report; 3012 die "checkDependencies removed; contact plugin author or maintainer and tell them to use BuildContrib DEPENDENCIES instead"; 3098 3013 } 3099 3014 … … 3120 3035 3121 3036 As per the GPL, removal of this notice is prohibited. 3122 3123 ---++ API History3124 3125 ---+++ twiki-20010901-release (Athens)3126 $Foswiki::Plugins::VERSION 1.0003127 ---++++ EmptyPlugin.pm3128 * =commonTagsHandler($text, $topic, $web)=3129 * =endRenderingHandler($text)=3130 * =outsidePREHandler($text)=3131 * =insidePREHandler($text)=3132 * =startRenderingHandler($text, $web)=3133 ---++++ Func.pm3134 * =checkAccessPermission($type, $login, $topicText, $topicName, $webName) -> $boolean=3135 * =expandCommonVariables($text, $topic, $web) -> $text=3136 * =extractNameValuePair($attrs, $name) -> $value=3137 * =formatGmTime($time) -> $text=3138 * =getCgiQuery() -> $query=3139 * =getDataDir() -> $dir=3140 * =getDefaultUserName() -> $loginName=3141 * =getMainWebname() -> $name=3142 * =getOopsUrl($web, $topic, $template, @theParams) -> $url=3143 * =getPreferencesFlag($key) -> $boolean=3144 * =getPreferencesValue($key, $web) -> $value=3145 * =getPublicWebList() -> @webs=3146 * =getPubDir() -> $dir=3147 * =getPubUrlPath() -> $path=3148 * =getRevisionInfo($webName, $topic, $rev, $attachment) -> ($date, $user, $rev, $comment)=3149 * =getScriptUrl($web, $topic, $script) -> $url=3150 * =getScriptUrlPath() -> $path=3151 * =getSessionValue($key) -> $value=3152 * =getSkin() -> $skin=3153 * =getTopicList($web) -> @topics=3154 * =getTwikiWebname() -> $name=3155 * =getUrlHost() -> $host=3156 * =getViewUrl($web, $topic) -> $url=3157 * =getWikiName() -> $wikiName=3158 * =getWikiUserName($text) -> $wikiName=3159 * =getWikiToolName() -> $name=3160 * =internalLink($preamble, $web, $topic, $linkText, $anchor, $createLink) -> $text=3161 * =isGuest() -> $boolean=3162 * =permissionsSet($web) -> $boolean=3163 * =readFile($filename) -> $text=3164 * =readTemplate($name, $skin) -> $text=3165 * =readTopic($webName, $topic) -> ($meta, $text)=3166 * =redirectCgiQuery($query, $url)=3167 * =renderText($text, $web) -> $text=3168 * =saveFile($filename, $text)=3169 * =setSessionValue($key, $value)=3170 * =topicExists($web, $topic) -> $boolean=3171 * =userToWikiName($user, $dontAddWeb) -> $wikiName=3172 * =webExists($web) -> $boolean=3173 * =wikiToUserName($wiki) -> $loginName=3174 * =writeDebug($text)=3175 * =writeHeader($query)=3176 * =writeWarning($text)=3177 3178 ---+++ TWikiRelease01Feb2003 (Beijing)3179 $Foswiki::Plugins::VERSION 1.0103180 ---++++ EmptyPlugin.pm3181 * =afterEditHandler($text, $topic, $web)=3182 * =beforeEditHandler($text, $topic, $web)=3183 * =beforeSaveHandler($text, $topic, $web)=3184 * =initializeUserHandler($loginName, $url, $pathInfo)=3185 * =redirectCgiQueryHandler($query, $url)=3186 * =registrationHandler($web, $wikiName, $loginName)=3187 * =writeHeaderHandler($query)=3188 ---++++ Func.pm3189 * =checkTopicEditLock($web, $topic) ->($oopsUrl, $loginName, $unlockTime)=3190 * =readTopicText($web, $topic, $rev, $ignorePermissions) -> $text=3191 * =saveTopicText($web, $topic, $text, $ignorePermissions, $dontNotify) -> $oopsUrl=3192 * =setTopicEditLock($web, $topic, $lock) -> $oopsUrl=3193 3194 ---+++ twiki-20040902-release (Cairo)3195 $Foswiki::Plugins::VERSION 1.0253196 ---++++ EmptyPlugin.pm3197 * =afterCommonTagsHandler($text, $topic, $web)=3198 * =afterSaveHandler($text, $topic, $web, $error)=3199 * =beforeCommonTagsHandler($text, $topic, $web)=3200 * =earlyInitPlugin()=3201 ---++++ Func.pm3202 * =afterAttachmentSaveHandler(\%attrHash, $topic, $web, $error)=3203 * =beforeAttachmentSaveHandler(\%attrHash, $topic, $web)=3204 * =checkDependencies($moduleName, $dependenciesRef) -> $error=3205 * =extractParameters($attr) -> %params=3206 * =formatTime($time, $format, $timezone) -> $text=3207 * =getPluginPreferencesFlag($key) -> $boolean=3208 * =getPluginPreferencesValue($key) -> $value=3209 * =getRegularExpression($regexName) -> $pattern=3210 3211 ---+++ TWikiRelease04x00x00 (Dakar)3212 $Foswiki::Plugins::VERSION 1.13213 ---++++ EmptyPlugin.pm3214 * =mergeHandler($diff, $old, $new, \%info) -> $text=3215 * =modifyHeaderHandler(\%headers, $query)=3216 * =postRenderingHandler($text)=3217 * =preRenderingHandler($text, \%map)=3218 * =renderFormFieldForEditHandler($name, $type, $size, $value, $attributes, $possibleValues) -> $html=3219 * =renderWikiWordHandler($linkText, $hasExplicitLinkLabel, $web, $topic) -> $linkText=3220 3221 * <strike> =endRenderingHandler($text)= </strike>3222 * <strike> =startRenderingHandler($text, $web)= </strike>3223 ---++++ Func.pm3224 * =addToHEAD($id, $header)=3225 * =attachmentExists($web, $topic, $attachment) -> $boolean=3226 * =clearSessionValue($key) -> $boolean=3227 * =checkDependencies($moduleName, $dependenciesRef) -> $error=3228 * =createWeb($newWeb, $baseWeb, $opts)=3229 * =expandTemplate($def ) -> $string=3230 * =expandVariablesOnTopicCreation($text) -> $text=3231 * =getContext() -> \%hash=3232 * =getListOfWebs($filter) -> @webs=3233 * =getScriptUrl($web, $topic, $script, @params) -> $url=3234 * =getRevisionAtTime($web, $topic, $time) -> $rev=3235 * =getWorkArea($pluginName) -> $directorypath=3236 * =isValidWikiWor
