]> git.mxchange.org Git - friendica.git/commitdiff
fix erros in Util namespace
authorArt4 <art4@wlabs.de>
Sat, 16 Nov 2024 17:16:26 +0000 (17:16 +0000)
committerArt4 <art4@wlabs.de>
Sat, 16 Nov 2024 17:16:26 +0000 (17:16 +0000)
src/Util/EMailer/NotifyMailBuilder.php
src/Util/HTTPSignature.php
src/Util/Images.php
src/Util/ParseUrl.php

index 57fe544127365135c79ba4a1650759cea456e960..d53715a83e5474a50922ca9ddd3a33ea627c4a07 100644 (file)
@@ -109,9 +109,9 @@ class NotifyMailBuilder extends MailBuilder
        public function withPhoto(string $image, string $link, string $name)
        {
                $this->photo = [
-                       'image' => $image ?? '',
-                       'link'  => $link ?? '',
-                       'name'  => $name ?? '',
+                       'image' => $image,
+                       'link'  => $link,
+                       'name'  => $name,
                ];
 
                return $this;
index d7679abd1fa6477e0e39f162254977f900d91dda..cf8971bcbe4f48d61f50eda44451b6cddd2fc8c4 100644 (file)
@@ -478,10 +478,6 @@ class HTTPSignature
                        return [];
                }
 
-               if (empty($curlResult)) {
-                       return [];
-               }
-
                if (!$curlResult->isSuccess() || empty($curlResult->getBodyString())) {
                        Logger::debug('Fetching was unsuccessful', ['url' => $request, 'return-code' => $curlResult->getReturnCode(), 'error-number' => $curlResult->getErrorNumber(), 'error' => $curlResult->getError()]);
                        return [];
index 675f034b9c07f2dbb6f1201c8276826a3f19f19c..62e22ef2f86234362ca8b3e53712bd4b43cb504b 100644 (file)
@@ -308,13 +308,13 @@ class Images
 
                $data = DI::cache()->get($cacheKey);
 
-               if (empty($data) || !is_array($data)) {
+               if (!is_array($data)) {
                        $data = self::getInfoFromURL($url, $ocr);
 
                        DI::cache()->set($cacheKey, $data);
                }
 
-               return $data ?? [];
+               return $data;
        }
 
        /**
@@ -370,7 +370,7 @@ class Images
 
                if ($image->isValid()) {
                        $data['blurhash'] = $image->getBlurHash();
-                       
+
                        if ($ocr) {
                                $media = ['img_str' => $img_str];
                                Hook::callAll('ocr-detection', $media);
index 4238499bab954833c43ebf8512e504d18e4d6cf0..d0377e02acc09816608e88c7a9948a6023446bb8 100644 (file)
@@ -1087,7 +1087,7 @@ class ParseUrl
                $content = JsonLD::fetchElement($jsonld, 'logo', 'url', '@type', 'ImageObject');
                if (!empty($content) && is_string($content)) {
                        $jsonldinfo['publisher_img'] = trim($content);
-               } elseif (!empty($content) && is_array($content)) {
+               } elseif (is_array($content) && array_key_exists(0, $content)) {
                        $jsonldinfo['publisher_img'] = trim($content[0]);
                }