diff options
author | Michael <icarus@dabo.de> | 2012-02-20 01:53:22 +0100 |
---|---|---|
committer | Michael <icarus@dabo.de> | 2012-02-20 01:53:22 +0100 |
commit | 0fb22e1284c0510a0d009e34b7a1aa31ef6be052 (patch) | |
tree | cd3b4aa3b824587eb0b271d9a51b4311171af966 /include/bb2diaspora.php | |
parent | b6d7777226517dc22745bc3d78b827b0175bcb16 (diff) | |
download | volse-hubzilla-0fb22e1284c0510a0d009e34b7a1aa31ef6be052.tar.gz volse-hubzilla-0fb22e1284c0510a0d009e34b7a1aa31ef6be052.tar.bz2 volse-hubzilla-0fb22e1284c0510a0d009e34b7a1aa31ef6be052.zip |
API is now working on my nginx server.
Diffstat (limited to 'include/bb2diaspora.php')
-rwxr-xr-x | include/bb2diaspora.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 6f0ab3d28..4bb9e5e47 100755 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -24,6 +24,9 @@ function diaspora2bb($s) { // Simply remove cr. $s = str_replace("\r","",$s); + // <br/> is invalid. Replace it with the valid expression + $s = str_replace("<br/>","<br />",$s); + $s = preg_replace('/\@\{(.+?)\; (.+?)\@(.+?)\}/','@[url=https://$3/u/$2]$1[/url]',$s); // Escaping the hash tags - doesn't always seem to work @@ -40,12 +43,14 @@ function diaspora2bb($s) { $s = html2bbcode($s); // $s = str_replace('*','*',$s); + // Convert everything that looks like a link to a link + $s = preg_replace("/([^\]\=]|^)(https?\:\/\/)([a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[url=$2$3]$2$3[/url]',$s); + //$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 = 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); $s = preg_replace("/\[url\=https?:\/\/vimeo.com\/([0-9]+)\](.*?)\[\/url\]/ism",'[vimeo]$1[/vimeo]',$s); - $s = preg_replace("/([^\]\=]|^)(https?\:\/\/)(vimeo|youtu|www\.youtube|soundcloud)([a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[url]$2$3$4[/url]',$s); // remove duplicate adjacent code tags $s = preg_replace("/(\[code\])+(.*?)(\[\/code\])+/ism","[code]$2[/code]", $s); |