13 lines
507 B
PHP
13 lines
507 B
PHP
<?php
|
|
|
|
function smarty_modifier_xml_string($string)
|
|
{
|
|
$string = html_entity_decode($string, ENT_QUOTES, 'UTF-8');
|
|
// beware of the order of search@replace values
|
|
// str_replace() replaces left to right, it might replace a previously inserted value when doing multiple replacements
|
|
$string = str_replace(['&', '<', '>'], ['&', '<', '>'], $string);
|
|
$string = preg_replace('/[^\x{0009}\x{000a}\x{000d}\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}]+/u', ' ', $string);
|
|
|
|
return $string;
|
|
}
|