Permalink
Browse files

HTML Entities are now 'reversed' on import.

  • Loading branch information...
1 parent 8f0876a commit 7452a561105bdde4cebab77f2b3f579f7dfd0df4 thepurpleblob committed Jan 26, 2005
Showing with 12 additions and 3 deletions.
  1. +12 −3 mod/quiz/format/learnwise/format.php
@@ -32,6 +32,15 @@ function readquestions($lines) {
return $questions;
}
+ function unhtmlentities($string)
+ // puts all the > etc stuff back to 'normal'
+ // good for PHP 4.1.0 on
+ {
+ $trans_tbl = get_html_translation_table(HTML_ENTITIES);
+ $trans_tbl = array_flip($trans_tbl);
+ return strtr($string, $trans_tbl);
+ }
+
function readquestion($lines) {
$text = '';
foreach ($lines as $line) $text .= $line;
@@ -71,9 +80,9 @@ function readquestion($lines) {
}
$question->qtype = MULTICHOICE;
- $question->name = substr($questiontext,0,30);
+ $question->name = substr($this->unhtmlentities($questiontext),0,30);
if(strlen($questionlen)<30) $question->name .= '...';
- $question->questiontext = $questiontext;
+ $question->questiontext = $this->unhtmlentities($questiontext);
$question->single = 1;
$question->feedback[] = '';
$question->usecase = 0;
@@ -86,7 +95,7 @@ function readquestion($lines) {
{
if($options_correct[$n]=='yes') $fraction = (int) $questionaward; else $fraction = 0;
$question->fraction[] = $fraction;
- $question->answer[] = $options_text[$n];
+ $question->answer[] = $this->unhtmlentities($options_text[$n]);
//echo "hello: $options_text[$n], $fraction<br>";
}
}

0 comments on commit 7452a56

Please sign in to comment.