Bugfix: When fetching a feed's name, take the title or description, but not the author name.
This commit is contained in:
parent
ed1dce93d6
commit
b1afaa50de
1 changed files with 23 additions and 20 deletions
|
@ -617,7 +617,7 @@ function probe_url($url, $mode = PROBE_NORMAL) {
|
||||||
if(x($feedret,'photo') && (! x($vcard,'photo')))
|
if(x($feedret,'photo') && (! x($vcard,'photo')))
|
||||||
$vcard['photo'] = $feedret['photo'];
|
$vcard['photo'] = $feedret['photo'];
|
||||||
require_once('library/simplepie/simplepie.inc');
|
require_once('library/simplepie/simplepie.inc');
|
||||||
$feed = new SimplePie();
|
$feed = new SimplePie();
|
||||||
$xml = fetch_url($poll);
|
$xml = fetch_url($poll);
|
||||||
|
|
||||||
logger('probe_url: fetch feed: ' . $poll . ' returns: ' . $xml, LOGGER_DATA);
|
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
|
// Don't try and parse an empty string
|
||||||
$feed->set_raw_data(($xml) ? $xml : '<?xml version="1.0" encoding="utf-8" ?><xml></xml>');
|
$feed->set_raw_data(($xml) ? $xml : '<?xml version="1.0" encoding="utf-8" ?><xml></xml>');
|
||||||
|
|
||||||
$feed->init();
|
$feed->init();
|
||||||
if($feed->error())
|
if($feed->error())
|
||||||
logger('probe_url: scrape_feed: Error parsing XML: ' . $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()));
|
$profile = trim(unxmlify($author->get_link()));
|
||||||
if(! $vcard['photo']) {
|
if(! $vcard['photo']) {
|
||||||
$rawtags = $feed->get_feed_tags( SIMPLEPIE_NAMESPACE_ATOM_10, 'author');
|
$rawtags = $feed->get_feed_tags( SIMPLEPIE_NAMESPACE_ATOM_10, 'author');
|
||||||
if($rawtags) {
|
if($rawtags) {
|
||||||
$elems = $rawtags[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10];
|
$elems = $rawtags[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10];
|
||||||
if((x($elems,'link')) && ($elems['link'][0]['attribs']['']['rel'] === 'photo'))
|
if((x($elems,'link')) && ($elems['link'][0]['attribs']['']['rel'] === 'photo'))
|
||||||
$vcard['photo'] = $elems['link'][0]['attribs']['']['href'];
|
$vcard['photo'] = $elems['link'][0]['attribs']['']['href'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -676,11 +676,11 @@ function probe_url($url, $mode = PROBE_NORMAL) {
|
||||||
}
|
}
|
||||||
if(! $vcard['photo']) {
|
if(! $vcard['photo']) {
|
||||||
$rawtags = $item->get_item_tags( SIMPLEPIE_NAMESPACE_ATOM_10, 'author');
|
$rawtags = $item->get_item_tags( SIMPLEPIE_NAMESPACE_ATOM_10, 'author');
|
||||||
if($rawtags) {
|
if($rawtags) {
|
||||||
$elems = $rawtags[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10];
|
$elems = $rawtags[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10];
|
||||||
if((x($elems,'link')) && ($elems['link'][0]['attribs']['']['rel'] === 'photo'))
|
if((x($elems,'link')) && ($elems['link'][0]['attribs']['']['rel'] === 'photo'))
|
||||||
$vcard['photo'] = $elems['link'][0]['attribs']['']['href'];
|
$vcard['photo'] = $elems['link'][0]['attribs']['']['href'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -692,6 +692,11 @@ function probe_url($url, $mode = PROBE_NORMAL) {
|
||||||
if(isset($lnk) && strlen($lnk))
|
if(isset($lnk) && strlen($lnk))
|
||||||
$profile = $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')))
|
if(! (x($vcard,'fn')))
|
||||||
$vcard['fn'] = notags($feed->get_title());
|
$vcard['fn'] = notags($feed->get_title());
|
||||||
if(! (x($vcard,'fn')))
|
if(! (x($vcard,'fn')))
|
||||||
|
@ -706,8 +711,6 @@ function probe_url($url, $mode = PROBE_NORMAL) {
|
||||||
if(strpos($vcard['nick'],' '))
|
if(strpos($vcard['nick'],' '))
|
||||||
$vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' ')));
|
$vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' ')));
|
||||||
}
|
}
|
||||||
if(! $network)
|
|
||||||
$network = NETWORK_FEED;
|
|
||||||
if(! $priority)
|
if(! $priority)
|
||||||
$priority = 2;
|
$priority = 2;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue