You are here

function _file_expiration_date in Ubercart 5

Return a file expiration date given a purchase date

@return: A UNIX timestamp representing the second the file download expires or FALSE if there won't be an expiration

Parameters

$purchase_date: The purchase date for the file

2 calls to _file_expiration_date()
uc_file_user_downloads in uc_file/uc_file.module
Table builder for user downloads
_file_download in uc_file/uc_file.module
Perform first-pass authorization. Call authorization hooks afterwards.

File

uc_file/uc_file.module, line 1266
Allows products to be associated with downloadable files.

Code

function _file_expiration_date($purchase_date = NULL) {
  $purchase_date = !is_null($purchase_date) ? $purchase_date : time();
  $quantity = !is_null(variable_get('uc_file_download_limit_duration_qty', NULL)) ? variable_get('uc_file_download_limit_duration_qty', NULL) : 1;
  $operator = $quantity < 0 ? '' : '+';
  $duration = variable_get('uc_file_download_limit_duration_granularity', 'never');
  return $duration != 'never' ? strtotime($operator . $quantity . ' ' . $duration, $purchase_date) : FALSE;
}