Skip to content
Snippets Groups Projects
Commit 205b1e60 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

prevent warning in OpenGraphURL, fixes #2068

Closes #2068

Merge request studip/studip!1344
parent 1e8bc6cb
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
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