phpBB API Documentation
Class

phpbb\textformatter\s9e\utils

class utils implements utils_interface

Text manipulation utilities

Methods

string clean_formatting(string $xml)

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 $xml)

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

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

Remove given BBCode and its content, at given nesting depth

string unparse(string $xml)

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 $xml)

Replace BBCodes and other formatting elements with whitespace

NOTE: preserves smilies as text

Parameters

string $xml Parsed text

Return Value

string Plain text

at line 63
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 97
public string[] get_outermost_quote_authors(string $xml)

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

Parameters

string $xml Parsed text

Return Value

string[] List of authors

at line 124
public string remove_bbcode(string $xml, string $bbcode_name, integer $depth)

Remove given BBCode and its content, at given nesting depth

Parameters

string $xml 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 135
public string unparse(string $xml)

Return a parsed text to its original form

Parameters

string $xml Parsed text

Return Value

string Original plain text

at line 143
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