function build($buildFiles, $outputDir) { global $createdGroups; global $verbose; if ($buildFiles) { // groupName = "sidecar", "portal", etc. foreach ($buildFiles as $groupName => $fileList) { $createdGroups[] = $groupName; buildFile($outputDir, $groupName . ".js", $fileList, false); buildFile($outputDir, $groupName . ".min.js", $fileList, true); if ($verbose) { _lintFiles($fileList); } } } else { echo "You do not appear to have include-manifest.php or we were unable to parse it."; exit(1); } }
<?php include '_header.php'; $update = getUpdate($_GET['file']); $teaserblocks = $update['page']->keyExists('teaserblocks') ? $update['page']->fetch('teaserblocks') : null; if ($_POST) { $file = buildFile(); $newFileName = getFileName($_POST['date'], $_POST['title']); // delete current Markdown file unlink($updates_dir . $_GET['file']); // write new Markdown file file_put_contents($updates_dir . $newFileName, $file); chmod($updates_dir . $newFileName, 0777); //echo "<textarea style='width: 100%; height: 500px;'>"; //echo $file; //echo "</textarea>"; echo "<script>location.href = location.pathname + '?file=" . $newFileName . "';</script>"; } ?> <form action="" method="post"> <fieldset> <legend>Metadata</legend> <div> <label for="published">Published</label> <div> <input type="radio" name="published" value="true" <?php if ($update['page']->fetch('published')) { echo "checked"; } ?>
function buildDir($dir) { global $filesToBuild; global $ext; $files = preg_grep('/^([^.])/', scandir($dir)); //过滤隐藏文件 foreach ($files as $idx => $item) { if (!is_dir($dir . DS . $item)) { //file $filePath = $dir . DS . $item; if (preg_match("/" . $ext . "/", $filePath) && !isExcluded($filePath)) { //只替换ext文件类型 buildFile($filePath); } } else { buildDir($dir . DS . $item); } } }