protected function TMGMTFileformatXLIFF::getImportedXML in Translation Management Tool 7
Returns the simple XMLElement object.
Parameters
string $imported_file: Path to a file or an XML string to import.
bool $is_file: (optional) Whether $imported_file is the path to a file or not.
Return value
bool|\SimpleXMLElement The parsed SimpleXMLElement object. FALSE in case of failed parsing.
2 calls to TMGMTFileformatXLIFF::getImportedXML()
- TMGMTFileformatXLIFF::import in translators/
file/ tmgmt_file.format.xliff.inc - Converts an exported file content back to the translated data.
- TMGMTFileformatXLIFF::validateImport in translators/
file/ tmgmt_file.format.xliff.inc - Validates that the given file is valid and can be imported.
File
- translators/
file/ tmgmt_file.format.xliff.inc, line 310
Class
- TMGMTFileformatXLIFF
- Export to XLIFF format.
Code
protected function getImportedXML($imported_file, $is_file = TRUE) {
if (empty($this->importedXML)) {
// It is not possible to load the file directly with simplexml as it gets
// url encoded due to the temporary://. This is a PHP bug, see
// https://bugs.php.net/bug.php?id=61469
if ($is_file) {
$imported_file = file_get_contents($imported_file);
}
if (!($this->importedXML = simplexml_load_string($imported_file))) {
return FALSE;
}
// Register the XLIFF namespace, required for xpath.
$this->importedXML
->registerXPathNamespace('xliff', 'urn:oasis:names:tc:xliff:document:1.2');
}
return $this->importedXML;
}