Add function for batch validating ids in an array
This commit is contained in:
parent
245d161805
commit
e19e0c875c
@ -111,6 +111,25 @@ final class MD_STD_IN {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Valiates a list of entries, ensuring all returned values are valid IDs.
|
||||
*
|
||||
* @param array<mixed> $inputs Input array.
|
||||
*
|
||||
* @return array<integer>
|
||||
*/
|
||||
public static function sanitize_id_array(array $inputs):array {
|
||||
|
||||
$output = [];
|
||||
|
||||
foreach ($inputs as $input) {
|
||||
$output[] = self::sanitize_id($input);
|
||||
}
|
||||
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves HTTP input texts from GET or POST variables, whatever is provided.
|
||||
* If neither is given, returns a provided default.
|
||||
|
Loading…
Reference in New Issue
Block a user