toHtml() public method

Convert the attribute list to html.
public toHtml ( array $attributes ) : string
$attributes array Attributes
return string
Beispiel #1
0
 /**
  * Parse opening tag.
  *
  * @param resource $parser     XML parser
  * @param string   $tag        Tag name
  * @param array    $attributes Tag attributes
  */
 public function startTag($parser, $tag, array $attributes)
 {
     $this->empty = true;
     if ($this->tag->isAllowed($tag, $attributes)) {
         $attributes = $this->attribute->filter($tag, $attributes);
         if ($this->attribute->hasRequiredAttributes($tag, $attributes)) {
             $attributes = $this->attribute->addAttributes($tag, $attributes);
             $this->output .= $this->tag->openHtmlTag($tag, $this->attribute->toHtml($attributes));
             $this->empty = false;
         }
     }
     $this->empty_tags[] = $this->empty;
 }
Beispiel #2
0
 public function testHtml()
 {
     $filter = new Attribute(new Url('http://google.com'));
     $this->assertEquals('title="A & B"', $filter->toHtml(array('title' => 'A & B')));
     $this->assertEquals('title=""a""', $filter->toHtml(array('title' => '"a"')));
     $this->assertEquals('title="ç" alt="b"', $filter->toHtml(array('title' => 'ç', 'alt' => 'b')));
 }