commit a0c9a2e9de36021f19533134278ab2fc80deb43d
Author: Assos Assos <assos+forge@centrale-marseille.fr>
Date:   Wed Dec 7 23:44:53 2016 +0100

    Weekly update of contrib modules

diff --git a/drupal7/sites/all/modules/media/includes/media.browser.inc b/drupal7/sites/all/modules/media/includes/media.browser.inc
index 04e11e24..f410f9ac 100644
--- a/drupal7/sites/all/modules/media/includes/media.browser.inc
+++ b/drupal7/sites/all/modules/media/includes/media.browser.inc
@@ -16,7 +16,7 @@ function media_browser($selected = NULL) {
 
   // If we just did a multiple upload, do the multiform file edit. The flag that
   // tells us that we need to do this is $params['render_multi_edit_form'].
-  if (isset($params['render_multi_edit_form']) && isset($params['fid']) && module_exists('media_bulk_upload')) {
+  if (variable_get('media_bulk_upload_edit', TRUE) && isset($params['render_multi_edit_form']) && isset($params['fid']) && module_exists('media_bulk_upload')) {
     module_load_include('inc', 'media_bulk_upload', 'includes/media_bulk_upload.pages');
     $files = file_load_multiple($params['fid']);
     $multi_edit_form = media_bulk_upload_file_page_edit_multiple($files);
diff --git a/drupal7/sites/all/modules/media/js/media.admin.js b/drupal7/sites/all/modules/media/js/media.admin.js
index 058e9318..b82eb29d 100644
--- a/drupal7/sites/all/modules/media/js/media.admin.js
+++ b/drupal7/sites/all/modules/media/js/media.admin.js
@@ -13,7 +13,7 @@
  */
 Drupal.behaviors.mediaAdmin = {
   attach: function (context) {
-    // Show a javascript confirmation dialog if a user has files selected and
+    // Show a JavaScript confirmation dialog if a user has files selected and
     // they try to switch between the "Thumbnail" and "List" local tasks.
     $('.tabs.secondary a').once('media-admin').bind('click', function () {
       if ($(':checkbox:checked', $('.file-entity-admin-file-form')).length != 0) {
diff --git a/drupal7/sites/all/modules/media/media.info b/drupal7/sites/all/modules/media/media.info
index 119a305a..4540b135 100644
--- a/drupal7/sites/all/modules/media/media.info
+++ b/drupal7/sites/all/modules/media/media.info
@@ -24,9 +24,9 @@ configure = admin/config/media/browser
 ; We have to add a fake version so Git checkouts do not fail Media dependencies
 version = 7.x-2.x-dev
 
-; Information added by Drupal.org packaging script on 2016-11-24
-version = "7.x-2.0-beta10"
+; Information added by Drupal.org packaging script on 2016-12-07
+version = "7.x-2.0-beta13"
 core = "7.x"
 project = "media"
-datestamp = "1480015684"
+datestamp = "1481140093"
 
diff --git a/drupal7/sites/all/modules/media/media.install b/drupal7/sites/all/modules/media/media.install
index e18593a6..50fe58db 100644
--- a/drupal7/sites/all/modules/media/media.install
+++ b/drupal7/sites/all/modules/media/media.install
@@ -65,6 +65,8 @@ function media_uninstall() {
   variable_del('media_zindex');
   variable_del('media_backgroundcolor');
   variable_del('media_opacity');
+  // bulk edit option
+  variable_del('media_bulk_upload_edit');
 }
 
 /**
diff --git a/drupal7/sites/all/modules/media/media.views.inc b/drupal7/sites/all/modules/media/media.views.inc
index db20b1aa..c577f48e 100644
--- a/drupal7/sites/all/modules/media/media.views.inc
+++ b/drupal7/sites/all/modules/media/media.views.inc
@@ -129,7 +129,7 @@ function template_preprocess_media_views_view_media_browser(&$vars) {
   // Run theming variables through a standard Views preprocess function.
   template_preprocess_views_view_unformatted($vars);
 
-  // Add media browser javascript and CSS.
+  // Add media browser JavaScript and CSS.
   drupal_add_js(drupal_get_path('module', 'media') . '/js/plugins/media.views.js');
 }
 
diff --git a/drupal7/sites/all/modules/media/modules/media_bulk_upload/media_bulk_upload.info b/drupal7/sites/all/modules/media/modules/media_bulk_upload/media_bulk_upload.info
index 31aef429..60a3d096 100644
--- a/drupal7/sites/all/modules/media/modules/media_bulk_upload/media_bulk_upload.info
+++ b/drupal7/sites/all/modules/media/modules/media_bulk_upload/media_bulk_upload.info
@@ -4,7 +4,7 @@ package = Media
 core = 7.x
 
 dependencies[] = media
-dependencies[] = multiform
+dependencies[] = multiform (>= 7.x-1.3)
 dependencies[] = plupload
 
 test_dependencies[] = multiform
@@ -13,9 +13,9 @@ test_dependencies[] = plupload
 files[] = includes/MediaBrowserBulkUpload.inc
 files[] = tests/media_bulk_upload.test
 
-; Information added by Drupal.org packaging script on 2016-11-24
-version = "7.x-2.0-beta10"
+; Information added by Drupal.org packaging script on 2016-12-07
+version = "7.x-2.0-beta13"
 core = "7.x"
 project = "media"
-datestamp = "1480015684"
+datestamp = "1481140093"
 
diff --git a/drupal7/sites/all/modules/media/modules/media_bulk_upload/media_bulk_upload.module b/drupal7/sites/all/modules/media/modules/media_bulk_upload/media_bulk_upload.module
index 3d2cc974..7db48cdf 100644
--- a/drupal7/sites/all/modules/media/modules/media_bulk_upload/media_bulk_upload.module
+++ b/drupal7/sites/all/modules/media/modules/media_bulk_upload/media_bulk_upload.module
@@ -235,3 +235,23 @@ function _media_bulk_upload_file_entity_access_recursive($files, $op) {
 function media_bulk_upload_multi_load($fids) {
   return file_load_multiple(explode(' ', $fids));
 }
+
+/**
+ * Implements hook_form_FORM_ID_alter().
+ */
+function media_bulk_upload_form_media_admin_config_browser_alter(&$form, &$form_state) {
+
+  $form['bulk_upload'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Bulk Upload'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+
+  $form['bulk_upload']['media_bulk_upload_edit'] = array(
+    '#type' => 'checkbox',
+    '#title' => t("Bulk upload edit"),
+    '#description' => t("After bulk uploads on entity edit pages, show edit form for all uploaded files in a single popup."),
+    '#default_value' => variable_get('media_bulk_upload_edit', TRUE),
+  );
+}
diff --git a/drupal7/sites/all/modules/media/modules/media_internet/media_internet.info b/drupal7/sites/all/modules/media/modules/media_internet/media_internet.info
index d07cbb65..bea7babc 100644
--- a/drupal7/sites/all/modules/media/modules/media_internet/media_internet.info
+++ b/drupal7/sites/all/modules/media/modules/media_internet/media_internet.info
@@ -12,9 +12,9 @@ files[] = includes/MediaInternetNoHandlerException.inc
 files[] = includes/MediaInternetValidationException.inc
 files[] = tests/media_internet.test
 
-; Information added by Drupal.org packaging script on 2016-11-24
-version = "7.x-2.0-beta10"
+; Information added by Drupal.org packaging script on 2016-12-07
+version = "7.x-2.0-beta13"
 core = "7.x"
 project = "media"
-datestamp = "1480015684"
+datestamp = "1481140093"
 
diff --git a/drupal7/sites/all/modules/media/modules/media_internet/tests/media_internet_test.info b/drupal7/sites/all/modules/media/modules/media_internet/tests/media_internet_test.info
index aac51b93..b29a5dba 100644
--- a/drupal7/sites/all/modules/media/modules/media_internet/tests/media_internet_test.info
+++ b/drupal7/sites/all/modules/media/modules/media_internet/tests/media_internet_test.info
@@ -7,9 +7,9 @@ hidden = TRUE
 files[] = includes/MediaInternetTestStreamWrapper.inc
 files[] = includes/MediaInternetTestHandler.inc
 
-; Information added by Drupal.org packaging script on 2016-11-24
-version = "7.x-2.0-beta10"
+; Information added by Drupal.org packaging script on 2016-12-07
+version = "7.x-2.0-beta13"
 core = "7.x"
 project = "media"
-datestamp = "1480015684"
+datestamp = "1481140093"
 
diff --git a/drupal7/sites/all/modules/media/modules/media_migrate_file_types/media_migrate_file_types.info b/drupal7/sites/all/modules/media/modules/media_migrate_file_types/media_migrate_file_types.info
index 5bdf222a..ae937841 100644
--- a/drupal7/sites/all/modules/media/modules/media_migrate_file_types/media_migrate_file_types.info
+++ b/drupal7/sites/all/modules/media/modules/media_migrate_file_types/media_migrate_file_types.info
@@ -8,9 +8,9 @@ dependencies[] = media
 
 configure = admin/structure/file-types/upgrade
 
-; Information added by Drupal.org packaging script on 2016-11-24
-version = "7.x-2.0-beta10"
+; Information added by Drupal.org packaging script on 2016-12-07
+version = "7.x-2.0-beta13"
 core = "7.x"
 project = "media"
-datestamp = "1480015684"
+datestamp = "1481140093"
 
diff --git a/drupal7/sites/all/modules/media/modules/media_wysiwyg/includes/media_wysiwyg.filter.inc b/drupal7/sites/all/modules/media/modules/media_wysiwyg/includes/media_wysiwyg.filter.inc
index 2370808e..6b47c5ee 100644
--- a/drupal7/sites/all/modules/media/modules/media_wysiwyg/includes/media_wysiwyg.filter.inc
+++ b/drupal7/sites/all/modules/media/modules/media_wysiwyg/includes/media_wysiwyg.filter.inc
@@ -159,7 +159,7 @@ function media_wysiwyg_token_to_markup($match, $wysiwyg = FALSE, $langcode = NUL
     }
 
     $attributes = is_array($tag_info['attributes']) ? $tag_info['attributes'] : array();
-    $attribute_whitelist = variable_get('media_wysiwyg_wysiwyg_allowed_attributes', _media_wysiwyg_wysiwyg_allowed_attributes_default());
+    $attribute_whitelist = media_wysiwyg_allowed_attributes();
     $settings['attributes'] = array_intersect_key($attributes, array_flip($attribute_whitelist));
     $settings['fields'] = $fields;
 
@@ -206,7 +206,7 @@ function media_wysiwyg_token_to_markup($match, $wysiwyg = FALSE, $langcode = NUL
   // the rest of this function, so that if the file is themed as a link, the
   // desired text will be used (see, for example, theme_file_link()).
   // @todo: Try to find a less hacky way to do this.
-  if (isset($tag_info['link_text'])) {
+  if (isset($tag_info['link_text']) && variable_get('media_wysiwyg_use_link_text_for_filename', 1)) {
     // The link text will have characters such as "&" encoded for HTML, but the
     // filename itself needs the raw value when it is used to build the link,
     // in order to avoid double encoding.
@@ -236,7 +236,7 @@ function media_wysiwyg_token_to_markup($match, $wysiwyg = FALSE, $langcode = NUL
       'view_mode' => $tag_info['view_mode'],
       'link_text' => $tag_info['link_text'],
     );
-    drupal_add_js(array('mediaDataMap' => array($file->fid => $data)), 'setting');
+    drupal_add_js(array('mediaDataMap' => array($file->fid => $data), 'mediaDoLinkText' => (boolean)(variable_get('media_wysiwyg_use_link_text_for_filename', 1))), 'setting');
     $element['#attributes']['data-fid'] = $file->fid;
     $element['#attributes']['data-media-element'] = '1';
     $element['#attributes']['class'][] = 'media-element';
@@ -295,6 +295,15 @@ function media_wysiwyg_token_to_markup($match, $wysiwyg = FALSE, $langcode = NUL
 function media_wysiwyg_filter_field_parser($tag_info) {
   $fields = array();
   if (isset($tag_info['fields'])) {
+    // Field names that end in [format] are associated with long-text fields that may have HTML Entities.
+    // Those values will need to be URLDecoded as well as HTMLDecoded.
+    $url_encoded_fields = array();
+    foreach($tag_info['fields'] as $field_name => $field_value) {
+      if (preg_match('/\[format\]$/', $field_name) > 0){
+        $url_encoded_fields[] = preg_replace('/\[format\]$/', '[value]', $field_name);
+      }
+    }
+
     foreach($tag_info['fields'] as $field_name => $field_value) {
       if (strpos($field_name, 'field_') === 0) {
         $parsed_field = explode('[', str_replace(']', '', $field_name));
@@ -329,8 +338,14 @@ function media_wysiwyg_filter_field_parser($tag_info) {
         }
 
         // The value should be set at the deepest level.
-        // Fields that use rich-text markup will be urlencoded.
-        $ref = decode_entities($field_value);
+        if (in_array($field_name, $url_encoded_fields)){
+          // Fields that use rich-text markup will be urlencoded.
+          $ref = urldecode(decode_entities($field_value));
+        }
+        else {
+          // Only entities need to be decoded.
+          $ref = decode_entities($field_value);
+        }
       }
     }
   }
diff --git a/drupal7/sites/all/modules/media/modules/media_wysiwyg/includes/media_wysiwyg.pages.inc b/drupal7/sites/all/modules/media/modules/media_wysiwyg/includes/media_wysiwyg.pages.inc
index 482947d8..94078057 100644
--- a/drupal7/sites/all/modules/media/modules/media_wysiwyg/includes/media_wysiwyg.pages.inc
+++ b/drupal7/sites/all/modules/media/modules/media_wysiwyg/includes/media_wysiwyg.pages.inc
@@ -139,7 +139,7 @@ function media_wysiwyg_format_form_view_mode(&$form, $form_state, $file)  {
 
   $form['preview'] = array();
   $form['preview']['#prefix'] = '<div class="media-item"><div class="media-thumbnail">';
-  $form['preview']['#suffix'] = '</div><div class="label-wrapper"><label class="media-filename">' . $file->filename . '</label></div></div>';
+  $form['preview']['#suffix'] = '</div><div class="label-wrapper"><label class="media-filename">' . check_plain($file->filename) . '</label></div></div>';
   $form['preview']['thumbnail'] = file_view_file($file, $view_mode);
   $form['preview']['thumbnail']['#prefix'] = '<div id="media-preview">';
   $form['preview']['thumbnail']['#suffix'] = '</div>';
diff --git a/drupal7/sites/all/modules/media/modules/media_wysiwyg/js/media_wysiwyg.filter.js b/drupal7/sites/all/modules/media/modules/media_wysiwyg/js/media_wysiwyg.filter.js
index 930ffb25..86140834 100644
--- a/drupal7/sites/all/modules/media/modules/media_wysiwyg/js/media_wysiwyg.filter.js
+++ b/drupal7/sites/all/modules/media/modules/media_wysiwyg/js/media_wysiwyg.filter.js
@@ -174,40 +174,31 @@
     replacePlaceholderWithToken: function(content) {
       Drupal.media.filter.ensure_tagmap();
 
-      // Replace all media placeholders with their JSON macro representations.
-      //
-      // There are issues with using jQuery to parse the WYSIWYG content (see
-      // http://drupal.org/node/1280758), and parsing HTML with regular
-      // expressions is a terrible idea (see http://stackoverflow.com/a/1732454/854985)
-      //
-      // WYSIWYG editors act wacky with complex placeholder markup anyway, so an
-      // image is the most reliable and most usable anyway: images can be moved by
-      // dragging and dropping, and can be resized using interactive handles.
-      //
-      // Media requests a WYSIWYG place holder rendering of the file by passing
-      // the wysiwyg => 1 flag in the settings array when calling
-      // media_get_file_without_label().
-      //
-      // Finds the media-element class.
-      var classRegex = 'class=[\'"][^\'"]*?media-element';
-      // Image tag with the media-element class.
-      var regex = '<img[^>]+' + classRegex + '[^>]*?>';
-      // Or a span with the media-element class (used for documents).
-      // \S\s catches any character, including a linebreak; JavaScript does not
-      // have a dotall flag.
-      regex += '|<span[^>]+' + classRegex + '[^>]*?>[\\S\\s]+?</span>';
-      var matches = content.match(RegExp(regex, 'gi'));
-      if (matches) {
-        for (i = 0; i < matches.length; i++) {
-          var markup = matches[i];
+      // Locate and process all the media placeholders in the WYSIWYG content.
+      var contentElements = $('<div/>').html(content);  // TODO: once baseline jQuery is 1.8+, switch to using $.parseHTML(content)
+      var mediaElements = contentElements.find('.media-element');
+      if (mediaElements) {
+        $(mediaElements).each(function (i) {
+          // Attempt to derive a JSON macro representation of the media placeholder.
+          // Note: Drupal 7 ships with JQuery 1.4.4, which allows $(this).attr('outerHTML') to retrieve the eement's HTML,
+          // but many sites use JQuery update to increate this to 1.6+, which insists on $(this).prop('outerHTML). 
+          // Until the minimum jQuery is >= 1.6, we need to do this the old-school way. 
+          // See http://stackoverflow.com/questions/2419749/get-selected-elements-outer-html
+          var markup = $(this).get(0).outerHTML;
+          if (markup === undefined) {
+            // Browser does not support outerHTML DOM property.  Use the more expensive clone method instead.
+            markup = $(this).clone().wrap('<div>').parent().html();
+          }
           var macro = Drupal.media.filter.create_macro($(markup));
-          // If we have a truthy response, store the macro and perform the
-          // replacement.
           if (macro) {
+            // Replace the placeholder with the macro in the parsed content.
+            // (Can't just replace the string section, because the outerHTML may be subtly different,
+            // depending on the browser. Parsing tends to convert <img/> to <img>, for instance.)
             Drupal.settings.tagmap[macro] = markup;
-            content = content.replace(markup, macro);
+            $(this).replaceWith(macro);
           }
-        }
+        });
+        content = $(contentElements).html();
       }
 
       return content;
@@ -345,7 +336,7 @@
           });
 
           // Extract the link text, if there is any.
-          file_info.link_text = element.find('a').html();
+          file_info.link_text = (Drupal.settings.mediaDoLinkText) ? element.find('a').html() : false;
 
           // When a file is embedded, its fields can be overridden. To allow for
           // the edge case where the same file is embedded multiple times with
@@ -430,13 +421,20 @@
      * Generates a unique "delta" for each embedding of a particular file.
      */
     fileEmbedDelta: function(fid, element) {
+      // Ensure we have an object to track our deltas.
+      Drupal.settings.mediaDeltas = Drupal.settings.mediaDeltas || {};
+
       // Check to see if the element already has one.
       if (element && element.data('delta')) {
-        return element.data('delta');
+        var existingDelta = element.data('delta');
+        // If so, make sure that it is being tracked in mediaDeltas.
+        if (!Drupal.settings.mediaDeltas[fid]) {
+          Drupal.settings.mediaDeltas[fid] = existingDelta;
+        }
+        return existingDelta;
       }
       // Otherwise, generate a new one. Arbitrarily start with 1.
       var delta = 1;
-      Drupal.settings.mediaDeltas = Drupal.settings.mediaDeltas || {};
       if (Drupal.settings.mediaDeltas[fid]) {
         delta = Drupal.settings.mediaDeltas[fid] + 1;
       }
diff --git a/drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.api.php b/drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.api.php
index 894e89be..00ead2b8 100644
--- a/drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.api.php
+++ b/drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.api.php
@@ -69,3 +69,18 @@ function hook_media_wysiwyg_token_to_markup_alter(&$element, $tag_info, $setting
     $element['#attributes']['alt'] = t('This media has been output using the @mode view mode.', array('@mode' => $tag_info['view_mode']));
   }
 }
+
+/**
+ * Alter list of attributes allowed to be stored in json and rendered in HTML.
+ * This example ensures that 'class' is always a permitted attribute.
+ *
+ * @param array $allowed_attributes
+ *   A flat array of attribute names.
+ *
+ * @see media_wysiwyg_allowed_attributes()
+ */
+function hook_media_wysiwyg_allowed_attributes_alter(&$allowed_attributes) {
+  if (!in_array('class', $allowed_attributes)) {
+    $allowed_attributes[] = 'class';
+  }
+}
diff --git a/drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.info b/drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.info
index e59b7225..8109c9f6 100644
--- a/drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.info
+++ b/drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.info
@@ -15,9 +15,9 @@ files[] = tests/media_wysiwyg.macro.test
 
 configure = admin/config/media/browser
 
-; Information added by Drupal.org packaging script on 2016-11-24
-version = "7.x-2.0-beta10"
+; Information added by Drupal.org packaging script on 2016-12-07
+version = "7.x-2.0-beta13"
 core = "7.x"
 project = "media"
-datestamp = "1480015684"
+datestamp = "1481140093"
 
diff --git a/drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.install b/drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.install
index 34d30c23..1f99dc52 100644
--- a/drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.install
+++ b/drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.install
@@ -71,6 +71,7 @@ function media_wysiwyg_uninstall() {
   variable_del('media_wysiwyg_wysiwyg_allowed_attributes');
   variable_del('media_wysiwyg_wysiwyg_browser_plugins');
   variable_del('media_wysiwyg_wysiwyg_override_field_types');
+  variable_del('media_wysiwyg_use_link_text_for_filename');
 }
 
 /**
diff --git a/drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.module b/drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.module
index 56acb89c..b9c68e27 100644
--- a/drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.module
+++ b/drupal7/sites/all/modules/media/modules/media_wysiwyg/media_wysiwyg.module
@@ -22,6 +22,7 @@ require_once dirname(__FILE__) . '/includes/media_wysiwyg.features.inc';
  */
 function media_wysiwyg_hook_info() {
   $hooks = array(
+    'media_wysiwyg_allowed_attributes_alter',
     'media_wysiwyg_token_to_markup_alter',
     'media_wysiwyg_allowed_view_modes_alter',
     'media_wysiwyg_format_form_prepare_alter',
@@ -119,7 +120,7 @@ function media_wysiwyg_pre_render_text_format($element) {
 
   // Add wysiwyg-specific settings.
   $settings = array(
-    'wysiwyg_allowed_attributes' => variable_get('media_wysiwyg_wysiwyg_allowed_attributes', _media_wysiwyg_wysiwyg_allowed_attributes_default()),
+    'wysiwyg_allowed_attributes' => media_wysiwyg_allowed_attributes(),
     'img_alt_field' => 'field_file_image_alt_text',
     'img_title_field' => 'field_file_image_title_text',
   );
@@ -270,6 +271,13 @@ function media_wysiwyg_form_media_admin_config_browser_alter(&$form, &$form_stat
     '#description' => t('If checked, then the field type may be overridden in the WYSIWYG editor. Not all field types (e.g. Term reference) currently support being overridden so the desired result might not be achieved.')
   );
 
+  $form['wysiwyg']['media_wysiwyg_use_link_text_for_filename'] = array(
+    '#type' => 'checkbox',
+    '#title' => t("Use link text for filename"),
+    '#default_value' => variable_get('media_wysiwyg_use_link_text_for_filename', 1),
+    '#description' => t('When formatting inserted media, allow editable link text to be used in place of the filename. Turn this off if your file view modes handle link formatting.'),
+  );
+
   $form['#submit'][] = 'media_wysiwyg_admin_config_browser_pre_submit';
 }
 
@@ -320,13 +328,14 @@ function media_wysiwyg_wysiwyg_include_directory($type) {
 }
 
 /**
- * Returns the default set of allowed attributes for use with WYSIWYG.
+ * Returns the set of allowed attributes for use with WYSIWYG.
  *
  * @return array
  *   An array of whitelisted attributes.
  */
-function _media_wysiwyg_wysiwyg_allowed_attributes_default() {
-  return array(
+function media_wysiwyg_allowed_attributes() {
+  // Support the legacy variable for this.
+  $allowed_attributes = variable_get('media_wysiwyg_wysiwyg_allowed_attributes', array(
     'alt',
     'title',
     'height',
@@ -343,7 +352,9 @@ function _media_wysiwyg_wysiwyg_allowed_attributes_default() {
     'data-picture-align',
     'data-picture-mapping',
     'data-delta',
-  );
+  ));
+  drupal_alter('media_wysiwyg_allowed_attributes', $allowed_attributes);
+  return $allowed_attributes;  
 }
 
 /**
diff --git a/drupal7/sites/all/modules/media/modules/media_wysiwyg_view_mode/media_wysiwyg_view_mode.info b/drupal7/sites/all/modules/media/modules/media_wysiwyg_view_mode/media_wysiwyg_view_mode.info
index 74cf1302..f25e9390 100644
--- a/drupal7/sites/all/modules/media/modules/media_wysiwyg_view_mode/media_wysiwyg_view_mode.info
+++ b/drupal7/sites/all/modules/media/modules/media_wysiwyg_view_mode/media_wysiwyg_view_mode.info
@@ -3,9 +3,9 @@ description = DEPRECATED, this folder is only here so that the module can be uni
 package = Media
 core = 7.x
 
-; Information added by Drupal.org packaging script on 2016-11-24
-version = "7.x-2.0-beta10"
+; Information added by Drupal.org packaging script on 2016-12-07
+version = "7.x-2.0-beta13"
 core = "7.x"
 project = "media"
-datestamp = "1480015684"
+datestamp = "1481140093"
 
diff --git a/drupal7/sites/all/modules/media/modules/mediafield/mediafield.info b/drupal7/sites/all/modules/media/modules/mediafield/mediafield.info
index 1b1f04ad..bce61a68 100644
--- a/drupal7/sites/all/modules/media/modules/mediafield/mediafield.info
+++ b/drupal7/sites/all/modules/media/modules/mediafield/mediafield.info
@@ -4,9 +4,9 @@ package = Media
 core = 7.x
 dependencies[] = media
 
-; Information added by Drupal.org packaging script on 2016-11-24
-version = "7.x-2.0-beta10"
+; Information added by Drupal.org packaging script on 2016-12-07
+version = "7.x-2.0-beta13"
 core = "7.x"
 project = "media"
-datestamp = "1480015684"
+datestamp = "1481140093"
 
diff --git a/drupal7/sites/all/modules/media/tests/media_module_test.info b/drupal7/sites/all/modules/media/tests/media_module_test.info
index 38e3d8d6..f878eabf 100644
--- a/drupal7/sites/all/modules/media/tests/media_module_test.info
+++ b/drupal7/sites/all/modules/media/tests/media_module_test.info
@@ -6,9 +6,9 @@ hidden = TRUE
 
 files[] = includes/MediaModuleTest.inc
 
-; Information added by Drupal.org packaging script on 2016-11-24
-version = "7.x-2.0-beta10"
+; Information added by Drupal.org packaging script on 2016-12-07
+version = "7.x-2.0-beta13"
 core = "7.x"
 project = "media"
-datestamp = "1480015684"
+datestamp = "1481140093"
 
