MDL-54853 weblib: Specify version and fixed encoding

This commit is contained in:
Andrew Nicols
2016-06-09 09:54:41 +08:00
parent 2331a70c89
commit bf98b7fe3b
+1 -2
View File
@@ -1320,9 +1320,8 @@ function format_text($text, $format = FORMAT_MOODLE, $options = null, $courseidd
}
if ($options['blanktarget']) {
$encoding = ini_get('default_charset') ? ini_get('default_charset') : 'utf-8';
$domdoc = new DOMDocument();
$domdoc->loadHTML('<?xml encoding="' . $encoding . '" ?>' . $text);
$domdoc->loadHTML('<?xml version="1.0" encoding="UTF-8" ?>' . $text);
foreach ($domdoc->getElementsByTagName('a') as $link) {
if ($link->hasAttribute('target') && strpos($link->getAttribute('target'), '_blank') === false) {
continue;