Projet

Général

Profil

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

root / drupal7 / sites / all / modules / print / print_pdf / lib_handlers / print_pdf_dompdf / print_pdf_dompdf.install @ 76bdcd04

1
<?php
2

    
3
/**
4
 * @file
5
 * Install, update and uninstall functions for the print_pdf_dompdf module.
6
 *
7
 * @ingroup print
8
 */
9

    
10
/**
11
 * Implements hook_uninstall().
12
 */
13
function print_pdf_dompdf_uninstall() {
14
  variable_del('print_pdf_dompdf_unicode');
15
  variable_del('print_pdf_dompdf_font_subsetting');
16
}
17

    
18
/**
19
 * Implements hook_requirements().
20
 */
21
function print_pdf_dompdf_requirements($phase) {
22
  $requirements = array();
23
  $t = get_t();
24
  switch ($phase) {
25
    // On status report page, make sure that a PDF generation tool is selected.
26
    case 'runtime':
27
      $print_pdf_pdf_tool = variable_get('print_pdf_pdf_tool', PRINT_PDF_PDF_TOOL_DEFAULT);
28
      if (!empty($print_pdf_pdf_tool)) {
29
        $tool = explode('|', $print_pdf_pdf_tool);
30
        $version = print_pdf_dompdf_pdf_tool_version($tool[1]);
31

    
32
        // If version is older than 0.6.2, raise warning, except if if is
33
        // disabled in config.
34
        if ((version_compare($version, '0.6.2', '<')) && !variable_get('print_pdf_dompdf_secure_06', FALSE)) {
35
          $requirements['print_pdf_dompdf'] = array(
36
            'title' => $t('dompdf library'),
37
            'value' => $t('Possibly insecure release'),
38
            'description' => $t("dompdf versions prior to 0.6.2 are insecure. Make sure you run at least dompdf 0.6.2. If you are running dompdf 0.6.2, set print_pdf_dompdf_secure_06 to TRUE in settings.php to hide this warning."),
39
            'severity' => REQUIREMENT_WARNING,
40
          );
41
        }
42
      }
43
      break;
44
  }
45
  return $requirements;
46
}