current()->getPathname(), 4); return ($this->current()->isDir() && !isset($components[2])) || (isset($components[2]) && $components[2] === 'pages'); } }; $iterator = new \RecursiveIteratorIterator($filter); $isHttps = isHttps(); foreach ($iterator as $info) { if ($info->isFile()) { [, $year,, $page] = explode('/', $info->getPathname(), 4); if (str_ends_with($page, '.pg') && !str_starts_with($page, 'cs/error/') && !str_starts_with($page, 'en/error/') && !str_starts_with($page, 'de/error/')) { $file = substr($page, 0, -3); $file = preg_replace('(/main$)', '/', $file); echo ($isHttps ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/' . $year . '/' . $file . "\n"; } } }