function qformat_xml::xmltidy in Quiz 6.5
Same name and namespace in other branches
- 6.6 includes/moodle/question/format/xml/format.php \qformat_xml::xmltidy()
1 call to qformat_xml::xmltidy()
- qformat_xml::presave_process in includes/moodle/question/format/xml/format.php
- Enable any processing to be done on the content
just prior to the file being saved
default is to do nothing
File
- includes/moodle/question/format/xml/format.php, line 711
Class
- qformat_xml
Code
function xmltidy($content) {
if (extension_loaded('tidy')) {
$config = array(
'input-xml' => true,
'output-xml' => true,
'indent' => true,
'wrap' => 0,
);
$tidy = new tidy();
$tidy
->parseString($content, $config, 'utf8');
$tidy
->cleanRepair();
return $tidy->value;
}
else {
return $content;
}
}