Projet

Général

Profil

Révision ca0757b9

Ajouté par Assos Assos il y a plus de 9 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/file_entity/file_entity.file_api.inc
484 484
  return !empty($type->disabled);
485 485
}
486 486

  
487
/**
488
 * Returns an array of valid file extensions.
489
 */
490
function file_type_get_valid_extensions($type) {
491
  include_once DRUPAL_ROOT . '/includes/file.mimetypes.inc';
492
  $mapping = file_mimetype_mapping();
493

  
494
  $type_extensions = array();
495
  $type_ext_keys = array();
496
  if (!empty($type->mimetypes)) {
497
    foreach ($mapping['mimetypes'] as $ext_key => $mimetype) {
498
      if (file_entity_match_mimetypes($mimetype, $type->mimetypes)) {
499
        $type_ext_keys[] = $ext_key;
500
      }
501
    }
502

  
503
    if ($type_ext_keys) {
504
      $type_extensions = array_intersect($mapping['extensions'], $type_ext_keys);
505
      $type_extensions = array_keys($type_extensions);
506
    }
507
  }
508

  
509
  return $type_extensions;
510
}
511

  
487 512
/**
488 513
 * Updates an existing file type or creates a new one.
489 514
 *
......
596 621
 *   Type of the file_type to disable
597 622
 */
598 623
function file_type_enable($type) {
624
  ctools_include('export');
599 625
  ctools_export_crud_enable('file_type', $type);
600 626
}
601 627

  
......
607 633
 *   Type of the file_type to disable
608 634
 */
609 635
function file_type_disable($type) {
636
  ctools_include('export');
610 637
  ctools_export_crud_disable('file_type', $type);
611 638
}
612 639

  
......
699 726
  if (empty($file)) {
700 727
    $file = new stdClass();
701 728
    $file->uid = $GLOBALS['user']->uid;
702
    $file->filename = basename($uri);
729
    $file->filename = drupal_basename($uri);
703 730
    $file->uri = $uri;
704 731
    $file->filemime = file_get_mimetype($uri);
705 732
    // This is gagged because some uris will not support it.

Formats disponibles : Unified diff