All pastes #899999 Raw Edit

Miscellany

public php v1 · immutable
·published 2008-02-11 16:21 UTC
rendered paste body
   function bb2($str)   {       $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=(.+)\](.*)\[/size\]#isU',            '#\[(quote)=([a-z0-9]*)\](.*)\[\/\1\]#isU',            '#\[syntax="(.+)"\](.*)\[/syntax\]#isUe',            '#\[ ?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: \1px>\2</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="border: 1px solid"><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="white-space:pre;border: 1px solid">\' . $this->getsyntax((\'\1\' == \'es\' ? \'eventscripts\' : \'\1\'), \'\2\') . \'</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;    }