Completed
Branch BUG-8698-ticket-sellouts (330ec2)
by
unknown
34:27 queued 16:21
created
core/services/commands/CommandHandlerNotFoundException.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\services\commands;
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,14 +25,14 @@  discard block
 block discarded – undo
25 25
 	 * @param  int        $code
26 26
 	 * @param  \Exception $previous
27 27
 	 */
28
-	public function __construct( $command_handler_name, $message = '', $code = 0, \Exception $previous = null ) {
29
-		if ( empty( $message ) ) {
28
+	public function __construct($command_handler_name, $message = '', $code = 0, \Exception $previous = null) {
29
+		if (empty($message)) {
30 30
 			$message = sprintf(
31
-				__( 'The requested Command Handler "%1$s" could not be located or does not exist.', 'event_espresso' ),
31
+				__('The requested Command Handler "%1$s" could not be located or does not exist.', 'event_espresso'),
32 32
 				$command_handler_name
33 33
 			);
34 34
 		}
35
-		parent::__construct( $message, $code, $previous );
35
+		parent::__construct($message, $code, $previous);
36 36
 	}
37 37
 
38 38
 }
Please login to merge, or discard this patch.
core/EE_Session.core.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 	  * set session data
365 365
 	  * @access 	public
366 366
 	  * @param 	array $data
367
-	  * @return 	TRUE on success, FALSE on fail
367
+	  * @return 	boolean on success, FALSE on fail
368 368
 	  */
369 369
 	public function set_session_data( $data ) {
370 370
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 	 /**
393 393
 	  * @initiate session
394 394
 	  * @access   private
395
-	  * @return TRUE on success, FALSE on fail
395
+	  * @return boolean on success, FALSE on fail
396 396
 	  * @throws \EE_Error
397 397
 	  */
398 398
 	private function _espresso_session() {
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 	  * @update session data  prior to saving to the db
532 532
 	  * @access public
533 533
 	  * @param bool $new_session
534
-	  * @return TRUE on success, FALSE on fail
534
+	  * @return boolean on success, FALSE on fail
535 535
 	  */
536 536
 	public function update( $new_session = FALSE ) {
537 537
 		$this->_session_data = isset( $this->_session_data )
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 	  * This is a callback for the 'wp_redirect' filter
626 626
 	  *
627 627
 	  * @param string $location
628
-	  * @return mixed
628
+	  * @return string
629 629
 	  */
630 630
 	 public function update_on_redirect( $location ) {
631 631
 		 $this->update();
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
 	  * @access public
812 812
 	  * @param array $data_to_reset
813 813
 	  * @param bool  $show_all_notices
814
-	  * @return TRUE on success, FALSE on fail
814
+	  * @return boolean on success, FALSE on fail
815 815
 	  */
816 816
 	public function reset_data( $data_to_reset = array(), $show_all_notices = FALSE ) {
817 817
 		// if $data_to_reset is not in an array, then put it in one
Please login to merge, or discard this patch.
Spacing   +156 added lines, -156 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 /**
3 3
  *
4 4
  * Event Espresso
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	  * array for defining default session vars
111 111
 	  * @var array
112 112
 	  */
113
-	 private $_default_session_vars = array (
113
+	 private $_default_session_vars = array(
114 114
 		'id' 							=> null,
115 115
 		'user_id' 					=> null,
116 116
 		'ip_address' 			=> null,
@@ -133,12 +133,12 @@  discard block
 block discarded – undo
133 133
 	 * @param \EE_Encryption $encryption
134 134
 	 *	@return EE_Session
135 135
 	 */
136
-	public static function instance( EE_Encryption $encryption = null ) {
136
+	public static function instance(EE_Encryption $encryption = null) {
137 137
 		// check if class object is instantiated
138 138
 		// session loading is turned ON by default, but prior to the init hook, can be turned back OFF via:
139 139
 		// add_filter( 'FHEE_load_EE_Session', '__return_false' );
140
-		if ( ! self::$_instance instanceof EE_Session && apply_filters( 'FHEE_load_EE_Session', true ) ) {
141
-			self::$_instance = new self( $encryption );
140
+		if ( ! self::$_instance instanceof EE_Session && apply_filters('FHEE_load_EE_Session', true)) {
141
+			self::$_instance = new self($encryption);
142 142
 		}
143 143
 		return self::$_instance;
144 144
 	}
@@ -151,15 +151,15 @@  discard block
 block discarded – undo
151 151
 	  * @access protected
152 152
 	  * @param \EE_Encryption $encryption
153 153
 	  */
154
-	 protected function __construct( EE_Encryption $encryption = null ) {
154
+	 protected function __construct(EE_Encryption $encryption = null) {
155 155
 
156 156
 		// session loading is turned ON by default, but prior to the init hook, can be turned back OFF via: add_filter( 'FHEE_load_EE_Session', '__return_false' );
157
-		if ( ! apply_filters( 'FHEE_load_EE_Session', TRUE ) ) {
157
+		if ( ! apply_filters('FHEE_load_EE_Session', TRUE)) {
158 158
 			return;
159 159
 		}
160
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
161
-		if ( ! defined( 'ESPRESSO_SESSION' ) ) {
162
-			define( 'ESPRESSO_SESSION', true );
160
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
161
+		if ( ! defined('ESPRESSO_SESSION')) {
162
+			define('ESPRESSO_SESSION', true);
163 163
 		}
164 164
 		// default session lifespan in seconds
165 165
 		$this->_lifespan = apply_filters(
@@ -173,36 +173,36 @@  discard block
 block discarded – undo
173 173
 		 * 		}
174 174
 		 */
175 175
 		// retrieve session options from db
176
-		$session_settings = get_option( 'ee_session_settings' );
177
-		if ( $session_settings !== FALSE ) {
176
+		$session_settings = get_option('ee_session_settings');
177
+		if ($session_settings !== FALSE) {
178 178
 			// cycle though existing session options
179
-			foreach ( $session_settings as $var_name => $session_setting ) {
179
+			foreach ($session_settings as $var_name => $session_setting) {
180 180
 				// set values for class properties
181
-				$var_name = '_' . $var_name;
181
+				$var_name = '_'.$var_name;
182 182
 				$this->{$var_name} = $session_setting;
183 183
 			}
184 184
 		}
185 185
 		// are we using encryption?
186
-		if ( $this->_use_encryption && $encryption instanceof EE_Encryption ) {
186
+		if ($this->_use_encryption && $encryption instanceof EE_Encryption) {
187 187
 			// encrypt data via: $this->encryption->encrypt();
188 188
 			$this->encryption = $encryption;
189 189
 		}
190 190
 		// filter hook allows outside functions/classes/plugins to change default empty cart
191
-		$extra_default_session_vars = apply_filters( 'FHEE__EE_Session__construct__extra_default_session_vars', array() );
192
-		array_merge( $this->_default_session_vars, $extra_default_session_vars );
191
+		$extra_default_session_vars = apply_filters('FHEE__EE_Session__construct__extra_default_session_vars', array());
192
+		array_merge($this->_default_session_vars, $extra_default_session_vars);
193 193
 		// apply default session vars
194 194
 		$this->_set_defaults();
195 195
 		// check for existing session and retrieve it from db
196
-		if ( ! $this->_espresso_session() ) {
196
+		if ( ! $this->_espresso_session()) {
197 197
 			// or just start a new one
198 198
 			$this->_create_espresso_session();
199 199
 		}
200 200
 		// check request for 'clear_session' param
201
-		add_action( 'AHEE__EE_Request_Handler__construct__complete', array( $this, 'wp_loaded' ));
201
+		add_action('AHEE__EE_Request_Handler__construct__complete', array($this, 'wp_loaded'));
202 202
 		// once everything is all said and done,
203
-		add_action( 'shutdown', array( $this, 'update' ), 100 );
204
-		add_action( 'shutdown', array( $this, 'garbage_collection' ), 999 );
205
-		add_filter( 'wp_redirect', array( $this, 'update_on_redirect' ), 100, 1 );
203
+		add_action('shutdown', array($this, 'update'), 100);
204
+		add_action('shutdown', array($this, 'garbage_collection'), 999);
205
+		add_filter('wp_redirect', array($this, 'update_on_redirect'), 100, 1);
206 206
 	}
207 207
 
208 208
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	  * @return int
239 239
 	  */
240 240
 	 public function extension() {
241
-		 return apply_filters( 'FHEE__EE_Session__extend_expiration__seconds_added', ( 10 * MINUTE_IN_SECONDS ) );
241
+		 return apply_filters('FHEE__EE_Session__extend_expiration__seconds_added', (10 * MINUTE_IN_SECONDS));
242 242
 	 }
243 243
 
244 244
 
@@ -247,9 +247,9 @@  discard block
 block discarded – undo
247 247
 	  * @param int $time number of seconds to add to session expiration
248 248
 	  * @return int
249 249
 	  */
250
-	 public function extend_expiration( $time = 0 ) {
250
+	 public function extend_expiration($time = 0) {
251 251
 		 $time = $time ? $time : $this->extension();
252
-		 $this->_expiration += absint( $time );
252
+		 $this->_expiration += absint($time);
253 253
 	 }
254 254
 
255 255
 
@@ -271,8 +271,8 @@  discard block
 block discarded – undo
271 271
 	 */
272 272
 	private function _set_defaults() {
273 273
 		// set some defaults
274
-		foreach ( $this->_default_session_vars as $key => $default_var ) {
275
-			$this->_session_data[ $key ] = $default_var;
274
+		foreach ($this->_default_session_vars as $key => $default_var) {
275
+			$this->_session_data[$key] = $default_var;
276 276
 		}
277 277
 	}
278 278
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 	  * @param \EE_Cart $cart
294 294
 	  * @return bool
295 295
 	  */
296
-	 public function set_cart( EE_Cart $cart ) {
296
+	 public function set_cart(EE_Cart $cart) {
297 297
 		 $this->_session_data['cart'] = $cart;
298 298
 		 return TRUE;
299 299
 	 }
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 	  * reset_cart
305 305
 	  */
306 306
 	 public function reset_cart() {
307
-		 do_action( 'AHEE__EE_Session__reset_cart__before_reset', $this );
307
+		 do_action('AHEE__EE_Session__reset_cart__before_reset', $this);
308 308
 		 $this->_session_data['cart'] = NULL;
309 309
 	 }
310 310
 
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 	  * @return \EE_Cart
315 315
 	  */
316 316
 	 public function cart() {
317
-		 return isset( $this->_session_data['cart'] ) && $this->_session_data[ 'cart' ] instanceof EE_Cart ? $this->_session_data['cart'] : NULL;
317
+		 return isset($this->_session_data['cart']) && $this->_session_data['cart'] instanceof EE_Cart ? $this->_session_data['cart'] : NULL;
318 318
 	 }
319 319
 
320 320
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 	  * @param \EE_Checkout $checkout
324 324
 	  * @return bool
325 325
 	  */
326
-	 public function set_checkout( EE_Checkout $checkout ) {
326
+	 public function set_checkout(EE_Checkout $checkout) {
327 327
 		 $this->_session_data['checkout'] = $checkout;
328 328
 		 return TRUE;
329 329
 	 }
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 	  * reset_checkout
335 335
 	  */
336 336
 	 public function reset_checkout() {
337
-		 do_action( 'AHEE__EE_Session__reset_checkout__before_reset', $this );
337
+		 do_action('AHEE__EE_Session__reset_checkout__before_reset', $this);
338 338
 		 $this->_session_data['checkout'] = NULL;
339 339
 	 }
340 340
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 	  * @return \EE_Checkout
345 345
 	  */
346 346
 	 public function checkout() {
347
-		 return isset( $this->_session_data['checkout'] ) && $this->_session_data[ 'checkout' ] instanceof EE_Checkout ? $this->_session_data['checkout'] : NULL;
347
+		 return isset($this->_session_data['checkout']) && $this->_session_data['checkout'] instanceof EE_Checkout ? $this->_session_data['checkout'] : NULL;
348 348
 	 }
349 349
 
350 350
 
@@ -353,9 +353,9 @@  discard block
 block discarded – undo
353 353
 	  * @param \EE_Transaction $transaction
354 354
 	  * @return bool
355 355
 	  */
356
-	 public function set_transaction( EE_Transaction $transaction ) {
356
+	 public function set_transaction(EE_Transaction $transaction) {
357 357
 		 // first remove the session from the transaction before we save the transaction in the session
358
-		 $transaction->set_txn_session_data( NULL );
358
+		 $transaction->set_txn_session_data(NULL);
359 359
 		 $this->_session_data['transaction'] = $transaction;
360 360
 		 return TRUE;
361 361
 	 }
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 	  * reset_transaction
367 367
 	  */
368 368
 	 public function reset_transaction() {
369
-		 do_action( 'AHEE__EE_Session__reset_transaction__before_reset', $this );
369
+		 do_action('AHEE__EE_Session__reset_transaction__before_reset', $this);
370 370
 		 $this->_session_data['transaction'] = NULL;
371 371
 	 }
372 372
 
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 	  * @return \EE_Transaction
377 377
 	  */
378 378
 	 public function transaction() {
379
-		 return isset( $this->_session_data['transaction'] ) && $this->_session_data[ 'transaction' ] instanceof EE_Transaction ? $this->_session_data['transaction'] : NULL;
379
+		 return isset($this->_session_data['transaction']) && $this->_session_data['transaction'] instanceof EE_Transaction ? $this->_session_data['transaction'] : NULL;
380 380
 	 }
381 381
 
382 382
 
@@ -388,15 +388,15 @@  discard block
 block discarded – undo
388 388
 	  * @param bool $reset_cache
389 389
 	  * @return    array
390 390
 	  */
391
-	public function get_session_data( $key = NULL, $reset_cache = FALSE ) {
392
-		if ( $reset_cache ) {
391
+	public function get_session_data($key = NULL, $reset_cache = FALSE) {
392
+		if ($reset_cache) {
393 393
 			$this->reset_cart();
394 394
 			$this->reset_checkout();
395 395
 			$this->reset_transaction();
396 396
 		}
397
-		 if ( ! empty( $key ))  {
398
-			return  isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL;
399
-		}  else  {
397
+		 if ( ! empty($key)) {
398
+			return  isset($this->_session_data[$key]) ? $this->_session_data[$key] : NULL;
399
+		} else {
400 400
 			return $this->_session_data;
401 401
 		}
402 402
 	}
@@ -409,23 +409,23 @@  discard block
 block discarded – undo
409 409
 	  * @param 	array $data
410 410
 	  * @return 	TRUE on success, FALSE on fail
411 411
 	  */
412
-	public function set_session_data( $data ) {
412
+	public function set_session_data($data) {
413 413
 
414 414
 		// nothing ??? bad data ??? go home!
415
-		if ( empty( $data ) || ! is_array( $data )) {
416
-			EE_Error::add_error( __( 'No session data or invalid session data was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
415
+		if (empty($data) || ! is_array($data)) {
416
+			EE_Error::add_error(__('No session data or invalid session data was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
417 417
 			return FALSE;
418 418
 		}
419 419
 
420
-		foreach ( $data as $key =>$value ) {
421
-			if ( isset( $this->_default_session_vars[ $key ] )) {
420
+		foreach ($data as $key =>$value) {
421
+			if (isset($this->_default_session_vars[$key])) {
422 422
 				EE_Error::add_error(
423
-					sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $key ),
423
+					sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $key),
424 424
 					__FILE__, __FUNCTION__, __LINE__
425 425
 				);
426 426
 				return FALSE;
427 427
 			} else {
428
-				$this->_session_data[ $key ] = $value;
428
+				$this->_session_data[$key] = $value;
429 429
 			}
430 430
 		}
431 431
 
@@ -442,9 +442,9 @@  discard block
 block discarded – undo
442 442
 	  * @throws \EE_Error
443 443
 	  */
444 444
 	private function _espresso_session() {
445
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
445
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
446 446
 		// check that session has started
447
-		if ( session_id() === '' ) {
447
+		if (session_id() === '') {
448 448
 			//starts a new session if one doesn't already exist, or re-initiates an existing one
449 449
 			session_start();
450 450
 		}
@@ -453,57 +453,57 @@  discard block
 block discarded – undo
453 453
 		// and the visitors IP
454 454
 		$this->_ip_address = $this->_visitor_ip();
455 455
 		// set the "user agent"
456
-		$this->_user_agent = ( isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr( $_SERVER['HTTP_USER_AGENT'] ) : FALSE;
456
+		$this->_user_agent = (isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr($_SERVER['HTTP_USER_AGENT']) : FALSE;
457 457
 		// now let's retrieve what's in the db
458 458
 		// we're using WP's Transient API to store session data using the PHP session ID as the option name
459
-		$session_data = get_transient( EE_Session::session_id_prefix . $this->_sid );
460
-		if ( $session_data ) {
461
-			if ( apply_filters( 'FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG ) ) {
462
-				$hash_check = get_transient( EE_Session::hash_check_prefix . $this->_sid );
463
-				if ( $hash_check && $hash_check !== md5( $session_data ) ) {
459
+		$session_data = get_transient(EE_Session::session_id_prefix.$this->_sid);
460
+		if ($session_data) {
461
+			if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
462
+				$hash_check = get_transient(EE_Session::hash_check_prefix.$this->_sid);
463
+				if ($hash_check && $hash_check !== md5($session_data)) {
464 464
 					EE_Error::add_error(
465 465
 						sprintf(
466
-							__( 'The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso' ),
467
-							EE_Session::session_id_prefix . $this->_sid
466
+							__('The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso'),
467
+							EE_Session::session_id_prefix.$this->_sid
468 468
 						),
469 469
 						__FILE__, __FUNCTION__, __LINE__
470 470
 					);
471 471
 				}
472 472
 			}
473 473
 			// un-encrypt the data
474
-			$session_data = $this->_use_encryption ? $this->encryption->decrypt( $session_data ) : $session_data;
474
+			$session_data = $this->_use_encryption ? $this->encryption->decrypt($session_data) : $session_data;
475 475
 			// unserialize
476
-			$session_data = maybe_unserialize( $session_data );
476
+			$session_data = maybe_unserialize($session_data);
477 477
 			// just a check to make sure the session array is indeed an array
478
-			if ( ! is_array( $session_data ) ) {
478
+			if ( ! is_array($session_data)) {
479 479
 				// no?!?! then something is wrong
480 480
 				return FALSE;
481 481
 			}
482 482
 			// get the current time in UTC
483
-			$this->_time = isset( $this->_time ) ? $this->_time : time();
483
+			$this->_time = isset($this->_time) ? $this->_time : time();
484 484
 			// and reset the session expiration
485
-			$this->_expiration = isset( $session_data['expiration'] ) ? $session_data['expiration'] : $this->_time + $this->_lifespan;
485
+			$this->_expiration = isset($session_data['expiration']) ? $session_data['expiration'] : $this->_time + $this->_lifespan;
486 486
 
487 487
 		} else {
488 488
 			// set initial site access time and the session expiration
489 489
 			$this->_set_init_access_and_expiration();
490 490
 			// set referer
491
-			$this->_session_data[ 'pages_visited' ][ $this->_session_data['init_access'] ] = isset( $_SERVER['HTTP_REFERER'] ) ? esc_attr( $_SERVER['HTTP_REFERER'] ) : '';
491
+			$this->_session_data['pages_visited'][$this->_session_data['init_access']] = isset($_SERVER['HTTP_REFERER']) ? esc_attr($_SERVER['HTTP_REFERER']) : '';
492 492
 			// no previous session = go back and create one (on top of the data above)
493 493
 			return FALSE;
494 494
 		}
495 495
 		// now the user agent
496
-		if ( $session_data['user_agent'] != $this->_user_agent ) {
496
+		if ($session_data['user_agent'] != $this->_user_agent) {
497 497
 			return FALSE;
498 498
 		}
499 499
 		// make event espresso session data available to plugin
500
-		$this->_session_data = array_merge( $this->_session_data, $session_data );
500
+		$this->_session_data = array_merge($this->_session_data, $session_data);
501 501
 		// wait a minute... how old are you?
502
-		if ( $this->_time > $this->_expiration ) {
502
+		if ($this->_time > $this->_expiration) {
503 503
 			// yer too old fer me!
504 504
 			$this->_expired = true;
505 505
 			// wipe out everything that isn't a default session datum, and set expired flag to true
506
-			$this->clear_session( __CLASS__, __FUNCTION__ );
506
+			$this->clear_session(__CLASS__, __FUNCTION__);
507 507
 		}
508 508
 		return TRUE;
509 509
 
@@ -522,12 +522,12 @@  discard block
 block discarded – undo
522 522
 	  */
523 523
 	protected function _generate_session_id() {
524 524
 		// check if the SID was passed explicitly, otherwise get from session, then add salt and hash it to reduce length
525
-		if ( isset( $_REQUEST[ 'EESID' ] ) ) {
526
-			$session_id = sanitize_text_field( $_REQUEST[ 'EESID' ] );
525
+		if (isset($_REQUEST['EESID'])) {
526
+			$session_id = sanitize_text_field($_REQUEST['EESID']);
527 527
 		} else {
528
-			$session_id = md5( session_id() . get_current_blog_id() . $this->_get_sid_salt() );
528
+			$session_id = md5(session_id().get_current_blog_id().$this->_get_sid_salt());
529 529
 		}
530
-		return apply_filters( 'FHEE__EE_Session___generate_session_id__session_id', $session_id );
530
+		return apply_filters('FHEE__EE_Session___generate_session_id__session_id', $session_id);
531 531
 	}
532 532
 
533 533
 
@@ -539,20 +539,20 @@  discard block
 block discarded – undo
539 539
 	  */
540 540
 	protected function _get_sid_salt() {
541 541
 		// was session id salt already saved to db ?
542
-		if ( empty( $this->_sid_salt ) ) {
542
+		if (empty($this->_sid_salt)) {
543 543
 			// no?  then maybe use WP defined constant
544
-			if ( defined( 'AUTH_SALT' ) ) {
544
+			if (defined('AUTH_SALT')) {
545 545
 				$this->_sid_salt = AUTH_SALT;
546 546
 			}
547 547
 			// if salt doesn't exist or is too short
548
-			if ( empty( $this->_sid_salt ) || strlen( $this->_sid_salt ) < 32 ) {
548
+			if (empty($this->_sid_salt) || strlen($this->_sid_salt) < 32) {
549 549
 				// create a new one
550
-				$this->_sid_salt = wp_generate_password( 64 );
550
+				$this->_sid_salt = wp_generate_password(64);
551 551
 			}
552 552
 			// and save it as a permanent session setting
553
-			$session_settings = get_option( 'ee_session_settings' );
554
-			$session_settings[ 'sid_salt' ] = $this->_sid_salt;
555
-			update_option( 'ee_session_settings', $session_settings );
553
+			$session_settings = get_option('ee_session_settings');
554
+			$session_settings['sid_salt'] = $this->_sid_salt;
555
+			update_option('ee_session_settings', $session_settings);
556 556
 		}
557 557
 		return $this->_sid_salt;
558 558
 	}
@@ -580,18 +580,18 @@  discard block
 block discarded – undo
580 580
 	  * @param bool $new_session
581 581
 	  * @return TRUE on success, FALSE on fail
582 582
 	  */
583
-	public function update( $new_session = FALSE ) {
584
-		$this->_session_data = isset( $this->_session_data )
585
-			&& is_array( $this->_session_data )
586
-			&& isset( $this->_session_data['id'])
583
+	public function update($new_session = FALSE) {
584
+		$this->_session_data = isset($this->_session_data)
585
+			&& is_array($this->_session_data)
586
+			&& isset($this->_session_data['id'])
587 587
 			? $this->_session_data
588 588
 			: NULL;
589
-		if ( empty( $this->_session_data )) {
589
+		if (empty($this->_session_data)) {
590 590
 			$this->_set_defaults();
591 591
 		}
592
-		foreach ( $this->_session_data as $key => $value ) {
592
+		foreach ($this->_session_data as $key => $value) {
593 593
 
594
-			switch( $key ) {
594
+			switch ($key) {
595 595
 
596 596
 				case 'id' :
597 597
 					// session ID
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
 				break;
610 610
 
611 611
 				case 'init_access' :
612
-					$this->_session_data['init_access'] = absint( $value );
612
+					$this->_session_data['init_access'] = absint($value);
613 613
 				break;
614 614
 
615 615
 				case 'last_access' :
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 
620 620
 				case 'expiration' :
621 621
 					// when the session expires
622
-					$this->_session_data['expiration'] = ! empty( $this->_expiration )
622
+					$this->_session_data['expiration'] = ! empty($this->_expiration)
623 623
 						? $this->_expiration
624 624
 						: $this->_session_data['init_access'] + $this->_lifespan;
625 625
 				break;
@@ -631,11 +631,11 @@  discard block
 block discarded – undo
631 631
 
632 632
 				case 'pages_visited' :
633 633
 					$page_visit = $this->_get_page_visit();
634
-					if ( $page_visit ) {
634
+					if ($page_visit) {
635 635
 						// set pages visited where the first will be the http referrer
636
-						$this->_session_data[ 'pages_visited' ][ $this->_time ] = $page_visit;
636
+						$this->_session_data['pages_visited'][$this->_time] = $page_visit;
637 637
 						// we'll only save the last 10 page visits.
638
-						$this->_session_data[ 'pages_visited' ] = array_slice( $this->_session_data['pages_visited'], -10 );
638
+						$this->_session_data['pages_visited'] = array_slice($this->_session_data['pages_visited'], -10);
639 639
 					}
640 640
 				break;
641 641
 
@@ -643,9 +643,9 @@  discard block
 block discarded – undo
643 643
 
644 644
 		}
645 645
 		// creating a new session does not require saving to the db just yet
646
-		if ( ! $new_session ) {
646
+		if ( ! $new_session) {
647 647
 			// ready? let's save
648
-			if ( $this->_save_session_to_db() ) {
648
+			if ($this->_save_session_to_db()) {
649 649
 				return TRUE;
650 650
 			} else {
651 651
 				return FALSE;
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 	  * @param string $location
668 668
 	  * @return mixed
669 669
 	  */
670
-	 public function update_on_redirect( $location ) {
670
+	 public function update_on_redirect($location) {
671 671
 		 $this->update();
672 672
 		 return $location;
673 673
 	}
@@ -679,9 +679,9 @@  discard block
 block discarded – undo
679 679
 	 * 	@return bool
680 680
 	 */
681 681
 	private function _create_espresso_session( ) {
682
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__, '' );
682
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, '');
683 683
 		// use the update function for now with $new_session arg set to TRUE
684
-		return  $this->update( TRUE ) ? TRUE : FALSE;
684
+		return  $this->update(TRUE) ? TRUE : FALSE;
685 685
 	}
686 686
 
687 687
 
@@ -700,26 +700,26 @@  discard block
 block discarded – undo
700 700
 			|| ! (
701 701
 				EE_Registry::instance()->REQ->is_espresso_page()
702 702
 				|| EE_Registry::instance()->REQ->front_ajax
703
-				|| is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX )
703
+				|| is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX)
704 704
 			)
705 705
 		) {
706 706
 			return false;
707 707
 		}
708 708
 		EE_Registry::instance()->SSN = $this;
709 709
 		// first serialize all of our session data
710
-		$session_data = serialize( $this->_session_data );
710
+		$session_data = serialize($this->_session_data);
711 711
 		// encrypt it if we are using encryption
712
-		$session_data = $this->_use_encryption ? $this->encryption->encrypt( $session_data ) : $session_data;
712
+		$session_data = $this->_use_encryption ? $this->encryption->encrypt($session_data) : $session_data;
713 713
 		// add an hour to the session transient expiration (NOT the session expiration itself),
714 714
 		// which allows us to still retrieve expired sessions instead of having the transients deleted on us immediately,
715 715
 		// which looks no different than the session having never existed at all
716 716
 		$expiry = $this->_lifespan + HOUR_IN_SECONDS;
717 717
 		// maybe save hash check
718
-		if ( apply_filters( 'FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG ) ) {
719
-			set_transient( EE_Session::hash_check_prefix . $this->_sid, md5( $session_data ), $expiry );
718
+		if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
719
+			set_transient(EE_Session::hash_check_prefix.$this->_sid, md5($session_data), $expiry);
720 720
 		}
721 721
 		// we're using the Transient API for storing session data, cuz it's so damn simple -> set_transient(  transient ID, data, expiry )
722
-		return set_transient( EE_Session::session_id_prefix . $this->_sid, $session_data, $expiry );
722
+		return set_transient(EE_Session::session_id_prefix.$this->_sid, $session_data, $expiry);
723 723
 	}
724 724
 
725 725
 
@@ -745,10 +745,10 @@  discard block
 block discarded – undo
745 745
 			'HTTP_FORWARDED',
746 746
 			'REMOTE_ADDR'
747 747
 		);
748
-		foreach ( $server_keys as $key ){
749
-			if ( isset( $_SERVER[ $key ] )) {
750
-				foreach ( array_map( 'trim', explode( ',', $_SERVER[ $key ] )) as $ip ) {
751
-					if ( $ip === '127.0.0.1' || filter_var( $ip, FILTER_VALIDATE_IP ) !== FALSE ) {
748
+		foreach ($server_keys as $key) {
749
+			if (isset($_SERVER[$key])) {
750
+				foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip) {
751
+					if ($ip === '127.0.0.1' || filter_var($ip, FILTER_VALIDATE_IP) !== FALSE) {
752 752
 						$visitor_ip = $ip;
753 753
 					}
754 754
 				}
@@ -768,41 +768,41 @@  discard block
 block discarded – undo
768 768
 	 */
769 769
 	public function _get_page_visit() {
770 770
 
771
-				$page_visit = home_url('/') . 'wp-admin/admin-ajax.php';
771
+				$page_visit = home_url('/').'wp-admin/admin-ajax.php';
772 772
 
773 773
 		// check for request url
774
-		if ( isset( $_SERVER['REQUEST_URI'] )) {
774
+		if (isset($_SERVER['REQUEST_URI'])) {
775 775
 
776
-			$request_uri = esc_url( $_SERVER['REQUEST_URI'] );
776
+			$request_uri = esc_url($_SERVER['REQUEST_URI']);
777 777
 
778
-			$ru_bits = explode( '?', $request_uri );
778
+			$ru_bits = explode('?', $request_uri);
779 779
 			$request_uri = $ru_bits[0];
780 780
 			// check for and grab host as well
781
-			if ( isset( $_SERVER['HTTP_HOST'] )) {
782
-				$http_host = esc_url( $_SERVER['HTTP_HOST'] );
781
+			if (isset($_SERVER['HTTP_HOST'])) {
782
+				$http_host = esc_url($_SERVER['HTTP_HOST']);
783 783
 			} else {
784 784
 				$http_host = '';
785 785
 			}
786 786
 			// check for page_id in SERVER REQUEST
787
-			if ( isset( $_REQUEST['page_id'] )) {
787
+			if (isset($_REQUEST['page_id'])) {
788 788
 				// rebuild $e_reg without any of the extra parameters
789
-				$page_id = '?page_id=' . esc_attr( $_REQUEST['page_id'] ) . '&amp;';
789
+				$page_id = '?page_id='.esc_attr($_REQUEST['page_id']).'&amp;';
790 790
 			} else {
791 791
 				$page_id = '?';
792 792
 			}
793 793
 			// check for $e_reg in SERVER REQUEST
794
-			if ( isset( $_REQUEST['ee'] )) {
794
+			if (isset($_REQUEST['ee'])) {
795 795
 				// rebuild $e_reg without any of the extra parameters
796
-				$e_reg = 'ee=' . esc_attr( $_REQUEST['ee'] );
796
+				$e_reg = 'ee='.esc_attr($_REQUEST['ee']);
797 797
 			} else {
798 798
 				$e_reg = '';
799 799
 			}
800 800
 
801
-			$page_visit = rtrim( $http_host . $request_uri . $page_id . $e_reg, '?' );
801
+			$page_visit = rtrim($http_host.$request_uri.$page_id.$e_reg, '?');
802 802
 
803 803
 		}
804 804
 
805
-		return $page_visit != home_url( '/wp-admin/admin-ajax.php' ) ? $page_visit : '';
805
+		return $page_visit != home_url('/wp-admin/admin-ajax.php') ? $page_visit : '';
806 806
 
807 807
 	}
808 808
 
@@ -830,13 +830,13 @@  discard block
 block discarded – undo
830 830
 	  * @param string $class
831 831
 	  * @param string $function
832 832
 	  */
833
-	public function clear_session( $class = '', $function = '' ) {
834
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : ' . $class . '::' .  $function . '()' );
833
+	public function clear_session($class = '', $function = '') {
834
+		do_action('AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : '.$class.'::'.$function.'()');
835 835
 		$this->reset_cart();
836 836
 		$this->reset_checkout();
837 837
 		$this->reset_transaction();
838 838
 		// wipe out everything that isn't a default session datum
839
-		$this->reset_data( array_keys( $this->_session_data ));
839
+		$this->reset_data(array_keys($this->_session_data));
840 840
 		// reset initial site access time and the session expiration
841 841
 		$this->_set_init_access_and_expiration();
842 842
 		$this->_save_session_to_db();
@@ -851,41 +851,41 @@  discard block
 block discarded – undo
851 851
 	  * @param bool  $show_all_notices
852 852
 	  * @return TRUE on success, FALSE on fail
853 853
 	  */
854
-	public function reset_data( $data_to_reset = array(), $show_all_notices = FALSE ) {
854
+	public function reset_data($data_to_reset = array(), $show_all_notices = FALSE) {
855 855
 		// if $data_to_reset is not in an array, then put it in one
856
-		if ( ! is_array( $data_to_reset ) ) {
857
-			$data_to_reset = array ( $data_to_reset );
856
+		if ( ! is_array($data_to_reset)) {
857
+			$data_to_reset = array($data_to_reset);
858 858
 		}
859 859
 		// nothing ??? go home!
860
-		if ( empty( $data_to_reset )) {
861
-			EE_Error::add_error( __( 'No session data could be reset, because no session var name was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
860
+		if (empty($data_to_reset)) {
861
+			EE_Error::add_error(__('No session data could be reset, because no session var name was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
862 862
 			return FALSE;
863 863
 		}
864 864
 		$return_value = TRUE;
865 865
 		// since $data_to_reset is an array, cycle through the values
866
-		foreach ( $data_to_reset as $reset ) {
866
+		foreach ($data_to_reset as $reset) {
867 867
 
868 868
 			// first check to make sure it is a valid session var
869
-			if ( isset( $this->_session_data[ $reset ] )) {
869
+			if (isset($this->_session_data[$reset])) {
870 870
 				// then check to make sure it is not a default var
871
-				if ( ! array_key_exists( $reset, $this->_default_session_vars )) {
871
+				if ( ! array_key_exists($reset, $this->_default_session_vars)) {
872 872
 					// remove session var
873
-					unset( $this->_session_data[ $reset ] );
874
-					if ( $show_all_notices ) {
875
-						EE_Error::add_success( sprintf( __( 'The session variable %s was removed.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
873
+					unset($this->_session_data[$reset]);
874
+					if ($show_all_notices) {
875
+						EE_Error::add_success(sprintf(__('The session variable %s was removed.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
876 876
 					}
877 877
 
878 878
 				} else {
879 879
 					// yeeeeeeeeerrrrrrrrrrr OUT !!!!
880
-					if ( $show_all_notices ) {
881
-						EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
880
+					if ($show_all_notices) {
881
+						EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
882 882
 					}
883 883
 					$return_value = FALSE;
884 884
 				}
885 885
 
886
-			} else if ( $show_all_notices ) {
886
+			} else if ($show_all_notices) {
887 887
 				// oops! that session var does not exist!
888
-				EE_Error::add_error( sprintf( __( 'The session item provided, %s, is invalid or does not exist.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
888
+				EE_Error::add_error(sprintf(__('The session item provided, %s, is invalid or does not exist.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
889 889
 				$return_value = FALSE;
890 890
 			}
891 891
 
@@ -906,8 +906,8 @@  discard block
 block discarded – undo
906 906
 	 *   @return	 string
907 907
 	 */
908 908
 	public function wp_loaded() {
909
-		if ( isset(  EE_Registry::instance()->REQ ) && EE_Registry::instance()->REQ->is_set( 'clear_session' )) {
910
-			$this->clear_session( __CLASS__, __FUNCTION__ );
909
+		if (isset(EE_Registry::instance()->REQ) && EE_Registry::instance()->REQ->is_set('clear_session')) {
910
+			$this->clear_session(__CLASS__, __FUNCTION__);
911 911
 		}
912 912
 	}
913 913
 
@@ -932,24 +932,24 @@  discard block
 block discarded – undo
932 932
 	  */
933 933
 	 public function garbage_collection() {
934 934
 		 // only perform during regular requests
935
-		 if ( ! defined( 'DOING_AJAX') || ! DOING_AJAX ) {
935
+		 if ( ! defined('DOING_AJAX') || ! DOING_AJAX) {
936 936
 			 /** @type WPDB $wpdb */
937 937
 			 global $wpdb;
938 938
 			 // since transient expiration timestamps are set in the future, we can compare against NOW
939 939
 			 $expiration = time();
940
-			 $too_far_in_the_the_future = $expiration + ( $this->_lifespan * 2 ) + HOUR_IN_SECONDS;
940
+			 $too_far_in_the_the_future = $expiration + ($this->_lifespan * 2) + HOUR_IN_SECONDS;
941 941
 			 // filter the query limit. Set to 0 to turn off garbage collection
942
-			 $expired_session_transient_delete_query_limit = absint( apply_filters( 'FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50 ));
942
+			 $expired_session_transient_delete_query_limit = absint(apply_filters('FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50));
943 943
 			 // non-zero LIMIT means take out the trash
944
-			 if ( $expired_session_transient_delete_query_limit ) {
944
+			 if ($expired_session_transient_delete_query_limit) {
945 945
 				 //array of transient keys that require garbage collection
946 946
 				 $session_keys = array(
947 947
 					 EE_Session::session_id_prefix,
948 948
 					 EE_Session::hash_check_prefix,
949 949
 				 );
950
-				 foreach ( $session_keys as $session_key ) {
951
-					 $session_key = str_replace( '_', '\_', $session_key );
952
-					 $session_key = '\_transient\_timeout\_' . $session_key . '%';
950
+				 foreach ($session_keys as $session_key) {
951
+					 $session_key = str_replace('_', '\_', $session_key);
952
+					 $session_key = '\_transient\_timeout\_'.$session_key.'%';
953 953
 					 $SQL = "
954 954
 					SELECT option_name
955 955
 					FROM {$wpdb->options}
@@ -959,28 +959,28 @@  discard block
 block discarded – undo
959 959
 					OR option_value > {$too_far_in_the_the_future} )
960 960
 					LIMIT {$expired_session_transient_delete_query_limit}
961 961
 				";
962
-					 $expired_sessions = $wpdb->get_col( $SQL );
962
+					 $expired_sessions = $wpdb->get_col($SQL);
963 963
 					 // valid results?
964
-					 if ( ! $expired_sessions instanceof WP_Error && ! empty( $expired_sessions ) ) {
964
+					 if ( ! $expired_sessions instanceof WP_Error && ! empty($expired_sessions)) {
965 965
 						 // format array of results into something usable within the actual DELETE query's IN clause
966 966
 						 $expired = array();
967
-						 foreach ( $expired_sessions as $expired_session ) {
968
-							 $expired[ ] = "'" . $expired_session . "'";
969
-							 $expired[ ] = "'" . str_replace( 'timeout_', '', $expired_session ) . "'";
967
+						 foreach ($expired_sessions as $expired_session) {
968
+							 $expired[] = "'".$expired_session."'";
969
+							 $expired[] = "'".str_replace('timeout_', '', $expired_session)."'";
970 970
 						 }
971
-						 $expired = implode( ', ', $expired );
971
+						 $expired = implode(', ', $expired);
972 972
 						 $SQL = "
973 973
 						DELETE FROM {$wpdb->options}
974 974
 						WHERE option_name
975 975
 						IN ( $expired );
976 976
 					 ";
977
-						 $results = $wpdb->query( $SQL );
977
+						 $results = $wpdb->query($SQL);
978 978
 						 // if something went wrong, then notify the admin
979
-						 if ( $results instanceof WP_Error && is_admin() ) {
980
-							 EE_Error::add_error( $results->get_error_message(), __FILE__, __FUNCTION__, __LINE__ );
979
+						 if ($results instanceof WP_Error && is_admin()) {
980
+							 EE_Error::add_error($results->get_error_message(), __FILE__, __FUNCTION__, __LINE__);
981 981
 						 }
982 982
 					 }
983
-					 do_action( 'FHEE__EE_Session__garbage_collection___end', $expired_session_transient_delete_query_limit );
983
+					 do_action('FHEE__EE_Session__garbage_collection___end', $expired_session_transient_delete_query_limit);
984 984
 				 }
985 985
 			 }
986 986
 		 }
Please login to merge, or discard this patch.
form_sections/strategies/layout/EE_Form_Section_Layout_Base.strategy.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * stating where the proper subsections should be placed (but usually leaving them to layout
9 9
  * their own headers and footers etc).
10 10
  */
11
-abstract class EE_Form_Section_Layout_Base{
11
+abstract class EE_Form_Section_Layout_Base {
12 12
 
13 13
 	/**
14 14
 	 * Form form section to lay out
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	/**
22 22
 	 * 	__construct
23 23
 	 */
24
-	function __construct(){
24
+	function __construct() {
25 25
 	}
26 26
 
27 27
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 * The form section on which this strategy is to perform
31 31
 	 * @param EE_Form_Section_Proper $form
32 32
 	 */
33
-	function _construct_finalize(EE_Form_Section_Proper $form){
33
+	function _construct_finalize(EE_Form_Section_Proper $form) {
34 34
 		$this->_form_section = $form;
35 35
 	}
36 36
 
@@ -53,28 +53,28 @@  discard block
 block discarded – undo
53 53
 	 * Returns the HTML
54 54
 	 * @return string HTML for displaying
55 55
 	 */
56
-	function layout_form(){
56
+	function layout_form() {
57 57
 		$html = '';
58 58
 		// layout_form_begin
59 59
 		$html .= apply_filters(
60
-			'FHEE__EE_Form_Section_Layout_Base__layout_form__start__for_' . $this->_form_section->name(),
60
+			'FHEE__EE_Form_Section_Layout_Base__layout_form__start__for_'.$this->_form_section->name(),
61 61
 			$this->layout_form_begin(),
62 62
 			$this->_form_section
63 63
 		);
64 64
 		// layout_form_loop
65 65
 		$html .= apply_filters(
66
-			'FHEE__EE_Form_Section_Layout_Base__layout_form__loop__for_' . $this->_form_section->name(),
66
+			'FHEE__EE_Form_Section_Layout_Base__layout_form__loop__for_'.$this->_form_section->name(),
67 67
 			$this->layout_form_loop(),
68 68
 			$this->_form_section
69 69
 		);
70 70
 		// layout_form_end
71 71
 		$html .= apply_filters(
72
-			'FHEE__EE_Form_Section_Layout_Base__layout_form__end__for_' . $this->_form_section->name(),
72
+			'FHEE__EE_Form_Section_Layout_Base__layout_form__end__for_'.$this->_form_section->name(),
73 73
 			$this->layout_form_end(),
74 74
 			$this->_form_section
75 75
 		);
76 76
 
77
-		$html = $this->add_form_section_hooks_and_filters( $html );
77
+		$html = $this->add_form_section_hooks_and_filters($html);
78 78
 		return $html;
79 79
 	}
80 80
 
@@ -83,20 +83,20 @@  discard block
 block discarded – undo
83 83
 	/**
84 84
 	 * @return string
85 85
 	 */
86
-	function layout_form_loop(){
86
+	function layout_form_loop() {
87 87
 		$html = '';
88
-		foreach( $this->_form_section->subsections() as $name => $subsection ){
89
-			if ( $subsection instanceof EE_Form_Input_Base ){
88
+		foreach ($this->_form_section->subsections() as $name => $subsection) {
89
+			if ($subsection instanceof EE_Form_Input_Base) {
90 90
 				$html .= apply_filters(
91
-					'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_input_' . $name . '__in_' . $this->_form_section->name(),
92
-					$this->layout_input( $subsection ),
91
+					'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_input_'.$name.'__in_'.$this->_form_section->name(),
92
+					$this->layout_input($subsection),
93 93
 					$this->_form_section,
94 94
 					$subsection
95 95
 				);
96
-			} elseif ( $subsection instanceof EE_Form_Section_Base ){
96
+			} elseif ($subsection instanceof EE_Form_Section_Base) {
97 97
 				$html .= apply_filters(
98
-					'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_non_input_' . $name . '__in_' . $this->_form_section->name(),
99
-					$this->layout_subsection( $subsection ),
98
+					'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_non_input_'.$name.'__in_'.$this->_form_section->name(),
99
+					$this->layout_subsection($subsection),
100 100
 					$this->_form_section,
101 101
 					$subsection
102 102
 				);
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @param EE_Form_Section_Base $subsection
145 145
 	 * @return string html
146 146
 	 */
147
-	abstract function layout_subsection( $subsection );
147
+	abstract function layout_subsection($subsection);
148 148
 
149 149
 
150 150
 
@@ -153,10 +153,10 @@  discard block
 block discarded – undo
153 153
 	 * @param EE_Form_Input_Base $input
154 154
 	 * @return string
155 155
 	 */
156
-	public function display_label($input){
157
-		$class = $input->required() ? 'ee-required-label ' . $input->html_label_class() : $input->html_label_class();
158
-		$label_text = $input->required() ? $input->html_label_text() . '<span class="ee-asterisk">*</span>' : $input->html_label_text();
159
-		return '<label id="' . $input->html_label_id() . '" class="' . $class . '" style="' . $input->html_label_style() . '" for="' . $input->html_name() . '">' .  $label_text . '</label>';
156
+	public function display_label($input) {
157
+		$class = $input->required() ? 'ee-required-label '.$input->html_label_class() : $input->html_label_class();
158
+		$label_text = $input->required() ? $input->html_label_text().'<span class="ee-asterisk">*</span>' : $input->html_label_text();
159
+		return '<label id="'.$input->html_label_id().'" class="'.$class.'" style="'.$input->html_label_style().'" for="'.$input->html_name().'">'.$label_text.'</label>';
160 160
 	}
161 161
 
162 162
 
@@ -169,10 +169,10 @@  discard block
 block discarded – undo
169 169
 	 * @param EE_Form_Input_Base $input
170 170
 	 * @return string
171 171
 	 */
172
-	public function display_errors($input){
173
-		if( $input->get_validation_errors() ){
174
-			return  "<label  id='" . $input->html_id() . "-error' class='error' for='{$input->html_name()}'>" . $input->get_validation_error_string() . "</label>";
175
-		}else{
172
+	public function display_errors($input) {
173
+		if ($input->get_validation_errors()) {
174
+			return  "<label  id='".$input->html_id()."-error' class='error' for='{$input->html_name()}'>".$input->get_validation_error_string()."</label>";
175
+		} else {
176 176
 			return '';
177 177
 		}
178 178
 	}
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
 	 * @param EE_Form_Input_Base $input
183 183
 	 * @return string
184 184
 	 */
185
-	public function display_help_text( $input ){
186
-		if ( $input->html_help_text() != '' ) {
185
+	public function display_help_text($input) {
186
+		if ($input->html_help_text() != '') {
187 187
 			$tag = is_admin() ? 'p' : 'span';
188
-			return '<' . $tag . ' id="' . $input->html_id() . '-help" class="' . $input->html_help_class() . '" style="' . $input->html_help_style() . '">' . $input->html_help_text() . '</' . $tag . '>';
188
+			return '<'.$tag.' id="'.$input->html_id().'-help" class="'.$input->html_help_class().'" style="'.$input->html_help_style().'">'.$input->html_help_text().'</'.$tag.'>';
189 189
 		}
190 190
 		return '';
191 191
 	}
@@ -197,13 +197,13 @@  discard block
 block discarded – undo
197 197
 	 * @param string $html
198 198
 	 * @return string
199 199
 	 */
200
-	public function add_form_section_hooks_and_filters( $html ){
200
+	public function add_form_section_hooks_and_filters($html) {
201 201
 		// replace dashes and spaces with underscores
202
-		$hook_name = str_replace( array( '-', ' ' ), '_', $this->_form_section->html_id() );
203
-		do_action( 'AHEE__Form_Section_Layout__' . $hook_name, $this->_form_section );
204
-		$html = apply_filters( 'AFEE__Form_Section_Layout__' . $hook_name . '__html', $html, $this->_form_section );
205
-		$html .= EEH_HTML::nl() . '<!-- AHEE__Form_Section_Layout__' . $hook_name . '__html -->';
206
-		$html .= EEH_HTML::nl() . '<!-- AFEE__Form_Section_Layout__' . $hook_name . ' -->';
202
+		$hook_name = str_replace(array('-', ' '), '_', $this->_form_section->html_id());
203
+		do_action('AHEE__Form_Section_Layout__'.$hook_name, $this->_form_section);
204
+		$html = apply_filters('AFEE__Form_Section_Layout__'.$hook_name.'__html', $html, $this->_form_section);
205
+		$html .= EEH_HTML::nl().'<!-- AHEE__Form_Section_Layout__'.$hook_name.'__html -->';
206
+		$html .= EEH_HTML::nl().'<!-- AFEE__Form_Section_Layout__'.$hook_name.' -->';
207 207
 		return $html;
208 208
 	}
209 209
 
Please login to merge, or discard this patch.
admin_pages/registrations/templates/reg_status_change_buttons.template.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <div id="reg-admin-approve-decline-reg-status-dv">
2 2
 
3 3
 	<h2 id="reg-admin-reg-details-reg-status-hdr">
4
-		<?php echo __( 'Current Registration Status : ', 'event_espresso' ); ?>
4
+		<?php echo __('Current Registration Status : ', 'event_espresso'); ?>
5 5
 		<span class="<?php echo $reg_status_class; ?> bigger-text"><?php echo $reg_status_value; ?></span>
6 6
 	</h2>
7
-	<?php do_action( 'AHEE__reg_status_change_buttons__after_header', $REG_ID ); ?>
7
+	<?php do_action('AHEE__reg_status_change_buttons__after_header', $REG_ID); ?>
8 8
 
9 9
 	<h3 id="reg-admin-reg-details-reg-status-hdr">
10
-		<?php echo __( 'Change Registration Status to :', 'event_espresso' ); ?>
10
+		<?php echo __('Change Registration Status to :', 'event_espresso'); ?>
11 11
 	</h3>
12 12
 
13 13
 	<form id="reg_status_change_form" method="POST" action="<?php echo $form_url; ?>">
@@ -16,15 +16,15 @@  discard block
 block discarded – undo
16 16
 		<input type="hidden" name="return" value="view_registration">
17 17
 		<?php echo $nonce; ?>
18 18
 		<?php echo $status_buttons; ?>
19
-		<?php if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'registration_message_type' ) ) : ?>
19
+		<?php if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'registration_message_type')) : ?>
20 20
 			<span id="send-related-messages-dv">
21
-			<label for="txn-reg-status-send-notifications-inp" class="important-notice"><?php _e( '...and send related messages ?', 'event_espresso' ); ?>
21
+			<label for="txn-reg-status-send-notifications-inp" class="important-notice"><?php _e('...and send related messages ?', 'event_espresso'); ?>
22 22
 				<input type="checkbox" value="1" id="txn-reg-status-send-notifications-inp" name="txn_reg_status_change[send_notifications]">
23 23
 			</label>
24 24
 			<br/>
25 25
 		</span>
26 26
 			<br/>
27
-			<p class="description"><?php _e( 'If the "send related messages"checkbox is checked when changing status, then the related messages will be sent to the registrant.', 'event_espresso' ); ?></p>
27
+			<p class="description"><?php _e('If the "send related messages"checkbox is checked when changing status, then the related messages will be sent to the registrant.', 'event_espresso'); ?></p>
28 28
 		<?php endif; ?>
29 29
 	</form>
30 30
 </div>
Please login to merge, or discard this patch.
core/helpers/EEH_Array.helper.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('NO direct script access allowed'); }
3 3
 
4
-require_once( EE_HELPERS . 'EEH_Base.helper.php' );
4
+require_once(EE_HELPERS.'EEH_Base.helper.php');
5 5
 
6 6
 /**
7 7
  * EE_Array
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 	 * @param  array $array2 an array of objects
27 27
 	 * @return array         an array of objects found in array 1 that aren't found in array 2.
28 28
 	 */
29
-	public static function object_array_diff( $array1, $array2 ) {
30
-		return array_udiff( $array1, $array2, array('self', '_compare_objects' ));
29
+	public static function object_array_diff($array1, $array2) {
30
+		return array_udiff($array1, $array2, array('self', '_compare_objects'));
31 31
 	}
32 32
 
33 33
 	/**
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 	 * @param array $array
37 37
 	 * @return boolean
38 38
 	 */
39
-	public static function is_associative_array( array $array ) {
40
-		return array_keys( $array ) !== range( 0, count( $array ) - 1 );
39
+	public static function is_associative_array(array $array) {
40
+		return array_keys($array) !== range(0, count($array) - 1);
41 41
 	}
42 42
 
43 43
 	/**
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * @param array $arr
47 47
 	 * @return mixed what ever is in the array
48 48
 	 */
49
-	public static function get_one_item_from_array($arr){
49
+	public static function get_one_item_from_array($arr) {
50 50
 		$item = end($arr);
51 51
 		reset($arr);
52 52
 		return $item;
@@ -57,16 +57,16 @@  discard block
 block discarded – undo
57 57
 	 * @param mixed $arr
58 58
 	 * @return boolean
59 59
 	 */
60
-	public static function is_multi_dimensional_array($arr){
61
-		if(is_array($arr)){
60
+	public static function is_multi_dimensional_array($arr) {
61
+		if (is_array($arr)) {
62 62
 			$first_item = reset($arr);
63
-			if(is_array($first_item)){
64
-				return true;//yep, there's at least 2 levels to this array
65
-			}else{
66
-				return false;//nope, only 1 level
63
+			if (is_array($first_item)) {
64
+				return true; //yep, there's at least 2 levels to this array
65
+			} else {
66
+				return false; //nope, only 1 level
67 67
 			}
68
-		}else{
69
-			return false;//its not an array at all!
68
+		} else {
69
+			return false; //its not an array at all!
70 70
 		}
71 71
 	}
72 72
 
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 	 * @param mixed $default
78 78
 	 * @return mixed
79 79
 	 */
80
-	public static function is_set( $arr, $index, $default ) {
81
-		return isset( $arr[ $index ] ) ? $arr[ $index ] : $default;
80
+	public static function is_set($arr, $index, $default) {
81
+		return isset($arr[$index]) ? $arr[$index] : $default;
82 82
 	}
83 83
 
84 84
 	/**
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
 	 * @param mixed $value usually a string, but could be an array or object
87 87
 	 * @return mixed the UN-serialized data
88 88
 	 */
89
-	public static function maybe_unserialize( $value ) {
89
+	public static function maybe_unserialize($value) {
90 90
 		$data = maybe_unserialize($value);
91 91
 		//it's possible that this still has serialized data if its the session.  WP has a bug, http://core.trac.wordpress.org/ticket/26118 that doesnt' unserialize this automatically.
92 92
 		$token = 'C';
93 93
 		$data = is_string($data) ? trim($data) : $data;
94
-		if ( is_string($data) && strlen($data) > 1 && $data[0] == $token  && preg_match( "/^{$token}:[0-9]+:/s", $data ) ) {
94
+		if (is_string($data) && strlen($data) > 1 && $data[0] == $token && preg_match("/^{$token}:[0-9]+:/s", $data)) {
95 95
 			return unserialize($data);
96 96
 		} else {
97 97
 			return $data;
@@ -110,30 +110,30 @@  discard block
 block discarded – undo
110 110
 	 * @param bool $preserve_keys 		whether or not to reset numerically indexed arrays
111 111
 	 * @return array
112 112
 	 */
113
-	public static function insert_into_array( $target_array = array(), $array_to_insert = array(), $offset = null, $add_before = true, $preserve_keys = true ) {
113
+	public static function insert_into_array($target_array = array(), $array_to_insert = array(), $offset = null, $add_before = true, $preserve_keys = true) {
114 114
 		// ensure incoming arrays are actually arrays
115
-		$target_array 		= (array)$target_array;
116
-		$array_to_insert	= (array)$array_to_insert;
115
+		$target_array = (array) $target_array;
116
+		$array_to_insert = (array) $array_to_insert;
117 117
 		// if no offset key was supplied
118
-		if ( empty( $offset )) {
118
+		if (empty($offset)) {
119 119
 			// use start or end of $target_array based on whether we are adding before or not
120
-			$offset = $add_before ? 0 : count( $target_array );
120
+			$offset = $add_before ? 0 : count($target_array);
121 121
 		}
122 122
 		// if offset key is a string, then find the corresponding numeric location for that element
123
-		$offset = is_int( $offset ) ? $offset : array_search( $offset, array_keys( $target_array ) );
123
+		$offset = is_int($offset) ? $offset : array_search($offset, array_keys($target_array));
124 124
 		// add one to the offset if adding after
125 125
 		$offset = $add_before ? $offset : $offset + 1;
126 126
 		// but ensure offset does not exceed the length of the array
127
-		$offset = $offset > count( $target_array ) ? count( $target_array ) : $offset;
127
+		$offset = $offset > count($target_array) ? count($target_array) : $offset;
128 128
 		// reindex array ???
129
-		if ( $preserve_keys ) {
129
+		if ($preserve_keys) {
130 130
 			// take a slice of the target array from the beginning till the offset,
131 131
 			// then add the new data
132 132
 			// then add another slice that starts at the offset and goes till the end
133
-			return array_slice( $target_array, 0, $offset, true ) + $array_to_insert + array_slice( $target_array, $offset, null, true );
133
+			return array_slice($target_array, 0, $offset, true) + $array_to_insert + array_slice($target_array, $offset, null, true);
134 134
 		} else {
135 135
 			// since we don't want to preserve keys, we can use array_splice
136
-			array_splice( $target_array, $offset, 0, $array_to_insert );
136
+			array_splice($target_array, $offset, 0, $array_to_insert);
137 137
 			return $target_array;
138 138
 		}
139 139
 	}
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
 	 * @param array $array2
152 152
 	 * @return array
153 153
 	 */
154
-	public static function merge_arrays_and_overwrite_keys( array $array1, array $array2 ) {
155
-		foreach ( $array2 as $key => $value ) {
156
-			$array1[ $key ] = $value;
154
+	public static function merge_arrays_and_overwrite_keys(array $array1, array $array2) {
155
+		foreach ($array2 as $key => $value) {
156
+			$array1[$key] = $value;
157 157
 		}
158 158
 		return $array1;
159 159
 	}
@@ -171,14 +171,14 @@  discard block
 block discarded – undo
171 171
 	 * @param mixed $final_value
172 172
 	 * @return array
173 173
 	 */
174
-	public static function convert_array_values_to_keys( array $flat_array, $final_value = null ) {
174
+	public static function convert_array_values_to_keys(array $flat_array, $final_value = null) {
175 175
 		$multidimensional = array();
176 176
 		$reference = &$multidimensional;
177
-		foreach ( $flat_array as $key ) {
178
-			$reference[ $key ] = array();
179
-			$reference = &$reference[ $key ];
177
+		foreach ($flat_array as $key) {
178
+			$reference[$key] = array();
179
+			$reference = &$reference[$key];
180 180
 		}
181
-		if ( $final_value !== null ) {
181
+		if ($final_value !== null) {
182 182
 			$reference = $final_value;
183 183
 		}
184 184
 		return $multidimensional;
Please login to merge, or discard this patch.
core/exceptions/ExceptionStackTraceDisplay.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
 			// add generic non-identifying messages for non-privileged users
119 119
 			if ( ! WP_DEBUG ) {
120 120
 				$output .= '<span class="ee-error-user-msg-spn">'
121
-				           . trim( $msg )
122
-				           . '</span> &nbsp; <sup>'
123
-				           . $code
124
-				           . '</sup><br />';
121
+						   . trim( $msg )
122
+						   . '</span> &nbsp; <sup>'
123
+						   . $code
124
+						   . '</sup><br />';
125 125
 			} else {
126 126
 				// or helpful developer messages if debugging is on
127 127
 				$output .= '
@@ -130,39 +130,39 @@  discard block
 block discarded – undo
130 130
 				'
131 131
 				. sprintf(
132 132
 					__( '%1$sAn %2$s was thrown!%3$s code: %4$s', 'event_espresso' ),
133
-				    '<strong class="ee-error-dev-msg-str">',
133
+					'<strong class="ee-error-dev-msg-str">',
134 134
 					get_class( $exception ),
135 135
 					'</strong>  &nbsp; <span>',
136 136
 					$code . '</span>'
137 137
 				)
138 138
 				. '<br />
139 139
 				<span class="big-text">"'
140
-				           . trim( $msg )
141
-				           . '"</span><br/>
140
+						   . trim( $msg )
141
+						   . '"</span><br/>
142 142
 				<a id="display-ee-error-trace-1'
143
-				           . $time
144
-				           . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-1'
145
-				           . $time
146
-				           . '">
143
+						   . $time
144
+						   . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-1'
145
+						   . $time
146
+						   . '">
147 147
 					'
148
-				           . __( 'click to view backtrace and class/method details', 'event_espresso' )
149
-				           . '
148
+						   . __( 'click to view backtrace and class/method details', 'event_espresso' )
149
+						   . '
150 150
 				</a><br />
151 151
 				'
152
-				           . $exception->getFile()
153
-				           . sprintf(
154
-					           __( '%1$s( line no: %2$s )%3$s', 'event_espresso' ),
155
-					           ' &nbsp; <span class="small-text lt-grey-text">',
156
-					           $exception->getLine(),
157
-					           '</span>'
158
-				           )
159
-				           . '
152
+						   . $exception->getFile()
153
+						   . sprintf(
154
+							   __( '%1$s( line no: %2$s )%3$s', 'event_espresso' ),
155
+							   ' &nbsp; <span class="small-text lt-grey-text">',
156
+							   $exception->getLine(),
157
+							   '</span>'
158
+						   )
159
+						   . '
160 160
 			</p>
161 161
 			<div id="ee-error-trace-1'
162
-				           . $time
163
-				           . '-dv" class="ee-error-trace-dv" style="display: none;">
162
+						   . $time
163
+						   . '-dv" class="ee-error-trace-dv" style="display: none;">
164 164
 				'
165
-				           . $trace_details;
165
+						   . $trace_details;
166 166
 				if ( ! empty( $class ) ) {
167 167
 					$output .= '
168 168
 				<div style="padding:3px; margin:0 0 1em; border:1px solid #999; background:#fff; border-radius:3px;">
Please login to merge, or discard this patch.
Spacing   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
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
 
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 	/**
23 23
 	 * @param \Exception $exception
24 24
 	 */
25
-	public function __construct( \Exception $exception ) {
26
-		if ( WP_DEBUG ) {
27
-			$this->displayException( $exception );
25
+	public function __construct(\Exception $exception) {
26
+		if (WP_DEBUG) {
27
+			$this->displayException($exception);
28 28
 		}
29 29
 	}
30 30
 
@@ -34,27 +34,27 @@  discard block
 block discarded – undo
34 34
 	 * @access protected
35 35
 	 * @param \Exception $exception
36 36
 	 */
37
-	protected function displayException( \Exception $exception ) {
37
+	protected function displayException(\Exception $exception) {
38 38
 
39 39
 		$error_code = '';
40 40
 		$trace_details = '';
41 41
 		$time = time();
42 42
 		$trace = $exception->getTrace();
43 43
 		// get separate user and developer messages if they exist
44
-		$msg = explode( '||', $exception->getMessage() );
44
+		$msg = explode('||', $exception->getMessage());
45 45
 		$user_msg = $msg[0];
46
-		$dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0];
46
+		$dev_msg = isset($msg[1]) ? $msg[1] : $msg[0];
47 47
 		$msg = WP_DEBUG ? $dev_msg : $user_msg;
48 48
 		// start gathering output
49 49
 		$output = $this->exceptionStyles();
50 50
 		$output .= '
51 51
 <div id="ee-error-message" class="error">';
52
-		if ( ! WP_DEBUG ) {
52
+		if ( ! WP_DEBUG) {
53 53
 			$output .= '
54 54
 	<p>';
55 55
 		}
56 56
 			// process trace info
57
-			if ( empty( $trace ) ) {
57
+			if (empty($trace)) {
58 58
 				$trace_details .= __(
59 59
 					'Sorry, but no trace information was available for this exception.',
60 60
 					'event_espresso'
@@ -67,47 +67,47 @@  discard block
 block discarded – undo
67 67
 					<th scope="col" align="right" style="width:2.5%;">#</th>
68 68
 					<th scope="col" align="right" style="width:3.5%;">Line</th>
69 69
 					<th scope="col" align="left" style="width:40%;">File</th>
70
-					<th scope="col" align="left">' . __( 'Class', 'event_espresso' ) . '->' . __( 'Method( arguments )', 'event_espresso' ) . '</th>
70
+					<th scope="col" align="left">' . __('Class', 'event_espresso').'->'.__('Method( arguments )', 'event_espresso').'</th>
71 71
 				</tr>';
72
-				$last_on_stack = count( $trace ) - 1;
72
+				$last_on_stack = count($trace) - 1;
73 73
 				// reverse array so that stack is in proper chronological order
74
-				$sorted_trace = array_reverse( $trace );
75
-				foreach ( $sorted_trace as $nmbr => $trace ) {
76
-					$file = isset( $trace['file'] ) ? $trace['file'] : '';
77
-					$class = isset( $trace['class'] ) ? $trace['class'] : '';
78
-					$type = isset( $trace['type'] ) ? $trace['type'] : '';
79
-					$function = isset( $trace['function'] ) ? $trace['function'] : '';
80
-					$args = isset( $trace['args'] ) ? $this->_convert_args_to_string( $trace['args'] ) : '';
81
-					$args = isset( $trace['args'] ) && count( $trace['args'] ) > 4  ? ' <br />' . $args . '<br />' : $args;
82
-					$line = isset( $trace['line'] ) ? $trace['line'] : '';
74
+				$sorted_trace = array_reverse($trace);
75
+				foreach ($sorted_trace as $nmbr => $trace) {
76
+					$file = isset($trace['file']) ? $trace['file'] : '';
77
+					$class = isset($trace['class']) ? $trace['class'] : '';
78
+					$type = isset($trace['type']) ? $trace['type'] : '';
79
+					$function = isset($trace['function']) ? $trace['function'] : '';
80
+					$args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : '';
81
+					$args = isset($trace['args']) && count($trace['args']) > 4 ? ' <br />'.$args.'<br />' : $args;
82
+					$line = isset($trace['line']) ? $trace['line'] : '';
83 83
 					$zebra = $nmbr % 2 !== 0 ? ' odd' : '';
84
-					if ( empty( $file ) && ! empty( $class ) ) {
85
-						$a = new \ReflectionClass( $class );
84
+					if (empty($file) && ! empty($class)) {
85
+						$a = new \ReflectionClass($class);
86 86
 						$file = $a->getFileName();
87
-						if ( empty( $line ) && ! empty( $function ) ) {
88
-							$b = new \ReflectionMethod( $class, $function );
87
+						if (empty($line) && ! empty($function)) {
88
+							$b = new \ReflectionMethod($class, $function);
89 89
 							$line = $b->getStartLine();
90 90
 						}
91 91
 					}
92
-					if ( $nmbr === $last_on_stack ) {
92
+					if ($nmbr === $last_on_stack) {
93 93
 						$file = $exception->getFile() !== '' ? $exception->getFile() : $file;
94 94
 						$line = $exception->getLine() !== '' ? $exception->getLine() : $line;
95
-						$error_code = $this->generate_error_code( $file, $trace['function'], $line );
95
+						$error_code = $this->generate_error_code($file, $trace['function'], $line);
96 96
 					}
97
-					$file = \EEH_File::standardise_directory_separators( $file );
98
-					$nmbr = ! empty( $nmbr ) ? $nmbr : '&nbsp;';
99
-					$line = ! empty( $line ) ? $line : '&nbsp;';
100
-					$file = ! empty( $file ) ? $file : '&nbsp;';
101
-					$class_display = ! empty( $class ) ? $class : '';
102
-					$type = ! empty( $type ) ? $type : '';
103
-					$function = ! empty( $function ) ? $function : '';
104
-					$args = ! empty( $args ) ? '( ' . $args . ' )' : '()';
97
+					$file = \EEH_File::standardise_directory_separators($file);
98
+					$nmbr = ! empty($nmbr) ? $nmbr : '&nbsp;';
99
+					$line = ! empty($line) ? $line : '&nbsp;';
100
+					$file = ! empty($file) ? $file : '&nbsp;';
101
+					$class_display = ! empty($class) ? $class : '';
102
+					$type = ! empty($type) ? $type : '';
103
+					$function = ! empty($function) ? $function : '';
104
+					$args = ! empty($args) ? '( '.$args.' )' : '()';
105 105
 					$trace_details .= '
106 106
 					<tr>
107
-						<td align="right" valign="top" class="' . $zebra . '">' . $nmbr . '</td>
108
-						<td align="right" valign="top" class="' . $zebra . '">' . $line . '</td>
109
-						<td align="left" valign="top" class="' . $zebra . '">' . $file . '</td>
110
-						<td align="left" valign="top" class="' . $zebra . '">' . $class_display . $type . $function . $args . '</td>
107
+						<td align="right" valign="top" class="' . $zebra.'">'.$nmbr.'</td>
108
+						<td align="right" valign="top" class="' . $zebra.'">'.$line.'</td>
109
+						<td align="left" valign="top" class="' . $zebra.'">'.$file.'</td>
110
+						<td align="left" valign="top" class="' . $zebra.'">'.$class_display.$type.$function.$args.'</td>
111 111
 					</tr>';
112 112
 				}
113 113
 				$trace_details .= '
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
 			}
117 117
 			$code = $exception->getCode() ? $exception->getCode() : $error_code;
118 118
 			// add generic non-identifying messages for non-privileged users
119
-			if ( ! WP_DEBUG ) {
119
+			if ( ! WP_DEBUG) {
120 120
 				$output .= '<span class="ee-error-user-msg-spn">'
121
-				           . trim( $msg )
121
+				           . trim($msg)
122 122
 				           . '</span> &nbsp; <sup>'
123 123
 				           . $code
124 124
 				           . '</sup><br />';
@@ -129,15 +129,15 @@  discard block
 block discarded – undo
129 129
 			<p class="ee-error-dev-msg-pg">
130 130
 				'
131 131
 				. sprintf(
132
-					__( '%1$sAn %2$s was thrown!%3$s code: %4$s', 'event_espresso' ),
132
+					__('%1$sAn %2$s was thrown!%3$s code: %4$s', 'event_espresso'),
133 133
 				    '<strong class="ee-error-dev-msg-str">',
134
-					get_class( $exception ),
134
+					get_class($exception),
135 135
 					'</strong>  &nbsp; <span>',
136
-					$code . '</span>'
136
+					$code.'</span>'
137 137
 				)
138 138
 				. '<br />
139 139
 				<span class="big-text">"'
140
-				           . trim( $msg )
140
+				           . trim($msg)
141 141
 				           . '"</span><br/>
142 142
 				<a id="display-ee-error-trace-1'
143 143
 				           . $time
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
 				           . $time
146 146
 				           . '">
147 147
 					'
148
-				           . __( 'click to view backtrace and class/method details', 'event_espresso' )
148
+				           . __('click to view backtrace and class/method details', 'event_espresso')
149 149
 				           . '
150 150
 				</a><br />
151 151
 				'
152 152
 				           . $exception->getFile()
153 153
 				           . sprintf(
154
-					           __( '%1$s( line no: %2$s )%3$s', 'event_espresso' ),
154
+					           __('%1$s( line no: %2$s )%3$s', 'event_espresso'),
155 155
 					           ' &nbsp; <span class="small-text lt-grey-text">',
156 156
 					           $exception->getLine(),
157 157
 					           '</span>'
@@ -163,14 +163,14 @@  discard block
 block discarded – undo
163 163
 				           . '-dv" class="ee-error-trace-dv" style="display: none;">
164 164
 				'
165 165
 				           . $trace_details;
166
-				if ( ! empty( $class ) ) {
166
+				if ( ! empty($class)) {
167 167
 					$output .= '
168 168
 				<div style="padding:3px; margin:0 0 1em; border:1px solid #999; background:#fff; border-radius:3px;">
169 169
 					<div style="padding:1em 2em; border:1px solid #999; background:#fcfcfc;">
170
-						<h3>' . __( 'Class Details', 'event_espresso' ) . '</h3>';
171
-					$a = new \ReflectionClass( $class );
170
+						<h3>' . __('Class Details', 'event_espresso').'</h3>';
171
+					$a = new \ReflectionClass($class);
172 172
 					$output .= '
173
-						<pre>' . $a . '</pre>
173
+						<pre>' . $a.'</pre>
174 174
 					</div>
175 175
 				</div>';
176 176
 				}
@@ -180,16 +180,16 @@  discard block
 block discarded – undo
180 180
 		<br />';
181 181
 			}
182 182
 		// remove last linebreak
183
-		$output = substr( $output, 0, count( $output ) - 7 );
184
-		if ( ! WP_DEBUG ) {
183
+		$output = substr($output, 0, count($output) - 7);
184
+		if ( ! WP_DEBUG) {
185 185
 			$output .= '
186 186
 	</p>';
187 187
 		}
188 188
 		$output .= '
189 189
 </div>';
190
-		$output .= $this->printScripts( true );
191
-		if ( defined( 'DOING_AJAX' ) ) {
192
-			echo json_encode( array( 'error' => $output ) );
190
+		$output .= $this->printScripts(true);
191
+		if (defined('DOING_AJAX')) {
192
+			echo json_encode(array('error' => $output));
193 193
 			exit();
194 194
 		}
195 195
 		echo $output;
@@ -206,56 +206,56 @@  discard block
 block discarded – undo
206 206
 	 * @param bool  $array
207 207
 	 * @return string
208 208
 	 */
209
-	private function _convert_args_to_string( $arguments = array(), $indent = 0, $array = false ) {
209
+	private function _convert_args_to_string($arguments = array(), $indent = 0, $array = false) {
210 210
 		$args = array();
211
-		$args_count = count( $arguments );
212
-		if ( $args_count > 2 ) {
211
+		$args_count = count($arguments);
212
+		if ($args_count > 2) {
213 213
 			$indent++;
214 214
 			$args[] = '<br />';
215 215
 		}
216 216
 		$x = 0;
217
-		foreach ( $arguments as $arg ) {
217
+		foreach ($arguments as $arg) {
218 218
 			$x++;
219
-			for( $i = 0; $i < $indent; $i++ ) {
219
+			for ($i = 0; $i < $indent; $i++) {
220 220
 				$args[] = ' &nbsp;&nbsp; ';
221 221
 			}
222
-			if ( is_string( $arg ) ) {
223
-				if ( ! $array && strlen( $arg ) > 75 ) {
222
+			if (is_string($arg)) {
223
+				if ( ! $array && strlen($arg) > 75) {
224 224
 					$args[] = "<br />";
225
-					for ( $i = 0; $i <= $indent; $i++ ) {
225
+					for ($i = 0; $i <= $indent; $i++) {
226 226
 						$args[] = ' &nbsp;&nbsp; ';
227 227
 					}
228
-					$args[] = "'" . $arg . "'<br />";
228
+					$args[] = "'".$arg."'<br />";
229 229
 				} else {
230
-					$args[] = " '" . $arg . "'";
230
+					$args[] = " '".$arg."'";
231 231
 				}
232
-			} elseif ( is_array( $arg ) ) {
233
-				$arg_count = count( $arg );
234
-				if ( $arg_count > 2 ) {
232
+			} elseif (is_array($arg)) {
233
+				$arg_count = count($arg);
234
+				if ($arg_count > 2) {
235 235
 					$indent++;
236
-					$args[] = " array(" . $this->_convert_args_to_string( $arg, $indent, true ) . ")";
236
+					$args[] = " array(".$this->_convert_args_to_string($arg, $indent, true).")";
237 237
 					$indent--;
238
-				} else if ( $arg_count === 0 ) {
238
+				} else if ($arg_count === 0) {
239 239
 					$args[] = " array()";
240 240
 				} else {
241
-					$args[] = " array( " . $this->_convert_args_to_string( $arg ) . " )";
241
+					$args[] = " array( ".$this->_convert_args_to_string($arg)." )";
242 242
 				}
243
-			} elseif ( $arg === null ) {
243
+			} elseif ($arg === null) {
244 244
 				$args[] = ' null';
245
-			} elseif ( is_bool( $arg ) ) {
245
+			} elseif (is_bool($arg)) {
246 246
 				$args[] = $arg ? ' true' : ' false';
247
-			} elseif ( is_object( $arg ) ) {
248
-				$args[] = get_class( $arg );
249
-			} elseif ( is_resource( $arg ) ) {
250
-				$args[] = get_resource_type( $arg );
247
+			} elseif (is_object($arg)) {
248
+				$args[] = get_class($arg);
249
+			} elseif (is_resource($arg)) {
250
+				$args[] = get_resource_type($arg);
251 251
 			} else {
252 252
 				$args[] = $arg;
253 253
 			}
254
-			if ( $x === $args_count ) {
255
-				if ( $args_count > 2 ) {
254
+			if ($x === $args_count) {
255
+				if ($args_count > 2) {
256 256
 					$args[] = "<br />";
257 257
 					$indent--;
258
-					for ( $i = 1; $i < $indent; $i++ ) {
258
+					for ($i = 1; $i < $indent; $i++) {
259 259
 						$args[] = ' &nbsp;&nbsp; ';
260 260
 					}
261 261
 				}
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 				$args[] = $args_count > 2 ? ",<br />" : ', ';
264 264
 			}
265 265
 		}
266
-		return implode( '', $args );
266
+		return implode('', $args);
267 267
 	}
268 268
 
269 269
 
@@ -278,11 +278,11 @@  discard block
 block discarded – undo
278 278
 	 * @param string $line
279 279
 	 * @return string
280 280
 	 */
281
-	protected function generate_error_code( $file = '', $func = '', $line = '' ) {
282
-		$file_bits = explode( '.', basename( $file ) );
283
-		$error_code = ! empty( $file_bits[0] ) ? $file_bits[0] : '';
284
-		$error_code .= ! empty( $func ) ? ' - ' . $func : '';
285
-		$error_code .= ! empty( $line ) ? ' - ' . $line : '';
281
+	protected function generate_error_code($file = '', $func = '', $line = '') {
282
+		$file_bits = explode('.', basename($file));
283
+		$error_code = ! empty($file_bits[0]) ? $file_bits[0] : '';
284
+		$error_code .= ! empty($func) ? ' - '.$func : '';
285
+		$error_code .= ! empty($line) ? ' - '.$line : '';
286 286
 		return $error_code;
287 287
 	}
288 288
 
@@ -366,26 +366,26 @@  discard block
 block discarded – undo
366 366
 	 * @param bool $force_print
367 367
 	 * @return string|void
368 368
 	 */
369
-	private function printScripts( $force_print = false ) {
370
-		if ( ! $force_print  && ( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' ) ) ) {
371
-			if ( wp_script_is( 'ee_error_js', 'enqueued' ) ) {
369
+	private function printScripts($force_print = false) {
370
+		if ( ! $force_print && (did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts'))) {
371
+			if (wp_script_is('ee_error_js', 'enqueued')) {
372 372
 				return '';
373
-			} else if ( wp_script_is( 'ee_error_js', 'registered' ) ) {
374
-				add_filter( 'FHEE_load_css', '__return_true' );
375
-				add_filter( 'FHEE_load_js', '__return_true' );
376
-				wp_enqueue_script( 'ee_error_js' );
377
-				wp_localize_script( 'ee_error_js', 'ee_settings', array( 'wp_debug' => WP_DEBUG ) );
373
+			} else if (wp_script_is('ee_error_js', 'registered')) {
374
+				add_filter('FHEE_load_css', '__return_true');
375
+				add_filter('FHEE_load_js', '__return_true');
376
+				wp_enqueue_script('ee_error_js');
377
+				wp_localize_script('ee_error_js', 'ee_settings', array('wp_debug' => WP_DEBUG));
378 378
 			}
379 379
 		} else {
380 380
 			return '
381 381
 <script>
382 382
 /* <![CDATA[ */
383
-var ee_settings = {"wp_debug":"' . WP_DEBUG . '"};
383
+var ee_settings = {"wp_debug":"' . WP_DEBUG.'"};
384 384
 /* ]]> */
385 385
 </script>
386
-<script src="' . includes_url() . 'js/jquery/jquery.js" type="text/javascript"></script>
387
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
388
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
386
+<script src="' . includes_url().'js/jquery/jquery.js" type="text/javascript"></script>
387
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
388
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
389 389
 ';
390 390
 		}
391 391
 		return '';
Please login to merge, or discard this patch.
core/exceptions/InsufficientPermissionsException.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
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
 
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 	 * @param  int $code
25 25
 	 * @param  \Exception $previous
26 26
 	 */
27
-	public function __construct( $action, $message = '', $code = 0, \Exception $previous = null ) {
28
-		if ( empty( $message ) ) {
27
+	public function __construct($action, $message = '', $code = 0, \Exception $previous = null) {
28
+		if (empty($message)) {
29 29
 			$message = sprintf(
30 30
 				__(
31 31
 					'We\'re sorry, but you do not have the required permissions to perform the following action: ',
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 				$action
35 35
 			);
36 36
 		}
37
-		parent::__construct( $message, $code, $previous );
37
+		parent::__construct($message, $code, $previous);
38 38
 	}
39 39
 
40 40
 
Please login to merge, or discard this patch.
core/libraries/form_sections/form_handlers/InvalidFormHandlerException.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\libraries\form_sections\form_handlers;
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
 
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 	 * @param int        $code
27 27
 	 * @param \Exception $previous
28 28
 	 */
29
-	public function __construct( $actual, $message = '', $code = 0, \Exception $previous = null ) {
30
-		if ( empty( $message ) ) {
29
+	public function __construct($actual, $message = '', $code = 0, \Exception $previous = null) {
30
+		if (empty($message)) {
31 31
 			$message = sprintf(
32 32
 				__(
33 33
 					'A valid Form Handler was expected but instead "%1$s" was received.',
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 				$actual
37 37
 			);
38 38
 		}
39
-		parent::__construct( $message, $code, $previous );
39
+		parent::__construct($message, $code, $previous);
40 40
 	}
41 41
 
42 42
 }
Please login to merge, or discard this patch.
core/libraries/form_sections/form_handlers/FormHandlerInterface.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 
4 4
 use EE_Form_Section_Proper;
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
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	/**
37 37
 	 * @param \EE_Form_Section_Proper $form
38 38
 	 */
39
-	public function setForm( \EE_Form_Section_Proper $form );
39
+	public function setForm(\EE_Form_Section_Proper $form);
40 40
 
41 41
 
42 42
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	/**
54 54
 	 * @param boolean $displayable
55 55
 	 */
56
-	public function setDisplayable( $displayable = false );
56
+	public function setDisplayable($displayable = false);
57 57
 
58 58
 
59 59
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	/**
95 95
 	 * @param string $submit_btn_text
96 96
 	 */
97
-	public function setSubmitBtnText( $submit_btn_text );
97
+	public function setSubmitBtnText($submit_btn_text);
98 98
 
99 99
 
100 100
 
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
 	/**
109 109
 	 * @param string $form_action
110 110
 	 */
111
-	public function setFormAction( $form_action );
111
+	public function setFormAction($form_action);
112 112
 
113 113
 
114 114
 
115 115
 	/**
116 116
 	 * @param array $form_args
117 117
 	 */
118
-	public function addFormActionArgs( $form_args = array() );
118
+	public function addFormActionArgs($form_args = array());
119 119
 
120 120
 
121 121
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 *
136 136
 	 * @param string $form_config
137 137
 	 */
138
-	public function setFormConfig( $form_config );
138
+	public function setFormConfig($form_config);
139 139
 
140 140
 
141 141
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 * @param array $submitted_form_data
188 188
 	 * @return bool
189 189
 	 */
190
-	public function process( $submitted_form_data = array() );
190
+	public function process($submitted_form_data = array());
191 191
 
192 192
 
193 193
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 * @param string $text
198 198
 	 * @return \EE_Submit_Input
199 199
 	 */
200
-	public function generateSubmitButton( $text = '' );
200
+	public function generateSubmitButton($text = '');
201 201
 
202 202
 
203 203
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 * @param string $text
217 217
 	 * @return \EE_Submit_Input
218 218
 	 */
219
-	public function generateCancelButton( $text = '' );
219
+	public function generateCancelButton($text = '');
220 220
 
221 221
 
222 222
 
Please login to merge, or discard this patch.