Beispiel #1
0
function scanFiles($rootDir, $allData = array())
{
    $invisibleFileNames = array(".", "..", ".htaccess", ".htpasswd", "/cache/", "/tmp/", "index.html");
    //$visibleFileNames = array("media");
    $dirContent = scandir($rootDir);
    foreach ($dirContent as $key => $content) {
        $path = $rootDir . '/' . $content;
        if (!in_array($content, $invisibleFileNames) && !in_array("/" . $content . "/", $invisibleFileNames)) {
            if (is_file($path) && is_readable($path)) {
                $allData[] = $path;
            } elseif (is_dir($path) && is_readable($path)) {
                $allData = scanFiles($path, $allData);
            }
        }
    }
    return $allData;
}
/**
 * Scan all files from Magento root
 *
 * @param $path
 * @param array $ignorePath
 * @return array
 */
function scanFiles($path, $ignorePath = [])
{
    global $sampleDataSource;
    $results = [];
    foreach (glob($path . DIRECTORY_SEPARATOR . '*') as $filename) {
        $target = preg_replace('#^' . preg_quote($sampleDataSource) . "#", '', $filename);
        if (!in_array(resolvePath($target), $ignorePath)) {
            $results[] = $filename;
            if (is_dir($filename)) {
                $results = array_merge($results, scanFiles($filename, $ignorePath));
            }
        }
    }
    return $results;
}
                        </a>
                    </p>
                </div>
            </div>
        </div>
        <div class="row external-branding">
            <div class="footer-base-external-branding-left">
                <a href="http://nationalarchives.gov.uk/doc/open-government-licence/">
                    <img src="images/logo-ogl.png" alt="Open Government Licence logo">
                </a>

                <p>
                    All content is available under the <a
                        href="http://nationalarchives.gov.uk/doc/open-government-licence/">
                        Open Government Licence v2.0
                    </a>,
                    <br>
                    except where otherwise stated
                </p>
            </div>
            <div class="footer-base-external-branding-right">
                <a class="footer-base-external-branding-gov-logo-adjust" href="http://gov.uk/"
                   title="External website - opens in a new window" target="_blank">
                    <img src="images/gov-uk.png" alt="GOV.UK logo">
                </a>
            </div>
        </div>
        <h3>Jump to any page</h3>
<?php 
scanFiles();