Fixed CHANGELOG.md loading in Admin Panel

This commit is contained in:
slawkens 2020-02-25 10:33:57 +01:00
parent 25ab4e187c
commit 0c9219f885
3 changed files with 2003 additions and 8 deletions

View File

@ -4,8 +4,9 @@
### Fixed ### Fixed
* Some weird behaviour with installation of plugins * Some weird behaviour with installation of plugins
* CHANGELOG.md loading in Admin Panel
## [0.8.0 - x.02.2020] ## [0.8.0 - 19.02.2020]
### Added: ### Added:
* new Awesome Bootstrap Admin Panel by Lee (@Leesneaks) * new Awesome Bootstrap Admin Panel by Lee (@Leesneaks)

1994
system/libs/Parsedown.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -10,17 +10,17 @@
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
$title = 'MyAAC Changelog'; $title = 'MyAAC Changelog';
if (!file_exists(BASE . 'CHANGELOG')) { if (!file_exists(BASE . 'CHANGELOG.md')) {
echo 'File CHANGELOG doesn\'t exist.'; echo 'File CHANGELOG.md doesn\'t exist.';
return; return;
} }
$changelog = file_get_contents(BASE . 'CHANGELOG'); require LIBS . 'Parsedown.php';
$changelog = htmlspecialchars($changelog);
// replace URLs with <a href...> elements $changelog = file_get_contents(BASE . 'CHANGELOG.md');
$changelog = preg_replace('/\s(\w+:\/\/)(\S+)/', ' <a href="\\1\\2" target="_blank">\\1\\2</a>', $changelog);
$changelog = nl2br($changelog); $Parsedown = new Parsedown();
$changelog = $Parsedown->text($changelog); # prints: <p>Hello <em>Parsedown</em>!</p>
echo '<div>' . $changelog . '</div>'; echo '<div>' . $changelog . '</div>';