summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-08-27 14:18:51 -0700
committerEvan Prodromou <evan@status.net>2009-08-27 14:18:51 -0700
commitbbb830e14c718c687f0636710a1827c90b11f4cc (patch)
treeff637b6b10ecd760c410f8dfea81f2f7113989ab /lib
parent82b0927f5838f3c12816e03712df9460a9f77b72 (diff)
parent2dd5a5f86d5242362499c381c8d9519f40a8925b (diff)
Merge branch '0.8.x' of git@gitorious.org:laconica/mainline into 0.8.x
Diffstat (limited to 'lib')
-rw-r--r--lib/facebookaction.php1
-rw-r--r--lib/facebookutil.php34
-rw-r--r--lib/util.php4
3 files changed, 27 insertions, 12 deletions
diff --git a/lib/facebookaction.php b/lib/facebookaction.php
index ca67a094a..5cbb9be53 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');
}
diff --git a/lib/facebookutil.php b/lib/facebookutil.php
index 36b745279..ad61b6f0a 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)
diff --git a/lib/util.php b/lib/util.php
index 4ad5c48f5..cedb70873 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<url>'.
+ '('.
'(?:'.
'(?:'. //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);