You are here

function file_entity_file_is_local in File Entity (fieldable files) 7.2

Same name and namespace in other branches
  1. 7.3 file_entity.module \file_entity_file_is_local()

Check if a file entity is considered local or not.

Parameters

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

Return value

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

1 call to file_entity_file_is_local()
file_entity_download_page in ./file_entity.pages.inc
Menu callback; download a single file entity.

File

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

Code

function file_entity_file_is_local($file) {
  $scheme = file_uri_scheme($file->uri);
  $wrappers = file_get_stream_wrappers(STREAM_WRAPPERS_LOCAL);
  return !empty($wrappers[$scheme]) && empty($wrappers[$scheme]['remote']);
}