You are here

function file_entity_file_is_readable in File Entity (fieldable files) 7.3

Same name and namespace in other branches
  1. 7.2 file_entity.module \file_entity_file_is_readable()

Check if a file entity is readable or not.

Parameters

object $file: A file entity object from file_load().

Return value

boolean TRUE if the file is using a readable stream wrapper, or FALSE otherwise.

1 call to file_entity_file_is_readable()
file_entity_file_formatter_file_image_view in ./file_entity.module
Implements hook_file_formatter_FORMATTER_view().

File

./file_entity.module, line 1400
Extends Drupal file entities to be fieldable and viewable.

Code

function file_entity_file_is_readable($file) {
  $scheme = file_uri_scheme($file->uri);
  $wrappers = file_get_stream_wrappers(STREAM_WRAPPERS_READ);
  return !empty($wrappers[$scheme]);
}