// Show it as "plain HTML", that is, with only <b>, <i>, <u>, and <a>. print "<h3 style='color:#090;'>As \"plain HTML\" (<b>, <i>, <u>, and <a> tags only):</h3>\n"; $bbcode = new BBCode(); $bbcode->SetPlainMode(true); $output = $bbcode->Parse($input); $output = $bbcode->nl2br($output); print "<div class='bbcode' style='margin:1em;'>{$output}</div>\n"; print "<hr />\n"; //----------------------------------------------------------------------- // Now the same thing, with 520 characters or less. print "<h3 style='color:#090;'>As length-limited \"plain HTML\" (<b>, <i>, <u>, and <a> tags only):</h3>\n"; $bbcode = new BBCode(); $bbcode->SetPlainMode(true); $bbcode->SetLimit(520); $output = $bbcode->Parse($input); $output = $bbcode->nl2br($output); print "<div class='bbcode' style='margin:1em;'>{$output}</div>\n"; print "<hr />\n"; //----------------------------------------------------------------------- // Okay, this time, do it as pure plain text: No HTML at all. We // use plain-HTML mode and a couple of preg_replace calls to clean // up the result. print "<h3 style='color:#090;'>As plain text:</h3>\n"; $bbcode = new BBCode(); $bbcode->SetPlainMode(true); $output = $bbcode->Parse($input); $output = preg_replace("/<\\/?[buia][^>]*>/", "", $output); $output = wordwrap($bbcode->UnHTMLEncode(strip_tags($output))); print "<div class='bbcode' style='margin:1em;font:10pt Courier,mono,monospace;white-space:pre;'>{$output}</div>\n"; print "<hr />\n"; //-----------------------------------------------------------------------