mirror of
https://github.com/moodle/moodle.git
synced 2025-04-30 13:28:28 +02:00
MDL-32865 Backwards compatibility, deal with the old image tag
This commit is contained in:
parent
7c86628de6
commit
bedbfd6dfa
@ -443,6 +443,19 @@ class qformat_xml extends qformat_default {
|
||||
$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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user