<?php
+
/**
* @file src/Content/OEmbed.php
*/
use Friendica\Core\Addon;
use Friendica\Core\Cache;
+use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System;
-use Friendica\Core\Config;
use Friendica\Database\DBM;
+use Friendica\Util\DateTimeFormat;
+use Friendica\Util\Network;
use Friendica\Util\ParseUrl;
use dba;
use DOMDocument;
-use DOMXPath;
use DOMNode;
+use DOMText;
+use DOMXPath;
use Exception;
require_once 'include/dba.php';
if (!in_array($ext, $noexts)) {
// try oembed autodiscovery
$redirects = 0;
- $html_text = fetch_url($embedurl, false, $redirects, 15, "text/*");
+ $html_text = Network::fetchUrl($embedurl, false, $redirects, 15, "text/*");
if ($html_text) {
$dom = @DOMDocument::loadHTML($html_text);
if ($dom) {
$entries = $xpath->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;
}
}
'url' => normalise_link($embedurl),
'maxwidth' => $a->videowidth,
'content' => $txt,
- 'created' => datetime_convert()
+ 'created' => DateTimeFormat::utcNow()
], true);
}
$allowed = explode(',', $str_allowed);
- return allowed_domain($domain, $allowed);
+ return Network::isDomainAllowed($domain, $allowed);
}
public static function getHTML($url, $title = null)