/** * Main parser dispatcher method. * This is where the first-level parsing gets dispatched to specific parser methods. * Accepts (requires) a single string, containing HTML to be parsed for uFormats. * Returns an xArray of parsed uFormats' objects. * @param $str HTML to be parsed. * @return xArray of uFormat objects. */ function parseSource($str) { @($this->_dom =& domxml_open_mem($str)); if (!$this->_dom) { return false; } $root = $this->_dom->get_elements_by_tagname('body'); $root = $root[0]; $children = $root->child_nodes(); $elems = new xArray(); foreach ($children as $child) { if ($this->_parseHCard) { $e = $this->parseCard($child); $elems->append($e->toArray()); } if ($this->_parseHCalendar) { $e = $this->parseCalendar($child); $elems->append($e->toArray()); } if ($this->_parseHReview) { $e = $this->parseReview($child); $elems->append($e->toArray()); } if ($this->_parseRelTags) { $e = $this->parseRel($child); $elems->append($e->toArray()); } } return $elems->compact(); }