if (!in_array($ext, $noexts)) {
// try oembed autodiscovery
$html_text = DI::httpRequest()->fetch($embedurl, 15, 'text/*');
- if ($html_text) {
+ if (!empty($html_text)) {
$dom = new DOMDocument();
if (@$dom->loadHTML($html_text)) {
$xpath = new DOMXPath($dom);
// if its not a picture then look if its a page that contains a picture link
$body = DI::httpRequest()->fetch($match[1]);
-
+ if (empty($body)) {
+ DI::cache()->set($cache_key, $text);
+ return $text;
+ }
+
$doc = new DOMDocument();
@$doc->loadHTML($body);
$xpath = new DOMXPath($doc);
private static function cleanPictureLinksCallback($match)
{
- $a = DI::app();
-
// When the picture link is the own photo path then we can avoid fetching the link
$own_photo_url = preg_quote(Strings::normaliseLink(DI::baseUrl()->get()) . '/photos/');
if (preg_match('|' . $own_photo_url . '.*?/image/|', Strings::normaliseLink($match[1]))) {
// if its not a picture then look if its a page that contains a picture link
$body = DI::httpRequest()->fetch($match[1]);
+ if (empty($body)) {
+ DI::cache()->set($cache_key, $text);
+ return $text;
+ }
$doc = new DOMDocument();
@$doc->loadHTML($body);
// Collecting all links
$urls = self::collectURLs($message);
+ if (empty($message)) {
+ return '';
+ }
+
@$doc->loadHTML($message, LIBXML_HTML_NODEFDTD);
self::tagToBBCode($doc, 'html', [], '', '');
*/
private static function analyseRootBody($curlResult, array $serverdata, string $url)
{
+ if (empty($curlResult->getBody())) {
+ return $serverdata;
+ }
+
$doc = new DOMDocument();
@$doc->loadHTML($curlResult->getBody());
$xpath = new DOMXPath($doc);
}
$body = $curlResult->getBody();
+ if (empty($body)) {
+ return false;
+ }
$doc = new DOMDocument();
@$doc->loadHTML($body);
return [];
}
$content = $curlResult->getBody();
- if (!$content) {
+ if (empty($content)) {
return [];
}
private static function pumpioProfileData($profile_link)
{
$curlResult = DI::httpRequest()->get($profile_link);
- if (!$curlResult->isSuccess()) {
+ if (!$curlResult->isSuccess() || empty($curlResult->getBody())) {
return [];
}
$curlResult = DI::httpRequest()->get($conversation, ['accept_content' => 'application/atom+xml, text/html']);
- if (!$curlResult->isSuccess()) {
+ if (!$curlResult->isSuccess() || empty($curlResult->getBody())) {
return;
}
$stored = false;
$curlResult = DI::httpRequest()->get($related, ['accept_content' => 'application/atom+xml, text/html']);
- if (!$curlResult->isSuccess()) {
+ if (!$curlResult->isSuccess() || empty($curlResult->getBody())) {
return;
}
}
$curlResult = DI::httpRequest()->get($url);
- if (!$curlResult->isSuccess()) {
+ if (!$curlResult->isSuccess() || empty($curlResult->getBody())) {
return $siteinfo;
}