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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| if ($signature != "") {
$BBCode = array (
'#\[bold\](.+)\[/bold\]#isU',
'#\[italic\](.+)\[/italic\]#isU',
'#\[underline\](.+)\[/underline\]#isU',
'#\[line-through\](.+)\[/line-through\]#isU',
'#\[overline\](.+)\[/overline\]#isU',
'#\[ul\](.+)\[/ul\]#isU',
'#\[ol\](.+)\[/ol\]#isU',
'#\[li\](.+)\[/li\]#isU',
'#\[spoiler\](.+)\[/spoiler\]#isU',
'#\[quote=(.+)\](.+)\[/quote\]#isU',
'#\[code\](.+)\[/code\]#isU',
'#\[url=(.+)\](.+)\[/url\]#isU',
'#\[img\](.+)\[/img\]#isU',
'#\[video\](.+)\[/video\]#isU',
'#\[color=(.+)\](.+)\[/color\]#isU',
'#\[size=(.+)\](.+)\[/size\]#isU',
'#\[left\](.+)\[/left\]#isU',
'#\[center\](.+)\[/center\]#isU',
'#\[right\](.+)\[/right\]#isU',
'#\[justify\](.+)\[/justify\]#isU',
);
$html = array(
'<span style="font-weight:bold">$1</span>',
'<span style="font-style:italic">$1</span>',
'<span style="text-decoration:underline">$1</span>',
'<span style="text-decoration:line-through">$1</span>',
'<span style="text-decoration:overline">$1</span>',
'<ul>$1</ul>',
'<ol>$1</ol>',
'<li>$1</li>',
'<div class="spoiler">$1</div>',
'<blockquote><span style="font-weight:bold">Citation de : $1</span><br/>$2</blockquote>',
'<div class="code">$1</div>',
'<a href="$1" class="lien">$2</a>',
'<img src="$1" alt="Image utilisateur" />',
'<div class="video">$1</div>', //A changer
'<span style="color:$1">$2</span>',
'<span style="font-size:$1">$2</span>',
'<div style="text-align:left">$1</div>',
'<div style="text-align:center">$1</div>',
'<div style="text-align:right">$1</div>',
'<div style="text-align:justify">$1</div>',
);
$signature = htmlspecialchars($signature, ENT_QUOTES);
$signature = preg_replace($BBCode, $html, $signature);
$signature = preg_replace('#\n#isU', '<br />', $signature);
$liste = preg_match('#<ul>.+</ul>#isU', $signature);
$listeNew = preg_replace('#<br />#isU', '', $liste);
$signature = preg_replace($liste, $listeNew, $signature);
} |
Partager