1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
// Je remplace les balises bb comprises entre des balises HTML
$texte = preg_replace('#(\[HTML\].*)<h1>(.*?)</h1>(.*\[/HTML\])#m', '$1<SPAN CLASS="balisehtml"><h1></SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml"></h1></SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)<h2>(.*?)</h2>(.*\[/HTML\])#m', '$1<SPAN CLASS="balisehtml"><h2></SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml"></h2></SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)<h3>(.*?)</h3>(.*\[/HTML\])#m', '$1<SPAN CLASS="balisehtml"><h3></SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml"></h3></SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)<h4>(.*?)</h4>(.*\[/HTML\])#m', '$1<SPAN CLASS="balisehtml"><h4></SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml"></h4></SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)<h5>(.*?)</h5>(.*\[/HTML\])#m', '$1<SPAN CLASS="balisehtml"><h5></SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml"></h5></SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)<h6>(.*?)</h6>(.*\[/HTML\])#m', '$1<SPAN CLASS="balisehtml"><h6></SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml"></h6></SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)(.*?)<br>(.*\[/HTML\])#m', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml"><br></SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)(.*?)<br />(.*\[/HTML\])#m', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml"><br /></SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)<p>(.*?)</p>(.*\[/HTML\])#m', '$1<SPAN CLASS="balisehtml"><p></SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml"></p></SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)<em>(.*?)</em>(.*\[/HTML\])#m', '$1<SPAN CLASS="balisehtml"><em></SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml"></em></SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)<strong>(.*?)</strong>(.*\[/HTML\])#m', '$1<SPAN CLASS="balisehtml"><strong></SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml"></strong></SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)<html>(.*?)</html>(.*\[/HTML\])#m', '$1<SPAN CLASS="balisehtml"><html></SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml"></html></SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)<title>(.*?)</title>(.*\[/HTML\])#m', '$1<SPAN CLASS="balisehtml"><title></SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml"></title></SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)<head>(.*?)</head>(.*\[/HTML\])#m', '$1<SPAN CLASS="balisehtml"><head></SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml"></head></SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)<body>(.*?)</body>(.*\[/HTML\])#m', '$1<SPAN CLASS="balisehtml"><body></SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml"></body></SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)<q>(.*?)</q>(.*\[/HTML\])#m', '$1<SPAN CLASS="balisehtml"><q></SPAN><SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml"></q></SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)<a(.*?)>(.*\[/HTML\])#m', '$1<SPAN CLASS="balisehtml"><a</SPAN> $2<SPAN CLASS="balisehtml">></SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)<acronym(.*?)>(.*\[/HTML\])#m', '$1<SPAN CLASS="balisehtml"><acronym</SPAN> $2<SPAN CLASS="balisehtml">></SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)<html(.*?)>(.*\[/HTML\])#m', '$1<SPAN CLASS="balisehtml"><html</SPAN> $2<SPAN CLASS="balisehtml">></SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)<body(.*?)>(.*\[/HTML\])#m', '$1<SPAN CLASS="balisehtml"><body</SPAN> $2<SPAN CLASS="balisehtml">></SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)>(.*?)</a>(.*\[/HTML\])#m', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml"></a></SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)>(.*?)</acronym>(.*\[/HTML\])#m', '$1<SPAN CLASS="balisehtmltexte">$2</SPAN><SPAN CLASS="balisehtml"></acronym></SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)<img(.*?)/>(.*\[/HTML\])#m', '$1<SPAN CLASS="balisehtml"><img</SPAN> $2<SPAN CLASS="balisehtml">/></SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)<img(.*?)>(.*\[/HTML\])#m', '$1<SPAN CLASS="balisehtml"><img</SPAN> $2<SPAN CLASS="balisehtml">></SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)<span(.*?)>(.*\[/HTML\])#m', '$1<SPAN CLASS="balisehtml"><span</SPAN> $2<SPAN CLASS="balisehtml">></SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)class="(.*?)"(.*\[/HTML\])#m', '$1 <SPAN CLASS="balisehtmltype">class</SPAN>=<SPAN CLASS="balisehtmlname">"$2"</SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)http-equiv="(.*?)"(.*\[/HTML\])#m', '$1 <SPAN CLASS="balisehtmltype">http-equiv</SPAN>=<SPAN CLASS="balisehtmlname">"$2"</SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)xmlns="(.*?)"(.*\[/HTML\])#m', '$1 <SPAN CLASS="balisehtmltype">xmlns</SPAN>=<SPAN CLASS="balisehtmlname">"$2"</SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)content="(.*?)"(.*\[/HTML\])#m', '$1 <SPAN CLASS="balisehtmltype">content</SPAN>=<SPAN CLASS="balisehtmlname">"$2"</SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)rel="(.*?)"(.*\[/HTML\])#m', '$1 <SPAN CLASS="balisehtmltype">rel</SPAN>=<SPAN CLASS="balisehtmlname">"$2"</SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)media="(.*?)"(.*\[/HTML\])#m', '$1 <SPAN CLASS="balisehtmltype">media</SPAN>=<SPAN CLASS="balisehtmlname">"$2"</SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)type="(.*?)"(.*\[/HTML\])#m', '$1 <SPAN CLASS="balisehtmltype">type</SPAN>=<SPAN CLASS="balisehtmlname">"$2"</SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)href="(.*?)"(.*\[/HTML\])#m', '$1 <SPAN CLASS="balisehtmltype">href</SPAN>=<SPAN CLASS="balisehtmlname">"$2"</SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)title="(.*?)"(.*\[/HTML\])#m', '$1 <SPAN CLASS="balisehtmltype">title</SPAN>=<SPAN CLASS="balisehtmlname">"$2"</SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)alt="(.*?)"(.*\[/HTML\])#m', '$1 <SPAN CLASS="balisehtmltype">alt</SPAN>=<SPAN CLASS="balisehtmlname">"$2"</SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)src="(.*?)"(.*\[/HTML\])#m', '$1 <SPAN CLASS="balisehtmltype">src</SPAN>=<SPAN CLASS="balisehtmlname">"$2"</SPAN>$3', $texte);
$texte = preg_replace('#(\[HTML\].*)target=(.*?) (.*\[/HTML\])#m', '$1 <SPAN CLASS="balisehtmltype">target</SPAN>=<SPAN CLASS="balisehtmlnameautre">$2</SPAN>$3', $texte);
// je supprime les balises HTML
$texte = preg_replace('#\[HTML\](.*)\[/HTML\]#m','<br><span class="codetype">CODE HTML :</span><div class="code">$1</div>', $texte);
echo $texte;
?> |
Partager