protected function unescapeXliff($content)
{
$content = preg_replace("/<\\/?(target|mrk)([^>.]+)?>/i", "", $content);
// we have to do this again but with html entities because of CDATA content
$content = preg_replace("/<\\/?(target|mrk)((?!>).)*>/i", "", $content);
if (preg_match("/<\\/?(bpt|ept)/", $content)) {
$xml = str_get_html($content);
if ($xml) {
$els = $xml->find("bpt,ept");
foreach ($els as $el) {
$content = html_entity_decode($el->innertext, null, "UTF-8");
$el->outertext = $content;
}
}
$content = $xml->save();
}
return $content;
}