function hotpot_xml_tree::xml_value in Quiz 6.6
Same name and namespace in other branches
- 6.5 includes/moodle/question/format/hotpot/format.php \hotpot_xml_tree::xml_value()
File
- includes/moodle/question/format/hotpot/format.php, line 547
Class
- hotpot_xml_tree
Code
function xml_value($tags, $more_tags = "[0]['#']") {
$tags = empty($tags) ? '' : "['" . str_replace(",", "'][0]['#']['", $tags) . "']";
eval('$value = &$this->xml' . $this->xml_root . $tags . $more_tags . ';');
if (is_string($value)) {
$value = strtr($value, array(
'<' => '<',
'>' => '>',
'&' => '&',
));
$htmltags = '(' . 'TABLE|/?CAPTION|/?COL|/?COLGROUP|/?TBODY|/?TFOOT|/?THEAD|/?TD|/?TH|/?TR' . '|OL|UL|/?LI' . '|DL|/?DT|/?DD' . '|EMBED|OBJECT|APPLET|/?PARAM' . ')';
$search = '#(<' . $htmltags . '[^>]*' . '>)\\s+' . '(?=' . '<' . ')#is';
$value = preg_replace($search, '\\1', $value);
$value = str_replace("\n", '<br />', $value);
$search = '#(' . '[\\xc0-\\xdf][\\x80-\\xbf]' . '|' . '[\\xe0-\\xef][\\x80-\\xbf]{2}' . '|' . '[\\xf0-\\xff][\\x80-\\xbf]{3}' . '|' . '[\\x80-\\xff]' . ')#se';
$value = preg_replace($search, "hotpot_utf8_to_html_entity('\\1')", $value);
}
return $value;
}