Copied!
Cloneable Instantiable
Constants
public Html2Text\Html2Text ::ENCODING = 'UTF-8'
Methods
public __construct ( $html = '' , $options = [ ] )
 
  • param string $html Source HTML
  • param array $options Set configuration options
public get_text ()
 
  • deprecated
public getHtml ()
 

Get the source HTML

  • return string
public getText ()
 

Returns the text, converted from HTML.

  • return string Plain text
public p ()
 
  • deprecated
public print_text ()
 
  • deprecated
public set_base_url ( $baseurl )
 
  • deprecated
public set_html ( $html , $from_file = false )
 
  • deprecated
public setBaseUrl ( $baseurl )
 

Sets a base URL to handle relative links.

  • param string $baseurl
public setHtml ( $html )
 

Set the source HTML

  • param string $html HTML source content
Properties
protected $baseurl
 

Contains the base URL that relative links should resolve to.

  • var string $baseurl
protected $callbackSearch
 

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

  • var array $callbackSearch
protected $converted
 

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

  • var bool $converted
  • see
protected $entReplace
 

List of pattern replacements corresponding to patterns searched.

  • var array $entReplace
  • see
protected $entSearch
 

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

  • var array $entSearch
  • see
protected $html
 

Contains the HTML content to convert.

  • var string $html
protected $htmlFuncFlags
protected $linkList
 

Contains URL addresses from links to be rendered in plain text.

  • var array $linkList
  • see \buildlinkList()
protected $options
 

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

  • var array $options
protected $preContent
 

Temporary workspace used during PRE processing.

  • var string $preContent
protected $preReplace
 

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

  • var array $preReplace
  • see
protected $preSearch
 

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

  • var array $preSearch
  • see
protected $replace
 

List of pattern replacements corresponding to patterns searched.

  • var array $replace
  • see
protected $search
 

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

  • var array $search
  • see
protected $text
 

Contains the converted, formatted text.

  • var string $text
Methods
protected buildlinkList ( $link , $display , $linkOverride = NULL )
 

Helper function called by preg_replace() on link replacement.

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.

  • param string $link URL of the link
  • param string $display Part of the text to associate number with
  • param null $linkOverride
  • return string
protected convert ()
protected convertBlockquotes ( $text )
 

Helper function for BLOCKQUOTE body conversion.

  • param string $text HTML content
protected converter ( $text )
protected convertPre ( $text )
 

Helper function for PRE body conversion.

  • param string $text HTML content
protected doConvert ()
protected pregCallback ( $matches )
 

Callback function for preg_replace_callback use.

  • param array $matches PREG matches
  • return string
protected pregPreCallback ( $matches )
 

Callback function for preg_replace_callback use in PRE content handler.

  • param array $matches PREG matches
  • return string
protected strtoupper ( $str )
 

Strtoupper multibyte wrapper function with HTML entities handling.

  • param string $str Text to convert
  • return string Converted text
protected tostrike ( $str )
 

Helper function for DEL conversion.

  • param string $text HTML content
  • return string Converted text
protected toupper ( $str )
 

Strtoupper function with HTML tags and entities handling.

  • param string $str Text to convert
  • return string Converted text
Methods
private legacyConstruct ( $html = '' , $fromFile = false , array $options = [ ] )
© 2022 Bruce Wells
Search Namespaces \ Classes
Configuration