From 5b0dc681ad7b3ddb952db304aa8d362a86f29f4d Mon Sep 17 00:00:00 2001 From: tjhunt Date: Tue, 13 Mar 2007 16:24:13 +0000 Subject: [PATCH] Use the right string processing when outputting question text on import/export. --- question/format.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/question/format.php b/question/format.php index d176fa4425..de2f7435df 100644 --- a/question/format.php +++ b/question/format.php @@ -129,7 +129,7 @@ class qformat_default { $count++; - echo "

$count. ".stripslashes($question->questiontext)."

"; + echo "

$count. ".$this->format_question_text($question)."

"; // check for answer grades validity (must match fixed list of grades) if (!empty($question->fraction) and (is_array($question->fraction))) { @@ -396,7 +396,7 @@ class qformat_default { // export the question displaying message $count++; - echo "

$count. ".stripslashes($question->questiontext)."

"; + echo "

$count. ".$this->format_question_text($question)."

"; $expout .= $this->writequestion( $question ) . "\n"; } @@ -438,6 +438,17 @@ class qformat_default { return $path; } + function format_question_text($question) { + $formatoptions = new stdClass; + $formatoptions->noclean = true; + $formatoptions->para = false; + if (empty($question->questiontextformat)) { + $format = FORMAT_MOODLE; + } else { + $format = $question->questiontextformat; + } + return format_text(stripslashes($question->questiontext), $format, $formatoptions); + } } ?> -- 2.39.5