コード例 #1
0
function find_files($path, Queue &$result)
{
    $files = SysDirectory::getFiles($path);
    $iterator =& $files->getIterator();
    while ($iterator->hasNext()) {
        $entry =& $iterator->next();
        if ('php' == $entry->getExtension()) {
            if (!$result->contains($entry)) {
                $result->enqueue($entry);
            }
        }
    }
    $dirs = SysDirectory::getDirectories($path);
    if ($dirs->size() > 0) {
        $iterator =& $dirs->getIterator();
        while ($iterator->hasNext()) {
            $entry =& $iterator->next();
            /*
                    if ( $entry->getName() != '.' && $entry->getName() != '..' )
                      find_files( (string)$entry, $result );
            */
        }
    }
}
コード例 #2
0
ファイル: index.php プロジェクト: gotnospirit/php-dpat
<?php

require 'c.system.php';
System::import('System.Context.HttpContext');
System::import('System.IO.SysDirectory');
System::import('System.IO.SysFile');
$context =& new HttpContext();
$tmpfile = new SysFile($context->getParam('SCRIPT_FILENAME'));
$files = SysDirectory::getFiles($tmpfile->getDirectoryName());
$items = array();
if (count($files) > 0) {
    $iterator =& $files->getIterator();
    while ($iterator->hasNext()) {
        $file = $iterator->next();
        if ('php' == $file->getExtension()) {
            $filename = $file->getFilename();
            $matches = array();
            preg_match('|([a-z0-9_]+)\\-([a-z0-9_]+)\\-loader|', $filename, $matches);
            if (count($matches) > 0) {
                $type = ucfirst($matches[1]);
                if (!array_key_exists($type, $items)) {
                    $items[$type] = array();
                }
                $items[$type][$filename] = ucfirst($matches[2]);
            }
        }
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">