Projet

Général

Profil

Révision 3acd948f

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

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/entityreference/entityreference.info
29 29
files[] = tests/entityreference.feeds.test
30 30
files[] = tests/entityreference.entity_translation.test
31 31

  
32
; Information added by Drupal.org packaging script on 2017-05-23
33
version = "7.x-1.4"
32
; Information added by Drupal.org packaging script on 2017-08-16
33
version = "7.x-1.5"
34 34
core = "7.x"
35 35
project = "entityreference"
36
datestamp = "1495557187"
36
datestamp = "1502895850"
37 37

  
drupal7/sites/all/modules/entityreference/entityreference.module
1 1
<?php
2 2

  
3
define('ENTITYREFERENCE_DENIED', '- Restricted access -');
4

  
3 5
/**
4 6
 * @file
5 7
 * Entityreference primary module file.
......
1106 1108
  if (isset($tag_last)) {
1107 1109
    // Get an array of matching entities.
1108 1110
    $entity_labels = $handler->getReferencableEntities($tag_last, $instance['widget']['settings']['match_operator'], 10);
1109

  
1111
    $denied_label = t(ENTITYREFERENCE_DENIED);
1110 1112
    // Loop through the products and convert them into autocomplete output.
1111 1113
    foreach ($entity_labels as $values) {
1112 1114
      foreach ($values as $entity_id => $label) {
1115
        // Never autocomplete entities that aren't accessible.
1116
        if ($label == $denied_label) {
1117
          continue;
1118
        }
1113 1119
        $key = "$label ($entity_id)";
1114 1120
        // Strip starting/trailing white spaces, line breaks and tags.
1115 1121
        $key = preg_replace('/\s\s+/', ' ', str_replace("\n", '', trim(decode_entities(strip_tags($key)))));
drupal7/sites/all/modules/entityreference/examples/entityreference_behavior_example/entityreference_behavior_example.info
4 4
package = Fields
5 5
dependencies[] = entityreference
6 6

  
7
; Information added by Drupal.org packaging script on 2017-05-23
8
version = "7.x-1.4"
7
; Information added by Drupal.org packaging script on 2017-08-16
8
version = "7.x-1.5"
9 9
core = "7.x"
10 10
project = "entityreference"
11
datestamp = "1495557187"
11
datestamp = "1502895850"
12 12

  
drupal7/sites/all/modules/entityreference/plugins/selection/EntityReference_SelectionHandler_Generic.class.php
309 309
   */
310 310
  public function getLabel($entity) {
311 311
    $target_type = $this->field['settings']['target_type'];
312
    return entity_access('view', $target_type, $entity) ? entity_label($target_type, $entity) : t('- Restricted access -');
312
    return entity_access('view', $target_type, $entity) ? entity_label($target_type, $entity) : t(ENTITYREFERENCE_DENIED);
313 313
  }
314 314

  
315 315
  /**
drupal7/sites/all/modules/entityreference/tests/entityreference.handlers.test
271 271
        ),
272 272
        'result' => array(
273 273
          'user' => array(
274
            $users['admin']->uid => '- Restricted access -',
274
            $users['admin']->uid => ENTITYREFERENCE_DENIED,
275 275
            $users['non_admin']->uid => $user_labels['non_admin'],
276 276
          ),
277 277
        ),
drupal7/sites/all/modules/entityreference/tests/modules/entityreference_feeds_test/entityreference_feeds_test.info
8 8
dependencies[] = feeds_ui
9 9
dependencies[] = entityreference
10 10

  
11
; Information added by Drupal.org packaging script on 2017-05-23
12
version = "7.x-1.4"
11
; Information added by Drupal.org packaging script on 2017-08-16
12
version = "7.x-1.5"
13 13
core = "7.x"
14 14
project = "entityreference"
15
datestamp = "1495557187"
15
datestamp = "1502895850"
16 16

  
drupal7/sites/all/modules/file_entity/admin_views_default/file.admin-content-file.inc
33 33
$handler->display->display_options['pager']['options']['quantity'] = '9';
34 34
$handler->display->display_options['style_plugin'] = 'table';
35 35
$handler->display->display_options['style_options']['columns'] = array(
36
    'views_bulk_operations' => 'views_bulk_operations',
37
    'filename' => 'filename',
38
    'type' => 'type',
39
    'name' => 'name',
40
    'filesize' => 'filesize',
41
    'timestamp' => 'timestamp',
42
    'edit' => 'edit',
43
    'delete' => 'delete',
36
  'views_bulk_operations' => 'views_bulk_operations',
37
  'filename' => 'filename',
38
  'type' => 'type',
39
  'name' => 'name',
40
  'filesize' => 'filesize',
41
  'timestamp' => 'timestamp',
42
  'edit' => 'edit',
43
  'delete' => 'delete',
44 44
);
45 45
$handler->display->display_options['style_options']['default'] = 'timestamp';
46 46
$handler->display->display_options['style_options']['info'] = array(
47
    'views_bulk_operations' => array(
48
        'align' => '',
49
        'separator' => '',
50
        'empty_column' => 0,
51
    ),
52
    'filename' => array(
53
        'sortable' => 1,
54
        'default_sort_order' => 'asc',
55
        'align' => '',
56
        'separator' => '',
57
        'empty_column' => 0,
58
    ),
59
    'type' => array(
60
        'sortable' => 1,
61
        'default_sort_order' => 'asc',
62
        'align' => '',
63
        'separator' => '',
64
        'empty_column' => 0,
65
    ),
66
    'name' => array(
67
        'sortable' => 1,
68
        'default_sort_order' => 'asc',
69
        'align' => '',
70
        'separator' => '',
71
        'empty_column' => 0,
72
    ),
73
    'filesize' => array(
74
        'sortable' => 1,
75
        'default_sort_order' => 'asc',
76
        'align' => '',
77
        'separator' => '',
78
        'empty_column' => 0,
79
    ),
80
    'timestamp' => array(
81
        'sortable' => 1,
82
        'default_sort_order' => 'desc',
83
        'align' => '',
84
        'separator' => '',
85
        'empty_column' => 0,
86
    ),
87
    'edit' => array(
88
        'sortable' => 0,
89
        'default_sort_order' => 'asc',
90
        'align' => '',
91
        'separator' => '',
92
        'empty_column' => 0,
93
    ),
94
    'usage' => array(
95
        'sortable' => 1,
96
        'default_sort_order' => 'asc',
97
        'align' => '',
98
        'separator' => '',
99
        'empty_column' => 0,
100
    ),
101
    'delete' => array(
102
        'sortable' => 0,
103
        'default_sort_order' => 'asc',
104
        'align' => '',
105
        'separator' => '',
106
        'empty_column' => 0,
107
    ),
47
  'views_bulk_operations' => array(
48
    'align' => '',
49
    'separator' => '',
50
    'empty_column' => 0,
51
  ),
52
  'filename' => array(
53
    'sortable' => 1,
54
    'default_sort_order' => 'asc',
55
    'align' => '',
56
    'separator' => '',
57
    'empty_column' => 0,
58
  ),
59
  'type' => array(
60
    'sortable' => 1,
61
    'default_sort_order' => 'asc',
62
    'align' => '',
63
    'separator' => '',
64
    'empty_column' => 0,
65
  ),
66
  'name' => array(
67
    'sortable' => 1,
68
    'default_sort_order' => 'asc',
69
    'align' => '',
70
    'separator' => '',
71
    'empty_column' => 0,
72
  ),
73
  'filesize' => array(
74
    'sortable' => 1,
75
    'default_sort_order' => 'asc',
76
    'align' => '',
77
    'separator' => '',
78
    'empty_column' => 0,
79
  ),
80
  'timestamp' => array(
81
    'sortable' => 1,
82
    'default_sort_order' => 'desc',
83
    'align' => '',
84
    'separator' => '',
85
    'empty_column' => 0,
86
  ),
87
  'edit' => array(
88
    'sortable' => 0,
89
    'default_sort_order' => 'asc',
90
    'align' => '',
91
    'separator' => '',
92
    'empty_column' => 0,
93
  ),
94
  'usage' => array(
95
    'sortable' => 1,
96
    'default_sort_order' => 'asc',
97
    'align' => '',
98
    'separator' => '',
99
    'empty_column' => 0,
100
  ),
101
  'delete' => array(
102
    'sortable' => 0,
103
    'default_sort_order' => 'asc',
104
    'align' => '',
105
    'separator' => '',
106
    'empty_column' => 0,
107
  ),
108 108
);
109 109
$handler->display->display_options['style_options']['sticky'] = TRUE;
110 110
$handler->display->display_options['style_options']['empty_table'] = TRUE;
......
130 130
$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['force_single'] = 0;
131 131
$handler->display->display_options['fields']['views_bulk_operations']['vbo_settings']['entity_load_capacity'] = '10';
132 132
$handler->display->display_options['fields']['views_bulk_operations']['vbo_operations'] = array(
133
    'action::views_bulk_operations_archive_action' => array(
134
        'selected' => 1,
135
        'postpone_processing' => 0,
136
        'skip_confirmation' => 0,
137
        'override_label' => 1,
138
        'label' => 'Archive',
139
        'settings' => array(
140
            'scheme' => 'public',
141
            'temporary' => 1,
142
        ),
143
    ),
144
    'action::views_bulk_operations_delete_item' => array(
145
        'selected' => 1,
146
        'postpone_processing' => 0,
147
        'skip_confirmation' => 0,
148
        'override_label' => 1,
149
        'label' => 'Delete',
150
    ),
151
    'action::views_bulk_operations_script_action' => array(
152
        'selected' => 0,
153
        'postpone_processing' => 0,
154
        'skip_confirmation' => 0,
155
        'override_label' => 0,
156
        'label' => '',
133
  'action::views_bulk_operations_archive_action' => array(
134
    'selected' => 1,
135
    'postpone_processing' => 0,
136
    'skip_confirmation' => 0,
137
    'override_label' => 1,
138
    'label' => 'Archive',
139
    'settings' => array(
140
      'scheme' => 'public',
141
      'temporary' => 1,
157 142
    ),
158
    'action::views_bulk_operations_modify_action' => array(
159
        'selected' => 1,
160
        'postpone_processing' => 0,
161
        'skip_confirmation' => 1,
162
        'override_label' => 1,
163
        'label' => 'Change value',
164
        'settings' => array(
165
            'show_all_tokens' => 1,
166
            'display_values' => array(
167
                '_all_' => '_all_',
168
            ),
143
  ),
144
  'action::views_bulk_operations_delete_item' => array(
145
    'selected' => 1,
146
    'postpone_processing' => 0,
147
    'skip_confirmation' => 0,
148
    'override_label' => 1,
149
    'label' => 'Delete',
150
  ),
151
  'action::views_bulk_operations_script_action' => array(
152
    'selected' => 0,
153
    'postpone_processing' => 0,
154
    'skip_confirmation' => 0,
155
    'override_label' => 0,
156
    'label' => '',
157
  ),
158
  'action::views_bulk_operations_modify_action' => array(
159
    'selected' => 1,
160
    'postpone_processing' => 0,
161
    'skip_confirmation' => 1,
162
    'override_label' => 1,
163
    'label' => 'Change value',
164
    'settings' => array(
165
        'show_all_tokens' => 1,
166
        'display_values' => array(
167
            '_all_' => '_all_',
169 168
        ),
170 169
    ),
171
    'action::views_bulk_operations_argument_selector_action' => array(
172
        'selected' => 0,
173
        'skip_confirmation' => 0,
174
        'override_label' => 0,
175
        'label' => '',
176
        'settings' => array(
177
            'url' => '',
178
        ),
179
    ),
180
    'action::system_send_email_action' => array(
181
        'selected' => 0,
182
        'postpone_processing' => 0,
183
        'skip_confirmation' => 0,
184
        'override_label' => 0,
185
        'label' => '',
186
    ),
187
    'action::panelizer_set_status_action' => array(
188
        'selected' => 0,
189
        'postpone_processing' => 0,
190
        'skip_confirmation' => 0,
191
        'override_label' => 0,
192
        'label' => '',
170
  ),
171
  'action::views_bulk_operations_argument_selector_action' => array(
172
    'selected' => 0,
173
    'skip_confirmation' => 0,
174
    'override_label' => 0,
175
    'label' => '',
176
    'settings' => array(
177
      'url' => '',
193 178
    ),
179
  ),
180
  'action::system_send_email_action' => array(
181
    'selected' => 0,
182
    'postpone_processing' => 0,
183
    'skip_confirmation' => 0,
184
    'override_label' => 0,
185
    'label' => '',
186
  ),
187
  'action::panelizer_set_status_action' => array(
188
    'selected' => 0,
189
    'postpone_processing' => 0,
190
    'skip_confirmation' => 0,
191
    'override_label' => 0,
192
    'label' => '',
193
  ),
194 194
);
195 195
/* Field: File: Name */
196 196
$handler->display->display_options['fields']['filename']['id'] = 'filename';
......
267 267
$handler->display->display_options['filters']['filename']['expose']['identifier'] = 'filename';
268 268
$handler->display->display_options['filters']['filename']['expose']['remember'] = TRUE;
269 269
$handler->display->display_options['filters']['filename']['expose']['remember_roles'] = array(
270
    2 => '2',
271
    1 => 0,
272
    3 => 0,
270
  2 => '2',
271
  1 => 0,
272
  3 => 0,
273 273
);
274 274
/* Filter criterion: File: Type */
275 275
$handler->display->display_options['filters']['type']['id'] = 'type';
......
283 283
$handler->display->display_options['filters']['type']['expose']['identifier'] = 'type';
284 284
$handler->display->display_options['filters']['type']['expose']['remember'] = TRUE;
285 285
$handler->display->display_options['filters']['type']['expose']['remember_roles'] = array(
286
    2 => '2',
287
    1 => 0,
288
    3 => 0,
286
  2 => '2',
287
  1 => 0,
288
  3 => 0,
289 289
);
290 290
/* Filter criterion: User: Name */
291 291
$handler->display->display_options['filters']['uid']['id'] = 'uid';
......
301 301
$handler->display->display_options['filters']['uid']['expose']['identifier'] = 'uid';
302 302
$handler->display->display_options['filters']['uid']['expose']['remember'] = TRUE;
303 303
$handler->display->display_options['filters']['uid']['expose']['remember_roles'] = array(
304
    2 => '2',
305
    1 => 0,
306
    3 => 0,
304
  2 => '2',
305
  1 => 0,
306
  3 => 0,
307 307
);
308 308

  
309 309
/* Display: System */
drupal7/sites/all/modules/file_entity/file_entity.admin.inc
1 1
<?php
2

  
2 3
/**
3 4
 * @file
4 5
 * File administration and module settings UI.
......
178 179
 *   Array of key/value pairs with file field names and the
179 180
 *   value to update that field to.
180 181
 */
181
function file_entity_mass_update($files, $updates) {
182
function file_entity_mass_update(array $files, array $updates) {
182 183
  // We use batch processing to prevent timeout when updating a large number
183 184
  // of files.
184 185
  if (count($files) > 10) {
......
323 324
    'timestamp' => array(
324 325
      'data' => t('Updated'),
325 326
      'field' => 'fm.timestamp',
326
      'sort' => 'desc'),
327
      'sort' => 'desc',
328
    ),
327 329
    'usage' => array('data' => t('Used in'), 'field' => 'total_count'),
328 330
    'operations' => array('data' => t('Operations')),
329 331
  );
330 332

  
333
  if (variable_get('file_entity_total_count_optimization', FALSE)) {
334
    // If the total_count is being retrieved by subqueries,
335
    // the table is not sortable by this column.
336
    unset($header['usage']['field']);
337
  }
338

  
331 339
  $query = db_select('file_managed', 'fm')->extend('PagerDefault')->extend('TableSort');
332
  $query->leftJoin('file_usage', 'fu', 'fm.fid = fu.fid');
333
  $query->groupBy('fm.fid');
334
  $query->groupBy('fm.uid');
335
  $query->groupBy('fm.timestamp');
336
  $query->addExpression('SUM(fu.count)', 'total_count');
340
  if (!variable_get('file_entity_total_count_optimization', FALSE)) {
341
    $query->leftJoin('file_usage', 'fu', 'fm.fid = fu.fid');
342
    $query->groupBy('fm.fid');
343
    $query->groupBy('fm.uid');
344
    $query->groupBy('fm.timestamp');
345
    $query->addExpression('SUM(fu.count)', 'total_count');
346
  }
337 347
  file_entity_build_filter_query($query);
338 348

  
339 349
  $result = $query
......
343 353
    ->addTag('file_access')
344 354
    ->execute()
345 355
    ->fetchAllAssoc('fid');
356

  
357
  if (variable_get('file_entity_total_count_optimization', FALSE)) {
358
    // Get the total_count in separate queries, otherwise the main
359
    // query will take too long.
360
    // This setting can be configured under /admin/config/development/performance.
361
    foreach ($result as &$file_result) {
362
      $count_query = db_select('file_usage', 'fu')
363
        ->fields('fu', array('fid', 'count'))
364
        ->condition('fu.fid', $file_result->fid, '=');
365
      $count_query->addExpression('SUM(fu.count)', 'total_count');
366
      $count_result = $count_query->execute()->fetchAll();
367

  
368
      if (!empty($count_result[0]->total_count)) {
369
        $file_result->total_count = $count_result[0]->total_count;
370
      }
371
    }
372
  }
373

  
346 374
  $files = file_load_multiple(array_keys($result));
347 375

  
348 376
  $uids = array();
......
931 959
  $form_state['redirect'] = 'admin/structure/file-types';
932 960
}
933 961

  
934

  
935 962
/**
936 963
 * Menu callback; disable a single file type.
937 964
 */
......
942 969
  return confirm_form($form, $message, 'admin/structure/file-types', '', t('Enable'));
943 970
}
944 971

  
945

  
946 972
/**
947 973
 * Process file type disable confirm submissions.
948 974
 */
......
952 978
  drupal_set_message(t('The file type %label has been enabled.', $t_args));
953 979
  watchdog('file_entity', 'Enabled file type %label.', $t_args, WATCHDOG_NOTICE);
954 980
  $form_state['redirect'] = 'admin/structure/file-types';
955
  return;
956 981
}
957 982

  
958

  
959 983
/**
960 984
 * Menu callback; disable a single file type.
961 985
 */
......
989 1013
  drupal_set_message(t('The file type %label has been disabled.', $t_args));
990 1014
  watchdog('file_entity', 'Disabled file type %label.', $t_args, WATCHDOG_NOTICE);
991 1015
  $form_state['redirect'] = 'admin/structure/file-types';
992
  return;
993 1016
}
994 1017

  
995

  
996 1018
/**
997 1019
 * Menu callback; revert a single file type.
998 1020
 */
......
1003 1025
  return confirm_form($form, $message, 'admin/structure/file-types', '', t('Revert'));
1004 1026
}
1005 1027

  
1006

  
1007 1028
/**
1008 1029
 * Process file type delete confirm submissions.
1009 1030
 */
......
1014 1035
  drupal_set_message(t('The file type %label has been reverted.', $t_args));
1015 1036
  watchdog('file_entity', 'Reverted file type %label.', $t_args, WATCHDOG_NOTICE);
1016 1037
  $form_state['redirect'] = 'admin/structure/file-types';
1017
  return;
1018 1038
}
1019 1039

  
1020

  
1021 1040
/**
1022 1041
 * Menu callback; delete a single file type.
1023 1042
 */
......
1049 1068
  watchdog('file_entity', 'Deleted file type %label.', $t_args, WATCHDOG_NOTICE);
1050 1069

  
1051 1070
  $form_state['redirect'] = 'admin/structure/file-types';
1052
  return;
1053 1071
}
1054 1072

  
1055 1073
/**
drupal7/sites/all/modules/file_entity/file_entity.api.php
78 78
 *   Array of information on file formatters exposed by
79 79
 *   hook_file_formatter_info() implementations.
80 80
 */
81
function hook_file_formatter_info_alter(&$info) {
81
function hook_file_formatter_info_alter(array &$info) {
82 82
  // @todo Add example.
83 83
}
84 84

  
......
170 170
 *   - "delete"
171 171
 *   - "update"
172 172
 *   - "view"
173
 *   - "download"
173
 *   - "download".
174 174
 * @param object $file
175 175
 *   The file on which the operation is to be performed, or, if it does
176 176
 *   not yet exist, the type of file to be created.
......
178 178
 *   A user object representing the user for whom the operation is to be
179 179
 *   performed.
180 180
 *
181
 * @return string|NULL
181
 * @return string|null
182 182
 *   FILE_ENTITY_ACCESS_ALLOW if the operation is to be allowed;
183 183
 *   FILE_ENTITY_ACCESS_DENY if the operation is to be denied;
184 184
 *   FILE_ENTITY_ACCESS_IGNORE to not affect this operation at all.
......
377 377
 * @param object $file
378 378
 *   File object.
379 379
 */
380
function hook_file_type_alter(&$types, $file) {
380
function hook_file_type_alter(array &$types, $file) {
381 381
  // Choose a specific, non-first, file type.
382 382
  $types = array($types[4]);
383 383
}
drupal7/sites/all/modules/file_entity/file_entity.devel_generate.inc
5 5
 * Devel generate integration for the File Entity module.
6 6
 */
7 7

  
8
/**
9
 * Devel generate file form.
10
 *
11
 * Options for Devel generate file integration.
12
 */
8 13
function file_entity_generate_file_form() {
9 14
  $form['count'] = array(
10 15
    '#type' => 'textfield',
......
32 37
  return $form;
33 38
}
34 39

  
40
/**
41
 * Implements hook_ID_form_submit().
42
 */
35 43
function file_entity_generate_file_form_submit(&$form, &$form_state) {
36 44
  $file_types = array_values(array_filter($form_state['values']['file_types']));
37 45
  $batch = file_entity_generate_file_batch_info($form_state['values']['count'], $file_types, $form_state['values']['delete']);
38 46
  batch_set($batch);
39 47
}
40 48

  
49
/**
50
 * Implements hook_batch_info().
51
 */
41 52
function file_entity_generate_file_batch_info($count, array $file_types = array(), $delete = FALSE) {
42 53
  if (empty($file_types)) {
43 54
    $file_types = array_keys(file_entity_type_get_names());
......
56 67
  );
57 68
}
58 69

  
70
/**
71
 * Implements hook_batch_delete().
72
 */
59 73
function file_entity_generate_file_batch_delete(array $file_types, array &$context) {
60 74
  if (empty($context['sandbox'])) {
61 75
    $context['sandbox'] = array();
......
80 94
  }
81 95
}
82 96

  
97
/**
98
 * Implements hook_generate_file_batch_generate() using Devel generate api.
99
 */
83 100
function file_entity_generate_file_batch_generate(array $file_types, $num, array &$context) {
84 101
  if (empty($context['sandbox'])) {
85 102
    module_load_include('inc', 'devel_generate');
......
114 131
  }
115 132
}
116 133

  
134
/**
135
 * When the batch is finished set a status message.
136
 */
117 137
function file_entity_generate_file_batch_finished($success, $results, $operations) {
118 138
  if ($success) {
119 139
    drupal_set_message(format_plural(count($results), 'One file created.', '@count files created.'));
......
126 146
  }
127 147
}
128 148

  
149
/**
150
 * Generate file function for file_entity.
151
 */
129 152
function file_entity_generate_file($file_type) {
130 153
  $type = file_type_load($file_type);
131 154
  $possible_extensions = file_type_get_valid_extensions($type);
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-07-04
36
version = "7.x-2.3"
35
; Information added by Drupal.org packaging script on 2017-08-10
36
version = "7.x-2.4"
37 37
core = "7.x"
38 38
project = "file_entity"
39
datestamp = "1499174351"
39
datestamp = "1502334549"
40 40

  
drupal7/sites/all/modules/file_entity/file_entity.module
2643 2643
  }
2644 2644
}
2645 2645

  
2646
/**
2647
 * Implements hook_FORM_ID_alter().
2648
 */
2649
function file_entity_form_system_performance_settings_alter(&$form, &$form_state) {
2650
  $form['bandwidth_optimization']['file_entity_total_count_optimization'] = array(
2651
    '#type' => 'checkbox',
2652
    '#title' => t('Optimize the calculation of the total usage count of files in the files overview.'),
2653
    '#default_value' => variable_get('file_entity_total_count_optimization', FALSE),
2654
    '#description' => t('Recommended if the files admin page loads too slowly due to a high number of files.'),
2655
  );
2656
}
drupal7/sites/all/modules/file_entity/file_entity.pages.inc
827 827
    $replacement = $form_state['values']['replace_upload'];
828 828
    // Move file from temp to permanent home.
829 829
    if (pathinfo($replacement->uri, PATHINFO_EXTENSION) == pathinfo($file->uri, PATHINFO_EXTENSION)) {
830
        file_unmanaged_copy($replacement->uri, $file->uri, FILE_EXISTS_REPLACE);
830
      if ($new_file_uri = file_unmanaged_copy($replacement->uri, $file->uri, FILE_EXISTS_REPLACE)) {
831
        // Remove temporary file.
832
        file_delete($replacement);
833
      }
831 834
    } else {
832 835
      $destination_uri = rtrim($file->uri, drupal_basename($file->uri)) . drupal_basename($replacement->uri);
833 836
      $replace_mode = $destination_uri == $file->uri ? FILE_EXISTS_REPLACE : FILE_EXISTS_RENAME;
......
839 842

  
840 843
        // Update if the uri target has changed.
841 844
        if ($new_file_uri != $file->uri) {
842
         // Store the original file uri to delete if save is successful.
843
         $orphaned_uri = $file->uri;
845
          // Store the original file uri to delete if save is successful.
846
          $orphaned_uri = $file->uri;
844 847

  
845 848
          // Update file entity uri.
846 849
          $file->uri = $new_file_uri;
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-07-04
9
version = "7.x-2.3"
8
; Information added by Drupal.org packaging script on 2017-08-10
9
version = "7.x-2.4"
10 10
core = "7.x"
11 11
project = "file_entity"
12
datestamp = "1499174351"
12
datestamp = "1502334549"
13 13

  
drupal7/sites/all/modules/media_youtube/includes/MediaInternetYouTubeHandler.inc
14 14

  
15 15
  public function parse($embedCode) {
16 16
    $list_patterns = array(
17
      '@youtube\.com/playlist[#\?].*?list=([^"\& ]+)@i',
18
      '@youtube\.com/view_play_list[#\?].*?p=([^"\& ]+)@i',
17
      '@youtube\.com/playlist[#\?].*?list=([^"#\& ]+)@i',
18
      '@youtube\.com/view_play_list[#\?].*?p=([^"#\& ]+)@i',
19 19
    );
20 20

  
21 21
    foreach ($list_patterns as $pattern) {
......
32 32
    // http://youtu.be/*
33 33
    // http://gdata.youtube.com/feeds/api/videos/*
34 34
    $patterns = array(
35
      '@youtube\.com/watch[#\?].*?v=([^"\& ]+).*&list=([^"\& ]+)@i',
36
      '@youtu\.be/([^"\&\? ]+)\?list=([^"\& ]+)@i',
37
      '@youtube\.com/embed/([^"\&\? ]+)\?list=([^"\& ]+)@i',
38
      '@youtube\.com/watch[#\?].*?v=([^"\& ]+)@i',
39
      '@youtube\.com/embed/([^"\&\? ]+)@i',
40
      '@youtube\.com/v/([^"\&\? ]+)@i',
41
      '@youtube\.com/\?v=([^"\& ]+)@i',
42
      '@youtu\.be/([^"\&\? ]+)@i',
43
      '@gdata\.youtube\.com/feeds/api/videos/([^"\&\? ]+)@i',
35
      '@youtube\.com/watch[#\?].*?v=([^"#\& ]+).*&list=([^"#\& ]+)@i',
36
      '@youtu\.be/([^"#\&\? ]+)\?list=([^"#\& ]+)@i',
37
      '@youtube\.com/embed/([^"#\&\? ]+)\?list=([^"#\& ]+)@i',
38
      '@youtube\.com/watch[#\?].*?v=([^"#\& ]+)@i',
39
      '@youtube\.com/embed/([^"#\&\? ]+)@i',
40
      '@youtube\.com/v/([^"#\&\? ]+)@i',
41
      '@youtube\.com/\?v=([^"#\& ]+)@i',
42
      '@youtu\.be/([^"#\&\? ]+)@i',
43
      '@gdata\.youtube\.com/feeds/api/videos/([^"#\&\? ]+)@i',
44 44
    );
45 45

  
46 46
    foreach ($patterns as $pattern) {
......
51 51
        $uri = 'youtube://v/' . $matches[1][0];
52 52
        if (isset($matches[2][0]) && $this->validId($matches[2][0], 'l')) {
53 53
          $uri .= '/l/' . $matches[2][0];
54
         }
54
        }
55 55
        return file_stream_wrapper_uri_normalize($uri);
56 56
      }
57 57
    }
drupal7/sites/all/modules/media_youtube/includes/MediaYouTubeStreamWrapper.inc
10 10
 *  $youtube = new MediaYouTubeStreamWrapper('youtube://v/[video-code]');
11 11
 */
12 12
class MediaYouTubeStreamWrapper extends MediaReadOnlyStreamWrapper {
13
  protected $base_url = 'http://www.youtube.com/watch';
13
  protected $base_url = 'https://www.youtube.com/watch';
14 14

  
15 15
  static function getMimeType($uri, $mapping = NULL) {
16 16
    return 'video/youtube';
......
18 18

  
19 19
  function getOriginalThumbnailPath() {
20 20
    $parts = $this->get_parameters();
21
    $thumbnail_url = 'http://img.youtube.com/vi/' . check_plain($parts['v']) . "/maxresdefault.jpg";
21
    $thumbnail_url = 'https://img.youtube.com/vi/' . check_plain($parts['v']) . "/maxresdefault.jpg";
22 22
    $response = drupal_http_request($thumbnail_url);
23
    if ($response->code == 404) {
24
      $thumbnail_url = 'https://img.youtube.com/vi/' . check_plain($parts['v']) . "/hqdefault.jpg";
25
      $response = drupal_http_request($thumbnail_url);
26
    }
23 27
    if (!isset($response->error)) {
24 28
      return $thumbnail_url;
25 29
    }
......
27 31
      throw new MediaInternetValidationException("Embedding has been disabled for this video.");
28 32
    }
29 33
    elseif ($response->code == 404) {
30
      return "http://s.ytimg.com/yts/img/image-hh-404-vflvCykRp.png";
34
      return "https://s.ytimg.com/yts/img/image-hh-404-vflvCykRp.png";
31 35
    }
32 36
    elseif ($response->code != 200) {
33 37
      throw new MediaInternetValidationException("The YouTube video ID is invalid or the video was deleted.");
......
35 39
    else {
36 40
      $uri = file_stream_wrapper_uri_normalize('youtube://v/' . check_plain($parts['v']));
37 41
      $external_url = file_create_url($uri);
38
      $oembed_url = url('http://www.youtube.com/oembed', array('query' => array('url' => $external_url, 'format' => 'json')));
42
      $oembed_url = url('https://www.youtube.com/oembed', array('query' => array('url' => $external_url, 'format' => 'json')));
39 43
      $response = drupal_http_request($oembed_url);
40 44

  
41 45
      if (!isset($response->error)) {
......
65 69
          file_unmanaged_save_data($response->data, $local_path, TRUE);
66 70
        }
67 71
        else {
68
          @copy($this->getOriginalThumbnailPath(), $local_path);
72
          system_retrieve_file($this->getOriginalThumbnailPath(), $local_path, FALSE, FILE_EXISTS_REPLACE);
69 73
        }
70 74
      }
71 75
      catch (Exception $e) {
......
86 90
  function setBaseUrl($parameters) {
87 91
    if (isset($parameters['l'])) {
88 92
      if (!isset($parameters['v'])) {
89
        $this->base_url = 'http://youtube.com/playlist';
93
        $this->base_url = 'https://youtube.com/playlist';
90 94
      }
91 95
      $parameters['list'] = $parameters['l'];
92 96
      unset($parameters['l']);
drupal7/sites/all/modules/media_youtube/includes/media_youtube.formatters.inc
29 29
      'showinfo' => TRUE,
30 30
      'theme' => 'dark',
31 31
      'captions' => FALSE,
32
      'controls' => FALSE,
32 33
    ),
33 34
    'view callback' => 'media_youtube_file_formatter_video_view',
34 35
    'settings callback' => 'media_youtube_file_formatter_video_settings',
......
66 67
    // Fake a default for attributes so the ternary doesn't choke.
67 68
    $display['settings']['attributes'] = array();
68 69

  
69
    foreach (array('width', 'height', 'autohide', 'autoplay', 'color', 'enablejsapi', 'loop', 'modestbranding', 'nocookie', 'origin', 'protocol', 'protocol_specify', 'rel', 'showinfo', 'theme', 'attributes', 'captions') as $setting) {
70
    foreach (array('width', 'height', 'autohide', 'autoplay', 'color', 'enablejsapi', 'loop', 'modestbranding', 'nocookie', 'origin', 'protocol', 'protocol_specify', 'rel', 'showinfo', 'theme', 'attributes', 'captions','controls') as $setting) {
70 71
      $element['#options'][$setting] = isset($file->override[$setting]) ? $file->override[$setting] : $display['settings'][$setting];
71 72
    }
72 73

  
......
146 147
    '#type' => 'checkbox',
147 148
    '#default_value' => $settings['loop'],
148 149
  );
150
  $element['controls'] = array(
151
    '#title' => t('Show Controls'),
152
    '#type' => 'checkbox',
153
    '#default_value' => $settings['controls'],
154
  );
149 155

  
150 156
  // Note: make sure the positive/negative language lines up with option
151 157
  // processing in media_youtube.theme.inc.
drupal7/sites/all/modules/media_youtube/media_youtube.info
11 11
files[] = includes/MediaYouTubeStreamWrapper.inc
12 12
files[] = includes/MediaInternetYouTubeHandler.inc
13 13

  
14
; Information added by Drupal.org packaging script on 2017-06-09
15
version = "7.x-3.4"
14
; Information added by Drupal.org packaging script on 2017-08-14
15
version = "7.x-3.5"
16 16
core = "7.x"
17 17
project = "media_youtube"
18
datestamp = "1497020345"
18
datestamp = "1502719245"
19 19

  
drupal7/sites/all/modules/media_youtube/tests/media_youtube_test.info
8 8
files[] = includes/MediaYouTubeTestStreamWrapper.inc
9 9
files[] = includes/MediaYouTubeTestHandler.inc
10 10

  
11
; Information added by Drupal.org packaging script on 2017-06-09
12
version = "7.x-3.4"
11
; Information added by Drupal.org packaging script on 2017-08-14
12
version = "7.x-3.5"
13 13
core = "7.x"
14 14
project = "media_youtube"
15
datestamp = "1497020345"
15
datestamp = "1502719245"
16 16

  
drupal7/sites/all/modules/media_youtube/themes/media_youtube.theme.inc
12 12
function media_youtube_preprocess_media_youtube_video(&$variables) {
13 13
  // Build the URI.
14 14
  $wrapper = file_stream_wrapper_get_instance_by_uri($variables['uri']);
15
  $parts = $wrapper->get_parameters();
16
  if (isset($parts['v'])) {
17
    $variables['embed_type'] = 'video';
18
    $variables['video_id'] = check_plain($parts['v']);
19
    $embed_path = '/embed/' . $variables['video_id'];
15
  if ($wrapper instanceof MediaReadOnlyStreamWrapper) {
16
    $parts = $wrapper->get_parameters();
17
    if (isset($parts['v'])) {
18
      $variables['embed_type'] = 'video';
19
      $variables['video_id'] = check_plain($parts['v']);
20
      $embed_path = '/embed/' . $variables['video_id'];
21
    }
22
    elseif (isset($parts['l'])) {
23
      $variables['embed_type'] = 'playlist';
24
      $variables['video_id'] = check_plain($parts['l']);
25
      $embed_path = '/embed/videoseries';
26
    }
20 27
  }
21
  elseif (isset($parts['l'])) {
22
    $variables['embed_type'] = 'playlist';
23
    $variables['video_id'] = check_plain($parts['l']);
24
    $embed_path = '/embed/videoseries';
28
  else {
29
    // This happens when stream wrappers are not yet initialized. This is
30
    // normally only encountered when creating content during profile install
31
    // using drush make. At that point, video_id is irrelevant anyway.
32
    $variables['video_id'] = '';
25 33
  }
26 34

  
27 35
  // Checked existing function.
......
42 50
  // Make css z-index work with flash object. Must be the first parameter.
43 51
  $query['wmode'] = 'opaque';
44 52

  
53
  //YouTube video controls, on or off.
54
  if (isset($variables['options']['controls'])) {
55
    //on or off (TRUE/FALSE) depending on what is stored in $variables['options']['controls'].
56
    $query['controls'] = $variables['options']['controls'];
57
  } else {
58
    //on
59
    $query['controls'] = TRUE;
60
  }
45 61
  // These queries default to 0. If the option is true, set value to 1.
46 62
  foreach (array('autoplay', 'enablejsapi', 'loop', 'modestbranding') as $option) {
47 63
    if ($variables['options'][$option]) {
drupal7/sites/all/modules/views/includes/ajax.inc
40 40

  
41 41
    // Load the view.
42 42
    $view = views_get_view($name);
43
    if ($view && $view->access($display_id)) {
43
    if ($view && $view->access($display_id) && $view->set_display($display_id) && $view->display_handler->use_ajax()) {
44 44
      // Fix 'q' for paging.
45 45
      if (!empty($path)) {
46 46
        $_GET['q'] = $path;
drupal7/sites/all/modules/views/tests/views_ajax.test
1
<?php
2

  
3
/**
4
 * @file
5
 * Definition of ViewsAjaxTest.
6
 */
7

  
8
/**
9
 * Tests views ajax display.
10
 */
11
class ViewsAjaxTest extends ViewsSqlTest {
12
  public static function getInfo() {
13
    return array(
14
      'name' => 'Ajax',
15
      'description' => 'Test views with and without ajax enabled.',
16
      'group' => 'Views Handlers',
17
    );
18
  }
19

  
20
  public function setUp() {
21
    parent::setUp('views', 'views_test');
22
    // Create a second node.
23
    $this->drupalCreateNode(array('type' => 'article', 'status' => NODE_PUBLISHED));
24
  }
25

  
26
  /**
27
   * Perform a simple AJAX POST HTTP request.
28
   *
29
   * @param string $path
30
   *   Drupal path where the request should be POSTed.
31
   * @param string $accept
32
   *   The value for the "Accept" header. Usually either 'application/json' or
33
   *   'application/vnd.drupal-ajax'.
34
   * @param array $post
35
   *   The POST data. When making a 'application/vnd.drupal-ajax' request, the
36
   *   Ajax page state data should be included. Use getAjaxPageStatePostData()
37
   *   for that.
38
   *
39
   * @return
40
   *   The content returned from the call to curl_exec().
41
   */
42
  public function simpleAjaxPost($path, $accept, $post = array()) {
43
    $options['absolute'] = TRUE;
44
    foreach ($post as $key => $value) {
45
      // Encode according to application/x-www-form-urlencoded
46
      // Both names and values needs to be urlencoded, according to
47
      // http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1
48
      $post[$key] = urlencode($key) . '=' . urlencode($value);
49
    }
50
    $postfields = implode('&', $post);
51
    $headers = array(
52
      'Accept: ' . $accept,
53
      'Content-Type: application/x-www-form-urlencoded',
54
    );
55
    return $this->curlExec(array(
56
      CURLOPT_URL => url($path, $options),
57
      CURLOPT_POST => TRUE,
58
      CURLOPT_POSTFIELDS => $postfields,
59
      CURLOPT_HTTPHEADER => $headers,
60
    ));
61
  }
62

  
63
  /**
64
   * Tests an ajax and non-ajax view.
65
   */
66
  public function testAjaxView() {
67
    $this->drupalCreateNode();
68
    $this->drupalGet('test_ajax_view');
69
    $drupal_settings = $this->drupalGetSettings();
70
    $this->assertTrue(isset($drupal_settings['views']['ajax_path']), 'The Ajax callback path is set in drupalSettings.');
71
    $this->assertEqual(count($drupal_settings['views']['ajaxViews']), 1);
72
    $view_entry = current(array_keys($drupal_settings['views']['ajaxViews']));
73
    $this->assertEqual($drupal_settings['views']['ajaxViews'][$view_entry]['view_name'], 'test_ajax_view', 'The view\'s ajaxViews array entry has the correct \'view_name\' key.');
74
    $this->assertEqual($drupal_settings['views']['ajaxViews'][$view_entry]['view_display_id'], 'page_1', 'The view\'s ajaxViews array entry has the correct \'view_display_id\' key.');
75

  
76
    $post = [
77
      'view_name' => 'test_ajax_view',
78
      'view_display_id' => 'page_1',
79
    ];
80

  
81
    $response = $this->simpleAjaxPost('views/ajax', 'application/json', $post);
82
    $data = drupal_json_decode($response);
83

  
84
    $this->assertTrue(isset($data[0]['settings']['views']['ajaxViews']));
85

  
86
    // Ensure that the view insert command is part of the result.
87
    $this->assertEqual($data[1]['command'], 'insert');
88
    $this->assertTrue(strpos($data[1]['selector'], '.view-dom-id-') === 0);
89

  
90
    $this->drupalSetContent($data[1]['data']);
91
    $result = $this->xpath('//div[contains(@class, "views-row")]');
92
    $this->assertEqual(count($result), 2, 'Ensure that two items are rendered in the HTML.');
93

  
94
    $post = [
95
      'view_name' => 'test_noajax_view',
96
      'view_display_id' => 'default',
97
    ];
98

  
99
    $response = $this->simpleAjaxPost('views/ajax', 'application/json', $post);
100
    $data = drupal_json_decode($response);
101
    // In Drupal 7 we get an ajax response with no commands instead of a 403 if
102
    // the view cannot be accessed.
103
    foreach ($data as $item) {
104
      $this->assertIdentical('settings', $item['command']);
105
      $this->assertTrue(empty($item['data']));
106
    }
107
  }
108

  
109
}
drupal7/sites/all/modules/views/tests/views_test.info
5 5
dependencies[] = views
6 6
hidden = TRUE
7 7

  
8
; Information added by Drupal.org packaging script on 2017-04-02
9
version = "7.x-3.16"
8
; Information added by Drupal.org packaging script on 2017-08-16
9
version = "7.x-3.17"
10 10
core = "7.x"
11 11
project = "views"
12
datestamp = "1491158591"
12
datestamp = "1502903349"
13 13

  
drupal7/sites/all/modules/views/tests/views_test.views_default.inc
1

  
1 2
<?php
2 3

  
3 4
/**
......
274 275

  
275 276
  $views[$view->name] = $view;
276 277

  
278
  $view = new view();
279
  $view->name = 'test_ajax_view';
280
  $view->description = '';
281
  $view->tag = '';
282
  $view->base_table = 'node';
283
  $view->human_name = '';
284
  $view->core = 0;
285
  $view->api_version = '3.0';
286
  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
287

  
288
  /* Display: Master */
289
  $handler = $view->new_display('default', 'Master', 'default');
290
  $handler->display->display_options['use_ajax'] = TRUE;
291
  $handler->display->display_options['use_more_always'] = FALSE;
292
  $handler->display->display_options['access']['type'] = 'none';
293
  $handler->display->display_options['cache']['type'] = 'none';
294
  $handler->display->display_options['query']['type'] = 'views_query';
295
  $handler->display->display_options['exposed_form']['type'] = 'basic';
296
  $handler->display->display_options['pager']['type'] = 'none';
297
  $handler->display->display_options['style_plugin'] = 'default';
298
  $handler->display->display_options['row_plugin'] = 'node';
299

  
300
  /* Display: Page */
301
  $handler = $view->new_display('page', 'Page', 'page_1');
302
  $handler->display->display_options['path'] = 'test_ajax_view';
303

  
304
  $views[$view->name] = $view;
305

  
306
  $view = new view();
307
  $view->name = 'test_noajax_view';
308
  $view->description = '';
309
  $view->tag = '';
310
  $view->base_table = 'node';
311
  $view->human_name = '';
312
  $view->core = 0;
313
  $view->api_version = '3.0';
314
  $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
315

  
316
  /* Display: Master */
317
  $handler = $view->new_display('default', 'Master', 'default');
318
  $handler->display->display_options['use_ajax'] = FALSE;
319
  $handler->display->display_options['use_more_always'] = FALSE;
320
  $handler->display->display_options['access']['type'] = 'none';
321
  $handler->display->display_options['cache']['type'] = 'none';
322
  $handler->display->display_options['query']['type'] = 'views_query';
323
  $handler->display->display_options['exposed_form']['type'] = 'basic';
324
  $handler->display->display_options['pager']['type'] = 'none';
325
  $handler->display->display_options['style_plugin'] = 'default';
326
  $handler->display->display_options['row_plugin'] = 'node';
327

  
328
  $views[$view->name] = $view;
329

  
277 330
  return $views;
278 331
}
drupal7/sites/all/modules/views/views.info
301 301
files[] = tests/views_access.test
302 302
files[] = tests/views_analyze.test
303 303
files[] = tests/views_basic.test
304
files[] = tests/views_ajax.test
304 305
files[] = tests/views_argument_default.test
305 306
files[] = tests/views_argument_validator.test
306 307
files[] = tests/views_exposed_form.test
......
327 328
files[] = tests/views_view.test
328 329
files[] = tests/views_ui.test
329 330

  
330
; Information added by Drupal.org packaging script on 2017-04-02
331
version = "7.x-3.16"
331
; Information added by Drupal.org packaging script on 2017-08-16
332
version = "7.x-3.17"
332 333
core = "7.x"
333 334
project = "views"
334
datestamp = "1491158591"
335
datestamp = "1502903349"
335 336

  
drupal7/sites/all/modules/views/views_ui.info
7 7
files[] = views_ui.module
8 8
files[] = plugins/views_wizard/views_ui_base_views_wizard.class.php
9 9

  
10
; Information added by Drupal.org packaging script on 2017-04-02
11
version = "7.x-3.16"
10
; Information added by Drupal.org packaging script on 2017-08-16
11
version = "7.x-3.17"
12 12
core = "7.x"
13 13
project = "views"
14
datestamp = "1491158591"
14
datestamp = "1502903349"
15 15

  

Formats disponibles : Unified diff