aboutsummaryrefslogtreecommitdiffstats
path: root/include/oembed.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/oembed.php')
-rwxr-xr-xinclude/oembed.php31
1 files changed, 19 insertions, 12 deletions
diff --git a/include/oembed.php b/include/oembed.php
index 520b69892..d8671a752 100755
--- a/include/oembed.php
+++ b/include/oembed.php
@@ -1,12 +1,10 @@
<?php /** @file */
function oembed_replacecb($matches){
-// logger('oembedcb');
+
$embedurl=$matches[1];
$j = oembed_fetch_url($embedurl);
- $s = oembed_format_object($j);
- return $s;//oembed_iframe($s,$j->width,$j->height);
-
-
+ $s = oembed_format_object($j);
+ return $s;
}
@@ -26,7 +24,21 @@ function oembed_fetch_url($embedurl){
if(is_null($txt)){
$txt = "";
- if (!in_array($ext, $noexts)){
+ if (in_array($ext, $noexts)) {
+ $m = @parse_url($embedurl);
+ $zrl = false;
+ if($m['host']) {
+ $r = q("select hubloc_url from hubloc where hubloc_host = '%s' limit 1",
+ dbesc($m['host'])
+ );
+ if($r)
+ $zrl = true;
+ }
+ if($zrl) {
+ $embedurl = zid($embedurl);
+ }
+ }
+ else {
// try oembed autodiscovery
$redirects = 0;
@@ -57,12 +69,6 @@ function oembed_fetch_url($embedurl){
call_hooks('oembed_probe',$x);
if(array_key_exists('embed',$x))
$txt = $x['embed'];
-
- // try oohembed service
-// $ourl = "http://oohembed.com/oohembed/?url=".urlencode($embedurl).'&maxwidth=' . $a->videowidth;
-// $result = z_fetch_url($ourl);
-// if($result['success'])
-// $txt = $result['body'];
}
$txt=trim($txt);
@@ -82,6 +88,7 @@ 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) );
+
$ret="<span class='oembed ".$j->type."'>";
switch ($j->type) {
case "video": {