function splashify_requirements in Splashify 7
Same name and namespace in other branches
- 6 splashify.install \splashify_requirements()
Implements hook_requirements().
Make sure the jStorage library is installed on the site.
File
- ./
splashify.install, line 13 - Handles installing, uninstalling and the requirements for Splashify.
Code
function splashify_requirements($phase) {
$requirements = array();
$t = get_t();
// Make sure we we can access the necessary libraries.
if ($phase == 'runtime') {
// jStorage
$jstorage = libraries_detect('jstorage');
$installed = $jstorage && !empty($jstorage['installed']);
if ($installed) {
// Check PHPMailer file integrity.
$path = DRUPAL_ROOT . '/' . $jstorage['library path'] . '/';
$file_integrity = file_exists($path . 'jstorage.min.js');
if (!$file_integrity) {
$requirements['splashify_jstorage_integrity'] = array(
'title' => $t('Splashify library file integrity'),
'description' => $t('Cannot find the file "jstorage.min.js".'),
'value' => '',
'severity' => REQUIREMENT_ERROR,
);
}
}
else {
$requirements['splashify_jstorage'] = array(
'title' => $t('Splashify'),
'description' => $t('The jStorage library could not be found. See the README.txt file for more information.'),
'value' => '',
'severity' => REQUIREMENT_ERROR,
);
}
// Mobile Detect
$is_mobile_enabled = variable_get('splashify_when_mobile', 0);
if ($is_mobile_enabled) {
// Verify the Mobile Detect library is installed.
$mobile_detect = libraries_load('Mobile_Detect');
if (!$mobile_detect['installed']) {
$requirements['splashify_Mobile_Detect'] = array(
'title' => $t('Splashify'),
'description' => $t('Mobile splash is enabled, but could not find the Mobile Detect library. See the readme.'),
'value' => '',
'severity' => REQUIREMENT_ERROR,
);
}
}
}
return $requirements;
}