Html2Text

package

Default

Methods

__construct

__construct(string $html = '',array $options = array())

Arguments

$html

string

Source HTML

$options

array

Set configuration options

convert

convert()

Helper function for BLOCKQUOTE body conversion.

convertBlockquotes( &$text)

Arguments

$text

converter

converter( &$text)

Arguments

$text

Helper function for PRE body conversion.

convertPre( &$text)

Arguments

$text

doConvert

doConvert()

get_text

get_text()
deprecated

Get the source HTML

getHtml(): string

Response

string

Returns the text, converted from HTML.

getText(): string

Response

string

Plain text

legacyConstruct

legacyConstruct( $html = '', $fromFile = false,array $options = array())

Arguments

$html

$fromFile

$options

array

p

p()
deprecated

Callback function for preg_replace_callback use.

pregCallback(array $matches): string

Arguments

$matches

array

PREG matches

Response

string

Callback function for preg_replace_callback use in PRE content handler.

pregPreCallback(array $matches): string

Arguments

$matches

array

PREG matches

Response

string

print_text

print_text()
deprecated

set_base_url

set_base_url( $baseurl)
deprecated

Arguments

$baseurl

set_html

set_html( $html, $from_file = false)
deprecated

Arguments

$html

$from_file

Sets a base URL to handle relative links.

setBaseUrl(string $baseurl)

Arguments

$baseurl

string

Set the source HTML

setHtml(string $html)

Arguments

$html

string

HTML source content

Strtoupper multibyte wrapper function with HTML entities handling.

strtoupper(string $str): string

Arguments

$str

string

Text to convert

Response

string

Converted text

Helper function for DEL conversion.

tostrike( $str): string

Arguments

$str

Response

string

Converted text

Strtoupper function with HTML tags and entities handling.

toupper(string $str): string

Arguments

$str

string

Text to convert

Response

string

Converted text

Constants

ENCODING

ENCODING

Properties

htmlFuncFlags

htmlFuncFlags :

Type(s)

Contains the HTML content to convert.

html :string
var

Type(s)

string

Contains the converted, formatted text.

text :string
var

Type(s)

string

List of pattern replacements corresponding to patterns searched.

replace :array
var
see

Type(s)

array

List of preg* regular expression patterns to search for, used in conjunction with $entReplace.

entSearch :array
var
see

Type(s)

array

List of pattern replacements corresponding to patterns searched.

entReplace :array
var
see

Type(s)

array

List of preg* regular expression patterns to search for and replace using callback function.

callbackSearch :array
var

Type(s)

array

List of preg* regular expression patterns to search for in PRE body, used in conjunction with $preReplace.

preSearch :array
var
see

Type(s)

array

List of pattern replacements corresponding to patterns searched for PRE body.

preReplace :array
var
see

Type(s)

array

Temporary workspace used during PRE processing.

preContent :string
var

Type(s)

string

Contains the base URL that relative links should resolve to.

baseurl :string
var

Type(s)

string

Indicates whether content in the $html variable has been converted yet.

converted :boolean
var
see

$text

Type(s)

boolean

Various configuration options (able to be set in the constructor)

options :array
var

Type(s)

array