use Friendica\Core\Cache;
use Friendica\Core\Config;
use Friendica\Core\L10n;
+use Friendica\Core\Renderer;
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;
require_once 'include/dba.php';
-require_once 'mod/proxy.php';
/**
* Handles all OEmbed content fetching and replacement
*
* @see https://oembed.com
*
- * @author Hypolite Petovan <mrpetovan@gmail.com>
+ * @author Hypolite Petovan <hypolite@mrpetovan.com>
*/
class OEmbed
{
'content' => $json_string,
'created' => DateTimeFormat::utcNow()
], true);
- $cache_ttl = CACHE_DAY;
+ $cache_ttl = Cache::DAY;
} else {
- $cache_ttl = CACHE_FIVE_MINUTES;
+ $cache_ttl = Cache::FIVE_MINUTES;
}
Cache::set($cache_key, $json_string, $cache_ttl);
$oembed->description = $data['text'];
}
- if (is_array($data['images'])) {
+ if (!empty($data['images'])) {
$oembed->thumbnail_url = $data['images'][0]['src'];
$oembed->thumbnail_width = $data['images'][0]['width'];
$oembed->thumbnail_height = $data['images'][0]['height'];
$th = 120;
$tw = $th * $tr;
- $tpl = get_markup_template('oembed_video.tpl');
- $ret .= replace_macros($tpl, [
+ $tpl = Renderer::getMarkupTemplate('oembed_video.tpl');
+ $ret .= Renderer::replaceMacros($tpl, [
'$baseurl' => System::baseUrl(),
'$embedurl' => $oembed->embed_url,
'$escapedhtml' => base64_encode($oembed->html),
$ret = $oembed->html;
}
break;
+
case "photo":
- $ret .= '<img width="' . $oembed->width . '" src="' . proxy_url($oembed->url) . '">';
+ $ret .= '<img width="' . $oembed->width . '" src="' . ProxyUtils::proxifyUrl($oembed->url) . '">';
break;
+
case "link":
break;
+
case "rich":
- $ret .= proxy_parse_html($oembed->html);
+ $ret .= ProxyUtils::proxifyHtml($oembed->html);
break;
}