Projet

Général

Profil

Révision 02a0babc

Ajouté par Assos Assos il y a presque 7 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/file_entity/file_entity.field.inc
272 272
  return implode('<br />', $summary);
273 273
}
274 274

  
275
/**
276
 * Implements hook_field_formatter_prepare_view().
277
 */
278
function file_entity_field_formatter_prepare_view($entity_type, $entities, $field, $instances, $langcode, &$items, $displays) {
279
  // File and image fields set item values to NULL if a file cannot be loaded.
280
  // Remove those empty items so we can simply iterate through $items normally
281
  // in file_entity_field_formatter_view().
282
  foreach (array_keys($entities) as $id) {
283
    $items[$id] = array_filter($items[$id]);
284
  }
285
}
286

  
275 287
/**
276 288
 * Implements hook_field_formatter_view().
277 289
 */
......
356 368
    case 'file_audio':
357 369
      $multiple_file_behavior = $settings['multiple_file_behavior'];
358 370

  
359
      // Prevent 'empty' fields from causing a WSOD.
360
      $items = array_filter($items);
361

  
362 371
      // Build an array of sources for each <audio> element.
363 372
      $source_lists = array();
364 373
      if ($multiple_file_behavior == 'tags') {
......
392 401
    case 'file_video':
393 402
      $multiple_file_behavior = $settings['multiple_file_behavior'];
394 403

  
395
      // Prevent 'empty' fields from causing a WSOD.
396
      $items = array_filter($items);
397

  
398 404
      // Build an array of sources for each <video> element.
399 405
      $source_lists = array();
400 406
      if ($multiple_file_behavior == 'tags') {
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-06-19
36
version = "7.x-2.2"
35
; Information added by Drupal.org packaging script on 2017-07-04
36
version = "7.x-2.3"
37 37
core = "7.x"
38 38
project = "file_entity"
39
datestamp = "1497884645"
39
datestamp = "1499174351"
40 40

  
drupal7/sites/all/modules/file_entity/file_entity.module
1141 1141
      'label' => t('Image'),
1142 1142
      'default settings' => array(
1143 1143
        'image_style' => '',
1144
        'alt' => '[file:field_file_image_alt_text]',
1145
        'title' => '[file:field_file_image_title_text]'
1144
        'alt' => '[file:field-file-image-alt-text]',
1145
        'title' => '[file:field-file-image-title-text]'
1146 1146
      ),
1147 1147
      'view callback' => 'file_entity_file_formatter_file_image_view',
1148 1148
      'settings callback' => 'file_entity_file_formatter_file_image_settings',
......
1677 1677

  
1678 1678
  // $file may be either an object or a file type. Since file types cannot be
1679 1679
  // an integer, use either fid or type as the static cache id.
1680
  $cache_id = is_object($file) ? $file->fid : $file;
1680
  $cache_id = NULL;
1681
  if (!empty($file->id)) {
1682
    $cache_id = $file->id;
1683
  }
1684
  elseif (is_string($file) && $op == 'create') {
1685
    $cache_id = $file;
1686
  }
1687
  else {
1688
    $cache_id = drupal_hash_base64(serialize($file));
1689
  }
1681 1690

  
1682 1691
  // If we've already checked access for this file, user and op, return from
1683 1692
  // cache.
......
1738 1747
 */
1739 1748
function file_entity_file_entity_access($op, $file, $account) {
1740 1749
  // If the file URI is invalid, deny access.
1741
  if (is_object($file) && !file_valid_uri($file->uri)) {
1750
  if (is_object($file) && isset($file->uri) && !file_valid_uri($file->uri)) {
1751
    if(isset($file->is_new) && $file->is_new == true && user_access('create files')) {
1752
      return FILE_ENTITY_ACCESS_ALLOW;
1753
    }
1742 1754
    return FILE_ENTITY_ACCESS_DENY;
1743 1755
  }
1744 1756

  
......
1832 1844
  if (!$base_table) {
1833 1845
    $fallback = '';
1834 1846
    foreach ($tables as $alias => $table_info) {
1835
      if (!($table_info instanceof SelectQueryInterface)) {
1847
      if (!($table_info instanceof SelectQueryInterface || $table_info['table'] instanceof SelectQueryInterface)) {
1836 1848
        $table = $table_info['table'];
1837 1849
        // If the file_managed table is in the query, it wins immediately.
1838 1850
        if ($table == 'file_managed') {
drupal7/sites/all/modules/file_entity/file_entity.pages.inc
85 85
  }
86 86
  $step = (isset($form_state['step']) && in_array($form_state['step'], array(1, 2, 3, 4))) ? $form_state['step'] : 1;
87 87
  $form['#step'] = $step;
88
  $form['#options'] = $options;
88
  $form['#options'] = $options + array(
89
    'types' => array(),
90
    'enabledPlugins' => array(),
91
    'schemes' => array(),
92
    'max_filesize' => '',
93
    'uri_scheme' => 'public',
94
    'plugins' => ''
95
  );
96

  
89 97
  switch ($step) {
90 98
    case 1:
91 99
      return file_entity_add_upload_step_upload($form, $form_state, $options);
......
133 141
 */
134 142
function file_entity_add_upload_step_filetype($form, &$form_state, array $options = array()) {
135 143
  $file = file_load($form_state['storage']['upload']);
144
  $selected_files = $form['#options']['types'];
136 145

  
137 146
  $form['type'] = array(
138 147
    '#type' => 'radios',
139 148
    '#title' => t('File type'),
140
    '#options' => file_entity_get_filetype_candidates($file),
149
    '#options' => file_entity_get_filetype_candidates($file, $selected_files),
141 150
    '#default_value' => isset($form_state['storage']['type']) ? $form_state['storage']['type'] : NULL,
142 151
    '#required' => TRUE,
143 152
  );
......
312 321
 * @return array
313 322
 *   An array of file type bundles that support the file's mime type.
314 323
 */
315
function file_entity_get_filetype_candidates($file) {
324
function file_entity_get_filetype_candidates($file, $selected_files = array()) {
316 325
  $types = module_invoke_all('file_type', $file);
317 326
  drupal_alter('file_type', $types, $file);
327

  
328
  // If no file types are selected in field instance settings, allow all
329
  // available types.
330
  if (!empty($selected_files)) {
331
    // Limit file type candidates to field allowed types.
332
    $types = array_intersect($types, $selected_files);
333
  }
334

  
318 335
  $candidates = array();
319 336
  foreach ($types as $type) {
320 337
    $file->type = $type;
......
332 349
  $form_state['storage'] = isset($form_state['storage']) ? $form_state['storage'] : array();
333 350
  $form_state['storage'] = array_merge($form_state['storage'], $form_state['values']);
334 351

  
352
  // Field selected allowed types.
353
  $selected_files = $form['#options']['types'];
354

  
335 355
  // This var is set to TRUE when we are ready to save the file.
336 356
  $save = FALSE;
337 357
  $trigger = $form_state['triggering_element']['#id'];
......
349 369
      $file = file_load($form_state['storage']['upload']);
350 370
      if ($step == 2) {
351 371
        // Check if we can skip step 2.
352
        $candidates = file_entity_get_filetype_candidates($file);
372
        $candidates = file_entity_get_filetype_candidates($file, $selected_files);
353 373
        if (count($candidates) == 1) {
354 374
          $candidates_keys = array_keys($candidates);
355 375
          // There is only one possible filetype for this file.
......
853 873
  if (file_uri_scheme($file->uri) != $form_state['values']['scheme']) {
854 874
    $file_destination = $form_state['values']['scheme'] . '://' . file_uri_target($file->uri);
855 875
    $file_destination = file_stream_wrapper_uri_normalize($file_destination);
876
    $file_destination_dirname = drupal_dirname($file_destination);
877
    // Create the directory in case it doesn't exist.
878
    file_prepare_directory($file_destination_dirname, FILE_CREATE_DIRECTORY);
856 879
    if ($moved_file = file_move($file, $file_destination, FILE_EXISTS_RENAME)) {
857 880
      // Only re-assign the file object if file_move() did not fail.
858 881
      $file = $moved_file;
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-06-19
9
version = "7.x-2.2"
8
; Information added by Drupal.org packaging script on 2017-07-04
9
version = "7.x-2.3"
10 10
core = "7.x"
11 11
project = "file_entity"
12
datestamp = "1497884645"
12
datestamp = "1499174351"
13 13

  
drupal7/sites/all/modules/media/js/media.popups.js
111 111
  return {
112 112
    global: {
113 113
      types: [], // Types to allow, defaults to all.
114
      activePlugins: [] // If provided, a list of plugins which should be enabled.
114
      enabledPlugins: [] // If provided, a list of plugins which should be enabled.
115 115
    },
116 116
    widget: { // Settings for the actual iFrame which is launched.
117 117
      src: Drupal.settings.media.browserUrl, // Src of the media browser (if you want to totally override it)
drupal7/sites/all/modules/media/media.info
24 24
; We have to add a fake version so Git checkouts do not fail Media dependencies
25 25
version = 7.x-2.x-dev
26 26

  
27
; Information added by Drupal.org packaging script on 2017-06-16
28
version = "7.x-2.8"
27
; Information added by Drupal.org packaging script on 2017-07-04
28
version = "7.x-2.9"
29 29
core = "7.x"
30 30
project = "media"
31
datestamp = "1497597548"
31
datestamp = "1499174646"
32 32

  
drupal7/sites/all/modules/media/media.module
1138 1138
function media_file_validate_types($file, $types) {
1139 1139
  $errors = array();
1140 1140

  
1141
  if (!function_exists('file_entity_get_filetype_candidates')) {
1142
    module_load_include('inc', 'file_entity', 'file_entity.pages');
1143
  }
1141 1144
  $file_candidates = array_keys(file_entity_get_filetype_candidates($file));
1142 1145
  if (!array_intersect($file_candidates, $types)) {
1143 1146
    $errors[] = t('Only the following types of files are allowed to be uploaded: %types-allowed', array('%types-allowed' => implode(', ', $types)));
......
1217 1220

  
1218 1221
    // Filter out everything except a whitelist of known safe options.
1219 1222
    $safe_options = array(
1220
      'activePlugins',
1223
      'enabledPlugins',
1221 1224
      'fid',
1222 1225
      'id',
1223 1226
      'multiselect',
drupal7/sites/all/modules/media/modules/media_bulk_upload/media_bulk_upload.info
15 15
files[] = includes/MediaBrowserBulkUpload.inc
16 16
files[] = tests/media_bulk_upload.test
17 17

  
18
; Information added by Drupal.org packaging script on 2017-06-16
19
version = "7.x-2.8"
18
; Information added by Drupal.org packaging script on 2017-07-04
19
version = "7.x-2.9"
20 20
core = "7.x"
21 21
project = "media"
22
datestamp = "1497597548"
22
datestamp = "1499174646"
23 23

  
drupal7/sites/all/modules/media/modules/media_bulk_upload/media_bulk_upload.module
52 52
 * Implements hook_media_browser_plugin_info_alter().
53 53
 */
54 54
function media_bulk_upload_media_browser_plugin_info_alter(&$info) {
55
  $info['upload']['title'] = t('Upload');
55 56
  $info['upload']['class'] = 'MediaBrowserBulkUpload';
57

  
56 58
}
57 59

  
58 60
/**
drupal7/sites/all/modules/media/modules/media_internet/media_internet.info
12 12
files[] = includes/MediaInternetValidationException.inc
13 13
files[] = tests/media_internet.test
14 14

  
15
; Information added by Drupal.org packaging script on 2017-06-16
16
version = "7.x-2.8"
15
; Information added by Drupal.org packaging script on 2017-07-04
16
version = "7.x-2.9"
17 17
core = "7.x"
18 18
project = "media"
19
datestamp = "1497597548"
19
datestamp = "1499174646"
20 20

  
drupal7/sites/all/modules/media/modules/media_internet/tests/media_internet_test.info
7 7
files[] = includes/MediaInternetTestStreamWrapper.inc
8 8
files[] = includes/MediaInternetTestHandler.inc
9 9

  
10
; Information added by Drupal.org packaging script on 2017-06-16
11
version = "7.x-2.8"
10
; Information added by Drupal.org packaging script on 2017-07-04
11
version = "7.x-2.9"
12 12
core = "7.x"
13 13
project = "media"
14
datestamp = "1497597548"
14
datestamp = "1499174646"
15 15

  
drupal7/sites/all/modules/media/modules/media_migrate_file_types/media_migrate_file_types.info
8 8

  
9 9
configure = admin/structure/file-types/upgrade
10 10

  
11
; Information added by Drupal.org packaging script on 2017-06-16
12
version = "7.x-2.8"
11
; Information added by Drupal.org packaging script on 2017-07-04
12
version = "7.x-2.9"
13 13
core = "7.x"
14 14
project = "media"
15
datestamp = "1497597548"
15
datestamp = "1499174646"
16 16

  
drupal7/sites/all/modules/media/modules/media_wysiwyg/includes/media_wysiwyg.filter.inc
342 342
        'media-element-container',
343 343
        'media-' . $element['content']['file']['#view_mode'],
344 344
      );
345
      if (variable_get('media_wysiwyg_remove_media_class', FALSE)) {
346
        $classes = $element['content']['#attributes']['class'];
347
        $element['content']['#attributes']['class'] = array_diff($classes, array('media'));
348
      }
345 349
    }
346 350

  
347 351
    // Conditionally add a pre-render if the media filter output is be cached.
drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.info
16 16

  
17 17
configure = admin/config/media/browser
18 18

  
19
; Information added by Drupal.org packaging script on 2017-06-16
20
version = "7.x-2.8"
19
; Information added by Drupal.org packaging script on 2017-07-04
20
version = "7.x-2.9"
21 21
core = "7.x"
22 22
project = "media"
23
datestamp = "1497597548"
23
datestamp = "1499174646"
24 24

  
drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.install
77 77
  variable_del('media_wysiwyg_use_link_text_for_filename');
78 78
  variable_del('media_wysiwyg_alignment');
79 79
  variable_del('media_wysiwyg_external_link');
80
  variable_del('media_wysiwyg_remove_media_class');
80 81
}
81 82

  
82 83
/**
drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.module
120 120
  $tagmap = array();
121 121

  
122 122
  foreach (array('value', 'summary') as $column) {
123
    if (isset($element[$column])) {
123
    if (isset($element[$column]['#value'])) {
124 124
      $tagmap += _media_wysiwyg_generate_tagMap($element[$column]['#value']);
125 125
    }
126 126
  }
......
281 281

  
282 282
  $options = array();
283 283
  foreach(field_info_field_types() as $key => $type) {
284
    $options[$key] = $type['label'];
284
    $options[$key] = (!empty($type['label']))? $type['label'] : ucfirst(str_replace("_"," ",$key));
285 285
  }
286 286
  asort($options);
287 287
  $form['wysiwyg']['media_wysiwyg_wysiwyg_override_field_types'] = array(
......
319 319
    '#default_value' => variable_get('media_wysiwyg_external_link', FALSE),
320 320
    '#description' => t('If checked there will be a new field when embedding that will allow users to link to the media to urls'),
321 321
  );
322

  
323
  $form['wysiwyg']['media_wysiwyg_remove_media_class'] = array(
324
    '#type' => 'checkbox',
325
    '#title' => t('Remove the ".media" class from embedded media'),
326
    '#description' => t('If checked, the ".media" class will be removed from embedded media. Particularlly for sites using Bootstrap, the ".media" class can cause CSS to be unexpectedly applied to embedded media.'),
327
    '#default_value' => variable_get('media_wysiwyg_remove_media_class', FALSE),
328
  );
329

  
322 330
  $form['#submit'][] = 'media_wysiwyg_admin_config_browser_pre_submit';
323 331
}
324 332

  
drupal7/sites/all/modules/media/modules/media_wysiwyg_view_mode/media_wysiwyg_view_mode.info
3 3
package = Media
4 4
core = 7.x
5 5

  
6
; Information added by Drupal.org packaging script on 2017-06-16
7
version = "7.x-2.8"
6
; Information added by Drupal.org packaging script on 2017-07-04
7
version = "7.x-2.9"
8 8
core = "7.x"
9 9
project = "media"
10
datestamp = "1497597548"
10
datestamp = "1499174646"
11 11

  
drupal7/sites/all/modules/media/modules/mediafield/mediafield.info
4 4
core = 7.x
5 5
dependencies[] = media
6 6

  
7
; Information added by Drupal.org packaging script on 2017-06-16
8
version = "7.x-2.8"
7
; Information added by Drupal.org packaging script on 2017-07-04
8
version = "7.x-2.9"
9 9
core = "7.x"
10 10
project = "media"
11
datestamp = "1497597548"
11
datestamp = "1499174646"
12 12

  
drupal7/sites/all/modules/media/tests/media_module_test.info
6 6

  
7 7
files[] = includes/MediaModuleTest.inc
8 8

  
9
; Information added by Drupal.org packaging script on 2017-06-16
10
version = "7.x-2.8"
9
; Information added by Drupal.org packaging script on 2017-07-04
10
version = "7.x-2.9"
11 11
core = "7.x"
12 12
project = "media"
13
datestamp = "1497597548"
13
datestamp = "1499174646"
14 14

  

Formats disponibles : Unified diff