Merge branch 'MDL-53240-master-filetypewidgets' of git://github.com/mudrd8mz/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2017-06-05 23:38:23 +02:00
commit 39f0cb8b8f

View file

@ -26,6 +26,7 @@ namespace core_form;
use core_collator; use core_collator;
use core_filetypes; use core_filetypes;
use core_text;
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
@ -73,7 +74,7 @@ class filetypes_util {
// Fix whitespace and normalize the syntax a bit. // Fix whitespace and normalize the syntax a bit.
foreach ($types as $i => $type) { foreach ($types as $i => $type) {
$type = str_replace('*.', '.', $type); $type = str_replace('*.', '.', $type);
$type = strtolower($type); $type = core_text::strtolower($type);
$type = trim($type); $type = trim($type);
if ($type === '*') { if ($type === '*') {
@ -470,7 +471,7 @@ class filetypes_util {
return true; return true;
} }
$haystack = strrev(trim(strtolower($filename))); $haystack = strrev(trim(core_text::strtolower($filename)));
foreach ($allowedextensions as $extension) { foreach ($allowedextensions as $extension) {
if (strpos($haystack, strrev($extension)) === 0) { if (strpos($haystack, strrev($extension)) === 0) {