function _uc_roles_get_expiration in Ubercart 6.2
Same name and namespace in other branches
- 7.3 uc_roles/uc_roles.module \_uc_roles_get_expiration()
Function will return a expiration time stamp given a certain amount of time from a starting point (defaults to current time).
Parameters
$duration: The amount of time until expiration.
$granularity: A string representing the granularity's name (e.g. "day", "month", etc.).
$start_time: The starting date for when the role will last.
Return value
A UNIX timestamp representing the second that expiration takes place.
5 calls to _uc_roles_get_expiration()
- uc_roles_cron in uc_roles/
uc_roles.module - Implements hook_cron().
- uc_roles_feature_form in uc_roles/
uc_roles.module - Form builder for hook_product_feature.
- uc_roles_user_submit in uc_roles/
uc_roles.module - Implements hook_user_submit().
- uc_roles_user_validate in uc_roles/
uc_roles.module - Implements hook_user_validate().
- _uc_roles_product_get_expiration in uc_roles/
uc_roles.module - Calculates the expiration time using a role_product object.
File
- uc_roles/
uc_roles.module, line 1394
Code
function _uc_roles_get_expiration($duration, $granularity, $start_time = NULL) {
// Never expires?
if ($granularity == 'never') {
return NULL;
}
$start_time = !is_null($start_time) ? $start_time : time();
$operator = $duration < 0 ? '' : '+';
return strtotime($operator . $duration . ' ' . $granularity, $start_time);
}