KumbiaPHP beta2-dev
Framework PHP en español
input.php
Ir a la documentación de este archivo.
00001 <?php
00022 class Input 
00023 {
00030         public static function is($method = NULL)
00031         {
00032                 if($method){                    
00033                         return $method == $_SERVER['REQUEST_METHOD'];
00034                 }
00035                 return $_SERVER['REQUEST_METHOD'];
00036         }
00037         
00043         public static function isAjax()
00044         {
00045                 return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest');
00046         }
00047         
00054         public static function post($var)
00055         {
00056                 return filter_has_var(INPUT_POST, $var) ? $_POST[$var] : NULL;
00057         }
00058 
00066         public static function get($var = NULL)
00067         {
00068                 if($var){
00069                         $value = filter_has_var(INPUT_GET, $var) ? filter_input(INPUT_GET, $var, FILTER_SANITIZE_STRING) : NULL;
00070                 } else {
00071                         $value = filter_input_array (INPUT_GET, FILTER_SANITIZE_STRING);
00072                 }
00073                         
00074                 return $value;
00075         }
00076 
00083         public static function request($var)
00084         {
00085                 return isset($_REQUEST[$var]) ? $_REQUEST[$var] : NULL;
00086         }
00087 
00094         public static function hasPost($var) 
00095         {
00096                 return filter_has_var(INPUT_POST, $var);
00097         }
00098 
00105         public static function hasGet($var)
00106         {
00107                 return filter_has_var(INPUT_GET, $var);
00108         }
00109 
00116         public static function hasRequest($var) 
00117         {
00118                 return isset($_REQUEST[$var]);
00119         }
00120         
00127         public static function delete($var = NULL) 
00128         {
00129                 if($var){
00130                         unset($_POST[$var]);
00131                 } else {
00132                         unset($_POST);
00133                 }
00134         }
00135         
00143         public static function filter($var)
00144     {
00145                 //TODO
00146     }
00147 }
 Todo Estructuras de Datos Namespaces Archivos Funciones Variables Enumeraciones