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 66 67 68
| public function parse($content) {
return $this->clean($content);
}
private function clean($content) {
$vdcode = array(
'#\[gras](.+)\[/gras]#isU',
'#\[italique](.+)\[/italique]#isU',
'#\[souligne](.+)\[/souligne]#isU',
'#\[barre](.+)\[/barre]#isU',
'#\[surligne](.+)\[/surligne]#isU',
'#\[exp](.+)\[/exp]#isU',
'#\[ind](.+)\[/ind]#isU',
'#\[gauche](.+)\[/gauche]#isU',
'#\[centrer](.+)\[/centrer]#isU',
'#\[justifie](.+)\[/justifie]#isU',
'#\[droite](.+)\[/droite]#isU',
'#\[lnombre](.+)\[/lnombre]#isU',
'#\[lpuce](.+)\[/lpuce]#isU',
'#\[li](.+)\[/li]#isU',
'#\[T1](.+)\[/T1]#isU',
'#\[T2](.+)\[/T2]#isU',
'#\[T3](.+)\[/T3]#isU',
'#\[T4](.+)\[/T4]#isU',
'#\[tableau](.+)\[/tableau]#isU',
'#\[ligne](.+)\[/ligne]#isU',
'#\[cel](.+)\[/cel]#isU',
'#\[lien url="(.+)"](.+)\[/lien]#isU',
'#\[image legende="(.+)"](.+)\[/image]#isU',
'#\[citation auteur="(.+)"](.+)\[/citation]#isU',
'#\[couleur nom="(.+)"](.+)\[/couleur]#isU',
'#\[background couleur="(.+)"](.+)\[/background]#isU',
'#\[taille valeur="(.+)"](.+)\[/taille]#isU',
'#\[bordure type="(.+)"](.+)\[/bordure]#isU'
);
$tags = array(
'<strong>$1</strong>',
'<em>$1</em>',
'<span class="underline">$1</span>',
'<span class="linethrough">$1</span>',
'<span class="overline">$1</span>',
'<sup>$1</sup>',
'<sub>$1</sub>',
'</p><p class="left">$1</p><p>',
'</p><p class="center">$1</p><p>',
'</p><p class="justify">$1</p><p>',
'</p><p class="right">$1</p><p>',
'</p><ol>$1</ol><p>',
'</p><ul>$1</ul><p>',
'<li>$1</li>',
'</p><h1>$1</h1><p>',
'</p><h1>$1</h2><p>',
'</p><h1>$1</h3><p>',
'</p><h1>$1</h4><p>',
'</p><div class="usertable"><table>$1</table></div><p>',
'<tr>$1</tr>',
'<td>$1</td>',
'<a href="$1">$2</a>',
'<img src="$2" alt="$1" />',
'</p><blockquote cite="$1">$2</blockquote><p>',
'<span class="$1">$2</span>',
'<span class="$1">$2</span>',
'<span class="$1">$2</span>',
'<span class="$1">$2</span>'
);
$content = htmlentities($content, ENT_QUOTES, 'iso-8859-15');
$content = preg_replace($vdcode, $tags, $content);
return $content;
} |
Partager