1 | <?php |
||
22 | class Input |
||
23 | { |
||
24 | /** |
||
25 | * Verifica o obtiene el metodo de la peticion |
||
26 | * |
||
27 | * @param string $method |
||
28 | * @return mixed |
||
29 | */ |
||
30 | public static function is($method = '') |
||
37 | |||
38 | /** |
||
39 | * Indica si el request es AJAX |
||
40 | * |
||
41 | * @return boolean |
||
42 | */ |
||
43 | public static function isAjax() |
||
47 | |||
48 | /** |
||
49 | * Detecta si el Agente de Usuario (User Agent) es un móvil |
||
50 | * |
||
51 | * @return boolean |
||
52 | */ |
||
53 | public static function isMobile() |
||
57 | |||
58 | /** |
||
59 | * Obtiene un valor del arreglo $_POST |
||
60 | * |
||
61 | * @param string $var |
||
62 | * @return mixed |
||
63 | */ |
||
64 | public static function post($var = '') |
||
68 | |||
69 | /** |
||
70 | * Obtiene un valor del arreglo $_GET, aplica el filtro FILTER_SANITIZE_STRING |
||
71 | * por defecto |
||
72 | * |
||
73 | * @param string $var |
||
74 | * @return mixed |
||
75 | */ |
||
76 | public static function get($var = '') |
||
80 | |||
81 | /** |
||
82 | * Obtiene un valor del arreglo $_REQUEST |
||
83 | * |
||
84 | * @param string $var |
||
85 | * @return mixed |
||
86 | */ |
||
87 | public static function request($var = '') |
||
91 | |||
92 | |||
93 | /** |
||
94 | * Obtiene un valor del arreglo $_SERVER |
||
95 | * |
||
96 | * @param string $var |
||
97 | * @return mixed |
||
98 | */ |
||
99 | public static function server($var = '') |
||
103 | |||
104 | /** |
||
105 | * Verifica si existe el elemento indicado en $_POST |
||
106 | * |
||
107 | * @param string $var elemento a verificar |
||
108 | * @return boolean |
||
109 | */ |
||
110 | public static function hasPost($var) |
||
114 | |||
115 | /** |
||
116 | * Verifica si existe el elemento indicado en $_GET |
||
117 | * |
||
118 | * @param string $var elemento a verificar |
||
119 | * @return boolean |
||
120 | */ |
||
121 | public static function hasGet($var) |
||
125 | |||
126 | /** |
||
127 | * Verifica si existe el elemento indicado en $_REQUEST |
||
128 | * |
||
129 | * @param string $var elemento a verificar |
||
130 | * @return boolean |
||
131 | */ |
||
132 | public static function hasRequest($var) |
||
136 | |||
137 | /** |
||
138 | * Elimina elemento indicado en $_POST |
||
139 | * |
||
140 | * @param string $var elemento a verificar |
||
141 | * @return boolean|null |
||
142 | */ |
||
143 | public static function delete($var = '') |
||
151 | |||
152 | /** |
||
153 | * Permite Obtener el Agente de Usuario (User Agent) |
||
154 | * @return String |
||
155 | */ |
||
156 | public static function userAgent(){ |
||
159 | |||
160 | /** |
||
161 | * Permite obtene la IP del cliente, aún cuando usa proxy |
||
162 | * @return String |
||
163 | */ |
||
164 | public static function ip(){ |
||
165 | if (!empty($_SERVER['HTTP_CLIENT_IP'])){ |
||
166 | return $_SERVER['HTTP_CLIENT_IP']; |
||
167 | } |
||
168 | if(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){ |
||
169 | return $_SERVER['HTTP_X_FORWARDED_FOR']; |
||
170 | } |
||
171 | return $_SERVER['REMOTE_ADDR']; |
||
172 | } |
||
173 | |||
174 | |||
175 | /** |
||
176 | * Obtiene y filtra un valor del arreglo $_REQUEST |
||
177 | * Por defecto, usa SANITIZE |
||
178 | * |
||
179 | * @param string $var |
||
180 | * @return mixed |
||
181 | */ |
||
182 | public static function filter($var) |
||
186 | |||
187 | /** |
||
188 | * Devuelve el valor dentro de un array con clave en formato uno.dos.tres |
||
189 | * @param Array array que contiene la variable |
||
190 | * @param string $str clave a usar |
||
191 | * @return mixed |
||
192 | */ |
||
193 | protected static function getFilter(Array $var, $str) |
||
210 | } |
||
211 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.