protected static function get_custom_types() {
        global $CFG;
        if (!empty($CFG->customfiletypes)) {
            if (is_array($CFG->customfiletypes)) {
                // You can define this as an array in config.php...
                return $CFG->customfiletypes;
            } else {
                // Or as a JSON string in the config table.
                return json_decode($CFG->customfiletypes);
            }
        } else {
            return array();
        }
    }