X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fparse_url.php;h=71d767675f8c51a1b3cba44b3edae4e2bd0c7bf8;hb=5f89cb09234bc79aab2be93778609b344239c3da;hp=7f4bd29a08b292728e2c07b3bb0f457c796420c3;hpb=f1c6d6f1ba2246d75b603335abf03368f7b46f29;p=friendica.git diff --git a/mod/parse_url.php b/mod/parse_url.php index 7f4bd29a08..71d767675f 100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -97,6 +97,14 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co return($siteinfo); } + // if the file is too large then exit + if ($curl_info["download_content_length"] > 1000000) + return($siteinfo); + + // if it isn't a HTML file then exit + if (($curl_info["content_type"] != "") AND !strstr(strtolower($curl_info["content_type"]),"html")) + return($siteinfo); + if ($do_oembed) { require_once("include/oembed.php"); @@ -104,15 +112,16 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co if ($oembed_data->type != "error") $siteinfo["type"] = $oembed_data->type; - } - - // if the file is too large then exit - if ($curl_info["download_content_length"] > 1000000) - return($siteinfo); - // if it isn't a HTML file then exit - if (($curl_info["content_type"] != "") AND !strstr(strtolower($curl_info["content_type"]),"html")) - return($siteinfo); + if (($oembed_data->type == "link") AND ($siteinfo["type"] != "photo")) { + if (isset($oembed_data->title)) + $siteinfo["title"] = $oembed_data->title; + if (isset($oembed_data->description)) + $siteinfo["text"] = trim($oembed_data->description); + if (isset($oembed_data->thumbnail_url)) + $siteinfo["image"] = $oembed_data->thumbnail_url; + } + } $stamp1 = microtime(true); @@ -283,15 +292,6 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co } } - if (isset($oembed_data) AND ($oembed_data->type == "link") AND ($siteinfo["type"] != "photo")) { - if (isset($oembed_data->title) AND (trim($oembed_data->title) != "")) - $siteinfo["title"] = $oembed_data->title; - if (isset($oembed_data->description) AND (trim($oembed_data->description) != "")) - $siteinfo["text"] = trim($oembed_data->description); - if (isset($oembed_data->thumbnail_url) AND (trim($oembed_data->thumbnail_url) != "")) - $siteinfo["image"] = $oembed_data->thumbnail_url; - } - if ((@$siteinfo["image"] == "") AND !$no_guessing) { $list = $xpath->query("//img[@src]"); foreach ($list as $node) {