@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\Core\Exceptions; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | * @param \Exception $previous |
26 | 26 | * @throws \EventEspresso\Core\Exceptions\BaseException |
27 | 27 | */ |
28 | - public function __construct( $message, $code = 0, \Exception $previous = null ) { |
|
29 | - parent::__construct( $message, $code, $previous ); |
|
28 | + public function __construct($message, $code = 0, \Exception $previous = null) { |
|
29 | + parent::__construct($message, $code, $previous); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 |
@@ -168,28 +168,28 @@ discard block |
||
168 | 168 | $trace_details .= ' |
169 | 169 | <tr> |
170 | 170 | <td align="right" valign="top" class="' |
171 | - . $corellian_bloodstripe |
|
172 | - . '">' |
|
173 | - . $nmbr |
|
174 | - . '</td> |
|
171 | + . $corellian_bloodstripe |
|
172 | + . '">' |
|
173 | + . $nmbr |
|
174 | + . '</td> |
|
175 | 175 | <td align="right" valign="top" class="' |
176 | - . $corellian_bloodstripe |
|
177 | - . '">' |
|
178 | - . $line |
|
179 | - . '</td> |
|
176 | + . $corellian_bloodstripe |
|
177 | + . '">' |
|
178 | + . $line |
|
179 | + . '</td> |
|
180 | 180 | <td align="left" valign="top" class="' |
181 | - . $corellian_bloodstripe |
|
182 | - . '">' |
|
183 | - . $file |
|
184 | - . '</td> |
|
181 | + . $corellian_bloodstripe |
|
182 | + . '">' |
|
183 | + . $file |
|
184 | + . '</td> |
|
185 | 185 | <td align="left" valign="top" class="' |
186 | - . $corellian_bloodstripe |
|
187 | - . '">' |
|
188 | - . $class_display |
|
189 | - . $type |
|
190 | - . $function |
|
191 | - . $args |
|
192 | - . '</td> |
|
186 | + . $corellian_bloodstripe |
|
187 | + . '">' |
|
188 | + . $class_display |
|
189 | + . $type |
|
190 | + . $function |
|
191 | + . $args |
|
192 | + . '</td> |
|
193 | 193 | </tr>'; |
194 | 194 | } |
195 | 195 | $trace_details .= ' |
@@ -200,51 +200,51 @@ discard block |
||
200 | 200 | // add generic non-identifying messages for non-privileged users |
201 | 201 | if ( ! WP_DEBUG ) { |
202 | 202 | $this->pretty_exception .= '<span class="ee-error-user-msg-spn">' |
203 | - . trim( $msg ) |
|
204 | - . '</span> <sup>' |
|
205 | - . $error_code |
|
206 | - . '</sup><br />'; |
|
203 | + . trim( $msg ) |
|
204 | + . '</span> <sup>' |
|
205 | + . $error_code |
|
206 | + . '</sup><br />'; |
|
207 | 207 | } else { |
208 | 208 | // or helpful developer messages if debugging is on |
209 | 209 | $this->pretty_exception .= ' |
210 | 210 | <div class="ee-error-dev-msg-dv"> |
211 | 211 | <p class="ee-error-dev-msg-pg"> |
212 | 212 | ' |
213 | - . sprintf( |
|
214 | - __( '%1$sAn %2$s was thrown!%3$s code: %4$s', 'event_espresso' ), |
|
215 | - '<strong class="ee-error-dev-msg-str">', |
|
216 | - get_class( $this->exception ), |
|
217 | - '</strong> <span>', |
|
218 | - $error_code . '</span>' |
|
219 | - ) |
|
220 | - . '<br /> |
|
213 | + . sprintf( |
|
214 | + __( '%1$sAn %2$s was thrown!%3$s code: %4$s', 'event_espresso' ), |
|
215 | + '<strong class="ee-error-dev-msg-str">', |
|
216 | + get_class( $this->exception ), |
|
217 | + '</strong> <span>', |
|
218 | + $error_code . '</span>' |
|
219 | + ) |
|
220 | + . '<br /> |
|
221 | 221 | <span class="big-text">"' |
222 | - . trim( $msg ) |
|
223 | - . '"</span><br/> |
|
222 | + . trim( $msg ) |
|
223 | + . '"</span><br/> |
|
224 | 224 | <a id="display-ee-error-trace' |
225 | - . $this->time |
|
226 | - . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace' |
|
227 | - . $this->time |
|
228 | - . '"> |
|
225 | + . $this->time |
|
226 | + . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace' |
|
227 | + . $this->time |
|
228 | + . '"> |
|
229 | 229 | ' |
230 | - . __( 'click to view backtrace and class/method details', 'event_espresso' ) |
|
231 | - . ' |
|
230 | + . __( 'click to view backtrace and class/method details', 'event_espresso' ) |
|
231 | + . ' |
|
232 | 232 | </a><br /> |
233 | 233 | ' |
234 | - . $this->exception->getFile() |
|
235 | - . sprintf( |
|
236 | - __( '%1$s( line no: %2$s )%3$s', 'event_espresso' ), |
|
237 | - ' <span class="small-text lt-grey-text">', |
|
238 | - $this->exception->getLine(), |
|
239 | - '</span>' |
|
240 | - ) |
|
241 | - . ' |
|
234 | + . $this->exception->getFile() |
|
235 | + . sprintf( |
|
236 | + __( '%1$s( line no: %2$s )%3$s', 'event_espresso' ), |
|
237 | + ' <span class="small-text lt-grey-text">', |
|
238 | + $this->exception->getLine(), |
|
239 | + '</span>' |
|
240 | + ) |
|
241 | + . ' |
|
242 | 242 | </p> |
243 | 243 | <div id="ee-error-trace' |
244 | - . $this->time |
|
245 | - . '-dv" class="ee-error-trace-dv" style="display: none;"> |
|
244 | + . $this->time |
|
245 | + . '-dv" class="ee-error-trace-dv" style="display: none;"> |
|
246 | 246 | ' |
247 | - . $trace_details; |
|
247 | + . $trace_details; |
|
248 | 248 | if ( ! empty( $class ) ) { |
249 | 249 | $this->pretty_exception .= ' |
250 | 250 | <div style="padding:3px; margin:0 0 1em; border:1px solid #999; background:#fff; border-radius:3px;"> |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | |
4 | 4 | use Exception; |
5 | 5 | |
6 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
7 | - exit( 'No direct script access allowed' ); |
|
6 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
7 | + exit('No direct script access allowed'); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @param \Exception $exception |
48 | 48 | * @param ExceptionLogger $logger |
49 | 49 | */ |
50 | - public function __construct( Exception $exception, ExceptionLogger $logger = null ) { |
|
50 | + public function __construct(Exception $exception, ExceptionLogger $logger = null) { |
|
51 | 51 | $this->time = time(); |
52 | 52 | $this->exception = $exception; |
53 | 53 | $this->logger = $logger; |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | |
59 | 59 | public function display() { |
60 | 60 | $this->format_error(); |
61 | - if ( defined( 'DOING_AJAX' ) ) { |
|
62 | - echo json_encode( array( 'error' => $this->pretty_exception ) ); |
|
61 | + if (defined('DOING_AJAX')) { |
|
62 | + echo json_encode(array('error' => $this->pretty_exception)); |
|
63 | 63 | exit(); |
64 | 64 | } |
65 | 65 | echo $this->pretty_exception; |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | |
76 | 76 | |
77 | 77 | public function log() { |
78 | - if ( ! $this->logger instanceof ExceptionLogger ) { |
|
79 | - $this->logger = new ExceptionLogger( $this->exception ); |
|
78 | + if ( ! $this->logger instanceof ExceptionLogger) { |
|
79 | + $this->logger = new ExceptionLogger($this->exception); |
|
80 | 80 | } |
81 | 81 | $this->logger->log(); |
82 | 82 | } |
@@ -100,20 +100,20 @@ discard block |
||
100 | 100 | $error_code = ''; |
101 | 101 | $trace_details = ''; |
102 | 102 | // get separate user and developer messages if they exist |
103 | - $msg = explode( '||', $this->exception->getMessage() ); |
|
103 | + $msg = explode('||', $this->exception->getMessage()); |
|
104 | 104 | $user_msg = $msg[0]; |
105 | - $dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0]; |
|
105 | + $dev_msg = isset($msg[1]) ? $msg[1] : $msg[0]; |
|
106 | 106 | $msg = WP_DEBUG ? $dev_msg : $user_msg; |
107 | 107 | $backtrace = $this->exception->getTrace(); |
108 | 108 | $this->pretty_exception = ExceptionHandler::_exception_styles(); |
109 | 109 | $this->pretty_exception .= ' |
110 | 110 | <div id="ee-error-message" class="error">'; |
111 | - if ( ! WP_DEBUG ) { |
|
111 | + if ( ! WP_DEBUG) { |
|
112 | 112 | $this->pretty_exception .= ' |
113 | 113 | <p>'; |
114 | 114 | } |
115 | 115 | // process trace info |
116 | - if ( empty( $backtrace ) ) { |
|
116 | + if (empty($backtrace)) { |
|
117 | 117 | $trace_details .= __( |
118 | 118 | 'Sorry, but no trace information was available for this exception.', |
119 | 119 | 'event_espresso' |
@@ -126,45 +126,45 @@ discard block |
||
126 | 126 | <th scope="col" align="right" style="width:2.5%;">#</th> |
127 | 127 | <th scope="col" align="right" style="width:3.5%;">Line</th> |
128 | 128 | <th scope="col" align="left" style="width:40%;">File</th> |
129 | - <th scope="col" align="left">' . __( 'Class', 'event_espresso' ) . '->' . __( |
|
129 | + <th scope="col" align="left">' . __('Class', 'event_espresso').'->'.__( |
|
130 | 130 | 'Method( arguments )', |
131 | 131 | 'event_espresso' |
132 | - ) . '</th> |
|
132 | + ).'</th> |
|
133 | 133 | </tr>'; |
134 | - $last_on_stack = count( $backtrace ) - 1; |
|
134 | + $last_on_stack = count($backtrace) - 1; |
|
135 | 135 | // reverse array so that stack is in proper chronological order |
136 | - $sorted_trace = array_reverse( $backtrace ); |
|
137 | - foreach ( $sorted_trace as $nmbr => $trace ) { |
|
138 | - $file = isset( $trace['file'] ) ? $trace['file'] : ''; |
|
139 | - $class = isset( $trace['class'] ) ? $trace['class'] : ''; |
|
140 | - $type = isset( $trace['type'] ) ? $trace['type'] : ''; |
|
141 | - $function = isset( $trace['function'] ) ? $trace['function'] : ''; |
|
142 | - $args = isset( $trace['args'] ) ? $this->_convert_args_to_string( $trace['args'] ) : ''; |
|
143 | - $args = isset( $trace['args'] ) && count( $trace['args'] ) > 4 ? ' <br />' . $args . '<br />' |
|
136 | + $sorted_trace = array_reverse($backtrace); |
|
137 | + foreach ($sorted_trace as $nmbr => $trace) { |
|
138 | + $file = isset($trace['file']) ? $trace['file'] : ''; |
|
139 | + $class = isset($trace['class']) ? $trace['class'] : ''; |
|
140 | + $type = isset($trace['type']) ? $trace['type'] : ''; |
|
141 | + $function = isset($trace['function']) ? $trace['function'] : ''; |
|
142 | + $args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : ''; |
|
143 | + $args = isset($trace['args']) && count($trace['args']) > 4 ? ' <br />'.$args.'<br />' |
|
144 | 144 | : $args; |
145 | - $line = isset( $trace['line'] ) ? $trace['line'] : ''; |
|
145 | + $line = isset($trace['line']) ? $trace['line'] : ''; |
|
146 | 146 | $corellian_bloodstripe = $nmbr % 2 !== 0 ? ' odd' : ''; |
147 | - if ( empty( $file ) && ! empty( $class ) ) { |
|
148 | - $a = new \ReflectionClass( $class ); |
|
147 | + if (empty($file) && ! empty($class)) { |
|
148 | + $a = new \ReflectionClass($class); |
|
149 | 149 | $file = $a->getFileName(); |
150 | - if ( empty( $line ) && ! empty( $function ) ) { |
|
151 | - $b = new \ReflectionMethod( $class, $function ); |
|
150 | + if (empty($line) && ! empty($function)) { |
|
151 | + $b = new \ReflectionMethod($class, $function); |
|
152 | 152 | $line = $b->getStartLine(); |
153 | 153 | } |
154 | 154 | } |
155 | - if ( $nmbr === $last_on_stack ) { |
|
155 | + if ($nmbr === $last_on_stack) { |
|
156 | 156 | $file = $this->exception->getFile() !== '' ? $this->exception->getFile() : $file; |
157 | 157 | $line = $this->exception->getLine() !== '' ? $this->exception->getLine() : $line; |
158 | - $error_code = self::generate_error_code( $file, $trace['function'], $line ); |
|
158 | + $error_code = self::generate_error_code($file, $trace['function'], $line); |
|
159 | 159 | } |
160 | - $file = \EEH_File::standardise_directory_separators( $file ); |
|
161 | - $nmbr = ! empty( $nmbr ) ? $nmbr : ' '; |
|
162 | - $line = ! empty( $line ) ? $line : ' '; |
|
163 | - $file = ! empty( $file ) ? $file : ' '; |
|
164 | - $class_display = ! empty( $class ) ? $class : ''; |
|
165 | - $type = ! empty( $type ) ? $type : ''; |
|
166 | - $function = ! empty( $function ) ? $function : ''; |
|
167 | - $args = ! empty( $args ) ? '( ' . $args . ' )' : '()'; |
|
160 | + $file = \EEH_File::standardise_directory_separators($file); |
|
161 | + $nmbr = ! empty($nmbr) ? $nmbr : ' '; |
|
162 | + $line = ! empty($line) ? $line : ' '; |
|
163 | + $file = ! empty($file) ? $file : ' '; |
|
164 | + $class_display = ! empty($class) ? $class : ''; |
|
165 | + $type = ! empty($type) ? $type : ''; |
|
166 | + $function = ! empty($function) ? $function : ''; |
|
167 | + $args = ! empty($args) ? '( '.$args.' )' : '()'; |
|
168 | 168 | $trace_details .= ' |
169 | 169 | <tr> |
170 | 170 | <td align="right" valign="top" class="' |
@@ -198,9 +198,9 @@ discard block |
||
198 | 198 | } |
199 | 199 | $error_code = $this->exception->getCode() ? $this->exception->getCode() : $error_code; |
200 | 200 | // add generic non-identifying messages for non-privileged users |
201 | - if ( ! WP_DEBUG ) { |
|
201 | + if ( ! WP_DEBUG) { |
|
202 | 202 | $this->pretty_exception .= '<span class="ee-error-user-msg-spn">' |
203 | - . trim( $msg ) |
|
203 | + . trim($msg) |
|
204 | 204 | . '</span> <sup>' |
205 | 205 | . $error_code |
206 | 206 | . '</sup><br />'; |
@@ -211,15 +211,15 @@ discard block |
||
211 | 211 | <p class="ee-error-dev-msg-pg"> |
212 | 212 | ' |
213 | 213 | . sprintf( |
214 | - __( '%1$sAn %2$s was thrown!%3$s code: %4$s', 'event_espresso' ), |
|
214 | + __('%1$sAn %2$s was thrown!%3$s code: %4$s', 'event_espresso'), |
|
215 | 215 | '<strong class="ee-error-dev-msg-str">', |
216 | - get_class( $this->exception ), |
|
216 | + get_class($this->exception), |
|
217 | 217 | '</strong> <span>', |
218 | - $error_code . '</span>' |
|
218 | + $error_code.'</span>' |
|
219 | 219 | ) |
220 | 220 | . '<br /> |
221 | 221 | <span class="big-text">"' |
222 | - . trim( $msg ) |
|
222 | + . trim($msg) |
|
223 | 223 | . '"</span><br/> |
224 | 224 | <a id="display-ee-error-trace' |
225 | 225 | . $this->time |
@@ -227,13 +227,13 @@ discard block |
||
227 | 227 | . $this->time |
228 | 228 | . '"> |
229 | 229 | ' |
230 | - . __( 'click to view backtrace and class/method details', 'event_espresso' ) |
|
230 | + . __('click to view backtrace and class/method details', 'event_espresso') |
|
231 | 231 | . ' |
232 | 232 | </a><br /> |
233 | 233 | ' |
234 | 234 | . $this->exception->getFile() |
235 | 235 | . sprintf( |
236 | - __( '%1$s( line no: %2$s )%3$s', 'event_espresso' ), |
|
236 | + __('%1$s( line no: %2$s )%3$s', 'event_espresso'), |
|
237 | 237 | ' <span class="small-text lt-grey-text">', |
238 | 238 | $this->exception->getLine(), |
239 | 239 | '</span>' |
@@ -245,14 +245,14 @@ discard block |
||
245 | 245 | . '-dv" class="ee-error-trace-dv" style="display: none;"> |
246 | 246 | ' |
247 | 247 | . $trace_details; |
248 | - if ( ! empty( $class ) ) { |
|
248 | + if ( ! empty($class)) { |
|
249 | 249 | $this->pretty_exception .= ' |
250 | 250 | <div style="padding:3px; margin:0 0 1em; border:1px solid #999; background:#fff; border-radius:3px;"> |
251 | 251 | <div style="padding:1em 2em; border:1px solid #999; background:#fcfcfc;"> |
252 | - <h3>' . __( 'Class Details', 'event_espresso' ) . '</h3>'; |
|
253 | - $a = new \ReflectionClass( $class ); |
|
252 | + <h3>' . __('Class Details', 'event_espresso').'</h3>'; |
|
253 | + $a = new \ReflectionClass($class); |
|
254 | 254 | $this->pretty_exception .= ' |
255 | - <pre>' . $a . '</pre> |
|
255 | + <pre>' . $a.'</pre> |
|
256 | 256 | </div> |
257 | 257 | </div>'; |
258 | 258 | } |
@@ -264,13 +264,13 @@ discard block |
||
264 | 264 | |
265 | 265 | // remove last linebreak |
266 | 266 | // $this->pretty_exception = substr( $this->pretty_exception, 0, count( $this->pretty_exception ) - 7 ); |
267 | - if ( ! WP_DEBUG ) { |
|
267 | + if ( ! WP_DEBUG) { |
|
268 | 268 | $this->pretty_exception .= ' |
269 | 269 | </p>'; |
270 | 270 | } |
271 | 271 | $this->pretty_exception .= ' |
272 | 272 | </div>'; |
273 | - $this->pretty_exception .= self::_print_scripts( true ); |
|
273 | + $this->pretty_exception .= self::_print_scripts(true); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | |
@@ -283,56 +283,56 @@ discard block |
||
283 | 283 | * @param bool $array |
284 | 284 | * @return string |
285 | 285 | */ |
286 | - private function _convert_args_to_string( $arguments = array(), $indent = 0, $array = false ) { |
|
286 | + private function _convert_args_to_string($arguments = array(), $indent = 0, $array = false) { |
|
287 | 287 | $args = array(); |
288 | - $args_count = count( $arguments ); |
|
289 | - if ( $args_count > 2 ) { |
|
288 | + $args_count = count($arguments); |
|
289 | + if ($args_count > 2) { |
|
290 | 290 | $indent++; |
291 | 291 | $args[] = '<br />'; |
292 | 292 | } |
293 | 293 | $x = 0; |
294 | - foreach ( $arguments as $arg ) { |
|
294 | + foreach ($arguments as $arg) { |
|
295 | 295 | $x++; |
296 | - for ( $i = 0; $i < $indent; $i++ ) { |
|
296 | + for ($i = 0; $i < $indent; $i++) { |
|
297 | 297 | $args[] = ' '; |
298 | 298 | } |
299 | - if ( is_string( $arg ) ) { |
|
300 | - if ( ! $array && strlen( $arg ) > 75 ) { |
|
299 | + if (is_string($arg)) { |
|
300 | + if ( ! $array && strlen($arg) > 75) { |
|
301 | 301 | $args[] = "<br />"; |
302 | - for ( $i = 0; $i <= $indent; $i++ ) { |
|
302 | + for ($i = 0; $i <= $indent; $i++) { |
|
303 | 303 | $args[] = ' '; |
304 | 304 | } |
305 | - $args[] = "'" . $arg . "'<br />"; |
|
305 | + $args[] = "'".$arg."'<br />"; |
|
306 | 306 | } else { |
307 | - $args[] = " '" . $arg . "'"; |
|
307 | + $args[] = " '".$arg."'"; |
|
308 | 308 | } |
309 | - } elseif ( is_array( $arg ) ) { |
|
310 | - $arg_count = count( $arg ); |
|
311 | - if ( $arg_count > 2 ) { |
|
309 | + } elseif (is_array($arg)) { |
|
310 | + $arg_count = count($arg); |
|
311 | + if ($arg_count > 2) { |
|
312 | 312 | $indent++; |
313 | - $args[] = " array(" . $this->_convert_args_to_string( $arg, $indent, true ) . ")"; |
|
313 | + $args[] = " array(".$this->_convert_args_to_string($arg, $indent, true).")"; |
|
314 | 314 | $indent--; |
315 | - } else if ( $arg_count === 0 ) { |
|
315 | + } else if ($arg_count === 0) { |
|
316 | 316 | $args[] = " array()"; |
317 | 317 | } else { |
318 | - $args[] = " array( " . $this->_convert_args_to_string( $arg ) . " )"; |
|
318 | + $args[] = " array( ".$this->_convert_args_to_string($arg)." )"; |
|
319 | 319 | } |
320 | - } elseif ( $arg === null ) { |
|
320 | + } elseif ($arg === null) { |
|
321 | 321 | $args[] = ' null'; |
322 | - } elseif ( is_bool( $arg ) ) { |
|
322 | + } elseif (is_bool($arg)) { |
|
323 | 323 | $args[] = $arg ? ' true' : ' false'; |
324 | - } elseif ( is_object( $arg ) ) { |
|
325 | - $args[] = get_class( $arg ); |
|
326 | - } elseif ( is_resource( $arg ) ) { |
|
327 | - $args[] = get_resource_type( $arg ); |
|
324 | + } elseif (is_object($arg)) { |
|
325 | + $args[] = get_class($arg); |
|
326 | + } elseif (is_resource($arg)) { |
|
327 | + $args[] = get_resource_type($arg); |
|
328 | 328 | } else { |
329 | 329 | $args[] = $arg; |
330 | 330 | } |
331 | - if ( $x === $args_count ) { |
|
332 | - if ( $args_count > 2 ) { |
|
331 | + if ($x === $args_count) { |
|
332 | + if ($args_count > 2) { |
|
333 | 333 | $args[] = "<br />"; |
334 | 334 | $indent--; |
335 | - for ( $i = 1; $i < $indent; $i++ ) { |
|
335 | + for ($i = 1; $i < $indent; $i++) { |
|
336 | 336 | $args[] = ' '; |
337 | 337 | } |
338 | 338 | } |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | $args[] = $args_count > 2 ? ",<br />" : ', '; |
341 | 341 | } |
342 | 342 | } |
343 | - return implode( '', $args ); |
|
343 | + return implode('', $args); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | |
@@ -355,11 +355,11 @@ discard block |
||
355 | 355 | * @param string $line |
356 | 356 | * @return string |
357 | 357 | */ |
358 | - public static function generate_error_code( $file = '', $func = '', $line = '' ) { |
|
359 | - $file_bits = explode( '.', basename( $file ) ); |
|
360 | - $error_code = ! empty( $file_bits[0] ) ? $file_bits[0] : ''; |
|
361 | - $error_code .= ! empty( $func ) ? ' - ' . $func : ''; |
|
362 | - $error_code .= ! empty( $line ) ? ' - ' . $line : ''; |
|
358 | + public static function generate_error_code($file = '', $func = '', $line = '') { |
|
359 | + $file_bits = explode('.', basename($file)); |
|
360 | + $error_code = ! empty($file_bits[0]) ? $file_bits[0] : ''; |
|
361 | + $error_code .= ! empty($func) ? ' - '.$func : ''; |
|
362 | + $error_code .= ! empty($line) ? ' - '.$line : ''; |
|
363 | 363 | return $error_code; |
364 | 364 | } |
365 | 365 | |
@@ -438,26 +438,26 @@ discard block |
||
438 | 438 | * @param bool $force_print |
439 | 439 | * @return string|void |
440 | 440 | */ |
441 | - private static function _print_scripts( $force_print = false ) { |
|
442 | - if ( ! $force_print && ( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' ) ) ) { |
|
443 | - if ( wp_script_is( 'ee_error_js', 'enqueued' ) ) { |
|
441 | + private static function _print_scripts($force_print = false) { |
|
442 | + if ( ! $force_print && (did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts'))) { |
|
443 | + if (wp_script_is('ee_error_js', 'enqueued')) { |
|
444 | 444 | return ''; |
445 | - } else if ( wp_script_is( 'ee_error_js', 'registered' ) ) { |
|
446 | - add_filter( 'FHEE_load_css', '__return_true' ); |
|
447 | - add_filter( 'FHEE_load_js', '__return_true' ); |
|
448 | - wp_enqueue_script( 'ee_error_js' ); |
|
449 | - wp_localize_script( 'ee_error_js', 'ee_settings', array( 'wp_debug' => WP_DEBUG ) ); |
|
445 | + } else if (wp_script_is('ee_error_js', 'registered')) { |
|
446 | + add_filter('FHEE_load_css', '__return_true'); |
|
447 | + add_filter('FHEE_load_js', '__return_true'); |
|
448 | + wp_enqueue_script('ee_error_js'); |
|
449 | + wp_localize_script('ee_error_js', 'ee_settings', array('wp_debug' => WP_DEBUG)); |
|
450 | 450 | } |
451 | 451 | } else { |
452 | 452 | return ' |
453 | 453 | <script> |
454 | 454 | /* <![CDATA[ */ |
455 | -var ee_settings = {"wp_debug":"' . WP_DEBUG . '"}; |
|
455 | +var ee_settings = {"wp_debug":"' . WP_DEBUG.'"}; |
|
456 | 456 | /* ]]> */ |
457 | 457 | </script> |
458 | -<script src="' . includes_url() . 'js/jquery/jquery.js" type="text/javascript"></script> |
|
459 | -<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
|
460 | -<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script> |
|
458 | +<script src="' . includes_url().'js/jquery/jquery.js" type="text/javascript"></script> |
|
459 | +<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js'.'?ver='.espresso_version().'" type="text/javascript"></script> |
|
460 | +<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js'.'?ver='.espresso_version().'" type="text/javascript"></script> |
|
461 | 461 | '; |
462 | 462 | } |
463 | 463 | return ''; |