aboutsummaryrefslogtreecommitdiffstats
path: root/include/bb2diaspora.php
diff options
context:
space:
mode:
authorFabio Comuni <fabrix.xm@gmail.com>2011-09-26 11:42:48 +0200
committerFabio Comuni <fabrix.xm@gmail.com>2011-09-26 11:42:48 +0200
commit5792b3d3580b9f09460305858293398d8d8a9abf (patch)
tree90d60e9db4ed733a60c2890c7305d45ddd48be42 /include/bb2diaspora.php
parent991656a3ef396d9a6bd43ddb752627c2880b17ba (diff)
parent428e6766411d2c6708ad25f726c4bcf1d64af1cc (diff)
downloadvolse-hubzilla-5792b3d3580b9f09460305858293398d8d8a9abf.tar.gz
volse-hubzilla-5792b3d3580b9f09460305858293398d8d8a9abf.tar.bz2
volse-hubzilla-5792b3d3580b9f09460305858293398d8d8a9abf.zip
Merge branch 'master' into newui
Diffstat (limited to 'include/bb2diaspora.php')
-rw-r--r--include/bb2diaspora.php27
1 files changed, 7 insertions, 20 deletions
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index 5b240bdd2..c72c78445 100644
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -3,30 +3,18 @@
require_once("include/oembed.php");
require_once('include/event.php');
-
-
+require_once('library/markdown.php');
+require_once('include/html2bbcode.php');
function diaspora2bb($s) {
- // bug #127
- $s = preg_replace('/\[(.+?)\]\((.+?)[^\\\]_(.+?)\)/','[$1]($2\\_$3)',$s);
-
-
- $s = str_replace(array('\\**','\\__','\\*','\\_'), array('-^doublestar^-','-^doublescore-^','-^star^-','-^score^-'),$s);
- $s = preg_replace("/\*\*\*(.+?)\*\*\*/", '[b][i]$1[/i][/b]', $s);
- $s = preg_replace("/\_\_\_(.+?)\_\_\_/", '[b][i]$1[/i][/b]', $s);
- $s = preg_replace("/\*\*(.+?)\*\*/", '[b]$1[/b]', $s);
- $s = preg_replace("/\_\_(.+?)\_\_/", '[b]$1[/b]', $s);
- $s = preg_replace("/\*(.+?)\*/", '[i]$1[/i]', $s);
- $s = preg_replace("/\_(.+?)\_/", '[i]$1[/i]', $s);
-
- $s = str_replace(array('-^doublestar^-','-^doublescore-^','-^star^-','-^score^-'), array('**','__','*','_'), $s);
- $s = preg_replace('/\!\[(.+?)\]\((.+?)\)/','[img]$2[/img]',$s);
- $s = preg_replace('/\[(.+?)\]\((.+?)\)/','[url=$2]$1[/url]',$s);
$s = preg_replace('/\@\{(.+?)\; (.+?)\@(.+?)\}/','@[url=https://$3/u/$2]$1[/url]',$s);
+ $s = Markdown($s);
+ $s = html2bbcode($s);
+// $s = preg_replace('/\[url=(.+?)\<em\>(.+?)\]/ism','[url=$1_$2]',$s);
+// $s = preg_replace('/\[url=(.+?)\<\/em\>(.+?)\]/ism','[url=$1_$2]',$s);
- $s = escape_tags($s);
return $s;
}
@@ -188,8 +176,7 @@ function bb2diaspora($Text,$preserve_nl = false) {
$Text = preg_replace("/\<(.*?)(src|href)=(.*?)\&amp\;(.*?)\>/ism",'<$1$2=$3&$4>',$Text);
- $Text = preg_replace('/\[(.*?)\\\\_(.*?)\]\((.*?)\)/ism','[$1_$2]($3)',$Text);
- $Text = preg_replace('/\[(.*?)\\\\\*(.*?)\]\((.*?)\)/ism','[$1*$2]($3)',$Text);
+ $Text = preg_replace('/\[(.*?)\]\((.*?)\\\\_(.*?)\)/ism','[$1]($2_$3)',$Text);
call_hooks('bb2diaspora',$Text);