New functions to check if a contact supports that protocol

This commit is contained in:
Michael 2019-07-27 11:09:12 +00:00
parent d75e3e1650
commit 264936100f
4 changed files with 81 additions and 17 deletions

View file

@ -2302,4 +2302,19 @@ class OStatus
return trim($doc->saveXML());
}
/**
* Checks if the given contact url does support OStatus
*
* @param string $url profile url
* @param boolean $update Update the profile
* @return boolean
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function isSupportedByContactUrl($url, $update = false)
{
$probe = Probe::uri($url, Protocol::OSTATUS, 0, !$update);
return $probe['network'] == Protocol::OSTATUS;
}
}