You are here

function _dir_scan_directory in Views Slideshow: Dynamic Display Block 6.2

Same name and namespace in other branches
  1. 7.2 views_slideshow_ddblock.views_slideshow.inc \_dir_scan_directory()

Get the sub directories, starting with the mapping string, of a directory.

Parameters

$dir: directory.

$mapping: the start characters of the directory

Return value

An array of directories.

2 calls to _dir_scan_directory()
views_slideshow_ddblock_views_slideshow_options_form in ./views_slideshow_ddblock.views_slideshow.inc
Implements hook_views_slideshow_options_form().
_views_slideshow_ddblock_get_template_size in ./views_slideshow_ddblock.views_slideshow.inc
Get theme sizes of a theme.

File

./views_slideshow_ddblock.views_slideshow.inc, line 1005
The default options available with Views Slideshow: ddblock.

Code

function _dir_scan_directory($dir, $mapping = '') {
  $dirs = array();
  if (is_dir($dir) && ($handle = opendir($dir))) {
    while ($file = readdir($handle)) {
      if ($file[0] != '.') {
        if (is_dir("{$dir}/{$file}")) {
          if (!empty($mapping)) {
            if (substr($file, 0, 3) == $mapping) {

              // add dir.
              $dirs[] = $file;
            }
          }
          else {

            // add dir.
            $dirs[] = $file;
          }
        }
      }
    }
    closedir($handle);
  }
  return $dirs;
}