Skip to content

Commit

Permalink
MDL-69050 lang: Fix placeholder in the err_wrongfileextension string
Browse files Browse the repository at this point in the history
The name of the placeholder has been found exclusive and potentially
derogatory. Also the name of variable that was used to populate the
placeholder value. That was not the intention.
  • Loading branch information
mudrd8mz committed Sep 24, 2020
1 parent 5486b03 commit d9dc9ae
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lang/en/form.php
Expand Up @@ -42,7 +42,7 @@
$string['err_rangelength'] = 'You must enter between {$a->format[0]} and {$a->format[1]} characters here.';
$string['err_required'] = 'You must supply a value here.';
$string['err_wrappingwhitespace'] = 'The value must not start or end with whitespace.';
$string['err_wrongfileextension'] = 'Some files ({$a->wrongfiles}) cannot be uploaded. Only file types {$a->whitelist} are allowed.';
$string['err_wrongfileextension'] = 'Some files ({$a->wrongfiles}) cannot be uploaded. Only file types {$a->allowlist} are allowed.';
$string['filesofthesetypes'] = 'Accepted file types:';
$string['filetypesany'] = 'All file types';
$string['filetypesnotall'] = 'It is not allowed to select \'All file types\' here';
Expand Down
8 changes: 4 additions & 4 deletions lib/form/filemanager.php
Expand Up @@ -328,9 +328,9 @@ public function validateSubmitValue($value) {
}

$filetypesutil = new \core_form\filetypes_util();
$whitelist = $filetypesutil->normalize_file_types($this->_options['accepted_types']);
$allowlist = $filetypesutil->normalize_file_types($this->_options['accepted_types']);

if (empty($whitelist) || $whitelist === ['*']) {
if (empty($allowlist) || $allowlist === ['*']) {
// Any file type is allowed, nothing to check here.
return;
}
Expand All @@ -344,14 +344,14 @@ public function validateSubmitValue($value) {
}

foreach ($draftfiles as $file) {
if (!$filetypesutil->is_allowed_file_type($file->filename, $whitelist)) {
if (!$filetypesutil->is_allowed_file_type($file->filename, $allowlist)) {
$wrongfiles[] = $file->filename;
}
}

if ($wrongfiles) {
$a = array(
'whitelist' => implode(', ', $whitelist),
'allowlist' => implode(', ', $allowlist),
'wrongfiles' => implode(', ', $wrongfiles),
);
return get_string('err_wrongfileextension', 'core_form', $a);
Expand Down
8 changes: 4 additions & 4 deletions lib/form/filepicker.php
Expand Up @@ -248,9 +248,9 @@ public function export_for_template(renderer_base $output) {
public function validateSubmitValue($value) {

$filetypesutil = new \core_form\filetypes_util();
$whitelist = $filetypesutil->normalize_file_types($this->_options['accepted_types']);
$allowlist = $filetypesutil->normalize_file_types($this->_options['accepted_types']);

if (empty($whitelist) || $whitelist === ['*']) {
if (empty($allowlist) || $allowlist === ['*']) {
// Any file type is allowed, nothing to check here.
return;
}
Expand All @@ -264,14 +264,14 @@ public function validateSubmitValue($value) {
}

foreach ($draftfiles->list as $file) {
if (!$filetypesutil->is_allowed_file_type($file->filename, $whitelist)) {
if (!$filetypesutil->is_allowed_file_type($file->filename, $allowlist)) {
$wrongfiles[] = $file->filename;
}
}

if ($wrongfiles) {
$a = array(
'whitelist' => implode(', ', $whitelist),
'allowlist' => implode(', ', $allowlist),
'wrongfiles' => implode(', ', $wrongfiles),
);
return get_string('err_wrongfileextension', 'core_form', $a);
Expand Down

0 comments on commit d9dc9ae

Please sign in to comment.