/** * @param string $matches * @return string */ static function normalizeCharReferencesCallback($matches) { $ret = null; if ($matches[1] != '') { $ret = Sanitizer::normalizeEntity($matches[1]); } elseif ($matches[2] != '') { $ret = Sanitizer::decCharReference($matches[2]); } elseif ($matches[3] != '') { $ret = Sanitizer::hexCharReference($matches[3]); } if (is_null($ret)) { return htmlspecialchars($matches[0]); } else { return $ret; } }