aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-09-24 14:27:18 -0700
committerfriendica <info@friendica.com>2014-09-24 14:27:18 -0700
commit24d402941f143503b5b0e07403d5567f3b9d0173 (patch)
treedfa2446edce968953cd234079e101d072ba74cac
parentc76b8febaac5e1ec925499dd63ff763dc512fab8 (diff)
downloadvolse-hubzilla-24d402941f143503b5b0e07403d5567f3b9d0173.tar.gz
volse-hubzilla-24d402941f143503b5b0e07403d5567f3b9d0173.tar.bz2
volse-hubzilla-24d402941f143503b5b0e07403d5567f3b9d0173.zip
if no rss/atom element author, use feed level contact
-rwxr-xr-xinclude/items.php18
1 files changed, 11 insertions, 7 deletions
diff --git a/include/items.php b/include/items.php
index 8c7a0a777..4d89606da 100755
--- a/include/items.php
+++ b/include/items.php
@@ -1418,10 +1418,12 @@ function get_atom_elements($feed,$item,&$author) {
if($found_author) {
$author['author_name'] = unxmlify($found_author->get_name());
$author['author_link'] = unxmlify($found_author->get_link());
+ $author['author_is_feed'] = false;
}
else {
$author['author_name'] = unxmlify($feed->get_title());
$author['author_link'] = unxmlify($feed->get_permalink());
+ $author['author_is_feed'] = true;
}
if(substr($author['author_link'],-1,1) == '/')
@@ -1493,8 +1495,10 @@ function get_atom_elements($feed,$item,&$author) {
if($rawauthor && $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']) {
$base = $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'];
foreach($base as $link) {
- if($link['attribs']['']['rel'] === 'alternate' && (! $author['author_link']))
+ if($link['attribs']['']['rel'] === 'alternate' && (! $author['author_link'])) {
$author['author_link'] = unxmlify($link['attribs']['']['href']);
+ $author['author_is_feed'] = true;
+ }
if(! $author['author_photo']) {
if($link['attribs']['']['rel'] === 'photo' || $link['attribs']['']['rel'] === 'avatar')
$author['author_photo'] = unxmlify($link['attribs']['']['href']);
@@ -3343,11 +3347,11 @@ function consume_feed($xml,$importer,&$contact,$pass = 0) {
$author = array();
$datarray = get_atom_elements($feed,$item,$author);
- if(! x($author,'author_name'))
+ if((! x($author,'author_name')) || ($author['author_is_feed']))
$author['author_name'] = $contact['xchan_name'];
- if(! x($author,'author_link'))
+ if((! x($author,'author_link')) || ($author['author_is_feed']))
$author['author_link'] = $contact['xchan_url'];
- if(! x($author,'author_photo'))
+ if((! x($author,'author_photo'))|| ($author['author_is_feed']))
$author['author_photo'] = $contact['xchan_photo_m'];
$datarray['author_xchan'] = '';
@@ -3406,11 +3410,11 @@ function consume_feed($xml,$importer,&$contact,$pass = 0) {
$datarray = get_atom_elements($feed,$item,$author);
if(is_array($contact)) {
- if(! x($author,'author_name'))
+ if((! x($author,'author_name')) || ($author['author_is_feed']))
$author['author_name'] = $contact['xchan_name'];
- if(! x($author,'author_link'))
+ if((! x($author,'author_link')) || ($author['author_is_feed']))
$author['author_link'] = $contact['xchan_url'];
- if(! x($author,'author_photo'))
+ if((! x($author,'author_photo'))|| ($author['author_is_feed']))
$author['author_photo'] = $contact['xchan_photo_m'];
}