]> git.mjollnir.org Git - moodle.git/commitdiff
HTML Entities are now 'reversed' on import.
authorthepurpleblob <thepurpleblob>
Wed, 26 Jan 2005 10:37:16 +0000 (10:37 +0000)
committerthepurpleblob <thepurpleblob>
Wed, 26 Jan 2005 10:37:16 +0000 (10:37 +0000)
mod/quiz/format/learnwise/format.php

index b8fe644aab734c3e72cfc39448b7966eecbfe132..ce0fcc0816a96dca8b2b7c2d933b61b3c10e4f8e 100755 (executable)
@@ -32,6 +32,15 @@ class quiz_file_format extends quiz_default_format {
                return $questions;\r
        }\r
 \r
+        function unhtmlentities($string)\r
+        // puts all the &gt; etc stuff back to 'normal' \r
+        // good for PHP 4.1.0 on\r
+        {\r
+          $trans_tbl = get_html_translation_table(HTML_ENTITIES);\r
+          $trans_tbl = array_flip($trans_tbl);\r
+          return strtr($string, $trans_tbl);\r
+        }\r
+\r
     function readquestion($lines) {\r
                $text = '';\r
                foreach ($lines as $line) $text .= $line;\r
@@ -71,9 +80,9 @@ class quiz_file_format extends quiz_default_format {
                                }\r
                                \r
                                $question->qtype = MULTICHOICE;\r
-                               $question->name = substr($questiontext,0,30);\r
+                               $question->name = substr($this->unhtmlentities($questiontext),0,30);\r
                                if(strlen($questionlen)<30) $question->name .= '...';\r
-                               $question->questiontext = $questiontext;\r
+                               $question->questiontext = $this->unhtmlentities($questiontext);\r
                                $question->single = 1;\r
                                $question->feedback[] = '';\r
                                $question->usecase = 0;\r
@@ -86,7 +95,7 @@ class quiz_file_format extends quiz_default_format {
                                        {\r
                                                if($options_correct[$n]=='yes') $fraction = (int) $questionaward; else $fraction = 0;\r
                                                $question->fraction[] = $fraction;\r
-                                               $question->answer[] = $options_text[$n];\r
+                                               $question->answer[] = $this->unhtmlentities($options_text[$n]);\r
                                                //echo "hello: $options_text[$n], $fraction<br>";\r
                                        }\r
                                }\r