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");
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);
}
}
- 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) {
}
}
+ // add url scheme if missing
+ $arrurl = parse_url($url);
+ if (!x($arrurl, 'scheme')) {
+ if (x($arrurl, 'host'))
+ $url = "http:".$url;
+ else
+ $url = "http://".$url;
+ }
+
logger('parse_url: ' . $url);
if($textmode)
$sitedata = "";
- if($siteinfo["title"] == "") {
- $sitedata .= sprintf($template,$url,$url,'') . $str_tags;
- killme();
- } else {
+ if($siteinfo["title"] != "") {
$text = $siteinfo["text"];
$title = $siteinfo["title"];
}