use Posterous element if available for RssChannel discovery

This commit is contained in:
Evan Prodromou 2010-03-20 17:18:55 -05:00
parent 97bd7e22da
commit c2afdfbbf5

View File

@ -893,6 +893,20 @@ class Ostatus_profile extends Memcached_DataObject
public static function ensureRssChannel($feedEl, $hints) public static function ensureRssChannel($feedEl, $hints)
{ {
// Special-case for Posterous. They have some nice metadata in their
// posterous:author elements. We should use them instead of the channel.
$items = $feedEl->getElementsByTagName('item');
if ($items->length > 0) {
$item = $items->item(0);
$authorEl = ActivityUtils::child($item, ActivityObject::AUTHOR, ActivityObject::POSTEROUS);
if (!empty($authorEl)) {
$obj = ActivityObject::fromPosterousAuthor($authorEl);
return self::ensureActivityObjectProfile($obj, $hints);
}
}
// @fixme we should check whether this feed has elements // @fixme we should check whether this feed has elements
// with different <author> or <dc:creator> elements, and... I dunno. // with different <author> or <dc:creator> elements, and... I dunno.
// Do something about that. // Do something about that.