addthis.install in AddThis 7.4
Same filename and directory in other branches
Install, update and uninstall functions for the AddThis module.
File
addthis.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the AddThis module.
*/
// We need some constant values from the AddThis class.
include_once 'classes/AddThis.php';
/**
* Implements hook_field_schema().
*/
function addthis_field_schema($field) {
$schema = array();
if ($field['type'] == AddThis::FIELD_TYPE) {
$columns = array(
'value' => array(
'type' => 'varchar',
'length' => $field['settings']['max_length'],
'not null' => FALSE,
),
);
$schema = array(
'columns' => $columns,
'indexes' => array(),
'foreign keys' => array(),
);
}
return $schema;
}
/**
* Implements hook_uninstall().
*/
function addthis_uninstall() {
variable_del(AddThis::ADDRESSBOOK_ENABLED_KEY);
variable_del(AddThis::BLOCK_WIDGET_TYPE_KEY);
variable_del(AddThis::BOOKMARK_URL_KEY);
variable_del(AddThis::CLICKBACK_TRACKING_ENABLED_KEY);
variable_del(AddThis::CLICK_TO_OPEN_COMPACT_MENU_ENABLED_KEY);
variable_del(AddThis::CO_BRAND_KEY);
variable_del(AddThis::COMPLIANT_508_KEY);
variable_del(AddThis::CUSTOM_CONFIGURATION_CODE_ENABLED_KEY);
variable_del(AddThis::CUSTOM_CONFIGURATION_CODE_KEY);
variable_del(AddThis::ENABLED_SERVICES_KEY);
variable_del(AddThis::EXCLUDED_SERVICES_KEY);
variable_del(AddThis::OPEN_WINDOWS_ENABLED_KEY);
variable_del(AddThis::PROFILE_ID_KEY);
variable_del(AddThis::SERVICES_CSS_URL_KEY);
variable_del(AddThis::SERVICES_JSON_URL_KEY);
variable_del(AddThis::STANDARD_CSS_ENABLED_KEY);
variable_del(AddThis::UI_DELAY_KEY);
variable_del(AddThis::UI_HEADER_BACKGROUND_COLOR_KEY);
variable_del(AddThis::UI_HEADER_COLOR_KEY);
variable_del(AddThis::WIDGET_JS_URL_KEY);
variable_del(AddThis::WIDGET_JS_LOAD_DOMREADY);
variable_del(AddThis::WIDGET_JS_LOAD_ASYNC);
variable_del(AddThis::TWITTER_VIA_KEY);
variable_del(AddThis::TWITTER_TEXT_KEY);
}
/**
* Remove old WIDGET_JS_ASYNC variable.
*/
function addthis_update_7401() {
variable_del('addthis_widget_async');
}
/**
* Remove old addthis_widget_load_type and transform it into new values.
*
* Transform variable in settings for domready and async.
* If value = async set domready TRUE and async TRUE.
* If value = domready set domready TRUE and async FALSE.
* If value = include set domready FALSE and async FALSE.
*/
function addthis_update_7402() {
$load_type = variable_get('addthis_widget_load_type', NULL);
switch ($load_type) {
case 'async':
variable_set(AddThis::WIDGET_JS_LOAD_DOMREADY, TRUE);
variable_set(AddThis::WIDGET_JS_LOAD_ASYNC, TRUE);
break;
case 'domready':
variable_set(AddThis::WIDGET_JS_LOAD_DOMREADY, TRUE);
variable_set(AddThis::WIDGET_JS_LOAD_ASYNC, FALSE);
break;
case 'include':
variable_set(AddThis::WIDGET_JS_LOAD_DOMREADY, FALSE);
variable_set(AddThis::WIDGET_JS_LOAD_ASYNC, FALSE);
break;
default:
variable_set(AddThis::WIDGET_JS_LOAD_DOMREADY, TRUE);
variable_set(AddThis::WIDGET_JS_LOAD_ASYNC, FALSE);
break;
}
variable_del('addthis_widget_load_type');
}
/**
* Remove old TWITTER_TEMPLATE_KEY variable, add default value for
* TWITTER_TEXT_KEY
*/
function addthis_update_7403() {
variable_del('addthis_twitter_template');
}
Functions
Name | Description |
---|---|
addthis_field_schema | Implements hook_field_schema(). |
addthis_uninstall | Implements hook_uninstall(). |
addthis_update_7401 | Remove old WIDGET_JS_ASYNC variable. |
addthis_update_7402 | Remove old addthis_widget_load_type and transform it into new values. |
addthis_update_7403 | Remove old TWITTER_TEMPLATE_KEY variable, add default value for TWITTER_TEXT_KEY |