1
0
Fork 0

Bugfix: When fetching a feed's name, take the title or description, but not the author name.

This commit is contained in:
Michael Vogel 2014-07-22 07:59:11 +02:00
parent ed1dce93d6
commit b1afaa50de

View file

@ -617,7 +617,7 @@ function probe_url($url, $mode = PROBE_NORMAL) {
if(x($feedret,'photo') && (! x($vcard,'photo')))
$vcard['photo'] = $feedret['photo'];
require_once('library/simplepie/simplepie.inc');
$feed = new SimplePie();
$feed = new SimplePie();
$xml = fetch_url($poll);
logger('probe_url: fetch feed: ' . $poll . ' returns: ' . $xml, LOGGER_DATA);
@ -628,7 +628,7 @@ function probe_url($url, $mode = PROBE_NORMAL) {
// Don't try and parse an empty string
$feed->set_raw_data(($xml) ? $xml : '<?xml version="1.0" encoding="utf-8" ?><xml></xml>');
$feed->init();
$feed->init();
if($feed->error())
logger('probe_url: scrape_feed: Error parsing XML: ' . $feed->error());
@ -648,11 +648,11 @@ function probe_url($url, $mode = PROBE_NORMAL) {
$profile = trim(unxmlify($author->get_link()));
if(! $vcard['photo']) {
$rawtags = $feed->get_feed_tags( SIMPLEPIE_NAMESPACE_ATOM_10, 'author');
if($rawtags) {
if($rawtags) {
$elems = $rawtags[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10];
if((x($elems,'link')) && ($elems['link'][0]['attribs']['']['rel'] === 'photo'))
$vcard['photo'] = $elems['link'][0]['attribs']['']['href'];
}
}
}
}
else {
@ -676,11 +676,11 @@ function probe_url($url, $mode = PROBE_NORMAL) {
}
if(! $vcard['photo']) {
$rawtags = $item->get_item_tags( SIMPLEPIE_NAMESPACE_ATOM_10, 'author');
if($rawtags) {
if($rawtags) {
$elems = $rawtags[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10];
if((x($elems,'link')) && ($elems['link'][0]['attribs']['']['rel'] === 'photo'))
$vcard['photo'] = $elems['link'][0]['attribs']['']['href'];
}
}
}
}
}
@ -692,6 +692,11 @@ function probe_url($url, $mode = PROBE_NORMAL) {
if(isset($lnk) && strlen($lnk))
$profile = $lnk;
if(! $network) {
$network = NETWORK_FEED;
// If it is a feed, don't take the author name as feed name
unset($vcard['fn']);
}
if(! (x($vcard,'fn')))
$vcard['fn'] = notags($feed->get_title());
if(! (x($vcard,'fn')))
@ -706,8 +711,6 @@ function probe_url($url, $mode = PROBE_NORMAL) {
if(strpos($vcard['nick'],' '))
$vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' ')));
}
if(! $network)
$network = NETWORK_FEED;
if(! $priority)
$priority = 2;
}