Browse Source

Initial commit

merge-requests/1/head
JamesRezo 4 years ago
commit
c87102a7d8
  1. 1
      .gitignore
  2. 13
      composer.json
  3. 37
      css/supported-versions.css
  4. 165
      inc/supported-versions.php
  5. 12
      lang/supportedversions_en.php
  6. 12
      lang/supportedversions_fr.php
  7. 1
      modeles/eol.html
  8. 17
      modeles/legend.html
  9. 1
      modeles/release-note.html
  10. 12
      modeles/supported-versions.html
  11. 37
      modeles/table.html
  12. 9
      paquet.xml
  13. 2
      supported-versions.svg.html

1
.gitignore vendored

@ -0,0 +1 @@
/vendor/

13
composer.json

@ -0,0 +1,13 @@
{
"name": "jamesrezo/supported-versions",
"description": "SPIP Supported Versions",
"type": "spip-plugin",
"license": "MIT",
"authors": [
{
"name": "JamesRezo",
"email": "james@rezo.net"
}
],
"require": {}
}

37
css/supported-versions.css

@ -0,0 +1,37 @@
/* Branches page */
table.standard tr.eol td:first-child {
background: #f33;
color: white;
}
table.standard tr.security td:first-child {
background: #f93;
}
table.standard tr.stable td:first-child {
background: #9c9;
}
@media (max-width: 767px) {
table.standard th {
font-size: 1rem;
}
table.standard td.collapse-phone {
padding: 0;
}
table.standard td.collapse-phone * {
display: none;
}
}
svg {
max-width: 100%;
height: auto;
}
.version-notes {
border: 0;
}

165
inc/supported-versions.php

@ -0,0 +1,165 @@
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/branches.inc';
// Sizing constants.
$margin_left = 80;
$margin_right = 50;
$header_height = 24;
$year_width = 120;
$branch_height = 30;
$footer_height = 24;
function branches_to_show() {
// Basically: show all 5.3+ branches with EOL dates > min_date().
$branches = array();
// Flatten out the majors.
foreach (get_all_branches() as $major => $major_branches) {
foreach ($major_branches as $branch => $version) {
if (version_compare($branch, '5.3', 'ge') && get_branch_security_eol_date($branch) > min_date()) {
$branches[$branch] = $version;
}
}
}
ksort($branches);
return $branches;
}
function min_date() {
$now = new DateTime('January 1');
return $now->sub(new DateInterval('P3Y'));
}
function max_date() {
$now = new DateTime('January 1');
return $now->add(new DateInterval('P5Y'));
}
function date_horiz_coord(DateTime $date) {
$diff = $date->diff(min_date());
if (!$diff->invert) {
return $GLOBALS['margin_left'];
}
return $GLOBALS['margin_left'] + ($diff->days / (365.24 / $GLOBALS['year_width']));
}
$branches = branches_to_show();
$i = 0;
foreach ($branches as $branch => $version) {
$branches[$branch]['top'] = $header_height + ($branch_height * $i++);
}
if (!isset($non_standalone)) {
header('Content-Type: image/svg+xml');
echo '<?xml version="1.0"?>';
}
$years = iterator_to_array(new DatePeriod(min_date(), new DateInterval('P1Y'), max_date()));
$width = $margin_left + $margin_right + ((count($years) - 1) * $year_width);
$height = $header_height + $footer_height + (count($branches) * $branch_height);
?>
<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 <?php echo $width ?> <?php echo $height ?>" width="<?php echo $width ?>" height="<?php echo $height ?>">
<style type="text/css">
<![CDATA[
@import url(/fonts/Fira/fira.css);
text {
fill: #333;
font-family: "Fira Sans", "Source Sans Pro", Helvetica, Arial, sans-serif;
font-size: <?php echo (2 / 3) * $header_height; ?>px;
}
g.eol rect,
.branches rect.eol {
fill: #f33;
}
g.eol text {
fill: white;
}
g.security rect,
.branches rect.security {
fill: #f93;
}
g.stable rect,
.branches rect.stable {
fill: #9c9;
}
.branch-labels text {
dominant-baseline: central;
text-anchor: middle;
}
.today line {
stroke: #f33;
stroke-dasharray: 7,7;
stroke-width: 3px;
}
.today text {
fill: #f33;
text-anchor: middle;
}
.years line {
stroke: black;
}
.years text {
text-anchor: middle;
}
]]>
</style>
<!-- Branch labels -->
<g class="branch-labels">
<?php foreach ($branches as $branch => $version): ?>
<g class="<?php echo get_branch_support_state($branch) ?>">
<rect x="0" y="<?php echo $version['top'] ?>" width="<?php echo 0.5 * $margin_left ?>" height="<?php echo $branch_height ?>" />
<text x="<?php echo 0.25 * $margin_left ?>" y="<?php echo $version['top'] + (0.5 * $branch_height) ?>">
<?php echo htmlspecialchars($branch) ?>
</text>
</g>
<?php endforeach ?>
</g>
<!-- Branch blocks -->
<g class="branches">
<?php foreach ($branches as $branch => $version): ?>
<?php
$x_release = date_horiz_coord(get_branch_release_date($branch));
$x_bug = date_horiz_coord(get_branch_bug_eol_date($branch));
$x_eol = date_horiz_coord(get_branch_security_eol_date($branch));
?>
<rect class="stable" x="<?php echo $x_release ?>" y="<?php echo $version['top'] ?>" width="<?php echo $x_bug - $x_release ?>" height="<?php echo $branch_height ?>" />
<rect class="security" x="<?php echo $x_bug ?>" y="<?php echo $version['top'] ?>" width="<?php echo $x_eol - $x_bug ?>" height="<?php echo $branch_height ?>" />
<?php endforeach ?>
</g>
<!-- Year lines -->
<g class="years">
<?php foreach ($years as $date): ?>
<line x1="<?php echo date_horiz_coord($date) ?>" y1="<?php echo $header_height ?>" x2="<?php echo date_horiz_coord($date) ?>" y2="<?php echo $header_height + (count($branches) * $branch_height) ?>" />
<text x="<?php echo date_horiz_coord($date) ?>" y="<?php echo 0.8 * $header_height; ?>">
<?php echo $date->format('j M Y') ?>
</text>
<?php endforeach ?>
</g>
<!-- Today -->
<g class="today">
<?php
$now = new DateTime;
$x = date_horiz_coord($now);
?>
<line x1="<?php echo $x ?>" y1="<?php echo $header_height ?>" x2="<?php echo $x ?>" y2="<?php echo $header_height + (count($branches) * $branch_height) ?>" />
<text x="<?php echo $x ?>" y="<?php echo $header_height + (count($branches) * $branch_height) + (0.8 * $footer_height) ?>">
<?php echo 'Today: '.$now->format('j M Y') ?>
</text>
</g>
</svg>

12
lang/supportedversions_en.php

@ -0,0 +1,12 @@
<?php
$GLOBALS[$GLOBALS['idx_lang']] = [
'active_support' => 'Active support',
'security_fix' => 'Security fixes only',
'security_fix_defintion' => 'A release that is supported for critical security issues only.
Releases are only made on an as-needed basis.'
'end_of_life' => 'End of life',
'end_of_life_definition' => 'A release that is no longer supported.
Users of this release should upgrade as soon as possible,
as they may be exposed to unpatched security vulnerabilities.',
];

12
lang/supportedversions_fr.php

@ -0,0 +1,12 @@
<?php
$GLOBALS[$GLOBALS['idx_lang']] = [
'active_support' => 'Active support',
'security_fix' => 'Security fixes only',
'security_fix_defintion' => 'Une version qui est maintenue pour des corrections de failles de sécurité seulement.
Releases are only made on an as-needed basis.'
'end_of_life' => 'Fin de vie',
'end_of_life_definition' => 'Une version qui n\'est plus maintenue.
Les utilisateurs de cette version devraient faire une mise à jour le plus rapidement possible,
as they may be exposed to unpatched security vulnerabilities.',
];

1
modeles/eol.html

@ -0,0 +1 @@
eol.html

17
modeles/legend.html

@ -0,0 +1,17 @@
<table class="standard">
<tr class="stable">
<td><:supportedversions:active_support:></td>
<td>
A release that is being actively supported. Reported bugs and security
issues are fixed and regular point releases are made.
</td>
</tr>
<tr class="security">
<td><:supportedversions:security_fix:></td>
<td><:supportedversions:security_fix_definition:></td>
</tr>
<tr class="eol">
<td><:supportedversions:end_of_life:></td>
<td><:supportedversions:end_of_life_definition:></td>
</tr>
</table>

1
modeles/release-note.html

@ -0,0 +1 @@
release-note.html

12
modeles/supported-versions.html

@ -0,0 +1,12 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="300" height="200">
<title>Exemple simple de figure SVG</title>
<desc>
Cette figure est constituée d'un rectangle,
d'un segment de droite et d'un cercle.
</desc>
<rect width="100" height="80" x="0" y="70" fill="green" />
<line x1="5" y1="5" x2="250" y2="95" stroke="red" />
<circle cx="90" cy="80" r="50" fill="blue" />
<text x="180" y="60">Un texte</text>
</svg>

After

Width:  |  Height:  |  Size: 448 B

37
modeles/table.html

@ -0,0 +1,37 @@
<table class="standard">
<thead>
<tr>
<th>Branch</th>
<th colspan="2">Initial Release</th>
<th colspan="2">Active Support Until</th>
<th colspan="2">Security Support Until</th>
</tr>
</thead>
<tbody>
<?php foreach (get_active_branches(false) as $major => $releases): ?>
<?php ksort($releases) ?>
<?php foreach ($releases as $branch => $release): ?>
<?php
$state = get_branch_support_state($branch);
$initial = get_branch_release_date($branch);
$until = get_branch_bug_eol_date($branch);
$eol = get_branch_security_eol_date($branch);
?>
<tr class="<?php echo $state ?>">
<td>
<a href="/downloads.php#v<?php echo htmlspecialchars($release['version']) ?>"><?php echo htmlspecialchars($branch) ?></a>
<?php if (isset($VERSION_NOTES[$branch])): ?>
<a class="version-notes" href="<?php echo htmlspecialchars($VERSION_NOTES[$branch]) ?>">*</a>
<?php endif ?>
</td>
<td><?php echo htmlspecialchars($initial->format('j M Y')) ?></td>
<td class="collapse-phone"><em><?php echo htmlspecialchars(format_interval($initial, null)) ?></em></td>
<td><?php echo htmlspecialchars($until->format('j M Y')) ?></td>
<td class="collapse-phone"><em><?php echo htmlspecialchars(format_interval($until, null)) ?></em></td>
<td><?php echo htmlspecialchars($eol->format('j M Y')) ?></td>
<td class="collapse-phone"><em><?php echo htmlspecialchars(format_interval($eol, null)) ?></em></td>
</tr>
<?php endforeach ?>
<?php endforeach ?>
</tbody>
</table>

9
paquet.xml

@ -0,0 +1,9 @@
<paquet
categorie="date"
prefix="supportedversions"
version="0.1.0"
etat="experimental"
compatibilite="[3.2;["
>
<nom>SPIP: Supported Versions</nom>
</paquet>

2
supported-versions.svg.html

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
#MODELE{supported-versions}
Loading…
Cancel
Save