]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/ParseUrl.php
Contact follow and unfollow workd partially
[friendica.git] / src / Util / ParseUrl.php
index 520100b6d7c65f266f49ae2eb6ffb8473542c917..40cb0b8fc099eaa42763fd4ddbd06ecd062d1185 100644 (file)
@@ -271,11 +271,9 @@ class ParseUrl
                                        $siteinfo['image'] = $meta_tag['content'];
                                        break;
                                case 'twitter:card':
-                                       // Convert Twitter types in our own
+                                       // Detect photo pages
                                        if ($meta_tag['content'] == 'summary_large_image') {
                                                $siteinfo['type'] = 'photo';
-                                       } else {
-                                               $siteinfo['type'] = $meta_tag['content'];
                                        }
                                        break;
                                case 'twitter:description':
@@ -334,6 +332,11 @@ class ParseUrl
                        }
                }
 
+               // Prevent to have a photo type without an image
+               if ((empty($siteinfo['image']) || !empty($siteinfo['text'])) && ($siteinfo['type'] == 'photo')) {
+                       $siteinfo['type'] = 'link';
+               }
+
                if ((@$siteinfo['image'] == '') && !$no_guessing) {
                        $list = $xpath->query('//img[@src]');
                        foreach ($list as $node) {