function transliteration_init in Transliteration 6.2
Same name and namespace in other branches
- 6.3 transliteration.module \transliteration_init()
- 6 transliteration.module \transliteration_init()
- 7.3 transliteration.module \transliteration_init()
Implementation of hook_init().
Transliterate and clean the names of files currently being uploaded.
File
- ./
transliteration.module, line 43 - Provides transliteration for UTF-8 text input and sanitzes file names.
Code
function transliteration_init() {
if (!empty($_FILES['files'])) {
require_once drupal_get_path('module', 'transliteration') . '/transliteration.inc';
// Figure out language, which is available for node form submits.
$langcode = NULL;
if (!empty($_POST['language'])) {
$languages = language_list();
$langcode = isset($languages[$_POST['language']]) ? $_POST['language'] : NULL;
}
foreach ($_FILES['files']['name'] as $field => $filename) {
// Keep a copy of the unaltered file name.
$_FILES['files']['orig_name'][$field] = $filename;
$_FILES['files']['name'][$field] = transliteration_clean_filename($filename, $langcode);
}
}
}