From: Roland Häder Date: Wed, 22 Jun 2022 16:56:08 +0000 (+0200) Subject: Changed: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7eefb9aed85dafa266aae0f8d5d019a35fc05853;p=friendica.git Changed: - empty() is maybe superflous here, still I would prefer a code style that is written explicitly and not rely on "magic casting" --- diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index 1c6f11c2f3..c3e255a4d9 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -111,7 +111,7 @@ class BBCode $picturedata = Images::getInfoFromURLCached($matches[1]); - if (!empty($picturedata)) { + if ($picturedata) { if (($picturedata[0] >= 500) && ($picturedata[0] >= $picturedata[1])) { $post['image'] = $matches[1]; } else { @@ -320,7 +320,7 @@ class BBCode $post['text'] = trim(str_replace($pictures[0][0], '', $body)); } else { $imgdata = Images::getInfoFromURLCached($pictures[0][1]); - if (!empty($imgdata) && substr($imgdata['mime'], 0, 6) == 'image/') { + if (($imgdata) && substr($imgdata['mime'], 0, 6) == 'image/') { $post['type'] = 'photo'; $post['image'] = $pictures[0][1]; $post['preview'] = $pictures[0][2]; diff --git a/src/Model/Post/Media.php b/src/Model/Post/Media.php index 2b17614e89..3b23e5d0fe 100644 --- a/src/Model/Post/Media.php +++ b/src/Model/Post/Media.php @@ -192,7 +192,7 @@ class Media if (($media['type'] == self::IMAGE) || ($filetype == 'image')) { $imagedata = Images::getInfoFromURLCached($media['url']); - if (!empty($imagedata)) { + if ($imagedata) { $media['mimetype'] = $imagedata['mime']; $media['size'] = $imagedata['size']; $media['width'] = $imagedata[0]; @@ -202,7 +202,7 @@ class Media } if (!empty($media['preview'])) { $imagedata = Images::getInfoFromURLCached($media['preview']); - if (!empty($imagedata)) { + if ($imagedata) { $media['preview-width'] = $imagedata[0]; $media['preview-height'] = $imagedata[1]; } diff --git a/src/Protocol/OStatus.php b/src/Protocol/OStatus.php index be86c13be7..ddc55a2c5b 100644 --- a/src/Protocol/OStatus.php +++ b/src/Protocol/OStatus.php @@ -1377,7 +1377,7 @@ class OStatus case 'photo': if (!empty($siteinfo['image'])) { $imgdata = Images::getInfoFromURLCached($siteinfo['image']); - if (!empty($imgdata)) { + if ($imgdata) { $attributes = [ 'rel' => 'enclosure', 'href' => $siteinfo['image'], @@ -1407,7 +1407,7 @@ class OStatus if (!DI::config()->get('system', 'ostatus_not_attach_preview') && ($siteinfo['type'] != 'photo') && isset($siteinfo['image'])) { $imgdata = Images::getInfoFromURLCached($siteinfo['image']); - if (!empty($imgdata)) { + if ($imgdata) { $attributes = [ 'rel' => 'enclosure', 'href' => $siteinfo['image'], diff --git a/src/Util/ParseUrl.php b/src/Util/ParseUrl.php index f86a6480b7..ee171ea047 100644 --- a/src/Util/ParseUrl.php +++ b/src/Util/ParseUrl.php @@ -551,7 +551,7 @@ class ParseUrl if (!empty($image['url'])) { $image['url'] = self::completeUrl($image['url'], $page_url); $photodata = Images::getInfoFromURLCached($image['url']); - if (!empty($photodata) && ($photodata[0] > 50) && ($photodata[1] > 50)) { + if (($photodata) && ($photodata[0] > 50) && ($photodata[1] > 50)) { $image['src'] = $image['url']; $image['width'] = $photodata[0]; $image['height'] = $photodata[1];