X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FContent%2FOEmbed.php;h=360a0dc4899439949d7addf0de0b99bcf088d469;hb=0360f7197aac062eb2fecf95969658ca56068deb;hp=9f1df5174566bdca08e5be7493ad5d70fcb35c22;hpb=07d306aa3736aa8a0b46109b15a6c637919c33b1;p=friendica.git diff --git a/src/Content/OEmbed.php b/src/Content/OEmbed.php index 9f1df51745..360a0dc489 100644 --- a/src/Content/OEmbed.php +++ b/src/Content/OEmbed.php @@ -1,4 +1,5 @@ query("//link[@type='application/json+oembed']"); foreach ($entries as $e) { $href = $e->getAttributeNode("href")->nodeValue; - $txt = fetch_url($href . '&maxwidth=' . $a->videowidth); + $txt = Network::fetchUrl($href . '&maxwidth=' . $a->videowidth); break; } $entries = $xpath->query("//link[@type='text/json+oembed']"); foreach ($entries as $e) { $href = $e->getAttributeNode("href")->nodeValue; - $txt = fetch_url($href . '&maxwidth=' . $a->videowidth); + $txt = Network::fetchUrl($href . '&maxwidth=' . $a->videowidth); break; } } @@ -104,12 +108,12 @@ class OEmbed $txt = '{"type":"error"}'; } else { //save in cache $j = json_decode($txt); - if ($j->type != "error") { + if (!empty($j->type) && $j->type != "error") { dba::insert('oembed', [ 'url' => normalise_link($embedurl), 'maxwidth' => $a->videowidth, 'content' => $txt, - 'created' => datetime_convert() + 'created' => DateTimeFormat::utcNow() ], true); } @@ -311,7 +315,7 @@ class OEmbed $allowed = explode(',', $str_allowed); - return allowed_domain($domain, $allowed); + return Network::isDomainAllowed($domain, $allowed); } public static function getHTML($url, $title = null)