]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/DFRN.php
New functions to check if a contact supports that protocol
[friendica.git] / src / Protocol / DFRN.php
index 5fceab3264d7ab9cc70056c7db2486db4c991124..e8196172ebae7d4d8a3414881684a36e62d9eb56 100644 (file)
@@ -29,6 +29,7 @@ use Friendica\Model\Mail;
 use Friendica\Model\PermissionSet;
 use Friendica\Model\Profile;
 use Friendica\Model\User;
+use Friendica\Network\Probe;
 use Friendica\Object\Image;
 use Friendica\Util\BaseURL;
 use Friendica\Util\Crypto;
@@ -3041,4 +3042,19 @@ class DFRN
 
                return (strcmp($existing_edited, $update_edited) < 0);
        }
+
+       /**
+        * Checks if the given contact url does support DFRN
+        *
+        * @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::DFRN, 0, !$update);
+               return $probe['network'] == Protocol::DFRN;
+       }
 }