public static function is_allowed_file_type($filename, $whitelist) {

        debugging('The method workshop::is_allowed_file_type() is deprecated.
            Please use the methods provided by the \core_form\filetypes_util class.', DEBUG_DEVELOPER);

        $whitelist = self::normalize_file_extensions($whitelist);

        if (empty($whitelist)) {
            return true;
        }

        $haystack = strrev(trim(strtolower($filename)));

        foreach ($whitelist as $extension) {
            if (strpos($haystack, strrev($extension)) === 0) {
                // The file name ends with the extension.
                return true;
            }
        }

        return false;
    }