shariff.install in Shariff Social Media Buttons 7
Same filename and directory in other branches
Install, update and uninstall functions for the shariff module.
File
shariff.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the shariff module.
*/
/**
* Implements hook_uninstall().
*/
function shariff_uninstall() {
variable_del('shariff_services');
variable_del('shariff_backend_url');
variable_del('shariff_theme');
variable_del('shariff_css');
variable_del('shariff_orientation');
variable_del('shariff_referrer_track');
variable_del('shariff_twitter_via');
variable_del('shariff_mail_subject');
variable_del('shariff_mail_body');
variable_del('shariff_flattr_category');
variable_del('shariff_flattr_user');
variable_del('shariff_media_url');
}
/**
* Implements hook_requirements().
*/
function shariff_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
$t = get_t();
$library_shariff = libraries_detect('shariff');
$jquery_version = variable_get('jquery_update_jquery_version', '1.10');
if ($library_shariff['installed'] != TRUE) {
$requirements['shariff_lib'] = array(
'title' => $t('Shariff Libray'),
'value' => $t('Please download at least v1.4.6 of the !link library and place it in libraries under <code>shariff</code>. So that the js file is available under .../libraries/shariff/build/shariff.min.js.', array(
'!link' => l($t('Shariff'), $library_shariff['download url']),
)),
'severity' => REQUIREMENT_ERROR,
);
}
if (version_compare($jquery_version, 1.7, '<')) {
$requirements['shariff_jquery'] = array(
'title' => $t('Shariff jQuery'),
'value' => $t('Shariff requires jQuery 1.7 or higher. Please configure jQuery Update accordingly.'),
'severity' => REQUIREMENT_ERROR,
);
drupal_set_message($t('Shariff requires jQuery 1.7 or higher. Please configure jQuery Update accordingly.'), 'error');
}
if (count($requirements) == 0) {
$requirements['shariff'] = array(
'title' => $t('Shariff Library'),
'value' => $library_shariff['version'],
'severity' => REQUIREMENT_OK,
);
}
}
return $requirements;
}
/**
* Implements hook_field_schema().
*/
function shariff_field_schema($field) {
$columns = array(
'value' => array(
'type' => 'int',
'not null' => FALSE,
),
);
return array(
'columns' => $columns,
);
}
/**
* Remove unused variables.
*/
function shariff_update_7000() {
variable_del('shariff_url');
}
Functions
Name | Description |
---|---|
shariff_field_schema | Implements hook_field_schema(). |
shariff_requirements | Implements hook_requirements(). |
shariff_uninstall | Implements hook_uninstall(). |
shariff_update_7000 | Remove unused variables. |