IV. API Reference
[ Previous: F. Rule Functions | Next: H. Smiley Functions ]
G. Wiki-Link Functions
void BBCode::SetWikiURL ( string $url )
This function changes the current wiki URL to the provided
string. When a [wiki="foo"] tag is encountered in the input (or its equivalent
tag, [[foo]]), NBBC will use this URL to turn that tag into a
<a>
link: This URL will be taken first, and the
wiki-fied
page name ("foo") will be appended to it (with no characters added in between).
See the section on
wiki-links for more information on
how to use this function.
Parameters:
- url: A string to be inserted in the resulting <a href=...>
element before the wiki-fied page name. For example,
if this is "http://www.example.com/wiki.php?page=" and the page name given by
the user is "George Washington", the resulting complete URL would be
<a href=\"http://www.example.com/wiki.php?page=George_Washington>.
Return values: None.
string BBCode::GetWikiURL ( )
This function returns the current wiki URL, as set by
SetWikiURL(). If no wiki URL has been
set, the return value is the same as that of
GetDefaultWikiURL().
Parameters: None.
Return values: The current wiki URL.
string BBCode::GetDefaultWikiURL ( )
This function returns the default wiki URL, which is
always "/?page=" --- this URL, when a wiki page name like "foo" is
appended to the end of it, results in links that look like this:
<a href="/?page=foo">...</a>
Parameters: None.
Return values: The default wiki URL, which
is always "/?page=".
string BBCode::Wikify ( string $rawstring )
This function takes a raw string and cleans it up for use as
a wiki page name. To do this, it replaces all of the following characters with
underscores:
, ! ? ; @ # $ % \ ^ & * < > = + ` ~ ' _ - and all whitespace (0x00-0x20).
In addition, multiple successive underscores are condensed to a single underscore,
and all initial and trailing underscores are removed. Also, characters in the extended
range (0x7F-0xFF) are replaced with their URL-encoded equivalents.
Parameters:
- rawstring: The string to clean up and make "wiki-friendly."
Return values: The resulting "clean" string.
Notes:
For example, "Washington, D.C."
would become "Washington_D.C.", which is a string that can be safely used as
part of a URL; while "é" might become "%E9", and "église" might
become "%E9glise", depending on your current character encoding. The
output of this function is always URL-safe and 8-bit clean.
Note that because accented characters like é and ü and
non-Roman characters like א and 宮 are converted to
URL-encoded-equivalents, this function may not suitable for use with some non-Roman
languages.
The rationale behind URL-encoding the non-English characters is that some web servers
and some web browsers are not 8-bit clean and may misbehave if they are
sent a direct code value in this range.
[ Previous: F. Rule Functions | Next: H. Smiley Functions ]
Copyright © 2010, the Phantom Inker. All rights reserved.