Changeset 812 for trunk/core/lib/Foswiki.pm
- Timestamp:
- 11/19/08 16:05:12 (4 years ago)
- File:
-
- 1 edited
-
trunk/core/lib/Foswiki.pm (modified) (43 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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 ) = @_;
Note: See TracChangeset
for help on using the changeset viewer.
