diff options
author | redmatrix <git@macgirvin.com> | 2016-01-31 15:55:27 -0800 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-01-31 15:55:27 -0800 |
commit | a341c889b751055e90eba9b7a14da5b7cd0e8032 (patch) | |
tree | c42867ffbcac204c664522cb1559b7169c797cc1 /include | |
parent | 1f87fef9684a29da91fcb41a5d1d3bd4fb9a4619 (diff) | |
download | volse-hubzilla-a341c889b751055e90eba9b7a14da5b7cd0e8032.tar.gz volse-hubzilla-a341c889b751055e90eba9b7a14da5b7cd0e8032.tar.bz2 volse-hubzilla-a341c889b751055e90eba9b7a14da5b7cd0e8032.zip |
add oembed provider for photos
Diffstat (limited to 'include')
-rwxr-xr-x | include/oembed.php | 7 | ||||
-rw-r--r-- | include/security.php | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/include/oembed.php b/include/oembed.php index e50d34c7d..b95f93f91 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -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": { diff --git a/include/security.php b/include/security.php index 2a9a6e39e..ee94dba82 100644 --- a/include/security.php +++ b/include/security.php @@ -181,7 +181,7 @@ function permissions_sql($owner_id, $remote_observer = null) { */ else { - $observer = (($remote_observer) ? $remote_observer : get_observer_hash()); + $observer = ((! is_null($remote_observer)) ? $remote_observer : get_observer_hash()); if($observer) { $groups = init_groups_visitor($observer); |