1 2 3 4 5 6 7 8 9 10 11 12 13 14
| <?php
function get_bbcode($text)
{
$text=nl2br($text);
$text = preg_replace('!\[g\](.+)\/g\!isU', '<strong>$1</strong>', $text);
$text = preg_replace('!\[i\](.+)\/i\!isU', '<em>$1</em>', $text);
$text = preg_replace('!\[s\](.+)\/s\!isU', '<span style="text-decoration:underline;">$1</span>', $text);
$text = preg_replace('!\[centre\](.+)\/centre\!isU', '<p tyle="text-align:center;margin:0px;padding:0px;">$1</p>', $text);
$text = preg_replace('!\[droite\](.+)\/droite\!isU', '<p style="text-align:right;margin:0px;padding:0px;">$1</p>', $text);
$text = preg_replace('!\[gauche\](.+)\/gauche\!isU', '<p style="text-align:left;margin:0px;padding:0px;">$1</p>', $text);
$text = preg_replace('!\[justifie\](.+)\/justifie\!isU', '<p style="text-align:justify;margin:0px;padding:0px;">$1</p>', $text);
$text = preg_replace('!\[titre\](.+)\/titre\!isU', '<h3>$1</h3>',$text);
} //etc...
?> |
Partager