Projet

Général

Profil

Révision a8cee257

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

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/file_entity/file_entity.pages.inc
56 56
    // For local files, transfer the file and do not reveal the actual URL.
57 57
    file_transfer($file->uri, $headers);
58 58
  }
59
  else if (file_uri_scheme($file->uri) == 's3') {
60
    $url = file_create_url($file->uri);
61
    drupal_goto($url);
62
  }
59 63
  else {
60 64
    // For remote files, just redirect the user to that file's actual URL.
61 65
    $headers['Location'] = file_create_url($file->uri);
......
282 286
        $entity_uri = empty($entities[$entity_id]) ? NULL : entity_uri($entity_type, $entities[$entity_id]);
283 287

  
284 288
        // Link the label to the URI when possible.
285
        if (!empty($entity_uri['path'])) {
289
        if (!empty($entity_uri['path']) && $entity_type != 'paragraphs_item') {
286 290
          $entity_label = l($label, $entity_uri['path']);
287 291
        }
292
        // For paragraphs items, we are searching for usages in nodes.
293
        elseif ($entity_type == 'paragraphs_item') {
294
          $paragraph_fields = field_read_fields(array('type' => 'paragraphs'));
295
          foreach ($paragraph_fields as $paragraph_field) {
296
            $field_name = $paragraph_field['field_name'];
297
            $query = new EntityFieldQuery();
298
            $query->entityCondition('entity_type', 'node')
299
              ->fieldCondition($field_name, 'value', $entity_id, '=');
300
            $nid = $query->execute();
301
            if (!empty($nid)) {
302
              $nid = implode(array_keys($nid['node']));
303
              if ($nid) {
304
                $node = node_load($nid);
305
                $entity_label = l($node->title, 'node/' . $nid);
306
              }
307
            }
308
          }
309
        }
288 310
        else {
289 311
          $entity_label = check_plain($label);
290 312
        }
......
522 544
  $destination = trim($params['file_directory'], '/');
523 545

  
524 546
  // Replace tokens.
525
  $destination = token_replace($destination, $data);
547
  $destination = decode_entities(token_replace($destination, $data));
526 548

  
527 549
  return $params['uri_scheme'] . '://' . $destination;
528 550
}
......
654 676
  // Add a 'replace this file' upload field if the file is writeable.
655 677
  if (file_entity_file_is_writeable($file)) {
656 678
    // Set up replacement file validation.
657
    $replacement_options = array();
679
    $replacement_options = !empty($form_state['#upload_options']) ? $form_state['#upload_options'] : array();
658 680

  
659 681
    // The replacement file must have an extension valid for the original type.
660 682
    $file_extensions = array();
661 683
    $file_type_name = isset($file->type) ? $file->type : file_get_type($file);
662
    if ($file_type_name && ($file_type = file_type_load($file_type_name))) {
684
    if (!empty($replacement_options['file_extensions'])) {
685
      $file_extensions = explode(' ', $replacement_options['file_extensions']);
686
    }
687
    elseif ($file_type_name && ($file_type = file_type_load($file_type_name))) {
663 688
      $file_extensions = file_type_get_valid_extensions($file_type);
664 689
    }
665 690

  
......
1187 1212
      $extract_dir = file_default_scheme() . '://' . pathinfo($archive->filename, PATHINFO_FILENAME);
1188 1213
      $extract_dir = file_destination($extract_dir, FILE_EXISTS_RENAME);
1189 1214
      if (!file_prepare_directory($extract_dir, FILE_MODIFY_PERMISSIONS | FILE_CREATE_DIRECTORY)) {
1190
        throw new Exception(t('Unable to prepar, e directory %dir for extraction.', array('%dir' => $extract_dir)));
1215
        throw new Exception(t('Unable to prepare directory %dir for extraction.', array('%dir' => $extract_dir)));
1191 1216
      }
1192 1217

  
1193 1218
      $archiver->extract($extract_dir);

Formats disponibles : Unified diff