public function tidyErrors($in = '', &$out = '')
{
$out = preg_replace('@>\\s*<@s', ">\n<", $in);
// direct access? windows etc
if (function_exists('tidy_parse_string')) {
$tidy = tidy_parse_string($out, [], 'UTF8');
$tidy->cleanRepair();
$errors = $tidy->errorBuffer . "\n";
return $errors;
}
// cli
$File = new File(rtrim(TMP, DS) . DS . rand() . '.html', true);
$File->write($out);
$path = $File->pwd();
$errors = $path . '.err';
$this->_exec("tidy -eq -utf8 -f {$errors} {$path}");
$File->delete();
if (!file_exists($errors)) {
return '';
}
$Error = new File($errors);
$errors = $Error->read();
$Error->delete();
return $errors;
}