You are here

function views_rdf_strip_illegal_chars in Views Datasource 5

Same name and namespace in other branches
  1. 6 views_rdf.module \views_rdf_strip_illegal_chars()
  2. 7 views_rdf.module \views_rdf_strip_illegal_chars()

Strips illegal Unicode characters and encodes entities in string

Parameters

string $input:

Return value

string

2 calls to views_rdf_strip_illegal_chars()
views_rdf_foaf_xml_render in ./views_rdf.module
views_rdf_sioc_xml_render in ./views_rdf.module

File

./views_rdf.module, line 472
Provides Views plugin for rendering node content as RDF.

Code

function views_rdf_strip_illegal_chars($input) {
  $output = preg_replace('/[\\x{80}-\\x{A0}' . '\\x{01}-\\x{1F}' . '\\x{AD}' . '\\x{2000}-\\x{200F}' . '\\x{2028}-\\x{202F}' . '\\x{205F}-\\x{206F}' . '\\x{FEFF}' . '\\x{FF01}-\\x{FF60}' . '\\x{FFF9}-\\x{FFFD}' . '\\x{0}]/u', '', $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('>', '&rt;', $output); //encode right-angled bracket
  return check_plain(strip_tags($output));
}