From ec28dee728b847f2363a53fb11e003d818c8e1cb Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 29 Oct 2015 12:58:32 +0100 Subject: update to latest object --- include/bb2diaspora.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'include/bb2diaspora.php') diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index d10ed57eb..7cba40672 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -309,9 +309,8 @@ function bb2diaspora_itembody($item, $force_update = false) { $is_photo = (($item['obj_type'] == ACTIVITY_OBJ_PHOTO) ? true : false); if($is_photo) { $object = json_decode($item['object'],true); - if($object['link'][2]) { - $photo_bb = '[zrl=' . rawurldecode($object['id']) . ']' . '[zmg=' . $object['link'][2]['width'] . 'x' . $object['link'][2]['height'] . ']' . rawurldecode($object['link'][2]['href']) . '[/zmg]' . '[/zrl]'; - $item['body'] = (($item['body']) ? $photo_bb . $item['body'] : $photo_bb); + if($object['bbcode']) { + $item['body'] = (($item['body']) ? $object['bbcode'] . "\r\n" . $item['body'] : $object['bbcode']); } } -- cgit v1.2.3 From ca81ab784a0d1975ae1780eb0b5003eb8fbb832f Mon Sep 17 00:00:00 2001 From: jeroenpraat Date: Sat, 31 Oct 2015 22:38:16 +0100 Subject: Fix youtube and vimeo for Diaspora posts. Remove empty zrl's from Diaspora posts (fixes also the not working and only translated into default hub language 'view full size'). Please revert when wrong. --- include/bb2diaspora.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'include/bb2diaspora.php') diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 7cba40672..1be7caa19 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -162,10 +162,10 @@ function diaspora2bb($s, $use_zrl = false) { } //$s = preg_replace("/([^\]\=]|^)(https?\:\/\/)(vimeo|youtu|www\.youtube|soundcloud)([a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[url=$2$3$4]$2$3$4[/url]',$s); - $s = bb_tag_preg_replace("/\[url\=?(.*?)\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/url\]/ism",'[youtube]$2[/youtube]','url',$s); - $s = bb_tag_preg_replace("/\[url\=https?:\/\/www.youtube.com\/watch\?v\=(.*?)\].*?\[\/url\]/ism",'[youtube]$1[/youtube]','url',$s); - $s = bb_tag_preg_replace("/\[url\=?(.*?)\]https?:\/ \/vimeo.com\/([0-9]+)(.*?)\[\/url\]/ism",'[vimeo]$2[/vimeo]','url',$s); - $s = bb_tag_preg_replace("/\[url\=https?:\/\/vimeo.com\/([0-9]+)\](.*?)\[\/url\]/ism",'[vimeo]$1[/vimeo]','url',$s); + $s = bb_tag_preg_replace("/\[url\=?(.*?)\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/url\]/ism",'[embed]https://www.youtube.com/watch?v=$2[/embed]','url',$s); + $s = bb_tag_preg_replace("/\[url\=https?:\/\/www.youtube.com\/watch\?v\=(.*?)\].*?\[\/url\]/ism",'[embed]https://www.youtube.com/watch?v=$1[/embed]','url',$s); + $s = bb_tag_preg_replace("/\[url\=?(.*?)\]https?:\/ \/vimeo.com\/([0-9]+)(.*?)\[\/url\]/ism",'[embed]https://vimeo.com/$2[/embed]','url',$s); + $s = bb_tag_preg_replace("/\[url\=https?:\/\/vimeo.com\/([0-9]+)\](.*?)\[\/url\]/ism",'[embed]https://vimeo.com/$1[/embed]','url',$s); // remove duplicate adjacent code tags $s = preg_replace("/(\[code\])+(.*?)(\[\/code\])+/ism","[code]$2[/code]", $s); @@ -440,6 +440,9 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) { // So take off the angle brackets of any such URL $Text = preg_replace("//is", "http$1", $Text); + // Remove empty zrl links + $Text = preg_replace("/\[zrl\=\].*?\[\/zrl\]/is", "", $Text); + // Remove all unconverted tags $Text = strip_tags($Text); -- cgit v1.2.3