function rss_to_activity_streams($data)
{
//
$feed = new SimplePie();
$feed->set_raw_data($data);
//
unset($data);
//
$feed->set_stupidly_fast(true);
$feed->init();
$feed->handle_content_type();
//
$id = md5($url);
$title = 'submit';
$link = 'http://' . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
$activityStream = new ActivityStreamsDoc($id, $title, $link);
//
foreach ($feed->get_items() as $item) {
$author = $item->get_author();
if (!$author) {
$author = $feed->get_author();
}
//
$activityStream->entry($item->get_id(), date("r", $item->get_date()), $author ? $author->get_name() : null, $author ? $author->get_link() : null, $item->get_title(), $item->get_permalink(), $item->get_description());
}
return $activityStream;
}