Collection of themes/skins for the Fossil SCM

⌈⌋ ⎇ branch:  Fossil Skins Extra


Artifact [16f45544e1]

Artifact 16f45544e12d6ad38aa3655970cbd64e76230485:

  • Executable file extroot/index — part of check-in [f6b70114ca] at 2021-04-05 18:44:43 on branch trunk — fix PMD extraction regex (user: mario size: 1196)

#!/usr/bin/php-cgi -dcgi.force_redirect=0
<?php
# encoding: utf-8
# api: cgi
# type: display
# 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; encoding=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";
}

?>