use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
-use Friendica\Core\System;
use Friendica\Database\DBA;
+use Friendica\DI;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
use Friendica\Util\ParseUrl;
{
$embedurl = trim($embedurl, '\'"');
- $a = \get_app();
+ $a = DI::app();
$cache_key = 'oembed:' . $a->videowidth . ':' . $embedurl;
if (!in_array($ext, $noexts)) {
// try oembed autodiscovery
- $redirects = 0;
- $html_text = Network::fetchUrl($embedurl, false, $redirects, 15, 'text/*');
+ $html_text = Network::fetchUrl($embedurl, false, 15, 'text/*');
if ($html_text) {
- $dom = new DOMDocument();
- $dom->loadHTML($html_text);
+ $dom = @DOMDocument::loadHTML($html_text);
if ($dom) {
$xpath = new DOMXPath($dom);
$entries = $xpath->query("//link[@type='application/json+oembed']");
$tw = $th * $tr;
$tpl = Renderer::getMarkupTemplate('oembed_video.tpl');
$ret .= Renderer::replaceMacros($tpl, [
- '$baseurl' => System::baseUrl(),
'$embedurl' => $oembed->embed_url,
'$escapedhtml' => base64_encode($oembed->html),
'$tw' => $tw,
$html_text = mb_convert_encoding($text, 'HTML-ENTITIES', mb_detect_encoding($text));
// If it doesn't parse at all, just return the text.
- $dom = new DOMDocument();
- $dom->loadHTML($html_text);
+ $dom = @DOMDocument::loadHTML($html_text);
if (!$dom) {
return $text;
}
}
$width = '100%';
- $src = System::baseUrl() . '/oembed/' . Strings::base64UrlEncode($src);
+ $src = DI::baseUrl() . '/oembed/' . Strings::base64UrlEncode($src);
return '<iframe onload="resizeIframe(this);" class="embed_rich" height="' . $height . '" width="' . $width . '" src="' . $src . '" allowfullscreen scrolling="no" frameborder="no">' . L10n::t('Embedded content') . '</iframe>';
}