You are here

function file_entity_get_download_token in File Entity (fieldable files) 7.2

Same name and namespace in other branches
  1. 7.3 file_entity.module \file_entity_get_download_token()
3 calls to file_entity_get_download_token()
FileEntityAccessTestCase::testFileEntityPageAccess in ./file_entity.test
Tests page access.
file_entity_download_page in ./file_entity.pages.inc
Menu callback; download a single file entity.
file_entity_download_uri in ./file_entity.module
Return an URI for a file download.

File

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

Code

function file_entity_get_download_token($file) {

  // Return the first eight characters.
  return substr(drupal_hmac_base64("file/{$file->fid}/download:" . $file->uri, drupal_get_private_key() . drupal_get_hash_salt()), 0, 8);
}