Projet

Général

Profil

Paste
Télécharger (1,83 ko) Statistiques
| Branche: | Révision:

root / htmltest / sites / all / modules / superfish / superfish.install @ a5572547

1
<?php
2

    
3
/**
4
 * @file
5
 * Install, update and uninstall functions for the Superfish module.
6
 */
7

    
8
/**
9
 * Implements hook_uninstall().
10
 */
11
function superfish_uninstall() {
12
  db_delete('variable')->condition('name', '%%superfish%%', 'LIKE')->execute();
13
  db_delete('block')->condition('module', 'superfish')->execute();
14
}
15

    
16
/**
17
 * Implements hook_enable().
18
 */
19
function superfish_enable() {
20
  drupal_set_message(check_plain('To use Superfish go to the administer blocks page and enable a Superfish block.'));
21
}
22

    
23

    
24
/**
25
 * Implements hook_requirements().
26
 */
27
function superfish_requirements($phase) {
28
  $requirements = array();
29
  if ($phase == 'runtime') {
30
    // Ensure translations do not break at install time
31
    $t = get_t();
32
    $requirements['superfish']['title'] = $t('Superfish library');
33
    if (module_exists('libraries') && function_exists('libraries_get_libraries')) {
34
      $library = libraries_get_libraries();
35
      $superfish_installed = (isset($library['superfish'])) ? TRUE : FALSE;
36
    }
37
    elseif (file_exists('sites/all/libraries/superfish/superfish.js') || file_exists('profiles/' . drupal_get_profile() . '/libraries/superfish/superfish.js')) {
38
      $superfish_installed = TRUE;
39
    }
40
    else {
41
      $superfish_installed = FALSE;
42
    }
43
    if ($superfish_installed) {
44
      $requirements['superfish']['value'] = $t('Installed');
45
      $requirements['superfish']['severity'] = REQUIREMENT_OK;
46
    }
47
    else {
48
      $requirements['superfish']['value'] = $t('Not installed');
49
      $requirements['superfish']['severity'] = REQUIREMENT_ERROR;
50
      $requirements['superfish']['description'] = $t('Please download the Superfish library from !link.', array('!link' => l('http://drupal.org/project/superfish', 'http://drupal.org/project/superfish')));
51
    }
52
  }
53
  return $requirements;
54
}
55

    
56
/**
57
 * Implements hook_update_N().
58
 */
59
function superfish_update_7100() {
60
}