Projet

Général

Profil

Révision da542b7b

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

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/media/modules/media_wysiwyg/includes/media_wysiwyg.file_usage.inc
12 12
 * is heavy-handed, and should be replaced when Drupal's filter system is
13 13
 * context-aware.
14 14
 */
15
function media_wysiwyg_field_attach_insert($entity_type, $entity) {
15
function media_wysiwyg_entity_insert($entity, $entity_type) {
16 16
  _media_wysiwyg_filter_add_file_usage_from_fields($entity_type, $entity);
17 17
}
18 18

  
......
21 21
 *
22 22
 * @see media_field_attach_insert().
23 23
 */
24
function media_wysiwyg_field_attach_update($entity_type, $entity) {
24
function media_wysiwyg_entity_update($entity, $entity_type) {
25 25
  _media_wysiwyg_filter_add_file_usage_from_fields($entity_type, $entity);
26 26
}
27 27

  
......
92 92
  foreach (media_wysiwyg_filter_fields_with_text_filtering($entity_type, $entity) as $field_name) {
93 93
    if ($field_items = field_get_items($entity_type, $entity, $field_name)) {
94 94
      foreach ($field_items as $field_item) {
95
        preg_match_all(MEDIA_WYSIWYG_TOKEN_REGEX, $field_item['value'], $matches);
96
        foreach ($matches[0] as $tag) {
97
          $tag = str_replace(array('[[', ']]'), '', $tag);
98
          $tag_info = drupal_json_decode($tag);
99
          if (isset($tag_info['fid']) && $tag_info['type'] == 'media') {
100
            $file_references[] = $tag_info;
95
        if (!empty($field_item['value'])) {
96
          preg_match_all(MEDIA_WYSIWYG_TOKEN_REGEX, $field_item['value'], $matches);
97
          foreach ($matches[0] as $tag) {
98
            $tag = str_replace(array('[[', ']]'), '', $tag);
99
            $tag_info = drupal_json_decode($tag);
100
            if (isset($tag_info['fid']) && $tag_info['type'] == 'media') {
101
              $file_references[] = $tag_info;
102
            }
101 103
          }
102
        }
103 104

  
104
        preg_match_all(MEDIA_WYSIWYG_TOKEN_REGEX, $field_item['value'], $matches_alt);
105
        foreach ($matches_alt[0] as $tag) {
106
          $tag = urldecode($tag);
107
          $tag_info = drupal_json_decode($tag);
108
          if (isset($tag_info['fid']) && $tag_info['type'] == 'media') {
109
            $file_references[] = $tag_info;
105
          preg_match_all(MEDIA_WYSIWYG_TOKEN_REGEX, $field_item['value'], $matches_alt);
106
          foreach ($matches_alt[0] as $tag) {
107
            $tag = urldecode($tag);
108
            $tag_info = drupal_json_decode($tag);
109
            if (isset($tag_info['fid']) && $tag_info['type'] == 'media') {
110
              $file_references[] = $tag_info;
111
            }
110 112
          }
111 113
        }
112 114
      }

Formats disponibles : Unified diff