getRealPath(); /* check files and directories */ if ($this->isIgnoredPath($filepath)) { continue; } try { /* check only files */ if ($fifo->isFile() && $filterby === 'file' ) { $files[] = $filepath; continue; } /* check only directories */ if ($fifo->isDir() && $filterby === 'directory' ) { $files[] = $filepath; continue; } } catch (RuntimeException $e) { // Skip failure } } sort($files); } return $files; } /** * Ignores files specified by the admins. * * @param string $path Path to the file or directory. * @return bool True if the path has to be ignored. */ private function isIgnoredPath($path) { $shouldBeIgnored = false; $ignored_directories = [ '/wt-security/lib/modules/logs/Scan.php' ]; foreach ($ignored_directories as $ignored) { if (strpos($path, $ignored) !== false) { $shouldBeIgnored = true; break; } } return $shouldBeIgnored; } /** * Returns the content of a file. * * If the file does not exists or is not readable the method will return * false. Make sure that you double check this with a condition using triple * equals in order to avoid ambiguous results when the file exists, is * readable, but is empty. * * @param string $path Relative or absolute path of the file. * @return string Content of the file, false if not accessible. */ public static function fileContent($path = '') { return (string) (is_readable($path) ? @file_get_contents($path) : ''); } }