array('type' => BBCODE_TYPE_ROOT)));
// [b][/b] - Bold
bbcode_add_element($bbcode,'b',array( 'type' => BBCODE_TYPE_NOARG,
'open_tag' => '',
'close_tag' => ''));
// [i][/i] - Italic
bbcode_add_element($bbcode,'i',array( 'type' => BBCODE_TYPE_NOARG,
'open_tag' => '',
'close_tag' => ''));
// [url][/url] - [url=][/url] - Link
bbcode_add_element($bbcode,'url',array( 'type' => BBCODE_TYPE_OPTARG,
'open_tag' => '',
'close_tag' => '',
'default_arg' => '{CONTENT}'));
// [img][/img] - [img=][/img] - Image
bbcode_add_element($bbcode,'img',array( 'type' => BBCODE_TYPE_OPTARG,
'open_tag' => '',
'default_tag' => '{CONTENT}'));
// [big][/big] - Big
bbcode_add_element($bbcode,'big',array( 'type' => BBCODE_TYPE_NOARG,
'open_tag' => '',
'close_tag' => ''));
// [small][/small] - Small
bbcode_add_element($bbcode,'small',array( 'type' => BBCODE_TYPE_NOARG,
'open_tag' => '',
'close_tag' => ''));
// [ul][/ul] - Unordered List
bbcode_add_element($bbcode,'ul',array( 'type' => BBCODE_TYPE_NOARG,
'open_tag' => '
',
'childs' => 'li'));
// [ol][/ol] - Ordered List
bbcode_add_element($bbcode,'ol',array( 'type' => BBCODE_TYPE_NOARG,
'open_tag' => '',
'close_tag' => '
',
'childs' => 'li'));
// [li][/li] - List Item
bbcode_add_element($bbcode,'li',array( 'type' => BBCODE_TYPE_NOARG,
'open_tag' => '',
'close_tag' => ''));
// [code][/code] - Code
bbcode_add_element($bbcode,'code',array( 'type' => BBCODE_TYPE_NOARG,
'open_tag' => '',
'close_tag' => '
'));
// [pre][/pre] - Preformatted Code
bbcode_add_element($bbcode,'pre',array( 'type' => BBCODE_TYPE_NOARG,
'open_tag' => ''));
function bb_fixCode($string)
{
$he = htmlentities($string);
$br = nl2br($he);
$sp = str_replace(' ',' $nbsp;',$br);
$ta = str_replace(' ',' ',$sp);
return($ta);
}
// [blog][/blog] - Blog Link
bbcode_add_element($bbcode,'blog',array( 'type' => BBCODE_TYPE_OPTARG,
'open_tag' => (isset($oldBlog) ? '' : ''),
'close_tag' => '',
'default_arg' => '{CONTENT}'));
// [quote][/quote] - Quotes DB Link
bbcode_add_element($bbcode,'quote',array( 'type' => BBCODE_TYPE_NOARG,
'open_tag' => (isset($oldBlog) ? '#' : '#'),
'close_tag' => ''));
// [ins][/ins] - Insert
bbcode_add_element($bbcode,'ins',array( 'type' => BBCODE_TYPE_NOARG,
'open_tag' => '',
'close_tag' => ''));
// [del][/del] - Delete
bbcode_add_element($bbcode,'del',array( 'type' => BBCODE_TYPE_NOARG,
'open_tag' => '',
'close_tag' => ''));
// [bquote][/bquote] - Blockquote
bbcode_add_element($bbcode,'bquote',array( 'type' => BBCODE_TYPE_OPTARG,
'open_tag' => '',
'default_arg' => 'Anonymous'));
// [project][/project] - Project Link
bbcode_add_element($bbcode,'project',array( 'type' => BBCODE_TYPE_NOARG,
'open_tag' => (isset($oldBlog) ? '' : ''),
'close_tag' => ''));
// [abbr][/abbr] - Abbreviation
bbcode_add_element($bbcode,'abbr',array( 'type' => BBCODE_TYPE_OPTARG,
'open_tag' => '',
'close_tag' => '',
'default_arg' => ''));
// [br] - Line Break
bbcode_add_element($bbcode,'br',array( 'type' => BBCODE_TYPE_SINGLE,
'open_tag' => '
'));
// [hidden][/hidden] - Hidden Text
bbcode_add_element($bbcode,'hidden',array( 'type' => BBCODE_TYPE_OPTARG,
'open_tag' => '',
'close_tag' => '
',
'default_arg' => ''));
function parseBBCode($text)
{
global $bbcode;
$to_parse = str_replace("\n",'[br]',htmlentities($text));
$to_parse = bbcode_parse($bbcode,$to_parse);
return str_replace('[br]','',$to_parse);
}
?>