You are here

function nivo_slider_uninstall in Nivo Slider 7

Same name and namespace in other branches
  1. 8 nivo_slider.install \nivo_slider_uninstall()

Implements hook_uninstall().

File

./nivo_slider.install, line 11
Install, update and uninstall functions for the Nivo Slider module.

Code

function nivo_slider_uninstall() {

  // Get the current slider settings
  $slides = variable_get('nivo_slider_banner_settings', array());

  // Delete all of the slide images
  foreach ($slides as $slide) {

    // Check if the slide has a file ID
    if (isset($slide['fid'])) {

      // Load the file that corresponds to the file ID
      $file_object = file_load($slide['fid']);

      // Delete the file
      if ($file_object) {
        file_delete($file_object);
      }
    }
  }

  // Delete the folder the slider images were contained in
  $banner_folder = 'public://banner/';
  file_unmanaged_delete_recursive($banner_folder);

  // Remove slide variables
  variable_del('nivo_slider_banner_settings');
  variable_del('nivo_slider_banner_html_captions');

  // Remove option variables
  variable_del('nivo_slider_theme');
  variable_del('nivo_slider_image_style');
  variable_del('nivo_slider_image_style_slide');
  variable_del('nivo_slider_image_style_thumb');
  variable_del('nivo_slider_random_start');
  variable_del('nivo_slider_start_slide');
  variable_del('nivo_slider_effect');
  variable_del('nivo_slider_slices');
  variable_del('nivo_slider_box_columns');
  variable_del('nivo_slider_box_rows');
  variable_del('nivo_slider_animation_speed');
  variable_del('nivo_slider_pause_on_hover');
  variable_del('nivo_slider_directional_navigation');
  variable_del('nivo_slider_next_text');
  variable_del('nivo_slider_previous_text');
  variable_del('nivo_slider_control_navigation');
  variable_del('nivo_slider_control_nav_thumbs');
  variable_del('nivo_slider_manual_advance');
  variable_del('nivo_slider_pause_time');
  variable_del('nivo_slider_dir_name');
}