print.install 3.93 KB
Newer Older
jcnventura's avatar
jcnventura committed
1 2 3
<?php
// $Id$

jcnventura's avatar
jcnventura committed
4 5 6 7 8
/**
 * @file
 * Install file of the print module
 */

jcnventura's avatar
jcnventura committed
9 10 11 12
/**
 * Implementation of hook_install().
 */
function print_install() {
13 14
  $t = get_t();
  drupal_set_message($t('Printer-friendly Page settings are available under !link',
jcnventura's avatar
jcnventura committed
15 16 17 18
    array( '!link' => l('Administer > Site configuration > Printer-friendly Pages ',  'admin/settings/print' ) )
  ));
}

jcnventura's avatar
jcnventura committed
19 20 21 22 23 24 25 26
/**
 * Implementation of hook_uninstall().
 */
function print_uninstall() {
  variable_del('print_settings');
  variable_del('print_sourceurl_settings');
  variable_del('print_html_settings');
  variable_del('print_robot_settings');
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
  variable_del('print_logo_url');
  variable_del('print_css');
  variable_del('print_urls');
  variable_del('print_comments');
  variable_del('print_newwindow');
  variable_del('print_sourceurl_enabled');
  variable_del('print_sourceurl_date');
  variable_del('print_sourceurl_forcenode');
  variable_del('print_html_show_link');
  variable_del('print_html_node_link_visibility');
  variable_del('print_html_node_link_pages');
  variable_del('print_html_link_class');
  variable_del('print_html_sys_link_visibility');
  variable_del('print_html_sys_link_pages');
  variable_del('print_html_book_link');
  variable_del('print_html_new_window');
  variable_del('print_html_sendtoprinter');
  variable_del('print_robots_noindex');
  variable_del('print_robots_nofollow');
  variable_del('print_robots_noarchive');
jcnventura's avatar
jcnventura committed
47 48 49 50 51
  $settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'print\_display\_%'");
  while ($variable = db_fetch_object($settings)) {
    variable_del($variable->name);
  }
}
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77

/**
 * Update to version 6.x-1.0
 */
function print_update_6000() {
  global $conf;

  $ret = array();
  if (isset($conf['print_settings'])) {
    $print_settings = variable_get('print_settings', '');
    variable_set('print_logo_url', $print_settings['logo_url']);
    variable_set('print_css', $print_settings['css']);
    variable_set('print_urls', $print_settings['urls']);
    variable_set('print_comments', $print_settings['comments']);
    variable_set('print_newwindow', $print_settings['newwindow']);
    variable_del('print_settings');
  }
  if (isset($conf['print_sourceurl_settings'])) {
    $print_sourceurl_settings = variable_get('print_sourceurl_settings', '');
    variable_set('print_sourceurl_enabled', $print_sourceurl_settings['enabled']);
    variable_set('print_sourceurl_date', $print_sourceurl_settings['date']);
    variable_set('print_sourceurl_forcenode', $print_sourceurl_settings['forcenode']);
    variable_del('print_sourceurl_settings');
  }
  if (isset($conf['print_html_settings'])) {
    $print_html_settings = variable_get('print_html_settings', '');
78 79
    variable_set('print_html_link_pos', array('link' => ($print_html_settings['show_link'] ? 'link' : 0) ));
    variable_set('print_html_show_link', max(1, $print_html_settings['show_link']));
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
    variable_set('print_html_node_link_visibility', $print_html_settings['node_link_visibility']);
    variable_set('print_html_node_link_pages', $print_html_settings['node_link_pages']);
    variable_set('print_html_link_class', $print_html_settings['link_class']);
    variable_set('print_html_sys_link_visibility', $print_html_settings['sys_link_visibility']);
    variable_set('print_html_sys_link_pages', $print_html_settings['sys_link_pages']);
    variable_set('print_html_book_link', $print_html_settings['book_link']);
    variable_set('print_html_new_window', $print_html_settings['new_window']);
    variable_set('print_html_sendtoprinter', $print_html_settings['sendtoprinter']);
    variable_del('print_html_settings');
  }
  if (isset($conf['print_robot_settings'])) {
    $print_robot_settings = variable_get('print_robot_settings', '');
    variable_set('print_robots_noindex', $print_robot_settings['noindex']);
    variable_set('print_robots_nofollow', $print_robot_settings['nofollow']);
    variable_set('print_robots_noarchive', $print_robot_settings['noarchive']);
    variable_del('print_robot_settings');
  }
  return $ret;
}