-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
39 lines (30 loc) · 1 KB
/
index.php
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
<?php
require_once "vendor/autoload.php";
require_once "_internal/DeerLister.php";
// autoload previews
spl_autoload_register(function($class) {
$filePreview = "_internal/previews/" . $class . ".php";
$fileDisplay = "_internal/displays/" . $class . ".php";
if (file_exists($filePreview))
{
include $filePreview;
}
else if (file_exists($fileDisplay))
{
include $fileDisplay;
}
});
$lister = new DeerLister();
$lister->registerFileDisplay("audio", AudioDisplay::class);
$lister->registerFileDisplay("image", ImageDisplay::class);
$lister->registerFilePreview("audio", AudioPreview::class);
$lister->registerFilePreview("image", ImagePreview::class);
$lister->registerFilePreview("video", VideoPreview::class);
$lister->registerFilePreview("code", CodePreview::class);
$lister->registerFilePreview("markdown", MarkdownPreview::class);
if (isset($_GET["preview"]))
{
echo $lister->getFilePreview($_GET["preview"]);
exit;
}
echo $lister->render($_GET["dir"] ?? "");