summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Mateescu2011-10-10 05:44:29 (GMT)
committer Andrei Mateescu2011-10-10 05:44:29 (GMT)
commit0529dd9a3fd6a0bf0afb0473046781914d848bb3 (patch)
treed532b092b76d13bf4610e7b9a3e7e81b5feb1114
parent97678618e2ab6a1cc057632e033db34abb40d0aa (diff)
Issue #1243974 by cyborg_572: Supporting Files uploaded as an array.
-rw-r--r--transliteration.module12
1 files changed, 10 insertions, 2 deletions
diff --git a/transliteration.module b/transliteration.module
index e56d0cc..4742bbf 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);