You are here

function _zenophile_find_sites in Zenophile 7

Same name and namespace in other branches
  1. 6.2 zenophile.module \_zenophile_find_sites()
  2. 6 zenophile.module \_zenophile_find_sites()

List this Drupal installation's site directories.

Return value

An array of directories in the sites directory.

1 call to _zenophile_find_sites()
zenophile_create in ./zenophile.module
Form to create the subtheme. drupal_get_form() callback.

File

./zenophile.module, line 503
Creates Zen subthemes quickly and easily.

Code

function _zenophile_find_sites() {
  $sites = array();
  if ($h = opendir('sites')) {
    while (($site = readdir($h)) !== FALSE) {
      $sitepath = 'sites/' . $site;

      // Don't allow dot files or links for security reasons (redundancy, too)
      if (is_dir($sitepath) && !is_link($sitepath) && $site[0] !== '.') {
        $sites[] = $site;
      }
    }
    closedir($h);
    return drupal_map_assoc($sites);
  }
  else {
    drupal_set_message(t('The <em>sites</em> directory could not be read.'), 'error');
    return array();
  }
}