diff --git a/transliteration.module b/transliteration.module index 6505c2963f92fdf357e3474e0e30d348798e201d..913a53127f89136004d1ad9455042c6a54c33fee 100644 --- a/transliteration.module +++ b/transliteration.module @@ -61,9 +61,11 @@ function transliteration_form_system_file_system_settings_alter(&$form, &$form_s * * The resulting file name has white space replaced with underscores, consists * of only US-ASCII characters, and is converted to lowercase (if configured). + * If multiple files have been submitted as an array, the names will be + * processed recursively. * * @param $filename - * A file name. + * A file name, or an array of file names. * @param $source_langcode * Optional ISO 639 language code that denotes the language of the input and * is used to apply language-specific variations. If the source language is @@ -71,11 +73,17 @@ function transliteration_form_system_file_system_settings_alter(&$form, &$form_s * argument to the site default language to produce consistent results. * Otherwise the current display language will be used. * @return - * Sanitized file name. + * Sanitized file name, or array of sanitized file names. * * @see language_default() */ function transliteration_clean_filename($filename, $source_langcode = NULL) { + if (is_array($filename)) { + foreach ($filename as $key => $value) { + $filename[$key] = transliteration_clean_filename($value, $source_langcode); + } + return $filename; + } $filename = transliteration_get($filename, '', $source_langcode); // Replace whitespace. $filename = str_replace(' ', '_', $filename);