phpBB API Documentation
Interface

phpbb\textformatter\utils_interface

interface utils_interface

Used to manipulate a parsed text

Methods

string clean_formatting(string $text)

Replace BBCodes and other formatting elements with whitespace

string generate_quote(string $text, array $attributes = array())

Create a quote block for given text

string[] get_outermost_quote_authors(string $text)

Get a list of quote authors, limited to the outermost quotes

string remove_bbcode(string $text, string $bbcode_name, integer $depth)

Remove given BBCode and its content, at given nesting depth

string unparse(string $text)

Return a parsed text to its original form

bool is_empty(string $text)

Return whether or not a parsed text represent an empty text.

Details

at line 29
public string clean_formatting(string $text)

Replace BBCodes and other formatting elements with whitespace

NOTE: preserves smilies as text

Parameters

string $text Parsed text

Return Value

string Plain text

at line 44
public string generate_quote(string $text, array $attributes = array())

Create a quote block for given text

Possible attributes: - author: author's name (usually a username) - postid: postid of the post being quoted - userid: userid of the user being quoted - time: timestamp of the original message

Parameters

string $text Quote's text
array $attributes Quote's attributes

Return Value

string Quote block to be used in a new post/text

at line 52
public string[] get_outermost_quote_authors(string $text)

Get a list of quote authors, limited to the outermost quotes

Parameters

string $text Parsed text

Return Value

string[] List of authors

at line 62
public string remove_bbcode(string $text, string $bbcode_name, integer $depth)

Remove given BBCode and its content, at given nesting depth

Parameters

string $text Parsed text
string $bbcode_name BBCode's name
integer $depth Minimum nesting depth (number of parents of the same name)

Return Value

string Parsed text

at line 70
public string unparse(string $text)

Return a parsed text to its original form

Parameters

string $text Parsed text

Return Value

string Original plain text

at line 78
public bool is_empty(string $text)

Return whether or not a parsed text represent an empty text.

Parameters

string $text Parsed text

Return Value

bool Tue if the original text is empty