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
| function code($texte, $mp3_file){
//Smileys
//gras
$texte = preg_replace('`\[g\](.+)\[/g\]`isU', '<strong>$1</strong>', $texte);
//italique
$texte = preg_replace('`\[i\](.+)\[/i\]`isU', '<em>$1</em>', $texte);
//souligné
$texte = preg_replace('`\[s\](.+)\[/s\]`isU', '<u>$1</u>', $texte);
//lien
$texte = preg_replace('`\[img\]http:(.+)\[/img\]`isU', '<img src="$1"/>', $texte);
$texte = preg_replace('#http://[a-z0-9._/-]+#i', '<a href="$0" target="_blank">$0</a>', $texte);
//$texte = preg_replace('#\[quote\](.+)\[/quote\]#isU', '<div class="quote"><p><strong>Citation : </strong></p>$1</div>', $texte);
$texte = replace_quotes($texte);
$texte = preg_replace('#\[size=([0-9]{1,2})](.*?)\[/size\]#s', '<font style="font-size: $1px;">$2</font>', $texte);
$texte = str_replace(':D:', '<img src="http://'.$_SERVER['HTTP_HOST'].'/forum/images/smileys/happy.png" title="heureux" alt="heureux" />', $texte);
$texte = str_replace(':lol: ', '<img src="http://'.$_SERVER['HTTP_HOST'].'/forum/images/smileys/lol.png" title="lol" alt="lol" />', $texte);
$texte = str_replace(':sad:', '<img src="http://'.$_SERVER['HTTP_HOST'].'/forum/images/smileys/sad.png" title="triste" alt="triste" />', $texte);
$texte = str_replace(':cool:', '<img src="http://'.$_SERVER['HTTP_HOST'].'/forum/images/smileys/cool.png" title="cool" alt="cool" />', $texte);
$texte = str_replace(':inlove:', '<img src="http://'.$_SERVER['HTTP_HOST'].'/forum/images/smileys/inlove.png" title="in love" alt="in love" />', $texte);
$texte = str_replace(':angry:', '<img src="http://'.$_SERVER['HTTP_HOST'].'/forum/images/smileys/angry.png" title="angry" alt="angry" />', $texte);
if($mp3_file != ""){
$texte = str_replace(':mp3:', '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'.MP3_PLAYER_WIDTH.'" height="'.MP3_PLAYER_HEIGHT.'"><param name="movie" value="../swf/mp3_player2.swf"><param name="quality" value="high"><param name="flashvars" value="mp3=../swf/mp3/'.$mp3_file.'"><embed src="../swf/mp3_player2.swf" flashvars="mp3=../swf/mp3/'.$mp3_file.'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'.MP3_PLAYER_WIDTH.'" height="'.MP3_PLAYER_HEIGHT.'"></embed></object>', $texte);
}
//On retourne la variable texte
return $texte;
} |
Partager