You are here

function _views_oai_pmh_xmlstr in Views OAI-PMH 6

Same name and namespace in other branches
  1. 7 theme/views_oai_pmh.theme.inc \_views_oai_pmh_xmlstr()
  2. 7.2 theme/views_oai_pmh.theme.inc \_views_oai_pmh_xmlstr()
1 call to _views_oai_pmh_xmlstr()
theme_views_oai_pmh_row_dc_fields in theme/views_oai_pmh.theme.inc
@file Theme related functions for processing our output style plugins.

File

theme/views_oai_pmh.theme.inc, line 172
Theme related functions for processing our output style plugins.

Code

function _views_oai_pmh_xmlstr($string, $charset = 'iso8859-1', $xmlescaped = 'false') {
  $xmlstr = stripslashes(trim($string));

  // just remove invalid characters
  $pattern = "/[\\x-\10\v-\f\16-\37]/";
  $xmlstr = preg_replace($pattern, '', $xmlstr);

  // escape only if string is not escaped
  if (!$xmlescaped) {
    $xmlstr = htmlspecialchars($xmlstr, ENT_QUOTES);
  }
  return $xmlstr;
}