aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjeroenpraat <jeroenpraat@xs4all.nl>2015-10-31 22:38:16 +0100
committerjeroenpraat <jeroenpraat@xs4all.nl>2015-10-31 22:38:16 +0100
commitca81ab784a0d1975ae1780eb0b5003eb8fbb832f (patch)
tree5beb41f294cb82ca7246d5c8fdb92ae99ae03383
parent3262d819de04d1c6ddfab8eb02a21fe2a61561a0 (diff)
downloadvolse-hubzilla-ca81ab784a0d1975ae1780eb0b5003eb8fbb832f.tar.gz
volse-hubzilla-ca81ab784a0d1975ae1780eb0b5003eb8fbb832f.tar.bz2
volse-hubzilla-ca81ab784a0d1975ae1780eb0b5003eb8fbb832f.zip
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.
-rw-r--r--include/bb2diaspora.php11
1 files changed, 7 insertions, 4 deletions
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("/<http(.*?)>/is", "http$1", $Text);
+ // Remove empty zrl links
+ $Text = preg_replace("/\[zrl\=\].*?\[\/zrl\]/is", "", $Text);
+
// Remove all unconverted tags
$Text = strip_tags($Text);