added in support for showing html page in an iframe.
[project/lightbox2.git] / lightbox2.install
CommitLineData
ac1392ca 1<?php
7bea4c5f 2// $Id$
e6a138f1
SP
3
4/**
e14574de
SP
5 * @file
6 * Installation functions for Lightbox2.
7 */
8
9/**
ee0a41e7 10 * Implementation of hook_install().
1caf161e 11 */
ac1392ca 12function lightbox2_install() {
7b915f93 13 module_invoke('content', 'clear_type_cache');
ac1392ca
SP
14}
15
e6a138f1 16/**
ee0a41e7 17 * Implementation of hook_uninstall().
1caf161e 18 */
ac1392ca 19function lightbox2_uninstall() {
ee0a41e7 20 // Delete the variables we created.
09d4f013 21 variable_del('lightbox2_plus');
59c04a7b 22 variable_del('lightbox2G2_filter');
3e3b4759 23
59c04a7b
SP
24 // Remove the general settings.
25 variable_del('lightbox2_lite');
27f345ed
SP
26 variable_del('lightbox2_use_alt_layout');
27 variable_del('lightbox2_force_show_nav');
3e3b4759
SP
28 variable_del('lightbox2_image_count_str');
29 variable_del('lightbox2_disable_zoom');
59c04a7b
SP
30 variable_del('lightbox2_disable_these_urls');
31 variable_del('lightbox2_imagefield_group_node_id');
d284e1a1
SP
32 variable_del('lightbox2_overlay_opacity');
33 variable_del('lightbox2_js_location');
3e3b4759 34
59c04a7b
SP
35 // Remove slideshow settings.
36 variable_del('lightbox2_slideshow_interval');
37 variable_del('lightbox2_slideshow_automatic_exit');
38 variable_del('lightbox2_slideshow_show_play_pause');
39 variable_del('lightbox2_slideshow_pause_on_next_click');
40 variable_del('lightbox2_slideshow_pause_on_previous_click');
41
42 // Remove the automatic image handling settings.
09d4f013 43 variable_del('lightbox2_image_node');
c571d3bb
SP
44 variable_del('lightbox2_display_image_size');
45 variable_del('lightbox2_trigger_image_size');
59c04a7b 46 variable_del('lightbox2_disable_nested_galleries');
ae2fcbc1 47 variable_del('lightbox2_flickr');
59c04a7b 48 variable_del('lightbox2_gallery2_blocks');
c571d3bb 49 variable_del('lightbox2_inline');
59c04a7b 50 variable_del('lightbox2_image_assist_custom');
c571d3bb 51 variable_del('lightbox2_custom_trigger_classes');
b5b1538e 52 variable_del('lightbox2_node_link_text');
19f4a474 53 variable_del('lightbox2_node_link_target');
59c04a7b 54 variable_del('lightbox2_image_group');
54312d03 55 variable_del('lightbox2_disable_nested_acidfree_galleries');
ac1392ca 56}
e6a138f1 57
23b9eafc 58/**
e14574de
SP
59 * One of the variables was renamed from 'lightbox2_plus' to 'lightbox2_lite'.
60 */
1cadb408
SP
61function lightbox2_update_1() {
62 $ret = array();
63 switch ($GLOBALS['db_type']) {
64 case 'mysql':
65 case 'mysqli':
66 $ret[] = update_sql('UPDATE {variable} SET name="lightbox2_lite"
67 WHERE name="lightbox2_plus";');
68 break;
69
70 case 'pgsql':
71 $ret[] = update_sql('UPDATE {variable} SET name="lightbox2_lite"
72 WHERE name="lightbox2_plus";');
73 break;
74 }
75
76 return $ret;
77}
78
23b9eafc
SP
79/**
80 * 'lightbox2_image_group' variable has been removed and others need to be
81 * updated accordingly.
82 */
83function lightbox2_update_2() {
84 $image_group = variable_get('lightbox2_image_group', TRUE);
85 $image_node = variable_get('lightbox2_image_node', TRUE);
86 $flickr = variable_get('lightbox2_flickr', TRUE);
87 $gallery2 = variable_get('lightbox2_gallery2_blocks', TRUE);
88 $inline = variable_get('lightbox2_inline', TRUE);
89 $image_assist = variable_get('lightbox2_image_assist_custom', TRUE);
1cadb408 90
23b9eafc
SP
91 if ($image_group) {
92 if ($image_node) {
93 variable_set('lightbox2_image_node', 2);
94 }
95 if ($flickr) {
96 variable_set('lightbox2_flickr', 2);
97 }
98 if ($gallery2) {
99 variable_set('lightbox2_gallery2_blocks', 2);
100 }
101 if ($inline) {
102 variable_set('lightbox2_inline', 2);
103 }
104 if ($image_assist) {
105 variable_set('lightbox2_image_assist_custom', 2);
106 }
107 }
108 variable_del('lightbox2_image_group');
109
110 return array();
111}