function getSrcOnlyFile($src, $test, $path = '') { $result = array(); $as = listFile($src . $path); $ts = listFile($test . $path); foreach ($as as $item) { $si = $src . $path . $item; $ti = $test . $path . $item; if (is_dir($si) && is_dir($ti)) { $result = array_merge($result, getSrcOnlyFile($src, $test, $path . $item . '/')); } else { if (is_file($si) && !is_file($ti)) { if (substr($si, -3) == '.js') { array_push($result, $path . $item); } } else { // print("error : $si"); } } } return $result; }
public static function listSrcOnly($print = true, $projroot = '../../../') { $srcpath = $projroot . 'src/'; $testpath = $projroot . 'test/'; require_once 'filehelper.php'; $caselist = getSameFile($srcpath, $testpath, ''); $srclist = getSrcOnlyFile($srcpath, $testpath, ''); $srcList = array(); foreach ($srclist as $case) { if (in_array($case, $caselist)) { continue; } $name = str_replace('/', '.', substr($case, 0, -3)); $tag = "<a class=\"jsframe_qunit\" title=\"{$name}\">" . (strlen($name) > 20 ? substr($name, 6) : $name) . "</a>"; array_push($srcList, $tag); if ($print) { echo $tag; } } return $srcList; }
public static function listSrcOnly($print = true) { $srcpath = Config::$projroot . Config::$src_PATH; $testpath = Config::$projroot . Config::$test_PATH; require_once 'fileHelper.php'; $caselist = getSameFile($srcpath, $testpath, ''); $srclist = getSrcOnlyFile($srcpath, $testpath, ''); $srcList = array(); foreach ($srclist as $case) { if (in_array($case, $caselist)) { continue; } $name = str_replace('/', '.', substr($case, 0, -3)); $tag = "<a title=\"{$name}\">" . (strlen($name) > 20 ? substr($name, 6) : $name) . "</a>"; array_push($srcList, $tag); if ($print) { echo $tag; } } return $srcList; }