Browse Source

Merge pull request #411 from jordandukart/7.x

Add sanitation function.
pull/412/merge
Adam 11 years ago
parent
commit
f824bf4d8f
  1. 16
      includes/utilities.inc

16
includes/utilities.inc

@ -908,3 +908,19 @@ function islandora_as_renderable_array(&$markup_array) {
} }
unset($value); unset($value);
} }
/**
* Sanitizes an input string to be valid XML.
*
* @param string $input
* An input string.
* @param string $replacement
* What we are replacing invalid characters with, defaults to ''.
*
* @return string
* The sanitized string.
*/
function islandora_sanitize_input_for_valid_xml($input, $replacement = '') {
$input = preg_replace('/[^\x9\xA\xD\x20-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}]/u', $replacement, $input);
return $input;
}

Loading…
Cancel
Save