|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
<?php |
|
|
|
|
|
|
|
|
|
// SPIP Standard API |
|
|
|
|
|
|
|
|
|
function supportedversions_insert_head_css($flux) { |
|
|
|
|
$flux .= '<link rel="stylesheet" type="text/css" media="all" href="'. |
|
|
|
|
find_in_path('css/supported-versions.css'). |
|
|
|
@ -12,27 +14,65 @@ function supportedversions_header_prive_css($flux) {
|
|
|
|
|
return supportedversions_insert_head_css($flux); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function supver_state(array $valeurs) { |
|
|
|
|
$now = new DateTime; |
|
|
|
|
$initial = new DateTime($valeurs['initial_release']); |
|
|
|
|
$bug = $valeurs['active_support'] ? new DateTime($valeurs['active_support']) : null; |
|
|
|
|
$security = $valeurs['eol'] ? new DateTime($valeurs['eol']) : null; |
|
|
|
|
|
|
|
|
|
if ($security && $now >= $security) { |
|
|
|
|
return 'eol'; |
|
|
|
|
} elseif ($bug && $now >= $bug) { |
|
|
|
|
return 'security'; |
|
|
|
|
} elseif ($now >= $initial) { |
|
|
|
|
return 'stable'; |
|
|
|
|
} else { |
|
|
|
|
return 'future'; |
|
|
|
|
function balise_SUPPORTED_VERSIONS_dist($p) { |
|
|
|
|
return balise_ENV_dist($p, '$GLOBALS["supportedversions"]'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Supported Versions filters class |
|
|
|
|
|
|
|
|
|
class SupportedVersions |
|
|
|
|
{ |
|
|
|
|
public static function state(array $valeurs) { |
|
|
|
|
$now = new DateTime; |
|
|
|
|
$initial = new DateTime($valeurs['initial_release']); |
|
|
|
|
$bug = $valeurs['active_support'] ? new DateTime($valeurs['active_support']) : null; |
|
|
|
|
$security = $valeurs['eol'] ? new DateTime($valeurs['eol']) : null; |
|
|
|
|
|
|
|
|
|
if ($security && $now >= $security) { |
|
|
|
|
$state = 'eol'; |
|
|
|
|
} elseif ($bug && $now >= $bug) { |
|
|
|
|
$state = 'security'; |
|
|
|
|
} elseif ($now >= $initial) { |
|
|
|
|
$state = 'stable'; |
|
|
|
|
} else { |
|
|
|
|
$state = 'future'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $state; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ''; |
|
|
|
|
} |
|
|
|
|
public static function top($branch) { |
|
|
|
|
global $supportedversions; |
|
|
|
|
|
|
|
|
|
function balise_SUPPORTED_VERSIONS_dist($p) { |
|
|
|
|
return balise_ENV_dist($p, '$GLOBALS["supportedversions"]'); |
|
|
|
|
$i = array_search($branch, branches(), true); |
|
|
|
|
|
|
|
|
|
return $supportedversions['svg']['header_height'] + ($supportedversions['svg']['branch_height'] * $i++); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static function topForText($branch) { |
|
|
|
|
global $supportedversions; |
|
|
|
|
|
|
|
|
|
$top = self::top($branch) + (0.5 * $supportedversions['svg']['branch_height']); |
|
|
|
|
|
|
|
|
|
return $top; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static function width($margin_left) { |
|
|
|
|
global $supportedversions; |
|
|
|
|
|
|
|
|
|
return $margin_left + |
|
|
|
|
$supportedversions['svg']['margin_right'] + |
|
|
|
|
((count(years()) - 1) * $supportedversions['svg']['year_width']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static function height($header_height) { |
|
|
|
|
global $supportedversions; |
|
|
|
|
|
|
|
|
|
return $header_height + |
|
|
|
|
$supportedversions['svg']['footer_height'] + |
|
|
|
|
(count(branches()) * $supportedversions['svg']['branch_height']); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function supver_min_date() { |
|
|
|
@ -68,7 +108,7 @@ function supver_horiz_coord($date) {
|
|
|
|
|
return supver_date_horiz_coord(supver_max_date()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function supver_years() { |
|
|
|
|
function years() { |
|
|
|
|
static $years = []; |
|
|
|
|
|
|
|
|
|
if (empty($years)) { |
|
|
|
@ -83,7 +123,7 @@ function supver_years() {
|
|
|
|
|
return $years; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function supver_branches() { |
|
|
|
|
function branches() { |
|
|
|
|
static $branches = []; |
|
|
|
|
|
|
|
|
|
if (empty($branches)) { |
|
|
|
@ -97,35 +137,3 @@ function supver_branches() {
|
|
|
|
|
|
|
|
|
|
return $branches; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function supver_top($branch) { |
|
|
|
|
global $supportedversions; |
|
|
|
|
|
|
|
|
|
$i = array_search($branch, supver_branches(), true); |
|
|
|
|
|
|
|
|
|
return $supportedversions['svg']['header_height'] + ($supportedversions['svg']['branch_height'] * $i++); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function supver_top_for_text($top) { |
|
|
|
|
global $supportedversions; |
|
|
|
|
|
|
|
|
|
$top = $top + (0.5 * $supportedversions['svg']['branch_height']); |
|
|
|
|
|
|
|
|
|
return $top; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function supver_width($margin_left) { |
|
|
|
|
global $supportedversions; |
|
|
|
|
|
|
|
|
|
return $margin_left + |
|
|
|
|
$supportedversions['svg']['margin_right'] + |
|
|
|
|
((count(supver_years()) - 1) * $supportedversions['svg']['year_width']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function supver_height($header_height) { |
|
|
|
|
global $supportedversions; |
|
|
|
|
|
|
|
|
|
return $header_height + |
|
|
|
|
$supportedversions['svg']['footer_height'] + |
|
|
|
|
(count(supver_branches()) * $supportedversions['svg']['branch_height']); |
|
|
|
|
} |
|
|
|
|