Input filtering trait for PHP