-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbootstrap.php
More file actions
executable file
·71 lines (57 loc) · 2.11 KB
/
bootstrap.php
File metadata and controls
executable file
·71 lines (57 loc) · 2.11 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
<?php
/**
* Kirby App Bootstrapper
*
* Include this file to load all essential
* files to initiate a new Kirby App
*
* @package Kirby App
* @author Bastian Allgeier <bastian@getkirby.com>
* @link http://getkirby.com
* @copyright Bastian Allgeier
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
// check for an existing toolkit
if(!defined('KIRBY_TOOLKIT_ROOT')) die('The Kirby Toolkit is required for the Kirby App Framework');
/**
* Overwritable constants
* Define them before including the bootstrapper
* to change essential roots
*/
if(!defined('KIRBY_APP_ROOT')) define('KIRBY_APP_ROOT', __DIR__);
if(!defined('KIRBY_APP_ROOT_LIB')) define('KIRBY_APP_ROOT_LIB', KIRBY_APP_ROOT . DS . 'lib');
if(!defined('KIRBY_APP_ROOT_CONFIG')) define('KIRBY_APP_ROOT_CONFIG', KIRBY_APP_ROOT . DS . 'config');
// initialize the autoloader
$autoloader = new Kirby\Toolkit\Autoloader();
// set the base root where all classes are located
$autoloader->root = KIRBY_APP_ROOT_LIB;
// set the global namespace for all classes
$autoloader->namespace = 'Kirby\\App';
// add all needed aliases
$autoloader->aliases = array(
'app' => 'Kirby\\App',
'assets' => 'Kirby\\App\\Assets',
'controller' => 'Kirby\\App\\Controller',
'layout' => 'Kirby\\App\\Layout',
'module' => 'Kirby\\App\\Module',
'snippet' => 'Kirby\\App\\Snippet',
'view' => 'Kirby\\App\\View',
);
// start autoloading
$autoloader->start();
// load the app class
require_once(KIRBY_APP_ROOT . DS . 'app.php');
// load the default config values
require_once(KIRBY_APP_ROOT_CONFIG . DS . 'defaults.php');
// load the default events
require_once(KIRBY_APP_ROOT_CONFIG . DS . 'events.php');
/*
// catch all errors and throw an exception so it can get caught by the app's error event
set_error_handler(function($errno, $errstr, $errfile, $errline) {
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
});
// catch all exceptions with the app's error event
set_exception_handler(function($exception) {
event::trigger('kirby.app.error', $exception);
});
*/