print.install in Printer, email and PDF versions 5.3
Same filename and directory in other branches
Install file of the print module
File
print.installView source
<?php
/**
* @file
* Install file of the print module
*/
/**
* Implementation of hook_install().
*/
function print_install() {
$t = get_t();
drupal_set_message($t('Printer-friendly Page settings are available under !link', array(
'!link' => l('Administer > Site configuration > Printer-friendly Pages ', 'admin/settings/print'),
)));
}
/**
* Implementation of hook_uninstall().
*/
function print_uninstall() {
variable_del('print_settings');
variable_del('print_display_comment');
variable_del('print_sourceurl_settings');
variable_del('print_robot_settings');
variable_del('print_logo_url');
variable_del('print_logo_options');
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_link_pos');
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');
$settings = db_query("SELECT name FROM {variable} WHERE name LIKE 'print\\_display\\_%'");
while ($variable = db_fetch_object($settings)) {
variable_del($variable->name);
}
}
/**
* Update to version 5.x-3.6
*/
function print_update_5300() {
global $conf;
$ret = array();
if (isset($conf['print_settings'])) {
$print_settings = variable_get('print_settings', '');
$print_settings['node_link_visibility'] = 0;
$print_settings['node_link_pages'] = '';
$print_settings['link_class'] = 'print-page';
$print_settings['sys_link_visibility'] = $print_settings['show_sys_link'] ? 0 : 1;
$print_settings['sys_link_pages'] = '';
$oldwindow = $print_settings['newwindow'];
$print_settings['newwindow'] = 1;
$print_settings['new_window'] = 0;
switch ($oldwindow) {
case 1:
// Use HTML target
$print_settings['newwindow'] = 0;
// no break on purpose
case 2:
// Use Javascript
$print_settings['new_window'] = 1;
break;
case 3:
// Use Greybox Redux
$print_settings['link_class'] .= ' ' . variable_get('greybox_class_text', 'greybox');
break;
case 4:
// Use Thickbox
$print_settings['link_class'] .= ' thickbox';
break;
}
unset($print_settings['show_sys_link']);
variable_set('print_settings', $print_settings);
}
if (isset($conf['print_robot_settings'])) {
$robots_settings = variable_get('print_robot_settings', '');
unset($robots_settings['nocache']);
variable_set('print_robot_settings', $robots_settings);
}
return $ret;
}
/**
* Update to version 5.x-3.7
*/
function print_update_5301() {
global $conf;
$ret = array();
if (isset($conf['print_settings'])) {
$print_settings = variable_get('print_settings', '');
variable_set('print_logo_options', $print_settings['logo_url'] ? 2 : 1);
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_set('print_html_link_pos', array(
'link' => $print_settings['show_link'] ? 'link' : 0,
));
variable_set('print_html_show_link', max(1, $print_settings['show_link']));
variable_set('print_html_node_link_visibility', $print_settings['node_link_visibility']);
variable_set('print_html_node_link_pages', $print_settings['node_link_pages']);
variable_set('print_html_link_class', $print_settings['link_class']);
variable_set('print_html_sys_link_visibility', $print_settings['sys_link_visibility']);
variable_set('print_html_sys_link_pages', $print_settings['sys_link_pages']);
variable_set('print_html_book_link', $print_settings['book_link']);
variable_set('print_html_new_window', $print_settings['new_window']);
variable_set('print_html_sendtoprinter', $print_settings['sendtoprinter']);
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_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;
}
Functions
Name | Description |
---|---|
print_install | Implementation of hook_install(). |
print_uninstall | Implementation of hook_uninstall(). |
print_update_5300 | Update to version 5.x-3.6 |
print_update_5301 | Update to version 5.x-3.7 |