91 lines
No EOL
3 KiB
Text
91 lines
No EOL
3 KiB
Text
<?php
|
|
|
|
/**
|
|
* @file
|
|
* Lexicon module installation functions.
|
|
*/
|
|
|
|
/**
|
|
* Implementation of hook_requirements().
|
|
*/
|
|
function lexicon_requirements($phase) {
|
|
$requirements = array();
|
|
// Ensure translations don't break at install time
|
|
$t = get_t();
|
|
|
|
// check that php is compiled with ctype support
|
|
$requirements['ctype'] = array(
|
|
'title' => $t('Character type functions (ctype)'),
|
|
);
|
|
if (function_exists('ctype_alnum')) {
|
|
$requirements['ctype']['value'] = $t('Enabled');
|
|
$requirements['ctype']['severity'] = REQUIREMENT_OK;
|
|
}
|
|
else {
|
|
$requirements['ctype']['value'] = $t('Disabled');
|
|
$requirements['ctype']['description'] = $t('The Lexicon module requires that you configure PHP with --enable-ctype.');
|
|
$requirements['ctype']['severity'] = REQUIREMENT_ERROR;
|
|
}
|
|
|
|
return $requirements;
|
|
}
|
|
|
|
/**
|
|
* Implementation of hook_install().
|
|
*/
|
|
function lexicon_install() {
|
|
drupal_set_message(t('The Lexicon module has been installed. To use the module you first have to configure it <a href="!settings_uri">here</a>.', array('!settings_uri' => url('admin/settings/lexicon'))));
|
|
}
|
|
|
|
/**
|
|
* Implementation of hook_uninstall().
|
|
* There are no tables, so we delete all variables and clear the filter cache.
|
|
* It is left to the user to dispose of any vocabularies that are no longer needed.
|
|
*/
|
|
function lexicon_uninstall() {
|
|
$vids = variable_get('lexicon_vids', array());
|
|
|
|
//Delete the settings for each Lexicon vocabulary
|
|
foreach ($vids as $vid) {
|
|
variable_del('lexicon_path_' . $vid);
|
|
variable_del('lexicon_title_' . $vid);
|
|
variable_del('lexicon_vids');
|
|
}
|
|
|
|
//Delete the rest of the variables
|
|
variable_del('lexicon_vids');
|
|
variable_del('lexicon_disable_indicator');
|
|
variable_del('lexicon_click_option');
|
|
variable_del('lexicon_show_edit');
|
|
variable_del('lexicon_show_search');
|
|
variable_del('lexicon_go_to_top_link');
|
|
variable_del('lexicon_go_to_top_link_fragment');
|
|
variable_del('lexicon_local_links_scroll');
|
|
variable_del('lexicon_page_per_letter');
|
|
variable_del('lexicon_seperate_letters');
|
|
variable_del('lexicon_allow_no_description');
|
|
variable_del('lexicon_show_description');
|
|
variable_del('lexicon_show_detailed');
|
|
variable_del('lexicon_link_related');
|
|
variable_del('lexicon_link_related_how');
|
|
variable_del('lexicon_term_class');
|
|
variable_del('lexicon_mark_terms');
|
|
variable_del('lexicon_match');
|
|
variable_del('lexicon_case');
|
|
variable_del('lexicon_replace_all');
|
|
variable_del('lexicon_blocking_tags');
|
|
variable_del('lexicon_link');
|
|
variable_del('lexicon_replace');
|
|
variable_del('lexicon_superscript');
|
|
variable_del('lexicon_icon');
|
|
variable_del('lexicon_alphabet');
|
|
variable_del('lexicon_digits');
|
|
variable_del('lexicon_suppress_unused');
|
|
variable_del('lexicon_alphabar_separator');
|
|
variable_del('lexicon_alphabar_instruction');
|
|
|
|
// Let's make sure the filter cache is cleared of our stuff.
|
|
cache_clear_all(NULL, 'cache_filter');
|
|
|
|
drupal_set_message(t('The Lexicon module has been uninstalled. You will still need to decide what to do with vocabularies that were used.'), 'warning');
|
|
} |