Exemplo n.º 1
0
function build_theme_loop()
{
    global $config;
    $loop = array();
    $directories = find_all_directories(BASE . '/templates/');
    foreach ($directories as $directory) {
        $name = str_ireplace(BASE . '/templates/', '', $directory);
        if ($name != 'custom_css') {
            $loop[] = array('value' => $name, 'text' => $name, 'selected' => $name == $config['html']['theme']);
        }
    }
    return $loop;
}
Exemplo n.º 2
0
                $directories = array();
            }
            break;
    }
}
/********************************************************************************
 *
 *   Get Footprints and set all HTML variables
 *
 *********************************************************************************/
if (count($directories) > 0) {
    $categories_loop = array();
    $categories = array();
    foreach ($directories as $directory) {
        $categories[] = rtrim($directory, "\\/");
        $categories = array_merge($categories, find_all_directories($directory, true));
    }
    sort($categories);
    foreach ($categories as $category) {
        $pictures_loop = array();
        $pictures = find_all_files($category . '/', false, '.png');
        foreach ($pictures as $filename) {
            $pictures_loop[] = array('title' => str_replace('.png', '', basename($filename)), 'filename' => str_replace(BASE, BASE_RELATIVE, $filename));
        }
        if (count($pictures_loop) > 0) {
            $categories_loop[] = array('category_name' => str_replace(BASE, '', $category), 'pictures_loop' => $pictures_loop);
        }
    }
    $html->set_loop('categories_loop', $categories_loop);
}
/********************************************************************************
Exemplo n.º 3
0
/**
 * @brief Find all subdirectories of a directory (not recursive)
 *
 * @param string    $directory          Path to the directory (IMPORTANT: absolute UNIX path, with slash at the end! see to_unix_path())
 * @param boolean   $recursive          if true, all subdirectories will be listed too
 *
 * @retval array    all found directories (without slashes at the end, incl. absolute UNIX paths, sorted alphabetically)
 *
 * @throws Exception if there was an error
 */
function find_all_directories($directory, $recursive = false)
{
    $directories = array();
    if (!is_dir($directory) || mb_substr($directory, -1, 1) != '/' || !is_path_absolute_and_unix($directory, false)) {
        throw new Exception('"' . $directory . '" ist kein gültiges Verzeichnis!');
    }
    $dirfiles = scandir($directory);
    foreach ($dirfiles as $file) {
        if ($file != "." && $file != ".." && $file != ".svn" && $file != ".git" && is_dir($directory . $file)) {
            $directories[] = $directory . $file;
            if ($recursive) {
                $directories = array_merge($directories, find_all_directories($directory . $file . '/', true));
            }
        }
    }
    return $directories;
}