## IV. API Reference

[ Previous: H. Smiley Functions | Next: J. Miscellaneous Support Functions ]

### I. Replaced-Item Functions

void BBCode::SetRuleHTML ( string $`html` )
This function determines how the Standard BBCode Library generates a horizontal rule. By default, it outputs "`<hr />`," but you can use this function to change that output into any HTML you want. Many sites prefer to use images or <div> elements to produce horizontal rules for stylistic reasons, and this function lets you easily swap those in without changing any CSS.
Parameters:

- `html`: The HTML to generate when NBBC encounters a [rule] tag.

string BBCode::GetRuleHTML ( )
This function returns the current HTML rule output. See SetRuleHTML() for more details.
Return values: Returns a string containing HTML, the same HTML most-recently given to SetRuleHTML(), or "`<hr />`" if SetRuleHTML() has never been called.
string BBCode::GetDefaultRuleHTML ( )
This function returns the default HTML rule output provided by the Standard BBCode Library.
Return values: Always returns "`<hr />`".
void BBCode::SetLocalImgDir ( string $`fullpath` )
This function tells NBBC where local images are found, as a pathname relative to the root of the host's filesystem (an absolute pathname). You should usually use a full absolute pathname for this, like "`/home/larry/web/myimages`", and you should not include a trailing slash on the path, as one will be appended automatically. Using relative pathnames can work, but may produce problems on some web servers.
Parameters:

- `fullpath`: The filesystem path to your local image directory.

string BBCode::GetLocalImgDir ( )
This function returns the current local image directory. See SetLocalImgDir() for more details.
Return values: Returns the current local image directory. If no local image directory has been set, this returns simply "img".
string BBCode::GetDefaultLocalImgDir ( )
This function returns the default local image directory.
Return values: Always returns "img".
void BBCode::SetLocalImgURL ( string $`url` )
This function tells the browser where local images are found, as an absolute URL. You should usually use a full absolute URL for this, like "`http://larry.example.com/myimages`", and you should not include a trailing slash on the path, as one will be appended automatically. Using relative (short) URLs can work, but may produce problems with some web browsers if not used carefully.
Parameters:

- `url`: The full URL to your local image directory.

string BBCode::GetLocalImgURL ( )
This function returns the current local image URL. See SetLocalImgURL() for more details.
Return values: Returns the current local image URL. If no local image URL has been set, this returns simply "img".
string BBCode::GetDefaultLocalImgURL ( )
This function returns the default local image URL.
Return values: Always returns "img".
mixed BBCode::GetURLTargetable ( )
This function returns the current setting for the URL-targetable security flag. See SetURLTargetable() for more details.
Return values: The current state of the URL-targetable security flag.
void BBCode::SetURLTargetable ( mixed $`enabled` )
This function changes the URL-targetable security flag.
Parameters:

- `enabled`: If true, the `[url]` tag will allow URL targeting. If false, the `[url]` tag will not allow user-targeting. If set to `'override'`, any user-supplied target will override the default URL target.

The URL-targetable flag controls whether the `[url]` tag allows an additional `target=""` parameter that controls which window or frame the link will appear in. It mirrors the `target=""` parameter that `<a>` elements have, and supports all the same values. By default, this parameter is disabled for security reasons: In certain (rare) circumstances where a visitor has the ability to write BBCode on your site, it can be possible to use the `target=""` parameter to bypass enough security restrictions to perform CSRF or XSS attacks. However, if the only people who will be writing BBCode on your site are trusted people, then this parameter can be safely enabled.
mixed BBCode::GetURLTarget ( )
This function returns the current setting for the URL target. This will either be false or a target string. See SetURLTarget() for more details.
Return values: The current state of the URL target.
void BBCode::SetURLTarget ( mixed $`setting` )
This function changes the URL target.
Parameters:

- `setting`: If false, the `[url]` tag will either allow URL targeting (if URL targeting is enabled), or it will have no target. If setting is a string, that string will be used for the link target, and any user-supplied target will be ignored.

The URL target setting controls whether the `[url]` tag will produce links that have an additional `target=""` parameter that controls which window or frame the link will appear in. By default, this is disabled (false), allowing links to either open in the current window, or in a user-chosen window (if the URL-targetable flag is set). By setting this, however, you can force all links to open in the window of your choice, be it "_blank" or some specific custom window.

[ Previous: H. Smiley Functions | Next: J. Miscellaneous Support Functions ]

Copyright © 2010, the Phantom Inker. All rights reserved.