diff options
Diffstat (limited to 'include/bb2diaspora.php')
-rw-r--r-- | include/bb2diaspora.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 5ce34d666..7f7b8748d 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -5,6 +5,25 @@ require_once('include/event.php'); + +function diaspora2bb($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('/\[(.+?)\]\((.+?)\)/','[url=$2]$1[/url]',$s); + + $s = escape_tags($s); + return $s; + +} + + function stripdcode_br_cb($s) { return '[code]' . str_replace('<br />', '', $s[1]) . '[/code]'; } |