Skip to content
Snippets Groups Projects
Commit 710f175b authored by David Siegfried's avatar David Siegfried
Browse files

prevent php8 warnings, closes #2361

Closes #2361

Merge request studip/studip!1544
parent 60e93bc4
No related branches found
No related tags found
No related merge requests found
Pipeline #10327 passed
......@@ -159,7 +159,7 @@ class OpenGraphURL extends SimpleORMap
$isOpenGraph = false;
$response = FileManager::fetchURLMetadata($this['url']);
if ($response['response_code'] == 200 && mb_strpos($response['Content-Type'],'html') !== false) {
if ((int)$response['response_code'] === 200 && isset($response['Content-Type']) && mb_strpos($response['Content-Type'],'html') !== false) {
if (preg_match('/(?<=charset=)[^;]*/i', $response['Content-Type'], $match)) {
$currentEncoding = trim($match[0], '"');
} else {
......@@ -214,13 +214,13 @@ class OpenGraphURL extends SimpleORMap
$this[$key] = $tag;
}
}
if (!$this['title'] && $isOpenGraph) {
if (empty($this['title']) && $isOpenGraph) {
$titles = $doc->getElementsByTagName('title');
if ($titles->length > 0) {
$this['title'] = $titles->item(0)->textContent;
}
}
if (!$this['description'] && $isOpenGraph) {
if (empty($this['description']) && $isOpenGraph) {
foreach ($metatags as $tag) {
if (mb_stripos($tag->getAttribute('name'), "description") !== false
|| mb_stripos($tag->getAttribute('property'), "description") !== false)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment