-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
53 lines (48 loc) · 1.68 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
use Kirby\Cms\App;
use Kirby\Exception\Exception;
use Kirby\Filesystem\F;
/**
* Kirby Downloads Plugin
* Block to embed a list of downloads from a central storage page
* with filters and search
*
* @package Kirby Downloads Plugin
* @author Lukas Bestle <project-kirbydownloads@lukasbestle.com>
* @link https://github.com/lukasbestle/kirby-downloads
* @copyright Lukas Bestle
* @license https://opensource.org/licenses/MIT
*/
// validate the Kirby version; the supported versions are
// updated manually when verified to work with the plugin
$kirbyVersion = App::version();
if (
$kirbyVersion !== null &&
(
version_compare($kirbyVersion, '3.8.0-rc.1', '<') === true ||
(
version_compare($kirbyVersion, '4.0.0-alpha', '>=') === true &&
version_compare($kirbyVersion, '4.1.0-rc.1', '<') === true
) ||
version_compare($kirbyVersion, '5.0.0-alpha', '>=') === true
)
) {
throw new Exception(
'The installed version of the Kirby Downloads plugin ' .
'is not compatible with Kirby ' . $kirbyVersion
);
}
// autoload classes
F::loadClasses([
'LukasBestle\Downloads\Downloads' => __DIR__ . '/src/classes/Downloads.php',
'LukasBestle\Downloads\DownloadsBlock' => __DIR__ . '/src/classes/DownloadsBlock.php',
]);
// register the plugin
App::plugin('lukasbestle/downloads', [
'api' => require __DIR__ . '/src/config/api.php',
'blockModels' => require __DIR__ . '/src/config/blockModels.php',
'blueprints' => require __DIR__ . '/src/config/blueprints.php',
'options' => require __DIR__ . '/src/config/options.php',
'snippets' => require __DIR__ . '/src/config/snippets.php',
'translations' => require __DIR__ . '/src/config/translations.php',
]);