Use DOMElement::getAttribute
authorjoshuaruesweg <ruesweg@woltlab.com>
Fri, 12 Mar 2021 14:55:18 +0000 (15:55 +0100)
committerjoshuaruesweg <ruesweg@woltlab.com>
Tue, 16 Mar 2021 15:19:16 +0000 (16:19 +0100)
wcfsetup/install/files/lib/system/message/unfurl/UnfurlResponse.class.php

index c12ef57c7ffd699f269469b34f615da3865b554a..dff908d0c4ae7a2fbe85200824321c92af46fb64 100644 (file)
@@ -211,11 +211,8 @@ final class UnfurlResponse
             // og:title
             $list = $this->domXPath->query("//meta[@property='og:title']");
             foreach ($list as $node) {
-                foreach ($node->attributes as $attribute) {
-                    if ($attribute->nodeName === 'content') {
-                        return $attribute->nodeValue;
-                    }
-                }
+                /** @var \DOMElement $node */
+                return $node->getAttribute("content");
             }
 
             // title tag
@@ -237,11 +234,8 @@ final class UnfurlResponse
             // og:description
             $list = $this->domXPath->query("//meta[@property='og:description']");
             foreach ($list as $node) {
-                foreach ($node->attributes as $attribute) {
-                    if ($attribute->nodeName === 'content') {
-                        return $attribute->nodeValue;
-                    }
-                }
+                /** @var \DOMElement $node */
+                return $node->getAttribute("content");
             }
         }
 
@@ -257,11 +251,8 @@ final class UnfurlResponse
             // og:image
             $list = $this->domXPath->query("//meta[@property='og:image']");
             foreach ($list as $node) {
-                foreach ($node->attributes as $attribute) {
-                    if ($attribute->nodeName === 'content') {
-                        return $attribute->nodeValue;
-                    }
-                }
+                /** @var \DOMElement $node */
+                return $node->getAttribute("content");
             }
         }