aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-06-16 15:28:29 -0700
committerzotlabs <mike@macgirvin.com>2017-06-16 15:28:29 -0700
commitb429576349a9a1909f1605226a246507feab1350 (patch)
tree590fdfd0f3665079ec4c48513a5d6f0db2f0fe64 /include
parent327b22d24ef62ac4057728dfa31aec6f1f76b2d0 (diff)
downloadvolse-hubzilla-b429576349a9a1909f1605226a246507feab1350.tar.gz
volse-hubzilla-b429576349a9a1909f1605226a246507feab1350.tar.bz2
volse-hubzilla-b429576349a9a1909f1605226a246507feab1350.zip
some logic cleanup in feed_get_reshare
Diffstat (limited to 'include')
-rw-r--r--include/feedutils.php21
1 files changed, 14 insertions, 7 deletions
diff --git a/include/feedutils.php b/include/feedutils.php
index 568c1e9ed..459cfb5ff 100644
--- a/include/feedutils.php
+++ b/include/feedutils.php
@@ -718,7 +718,7 @@ function feed_get_reshare(&$res,$item) {
if($rawobj) {
- $rawauthor = $rawobj->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author');
+ $rawauthor = $rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['author'];
if($rawauthor && $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name']) {
$share['author'] = unxmlify($rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name']);
@@ -751,7 +751,8 @@ function feed_get_reshare(&$res,$item) {
if(x($child[SIMPLEPIE_NAMESPACE_ATOM_10], 'link') && $child[SIMPLEPIE_NAMESPACE_ATOM_10]['link'])
$share['link'] = encode_rel_links($child[SIMPLEPIE_NAMESPACE_ATOM_10]['link']);
- $rawcreated = $rawobj->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'published');
+ $rawcreated = $rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['published'];
+
if($rawcreated)
$share['created'] = unxmlify($rawcreated[0]['data']);
else
@@ -771,13 +772,15 @@ function feed_get_reshare(&$res,$item) {
}
}
- $attach = $rawobj->get_enclosures();
+ $attach = $share['link'];
if($attach) {
foreach($attach as $att) {
- $len = intval($att->get_length());
- $link = str_replace(array(',','"'),array('%2D','%22'),notags(trim(unxmlify($att->get_link()))));
- $title = str_replace(array(',','"'),array('%2D','%22'),notags(trim(unxmlify($att->get_title()))));
- $type = str_replace(array(',','"'),array('%2D','%22'),notags(trim(unxmlify($att->get_type()))));
+ if($att['rel'] !== 'enclosure')
+ continue;
+ $len = intval($att['length']);
+ $link = str_replace(array(',','"'),array('%2D','%22'),notags(trim(unxmlify($att['href']))));
+ $title = str_replace(array(',','"'),array('%2D','%22'),notags(trim(unxmlify($att['title']))));
+ $type = str_replace(array(',','"'),array('%2D','%22'),notags(trim(unxmlify($att['type']))));
if(strpos($type,';'))
$type = substr($type,0,strpos($type,';'));
if((! $link) || (strpos($link,'http') !== 0))
@@ -823,6 +826,10 @@ function encode_rel_links($links) {
$l = array();
if($link['attribs']['']['rel'])
$l['rel'] = $link['attribs']['']['rel'];
+ if($link['attribs']['']['length'])
+ $l['length'] = $link['attribs']['']['length'];
+ if($link['attribs']['']['title'])
+ $l['title'] = $link['attribs']['']['title'];
if($link['attribs']['']['type'])
$l['type'] = $link['attribs']['']['type'];
if($link['attribs']['']['href'])