function qformat_xml::writetext in Quiz 6.6
Same name and namespace in other branches
- 6.5 includes/moodle/question/format/xml/format.php \qformat_xml::writetext()
generates <text></text> tags, processing raw text therein
Parameters
int ilev the current indent level:
boolean short stick it on one line:
Return value
string formatted text
1 call to qformat_xml::writetext()
- qformat_xml::writequestion in includes/
moodle/ question/ format/ xml/ format.php - Turns question into an xml segment
File
- includes/
moodle/ question/ format/ xml/ format.php, line 693
Class
Code
function writetext($raw, $ilev = 0, $short = true) {
$indent = str_repeat(" ", $ilev);
// if required add CDATA tags
if (!empty($raw) and htmlspecialchars($raw) != $raw) {
$raw = "<![CDATA[{$raw}]]>";
}
if ($short) {
$xml = "{$indent}<text>{$raw}</text>\n";
}
else {
$xml = "{$indent}<text>\n{$raw}\n{$indent}</text>\n";
}
return $xml;
}