function constant_contact_requirements in Constant Contact 6.2
Same name and namespace in other branches
- 6.3 constant_contact.install \constant_contact_requirements()
- 7.3 constant_contact.install \constant_contact_requirements()
Implementation of hook_requirements(). This helps admin know if the module is functioning correctly. Adds status report to the admin area.
File
- ./
constant_contact.install, line 28
Code
function constant_contact_requirements($phase) {
$requirements = array();
// try to change the allow_url_fopen setting
@ini_get('allow_url_fopen', 1);
if ($phase == 'runtime') {
// running the module...
$details = constant_contact_check_details();
if ($details) {
$requirements['constant_contact'] = array(
'value' => t('Configured'),
'severity' => REQUIREMENT_OK,
'description' => t('The Constant Contact account settings have been configured'),
);
}
else {
$requirements['constant_contact'] = array(
'value' => t('Not configured'),
'severity' => REQUIREMENT_ERROR,
'description' => t('The Constant Contact account settings have not been configured, <a href="@settings">configure now</a>', array(
'@settings' => url('admin/constant_contact/settings'),
)),
);
}
$requirements['constant_contact']['title'] = t('Constant Contact');
}
else {
// installing...
if (!extension_loaded('xml')) {
$requirements['xml'] = array(
'value' => t('XML extension Not installed'),
'severity' => REQUIREMENT_ERROR,
'description' => t('The XML extension for PHP is missing or outdated. Please check the PHP XML documentation for information on how to correct this.'),
);
$requirements['xml']['title'] = t('Constant Contact');
}
if (!extension_loaded('openssl')) {
$requirements['openssl'] = array(
'value' => t('openssl extension Not installed'),
'severity' => REQUIREMENT_ERROR,
'description' => t('The openssl extension for PHP is missing or outdated. Please check the PHP openssl documentation for information on how to correct this.'),
);
$requirements['openssl']['title'] = t('Constant Contact');
}
if (!ini_get('allow_url_fopen')) {
$requirements['allow_url_fopen'] = array(
'value' => t('allow_url_fopen setting Not enabled'),
'severity' => REQUIREMENT_ERROR,
'description' => t('The allow_url_fopen setting is not enabled in your php.ini config file'),
);
$requirements['allow_url_fopen']['title'] = t('Constant Contact');
}
}
return $requirements;
}