| 1 |
<?php |
| 2 |
|
| 3 |
// Start of filter v.0.11.0 |
| 4 |
|
| 5 |
/** |
| 6 |
* Gets a specific external variable by name and optionally filters it |
| 7 |
* @link http://www.php.net/manual/en/function.filter-input.php |
| 8 |
* @param type int <p> |
| 9 |
* One of INPUT_GET, INPUT_POST, |
| 10 |
* INPUT_COOKIE, INPUT_SERVER, or |
| 11 |
* INPUT_ENV. |
| 12 |
* </p> |
| 13 |
* @param variable_name string <p> |
| 14 |
* Name of a variable to get. |
| 15 |
* </p> |
| 16 |
* @param filter int[optional] <p> |
| 17 |
* The ID of the filter to apply. The |
| 18 |
* manual page lists the available filters. |
| 19 |
* </p> |
| 20 |
* @param options mixed[optional] <p> |
| 21 |
* Associative array of options or bitwise disjunction of flags. If filter |
| 22 |
* accepts options, flags can be provided in "flags" field of array. |
| 23 |
* </p> |
| 24 |
* @return mixed Value of the requested variable on success, false if the filter fails, |
| 25 |
* or &null; if the variable_name variable is not set. |
| 26 |
* If the flag FILTER_NULL_ON_FAILURE is used, it |
| 27 |
* returns false if the variable is not set and &null; if the filter fails. |
| 28 |
*/ |
| 29 |
function filter_input ($type, $variable_name, $filter = null, $options = null) {} |
| 30 |
|
| 31 |
/** |
| 32 |
* Filters a variable with a specified filter |
| 33 |
* @link http://www.php.net/manual/en/function.filter-var.php |
| 34 |
* @param variable mixed <p> |
| 35 |
* Value to filter. |
| 36 |
* </p> |
| 37 |
* @param filter int[optional] <p> |
| 38 |
* The ID of the filter to apply. The |
| 39 |
* manual page lists the available filters. |
| 40 |
* </p> |
| 41 |
* @param options mixed[optional] <p> |
| 42 |
* Associative array of options or bitwise disjunction of flags. If filter |
| 43 |
* accepts options, flags can be provided in "flags" field of array. For |
| 44 |
* the "callback" filter, callable type should be passed. The |
| 45 |
* callback must accept one argument, the value to be filtered, and return |
| 46 |
* the value after filtering/sanitizing it. |
| 47 |
* </p> |
| 48 |
* <p> |
| 49 |
* |
| 50 |
* array( |
| 51 |
* 'default' => 3, // value to return if the filter fails |
| 52 |
* // other options here |
| 53 |
* 'min_range' => 0 |
| 54 |
* ), |
| 55 |
* 'flags' => FILTER_FLAG_ALLOW_OCTAL, |
| 56 |
* ); |
| 57 |
* $var = filter_var('0755', FILTER_VALIDATE_INT, $options); |
| 58 |
* // for filter that only accept flags, you can pass them directly |
| 59 |
* $var = filter_var('oops', FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); |
| 60 |
* // for filter that only accept flags, you can also pass as an array |
| 61 |
* $var = filter_var('oops', FILTER_VALIDATE_BOOLEAN, |
| 62 |
* array('flags' => FILTER_NULL_ON_FAILURE)); |
| 63 |
* // callback validate filter |
| 64 |
* function foo($value) |
| 65 |
* { |
| 66 |
* // Expected format: Surname, GivenNames |
| 67 |
* if (strpos($value, ", ") === false) return false; |
| 68 |
* list($surname, $givennames) = explode(", ", $value, 2); |
| 69 |
* $empty = (empty($surname) || empty($givennames)); |
| 70 |
* $notstrings = (!is_string($surname) || !is_string($givennames)); |
| 71 |
* if ($empty || $notstrings) { |
| 72 |
* return false; |
| 73 |
* } else { |
| 74 |
* return $value; |
| 75 |
* } |
| 76 |
* } |
| 77 |
* $var = filter_var('Doe, Jane Sue', FILTER_CALLBACK, array('options' => 'foo')); |
| 78 |
* ?> |
| 79 |
* ]]> |
| 80 |
* |
| 81 |
* </p> |
| 82 |
* @return mixed the filtered data, or false if the filter fails. |
| 83 |
*/ |
| 84 |
function filter_var ($variable, $filter = null, $options = null) {} |
| 85 |
|
| 86 |
/** |
| 87 |
* Gets external variables and optionally filters them |
| 88 |
* @link http://www.php.net/manual/en/function.filter-input-array.php |
| 89 |
* @param type int <p> |
| 90 |
* One of INPUT_GET, INPUT_POST, |
| 91 |
* INPUT_COOKIE, INPUT_SERVER, or |
| 92 |
* INPUT_ENV. |
| 93 |
* </p> |
| 94 |
* @param definition mixed[optional] <p> |
| 95 |
* An array defining the arguments. A valid key is a string |
| 96 |
* containing a variable name and a valid value is either a filter type, or an array |
| 97 |
* optionally specifying the filter, flags and options. If the value is an |
| 98 |
* array, valid keys are filter which specifies the |
| 99 |
* filter type, |
| 100 |
* flags which specifies any flags that apply to the |
| 101 |
* filter, and options which specifies any options that |
| 102 |
* apply to the filter. See the example below for a better understanding. |
| 103 |
* </p> |
| 104 |
* <p> |
| 105 |
* This parameter can be also an integer holding a filter constant. Then all values in the |
| 106 |
* input array are filtered by this filter. |
| 107 |
* </p> |
| 108 |
* @param add_empty bool[optional] <p> |
| 109 |
* Add missing keys as &null; to the return value. |
| 110 |
* </p> |
| 111 |
* @return mixed An array containing the values of the requested variables on success, or false |
| 112 |
* on failure. An array value will be false if the filter fails, or &null; if |
| 113 |
* the variable is not set. Or if the flag FILTER_NULL_ON_FAILURE |
| 114 |
* is used, it returns false if the variable is not set and &null; if the filter |
| 115 |
* fails. |
| 116 |
*/ |
| 117 |
function filter_input_array ($type, $definition = null, $add_empty = null) {} |
| 118 |
|
| 119 |
/** |
| 120 |
* Gets multiple variables and optionally filters them |
| 121 |
* @link http://www.php.net/manual/en/function.filter-var-array.php |
| 122 |
* @param data array <p> |
| 123 |
* An array with string keys containing the data to filter. |
| 124 |
* </p> |
| 125 |
* @param definition mixed[optional] <p> |
| 126 |
* An array defining the arguments. A valid key is a string |
| 127 |
* containing a variable name and a valid value is either a |
| 128 |
* filter type, or an |
| 129 |
* array optionally specifying the filter, flags and options. |
| 130 |
* If the value is an array, valid keys are filter |
| 131 |
* which specifies the filter type, |
| 132 |
* flags which specifies any flags that apply to the |
| 133 |
* filter, and options which specifies any options that |
| 134 |
* apply to the filter. See the example below for a better understanding. |
| 135 |
* </p> |
| 136 |
* <p> |
| 137 |
* This parameter can be also an integer holding a filter constant. Then all values in the |
| 138 |
* input array are filtered by this filter. |
| 139 |
* </p> |
| 140 |
* @param add_empty bool[optional] <p> |
| 141 |
* Add missing keys as &null; to the return value. |
| 142 |
* </p> |
| 143 |
* @return mixed An array containing the values of the requested variables on success, or false |
| 144 |
* on failure. An array value will be false if the filter fails, or &null; if |
| 145 |
* the variable is not set. |
| 146 |
*/ |
| 147 |
function filter_var_array (array $data, $definition = null, $add_empty = null) {} |
| 148 |
|
| 149 |
/** |
| 150 |
* Returns a list of all supported filters |
| 151 |
* @link http://www.php.net/manual/en/function.filter-list.php |
| 152 |
* @return array an array of names of all supported filters, empty array if there |
| 153 |
* are no such filters. Indexes of this array are not filter IDs, they can be |
| 154 |
* obtained with filter_id from a name instead. |
| 155 |
*/ |
| 156 |
function filter_list () {} |
| 157 |
|
| 158 |
/** |
| 159 |
* Checks if variable of specified type exists |
| 160 |
* @link http://www.php.net/manual/en/function.filter-has-var.php |
| 161 |
* @param type int <p> |
| 162 |
* One of INPUT_GET, INPUT_POST, |
| 163 |
* INPUT_COOKIE, INPUT_SERVER, or |
| 164 |
* INPUT_ENV. |
| 165 |
* </p> |
| 166 |
* @param variable_name string <p> |
| 167 |
* Name of a variable to check. |
| 168 |
* </p> |
| 169 |
* @return bool Returns true on success, false on failure. |
| 170 |
*/ |
| 171 |
function filter_has_var ($type, $variable_name) {} |
| 172 |
|
| 173 |
/** |
| 174 |
* Returns the filter ID belonging to a named filter |
| 175 |
* @link http://www.php.net/manual/en/function.filter-id.php |
| 176 |
* @param filtername string <p> |
| 177 |
* Name of a filter to get. |
| 178 |
* </p> |
| 179 |
* @return int ID of a filter on success or false if filter doesn't exist. |
| 180 |
*/ |
| 181 |
function filter_id ($filtername) {} |
| 182 |
|
| 183 |
|
| 184 |
/** |
| 185 |
* POST variables. |
| 186 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 187 |
*/ |
| 188 |
define ('INPUT_POST', 0); |
| 189 |
|
| 190 |
/** |
| 191 |
* GET variables. |
| 192 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 193 |
*/ |
| 194 |
define ('INPUT_GET', 1); |
| 195 |
|
| 196 |
/** |
| 197 |
* COOKIE variables. |
| 198 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 199 |
*/ |
| 200 |
define ('INPUT_COOKIE', 2); |
| 201 |
|
| 202 |
/** |
| 203 |
* ENV variables. |
| 204 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 205 |
*/ |
| 206 |
define ('INPUT_ENV', 4); |
| 207 |
|
| 208 |
/** |
| 209 |
* SERVER variables. |
| 210 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 211 |
*/ |
| 212 |
define ('INPUT_SERVER', 5); |
| 213 |
|
| 214 |
/** |
| 215 |
* SESSION variables. |
| 216 |
* (not implemented yet) |
| 217 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 218 |
*/ |
| 219 |
define ('INPUT_SESSION', 6); |
| 220 |
|
| 221 |
/** |
| 222 |
* REQUEST variables. |
| 223 |
* (not implemented yet) |
| 224 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 225 |
*/ |
| 226 |
define ('INPUT_REQUEST', 99); |
| 227 |
|
| 228 |
/** |
| 229 |
* No flags. |
| 230 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 231 |
*/ |
| 232 |
define ('FILTER_FLAG_NONE', 0); |
| 233 |
|
| 234 |
/** |
| 235 |
* Flag used to require scalar as input |
| 236 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 237 |
*/ |
| 238 |
define ('FILTER_REQUIRE_SCALAR', 33554432); |
| 239 |
|
| 240 |
/** |
| 241 |
* Require an array as input. |
| 242 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 243 |
*/ |
| 244 |
define ('FILTER_REQUIRE_ARRAY', 16777216); |
| 245 |
|
| 246 |
/** |
| 247 |
* Always returns an array. |
| 248 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 249 |
*/ |
| 250 |
define ('FILTER_FORCE_ARRAY', 67108864); |
| 251 |
|
| 252 |
/** |
| 253 |
* Use NULL instead of FALSE on failure. |
| 254 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 255 |
*/ |
| 256 |
define ('FILTER_NULL_ON_FAILURE', 134217728); |
| 257 |
|
| 258 |
/** |
| 259 |
* ID of "int" filter. |
| 260 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 261 |
*/ |
| 262 |
define ('FILTER_VALIDATE_INT', 257); |
| 263 |
|
| 264 |
/** |
| 265 |
* ID of "boolean" filter. |
| 266 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 267 |
*/ |
| 268 |
define ('FILTER_VALIDATE_BOOLEAN', 258); |
| 269 |
|
| 270 |
/** |
| 271 |
* ID of "float" filter. |
| 272 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 273 |
*/ |
| 274 |
define ('FILTER_VALIDATE_FLOAT', 259); |
| 275 |
|
| 276 |
/** |
| 277 |
* ID of "validate_regexp" filter. |
| 278 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 279 |
*/ |
| 280 |
define ('FILTER_VALIDATE_REGEXP', 272); |
| 281 |
|
| 282 |
/** |
| 283 |
* ID of "validate_url" filter. |
| 284 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 285 |
*/ |
| 286 |
define ('FILTER_VALIDATE_URL', 273); |
| 287 |
|
| 288 |
/** |
| 289 |
* ID of "validate_email" filter. |
| 290 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 291 |
*/ |
| 292 |
define ('FILTER_VALIDATE_EMAIL', 274); |
| 293 |
|
| 294 |
/** |
| 295 |
* ID of "validate_ip" filter. |
| 296 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 297 |
*/ |
| 298 |
define ('FILTER_VALIDATE_IP', 275); |
| 299 |
define ('FILTER_VALIDATE_MAC', 276); |
| 300 |
|
| 301 |
/** |
| 302 |
* ID of default ("string") filter. |
| 303 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 304 |
*/ |
| 305 |
define ('FILTER_DEFAULT', 516); |
| 306 |
|
| 307 |
/** |
| 308 |
* ID of "unsafe_raw" filter. |
| 309 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 310 |
*/ |
| 311 |
define ('FILTER_UNSAFE_RAW', 516); |
| 312 |
|
| 313 |
/** |
| 314 |
* ID of "string" filter. |
| 315 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 316 |
*/ |
| 317 |
define ('FILTER_SANITIZE_STRING', 513); |
| 318 |
|
| 319 |
/** |
| 320 |
* ID of "stripped" filter. |
| 321 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 322 |
*/ |
| 323 |
define ('FILTER_SANITIZE_STRIPPED', 513); |
| 324 |
|
| 325 |
/** |
| 326 |
* ID of "encoded" filter. |
| 327 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 328 |
*/ |
| 329 |
define ('FILTER_SANITIZE_ENCODED', 514); |
| 330 |
|
| 331 |
/** |
| 332 |
* ID of "special_chars" filter. |
| 333 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 334 |
*/ |
| 335 |
define ('FILTER_SANITIZE_SPECIAL_CHARS', 515); |
| 336 |
define ('FILTER_SANITIZE_FULL_SPECIAL_CHARS', 522); |
| 337 |
|
| 338 |
/** |
| 339 |
* ID of "email" filter. |
| 340 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 341 |
*/ |
| 342 |
define ('FILTER_SANITIZE_EMAIL', 517); |
| 343 |
|
| 344 |
/** |
| 345 |
* ID of "url" filter. |
| 346 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 347 |
*/ |
| 348 |
define ('FILTER_SANITIZE_URL', 518); |
| 349 |
|
| 350 |
/** |
| 351 |
* ID of "number_int" filter. |
| 352 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 353 |
*/ |
| 354 |
define ('FILTER_SANITIZE_NUMBER_INT', 519); |
| 355 |
|
| 356 |
/** |
| 357 |
* ID of "number_float" filter. |
| 358 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 359 |
*/ |
| 360 |
define ('FILTER_SANITIZE_NUMBER_FLOAT', 520); |
| 361 |
|
| 362 |
/** |
| 363 |
* ID of "magic_quotes" filter. |
| 364 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 365 |
*/ |
| 366 |
define ('FILTER_SANITIZE_MAGIC_QUOTES', 521); |
| 367 |
|
| 368 |
/** |
| 369 |
* ID of "callback" filter. |
| 370 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 371 |
*/ |
| 372 |
define ('FILTER_CALLBACK', 1024); |
| 373 |
|
| 374 |
/** |
| 375 |
* Allow octal notation (0[0-7]+) in "int" filter. |
| 376 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 377 |
*/ |
| 378 |
define ('FILTER_FLAG_ALLOW_OCTAL', 1); |
| 379 |
|
| 380 |
/** |
| 381 |
* Allow hex notation (0x[0-9a-fA-F]+) in "int" filter. |
| 382 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 383 |
*/ |
| 384 |
define ('FILTER_FLAG_ALLOW_HEX', 2); |
| 385 |
|
| 386 |
/** |
| 387 |
* Strip characters with ASCII value less than 32. |
| 388 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 389 |
*/ |
| 390 |
define ('FILTER_FLAG_STRIP_LOW', 4); |
| 391 |
|
| 392 |
/** |
| 393 |
* Strip characters with ASCII value greater than 127. |
| 394 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 395 |
*/ |
| 396 |
define ('FILTER_FLAG_STRIP_HIGH', 8); |
| 397 |
define ('FILTER_FLAG_STRIP_BACKTICK', 512); |
| 398 |
|
| 399 |
/** |
| 400 |
* Encode characters with ASCII value less than 32. |
| 401 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 402 |
*/ |
| 403 |
define ('FILTER_FLAG_ENCODE_LOW', 16); |
| 404 |
|
| 405 |
/** |
| 406 |
* Encode characters with ASCII value greater than 127. |
| 407 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 408 |
*/ |
| 409 |
define ('FILTER_FLAG_ENCODE_HIGH', 32); |
| 410 |
|
| 411 |
/** |
| 412 |
* Encode &. |
| 413 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 414 |
*/ |
| 415 |
define ('FILTER_FLAG_ENCODE_AMP', 64); |
| 416 |
|
| 417 |
/** |
| 418 |
* Don't encode ' and ". |
| 419 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 420 |
*/ |
| 421 |
define ('FILTER_FLAG_NO_ENCODE_QUOTES', 128); |
| 422 |
|
| 423 |
/** |
| 424 |
* (No use for now.) |
| 425 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 426 |
*/ |
| 427 |
define ('FILTER_FLAG_EMPTY_STRING_NULL', 256); |
| 428 |
|
| 429 |
/** |
| 430 |
* Allow fractional part in "number_float" filter. |
| 431 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 432 |
*/ |
| 433 |
define ('FILTER_FLAG_ALLOW_FRACTION', 4096); |
| 434 |
|
| 435 |
/** |
| 436 |
* Allow thousand separator (,) in "number_float" filter. |
| 437 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 438 |
*/ |
| 439 |
define ('FILTER_FLAG_ALLOW_THOUSAND', 8192); |
| 440 |
|
| 441 |
/** |
| 442 |
* Allow scientific notation (e, E) in |
| 443 |
* "number_float" filter. |
| 444 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 445 |
*/ |
| 446 |
define ('FILTER_FLAG_ALLOW_SCIENTIFIC', 16384); |
| 447 |
define ('FILTER_FLAG_SCHEME_REQUIRED', 65536); |
| 448 |
define ('FILTER_FLAG_HOST_REQUIRED', 131072); |
| 449 |
|
| 450 |
/** |
| 451 |
* Require path in "validate_url" filter. |
| 452 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 453 |
*/ |
| 454 |
define ('FILTER_FLAG_PATH_REQUIRED', 262144); |
| 455 |
|
| 456 |
/** |
| 457 |
* Require query in "validate_url" filter. |
| 458 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 459 |
*/ |
| 460 |
define ('FILTER_FLAG_QUERY_REQUIRED', 524288); |
| 461 |
|
| 462 |
/** |
| 463 |
* Allow only IPv4 address in "validate_ip" filter. |
| 464 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 465 |
*/ |
| 466 |
define ('FILTER_FLAG_IPV4', 1048576); |
| 467 |
|
| 468 |
/** |
| 469 |
* Allow only IPv6 address in "validate_ip" filter. |
| 470 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 471 |
*/ |
| 472 |
define ('FILTER_FLAG_IPV6', 2097152); |
| 473 |
|
| 474 |
/** |
| 475 |
* Deny reserved addresses in "validate_ip" filter. |
| 476 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 477 |
*/ |
| 478 |
define ('FILTER_FLAG_NO_RES_RANGE', 4194304); |
| 479 |
|
| 480 |
/** |
| 481 |
* Deny private addresses in "validate_ip" filter. |
| 482 |
* @link http://www.php.net/manual/en/filter.constants.php |
| 483 |
*/ |
| 484 |
define ('FILTER_FLAG_NO_PRIV_RANGE', 8388608); |
| 485 |
|
| 486 |
// End of filter v.0.11.0 |
| 487 |
?> |