Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function bbc($string){
- // All the default bbcode arrays.
- $bbcode = array(
- //Text Apperence
- '#\[b\](.*?)\[/b\]#si' => '<b>\\1</b>',
- '#\[i\](.*?)\[/i\]#si' => '<i>\\1</i>',
- '#\[u\](.*?)\[/u\]#si' => '<u>\\1</u>',
- '#\[s\](.*?)\[/s\]#si' => '<strike>\\1</strike>',
- //Font Color
- '#\[color=(.*?)\](.*?)\[/color\]#si' => '<font color="\\1">\\2</font>',
- //Text Effects
- '#\[bl\](.*?)\[/bl\]#si' => '<blink>\\1</blink>',
- '#\[marquee\](.*?)\[/marquee\]#si' => '<marquee>\\1</marquee>',
- //Other
- '#\[code\](.*?)\[/code]#si' => '<code>\\1</code>',
- '#\[url=(.*?)\](.*?)\[/url]#si' => '<a href="\\1" rel="nofollow" target="_blank">\\2</a>',
- '#\[url](.*?)\[/url]#si' => '<a href="\\1" rel="nofollow" target="_blank">\\1</a>',
- '#\[quote\](.*?)\[/quote\]#si' => '<blockquote>\\1</blockquote>',
- '#\[img\](.*?)\[/img\]#si' => '<img src="\\1">',
- '#\[email\](.*?)\[/email\]#si' => '<a href="mailto:\\1">\\1</a>'
- );
- $output = preg_replace(array_keys($bbcode), array_values($bbcode), $string);
- return $output;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement