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-v Ax}ԓP+{Lqy0Cxtdj/3PY|9QZ}y*`#Jby*ҪE[PZDɤ*!A1;F4ߑ>]ȯE^rMi㼂^tN4ic=:bgY<9,$PFVꚎ" xwh:Ò8AcB2sYP詧Y/o%zE, ;s<?v/暈wHJo^:v#UxﶩĀE ␍&x }PyJMp ftw@ϸ+h)Pۃ4:ѐ25t 4ֿo֛NwgFN5K]O/)br;𣯎> V.b(~pأ ߳cv { %cMv`\B>eCtwgFN5K]O=iDwхߝ[ˆ`bj+O2ȑ|݊hK knCؤKIPo.9+,֯@fmv5BhWϯ{bd{ZQkƣ9Žk61W*^D|MLuwgFN5K]OYQ=ϚۙThwQ%ye::<$<mGμ# #\o}[Kɪ A8րU2,"{ƿVZ0puqguE#+q^ttzo &^i 4#AY7QP6.!}.>hYAбWfkr"Ƃ+(wqHxl5,%FjjX|PJ|KUxw$qcCv+ 4{ -hmr{;AH&r*[Cikg,x89vLo+8 G-O s@Tb97]{:qH2ҧAOQOãƁE)cAuiYmT㸐bF/51O $XBf]Gd[m&>}WT which is included with * almost all distributions of PHP. */ public function loadHTMLFragment($string, array $options = array()) { return $this->parseFragment($string, $options); } /** * Return all errors encountered into parsing phase. * * @return array */ public function getErrors() { return $this->errors; } /** * Return true it some errors were encountered into parsing phase. * * @return bool */ public function hasErrors() { return count($this->errors) > 0; } /** * Parse an input string. * * @param string $input * @param array $options * * @return \DOMDocument */ public function parse($input, array $options = array()) { $this->errors = array(); $options = array_merge($this->defaultOptions, $options); $events = new DOMTreeBuilder(false, $options); $scanner = new Scanner($input, !empty($options['encoding']) ? $options['encoding'] : 'UTF-8'); $parser = new Tokenizer($scanner, $events, !empty($options['xmlNamespaces']) ? Tokenizer::CONFORMANT_XML : Tokenizer::CONFORMANT_HTML); $parser->parse(); $this->errors = $events->getErrors(); return $events->document(); } /** * Parse an input stream where the stream is a fragment. * * Lower-level loading function. This requires an input stream instead * of a string, file, or resource. * * @param string $input The input data to parse in the form of a string. * @param array $options An array of options. * * @return \DOMDocumentFragment */ public function parseFragment($input, array $options = array()) { $options = array_merge($this->defaultOptions, $options); $events = new DOMTreeBuilder(true, $options); $scanner = new Scanner($input, !empty($options['encoding']) ? $options['encoding'] : 'UTF-8'); $parser = new Tokenizer($scanner, $events, !empty($options['xmlNamespaces']) ? Tokenizer::CONFORMANT_XML : Tokenizer::CONFORMANT_HTML); $parser->parse(); $this->errors = $events->getErrors(); return $events->fragment(); } /** * Save a DOM into a given file as HTML5. * * @param mixed $dom The DOM to be serialized. * @param string|resource $file The filename to be written or resource to write to. * @param array $options Configuration options when serializing the DOM. These include: * - encode_entities: Text written to the output is escaped by default and not all * entities are encoded. If this is set to true all entities will be encoded. * Defaults to false. */ public function save($dom, $file, $options = array()) { $close = true; if (is_resource($file)) { $stream = $file; $close = false; } else { $stream = fopen($file, 'wb'); } $options = array_merge($this->defaultOptions, $options); $rules = new OutputRules($stream, $options); $trav = new Traverser($dom, $stream, $rules, $options); $trav->walk(); /* * release the traverser to avoid cyclic references and allow PHP to free memory without waiting for gc_collect_cycles */ $rules->unsetTraverser(); if ($close) { fclose($stream); } } /** * Convert a DOM into an HTML5 string. * * @param mixed $dom The DOM to be serialized. * @param array $options Configuration options when serializing the DOM. These include: * - encode_entities: Text written to the output is escaped by default and not all * entities are encoded. If this is set to true all entities will be encoded. * Defaults to false. * * @return string A HTML5 documented generated from the DOM. */ public function saveHTML($dom, $options = array()) { $stream = fopen('php://temp', 'wb'); $this->save($dom, $stream, array_merge($this->defaultOptions, $options)); $html = stream_get_contents($stream, -1, 0); fclose($stream); return $html; } }