No se si funcione, pero me imagino que si.. la forma mas simple que se me ocurre es usando
array_map().
Código PHP:
$_GET = array_map('htmlentities', $_GET);
$_POST = array_map('htmlentities', $_POST);
Aunque para prevenir sql-injectin y eso, tmb tienes addslashes, mysql_real_escape_string() y algunas más.
Saludos