class TexyHtml extends TexyObject implements ArrayAccess, IteratorAggregate

HTML helper.

usage: $anchor = TexyHtml::el('a')->href($link)->setText('Texy'); $el->class = 'myclass';

echo $el->startTag(), $el->endTag();

Properties

array $attrs
protected array $children
static bool $xhtml
static array $emptyElements
static array $inlineElements
static array $optionalEnds
static $prohibits

Methods

static TexyHtml
el($name = NULL, $attrs = NULL)

Static factory.

setName($name, $empty = NULL)

Changes element's name.

string
getName()

Returns element's name.

bool
isEmpty()

Is element empty?

void
__set($name, $value)

Overloaded setter for element's attribute.

mixed
__get($name)

Overloaded getter for element's attribute.

href($path, $query = NULL)

Special setter for element's attribute.

setText($text)

Sets element's textual content.

string
getText()

Gets element's textual content.

add($child)

Adds new element's child.

create($name, $attrs = NULL)

Creates and adds a new TexyHtml child.

insert($index, $child, $replace = FALSE)

Inserts child node.

void
offsetSet($index, $child)

Inserts (replaces) child node (ArrayAccess implementation).

mixed
offsetGet($index)

Returns child node (ArrayAccess implementation).

bool
offsetExists($index)

Exists child node? (ArrayAccess implementation).

void
offsetUnset($index)

Removes child node (ArrayAccess implementation).

int
count()

Required by the Countable interface.

void
removeChildren()

Removed all children.

getIterator()

Required by the IteratorAggregate interface.

getChildren()

Returns all of children.

string
toString(Texy $texy)

Renders element's start tag, content and end tag to internal string representation.

string
toHtml(Texy $texy)

Renders to final HTML.

string
toText(Texy $texy)

Renders to final text.

string
startTag()

Returns element's start tag.

string
endTag()

Returns element's end tag.

__clone()

Clones all children too.

int
getContentType()

No description

void
validateAttrs($dtd)

No description

validateChild($child, $dtd)

No description

void
parseLine(Texy $texy, $s)

Parses text as single line.

void
parseBlock(Texy $texy, $s, $indented = FALSE)

Parses text as block.

Details

at line 81
static TexyHtml el($name = NULL, $attrs = NULL)

Static factory.

Parameters

$name
$attrs

Return Value

TexyHtml

at line 101
final TexyHtml setName($name, $empty = NULL)

Changes element's name.

Parameters

$name
$empty

Return Value

TexyHtml

Exceptions

InvalidArgumentException

at line 117
final string getName()

Returns element's name.

Return Value

string

at line 127
final bool isEmpty()

Is element empty?

Return Value

bool

at line 139
final void __set($name, $value)

Overloaded setter for element's attribute.

Parameters

$name
$value

Return Value

void

at line 150
final mixed __get($name)

Overloaded getter for element's attribute.

Parameters

$name

Return Value

mixed

property value

at line 180
final TexyHtml href($path, $query = NULL)

Special setter for element's attribute.

Parameters

$path
$query

Return Value

TexyHtml

at line 198
final TexyHtml setText($text)

Sets element's textual content.

Parameters

$text

Return Value

TexyHtml

at line 214
final string getText()

Gets element's textual content.

Return Value

string

at line 232
final TexyHtml add($child)

Adds new element's child.

Parameters

$child

Return Value

TexyHtml

at line 244
final TexyHtml create($name, $attrs = NULL)

Creates and adds a new TexyHtml child.

Parameters

$name
$attrs

Return Value

TexyHtml

created element

at line 259
TexyHtml insert($index, $child, $replace = FALSE)

Inserts child node.

Parameters

$index
$child
$replace

Return Value

TexyHtml

Exceptions

Exception

at line 283
final void offsetSet($index, $child)

Inserts (replaces) child node (ArrayAccess implementation).

Parameters

$index
$child

Return Value

void

at line 294
final mixed offsetGet($index)

Returns child node (ArrayAccess implementation).

Parameters

$index

Return Value

mixed

at line 305
final bool offsetExists($index)

Exists child node? (ArrayAccess implementation).

Parameters

$index

Return Value

bool

at line 316
void offsetUnset($index)

Removes child node (ArrayAccess implementation).

Parameters

$index

Return Value

void

at line 328
final int count()

Required by the Countable interface.

Return Value

int

at line 338
void removeChildren()

Removed all children.

Return Value

void

at line 348
final ArrayIterator getIterator()

Required by the IteratorAggregate interface.

Return Value

ArrayIterator

at line 358
final getChildren()

Returns all of children.

return array

at line 369
final string toString(Texy $texy)

Renders element's start tag, content and end tag to internal string representation.

Parameters

Texy $texy

Return Value

string

at line 398
final string toHtml(Texy $texy)

Renders to final HTML.

Parameters

Texy $texy

Return Value

string

at line 409
final string toText(Texy $texy)

Renders to final text.

Parameters

Texy $texy

Return Value

string

at line 419
string startTag()

Returns element's start tag.

Return Value

string

at line 486
string endTag()

Returns element's end tag.

Return Value

string

at line 498
__clone()

Clones all children too.

at line 511
final int getContentType()

No description

Return Value

int

at line 525
final void validateAttrs($dtd)

No description

Parameters

$dtd

Return Value

void

at line 540
validateChild($child, $dtd)

No description

Parameters

$child
$dtd

at line 559
final void parseLine(Texy $texy, $s)

Parses text as single line.

Parameters

Texy $texy
$s

Return Value

void

at line 578
final void parseBlock(Texy $texy, $s, $indented = FALSE)

Parses text as block.

Parameters

Texy $texy
$s
$indented

Return Value

void