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;
    }
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;
    }
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 ; }
Is the file have allowed to be uploaded to the workshop?

Empty whitelist is interpretted as "any file type is allowed" rather
than "no file can be uploaded".

@deprecated since Moodle 3.4 MDL-56486 - please use the {@link core_form\filetypes_util}
@param string $filename the file name
@param string|array $whitelist list of allowed file extensions
@return false
Is the file have allowed to be uploaded to the workshop?