}
-/********************************
-
- function readdata($filename) {
- /// Returns complete file with an array, one item per line
-
- if (is_readable($filename)) {
-
- $zip = zip_open($filename);
- $zip_entry = $zip_read($zip);
- if (strstr($zip_entry_name($zip_entry), "imsmanifest") == 0)
- $zip_entry = $zip_read($zip); // skip past manifest file
-
- if (zip_entry_open($zip, $zip_entry, "r")) {
-
- $strbuf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
- $buf = explode("\n", $strbuf);
- zip_entry_close($zip_entry);
- zip_close($zip);
- return $buf;
-
- } else {
-
- zip_close($zip);
- return false;
-
- }
-
- }
-
- return false;
- }
-
-********************************/
-
function readquestions ($lines) {
/// Parses an array of lines into an array of questions,
/// where each item is a question object as defined by
// put questiontext in question object
if ($ishtml) {
- $question->questiontext = html_entity_decode_php4(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"]));
+ $question->questiontext = html_entity_decode(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"]),ENT_QUOTES,'UTF-8');
}
$question->questiontext = $question->questiontext;
// put name in question object
- $question->name = substr($question->questiontext, 0, 254);
+ $question->name = shorten_text($question->questiontext, 254);
$choices = $thisquestion["#"]["ANSWER"];
// put questiontext in question object
if ($ishtml) {
- $question->questiontext = html_entity_decode_php4(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"]));
+ $question->questiontext = html_entity_decode(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"]),ENT_QUOTES,'UTF-8');
}
$question->questiontext = $question->questiontext;
// put name of question in question object, careful of length
- $question->name = substr($question->questiontext, 0, 254);
+ $question->name = shorten_text($question->questiontext, 254);
$choices = $thisquestion["#"]["ANSWER"];
for ($j = 0; $j < sizeof ($choices); $j++) {
$choice = trim($choices[$j]["#"]["TEXT"][0]["#"]);
// put this choice in the question object.
if ($ishtml) {
- $question->answer[$j] = html_entity_decode_php4($choice);
+ $question->answer[$j] = html_entity_decode($choice,ENT_QUOTES,'UTF-8');
}
$question->answer[$j] = $question->answer[$j];
if (strcmp ($id, $correct_answer_id) == 0) {
$question->fraction[$j] = 1;
if ($ishtml) {
- $question->feedback[$j] = html_entity_decode_php4(trim(@$thisquestion["#"]["GRADABLE"][0]["#"]["FEEDBACK_WHEN_CORRECT"][0]["#"]));
+ $question->feedback[$j] = html_entity_decode(trim(@$thisquestion["#"]["GRADABLE"][0]["#"]["FEEDBACK_WHEN_CORRECT"][0]["#"]),ENT_QUOTES,'UTF-8');
}
$question->feedback[$j] = $question->feedback[$j];
} else {
$question->fraction[$j] = 0;
if ($ishtml) {
- $question->feedback[$j] = html_entity_decode_php4(trim(@$thisquestion["#"]["GRADABLE"][0]["#"]["FEEDBACK_WHEN_INCORRECT"][0]["#"]));
+ $question->feedback[$j] = html_entity_decode(trim(@$thisquestion["#"]["GRADABLE"][0]["#"]["FEEDBACK_WHEN_INCORRECT"][0]["#"]),ENT_QUOTES,'UTF-8');
}
$question->feedback[$j] = $question->feedback[$j];
}
// put questiontext in question object
if ($ishtml) {
- $question->questiontext = html_entity_decode_php4(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"]));
+ $question->questiontext = html_entity_decode(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"]),ENT_QUOTES,'UTF-8');
}
$question->questiontext = $question->questiontext;
// put name of question in question object
- $question->name = substr($question->questiontext, 0, 254);
+ $question->name = shorten_text($question->questiontext, 254);
$choices = $thisquestion["#"]["ANSWER"];
$correctanswers = $thisquestion["#"]["GRADABLE"][0]["#"]["CORRECTANSWER"];
// put questiontext in question object
if ($ishtml) {
- $question->questiontext = html_entity_decode_php4(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"]));
+ $question->questiontext = html_entity_decode(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"]),ENT_QUOTES,'UTF-8');
}
$question->questiontext = $question->questiontext;
// put name of question in question object
- $question->name = substr($question->questiontext, 0, 254);
+ $question->name = shorten_text($question->questiontext, 254);
$answer = trim($thisquestion["#"]["ANSWER"][0]["#"]["TEXT"][0]["#"]);
// put questiontext in question object
if ($ishtml) {
- $question->questiontext = html_entity_decode_php4(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"]));
+ $question->questiontext = html_entity_decode(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"]),ENT_QUOTES,'UTF-8');
}
$question->questiontext = $question->questiontext;
// put name of question in question object
- $question->name = substr($question->questiontext, 0, 254);
+ $question->name = shorten_text($question->questiontext, 254);
$choices = $thisquestion["#"]["CHOICE"];
for ($j = 0; $j < sizeof ($choices); $j++) {