1
0
Fork 0

Update ParseUrl::getSiteinfo type recognition

- Added obsolete twitter card type provision
This commit is contained in:
Hypolite Petovan 2018-09-02 17:50:27 -04:00
parent 8bcc3c6860
commit 9744f0e780

View file

@ -248,7 +248,10 @@ class ParseUrl
} }
} }
if (!empty($meta_tag['content'])) { if (empty($meta_tag['content'])) {
continue;
}
$meta_tag['content'] = trim(html_entity_decode($meta_tag['content'], ENT_QUOTES, 'UTF-8')); $meta_tag['content'] = trim(html_entity_decode($meta_tag['content'], ENT_QUOTES, 'UTF-8'));
switch (strtolower($meta_tag['name'])) { switch (strtolower($meta_tag['name'])) {
@ -268,7 +271,10 @@ class ParseUrl
$siteinfo['image'] = $meta_tag['content']; $siteinfo['image'] = $meta_tag['content'];
break; break;
case 'twitter:card': case 'twitter:card':
if (($siteinfo['type'] == '') || ($meta_tag['content'] == 'photo')) { // Obsolete card type
if ($meta_tag['content'] == 'photo') {
$siteinfo['type'] = 'summary_large_image';
} else {
$siteinfo['type'] = $meta_tag['content']; $siteinfo['type'] = $meta_tag['content'];
} }
break; break;
@ -292,10 +298,10 @@ class ParseUrl
break; break;
} }
} }
if ($siteinfo['type'] == 'summary') {
if ($siteinfo['type'] == 'summary' || $siteinfo['type'] == 'summary_large_image') {
$siteinfo['type'] = 'link'; $siteinfo['type'] = 'link';
} }
}
if (isset($keywords)) { if (isset($keywords)) {
$siteinfo['keywords'] = []; $siteinfo['keywords'] = [];