use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
use Friendica\Util\ParseUrl;
use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
use Friendica\Util\ParseUrl;
use Friendica\Util\Proxy as ProxyUtils;
* @param bool $no_rich_type If set to true rich type content won't be fetched.
*
* @return \Friendica\Object\OEmbed
* @param bool $no_rich_type If set to true rich type content won't be fetched.
*
* @return \Friendica\Object\OEmbed
*/
public static function fetchURL($embedurl, $no_rich_type = false)
{
$embedurl = trim($embedurl, '\'"');
*/
public static function fetchURL($embedurl, $no_rich_type = false)
{
$embedurl = trim($embedurl, '\'"');
$oembed_record = DBA::selectFirst('oembed', ['content'], $condition);
if (DBA::isResult($oembed_record)) {
$json_string = $oembed_record['content'];
$oembed_record = DBA::selectFirst('oembed', ['content'], $condition);
if (DBA::isResult($oembed_record)) {
$json_string = $oembed_record['content'];
if (!in_array($ext, $noexts)) {
// try oembed autodiscovery
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/*');
'maxwidth' => $a->videowidth,
'content' => $json_string,
'created' => DateTimeFormat::utcNow()
'maxwidth' => $a->videowidth,
'content' => $json_string,
'created' => DateTimeFormat::utcNow()
- $tpl = get_markup_template('oembed_video.tpl');
- $ret .= replace_macros($tpl, [
- '$baseurl' => System::baseUrl(),
+ $tpl = Renderer::getMarkupTemplate('oembed_video.tpl');
+ $ret .= Renderer::replaceMacros($tpl, [
'$embedurl' => $oembed->embed_url,
'$escapedhtml' => base64_encode($oembed->html),
'$tw' => $tw,
'$embedurl' => $oembed->embed_url,
'$escapedhtml' => base64_encode($oembed->html),
'$tw' => $tw,
- $ret = str_replace("\n", "", $ret);
- return mb_convert_encoding($ret, 'HTML-ENTITIES', mb_detect_encoding($ret));
+ return str_replace("\n", "", $ret);
/**
* Find <span class='oembed'>..<a href='url' rel='oembed'>..</a></span>
* and replace it with [embed]url[/embed]
/**
* Find <span class='oembed'>..<a href='url' rel='oembed'>..</a></span>
* and replace it with [embed]url[/embed]
* Since the iframe is automatically resized on load, there are no need for ugly
* and impractical scrollbars.
*
* Since the iframe is automatically resized on load, there are no need for ugly
* and impractical scrollbars.
*