Update ParseUrl::getSiteinfo type recognition
- Added obsolete twitter card type provision
This commit is contained in:
parent
8bcc3c6860
commit
9744f0e780
1 changed files with 51 additions and 45 deletions
|
@ -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'));
|
||||
|
||||
switch (strtolower($meta_tag['name'])) {
|
||||
|
@ -268,7 +271,10 @@ class ParseUrl
|
|||
$siteinfo['image'] = $meta_tag['content'];
|
||||
break;
|
||||
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'];
|
||||
}
|
||||
break;
|
||||
|
@ -292,10 +298,10 @@ class ParseUrl
|
|||
break;
|
||||
}
|
||||
}
|
||||
if ($siteinfo['type'] == 'summary') {
|
||||
|
||||
if ($siteinfo['type'] == 'summary' || $siteinfo['type'] == 'summary_large_image') {
|
||||
$siteinfo['type'] = 'link';
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($keywords)) {
|
||||
$siteinfo['keywords'] = [];
|
||||
|
|
Loading…
Reference in a new issue