public function HtmlPurifierFilter::configErrorHandler in HTML Purifier 8
Custom error handler to manage invalid purifier configuration assignments.
Parameters
$errno:
$errstr:
File
- src/
Plugin/ Filter/ HtmlPurifierFilter.php, line 132
Class
- HtmlPurifierFilter
- Plugin annotation @Filter( id = "htmlpurifier", title = @Translation("HTML Purifier"), description = @Translation("Removes malicious HTML code and ensures that the output is standards compliant."), type =…
Namespace
Drupal\htmlpurifier\Plugin\FilterCode
public function configErrorHandler($errno, $errstr) {
// Do not set a validation error if the error is about a deprecated use.
if ($errno < E_DEPRECATED) {
// \HTMLPurifier_Config::triggerError() adds ' invoked on line ...' to the
// error message. Remove that part from our validation error message.
$needle = 'invoked on line';
$pos = strpos($errstr, $needle);
if ($pos !== FALSE) {
$message = substr($errstr, 0, $pos - 1);
$this->configErrors[] = $message;
}
else {
$this->configErrors[] = 'HTMLPurifier configuration is not valid. Error: ' . $errstr;
}
}
}