hice unas pruebas con el KSES:
Aquí les dejo el resultado:
form:
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>NUCKLEAR</title>
</head>
<body>
<?php
include '../kses.php';
$allowed = array('b' => array(),
'i' => array(),
'a' => array('href' => array('minlen' => 3, 'maxlen' => 50),
'title' => array('valueless' => 'n')),
'p' => array('align' => 1,
'dummy' => array('valueless' => 'y')),
'img' => array('src' => 1), # FIXME
'font' => array('size' =>
array('minval' => 4, 'maxval' => 20)),
'br' => array());
if(isset($_POST['entrada']))
{
$val=$_POST['entrada'];
$val = stripslashes($val);
$sal = kses($val, $allowed, array('http', 'https'));
}
else
{
$val="Introduzca el texto HTML";
$sal="No se ha introducido texto HTML";
}
?>
<form name="form1" id="form1" method="post">
<div style="border:#003366 solid 1px; background-color:#FFFFCC; width:50%;">
<table width="100%">
<tr>
<td width="20%"><label for="entrada">Entrada: </label></td><td width="80%"><textarea name="entrada" rows="5" cols="30" onclick="if(this.value=='Introduzca el texto HTML'){this.value='';}"><?php echo htmlspecialchars($val); ?></textarea></td>
</tr>
<tr>
<td><label for="salida">Salida: </label></td><td><textarea name="salida" rows="5" cols="30" readonly="readonly"><?php echo htmlspecialchars($sal); ?></textarea></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="Enviar" value="Enviar" /></td>
</tr>
</table>
</div>
</form>
<br /><br />
<h3>Interpretación:</h3>
<div style="border:solid #003366 1px; background-color:#FFFFCC; color:#000000; width:50%;">
<?php echo $sal;?>
</div>
</body>
</html>
el script que hace la validacion lo pueden bajar de aqui
http://sourceforge.net/projects/kses
ya que esta muy largo para publicarlo aqui!
Saludos