aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-01-11 14:03:27 -0800
committerfriendica <info@friendica.com>2012-01-11 14:03:27 -0800
commitc5f41d8b6c9473b5573e941118d8d8c9e25013dc (patch)
tree86bc0c462f39f713a393ad585ce1d625a0ea013e
parentdcc22ab5c5502b8bf36bc42308f114e7c0e4fb7e (diff)
downloadvolse-hubzilla-c5f41d8b6c9473b5573e941118d8d8c9e25013dc.tar.gz
volse-hubzilla-c5f41d8b6c9473b5573e941118d8d8c9e25013dc.tar.bz2
volse-hubzilla-c5f41d8b6c9473b5573e941118d8d8c9e25013dc.zip
fix D* links+text smushed together
-rw-r--r--include/bb2diaspora.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index e819976a7..8564d20e3 100644
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -19,6 +19,11 @@ function diaspora2bb($s) {
$s = Markdown($s);
$s = html2bbcode($s);
// $s = str_replace('&#42;','*',$s);
+
+ // we seem to get a lot of text smushed together with links from Diaspora.
+ // if it's a url that we haven't already parsed into a bbcode structure, put a space before it.
+ $s = preg_replace("/([^=])(https?:\/\/)/ism",'$1 $2',$s);
+
$s = preg_replace("/\[url\=?(.*?)\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/url\]/ism",'[youtube]$2[/youtube]',$s);
$s = preg_replace("/\[url\=https?:\/\/www.youtube.com\/watch\?v\=(.*?)\].*?\[\/url\]/ism",'[youtube]$1[/youtube]',$s);
$s = preg_replace("/\[url\=?(.*?)\]https?:\/\/vimeo.com\/([0-9]+)(.*?)\[\/url\]/ism",'[vimeo]$2[/vimeo]',$s);