PHP Class phpbb\textformatter\s9e\utils

Inheritance: implements phpbb\textformatter\utils_interface
Show file Open project: phpbb/phpbb Class Usage Examples

Public Methods

Method Description
clean_formatting ( string $xml ) : string Replace BBCodes and other formatting elements with whitespace
generate_quote ( $text, array $attributes = [] )
get_outermost_quote_authors ( string $xml ) : string[] Get a list of quote authors, limited to the outermost quotes
remove_bbcode ( string $xml, string $bbcode_name, integer $depth ) : string Remove given BBCode and its content, at given nesting depth
unparse ( string $xml ) : string Return a parsed text to its original form

Protected Methods

Method Description
enquote ( string $str ) : string Return given string between quotes

Method Details

clean_formatting() public method

NOTE: preserves smilies as text
public clean_formatting ( string $xml ) : string
$xml string Parsed text
return string Plain text

enquote() protected method

Will use either single- or double- quotes depending on whichever requires less escaping. Quotes and backslashes are escaped with backslashes where necessary
protected enquote ( string $str ) : string
$str string Original string
return string Escaped string within quotes

generate_quote() public method

public generate_quote ( $text, array $attributes = [] )
$attributes array

get_outermost_quote_authors() public method

Get a list of quote authors, limited to the outermost quotes
public get_outermost_quote_authors ( string $xml ) : string[]
$xml string Parsed text
return string[] List of authors

remove_bbcode() public method

Remove given BBCode and its content, at given nesting depth
public remove_bbcode ( string $xml, string $bbcode_name, integer $depth ) : string
$xml string Parsed text
$bbcode_name string BBCode's name
$depth integer Minimum nesting depth (number of parents of the same name)
return string Parsed text

unparse() public method

Return a parsed text to its original form
public unparse ( string $xml ) : string
$xml string Parsed text
return string Original plain text