function comment_feed()
{
$feed = null;
// Well Formed Web comment feeds extension for RSS 2.0
// <http://www.sellsbrothers.com/spout/default.aspx?content=archive.htm#exposingRssComments>
//
// N.B.: Correct capitalization is wfw:commentRss, but
// wfw:commentRSS is common in the wild (partly due to a typo in
// the original spec). In any case, our item array is normalized
// to all lowercase anyways.
if (isset($this->item['wfw']['commentrss'])) {
$feed = $this->item['wfw']['commentrss'];
}
// In Atom 1.0, the convention is to use a standard link element
// with @rel="replies". Sometimes this is also used to pass a
// link to the human-readable comments page, so we also need to
// check link/@type for a feed MIME type.
//
// Which is why I'm not using the SimplePie_Item::get_links()
// method here, incidentally: it doesn't allow you to filter by
// @type. *sigh*
if (isset($this->item['link_replies'])) {
// There may be multiple <link rel="replies"> elements; feeds have a feed MIME type
$N = isset($this->item['link_replies#']) ? $this->item['link_replies#'] : 1;
for ($i = 1; $i <= $N; $i++) {
$currentElement = 'link_replies' . ($i > 1 ? '#' . $i : '');
if (isset($this->item[$currentElement . '@type']) and preg_match("application/(atom|rss|rdf)\\+xmli", $this->item[$currentElement . '@type'])) {
$feed = $this->item[$currentElement];
}
}
}
return $feed;
}