mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-69187 files: normalize retrieval of mimetypes from groups array.
Ensure that the following both return consistently, so that filepicker form elements behave the same for each when defining "accepted_types": '.html, .txt' ['.html', '.txt']
This commit is contained in:
parent
e998f14061
commit
e66f04e61d
@ -2068,9 +2068,12 @@ function get_mimetype_description($obj, $capitalise=false) {
|
||||
*/
|
||||
function file_get_typegroup($element, $groups) {
|
||||
static $cached = array();
|
||||
|
||||
// Turn groups into a list.
|
||||
if (!is_array($groups)) {
|
||||
$groups = array($groups);
|
||||
$groups = preg_split('/[\s,;:"\']+/', $groups, -1, PREG_SPLIT_NO_EMPTY);
|
||||
}
|
||||
|
||||
if (!array_key_exists($element, $cached)) {
|
||||
$cached[$element] = array();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user