Completed
Branch BUG-10738-inconsistency-in-ses... (860590)
by
unknown
45:05 queued 33:37
created
core/EE_Module_Request_Router.core.php 2 patches
Indentation   +307 added lines, -307 removed lines patch added patch discarded remove patch
@@ -17,316 +17,316 @@
 block discarded – undo
17 17
 final class EE_Module_Request_Router implements InterminableInterface
18 18
 {
19 19
 
20
-    /**
21
-     * @var array $_previous_routes
22
-     */
23
-    private static $_previous_routes = array();
24
-
25
-    /**
26
-     * @var WP_Query $WP_Query
27
-     */
28
-    public $WP_Query;
29
-
30
-
31
-
32
-    /**
33
-     * EE_Module_Request_Router constructor.
34
-     */
35
-    public function __construct()
36
-    {
37
-    }
38
-
39
-
40
-
41
-    /**
42
-     * on the first call  to this method, it checks the EE_Request_Handler for a "route"
43
-     * on subsequent calls to this method,
44
-     * instead of checking the EE_Request_Handler for a route, it checks the previous routes array,
45
-     * and checks if the last called route has any forwarding routes registered for it
46
-     *
47
-     * @param WP_Query $WP_Query
48
-     * @return NULL|string
49
-     * @throws EE_Error
50
-     * @throws ReflectionException
51
-     */
52
-    public function get_route(WP_Query $WP_Query)
53
-    {
54
-        $this->WP_Query = $WP_Query;
55
-        // assume this if first route being called
56
-        $previous_route = false;
57
-        // but is it really ???
58
-        if (! empty(self::$_previous_routes)) {
59
-            // get last run route
60
-            $previous_routes = array_values(self::$_previous_routes);
61
-            $previous_route = array_pop($previous_routes);
62
-        }
63
-        //  has another route already been run ?
64
-        if ($previous_route) {
65
-            // check if  forwarding has been set
66
-            $current_route = $this->get_forward($previous_route);
67
-            try {
68
-                //check for recursive forwarding
69
-                if (isset(self::$_previous_routes[$current_route])) {
70
-                    throw new EE_Error(
71
-                        sprintf(
72
-                            __(
73
-                                'An error occurred. The %s route has already been called, and therefore can not be forwarded to, because an infinite loop would be created and break the interweb.',
74
-                                'event_espresso'
75
-                            ),
76
-                            $current_route
77
-                        )
78
-                    );
79
-                }
80
-            } catch (EE_Error $e) {
81
-                $e->get_error();
82
-                return null;
83
-            }
84
-        } else {
85
-            // first route called
86
-            $current_route = null;
87
-            // grab all routes
88
-            $routes = EE_Config::get_routes();
89
-            //d( $routes );
90
-            foreach ($routes as $key => $route) {
91
-                // check request for module route
92
-                if (EE_Registry::instance()->REQ->is_set($key)) {
93
-                    //echo '<b style="color:#2EA2CC;">key : <span style="color:#E76700">' . $key . '</span></b><br />';
94
-                    $current_route = sanitize_text_field(EE_Registry::instance()->REQ->get($key));
95
-                    if ($current_route) {
96
-                        $current_route = array($key, $current_route);
97
-                        //echo '<b style="color:#2EA2CC;">current_route : <span style="color:#E76700">' . $current_route . '</span></b><br />';
98
-                        break;
99
-                    }
100
-                }
101
-            }
102
-        }
103
-        // sorry, but I can't read what you route !
104
-        if (empty($current_route)) {
105
-            return null;
106
-        }
107
-        //add route to previous routes array
108
-        self::$_previous_routes[] = $current_route;
109
-        return $current_route;
110
-    }
111
-
112
-
113
-
114
-    /**
115
-     * this method simply takes a valid route, and resolves what module class method the route points to
116
-     *
117
-     * @param string $key
118
-     * @param string $current_route
119
-     * @return mixed EED_Module | boolean
120
-     * @throws EE_Error
121
-     * @throws ReflectionException
122
-     */
123
-    public function resolve_route($key, $current_route)
124
-    {
125
-        // get module method that route has been mapped to
126
-        $module_method = EE_Config::get_route($current_route, $key);
127
-        //EEH_Debug_Tools::printr( $module_method, '$module_method  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
128
-        // verify result was returned
129
-        if (empty($module_method)) {
130
-            $msg = sprintf(
131
-                __('The requested route %s could not be mapped to any registered modules.', 'event_espresso'),
132
-                $current_route
133
-            );
134
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
135
-            return false;
136
-        }
137
-        // verify that result is an array
138
-        if (! is_array($module_method)) {
139
-            $msg = sprintf(__('The %s  route has not been properly registered.', 'event_espresso'), $current_route);
140
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
141
-            return false;
142
-        }
143
-        // grab module name
144
-        $module_name = $module_method[0];
145
-        // verify that a class method was registered properly
146
-        if (! isset($module_method[1])) {
147
-            $msg = sprintf(
148
-                __('A class method for the %s  route has not been properly registered.', 'event_espresso'),
149
-                $current_route
150
-            );
151
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
152
-            return false;
153
-        }
154
-        // grab method
155
-        $method = $module_method[1];
156
-        // verify that class exists
157
-        if (! class_exists($module_name)) {
158
-            $msg = sprintf(__('The requested %s class could not be found.', 'event_espresso'), $module_name);
159
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
160
-            return false;
161
-        }
162
-        // verify that method exists
163
-        if (! method_exists($module_name, $method)) {
164
-            $msg = sprintf(
165
-                __('The class method %s for the %s route is in invalid.', 'event_espresso'), $method, $current_route
166
-            );
167
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
168
-            return false;
169
-        }
170
-        // instantiate module and call route method
171
-        return $this->_module_router($module_name, $method);
172
-    }
173
-
174
-
175
-
176
-    /**
177
-     * this method instantiates modules and calls the method that was defined when the route was registered
178
-     *
179
-     * @param string $module_name
180
-     * @return EED_Module|object|null
181
-     * @throws ReflectionException
182
-     */
183
-    public static function module_factory($module_name)
184
-    {
185
-        if ($module_name === 'EED_Module') {
186
-            EE_Error::add_error(
187
-                sprintf(
188
-                    __(
189
-                        'EED_Module is an abstract parent class an can not be instantiated. Please provide a proper module name.',
190
-                        'event_espresso'
191
-                    ), $module_name
192
-                ), __FILE__, __FUNCTION__, __LINE__
193
-            );
194
-            return null;
195
-        }
196
-        // let's pause to reflect on this...
197
-        $mod_reflector = new ReflectionClass($module_name);
198
-        // ensure that class is actually a module
199
-        if (! $mod_reflector->isSubclassOf('EED_Module')) {
200
-            EE_Error::add_error(
201
-                sprintf(__('The requested %s module is not of the class EED_Module.', 'event_espresso'), $module_name),
202
-                __FILE__, __FUNCTION__, __LINE__
203
-            );
204
-            return null;
205
-        }
206
-        // instantiate and return module class
207
-        return $mod_reflector->newInstance();
208
-    }
209
-
210
-
211
-
212
-    /**
213
-     * this method instantiates modules and calls the method that was defined when the route was registered
214
-     *
215
-     * @param string $module_name
216
-     * @param string $method
217
-     * @return EED_Module|null
218
-     * @throws EE_Error
219
-     * @throws ReflectionException
220
-     */
221
-    private function _module_router($module_name, $method)
222
-    {
223
-        // instantiate module class
224
-        $module = EE_Module_Request_Router::module_factory($module_name);
225
-        if ($module instanceof EED_Module) {
226
-            // and call whatever action the route was for
227
-            try {
228
-                call_user_func(array($module, $method), $this->WP_Query);
229
-            } catch (EE_Error $e) {
230
-                $e->get_error();
231
-                return null;
232
-            }
233
-        }
234
-        return $module;
235
-    }
236
-
237
-
238
-
239
-    /**
240
-     * @param $current_route
241
-     * @return string
242
-     */
243
-    public function get_forward($current_route)
244
-    {
245
-        return EE_Config::get_forward($current_route);
246
-    }
247
-
248
-
249
-
250
-    /**
251
-     * @param $current_route
252
-     * @return string
253
-     */
254
-    public function get_view($current_route)
255
-    {
256
-        return EE_Config::get_view($current_route);
257
-    }
258
-
259
-
260
-
261
-    /**
262
-     * @param $a
263
-     * @param $b
264
-     * @return bool
265
-     */
266
-    public function __set($a, $b)
267
-    {
268
-        return false;
269
-    }
270
-
271
-
272
-
273
-    /**
274
-     * @param $a
275
-     * @return bool
276
-     */
277
-    public function __get($a)
278
-    {
279
-        return false;
280
-    }
281
-
282
-
283
-
284
-    /**
285
-     * @param $a
286
-     * @return bool
287
-     */
288
-    public function __isset($a)
289
-    {
290
-        return false;
291
-    }
292
-
293
-
294
-
295
-    /**
296
-     * @param $a
297
-     * @return bool
298
-     */
299
-    public function __unset($a)
300
-    {
301
-        return false;
302
-    }
303
-
304
-
305
-
306
-    /**
307
-     * @return void
308
-     */
309
-    public function __clone()
310
-    {
311
-    }
312
-
313
-
314
-
315
-    /**
316
-     * @return void
317
-     */
318
-    public function __wakeup()
319
-    {
320
-    }
20
+	/**
21
+	 * @var array $_previous_routes
22
+	 */
23
+	private static $_previous_routes = array();
24
+
25
+	/**
26
+	 * @var WP_Query $WP_Query
27
+	 */
28
+	public $WP_Query;
29
+
30
+
31
+
32
+	/**
33
+	 * EE_Module_Request_Router constructor.
34
+	 */
35
+	public function __construct()
36
+	{
37
+	}
38
+
39
+
40
+
41
+	/**
42
+	 * on the first call  to this method, it checks the EE_Request_Handler for a "route"
43
+	 * on subsequent calls to this method,
44
+	 * instead of checking the EE_Request_Handler for a route, it checks the previous routes array,
45
+	 * and checks if the last called route has any forwarding routes registered for it
46
+	 *
47
+	 * @param WP_Query $WP_Query
48
+	 * @return NULL|string
49
+	 * @throws EE_Error
50
+	 * @throws ReflectionException
51
+	 */
52
+	public function get_route(WP_Query $WP_Query)
53
+	{
54
+		$this->WP_Query = $WP_Query;
55
+		// assume this if first route being called
56
+		$previous_route = false;
57
+		// but is it really ???
58
+		if (! empty(self::$_previous_routes)) {
59
+			// get last run route
60
+			$previous_routes = array_values(self::$_previous_routes);
61
+			$previous_route = array_pop($previous_routes);
62
+		}
63
+		//  has another route already been run ?
64
+		if ($previous_route) {
65
+			// check if  forwarding has been set
66
+			$current_route = $this->get_forward($previous_route);
67
+			try {
68
+				//check for recursive forwarding
69
+				if (isset(self::$_previous_routes[$current_route])) {
70
+					throw new EE_Error(
71
+						sprintf(
72
+							__(
73
+								'An error occurred. The %s route has already been called, and therefore can not be forwarded to, because an infinite loop would be created and break the interweb.',
74
+								'event_espresso'
75
+							),
76
+							$current_route
77
+						)
78
+					);
79
+				}
80
+			} catch (EE_Error $e) {
81
+				$e->get_error();
82
+				return null;
83
+			}
84
+		} else {
85
+			// first route called
86
+			$current_route = null;
87
+			// grab all routes
88
+			$routes = EE_Config::get_routes();
89
+			//d( $routes );
90
+			foreach ($routes as $key => $route) {
91
+				// check request for module route
92
+				if (EE_Registry::instance()->REQ->is_set($key)) {
93
+					//echo '<b style="color:#2EA2CC;">key : <span style="color:#E76700">' . $key . '</span></b><br />';
94
+					$current_route = sanitize_text_field(EE_Registry::instance()->REQ->get($key));
95
+					if ($current_route) {
96
+						$current_route = array($key, $current_route);
97
+						//echo '<b style="color:#2EA2CC;">current_route : <span style="color:#E76700">' . $current_route . '</span></b><br />';
98
+						break;
99
+					}
100
+				}
101
+			}
102
+		}
103
+		// sorry, but I can't read what you route !
104
+		if (empty($current_route)) {
105
+			return null;
106
+		}
107
+		//add route to previous routes array
108
+		self::$_previous_routes[] = $current_route;
109
+		return $current_route;
110
+	}
111
+
112
+
113
+
114
+	/**
115
+	 * this method simply takes a valid route, and resolves what module class method the route points to
116
+	 *
117
+	 * @param string $key
118
+	 * @param string $current_route
119
+	 * @return mixed EED_Module | boolean
120
+	 * @throws EE_Error
121
+	 * @throws ReflectionException
122
+	 */
123
+	public function resolve_route($key, $current_route)
124
+	{
125
+		// get module method that route has been mapped to
126
+		$module_method = EE_Config::get_route($current_route, $key);
127
+		//EEH_Debug_Tools::printr( $module_method, '$module_method  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
128
+		// verify result was returned
129
+		if (empty($module_method)) {
130
+			$msg = sprintf(
131
+				__('The requested route %s could not be mapped to any registered modules.', 'event_espresso'),
132
+				$current_route
133
+			);
134
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
135
+			return false;
136
+		}
137
+		// verify that result is an array
138
+		if (! is_array($module_method)) {
139
+			$msg = sprintf(__('The %s  route has not been properly registered.', 'event_espresso'), $current_route);
140
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
141
+			return false;
142
+		}
143
+		// grab module name
144
+		$module_name = $module_method[0];
145
+		// verify that a class method was registered properly
146
+		if (! isset($module_method[1])) {
147
+			$msg = sprintf(
148
+				__('A class method for the %s  route has not been properly registered.', 'event_espresso'),
149
+				$current_route
150
+			);
151
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
152
+			return false;
153
+		}
154
+		// grab method
155
+		$method = $module_method[1];
156
+		// verify that class exists
157
+		if (! class_exists($module_name)) {
158
+			$msg = sprintf(__('The requested %s class could not be found.', 'event_espresso'), $module_name);
159
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
160
+			return false;
161
+		}
162
+		// verify that method exists
163
+		if (! method_exists($module_name, $method)) {
164
+			$msg = sprintf(
165
+				__('The class method %s for the %s route is in invalid.', 'event_espresso'), $method, $current_route
166
+			);
167
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
168
+			return false;
169
+		}
170
+		// instantiate module and call route method
171
+		return $this->_module_router($module_name, $method);
172
+	}
173
+
174
+
175
+
176
+	/**
177
+	 * this method instantiates modules and calls the method that was defined when the route was registered
178
+	 *
179
+	 * @param string $module_name
180
+	 * @return EED_Module|object|null
181
+	 * @throws ReflectionException
182
+	 */
183
+	public static function module_factory($module_name)
184
+	{
185
+		if ($module_name === 'EED_Module') {
186
+			EE_Error::add_error(
187
+				sprintf(
188
+					__(
189
+						'EED_Module is an abstract parent class an can not be instantiated. Please provide a proper module name.',
190
+						'event_espresso'
191
+					), $module_name
192
+				), __FILE__, __FUNCTION__, __LINE__
193
+			);
194
+			return null;
195
+		}
196
+		// let's pause to reflect on this...
197
+		$mod_reflector = new ReflectionClass($module_name);
198
+		// ensure that class is actually a module
199
+		if (! $mod_reflector->isSubclassOf('EED_Module')) {
200
+			EE_Error::add_error(
201
+				sprintf(__('The requested %s module is not of the class EED_Module.', 'event_espresso'), $module_name),
202
+				__FILE__, __FUNCTION__, __LINE__
203
+			);
204
+			return null;
205
+		}
206
+		// instantiate and return module class
207
+		return $mod_reflector->newInstance();
208
+	}
209
+
210
+
211
+
212
+	/**
213
+	 * this method instantiates modules and calls the method that was defined when the route was registered
214
+	 *
215
+	 * @param string $module_name
216
+	 * @param string $method
217
+	 * @return EED_Module|null
218
+	 * @throws EE_Error
219
+	 * @throws ReflectionException
220
+	 */
221
+	private function _module_router($module_name, $method)
222
+	{
223
+		// instantiate module class
224
+		$module = EE_Module_Request_Router::module_factory($module_name);
225
+		if ($module instanceof EED_Module) {
226
+			// and call whatever action the route was for
227
+			try {
228
+				call_user_func(array($module, $method), $this->WP_Query);
229
+			} catch (EE_Error $e) {
230
+				$e->get_error();
231
+				return null;
232
+			}
233
+		}
234
+		return $module;
235
+	}
236
+
237
+
238
+
239
+	/**
240
+	 * @param $current_route
241
+	 * @return string
242
+	 */
243
+	public function get_forward($current_route)
244
+	{
245
+		return EE_Config::get_forward($current_route);
246
+	}
247
+
248
+
249
+
250
+	/**
251
+	 * @param $current_route
252
+	 * @return string
253
+	 */
254
+	public function get_view($current_route)
255
+	{
256
+		return EE_Config::get_view($current_route);
257
+	}
258
+
259
+
260
+
261
+	/**
262
+	 * @param $a
263
+	 * @param $b
264
+	 * @return bool
265
+	 */
266
+	public function __set($a, $b)
267
+	{
268
+		return false;
269
+	}
270
+
271
+
272
+
273
+	/**
274
+	 * @param $a
275
+	 * @return bool
276
+	 */
277
+	public function __get($a)
278
+	{
279
+		return false;
280
+	}
281
+
282
+
283
+
284
+	/**
285
+	 * @param $a
286
+	 * @return bool
287
+	 */
288
+	public function __isset($a)
289
+	{
290
+		return false;
291
+	}
292
+
293
+
294
+
295
+	/**
296
+	 * @param $a
297
+	 * @return bool
298
+	 */
299
+	public function __unset($a)
300
+	{
301
+		return false;
302
+	}
303
+
304
+
305
+
306
+	/**
307
+	 * @return void
308
+	 */
309
+	public function __clone()
310
+	{
311
+	}
312
+
313
+
314
+
315
+	/**
316
+	 * @return void
317
+	 */
318
+	public function __wakeup()
319
+	{
320
+	}
321 321
 
322 322
 
323 323
 
324
-    /**
325
-     *
326
-     */
327
-    public function __destruct()
328
-    {
329
-    }
324
+	/**
325
+	 *
326
+	 */
327
+	public function __destruct()
328
+	{
329
+	}
330 330
 
331 331
 }
332 332
 // End of file EE_Module_Request_Router.core.php
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         // assume this if first route being called
56 56
         $previous_route = false;
57 57
         // but is it really ???
58
-        if (! empty(self::$_previous_routes)) {
58
+        if ( ! empty(self::$_previous_routes)) {
59 59
             // get last run route
60 60
             $previous_routes = array_values(self::$_previous_routes);
61 61
             $previous_route = array_pop($previous_routes);
@@ -135,36 +135,36 @@  discard block
 block discarded – undo
135 135
             return false;
136 136
         }
137 137
         // verify that result is an array
138
-        if (! is_array($module_method)) {
138
+        if ( ! is_array($module_method)) {
139 139
             $msg = sprintf(__('The %s  route has not been properly registered.', 'event_espresso'), $current_route);
140
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
140
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
141 141
             return false;
142 142
         }
143 143
         // grab module name
144 144
         $module_name = $module_method[0];
145 145
         // verify that a class method was registered properly
146
-        if (! isset($module_method[1])) {
146
+        if ( ! isset($module_method[1])) {
147 147
             $msg = sprintf(
148 148
                 __('A class method for the %s  route has not been properly registered.', 'event_espresso'),
149 149
                 $current_route
150 150
             );
151
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
151
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
152 152
             return false;
153 153
         }
154 154
         // grab method
155 155
         $method = $module_method[1];
156 156
         // verify that class exists
157
-        if (! class_exists($module_name)) {
157
+        if ( ! class_exists($module_name)) {
158 158
             $msg = sprintf(__('The requested %s class could not be found.', 'event_espresso'), $module_name);
159 159
             EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
160 160
             return false;
161 161
         }
162 162
         // verify that method exists
163
-        if (! method_exists($module_name, $method)) {
163
+        if ( ! method_exists($module_name, $method)) {
164 164
             $msg = sprintf(
165 165
                 __('The class method %s for the %s route is in invalid.', 'event_espresso'), $method, $current_route
166 166
             );
167
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
167
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
168 168
             return false;
169 169
         }
170 170
         // instantiate module and call route method
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         // let's pause to reflect on this...
197 197
         $mod_reflector = new ReflectionClass($module_name);
198 198
         // ensure that class is actually a module
199
-        if (! $mod_reflector->isSubclassOf('EED_Module')) {
199
+        if ( ! $mod_reflector->isSubclassOf('EED_Module')) {
200 200
             EE_Error::add_error(
201 201
                 sprintf(__('The requested %s module is not of the class EED_Module.', 'event_espresso'), $module_name),
202 202
                 __FILE__, __FUNCTION__, __LINE__
Please login to merge, or discard this patch.
espresso.php 1 patch
Indentation   +219 added lines, -219 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('ABSPATH')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /*
5 5
   Plugin Name:		Event Espresso
@@ -40,243 +40,243 @@  discard block
 block discarded – undo
40 40
  * @since            4.0
41 41
  */
42 42
 if (function_exists('espresso_version')) {
43
-    /**
44
-     *    espresso_duplicate_plugin_error
45
-     *    displays if more than one version of EE is activated at the same time
46
-     */
47
-    function espresso_duplicate_plugin_error()
48
-    {
49
-        ?>
43
+	/**
44
+	 *    espresso_duplicate_plugin_error
45
+	 *    displays if more than one version of EE is activated at the same time
46
+	 */
47
+	function espresso_duplicate_plugin_error()
48
+	{
49
+		?>
50 50
         <div class="error">
51 51
             <p>
52 52
                 <?php 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
-                ); ?>
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
-    }
59
+		espresso_deactivate_plugin(plugin_basename(__FILE__));
60
+	}
61 61
 
62
-    add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
62
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
63 63
 } else {
64
-    define('EE_MIN_PHP_VER_REQUIRED', '5.3.9');
65
-    if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
-        /**
67
-         * espresso_minimum_php_version_error
68
-         *
69
-         * @return void
70
-         */
71
-        function espresso_minimum_php_version_error()
72
-        {
73
-            ?>
64
+	define('EE_MIN_PHP_VER_REQUIRED', '5.3.9');
65
+	if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
+		/**
67
+		 * espresso_minimum_php_version_error
68
+		 *
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
-        /**
97
-         * espresso_version
98
-         * Returns the plugin version
99
-         *
100
-         * @return string
101
-         */
102
-        function espresso_version()
103
-        {
104
-            return apply_filters('FHEE__espresso__espresso_version', '4.9.46.rc.004');
105
-        }
94
+		add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
+	} else {
96
+		/**
97
+		 * espresso_version
98
+		 * Returns the plugin version
99
+		 *
100
+		 * @return string
101
+		 */
102
+		function espresso_version()
103
+		{
104
+			return apply_filters('FHEE__espresso__espresso_version', '4.9.46.rc.004');
105
+		}
106 106
 
107
-        // define versions
108
-        define('EVENT_ESPRESSO_VERSION', espresso_version());
109
-        define('EE_MIN_WP_VER_REQUIRED', '4.1');
110
-        define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
111
-        define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
112
-        define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
113
-        //used to be DIRECTORY_SEPARATOR, but that caused issues on windows
114
-        if ( ! defined('DS')) {
115
-            define('DS', '/');
116
-        }
117
-        if ( ! defined('PS')) {
118
-            define('PS', PATH_SEPARATOR);
119
-        }
120
-        if ( ! defined('SP')) {
121
-            define('SP', ' ');
122
-        }
123
-        if ( ! defined('EENL')) {
124
-            define('EENL', "\n");
125
-        }
126
-        define('EE_SUPPORT_EMAIL', '[email protected]');
127
-        // define the plugin directory and URL
128
-        define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
129
-        define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
130
-        define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
131
-        // main root folder paths
132
-        define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS);
133
-        define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS);
134
-        define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS);
135
-        define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS);
136
-        define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS);
137
-        define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS);
138
-        define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS);
139
-        define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS);
140
-        // core system paths
141
-        define('EE_ADMIN', EE_CORE . 'admin' . DS);
142
-        define('EE_CPTS', EE_CORE . 'CPTs' . DS);
143
-        define('EE_CLASSES', EE_CORE . 'db_classes' . DS);
144
-        define('EE_INTERFACES', EE_CORE . 'interfaces' . DS);
145
-        define('EE_BUSINESS', EE_CORE . 'business' . DS);
146
-        define('EE_MODELS', EE_CORE . 'db_models' . DS);
147
-        define('EE_HELPERS', EE_CORE . 'helpers' . DS);
148
-        define('EE_LIBRARIES', EE_CORE . 'libraries' . DS);
149
-        define('EE_TEMPLATES', EE_CORE . 'templates' . DS);
150
-        define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS);
151
-        define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS);
152
-        define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS);
153
-        // gateways
154
-        define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS);
155
-        define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS);
156
-        // asset URL paths
157
-        define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS);
158
-        define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS);
159
-        define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS);
160
-        define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS);
161
-        define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/');
162
-        define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/');
163
-        // define upload paths
164
-        $uploads = wp_upload_dir();
165
-        // define the uploads directory and URL
166
-        define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS);
167
-        define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS);
168
-        // define the templates directory and URL
169
-        define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS);
170
-        define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS);
171
-        // define the gateway directory and URL
172
-        define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS);
173
-        define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS);
174
-        // languages folder/path
175
-        define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS);
176
-        define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS);
177
-        //check for dompdf fonts in uploads
178
-        if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) {
179
-            define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS);
180
-        }
181
-        //ajax constants
182
-        define(
183
-                'EE_FRONT_AJAX',
184
-                isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false
185
-        );
186
-        define(
187
-                'EE_ADMIN_AJAX',
188
-                isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false
189
-        );
190
-        //just a handy constant occasionally needed for finding values representing infinity in the DB
191
-        //you're better to use this than its straight value (currently -1) in case you ever
192
-        //want to change its default value! or find when -1 means infinity
193
-        define('EE_INF_IN_DB', -1);
194
-        define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX);
195
-        define('EE_DEBUG', false);
196
-        // for older WP versions
197
-        if ( ! defined('MONTH_IN_SECONDS')) {
198
-            define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30);
199
-        }
200
-        /**
201
-         *    espresso_plugin_activation
202
-         *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
203
-         */
204
-        function espresso_plugin_activation()
205
-        {
206
-            update_option('ee_espresso_activation', true);
207
-        }
107
+		// define versions
108
+		define('EVENT_ESPRESSO_VERSION', espresso_version());
109
+		define('EE_MIN_WP_VER_REQUIRED', '4.1');
110
+		define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
111
+		define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
112
+		define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
113
+		//used to be DIRECTORY_SEPARATOR, but that caused issues on windows
114
+		if ( ! defined('DS')) {
115
+			define('DS', '/');
116
+		}
117
+		if ( ! defined('PS')) {
118
+			define('PS', PATH_SEPARATOR);
119
+		}
120
+		if ( ! defined('SP')) {
121
+			define('SP', ' ');
122
+		}
123
+		if ( ! defined('EENL')) {
124
+			define('EENL', "\n");
125
+		}
126
+		define('EE_SUPPORT_EMAIL', '[email protected]');
127
+		// define the plugin directory and URL
128
+		define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
129
+		define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
130
+		define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
131
+		// main root folder paths
132
+		define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS);
133
+		define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS);
134
+		define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS);
135
+		define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS);
136
+		define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS);
137
+		define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS);
138
+		define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS);
139
+		define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS);
140
+		// core system paths
141
+		define('EE_ADMIN', EE_CORE . 'admin' . DS);
142
+		define('EE_CPTS', EE_CORE . 'CPTs' . DS);
143
+		define('EE_CLASSES', EE_CORE . 'db_classes' . DS);
144
+		define('EE_INTERFACES', EE_CORE . 'interfaces' . DS);
145
+		define('EE_BUSINESS', EE_CORE . 'business' . DS);
146
+		define('EE_MODELS', EE_CORE . 'db_models' . DS);
147
+		define('EE_HELPERS', EE_CORE . 'helpers' . DS);
148
+		define('EE_LIBRARIES', EE_CORE . 'libraries' . DS);
149
+		define('EE_TEMPLATES', EE_CORE . 'templates' . DS);
150
+		define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS);
151
+		define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS);
152
+		define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS);
153
+		// gateways
154
+		define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS);
155
+		define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS);
156
+		// asset URL paths
157
+		define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS);
158
+		define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS);
159
+		define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS);
160
+		define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS);
161
+		define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/');
162
+		define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/');
163
+		// define upload paths
164
+		$uploads = wp_upload_dir();
165
+		// define the uploads directory and URL
166
+		define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS);
167
+		define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS);
168
+		// define the templates directory and URL
169
+		define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS);
170
+		define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS);
171
+		// define the gateway directory and URL
172
+		define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS);
173
+		define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS);
174
+		// languages folder/path
175
+		define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS);
176
+		define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS);
177
+		//check for dompdf fonts in uploads
178
+		if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) {
179
+			define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS);
180
+		}
181
+		//ajax constants
182
+		define(
183
+				'EE_FRONT_AJAX',
184
+				isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false
185
+		);
186
+		define(
187
+				'EE_ADMIN_AJAX',
188
+				isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false
189
+		);
190
+		//just a handy constant occasionally needed for finding values representing infinity in the DB
191
+		//you're better to use this than its straight value (currently -1) in case you ever
192
+		//want to change its default value! or find when -1 means infinity
193
+		define('EE_INF_IN_DB', -1);
194
+		define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX);
195
+		define('EE_DEBUG', false);
196
+		// for older WP versions
197
+		if ( ! defined('MONTH_IN_SECONDS')) {
198
+			define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30);
199
+		}
200
+		/**
201
+		 *    espresso_plugin_activation
202
+		 *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
203
+		 */
204
+		function espresso_plugin_activation()
205
+		{
206
+			update_option('ee_espresso_activation', true);
207
+		}
208 208
 
209
-        register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
210
-        /**
211
-         *    espresso_load_error_handling
212
-         *    this function loads EE's class for handling exceptions and errors
213
-         */
214
-        function espresso_load_error_handling()
215
-        {
216
-            // load debugging tools
217
-            if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) {
218
-                require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php');
219
-                EEH_Debug_Tools::instance();
220
-            }
221
-            // load error handling
222
-            if (is_readable(EE_CORE . 'EE_Error.core.php')) {
223
-                require_once(EE_CORE . 'EE_Error.core.php');
224
-            } else {
225
-                wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso'));
226
-            }
227
-        }
209
+		register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
210
+		/**
211
+		 *    espresso_load_error_handling
212
+		 *    this function loads EE's class for handling exceptions and errors
213
+		 */
214
+		function espresso_load_error_handling()
215
+		{
216
+			// load debugging tools
217
+			if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) {
218
+				require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php');
219
+				EEH_Debug_Tools::instance();
220
+			}
221
+			// load error handling
222
+			if (is_readable(EE_CORE . 'EE_Error.core.php')) {
223
+				require_once(EE_CORE . 'EE_Error.core.php');
224
+			} else {
225
+				wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso'));
226
+			}
227
+		}
228 228
 
229
-        /**
230
-         *    espresso_load_required
231
-         *    given a class name and path, this function will load that file or throw an exception
232
-         *
233
-         * @param    string $classname
234
-         * @param    string $full_path_to_file
235
-         * @throws    EE_Error
236
-         */
237
-        function espresso_load_required($classname, $full_path_to_file)
238
-        {
239
-            static $error_handling_loaded = false;
240
-            if ( ! $error_handling_loaded) {
241
-                espresso_load_error_handling();
242
-                $error_handling_loaded = true;
243
-            }
244
-            if (is_readable($full_path_to_file)) {
245
-                require_once($full_path_to_file);
246
-            } else {
247
-                throw new EE_Error (
248
-                        sprintf(
249
-                                esc_html__(
250
-                                        'The %s class file could not be located or is not readable due to file permissions.',
251
-                                        'event_espresso'
252
-                                ),
253
-                                $classname
254
-                        )
255
-                );
256
-            }
257
-        }
229
+		/**
230
+		 *    espresso_load_required
231
+		 *    given a class name and path, this function will load that file or throw an exception
232
+		 *
233
+		 * @param    string $classname
234
+		 * @param    string $full_path_to_file
235
+		 * @throws    EE_Error
236
+		 */
237
+		function espresso_load_required($classname, $full_path_to_file)
238
+		{
239
+			static $error_handling_loaded = false;
240
+			if ( ! $error_handling_loaded) {
241
+				espresso_load_error_handling();
242
+				$error_handling_loaded = true;
243
+			}
244
+			if (is_readable($full_path_to_file)) {
245
+				require_once($full_path_to_file);
246
+			} else {
247
+				throw new EE_Error (
248
+						sprintf(
249
+								esc_html__(
250
+										'The %s class file could not be located or is not readable due to file permissions.',
251
+										'event_espresso'
252
+								),
253
+								$classname
254
+						)
255
+				);
256
+			}
257
+		}
258 258
 
259
-        espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php');
260
-        espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php');
261
-        espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php');
262
-        new EE_Bootstrap();
263
-    }
259
+		espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php');
260
+		espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php');
261
+		espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php');
262
+		new EE_Bootstrap();
263
+	}
264 264
 }
265 265
 if ( ! function_exists('espresso_deactivate_plugin')) {
266
-    /**
267
-     *    deactivate_plugin
268
-     * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
269
-     *
270
-     * @access public
271
-     * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
272
-     * @return    void
273
-     */
274
-    function espresso_deactivate_plugin($plugin_basename = '')
275
-    {
276
-        if ( ! function_exists('deactivate_plugins')) {
277
-            require_once(ABSPATH . 'wp-admin/includes/plugin.php');
278
-        }
279
-        unset($_GET['activate'], $_REQUEST['activate']);
280
-        deactivate_plugins($plugin_basename);
281
-    }
266
+	/**
267
+	 *    deactivate_plugin
268
+	 * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
269
+	 *
270
+	 * @access public
271
+	 * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
272
+	 * @return    void
273
+	 */
274
+	function espresso_deactivate_plugin($plugin_basename = '')
275
+	{
276
+		if ( ! function_exists('deactivate_plugins')) {
277
+			require_once(ABSPATH . 'wp-admin/includes/plugin.php');
278
+		}
279
+		unset($_GET['activate'], $_REQUEST['activate']);
280
+		deactivate_plugins($plugin_basename);
281
+	}
282 282
 }
283 283
\ No newline at end of file
Please login to merge, or discard this patch.