+ if((! isset($vcard)) && (! $poll)) {
+
+ $ret = scrape_feed($url);
+
+ if(count($ret) && ($ret['feed_atom'] || $ret['feed_rss'])) {
+ $poll = ((x($ret,'feed_atom')) ? unamp($ret['feed_atom']) : unamp($ret['feed_rss']));
+ $vcard = array();
+ require_once('simplepie/simplepie.inc');
+ $feed = new SimplePie();
+ $xml = fetch_url($poll);
+
+ $feed->set_raw_data($xml);
+
+ $feed->init();
+
+ $vcard['photo'] = $feed->get_image_url();
+ $author = $feed->get_author();
+ if($author) {
+ $vcard['fn'] = unxmlify(trim($author->get_name()));
+ if(! $vcard['fn'])
+ $vcard['fn'] = trim(unxmlify($author->get_email()));
+ if(strpos($vcard['fn'],'@') !== false)
+ $vcard['fn'] = substr($vcard['fn'],0,strpos($vcard['fn'],'@'));
+ $vcard['nick'] = strtolower(notags(unxmlify($vcard['fn'])));
+ if(strpos($vcard['nick'],' '))
+ $vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' ')));
+ $email = unxmlify($author->get_email());
+ }
+ else {
+ $item = $feed->get_item(0);
+ if($item) {
+ $author = $item->get_author();
+ if($author) {
+ $vcard['fn'] = trim(unxmlify($author->get_name()));
+ if(! $vcard['fn'])
+ $vcard['fn'] = trim(unxmlify($author->get_email()));
+ if(strpos($vcard['fn'],'@') !== false)
+ $vcard['fn'] = substr($vcard['fn'],0,strpos($vcard['fn'],'@'));
+ $vcard['nick'] = strtolower(unxmlify($vcard['fn']));
+ if(strpos($vcard['nick'],' '))
+ $vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' ')));
+ $email = unxmlify($author->get_email());
+ }
+ if(! $vcard['photo']) {
+ $rawmedia = $item->get_item_tags('http://search.yahoo.com/mrss/','thumbnail');
+ if($rawmedia && $rawmedia[0]['attribs']['']['url'])
+ $vcard['photo'] = unxmlify($rawmedia[0]['attribs']['']['url']);
+ }
+ }
+ }
+ if((! $vcard['photo']) && strlen($email))
+ $vcard['photo'] = gravatar_img($email);
+
+ $network = 'feed';
+ $priority = 2;
+ }
+ }
+