I've made some changes tot the function "AlbyBBParser()".
one is for better looking quotes, using the html-tag.
The other is for smiley-support using the smileys-module (
http://dev.cmsmadesimple.org/projects/smileys )
I also changed the last line, In my oppinion a forum post should be a paragraph, not a div.
Maybe it's nice to add this to the next version of Forum Made Simlpe
Code: Select all
function AlbyBBParser( $text )
{
$bb = array(
'/</','/>/',
'/\[color=(.*?)\](.*?)\[\/color\]/ism', #color
'/\[center\](.*?)\[\/center\]/ism', #center
'/\[quote\](.*?)\[\/quote\]/ism', #blockquote 1
'/\[quote="(.*?)\"](.*?)\[\/quote\]/ism', #blockquote 2
'/\[img\](http:\/\/)(.*?)\[\/img\]/ism', #img
'/\[url\](.*?)\[\/url\]/ism', #link 1
'/\[url=(http:\/\/)(.*?)\](.*?)\[\/url\]/ism', #link 2
'/\[b\](.*?)\[\/b\]/ism', #bold
'/\[i\](.*?)\[\/i\]/ism', #italics
'/\[u\](.*?)\[\/u\]/ism', #underline
'/\[sup\](.*?)\[\/sup\]/ism', #superscript
'/\[sub\](.*?)\[\/sub\]/ism', #supscript
'/\r\n/', #new line
// '/[\s]{2}/i' #space
);
$html = array(
'<','>',
'<span style="color:\1;">\2</span>', #color
'<div class="forum_center">\1</div>', #center
//quote layout changed
'<blockquote><span>Quote</span><br /><div class="forum_quote">\1 </div></blockquote>', #blockquote 1
'<blockquote><span>Quote from: \1</span><br /><div class="forum_quote">\2 </div></blockquote>', #blockquote 2
'<a href="" onmouseover="SMR_setLink(this);" rel="nofollow external" target="_blank"><img src="http://\2" alt="forum image" onload="SMR_resize(this);" /></a>', #img
#'<img src="http://\2" alt="forum image" />', #img
'<a href="\1" rel="nofollow">\1</a>', #link 1
'<a href="http://\2" rel="nofollow">\3</a>', #link 2
'<b>\1</b>', #bold
'<i>\1</i>', #italics
'<u>\1</u>', #underline
'<sup>\1</sup>', #superscript
'<sub>\1</sub>', #subscript
' <br />', #new line
//' ' #space
);
$text = preg_replace($bb, $html, $text);
// Smiley support using smiley module
$smileys = $this->GetModuleInstance("Smileys");
if ($smileys!=false) {
$text = $smileys->ReplaceSmileys($text);
}
return '<p>'.$text.'</p>';
}
I've also made a function to displays a list of (clickable) smileys, but this required some changes in the smileys module too. I'll get back to that.