From cbdf8e51aa2826e11cc17c34bcbf568ca37e26ce Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 26 Aug 2009 14:34:41 +0000 Subject: Facebook app wasn't loading the theme css --- lib/facebookaction.php | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/facebookaction.php b/lib/facebookaction.php index 289e702c6..975ef9a50 100644 --- a/lib/facebookaction.php +++ b/lib/facebookaction.php @@ -96,6 +96,7 @@ class FacebookAction extends Action function showStylesheets() { $this->cssLink('css/display.css', 'base'); + $this->cssLink('css/display.css',null,'screen, projection, tv'); $this->cssLink('css/facebookapp.css', 'base'); } -- cgit v1.2.3-54-g00ecf From b7beac36c2dbebfa27982b2fc6c82cf2ebbaae8d Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Wed, 26 Aug 2009 21:54:57 -0400 Subject: Support multiple attachments per facebook update --- lib/facebookutil.php | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/facebookutil.php b/lib/facebookutil.php index e31a71f5e..67c6ecbdf 100644 --- a/lib/facebookutil.php +++ b/lib/facebookutil.php @@ -178,20 +178,38 @@ function format_attachments($attachments) $fbattachment = array(); $fbattachment['media'] = array(); - // Facebook only supports one attachment per item + foreach($attachments as $attachment) + { + $fbmedia = get_fbmedia_for_attachment($attachment); + if($fbmedia){ + $fbattachment['media'][]=$fbmedia; + }else{ + $fbattachment['name'] = ($attachment->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) -- cgit v1.2.3-54-g00ecf From 2dd5a5f86d5242362499c381c8d9519f40a8925b Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Thu, 27 Aug 2009 12:06:45 -0400 Subject: Do not used named capturing groups I'm not sure all php 5.2's are compiled with a PCRE library that supported named captures. --- lib/util.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/util.php b/lib/util.php index 7c1e21913..1e7834057 100644 --- a/lib/util.php +++ b/lib/util.php @@ -413,7 +413,7 @@ function common_replace_urls_callback($text, $callback, $notice_id = null) { // Start off with a regex $regex = '#'. '(?:^|[\s\(\)\[\]\{\}\\\'\\\";]+)(?![\@\!\#])'. - '(?P'. + '('. '(?:'. '(?:'. //Known protocols '(?:'. @@ -454,7 +454,7 @@ function common_replace_urls_callback($text, $callback, $notice_id = null) { } function callback_helper($matches, $callback, $notice_id) { - $url=$matches['url']; + $url=$matches[1]; $left = strpos($matches[0],$url); $right = $left+strlen($url); -- cgit v1.2.3-54-g00ecf