Lines Matching refs:html
119 public function setHtml($html): self { argument
120 if (!is_string($html) || trim($html) == '') {
127 $this->composeXmlNode($html);
131 $this->composeXmlNode($html);
139 * @param string $html
144 public function loadHTML($html, $options = 0): bool { argument
152 $html = '<domwrap></domwrap>' . $html;
155 $html = '<?xml encoding="' . ($this->getEncoding() ?? 'UTF-8') . '">' . $html;
157 $result = parent::loadHTML($html, $options);
190 private function getCharset(string $html): ?string { argument
193 if (preg_match('@<meta[^>]*?charset=["\']?([^"\'\s>]+)@im', $html, $matches)) {
203 private function detectEncoding(string $html) { argument
207 $charset = $this->getCharset($html);
210 $detectedCharset = mb_detect_encoding($html, mb_detect_order(), true);
224 private function convertToUtf8(string $html): string { argument
228 $html = preg_replace('@(charset=["]?)([^"\s]+)([^"]*["]?)@im', '$1UTF-8$3', $html);
232 $html = mb_convert_encoding($html, 'UTF-8', $charset);
236 $htmlIconv = iconv($charset, 'UTF-8', $html);
239 $html = $htmlIconv;
247 …$html = htmlspecialchars_decode(mb_encode_numericentity(htmlentities($html, ENT_QUOTES, 'UTF-8'), …
250 return $html;
256 private function composeXmlNode($html) argument
258 $this->detectEncoding($html);
260 $html = $this->convertToUtf8($html);
262 $this->loadHTML($html, $this->libxmlOptions);