Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions credits.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public function __construct(
public readonly string $name,
public readonly string $license,
public readonly ?string $url,
public readonly ?string $license_url
public readonly ?string $license_url,
public readonly ?string $version,
) {
}
}
Expand All @@ -57,6 +58,10 @@ function output_credit_details(array $credit_details): void
} else {
echo html_safe($detail->name);
}
// Only show the version if we're in testing mode.
if (SiteConfig::get()->testing && isset($detail->version)) {
echo " " . html_safe($detail->version);
}
echo "</b><br>";
if (isset($detail->license_url)) {
echo _("License") . ": <a href='" . $detail->license_url . "'>" . html_safe($detail->license) . "</a>";
Expand All @@ -71,12 +76,12 @@ function output_credit_details(array $credit_details): void
/** @return array<string, CreditDetails> */
function load_bundled_credit_details(string $code_dir): array
{
$credit_details = [];
$files = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($code_dir),
RecursiveIteratorIterator::SELF_FIRST,
RecursiveIteratorIterator::CATCH_GET_CHILD
);
$credit_details = [];
foreach ($files as $file_info) {
$file = $file_info->getPathname();
if (basename($file) != "details.json") {
Expand All @@ -91,7 +96,8 @@ function load_bundled_credit_details(string $code_dir): array
name: $detail["name"],
url: $detail["url"] ?? null,
license: $detail["license"],
license_url: $detail["license_url"] ?? null
license_url: $detail["license_url"] ?? null,
version: $detail["version"] ?? null
);
}
}
Expand All @@ -106,12 +112,14 @@ function load_composer_credit_details()
global $code_dir;

$packages = json_decode(file_get_contents("$code_dir/composer.lock"));
$credit_details = [];
foreach ($packages->packages as $index => $package) {
$credit_details[$package->name] = new CreditDetails(
name: $package->name,
url: $package->homepage ?? null,
license: join(", ", $package->license),
license_url: null
license_url: null,
version: $package->version ?? null
);
}

Expand All @@ -129,6 +137,7 @@ function load_npm_credit_details()
$dependencies = array_keys($packages["packages"][""]["dependencies"]);

// now pull the license details
$credit_details = [];
foreach ($packages["packages"] as $name => $package) {
$short_name = str_replace("node_modules/", "", $name);
if (in_array($short_name, $dependencies)) {
Expand All @@ -137,6 +146,7 @@ function load_npm_credit_details()
url: null,
license: $package["license"],
license_url: null,
version: $package["version"] ?? null,
);
}
}
Expand Down
5 changes: 3 additions & 2 deletions pinc/3rdparty/iconify/details.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"url": "https://iconify.design/",
"license": "MIT License",
"license_url": "https://github.com/primer/octicons/blob/main/LICENSE",
"license_file": "MIT_LICENSE"
}
"license_file": "MIT_LICENSE",
"version": "v19.8.0"
}
3 changes: 2 additions & 1 deletion pinc/3rdparty/mediawiki/details.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"url": "https://www.mediawiki.org/wiki/MediaWiki",
"license": "GNU General Public License v2.0",
"license_url": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html",
"license_file": "gpl-2.0.txt"
"license_file": "gpl-2.0.txt",
"version": "1.31.1"
}
6 changes: 4 additions & 2 deletions styles/fonts/details.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
"url": "https://dejavu-fonts.github.io/",
"license": "DejaVu Fonts license",
"license_url": "https://dejavu-fonts.github.io/License.html",
"license_file": "DejaVu Fonts License.txt"
"license_file": "DejaVu Fonts License.txt",
"version": "2.37"
},
{
"name": "DP Sans Mono",
"url": "https://www.pgdp.net/wiki/DP_Sans_Mono",
"license": "DP Sans Mono license",
"license_url": "https://www.pgdp.net/wiki/DP_Sans_Mono#License",
"license_file": "DP Sans Mono License.txt"
"license_file": "DP Sans Mono License.txt",
"version": "Draft 17"
},
{
"name": "EB Garamond",
Expand Down