class vB_SignatureParser extends vB_BbCodeParser

Stack based BB code parser.

Properties

array $tag_list A list of tags to be parsed. from vB_BbCodeParser
array $stack The stack that will be populated during final parsing. Used to check context. from vB_BbCodeParser
string $parse_output Holder for the output of the BB code parser while it is being built. from vB_BbCodeParser
$current_tag Used alongside the stack. Holds a reference to the node on the stack that is currently being processed. Only applicable in callback functions. from vB_BbCodeParser
bool $printable Whether this parser is parsing for printable output from vB_BbCodeParser
vB_Registry $registry Reference to the main registry object from vB_BbCodeParser
array $options Holds various options such what type of things to parse and cachability. from vB_BbCodeParser
array $cached Holds the cached post if caching was enabled from vB_BbCodeParser
array $attachments Reference to attachment information pertaining to this post from vB_BbCodeParser
bool $unsetattach Whether this parser unsets attachment info in $this->attachments when an inline attachment is found from vB_BbCodeParser
integer $forumid Id of the forum the source string is in for permissions from vB_BbCodeParser
mixed $containerid Id of the outer container, if applicable from vB_BbCodeParser
bool $custom_fetched True if custom tags have been fetched from vB_BbCodeParser
array $smilie_cache Local cache of smilies for this parser. This is per object to allow WYSIWYG and non-WYSIWYG versions on the same page. from vB_BbCodeParser
array $parse_userinfo 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. from vB_BbCodeParser
int $node_max The number that is the maximum node when parsing for tags. count(nodes) from vB_BbCodeParser
int $node_num When parsing, the number of the current node. Starts at 1. Note that this is not necessary the key of the node in the array, but reflects the number of nodes handled. from vB_BbCodeParser
protected $quote_printable_template Template for generating quote links. We need to override for cms comments" * from vB_BbCodeParser
protected $quote_template Template for generating quote links. We need to override for cms comments" * from vB_BbCodeParser
protected $quote_vars from vB_BbCodeParser
protected $displayimage Display full size image attachment if an image is [attach] using without =config, otherwise display a thumbnail from vB_BbCodeParser
protected $userImagePermissions from vB_BbCodeParser
integer $userid User this signature belongs to
array $tag_groups Groupings for tags
array $errors Errors found in the signature
protected $imgcount
protected $skipdupcheck

Methods

__construct(vB_Registry $registry, array $tag_list, integer $userid, bool $append_custom_tags = true)

Constructor. Sets up the tag permissions list.

append_custom_tags()

Loads any user specified custom BB code tags into the $tag_list

set_parse_userinfo(array $userinfo, array $permissions = null)

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).

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 to determine how to parse a signature and determine if errors have occurred.

string
do_parse(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)

Parse the string with the selected options

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

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

string
do_word_wrap(string $text)

Word wraps the text if enabled.

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

Parses smilie codes into their appropriate HTML image versions

replace_smilies($matches)

Callback function for replacing smilies.

array
cache_smilies(bool $do_html)

Caches the smilies in a form ready to be executed.

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

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

string
parse_bbcode(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
build_parse_array(string $text)

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

array
fix_tags(array $preparsed)

Traverses parse array and fixes nesting and mismatched tags.

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

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

bool
is_valid_tag(string $tag_name, bool/null $has_option = null)

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

bool
is_valid_option(string $tag_name, string $tag_option)

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

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

Find the first instance of a tag in an array

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

Find the last instance of a tag in an array.

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

Handles an [indent] tag.

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_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_post(string $text, string $postId)

Handles a [post] tag. Creates a link to another post.

string
handle_bbcode_thread(string $text, string $threadId)

Handles a [thread] tag. Creates a link to another thread.

string
handle_bbcode_php(string $code)

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

emulate_pre_tag($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_h(string $text, string $option)

Handled [h] tags - converts to

string
handle_bbcode_html(string $code)

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

handleBBCodeTagPregMatch1($matches)

Callback for preg_replace_callback used in handle_bbcode_html

handleBBCodeTagPregMatch2($matches)

Callback for preg_replace_callback used in handle_bbcode_html

string
handle_bbcode_html_tag(string $tag)

Handles an individual HTML tag in a [html] 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

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 = '')

Handles an [img] tag.

handleBbcodeImgMatchCallback($matches)

Callback for preg_replace_callback in handle_bbcode_img

handleBbcodeUrlCallback($matches)

Callback for preg_replace_callback in handle_bbcode_img

handleBBCodeSigPicCallback($matches)

Callback for preg_replace_callback in handle_bbcode_img

string
handle_bbcode_img_match($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 $parse_userinfo member.

string
handle_bbcode_size(string $text, string $size)

Handles a [size] tag

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

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

strip_front_back_whitespace(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
strip_smilies(string $text)

Removes translated smilies from a string.

bool
contains_bbcode_img_tags(string $text)

Determines whether a string contains an [img] tag.

int
fetch_block_height(string $code)

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

array
fetch_bbcode_html_colors()

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

bool
is_wysiwyg()

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

array
make_snippet(array $tokens, integer $initial_length = 0)

Chops a set of (fixed) BB code tokens to a specified length or slightly over.

set_quote_template(string $template_name)

Sets the template to be used for generating quotes

set_quote_printable_template(string $template_name)

Sets the template to be used for generating quotes

set_quote_vars(string $var_array)

Sets variables to be passed to the quote template

array
getPreview(string $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
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.

bool
checkImagePermissions(int $currentUserid, int $parentid)

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

array
getPerms()

Returns signature bbcode permissions.

check_bbcode_general($text)

BB code callback allowed check

check_bbcode_size($text, $size)

BB code callback allowed check with size checking

check_bbcode_img($image_path)

BB code callback allowed check for images. Images fall back to links if the image code is disabled, so allow if either is true.

check_bbcode_sigpic($alt_text)

BB code sigpic, returns the <img link.

setSkipdupcheck($skip)

No description

Details

at line 58
__construct(vB_Registry $registry, array $tag_list, integer $userid, bool $append_custom_tags = true)

Constructor. Sets up the tag permissions list.

Parameters

vB_Registry $registry Reference to registry object
array $tag_list List of tags to parse
integer $userid The user this signature belongs to. Required
bool $append_custom_tags Whether to append customer user tags to the tag list

in vB_BbCodeParser at line 203
append_custom_tags()

Loads any user specified custom BB code tags into the $tag_list

in vB_BbCodeParser at line 276
set_parse_userinfo(array $userinfo, array $permissions = null)

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

array $userinfo Array of user info to parse as
array $permissions Array of user's permissions (may come through $userinfo already)

at line 169
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 to determine how to parse a signature and determine if errors have occurred.

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

in vB_BbCodeParser at line 427
string do_parse(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)

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

Return Value

string Parsed text

in vB_BbCodeParser at line 520
array get_preview($pagetext, $initial_length = 0, $do_html = false, $do_nl2br = true, $htmlstate = null)

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

Parameters

$pagetext
$initial_length
$do_html
$do_nl2br
$htmlstate

Return Value

array Tokens, chopped to the right length.

in vB_BbCodeParser at line 706
string do_word_wrap(string $text)

Word wraps the text if enabled.

Parameters

string $text Text to wrap

Return Value

string Wrapped text

in vB_BbCodeParser at line 723
string parse_smilies(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

in vB_BbCodeParser at line 777
replace_smilies($matches)

Callback function for replacing smilies.

Parameters

$matches

in vB_BbCodeParser at line 789
array cache_smilies(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)

in vB_BbCodeParser at line 878
string parse_whitespace_newlines(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

in vB_BbCodeParser at line 931
string parse_bbcode(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)

in vB_BbCodeParser at line 944
array build_parse_array(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

in vB_BbCodeParser at line 1130
array fix_tags(array $preparsed)

Traverses parse array and fixes nesting and mismatched tags.

Parameters

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

Return Value

array Parse array with specific data fixed

in vB_BbCodeParser at line 1273
string parse_array(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

in vB_BbCodeParser at line 1498
bool is_valid_tag(string $tag_name, bool/null $has_option = null)

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

Parameters

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

Return Value

bool Whether the tag is valid

in vB_BbCodeParser at line 1530
bool is_valid_option(string $tag_name, string $tag_option)

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

Parameters

string $tag_name Name of the tag
string $tag_option Value of the option

Return Value

bool Whether the option is valid

in vB_BbCodeParser at line 1547
int/false find_first_tag(string $tag_name, array $stack)

Find the first 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

in vB_BbCodeParser at line 1567
int/false find_last_tag(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

in vB_BbCodeParser at line 1587
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.

in vB_BbCodeParser at line 1618
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

in vB_BbCodeParser at line 1636
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.

in vB_BbCodeParser at line 1677
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.

in vB_BbCodeParser at line 1724
string handle_bbcode_post(string $text, string $postId)

Handles a [post] tag. Creates a link to another post.

Parameters

string $text If tag has option, the displayable name. Else, the postid.
string $postId If tag has option, the postid.

Return Value

string HTML representation of the tag.

in vB_BbCodeParser at line 1754
string handle_bbcode_thread(string $text, string $threadId)

Handles a [thread] tag. Creates a link to another thread.

Parameters

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

Return Value

string HTML representation of the tag.

in vB_BbCodeParser at line 1783
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.

in vB_BbCodeParser at line 1876
emulate_pre_tag($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

in vB_BbCodeParser at line 1894
string handle_bbcode_video($url, $option)

Handles a [video] tag. Displays a movie.

Parameters

$url
$option

Return Value

string HTML representation of the tag.

in vB_BbCodeParser at line 1923
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.

in vB_BbCodeParser at line 1957
string handle_bbcode_h(string $text, string $option)

Handled [h] tags - converts to

Parameters

string $text Body of the [H]
string $option H Size (1 - 6)

Return Value

string Parsed text

in vB_BbCodeParser at line 1979
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.

in vB_BbCodeParser at line 2033
protected handleBBCodeTagPregMatch1($matches)

Callback for preg_replace_callback used in handle_bbcode_html

Parameters

$matches

in vB_BbCodeParser at line 2041
protected handleBBCodeTagPregMatch2($matches)

Callback for preg_replace_callback used in handle_bbcode_html

Parameters

$matches

in vB_BbCodeParser at line 2053
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.

in vB_BbCodeParser at line 2150
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.

in vB_BbCodeParser at line 2211
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

in vB_BbCodeParser at line 2226
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.

in vB_BbCodeParser at line 2461
protected handle_bbcode_attach($text, $option)

Parameters

$text
$option

in vB_BbCodeParser at line 2509
protected handle_bbcode_img2($text, $option)

Parameters

$text
$option

in vB_BbCodeParser at line 2553
protected processImg2BBCode($data)

Parameters

$data

in vB_BbCodeParser at line 2670
protected processAttachBBCode($data)

Parameters

$data

in vB_BbCodeParser at line 2928
protected addCaption($insertHtml, $settings)

Parameters

$insertHtml
$settings

in vB_BbCodeParser at line 2966
protected convertImgBitsArrayToHtml($imgbits)

Parameters

$imgbits

in vB_BbCodeParser at line 2982
protected addAnchorAndConvertToHtml($imgbits, $settings, $link, $size, $attachment)

Parameters

$imgbits
$settings
$link
$size
$attachment

in vB_BbCodeParser at line 3081
protected getNearestImageSize($settings)

Parameters

$settings

in vB_BbCodeParser at line 3150
protected processCustomImgConfig($config_array)

Parameters

$config_array

in vB_BbCodeParser at line 3260
string handle_bbcode_img($bbcode, $do_imgcode, $has_img_code = false, $fulltext = '')

Handles an [img] tag.

Parameters

$bbcode
$do_imgcode
$has_img_code
$fulltext

Return Value

string HTML representation of the tag.

in vB_BbCodeParser at line 3543
protected handleBbcodeImgMatchCallback($matches)

Callback for preg_replace_callback in handle_bbcode_img

Parameters

$matches

in vB_BbCodeParser at line 3551
protected handleBbcodeUrlCallback($matches)

Callback for preg_replace_callback in handle_bbcode_img

Parameters

$matches

in vB_BbCodeParser at line 3559
protected handleBBCodeSigPicCallback($matches)

Callback for preg_replace_callback in handle_bbcode_img

Parameters

$matches

in vB_BbCodeParser at line 3571
string handle_bbcode_img_match($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.

in vB_BbCodeParser at line 3588
string handle_bbcode_sigpic(string $description)

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

Parameters

string $description Description for the sig pic

Return Value

string HTML representation of the sig pic

in vB_BbCodeParser at line 3630
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.

in vB_BbCodeParser at line 3687
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.

in vB_BbCodeParser at line 3703
strip_front_back_whitespace(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

in vB_BbCodeParser at line 3731
string strip_smilies(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

in vB_BbCodeParser at line 3746
bool contains_bbcode_img_tags(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

in vB_BbCodeParser at line 3792
int fetch_block_height(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

in vB_BbCodeParser at line 3817
array fetch_bbcode_html_colors()

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

Return Value

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

in vB_BbCodeParser at line 3838
bool is_wysiwyg()

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

in vB_BbCodeParser at line 3852
array make_snippet(array $tokens, integer $initial_length = 0)

Chops a set of (fixed) BB code tokens to a specified length or slightly over.

It will search for the first whitespace after the snippet length.

Parameters

array $tokens Fixed tokens
integer $initial_length Length of the text before parsing (optional)

Return Value

array Tokens, chopped to the right length.

in vB_BbCodeParser at line 3947
set_quote_template(string $template_name)

Sets the template to be used for generating quotes

Parameters

string $template_name the template name *

in vB_BbCodeParser at line 3956
set_quote_printable_template(string $template_name)

Sets the template to be used for generating quotes

Parameters

string $template_name the template name *

in vB_BbCodeParser at line 3965
set_quote_vars(string $var_array)

Sets variables to be passed to the quote template

Parameters

string $var_array the template name *

in vB_BbCodeParser at line 3984
array getPreview(string $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

string $pagetext text to parse
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.

in vB_BbCodeParser at line 4205
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

in vB_BbCodeParser at line 4220
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 193
array getPerms()

Returns signature bbcode permissions.

Return Value

array Signature bbcode permissions

<

pre> array() // array of bbcode tags that the user is allowed to use in a signature can => array() // array of bbcode tags that the user is NOT allowed to use in a signature cant => array() )

<

pre>

at line 219
check_bbcode_general($text)

BB code callback allowed check

Parameters

$text

at line 235
check_bbcode_size($text, $size)

BB code callback allowed check with size checking

Parameters

$text
$size

at line 339
check_bbcode_img($image_path)

BB code callback allowed check for images. Images fall back to links if the image code is disabled, so allow if either is true.

Parameters

$image_path

at line 372
protected check_bbcode_sigpic($alt_text)

BB code sigpic, returns the <img link.

Parameters

$alt_text

at line 402
setSkipdupcheck($skip)

Parameters

$skip