. */ /** * bbcode_format() * * Modified public domain code from www.phpit.net * * @param mixed $str * @return */ function bbcode_format ($str) { $str = htmlentities($str); $str = strip_tags($str); $str = wordwrap($str,100,"\n",true); $simple_search = array( '/\[b\](.*?)\[\/b\]/is', '/\[i\](.*?)\[\/i\]/is', '/\[u\](.*?)\[\/u\]/is', '/\[hr\]/is', '/\[pi\](.*?)\[\/pi\]/is', '/\[center\](.*?)\[\/center\]/is', '/\[title\](.*?)\[\/title\]/is', '/\[article\](.*?)\[\/article\]/is', '/\[section\](.*?)\[\/section\]/is', '/\[code\](.*?)\[\/code\]/is', '/\[quote\](.*?)\[\/quote\]/is', '/\[quote\=(.*?)\](.*?)\[\/quote\]/is', '/\[url\=(.*?)\](.*?)\[\/url\]/is', '/\[align\=(.*?)\](.*?)\[\/align\]/is', '/\[size\=(.*?)\](.*?)\[\/size\]/is', '/\[img\=(.*?)\](.*?)\[\/img\]/is' ); $simple_replace = array( '$1', '$1', '$1', '
$1
', '', '$1
$1', '$1 wrote:
$2', '$2', '
Code: |
$1 |
Code: |
$1 |
Quote: |
$1 |