OStatus fix: look for <link>s in the current element's children, not in all its descendants. Was breaking notice URL transfer, pulling a profile link by mistake.

This commit is contained in:
Brion Vibber 2010-03-02 15:38:52 -08:00
parent b1ffbf17d3
commit 7175e7c7a1

View File

@ -344,9 +344,10 @@ class ActivityUtils
static function getLink(DOMNode $element, $rel, $type=null)
{
$links = $element->getElementsByTagnameNS(self::ATOM, self::LINK);
$els = $element->childNodes;
foreach ($links as $link) {
foreach ($els as $link) {
if ($link->localName == self::LINK && $link->namespaceURI == self::ATOM) {
$linkRel = $link->getAttribute(self::REL);
$linkType = $link->getAttribute(self::TYPE);
@ -356,16 +357,18 @@ class ActivityUtils
return $link->getAttribute(self::HREF);
}
}
}
return null;
}
static function getLinks(DOMNode $element, $rel, $type=null)
{
$links = $element->getElementsByTagnameNS(self::ATOM, self::LINK);
$els = $element->childNodes;
$out = array();
foreach ($links as $link) {
foreach ($els as $link) {
if ($link->localName == self::LINK && $link->namespaceURI == self::ATOM) {
$linkRel = $link->getAttribute(self::REL);
$linkType = $link->getAttribute(self::TYPE);
@ -375,6 +378,7 @@ class ActivityUtils
$out[] = $link;
}
}
}
return $out;
}