Completed
Branch FET-3467-waitlists (bb55f8)
by
unknown
68:09 queued 54:37
created
core/exceptions/ExceptionStackTraceDisplay.php 2 patches
Indentation   +275 added lines, -275 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 use ReflectionException;
8 8
 
9 9
 if (! defined('EVENT_ESPRESSO_VERSION')) {
10
-    exit('No direct script access allowed');
10
+	exit('No direct script access allowed');
11 11
 }
12 12
 
13 13
 
@@ -25,53 +25,53 @@  discard block
 block discarded – undo
25 25
 
26 26
 
27 27
 
28
-    /**
29
-     * @param Exception $exception
30
-     * @throws Exception
31
-     */
32
-    public function __construct(Exception $exception)
33
-    {
34
-        if (WP_DEBUG && ! defined('EE_TESTS_DIR')) {
35
-            $this->displayException($exception);
36
-        } else {
37
-            throw $exception;
38
-        }
39
-    }
28
+	/**
29
+	 * @param Exception $exception
30
+	 * @throws Exception
31
+	 */
32
+	public function __construct(Exception $exception)
33
+	{
34
+		if (WP_DEBUG && ! defined('EE_TESTS_DIR')) {
35
+			$this->displayException($exception);
36
+		} else {
37
+			throw $exception;
38
+		}
39
+	}
40 40
 
41 41
 
42 42
 
43
-    /**
44
-     * @access protected
45
-     * @param Exception $exception
46
-     * @throws ReflectionException
47
-     */
48
-    protected function displayException(Exception $exception)
49
-    {
50
-        $error_code = '';
51
-        $trace_details = '';
52
-        $time = time();
53
-        $trace = $exception->getTrace();
54
-        // get separate user and developer messages if they exist
55
-        $msg = explode('||', $exception->getMessage());
56
-        $user_msg = $msg[0];
57
-        $dev_msg = isset($msg[1]) ? $msg[1] : $msg[0];
58
-        $msg = WP_DEBUG ? $dev_msg : $user_msg;
59
-        // start gathering output
60
-        $output = $this->exceptionStyles();
61
-        $output .= '
43
+	/**
44
+	 * @access protected
45
+	 * @param Exception $exception
46
+	 * @throws ReflectionException
47
+	 */
48
+	protected function displayException(Exception $exception)
49
+	{
50
+		$error_code = '';
51
+		$trace_details = '';
52
+		$time = time();
53
+		$trace = $exception->getTrace();
54
+		// get separate user and developer messages if they exist
55
+		$msg = explode('||', $exception->getMessage());
56
+		$user_msg = $msg[0];
57
+		$dev_msg = isset($msg[1]) ? $msg[1] : $msg[0];
58
+		$msg = WP_DEBUG ? $dev_msg : $user_msg;
59
+		// start gathering output
60
+		$output = $this->exceptionStyles();
61
+		$output .= '
62 62
 <div id="ee-error-message" class="error">';
63
-        if (! WP_DEBUG) {
64
-            $output .= '
63
+		if (! WP_DEBUG) {
64
+			$output .= '
65 65
 	<p>';
66
-        }
67
-        // process trace info
68
-        if (empty($trace)) {
69
-            $trace_details .= __(
70
-                'Sorry, but no trace information was available for this exception.',
71
-                'event_espresso'
72
-            );
73
-        } else {
74
-            $trace_details .= '
66
+		}
67
+		// process trace info
68
+		if (empty($trace)) {
69
+			$trace_details .= __(
70
+				'Sorry, but no trace information was available for this exception.',
71
+				'event_espresso'
72
+			);
73
+		} else {
74
+			$trace_details .= '
75 75
 			<div id="ee-trace-details">
76 76
 			<table width="100%" border="0" cellpadding="5" cellspacing="0">
77 77
 				<tr>
@@ -79,255 +79,255 @@  discard block
 block discarded – undo
79 79
 					<th scope="col" align="right" style="width:3.5%;">Line</th>
80 80
 					<th scope="col" align="left" style="width:40%;">File</th>
81 81
 					<th scope="col" align="left">' . __('Class', 'event_espresso') . '->' . __('Method( arguments )',
82
-                    'event_espresso') . '</th>
82
+					'event_espresso') . '</th>
83 83
 				</tr>';
84
-            $last_on_stack = count($trace) - 1;
85
-            // reverse array so that stack is in proper chronological order
86
-            $sorted_trace = array_reverse($trace);
87
-            foreach ($sorted_trace as $nmbr => $trace) {
88
-                $file = isset($trace['file']) ? $trace['file'] : '';
89
-                $class = isset($trace['class']) ? $trace['class'] : '';
90
-                $type = isset($trace['type']) ? $trace['type'] : '';
91
-                $function = isset($trace['function']) ? $trace['function'] : '';
92
-                $args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : '';
93
-                $args = isset($trace['args']) && count($trace['args']) > 4 ? ' <br />' . $args . '<br />' : $args;
94
-                $line = isset($trace['line']) ? $trace['line'] : '';
95
-                $zebra = $nmbr % 2 !== 0 ? ' odd' : '';
96
-                if (empty($file) && ! empty($class)) {
97
-                    $a = new ReflectionClass($class);
98
-                    $file = $a->getFileName();
99
-                    if (empty($line) && ! empty($function)) {
100
-                        $b = new \ReflectionMethod($class, $function);
101
-                        $line = $b->getStartLine();
102
-                    }
103
-                }
104
-                if ($nmbr === $last_on_stack) {
105
-                    $file = $exception->getFile() !== '' ? $exception->getFile() : $file;
106
-                    $line = $exception->getLine() !== '' ? $exception->getLine() : $line;
107
-                    $error_code = $this->generate_error_code($file, $trace['function'], $line);
108
-                }
109
-                $file = \EEH_File::standardise_directory_separators($file);
110
-                $nmbr = ! empty($nmbr) ? $nmbr : '&nbsp;';
111
-                $line = ! empty($line) ? $line : '&nbsp;';
112
-                $file = ! empty($file) ? $file : '&nbsp;';
113
-                $class_display = ! empty($class) ? $class : '';
114
-                $type = ! empty($type) ? $type : '';
115
-                $function = ! empty($function) ? $function : '';
116
-                $args = ! empty($args) ? '( ' . $args . ' )' : '()';
117
-                $trace_details .= '
84
+			$last_on_stack = count($trace) - 1;
85
+			// reverse array so that stack is in proper chronological order
86
+			$sorted_trace = array_reverse($trace);
87
+			foreach ($sorted_trace as $nmbr => $trace) {
88
+				$file = isset($trace['file']) ? $trace['file'] : '';
89
+				$class = isset($trace['class']) ? $trace['class'] : '';
90
+				$type = isset($trace['type']) ? $trace['type'] : '';
91
+				$function = isset($trace['function']) ? $trace['function'] : '';
92
+				$args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : '';
93
+				$args = isset($trace['args']) && count($trace['args']) > 4 ? ' <br />' . $args . '<br />' : $args;
94
+				$line = isset($trace['line']) ? $trace['line'] : '';
95
+				$zebra = $nmbr % 2 !== 0 ? ' odd' : '';
96
+				if (empty($file) && ! empty($class)) {
97
+					$a = new ReflectionClass($class);
98
+					$file = $a->getFileName();
99
+					if (empty($line) && ! empty($function)) {
100
+						$b = new \ReflectionMethod($class, $function);
101
+						$line = $b->getStartLine();
102
+					}
103
+				}
104
+				if ($nmbr === $last_on_stack) {
105
+					$file = $exception->getFile() !== '' ? $exception->getFile() : $file;
106
+					$line = $exception->getLine() !== '' ? $exception->getLine() : $line;
107
+					$error_code = $this->generate_error_code($file, $trace['function'], $line);
108
+				}
109
+				$file = \EEH_File::standardise_directory_separators($file);
110
+				$nmbr = ! empty($nmbr) ? $nmbr : '&nbsp;';
111
+				$line = ! empty($line) ? $line : '&nbsp;';
112
+				$file = ! empty($file) ? $file : '&nbsp;';
113
+				$class_display = ! empty($class) ? $class : '';
114
+				$type = ! empty($type) ? $type : '';
115
+				$function = ! empty($function) ? $function : '';
116
+				$args = ! empty($args) ? '( ' . $args . ' )' : '()';
117
+				$trace_details .= '
118 118
 					<tr>
119 119
 						<td align="right" valign="top" class="'
120
-                                  . $zebra
121
-                                  . '">'
122
-                                  . $nmbr
123
-                                  . '</td>
120
+								  . $zebra
121
+								  . '">'
122
+								  . $nmbr
123
+								  . '</td>
124 124
 						<td align="right" valign="top" class="'
125
-                                  . $zebra
126
-                                  . '">'
127
-                                  . $line
128
-                                  . '</td>
125
+								  . $zebra
126
+								  . '">'
127
+								  . $line
128
+								  . '</td>
129 129
 						<td align="left" valign="top" class="'
130
-                                  . $zebra
131
-                                  . '">'
132
-                                  . $file
133
-                                  . '</td>
130
+								  . $zebra
131
+								  . '">'
132
+								  . $file
133
+								  . '</td>
134 134
 						<td align="left" valign="top" class="'
135
-                                  . $zebra
136
-                                  . '">'
137
-                                  . $class_display
138
-                                  . $type
139
-                                  . $function
140
-                                  . $args
141
-                                  . '</td>
135
+								  . $zebra
136
+								  . '">'
137
+								  . $class_display
138
+								  . $type
139
+								  . $function
140
+								  . $args
141
+								  . '</td>
142 142
 					</tr>';
143
-            }
144
-            $trace_details .= '
143
+			}
144
+			$trace_details .= '
145 145
 			 </table>
146 146
 			</div>';
147
-        }
148
-        $code = $exception->getCode() ? $exception->getCode() : $error_code;
149
-        // add generic non-identifying messages for non-privileged users
150
-        if (! WP_DEBUG) {
151
-            $output .= '<span class="ee-error-user-msg-spn">'
152
-                       . trim($msg)
153
-                       . '</span> &nbsp; <sup>'
154
-                       . $code
155
-                       . '</sup><br />';
156
-        } else {
157
-            // or helpful developer messages if debugging is on
158
-            $output .= '
147
+		}
148
+		$code = $exception->getCode() ? $exception->getCode() : $error_code;
149
+		// add generic non-identifying messages for non-privileged users
150
+		if (! WP_DEBUG) {
151
+			$output .= '<span class="ee-error-user-msg-spn">'
152
+					   . trim($msg)
153
+					   . '</span> &nbsp; <sup>'
154
+					   . $code
155
+					   . '</sup><br />';
156
+		} else {
157
+			// or helpful developer messages if debugging is on
158
+			$output .= '
159 159
 		<div class="ee-error-dev-msg-dv">
160 160
 			<p class="ee-error-dev-msg-pg">
161 161
 				'
162
-                       . sprintf(
163
-                           __('%1$sAn %2$s was thrown!%3$s code: %4$s', 'event_espresso'),
164
-                           '<strong class="ee-error-dev-msg-str">',
165
-                           get_class($exception),
166
-                           '</strong>  &nbsp; <span>',
167
-                           $code . '</span>'
168
-                       )
169
-                       . '<br />
162
+					   . sprintf(
163
+						   __('%1$sAn %2$s was thrown!%3$s code: %4$s', 'event_espresso'),
164
+						   '<strong class="ee-error-dev-msg-str">',
165
+						   get_class($exception),
166
+						   '</strong>  &nbsp; <span>',
167
+						   $code . '</span>'
168
+					   )
169
+					   . '<br />
170 170
 				<span class="big-text">"'
171
-                       . trim($msg)
172
-                       . '"</span><br/>
171
+					   . trim($msg)
172
+					   . '"</span><br/>
173 173
 				<a id="display-ee-error-trace-1'
174
-                       . $time
175
-                       . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-1'
176
-                       . $time
177
-                       . '">
174
+					   . $time
175
+					   . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-1'
176
+					   . $time
177
+					   . '">
178 178
 					'
179
-                       . __('click to view backtrace and class/method details', 'event_espresso')
180
-                       . '
179
+					   . __('click to view backtrace and class/method details', 'event_espresso')
180
+					   . '
181 181
 				</a><br />
182 182
 				'
183
-                       . $exception->getFile()
184
-                       . sprintf(
185
-                           __('%1$s( line no: %2$s )%3$s', 'event_espresso'),
186
-                           ' &nbsp; <span class="small-text lt-grey-text">',
187
-                           $exception->getLine(),
188
-                           '</span>'
189
-                       )
190
-                       . '
183
+					   . $exception->getFile()
184
+					   . sprintf(
185
+						   __('%1$s( line no: %2$s )%3$s', 'event_espresso'),
186
+						   ' &nbsp; <span class="small-text lt-grey-text">',
187
+						   $exception->getLine(),
188
+						   '</span>'
189
+					   )
190
+					   . '
191 191
 			</p>
192 192
 			<div id="ee-error-trace-1'
193
-                       . $time
194
-                       . '-dv" class="ee-error-trace-dv" style="display: none;">
193
+					   . $time
194
+					   . '-dv" class="ee-error-trace-dv" style="display: none;">
195 195
 				'
196
-                       . $trace_details;
197
-            if (! empty($class)) {
198
-                $output .= '
196
+					   . $trace_details;
197
+			if (! empty($class)) {
198
+				$output .= '
199 199
 				<div style="padding:3px; margin:0 0 1em; border:1px solid #999; background:#fff; border-radius:3px;">
200 200
 					<div style="padding:1em 2em; border:1px solid #999; background:#fcfcfc;">
201 201
 						<h3>' . __('Class Details', 'event_espresso') . '</h3>';
202
-                $a = new ReflectionClass($class);
203
-                $output .= '
202
+				$a = new ReflectionClass($class);
203
+				$output .= '
204 204
 						<pre>' . $a . '</pre>
205 205
 					</div>
206 206
 				</div>';
207
-            }
208
-            $output .= '
207
+			}
208
+			$output .= '
209 209
 			</div>
210 210
 		</div>
211 211
 		<br />';
212
-        }
213
-        // remove last linebreak
214
-        $output = substr($output, 0, -6);
215
-        if (! WP_DEBUG) {
216
-            $output .= '
212
+		}
213
+		// remove last linebreak
214
+		$output = substr($output, 0, -6);
215
+		if (! WP_DEBUG) {
216
+			$output .= '
217 217
 	</p>';
218
-        }
219
-        $output .= '
218
+		}
219
+		$output .= '
220 220
 </div>';
221
-        $output .= $this->printScripts(true);
222
-        if (defined('DOING_AJAX')) {
223
-            echo wp_json_encode(array('error' => $output));
224
-            exit();
225
-        }
226
-        echo $output;
227
-    }
221
+		$output .= $this->printScripts(true);
222
+		if (defined('DOING_AJAX')) {
223
+			echo wp_json_encode(array('error' => $output));
224
+			exit();
225
+		}
226
+		echo $output;
227
+	}
228 228
 
229 229
 
230 230
 
231
-    /**
232
-     * generate string from exception trace args
233
-     *
234
-     * @param array $arguments
235
-     * @param int   $indent
236
-     * @param bool  $array
237
-     * @return string
238
-     */
239
-    private function _convert_args_to_string($arguments = array(), $indent = 0, $array = false)
240
-    {
241
-        $args = array();
242
-        $args_count = count($arguments);
243
-        if ($args_count > 2) {
244
-            $indent++;
245
-            $args[] = '<br />';
246
-        }
247
-        $x = 0;
248
-        foreach ($arguments as $arg) {
249
-            $x++;
250
-            for ($i = 0; $i < $indent; $i++) {
251
-                $args[] = ' &nbsp;&nbsp; ';
252
-            }
253
-            if (is_string($arg)) {
254
-                if (! $array && strlen($arg) > 75) {
255
-                    $args[] = '<br />';
256
-                    for ($i = 0; $i <= $indent; $i++) {
257
-                        $args[] = ' &nbsp;&nbsp; ';
258
-                    }
259
-                    $args[] = "'" . $arg . "'<br />";
260
-                } else {
261
-                    $args[] = " '" . $arg . "'";
262
-                }
263
-            } elseif (is_array($arg)) {
264
-                $arg_count = count($arg);
265
-                if ($arg_count > 2) {
266
-                    $indent++;
267
-                    $args[] = ' array(' . $this->_convert_args_to_string($arg, $indent, true) . ')';
268
-                    $indent--;
269
-                } else if ($arg_count === 0) {
270
-                    $args[] = ' array()';
271
-                } else {
272
-                    $args[] = ' array( ' . $this->_convert_args_to_string($arg) . ' )';
273
-                }
274
-            } elseif ($arg === null) {
275
-                $args[] = ' null';
276
-            } elseif (is_bool($arg)) {
277
-                $args[] = $arg ? ' true' : ' false';
278
-            } elseif (is_object($arg)) {
279
-                $args[] = get_class($arg);
280
-            } elseif (is_resource($arg)) {
281
-                $args[] = get_resource_type($arg);
282
-            } else {
283
-                $args[] = $arg;
284
-            }
285
-            if ($x === $args_count) {
286
-                if ($args_count > 2) {
287
-                    $args[] = '<br />';
288
-                    $indent--;
289
-                    for ($i = 1; $i < $indent; $i++) {
290
-                        $args[] = ' &nbsp;&nbsp; ';
291
-                    }
292
-                }
293
-            } else {
294
-                $args[] = $args_count > 2 ? ',<br />' : ', ';
295
-            }
296
-        }
297
-        return implode('', $args);
298
-    }
231
+	/**
232
+	 * generate string from exception trace args
233
+	 *
234
+	 * @param array $arguments
235
+	 * @param int   $indent
236
+	 * @param bool  $array
237
+	 * @return string
238
+	 */
239
+	private function _convert_args_to_string($arguments = array(), $indent = 0, $array = false)
240
+	{
241
+		$args = array();
242
+		$args_count = count($arguments);
243
+		if ($args_count > 2) {
244
+			$indent++;
245
+			$args[] = '<br />';
246
+		}
247
+		$x = 0;
248
+		foreach ($arguments as $arg) {
249
+			$x++;
250
+			for ($i = 0; $i < $indent; $i++) {
251
+				$args[] = ' &nbsp;&nbsp; ';
252
+			}
253
+			if (is_string($arg)) {
254
+				if (! $array && strlen($arg) > 75) {
255
+					$args[] = '<br />';
256
+					for ($i = 0; $i <= $indent; $i++) {
257
+						$args[] = ' &nbsp;&nbsp; ';
258
+					}
259
+					$args[] = "'" . $arg . "'<br />";
260
+				} else {
261
+					$args[] = " '" . $arg . "'";
262
+				}
263
+			} elseif (is_array($arg)) {
264
+				$arg_count = count($arg);
265
+				if ($arg_count > 2) {
266
+					$indent++;
267
+					$args[] = ' array(' . $this->_convert_args_to_string($arg, $indent, true) . ')';
268
+					$indent--;
269
+				} else if ($arg_count === 0) {
270
+					$args[] = ' array()';
271
+				} else {
272
+					$args[] = ' array( ' . $this->_convert_args_to_string($arg) . ' )';
273
+				}
274
+			} elseif ($arg === null) {
275
+				$args[] = ' null';
276
+			} elseif (is_bool($arg)) {
277
+				$args[] = $arg ? ' true' : ' false';
278
+			} elseif (is_object($arg)) {
279
+				$args[] = get_class($arg);
280
+			} elseif (is_resource($arg)) {
281
+				$args[] = get_resource_type($arg);
282
+			} else {
283
+				$args[] = $arg;
284
+			}
285
+			if ($x === $args_count) {
286
+				if ($args_count > 2) {
287
+					$args[] = '<br />';
288
+					$indent--;
289
+					for ($i = 1; $i < $indent; $i++) {
290
+						$args[] = ' &nbsp;&nbsp; ';
291
+					}
292
+				}
293
+			} else {
294
+				$args[] = $args_count > 2 ? ',<br />' : ', ';
295
+			}
296
+		}
297
+		return implode('', $args);
298
+	}
299 299
 
300 300
 
301 301
 
302
-    /**
303
-     * create error code from filepath, function name,
304
-     * and line number where exception or error was thrown
305
-     *
306
-     * @access protected
307
-     * @param string $file
308
-     * @param string $func
309
-     * @param string $line
310
-     * @return string
311
-     */
312
-    protected function generate_error_code($file = '', $func = '', $line = '')
313
-    {
314
-        $file_bits = explode('.', basename($file));
315
-        $error_code = ! empty($file_bits[0]) ? $file_bits[0] : '';
316
-        $error_code .= ! empty($func) ? ' - ' . $func : '';
317
-        $error_code .= ! empty($line) ? ' - ' . $line : '';
318
-        return $error_code;
319
-    }
302
+	/**
303
+	 * create error code from filepath, function name,
304
+	 * and line number where exception or error was thrown
305
+	 *
306
+	 * @access protected
307
+	 * @param string $file
308
+	 * @param string $func
309
+	 * @param string $line
310
+	 * @return string
311
+	 */
312
+	protected function generate_error_code($file = '', $func = '', $line = '')
313
+	{
314
+		$file_bits = explode('.', basename($file));
315
+		$error_code = ! empty($file_bits[0]) ? $file_bits[0] : '';
316
+		$error_code .= ! empty($func) ? ' - ' . $func : '';
317
+		$error_code .= ! empty($line) ? ' - ' . $line : '';
318
+		return $error_code;
319
+	}
320 320
 
321 321
 
322 322
 
323
-    /**
324
-     * _exception_styles
325
-     *
326
-     * @return string
327
-     */
328
-    private function exceptionStyles()
329
-    {
330
-        return '
323
+	/**
324
+	 * _exception_styles
325
+	 *
326
+	 * @return string
327
+	 */
328
+	private function exceptionStyles()
329
+	{
330
+		return '
331 331
 <style type="text/css">
332 332
 	#ee-error-message {
333 333
 		max-width:90% !important;
@@ -384,30 +384,30 @@  discard block
 block discarded – undo
384 384
 		color: #999;
385 385
 	}
386 386
 </style>';
387
-    }
387
+	}
388 388
 
389 389
 
390 390
 
391
-    /**
392
-     * _print_scripts
393
-     *
394
-     * @param bool $force_print
395
-     * @return string
396
-     */
397
-    private function printScripts($force_print = false)
398
-    {
399
-        if (! $force_print && (did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts'))) {
400
-            if (wp_script_is('ee_error_js', 'enqueued')) {
401
-                return '';
402
-            }
403
-            if (wp_script_is('ee_error_js', 'registered')) {
404
-                wp_enqueue_style('espresso_default');
405
-                wp_enqueue_style('espresso_custom_css');
406
-                wp_enqueue_script( 'ee_error_js' );
391
+	/**
392
+	 * _print_scripts
393
+	 *
394
+	 * @param bool $force_print
395
+	 * @return string
396
+	 */
397
+	private function printScripts($force_print = false)
398
+	{
399
+		if (! $force_print && (did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts'))) {
400
+			if (wp_script_is('ee_error_js', 'enqueued')) {
401
+				return '';
402
+			}
403
+			if (wp_script_is('ee_error_js', 'registered')) {
404
+				wp_enqueue_style('espresso_default');
405
+				wp_enqueue_style('espresso_custom_css');
406
+				wp_enqueue_script( 'ee_error_js' );
407 407
 				wp_localize_script( 'ee_error_js', 'ee_settings', array( 'wp_debug' => WP_DEBUG ) );
408
-            }
409
-        } else {
410
-            return '
408
+			}
409
+		} else {
410
+			return '
411 411
 <script>
412 412
 /* <![CDATA[ */
413 413
 var ee_settings = {"wp_debug":"' . WP_DEBUG . '"};
@@ -417,9 +417,9 @@  discard block
 block discarded – undo
417 417
 <script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
418 418
 <script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
419 419
 ';
420
-        }
421
-        return '';
422
-    }
420
+		}
421
+		return '';
422
+	}
423 423
 
424 424
 
425 425
 
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 use ReflectionClass;
7 7
 use ReflectionException;
8 8
 
9
-if (! defined('EVENT_ESPRESSO_VERSION')) {
9
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
10 10
     exit('No direct script access allowed');
11 11
 }
12 12
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         $output = $this->exceptionStyles();
61 61
         $output .= '
62 62
 <div id="ee-error-message" class="error">';
63
-        if (! WP_DEBUG) {
63
+        if ( ! WP_DEBUG) {
64 64
             $output .= '
65 65
 	<p>';
66 66
         }
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 					<th scope="col" align="right" style="width:2.5%;">#</th>
79 79
 					<th scope="col" align="right" style="width:3.5%;">Line</th>
80 80
 					<th scope="col" align="left" style="width:40%;">File</th>
81
-					<th scope="col" align="left">' . __('Class', 'event_espresso') . '->' . __('Method( arguments )',
82
-                    'event_espresso') . '</th>
81
+					<th scope="col" align="left">' . __('Class', 'event_espresso').'->'.__('Method( arguments )',
82
+                    'event_espresso').'</th>
83 83
 				</tr>';
84 84
             $last_on_stack = count($trace) - 1;
85 85
             // reverse array so that stack is in proper chronological order
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
                 $type = isset($trace['type']) ? $trace['type'] : '';
91 91
                 $function = isset($trace['function']) ? $trace['function'] : '';
92 92
                 $args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : '';
93
-                $args = isset($trace['args']) && count($trace['args']) > 4 ? ' <br />' . $args . '<br />' : $args;
93
+                $args = isset($trace['args']) && count($trace['args']) > 4 ? ' <br />'.$args.'<br />' : $args;
94 94
                 $line = isset($trace['line']) ? $trace['line'] : '';
95 95
                 $zebra = $nmbr % 2 !== 0 ? ' odd' : '';
96 96
                 if (empty($file) && ! empty($class)) {
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
                 $class_display = ! empty($class) ? $class : '';
114 114
                 $type = ! empty($type) ? $type : '';
115 115
                 $function = ! empty($function) ? $function : '';
116
-                $args = ! empty($args) ? '( ' . $args . ' )' : '()';
116
+                $args = ! empty($args) ? '( '.$args.' )' : '()';
117 117
                 $trace_details .= '
118 118
 					<tr>
119 119
 						<td align="right" valign="top" class="'
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         }
148 148
         $code = $exception->getCode() ? $exception->getCode() : $error_code;
149 149
         // add generic non-identifying messages for non-privileged users
150
-        if (! WP_DEBUG) {
150
+        if ( ! WP_DEBUG) {
151 151
             $output .= '<span class="ee-error-user-msg-spn">'
152 152
                        . trim($msg)
153 153
                        . '</span> &nbsp; <sup>'
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
                            '<strong class="ee-error-dev-msg-str">',
165 165
                            get_class($exception),
166 166
                            '</strong>  &nbsp; <span>',
167
-                           $code . '</span>'
167
+                           $code.'</span>'
168 168
                        )
169 169
                        . '<br />
170 170
 				<span class="big-text">"'
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
                        . '-dv" class="ee-error-trace-dv" style="display: none;">
195 195
 				'
196 196
                        . $trace_details;
197
-            if (! empty($class)) {
197
+            if ( ! empty($class)) {
198 198
                 $output .= '
199 199
 				<div style="padding:3px; margin:0 0 1em; border:1px solid #999; background:#fff; border-radius:3px;">
200 200
 					<div style="padding:1em 2em; border:1px solid #999; background:#fcfcfc;">
201
-						<h3>' . __('Class Details', 'event_espresso') . '</h3>';
201
+						<h3>' . __('Class Details', 'event_espresso').'</h3>';
202 202
                 $a = new ReflectionClass($class);
203 203
                 $output .= '
204
-						<pre>' . $a . '</pre>
204
+						<pre>' . $a.'</pre>
205 205
 					</div>
206 206
 				</div>';
207 207
             }
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         }
213 213
         // remove last linebreak
214 214
         $output = substr($output, 0, -6);
215
-        if (! WP_DEBUG) {
215
+        if ( ! WP_DEBUG) {
216 216
             $output .= '
217 217
 	</p>';
218 218
         }
@@ -251,25 +251,25 @@  discard block
 block discarded – undo
251 251
                 $args[] = ' &nbsp;&nbsp; ';
252 252
             }
253 253
             if (is_string($arg)) {
254
-                if (! $array && strlen($arg) > 75) {
254
+                if ( ! $array && strlen($arg) > 75) {
255 255
                     $args[] = '<br />';
256 256
                     for ($i = 0; $i <= $indent; $i++) {
257 257
                         $args[] = ' &nbsp;&nbsp; ';
258 258
                     }
259
-                    $args[] = "'" . $arg . "'<br />";
259
+                    $args[] = "'".$arg."'<br />";
260 260
                 } else {
261
-                    $args[] = " '" . $arg . "'";
261
+                    $args[] = " '".$arg."'";
262 262
                 }
263 263
             } elseif (is_array($arg)) {
264 264
                 $arg_count = count($arg);
265 265
                 if ($arg_count > 2) {
266 266
                     $indent++;
267
-                    $args[] = ' array(' . $this->_convert_args_to_string($arg, $indent, true) . ')';
267
+                    $args[] = ' array('.$this->_convert_args_to_string($arg, $indent, true).')';
268 268
                     $indent--;
269 269
                 } else if ($arg_count === 0) {
270 270
                     $args[] = ' array()';
271 271
                 } else {
272
-                    $args[] = ' array( ' . $this->_convert_args_to_string($arg) . ' )';
272
+                    $args[] = ' array( '.$this->_convert_args_to_string($arg).' )';
273 273
                 }
274 274
             } elseif ($arg === null) {
275 275
                 $args[] = ' null';
@@ -313,8 +313,8 @@  discard block
 block discarded – undo
313 313
     {
314 314
         $file_bits = explode('.', basename($file));
315 315
         $error_code = ! empty($file_bits[0]) ? $file_bits[0] : '';
316
-        $error_code .= ! empty($func) ? ' - ' . $func : '';
317
-        $error_code .= ! empty($line) ? ' - ' . $line : '';
316
+        $error_code .= ! empty($func) ? ' - '.$func : '';
317
+        $error_code .= ! empty($line) ? ' - '.$line : '';
318 318
         return $error_code;
319 319
     }
320 320
 
@@ -396,26 +396,26 @@  discard block
 block discarded – undo
396 396
      */
397 397
     private function printScripts($force_print = false)
398 398
     {
399
-        if (! $force_print && (did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts'))) {
399
+        if ( ! $force_print && (did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts'))) {
400 400
             if (wp_script_is('ee_error_js', 'enqueued')) {
401 401
                 return '';
402 402
             }
403 403
             if (wp_script_is('ee_error_js', 'registered')) {
404 404
                 wp_enqueue_style('espresso_default');
405 405
                 wp_enqueue_style('espresso_custom_css');
406
-                wp_enqueue_script( 'ee_error_js' );
407
-				wp_localize_script( 'ee_error_js', 'ee_settings', array( 'wp_debug' => WP_DEBUG ) );
406
+                wp_enqueue_script('ee_error_js');
407
+				wp_localize_script('ee_error_js', 'ee_settings', array('wp_debug' => WP_DEBUG));
408 408
             }
409 409
         } else {
410 410
             return '
411 411
 <script>
412 412
 /* <![CDATA[ */
413
-var ee_settings = {"wp_debug":"' . WP_DEBUG . '"};
413
+var ee_settings = {"wp_debug":"' . WP_DEBUG.'"};
414 414
 /* ]]> */
415 415
 </script>
416
-<script src="' . includes_url() . 'js/jquery/jquery.js" type="text/javascript"></script>
417
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
418
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
416
+<script src="' . includes_url().'js/jquery/jquery.js" type="text/javascript"></script>
417
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
418
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
419 419
 ';
420 420
         }
421 421
         return '';
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.40.rc.003');
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.40.rc.003');
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.