Last active
December 17, 2015 13:49
-
-
Save juniovitorino/5619856 to your computer and use it in GitHub Desktop.
WordPress Recursive XSS Sanitization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// XSS HTTP Treatment | |
add_filter('init', 'xssTreatment'); | |
function xssTreatment() { | |
foreach(array($_GET, $_POST, $_REQUEST) as $httpConst) XSSSanitization( $httpConst ); | |
} | |
function XSSSanitization(&$param) { | |
if(!is_array( $param ) && is_string( $param ) ) $param = filter_var($param, FILTER_SANITIZE_STRING); | |
else if( is_array( $param ) ) foreach( $param as $key => $value ) XSSSanitization( $param[$key] ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment