Created
October 27, 2014 21:18
-
-
Save chtombleson/1fec44e1701647a5f8c2 to your computer and use it in GitHub Desktop.
Raw PHP sanitisation class
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
class Sanitise | |
{ | |
public function get($name, $filter, $options=null) | |
{ | |
return $this->sanitise(INPUT_GET, $name, $filter, $options); | |
} | |
public function post($name, $filter, $options=null) | |
{ | |
return $this->sanitise(INPUT_POST, $name, $filter, $options); | |
} | |
public function cookie($name, $filter, $options=null) | |
{ | |
return $this->sanitise(INPUT_COOKIE, $name, $filter, $options); | |
} | |
public function server($name, $filter, $options=null) | |
{ | |
return $this->sanitise(INPUT_SERVER, $name, $filter, $options); | |
} | |
public function env($name, $filter, $options=null) | |
{ | |
return $this->sanitise(INPUT_ENV, $name, $filter, $options); | |
} | |
private funciton sanitise($type, $name, $filter, $options=null) | |
{ | |
return filter_input($type, $name, $filter, $options); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
private funciton sanitise - "function" is mis-spelled.