1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
defined('EVENT_ESPRESSO_MAIN_FILE') || exit; |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
/** |
7
|
|
|
* espresso_load_error_handling |
8
|
|
|
* this function loads EE's class for handling exceptions and errors |
9
|
|
|
*/ |
10
|
|
|
function espresso_load_error_handling() |
11
|
|
|
{ |
12
|
|
|
static $error_handling_loaded = false; |
13
|
|
|
if ($error_handling_loaded) { |
14
|
|
|
return; |
15
|
|
|
} |
16
|
|
|
// load debugging tools |
17
|
|
|
if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) { |
18
|
|
|
require_once EE_HELPERS . 'EEH_Debug_Tools.helper.php'; |
19
|
|
|
\EEH_Debug_Tools::instance(); |
20
|
|
|
} |
21
|
|
|
// load error handling |
22
|
|
|
if (is_readable(EE_CORE . 'EE_Error.core.php')) { |
23
|
|
|
require_once EE_CORE . 'EE_Error.core.php'; |
24
|
|
|
} else { |
25
|
|
|
wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
26
|
|
|
} |
27
|
|
|
$error_handling_loaded = true; |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* espresso_load_required |
33
|
|
|
* given a class name and path, this function will load that file or throw an exception |
34
|
|
|
* |
35
|
|
|
* @param string $classname |
36
|
|
|
* @param string $full_path_to_file |
37
|
|
|
* @throws EE_Error |
38
|
|
|
*/ |
39
|
|
|
function espresso_load_required($classname, $full_path_to_file) |
40
|
|
|
{ |
41
|
|
|
if (is_readable($full_path_to_file)) { |
42
|
|
|
require_once $full_path_to_file; |
43
|
|
|
} else { |
44
|
|
|
throw new \EE_Error ( |
45
|
|
|
sprintf( |
46
|
|
|
esc_html__( |
47
|
|
|
'The %s class file could not be located or is not readable due to file permissions.', |
48
|
|
|
'event_espresso' |
49
|
|
|
), |
50
|
|
|
$classname |
51
|
|
|
) |
52
|
|
|
); |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @since 4.9.27 |
59
|
|
|
* @throws \EE_Error |
60
|
|
|
* @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
61
|
|
|
* @throws \EventEspresso\core\exceptions\InvalidEntityException |
62
|
|
|
* @throws \EventEspresso\core\exceptions\InvalidIdentifierException |
63
|
|
|
* @throws \EventEspresso\core\exceptions\InvalidClassException |
64
|
|
|
* @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
65
|
|
|
* @throws \EventEspresso\core\services\container\exceptions\ServiceExistsException |
66
|
|
|
* @throws \EventEspresso\core\services\container\exceptions\ServiceNotFoundException |
67
|
|
|
* @throws \OutOfBoundsException |
68
|
|
|
* @throws Exception |
69
|
|
|
*/ |
70
|
|
|
function bootstrap_espresso() |
71
|
|
|
{ |
72
|
|
|
require_once __DIR__ . '/espresso_definitions.php'; |
73
|
|
|
try { |
74
|
|
|
espresso_load_error_handling(); |
75
|
|
|
espresso_load_required( |
76
|
|
|
'EEH_Base', |
77
|
|
|
EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' |
78
|
|
|
); |
79
|
|
|
espresso_load_required( |
80
|
|
|
'EEH_File', |
81
|
|
|
EE_CORE . 'interfaces' . DS . 'EEHI_File.interface.php' |
82
|
|
|
); |
83
|
|
|
espresso_load_required( |
84
|
|
|
'EEH_File', |
85
|
|
|
EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' |
86
|
|
|
); |
87
|
|
|
espresso_load_required( |
88
|
|
|
'EEH_Array', |
89
|
|
|
EE_CORE . 'helpers' . DS . 'EEH_Array.helper.php' |
90
|
|
|
); |
91
|
|
|
// instantiate and configure PSR4 autoloader |
92
|
|
|
espresso_load_required( |
93
|
|
|
'Psr4Autoloader', |
94
|
|
|
EE_CORE . 'Psr4Autoloader.php' |
95
|
|
|
); |
96
|
|
|
espresso_load_required( |
97
|
|
|
'EE_Psr4AutoloaderInit', |
98
|
|
|
EE_CORE . 'EE_Psr4AutoloaderInit.core.php' |
99
|
|
|
); |
100
|
|
|
$AutoloaderInit = new EE_Psr4AutoloaderInit(); |
101
|
|
|
$AutoloaderInit->initializeAutoloader(); |
102
|
|
|
new EventEspresso\core\services\bootstrap\BootstrapCore(); |
103
|
|
|
} catch (Exception $e) { |
104
|
|
|
require_once EE_CORE . 'exceptions' . DS . 'ExceptionStackTraceDisplay.php'; |
105
|
|
|
new EventEspresso\core\exceptions\ExceptionStackTraceDisplay($e); |
106
|
|
|
} |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
|
110
|
|
|
|
111
|
|
|
|
112
|
|
|
|