function photoswipe_requirements in PhotoSwipe 7.2
Same name and namespace in other branches
- 8.2 photoswipe.install \photoswipe_requirements()
- 8 photoswipe.install \photoswipe_requirements()
- 6 photoswipe.install \photoswipe_requirements()
- 7 photoswipe.install \photoswipe_requirements()
- 3.x photoswipe.install \photoswipe_requirements()
Implements hook_requirements().
File
- ./
photoswipe.install, line 22 - Install, uninstall and update hooks for Photswipe module.
Code
function photoswipe_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
$t = get_t();
$library = libraries_detect('photoswipe');
$error_type = isset($library['error']) ? drupal_ucfirst($library['error']) : '';
$error_message = isset($library['error message']) ? $library['error message'] : '';
if (empty($library['installed'])) {
$requirements['photoswipe_plugin'] = array(
'title' => $t('Photoswipe plugin'),
'value' => $t('@e: At least @a', array(
'@e' => $error_type,
'@a' => PHOTOSWIPE_MIN_PLUGIN_VERSION,
)),
'severity' => REQUIREMENT_ERROR,
'description' => $t('!error You need to download the !photoswipe, extract the archive and place the photoswipe directory in the %path directory on your server.', array(
'!error' => $error_message,
'!photoswipe' => l($t('Photoswipe plugin'), $library['download url']),
'%path' => 'sites/all/libraries',
)),
);
}
elseif (version_compare($library['version'], PHOTOSWIPE_MIN_PLUGIN_VERSION, '>=')) {
$requirements['photoswipe_plugin'] = array(
'title' => $t('Photoswipe plugin'),
'severity' => REQUIREMENT_OK,
'value' => $library['version'],
);
}
else {
$requirements['photoswipe_plugin'] = array(
'title' => $t('Photoswipe plugin'),
'value' => $t('At least @a', array(
'@a' => PHOTOSWIPE_MIN_PLUGIN_VERSION,
)),
'severity' => REQUIREMENT_ERROR,
'description' => $t('You need to download a later version of the !photoswipe and replace the old version located in the %path directory on your server.', array(
'!photoswipe' => l($t('Photoswipe plugin'), $library['download url']),
'%path' => $library['library path'],
)),
);
}
// Check for the minimum required jQuery version.
$jquery_version = variable_get('jquery_update_jquery_version', '1.10');
if (!version_compare($jquery_version, '1.7', '>=')) {
$requirements['photoswipe_plugin'] = array(
'description' => $t('Incorrect jQuery version detected. Photoswipe requires jQuery 1.7 or higher. Please change your <a href="!settings">jQuery Update settings</a>.', array(
'!settings' => url('admin/config/development/jquery_update'),
)),
'severity' => REQUIREMENT_ERROR,
'value' => $t('Not installed. Please enable jQuery 1.7 or higher.'),
'title' => $t('Photoswipe plugin'),
);
}
}
return $requirements;
}