You are here

function qformat_xml::xmltidy in Quiz 6.6

Same name and namespace in other branches
  1. 6.5 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) {

  // can only do this if tidy is installed
  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;
  }
}