]> git.mxchange.org Git - friendica.git/blobdiff - src/Network/Probe.php
Merge pull request #7090 from nupplaphil/task/mod_like
[friendica.git] / src / Network / Probe.php
index 008106ec3f41f6f60fd2b56d23286219465c803b..b0d2630103beaed42328d4aa61cee75a08a3d57f 100644 (file)
@@ -10,6 +10,7 @@ namespace Friendica\Network;
  */
 
 use DOMDocument;
+use DomXPath;
 use Friendica\Core\Cache;
 use Friendica\Core\Config;
 use Friendica\Core\Logger;
@@ -18,15 +19,14 @@ use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\Model\Contact;
 use Friendica\Model\Profile;
+use Friendica\Protocol\ActivityPub;
 use Friendica\Protocol\Email;
 use Friendica\Protocol\Feed;
-use Friendica\Protocol\ActivityPub;
 use Friendica\Util\Crypto;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
 use Friendica\Util\Strings;
 use Friendica\Util\XML;
-use DomXPath;
 
 /**
  * @brief This class contain functions for probing URL
@@ -510,30 +510,6 @@ class Probe
                return $data;
        }
 
-       /**
-        * @brief Switch the scheme of an url between http and https
-        *
-        * @param string $url URL
-        *
-        * @return string switched URL
-        */
-       private static function switchScheme($url)
-       {
-               $parts = parse_url($url);
-
-               if (!isset($parts['scheme'])) {
-                       return $url;
-               }
-
-               if ($parts['scheme'] == 'http') {
-                       $url = str_replace('http://', 'https://', $url);
-               } elseif ($parts['scheme'] == 'https') {
-                       $url = str_replace('https://', 'http://', $url);
-               }
-
-               return $url;
-       }
-
        /**
         * @brief Checks if a profile url should be OStatus but only provides partial information
         *
@@ -566,7 +542,7 @@ class Probe
                        return $webfinger;
                }
 
-               $url = self::switchScheme($webfinger['subject']);
+               $url = Network::switchScheme($webfinger['subject']);
                $path = str_replace('{uri}', urlencode($url), $lrdd);
                $webfinger2 = self::webfinger($path, $type);