]> git.mxchange.org Git - friendica.git/commitdiff
Changed:
authorRoland Häder <roland@mxchange.org>
Wed, 22 Jun 2022 16:56:08 +0000 (18:56 +0200)
committerRoland Häder <roland@mxchange.org>
Wed, 22 Jun 2022 16:57:01 +0000 (18:57 +0200)
- empty() is maybe superflous here, still I would prefer a code style that is
  written explicitly and not rely on "magic casting"

src/Content/Text/BBCode.php
src/Model/Post/Media.php
src/Protocol/OStatus.php
src/Util/ParseUrl.php

index 1c6f11c2f3f25834ee7a361ac5262b8a9f2e8b0d..c3e255a4d97de0844c089629ee4220d8410fee55 100644 (file)
@@ -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];
index 2b17614e89b1ce54ae4c425433d049138c8be149..3b23e5d0fe08db912bb105a4b0545d69cc2eadfc 100644 (file)
@@ -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];
                                }
index be86c13be7eafc02981b0ea231f52452b1f1ae07..ddc55a2c5bd4dcf0e10d50e023ecc99635dafffe 100644 (file)
@@ -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'],
index f86a6480b7b9e56e6c2eddf71ac10ae0eb9a4c55..ee171ea047e85ccf5111e14ce3392ead59ae3686 100644 (file)
@@ -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];