PHP Класс Falcon_Converter, Falcon

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$document DOMDocument This may be needed to export an element as HTML
$html string HTML fragment
$links array List of URLs in the document
$list_stack array -1 represents an unordered list, while all other integers represent the current index of the ordered list
$text string Textual representation of the HTML

Открытые методы

Метод Описание
__construct ( string $html ) Constructor
convert ( ) : string Convert HTML into a textual representation
silence_errors ( integer $num, string $str ) No-op error handler for libxml

Защищенные методы

Метод Описание
blockquote ( DOMElement $element ) : string Parse blockquote elements into a string
generate_links ( )
get_text ( DOMNode $node ) : string Convert a node to text
heading ( DOMElement $element ) : string Parse heading elements into a string
indent ( string $text ) : string Indent a section of text
parse_children ( DOMNode $list ) : string Parse a node's children
parse_element ( DOMElement $element ) : string Parse an element into text
preprocess ( string $html ) : string Preprocess HTML
table ( DOMElement $element ) : string Parse table elements into a string
table_row ( DOMElement $element ) : array Parse a table row element
table_section ( DOMElement $element ) : array Parse a table section element
wrap ( string $str ) : string Wrap a string to a certain number of characters

Описание методов

__construct() публичный Метод

Constructor
public __construct ( string $html )
$html string HTML fragment to convert

blockquote() защищенный Метод

Parse blockquote elements into a string
protected blockquote ( DOMElement $element ) : string
$element DOMElement Blockquote element
Результат string Text representation

convert() публичный Метод

Convert HTML into a textual representation
public convert ( ) : string
Результат string Text representation

get_text() защищенный Метод

Handles the various types of DOM nodes
protected get_text ( DOMNode $node ) : string
$node DOMNode Node to convert
Результат string Text representation

heading() защищенный Метод

Handles H1-H6, with special handling for H1 and H2
protected heading ( DOMElement $element ) : string
$element DOMElement Heading element
Результат string Text representation

indent() защищенный Метод

Indent a section of text
protected indent ( string $text ) : string
$text string Text to indent
Результат string Indented text

parse_children() защищенный Метод

Parse a node's children
protected parse_children ( DOMNode $list ) : string
$list DOMNode Node to parse
Результат string Text representation of the node's children

parse_element() защищенный Метод

This is a huge glorified switch statement, which is the easiest way to handle giant numbers of elements like this. Some elements have their handlers split off into separate methods.
protected parse_element ( DOMElement $element ) : string
$element DOMElement Element to parse
Результат string Text representation of the element

preprocess() защищенный Метод

Sanitizes the HTML for use with DOMDocument, including giving it a DOCTYPE, which forces standards mode
protected preprocess ( string $html ) : string
$html string HTML fragment
Результат string Processed HTML document

silence_errors() публичный статический Метод

No-op error handler for libxml
public static silence_errors ( integer $num, string $str )
$num integer Error type
$str string Error message

table() защищенный Метод

Parse table elements into a string
protected table ( DOMElement $element ) : string
$element DOMElement Table element
Результат string Text representation

table_row() защищенный Метод

Parse a table row element
protected table_row ( DOMElement $element ) : array
$element DOMElement TR element
Результат array Cells in the row

table_section() защищенный Метод

Parse a table section element
protected table_section ( DOMElement $element ) : array
$element DOMElement THEAD or TBODY element
Результат array Rows in the section

wrap() защищенный Метод

Has special handling for some text elements (blockquotes and tables)
protected wrap ( string $str ) : string
$str string Text to wrap
Результат string Word-wrapped text

Описание свойств

$document защищенное свойство

This may be needed to export an element as HTML
protected DOMDocument $document
Результат DOMDocument

$html защищенное свойство

HTML fragment
protected string $html
Результат string

$list_stack защищенное свойство

-1 represents an unordered list, while all other integers represent the current index of the ordered list
protected array $list_stack
Результат array

$text защищенное свойство

Textual representation of the HTML
protected string $text
Результат string