function get_all_html_files($path) { $html_files = array(); $path = rtrim(str_replace("\\", "/", $path), '/') . '/'; $entries = array(); $dir = dir($path); while (false !== ($entry = $dir->read())) { $entries[] = $entry; } $dir->close(); foreach ($entries as $entry) { $fullname = $path . $entry; if ($entry != '.' && $entry != '..' && is_dir($fullname)) { $html_files = array_merge($html_files, get_all_html_files($fullname)); } else { if (is_file($fullname) && strcasecmp(substr($fullname, strlen($fullname) - 5), '.html') == 0) { $html_files[$fullname] = get_url_for_html_file($path, $entry); } } } return $html_files; }
function get_website_files($paths) { global $all_settings; $public_html_dir = '/' . get_setting('public_html_dir', $all_settings) . '/'; if (!is_array($paths)) { $paths = array($paths); } $html_files = array(); foreach ($paths as $path) { $path = rtrim(str_replace("\\", "/", $path), '/') . '/'; if (file_exists($path)) { $entries = array(); $dir = dir($path); while (false !== ($entry = $dir->read())) { $entries[] = $entry; } $dir->close(); foreach ($entries as $entry) { $entry1 = strtolower($entry); if (end_with($entry1, 'html') || end_with($entry1, 'htm') || end_with($entry1, 'php')) { $fullname = $path . $entry; if ($entry != '.' && $entry != '..' && is_dir($fullname)) { //$html_files = array_merge($html_files, get_website_files($fullname)); } else { if (is_file($fullname)) { $html_files[$fullname] = get_url_for_html_file($public_html_dir, $path, $entry); } } } } } } return $html_files; }