aboutsummaryrefslogtreecommitdiffstats
path: root/include/bb2diaspora.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/bb2diaspora.php')
-rw-r--r--include/bb2diaspora.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index 2ac1f43c8..41001d216 100644
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -72,7 +72,7 @@ function bb_tag_preg_replace($pattern, $replace, $name, $s) {
// So we'll use that to convert to HTML, then convert the HTML back to bbcode,
// and then clean up a few Diaspora specific constructs.
-function diaspora2bb($s) {
+function diaspora2bb($s,$use_zrl = false) {
$s = html_entity_decode($s,ENT_COMPAT,'UTF-8');
@@ -106,7 +106,14 @@ function diaspora2bb($s) {
$s = str_replace('♲',html_entity_decode('♲',ENT_QUOTES,'UTF-8'),$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);
+ if($use_zrl) {
+ $s = str_replace(array('[img','/img]'),array('[zmg','/zmg]'),$s);
+ $s = preg_replace("/([^\]\=]|^)(https?\:\/\/)([a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[zrl=$2$3]$2$3[/zrl]',$s);
+ }
+ else {
+ $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 = bb_tag_preg_replace("/\[url\=?(.*?)\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/url\]/ism",'[youtube]$2[/youtube]','url',$s);