Project

General

Profile

Revision 9a28ac3f

Added by Assos Assos almost 4 years ago

Weekly update of contrib modules

View differences:

drupal7/sites/all/modules/file_entity/file_entity.file.inc
130 130
 * Returns whether the file has changed
131 131
 */
132 132
function file_entity_has_file_changed($file) {
133
  return empty($file->is_new) || empty($file->original) || $file->filesize != $file->original->filesize || $file->uri != $file->original->uri;
133
  return empty($file->is_new) ? empty($file->original) || $file->filesize != $file->original->filesize || $file->uri != $file->original->uri : FALSE;
134 134
}
135 135

  
136 136

  
......
275 275
  if (!isset($language)) {
276 276
    $language = $GLOBALS['language'];
277 277
  }
278

  
279
  $alt = variable_get('file_entity_alt', '[file:field_file_image_alt_text]');
280
  $title = variable_get('file_entity_title', '[file:field_file_image_title_text]');
281

  
282 278
  $replace_options = array(
283 279
    'clear' => TRUE,
284 280
    'sanitize' => FALSE,
......
286 282
  );
287 283

  
288 284
  foreach ($files as $file) {
289
    // Load alt and title text from fields.
290
    if (!empty($alt)) {
291
      $output = token_replace($alt, array('file' => $file), $replace_options);
292

  
293
      if (!empty($output)) {
294
        // @todo Remove once https://www.drupal.org/node/1713164 is fixed.
295
        // There is currently no way to get the raw alt text returned from the
296
        // token so we revert the encoding done during tokenization.
297
        $file->alt = decode_entities($output);
298
      }
299
    }
300
    if (!empty($title)) {
301
      $output = token_replace($title, array('file' => $file), $replace_options);
302

  
303
      if (!empty($output)) {
304
        // @todo Remove once https://www.drupal.org/node/1713164 is fixed.
305
        // There is currently no way to get the raw title text returned from the
306
        // token so we revert the encoding done during tokenization.
307
        $file->title = decode_entities($output);
308
      }
309
    }
285
    $file->title = file_entity_replace_title($file, $replace_options, NULL, $language->language);
286
    $file->alt = file_entity_replace_alt($file, $replace_options, NULL, $language->language);
310 287
  }
311 288
}
312 289

  

Also available in: Unified diff