function yandex_services_auth_requirements in Yandex Services Authorization API 6
Same name and namespace in other branches
- 7 yandex_services_auth.install \yandex_services_auth_requirements()
Implements hook_requirements().
File
- ./
yandex_services_auth.install, line 20 - Install and uninstall functions for the Yandex Services Authorization API module.
Code
function yandex_services_auth_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
module_load_include('module', 'yandex_services_auth');
$auth_timestamp = variable_get('yandex_services_auth_timestamp', '');
$requirements = array(
'yandex_services_auth' => array(
'title' => t('Yandex Services Authorization expiration'),
'value' => $auth_timestamp ? format_date($auth_timestamp) : '',
'description' => t('You should authorize your application at <a href="!link">Yandex Services Authorization settings page</a>.', array(
'!link' => url('admin/settings/yandex_services_auth'),
)),
'severity' => REQUIREMENT_OK,
),
);
switch (yandex_services_auth_status()) {
case 'not authorized':
$requirements['yandex_services_auth']['severity'] = REQUIREMENT_ERROR;
break;
case 'authorized':
unset($requirements['yandex_services_auth']['description']);
break;
case 'expiring':
$requirements['yandex_services_auth']['severity'] = REQUIREMENT_WARNING;
break;
case 'expired':
$requirements['yandex_services_auth']['severity'] = REQUIREMENT_ERROR;
break;
}
}
return $requirements;
}