aboutsummaryrefslogtreecommitdiff
path: root/lib/models/OpenGraphURL.class.php
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2023-01-25 14:30:39 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2023-01-25 14:30:39 +0000
commit205b1e60c00e62dca444f740e9b847bd2380f1fb (patch)
treecbf926ef8e640e640b75cb3fd0344d0387dd8b01 /lib/models/OpenGraphURL.class.php
parent1e8bc6cb2b527cde3ae5444fd03c0ee33fca5e2f (diff)
prevent warning in OpenGraphURL, fixes #2068
Closes #2068 Merge request studip/studip!1344
Diffstat (limited to 'lib/models/OpenGraphURL.class.php')
-rw-r--r--lib/models/OpenGraphURL.class.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/models/OpenGraphURL.class.php b/lib/models/OpenGraphURL.class.php
index 5df5e7f..19ea614 100644
--- a/lib/models/OpenGraphURL.class.php
+++ b/lib/models/OpenGraphURL.class.php
@@ -156,6 +156,8 @@ class OpenGraphURL extends SimpleORMap
return;
}
+ $isOpenGraph = false;
+
$response = FileManager::fetchURLMetadata($this['url']);
if ($response['response_code'] == 200 && mb_strpos($response['Content-Type'],'html') !== false) {
if (preg_match('/(?<=charset=)[^;]*/i', $response['Content-Type'], $match)) {
@@ -186,7 +188,6 @@ class OpenGraphURL extends SimpleORMap
$metatags = $doc->getElementsByTagName('meta');
$reservedTags = ['url', 'chdate', 'mkdate', 'last_update', 'is_opengraph', 'data'];
- $isOpenGraph = false;
$ogTags = [];
$data = [];
foreach ($metatags as $tag) {
@@ -230,6 +231,7 @@ class OpenGraphURL extends SimpleORMap
}
$this['data'] = $data;
}
+
$this['is_opengraph'] = (int) $isOpenGraph;
}