ACC SHELL
<?php
class TF_Html_Link extends TF_Html
{
function __construct ($href, $title = null, $attributes = array())
{
$internal = array("href" => $href);
$attribs = array_merge($attributes, $internal);
$this->setStripSpaces(true);
if (! is_null($title)) {
parent::__construct("a", $title, $attribs);
} else {
parent::__construct("a", $href, $attribs);
}
}
/**
* __toString
*/
public function __toString ()
{
$attr = array();
foreach ($this->_attributes as $attribute => $value) {
$attr[] = $attribute . '="' . $value . '"';
}
if ($attr === array()) {
$attributes = '';
} else {
$attributes = ' ' . implode(" ", $attr);
}
if ($this->_singleTag) {
if ($this->_isXhtml) {
$endTag = ' />';
} else {
$endTag = '>';
}
$startTag = '<' . $this->_tag . $attributes;
return $startTag . $endTag;
} else {
if (! is_null($this->_children) && is_array($this->_children)) {
$childRes = array();
foreach ($this->_children as $child) {
if ($child instanceof TF_Html) {
$x = str_ireplace(
"\r\n",
"\r\n" .
TF_Html::INDENT,
$child->__toString());
$childRes[] = $x;
} else if (is_string(
$child)) {
$childRes[] = $child;
} else {
try {
$childRes[] = (string) $child;
}
catch (Exception $e) {
throw new Zend_Exception(
"Neplatný obsah tagu!");
}
}
}
}
$startTag = '<' . $this->_tag . $attributes . '>';
$endTag = '</' . $this->_tag . '>';
return $startTag . implode($childRes) . $endTag;
}
} /* of __toString -------------------------------------*/
}
ACC SHELL 2018