Projet

Général

Profil

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

root / htmltest / sites / all / modules / highlightjs / highlight_js.install @ a5572547

1
<?php
2

    
3
/**
4
 * @file
5
 * Install file for Highlight JS library.
6
 *
7
 * @author Juned Kazi
8
 */
9

    
10
/**
11
 * Implements hook_requirements().
12
 */
13
function highlight_js_requirements($phase) {
14
  $requirements = array();
15

    
16
  switch ($phase) {
17

    
18
    case 'install':
19
      // Check to make sure at least Libraries 2.x is installed.
20
      if (!function_exists('libraries_detect')) {
21
        $requirements['highlightjs'] = array(
22
          'title' => t('Libraries'),
23
          'value' => t('1.x'),
24
          'description' => t('Highlight.js requires Libraries 7.x-2.0-alpha1 or higher.'),
25
          'severity' => REQUIREMENT_ERROR,
26
        );
27
      }
28
      break;
29

    
30
    case 'runtime':
31
      // Check to make sure the highlight.js library is available.
32
      $library = libraries_detect('highlightjs');
33
      $requirements['highlightjs'] = array(
34
        'title' => t('Highlight.js'),
35
        'value' => $library['installed'] ? t('Installed') : t('Not installed'),
36
        'description' => isset($library['error message']) ? $library['error message'] : '',
37
        'severity' => $library['installed'] ? REQUIREMENT_OK : REQUIREMENT_ERROR,
38
      );
39
      break;
40
  }
41
  return $requirements;
42
}
43

    
44
/**
45
 * Implementation of hook_uninstall().
46
 */
47
function highlight_js_uninstall() {
48
  variable_del('highlightjs_style');
49
}