function webifyDirectory($directory, $edition)
{
    $toc = getSubstring(file_get_contents($directory . DIRECTORY_SEPARATOR . 'index.html'), '<dl>', '</dl>', TRUE, TRUE, TRUE);
    $_editions = '';
    $editions = array('en' => array('3.5', '3.4'), 'ja' => array('3.5', '3.4'));
    foreach ($editions as $language => $versions) {
        foreach ($versions as $version) {
            if ($language . '-' . $version == $edition) {
                $active = ' class="active"';
            } else {
                $active = '';
            }
            switch ($language) {
                case 'en':
                    $_language = 'English';
                    break;
                case 'ja':
                    $_language = 'Japanese';
                    break;
                case 'de':
                    $_language = 'German';
                    break;
            }
            $_editions .= sprintf('<li><a href="http://www.phpunit.de/manual/%s/%s/index.html"%s>PHPUnit %s <span><small>%s</small></span></a></li>', $version, $language, $active, $version, $_language);
        }
    }
    foreach (new HTMLFilterIterator(new DirectoryIterator($directory)) as $file) {
        webifyFile($file->getPathName(), $toc, $_editions);
    }
}
function webifyDirectory($properties, $directory, $edition)
{
    $toc = getSubstring(file_get_contents($directory . DIRECTORY_SEPARATOR . 'index.html'), '<dl>', '</dl>', TRUE, TRUE, TRUE);
    $_editions = '';
    $editions = $properties['editions'];
    foreach ($editions as $language => $versions) {
        foreach ($versions as $version) {
            if ($language . '-' . $version == $edition) {
                $active = ' class="active"';
            } else {
                $active = '';
            }
            switch ($language) {
                case 'en':
                    $_language = 'English';
                    break;
                case 'ja':
                    $_language = 'Japanese';
                    break;
                case 'de':
                    $_language = 'German';
                    break;
            }
            $_editions .= sprintf('<li><a href="../%s-%s/index.html"%s>%s %s <span><small>%s</small></span></a></li>', $version, $language, $active, $properties['longName'], $version, $_language);
        }
    }
    foreach (new HTMLFilterIterator(new DirectoryIterator($directory)) as $file) {
        webifyFile($file->getPathName(), $toc, $_editions);
    }
}