public function AdvbanIpManager::expiryDurations in Advanced ban 8
Get expiry durations list or item.
Parameters
int $index: Item index (optional).
Return value
string|array List item or list.
Overrides AdvbanIpManagerInterface::expiryDurations
File
- src/
AdvbanIpManager.php, line 273
Class
- AdvbanIpManager
- Ban IP manager.
Namespace
Drupal\advbanCode
public function expiryDurations($index = NULL) {
$expiry_durations = $this->config
->get('advban.settings')
->get('expiry_durations');
if (empty($expiry_durations)) {
$expiry_durations = "+1 hour\n+1 day\n+1 week\n+1 month\n+1 year";
$this->config
->getEditable('advban.settings')
->set('expiry_durations', $expiry_durations)
->save();
}
$list = explode("\n", $expiry_durations);
return $index != NULL ? $list[$index] : $list;
}