function imce_clean_profile_fields in IMCE 7
Same name and namespace in other branches
- 6.2 inc/imce.admin.inc \imce_clean_profile_fields()
- 6 inc/admin.inc \imce_clean_profile_fields()
Unset empty fields in thumbnails and directory paths.
1 call to imce_clean_profile_fields()
- imce_profile_submit in inc/
imce.admin.inc - Profile form submit.
File
- inc/
imce.admin.inc, line 715 - Serves administration pages of IMCE.
Code
function imce_clean_profile_fields(&$profile) {
$clean = array();
foreach ($profile['thumbnails'] as $thumb) {
if (trim($thumb['name']) != '') {
$clean[] = $thumb;
}
}
$profile['thumbnails'] = $clean;
$clean = array();
$names = array();
foreach ($profile['directories'] as $dir) {
$dir['name'] = trim($dir['name'], '/ ');
if ($dir['name'] == '') {
continue;
}
if (isset($names[$dir['name']])) {
drupal_set_message(t('Duplicate directory paths are not allowed.'), 'error');
continue;
}
if (!imce_reg_dir($dir['name'])) {
drupal_set_message(t('%dirname is not accepted as a proper directory name.', array(
'%dirname' => $dir['name'],
)), 'error');
continue;
}
$clean[] = $dir;
$names[$dir['name']] = 1;
}
$profile['directories'] = $clean;
}