diff options
author | zotlabs <mike@macgirvin.com> | 2017-01-07 12:47:19 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-01-07 12:47:19 -0800 |
commit | c9f41841267db38573ff4c0401f81327ecd7c042 (patch) | |
tree | 79cc4870d393e3a03cec7f3ec072d1529d5c456a /include | |
parent | 6f1209ea49bf4afe80120ebeb82574866c1ffc3b (diff) | |
download | volse-hubzilla-c9f41841267db38573ff4c0401f81327ecd7c042.tar.gz volse-hubzilla-c9f41841267db38573ff4c0401f81327ecd7c042.tar.bz2 volse-hubzilla-c9f41841267db38573ff4c0401f81327ecd7c042.zip |
allow the atom_entry hook to change the results
Diffstat (limited to 'include')
-rw-r--r-- | include/feedutils.php | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/include/feedutils.php b/include/feedutils.php index 1502ac6a4..df56e3673 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -304,7 +304,7 @@ function get_atom_elements($feed, $item, &$author) { foreach($base as $link) { if($link['attribs']['']['rel'] === 'alternate' && (! $author['author_link'])) { $author['author_link'] = unxmlify($link['attribs']['']['href']); - $author['author_is_feed'] = true; +0 $author['author_is_feed'] = true; } if(! $author['author_photo']) { if($link['attribs']['']['rel'] === 'photo' || $link['attribs']['']['rel'] === 'avatar') @@ -331,6 +331,8 @@ function get_atom_elements($feed, $item, &$author) { } } + $ostatus_protocol = (($item->get_item_tags(NAMESPACE_OSTATUS,'conversation')) ? true : false); + $apps = $item->get_item_tags(NAMESPACE_STATUSNET,'notice_info'); if($apps && $apps[0]['attribs']['']['source']) { $res['app'] = strip_tags(unxmlify($apps[0]['attribs']['']['source'])); @@ -343,6 +345,8 @@ function get_atom_elements($feed, $item, &$author) { $have_real_body = false; $rawenv = $item->get_item_tags(NAMESPACE_DFRN, 'env'); + if(! $rawenv) + $rawenv = $item->get_item_tags(NAMESPACE_ZOT,'source'); if($rawenv) { $have_real_body = true; $res['body'] = $rawenv[0]['data']; @@ -389,9 +393,11 @@ function get_atom_elements($feed, $item, &$author) { } - // strip title if statusnet/gnusocial + // strip title and don't apply "title-in-body" if the feed involved + // uses the OStatus stack. We need a more generalised way for the calling + // function to specify this behaviour or for plugins to alter it. - if(strpos($item->get_id(),'noticeId=')) { + if($ostatus_protocol) { $res['title'] = ''; } elseif($res['plink'] && $res['title']) { @@ -629,14 +635,15 @@ function get_atom_elements($feed, $item, &$author) { $res['target'] = $obj; } - $arr = array('feed' => $feed, 'item' => $item, 'result' => $res); + $arr = array('feed' => $feed, 'item' => $item, 'author' => $author, 'result' => $res); call_hooks('parse_atom', $arr); - logger('get_atom_elements: author: ' . print_r($author,true),LOGGER_DATA); - logger('get_atom_elements: ' . print_r($res,true),LOGGER_DATA); + logger('get_atom_elements: author: ' . print_r($arr['author'],true),LOGGER_DATA); + + logger('get_atom_elements: ' . print_r($arr['result'],true),LOGGER_DATA); - return $res; + return $arr['result']; } function encode_rel_links($links) { |