llms_sanitize_with_safelist( mixed $needle, array $safelist, mixed $default = null )
Check that the test value is a member of a specific array for sanitization purposes.
Parameters Parameters
- $needle
-
(mixed) (Required) Value to be tested.
- $safelist
-
(array) (Required) Array of safelist values.
- $default
-
(mixed) (Optional) Default value to return if the needle is not in the safelist. Defaults to the first value in the safelist array if not provided.
Default value: null
Source Source
File: includes/llms.functions.core.php
function llms_sanitize_with_safelist( $needle, $safelist, $default = null ) {
if ( ! in_array( $needle, $safelist ) ) {
if ( isset( $default ) ) {
return $default;
} else {
return $safelist[0];
}
} else {
return $needle;
}
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 7.6.0 | Introduced. |