You are here

public static function FeedsExXmlUtility::decodeNamedHtmlEntities in Feeds extensible parsers 7

Converts named HTML entities to their UTF-8 equivalent.

Parameters

string $markup: The string.

Return value

string The converted string.

2 calls to FeedsExXmlUtility::decodeNamedHtmlEntities()
FeedsExXml.test in src/Tests/FeedsExXml.test
FeedsExXml::prepareDocument in src/FeedsExXml.inc
Prepares the DOM document.

File

src/Xml/Utility.php, line 42
Contains FeedsExXmlUtility.

Class

FeedsExXmlUtility
Simple XML helpers.

Code

public static function decodeNamedHtmlEntities($markup) {
  if (version_compare(PHP_VERSION, '5.4.0', '<')) {
    $map = (require dirname(dirname(dirname(__FILE__))) . '/resources/html_entities.php');
  }
  else {
    $map = array_flip(get_html_translation_table(HTML_ENTITIES, ENT_NOQUOTES | ENT_HTML5, 'UTF-8'));
    unset($map['&amp;'], $map['&lt;'], $map['&gt;']);
  }
  return strtr($markup, $map);
}