function autodiscovery()
{
$links = array_merge(SimplePie_Misc::get_element('link', $this->file->body), SimplePie_Misc::get_element('a', $this->file->body), SimplePie_Misc::get_element('area', $this->file->body));
$done = array();
foreach ($links as $link) {
if ($this->checked_feeds == $this->max_checked_feeds) {
break;
}
if (isset($link['attribs']['href']['data']) && isset($link['attribs']['rel']['data'])) {
$rel = array_unique(SimplePie_Misc::space_seperated_tokens(strtolower($link['attribs']['rel']['data'])));
if ($this->base_location < $link['offset']) {
$href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->base);
} else {
$href = SimplePie_Misc::absolutize_url(trim($link['attribs']['href']['data']), $this->http_base);
}
if (!in_array($href, $done) && in_array('feed', $rel) || in_array('alternate', $rel) && !empty($link['attribs']['type']['data']) && in_array(strtolower(SimplePie_Misc::parse_mime($link['attribs']['type']['data'])), array('application/rss+xml', 'application/atom+xml'))) {
$this->checked_feeds++;
$feed =& new $this->file_class($href, $this->timeout, 5, null, $this->useragent);
if ($this->is_feed($feed)) {
return $feed;
}
}
$done[] = $href;
}
}
return null;
}