/** * Converts bbcodes in the given text to HTML. Also auto-links URLs. * * @param string $text The text to parse * @return string */ function parse_bbcode($text) { require_once 'stringparser_bbcode/stringparser_bbcode.class.php'; $bbcode = new StringParser_BBCode(); $bbcode->setGlobalCaseSensitive(false); $bbcode->setRootParagraphHandling(true); // Convert all newlines to a common form $bbcode->addFilter(STRINGPARSER_FILTER_PRE, create_function('$a', 'return preg_replace("/\\015\\012|015\\012/", "\\n", $a);')); $bbcode->addParser(array('block', 'inline'), 'format_whitespace'); $bbcode->addParser(array('block', 'inline'), 'autolink_text'); // The bbcodes themselves $bbcode->addCode('b', 'simple_replace', null, array('start_tag' => '<strong>', 'end_tag' => '</strong>'), 'inline', array('listitem', 'block', 'inline', 'link'), array()); $bbcode->addCode('i', 'simple_replace', null, array('start_tag' => '<em>', 'end_tag' => '</em>'), 'inline', array('listitem', 'block', 'inline', 'link'), array()); $bbcode->addCode('url', 'usecontent?', 'bbcode_url', array('usecontent_param' => 'default'), 'link', array('listitem', 'block', 'inline'), array('link')); $bbcode->addCode('img', 'usecontent', 'bbcode_img', array(), 'image', array('listitem', 'block', 'inline', 'link'), array()); $text = $bbcode->parse($text); return $text; }
/** * strips bbcodes out of a string * * @global Database $db * @param string $text the string * @param bool $strict if true codes with strippable 1 are stripped too * @return string the stripped string */ public function strip($text, $strict = false) { $parser = new StringParser_BBCode(); $parser->setGlobalCaseSensitive(false); $parser->addCode('list', 'callback_replace', 'bbcode_list', array(), 'list', array('block', 'listitem'), array('inline')); $parser->addCode('*', 'simple_replace', null, array('start_tag' => '<li>', 'end_tag' => '</li>'), 'listitem', array('list'), array()); $parser->setCodeFlag('*', 'closetag', BBCODE_CLOSETAG_OPTIONAL); $parser->setCodeFlag('*', 'paragraphs', true); $parser->setCodeFlag('list', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT); $parser->setCodeFlag('list', 'opentag.before.newline', BBCODE_NEWLINE_DROP); $parser->setCodeFlag('list', 'closetag.before.newline', BBCODE_NEWLINE_DROP); foreach ($result as $code) { if ($code['strippable'] === '0') { continue; } elseif ($code['strippable'] === '1' && !$strict) { continue; } $params = array('start_tag' => '', 'end_tag' => ''); $tmp = explode('&', $code['params']); foreach ($tmp as $pair) { $parts = explode('=', $pair); if (count($parts) < 2) { continue; } $values = explode(',', $parts[1]); if (count($values) == 1) { $values = urldecode($values[0]); } else { $values = array_map('urldecode', $values); } $params[urldecode($parts[0])] = $values; } unset($tmp); $parser->addCode($code['name'], $code['parsetype'], preg_match('/(simple_replace|simple_replace_simgle)/i', $code['parsetype']) ? null : array('BBCodes', '_strip'), $params, $code['contenttype'], explode('|', $code['allowedin']), explode('|', $code['notallowedin'])); } return $parser->parse($text); }
public function displayText($str) { $sp = new StringParser_BBCode(); $sp->setGlobalCaseSensitive(false); if ($this->_postmode != 'html') { $sp->addParser(array('block', 'inline'), array($this, 'htmlspecialchars')); $sp->addParser(array('block', 'inline'), 'nl2br'); $sp->addParser(array('block', 'inline'), array($this, 'linkify')); } $sp->addCode('code', 'usecontent', array($this, '_codeblock'), array('usecontent_param' => 'default'), 'code', array('block'), array()); if ($this->replaceTags) { $sp->addParser(array('block'), array($this, '_replacetags')); } if ($this->_censorData) { $str = $this->censor($str); } $str = $sp->parse($str); return $str; }
/** * Simplified codes for comments. * * @param string $text * @return strng */ function plugin_bbcode_comment($text) { $bbcode = new StringParser_BBCode(); // If you set it to false the case-sensitive will be ignored for all codes $bbcode->setGlobalCaseSensitive(false); $bbcode->setMixedAttributeTypes(true); $bbcode->addCode('b', 'simple_replace', null, array('start_tag' => '<strong>', 'end_tag' => '</strong>'), 'inline', array('listitem', 'block', 'inline', 'link'), array()); $bbcode->addCode('strong', 'simple_replace', null, array('start_tag' => '<strong>', 'end_tag' => '</strong>'), 'inline', array('listitem', 'block', 'inline', 'link'), array()); $bbcode->addCode('i', 'simple_replace', null, array('start_tag' => '<em>', 'end_tag' => '</em>'), 'inline', array('listitem', 'block', 'inline', 'link'), array()); $bbcode->addCode('em', 'simple_replace', null, array('start_tag' => '<em>', 'end_tag' => '</em>'), 'inline', array('listitem', 'block', 'inline', 'link'), array()); $bbcode->addCode('ins', 'simple_replace', null, array('start_tag' => '<ins>', 'end_tag' => '</ins>'), 'inline', array('listitem', 'block', 'inline', 'link'), array()); $bbcode->addCode('u', 'simple_replace', null, array('start_tag' => '<ins>', 'end_tag' => '</ins>'), 'inline', array('listitem', 'block', 'inline', 'link'), array()); $bbcode->addCode('del', 'simple_replace', null, array('start_tag' => '<del>', 'end_tag' => '</del>'), 'inline', array('listitem', 'block', 'inline', 'link'), array()); $bbcode->addCode('strike', 'simple_replace', null, array('start_tag' => '<del>', 'end_tag' => '</del>'), 'inline', array('listitem', 'block', 'inline', 'link'), array()); $bbcode->addCode('blockquote', 'simple_replace', null, array('start_tag' => '<blockquote><p>', 'end_tag' => '</p></blockquote>'), 'inline', array('listitem', 'block', 'inline', 'link'), array()); $bbcode->addCode('quote', 'simple_replace', null, array('start_tag' => '<blockquote><p>', 'end_tag' => '</p></blockquote>'), 'inline', array('listitem', 'block', 'inline', 'link'), array()); $bbcode->addCode('pre', 'simple_replace', null, array('start_tag' => '<pre>', 'end_tag' => '</pre>'), 'inline', array('listitem', 'block', 'inline', 'link'), array()); $bbcode->addCode('code', 'usecontent', 'do_bbcode_code', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array()); return $bbcode->parse($text); }
<?php require_once '../../lib/bbcode/stringparser.class.php'; require_once '../../lib/bbcode/stringparser_bbcode.class.php'; // see docs here : http://www.christian-seiler.de/projekte/php/bbcode/doc/en/chapter1.php if (isset($_REQUEST['text'])) { $old_text = $_REQUEST['text']; } else { $old_text = "ceci est un [b]test[/b] \n\n[h1]je vais à la ligne [/h1]\n\n[code] this is [b]code[/b] [/code]\n\nje continue\nd gfgùdfgld ùmgldfùg ldfùg lsdlkfj sdlfkjsdfsdf\nsdf lskdjflsdk jflskdfjsd f\n\nsdf sdfsd sdf"; } $bbcode = new StringParser_BBCode(); $bbcode->setGlobalCaseSensitive(false); // Unify line breaks of different operating systems function convertlinebreaks($text) { return preg_replace("/\r\n|\r|\n/", "\n", $text); } // Remove everything but the newline charachter function bbcode_stripcontents($text) { return preg_replace("/[^\n]/", '', $text); } function do_bbcode_url($action, $attributes, $content, $params, $node_object) { if ($action == 'validate') { return true; } if (!isset($attributes['default'])) { return '<a href="' . htmlspecialchars($content) . '">' . htmlspecialchars($content) . '</a>'; } return '<a href="' . htmlspecialchars($attributes['default']) . '">' . $content . '</a>';
function gf_formatOldPost($str, $postmode = 'html', $mode = '') { global $CONF_FORUM; $oldPost = 0; if ($CONF_FORUM['pre2.5_mode'] != true) { return $str; } if (strstr($str, '<pre class="forumCode">') !== false) { $oldPost = 1; } if (strstr($str, "[code]<code>") !== false) { $oldPost = 1; } if (strstr($str, "<pre>") !== false) { $oldPost = 1; } if (stristr($str, '[code') == false || stristr($str, '[code]<code>') == true) { if (strstr($str, "<pre>") !== false) { $oldPost = 1; } $str = str_replace('<pre>', '[code]', $str); $str = str_replace('</pre>', '[/code]', $str); } $str = str_ireplace("[code]<code>", '[code]', $str); $str = str_ireplace("</code>[/code]", '[/code]', $str); $str = str_replace(array("<br />\r\n", "<br />\n\r", "<br />\r", "<br />\n", "<br>\r\n", "<br>\n\r", "<br>\r", "<br>\n"), '<br' . XHTML . '>', $str); $str = preg_replace("/\\[QUOTE\\sBY=\\s(.+?)\\]/i", "[QUOTE] Quote by \$1:", $str); /* Reformat code blocks - version 2.3.3 and prior */ $str = str_replace('<pre class="forumCode">', '[code]', $str); $str = preg_replace("/\\[QUOTE\\sBY=(.+?)\\]/i", "[QUOTE] Quote by \$1:", $str); $bbcode = new StringParser_BBCode(); $bbcode->setGlobalCaseSensitive(false); // It is impossible to include block level elements in a <p> element. Therefore I fix this. $bbcode->setParagraphHandlingParameters("\n\n", "", ""); if ($postmode == 'text') { $bbcode->addParser(array('block', 'inline', 'link', 'listitem'), 'bbcode_htmlspecialchars'); } if ($CONF_FORUM['use_glfilter'] == 1 && ($postmode == 'html' || $postmode == 'HTML')) { $bbcode->addParser(array('block', 'inline', 'link', 'listitem'), 'gf_checkHTML'); // calls checkHTML on all text blocks } $bbcode->addParser(array('block', 'inline', 'link', 'list', 'listitem'), 'bbcode_oldpost'); $bbcode->addCode('code', 'simple_replace', null, array('start_tag' => '[code]', 'end_tag' => '[/code]'), 'code', array('listitem', 'block', 'inline', 'link'), array()); if ($CONF_FORUM['use_censor']) { $str = COM_checkWords($str); } $str = $bbcode->parse($str); // If we have identified an old post based on the checks above // it is possible that code blocks will have htmlencoded items // we need to reverse that ... if ($oldPost) { if (strstr($str, "\\'") !== false) { $str = stripslashes($str); } $str = str_replace("$", "\$", $str); $str = str_replace("<br />", "\r", $str); $str = str_replace("<br>", "\r", $str); $str = str_replace('&', '&', $str); $str = str_replace(''', '\'', $str); $str = str_replace('"', '"', $str); $str = str_replace('<', '<', $str); $str = str_replace('>', '>', $str); } $str = str_replace('\', '\\', $str); return $str; }
function parse_post($text, $allowsmilie = false) { global $nuke_quotes, $fr_platform, $images; $images = array(); if (is_ipb()) { // Replace <br.*/> with \n $text = preg_replace('#<br.*?/>#is', "\n", $text); } $smilies = false; $v = process_input(array('smilies' => BOOLEAN)); if (isset($v['smilies'])) { $smilies = $v['smilies'] === true; } // Trim each line $lines = preg_split("/\n/", $text); for ($i = 0; $i < count($lines); $i++) { $lines[$i] = trim($lines[$i]); } $text = join("\n", $lines); $text = prepare_utf8_string($text, false); $bbcode = new StringParser_BBCode(); $bbcode->setGlobalCaseSensitive(false); // Handle default BBCode $bbcode->addCode('quote', 'callback_replace', 'handle_quotes', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array('')); $bbcode->addCode('url', 'usecontent?', 'handle_url', array('usecontent_param' => 'default'), 'link', array('listitem', 'block', 'inline'), array('link')); $bbcode->addCode('source', 'usecontent?', 'handle_url', array('usecontent_param' => 'default'), 'link', array('listitem', 'block', 'inline'), array('link')); if (!is_mybb()) { // myBB wonky attachment codes are already handled $bbcode->addCode('attach', 'callback_replace', 'handle_attach', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array('')); } $bbcode->addCode('attach', 'callback_replace', 'handle_attach', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array('')); $bbcode->addCode('img', 'callback_replace', 'handle_image', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array('')); $bbcode->addCode('imgl', 'callback_replace', 'handle_image', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array('')); $bbcode->addCode('imgr', 'callback_replace', 'handle_image', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array('')); //$bbcode->addCode('spoiler', 'callback_replace', 'handle_spoiler', array(), 'inline', //array('listitem', 'block', 'inline', 'link'), array('')); $bbcode->addCode('b', 'callback_replace', 'handle_bbcode_bold', array('usecontent_param' => array('default')), 'inline', array('listitem', 'block', 'inline', 'link'), array()); $bbcode->addCode('i', 'callback_replace', 'handle_bbcode_italic', array('usecontent_param' => array('default')), 'inline', array('listitem', 'block', 'inline', 'link'), array()); $bbcode->addCode('color', 'callback_replace', 'handle_bbcode_color', array('usecontent_param' => array('default')), 'inline', array('listitem', 'block', 'inline', 'link'), array()); $bbcode->setCodeFlag('color', 'closetag', BBCODE_CLOSETAG_MUSTEXIST); // Video Link BBCode $bbcode->addCode('yt', 'callback_replace', 'fr_handle_youtube', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array('')); $bbcode->addCode('youtube', 'callback_replace', 'fr_handle_youtube', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array('')); $bbcode->addCode('video', 'callback_replace', 'handle_video', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array('')); $bbcode->addCode('ame', 'callback_replace', 'handle_video', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array('')); $bbcode->addCode('media', 'callback_replace', is_xen() ? 'handle_xen_media' : 'handle_video', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array('')); $bbcode->addCode('tex', 'callback_replace', 'fr_handle_tex', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array('')); if (function_exists('fr_branded_bbcode_handler')) { @fr_branded_bbcode_handler($bbcode); } if (is_mybb()) { $bbcode->setMixedAttributeTypes(true); } $nuked_quotes = $text; $text = htmlspecialchars_uni($text); $nuke_quotes = true; $nuked_quotes = $bbcode->parse($nuked_quotes); if (is_ipb()) { $nuked_quotes = ipb_handle_attachments($nuked_quotes); } $nuke_quotes = false; $text = $bbcode->parse($text); if (is_ipb()) { $text = ipb_handle_attachments($text); } // Snag out images preg_match_all('#\\[IMG\\](.*?)\\[/IMG\\]#is', $text, $matches); $text = preg_replace("#\\[IMG\\](.*?)\\[/IMG\\]#is", '', $text); $nuked_quotes = preg_replace("#\\[IMG\\](.*?)\\[/IMG\\]#is", '', $nuked_quotes); if ($smilies) { if (is_vb()) { global $vbulletin; $parser = new vB_BbCodeParser($vbulletin, fetch_tag_list()); $text = $parser->parse_smilies($text, false); $text = preg_replace_callback('#img src="(.*?)"#is', parse_post_callback, $text); } } $text = preg_replace("#\n\n\n+#", "\n\n", $text); $text = preg_replace("#\n#", "<br/>", $text); $text = remove_bbcode($text); $nuked_quotes = preg_replace("#\n\n\n+#", "\n\n", $nuked_quotes); $nuked_quotes = remove_bbcode($nuked_quotes); return array($text, $nuked_quotes, $images); }
function _ff_checkHTMLforSQL($str, $postmode = 'html') { global $_FF_CONF; $bbcode = new StringParser_BBCode(); $bbcode->setGlobalCaseSensitive(false); if ($postmode == 'html' || $postmode == 'HTML') { $bbcode->addParser(array('block', 'inline'), '_ff_cleanHTML'); } $bbcode->addCode('code', 'simple_replace', null, array('start_tag' => '[code]', 'end_tag' => '[/code]'), 'code', array('listitem', 'block', 'inline', 'link'), array()); $str = $bbcode->parse($str); return $str; }
/** * Parse text block and interpret BBcodes * * @param string $str text to parse * @param string $postmode Either html or text * @param array $parser Additional parsers for the bbcode interpreter * @param array $code Additional bbcodes * @return string the formatted string */ function BBC_formatTextBlock($str, $postmode = 'html', $parser = array(), $code = array()) { global $_CONF; $postmode = strtolower($postmode); $bbcode = new StringParser_BBCode(); $bbcode->setGlobalCaseSensitive(false); if ($postmode == 'text') { $bbcode->addParser(array('block', 'inline', 'link', 'listitem'), '_bbcode_htmlspecialchars'); $bbcode->addParser(array('block', 'inline', 'link', 'listitem'), 'nl2br'); } else { $bbcode->addParser(array('block', 'inline', 'link', 'listitem'), 'COM_checkHTML'); } $bbcode->addParser(array('block', 'inline', 'link', 'listitem'), '_bcode_replacetags'); $bbcode->addParser('list', '_bbcode_stripcontents'); if (is_array($parser) && count($parser) > 0) { foreach ($parser as $extraparser) { if (isset($extraparser[0])) { $parm1 = $extraparser[0]; } else { $parm1 = ''; } if (isset($extraparser[1])) { $parm2 = $extraparser[1]; } else { $parm2 = ''; } $bbcode->addParser($parm1, $parm2); // $extraparser[0],$extraparser[1]); } } $bbcode->addCode('b', 'simple_replace', null, array('start_tag' => '<b>', 'end_tag' => '</b>'), 'inline', array('listitem', 'block', 'inline', 'link'), array()); $bbcode->addCode('i', 'simple_replace', null, array('start_tag' => '<i>', 'end_tag' => '</i>'), 'inline', array('listitem', 'block', 'inline', 'link'), array()); $bbcode->addCode('u', 'simple_replace', null, array('start_tag' => '<span style="text-decoration: underline;">', 'end_tag' => '</span>'), 'inline', array('listitem', 'block', 'inline', 'link'), array()); $bbcode->addCode('p', 'simple_replace', null, array('start_tag' => '<p>', 'end_tag' => '</p>'), 'inline', array('listitem', 'block', 'inline', 'link'), array()); $bbcode->addCode('s', 'simple_replace', null, array('start_tag' => '<del>', 'end_tag' => '</del>'), 'inline', array('listitem', 'block', 'inline', 'link'), array()); $bbcode->addCode('size', 'callback_replace', '_bbcode_size', array('usecontent_param' => 'default'), 'inline', array('listitem', 'block', 'inline', 'link'), array()); $bbcode->addCode('color', 'callback_replace', '_bbcode_color', array('usercontent_param' => 'default'), 'inline', array('listitem', 'block', 'inline', 'link'), array()); $bbcode->addCode('list', 'callback_replace', '_bbcode_list', array('usecontent_param' => 'default'), 'list', array('inline', 'block', 'listitem'), array()); $bbcode->addCode('*', 'simple_replace', null, array('start_tag' => '<li>', 'end_tag' => '</li>'), 'listitem', array('list'), array()); $bbcode->addCode('quote', 'simple_replace', null, array('start_tag' => '</p><div class="quotemain"><img src="' . $_CONF['site_url'] . '/forum/images/img_quote.gif" alt=""/>', 'end_tag' => '</div><p>'), 'inline', array('listitem', 'block', 'inline', 'link'), array()); $bbcode->addCode('url', 'usecontent?', '_bbcode_url', array('usecontent_param' => 'default'), 'link', array('listitem', 'block', 'inline'), array('link')); $bbcode->addCode('img', 'usecontent', '_bbcode_img', array(), 'image', array('listitem', 'block', 'inline', 'link'), array()); $bbcode->addCode('code', 'usecontent', '_bbcode_code', array('usecontent_param' => 'default'), 'code', array('listitem', 'block', 'inline', 'link'), array()); if (is_array($code) && count($code) > 0) { foreach ($code as $extracode) { $bbcode->addCode($extracode[0], $extracode[1], $extracode[2], $extracode[3], $extracode[4], $extracode[5], $extracode[6]); } } $bbcode->setCodeFlag('quote', 'paragraph_type', BBCODE_PARAGRAPH_ALLOW_INSIDE); $bbcode->setCodeFlag('*', 'closetag', BBCODE_CLOSETAG_OPTIONAL); $bbcode->setCodeFlag('*', 'paragraphs', true); $bbcode->setCodeFlag('list', 'opentag.before.newline', BBCODE_NEWLINE_DROP); $bbcode->setCodeFlag('list', 'closetag.before.newline', BBCODE_NEWLINE_DROP); $bbcode->addParser(array('block', 'inline', 'link', 'listitem'), '_bbcode_replacetags'); $bbcode->setRootParagraphHandling(true); if ($_CONF['censormode']) { $str = COM_checkWords($str); } $str = $bbcode->parse($str); return $str; }
/** * formats posting texts into plain text for e-mail notifications using the stringparser bbcode class * http://www.christian-seiler.de/projekte/php/bbcode/ * * @param string $string * @return string */ function email_format($string) { global $settings; require_once 'modules/stringparser_bbcode/stringparser_bbcode.class.php'; $bbcode = new StringParser_BBCode(); $bbcode->setGlobalCaseSensitive(false); $bbcode->addCode('quote', 'simple_replace', null, array('start_tag' => '', 'end_tag' => ''), 'inline', array('listitem', 'block', 'inline', 'link', 'quote'), array()); if ($settings['bbcode'] == 1) { $bbcode->addParser('list', 'bbcode_stripcontents'); $bbcode->addCode('b', 'simple_replace', null, array('start_tag' => '*', 'end_tag' => '*'), 'inline', array('listitem', 'block', 'inline', 'link', 'quote', 'pre', 'monospace'), array()); $bbcode->addCode('i', 'simple_replace', null, array('start_tag' => '', 'end_tag' => ''), 'inline', array('listitem', 'block', 'inline', 'link', 'quote', 'pre', 'monospace'), array()); $bbcode->addCode('u', 'simple_replace', null, array('start_tag' => '', 'end_tag' => ''), 'inline', array('listitem', 'block', 'inline', 'link', 'quote', 'pre', 'monospace'), array()); $bbcode->addCode('url', 'usecontent?', 'do_bbcode_url_email', array('usecontent_param' => 'default'), 'link', array('listitem', 'block', 'inline', 'quote', 'pre', 'monospace'), array('link')); $bbcode->addCode('link', 'usecontent?', 'do_bbcode_url_email', array('usecontent_param' => 'default'), 'link', array('listitem', 'block', 'inline', 'quote', 'pre', 'monospace'), array('link')); if ($settings['bbcode_img'] == 1) { $bbcode->addCode('img', 'usecontent', 'do_bbcode_img_email', array(), 'image', array('listitem', 'block', 'inline', 'link', 'quote'), array()); } $bbcode->addCode('color', 'callback_replace', 'do_bbcode_color_email', array('start_tag' => '', 'end_tag' => ''), 'inline', array('listitem', 'block', 'inline', 'link', 'quote', 'pre', 'monospace'), array()); $bbcode->addCode('size', 'callback_replace', 'do_bbcode_size_email', array('start_tag' => '', 'end_tag' => ''), 'inline', array('listitem', 'block', 'inline', 'link', 'quote'), array()); $bbcode->addCode('list', 'simple_replace', null, array('start_tag' => '', 'end_tag' => ''), 'list', array('block', 'listitem'), array()); $bbcode->addCode('*', 'simple_replace', null, array('start_tag' => '* ', 'end_tag' => ''), 'listitem', array('list'), array()); $bbcode->setCodeFlag('*', 'closetag', BBCODE_CLOSETAG_OPTIONAL); #$bbcode->addCode ('code', 'simple_replace', null, array ('start_tag' => '', 'end_tag' => ''), 'code', array ('block', 'inline'), array ()); if ($settings['bbcode_code'] == 1) { $bbcode->addCode('code', 'usecontent', 'do_bbcode_code_email', array(), 'code', array('block', 'quote'), array()); $bbcode->addCode('pre', 'simple_replace', null, array('start_tag' => '', 'end_tag' => ''), 'pre', array('block', 'quote'), array()); $bbcode->addCode('inlinecode', 'simple_replace', null, array('start_tag' => '', 'end_tag' => ''), 'inline', array('listitem', 'block', 'inline', 'link', 'quote'), array()); $bbcode->addCode('monospace', 'simple_replace', null, array('start_tag' => '', 'end_tag' => ''), 'inline', array('listitem', 'block', 'inline', 'link', 'quote'), array()); } } $string = $bbcode->parse($string); return $string; }