- empty() is maybe superflous here, still I would prefer a code style that is
  written explicitly and not rely on "magic casting"
This commit is contained in:
Roland Häder 2022-06-22 18:56:08 +02:00
parent 15d8341d9a
commit 7eefb9aed8
Signed by: roland
GPG key ID: C82EDE5DDFA0BA77
4 changed files with 7 additions and 7 deletions

View 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];

View 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];
}

View 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'],

View 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];