2015-04-26 16:01:28 +00:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* Sakura Main Index
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Declare Namespace
|
|
|
|
namespace Sakura;
|
|
|
|
|
2015-07-30 17:07:23 +00:00
|
|
|
// We don't use twig here
|
|
|
|
define('SAKURA_NO_TPL', true);
|
|
|
|
|
2015-04-26 16:01:28 +00:00
|
|
|
// Include components
|
2015-09-14 20:51:23 +00:00
|
|
|
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) . '_sakura/sakura.php';
|
2015-04-26 16:01:28 +00:00
|
|
|
|
|
|
|
// Path the changelog JSON
|
2015-09-14 20:51:23 +00:00
|
|
|
$changelog = json_decode(file_get_contents(ROOT . '_sakura/changelog.json'), true);
|
2015-04-26 16:01:28 +00:00
|
|
|
|
|
|
|
// Create variable to store HTML in
|
|
|
|
$changelogHTML = null;
|
|
|
|
|
|
|
|
// Format HTML
|
2015-09-14 20:51:23 +00:00
|
|
|
foreach (array_reverse($changelog['changelog'], true) as $revisionId => $revisionData) {
|
|
|
|
$changelogHTML .= '<div class="release" id="r' . $revisionId . '">';
|
2015-04-26 16:01:28 +00:00
|
|
|
|
2015-09-14 20:51:23 +00:00
|
|
|
$changelogHTML .= '<a href="#r' . $revisionId . '" class="title" style="color: ' . $changelog['versions'][$revisionData[0]] . ';">Revision ' . $revisionId . ' (' . ucfirst($revisionData[0]) . ')</a>';
|
2015-09-10 21:19:51 +00:00
|
|
|
|
|
|
|
unset($revisionData[0]);
|
2015-04-26 16:01:28 +00:00
|
|
|
|
2015-09-14 20:51:23 +00:00
|
|
|
foreach (array_reverse($revisionData) as $id => $changeData) {
|
|
|
|
$changelogHTML .= '<div id="r' . $revisionId . 'c' . $id . '">';
|
2015-04-26 16:01:28 +00:00
|
|
|
|
2015-09-14 20:51:23 +00:00
|
|
|
switch ($changeData['type']) {
|
2015-04-26 16:01:28 +00:00
|
|
|
case 'ADD':
|
|
|
|
$changelogHTML .= '<span class="tag addition-tag">Added</span>';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'REM':
|
|
|
|
$changelogHTML .= '<span class="tag removal-tag">Removed</span>';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'FIX':
|
|
|
|
$changelogHTML .= '<span class="tag fixed-tag">Fixed</span>';
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'UPD':
|
|
|
|
$changelogHTML .= '<span class="tag update-tag">Updated</span>';
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
$changelogHTML .= '<span class="tag">Unknown</span>';
|
|
|
|
}
|
|
|
|
|
|
|
|
$changelogHTML .= '<span class="changedesc">';
|
|
|
|
$changelogHTML .= $changeData['change'];
|
|
|
|
$changelogHTML .= '</span>';
|
|
|
|
|
2015-09-14 20:51:23 +00:00
|
|
|
$changelogHTML .= '<a class="changeuser" target="_blank" href="http://bitbucket.org/' . strtolower($changeData['user']) . '">';
|
2015-08-10 02:43:36 +00:00
|
|
|
$changelogHTML .= $changeData['user'];
|
|
|
|
$changelogHTML .= '</a>';
|
|
|
|
|
2015-04-26 16:01:28 +00:00
|
|
|
$changelogHTML .= '</div>';
|
|
|
|
}
|
|
|
|
|
|
|
|
$changelogHTML .= '</div>';
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get special template file
|
2015-09-14 20:51:23 +00:00
|
|
|
$tpl = file_get_contents(ROOT . '_sakura/templates/changeLog.tpl');
|
2015-04-26 16:01:28 +00:00
|
|
|
|
|
|
|
// Parse tags
|
2015-09-14 20:51:23 +00:00
|
|
|
$tpl = str_replace('{{ version }}', SAKURA_VERSION, $tpl);
|
|
|
|
$tpl = str_replace('{{ version_label }}', SAKURA_VLABEL, $tpl);
|
|
|
|
$tpl = str_replace('{{ version_type }}', SAKURA_STABLE ? 'Stable' : 'Development', $tpl);
|
|
|
|
$tpl = str_replace('{{ colour }}', SAKURA_COLOUR, $tpl);
|
|
|
|
$tpl = str_replace('{{ changeloghtml }}', $changelogHTML, $tpl);
|
2015-04-26 16:01:28 +00:00
|
|
|
|
|
|
|
// Print template
|
|
|
|
print $tpl;
|