$projectname) { echo sprintf("@%1d [%3d/%3d] ".$projectname."...\n", $id, ++$count, count($projects)); $pr = new CProject($dirname, $projectname); $pr->write(); } } function buildcommon() { echo "@0 [ 0/ ?] Common files...\n"; $projects = listprojects(); // Build all projects $plist = array(); $handles = array(); $handle_lookup = array(); $alphasort = []; foreach($projects as $dirname => $projectname) { $pr = new CProject($dirname, $projectname); $pr->genHomeImage(); // thumbnail $plist[] = $pr; if (is_null($pr->homeimage)) { $handle_lookup[$projectname] = null; } else { $handle_lookup[$projectname] = count($handles); $handles[] = $pr->homeimage; } $alphasort[] = [$pr->projname, count($plist)-1]; } usort($alphasort, function($a, $b) { return strcasecmp($a[0], $b[0]); }); $alphaidx = []; foreach($alphasort as $a) { $alphaidx[ $a[1] ] = count($alphaidx); } // Build homepage spritesheet if (count($handles)) { mkspritesheet($handles, BASEDIR.'wwwroot/logos.jpg', INDEX_THUMB_W, INDEX_THUMB_H); array_map('imagedestroy', $handles); // free } // Cache-busting stylesheet $style = '.homeimage-sprite { background-image: url("logos.jpg?'.md5_file(BASEDIR.'wwwroot/logos.jpg').'"); }'; // Build index page ob_start(); ?> $pr) { ?>
projname]) ? '
' : '
')?>
projname))?>, shortdesc)?> more... subtag) || count($pr->tags)) { ?>
subtag)?> subtag) && count($pr->tags)) { ?> :: tags as $tag) { ?>
'; $index = template(SITE_TITLE, ob_get_clean(), $extra_head); file_put_contents(BASEDIR.'wwwroot/index.html', $index); // Done } function redirecthtml($target) { ob_start(); ?> Moved » $newname) { $page = redirecthtml(BASEURL.$newname.'/'); // old format file_put_contents(BASEDIR.'wwwroot/'.$oldname.'.html', $page); // new format mkdir(BASEDIR.'wwwroot/'.$oldname); file_put_contents(BASEDIR.'wwwroot/'.$oldname.'/index.html', $page); } }