X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Ffacebookutil.php;h=ad61b6f0a545e5f976ea413da6c799b95b21f865;hb=3bc55e7b8bff2fe331371333de9ff4f96c8584d2;hp=e832fa50f7c7d464111f14f0766c15c9493f6245;hpb=c8b8f07af14ad2ce9d0c0267962dd3bbf6473a4b;p=quix0rs-gnu-social.git diff --git a/lib/facebookutil.php b/lib/facebookutil.php index e832fa50f7..ad61b6f0a5 100644 --- a/lib/facebookutil.php +++ b/lib/facebookutil.php @@ -1,6 +1,6 @@ title ? + $attachment->title : $attachment->url); + $fbattachment['href'] = $attachment->url; + } + } + if(count($fbattachment['media'])>0){ + unset($fbattachment['name']); + unset($fbattachment['href']); + } + return $fbattachment; +} - $attachment = $attachments[0]; +/** +* given an File objects, returns an associative array suitable for Facebook media +*/ +function get_fbmedia_for_attachment($attachment) +{ $fbmedia = array(); if (strncmp($attachment->mimetype, 'image/', strlen('image/')) == 0) { $fbmedia['type'] = 'image'; $fbmedia['src'] = $attachment->url; $fbmedia['href'] = $attachment->url; - $fbattachment['media'][] = $fbmedia; } else if ($attachment->mimetype == 'audio/mpeg') { $fbmedia['type'] = 'mp3'; $fbmedia['src'] = $attachment->url; - $fbattachment['media'][] = $fbmedia; }else if ($attachment->mimetype == 'application/x-shockwave-flash') { $fbmedia['type'] = 'flash'; @@ -200,14 +218,10 @@ function format_attachments($attachments) // $fbmedia['imgsrc']=''; $fbmedia['swfsrc'] = $attachment->url; - $fbattachment['media'][] = $fbmedia; }else{ - $fbattachment['name'] = ($attachment->title ? - $attachment->title : $attachment->url); - $fbattachment['href'] = $attachment->url; + return false; } - - return $fbattachment; + return $fbmedia; } function remove_facebook_app($flink)