rendered paste body<?php
$post = '[b]lol[/b]';
function bbcode($string) {
$string = str_replace(array('<', '>'), array('<', '>'), $str);
$match = array(
'#\[b\](.*?)\[\/b\]#se',
'#\[i\](.*?)\[\/i\]#se',
'#\[u\](.*?)\[\/u\]#se',
'#\[s\](.*?)\[\/s\]#se',
'#\[url=(.*?)\](.*?)\[\/url\]#se',
'#\[url](.*?)\[\/url\]#se',
'#\[email\](.*?)\[\/email\]#se',
'#\[img](.*?)\[\/img\]#se',
'#\[img alt=(.*?)](.*?)\[\/img\]#se'
);
$replace = array(
"'<strong>\\1</strong>'",
"'<em>\\1</em>'",
"'<span style=\"text-decoration: underline;\">\\1</span>'",
"'<strike>\\1</strike>'",
"'<a href=\"' . fix_url('\\1') . '\">\\2</a>'",
"'<a href=\"' . fix_url('\\1') . '\">' . fix_url('\\1') . '</a>'",
"'<a href=\"mailto:\\1\">\\1</a>'",
"'<img style=\"border: 0;\" src=\"\\1\" alt=\"BROKEN IMAGE :C\" />'",
"'<img style=\"border: 0;\" src=\"\\2\" alt=\"\\1\" />'"
);
$string = preg_replace($match, $replace, $string);
return $string;
}
$parsedPost = bbcode($post);
echo $parsedPost;
?>