function convert_metadata($xmldata)
{
$config = SimpleSAML_Configuration::getInstance();
if ($xmldata) {
$xmldata = htmlspecialchars_decode($xmldata);
SimpleSAML_Utilities::validateXMLDocument($xmldata, 'saml-meta');
$entities = SimpleSAML_Metadata_SAMLParser::parseDescriptorsString($xmldata);
foreach ($entities as &$entity) {
$entity = array('shib13-sp-remote' => $entity->getMetadata1xSP(), 'shib13-idp-remote' => $entity->getMetadata1xIdP(), 'saml20-sp-remote' => $entity->getMetadata20SP(), 'saml20-idp-remote' => $entity->getMetadata20IdP());
}
$output = array($entity['saml20-sp-remote']['entityid'] => $entity['saml20-sp-remote']);
} else {
$xmldata = '';
$output = array();
}
return $output;
}