function file_entity_file_is_local in D7 Media 7
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.
2 calls to file_entity_file_is_local()
- file_entity_file_formatter_file_image_view in file_entity/
file_entity.module - Implements hook_file_formatter_FORMATTER_view().
- media_field_validate in includes/
media.fields.inc - Implements hook_field_validate().
File
- file_entity/
file_entity.module, line 582 - 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']);
}