add oembed provider for photos

This commit is contained in:
redmatrix
2016-01-31 15:55:27 -08:00
parent 1f87fef968
commit a341c889b7
7 changed files with 110 additions and 9 deletions

View File

@@ -78,7 +78,6 @@ function oembed_fetch_url($embedurl){
else {
// try oembed autodiscovery
$redirects = 0;
$result = z_fetch_url($embedurl, false, $redirects, array('timeout' => 15, 'accept_content' => "text/*", 'novalidate' => true ));
if($result['success'])
$html_text = $result['body'];
@@ -88,8 +87,8 @@ function oembed_fetch_url($embedurl){
if ($dom){
$xpath = new DOMXPath($dom);
$attr = "oembed";
$xattr = oe_build_xpath("class","oembed");
$entries = $xpath->query("//link[@type='application/json+oembed']");
foreach($entries as $e){
$href = $e->getAttributeNode("href")->nodeValue;
@@ -173,6 +172,10 @@ function oembed_format_object($j){
$ret.="<br>";
}; break;
case "link": {
if($j->thumbnail_url) {
$ret = '<a href="' . $embedurl . '" ><img src="' . $j->thumbnail_url . '" alt="thumbnail" /></a><br /><br />';
}
//$ret = "<a href='".$embedurl."'>".$j->title."</a>";
}; break;
case "rich": {