SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | #bbcode.php by brennan 'thefatshizms' butler | |
| 3 | ||
| 4 | class BBcode {
| |
| 5 | ||
| 6 | public function BBcode_Message($input) {
| |
| 7 | ||
| 8 | //search for these bbcodes | |
| 9 | - | $search = array('/\[b\](.*?)\[\/b\]/is', '/\[i\](.*?)\[\/i\]/is', '/\[link=(.*?)\](.*?)\[\/link\]/is', '/\[list\](.*?)\[\/list\]/is', '/\[li\](.*?)\[\/li\]/is', '/\[size=(.*?)\](.*?)\[\/size\]/is', '/\[img\](.*?)\[\/img\]/is');
|
| 9 | + | $search = array('/\[b\](.*?)\[\/b\]/is', '/\[i\](.*?)\[\/i\]/is', '/\[link=(.*?)\](.*?)\[\/link\]/is', '/\[list\](.*?)\[\/list\]/is', '/\[li\](.*?)\[\/li\]/is', '/\[size=(.*?)\](.*?)\[\/size\]/is', '/\[img\](.*?)\[\/img\]/is', '/\[email\](.*?)\[\/email\]/is', '/\[background=(.*?)\](.*?)\[\/background\]/is', '/\[font=(.*?)\](.*?)\[\/font\]/is', '/\[s\](.*?)\[\/s\]/is');
|
| 10 | ||
| 11 | //replace the bbcodes with this html | |
| 12 | ||
| 13 | - | $replace = array('<b>$1</b>', '<i>$1</i>', '<a href="$1">$2</a>', '<ul>$1</ul>', '<li>$1</li>', '<span style="font-size:$1px;">$2</span>', '<img src="$1" alt=""/>');
|
| 13 | + | $replace = array('<b>$1</b>', '<i>$1</i>', '<a href="$1">$2</a>', '<ul>$1</ul>', '<li>$1</li>', '<span style="font-size:$1px;">$2</span>', '<img src="$1" alt=""/>', '<a href="mailto:$1">$1</a>', '<span style="background-color:#$1">$2</span>', '<span style="font-family:$1">$2</span>', '<strike>$1</strike>');
|
| 14 | ||
| 15 | return preg_replace($search, $replace, $input); | |
| 16 | ||
| 17 | } | |
| 18 | ||
| 19 | } | |
| 20 | ||
| 21 | ?> |