Converts HTML to formatted plain text
__construct(string $source = '', boolean $from_file = false, boolean $do_links = true, integer $width = 75, $charset = 'UTF-8')
If the HTML source string (or file) is supplied, the class will instantiate with that source propagated, all that has to be done it to call get_text().
string
HTML content
boolean
Indicates $source is a file to pull content from
boolean
Indicate whether a table of link URLs is desired
integer
Maximum width of the formatted text, 0 for no limit
set_html(string $source, boolean $from_file = false)
string
HTML content
boolean
Indicates $source is a file to pull content from
get_text() : string
string
Plain text
print_text()
set_base_url($url = '')
_convert()
_converter(&$text)
First performs custom tag replacement specified by $search and $replace arrays. Then strips any remaining HTML tags, reduces whitespace and newlines to a readable format, and word wraps the text to $width characters.
_build_link_list(string $link, string $display)
Maintains an internal list of links to be displayed at the end of the text, with numeric indices to the original point in the text they appeared. Also makes an effort at identifying and handling absolute and relative links.
string
URL of the link
string
Part of the text to associate number with
_convert_pre(&$text)
_convert_blockquotes(&$text)
blockquote_citation_callback($m)
pre_preg_callback($matches) : string
string
_toupper(string $str) : string
string
Text to convert
string
Converted text
_strtoupper(string $str) : string
string
Text to convert
string
Converted text
html : string
var | |
---|---|
string
text : string
var | |
---|---|
string
width : integer
Set this value to 0 (or less) to ignore word wrapping and not constrain text to a fixed-width column.
var | |
---|---|
integer
charset : string
var | |
---|---|
string
search : array
var | |
---|---|
see | |
array
replace : array
var | |
---|---|
see | |
array
ent_search : array
var | |
---|---|
see | |
array
ent_replace : array
var | |
---|---|
see | |
array
callback_search : array
var | |
---|---|
array
pre_search : array
var | |
---|---|
see | |
array
pre_replace : array
var | |
---|---|
see | |
array
url : string
var | |
---|---|
string
_converted : boolean
var | |
---|---|
see |
$text |
boolean
_link_list : array
var | |
---|---|
see | |
array
_do_links : boolean
var | |
---|---|
see | |
boolean