Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-32865 Backwards compatibility, deal with the old image tag

  • Loading branch information...
commit bedbfd6dfa3cf51e364cac46a6aed0ab664093b4 1 parent 7c86628
Jean-Michel Vedrine authored
Showing with 13 additions and 0 deletions.
  1. +13 −0 question/format/xml/format.php
View
13 question/format/xml/format.php
@@ -443,6 +443,19 @@ public function import_multianswer($question) {
$qo->questiontextfiles = $this->import_files($this->getpath($question,
array('#', 'questiontext', 0, '#', 'file'), array(), false));
+ // Backwards compatibility, deal with the old image tag.
+ $filedata = $this->getpath($question, array('#', 'image_base64', '0', '#'), null, false);
+ $filename = $this->getpath($question, array('#', 'image', '0', '#'), null, false);
+ if ($filedata && $filename) {
+ $data = new stdClass();
+ $data->content = $filedata;
+ $data->encoding = 'base64';
+ // Question file areas don't support subdirs, so convert path to filename if necessary.
+ $data->name = clean_param(str_replace('/', '_', $filename), PARAM_FILE);
+ $qo->questiontextfiles[] = $data;
+ $qo->questiontext .= ' <img src="@@PLUGINFILE@@/' . $data->name . '" />';
+ }
+
// restore files in generalfeedback
$qo->generalfeedback = $this->getpath($question,
array('#', 'generalfeedback', 0, '#', 'text', 0, '#'), $qo->generalfeedback, true);
Please sign in to comment.
Something went wrong with that request. Please try again.