Projet

Général

Profil

Révision 9e88ab34

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

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/file_entity/file_entity.admin.inc
1083 1083
    '#element_validate' => array('_file_generic_settings_max_filesize'),
1084 1084
  );
1085 1085

  
1086
  $form['file_entity_default_file_directory'] = array(
1087
    '#type' => 'textfield',
1088
    '#title' => t('Default file directory'),
1089
    '#default_value' => variable_get('file_entity_default_file_directory', ''),
1090
    '#maxlength' => NULL,
1091
  );
1092
  if (module_exists('token')) {
1093
    $form['file_entity_default_file_directory']['#description'] = t('Optional subdirectory within the upload destination where files will be stored if the file is uploaded through the file entity overview page and the directory is not specified otherwise. Do not include preceding or trailing slashes. This field supports tokens.  Suggest using: [current-date:custom:Y]/[current-date:custom:m]/[current-date:custom:d]');
1094
    $form['file_entity_default_file_directory']['tokens'] = array(
1095
      '#theme' => 'token_tree',
1096
      '#dialog' => TRUE,
1097
    );
1098
  }
1099
  else {
1100
    $form['file_entity_default_file_directory']['#description'] = t('Optional subdirectory within the upload destination where files will be stored if the file is uploaded through the file entity overview page and the directory is not specified otherwise. Do not include preceding or trailing slashes.');
1101
  }
1102

  
1086 1103
  $form['file_entity_default_allowed_extensions'] = array(
1087 1104
    '#type' => 'textfield',
1088 1105
    '#title' => t('Default allowed file extensions'),
drupal7/sites/all/modules/file_entity/file_entity.field.inc
356 356
      $items = array_filter($items);
357 357
      foreach ($items as $delta => $item) {
358 358
        if (!empty($item['fid']) && ($file = file_load($item['fid'])) && file_entity_access('download', $file)) {
359
          if (isset($item['display'])) {
360
            $file->display = $item['display'];
361
          }
362
          if (isset($item['description'])) {
363
            $file->description = $item['description'];
364
          }
359 365
          $element[$delta] = array(
360 366
            '#theme' => 'file_entity_download_link',
361 367
            '#file' => $file,
drupal7/sites/all/modules/file_entity/file_entity.file.inc
150 150
 * Implements hook_file_mimetype_mapping_alter().
151 151
 */
152 152
function file_entity_file_mimetype_mapping_alter(&$mapping) {
153
  // Add support for mka and mkv.
154
  // @todo Remove when http://drupal.org/node/1443070 is fixed in core.
155
  $new_mappings['mka'] = 'audio/x-matroska';
156
  $new_mappings['mkv'] = 'video/x-matroska';
153
  // For info on adding new mime-types to core: http://drupal.org/node/1443070.
157 154

  
158
  // Add support for weba, webm, and webp.
159
  // @todo Remove when http://drupal.org/node/1443070 is fixed in core.
160
  $new_mappings['weba'] = 'audio/webm';
161
  $new_mappings['webm'] = 'video/webm';
162
  $new_mappings['webp'] = 'image/webp';
155
  // @todo. Remove after fixing this in core http://drupal.org/node/2912875.
156
  // Add support for autocad drawings.
157
  $new_mappings['dwg'] = 'application/acad';
158
  // For info on adding new mime-types to file_entity: drupal.org/node/2900830.
163 159

  
164 160
  foreach ($new_mappings as $extension => $mime_type) {
165 161
    if (!in_array($mime_type, $mapping['mimetypes'])) {
......
178 174
 */
179 175
function file_entity_file_load($files) {
180 176
  // Add alt and title text to images.
177
  file_entity_set_title_alt_properties($files);
178

  
179
  // Load and unserialize metadata.
180
  $results = db_query("SELECT * FROM {file_metadata} WHERE fid IN (:fids)", array(':fids' => array_keys($files)));
181

  
182
  foreach ($results as $result) {
183
    $name = $result->name;
184

  
185
    // image.module required height and width to be properties of the file.
186
    if ($name == 'height' || $name == 'width') {
187
      $files[$result->fid]->$name = unserialize($result->value);
188
    }
189

  
190
    $files[$result->fid]->metadata[$name] = unserialize($result->value);
191
  }
192
}
193

  
194
/**
195
 * Implements hook_entitycache_ENTITY_TYPE_load().
196
 */
197
function file_entitycache_file_load($files) {
198
  // Integrates with entitycache - ensures the alt and title text on images is
199
  // localized.
200
  file_entity_set_title_alt_properties($files);
201
}
202

  
203
/**
204
 * Set the title / alt properties of file objects.
205
 *
206
 * @param array $files List of file entities.
207
 */
208
function file_entity_set_title_alt_properties($files) {
181 209
  $alt = variable_get('file_entity_alt', '[file:field_file_image_alt_text]');
182 210
  $title = variable_get('file_entity_title', '[file:field_file_image_title_text]');
183 211

  
184 212
  $replace_options = array(
185 213
    'clear' => TRUE,
186 214
    'sanitize' => FALSE,
215
    'language' => $GLOBALS['language'],
187 216
  );
188 217

  
189 218
  foreach ($files as $file) {
......
207 236
      $file->title = decode_entities($output);
208 237
    }
209 238
  }
210

  
211
  // Load and unserialize metadata.
212
  $results = db_query("SELECT * FROM {file_metadata} WHERE fid IN (:fids)", array(':fids' => array_keys($files)));
213

  
214
  foreach ($results as $result) {
215
    $name = $result->name;
216

  
217
    // image.module required height and width to be properties of the file.
218
    if ($name == 'height' || $name == 'width') {
219
      $files[$result->fid]->$name = unserialize($result->value);
220
    }
221

  
222
    $files[$result->fid]->metadata[$name] = unserialize($result->value);
223
  }
224 239
}
225 240

  
226 241
/**
drupal7/sites/all/modules/file_entity/file_entity.info
32 32
; We have to add a fake version so Git checkouts do not fail Media dependencies
33 33
version = 7.x-2.x-dev
34 34

  
35
; Information added by Drupal.org packaging script on 2017-08-10
36
version = "7.x-2.4"
35
; Information added by Drupal.org packaging script on 2017-10-03
36
version = "7.x-2.6"
37 37
core = "7.x"
38 38
project = "file_entity"
39
datestamp = "1502334549"
39
datestamp = "1507063150"
40 40

  
drupal7/sites/all/modules/file_entity/file_entity.install
239 239
  // Remove variables.
240 240
  variable_del('file_entity_max_filesize');
241 241
  variable_del('file_entity_default_allowed_extensions');
242
  variable_del('file_entity_default_file_directory');
242 243
  variable_del('file_entity_alt');
243 244
  variable_del('file_entity_title');
244 245
  variable_del('file_entity_allow_insecure_download');
drupal7/sites/all/modules/file_entity/file_entity.pages.inc
511 511
function file_entity_upload_destination_uri(array $params, array $data = array()) {
512 512
  $params += array(
513 513
    'uri_scheme' => file_default_scheme(),
514
    'file_directory' => '',
514
    'file_directory' => variable_get('file_entity_default_file_directory', ''),
515 515
  );
516 516

  
517 517
  $destination = trim($params['file_directory'], '/');
drupal7/sites/all/modules/file_entity/tests/file_entity_test.info
5 5
dependencies[] = file_entity
6 6
hidden = TRUE
7 7

  
8
; Information added by Drupal.org packaging script on 2017-08-10
9
version = "7.x-2.4"
8
; Information added by Drupal.org packaging script on 2017-10-03
9
version = "7.x-2.6"
10 10
core = "7.x"
11 11
project = "file_entity"
12
datestamp = "1502334549"
12
datestamp = "1507063150"
13 13

  

Formats disponibles : Unified diff