@@ -38,216 +38,216 @@ |
||
38 | 38 | * @since 4.0 |
39 | 39 | */ |
40 | 40 | if (function_exists('espresso_version')) { |
41 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | - /** |
|
43 | - * espresso_duplicate_plugin_error |
|
44 | - * displays if more than one version of EE is activated at the same time |
|
45 | - */ |
|
46 | - function espresso_duplicate_plugin_error() |
|
47 | - { |
|
48 | - ?> |
|
41 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | + /** |
|
43 | + * espresso_duplicate_plugin_error |
|
44 | + * displays if more than one version of EE is activated at the same time |
|
45 | + */ |
|
46 | + function espresso_duplicate_plugin_error() |
|
47 | + { |
|
48 | + ?> |
|
49 | 49 | <div class="error"> |
50 | 50 | <p> |
51 | 51 | <?php |
52 | - echo esc_html__( |
|
53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | - 'event_espresso' |
|
55 | - ); ?> |
|
52 | + echo esc_html__( |
|
53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | + 'event_espresso' |
|
55 | + ); ?> |
|
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | - } |
|
61 | - } |
|
62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | + } |
|
61 | + } |
|
62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
63 | 63 | |
64 | 64 | } else { |
65 | - define('EE_MIN_PHP_VER_REQUIRED', '5.3.9'); |
|
66 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
67 | - /** |
|
68 | - * espresso_minimum_php_version_error |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - function espresso_minimum_php_version_error() |
|
72 | - { |
|
73 | - ?> |
|
65 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.9'); |
|
66 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
67 | + /** |
|
68 | + * espresso_minimum_php_version_error |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + function espresso_minimum_php_version_error() |
|
72 | + { |
|
73 | + ?> |
|
74 | 74 | <div class="error"> |
75 | 75 | <p> |
76 | 76 | <?php |
77 | - printf( |
|
78 | - esc_html__( |
|
79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | - 'event_espresso' |
|
81 | - ), |
|
82 | - EE_MIN_PHP_VER_REQUIRED, |
|
83 | - PHP_VERSION, |
|
84 | - '<br/>', |
|
85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | - ); |
|
87 | - ?> |
|
77 | + printf( |
|
78 | + esc_html__( |
|
79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | + 'event_espresso' |
|
81 | + ), |
|
82 | + EE_MIN_PHP_VER_REQUIRED, |
|
83 | + PHP_VERSION, |
|
84 | + '<br/>', |
|
85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | + ); |
|
87 | + ?> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | - } |
|
91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | + } |
|
93 | 93 | |
94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | - } else { |
|
96 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | - /** |
|
98 | - * espresso_version |
|
99 | - * Returns the plugin version |
|
100 | - * |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - function espresso_version() |
|
104 | - { |
|
105 | - return apply_filters('FHEE__espresso__espresso_version', '4.9.59.rc.004'); |
|
106 | - } |
|
94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | + } else { |
|
96 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | + /** |
|
98 | + * espresso_version |
|
99 | + * Returns the plugin version |
|
100 | + * |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + function espresso_version() |
|
104 | + { |
|
105 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.59.rc.004'); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * espresso_plugin_activation |
|
110 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | - */ |
|
112 | - function espresso_plugin_activation() |
|
113 | - { |
|
114 | - update_option('ee_espresso_activation', true); |
|
115 | - } |
|
108 | + /** |
|
109 | + * espresso_plugin_activation |
|
110 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | + */ |
|
112 | + function espresso_plugin_activation() |
|
113 | + { |
|
114 | + update_option('ee_espresso_activation', true); |
|
115 | + } |
|
116 | 116 | |
117 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
118 | - /** |
|
119 | - * espresso_load_error_handling |
|
120 | - * this function loads EE's class for handling exceptions and errors |
|
121 | - */ |
|
122 | - function espresso_load_error_handling() |
|
123 | - { |
|
124 | - static $error_handling_loaded = false; |
|
125 | - if ($error_handling_loaded) { |
|
126 | - return; |
|
127 | - } |
|
128 | - // load debugging tools |
|
129 | - if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) { |
|
130 | - require_once EE_HELPERS . 'EEH_Debug_Tools.helper.php'; |
|
131 | - \EEH_Debug_Tools::instance(); |
|
132 | - } |
|
133 | - // load error handling |
|
134 | - if (is_readable(EE_CORE . 'EE_Error.core.php')) { |
|
135 | - require_once EE_CORE . 'EE_Error.core.php'; |
|
136 | - } else { |
|
137 | - wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
138 | - } |
|
139 | - $error_handling_loaded = true; |
|
140 | - } |
|
117 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
118 | + /** |
|
119 | + * espresso_load_error_handling |
|
120 | + * this function loads EE's class for handling exceptions and errors |
|
121 | + */ |
|
122 | + function espresso_load_error_handling() |
|
123 | + { |
|
124 | + static $error_handling_loaded = false; |
|
125 | + if ($error_handling_loaded) { |
|
126 | + return; |
|
127 | + } |
|
128 | + // load debugging tools |
|
129 | + if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) { |
|
130 | + require_once EE_HELPERS . 'EEH_Debug_Tools.helper.php'; |
|
131 | + \EEH_Debug_Tools::instance(); |
|
132 | + } |
|
133 | + // load error handling |
|
134 | + if (is_readable(EE_CORE . 'EE_Error.core.php')) { |
|
135 | + require_once EE_CORE . 'EE_Error.core.php'; |
|
136 | + } else { |
|
137 | + wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
138 | + } |
|
139 | + $error_handling_loaded = true; |
|
140 | + } |
|
141 | 141 | |
142 | - /** |
|
143 | - * espresso_load_required |
|
144 | - * given a class name and path, this function will load that file or throw an exception |
|
145 | - * |
|
146 | - * @param string $classname |
|
147 | - * @param string $full_path_to_file |
|
148 | - * @throws EE_Error |
|
149 | - */ |
|
150 | - function espresso_load_required($classname, $full_path_to_file) |
|
151 | - { |
|
152 | - if (is_readable($full_path_to_file)) { |
|
153 | - require_once $full_path_to_file; |
|
154 | - } else { |
|
155 | - throw new \EE_Error ( |
|
156 | - sprintf( |
|
157 | - esc_html__( |
|
158 | - 'The %s class file could not be located or is not readable due to file permissions.', |
|
159 | - 'event_espresso' |
|
160 | - ), |
|
161 | - $classname |
|
162 | - ) |
|
163 | - ); |
|
164 | - } |
|
165 | - } |
|
142 | + /** |
|
143 | + * espresso_load_required |
|
144 | + * given a class name and path, this function will load that file or throw an exception |
|
145 | + * |
|
146 | + * @param string $classname |
|
147 | + * @param string $full_path_to_file |
|
148 | + * @throws EE_Error |
|
149 | + */ |
|
150 | + function espresso_load_required($classname, $full_path_to_file) |
|
151 | + { |
|
152 | + if (is_readable($full_path_to_file)) { |
|
153 | + require_once $full_path_to_file; |
|
154 | + } else { |
|
155 | + throw new \EE_Error ( |
|
156 | + sprintf( |
|
157 | + esc_html__( |
|
158 | + 'The %s class file could not be located or is not readable due to file permissions.', |
|
159 | + 'event_espresso' |
|
160 | + ), |
|
161 | + $classname |
|
162 | + ) |
|
163 | + ); |
|
164 | + } |
|
165 | + } |
|
166 | 166 | |
167 | - /** |
|
168 | - * @since 4.9.27 |
|
169 | - * @throws \EE_Error |
|
170 | - * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
171 | - * @throws \EventEspresso\core\exceptions\InvalidEntityException |
|
172 | - * @throws \EventEspresso\core\exceptions\InvalidIdentifierException |
|
173 | - * @throws \EventEspresso\core\exceptions\InvalidClassException |
|
174 | - * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
175 | - * @throws \EventEspresso\core\services\container\exceptions\ServiceExistsException |
|
176 | - * @throws \EventEspresso\core\services\container\exceptions\ServiceNotFoundException |
|
177 | - * @throws \OutOfBoundsException |
|
178 | - */ |
|
179 | - function bootstrap_espresso() |
|
180 | - { |
|
181 | - require_once __DIR__ . '/core/espresso_definitions.php'; |
|
182 | - try { |
|
183 | - espresso_load_error_handling(); |
|
184 | - espresso_load_required( |
|
185 | - 'EEH_Base', |
|
186 | - EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' |
|
187 | - ); |
|
188 | - espresso_load_required( |
|
189 | - 'EEH_File', |
|
190 | - EE_CORE . 'interfaces' . DS . 'EEHI_File.interface.php' |
|
191 | - ); |
|
192 | - espresso_load_required( |
|
193 | - 'EEH_File', |
|
194 | - EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' |
|
195 | - ); |
|
196 | - espresso_load_required( |
|
197 | - 'EEH_Array', |
|
198 | - EE_CORE . 'helpers' . DS . 'EEH_Array.helper.php' |
|
199 | - ); |
|
200 | - // instantiate and configure PSR4 autoloader |
|
201 | - espresso_load_required( |
|
202 | - 'Psr4Autoloader', |
|
203 | - EE_CORE . 'Psr4Autoloader.php' |
|
204 | - ); |
|
205 | - espresso_load_required( |
|
206 | - 'EE_Psr4AutoloaderInit', |
|
207 | - EE_CORE . 'EE_Psr4AutoloaderInit.core.php' |
|
208 | - ); |
|
209 | - $AutoloaderInit = new EE_Psr4AutoloaderInit(); |
|
210 | - $AutoloaderInit->initializeAutoloader(); |
|
211 | - espresso_load_required( |
|
212 | - 'EE_Request', |
|
213 | - EE_CORE . 'request_stack' . DS . 'EE_Request.core.php' |
|
214 | - ); |
|
215 | - espresso_load_required( |
|
216 | - 'EE_Response', |
|
217 | - EE_CORE . 'request_stack' . DS . 'EE_Response.core.php' |
|
218 | - ); |
|
219 | - espresso_load_required( |
|
220 | - 'EE_Bootstrap', |
|
221 | - EE_CORE . 'EE_Bootstrap.core.php' |
|
222 | - ); |
|
223 | - // bootstrap EE and the request stack |
|
224 | - new EE_Bootstrap( |
|
225 | - new EE_Request($_GET, $_POST, $_COOKIE), |
|
226 | - new EE_Response() |
|
227 | - ); |
|
228 | - } catch (Exception $e) { |
|
229 | - require_once EE_CORE . 'exceptions' . DS . 'ExceptionStackTraceDisplay.php'; |
|
230 | - new EventEspresso\core\exceptions\ExceptionStackTraceDisplay($e); |
|
231 | - } |
|
232 | - } |
|
233 | - bootstrap_espresso(); |
|
234 | - } |
|
167 | + /** |
|
168 | + * @since 4.9.27 |
|
169 | + * @throws \EE_Error |
|
170 | + * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
171 | + * @throws \EventEspresso\core\exceptions\InvalidEntityException |
|
172 | + * @throws \EventEspresso\core\exceptions\InvalidIdentifierException |
|
173 | + * @throws \EventEspresso\core\exceptions\InvalidClassException |
|
174 | + * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
175 | + * @throws \EventEspresso\core\services\container\exceptions\ServiceExistsException |
|
176 | + * @throws \EventEspresso\core\services\container\exceptions\ServiceNotFoundException |
|
177 | + * @throws \OutOfBoundsException |
|
178 | + */ |
|
179 | + function bootstrap_espresso() |
|
180 | + { |
|
181 | + require_once __DIR__ . '/core/espresso_definitions.php'; |
|
182 | + try { |
|
183 | + espresso_load_error_handling(); |
|
184 | + espresso_load_required( |
|
185 | + 'EEH_Base', |
|
186 | + EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' |
|
187 | + ); |
|
188 | + espresso_load_required( |
|
189 | + 'EEH_File', |
|
190 | + EE_CORE . 'interfaces' . DS . 'EEHI_File.interface.php' |
|
191 | + ); |
|
192 | + espresso_load_required( |
|
193 | + 'EEH_File', |
|
194 | + EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' |
|
195 | + ); |
|
196 | + espresso_load_required( |
|
197 | + 'EEH_Array', |
|
198 | + EE_CORE . 'helpers' . DS . 'EEH_Array.helper.php' |
|
199 | + ); |
|
200 | + // instantiate and configure PSR4 autoloader |
|
201 | + espresso_load_required( |
|
202 | + 'Psr4Autoloader', |
|
203 | + EE_CORE . 'Psr4Autoloader.php' |
|
204 | + ); |
|
205 | + espresso_load_required( |
|
206 | + 'EE_Psr4AutoloaderInit', |
|
207 | + EE_CORE . 'EE_Psr4AutoloaderInit.core.php' |
|
208 | + ); |
|
209 | + $AutoloaderInit = new EE_Psr4AutoloaderInit(); |
|
210 | + $AutoloaderInit->initializeAutoloader(); |
|
211 | + espresso_load_required( |
|
212 | + 'EE_Request', |
|
213 | + EE_CORE . 'request_stack' . DS . 'EE_Request.core.php' |
|
214 | + ); |
|
215 | + espresso_load_required( |
|
216 | + 'EE_Response', |
|
217 | + EE_CORE . 'request_stack' . DS . 'EE_Response.core.php' |
|
218 | + ); |
|
219 | + espresso_load_required( |
|
220 | + 'EE_Bootstrap', |
|
221 | + EE_CORE . 'EE_Bootstrap.core.php' |
|
222 | + ); |
|
223 | + // bootstrap EE and the request stack |
|
224 | + new EE_Bootstrap( |
|
225 | + new EE_Request($_GET, $_POST, $_COOKIE), |
|
226 | + new EE_Response() |
|
227 | + ); |
|
228 | + } catch (Exception $e) { |
|
229 | + require_once EE_CORE . 'exceptions' . DS . 'ExceptionStackTraceDisplay.php'; |
|
230 | + new EventEspresso\core\exceptions\ExceptionStackTraceDisplay($e); |
|
231 | + } |
|
232 | + } |
|
233 | + bootstrap_espresso(); |
|
234 | + } |
|
235 | 235 | } |
236 | 236 | if (! function_exists('espresso_deactivate_plugin')) { |
237 | - /** |
|
238 | - * deactivate_plugin |
|
239 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
240 | - * |
|
241 | - * @access public |
|
242 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
243 | - * @return void |
|
244 | - */ |
|
245 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
246 | - { |
|
247 | - if (! function_exists('deactivate_plugins')) { |
|
248 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
249 | - } |
|
250 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
251 | - deactivate_plugins($plugin_basename); |
|
252 | - } |
|
237 | + /** |
|
238 | + * deactivate_plugin |
|
239 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
240 | + * |
|
241 | + * @access public |
|
242 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
243 | + * @return void |
|
244 | + */ |
|
245 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
246 | + { |
|
247 | + if (! function_exists('deactivate_plugins')) { |
|
248 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
249 | + } |
|
250 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
251 | + deactivate_plugins($plugin_basename); |
|
252 | + } |
|
253 | 253 | } |