LLMS_Abstract_Query::sanitize_id_array( string|int|array $ids = array() )
Sanitize input to ensure an array of absolute integers.
Parameters Parameters
- $ids
-
(string|int|array) (Optional) String/Int or array of strings/ints.
Default value: array()
Return Return
(array)
Source Source
File: includes/abstracts/llms-abstract-query.php
protected function sanitize_id_array( $ids = array() ) {
if ( empty( $ids ) ) {
return array();
}
// Allow numeric strings & ints to be passed instead of an array.
$ids = ! is_array( $ids ) ? array( $ids ) : $ids;
// Force positive ints.
$ids = array_map( 'absint', $ids );
// Remove empty values.
return array_values( array_filter( $ids ) );
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 6.0.0 | Moved from LLMS_Database_Query abstract. |
| 3.24.0 | Unknown. |
| 3.15.0 | Introduced. |