Documentation

Horde_Text_Filter_Html2text extends Horde_Text_Filter_Base
in package

Takes HTML and converts it to formatted, plain text.

Optional parameters to constructor:

callback     - (callback) Callback triggered on every node. Passed the
               DOMDocument object and the DOMNode object. If the callback
               returns non-null, add this text to the output and skip further
               processing of the node.
width        - (integer) The wrapping width. Set to 0 to not wrap.
nestingLimit - (integer) The limit on node nesting. If empty, no limit.
Tags
since
2.3.0
author

Jan Schneider jan@horde.org

author

Michael Slusarz slusarz@horde.org

category

Horde

license

http://www.horde.org/licenses/lgpl21 LGPL 2.1

Table of Contents

$_indent  : int
Current list indentation level.
$_linkList  : array<string|int, mixed>
The list of links contained in the message.
$_nestingLevel  : int
Current nesting level.
$_params  : array<string|int, mixed>
Filter parameters.
__construct()  : mixed
Constructor.
getPatterns()  : array<string|int, mixed>
Returns a hash with replace patterns.
postProcess()  : string
Executes any code necessary after applying the filter patterns.
preProcess()  : string
Executes any code necessary before applying the filter patterns.
_buildLinkList()  : mixed
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.
_node()  : string
Process DOM node.

Properties

$_indent

Current list indentation level.

protected int $_indent = 0

The list of links contained in the message.

protected array<string|int, mixed> $_linkList = array()

$_nestingLevel

Current nesting level.

protected int $_nestingLevel = 0

$_params

Filter parameters.

protected array<string|int, mixed> $_params = array('callback' => \null, 'charset' => 'UTF-8', 'width' => 75, 'nestingLimit' => \false)

Methods

__construct()

Constructor.

public __construct([array<string|int, mixed> $params = array() ]) : mixed
Parameters
$params : array<string|int, mixed> = array()

Any parameters that the filter instance needs.

Return values
mixed

getPatterns()

Returns a hash with replace patterns.

public getPatterns() : array<string|int, mixed>
Return values
array<string|int, mixed>

Patterns hash.

postProcess()

Executes any code necessary after applying the filter patterns.

public postProcess(string $text) : string
Parameters
$text : string

The text after the filtering.

Return values
string

The modified text.

preProcess()

Executes any code necessary before applying the filter patterns.

public preProcess(string $text) : string
Parameters
$text : string

The text before the filtering.

Return values
string

The modified text.

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.

protected _buildLinkList(DOMDocument $doc, DOMElement $node) : mixed
Parameters
$doc : DOMDocument

Document node.

$node : DOMElement

Element node.

Return values
mixed

_node()

Process DOM node.

protected _node(DOMDocument $doc, DOMElement $node) : string
Parameters
$doc : DOMDocument

Document node.

$node : DOMElement

Element node.

Return values
string

The plaintext representation.

Search results