tribe_sanitize_deep( mixed $value )
Sanitizes a value according to its type.
Contents
The function will recursively sanitize array values.
Parameters
- $value
-
(mixed) (Required) The value, or values, to sanitize.
Return
(mixed|null) Either the sanitized version of the value, or null
if the value is not a string, number or array.
Source
File: src/functions/utils.php
function tribe_sanitize_deep( &$value ) { if ( is_bool( $value ) ) { return $value; } if ( is_string( $value ) ) { $value = filter_var( $value, FILTER_SANITIZE_STRING ); return $value; } if ( is_int( $value ) ) { $value = filter_var( $value, FILTER_VALIDATE_INT ); return $value; } if ( is_float( $value ) ) { $value = filter_var( $value, FILTER_VALIDATE_FLOAT ); return $value; } if ( is_array( $value ) ) { array_walk( $value, 'tribe_sanitize_deep' ); return $value; } return null; }
Changelog
Version | Description |
---|---|
4.9.20 | Introduced. |