PHP Class Ip\Internal\Text\Html2Text

Show file Open project: impresspages/impresspages Class Usage Examples

Public Methods

Method Description
convert ( $html, $partial = null ) : string Tries to convert the given HTML into a plain text format - best suited for e-mail display, etc.

Protected Methods

Method Description
fix_newlines ( $text ) : string Unify newlines; in particular, \r\n becomes \n, and then \r becomes \n. This means that all newlines (Unix, Windows, Mac) all become \ns.
iterate_over_node ( $node )
next_child_name ( $node )
prev_child_name ( $node )

Method Details

convert() public static method

In particular, it tries to maintain the following features:

  • Links are maintained, with the 'href' copied over
  • Information in the <head> is lost
public static convert ( $html, $partial = null ) : string
return string the HTML converted, as best as possible, to text

fix_newlines() protected static method

Unify newlines; in particular, \r\n becomes \n, and then \r becomes \n. This means that all newlines (Unix, Windows, Mac) all become \ns.
protected static fix_newlines ( $text ) : string
return string the fixed text

iterate_over_node() protected static method

protected static iterate_over_node ( $node )

next_child_name() protected static method

protected static next_child_name ( $node )

prev_child_name() protected static method

protected static prev_child_name ( $node )