Collection of themes/skins for the Fossil SCM

⌈⌋ branch:  Fossil Skins Extra


Artifact [505e058af0]

Artifact 505e058af0e0d6235625173527c9aa224d40d706:

  • Executable file extroot/index — part of check-in [d059f0486e] at 2021-04-10 22:45:28 on branch trunk — charset= instead of encoding= (user: mario size: 1212)

#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: display
# category: list
# title: Ext/ index
# description: Lists all CGI extensions in the extroot: folder
# version: 0.1
# state: alpha
# config: -
#
# Just a glob() and some crude plugin meta extraction.
#


#-- fossil HTML output
function page_md($text) {
    header("Content-Type: text/x-markdown; charset=utf-8");
    print($text);
}

#-- filtered file list
function ls($dir) {
    $ls = [];
    foreach (glob("$dir/*") as $fn) {
        if (is_file($fn) and is_executable($fn) and is_readable($fn)) {
            $ls[] = basename($fn);
        }
    }
    return $ls;
}

#-- rough plugin meta data reading
function meta($fn) {
    $src = file_get_contents($fn, false, NULL, 0, 1024);
    preg_match_all("~^\s{0,2}[#*\/]+\s{0,2}([\w\-]+):\s*(.+)\n~m", $src, $uu);
    return array_combine($uu[1], $uu[2]);
}

#-- run
page_md("## Extensions\n\n");
foreach (ls(__DIR__) as $fn) {
    $meta = meta($fn);
    $title = $meta["title"] or $fn;
    $version = $meta["version"] ? " ($meta[version])" : "";
    $desc = $meta["description"] and $desc = "  \n    $desc";
    print " * [$title]($fn) " . $version . $desc . "\n";
}

?>