lightbox2.install 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <?php
  2. // $Id: lightbox2.install,v 1.1.4.4.2.49 2010/09/22 17:26:19 snpower Exp $
  3. /**
  4. * @file
  5. * Installation functions for Lightbox2.
  6. */
  7. /**
  8. * Implementation of hook_install().
  9. */
  10. function lightbox2_install() {
  11. module_invoke('content', 'clear_type_cache');
  12. }
  13. /**
  14. * Implementation of hook_uninstall().
  15. */
  16. function lightbox2_uninstall() {
  17. // Delete the variables we created.
  18. variable_del('lightbox2_plus');
  19. variable_del('lightbox2G2_filter');
  20. // Remove the general settings.
  21. variable_del('lightbox2_lite');
  22. variable_del('lightbox2_use_alt_layout');
  23. variable_del('lightbox2_force_show_nav');
  24. variable_del('lightbox2_loop_items');
  25. variable_del('lightbox2_image_count_str');
  26. variable_del('lightbox2_page_count_str');
  27. variable_del('lightbox2_video_count_str');
  28. variable_del('lightbox2_disable_resize');
  29. variable_del('lightbox2_disable_zoom');
  30. variable_del('lightbox2_enable_login');
  31. variable_del('lightbox2_enable_contact');
  32. variable_del('lightbox2_enable_video');
  33. variable_del('lightbox2_flv_player_path');
  34. variable_del('lightbox2_flv_player_flashvars');
  35. variable_del('lightbox2_page_init_action');
  36. variable_del('lightbox2_page_list');
  37. variable_del('lightbox2_disable_these_urls');
  38. variable_del('lightbox2_imagefield_group_node_id');
  39. variable_del('lightbox2_imagefield_use_node_title');
  40. variable_del('lightbox2_view_image_text');
  41. variable_del('lightbox2_image_ncck_group_node_id');
  42. variable_del('lightbox2_show_caption');
  43. // Advanced settings.
  44. variable_del('lightbox2_js_location');
  45. variable_del('lightbox2_keys_close');
  46. variable_del('lightbox2_keys_previous');
  47. variable_del('lightbox2_keys_next');
  48. variable_del('lightbox2_keys_zoom');
  49. variable_del('lightbox2_keys_play_pause');
  50. variable_del('lightbox2_top_position');
  51. variable_del('lightbox2_border_size');
  52. variable_del('lightbox2_box_color');
  53. variable_del('lightbox2_font_color');
  54. variable_del('lightbox2_overlay_opacity');
  55. variable_del('lightbox2_overlay_color');
  56. variable_del('lightbox2_disable_close_click');
  57. variable_del('lightbox2_resize_sequence');
  58. variable_del('lightbox2_resize_speed');
  59. variable_del('lightbox2_fadein_speed');
  60. variable_del('lightbox2_slidedown_speed');
  61. // Remove iframe settings.
  62. variable_del('lightbox2_default_frame_width');
  63. variable_del('lightbox2_default_frame_height');
  64. variable_del('lightbox2_frame_border');
  65. // Remove slideshow settings.
  66. variable_del('lightbox2_slideshow_interval');
  67. variable_del('lightbox2_slideshow_automatic_start');
  68. variable_del('lightbox2_slideshow_automatic_exit');
  69. variable_del('lightbox2_slideshow_show_play_pause');
  70. variable_del('lightbox2_slideshow_pause_on_next_click');
  71. variable_del('lightbox2_slideshow_pause_on_previous_click');
  72. variable_del('lightbox2_loop_slides');
  73. // Remove the automatic image handling settings.
  74. variable_del('lightbox2_image_node');
  75. variable_del('lightbox2_display_image_size');
  76. variable_del('lightbox2_trigger_image_size');
  77. variable_del('lightbox2_disable_nested_galleries');
  78. variable_del('lightbox2_flickr');
  79. variable_del('lightbox2_gallery2_blocks');
  80. variable_del('lightbox2_inline');
  81. variable_del('lightbox2_image_assist_custom');
  82. variable_del('lightbox2_custom_class_handler');
  83. variable_del('lightbox2_custom_trigger_classes');
  84. variable_del('lightbox2_node_link_text');
  85. variable_del('lightbox2_download_link_text');
  86. variable_del('lightbox2_node_link_target');
  87. variable_del('lightbox2_show_caption');
  88. variable_del('lightbox2_image_group');
  89. variable_del('lightbox2_disable_nested_acidfree_galleries');
  90. variable_del('lightbox2_acidfree_video');
  91. }
  92. /**
  93. * One of the variables was renamed from 'lightbox2_plus' to 'lightbox2_lite'.
  94. *
  95. * Should have been created with lightbox2_update_600x() naming convention, but
  96. * too late now.
  97. */
  98. function lightbox2_update_1() {
  99. $ret = array();
  100. $ret[] = update_sql('UPDATE {variable} SET name="lightbox2_lite"
  101. WHERE name="lightbox2_plus";');
  102. return $ret;
  103. }
  104. /**
  105. * 'lightbox2_image_group' variable has been removed and others need to be
  106. * updated accordingly.
  107. *
  108. * Should have been created with lightbox2_update_600x() naming convention, but
  109. * too late now.
  110. */
  111. function lightbox2_update_2() {
  112. $image_group = variable_get('lightbox2_image_group', TRUE);
  113. $image_node = variable_get('lightbox2_image_node', TRUE);
  114. $flickr = variable_get('lightbox2_flickr', TRUE);
  115. $gallery2 = variable_get('lightbox2_gallery2_blocks', TRUE);
  116. $inline = variable_get('lightbox2_inline', TRUE);
  117. $image_assist = variable_get('lightbox2_image_assist_custom', TRUE);
  118. if ($image_group) {
  119. if ($image_node) {
  120. variable_set('lightbox2_image_node', 2);
  121. }
  122. if ($flickr) {
  123. variable_set('lightbox2_flickr', 2);
  124. }
  125. if ($gallery2) {
  126. variable_set('lightbox2_gallery2_blocks', 2);
  127. }
  128. if ($inline) {
  129. variable_set('lightbox2_inline', 2);
  130. }
  131. if ($image_assist) {
  132. variable_set('lightbox2_image_assist_custom', 2);
  133. }
  134. }
  135. variable_del('lightbox2_image_group');
  136. return array();
  137. }
  138. /**
  139. * 'lightbox2_disable_these_urls' was renamed to 'lightbox2_page_list'.
  140. * 'lightbox2_page_init_action' was also added which determines whether the
  141. * lightbox functionality should be enabled or disabled for the page list.
  142. * 'lightbox2_disable_zoom' has been replaced by 'lightbox2_disable_resize'.
  143. * 'lightbox2_disable_zoom' still exists but has a different meaning.
  144. *
  145. * Should have been created with lightbox2_update_600x() naming convention, but
  146. * too late now.
  147. */
  148. function lightbox2_update_3() {
  149. $disabled_urls = variable_get('lightbox2_disable_these_urls', '');
  150. variable_set('lightbox2_page_init_action', 'page_disable');
  151. variable_set('lightbox2_page_list', $disabled_urls);
  152. variable_del('lightbox2_disable_these_urls');
  153. $disable_zoom = variable_get('lightbox2_disable_zoom', FALSE);
  154. variable_set('lightbox2_disable_resize', $disable_zoom);
  155. variable_set('lightbox2_disable_zoom', FALSE);
  156. return array();
  157. }
  158. function lightbox2_update_6001() {
  159. $size = variable_get('lightbox2_display_image_size', 'original');
  160. if ($size == '') {
  161. variable_set('lightbox2_display_image_size', 'original');
  162. }
  163. return array();
  164. }
  165. /**
  166. * 'lightbox2_slideshow_pause_on_previous_click' was mis-named as
  167. * 'lightbox2_slideshow_pause_on_prev_click'.
  168. */
  169. function lightbox2_update_6002() {
  170. $vars = variable_init();
  171. if (array_key_exists('lightbox2_slideshow_pause_on_prev_click', $vars)) {
  172. $value = $vars['lightbox2_slideshow_pause_on_prev_click'];
  173. variable_set('lightbox2_slideshow_pause_on_previous_click', $value);
  174. variable_del('lightbox2_slideshow_pause_on_prev_click');
  175. }
  176. return array();
  177. }
  178. /**
  179. * Menu paths changed.
  180. */
  181. function lightbox2_update_6003() {
  182. return array();
  183. }