X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FUtil%2FParseUrl.php;h=33828848391410a843475080905a30d41af1eaa7;hb=e02c475c9e98f27f631bd245592f1641c181db72;hp=f21528353d3fee175d1259b0c3b86ca501777031;hpb=1874a32728142f2c12724562eb122eb1cd1370fe;p=friendica.git diff --git a/src/Util/ParseUrl.php b/src/Util/ParseUrl.php index f21528353d..3382884839 100644 --- a/src/Util/ParseUrl.php +++ b/src/Util/ParseUrl.php @@ -24,6 +24,8 @@ namespace Friendica\Util; use DOMDocument; use DOMXPath; use Friendica\Content\OEmbed; +use Friendica\Content\Text\HTML; +use Friendica\Protocol\HTTP\MediaType; use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Database\Database; @@ -89,7 +91,7 @@ class ParseUrl } /** - * Search for chached embeddable data of an url otherwise fetch it + * Search for cached embeddable data of an url otherwise fetch it * * @param string $url The url of the page which should be scraped * @param bool $do_oembed The false option is used by the function fetch_oembed() @@ -283,25 +285,13 @@ class ParseUrl } $charset = ''; - // Look for a charset, first in headers - // 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