You are here

protected function Xliff::toEntities in Translation Management Tool 8

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 Xliff::toEntities()
Xliff::processForExport in translators/tmgmt_file/src/Plugin/tmgmt_file/Format/Xliff.php
Helper function to process the source text.

File

translators/tmgmt_file/src/Plugin/tmgmt_file/Format/Xliff.php, line 683

Class

Xliff
Export to XLIFF format.

Namespace

Drupal\tmgmt_file\Plugin\tmgmt_file\Format

Code

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