forked from flextype/flextype
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·76 lines (65 loc) · 2.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
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
76
<?php
declare(strict_types=1);
/**
* Flextype (http://flextype.org)
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
namespace Flextype;
use const DIRECTORY_SEPARATOR;
use const PHP_VERSION;
use function define;
use function getcwd;
use function is_file;
use function sprintf;
use function str_replace;
use function version_compare;
/**
* Define the application minimum supported PHP version.
*/
define('FLEXTYPE_MINIMUM_PHP', '7.2.0');
/**
* Define the PATH to the root directory (without trailing slash).
*/
define('ROOT_DIR', str_replace(DIRECTORY_SEPARATOR, '/', getcwd()));
/**
* Define the PATH (without trailing slash).
*/
define('PATH', [
'site' => ROOT_DIR . '/site',
'plugins' => ROOT_DIR . '/site/plugins',
'themes' => ROOT_DIR . '/site/themes',
'entries' => ROOT_DIR . '/site/entries',
'snippets' => ROOT_DIR . '/site/snippets',
'fieldsets' => ROOT_DIR . '/site/fieldsets',
'config' => [
'default' => ROOT_DIR . '/flextype/config',
'site' => ROOT_DIR . '/site/config',
],
'cache' => ROOT_DIR . '/site/cache',
]);
/**
* Check PHP Version
*/
version_compare($ver = PHP_VERSION, $req = FLEXTYPE_MINIMUM_PHP, '<') and exit(sprintf('You are running PHP %s, but Flextype needs at least <strong>PHP %s</strong> to run.', $ver, $req));
/**
* Ensure vendor libraries exist
*/
! is_file($autoload = __DIR__ . '/vendor/autoload.php') and exit('Please run: <i>composer install</i>');
/**
* Register The Auto Loader
*
* Composer provides a convenient, automatically generated class loader for
* our application. We just need to utilize it! We'll simply require it
* into the script here so that we don't have to worry about manual
* loading any of our classes later on. It feels nice to relax.
* Register The Auto Loader
*/
$loader = require_once $autoload;
/**
* Bootstraps the Flextype
*
* This bootstraps the Flextype and gets it ready for use, then it
* will load up this application so that we can run it and send
* the responses back to the browser and delight our users.
*/
include 'flextype/bootstrap.php';