Skip to content

Commit

Permalink
Homepage: Modified version number output
Browse files Browse the repository at this point in the history
Always include major and minor numbers, always omit zeroes in the rest.
  • Loading branch information
skyjake committed May 25, 2016
1 parent 268d654 commit 587c58b
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions web/classes/version.class.php
Expand Up @@ -106,13 +106,14 @@ public static function ucompare($a, $b)
public function asText($sep = '.', $omitTrailingZeros = false)
{
$sep = (string)$sep;
$omitTrailingZeros = (bool)$omitTrailingZeros;
/*$omitTrailingZeros = (bool)$omitTrailingZeros;
if($omitTrailingZeros === false)
{
return "{$this->major}$sep{$this->minor}$sep{$this->patch}$sep{$this->revision}";
}
}*/

/*
$text = '';
if($this->revision > 0)
{
Expand All @@ -132,8 +133,20 @@ public function asText($sep = '.', $omitTrailingZeros = false)
}
if(!empty($text)) $text = $sep . $text;
$text = $this->major . $text;
$text = $this->major . $text;*/

// Mandatory parts.
$text = "{$this->major}" . $sep . "{$this->minor}";

// Optional parts.
if($this->patch > 0 || $this->revision > 0)
{
$text .= $sep . "{$this->patch}";
}
if($this->revision > 0)
{
$text .= $sep . "{$this->revision}";
}
return $text;
}

Expand Down

0 comments on commit 587c58b

Please sign in to comment.