You are here

function uc_file_get_time_limit in Ubercart 7.3

Same name and namespace in other branches
  1. 8.4 uc_file/uc_file.module \uc_file_get_time_limit()
  2. 6.2 uc_file/uc_file.module \uc_file_get_time_limit()

Gets the time expiration for a given file.

If there are no file-specific time limits set, the function returns the global limits. Otherwise the limits from the file are returned.

Parameters

$file: A uc_file_products object.

Return value

An array with entries for the granularity and quantity.

2 calls to uc_file_get_time_limit()
uc_file_action_order_renew in uc_file/uc_file.rules.inc
Renews an orders product files.
uc_file_uc_add_to_cart in uc_file/uc_file.module
Implements hook_uc_add_to_cart().

File

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

Code

function uc_file_get_time_limit($file) {
  if (!isset($file->time_granularity) || $file->time_granularity == UC_FILE_LIMIT_SENTINEL) {
    return array(
      'time_polarity' => '+',
      'time_granularity' => variable_get('uc_file_download_limit_duration_granularity', 'never'),
      'time_quantity' => variable_get('uc_file_download_limit_duration_qty', NULL),
    );
  }
  else {
    return array(
      'time_polarity' => '+',
      'time_granularity' => $file->time_granularity,
      'time_quantity' => $file->time_quantity,
    );
  }
}