public function assignBody(HTML_Element $element) { if ($element->tag == 'body') { $this->body = $element; return; } else { if ($element instanceof HTML_Container) { try { $sub_element = $element->getAt(0); if ($sub_element->tag == 'body') { $this->body = $sub_element; return; } } catch (HTML_Index_Out_Of_Range_Exception $e) { } } } $match = $element->getElementsBy('tag', 'body'); if (!empty($match)) { $this->body = $match[0]; } else { throw new Root_Tag_Not_Found_Exception('body'); } }
public function getElementsBy($property, $value) { $elems_a = parent::getElementsBy($property, $value); foreach ($this->_elements as $element) { $sub_elems_a = $element->getElementsBy($property, $value); foreach ($sub_elems_a as $match) { $elems_a[] = $match; } } return $elems_a; }
public static function updateHTML($type, HTML_Element $root) { $itype = self::identify($type); switch ($itype) { case self::LIGHTBOX: case self::GREYBOX: $imgs = $root->getElementsBy('tag', 'img'); self::updateElements($type, $imgs); break; } }