better support for atom:link elements in rss feeds, support rel=standout (fuck you google and your nonstandard shit)
This commit is contained in:
parent
393c1ddc6d
commit
df2655e015
|
@ -22,8 +22,11 @@ class FeedItem_Atom extends FeedItem_Common {
|
||||||
$links = $this->elem->getElementsByTagName("link");
|
$links = $this->elem->getElementsByTagName("link");
|
||||||
|
|
||||||
foreach ($links as $link) {
|
foreach ($links as $link) {
|
||||||
if ($link && $link->hasAttribute("href") && (!$link->hasAttribute("rel")
|
if ($link && $link->hasAttribute("href") &&
|
||||||
|| $link->getAttribute("rel") == "alternate")) {
|
(!$link->hasAttribute("rel")
|
||||||
|
|| $link->getAttribute("rel") == "alternate"
|
||||||
|
|| $link->getAttribute("rel") == "standout")) {
|
||||||
|
|
||||||
return $link->getAttribute("href");
|
return $link->getAttribute("href");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,10 +19,16 @@ class FeedItem_RSS extends FeedItem_Common {
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_link() {
|
function get_link() {
|
||||||
$link = $this->xpath->query("atom:link", $this->elem)->item(0);
|
$links = $this->xpath->query("atom:link", $this->elem);
|
||||||
|
|
||||||
if ($link) {
|
foreach ($links as $link) {
|
||||||
return $link->getAttribute("href");
|
if ($link && $link->hasAttribute("href") &&
|
||||||
|
(!$link->hasAttribute("rel")
|
||||||
|
|| $link->getAttribute("rel") == "alternate"
|
||||||
|
|| $link->getAttribute("rel") == "standout")) {
|
||||||
|
|
||||||
|
return $link->getAttribute("href");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$link = $this->elem->getElementsByTagName("guid")->item(0);
|
$link = $this->elem->getElementsByTagName("guid")->item(0);
|
||||||
|
|
Loading…
Reference in New Issue