bbcodes['b'] = '{CONTENT}'; $this->bbcodes['i'] = '{CONTENT}'; $this->bbcodes['u'] = '{CONTENT}'; $this->bbcodes['url'] = '{CONTENT}'; $this->bbcodes2['url'] = '{CONTENT}'; $this->bbcodes['img'] = ''; $this->bbcodes2['img'] = ''; $this->bbcodes['big'] = '{CONTENT}'; $this->bbcodes['small'] = '{CONTENT}'; $this->bbcodes['ul'] = '
{CONTENT}
';
$this->bbcodes['pre'] = '{CONTENT}
';
$this->bbcodes['pref'] = '{CONTENT}'; $this->bbcodes2['blog'] = '{CONTENT}'; $this->bbcodes['quote'] = '#{CONTENT}'; $this->bbcodes2['quote'] = '{CONTENT}'; $this->bbcodes['ins'] = '{CONTENT}'; $this->bbcodes['del'] = '
{CONTENT}
{CONTENT}
') !== -1) { $to_parse = substr_replace($to_parse, str_replace('[br]', '', substr($to_parse, strpos($to_parse, $otag) + strlen($otag), strpos($to_parse, $ctag) - (strpos($to_parse, $otag) + strlen($otag)))), strpos($to_parse, $otag) + strlen($otag), strpos($to_parse, $ctag) - (strpos($to_parse, $otag) + strlen($otag))); } $value = str_replace('{CONTENT}', '\1', $value); $to_parse = preg_replace('/\[' . $name . ':' . $bbcode_uid . '\](.*)\[\/' . $name . ':' . $bbcode_uid . '\]/', $value, $to_parse); } } foreach ($this->bbcodes2 as $name => $value) { while (strpos($to_parse, '[' . $name . '=') !== FALSE) { $bbcode_uid = unique_id(); $bbpos = strpos($to_parse, '[' . $name . '='); $to_parse = substr_replace($to_parse, '[' . $name . ':' . $bbcode_uid . '=', $bbpos, strlen($name) + 2); $to_parse = substr_replace($to_parse, '[/' . $name . ':' . $bbcode_uid . ']', strpos(substr($to_parse, $bbpos), '[/' . $name . ']') + $bbpos, strlen($name) + 3); $value = str_replace('{PARAM}', '\1', $value); $value = str_replace('{CONTENT}', '\2', $value); $to_parse = preg_replace('/\[' . $name . ':' . $bbcode_uid . '=([^\]]*)\](.*)\[\/' . $name . ':' . $bbcode_uid . '\]/', $value, $to_parse); } } return str_replace('[br]','
',$to_parse); } } function parseBBCode($text) { static $bbcode; if (!isset($bbcode)) { $bbcode = new BBCode(); } return $bbcode->parseBBCode($text); } ?>