Formatting changes to Protocol/Feed

- Change attribute name condition
- Singularize $attributes variable name
This commit is contained in:
Hypolite Petovan 2018-03-10 18:35:24 -05:00
parent a80d77f328
commit 9b14165cc8

View file

@ -85,9 +85,9 @@ class Feed {
if ($xpath->query('/atom:feed')->length > 0) { if ($xpath->query('/atom:feed')->length > 0) {
$alternate = $xpath->query("atom:link[@rel='alternate']")->item(0)->attributes; $alternate = $xpath->query("atom:link[@rel='alternate']")->item(0)->attributes;
if (is_object($alternate)) { if (is_object($alternate)) {
foreach ($alternate AS $attributes) { foreach ($alternate AS $attribute) {
if ($attributes->name == "href") { if ($attribute->name == "href") {
$author["author-link"] = $attributes->textContent; $author["author-link"] = $attribute->textContent;
} }
} }
} }
@ -98,9 +98,9 @@ class Feed {
if ($author["author-link"] == "") { if ($author["author-link"] == "") {
$self = $xpath->query("atom:link[@rel='self']")->item(0)->attributes; $self = $xpath->query("atom:link[@rel='self']")->item(0)->attributes;
if (is_object($self)) { if (is_object($self)) {
foreach ($self AS $attributes) { foreach ($self AS $attribute) {
if ($attributes->name == "href") { if ($attribute->name == "href") {
$author["author-link"] = $attributes->textContent; $author["author-link"] = $attribute->textContent;
} }
} }
} }
@ -140,9 +140,9 @@ class Feed {
} }
$avatar = $xpath->evaluate("atom:author/atom:link[@rel='avatar']")->item(0)->attributes; $avatar = $xpath->evaluate("atom:author/atom:link[@rel='avatar']")->item(0)->attributes;
if (is_object($avatar)) { if (is_object($avatar)) {
foreach ($avatar AS $attributes) { foreach ($avatar AS $attribute) {
if ($attributes->name == "href") { if ($attribute->name == "href") {
$author["author-avatar"] = $attributes->textContent; $author["author-avatar"] = $attribute->textContent;
} }
} }
} }
@ -218,9 +218,9 @@ class Feed {
$alternate = $xpath->query("atom:link", $entry)->item(0)->attributes; $alternate = $xpath->query("atom:link", $entry)->item(0)->attributes;
} }
if (is_object($alternate)) { if (is_object($alternate)) {
foreach ($alternate AS $attributes) { foreach ($alternate AS $attribute) {
if ($attributes->name == "href") { if ($attribute->name == "href") {
$item["plink"] = $attributes->textContent; $item["plink"] = $attribute->textContent;
} }
} }
} }
@ -313,13 +313,13 @@ class Feed {
$type = ""; $type = "";
$title = ""; $title = "";
foreach ($enclosure->attributes AS $attributes) { foreach ($enclosure->attributes AS $attribute) {
if ($attributes->name == "url" || $attributes->name == "href") { if (in_array($attribute->name, ["url", "href"])) {
$href = $attributes->textContent; $href = $attribute->textContent;
} elseif ($attributes->name == "length") { } elseif ($attribute->name == "length") {
$length = $attributes->textContent; $length = $attribute->textContent;
} elseif ($attributes->name == "type") { } elseif ($attribute->name == "type") {
$type = $attributes->textContent; $type = $attribute->textContent;
} }
} }
if (strlen($item["attach"])) { if (strlen($item["attach"])) {