MDL-56899 filter: suppress dom parsing errors
Domdocument does not know about <video> and <audio> tags, also it's too strict for html style solution from http://stackoverflow.com/questions/6090667/php-domdocument-errors-warnings-on-html5-tags
This commit is contained in:
@@ -1321,7 +1321,9 @@ function format_text($text, $format = FORMAT_MOODLE, $options = null, $courseidd
|
||||
|
||||
if ($options['blanktarget']) {
|
||||
$domdoc = new DOMDocument();
|
||||
libxml_use_internal_errors(true);
|
||||
$domdoc->loadHTML('<?xml version="1.0" encoding="UTF-8" ?>' . $text);
|
||||
libxml_clear_errors();
|
||||
foreach ($domdoc->getElementsByTagName('a') as $link) {
|
||||
if ($link->hasAttribute('target') && strpos($link->getAttribute('target'), '_blank') === false) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user