function combineFile($filePath) { global $loadedFileList, $treeContentList, $treeIndex, $contentList, $t; $fileContent = getFileContent($filePath); $loadedFileList[$filePath] = $filePath; $treeContentList[] = str_repeat(' | ', $treeIndex) . ' +---- ' . $filePath; $treeIndex++; foreach ($fileContent as $key => $value) { $matchFile = findImport($value, $t); if ($matchFile != '') { if (@$loadedFileList[$matchFile] == null) { combineFile($matchFile); $contentList[] = "\n"; } } else { $contentList[] = $value; } } $treeIndex--; }
function packFile($dir) { $newdir = analyseDir($dir); if (!$newdir) { return; } //print '//'.$newdir."\n"; $f = openFile($newdir); global $CORELIST; global $bindjs; foreach ($f as $i => $k) { $newLine = findImport($k); //echo $newLine; $isHasMethod = 0; if ($newLine) { foreach ($CORELIST as $y) { if ($y == $newLine) { $isHasMethod = 1; break; } } if ($isHasMethod == 0) { array_push($CORELIST, $newLine); // print($newLine); //$o = analyseDir($newLine); // print($o); if ($newLine) { packFile($newLine); } else { return array_push($CORELIST, '这里打包出错'); } } } else { array_push($bindjs, $k); if ($i == count($f) - 1) { array_push($bindjs, "\n"); } } } }