aboutsummaryrefslogtreecommitdiff
path: root/lib/models/OpenGraphURL.class.php
diff options
context:
space:
mode:
authorDavid Siegfried <david.siegfried@uni-vechta.de>2023-03-12 17:33:06 +0000
committerDavid Siegfried <david.siegfried@uni-vechta.de>2023-03-12 17:33:06 +0000
commit710f175b5618672ace2c0771f6b6b31922bfcc66 (patch)
tree7e21211685c5d30fb3bc7ea1254cec36c73fe6e9 /lib/models/OpenGraphURL.class.php
parent60e93bc477a94a1fc4d997844ae1e39c884ba270 (diff)
prevent php8 warnings, closes #2361
Closes #2361 Merge request studip/studip!1544
Diffstat (limited to 'lib/models/OpenGraphURL.class.php')
-rw-r--r--lib/models/OpenGraphURL.class.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/models/OpenGraphURL.class.php b/lib/models/OpenGraphURL.class.php
index 19ea614..a1d4c72 100644
--- a/lib/models/OpenGraphURL.class.php
+++ b/lib/models/OpenGraphURL.class.php
@@ -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)