-
-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathqi_docs.php
More file actions
75 lines (63 loc) · 1.71 KB
/
Copy pathqi_docs.php
File metadata and controls
75 lines (63 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
*
* @package quickinstall
* @copyright (c) 2007 phpBB Limited
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* qi_docs module
*/
class qi_docs
{
public function run()
{
global $template, $quickinstall_path;
// GET README
$doc_file = $quickinstall_path . 'README.md';
if (file_exists($doc_file))
{
$doc_body = qi::render_markdown(file_get_contents($doc_file), 'readme', array(
'docs/sandbox-cli.md' => 'index.php?page=cli',
));
$template->assign_var('DOC_BODY', $doc_body);
}
// GET CHANGELOG
$changelog_file = $quickinstall_path . 'CHANGELOG.md';
if (file_exists($changelog_file))
{
// let's get the changelog :)
$data = file($changelog_file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
// We do not want the first line.
unset($data[0]);
foreach ($data as $row)
{
$row = ltrim($row);
if (strpos($row, '#') === 0)
{
$key = substr($row, 3);
$template->assign_block_vars('history', array(
'CHANGES_SINCE' => $key,
'U_CHANGES' => strtolower(str_replace(array(' ', '.'), array('-', ''), $key)),
));
}
else if (strpos($row, '-') === 0)
{
$change = substr($row, 2);
$change = str_replace(
['[Fix]', '[Change]', '[Feature]'],
['<span class="badge bg-primary">Fix</span>', '<span class="badge bg-warning">Change</span>', '<span class="badge bg-success">Feature</span>'],
$change);
$template->assign_block_vars('history.changelog', array(
'CHANGE' => Parsedown::instance()->line($change),
));
}
}
}
$template->assign_var('S_DOCS', true);
// Output page
qi::page_header('DOCS_LONG');
qi::page_display('docs_body');
}
}