aboutsummaryrefslogtreecommitdiffstats
path: root/include/oembed.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/oembed.php')
-rwxr-xr-xinclude/oembed.php25
1 files changed, 19 insertions, 6 deletions
diff --git a/include/oembed.php b/include/oembed.php
index 6fc4c5371..520b69892 100755
--- a/include/oembed.php
+++ b/include/oembed.php
@@ -1,4 +1,4 @@
-<?php
+<?php /** @file */
function oembed_replacecb($matches){
// logger('oembedcb');
$embedurl=$matches[1];
@@ -29,7 +29,11 @@ function oembed_fetch_url($embedurl){
if (!in_array($ext, $noexts)){
// try oembed autodiscovery
$redirects = 0;
- $html_text = fetch_url($embedurl, false, $redirects, 15, "text/*");
+
+ $result = z_fetch_url($embedurl, false, $redirects, array('timeout' => 15, 'accept_content' => "text/*", 'novalidate' => true ));
+ if($result['success'])
+ $html_text = $result['body'];
+
if($html_text){
$dom = @DOMDocument::loadHTML($html_text);
if ($dom){
@@ -40,17 +44,25 @@ function oembed_fetch_url($embedurl){
$entries = $xpath->query("//link[@type='application/json+oembed']");
foreach($entries as $e){
$href = $e->getAttributeNode("href")->nodeValue;
- $txt = fetch_url($href . '&maxwidth=' . $a->videowidth);
+ $x = z_fetch_url($href . '&maxwidth=' . $a->videowidth);
+ $txt = $x['body'];
break;
}
}
}
}
- if ($txt==false || $txt==""){
+ if ($txt==false || $txt=="") {
+ $x = array('url' => $embedurl,'videowidth' => $a->videowidth);
+ 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;
- $txt = fetch_url($ourl);
+// $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);
@@ -112,6 +124,7 @@ function oembed_format_object($j){
if ( $j->type!='rich' || !strpos($j->html,$embedurl) ){
$embedlink = (isset($j->title))?$j->title:$embedurl;
$ret .= "<a href='$embedurl' rel='oembed'>$embedlink</a>";
+ $ret .= "<br>";
if (isset($j->author_name)) $ret.=" by ".$j->author_name;
if (isset($j->provider_name)) $ret.=" on ".$j->provider_name;
} else {