MDL-16570

Use CDATA sections for text where required. More readable and less error
prone.
This commit is contained in:
thepurpleblob
2008-09-19 09:58:57 +00:00
parent 577fb1cd3b
commit d178d3a213
+4 -2
View File
@@ -692,8 +692,10 @@ class qformat_xml extends qformat_default {
function writetext( $raw, $ilev=0, $short=true) {
$indent = str_repeat( " ",$ilev );
// encode the text to 'disguise' HTML content
$raw = htmlspecialchars( $raw );
// if required add CDATA tags
if (!empty($raw) and (htmlspecialchars($raw)!=$raw)) {
$raw = "<![CDATA[$raw]]>";
}
if ($short) {
$xml = "$indent<text>$raw</text>\n";