more oembed provider work - channel articles

This commit is contained in:
redmatrix
2016-02-01 14:52:08 -08:00
parent 01b5b13475
commit ff487a0271
5 changed files with 154 additions and 4 deletions

View File

@@ -53,6 +53,10 @@ function oembed_fetch_url($embedurl){
$a = get_app();
$embedurl = str_replace('&','&', $embedurl);
// logger('fetch: ' . $embedurl);
$txt = Cache::get($a->videowidth . $embedurl);
if(strstr($txt,'youtu') && strstr(z_root(),'https:')) {
@@ -120,20 +124,29 @@ function oembed_fetch_url($embedurl){
if ($txt[0]!="{") $txt='{"type":"error"}';
//save in cache
Cache::set($a->videowidth . $embedurl,$txt);
if(! get_config('system','oembed_cache_disable'))
Cache::set($a->videowidth . $embedurl,$txt);
}
$j = json_decode($txt);
$j->embedurl = $embedurl;
// logger('fetch return: ' . print_r($j,true));
return $j;
}
function oembed_format_object($j){
$a = get_app();
$embedurl = $j->embedurl;
// logger('format: ' . print_r($j,true));
$jhtml = oembed_iframe($j->embedurl,(isset($j->width) ? $j->width : null), (isset($j->height) ? $j->height : null));
$ret="<span class='oembed ".$j->type."'>";