/** * Copyright (c) 2012 Robin Appelman <*****@*****.**> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ function loadDirectory($path) { if ($dh = opendir($path)) { while ($name = readdir($dh)) { if ($name[0] !== '.') { $file = $path . '/' . $name; if (is_dir($file)) { loadDirectory($file); } elseif (substr($name, -4, 4) === '.php') { require_once $file; } } } } }
function loadDirectory($dir) { $files = scandir($dir); foreach ($files as $file) { if ($file == '.' || $file == '..') { continue; } if (is_dir($dir . '/' . $file)) { loadDirectory($dir . '/' . $file); } else { $file_parts = pathinfo($dir . '/' . $file); if ($file_parts['extension'] == 'php') { require_once $dir . '/' . $file; } } } }
function loadDirectory($dir, $dir_name) { $array = array(); if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if ($file == "." || $file == "..") { continue; } if (is_dir("{$dir}/{$file}")) { $recursive = loadDirectory("{$dir}/{$file}", $dir_name); foreach ($recursive as $rfile => $rhash) { $array[$rfile] = $rhash; } } else { $fname = substr("{$dir}/{$file}", strlen($dir_name) + 1); $array[$fname] = md5_file("{$dir}/{$file}"); } } } } return $array; }
<?php require_once "config.php"; require_once "functions.php"; ?> <html> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>EXGALLERY</title> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"> </head> <body> <h1>GALLERIA</h1> <?php $lista_file = loadDirectory(DIR_IMMAGINI); ?> </body> </html>