class vB_Library_BbCode

Stack based BB code parser.

DO NOT USE THIS CLASS UNLESS YOU GET PRIOR APPROVAL

Traits

Constants

BBCODE_HAS_IMG

BBCODE_HAS_ATTACH

BBCODE_HAS_SIGPIC

BBCODE_HAS_RELPATH

PARSER_START

BB code parser's start state. Looking for the next tag to start.

PARSER_TEXT

BB code parser's "this range is just text" state.

Requires $internal_data to be set appropriately.

PARSER_TAG_OPENED

Tag has been opened. Now parsing for option and closing ].

Properties

static protected string $baseurl Forum config baseurl, passed in from presentation
static protected $baseurl_core
static protected $frontendurl
static protected vB_Library_BbCode $initialized
static protected array $defaultTags A list of default tags to be parsed.
static protected array $defaultOptions A list of default options for most types.
static protected array $customTags A list of custom tags to be parsed.
static protected array $smilies List of smilies
static protected array $censorship Censorship info
static protected $sessionUrl
static protected $blankAsciiStrip
static protected $wordWrap
static protected $bbUrl
static protected $viewAttachedImages
static protected $urlNoFollow
static protected $urlNoFollowWhiteList
static protected $vBHttpHost
static protected $useFileAvatar
static protected $sigpicUrl
protected array $tag_list A list of tags to be parsed.
protected $currentTag Used alongside the stack. Holds a reference to the node on the stack that is currently being processed. Only applicable in callback functions.
protected bool $printable Whether this parser is parsing for printable output
protected array $options Holds various options such what type of things to parse and cachability.
protected array $cached Holds the cached post if caching was enabled
protected array $attachments Reference to attachment information pertaining to this post Uses filedataid as key
protected array $filedataidsToAttachmentids Mapping of filedataid to array of attachment nodeids (aka attachmentids) that uses that filedata.
protected $delayedUnsetAttachments
protected $skipAttachmentList
protected $oldAttachments
protected bool $unsetattach Whether this parser unsets attachment info in $this->attachments when an inline attachment is found
protected integer $forumid Id of the forum the source string is in for permissions
protected mixed $containerid Id of the outer container, if applicable
protected array $smilieCache Local cache of smilies for this parser. This is per object to allow WYSIWYG and non-WYSIWYG versions on the same page.
protected array $parseUserinfo If we need to parse using specific user information (such as in a sig), set that info in this member. This should include userid, custom image revision info, and the user's permissions, at the least.
bool $stripSpaceAfter Global override for space stripping
protected $quotePrintableTemplate Template for generating quote links. We need to override for cms comments" *
protected $quoteTemplate Template for generating quote links. We need to override for cms comments" *
protected $quoteVars
protected vB_Library_BbCode_Table $tableHelper Object to provide the implementation of the table helper to use.
protected $displayimage Display full size image attachment if an image is [attach] using without =config, otherwise display a thumbnail
protected $sessionSuffix
protected $multiPageRender Tells the parser to handle a multi-page render, in which case, the [PAGE] and [PRBREAK] bbcodes are handled differently and are discarded. Used for CMS Articles.

Methods

__sleep()

No description

__wakeup()

No description

__construct($appendCustomTags = true, $appendSessionHashToImage = false)

Constructor. Sets up the tag list.

fetchBBCodes()

Gets the current bbCode List

setAttachments($attachments, $skipattachlist = false)

Adds attachments to the class property using filedataid as key.

getAttachments()

No description

setParseUserinfo(int $userId)

Sets the user the BB code as parsed as. As of 3.7, this function should only be called for parsing signatures (for sigpics and permissions).

setPrintable($bool)

Sets whether this parser is parsing for printable output

string
parse(string $text, int|str $forumid = 0, bool $allowsmilie = true, bool $isimgcheck = false, string $parsedtext = '', int $parsedhasimages = 3, bool $cachable = false, string $htmlstate = null)

Collect parser options and misc data and fully parse the string into an HTML version

string
doParse(string $text, bool $do_html = false, bool $do_smilies = true, bool $do_bbcode = true, bool $do_imgcode = true, bool $do_nl2br = true, bool $cachable = false, string $htmlstate = null, boolean $minimal = false, string $fulltext = '')

Parse the string with the selected options

string
fetchCensoredText(string $text)

Replaces any instances of words censored in self::$censorship['words'] with self::$censorship['char']

array
get_preview(array $pagetext, integer $initial_length = 0, boolean $do_html = false, boolean $do_nl2br = true, string $htmlstate = null, array $options = array())

This is copied from the blog bbcode parser. We either have a specific amount of text, or [PRBREAK][/PRBREAK].

string
doWordWrap(string $text)

Word wraps the text if enabled.

string
parseSmilies(string $text, bool $do_html = false)

Parses smilie codes into their appropriate HTML image versions

replaceSmilies($matches)

Callback function for replacing smilies.

array
cacheSmilies(bool $do_html)

Caches the smilies in a form ready to be executed.

string
parseWhitespaceNewlines(string $text, bool $do_nl2br = true)

Parses out specific white space before or after cetain tags and does nl2br

string
parseBbcode(string $input_text, bool $do_smilies, bool $do_imgcode, bool $do_html = false)

Parse an input string with BB code to a final output string of HTML

array
buildParseArray(string $text)

Takes a raw string and builds an array of tokens for parsing.

array
fixTags(array $preparsed)

Traverses parse array and fixes nesting and mismatched tags.

setStripSpace(bool $value)

Override each tag's default strip_space_after setting .

string
parseArray(array $preparsed, bool $do_smilies, bool $do_imgcode, bool $do_html = false)

Takes a parse array and parses it into the final HTML.

bool
isValidTag(string $tagName, bool/null $hasOption = null)

Checks if the specified tag exists in the list of parsable tags

bool
isValidOption(string $tagName, string $tagOption)

Checks if the specified tag option is valid (matches the regex if there is one)

int/false
findFirstTag(string $tagName, array $stack)

Find the first instance of a tag in an array

int/false
findLastTag(string $tag_name, array $stack)

Find the last instance of a tag in an array.

string
handle_external(string $value, string $option = null)

Allows extension of the class functionality at run time by calling an external function. To use this, your tag must have a callback of 'handle_external' and define an additional 'external_callback' entry.

string
handle_bbcode_indent(string $text, string $type = '')

Handles an [indent] tag.

string
handle_bbcode_email(string $text, string $link = '')

Handles an [email] tag. Creates a link to email an address.

string
handle_bbcode_quote(string $message, string $username = '')

Handles a [quote] tag. Displays a string in an area indicating it was quoted from someone/somewhere else.

string
handle_bbcode_user(string $username = '', string $userid = '')

Handles a [USER] tag. Creates a link to the user profile

string
handle_bbcode_php(string $code)

Handles a [php] tag. Syntax highlights a string of PHP.

emulatePreTag($text)

Emulates the behavior of a pre tag in HTML. Tabs and multiple spaces are replaced with spaces mixed with non-breaking spaces. Usually combined with code tags. Note: this still allows the browser to wrap lines.

string
handle_bbcode_video($url, $option)

Handles a [video] tag. Displays a movie.

string
handle_bbcode_code(string $code)

Handles a [code] tag. Displays a preformatted string.

string
handle_bbcode_html(string $code)

Handles an [html] tag. Syntax highlights a string of HTML.

bbcodeHtmlTagPregreplace1($matches)

Callback for preg_replace_callback used in handle_bbcode_html

bbcodeHtmlTagPregreplace2($matches)

Callback for preg_replace_callback used in handle_bbcode_html

string
parseDiscard(string $text)

Used for any tag we ignore. At the time of this, writing that means PRBREAK and PAGE. Both are cms-only and handled outside the parser.

setMultiPageRender($multiPage)

Sets the parser to handle a multi-page render, in which case, the [PAGE] and [PRBREAK] bbcodes are handled differently and are discarded.

string
parsePageBbcode(string $text)

Handles the [PAGE] bbcode

string
parsePrbreakBbcode(string $text)

Handles the [PRBREAK] bbcode

string
handle_bbcode_html_tag(string $tag)

Handles an individual HTML tag in a [html] tag.

handle_bbcode_h($text, $option)

No description

string
handle_bbcode_size(string $text, string $size)

Handles a [size] tag

string
handle_bbcode_list(string $text, string $type = '')

Handles a [list] tag. Makes a bulleted or ordered list.

string
handle_bbcode_list_element(string $text)

Handles a single bullet of a list

string
handle_bbcode_url(string $text, string $link, bool $image = false)

Handles a [url] tag. Creates a link to another web page.

handle_bbcode_attach($text, $option)

No description

handle_bbcode_img2($text, $option)

No description

processImg2BBCode($data)

No description

bool
checkImagePermissions(int $currentUserid, int $parentid)

Returns true of provided $currentUserid has either cangetimageattachment or canseethumbnails permission for the provided $parentid of the attachment.

processAttachBBCode($data)

No description

addCaption($insertHtml, $settings)

No description

convertImgBitsArrayToHtml($imgbits)

No description

addAnchorAndConvertToHtml($imgbits, $settings, $link, $size, $attachment)

No description

getNearestImageSize($settings)

No description

processCustomImgConfig($config_array)

No description

string
handle_bbcode_img($bbcode, $do_imgcode, $has_img_code = false, $fulltext = '', $forceShowImages = false)

Handles an [img] tag.

string
handle_bbcode_node(string $text, string $nodeId)

Handles a [node] tag. Creates a link to a node.

handleBbcodeImgMatchCallback($matches)

Callback for preg_replace_callback in handle_bbcode_img

handleBbcodeUrlCallback($matches)

Callback for preg_replace_callback in handle_bbcode_img

handleBBCodeSicpicPregReplace($matches)

Callback for preg_replace_callback in handle_bbcode_img

attachReplaceCallback($matches)

No description

string
handleBbcodeImgMatch($link, $fullsize = false)

Handles a match of the [img] tag that will be displayed as an actual image.

string
handle_bbcode_sigpic(string $description)

Handles the parsing of a signature picture. Most of this is handled based on the $parseUserinfo member.

append_noninline_attachments($text, $attachments, $do_imgcode = false, $skiptheseattachments = array())

Appends the non-inline attachment UI to the passed $text

stripFrontBackWhitespace(string $text, int $max_amount = 1, bool $strip_front = true, bool $strip_back = true)

Removes the specified amount of line breaks from the front and/or back of the input string. Includes HTML line braeks.

string
stripSmilies(string $text)

Removes translated smilies from a string.

bool
containsBbcodeImgTags(string $text)

Determines whether a string contains an [img] tag.

int
fetchBlockHeight(string $code)

Returns the height of a block of text in pixels (assuming 16px per line).

array
fetchBbcodeHtmlColors()

Fetches the colors used to highlight HTML in an [html] tag.

bool
isWysiwyg()

Returns whether this parser is a WYSIWYG parser. Useful to change behavior slightly for a WYSIWYG parser without rewriting code.

setQuoteTemplate(string $templateName)

Sets the template to be used for generating quotes

setQuotePrintableTemplate(string $template_name)

Sets the template to be used for generating quotes

setQuoteVars(string $var_array)

Sets variables to be passed to the quote template

vBForum_BBCodeHelper_Table
getTableHelper()

Fetches the table helper in use. It also acts as a lazy initializer.

string
parseTableTag(string $content, string $params = '')

Parses the [table] tag and returns the necessary HTML representation.

getUserValue($value)

No description

getPhrase()

No description

getAttachmentLink($attachment, $type = vB_Api_Filedata::SIZE_FULL)

No description

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

at line 264
__construct($appendCustomTags = true, $appendSessionHashToImage = false)

Constructor. Sets up the tag list.

Parameters

$appendCustomTags
$appendSessionHashToImage

at line 320
fetchBBCodes()

Gets the current bbCode List

at line 336
setAttachments($attachments, $skipattachlist = false)

Adds attachments to the class property using filedataid as key.

If the key is already set, it overwrites the value

Parameters

$attachments
$skipattachlist

at line 361
getAttachments()

at line 372
setParseUserinfo(int $userId)

Sets the user the BB code as parsed as. As of 3.7, this function should only be called for parsing signatures (for sigpics and permissions).

Parameters

int $userId

at line 382
setPrintable($bool)

Sets whether this parser is parsing for printable output

Parameters

$bool

at line 401
string parse(string $text, int|str $forumid = 0, bool $allowsmilie = true, bool $isimgcheck = false, string $parsedtext = '', int $parsedhasimages = 3, bool $cachable = false, string $htmlstate = null)

Collect parser options and misc data and fully parse the string into an HTML version

Parameters

string $text Unparsed text
int|str $forumid ID number of the forum whose parsing options should be used or a "special" string
bool $allowsmilie Whether to allow smilies in this post (if the option is allowed)
bool $isimgcheck Whether to parse the text as an image count check
string $parsedtext Preparsed text ([img] tags should not be parsed)
int $parsedhasimages Whether the preparsed text has images
bool $cachable Whether the parsed post is cachable
string $htmlstate Switch for dealing with nl2br

Return Value

string Parsed text

at line 514
string doParse(string $text, bool $do_html = false, bool $do_smilies = true, bool $do_bbcode = true, bool $do_imgcode = true, bool $do_nl2br = true, bool $cachable = false, string $htmlstate = null, boolean $minimal = false, string $fulltext = '')

Parse the string with the selected options

Parameters

string $text Unparsed text
bool $do_html Whether to allow HTML (true) or not (false)
bool $do_smilies Whether to parse smilies or not
bool $do_bbcode Whether to parse BB code
bool $do_imgcode Whether to parse the [img] BB code (independent of $do_bbcode)
bool $do_nl2br Whether to automatically replace new lines with HTML line breaks
bool $cachable Whether the post text is cachable
string $htmlstate Switch for dealing with nl2br
boolean $minimal do minimal required actions to parse bbcode
string $fulltext Full rawtext, ignoring pagebreaks.

Return Value

string Parsed text

at line 619
string fetchCensoredText(string $text)

Replaces any instances of words censored in self::$censorship['words'] with self::$censorship['char']

Parameters

string $text Text to be censored

Return Value

string

at line 674
array get_preview(array $pagetext, integer $initial_length = 0, boolean $do_html = false, boolean $do_nl2br = true, string $htmlstate = null, array $options = array())

This is copied from the blog bbcode parser. We either have a specific amount of text, or [PRBREAK][/PRBREAK].

Parameters

array $pagetext Fixed tokens
integer $initial_length Length of the text before parsing (optional)
boolean $do_html Flag to indicate whether do html or not
boolean $do_nl2br Flag to indicate whether to convert new lines to
or not
string $htmlstate Defines how to handle html while parsing.
array $options Extra options for parsing. 'do_smilies' => boolean used to handle the smilies display

Return Value

array Tokens, chopped to the right length.

at line 860
protected string doWordWrap(string $text)

Word wraps the text if enabled.

Parameters

string $text Text to wrap

Return Value

string Wrapped text

at line 877
protected string parseSmilies(string $text, bool $do_html = false)

Parses smilie codes into their appropriate HTML image versions

Parameters

string $text Text with smilie codes
bool $do_html Whether HTML is allowed

Return Value

string Text with HTML images in place of smilies

at line 920
protected replaceSmilies($matches)

Callback function for replacing smilies.

Parameters

$matches

at line 932
protected array cacheSmilies(bool $do_html)

Caches the smilies in a form ready to be executed.

Parameters

bool $do_html Whether HTML parsing is enabled

Return Value

array Reference to smilie cache (key: find text; value: replace text)

at line 979
protected string parseWhitespaceNewlines(string $text, bool $do_nl2br = true)

Parses out specific white space before or after cetain tags and does nl2br

Parameters

string $text Text to process
bool $do_nl2br Whether to translate newlines to
tags

Return Value

string Processed text

at line 1032
protected string parseBbcode(string $input_text, bool $do_smilies, bool $do_imgcode, bool $do_html = false)

Parse an input string with BB code to a final output string of HTML

Parameters

string $input_text Input Text (BB code)
bool $do_smilies Whether to parse smilies
bool $do_imgcode Whether to parse img (for the video bbcodes)
bool $do_html Whether to allow HTML (for smilies)

Return Value

string Ouput Text (HTML)

at line 1045
protected array buildParseArray(string $text)

Takes a raw string and builds an array of tokens for parsing.

Parameters

string $text Raw text input

Return Value

array List of tokens

at line 1231
protected array fixTags(array $preparsed)

Traverses parse array and fixes nesting and mismatched tags.

Parameters

array $preparsed Parsed data array, such as one from buildParseArray

Return Value

array Parse array with specific data fixed

at line 1361
setStripSpace(bool $value)

Override each tag's default strip_space_after setting .

. We don't want to strip spaces when parsing bbcode for the editor

Parameters

bool $value

at line 1377
protected string parseArray(array $preparsed, bool $do_smilies, bool $do_imgcode, bool $do_html = false)

Takes a parse array and parses it into the final HTML.

Tags are assumed to be matched.

Parameters

array $preparsed Parse array
bool $do_smilies Whether to parse smilies
bool $do_imgcode Whether to parse img (for the video tags)
bool $do_html Whether to allow HTML (for smilies)

Return Value

string Final HTML

at line 1595
protected bool isValidTag(string $tagName, bool/null $hasOption = null)

Checks if the specified tag exists in the list of parsable tags

Parameters

string $tagName Name of the tag
bool/null $hasOption true = tag with option, false = tag without option, null = either

Return Value

bool Whether the tag is valid

at line 1627
protected bool isValidOption(string $tagName, string $tagOption)

Checks if the specified tag option is valid (matches the regex if there is one)

Parameters

string $tagName Name of the tag
string $tagOption Value of the option

Return Value

bool Whether the option is valid

at line 1644
protected int/false findFirstTag(string $tagName, array $stack)

Find the first instance of a tag in an array

Parameters

string $tagName Name of tag
array $stack Array to search

Return Value

int/false Array key of first instance; false if it does not exist

at line 1664
protected int/false findLastTag(string $tag_name, array $stack)

Find the last instance of a tag in an array.

Parameters

string $tag_name Name of tag
array $stack Array to search

Return Value

int/false Array key of first instance; false if it does not exist

at line 1693
string handle_external(string $value, string $option = null)

Allows extension of the class functionality at run time by calling an external function. To use this, your tag must have a callback of 'handle_external' and define an additional 'external_callback' entry.

Your function will receive 3 parameters: A reference to this BB code parser The value for the tag The option for the tag Ensure that you accept at least the first parameter by reference!

Parameters

string $value Value for the tag
string $option Option for the tag (if it has one)

Return Value

string HTML representation of the tag

at line 1711
protected string handle_bbcode_indent(string $text, string $type = '')

Handles an [indent] tag.

Parameters

string $text The text to indent
string $type Indentation level

Return Value

string HTML representation of the tag.

at line 1735
protected string handle_bbcode_email(string $text, string $link = '')

Handles an [email] tag. Creates a link to email an address.

Parameters

string $text If tag has option, the displayable email name. Else, the email address.
string $link If tag has option, the email address.

Return Value

string HTML representation of the tag.

at line 1776
string handle_bbcode_quote(string $message, string $username = '')

Handles a [quote] tag. Displays a string in an area indicating it was quoted from someone/somewhere else.

Parameters

string $message The body of the quote.
string $username If tag has option, the original user to post.

Return Value

string HTML representation of the tag.

at line 1814
string handle_bbcode_user(string $username = '', string $userid = '')

Handles a [USER] tag. Creates a link to the user profile

Parameters

string $username The username
string $userid The userid

Return Value

string HTML representation of the tag.

at line 1860
string handle_bbcode_php(string $code)

Handles a [php] tag. Syntax highlights a string of PHP.

Parameters

string $code The code to highlight.

Return Value

string HTML representation of the tag.

at line 1953
protected emulatePreTag($text)

Emulates the behavior of a pre tag in HTML. Tabs and multiple spaces are replaced with spaces mixed with non-breaking spaces. Usually combined with code tags. Note: this still allows the browser to wrap lines.

Parameters

$text

at line 1971
protected string handle_bbcode_video($url, $option)

Handles a [video] tag. Displays a movie.

Parameters

$url
$option

Return Value

string HTML representation of the tag.

at line 1998
string handle_bbcode_code(string $code)

Handles a [code] tag. Displays a preformatted string.

Parameters

string $code The code to display

Return Value

string HTML representation of the tag.

at line 2031
string handle_bbcode_html(string $code)

Handles an [html] tag. Syntax highlights a string of HTML.

Parameters

string $code The HTML to highlight.

Return Value

string HTML representation of the tag.

at line 2087
protected bbcodeHtmlTagPregreplace1($matches)

Callback for preg_replace_callback used in handle_bbcode_html

Parameters

$matches

at line 2095
protected bbcodeHtmlTagPregreplace2($matches)

Callback for preg_replace_callback used in handle_bbcode_html

Parameters

$matches

at line 2107
protected string parseDiscard(string $text)

Used for any tag we ignore. At the time of this, writing that means PRBREAK and PAGE. Both are cms-only and handled outside the parser.

Parameters

string $text Page title

Return Value

string Output of the page header in multi page views, nothing in single page views

at line 2117
setMultiPageRender($multiPage)

Sets the parser to handle a multi-page render, in which case, the [PAGE] and [PRBREAK] bbcodes are handled differently and are discarded.

Parameters

$multiPage

at line 2129
protected string parsePageBbcode(string $text)

Handles the [PAGE] bbcode

Parameters

string $text The text

Return Value

string

at line 2148
protected string parsePrbreakBbcode(string $text)

Handles the [PRBREAK] bbcode

Parameters

string $text The text

Return Value

string

at line 2167
string handle_bbcode_html_tag(string $tag)

Handles an individual HTML tag in a [html] tag.

Parameters

string $tag The body of the tag.

Return Value

string Syntax highlighted, displayable HTML tag.

at line 2264
handle_bbcode_h($text, $option)

Parameters

$text
$option

at line 2286
string handle_bbcode_size(string $text, string $size)

Handles a [size] tag

Parameters

string $text The text to size.
string $size The size to size to

Return Value

string HTML representation of the tag.

at line 2340
string handle_bbcode_list(string $text, string $type = '')

Handles a [list] tag. Makes a bulleted or ordered list.

Parameters

string $text The body of the list.
string $type If tag has option, the type of list (ordered, etc).

Return Value

string HTML representation of the tag.

at line 2401
string handle_bbcode_list_element(string $text)

Handles a single bullet of a list

Parameters

string $text Text of bullet

Return Value

string HTML for bullet

at line 2415
string handle_bbcode_url(string $text, string $link, bool $image = false)

Handles a [url] tag. Creates a link to another web page.

Parameters

string $text If tag has option, the displayable name. Else, the URL.
string $link If tag has option, the URL.
bool $image If this is for an image, just return the link

Return Value

string HTML representation of the tag.

at line 2486
protected handle_bbcode_attach($text, $option)

Parameters

$text
$option

at line 2534
protected handle_bbcode_img2($text, $option)

Parameters

$text
$option

at line 2578
protected processImg2BBCode($data)

Parameters

$data

at line 2706
protected bool checkImagePermissions(int $currentUserid, int $parentid)

Returns true of provided $currentUserid has either cangetimageattachment or canseethumbnails permission for the provided $parentid of the attachment.

Also stores the already checked permissions in the userImagePermissions class variable.

Parameters

int $currentUserid
int $parentid Parent of attachment, usually the "content" post (starter/reply)

Return Value

bool

at line 2737
protected processAttachBBCode($data)

Parameters

$data

at line 3010
protected addCaption($insertHtml, $settings)

Parameters

$insertHtml
$settings

at line 3048
protected convertImgBitsArrayToHtml($imgbits)

Parameters

$imgbits

at line 3069
protected addAnchorAndConvertToHtml($imgbits, $settings, $link, $size, $attachment)

Parameters

$imgbits
$settings
$link
$size
$attachment

at line 3174
protected getNearestImageSize($settings)

Parameters

$settings

at line 3243
protected processCustomImgConfig($config_array)

Parameters

$config_array

at line 3347
string handle_bbcode_img($bbcode, $do_imgcode, $has_img_code = false, $fulltext = '', $forceShowImages = false)

Handles an [img] tag.

Parameters

$bbcode
$do_imgcode
$has_img_code
$fulltext
$forceShowImages

Return Value

string HTML representation of the tag.

at line 3547
protected string handle_bbcode_node(string $text, string $nodeId)

Handles a [node] tag. Creates a link to a node.

Parameters

string $text If tag has option, the displayable name. Else, the threadid.
string $nodeId If tag has option, the threadid.

Return Value

string HTML representation of the tag.

at line 3574
protected handleBbcodeImgMatchCallback($matches)

Callback for preg_replace_callback in handle_bbcode_img

Parameters

$matches

at line 3582
protected handleBbcodeUrlCallback($matches)

Callback for preg_replace_callback in handle_bbcode_img

Parameters

$matches

at line 3590
protected handleBBCodeSicpicPregReplace($matches)

Callback for preg_replace_callback in handle_bbcode_img

Parameters

$matches

at line 3595
protected attachReplaceCallback($matches)

Parameters

$matches

at line 3938
string handleBbcodeImgMatch($link, $fullsize = false)

Handles a match of the [img] tag that will be displayed as an actual image.

Parameters

$link
$fullsize

Return Value

string HTML representation of the tag.

at line 3956
string handle_bbcode_sigpic(string $description)

Handles the parsing of a signature picture. Most of this is handled based on the $parseUserinfo member.

Parameters

string $description Description for the sig pic

Return Value

string HTML representation of the sig pic

at line 4015
append_noninline_attachments($text, $attachments, $do_imgcode = false, $skiptheseattachments = array())

Appends the non-inline attachment UI to the passed $text

Parameters

$text
$attachments
$do_imgcode
$skiptheseattachments

at line 4046
stripFrontBackWhitespace(string $text, int $max_amount = 1, bool $strip_front = true, bool $strip_back = true)

Removes the specified amount of line breaks from the front and/or back of the input string. Includes HTML line braeks.

Parameters

string $text Text to remove white space from
int $max_amount Amount of breaks to remove
bool $strip_front Whether to strip from the front of the string
bool $strip_back Whether to strip from the back of the string

at line 4074
protected string stripSmilies(string $text)

Removes translated smilies from a string.

Parameters

string $text Text to search

Return Value

string Text with smilie HTML returned to smilie codes

at line 4089
protected bool containsBbcodeImgTags(string $text)

Determines whether a string contains an [img] tag.

Parameters

string $text Text to search

Return Value

bool Whether the text contains an [img] tag

at line 4131
protected int fetchBlockHeight(string $code)

Returns the height of a block of text in pixels (assuming 16px per line).

Limited by your "codemaxlines" setting (if > 0).

Parameters

string $code Block of text to find the height of

Return Value

int Number of lines

at line 4156
protected array fetchBbcodeHtmlColors()

Fetches the colors used to highlight HTML in an [html] tag.

Return Value

array array of type (key) to color (value)

at line 4177
protected bool isWysiwyg()

Returns whether this parser is a WYSIWYG parser. Useful to change behavior slightly for a WYSIWYG parser without rewriting code.

Return Value

bool True if it is; false otherwise

at line 4288
setQuoteTemplate(string $templateName)

Sets the template to be used for generating quotes

Parameters

string $templateName the template name *

at line 4297
setQuotePrintableTemplate(string $template_name)

Sets the template to be used for generating quotes

Parameters

string $template_name the template name *

at line 4306
setQuoteVars(string $var_array)

Sets variables to be passed to the quote template

Parameters

string $var_array the template name *

at line 4318
vBForum_BBCodeHelper_Table getTableHelper()

Fetches the table helper in use. It also acts as a lazy initializer.

If no table helper has been explicitly set, it will instantiate the class's default.

Return Value

vBForum_BBCodeHelper_Table Table helper object

at line 4339
protected string parseTableTag(string $content, string $params = '')

Parses the [table] tag and returns the necessary HTML representation.

TRs and TDs are parsed by this function (they are not real BB codes). Classes are pushed down to inner tags (TRs and TDs) and TRs are automatically valigned top.

Parameters

string $content Content within the table tag
string $params Optional set of parameters in an unparsed format. Parses "param: value, param: value" form.

Return Value

string HTML representation of the table and its contents.

at line 4345
protected getUserValue($value)

Parameters

$value

at line 4358
protected getPhrase()

Parameters

$attachment
$type