Plus çà va et plus j'ai d'idées... alors je préfère en attendant te donner une exclusivité :
<?php
$CrLf = chr(13).chr(10);
$CrLf_linux = chr(10);
$HtmlTable_from = array ('[b]', '[/b]', '[i]', '[/i]', '[u]', '[/u]', '[code]', '[/code]', '[quote]', '[/quote]', '[small]', '[/small]', '[blue]', '[/blue]', '[red]', '[/red]', '[green]', '[/green]', '[purple]', '[/purple]', '[navy]', '[/navy]', '[black]', '[/black]');
$HtmlTable_dest = array ('<b>', '</b>', '<i>', '</i>', '<u>', '</u>', '<code>', '</code>', '<blockquote><font size=2><i>', '</i></font></blockquote>', '<small>', '</small>', '<font color="blue">', '</font>', '<font color="red">', '</font>', '<font color="green">', '</font>', '<font color="purple">', '</font>', '<font color="navy">', '</font>', '<font color="black">', '</font>');
function CrLfToBR($Text) {
global $CrLf, $CrLf_linux;
$Text = str_replace($CrLf,'<br>',$Text);
$Text = str_replace($CrLf_linux,'<br>',$Text);
return $Text;
}
function HtmlReplacement($Value) {
global $HtmlTable_from, $HtmlTable_dest;
$Idx = 0;
foreach($HtmlTable_from as $s) {
$Value = str_replace($s,$HtmlTable_dest[$Idx],$Value);
$Idx++;
}
return $Value;
}
function Linking($Value) {
//INITIALISATION
$Opn = 0;
$Cls = 1;
$KeyO = '[link]';
$KeyC = '[/link]';
//TRAITEMENT
while ($Cls>$Opn) {
$Opn = strpos($Value,$KeyO);
$Cls = strpos($Value,$KeyC);
if ($Cls>$Opn) {
$Link = substr($Value,$Opn+strlen($KeyO),$Cls-$Opn-strlen($KeyO));
$Value = str_replace($KeyO.$Link.$KeyC,'<a href="'.$Link.'" target="_blank">'.$Link.'</a>',$Value);
//NDLR: cette fonction ne requiert pas de HTLMENTITIES étant donné que ce filtre a déjà été appliqué par la fonction DISPLAY
}
}
return $Value;
}
function Display($Value) {
$Value = htmlentities($Value); //NDLR: c'est FONDAMENTAL !!!!!!
$Value = CrLfToBR($Value);
$Value = SmileyReplacement($Value);
$Value = Linking($Value);
$Value = HtmlReplacement($Value);
return $Value;
}
?>
Pour appliquer les styles, tu utilises la fonction Display($Value);
Le comble c'est qu'il y a transformation des URL via [link] et [/link].
Je te redirai tout ça si ceci ne marche pas...
=============
Validez les réponses si ok...
ViewVite : HTML