/** * @param string $matches * @return string */ static function decodeCharReferencesCallback($matches) { if ($matches[1] != '') { return Sanitizer::decodeEntity($matches[1]); } elseif ($matches[2] != '') { return Sanitizer::decodeChar(intval($matches[2])); } elseif ($matches[3] != '') { return Sanitizer::decodeChar(hexdec($matches[3])); } # Last case should be an ampersand by itself return $matches[0]; }