You are here

function views_xml_strip_illegal_chars in Views Datasource 5

Strips illegal Unicode characters and encodes entities in string

Parameters

string $input:

Return value

string

3 calls to views_xml_strip_illegal_chars()
views_xml_atom_render in ./views_xml.module
views_xml_opml_render in ./views_xml.module
views_xml_raw_render in ./views_xml.module

File

./views_xml.module, line 355
views_xml.module - provides Views plugin for rendering node content as XML.

Code

function views_xml_strip_illegal_chars($input) {

  //  $output = preg_replace('/[\x{80}-\x{A0}'. // Non-printable ISO-8859-1 + NBSP
  //        '\x{01}-\x{1F}'. //Non-printable ASCII characters
  //        '\x{AD}'. // Soft-hyphen
  //        '\x{2000}-\x{200F}'. // Various space characters
  //        '\x{2028}-\x{202F}'. // Bidirectional text overrides
  //        '\x{205F}-\x{206F}'. // Various text hinting characters
  //        '\x{FEFF}'. // Byte order mark
  //        '\x{FF01}-\x{FF60}'. // Full-width latin
  //        '\x{FFF9}-\x{FFFD}'. // Replacement characters
  //        '\x{0}]/u', // NULL byte
  //        '', $input);
  //  $output = preg_replace('/\x((10?|[2-F])FFF[EF]|FDD[0-9A-F]|[19][0-9A-F]|7F|8[0-46-9A-F]|0?[1-8BCEF])/', '', $input);
  //  $output = str_replace('"', '"', $output); //encode quote
  //  $output = str_replace('&', '&', $output); //encode ampersand
  //  $output = str_replace("'", '&pos;', $output); //encode apostrophe
  //  $output = str_replace('<', '&lt;', $output); //encode left-angled bracket
  //  $output = str_replace('>', '&gt;', $output); //encode right-angled bracket
  return check_plain(strip_tags($input));
}