From e19e0c875cd4b8739834490d430f018d872660bb Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Wed, 3 Nov 2021 02:41:22 +0100 Subject: [PATCH] Add function for batch validating ids in an array --- src/MD_STD_IN.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/MD_STD_IN.php b/src/MD_STD_IN.php index d76c175..680140b 100644 --- a/src/MD_STD_IN.php +++ b/src/MD_STD_IN.php @@ -111,6 +111,25 @@ final class MD_STD_IN { } + /** + * Valiates a list of entries, ensuring all returned values are valid IDs. + * + * @param array $inputs Input array. + * + * @return array + */ + 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.