HumHub Documentation (unofficial)

HTML extends Document
in package

HTML document.

Tags
category

Zend

subpackage

Document

Table of Contents

Properties

$boost  : float
Field boost factor It's not stored directly in the index, but affects on normalization factor
$_fields  : array<string|int, mixed>
Associative array \ZendSearch\Lucene\Document\Field objects where the keys to the array are the names of the fields.
$_doc  : DOMDocument
Stored DOM representation
$_excludeNoFollowLinks  : bool
Exclude nofollow links flag
$_headerLinks  : array<string|int, mixed>
List of document header links
$_inlineTags  : array<string|int, mixed>
List of inline tags
$_links  : array<string|int, mixed>
List of document links

Methods

__get()  : string
Proxy method for getFieldValue(), provides more convenient access to the string value of a field.
__isset()  : bool
Magic method for checking the existence of a field
addField()  : Document
Add a field object to this document.
getExcludeNoFollowLinks()  : bool
Get exclude nofollow links flag
getField()  : Field
Returns {@link \ZendSearch\Lucene\Document\Field} object for a named field in this document.
getFieldNames()  : array<string|int, mixed>
Return an array with the names of the fields in this document.
getFieldUtf8Value()  : string
Returns the string value of a named field in UTF-8 encoding.
getFieldValue()  : string
Returns the string value of a named field in this document.
getHeaderLinks()  : array<string|int, mixed>
Get document header links
getHTML()  : string
Get HTML
getHTMLBody()  : string
Get HTML body
getLinks()  : array<string|int, mixed>
Get document HREF links
highlight()  : string
Highlight text with specified color
highlightExtended()  : string
Highlight text using specified View helper or callback function.
loadHTML()  : HTML
Load HTML document from a string
loadHTMLFile()  : HTML
Load HTML document from a file
setExcludeNoFollowLinks()  : void
Set exclude nofollow links flag
_highlightNodeRecursive()  : void
highlight words in content of the specified node
_highlightTextNode()  : void
Highlight text in text node
__construct()  : mixed
Object constructor
_retrieveNodeText()  : void
Get node text

Properties

$boost

Field boost factor It's not stored directly in the index, but affects on normalization factor

public float $boost = 1.0

$_fields

Associative array \ZendSearch\Lucene\Document\Field objects where the keys to the array are the names of the fields.

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

$_doc

Stored DOM representation

private DOMDocument $_doc

Exclude nofollow links flag

private static bool $_excludeNoFollowLinks = false

If true then links with rel='nofollow' attribute are not included into document links.

List of document header links

private array<string|int, mixed> $_headerLinks = array()

$_inlineTags

List of inline tags

private array<string|int, mixed> $_inlineTags = array('a', 'abbr', 'acronym', 'dfn', 'em', 'strong', 'code', 'samp', 'kbd', 'var', 'b', 'i', 'big', 'small', 'strike', 'tt', 'u', 'font', 'span', 'bdo', 'cite', 'del', 'ins', 'q', 'sub', 'sup')

List of document links

private array<string|int, mixed> $_links = array()

Methods

__get()

Proxy method for getFieldValue(), provides more convenient access to the string value of a field.

public __get(mixed $offset) : string
Parameters
$offset : mixed
Return values
string

__isset()

Magic method for checking the existence of a field

public __isset(string $offset) : bool
Parameters
$offset : string
Return values
bool

TRUE if the field exists else FALSE

Get exclude nofollow links flag

public static getExcludeNoFollowLinks() : bool
Return values
bool

getField()

Returns {@link \ZendSearch\Lucene\Document\Field} object for a named field in this document.

public getField(string $fieldName) : Field
Parameters
$fieldName : string
Tags
throws
InvalidArgumentException
Return values
Field

getFieldNames()

Return an array with the names of the fields in this document.

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

getFieldUtf8Value()

Returns the string value of a named field in UTF-8 encoding.

public getFieldUtf8Value(string $fieldName) : string
Parameters
$fieldName : string
Tags
see
__get()
Return values
string

getFieldValue()

Returns the string value of a named field in this document.

public getFieldValue(string $fieldName) : string
Parameters
$fieldName : string
Tags
see
__get()
Return values
string

Get document header links

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

getHTML()

Get HTML

public getHTML() : string
Return values
string

getHTMLBody()

Get HTML body

public getHTMLBody() : string
Return values
string

Get document HREF links

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

highlight()

Highlight text with specified color

public highlight(string|array<string|int, mixed> $words[, string $colour = '#66ffff' ]) : string
Parameters
$words : string|array<string|int, mixed>
$colour : string = '#66ffff'
Return values
string

highlightExtended()

Highlight text using specified View helper or callback function.

public highlightExtended(string|array<string|int, mixed> $words, callable $callback[, array<string|int, mixed> $params = array() ]) : string
Parameters
$words : string|array<string|int, mixed>

Words to highlight. Words could be organized using the array or string.

$callback : callable

Callback method, used to transform (highlighting) text.

$params : array<string|int, mixed> = array()

Array of additionall callback parameters passed through into it (first non-optional parameter is an HTML fragment for highlighting)

Tags
throws
InvalidArgumentException
Return values
string

loadHTML()

Load HTML document from a string

public static loadHTML(string $data[, bool $storeContent = false ][, string $defaultEncoding = '' ]) : HTML
Parameters
$data : string
$storeContent : bool = false
$defaultEncoding : string = ''

HTML encoding, is used if it's not specified using Content-type HTTP-EQUIV meta tag.

Return values
HTML

loadHTMLFile()

Load HTML document from a file

public static loadHTMLFile(string $file[, bool $storeContent = false ][, string $defaultEncoding = '' ]) : HTML
Parameters
$file : string
$storeContent : bool = false
$defaultEncoding : string = ''

HTML encoding, is used if it's not specified using Content-type HTTP-EQUIV meta tag.

Return values
HTML

Set exclude nofollow links flag

public static setExcludeNoFollowLinks(bool $newValue) : void
Parameters
$newValue : bool

_highlightNodeRecursive()

highlight words in content of the specified node

protected _highlightNodeRecursive(DOMNode $contextNode, array<string|int, mixed> $wordsToHighlight, callable $callback, array<string|int, mixed> $params) : void
Parameters
$contextNode : DOMNode
$wordsToHighlight : array<string|int, mixed>
$callback : callable

Callback method, used to transform (highlighting) text.

$params : array<string|int, mixed>

Array of additionall callback parameters (first non-optional parameter is a text to transform)

_highlightTextNode()

Highlight text in text node

protected _highlightTextNode(DOMText $node, array<string|int, mixed> $wordsToHighlight, callable $callback, array<string|int, mixed> $params) : void
Parameters
$node : DOMText
$wordsToHighlight : array<string|int, mixed>
$callback : callable

Callback method, used to transform (highlighting) text.

$params : array<string|int, mixed>

Array of additionall callback parameters (first non-optional parameter is a text to transform)

Tags
throws
RuntimeException

__construct()

Object constructor

private __construct(string $data, bool $isFile, bool $storeContent[, string $defaultEncoding = '' ]) : mixed
Parameters
$data : string

HTML string (may be HTML fragment, )

$isFile : bool
$storeContent : bool
$defaultEncoding : string = ''

HTML encoding, is used if it's not specified using Content-type HTTP-EQUIV meta tag.

_retrieveNodeText()

Get node text

private _retrieveNodeText(DOMNode $node, string &$text) : void

We should exclude scripts, which may be not included into comment tags, CDATA sections,

Parameters
$node : DOMNode
$text : string

        
On this page

Search results