Add function for batch validating ids in an array

This commit is contained in:
Joshua Ramon Enslin 2021-11-03 02:41:22 +01:00
parent 245d161805
commit e19e0c875c
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -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.