]> git.mxchange.org Git - friendica.git/commitdiff
better handling of feed photos (e,g, google+)
authorFriendika <info@friendika.com>
Wed, 6 Jul 2011 03:29:26 +0000 (20:29 -0700)
committerFriendika <info@friendika.com>
Wed, 6 Jul 2011 03:29:26 +0000 (20:29 -0700)
include/Scrape.php

index 698ec9cf04c4e182ecefd98752b7d645a48215ed..c2663a87434cf863c683ff2fde8a2da2a8e75d36 100644 (file)
@@ -467,6 +467,14 @@ function probe_url($url) {
                                if(strpos($vcard['fn'],'@') !== false)
                                        $vcard['fn'] = substr($vcard['fn'],0,strpos($vcard['fn'],'@'));
                                $email = unxmlify($author->get_email());
+                               if(! $vcard['photo']) {
+                                       $rawtags = $feed->get_feed_tags( SIMPLEPIE_NAMESPACE_ATOM_10, 'author');
+                               if($rawtags) {
+                                               $elems = $rawtags[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10];
+                                               if((x($elems,'link')) && ($elems['link'][0]['attribs']['']['rel'] === 'photo'))
+                                                       $vcard['photo'] = $elems['link'][0]['attribs']['']['href'];
+                               }
+                               }
                        }
                        else {
                                $item = $feed->get_item(0);
@@ -485,6 +493,14 @@ function probe_url($url) {
                                                if($rawmedia && $rawmedia[0]['attribs']['']['url'])
                                                        $vcard['photo'] = unxmlify($rawmedia[0]['attribs']['']['url']);
                                        }
+                                       if(! $vcard['photo']) {
+                                               $rawtags = $item->get_feed_tags( SIMPLEPIE_NAMESPACE_ATOM_10, 'author');
+                                       if($rawtags) {
+                                                       $elems = $rawtags[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10];
+                                                       if((x($elems,'link')) && ($elems['link'][0]['attribs']['']['rel'] === 'photo'))
+                                                               $vcard['photo'] = $elems['link'][0]['attribs']['']['href'];
+                                       }
+                                       }
                                }
                        }
                        if((! $vcard['photo']) && strlen($email))