public function __construct($public = 'strict', $url = '') { if ($public == 'strict') { $public = '-//W3C//DTD HTML 4.01//EN'; $url = 'http://www.w3.org/TR/html4/strict.dtd'; } else { if ($public == 'transitional') { $public = '-//W3C//DTD HTML 4.01 Transitional//EN'; $url = 'http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd'; } } parent::__construct('html', $public, $url); $this->elementClass('IMuHTMLElement'); }
public function element($name, $value = '') { $elem = parent::element($name); $elem->push(); if (is_array($value)) { if (array_keys($value) === range(0, count($value) - 1)) { $this->writeList($name, $value); } else { $this->writeHash($name, $value); } } else { if (is_object($value)) { $this->writeObject($name, $value); } else { $this->writeText($name, $value); } } $elem->pop(); return $elem; }
public function createXML() { $date = date('r'); $xml = new IMuDocument($this->encoding); $root = $xml->startElement('rss'); $root->setAttribute('version', '2.0'); $xml->startElement('channel'); $xml->writeElement('category', $this->category); $xml->writeElement('copyright', $this->copyright); $xml->writeElement('description', $this->description); $xml->writeElement('language', $this->language); $xml->writeElement('lastBuildDate', $date); $xml->writeElement('link', $this->link); $xml->writeElement('pubDate', $date); $xml->writeElement('title', $this->title); foreach ($this->items as $item) { $item->createXML($xml); } $xml->endDocument(); return $xml->saveXML(); }