- // Remove the xml declaration
- $data = preg_replace('/\<\?xml[^\?].*\?\>/','',$data);
-
- // Create a fake feed wrapper so simplepie doesn't choke
-
- $tpl = get_markup_template('fake_feed.tpl');
-
- $base = substr($data,strpos($data,'<entry'));
-
- $feedxml = $tpl . $base . '</feed>';
-
- logger('mod-salmon: Processed feed: ' . $feedxml);
-
- // Now parse it like a normal atom feed to scrape out the author URI
-
- $feed = new SimplePie();
- $feed->set_raw_data($feedxml);
- $feed->enable_order_by_date(false);
- $feed->init();
-
- logger('mod-salmon: Feed parsed.');
-
- if($feed->get_item_quantity()) {
- foreach($feed->get_items() as $item) {
- $author = $item->get_author();
- $author_link = unxmlify($author->get_link());
- break;
- }
- }
+ $author = OStatus::salmonAuthor($data, $importer);
+ $author_link = $author["author-link"];