You are here

function media_browser_plus_file_entity_access_wrapper in Media Browser Plus 7.3

Wrapper around file_entity_access() to deal with multiple files.

1 call to media_browser_plus_file_entity_access_wrapper()
media_browser_plus_download_action_form in ./media_browser_plus.module
Configuration form shown to the user before the action gets executed.
1 string reference to 'media_browser_plus_file_entity_access_wrapper'
media_browser_plus_menu in ./media_browser_plus.module
Implements hook_menu().

File

./media_browser_plus.module, line 327
Media Browser Plus - enhanced file management functions.

Code

function media_browser_plus_file_entity_access_wrapper($op, $files = NULL, $account = NULL) {

  // If there's files parameter, ensure it is an array to handle.
  if (!is_array($files) && !empty($files)) {
    $files = array(
      $files,
    );
  }
  if (!empty($files)) {
    foreach ($files as $file) {

      // Even if one is not accessible return FALSE.
      if (!file_entity_access($op, $file, $account)) {
        return FALSE;
      }
    }
    return TRUE;
  }
  return file_entity_access($op, $files, $account);
}