diff --git a/lib/models/OpenGraphURL.class.php b/lib/models/OpenGraphURL.class.php index 19ea6146e0a61aea503ac0034ad2977ddf97786e..a1d4c7210030af54a2ba6a00e92d3b9c3ca18e68 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)