Projet

Général

Profil

Paste
Télécharger (6,63 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / lightbox2 / lightbox2.install @ f0456308

1
<?php
2
// $Id: lightbox2.install,v 1.1.4.4.2.49 2010/09/22 17:26:19 snpower Exp $
3

    
4
/**
5
 * @file
6
 * Installation functions for Lightbox2.
7
 */
8

    
9
/**
10
 * Implementation of hook_install().
11
 */
12
function lightbox2_install() {
13
  module_invoke('content', 'clear_type_cache');
14
}
15

    
16
/**
17
 * Implementation of hook_uninstall().
18
 */
19
function lightbox2_uninstall() {
20
  // Delete the variables we created.
21
  variable_del('lightbox2_plus');
22
  variable_del('lightbox2G2_filter');
23

    
24
  // Remove the general settings.
25
  variable_del('lightbox2_lite');
26
  variable_del('lightbox2_use_alt_layout');
27
  variable_del('lightbox2_force_show_nav');
28
  variable_del('lightbox2_loop_items');
29
  variable_del('lightbox2_image_count_str');
30
  variable_del('lightbox2_page_count_str');
31
  variable_del('lightbox2_video_count_str');
32
  variable_del('lightbox2_disable_resize');
33
  variable_del('lightbox2_disable_zoom');
34
  variable_del('lightbox2_enable_login');
35
  variable_del('lightbox2_enable_contact');
36
  variable_del('lightbox2_enable_video');
37
  variable_del('lightbox2_flv_player_path');
38
  variable_del('lightbox2_flv_player_flashvars');
39
  variable_del('lightbox2_page_init_action');
40
  variable_del('lightbox2_page_list');
41
  variable_del('lightbox2_disable_these_urls');
42
  variable_del('lightbox2_imagefield_group_node_id');
43
  variable_del('lightbox2_imagefield_use_node_title');
44
  variable_del('lightbox2_view_image_text');
45
  variable_del('lightbox2_image_ncck_group_node_id');
46
  variable_del('lightbox2_show_caption');
47
  // Advanced settings.
48
  variable_del('lightbox2_js_location');
49
  variable_del('lightbox2_keys_close');
50
  variable_del('lightbox2_keys_previous');
51
  variable_del('lightbox2_keys_next');
52
  variable_del('lightbox2_keys_zoom');
53
  variable_del('lightbox2_keys_play_pause');
54
  variable_del('lightbox2_top_position');
55
  variable_del('lightbox2_border_size');
56
  variable_del('lightbox2_box_color');
57
  variable_del('lightbox2_font_color');
58
  variable_del('lightbox2_overlay_opacity');
59
  variable_del('lightbox2_overlay_color');
60
  variable_del('lightbox2_disable_close_click');
61
  variable_del('lightbox2_resize_sequence');
62
  variable_del('lightbox2_resize_speed');
63
  variable_del('lightbox2_fadein_speed');
64
  variable_del('lightbox2_slidedown_speed');
65

    
66
  // Remove iframe settings.
67
  variable_del('lightbox2_default_frame_width');
68
  variable_del('lightbox2_default_frame_height');
69
  variable_del('lightbox2_frame_border');
70

    
71
  // Remove slideshow settings.
72
  variable_del('lightbox2_slideshow_interval');
73
  variable_del('lightbox2_slideshow_automatic_start');
74
  variable_del('lightbox2_slideshow_automatic_exit');
75
  variable_del('lightbox2_slideshow_show_play_pause');
76
  variable_del('lightbox2_slideshow_pause_on_next_click');
77
  variable_del('lightbox2_slideshow_pause_on_previous_click');
78
  variable_del('lightbox2_loop_slides');
79

    
80
  // Remove the automatic image handling settings.
81
  variable_del('lightbox2_image_node');
82
  variable_del('lightbox2_display_image_size');
83
  variable_del('lightbox2_trigger_image_size');
84
  variable_del('lightbox2_disable_nested_galleries');
85
  variable_del('lightbox2_flickr');
86
  variable_del('lightbox2_gallery2_blocks');
87
  variable_del('lightbox2_inline');
88
  variable_del('lightbox2_image_assist_custom');
89
  variable_del('lightbox2_custom_class_handler');
90
  variable_del('lightbox2_custom_trigger_classes');
91
  variable_del('lightbox2_node_link_text');
92
  variable_del('lightbox2_download_link_text');
93
  variable_del('lightbox2_node_link_target');
94
  variable_del('lightbox2_show_caption');
95
  variable_del('lightbox2_image_group');
96
  variable_del('lightbox2_disable_nested_acidfree_galleries');
97
  variable_del('lightbox2_acidfree_video');
98
}
99

    
100
/**
101
 * One of the variables was renamed from 'lightbox2_plus' to 'lightbox2_lite'.
102
 *
103
 * Should have been created with lightbox2_update_600x() naming convention, but
104
 * too late now.
105
 */
106
function lightbox2_update_1() {
107
  $ret = array();
108
  $ret[] = update_sql('UPDATE {variable} SET name="lightbox2_lite"
109
    WHERE name="lightbox2_plus";');
110

    
111
  return $ret;
112
}
113

    
114
/**
115
 * 'lightbox2_image_group' variable has been removed and others need to be
116
 * updated accordingly.
117
 *
118
 * Should have been created with lightbox2_update_600x() naming convention, but
119
 * too late now.
120
 */
121
function lightbox2_update_2() {
122
  $image_group = variable_get('lightbox2_image_group', TRUE);
123
  $image_node = variable_get('lightbox2_image_node', TRUE);
124
  $flickr = variable_get('lightbox2_flickr', TRUE);
125
  $gallery2 = variable_get('lightbox2_gallery2_blocks', TRUE);
126
  $inline = variable_get('lightbox2_inline', TRUE);
127
  $image_assist = variable_get('lightbox2_image_assist_custom', TRUE);
128

    
129
  if ($image_group) {
130
    if ($image_node) {
131
      variable_set('lightbox2_image_node', 2);
132
    }
133
    if ($flickr) {
134
      variable_set('lightbox2_flickr', 2);
135
    }
136
    if ($gallery2) {
137
      variable_set('lightbox2_gallery2_blocks', 2);
138
    }
139
    if ($inline) {
140
      variable_set('lightbox2_inline', 2);
141
    }
142
    if ($image_assist) {
143
      variable_set('lightbox2_image_assist_custom', 2);
144
    }
145
  }
146
  variable_del('lightbox2_image_group');
147

    
148
  return array();
149
}
150

    
151
/**
152
 * 'lightbox2_disable_these_urls' was renamed to 'lightbox2_page_list'.
153
 * 'lightbox2_page_init_action' was also added which determines whether the
154
 * lightbox functionality should be enabled or disabled for the page list.
155
 * 'lightbox2_disable_zoom' has been replaced by 'lightbox2_disable_resize'.
156
 * 'lightbox2_disable_zoom' still exists but has a different meaning.
157
 *
158
 * Should have been created with lightbox2_update_600x() naming convention, but
159
 * too late now.
160
 */
161
function lightbox2_update_3() {
162
  $disabled_urls = variable_get('lightbox2_disable_these_urls', '');
163
  variable_set('lightbox2_page_init_action', 'page_disable');
164
  variable_set('lightbox2_page_list', $disabled_urls);
165
  variable_del('lightbox2_disable_these_urls');
166

    
167
  $disable_zoom = variable_get('lightbox2_disable_zoom', FALSE);
168
  variable_set('lightbox2_disable_resize', $disable_zoom);
169
  variable_set('lightbox2_disable_zoom', FALSE);
170

    
171
  return array();
172
}
173

    
174
function lightbox2_update_6001() {
175
  $size = variable_get('lightbox2_display_image_size', 'original');
176
  if ($size == '') {
177
    variable_set('lightbox2_display_image_size', 'original');
178
  }
179
  return array();
180
}
181

    
182
/**
183
 * 'lightbox2_slideshow_pause_on_previous_click' was mis-named as
184
 * 'lightbox2_slideshow_pause_on_prev_click'.
185
 */
186
function lightbox2_update_6002() {
187
  $vars = variable_init();
188
  if (array_key_exists('lightbox2_slideshow_pause_on_prev_click', $vars)) {
189
    $value = $vars['lightbox2_slideshow_pause_on_prev_click'];
190
    variable_set('lightbox2_slideshow_pause_on_previous_click', $value);
191
    variable_del('lightbox2_slideshow_pause_on_prev_click');
192
  }
193
  return array();
194
}
195

    
196
/**
197
 * Menu paths changed.
198
 */
199
function lightbox2_update_6003() {
200
  return array();
201
}
202