diff options
author | habeascodice <habeascodice@federated.social> | 2014-10-09 01:06:59 -0700 |
---|---|---|
committer | habeascodice <habeascodice@federated.social> | 2014-10-09 01:06:59 -0700 |
commit | 7a106cf60cfa005ec6d8c35f922dc57b9af0175e (patch) | |
tree | 34b0593f9922f33d9e2c2c517ba9f6e9d3490c44 /include/oembed.php | |
parent | 737a3362d50900a5f26aada14f515c5c857a762f (diff) | |
parent | fc0576acf810019a0c168bfa4dc4a2175ae0b505 (diff) | |
download | volse-hubzilla-7a106cf60cfa005ec6d8c35f922dc57b9af0175e.tar.gz volse-hubzilla-7a106cf60cfa005ec6d8c35f922dc57b9af0175e.tar.bz2 volse-hubzilla-7a106cf60cfa005ec6d8c35f922dc57b9af0175e.zip |
Merge remote branch 'upstream/master'
Diffstat (limited to 'include/oembed.php')
-rwxr-xr-x | include/oembed.php | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/include/oembed.php b/include/oembed.php index de3a6edc8..e08b287d1 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -56,6 +56,15 @@ function oembed_fetch_url($embedurl){ $txt = $x['body']; break; } + // soundcloud is now using text/json+oembed instead of application/json+oembed, + // others may be also + $entries = $xpath->query("//link[@type='text/json+oembed']"); + foreach($entries as $e){ + $href = $e->getAttributeNode("href")->nodeValue; + $x = z_fetch_url($href . '&maxwidth=' . $a->videowidth); + $txt = $x['body']; + break; + } } } } @@ -83,7 +92,8 @@ function oembed_fetch_url($embedurl){ function oembed_format_object($j){ $a = get_app(); $embedurl = $j->embedurl; - $jhtml = oembed_iframe($j->embedurl,(isset($j->width) ? $j->width : null), (isset($j->height) ? $j->height : null) ); + + $jhtml = oembed_iframe($j->embedurl,(isset($j->width) ? $j->width : null), (isset($j->height) ? $j->height : null)); $ret="<span class='oembed ".$j->type."'>"; switch ($j->type) { @@ -118,7 +128,6 @@ function oembed_format_object($j){ }; break; case "photo": { $ret.= "<img width='".$j->width."' src='".$j->url."'>"; - //$ret.= "<img width='".$j->width."' height='".$j->height."' src='".$j->url."'>"; $ret.="<br>"; }; break; case "link": { @@ -154,13 +163,12 @@ function oembed_iframe($src,$width,$height) { $height = intval($height) + 80; $width = intval($width) + 40; - $a = get_app(); - - $sandbox = ((strpos($src,get_app()->get_hostname())) ? ' sandbox="allow-scripts" ' : ''); + $s = z_root() . '/oembed/' . base64url_encode($src); - $s = $a->get_baseurl()."/oembed/".base64url_encode($src); + // Make sure any children are sandboxed within their own iframe. - return '<iframe ' . $sandbox . ' height="' . $height . '" width="' . $width . '" src="' . $s . '" frameborder="no" >' . t('Embedded content') . '</iframe>'; + return '<iframe height="' . $height . '" width="' . $width . '" src="' . $s . '" frameborder="no" >' + . t('Embedded content') . '</iframe>'; } |