phpBB API Documentation
Class

parse_message

class parse_message extends bbcode_firstpass

Main message parser for posting, pm, etc.

takes raw message and parses it for attachments, bbcode and smilies

Properties

$bbcode_uid
$bbcode_bitfield
$bbcode_cache
$bbcode_template
$bbcodes
$template_bitfield
$message
$warn_msg
$parsed_items
$attachment_data
$filename_data
$message_status
$allow_img_bbcode
$allow_flash_bbcode
$allow_quote_bbcode
$allow_url_bbcode
$mode

Methods

bbcode($bitfield = '')

Constructor Init bbcode cache entries if bitfield is specified

from bbcode
bbcode_second_pass($message, $bbcode_uid = '', $bbcode_bitfield = false)

Second pass bbcodes

from bbcode
bbcode_cache_init()

Init bbcode cache

from bbcode
bbcode_tpl($tpl_name, $bbcode_id = -1, $skip_bitfield_check = false)

Return bbcode template

from bbcode
bbcode_tpl_replace($tpl_name, $tpl)

Return bbcode template replacement

from bbcode
bbcode_list($type)

Second parse list bbcode

from bbcode
bbcode_second_pass_quote($username, $quote)

Second parse quote tag

from bbcode
bbcode_second_pass_code($type, $code)

Second parse code tag

from bbcode
mixed bbcode_second_pass_by_extension()

Function to perform custom bbcode second pass by extensions can be used to assign bbcode pattern replacement Example: '#[list=([^[]+):$uid]#e' => "\$this->bbcodesecondpassbyextension('\$1')"

from bbcode
parse_bbcode()

Parse BBCode

from bbcode_firstpass
prepare_bbcodes()

Prepare some bbcodes for better parsing

from bbcode_firstpass
bbcode_init($allow_custom_bbcode = true)

Init bbcode data for later parsing

from bbcode_firstpass
check_bbcode($bbcode, $in)

Making some pre-checks for bbcodes as well as increasing the number of parsed items

from bbcode_firstpass
bbcode_specialchars($text)

Transform some characters in valid bbcodes

from bbcode_firstpass
bbcode_size($stx, $in)

Parse size tag

from bbcode_firstpass
bbcode_color($stx, $in)

Parse color tag

from bbcode_firstpass
bbcode_underline($in)

Parse u tag

from bbcode_firstpass
bbcode_strong($in)

Parse b tag

from bbcode_firstpass
bbcode_italic($in)

Parse i tag

from bbcode_firstpass
bbcode_img($in)

Parse img tag

from bbcode_firstpass
bbcode_flash($width, $height, $in)

Parse flash tag

from bbcode_firstpass
bbcode_attachment($stx, $in)

Parse inline attachments [ia]

from bbcode_firstpass
bbcode_parse_code($stx, $code)

Parse code text from code tag

from bbcode_firstpass
bbcode_code($stx, $in)

Parse code tag Expects the argument to start right after the opening [code] tag and to end with [/code]

from bbcode_firstpass
bbcode_parse_list($in)

Parse list bbcode Expects the argument to start with a tag

from bbcode_firstpass
bbcode_quote($in)

Parse quote bbcode Expects the argument to start with a tag

from bbcode_firstpass
validate_email($var1, $var2)

Validate email

from bbcode_firstpass
validate_url(string $var1, string $var2)

Validate url

from bbcode_firstpass
true path_in_domain(string $url)

Check if url is pointing to this domain/script_path/php-file

from bbcode_firstpass
parse_message($message = '')

Init - give message here or manually

parse($allow_bbcode, $allow_magic_url, $allow_smilies, $allow_img_bbcode = true, $allow_flash_bbcode = true, $allow_quote_bbcode = true, $allow_url_bbcode = true, $update_this_message = true, $mode = 'post')

Parse Message

format_display($allow_bbcode, $allow_magic_url, $allow_smilies, $update_this_message = true)

Formatting text for display

decode_message($custom_bbcode_uid = '', $update_this_message = true)

Decode message to be placed back into form box

magic_url($server_url)

Replace magic urls of form http://xxx.xxx., www.xxx.

smilies($max_smilies)

Parse Smilies

parse_attachments($form_name, $mode, $forum_id, $submit, $preview, $refresh, $is_message = false)

Parse Attachments

get_submitted_attachment_data($check_user_id = false)

Get Attachment Data

parse_poll($poll)

Parse Poll

null remove_nested_quotes(integer $max_depth)

Remove nested quotes at given depth in current parsed message

null set_plupload(plupload $plupload)

Setter function for passing the plupload object

mixed validate_bbcode_by_extension()

Function to perform custom bbcode validation by extensions can be used in bbcodeinit() to assign regexp replacement Example: 'regexp' => array('#[b](.*?)[/b]#uise' => "\$this->validatebbcodebyextension('\$1')")

Details

in bbcode at line 40
public bbcode($bitfield = '')

Constructor Init bbcode cache entries if bitfield is specified

Parameters

$bitfield

in bbcode at line 52
public bbcode_second_pass($message, $bbcode_uid = '', $bbcode_bitfield = false)

Second pass bbcodes

Parameters

$message
$bbcode_uid
$bbcode_bitfield

in bbcode at line 141
public bbcode_cache_init()

Init bbcode cache

requires: $this->bbcodebitfield sets: $this->bbcodecache with bbcode templates needed for bbcode_bitfield

in bbcode at line 461
public bbcode_tpl($tpl_name, $bbcode_id = -1, $skip_bitfield_check = false)

Return bbcode template

Parameters

$tpl_name
$bbcode_id
$skip_bitfield_check

in bbcode at line 526
public bbcode_tpl_replace($tpl_name, $tpl)

Return bbcode template replacement

Parameters

$tpl_name
$tpl

in bbcode at line 555
public bbcode_list($type)

Second parse list bbcode

Parameters

$type

in bbcode at line 604
public bbcode_second_pass_quote($username, $quote)

Second parse quote tag

Parameters

$username
$quote

in bbcode at line 625
public bbcode_second_pass_code($type, $code)

Second parse code tag

Parameters

$type
$code

in bbcode at line 676
public mixed bbcode_second_pass_by_extension()

Function to perform custom bbcode second pass by extensions can be used to assign bbcode pattern replacement Example: '#[list=([^[]+):$uid]#e' => "\$this->bbcodesecondpassbyextension('\$1')"

Accepts variable number of parameters

Return Value

mixed Second pass result

in bbcode_firstpass at line 53
public parse_bbcode()

Parse BBCode

in bbcode_firstpass at line 106
public prepare_bbcodes()

Prepare some bbcodes for better parsing

in bbcode_firstpass at line 127
public bbcode_init($allow_custom_bbcode = true)

Init bbcode data for later parsing

Parameters

$allow_custom_bbcode

in bbcode_firstpass at line 267
public check_bbcode($bbcode, $in)

Making some pre-checks for bbcodes as well as increasing the number of parsed items

Parameters

$bbcode
$in

in bbcode_firstpass at line 287
public bbcode_specialchars($text)

Transform some characters in valid bbcodes

Parameters

$text

in bbcode_firstpass at line 298
public bbcode_size($stx, $in)

Parse size tag

Parameters

$stx
$in

in bbcode_firstpass at line 326
public bbcode_color($stx, $in)

Parse color tag

Parameters

$stx
$in

in bbcode_firstpass at line 339
public bbcode_underline($in)

Parse u tag

Parameters

$in

in bbcode_firstpass at line 352
public bbcode_strong($in)

Parse b tag

Parameters

$in

in bbcode_firstpass at line 365
public bbcode_italic($in)

Parse i tag

Parameters

$in

in bbcode_firstpass at line 378
public bbcode_img($in)

Parse img tag

Parameters

$in

in bbcode_firstpass at line 441
public bbcode_flash($width, $height, $in)

Parse flash tag

Parameters

$width
$height
$in

in bbcode_firstpass at line 495
public bbcode_attachment($stx, $in)

Parse inline attachments [ia]

Parameters

$stx
$in

in bbcode_firstpass at line 509
public bbcode_parse_code($stx, $code)

Parse code text from code tag

Parameters

$stx
$code

in bbcode_firstpass at line 578
public bbcode_code($stx, $in)

Parse code tag Expects the argument to start right after the opening [code] tag and to end with [/code]

Parameters

$stx
$in

in bbcode_firstpass at line 671
public bbcode_parse_list($in)

Parse list bbcode Expects the argument to start with a tag

Parameters

$in

in bbcode_firstpass at line 799
public bbcode_quote($in)

Parse quote bbcode Expects the argument to start with a tag

Parameters

$in

in bbcode_firstpass at line 968
public validate_email($var1, $var2)

Validate email

Parameters

$var1
$var2

in bbcode_firstpass at line 1008
public validate_url(string $var1, string $var2)

Validate url

Parameters

string $var1 optional url parameter for url bbcode: [url(=$var1)]$var2[/url]
string $var2 url bbcode content: [url(=$var1)]$var2[/url]

in bbcode_firstpass at line 1069
public true path_in_domain(string $url)

Check if url is pointing to this domain/script_path/php-file

Parameters

string $url the url to check

Return Value

true if the url is pointing to this domain/script_path/php-file, false if not

at line 1142
public parse_message($message = '')

Init - give message here or manually

Parameters

$message

at line 1152
public parse($allow_bbcode, $allow_magic_url, $allow_smilies, $allow_img_bbcode = true, $allow_flash_bbcode = true, $allow_quote_bbcode = true, $allow_url_bbcode = true, $update_this_message = true, $mode = 'post')

Parse Message

Parameters

$allow_bbcode
$allow_magic_url
$allow_smilies
$allow_img_bbcode
$allow_flash_bbcode
$allow_quote_bbcode
$allow_url_bbcode
$update_this_message
$mode

at line 1331
public format_display($allow_bbcode, $allow_magic_url, $allow_smilies, $update_this_message = true)

Formatting text for display

Parameters

$allow_bbcode
$allow_magic_url
$allow_smilies
$update_this_message

at line 1421
public decode_message($custom_bbcode_uid = '', $update_this_message = true)

Decode message to be placed back into form box

Parameters

$custom_bbcode_uid
$update_this_message

at line 1448
public magic_url($server_url)

Replace magic urls of form http://xxx.xxx., www.xxx.

and xxx@xxx.xxx. Cuts down displayed size of link if over 50 chars, turns absolute links into relative versions when the server/script path matches the link

Parameters

$server_url

at line 1457
public smilies($max_smilies)

Parse Smilies

Parameters

$max_smilies

at line 1530
public parse_attachments($form_name, $mode, $forum_id, $submit, $preview, $refresh, $is_message = false)

Parse Attachments

Parameters

$form_name
$mode
$forum_id
$submit
$preview
$refresh
$is_message

at line 1794
public get_submitted_attachment_data($check_user_id = false)

Get Attachment Data

Parameters

$check_user_id

at line 1882
public parse_poll($poll)

Parse Poll

Parameters

$poll

at line 1945
public null remove_nested_quotes(integer $max_depth)

Remove nested quotes at given depth in current parsed message

Parameters

integer $max_depth Depth limit

Return Value

null

at line 2003
public null set_plupload(plupload $plupload)

Setter function for passing the plupload object

Parameters

plupload $plupload The plupload object

Return Value

null

at line 2017
public mixed validate_bbcode_by_extension()

Function to perform custom bbcode validation by extensions can be used in bbcodeinit() to assign regexp replacement Example: 'regexp' => array('#[b](.*?)[/b]#uise' => "\$this->validatebbcodebyextension('\$1')")

Accepts variable number of parameters

Return Value

mixed Validation result