Projet

Général

Profil

Révision fc3d89c3

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

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/i18n/i18n.info
8 8
files[] = i18n.test
9 9
configure = admin/config/regional/i18n
10 10

  
11
; Information added by Drupal.org packaging script on 2015-05-07
12
version = "7.x-1.13"
11
; Information added by Drupal.org packaging script on 2016-10-22
12
version = "7.x-1.14"
13 13
core = "7.x"
14 14
project = "i18n"
15
datestamp = "1430999922"
15
datestamp = "1477154943"
16 16

  
drupal7/sites/all/modules/i18n/i18n.test
11 11

  
12 12
  function setUpLanguages($admin_permissions = array()) {
13 13
    // Setup admin user.
14
    $this->admin_user = $this->drupalCreateUser(array_merge(array('bypass node access', 'administer nodes', 'administer languages', 'administer content types', 'administer blocks', 'access administration pages', 'translate interface'), $admin_permissions));
14
    $this->admin_user = $this->drupalCreateUser(array_merge(array('bypass node access', 'administer nodes', 'administer languages', 'administer content types', 'administer fields', 'administer blocks', 'access administration pages', 'translate interface'), $admin_permissions));
15 15

  
16 16
    $this->drupalLogin($this->admin_user);
17 17

  
drupal7/sites/all/modules/i18n/i18n_block/i18n_block.info
8 8
files[] = i18n_block.test
9 9

  
10 10

  
11
; Information added by Drupal.org packaging script on 2015-05-07
12
version = "7.x-1.13"
11
; Information added by Drupal.org packaging script on 2016-10-22
12
version = "7.x-1.14"
13 13
core = "7.x"
14 14
project = "i18n"
15
datestamp = "1430999922"
15
datestamp = "1477154943"
16 16

  
drupal7/sites/all/modules/i18n/i18n_contact/i18n_contact.info
5 5
package = Multilingual - Internationalization
6 6
core = 7.x
7 7

  
8
; Information added by Drupal.org packaging script on 2015-05-07
9
version = "7.x-1.13"
8
; Information added by Drupal.org packaging script on 2016-10-22
9
version = "7.x-1.14"
10 10
core = "7.x"
11 11
project = "i18n"
12
datestamp = "1430999922"
12
datestamp = "1477154943"
13 13

  
drupal7/sites/all/modules/i18n/i18n_field/i18n_field.info
6 6
core = 7.x
7 7
files[] = i18n_field.inc
8 8
files[] = i18n_field.test
9
; Information added by Drupal.org packaging script on 2015-05-07
10
version = "7.x-1.13"
9
; Information added by Drupal.org packaging script on 2016-10-22
10
version = "7.x-1.14"
11 11
core = "7.x"
12 12
project = "i18n"
13
datestamp = "1430999922"
13
datestamp = "1477154943"
14 14

  
drupal7/sites/all/modules/i18n/i18n_forum/i18n_forum.info
7 7
core = 7.x
8 8
files[] = i18n_forum.test
9 9

  
10
; Information added by Drupal.org packaging script on 2015-05-07
11
version = "7.x-1.13"
10
; Information added by Drupal.org packaging script on 2016-10-22
11
version = "7.x-1.14"
12 12
core = "7.x"
13 13
project = "i18n"
14
datestamp = "1430999922"
14
datestamp = "1477154943"
15 15

  
drupal7/sites/all/modules/i18n/i18n_menu/i18n_menu.info
10 10
files[] = i18n_menu.inc
11 11
files[] = i18n_menu.test
12 12

  
13
; Information added by Drupal.org packaging script on 2015-05-07
14
version = "7.x-1.13"
13
; Information added by Drupal.org packaging script on 2016-10-22
14
version = "7.x-1.14"
15 15
core = "7.x"
16 16
project = "i18n"
17
datestamp = "1430999922"
17
datestamp = "1477154943"
18 18

  
drupal7/sites/all/modules/i18n/i18n_menu/i18n_menu.module
180 180
  // We just make sure every link has a valid language property.
181 181
  if (!i18n_object_langcode($item)) {
182 182
    $item['language'] = LANGUAGE_NONE;
183
    $item['i18n_tsid'] = 0;
183 184
  }
184 185
}
185 186

  
......
515 516
 * Check whether this link is to be processed by i18n_menu and start processing.
516 517
 */
517 518
function _i18n_menu_link_process(&$link) {
518
  // Only visible links that have a language property and haven't been processed
519
  // before. We also check that they belong to a menu with language options.
520
  if (empty($link['i18n_menu']) && !empty($link['language']) && !empty($link['access']) && empty($link['hidden']) && i18n_menu_mode($link['menu_name'])) {
519
  // Only links that have a language property and haven't been processed before.
520
  // We also translate links marked as hidden because core breadcrumbs ignore
521
  // that flag and excluding them would basically interfere with core behaviour.
522
  // We also check that they belong to a menu with language options.
523
  if (empty($link['i18n_menu']) && !empty($link['language']) && !empty($link['access']) && i18n_menu_mode($link['menu_name'])) {
521 524
    // Mark so it won't be processed twice.
522 525
    $link['i18n_menu'] = TRUE;
523 526
    // Skip if administering this menu or this menu item.
drupal7/sites/all/modules/i18n/i18n_node/i18n_node.info
9 9
files[]=i18n_node.test
10 10
files[]=i18n_node.variable.inc
11 11

  
12
; Information added by Drupal.org packaging script on 2015-05-07
13
version = "7.x-1.13"
12
; Information added by Drupal.org packaging script on 2016-10-22
13
version = "7.x-1.14"
14 14
core = "7.x"
15 15
project = "i18n"
16
datestamp = "1430999922"
16
datestamp = "1477154943"
17 17

  
drupal7/sites/all/modules/i18n/i18n_path/i18n_path.info
6 6

  
7 7
files[] = i18n_path.inc
8 8
files[] = i18n_path.test
9
; Information added by Drupal.org packaging script on 2015-05-07
10
version = "7.x-1.13"
9
; Information added by Drupal.org packaging script on 2016-10-22
10
version = "7.x-1.14"
11 11
core = "7.x"
12 12
project = "i18n"
13
datestamp = "1430999922"
13
datestamp = "1477154943"
14 14

  
drupal7/sites/all/modules/i18n/i18n_redirect/i18n_redirect.info
4 4
package = Multilingual - Internationalization
5 5
core = 7.x
6 6

  
7
; Information added by Drupal.org packaging script on 2015-05-07
8
version = "7.x-1.13"
7
; Information added by Drupal.org packaging script on 2016-10-22
8
version = "7.x-1.14"
9 9
core = "7.x"
10 10
project = "i18n"
11
datestamp = "1430999922"
11
datestamp = "1477154943"
12 12

  
drupal7/sites/all/modules/i18n/i18n_select/i18n_select.info
6 6
configure = admin/config/regional/i18n/select
7 7
files[] = i18n_select.test
8 8

  
9
; Information added by Drupal.org packaging script on 2015-05-07
10
version = "7.x-1.13"
9
; Information added by Drupal.org packaging script on 2016-10-22
10
version = "7.x-1.14"
11 11
core = "7.x"
12 12
project = "i18n"
13
datestamp = "1430999922"
13
datestamp = "1477154943"
14 14

  
drupal7/sites/all/modules/i18n/i18n_select/i18n_select.module
82 82
}
83 83

  
84 84
/**
85
 * Check current path to enable selection
85
 * Check current path to enable selection.
86 86
 *
87
 * This works pretty much like block visibility
87
 * This works pretty much like block visibility.
88 88
 *
89
 * @return boolean
89
 * @return bool
90 90
 *   TRUE if content selection should be enabled for this page.
91 91
 */
92 92
function i18n_select_page() {
......
100 100
      // with different case. Ex: /Page, /page, /PAGE.
101 101
      $pages = drupal_strtolower($pages);
102 102
      if ($visibility < I18N_SELECT_PAGE_PHP) {
103
        // Convert the Drupal path to lowercase
104
        $path = drupal_strtolower(drupal_get_path_alias($_GET['q']));
103
        // @see views_ajax()
104
        // @see I18NSelectAdminViewsAjax::testViewsAjaxWithoutSkippingTags()
105
        $path = isset($_REQUEST['view_path']) ? $_REQUEST['view_path'] : $_GET['q'];
106
        // Convert the Drupal path to lowercase.
107
        $path = drupal_strtolower(drupal_get_path_alias($path));
105 108
        // Compare the lowercase internal and lowercase path alias (if any).
106 109
        $page_match = drupal_match_path($path, $pages);
107 110
        if ($path != $_GET['q']) {
......
109 112
        }
110 113
        // When $visibility has a value of 0 (I18N_SELECT_PAGE_NOTLISTED),
111 114
        // the block is displayed on all pages except those listed in $pages.
112
        // When set to 1 (I18N_SELECT_PAGE_LISTED), it is displayed only on those
113
        // pages listed in $pages.
115
        // When set to 1 (I18N_SELECT_PAGE_LISTED), it is displayed only on
116
        // those pages listed in $pages.
114 117
        $mode = !($visibility xor $page_match);
115 118
      }
116 119
      elseif (module_exists('php')) {
......
121 124
      }
122 125
    }
123 126
    else {
124
      // No pages defined, still respect the setting (unlike blocks)
127
      // No pages defined, still respect the setting (unlike blocks).
125 128
      $mode = $visibility == I18N_SELECT_PAGE_NOTLISTED;
126 129
    }
127 130
  }
drupal7/sites/all/modules/i18n/i18n_select/i18n_select.test
84 84
    }
85 85
  }
86 86
}
87

  
88
/**
89
 * Test case for AJAX queries on "views/ajax" when view on admin page.
90
 */
91
class I18NSelectAdminViewsAjax extends Drupali18nTestCase {
92

  
93
  /**
94
   * {@inheritdoc}
95
   */
96
  public static function getInfo() {
97
    return array(
98
      'name' => t('I18N select Admin Views (AJAX)'),
99
      'group' => 'Internationalization',
100
      'description' => t('Test AJAX requests to the "views/ajax" when view located on "admin/*" and list of skipping tags is empty.'),
101
      // Skip this test when "admin_views" module does not exists.
102
      'dependencies' => array('admin_views'),
103
    );
104
  }
105

  
106
  /**
107
   * {@inheritdoc}
108
   */
109
  protected function setUp() {
110
    parent::setUp('translation', 'i18n_variable', 'i18n_select', 'admin_views');
111
    parent::setUpLanguages(array('access content overview'));
112
    parent::setUpContentTranslation();
113
  }
114

  
115
  /**
116
   * Test AJAX of a view without skipping tags for selection.
117
   *
118
   * @see i18n_select_page()
119
   */
120
  public function testViewsAjaxWithoutSkippingTags() {
121
    // If this variable will have the "views" value then this test will not
122
    // have sense. For instance, we want apply language selection filter
123
    // for views and remove "views" from "i18n_select_skip_tags" variable.
124
    // In this case all AJAX for views, on administration part of the site,
125
    // will be broken because the "i18n_select_page()" function will work
126
    // with "views/ajax" path instead of, for example, "admin/content".
127
    variable_set('i18n_select_skip_tags', '');
128

  
129
    // Create one hundred of nodes.
130
    for ($i = 1; $i <= 100; $i++) {
131
      // Create every second node on Spanish language and
132
      // every first - on English.
133
      $node = $this->createNode('page', "Node $i", '', $i % 2 ? $this->default_language : $this->secondary_language);
134

  
135
      // Update "changed" in order to sort the content by updating date. In
136
      // other case all nodes will be with the same date and not arranged in
137
      // order.
138
      db_update('node')
139
        ->fields(array('changed' => strtotime("+ $i minute")))
140
        ->condition('nid', $node->nid)
141
        ->execute();
142
    }
143

  
144
    $this->drupalGet('admin/content');
145

  
146
    // Check that latest node exists at the top.
147
    $this->assertText('Node 100');
148
    // Check that our page contains fifty nodes (the latest must be 51).
149
    $this->assertNoText('Node 50');
150

  
151
    // Test $_REQUEST['view_path']. There's no form to submit to, so
152
    // drupalPost() won't work here. This just tests a direct $_POST
153
    // request instead.
154
    $this->curlExec(array(
155
      CURLOPT_URL => $this->getAbsoluteUrl('views/ajax'),
156
      CURLOPT_POST => TRUE,
157
      CURLOPT_POSTFIELDS => http_build_query(array(
158
        'page' => 1,
159
        'view_path' => 'admin/content',
160
        'view_name' => 'admin_views_node',
161
        'view_display_id' => 'system_1',
162
      )),
163
    ));
164

  
165
    // Check that we are successfully switched to a new page of content.
166
    $this->assertText('Node 50');
167
    $this->assertNoText('Node 100');
168
  }
169

  
170
}
drupal7/sites/all/modules/i18n/i18n_string/i18n_string.info
10 10
files[] = i18n_string.test
11 11
configure = admin/config/regional/i18n/strings
12 12

  
13
; Information added by Drupal.org packaging script on 2015-05-07
14
version = "7.x-1.13"
13
; Information added by Drupal.org packaging script on 2016-10-22
14
version = "7.x-1.14"
15 15
core = "7.x"
16 16
project = "i18n"
17
datestamp = "1430999922"
17
datestamp = "1477154943"
18 18

  
drupal7/sites/all/modules/i18n/i18n_sync/i18n_sync.info
10 10
files[] = i18n_sync.module.inc
11 11
files[] = i18n_sync.node.inc
12 12
files[] = i18n_sync.test
13
; Information added by Drupal.org packaging script on 2015-05-07
14
version = "7.x-1.13"
13
; Information added by Drupal.org packaging script on 2016-10-22
14
version = "7.x-1.14"
15 15
core = "7.x"
16 16
project = "i18n"
17
datestamp = "1430999922"
17
datestamp = "1477154943"
18 18

  
drupal7/sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.info
11 11
files[] = i18n_taxonomy.admin.inc
12 12
files[] = i18n_taxonomy.test
13 13

  
14
; Information added by Drupal.org packaging script on 2015-05-07
15
version = "7.x-1.13"
14
; Information added by Drupal.org packaging script on 2016-10-22
15
version = "7.x-1.14"
16 16
core = "7.x"
17 17
project = "i18n"
18
datestamp = "1430999922"
18
datestamp = "1477154943"
19 19

  
drupal7/sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.module
213 213
          );
214 214
        }
215 215
        else {
216
          $term = $item['taxonomy_term'];
216
          if (isset($item['taxonomy_term'])) {
217
            $term = $item['taxonomy_term'];
218
          }
219
          else {
220
            $term = taxonomy_term_load($item['tid']);
221
          }
217 222
          $uri = entity_uri('taxonomy_term', $term);
218 223
          $element[$delta] = array(
219 224
            '#type' => 'link',
......
1020 1025
  if (!i18n_string_translate_langcode()) {
1021 1026
    return $terms;
1022 1027
  }
1028
  // $terms is not a valid array or term.
1029
  if (empty($terms)) {
1030
    return $terms;
1031
  }
1023 1032
  $object_info = i18n_object_info('taxonomy_term');
1024 1033
  $list = is_array($terms) ? $terms : array($terms);
1025 1034
  foreach ($list as $index => $term) {
drupal7/sites/all/modules/i18n/i18n_translation/i18n_translation.info
6 6

  
7 7
files[] = i18n_translation.inc
8 8

  
9
; Information added by Drupal.org packaging script on 2015-05-07
10
version = "7.x-1.13"
9
; Information added by Drupal.org packaging script on 2016-10-22
10
version = "7.x-1.14"
11 11
core = "7.x"
12 12
project = "i18n"
13
datestamp = "1430999922"
13
datestamp = "1477154943"
14 14

  
drupal7/sites/all/modules/i18n/i18n_user/i18n_user.info
4 4
package = Multilingual - Internationalization
5 5
dependencies[] = i18n_variable
6 6

  
7
; Information added by Drupal.org packaging script on 2015-05-07
8
version = "7.x-1.13"
7
; Information added by Drupal.org packaging script on 2016-10-22
8
version = "7.x-1.14"
9 9
core = "7.x"
10 10
project = "i18n"
11
datestamp = "1430999922"
11
datestamp = "1477154943"
12 12

  
drupal7/sites/all/modules/i18n/i18n_variable/i18n_variable.info
10 10
files[] = i18n_variable.class.inc
11 11
files[] = i18n_variable.test
12 12

  
13
; Information added by Drupal.org packaging script on 2015-05-07
14
version = "7.x-1.13"
13
; Information added by Drupal.org packaging script on 2016-10-22
14
version = "7.x-1.14"
15 15
core = "7.x"
16 16
project = "i18n"
17
datestamp = "1430999922"
17
datestamp = "1477154943"
18 18

  
drupal7/sites/all/modules/i18n/tests/i18n_test.info
7 7
core = 6.x
8 8
hidden = TRUE
9 9

  
10
; Information added by Drupal.org packaging script on 2015-05-07
11
version = "7.x-1.13"
10
; Information added by Drupal.org packaging script on 2016-10-22
11
version = "7.x-1.14"
12 12
core = "7.x"
13 13
project = "i18n"
14
datestamp = "1430999922"
14
datestamp = "1477154943"
15 15

  
drupal7/sites/all/modules/media/css/media.css
142 142
  margin-right: 10px;
143 143
  vertical-align: middle;
144 144
}
145

  
146
/* Exposed filter field */
147
/* Use similar look and feel of a disabled field */
148
.media-ajaxing-disabled {
149
  background-color: #EBEBE4;
150
}
drupal7/sites/all/modules/media/includes/media.fields.inc
100 100

  
101 101
  // Essentially we use the media type, extended with some enhancements.
102 102
  $element_info = element_info('media');
103
  $multiselect = ($field['cardinality'] > 1 || $field['cardinality'] == FIELD_CARDINALITY_UNLIMITED);
104

  
103 105
  $element += array(
104 106
    '#type' => 'media',
105 107
    '#value_callback' => 'media_field_widget_value',
......
113 115
        'file_extensions' => isset($field_settings['file_extensions']) ? $field_settings['file_extensions'] : variable_get('file_entity_default_allowed_extensions', 'jpg jpeg gif png txt doc docx xls xlsx pdf ppt pptx pps ppsx odt ods odp mp3 mov mp4 m4a m4v mpeg avi ogg oga ogv weba webp webm'),
114 116
        'max_filesize' => isset($field_settings['max_filesize']) ? $field_settings['max_filesize'] : 0,
115 117
        'uri_scheme' => !empty($field['settings']['uri_scheme']) ? $field['settings']['uri_scheme'] : file_default_scheme(),
118
        'multiselect' => $multiselect,
116 119
      ),
117 120
    ),
118 121
    // Allows this field to return an array instead of a single value.
......
277 280
 * wrapper around the entire group so it can be replaced all at once.
278 281
 */
279 282
function media_field_widget_process_multiple($element, &$form_state, $form) {
283
    // In order to support multiple selection, we need to reconstruct the _POST
284
  // data that is checked in media_attach_file(). We need to reconstruct the
285
  // field's _POST key name, for example: field_mediafield_und_0.
286
  $upload_name_prefix = implode('_', $element['#parents']) . '_';
287
  $upload_name = $upload_name_prefix . $element['#file_upload_delta'];
288
  if (!empty($_POST['media'][$upload_name])) {
289
    $files = explode(',', $_POST['media'][$upload_name]);
290
    $count = count($files);
291
    // Supposing #file_upload_delta is always the last delta this will work
292
    for ($i = 0; $i < $count; $i++) {
293
      // For each file selected, increment the field key to be processed.
294
      // field_mediafield_und_0 becomes field_mediafield_und_1, etc.
295
      $_POST['media'][$upload_name_prefix . ($element['#file_upload_delta'] + $i)] = $files[$i];
296
      $element[] = $element[$element['#file_upload_delta']];
297
    }
298
  }
299

  
280 300
  $element_children = element_children($element, TRUE);
281 301
  $count = count($element_children);
282 302

  
drupal7/sites/all/modules/media/js/media.js
91 91
      return;
92 92
    }
93 93

  
94
    // Grab the first of the selected media files.
95
    var mediaFile = mediaFiles[0];
94
    var mediaFileValue;
95
    // Process the value based on multiselect.
96
    if (mediaFiles.length > 1) {
97
      // Reverse array to have files in correct order
98
      mediaFiles.reverse();
99
      // Concatenate the array into a comma separated string.
100
      mediaFileValue = mediaFiles.map(function(file) {
101
        return file.fid;
102
      }).join(',');
103
    }
104
    else {
105
      // Grab the first of the selected media files.
106
      mediaFileValue = mediaFiles[0].fid;
107

  
108
      // Display a preview of the file using the selected media file's display.
109
      previewField.html(mediaFileValue.preview);
110
    }
96 111

  
97 112
    // Set the value of the hidden file ID field and trigger a change.
98
    uploadField.val(mediaFile.fid);
113
    uploadField.val(mediaFileValue);
99 114
    uploadField.trigger('change');
100 115

  
101 116
    // Find the attach button and automatically trigger it.
102 117
    var attachButton = uploadField.siblings('.attach');
103 118
    attachButton.trigger('mousedown');
104

  
105
    // Display a preview of the file using the selected media file's display.
106
    previewField.html(mediaFile.preview);
107 119
  }, configuration);
108 120

  
109 121
  return false;
drupal7/sites/all/modules/media/js/plugins/media.views.js
25 25
      return false;
26 26
    });
27 27

  
28
    // Return focus to the correct part of the form.
29
    $('.ctools-auto-submit-full-form .ctools-auto-submit-click', context).click(function () {
30
      settings.lastFocus = document.activeElement.id;
31

  
32
      // Add custom class to allow customize look and feel of the field while processing ajax
33
      // This way user can have a better user expierence using the exposed filters
34
      $(document.activeElement).addClass('media-ajaxing-disabled');
35
      // Remove focus to the active element
36
      $(document.activeElement).blur();
37

  
38
      // Before go with ajax, suppress key events
39
      $('body').bind('keydown keyup', suppressKeyEvents);
40
    });
41
    if (settings.lastFocus) {
42
      // Note, we just use each() so we can declare variables in a new scope.
43
      $('#' + settings.lastFocus, context).each(function () {
44
        var $this = $(this),
45
            val = $this.val();
46

  
47
        $this.focus();
48

  
49
        // Clear and reset the value to put the cursor at the end.
50
        $this.val('');
51
        $this.val(val);
52

  
53
        // After input recover focus, remove suppression of key events
54
        $('body').unbind('keydown keyup', suppressKeyEvents);
55
      });
56
    }
57

  
28 58
    // We loop through the views listed in Drupal.settings.media.browser.views
29 59
    // and set them up individually.
30 60
    var views_ids = [];
......
170 200
  $(view).addClass('media-browser-views-processed');
171 201
}
172 202

  
203
/**
204
 * Helper callback to supress propagation and default behaviour of an event
205
 *
206
 * This function is used in this way to make private and accesible only for the current scope
207
 */
208
var suppressKeyEvents = function(e) {
209
  e.stopImmediatePropagation();
210
  e.preventDefault();
211
}
212

  
173 213
}(jQuery));
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 2016-05-31
28
version = "7.x-2.0-beta2"
27
; Information added by Drupal.org packaging script on 2016-10-25
28
version = "7.x-2.0-beta3"
29 29
core = "7.x"
30 30
project = "media"
31
datestamp = "1464653492"
31
datestamp = "1477422289"
32 32

  
drupal7/sites/all/modules/media/media.install
29 29
 */
30 30
function _media_install_copy_icons() {
31 31
  $destination = variable_get('media_icon_base_directory', 'public://media-icons') . '/' . variable_get('media_icon_set', 'default');
32
  if (!file_prepare_directory($destination, FILE_CREATE_DIRECTORY)) {
32
  if (!file_prepare_directory($destination, FILE_MODIFY_PERMISSIONS || FILE_CREATE_DIRECTORY)) {
33 33
    throw new Exception("Unable to create directory $destination.");
34 34
  }
35 35
  // @todo If we ever add another default icon set, this should copy all images from one directory up.
drupal7/sites/all/modules/media/media.module
1162 1162

  
1163 1163
  // Load alt and title text from fields.
1164 1164
  if (!empty($alt)) {
1165
    $file->alt = token_replace($alt, array('file' => $file), $replace_options);
1165
    $file->alt = decode_entities(token_replace($alt, array('file' => $file), $replace_options));
1166 1166
  }
1167 1167
  if (!empty($title)) {
1168
    $file->title = token_replace($title, array('file' => $file), $replace_options);
1168
    $file->title = decode_entities(token_replace($title, array('file' => $file), $replace_options));
1169 1169
  }
1170 1170
}
1171 1171

  
drupal7/sites/all/modules/media/media.views.inc
78 78
  $view_mode = isset($params['view_mode']) ? $params['view_mode'] : 'preview';
79 79

  
80 80
  foreach ($vars['rows'] as $index => $row) {
81

  
82
    // If the view result is cached, then the result may include fids that no
83
    // longer exist.
84
    if (!isset($files[$row->fid])) {
85
      unset($vars['rows'][$index]);
86
      continue;
87
    }
88

  
81 89
    $file = $files[$row->fid];
82 90
    // Add url/preview to the file object.
83 91
    media_browser_build_media_item($file, $view_mode);
drupal7/sites/all/modules/media/modules/media_bulk_upload/media_bulk_upload.info
13 13
files[] = includes/MediaBrowserBulkUpload.inc
14 14
files[] = tests/media_bulk_upload.test
15 15

  
16
; Information added by Drupal.org packaging script on 2016-05-31
17
version = "7.x-2.0-beta2"
16
; Information added by Drupal.org packaging script on 2016-10-25
17
version = "7.x-2.0-beta3"
18 18
core = "7.x"
19 19
project = "media"
20
datestamp = "1464653492"
20
datestamp = "1477422289"
21 21

  
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 2016-05-31
16
version = "7.x-2.0-beta2"
15
; Information added by Drupal.org packaging script on 2016-10-25
16
version = "7.x-2.0-beta3"
17 17
core = "7.x"
18 18
project = "media"
19
datestamp = "1464653492"
19
datestamp = "1477422289"
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 2016-05-31
11
version = "7.x-2.0-beta2"
10
; Information added by Drupal.org packaging script on 2016-10-25
11
version = "7.x-2.0-beta3"
12 12
core = "7.x"
13 13
project = "media"
14
datestamp = "1464653492"
14
datestamp = "1477422289"
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 2016-05-31
12
version = "7.x-2.0-beta2"
11
; Information added by Drupal.org packaging script on 2016-10-25
12
version = "7.x-2.0-beta3"
13 13
core = "7.x"
14 14
project = "media"
15
datestamp = "1464653492"
15
datestamp = "1477422289"
16 16

  
drupal7/sites/all/modules/media/modules/media_wysiwyg/includes/media_wysiwyg.filter.inc
12 12
 *
13 13
 * @TODO check for security probably pass text through filter_xss
14 14
 */
15
function media_wysiwyg_filter($text) {
16
  $text = preg_replace_callback(MEDIA_WYSIWYG_TOKEN_REGEX, 'media_wysiwyg_token_to_markup', $text);
17
  return $text;
15
function media_wysiwyg_filter($text, $filter, $format, $langcode, $cache, $cache_id) {
16
  $replacements = array();
17
  $patterns = array();
18
  $rendered_text = $text;
19
  $count = 1;
20
  preg_match_all(MEDIA_WYSIWYG_TOKEN_REGEX, $text, $matches);
21
  if (!empty($matches[0])) {
22
    foreach ($matches[0] as $match) {
23
      $replacement = media_wysiwyg_token_to_markup(array($match), FALSE, $langcode);
24
      $rendered_text = str_replace($match, $replacement, $rendered_text, $count);
25
    }
26
  }
27
  return $rendered_text;
18 28
}
19 29

  
20 30
/**
......
55 65
 * @see media_wysiwyg_get_file_without_label()
56 66
 * @see hook_media_wysiwyg_token_to_markup_alter()
57 67
 */
58
function media_wysiwyg_token_to_markup($match, $wysiwyg = FALSE) {
68
function media_wysiwyg_token_to_markup($match, $wysiwyg = FALSE, $langcode = NULL) {
59 69
  static $recursion_stop;
60 70
  $settings = array();
61 71
  $match = str_replace("[[", "", $match);
......
156 166
          }
157 167
        }
158 168
      }
169
      foreach (array('title', 'alt') as $field_type) {
170
        if (isset($settings['attributes'][$field_type])) {
171
          $settings['attributes'][$field_type] = decode_entities($settings['attributes'][$field_type]);
172
        }
173
      }
159 174
    }
160 175
  }
161 176
  catch (Exception $e) {
......
180 195
    // that an inline macro can be generated when the WYSIWYG is detached.
181 196
    // The WYSIWYG plugin is expecting this information in the
182 197
    // Drupal.settings.mediaDataMap variable.
183
    $element = media_wysiwyg_get_file_without_label($file, $tag_info['view_mode'], $settings);
198
    $element = media_wysiwyg_get_file_without_label($file, $tag_info['view_mode'], $settings, $langcode);
184 199
    $data = array(
185 200
      'type' => 'media',
186 201
      'fid'  => $file->fid,
......
199 214
    if (variable_get('media_wysiwyg_default_render', 'file_entity') == 'file_entity') {
200 215
      $element['content'] = file_view($file, $tag_info['view_mode']);
201 216
    }
202
    $element['content']['file'] = media_wysiwyg_get_file_without_label($file, $tag_info['view_mode'], $settings);
217
    $element['content']['file'] = media_wysiwyg_get_file_without_label($file, $tag_info['view_mode'], $settings, $langcode);
203 218
    // Overwrite or set the file #alt attribute if it has been set in this
204 219
    // instance.
205 220
    if (!empty($element['content']['file']['#attributes']['alt'])) {
......
212 227
    }
213 228
    // For sites using the legacy field_attach rendering method, attach fields.
214 229
    if (variable_get('media_wysiwyg_default_render', 'file_entity') == 'field_attach') {
215
      field_attach_prepare_view('file', array($file->fid => $file), $tag_info['view_mode']);
216
      entity_prepare_view('file', array($file->fid => $file));
217
      $element['content'] += field_attach_view('file', $file, $tag_info['view_mode']);
230
      field_attach_prepare_view('file', array($file->fid => $file), $tag_info['view_mode'], $langcode);
231
      entity_prepare_view('file', array($file->fid => $file), $langcode);
232
      $element['content'] += field_attach_view('file', $file, $tag_info['view_mode'], $langcode);
218 233
    }
219 234
    if (count(element_children($element['content'])) > 1) {
220 235
      // Add surrounding divs to group them together.
......
234 249
      $element['#pre_render'][] = 'media_wysiwyg_pre_render_cached_filter';
235 250
    }
236 251
  }
237
  drupal_alter('media_wysiwyg_token_to_markup', $element, $tag_info, $settings);
252
  drupal_alter('media_wysiwyg_token_to_markup', $element, $tag_info, $settings, $langcode);
238 253
  $output = drupal_render($element);
239 254
  unset($recursion_stop[$file->fid]);
240 255
  return $output;
......
261 276

  
262 277
        // The value should be set at the deepest level.
263 278
        // Fields that use rich-text markup will be urlencoded.
264
        $ref = urldecode($field_value);
279
        $ref = decode_entities($field_value);
265 280
      }
266 281
    }
267 282
  }
drupal7/sites/all/modules/media/modules/media_wysiwyg/js/media_wysiwyg.filter.js
61 61
      return content;
62 62
    },
63 63

  
64
    /**
65
     * Returns alt and title field attribute data from the corresponding fields.
66
     *
67
     * Specifically looks for file_entity module's file_image_alt_text and
68
     * file_image_title_text fields as those are by default used to store
69
     * override values for image alt and title attributes.
70
     *
71
     * @param options (array)
72
     *   Options passed through a popup form submission.
73
     * @param includeFieldID (bool)
74
     *   If set, the returned object will have extra keys with the IDs of the
75
     *   found fields.
76
     *
77
     * If the alt or title fields were not found, their keys will be excluded
78
     * from the returned array.
79
     *
80
     * @return
81
     *   An object with the following keys:
82
     *   - alt: The value of the alt field.
83
     *   - altField: The id of the alt field.
84
     *   - title: The value of the title field.
85
     *   - titleField: The id of the title field.
86
     */
87
    parseAttributeFields: function(options, includeFieldID) {
88
      var attributes = {};
89

  
90
      for (var field in options) {
91
        // If the field is set to false, use an empty string for output.
92
        options[field] = options[field] === false ? '' : options[field];
93
        //if (field.match(/^field_file_image_alt_text/)) {
94
        if (field.match(new RegExp('^' + Drupal.settings.media.img_alt_field))) {
95
          attributes.alt = options[field];
96
          if (includeFieldID) {
97
            attributes.altField = field;
98
          }
99
        }
100

  
101
        //if (field.match(/^field_file_image_title_text/)) {
102
        if (field.match(new RegExp('^' + Drupal.settings.media.img_title_field))) {
103
          attributes.title = options[field];
104
          if (includeFieldID) {
105
            attributes.titleField = field;
106
          }
107
        }
108
      }
109

  
110
      return attributes;
111
    },
112

  
113
    /**
114
     * Ensures changes made to fielded attributes are done on the fields too.
115
     *
116
     * This should be called when creating a macro tag from a placeholder.
117
     *
118
     * Changed made to attributes represented by fields are synced back to the
119
     * corresponding fields, if they exist. The alt/title attribute
120
     * values encoded in the macro will override the alt/title field values (set
121
     * in the Media dialog) during rendering of both WYSIWYG placeholders and
122
     * the final file entity on the server. Syncing makes changes applied to a
123
     * placeholder's alt/title attribute using native WYSIWYG tools visible in
124
     * the fields shown in the Media dialog.
125
     *
126
     * The reverse should be done when creating a placeholder from a macro tag
127
     * so changes made in the Media dialog are reflected in the placeholder's
128
     * alt and title attributes or the values there become stale and the change
129
     * appears uneffective.
130
     *
131
     * @param file_info (object)
132
     *   A JSON decoded object of the file being inserted/updated.
133
     */
134
    syncAttributesToFields: function(file_info) {
135
      if (!file_info) {
136
        file_info = {};
137
      }
138
      if (!file_info.attributes) {
139
        file_info.attributes = {};
140
      }
141
      if (!file_info.fields) {
142
        file_info.fields = {};
143
      }
144
      var fields = Drupal.media.filter.parseAttributeFields(file_info.fields, true);
145

  
146
      // If the title attribute has changed, ensure the title field is updated.
147
      var titleAttr = file_info.attributes.title || false;
148
      if (fields.titleField && (titleAttr !== fields.title)) {
149
        file_info.fields[fields.titleField] = titleAttr;
150
      }
151

  
152
      // If the alt attribute has changed, ensure the alt field is updated.
153
      var altAttr = file_info.attributes.alt || false;
154
      if (fields.altField && (altAttr !== fields.alt)) {
155
        file_info.fields[fields.altField] = altAttr;
156
      }
157

  
158
      return file_info;
159
    },
160

  
64 161
    /**
65 162
     * Replaces media elements with tokens.
66 163
     *
......
70 167
    replacePlaceholderWithToken: function(content) {
71 168
      Drupal.media.filter.ensure_tagmap();
72 169

  
73
      // Rewrite the tagmap in case any of the macros have changed.
74
      Drupal.settings.tagmap = {};
75

  
76 170
      // Replace all media placeholders with their JSON macro representations.
77 171
      //
78 172
      // There are issues with using jQuery to parse the WYSIWYG content (see
......
88 182
      // media_get_file_without_label().
89 183
      //
90 184
      // Finds the media-element class.
91
      var classRegex = 'class=[\'"][^\'"]*?media-element';
185
      var classRegex = 'class=([\'"])[^\\1]*?media-element';
92 186
      // Image tag with the media-element class.
93 187
      var regex = '<img[^>]+' + classRegex + '[^>]*?>';
94 188
      // Or a span with the media-element class (used for documents).
......
98 192
      var matches = content.match(RegExp(regex, 'gi'));
99 193
      if (matches) {
100 194
        for (i = 0; i < matches.length; i++) {
101
          markup = matches[i];
102
          macro = Drupal.media.filter.create_macro($(markup));
103
          Drupal.settings.tagmap[macro] = markup;
104
          content = content.replace(markup, macro);
195
          var markup = matches[i];
196
          var macro = Drupal.media.filter.create_macro($(markup));
197
          // If we have a truthy response, store the macro and perform the
198
          // replacement.
199
          if (macro) {
200
            Drupal.settings.tagmap[macro] = markup;
201
            content = content.replace(markup, macro);
202
          }
105 203
        }
106 204
      }
107 205

  
......
131 229
        element = element.children();
132 230
      }
133 231

  
232
      // Extract attributes represented by fields and use those values to keep
233
      // them in sync, usually alt and title.
234
      info.fields = info.attributes;
235
      var attributes = Drupal.media.filter.parseAttributeFields(info.attributes);
236
      info.attributes = $.extend(info.attributes, attributes);
237

  
134 238
      // Move attributes from the file info array to the placeholder element.
135 239
      if (info.attributes) {
136 240
        $.each(Drupal.settings.media.wysiwyg_allowed_attributes, function(i, a) {
137 241
          if (info.attributes[a]) {
138
            element.attr(a, info.attributes[a]);
242
            element.attr(a, $('<textarea />').html(info.attributes[a]).text());
139 243
          }
140 244
        });
141 245
        delete(info.attributes);
......
163 267

  
164 268
      var classes = ['media-element'];
165 269
      if (info.view_mode) {
270
        // Remove any existing view mode classes.
271
        element.removeClass (function (index, css) {
272
          return (css.match (/\bfile-\S+/g) || []).join(' ');
273
        });
166 274
        classes.push('file-' + info.view_mode.replace(/_/g, '-'));
167 275
      }
168 276
      element.addClass(classes.join(' '));
......
223 331
        }
224 332
      }
225 333

  
226
      return file_info;
334
      return Drupal.media.filter.syncAttributesToFields(file_info);
227 335
    },
228 336

  
229 337
    /**
drupal7/sites/all/modules/media/modules/media_wysiwyg/js/wysiwyg-media.js
113 113
    var element = Drupal.media.filter.create_element(formatted_media.html, {
114 114
          fid: this.mediaFile.fid,
115 115
          view_mode: formatted_media.type,
116
          attributes: formatted_media.options,
116
          attributes: this.mediaFile.attributes,
117 117
          fields: formatted_media.options
118 118
        });
119 119
    // Get the markup and register it for the macro / placeholder handling.
drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.info
15 15

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

  
18
; Information added by Drupal.org packaging script on 2016-05-31
19
version = "7.x-2.0-beta2"
18
; Information added by Drupal.org packaging script on 2016-10-25
19
version = "7.x-2.0-beta3"
20 20
core = "7.x"
21 21
project = "media"
22
datestamp = "1464653492"
22
datestamp = "1477422289"
23 23

  
drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.module
115 115
  $element['#attached']['library'][] = array('media', 'media_browser_settings');
116 116

  
117 117
  // Add wysiwyg-specific settings.
118
  $settings = array('wysiwyg_allowed_attributes' => variable_get('media_wysiwyg_wysiwyg_allowed_attributes', _media_wysiwyg_wysiwyg_allowed_attributes_default()));
118
  $settings = array(
119
    'wysiwyg_allowed_attributes' => variable_get('media_wysiwyg_wysiwyg_allowed_attributes', _media_wysiwyg_wysiwyg_allowed_attributes_default()),
120
    'img_alt_field' => 'field_file_image_alt_text',
121
    'img_title_field' => 'field_file_image_title_text',
122
  );
123

  
124
  // The file_entity module lets you specify a string, possibly with tokens, for
125
  // the alt and title attributes of images. We need the actual field names instead.
126
  // If the variable only contains a token of the format [file:field_file_image_alt_text]
127
  // then it's possible to extract it.
128
  $alt_token = variable_get('file_entity_alt', '[file:field_file_image_alt_text]');
129
  $title_token = variable_get('file_entity_title', '[file:field_file_image_title_text]');
130
  $matches = array();
131
  if (preg_match('/^\[file:(field_[[:alnum:]_-]+)\]$/', trim($alt_token), $matches)) {
132
    $settings['img_alt_field'] = $matches[1];
133
  }
134
  if (preg_match('/^\[file:(field_[[:alnum:]_-]+)\]$/', trim($title_token), $matches)) {
135
    $settings['img_title_field'] = $matches[1];
136
  }
137

  
119 138
  $element['#attached']['js'][] = array(
120 139
    'data' => array(
121 140
      'media' => $settings,
......
288 307
 *
289 308
 * Optional custom settings can override how the file is displayed.
290 309
 */
291
function media_wysiwyg_get_file_without_label($file, $view_mode, $settings = array()) {
310
function media_wysiwyg_get_file_without_label($file, $view_mode, $settings = array(), $langcode = NULL) {
292 311
  $file->override = $settings;
293 312

  
294
  $element = file_view_file($file, $view_mode);
313
  $element = file_view_file($file, $view_mode, $langcode);
314

  
315
  // Field Translation Support.
316
  if (field_has_translation_handler('file')) {
317
    if ($field_items = field_get_items('file', $file, 'field_file_image_alt_text', $langcode)) {
318
      $value = field_view_value('file', $file, 'field_file_image_alt_text', $field_items[0], array(), $langcode);
319
      $element['#alt'] = isset($value['#markup']) ? $value['#markup'] : '';
320
    }
321
  }
295 322

  
296 323
  // The formatter invoked by file_view_file() can use $file->override to
297 324
  // customize the returned render array to match the requested settings. To
drupal7/sites/all/modules/media/modules/media_wysiwyg_view_mode/media_wysiwyg_view_mode.info
5 5
dependencies[] = media_wysiwyg
6 6
files[] = media_wysiwyg_view_mode.test
7 7

  
8
; Information added by Drupal.org packaging script on 2016-05-31
9
version = "7.x-2.0-beta2"
8
; Information added by Drupal.org packaging script on 2016-10-25
9
version = "7.x-2.0-beta3"
10 10
core = "7.x"
11 11
project = "media"
12
datestamp = "1464653492"
12
datestamp = "1477422289"
13 13

  
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 2016-05-31
8
version = "7.x-2.0-beta2"
7
; Information added by Drupal.org packaging script on 2016-10-25
8
version = "7.x-2.0-beta3"
9 9
core = "7.x"
10 10
project = "media"
11
datestamp = "1464653492"
11
datestamp = "1477422289"
12 12

  
drupal7/sites/all/modules/media/tests/media.test
22 22
    $modules[] = 'media';
23 23
    $modules[] = 'media_module_test';
24 24
    parent::setUp($modules);
25
    $this->admin_user = $this->drupalCreateUser(array('access content', 'view files', 'view own files', 'access media browser', 'access administration pages', 'administer site configuration', 'administer users', 'administer permissions', 'administer content types', 'administer nodes', 'administer files', 'bypass node access', 'bypass file access'));
25
    $this->admin_user = $this->drupalCreateUser(array('access content', 'view files', 'view own files', 'access media browser', 'access administration pages', 'administer site configuration', 'administer users', 'administer permissions', 'administer content types', 'administer nodes', 'administer files', 'bypass node access', 'bypass file access', 'administer fields'));
26 26
    $this->drupalLogin($this->admin_user);
27 27
  }
28 28

  
......
182 182
    }
183 183

  
184 184
    // Attach a file to the node.
185
    $edit['media[' . $field_name . '_' . $langcode . '_0]'] = $file->fid;
185
    $edit[$field_name . '[' . $langcode . '][0][fid]'] = $file->fid;
186 186
    $this->drupalPost("node/$nid/edit", $edit, t('Save'));
187 187

  
188 188
    return $nid;
......
911 911
    $instance = field_info_instance('node', $field_name, $type_name);
912 912

  
913 913
    $javascript = $this->drupalGet("node/add/$type_name");
914

  
915
    $multiselect = ($field['cardinality'] > 1 || $field['cardinality'] == FIELD_CARDINALITY_UNLIMITED);
914 916
    $field_widget = array(
915 917
        'elements' => array(
916 918
          '#edit-' . $field_name . '-' . LANGUAGE_NONE . '-0-upload' => array(
......
926 928
              'file_extensions' => 'txt',
927 929
              'max_filesize' => '',
928 930
              'uri_scheme' => 'public',
931
              'multiselect' => $multiselect,
929 932
            ),
930 933
          ),
931 934
        ),
......
1112 1115
    $node = node_load($nid, NULL, TRUE);
1113 1116
    $node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
1114 1117
    $this->assertFileExists($node_file, 'File exists after attaching to the required multiple value field.');
1115
    $this->assertFileEntryExists($node_file, 'File entry exists after attaching to the required multipel value field.');
1118
    $this->assertFileEntryExists($node_file, 'File entry exists after attaching to the required multiple value field.');
1116 1119

  
1117 1120
    // Remove our file field.
1118 1121
    field_delete_field($field_name);
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 2016-05-31
10
version = "7.x-2.0-beta2"
9
; Information added by Drupal.org packaging script on 2016-10-25
10
version = "7.x-2.0-beta3"
11 11
core = "7.x"
12 12
project = "media"
13
datestamp = "1464653492"
13
datestamp = "1477422289"
14 14

  

Formats disponibles : Unified diff