X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FUtil%2FParseUrl.php;h=4611cf8efe5f25378caa699044543af6269bab4c;hb=b5ad8c3e153976cf3e63753597377f09852d98d7;hp=8d8329675862779ca3cf2e2b2c511bfd07dfeb49;hpb=cc75eb5d18a78f68bbe1ea58ffab71bdad42e76a;p=friendica.git diff --git a/src/Util/ParseUrl.php b/src/Util/ParseUrl.php index 8d83296758..4611cf8efe 100644 --- a/src/Util/ParseUrl.php +++ b/src/Util/ParseUrl.php @@ -60,7 +60,7 @@ class ParseUrl * @param int $timeout * @return array content type */ - public static function getContentType(string $url, string $accept = HttpClientAccept::DEFAULT, int $timeout = 0) + public static function getContentType(string $url, string $accept = HttpClientAccept::DEFAULT, int $timeout = 0): array { if (!empty($timeout)) { $options = [HttpClientOptions::TIMEOUT => $timeout]; @@ -108,7 +108,7 @@ class ParseUrl * @see ParseUrl::getSiteinfo() for more information about scraping * embeddable content */ - public static function getSiteinfoCached($url, $do_oembed = true): array + public static function getSiteinfoCached(string $url, bool $do_oembed = true): array { if (empty($url)) { return [ @@ -187,7 +187,7 @@ class ParseUrl * * @endverbatim */ - public static function getSiteinfo($url, $do_oembed = true, $count = 1) + public static function getSiteinfo(string $url, bool $do_oembed = true, int $count = 1): array { if (empty($url)) { return [ @@ -214,7 +214,7 @@ class ParseUrl ]; if ($count > 10) { - Logger::notice('Endless loop detected', ['url' => $url]); + Logger::warning('Endless loop detected', ['url' => $url]); return $siteinfo; } @@ -287,22 +287,22 @@ class ParseUrl // Expected form: Content-Type: text/html; charset=ISO-8859-4 if (preg_match('/charset=([a-z0-9-_.\/]+)/i', $curlResult->getContentType(), $matches)) { $charset = trim(trim(trim(array_pop($matches)), ';,')); + } else { + // Then in body that gets precedence + // Expected forms: + // - + // - + // - + // - + // We escape