You are here

function views_nivo_slider_list_themes in Views Nivo Slider 7.3

List the available themes.

1 call to views_nivo_slider_list_themes()
views_nivo_slider_style_plugin::get_style_options in ./views_nivo_slider_style_plugin.inc

File

./views_nivo_slider.module, line 260
The implementation of Views Nivo Slider module.

Code

function views_nivo_slider_list_themes() {
  static $themes;
  if (isset($themes)) {
    return $themes;
  }
  $themes = array();
  if (module_exists('libraries')) {
    $dir = libraries_get_path('nivo-slider') . '/themes';
    if (!empty($dir) && $dir != NULL) {
      if (is_dir($dir)) {
        if ($handle = opendir($dir)) {
          while (FALSE !== ($filename = readdir($handle))) {
            if ($filename[0] != '.') {
              $uri = "{$dir}/{$filename}";
              $uri = file_stream_wrapper_uri_normalize($uri);
              if (is_dir($uri)) {
                $themes[drupal_strtolower($filename)] = t(drupal_ucfirst($filename));
              }
            }
          }
        }
      }
      natcasesort($themes);
    }
  }

  // Insert None into the head
  array_splice($themes, 0, 0, array(
    'none' => t('None'),
  ));
  return $themes;
}