function _auto_expire_expiry in Auto Expire 5
Same name and namespace in other branches
- 7 auto_expire.module \_auto_expire_expiry()
1 string reference to '_auto_expire_expiry'
File
- ./
auto_expire.module, line 68
Code
function _auto_expire_expiry($nid) {
$node = node_load($nid);
drupal_set_title(check_plain($node->title));
$expire = _auto_expire_get_expire($node->nid);
$code = AUTO_EXPIRE_NODE_TYPE . $node->type;
$warn = variable_get($code . '_w', AUTO_EXPIRE_WARN);
$form['nid'] = array(
'#type' => 'value',
'#value' => $nid,
);
$form['expireson'] = array(
'#value' => '<p>' . t('!title will expire on !date<br />that is in !interval.', array(
'!title' => $node->title,
'!date' => format_date($expire),
'!interval' => format_interval($expire - time()),
)) . '</p>',
);
if (time() > $expire - $warn * 24 * 60 * 60) {
$days = variable_get($code . '_d', AUTO_EXPIRE_DAYS);
$form['extendby'] = array(
'#value' => '<p>' . format_plural($days, 'You can extend it with 1 day.', 'You can extend it with @count days.') . '</p>',
);
$form['extend'] = array(
'#type' => 'submit',
'#value' => t('Extend'),
);
}
else {
$form['extendwhen'] = array(
'#value' => '<p>' . format_plural($warn, 'You will be able to extend this 24 hours before the expiry time.', 'You will be able to extend this @count days before the expiry time.') . ' ' . t('You will receive an email notification at that time.') . '</p>',
);
}
return $form;
}