This repository has been archived on 2026-10-11. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
nessar b72a5862ca V1.0
Former-commit-id: 29c4a482aea62e2f5d35555db447a04dec79b7af [formerly 2c14d750366df58becddad5816f2189e9e14a23a]
Former-commit-id: b7072ab2cc46a0010054d4c0cfeaa026e5457844
2020-12-29 19:44:30 +01:00

32 lines
1.5 KiB
PHP

<?php
function code($texte)
{
//Smileys
$texte = str_replace(':D', '<img src="./images/smileys/heureux.png" title="heureux" alt="heureux" />', $texte);
$texte = str_replace(':lol: ', '<img src="./images/smileys/lol.png" title="lol" alt="lol" />', $texte);
$texte = str_replace(':triste:', '<img src="./images/smileys/triste.png" title="triste" alt="triste" />', $texte);
$texte = str_replace(':frime:', '<img src="./images/smileys/cool.png" title="cool" alt="cool" />', $texte);
$texte = str_replace('XD', '<img src="./images/smileys/rire.png" title="rire" alt="rire" />', $texte);
$texte = str_replace(':s', '<img src="./images/smileys/confus.png" title="confus" alt="confus" />', $texte);
$texte = str_replace(':O', '<img src="./images/smileys/choc.png" title="choc" alt="choc" />', $texte);
$texte = str_replace(':question:', '<img src="./images/smileys/question.png" title="?" alt="?" />', $texte);
$texte = str_replace(':exclamation:', '<img src="./images/smileys/exclamation.png" title="!" alt="!" />', $texte);
//Mise en forme du texte
//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('`\[url\](.+)\[/url\]`isU', '<a href="$1" target="_blank">$1</a>', $texte);
//quote
$texte = preg_replace('`\[quote\](.+)\[/quote\]`isU', '<div id="quote">$1</div>', $texte);
//etc., etc.
//On retourne la variable texte
return $texte;
}
?>