Changeset 1221 for trunk/core/lib/Foswiki/Func.pm
- Timestamp:
- 12/09/08 18:16:48 (3 years ago)
- File:
-
- 1 edited
-
trunk/core/lib/Foswiki/Func.pm (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/lib/Foswiki/Func.pm
r1050 r1221 1278 1278 =begin TML 1279 1279 1280 ---+++ saveTopic( $web, $topic, $meta, $text, $options ) -> $error1280 ---+++ saveTopic( $web, $topic, $meta, $text, $options ) 1281 1281 1282 1282 * =$web= - web for the topic … … 1289 1289 | =forcenewrevision= | force the save to increment the revision counter | 1290 1290 | =minor= | True if this is a minor change, and is not to be notified | 1291 Return: error message or undef.1292 1291 1293 1292 For example, … … 1300 1299 __Note:__ Plugins handlers ( e.g. =beforeSaveHandler= ) will be called as 1301 1300 appropriate. 1301 1302 In the event of an error an exception will be thrown. Callers can elect 1303 to trap the exceptions thrown, or allow them to propagate to the calling 1304 environment. May throw Foswiki::OopsException, Foswiki::AccessControlException or Error::Simple. 1302 1305 1303 1306 =cut … … 2320 2323 =begin TML 2321 2324 2322 ---+++ getRegularExpression( $name ) -> $expr2323 2324 Retrieves a Foswiki predefined regular expression or character class.2325 * =$name= - Name of the expression to retrieve. See notes below2326 Return: String or precompiled regular expression matching as described below.2327 2328 __Note:__ Foswiki internally precompiles several regular expressions to2329 represent various string entities in an <nop>I18N-compatible manner. Plugins2330 authors are encouraged to use these in matching where appropriate. The2331 following are guaranteed to be present. Others may exist, but their use2332 is unsupported and they may be removed in future Foswiki versions.2333 2334 In the table below, the expression marked type 'String' are intended for2335 use within character classes (i.e. for use within square brackets inside2336 a regular expression), for example:2337 <verbatim>2338 my $upper = Foswiki::Func::getRegularExpression('upperAlpha');2339 my $alpha = Foswiki::Func::getRegularExpression('mixedAlpha');2340 my $capitalized = qr/[$upper][$alpha]+/;2341 </verbatim>2342 Those expressions marked type 'RE' are precompiled regular expressions that can be used outside square brackets. For example:2343 <verbatim>2344 my $webRE = Foswiki::Func::getRegularExpression('webNameRegex');2345 my $isWebName = ( $s =~ m/$webRE/ );2346 </verbatim>2347 2348 | *Name* | *Matches* | *Type* |2349 | upperAlpha | Upper case characters | String |2350 | upperAlphaNum | Upper case characters and digits | String |2351 | lowerAlpha | Lower case characters | String |2352 | lowerAlphaNum | Lower case characters and digits | String |2353 | numeric | Digits | String |2354 | mixedAlpha | Alphabetic characters | String |2355 | mixedAlphaNum | Alphanumeric characters | String |2356 | wikiWordRegex | WikiWords | RE |2357 | webNameRegex | User web names | RE |2358 | anchorRegex | #AnchorNames | RE |2359 | abbrevRegex | Abbreviations e.g. GOV, IRS | RE |2360 | emailAddrRegex | email@address.com | RE |2361 | tagNameRegex | Standard variable names e.g. %<nop>THIS_BIT% (THIS_BIT only) | RE |2362 2363 =cut2364 2365 sub getRegularExpression {2366 my ($regexName) = @_;2367 return $Foswiki::regex{$regexName};2368 }2369 2370 =begin TML2371 2372 2325 ---+++ normalizeWebTopicName($web, $topic) -> ($web, $topic) 2373 2326 … … 2509 2462 =begin TML 2510 2463 2464 ---+++ isValidWebName( $name, $system ) -> $boolean 2465 2466 Check for a valid web name. If $system is true, then 2467 system web names are considered valid (names starting with _) 2468 otherwise only user web names are valid 2469 2470 If $Foswiki::cfg{EnableHierarchicalWebs} is off, it will also return false 2471 when a nested web name is passed to it. 2472 2473 =cut 2474 2475 sub isValidWebName { 2476 return Foswiki::isValidWebName(@_); 2477 } 2478 2479 =begin TML 2480 2481 ---++ StaticMethod isValidTopicName( $name ) -> $boolean 2482 2483 Check for a valid topic name. 2484 2485 =cut 2486 2487 sub isValidTopicName { 2488 return Foswiki::isValidTopicName(@_); 2489 } 2490 2491 =begin TML 2492 2511 2493 ---+++ extractParameters($attr ) -> %params 2512 2494 … … 2581 2563 The following functions are retained for compatibility only. You should 2582 2564 stop using them as soon as possible. 2565 2566 =cut 2567 2568 =begin TML 2569 2570 ---+++ getRegularExpression( $name ) -> $expr 2571 2572 *Deprecated* 28 Nov 2008 - use =$Foswiki::regex{...}= instead, it is directly 2573 equivalent. 2574 2575 See System.DevelopingPlugins for more information 2576 2577 =cut 2578 2579 sub getRegularExpression { 2580 my ($regexName) = @_; 2581 return $Foswiki::regex{$regexName}; 2582 } 2583 2584 =begin TML 2583 2585 2584 2586 ---+++ getScriptUrlPath( ) -> $path
Note: See TracChangeset
for help on using the changeset viewer.
