PHP modifier to sanitize (remove any hostile characters) from any given string
function sanitize($value) {
$value = preg_replace('/[\x00-\x1f\?*:";|\/°^!§$%&\\()=´`+#\':,<>]/', '', trim($value));
$value = preg_replace('/^(?:PRN|AUX|CLOCK\$|NUL|CON|COM\d|LPT\d)(?:\.*)(.*)/', '\1', $value);
return $value;
}