colorbox.install in Colorbox 6
Same filename and directory in other branches
Install, update and uninstall functions for the colorbox module.
File
colorbox.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the colorbox module.
*/
/**
* Implementation of hook_requirements().
*/
function colorbox_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
$t = get_t();
$library_path = colorbox_get_path();
$colorbox_version = colorbox_get_version();
$jquery_version = FALSE;
if (function_exists('jquery_update_get_version')) {
if (version_compare(jquery_update_get_version(), COLORBOX_MIN_JQUERY_VERSION, '>=')) {
$jquery_version = TRUE;
}
}
if (!$jquery_version) {
$requirements['colorbox_jquery_version'] = array(
'title' => $t('Colorbox required jQuery version'),
'value' => $t('Between @a and @b', array(
'@a' => COLORBOX_MIN_JQUERY_VERSION,
'@b' => COLORBOX_MAX_JQUERY_VERSION,
)),
'severity' => REQUIREMENT_ERROR,
'description' => $t('You need to download and install a 6.x-2.0 version of the !jquery_update module.', array(
'!jquery_update' => l(t('jQuery Update'), 'http://drupal.org/project/jquery_update'),
)),
);
}
if (version_compare($colorbox_version, COLORBOX_MIN_PLUGIN_VERSION, '=')) {
$requirements['colorbox_plugin'] = array(
'title' => $t('Colorbox plugin'),
'severity' => REQUIREMENT_OK,
'value' => $colorbox_version,
);
}
else {
$requirements['colorbox_plugin'] = array(
'title' => $t('Colorbox plugin'),
'value' => $t('At least @a', array(
'@a' => COLORBOX_MIN_PLUGIN_VERSION,
)),
'severity' => REQUIREMENT_ERROR,
'description' => $t('You need to download the !colorbox, extract the archive and place the colorbox directory in the %path directory on your server.', array(
'!colorbox' => l($t('Colorbox plugin v1.3.18'), 'http://www.jacklmoore.com/colorbox/colorbox-1.3.18.zip'),
'%path' => $library_path,
)),
);
}
}
return $requirements;
}
/**
* Implementation of hook_uninstall().
*/
function colorbox_uninstall() {
db_query("DELETE FROM {variable} WHERE name LIKE 'colorbox_%'");
}
/**
* Delete the unused colorbox_login_form variabel.
*/
function colorbox_update_6001() {
$ret = array();
variable_del('colorbox_login_form');
return $ret;
}
Functions
Name | Description |
---|---|
colorbox_requirements | Implementation of hook_requirements(). |
colorbox_uninstall | Implementation of hook_uninstall(). |
colorbox_update_6001 | Delete the unused colorbox_login_form variabel. |