Commit cbe94a4c authored by Robert Lyon's avatar Robert Lyon

Bug 1451331: Saving of text block with embedded media for old PHP

The DOMDocument::saveHTML() function only gained the $node parameter
in version 5.3.6

So we need a workaround for PHP 5.3.3

Change-Id: I1033c0411f25cd41a4ec83cd2258fc518927e3ab
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 59766ce5
......@@ -117,12 +117,11 @@ class EmbeddedImage {
// we only want the fragments inside the body tag created by new DOMDocument
$childnodes = $dom->getElementsByTagName('body')->item(0)->childNodes;
$innerhtml = '';
$dummydom = new DOMDocument();
foreach ($childnodes as $child) {
$fragment = $dom->saveHTML($child);
$innerhtml .= html_entity_decode($fragment, ENT_QUOTES, 'UTF-8');
$dummydom->appendChild($dummydom->importNode($child, true));
}
$fieldvalue = $innerhtml;
$fieldvalue = html_entity_decode($dummydom->saveHTML(), ENT_QUOTES, 'UTF-8');
return $fieldvalue;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment