/** * Returns array as severity > line > column > message. * * @return string[] */ public function getErrors() { $this->m_tidy->diagnose(); $matches = []; preg_match_all('/^(?:line (\\d+) column (\\d+) - )?(\\S+): (?:\\[((?:\\d+\\.?){4})]:)?(.*?)$/m', $this->m_tidy->errorBuffer, $matches, PREG_SET_ORDER); $errors = []; if (false === isset($matches[0])) { return $errors; } foreach ($matches as $match) { $match[5] = \str\trim(\html\strip($match[5])); if ($this->ignoreProprietaryAttributes && \str\startsWithIgnoreCase($match[5], 'proprietary attribute')) { continue; } $levelTidy = strtolower(trim($match[3])); $level = self::ERROR; if (isset(self::$m_severities[$levelTidy])) { $level = self::$m_severities[$levelTidy]; } $errors[$level][(int) $match[1]][(int) $match[2]] = $match[5]; } return $errors; }
/** * @see \html\stripTags() stripTags */ public static function stripTags($string_, $ignoreTags_ = null, Io_Charset $charset_ = null, $escapeHtml_ = true, $flags_ = ENT_QUOTES) { if (null === $charset_) { return \html\strip($string_, $ignoreTags_, null, $escapeHtml_, ENT_XHTML, $flags_); } return \html\strip($string_, $ignoreTags_, $charset_->name(), $escapeHtml_, ENT_XHTML, $flags_); }