]> git.mxchange.org Git - friendica.git/commitdiff
Formatting changes to Protocol/Feed
authorHypolite Petovan <mrpetovan@gmail.com>
Sat, 10 Mar 2018 23:35:24 +0000 (18:35 -0500)
committerHypolite Petovan <mrpetovan@gmail.com>
Sat, 10 Mar 2018 23:35:24 +0000 (18:35 -0500)
- Change attribute name condition
- Singularize $attributes variable name

src/Protocol/Feed.php

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