You are here

protected function TMGMTFileformatXLIFF::toEntities in Translation Management Tool 7

Convert critical characters to HTML entities.

DOMDocument will convert HTML entities to its actual characters. This can lead into situation when not allowed characters will appear in the content.

Parameters

string $string: String to escape.

Return value

string Escaped string.

1 call to TMGMTFileformatXLIFF::toEntities()
TMGMTFileformatXLIFF::processForExport in translators/file/tmgmt_file.format.xliff.inc
Helper function to process the source text.

File

translators/file/tmgmt_file.format.xliff.inc, line 631

Class

TMGMTFileformatXLIFF
Export to XLIFF format.

Code

protected function toEntities($string) {
  return str_replace(array(
    '&',
    '>',
    '<',
  ), array(
    '&amp;',
    '&gt;',
    '&lt;',
  ), $string);
}