From: Hypolite Petovan Date: Thu, 25 Jun 2020 01:07:49 +0000 (-0400) Subject: Add support for mobile profile URL to core twitter probing X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2c2db55298fee0281b6099dd595cbf364c2b0286;p=friendica.git Add support for mobile profile URL to core twitter probing --- diff --git a/src/Network/Probe.php b/src/Network/Probe.php index 879ccf7fef..41682572cd 100644 --- a/src/Network/Probe.php +++ b/src/Network/Probe.php @@ -692,7 +692,7 @@ class Probe $parts = parse_url($uri); if (!empty($parts['scheme']) && !empty($parts['host'])) { - if ($parts['host'] == 'twitter.com') { + if (in_array($parts['host'], ['twitter.com', 'mobile.twitter.com'])) { return self::twitter($uri); } } elseif (strstr($uri, '@')) { @@ -706,7 +706,9 @@ class Probe return self::mail($uri, $uid); } - if (strpos($uri, '@twitter.com')) { + if (Strings::endsWith($uri, '@twitter.com') + || Strings::endsWith($uri, '@mobile.twitter.com') + ) { return self::twitter($uri); } } else { @@ -1720,9 +1722,9 @@ class Probe */ private static function twitter($uri) { - if (preg_match('=(.*)@twitter.com=i', $uri, $matches)) { + if (preg_match('=([^@]+)@(?:mobile\.)?twitter\.com$=i', $uri, $matches)) { $nick = $matches[1]; - } elseif (preg_match('=https?://twitter.com/(.*)=i', $uri, $matches)) { + } elseif (preg_match('=^https?://(?:mobile\.)?twitter\.com/(.+)=i', $uri, $matches)) { $nick = $matches[1]; } else { return [];