All pastes #633104 Raw Edit

Someone

public php v1 · immutable
#633104 ·published 2007-07-25 13:42 UTC
rendered paste body
function bb2($str){        if (preg_match('#\[(syntax)=\"(.+)\"\](.*)\[/syntax\]#isU', $str, $matches))        {        include_once('./system/application/libraries/geshi.php');        if ($matches[2] == 'es') {                $matches[2] = 'eventscripts';        }        $geshi =& new GeSHi($matches[3], $matches[2]);        $syntax = $geshi->parse_code();        } else {        $syntax = "";        }    $find = array('#\[ ?b *\](.+)\[ ?/b *\]#isU',        '#\[ ?i *\](.+)\[ ?/i *\]#isU',        '#\[ ?u *\](.+)\[ ?/u *\]#isU',        '#\[ ?s *\](.+)\[ ?/s *\]#isU',        '#\[(colou*r)=(.+)\](.*)\[\/\1\]#isU',        '#\[ ?quote *\](.+)\[ ?/quote *\]#isU',        '#\[ ?list *\](.+)\[ ?/list *\]#isU',        '#\[ ?\* *\](.+)\n#isU',        '#\[(size)=([0-9]*)\](.*)\[\/\1\]#isU',        '#\[(quote)=([a-z0-9]*)\](.*)\[\/\1\]#isU',        '#\[(syntax)=\"(.+)\"\](.*)\[/syntax\]#isU',        '#\[ ?code *\](.+)\[ ?/code *\]#isU',        '#\[ ?img *\](.+)\[ ?/img *\]#isU',        '#\[url=(https?:\/\/)([^\]]*)\](.*)\[\/url\]#isU',        '#\[url=([^\]]*)\](.*)\[\/url\]#isU',        '#\[url\](https?:\/\/)([^\[]*)\[\/url\]#isU',        '#\[url\]([^\[]*)\[\/url\]#isU',        '#\n#');    $replace = array('<b>\1</b>',        '<i>\1</i>',        '<u>\1</u>',        '<s>\1</s>',        '<span style="color: \2">\3</span>',        '<table width="100%" bgcolor="lightgray"><tr><td bgcolor="white">\1</td></tr></table>',        '<ul>\1</ul>',        '<li>\1</li>',        '<span style="font-size: \2">\3</span>','<table style="padding-left:30px" cellspacing="1" cellpadding="3" width="100%" border="0"><tr><td><b>\2 wrote:</b></td></tr><tr><td style="background:#F0F0F0"><br/>\3<br /></td></tr></table>','<table style="padding-left:30px" cellspacing="1" cellpadding="3" width="100%" border="0"><tr><td></td></tr><tr><td style="background:#F3F3F8; white-space:pre">'.$syntax.'</td></tr></table>',        '<table style="padding-left:30px" width="100%"><tr><td bgcolor="white"><code>\1</code></td></tr></table>',        '<img src="\1" alt="" />',        '<a href="\1\2">\3</a>',        '<a href="http://\1">\2</a>',        '<a href="\1\2">\2</a>',        '<a href="http://\1">\1</a>',        '<br />');    $str = preg_replace($find, $replace, $str);    return $str;}