mirror of
https://github.com/friendica/friendica
synced 2024-11-20 01:43:40 +00:00
Avoid several notices in ParseUrl
This commit is contained in:
parent
e6f4ed47e2
commit
fb663f0668
1 changed files with 19 additions and 14 deletions
|
@ -512,19 +512,20 @@ class ParseUrl
|
||||||
{
|
{
|
||||||
if (!empty($siteinfo['images'])) {
|
if (!empty($siteinfo['images'])) {
|
||||||
array_walk($siteinfo['images'], function (&$image) use ($page_url) {
|
array_walk($siteinfo['images'], function (&$image) use ($page_url) {
|
||||||
|
$image = [];
|
||||||
// According to the specifications someone could place a picture url into the content field as well.
|
// According to the specifications someone could place a picture url into the content field as well.
|
||||||
// But this doesn't seem to happen in the wild, so we don't cover it here.
|
// But this doesn't seem to happen in the wild, so we don't cover it here.
|
||||||
$image['url'] = self::completeUrl($image['url'], $page_url);
|
if (!empty($image['url'])) {
|
||||||
$photodata = Images::getInfoFromURLCached($image['url']);
|
$image['url'] = self::completeUrl($image['url'], $page_url);
|
||||||
if (!empty($photodata) && ($photodata[0] > 50) && ($photodata[1] > 50)) {
|
$photodata = Images::getInfoFromURLCached($image['url']);
|
||||||
$image['src'] = $image['url'];
|
if (!empty($photodata) && ($photodata[0] > 50) && ($photodata[1] > 50)) {
|
||||||
$image['width'] = $photodata[0];
|
$image['src'] = $image['url'];
|
||||||
$image['height'] = $photodata[1];
|
$image['width'] = $photodata[0];
|
||||||
$image['contenttype'] = $photodata['mime'];
|
$image['height'] = $photodata[1];
|
||||||
unset($image['url']);
|
$image['contenttype'] = $photodata['mime'];
|
||||||
ksort($image);
|
unset($image['url']);
|
||||||
} else {
|
ksort($image);
|
||||||
$image = [];
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -542,7 +543,7 @@ class ParseUrl
|
||||||
if (!empty($media[$field])) {
|
if (!empty($media[$field])) {
|
||||||
$media[$field] = self::completeUrl($media[$field], $page_url);
|
$media[$field] = self::completeUrl($media[$field], $page_url);
|
||||||
$type = self::getContentType($media[$field]);
|
$type = self::getContentType($media[$field]);
|
||||||
if ($type[0] == 'text') {
|
if (($type[0] ?? '') == 'text') {
|
||||||
if ($field == 'embed') {
|
if ($field == 'embed') {
|
||||||
$embed = $media[$field];
|
$embed = $media[$field];
|
||||||
} else {
|
} else {
|
||||||
|
@ -685,7 +686,9 @@ class ParseUrl
|
||||||
{
|
{
|
||||||
if (!empty($jsonld['@graph']) && is_array($jsonld['@graph'])) {
|
if (!empty($jsonld['@graph']) && is_array($jsonld['@graph'])) {
|
||||||
foreach ($jsonld['@graph'] as $part) {
|
foreach ($jsonld['@graph'] as $part) {
|
||||||
$siteinfo = self::parseParts($siteinfo, $part);
|
if (!empty($part)) {
|
||||||
|
$siteinfo = self::parseParts($siteinfo, $part);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} elseif (!empty($jsonld['@type'])) {
|
} elseif (!empty($jsonld['@type'])) {
|
||||||
$siteinfo = self::parseJsonLd($siteinfo, $jsonld);
|
$siteinfo = self::parseJsonLd($siteinfo, $jsonld);
|
||||||
|
@ -699,7 +702,9 @@ class ParseUrl
|
||||||
}
|
}
|
||||||
if ($numeric_keys) {
|
if ($numeric_keys) {
|
||||||
foreach ($jsonld as $part) {
|
foreach ($jsonld as $part) {
|
||||||
$siteinfo = self::parseParts($siteinfo, $part);
|
if (!empty($part)) {
|
||||||
|
$siteinfo = self::parseParts($siteinfo, $part);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue