protected static function set_custom_types(array $types) {
        global $CFG;
        // Check the setting hasn't been forced.
        if (array_key_exists('customfiletypes', $CFG->config_php_settings)) {
            throw new coding_exception('Cannot set custom filetypes because they ' .
                    'are defined in config.php');
        }
        if (empty($types)) {
            unset_config('customfiletypes');
        } else {
            set_config('customfiletypes', json_encode(array_values($types)));
        }

        // Clear the cached type list.
        self::reset_caches();
    }
protected static function set_custom_types(array $types) {
        global $CFG;
        // Check the setting hasn't been forced.
        if (array_key_exists('customfiletypes', $CFG->config_php_settings)) {
            throw new coding_exception('Cannot set custom filetypes because they ' .
                    'are defined in config.php');
        }
        if (empty($types)) {
            unset_config('customfiletypes');
        } else {
            set_config('customfiletypes', json_encode(array_values($types)));
        }

        // Clear the cached type list.
        self::reset_caches();
    }
protected static function set_custom_types ( array $ types ) { global $ CFG ; // Check the setting hasn't been forced. if ( array_key_exists ( 'customfiletypes' , $ CFG -> config_php_settings ) ) { throw new coding_exception ( 'Cannot set custom filetypes because they ' . 'are defined in config.php' ) ; } if ( empty ( $ types ) ) { unset_config ( 'customfiletypes' ) ; } else { set_config ( 'customfiletypes' , json_encode ( array_values ( $ types ) ) ) ; } // Clear the cached type list. self :: reset_caches ( ) ; }
Sets the custom types into config variable, encoding into JSON.

@param array $types Array of custom types
@throws coding_exception If the custom types are fixed in config.php.
Sets the custom types into config variable encoding into JSON .