Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
In reply to: miniBB – Import only latest
Here is my current converter: https://gist.github.com/gijs5/7943186#file-bbpress-minibb-converter
I’m gonna use it tomorrow to launch bbpress.Cheers.
In reply to: miniBB – Import only latestHi Stephan,
The minibb database is 124 mb, so thats pretty big 🙂
The code is pretty ugly now, but maybe I’ll clean it up later. It’s pretty simular to yours.I used this in the callback_html function.
return htmlspecialchars_decode(str_replace(array('$'), array('$'), $this->deCodeBB($field)), ENT_QUOTES);
And I used the minibb deCodeBB function to form bbcodes:
public function deCodeBB($msg) { $pattern=array(); $replacement=array(); $pattern[]="/<img src=\"(.+?)\"([^\>]+)>/i"; $replacement[]="[img]\\1[/img]"; $pattern[]="/<a href=\"(.+?)\"([^\>]+)>(.+?)<\/a>/i"; $replacement[]="[url=\"\\1\"]\\3[/url]"; $pattern[]="/<[bB]>(.+?)<\/[bB]>/s"; $replacement[]="[b]\\1[/b]"; $pattern[]="/<[iI]>(.+?)<\/[iI]>/s"; $replacement[]="[i]\\1[/i]"; $pattern[]="/<[uU]>(.+?)<\/[uU]>/s"; $replacement[]="[u]\\1[/u]"; $pattern[]="/<font color=\"(#[A-F0-9]{6})\">(.+?)<\/font>/is"; $replacement[]='[font\\1]\\2[/font]'; $pattern[] = '/<div class=\"quote\"><div class=\"quoting\">Quoting: (.+?)<\/div><br>(.+?)<\/div>/is'; $replacement[] = "[quote=\\1]\\2[/quote]"; $pattern[] = '/<div class=\"quote\">(.+?)\<\/div>/is'; $replacement[] = "[quote]\\1[/quote]"; $pattern[] = '/<div class="codex">(.+?)\<\/div>/is'; $replacement[] = "[code]\\1[/code]"; /* YouTube code */ $pattern[]="/<object width=\"297\" height=\"245\"><param name=\"movie\" value=\"http:\/\/www\.youtube\.com\/v\/([a-zA-Z0-9-_]+)\"><\/param><param name=\"wmode\" value=\"transparent\"><\/param><embed src=\"http:\/\/www\.youtube\.com\/v\/([a-zA-Z0-9-_]+)\" type=\"application\/x-shockwave-flash\" wmode=\"transparent\" width=\"297\" height=\"245\"><\/embed><\/object>/i"; $replacement[]="[youtube=http://www.youtube.com/watch?v=\\1]"; /* --YouTube code */ $msg=preg_replace($pattern, $replacement, $msg); $msg=str_replace ('<br>', "\n", $msg); if(substr_count($msg, '[img\\2]')>0) $msg=str_replace('[img\\2]', '[img]', $msg); if(function_exists('smileThis')) $msg=smileThis(FALSE,TRUE,$msg); return $msg; }
Hope this helps.
Cheers.
Viewing 2 replies - 1 through 2 (of 2 total)