Completed
Branch FET-9643-checkin-system-docume... (5f5a9c)
by
unknown
228:39 queued 218:41
created
core/EE_Session.core.php 4 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -137,11 +137,11 @@
 block discarded – undo
137 137
 
138 138
 
139 139
 	/**
140
-	* 	private constructor to prevent direct creation
141
-	* 	@Constructor
142
-	* 	@access private
143
-	* 	@return EE_Session
144
-	*/
140
+	 * 	private constructor to prevent direct creation
141
+	 * 	@Constructor
142
+	 * 	@access private
143
+	 * 	@return EE_Session
144
+	 */
145 145
 	private function __construct() {
146 146
 
147 147
 		// 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' );
Please login to merge, or discard this patch.
Spacing   +148 added lines, -148 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
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	  * array for defining default session vars
105 105
 	  * @var array
106 106
 	  */
107
-	 private $_default_session_vars = array (
107
+	 private $_default_session_vars = array(
108 108
 		'id' => NULL,
109 109
 		'user_id' => NULL,
110 110
 		'ip_address' => NULL,
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 	 *		@access public
127 127
 	 *		@return EE_Session
128 128
 	 */
129
-	public static function instance ( ) {
129
+	public static function instance( ) {
130 130
 		// check if class object is instantiated
131
-		if ( ! self::$_instance instanceof EE_Session ) {
131
+		if ( ! self::$_instance instanceof EE_Session) {
132 132
 			self::$_instance = new self();
133 133
 		}
134 134
 		return self::$_instance;
@@ -145,11 +145,11 @@  discard block
 block discarded – undo
145 145
 	private function __construct() {
146 146
 
147 147
 		// 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' );
148
-		if ( ! apply_filters( 'FHEE_load_EE_Session', TRUE ) ) {
148
+		if ( ! apply_filters('FHEE_load_EE_Session', TRUE)) {
149 149
 			return NULL;
150 150
 		}
151
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__, '' );
152
-		define( 'ESPRESSO_SESSION', TRUE );
151
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, '');
152
+		define('ESPRESSO_SESSION', TRUE);
153 153
 		// default session lifespan in seconds
154 154
 		$this->_lifespan = apply_filters(
155 155
 			'FHEE__EE_Session__construct___lifespan',
@@ -162,35 +162,35 @@  discard block
 block discarded – undo
162 162
 		 * 		}
163 163
 		 */
164 164
 		// retrieve session options from db
165
-		$session_settings = get_option( 'ee_session_settings' );
166
-		if ( $session_settings !== FALSE ) {
165
+		$session_settings = get_option('ee_session_settings');
166
+		if ($session_settings !== FALSE) {
167 167
 			// cycle though existing session options
168
-			foreach ( $session_settings as $var_name => $session_setting ) {
168
+			foreach ($session_settings as $var_name => $session_setting) {
169 169
 				// set values for class properties
170
-				$var_name = '_' . $var_name;
170
+				$var_name = '_'.$var_name;
171 171
 				$this->{$var_name} = $session_setting;
172 172
 			}
173 173
 		}
174 174
 		// are we using encryption?
175
-		if ( $this->_use_encryption ) {
175
+		if ($this->_use_encryption) {
176 176
 			// instantiate the class object making all properties and methods accessible via $this->encryption ex: $this->encryption->encrypt();
177
-			$this->encryption = EE_Registry::instance()->load_core( 'Encryption' );
177
+			$this->encryption = EE_Registry::instance()->load_core('Encryption');
178 178
 		}
179 179
 		// filter hook allows outside functions/classes/plugins to change default empty cart
180
-		$extra_default_session_vars = apply_filters( 'FHEE__EE_Session__construct__extra_default_session_vars', array() );
181
-		array_merge( $this->_default_session_vars, $extra_default_session_vars );
180
+		$extra_default_session_vars = apply_filters('FHEE__EE_Session__construct__extra_default_session_vars', array());
181
+		array_merge($this->_default_session_vars, $extra_default_session_vars);
182 182
 		// apply default session vars
183 183
 		$this->_set_defaults();
184 184
 		// check for existing session and retrieve it from db
185
-		if ( ! $this->_espresso_session() ) {
185
+		if ( ! $this->_espresso_session()) {
186 186
 			// or just start a new one
187 187
 			$this->_create_espresso_session();
188 188
 		}
189 189
 		// check request for 'clear_session' param
190
-		add_action( 'AHEE__EE_Request_Handler__construct__complete', array( $this, 'wp_loaded' ));
190
+		add_action('AHEE__EE_Request_Handler__construct__complete', array($this, 'wp_loaded'));
191 191
 		// once everything is all said and done,
192
-		add_action( 'shutdown', array( $this, 'update' ), 100 );
193
-		add_action( 'shutdown', array( $this, 'garbage_collection' ), 999 );
192
+		add_action('shutdown', array($this, 'update'), 100);
193
+		add_action('shutdown', array($this, 'garbage_collection'), 999);
194 194
 
195 195
 	}
196 196
 
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
 	 */
223 223
 	private function _set_defaults() {
224 224
 		// set some defaults
225
-		foreach ( $this->_default_session_vars as $key => $default_var ) {
226
-			if ( is_array( $default_var )) {
227
-				$this->_session_data[ $key ] = array();
225
+		foreach ($this->_default_session_vars as $key => $default_var) {
226
+			if (is_array($default_var)) {
227
+				$this->_session_data[$key] = array();
228 228
 			} else {
229
-				$this->_session_data[ $key ] = '';
229
+				$this->_session_data[$key] = '';
230 230
 			}
231 231
 		}
232 232
 	}
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	  * @param \EE_Cart $cart
249 249
 	  * @return bool
250 250
 	  */
251
-	 public function set_cart( EE_Cart $cart ) {
251
+	 public function set_cart(EE_Cart $cart) {
252 252
 		 $this->_session_data['cart'] = $cart;
253 253
 		 return TRUE;
254 254
 	 }
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 	  * @return \EE_Cart
269 269
 	  */
270 270
 	 public function cart() {
271
-		 return isset( $this->_session_data['cart'] ) ? $this->_session_data['cart'] : NULL;
271
+		 return isset($this->_session_data['cart']) ? $this->_session_data['cart'] : NULL;
272 272
 	 }
273 273
 
274 274
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	  * @param \EE_Checkout $checkout
278 278
 	  * @return bool
279 279
 	  */
280
-	 public function set_checkout( EE_Checkout $checkout ) {
280
+	 public function set_checkout(EE_Checkout $checkout) {
281 281
 		 $this->_session_data['checkout'] = $checkout;
282 282
 		 return TRUE;
283 283
 	 }
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	  * @return \EE_Checkout
298 298
 	  */
299 299
 	 public function checkout() {
300
-		 return isset( $this->_session_data['checkout'] ) ? $this->_session_data['checkout'] : NULL;
300
+		 return isset($this->_session_data['checkout']) ? $this->_session_data['checkout'] : NULL;
301 301
 	 }
302 302
 
303 303
 
@@ -306,9 +306,9 @@  discard block
 block discarded – undo
306 306
 	  * @param \EE_Transaction $transaction
307 307
 	  * @return bool
308 308
 	  */
309
-	 public function set_transaction( EE_Transaction $transaction ) {
309
+	 public function set_transaction(EE_Transaction $transaction) {
310 310
 		 // first remove the session from the transaction before we save the transaction in the session
311
-		 $transaction->set_txn_session_data( NULL );
311
+		 $transaction->set_txn_session_data(NULL);
312 312
 		 $this->_session_data['transaction'] = $transaction;
313 313
 		 return TRUE;
314 314
 	 }
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	  * @return \EE_Transaction
329 329
 	  */
330 330
 	 public function transaction() {
331
-		 return isset( $this->_session_data['transaction'] ) ? $this->_session_data['transaction'] : NULL;
331
+		 return isset($this->_session_data['transaction']) ? $this->_session_data['transaction'] : NULL;
332 332
 	 }
333 333
 
334 334
 
@@ -340,15 +340,15 @@  discard block
 block discarded – undo
340 340
 	  * @param bool $reset_cache
341 341
 	  * @return    array
342 342
 	  */
343
-	public function get_session_data( $key = NULL, $reset_cache = FALSE ) {
344
-		if ( $reset_cache ) {
343
+	public function get_session_data($key = NULL, $reset_cache = FALSE) {
344
+		if ($reset_cache) {
345 345
 			$this->reset_cart();
346 346
 			$this->reset_checkout();
347 347
 			$this->reset_transaction();
348 348
 		}
349
-		 if ( ! empty( $key ))  {
350
-			return  isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL;
351
-		}  else  {
349
+		 if ( ! empty($key)) {
350
+			return  isset($this->_session_data[$key]) ? $this->_session_data[$key] : NULL;
351
+		} else {
352 352
 			return $this->_session_data;
353 353
 		}
354 354
 	}
@@ -361,20 +361,20 @@  discard block
 block discarded – undo
361 361
 	  * @param 	array $data
362 362
 	  * @return 	TRUE on success, FALSE on fail
363 363
 	  */
364
-	public function set_session_data( $data ) {
364
+	public function set_session_data($data) {
365 365
 
366 366
 		// nothing ??? bad data ??? go home!
367
-		if ( empty( $data ) || ! is_array( $data )) {
368
-			EE_Error::add_error( __( 'No session data or invalid session data was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
367
+		if (empty($data) || ! is_array($data)) {
368
+			EE_Error::add_error(__('No session data or invalid session data was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
369 369
 			return FALSE;
370 370
 		}
371 371
 
372
-		foreach ( $data as $key =>$value ) {
373
-			if ( isset( $this->_default_session_vars[ $key ] )) {
374
-				EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $key ), __FILE__, __FUNCTION__, __LINE__ );
372
+		foreach ($data as $key =>$value) {
373
+			if (isset($this->_default_session_vars[$key])) {
374
+				EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $key), __FILE__, __FUNCTION__, __LINE__);
375 375
 				return FALSE;
376 376
 			} else {
377
-				$this->_session_data[ $key ] = $value;
377
+				$this->_session_data[$key] = $value;
378 378
 			}
379 379
 		}
380 380
 
@@ -391,9 +391,9 @@  discard block
 block discarded – undo
391 391
 	  * @throws \EE_Error
392 392
 	  */
393 393
 	private function _espresso_session() {
394
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
394
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
395 395
 		// check that session has started
396
-		if ( session_id() === '' ) {
396
+		if (session_id() === '') {
397 397
 			//starts a new session if one doesn't already exist, or re-initiates an existing one
398 398
 			session_start();
399 399
 		}
@@ -402,57 +402,57 @@  discard block
 block discarded – undo
402 402
 		// and the visitors IP
403 403
 		$this->_ip_address = $this->_visitor_ip();
404 404
 		// set the "user agent"
405
-		$this->_user_agent = ( isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr( $_SERVER['HTTP_USER_AGENT'] ) : FALSE;
405
+		$this->_user_agent = (isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr($_SERVER['HTTP_USER_AGENT']) : FALSE;
406 406
 		// now let's retrieve what's in the db
407 407
 		// we're using WP's Transient API to store session data using the PHP session ID as the option name
408
-		$session_data = get_transient( EE_Session::session_id_prefix . $this->_sid );
409
-		if ( $session_data ) {
410
-			if ( apply_filters( 'FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG ) ) {
411
-				$hash_check = get_transient( EE_Session::hash_check_prefix . $this->_sid );
412
-				if ( $hash_check && $hash_check !== md5( $session_data ) ) {
408
+		$session_data = get_transient(EE_Session::session_id_prefix.$this->_sid);
409
+		if ($session_data) {
410
+			if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
411
+				$hash_check = get_transient(EE_Session::hash_check_prefix.$this->_sid);
412
+				if ($hash_check && $hash_check !== md5($session_data)) {
413 413
 					EE_Error::add_error(
414 414
 						sprintf(
415
-							__( 'The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso' ),
416
-							EE_Session::session_id_prefix . $this->_sid
415
+							__('The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso'),
416
+							EE_Session::session_id_prefix.$this->_sid
417 417
 						),
418 418
 						__FILE__, __FUNCTION__, __LINE__
419 419
 					);
420 420
 				}
421 421
 			}
422 422
 			// un-encrypt the data
423
-			$session_data = $this->_use_encryption ? $this->encryption->decrypt( $session_data ) : $session_data;
423
+			$session_data = $this->_use_encryption ? $this->encryption->decrypt($session_data) : $session_data;
424 424
 			// unserialize
425
-			$session_data = maybe_unserialize( $session_data );
425
+			$session_data = maybe_unserialize($session_data);
426 426
 			// just a check to make sure the session array is indeed an array
427
-			if ( ! is_array( $session_data ) ) {
427
+			if ( ! is_array($session_data)) {
428 428
 				// no?!?! then something is wrong
429 429
 				return FALSE;
430 430
 			}
431 431
 			// get the current time in UTC
432
-			$this->_time = isset( $this->_time ) ? $this->_time : time();
432
+			$this->_time = isset($this->_time) ? $this->_time : time();
433 433
 			// and reset the session expiration
434
-			$this->_expiration = isset( $session_data['expiration'] ) ? $session_data['expiration'] : $this->_time + $this->_lifespan;
434
+			$this->_expiration = isset($session_data['expiration']) ? $session_data['expiration'] : $this->_time + $this->_lifespan;
435 435
 
436 436
 		} else {
437 437
 			// set initial site access time and the session expiration
438 438
 			$this->_set_init_access_and_expiration();
439 439
 			// set referer
440
-			$this->_session_data[ 'pages_visited' ][ $this->_session_data['init_access'] ] = isset( $_SERVER['HTTP_REFERER'] ) ? esc_attr( $_SERVER['HTTP_REFERER'] ) : '';
440
+			$this->_session_data['pages_visited'][$this->_session_data['init_access']] = isset($_SERVER['HTTP_REFERER']) ? esc_attr($_SERVER['HTTP_REFERER']) : '';
441 441
 			// no previous session = go back and create one (on top of the data above)
442 442
 			return FALSE;
443 443
 		}
444 444
 		// now the user agent
445
-		if ( $session_data['user_agent'] != $this->_user_agent ) {
445
+		if ($session_data['user_agent'] != $this->_user_agent) {
446 446
 			return FALSE;
447 447
 		}
448 448
 		// wait a minute... how old are you?
449
-		if ( $this->_time > $this->_expiration ) {
449
+		if ($this->_time > $this->_expiration) {
450 450
 			// yer too old fer me!
451 451
 			// wipe out everything that isn't a default session datum
452
-			$this->clear_session( __CLASS__, __FUNCTION__ );
452
+			$this->clear_session(__CLASS__, __FUNCTION__);
453 453
 		}
454 454
 		// make event espresso session data available to plugin
455
-		$this->_session_data = array_merge( $this->_session_data, $session_data );
455
+		$this->_session_data = array_merge($this->_session_data, $session_data);
456 456
 		return TRUE;
457 457
 
458 458
 	}
@@ -470,12 +470,12 @@  discard block
 block discarded – undo
470 470
 	  */
471 471
 	protected function _generate_session_id() {
472 472
 		// check if the SID was passed explicitly, otherwise get from session, then add salt and hash it to reduce length
473
-		if ( isset( $_REQUEST[ 'EESID' ] ) ) {
474
-			$session_id = sanitize_text_field( $_REQUEST[ 'EESID' ] );
473
+		if (isset($_REQUEST['EESID'])) {
474
+			$session_id = sanitize_text_field($_REQUEST['EESID']);
475 475
 		} else {
476
-			$session_id = md5( session_id() . get_current_blog_id() . $this->_get_sid_salt() );
476
+			$session_id = md5(session_id().get_current_blog_id().$this->_get_sid_salt());
477 477
 		}
478
-		return apply_filters( 'FHEE__EE_Session___generate_session_id__session_id', $session_id );
478
+		return apply_filters('FHEE__EE_Session___generate_session_id__session_id', $session_id);
479 479
 	}
480 480
 
481 481
 
@@ -487,20 +487,20 @@  discard block
 block discarded – undo
487 487
 	  */
488 488
 	protected function _get_sid_salt() {
489 489
 		// was session id salt already saved to db ?
490
-		if ( empty( $this->_sid_salt ) ) {
490
+		if (empty($this->_sid_salt)) {
491 491
 			// no?  then maybe use WP defined constant
492
-			if ( defined( 'AUTH_SALT' ) ) {
492
+			if (defined('AUTH_SALT')) {
493 493
 				$this->_sid_salt = AUTH_SALT;
494 494
 			}
495 495
 			// if salt doesn't exist or is too short
496
-			if ( empty( $this->_sid_salt ) || strlen( $this->_sid_salt ) < 32 ) {
496
+			if (empty($this->_sid_salt) || strlen($this->_sid_salt) < 32) {
497 497
 				// create a new one
498
-				$this->_sid_salt = wp_generate_password( 64 );
498
+				$this->_sid_salt = wp_generate_password(64);
499 499
 			}
500 500
 			// and save it as a permanent session setting
501
-			$session_settings = get_option( 'ee_session_settings' );
502
-			$session_settings[ 'sid_salt' ] = $this->_sid_salt;
503
-			update_option( 'ee_session_settings', $session_settings );
501
+			$session_settings = get_option('ee_session_settings');
502
+			$session_settings['sid_salt'] = $this->_sid_salt;
503
+			update_option('ee_session_settings', $session_settings);
504 504
 		}
505 505
 		return $this->_sid_salt;
506 506
 	}
@@ -528,19 +528,19 @@  discard block
 block discarded – undo
528 528
 	  * @param bool $new_session
529 529
 	  * @return TRUE on success, FALSE on fail
530 530
 	  */
531
-	public function update( $new_session = FALSE ) {
532
-		$this->_session_data = isset( $this->_session_data )
533
-			&& is_array( $this->_session_data )
534
-			&& isset( $this->_session_data['id'])
531
+	public function update($new_session = FALSE) {
532
+		$this->_session_data = isset($this->_session_data)
533
+			&& is_array($this->_session_data)
534
+			&& isset($this->_session_data['id'])
535 535
 			? $this->_session_data
536 536
 			: NULL;
537
-		if ( empty( $this->_session_data )) {
537
+		if (empty($this->_session_data)) {
538 538
 			$this->_set_defaults();
539 539
 		}
540 540
 		$session_data = array();
541
-		foreach ( $this->_session_data as $key => $value ) {
541
+		foreach ($this->_session_data as $key => $value) {
542 542
 
543
-			switch( $key ) {
543
+			switch ($key) {
544 544
 
545 545
 				case 'id' :
546 546
 					// session ID
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 				break;
559 559
 
560 560
 				case 'init_access' :
561
-					$session_data['init_access'] = absint( $value );
561
+					$session_data['init_access'] = absint($value);
562 562
 				break;
563 563
 
564 564
 				case 'last_access' :
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 
569 569
 				case 'expiration' :
570 570
 					// when the session expires
571
-					$session_data['expiration'] = ! empty( $this->_expiration )
571
+					$session_data['expiration'] = ! empty($this->_expiration)
572 572
 						? $this->_expiration
573 573
 						: $session_data['init_access'] + $this->_lifespan;
574 574
 				break;
@@ -580,11 +580,11 @@  discard block
 block discarded – undo
580 580
 
581 581
 				case 'pages_visited' :
582 582
 					$page_visit = $this->_get_page_visit();
583
-					if ( $page_visit ) {
583
+					if ($page_visit) {
584 584
 						// set pages visited where the first will be the http referrer
585
-						$this->_session_data[ 'pages_visited' ][ $this->_time ] = $page_visit;
585
+						$this->_session_data['pages_visited'][$this->_time] = $page_visit;
586 586
 						// we'll only save the last 10 page visits.
587
-						$session_data[ 'pages_visited' ] = array_slice( $this->_session_data['pages_visited'], -10 );
587
+						$session_data['pages_visited'] = array_slice($this->_session_data['pages_visited'], -10);
588 588
 					}
589 589
 				break;
590 590
 
@@ -598,9 +598,9 @@  discard block
 block discarded – undo
598 598
 
599 599
 		$this->_session_data = $session_data;
600 600
 		// creating a new session does not require saving to the db just yet
601
-		if ( ! $new_session ) {
601
+		if ( ! $new_session) {
602 602
 			// ready? let's save
603
-			if ( $this->_save_session_to_db() ) {
603
+			if ($this->_save_session_to_db()) {
604 604
 				return TRUE;
605 605
 			} else {
606 606
 				return FALSE;
@@ -621,9 +621,9 @@  discard block
 block discarded – undo
621 621
 	 * 	@return bool
622 622
 	 */
623 623
 	private function _create_espresso_session( ) {
624
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__, '' );
624
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, '');
625 625
 		// use the update function for now with $new_session arg set to TRUE
626
-		return  $this->update( TRUE ) ? TRUE : FALSE;
626
+		return  $this->update(TRUE) ? TRUE : FALSE;
627 627
 	}
628 628
 
629 629
 
@@ -647,15 +647,15 @@  discard block
 block discarded – undo
647 647
 			return FALSE;
648 648
 		}
649 649
 		// first serialize all of our session data
650
-		$session_data = serialize( $this->_session_data );
650
+		$session_data = serialize($this->_session_data);
651 651
 		// encrypt it if we are using encryption
652
-		$session_data = $this->_use_encryption ? $this->encryption->encrypt( $session_data ) : $session_data;
652
+		$session_data = $this->_use_encryption ? $this->encryption->encrypt($session_data) : $session_data;
653 653
 		// maybe save hash check
654
-		if ( apply_filters( 'FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG ) ) {
655
-			set_transient( EE_Session::hash_check_prefix . $this->_sid, md5( $session_data ), $this->_lifespan );
654
+		if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
655
+			set_transient(EE_Session::hash_check_prefix.$this->_sid, md5($session_data), $this->_lifespan);
656 656
 		}
657 657
 		// we're using the Transient API for storing session data, cuz it's so damn simple -> set_transient(  transient ID, data, expiry )
658
-		return set_transient( EE_Session::session_id_prefix . $this->_sid, $session_data, $this->_lifespan );
658
+		return set_transient(EE_Session::session_id_prefix.$this->_sid, $session_data, $this->_lifespan);
659 659
 	}
660 660
 
661 661
 
@@ -681,10 +681,10 @@  discard block
 block discarded – undo
681 681
 			'HTTP_FORWARDED',
682 682
 			'REMOTE_ADDR'
683 683
 		);
684
-		foreach ( $server_keys as $key ){
685
-			if ( isset( $_SERVER[ $key ] )) {
686
-				foreach ( array_map( 'trim', explode( ',', $_SERVER[ $key ] )) as $ip ) {
687
-					if ( $ip === '127.0.0.1' || filter_var( $ip, FILTER_VALIDATE_IP ) !== FALSE ) {
684
+		foreach ($server_keys as $key) {
685
+			if (isset($_SERVER[$key])) {
686
+				foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip) {
687
+					if ($ip === '127.0.0.1' || filter_var($ip, FILTER_VALIDATE_IP) !== FALSE) {
688 688
 						$visitor_ip = $ip;
689 689
 					}
690 690
 				}
@@ -705,45 +705,45 @@  discard block
 block discarded – undo
705 705
 	public function _get_page_visit() {
706 706
 
707 707
 //		echo '<h3>'. __CLASS__ .'->'.__FUNCTION__.'  ( line no: ' . __LINE__ . ' )</h3>';
708
-		$page_visit = home_url('/') . 'wp-admin/admin-ajax.php';
708
+		$page_visit = home_url('/').'wp-admin/admin-ajax.php';
709 709
 
710 710
 		// check for request url
711
-		if ( isset( $_SERVER['REQUEST_URI'] )) {
711
+		if (isset($_SERVER['REQUEST_URI'])) {
712 712
 
713
-			$request_uri = esc_url( $_SERVER['REQUEST_URI'] );
713
+			$request_uri = esc_url($_SERVER['REQUEST_URI']);
714 714
 
715
-			$ru_bits = explode( '?', $request_uri );
715
+			$ru_bits = explode('?', $request_uri);
716 716
 			$request_uri = $ru_bits[0];
717 717
 			//echo '<h1>$request_uri   ' . $request_uri . '</h1>';
718 718
 
719 719
 			// check for and grab host as well
720
-			if ( isset( $_SERVER['HTTP_HOST'] )) {
721
-				$http_host = esc_url( $_SERVER['HTTP_HOST'] );
720
+			if (isset($_SERVER['HTTP_HOST'])) {
721
+				$http_host = esc_url($_SERVER['HTTP_HOST']);
722 722
 			} else {
723 723
 				$http_host = '';
724 724
 			}
725 725
 			//echo '<h1>$http_host   ' . $http_host . '</h1>';
726 726
 
727 727
 			// check for page_id in SERVER REQUEST
728
-			if ( isset( $_REQUEST['page_id'] )) {
728
+			if (isset($_REQUEST['page_id'])) {
729 729
 				// rebuild $e_reg without any of the extra parameters
730
-				$page_id = '?page_id=' . esc_attr( $_REQUEST['page_id'] ) . '&amp;';
730
+				$page_id = '?page_id='.esc_attr($_REQUEST['page_id']).'&amp;';
731 731
 			} else {
732 732
 				$page_id = '?';
733 733
 			}
734 734
 			// check for $e_reg in SERVER REQUEST
735
-			if ( isset( $_REQUEST['ee'] )) {
735
+			if (isset($_REQUEST['ee'])) {
736 736
 				// rebuild $e_reg without any of the extra parameters
737
-				$e_reg = 'ee=' . esc_attr( $_REQUEST['ee'] );
737
+				$e_reg = 'ee='.esc_attr($_REQUEST['ee']);
738 738
 			} else {
739 739
 				$e_reg = '';
740 740
 			}
741 741
 
742
-			$page_visit = rtrim( $http_host . $request_uri . $page_id . $e_reg, '?' );
742
+			$page_visit = rtrim($http_host.$request_uri.$page_id.$e_reg, '?');
743 743
 
744 744
 		}
745 745
 
746
-		return $page_visit != home_url( '/wp-admin/admin-ajax.php' ) ? $page_visit : '';
746
+		return $page_visit != home_url('/wp-admin/admin-ajax.php') ? $page_visit : '';
747 747
 
748 748
 	}
749 749
 
@@ -772,14 +772,14 @@  discard block
 block discarded – undo
772 772
 	  * @param string $function
773 773
 	  * @return void
774 774
 	  */
775
-	public function clear_session( $class = '', $function = '' ) {
775
+	public function clear_session($class = '', $function = '') {
776 776
 		//echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '( ' . $class . '::' . $function . '() )</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span>    <b style="font-size:10px;">  ' . __LINE__ . ' </b></h3>';
777
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : ' . $class . '::' .  $function . '()' );
777
+		do_action('AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : '.$class.'::'.$function.'()');
778 778
 		$this->reset_cart();
779 779
 		$this->reset_checkout();
780 780
 		$this->reset_transaction();
781 781
 		// wipe out everything that isn't a default session datum
782
-		$this->reset_data( array_keys( $this->_session_data ));
782
+		$this->reset_data(array_keys($this->_session_data));
783 783
 		// reset initial site access time and the session expiration
784 784
 		$this->_set_init_access_and_expiration();
785 785
 		$this->_save_session_to_db();
@@ -794,42 +794,42 @@  discard block
 block discarded – undo
794 794
 	  * @param bool  $show_all_notices
795 795
 	  * @return TRUE on success, FALSE on fail
796 796
 	  */
797
-	public function reset_data( $data_to_reset = array(), $show_all_notices = FALSE ) {
797
+	public function reset_data($data_to_reset = array(), $show_all_notices = FALSE) {
798 798
 		// if $data_to_reset is not in an array, then put it in one
799
-		if ( ! is_array( $data_to_reset ) ) {
800
-			$data_to_reset = array ( $data_to_reset );
799
+		if ( ! is_array($data_to_reset)) {
800
+			$data_to_reset = array($data_to_reset);
801 801
 		}
802 802
 		// nothing ??? go home!
803
-		if ( empty( $data_to_reset )) {
804
-			EE_Error::add_error( __( 'No session data could be reset, because no session var name was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
803
+		if (empty($data_to_reset)) {
804
+			EE_Error::add_error(__('No session data could be reset, because no session var name was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
805 805
 			return FALSE;
806 806
 		}
807 807
 		$return_value = TRUE;
808 808
 		// since $data_to_reset is an array, cycle through the values
809
-		foreach ( $data_to_reset as $reset ) {
809
+		foreach ($data_to_reset as $reset) {
810 810
 
811 811
 			// first check to make sure it is a valid session var
812
-			if ( isset( $this->_session_data[ $reset ] )) {
812
+			if (isset($this->_session_data[$reset])) {
813 813
 				// then check to make sure it is not a default var
814
-				if ( ! array_key_exists( $reset, $this->_default_session_vars )) {
814
+				if ( ! array_key_exists($reset, $this->_default_session_vars)) {
815 815
 					// remove session var
816
-					unset( $this->_session_data[ $reset ] );
817
-					if ( $show_all_notices ) {
818
-						EE_Error::add_success( sprintf( __( 'The session variable %s was removed.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
816
+					unset($this->_session_data[$reset]);
817
+					if ($show_all_notices) {
818
+						EE_Error::add_success(sprintf(__('The session variable %s was removed.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
819 819
 					}
820
-					$return_value = !isset($return_value) ? TRUE : $return_value;
820
+					$return_value = ! isset($return_value) ? TRUE : $return_value;
821 821
 
822 822
 				} else {
823 823
 					// yeeeeeeeeerrrrrrrrrrr OUT !!!!
824
-					if ( $show_all_notices ) {
825
-						EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
824
+					if ($show_all_notices) {
825
+						EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
826 826
 					}
827 827
 					$return_value = FALSE;
828 828
 				}
829 829
 
830
-			} else if ( $show_all_notices ) {
830
+			} else if ($show_all_notices) {
831 831
 				// oops! that session var does not exist!
832
-				EE_Error::add_error( sprintf( __( 'The session item provided, %s, is invalid or does not exist.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
832
+				EE_Error::add_error(sprintf(__('The session item provided, %s, is invalid or does not exist.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
833 833
 				$return_value = FALSE;
834 834
 			}
835 835
 
@@ -850,8 +850,8 @@  discard block
 block discarded – undo
850 850
 	 *   @return	 string
851 851
 	 */
852 852
 	public function wp_loaded() {
853
-		if ( isset(  EE_Registry::instance()->REQ ) && EE_Registry::instance()->REQ->is_set( 'clear_session' )) {
854
-			$this->clear_session( __CLASS__, __FUNCTION__ );
853
+		if (isset(EE_Registry::instance()->REQ) && EE_Registry::instance()->REQ->is_set('clear_session')) {
854
+			$this->clear_session(__CLASS__, __FUNCTION__);
855 855
 		}
856 856
 	}
857 857
 
@@ -876,24 +876,24 @@  discard block
 block discarded – undo
876 876
 	  */
877 877
 	 public function garbage_collection() {
878 878
 		 // only perform during regular requests
879
-		 if ( ! defined( 'DOING_AJAX') || ! DOING_AJAX ) {
879
+		 if ( ! defined('DOING_AJAX') || ! DOING_AJAX) {
880 880
 			 /** @type WPDB $wpdb */
881 881
 			 global $wpdb;
882 882
 			 // since transient expiration timestamps are set in the future, we can compare against NOW
883 883
 			 $expiration = time();
884
-			 $too_far_in_the_the_future = $expiration + ( $this->_lifespan * 2 );
884
+			 $too_far_in_the_the_future = $expiration + ($this->_lifespan * 2);
885 885
 			 // filter the query limit. Set to 0 to turn off garbage collection
886
-			 $expired_session_transient_delete_query_limit = absint( apply_filters( 'FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50 ));
886
+			 $expired_session_transient_delete_query_limit = absint(apply_filters('FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50));
887 887
 			 // non-zero LIMIT means take out the trash
888
-			 if ( $expired_session_transient_delete_query_limit ) {
888
+			 if ($expired_session_transient_delete_query_limit) {
889 889
 				 //array of transient keys that require garbage collection
890 890
 				 $session_keys = array(
891 891
 					 EE_Session::session_id_prefix,
892 892
 					 EE_Session::hash_check_prefix,
893 893
 				 );
894
-				 foreach ( $session_keys as $session_key ) {
895
-					 $session_key = str_replace( '_', '\_', $session_key );
896
-					 $session_key = '\_transient\_timeout\_' . $session_key . '%';
894
+				 foreach ($session_keys as $session_key) {
895
+					 $session_key = str_replace('_', '\_', $session_key);
896
+					 $session_key = '\_transient\_timeout\_'.$session_key.'%';
897 897
 					 $SQL = "
898 898
 					SELECT option_name
899 899
 					FROM {$wpdb->options}
@@ -903,28 +903,28 @@  discard block
 block discarded – undo
903 903
 					OR option_value > {$too_far_in_the_the_future} )
904 904
 					LIMIT {$expired_session_transient_delete_query_limit}
905 905
 				";
906
-					 $expired_sessions = $wpdb->get_col( $SQL );
906
+					 $expired_sessions = $wpdb->get_col($SQL);
907 907
 					 // valid results?
908
-					 if ( ! $expired_sessions instanceof WP_Error && ! empty( $expired_sessions ) ) {
908
+					 if ( ! $expired_sessions instanceof WP_Error && ! empty($expired_sessions)) {
909 909
 						 // format array of results into something usable within the actual DELETE query's IN clause
910 910
 						 $expired = array();
911
-						 foreach ( $expired_sessions as $expired_session ) {
912
-							 $expired[ ] = "'" . $expired_session . "'";
913
-							 $expired[ ] = "'" . str_replace( 'timeout_', '', $expired_session ) . "'";
911
+						 foreach ($expired_sessions as $expired_session) {
912
+							 $expired[] = "'".$expired_session."'";
913
+							 $expired[] = "'".str_replace('timeout_', '', $expired_session)."'";
914 914
 						 }
915
-						 $expired = implode( ', ', $expired );
915
+						 $expired = implode(', ', $expired);
916 916
 						 $SQL = "
917 917
 						DELETE FROM {$wpdb->options}
918 918
 						WHERE option_name
919 919
 						IN ( $expired );
920 920
 					 ";
921
-						 $results = $wpdb->query( $SQL );
921
+						 $results = $wpdb->query($SQL);
922 922
 						 // if something went wrong, then notify the admin
923
-						 if ( $results instanceof WP_Error && is_admin() ) {
924
-							 EE_Error::add_error( $results->get_error_message(), __FILE__, __FUNCTION__, __LINE__ );
923
+						 if ($results instanceof WP_Error && is_admin()) {
924
+							 EE_Error::add_error($results->get_error_message(), __FILE__, __FUNCTION__, __LINE__);
925 925
 						 }
926 926
 					 }
927
-					 do_action( 'FHEE__EE_Session__garbage_collection___end', $expired_session_transient_delete_query_limit );
927
+					 do_action('FHEE__EE_Session__garbage_collection___end', $expired_session_transient_delete_query_limit);
928 928
 				 }
929 929
 			 }
930 930
 		 }
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 	 /**
342 342
 	  * retrieve session data
343 343
 	  * @access    public
344
-	  * @param null $key
344
+	  * @param string|null $key
345 345
 	  * @param bool $reset_cache
346 346
 	  * @return    array
347 347
 	  */
@@ -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 )
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
 	  * @access public
798 798
 	  * @param array $data_to_reset
799 799
 	  * @param bool  $show_all_notices
800
-	  * @return TRUE on success, FALSE on fail
800
+	  * @return boolean on success, FALSE on fail
801 801
 	  */
802 802
 	public function reset_data( $data_to_reset = array(), $show_all_notices = FALSE ) {
803 803
 		// if $data_to_reset is not in an array, then put it in one
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  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')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  *
4 6
  * Event Espresso
@@ -353,7 +355,7 @@  discard block
 block discarded – undo
353 355
 		}
354 356
 		 if ( ! empty( $key ))  {
355 357
 			return  isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL;
356
-		}  else  {
358
+		} else  {
357 359
 			return $this->_session_data;
358 360
 		}
359 361
 	}
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page_CPT_Init.core.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	public function do_initial_loads() {
33 33
 		//we want to use the corresponding admin page object (but not route it!).  To do this we just set _routing to false.  That way this page object is being loaded on all pages to make sure we hook into admin properly.  But note... we are ONLY doing this if the given page is NOT pages we WANT to load ;)
34 34
 		//This is important because we have hooks that help redirect custom post type saves
35
-		if ( !isset( $_REQUEST['page'] ) || ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] != $this->_menu_map->menu_slug ) ) {
35
+		if ( ! isset($_REQUEST['page']) || (isset($_REQUEST['page']) && $_REQUEST['page'] != $this->_menu_map->menu_slug)) {
36 36
 			$this->_routing = FALSE;
37 37
 			$this->_initialize_admin_page();
38 38
 		} else {
@@ -40,17 +40,17 @@  discard block
 block discarded – undo
40 40
 			$this->_initialize_admin_page();
41 41
 			//added for 4.1 to completely disable autosave for our pages. This can be removed once we fully enable autosave functionality
42 42
 			remove_filter('wp_print_scripts', 'wp_just_in_time_script_localization');
43
-			add_filter('wp_print_scripts', array($this, 'wp_just_in_time_script_localization'), 100 );
43
+			add_filter('wp_print_scripts', array($this, 'wp_just_in_time_script_localization'), 100);
44 44
 			//end removal of autosave functionality.
45 45
 		}
46 46
 	}
47 47
 
48 48
 	public function wp_just_in_time_script_localization() {
49
-		wp_localize_script( 'autosave', 'autosaveL10n', array(
49
+		wp_localize_script('autosave', 'autosaveL10n', array(
50 50
 			'autosaveInterval' => 172800,
51 51
 			'savingText' => __('Saving Draft&#8230;'),
52 52
 			'saveAlert' => __('The changes you made will be lost if you navigate away from this page.')
53
-		) );
53
+		));
54 54
 	}
55 55
 
56 56
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page_Init.core.php 3 patches
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -88,16 +88,16 @@  discard block
 block discarded – undo
88 88
 		$this->_set_init_properties();
89 89
 
90 90
 		//global styles/scripts across all wp admin pages
91
-		add_action('admin_enqueue_scripts', array($this, 'load_wp_global_scripts_styles'), 5 );
91
+		add_action('admin_enqueue_scripts', array($this, 'load_wp_global_scripts_styles'), 5);
92 92
 
93 93
 		//load initial stuff.
94 94
 		$this->_set_file_and_folder_name();
95 95
 
96 96
 		$this->_set_menu_map();
97 97
 
98
-		if ( empty( $this->_menu_map ) || is_array( $this->_menu_map ) )
98
+		if (empty($this->_menu_map) || is_array($this->_menu_map))
99 99
 			 {
100
-			 	EE_Error::doing_it_wrong( get_class( $this ) . '::$_menu_map', sprintf( __('The EE4 addon with the class %s is setting up the _menu_map property incorrectly for this version of EE core.  Please see Admin_Page_Init class examples in core for the new way of setting this property up.', 'event_espresso' ), get_class( $this ) ), '4.4.0' );
100
+			 	EE_Error::doing_it_wrong(get_class($this).'::$_menu_map', sprintf(__('The EE4 addon with the class %s is setting up the _menu_map property incorrectly for this version of EE core.  Please see Admin_Page_Init class examples in core for the new way of setting this property up.', 'event_espresso'), get_class($this)), '4.4.0');
101 101
 			 	return;
102 102
 			 }
103 103
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	public function load_wp_global_scripts_styles() {
160 160
 		/** STYLES **/
161 161
 		//register
162
-		wp_register_style('espresso_menu', EE_ADMIN_URL . 'assets/admin-menu-styles.css');
162
+		wp_register_style('espresso_menu', EE_ADMIN_URL.'assets/admin-menu-styles.css');
163 163
 
164 164
 
165 165
 
@@ -201,8 +201,8 @@  discard block
 block discarded – undo
201 201
 
202 202
 
203 203
 	protected function _set_capability() {
204
-		$capability = empty($this->capability) ?  $this->_menu_map->capability : $this->capability;
205
-		$this->capability = apply_filters( 'FHEE_' . $this->_menu_map->menu_slug . '_capability', $capability );
204
+		$capability = empty($this->capability) ? $this->_menu_map->capability : $this->capability;
205
+		$this->capability = apply_filters('FHEE_'.$this->_menu_map->menu_slug.'_capability', $capability);
206 206
 	}
207 207
 
208 208
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	public function initialize_admin_page() {
221 221
 		//let's check user access first
222 222
 		$this->_check_user_access();
223
-		if ( !is_object( $this->_loaded_page_object) ) return;
223
+		if ( ! is_object($this->_loaded_page_object)) return;
224 224
 		$this->_loaded_page_object->route_admin_request();
225 225
 		return;
226 226
 	}
@@ -232,25 +232,25 @@  discard block
 block discarded – undo
232 232
 
233 233
 
234 234
 	public function set_page_dependencies($wp_page_slug) {
235
-		if ( !$this->_load_page ) return;
235
+		if ( ! $this->_load_page) return;
236 236
 
237
-		if ( !is_object($this->_loaded_page_object) ) {
237
+		if ( ! is_object($this->_loaded_page_object)) {
238 238
 			$msg[] = __('We can\'t load the page because we\'re missing a valid page object that tells us what to load', 'event_espresso');
239
-			$msg[] = $msg[0] . "\r\n" . sprintf(
239
+			$msg[] = $msg[0]."\r\n".sprintf(
240 240
 				__('The custom slug you have set for this page is %s. This means we\'re looking for the class %s_Admin_Page (found in %s_Admin_Page.core.php) within your %s directory', 'event_espresso'),
241 241
 				 $this->_file_name,
242 242
 				 $this->_file_name,
243
-				 $this->_folder_path . $this->_file_name,
243
+				 $this->_folder_path.$this->_file_name,
244 244
 				 $this->_menu_map->menu_slug
245 245
 			);
246
-			throw new EE_Error( implode( '||', $msg) );
246
+			throw new EE_Error(implode('||', $msg));
247 247
 		}
248 248
 
249 249
 		$this->_loaded_page_object->set_wp_page_slug($wp_page_slug);
250
-		$page_hook = 'load-' . $wp_page_slug;
250
+		$page_hook = 'load-'.$wp_page_slug;
251 251
 		//hook into page load hook so all page specific stuff get's loaded.
252
-		if ( !empty($wp_page_slug) )
253
-			add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies') );
252
+		if ( ! empty($wp_page_slug))
253
+			add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies'));
254 254
 	}
255 255
 
256 256
 
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	 */
262 262
 	public function do_initial_loads() {
263 263
 		//no loading or initializing if menu map is setup incorrectly.
264
-		if ( empty( $this->_menu_map ) || is_array( $this->_menu_map ) ) {
264
+		if (empty($this->_menu_map) || is_array($this->_menu_map)) {
265 265
 			return;
266 266
 		}
267 267
 		$this->_initialize_admin_page();
@@ -278,19 +278,19 @@  discard block
 block discarded – undo
278 278
 		$bt = debug_backtrace();
279 279
 		//for more reliable determination of folder name
280 280
 		//we're using this to get the actual folder name of the CALLING class (i.e. the child class that extends this).  Why?  Because $this->menu_slug may be different than the folder name (to avoid conflicts with other plugins)
281
-		$class = get_class( $this );
282
-		foreach ( $bt as $index => $values ) {
283
-			if ( isset( $values['class'] ) && $values['class'] == $class ) {
281
+		$class = get_class($this);
282
+		foreach ($bt as $index => $values) {
283
+			if (isset($values['class']) && $values['class'] == $class) {
284 284
 				$file_index = $index - 1;
285
-				$this->_folder_name = basename(dirname($bt[$file_index]['file']) );
286
-				if ( !empty( $this->_folder_name ) ) break;
285
+				$this->_folder_name = basename(dirname($bt[$file_index]['file']));
286
+				if ( ! empty($this->_folder_name)) break;
287 287
 			}
288 288
 		}
289 289
 
290
-		$this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . DS;
290
+		$this->_folder_path = EE_ADMIN_PAGES.$this->_folder_name.DS;
291 291
 
292
-		$this->_file_name = preg_replace( '/^ee/' , 'EE', $this->_folder_name );
293
-		$this->_file_name = ucwords( str_replace('_', ' ', $this->_file_name) );
292
+		$this->_file_name = preg_replace('/^ee/', 'EE', $this->_folder_name);
293
+		$this->_file_name = ucwords(str_replace('_', ' ', $this->_file_name));
294 294
 		$this->_file_name = str_replace(' ', '_', $this->_file_name);
295 295
 	}
296 296
 
@@ -302,19 +302,19 @@  discard block
 block discarded – undo
302 302
 	 * @param bool $extend This indicates whether we're checking the extend directory for any register_hooks files/classes
303 303
 	 * @return array
304 304
 	 */
305
-	public function register_hooks( $extend = FALSE ) {
305
+	public function register_hooks($extend = FALSE) {
306 306
 
307 307
 		//get a list of files in the directory that have the "Hook" in their name an
308 308
 
309 309
 		//if this is an extended check (i.e. caf is active) then we will scan the caffeinated/extend directory first and any hook files that are found will be have their reference added to the $_files_hook array property.  Then, we make sure that when we loop through the core decaf directories to find hook files that we skip over any hooks files that have already been set by caf.
310
-		if ( $extend ) {
311
-			$hook_files_glob_path = apply_filters( 'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path__extend', EE_CORE_CAF_ADMIN_EXTEND . $this->_folder_name . DS . '*' . $this->_file_name . '_Hooks_Extend.class.php' );
312
-			$this->_hook_paths = $this->_register_hook_files( $hook_files_glob_path, $extend );
310
+		if ($extend) {
311
+			$hook_files_glob_path = apply_filters('FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path__extend', EE_CORE_CAF_ADMIN_EXTEND.$this->_folder_name.DS.'*'.$this->_file_name.'_Hooks_Extend.class.php');
312
+			$this->_hook_paths = $this->_register_hook_files($hook_files_glob_path, $extend);
313 313
 		}
314 314
 
315 315
 		//loop through decaf folders
316
-		$hook_files_glob_path = apply_filters( 'FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path', $this->_folder_path . '*' . $this->_file_name . '_Hooks.class.php' );
317
-		$this->_hook_paths = array_merge( $this->_register_hook_files( $hook_files_glob_path ), $this->_hook_paths );  //making sure any extended hook paths are later in the array than the core hook paths!
316
+		$hook_files_glob_path = apply_filters('FHEE__EE_Admin_Page_Init__register_hooks__hook_files_glob_path', $this->_folder_path.'*'.$this->_file_name.'_Hooks.class.php');
317
+		$this->_hook_paths = array_merge($this->_register_hook_files($hook_files_glob_path), $this->_hook_paths); //making sure any extended hook paths are later in the array than the core hook paths!
318 318
 
319 319
 		return $this->_hook_paths;
320 320
 
@@ -322,27 +322,27 @@  discard block
 block discarded – undo
322 322
 
323 323
 
324 324
 
325
-	protected function _register_hook_files( $hook_files_glob_path, $extend = FALSE ) {
325
+	protected function _register_hook_files($hook_files_glob_path, $extend = FALSE) {
326 326
 		$hook_paths = array();
327
-		if ( $hook_files = glob( $hook_files_glob_path ) ) {
328
-			if ( empty( $hook_files ) ) {
327
+		if ($hook_files = glob($hook_files_glob_path)) {
328
+			if (empty($hook_files)) {
329 329
 				return array();
330 330
 			}
331
-			foreach ( $hook_files as $file ) {
331
+			foreach ($hook_files as $file) {
332 332
 				//lets get the linked admin.
333
-				$hook_file = $extend ? str_replace( EE_CORE_CAF_ADMIN_EXTEND . $this->_folder_name . DS, '', $file ) : str_replace($this->_folder_path, '', $file );
334
-				$replace = $extend ? '_' . $this->_file_name . '_Hooks_Extend.class.php' : '_' . $this->_file_name . '_Hooks.class.php';
335
-				$rel_admin = str_replace( $replace, '', $hook_file);
333
+				$hook_file = $extend ? str_replace(EE_CORE_CAF_ADMIN_EXTEND.$this->_folder_name.DS, '', $file) : str_replace($this->_folder_path, '', $file);
334
+				$replace = $extend ? '_'.$this->_file_name.'_Hooks_Extend.class.php' : '_'.$this->_file_name.'_Hooks.class.php';
335
+				$rel_admin = str_replace($replace, '', $hook_file);
336 336
 				$rel_admin = strtolower($rel_admin);
337 337
 				$hook_paths[] = $file;
338 338
 
339 339
 				//make sure we haven't already got a hook setup for this page path
340
-				if ( in_array( $rel_admin, $this->_files_hooked ) )
340
+				if (in_array($rel_admin, $this->_files_hooked))
341 341
 					continue;
342 342
 
343 343
 				$this->hook_file = $hook_file;
344
-				$rel_admin_hook = 'FHEE_do_other_page_hooks_' . $rel_admin;
345
-				$filter = add_filter( $rel_admin_hook, array($this, 'load_admin_hook') );
344
+				$rel_admin_hook = 'FHEE_do_other_page_hooks_'.$rel_admin;
345
+				$filter = add_filter($rel_admin_hook, array($this, 'load_admin_hook'));
346 346
 				$this->_files_hooked[] = $rel_admin;
347 347
 			}
348 348
 		}
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 	protected function _initialize_admin_page() {
368 368
 
369 369
 		//JUST CHECK WE'RE ON RIGHT PAGE.
370
-		if ( (!isset( $_REQUEST['page'] ) || $_REQUEST['page'] != $this->_menu_map->menu_slug) && $this->_routing )
370
+		if (( ! isset($_REQUEST['page']) || $_REQUEST['page'] != $this->_menu_map->menu_slug) && $this->_routing)
371 371
 			return; //not on the right page so let's get out.
372 372
 		$this->_load_page = TRUE;
373 373
 
@@ -375,30 +375,30 @@  discard block
 block discarded – undo
375 375
 //		spl_autoload_register(array( $this, 'set_autoloaders') );
376 376
 
377 377
 		//we don't need to do a page_request check here because it's only called via WP menu system.
378
-		$admin_page = $this->_file_name . '_Admin_Page';
379
-		$hook_suffix = $this->_menu_map->menu_slug . '_' . $admin_page;
378
+		$admin_page = $this->_file_name.'_Admin_Page';
379
+		$hook_suffix = $this->_menu_map->menu_slug.'_'.$admin_page;
380 380
 		$admin_page = apply_filters("FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__{$hook_suffix}", $admin_page);
381 381
 
382 382
 		// define requested admin page class name then load the file and instantiate
383
-		$path_to_file = str_replace( array( '\\', '/' ), DS, $this->_folder_path . $admin_page . '.core.php' );
384
-		$path_to_file=apply_filters("FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__{$hook_suffix}",$path_to_file );//so if the file would be in EE_ADMIN/attendees/Attendee_Admin_Page.core.php, the filter would be FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__attendees_Attendee_Admin_Page
383
+		$path_to_file = str_replace(array('\\', '/'), DS, $this->_folder_path.$admin_page.'.core.php');
384
+		$path_to_file = apply_filters("FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__{$hook_suffix}", $path_to_file); //so if the file would be in EE_ADMIN/attendees/Attendee_Admin_Page.core.php, the filter would be FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__attendees_Attendee_Admin_Page
385 385
 
386
-		if ( is_readable( $path_to_file )) {
386
+		if (is_readable($path_to_file)) {
387 387
 			// This is a place where EE plugins can hook in to make sure their own files are required in the appropriate place
388
-			do_action( 'AHEE__EE_Admin_Page___initialize_admin_page__before_initialization' );
389
-			do_action( 'AHEE__EE_Admin_Page___initialize_admin_page__before_initialization_' . $this->_menu_map->menu_slug );
390
-			require_once( $path_to_file );
391
-			$a = new ReflectionClass( $admin_page );
392
-			$this->_loaded_page_object = $a->newInstance( $this->_routing );
388
+			do_action('AHEE__EE_Admin_Page___initialize_admin_page__before_initialization');
389
+			do_action('AHEE__EE_Admin_Page___initialize_admin_page__before_initialization_'.$this->_menu_map->menu_slug);
390
+			require_once($path_to_file);
391
+			$a = new ReflectionClass($admin_page);
392
+			$this->_loaded_page_object = $a->newInstance($this->_routing);
393 393
 		}
394
-		do_action( 'AHEE__EE_Admin_Page___initialize_admin_page__after_initialization' );
395
-		do_action( 'AHEE__EE_Admin_Page___initialize_admin_page__after_initialization_' . $this->_menu_map->menu_slug );
394
+		do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization');
395
+		do_action('AHEE__EE_Admin_Page___initialize_admin_page__after_initialization_'.$this->_menu_map->menu_slug);
396 396
 	}
397 397
 
398 398
 
399 399
 
400 400
 	public function get_admin_page_name() {
401
-		return $this->_file_name . '_Admin_Page';
401
+		return $this->_file_name.'_Admin_Page';
402 402
 	}
403 403
 
404 404
 
@@ -431,8 +431,8 @@  discard block
 block discarded – undo
431 431
 	 * @return bool|die true if pass (or admin) wp_die if fail
432 432
 	 */
433 433
 	private function _check_user_access() {
434
-		if ( ! EE_Registry::instance()->CAP->current_user_can( $this->_menu_map->capability, $this->_menu_map->menu_slug ) ) {
435
-			wp_die( __('You don\'t have access to this page.'), '', array( 'back_link' => true ) );
434
+		if ( ! EE_Registry::instance()->CAP->current_user_can($this->_menu_map->capability, $this->_menu_map->menu_slug)) {
435
+			wp_die(__('You don\'t have access to this page.'), '', array('back_link' => true));
436 436
 		}
437 437
 		return true;
438 438
 	}
Please login to merge, or discard this patch.
Braces   +22 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  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')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -220,7 +222,9 @@  discard block
 block discarded – undo
220 222
 	public function initialize_admin_page() {
221 223
 		//let's check user access first
222 224
 		$this->_check_user_access();
223
-		if ( !is_object( $this->_loaded_page_object) ) return;
225
+		if ( !is_object( $this->_loaded_page_object) ) {
226
+			return;
227
+		}
224 228
 		$this->_loaded_page_object->route_admin_request();
225 229
 		return;
226 230
 	}
@@ -232,7 +236,9 @@  discard block
 block discarded – undo
232 236
 
233 237
 
234 238
 	public function set_page_dependencies($wp_page_slug) {
235
-		if ( !$this->_load_page ) return;
239
+		if ( !$this->_load_page ) {
240
+			return;
241
+		}
236 242
 
237 243
 		if ( !is_object($this->_loaded_page_object) ) {
238 244
 			$msg[] = __('We can\'t load the page because we\'re missing a valid page object that tells us what to load', 'event_espresso');
@@ -249,8 +255,9 @@  discard block
 block discarded – undo
249 255
 		$this->_loaded_page_object->set_wp_page_slug($wp_page_slug);
250 256
 		$page_hook = 'load-' . $wp_page_slug;
251 257
 		//hook into page load hook so all page specific stuff get's loaded.
252
-		if ( !empty($wp_page_slug) )
253
-			add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies') );
258
+		if ( !empty($wp_page_slug) ) {
259
+					add_action($page_hook, array($this->_loaded_page_object, 'load_page_dependencies') );
260
+		}
254 261
 	}
255 262
 
256 263
 
@@ -283,7 +290,9 @@  discard block
 block discarded – undo
283 290
 			if ( isset( $values['class'] ) && $values['class'] == $class ) {
284 291
 				$file_index = $index - 1;
285 292
 				$this->_folder_name = basename(dirname($bt[$file_index]['file']) );
286
-				if ( !empty( $this->_folder_name ) ) break;
293
+				if ( !empty( $this->_folder_name ) ) {
294
+					break;
295
+				}
287 296
 			}
288 297
 		}
289 298
 
@@ -337,8 +346,9 @@  discard block
 block discarded – undo
337 346
 				$hook_paths[] = $file;
338 347
 
339 348
 				//make sure we haven't already got a hook setup for this page path
340
-				if ( in_array( $rel_admin, $this->_files_hooked ) )
341
-					continue;
349
+				if ( in_array( $rel_admin, $this->_files_hooked ) ) {
350
+									continue;
351
+				}
342 352
 
343 353
 				$this->hook_file = $hook_file;
344 354
 				$rel_admin_hook = 'FHEE_do_other_page_hooks_' . $rel_admin;
@@ -367,8 +377,10 @@  discard block
 block discarded – undo
367 377
 	protected function _initialize_admin_page() {
368 378
 
369 379
 		//JUST CHECK WE'RE ON RIGHT PAGE.
370
-		if ( (!isset( $_REQUEST['page'] ) || $_REQUEST['page'] != $this->_menu_map->menu_slug) && $this->_routing )
371
-			return; //not on the right page so let's get out.
380
+		if ( (!isset( $_REQUEST['page'] ) || $_REQUEST['page'] != $this->_menu_map->menu_slug) && $this->_routing ) {
381
+					return;
382
+		}
383
+		//not on the right page so let's get out.
372 384
 		$this->_load_page = TRUE;
373 385
 
374 386
 		//let's set page specific autoloaders.  Note that this just sets autoloaders for THIS set of admin pages.
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -214,7 +214,6 @@  discard block
 block discarded – undo
214 214
 	 *
215 215
 	 * @access  public
216 216
 	 * @uses   _initialize_admin_page()
217
-	 * @param  string $dir_name directory name for specific admin_page being loaded.
218 217
 	 * @return void
219 218
 	 */
220 219
 	public function initialize_admin_page() {
@@ -231,6 +230,9 @@  discard block
 block discarded – undo
231 230
 
232 231
 
233 232
 
233
+	/**
234
+	 * @param string $wp_page_slug
235
+	 */
234 236
 	public function set_page_dependencies($wp_page_slug) {
235 237
 		if ( !$this->_load_page ) return;
236 238
 
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page_Loader.core.php 2 patches
Spacing   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 		//let's do a scan and see what installed pages we have
120 120
 		$this->_get_installed_pages();
121 121
 		//set menus (has to be done on every load - we're not actually loading the page just setting the menus and where they point to).
122
-		add_action('admin_menu', array( $this, 'set_menus' ));
123
-		add_action( 'network_admin_menu', array( $this, 'set_network_menus' ) );
122
+		add_action('admin_menu', array($this, 'set_menus'));
123
+		add_action('network_admin_menu', array($this, 'set_network_menus'));
124 124
 	}
125 125
 
126 126
 
@@ -133,13 +133,13 @@  discard block
 block discarded – undo
133 133
 	 * @return void
134 134
 	 */
135 135
 	private function _define_caffeinated_constants() {
136
-		if ( ! defined( 'EE_CORE_CAF_ADMIN'  ) ) {
137
-			define( 'EE_CORE_CAF_ADMIN', EE_PLUGIN_DIR_PATH . 'caffeinated/admin/');
138
-			define( 'EE_CORE_CAF_ADMIN_URL', EE_PLUGIN_DIR_URL . 'caffeinated/admin/');
139
-			define( 'EE_CORE_CAF_ADMIN_NEW', EE_CORE_CAF_ADMIN . 'new/');
140
-			define( 'EE_CORE_CAF_ADMIN_EXTEND', EE_CORE_CAF_ADMIN . 'extend/');
141
-			define( 'EE_CORE_CAF_ADMIN_EXTEND_URL', EE_CORE_CAF_ADMIN_URL . 'extend/');
142
-			define( 'EE_CORE_CAF_ADMIN_HOOKS', EE_CORE_CAF_ADMIN . 'hooks/');
136
+		if ( ! defined('EE_CORE_CAF_ADMIN')) {
137
+			define('EE_CORE_CAF_ADMIN', EE_PLUGIN_DIR_PATH.'caffeinated/admin/');
138
+			define('EE_CORE_CAF_ADMIN_URL', EE_PLUGIN_DIR_URL.'caffeinated/admin/');
139
+			define('EE_CORE_CAF_ADMIN_NEW', EE_CORE_CAF_ADMIN.'new/');
140
+			define('EE_CORE_CAF_ADMIN_EXTEND', EE_CORE_CAF_ADMIN.'extend/');
141
+			define('EE_CORE_CAF_ADMIN_EXTEND_URL', EE_CORE_CAF_ADMIN_URL.'extend/');
142
+			define('EE_CORE_CAF_ADMIN_HOOKS', EE_CORE_CAF_ADMIN.'hooks/');
143 143
 		}
144 144
 	}
145 145
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
 		//set array of EE_Admin_Page_Menu_Group objects
160 160
 		$groups = array(
161
-			'main' => new EE_Admin_Page_Menu_Group( array(
161
+			'main' => new EE_Admin_Page_Menu_Group(array(
162 162
 				'menu_label' => __('Main', 'event_espresso'),
163 163
 				'show_on_menu' => EE_Admin_Page_Menu_Map::NONE,
164 164
 				'menu_slug' => 'main',
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 				'menu_order' => 0,
167 167
 				'parent_slug' => 'espresso_events',
168 168
 				)),
169
-			'management' => new EE_Admin_Page_Menu_Group( array(
169
+			'management' => new EE_Admin_Page_Menu_Group(array(
170 170
 				'menu_label' => __('Management', 'event_espresso'),
171 171
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
172 172
 				'menu_slug' => 'management',
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 				'menu_order' => 10,
175 175
 				'parent_slug' => 'espresso_events'
176 176
 				)),
177
-			'settings' => new EE_Admin_Page_Menu_Group( array(
177
+			'settings' => new EE_Admin_Page_Menu_Group(array(
178 178
 				'menu_label' => __('Settings', 'event_espresso'),
179 179
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
180 180
 				'menu_slug' => 'settings',
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 				'menu_order' => 30,
183 183
 				'parent_slug' => 'espresso_events'
184 184
 				)),
185
-			'templates' => new EE_Admin_Page_Menu_Group( array(
185
+			'templates' => new EE_Admin_Page_Menu_Group(array(
186 186
 				'menu_label' => __('Templates', 'event_espresso'),
187 187
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
188 188
 				'menu_slug' => 'templates',
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 				'menu_order' => 40,
191 191
 				'parent_slug' => 'espresso_events'
192 192
 				)),
193
-			'extras' => new EE_Admin_Page_Menu_Group( array(
193
+			'extras' => new EE_Admin_Page_Menu_Group(array(
194 194
 				'menu_label' => __('Extras', 'event_espresso'),
195 195
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN,
196 196
 				'menu_slug' => 'extras',
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 				'parent_slug' => 'espresso_events',
200 200
 				'maintenance_mode_parent' => 'espresso_maintenance_settings'
201 201
 				)),
202
-			'tools' => new EE_Admin_Page_Menu_Group( array(
202
+			'tools' => new EE_Admin_Page_Menu_Group(array(
203 203
 				'menu_label' => __("Tools", "event_espresso"),
204 204
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
205 205
 				'menu_slug' => 'tools',
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 				'menu_order' => 60,
208 208
 				'parent_slug' => 'espresso_events'
209 209
 				)),
210
-			'addons' => new EE_Admin_Page_Menu_Group( array(
210
+			'addons' => new EE_Admin_Page_Menu_Group(array(
211 211
 				'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN,
212 212
 				'menu_label' => __('Add-ons', 'event_espresso'),
213 213
 				'menu_slug' => 'addons',
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 				))
218 218
 			);
219 219
 
220
-		$this->_admin_menu_groups = apply_filters( 'FHEE__EE_Admin_Page_Loader___set_menu_groups__admin_menu_groups', $groups );
220
+		$this->_admin_menu_groups = apply_filters('FHEE__EE_Admin_Page_Loader___set_menu_groups__admin_menu_groups', $groups);
221 221
 	}
222 222
 
223 223
 
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
 	private function _rearrange_menu_groups() {
236 236
 		$groups = array();
237 237
 		//first let's order the menu groups by their internal menu order (note usort type hinting to ensure the incoming array is EE_Admin_Page_Menu_Map objects )
238
-		usort( $this->_admin_menu_groups, array( $this, '_sort_menu_maps' ) );
239
-		foreach ( $this->_admin_menu_groups as $group ) {
240
-			if ( ! $group instanceof EE_Admin_Page_Menu_Group )
241
-				throw new EE_Error( sprintf( __('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups.  All values in this array are required to be a EE_Admin_Page_Menu_Group object.  Instead there was: %s', 'event_espresso'), print_r($group, TRUE) ) );
238
+		usort($this->_admin_menu_groups, array($this, '_sort_menu_maps'));
239
+		foreach ($this->_admin_menu_groups as $group) {
240
+			if ( ! $group instanceof EE_Admin_Page_Menu_Group)
241
+				throw new EE_Error(sprintf(__('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups.  All values in this array are required to be a EE_Admin_Page_Menu_Group object.  Instead there was: %s', 'event_espresso'), print_r($group, TRUE)));
242 242
 			$groups[$group->menu_slug] = $group;
243 243
 		}
244 244
 		return $groups;
@@ -256,48 +256,48 @@  discard block
 block discarded – undo
256 256
 	 */
257 257
 	private function _get_installed_pages() {
258 258
 		$installed_refs = array();
259
-		$exclude = array( 'assets', 'templates' );
259
+		$exclude = array('assets', 'templates');
260 260
 		// grab everything in the  admin core directory
261
-		$admin_screens = glob( EE_ADMIN_PAGES . '*', GLOB_ONLYDIR );
262
-		if ( $admin_screens ) {
263
-			foreach( $admin_screens as $admin_screen ) {
261
+		$admin_screens = glob(EE_ADMIN_PAGES.'*', GLOB_ONLYDIR);
262
+		if ($admin_screens) {
263
+			foreach ($admin_screens as $admin_screen) {
264 264
 				// files and anything in the exclude array need not apply
265
-				if ( is_dir( $admin_screen ) && ! in_array( basename( $admin_screen ), $exclude )) {
265
+				if (is_dir($admin_screen) && ! in_array(basename($admin_screen), $exclude)) {
266 266
 					// these folders represent the different EE admin pages
267
-					$installed_refs[ basename( $admin_screen ) ] = $admin_screen;
267
+					$installed_refs[basename($admin_screen)] = $admin_screen;
268 268
 				}
269 269
 			}
270 270
 		}
271 271
 
272
-		if ( empty( $installed_refs ) ) {
272
+		if (empty($installed_refs)) {
273 273
 			$error_msg[] = __('There are no EE_Admin pages detected, it looks like EE did not install properly', 'event_espresso');
274
-			$error_msg[] = $error_msg[0] . "\r\n" . sprintf( __('Check that the %s folder exists and is writable. Maybe try deactivating, then reactivating Event Espresso again.', 'event_espresso'), EE_ADMIN_PAGES );
275
-			throw new EE_Error( implode( '||', $error_msg ));
274
+			$error_msg[] = $error_msg[0]."\r\n".sprintf(__('Check that the %s folder exists and is writable. Maybe try deactivating, then reactivating Event Espresso again.', 'event_espresso'), EE_ADMIN_PAGES);
275
+			throw new EE_Error(implode('||', $error_msg));
276 276
 		}
277 277
 
278 278
 		//this just checks the caffeinated folder and takes care of setting up any caffeinated stuff.
279 279
 		$installed_refs = $this->_set_caffeinated($installed_refs);
280 280
 		//allow plugins to add in their own pages (note at this point they will need to have an autoloader defined for their class) OR hook into EEH_Autoloader::load_admin_page() to add their path.;
281
-		$installed_refs = apply_filters( 'FHEE__EE_Admin_Page_Loader___get_installed_pages__installed_refs', $installed_refs );
282
-		$this->_caffeinated_extends = apply_filters( 'FHEE__EE_Admin_Page_Loader___get_installed_pages__caffeinated_extends', $this->_caffeinated_extends );
281
+		$installed_refs = apply_filters('FHEE__EE_Admin_Page_Loader___get_installed_pages__installed_refs', $installed_refs);
282
+		$this->_caffeinated_extends = apply_filters('FHEE__EE_Admin_Page_Loader___get_installed_pages__caffeinated_extends', $this->_caffeinated_extends);
283 283
 
284 284
 		//loop through admin pages and setup the $_installed_pages array.
285 285
 		$hooks_ref = array();
286
-		foreach ( $installed_refs as $page => $path ) {
286
+		foreach ($installed_refs as $page => $path) {
287 287
 			// set autoloaders for our admin page classes based on included path information
288
-			EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $path );
288
+			EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($path);
289 289
 			// build list of installed pages
290
-			$this->_installed_pages[$page] = $this->_load_admin_page( $page, $path );
290
+			$this->_installed_pages[$page] = $this->_load_admin_page($page, $path);
291 291
 			// verify returned object
292
-			if ( $this->_installed_pages[$page] instanceof EE_Admin_Page_Init ) {
293
-				if ( ! $this->_installed_pages[$page]->get_menu_map() instanceof EE_Admin_Page_Menu_Map ) {
292
+			if ($this->_installed_pages[$page] instanceof EE_Admin_Page_Init) {
293
+				if ( ! $this->_installed_pages[$page]->get_menu_map() instanceof EE_Admin_Page_Menu_Map) {
294 294
 					continue;
295 295
 				}
296 296
 
297 297
 				//skip if in full maintenance mode and maintenance_mode_parent is set
298 298
 				$maintenance_mode_parent = $this->_installed_pages[$page]->get_menu_map()->maintenance_mode_parent;
299
-				if ( empty( $maintenance_mode_parent ) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) {
300
-					unset( $installed_refs[$page] );
299
+				if (empty($maintenance_mode_parent) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
300
+					unset($installed_refs[$page]);
301 301
 					continue;
302 302
 				}
303 303
 
@@ -305,45 +305,45 @@  discard block
 block discarded – undo
305 305
 				//flag for register hooks on extended pages b/c extended pages use the default INIT.
306 306
 				$extend = FALSE;
307 307
 				//now that we've got the admin_init objects... lets see if there are any caffeinated pages extending the originals.  If there are then let's hook into the init admin filter and load our extend instead.
308
-				if ( isset( $this->_caffeinated_extends[$page] ) ) {
308
+				if (isset($this->_caffeinated_extends[$page])) {
309 309
 					$this->_current_caf_extend_slug = $page;
310
-					$path_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__' . $this->_installed_pages[$page]->get_menu_map()->menu_slug . '_' . $this->_installed_pages[$page]->get_admin_page_name();
311
-					$path_runtime = 'return "' . $this->_caffeinated_extends[$this->_current_caf_extend_slug]["path"] . '";';
312
-					$page_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__' . $this->_installed_pages[$page]->get_menu_map()->menu_slug . '_' . $this->_installed_pages[$page]->get_admin_page_name();
313
-					$page_runtime = 'return "' . $this->_caffeinated_extends[$this->_current_caf_extend_slug]["admin_page"] . '";';
310
+					$path_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__path_to_file__'.$this->_installed_pages[$page]->get_menu_map()->menu_slug.'_'.$this->_installed_pages[$page]->get_admin_page_name();
311
+					$path_runtime = 'return "'.$this->_caffeinated_extends[$this->_current_caf_extend_slug]["path"].'";';
312
+					$page_hook = 'FHEE__EE_Admin_Page_Init___initialize_admin_page__admin_page__'.$this->_installed_pages[$page]->get_menu_map()->menu_slug.'_'.$this->_installed_pages[$page]->get_admin_page_name();
313
+					$page_runtime = 'return "'.$this->_caffeinated_extends[$this->_current_caf_extend_slug]["admin_page"].'";';
314 314
 
315
-					$hook_function_path = create_function( '$path_to_file', $path_runtime);
316
-					$hook_function_page = create_function( '$admin_page', $page_runtime );
315
+					$hook_function_path = create_function('$path_to_file', $path_runtime);
316
+					$hook_function_page = create_function('$admin_page', $page_runtime);
317 317
 
318
-					add_filter( $path_hook, $hook_function_path );
319
-					add_filter( $page_hook, $hook_function_page );
318
+					add_filter($path_hook, $hook_function_path);
319
+					add_filter($page_hook, $hook_function_page);
320 320
 					$extend = TRUE;
321 321
 				}
322 322
 				//let's do the registered hooks
323
-				$extended_hooks = $this->_installed_pages[$page]->register_hooks( $extend );
323
+				$extended_hooks = $this->_installed_pages[$page]->register_hooks($extend);
324 324
 				$hooks_ref = array_merge($hooks_ref, $extended_hooks);
325 325
 			}
326 326
 		}
327 327
 
328 328
 		//the hooks_ref is all the pages where we have $extended _Hooks files that will extend a class in a different folder.  So we want to make sure we load the file for the parent.
329 329
 		//first make sure we've got unique values
330
-		$hooks_ref = array_unique( $hooks_ref );
330
+		$hooks_ref = array_unique($hooks_ref);
331 331
 		//now let's loop and require!
332
-		foreach ( $hooks_ref as $path ) {
333
-			require_once( $path );
332
+		foreach ($hooks_ref as $path) {
333
+			require_once($path);
334 334
 		}
335 335
 		//make sure we have menu slugs global setup. Used in EE_Admin_Page->page_setup() to ensure we don't do a full class load for an admin page that isn't requested.
336 336
 		global $ee_menu_slugs;
337 337
 		$ee_menu_slugs = $this->_menu_slugs;
338 338
 
339 339
 		//we need to loop again to run any early code
340
-		foreach ( $installed_refs as $page => $path ) {
341
-			if ( $this->_installed_pages[$page] instanceof EE_Admin_Page_Init ) {
340
+		foreach ($installed_refs as $page => $path) {
341
+			if ($this->_installed_pages[$page] instanceof EE_Admin_Page_Init) {
342 342
 				$this->_installed_pages[$page]->do_initial_loads();
343 343
 			}
344 344
 		}
345 345
 
346
-		do_action( 'AHEE__EE_Admin_Page_Loader___get_installed_pages_loaded', $this->_installed_pages );
346
+		do_action('AHEE__EE_Admin_Page_Loader___get_installed_pages_loaded', $this->_installed_pages);
347 347
 
348 348
 	}
349 349
 
@@ -355,9 +355,9 @@  discard block
 block discarded – undo
355 355
 	 * @param string $page_slug
356 356
 	 * @return EE_Admin_Page
357 357
 	 */
358
-	public function get_admin_page_object( $page_slug = '' ) {
359
-		if ( isset( $this->_installed_pages[ $page_slug ] )) {
360
-			return $this->_installed_pages[ $page_slug ]->loaded_page_object();
358
+	public function get_admin_page_object($page_slug = '') {
359
+		if (isset($this->_installed_pages[$page_slug])) {
360
+			return $this->_installed_pages[$page_slug]->loaded_page_object();
361 361
 		}
362 362
 		return NULL;
363 363
 	}
@@ -370,9 +370,9 @@  discard block
 block discarded – undo
370 370
 	 * @param $dir_name
371 371
 	 * @return string
372 372
 	 */
373
-	private function _get_classname_for_admin_page( $dir_name = '' ) {
374
-		$class_name = str_replace( '_', ' ', strtolower( $dir_name ));
375
-		return str_replace( ' ', '_', ucwords( $class_name )) . '_Admin_Page';
373
+	private function _get_classname_for_admin_page($dir_name = '') {
374
+		$class_name = str_replace('_', ' ', strtolower($dir_name));
375
+		return str_replace(' ', '_', ucwords($class_name)).'_Admin_Page';
376 376
 	}
377 377
 
378 378
 
@@ -383,9 +383,9 @@  discard block
 block discarded – undo
383 383
 	 * @param $dir_name
384 384
 	 * @return string
385 385
 	 */
386
-	private function _get_classname_for_admin_init_page( $dir_name = '' ) {
387
-		$class_name = str_replace( '_', ' ', strtolower( $dir_name ));
388
-		return str_replace( ' ', '_', ucwords( $class_name )) . '_Admin_Page_Init';
386
+	private function _get_classname_for_admin_init_page($dir_name = '') {
387
+		$class_name = str_replace('_', ' ', strtolower($dir_name));
388
+		return str_replace(' ', '_', ucwords($class_name)).'_Admin_Page_Init';
389 389
 	}
390 390
 
391 391
 
@@ -398,13 +398,13 @@  discard block
 block discarded – undo
398 398
 	 * @throws EE_Error
399 399
 	 * @return object|bool  return page object if valid, bool false if not.
400 400
 	 */
401
-	private function _load_admin_page( $page = '', $path = '' ) {
402
-		$class_name = $this->_get_classname_for_admin_init_page( $page );
403
- 		EE_Registry::instance()->load_file( $path, $class_name, 'core' );
404
-		if ( ! class_exists( $class_name )) {
405
-			$error_msg[] = sprintf( __('Something went wrong with loading the %s admin page.', 'event_espresso' ), $page);
406
-			$error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no Init class in place for the %s admin page.', 'event_espresso') . '<br />' . __( 'Make sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, $class_name );
407
-			throw new EE_Error( implode( '||', $error_msg ));
401
+	private function _load_admin_page($page = '', $path = '') {
402
+		$class_name = $this->_get_classname_for_admin_init_page($page);
403
+ 		EE_Registry::instance()->load_file($path, $class_name, 'core');
404
+		if ( ! class_exists($class_name)) {
405
+			$error_msg[] = sprintf(__('Something went wrong with loading the %s admin page.', 'event_espresso'), $page);
406
+			$error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no Init class in place for the %s admin page.', 'event_espresso').'<br />'.__('Make sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, $class_name);
407
+			throw new EE_Error(implode('||', $error_msg));
408 408
 		}
409 409
 		$a = new ReflectionClass($class_name);
410 410
 		return  $a->newInstance();
@@ -423,9 +423,9 @@  discard block
 block discarded – undo
423 423
 	public function set_menus() {
424 424
 		//prep the menu pages (sort, group.)
425 425
 		$this->_prep_pages();
426
-		foreach( $this->_prepped_menu_maps as $menu_map ) {
427
-			if ( EE_Registry::instance()->CAP->current_user_can( $menu_map->capability, $menu_map->menu_slug ) ) {
428
-				$menu_map->add_menu_page( FALSE );
426
+		foreach ($this->_prepped_menu_maps as $menu_map) {
427
+			if (EE_Registry::instance()->CAP->current_user_can($menu_map->capability, $menu_map->menu_slug)) {
428
+				$menu_map->add_menu_page(FALSE);
429 429
 			}
430 430
 		}
431 431
 	}
@@ -438,11 +438,11 @@  discard block
 block discarded – undo
438 438
 	 *
439 439
 	 * @return void
440 440
 	 */
441
-	public function set_network_menus(){
441
+	public function set_network_menus() {
442 442
 		$this->_prep_pages();
443
-		foreach( $this->_prepped_menu_maps as $menu_map ) {
444
-			if ( EE_Registry::instance()->CAP->current_user_can( $menu_map->capability, $menu_map->menu_slug ) ) {
445
-				$menu_map->add_menu_page( TRUE );
443
+		foreach ($this->_prepped_menu_maps as $menu_map) {
444
+			if (EE_Registry::instance()->CAP->current_user_can($menu_map->capability, $menu_map->menu_slug)) {
445
+				$menu_map->add_menu_page(TRUE);
446 446
 			}
447 447
 		}
448 448
 	}
@@ -463,22 +463,22 @@  discard block
 block discarded – undo
463 463
 		//rearrange _admin_menu_groups to be indexed by group slug.
464 464
 		$menu_groups = $this->_rearrange_menu_groups();
465 465
 
466
-		foreach( $this->_installed_pages as $page ) {
467
-			if ( $page instanceof EE_Admin_page_Init ) {
466
+		foreach ($this->_installed_pages as $page) {
467
+			if ($page instanceof EE_Admin_page_Init) {
468 468
 				$page_map = $page->get_menu_map();
469 469
 				//if we've got an array then the menu map is in the old format so let's throw a persistent notice that the admin system isn't setup correctly for this item.
470
-				if ( is_array( $page_map ) || empty( $page_map ) ) {
471
-					EE_Error::add_persistent_admin_notice( 'menu_map_warning_' . str_replace(' ', '_', $page->label) . '_' . EVENT_ESPRESSO_VERSION, sprintf( __('The admin page for %s was not correctly setup because it is using an older method for integrating with Event Espresso Core.  This means that full functionality for this component is not available.  This error message usually appears with an Add-on that is out of date.  Make sure you update all your Event Espresso 4 add-ons to the latest version to ensure they have necessary compatibility updates in place.', 'event_espresso' ), $page->label ) );
470
+				if (is_array($page_map) || empty($page_map)) {
471
+					EE_Error::add_persistent_admin_notice('menu_map_warning_'.str_replace(' ', '_', $page->label).'_'.EVENT_ESPRESSO_VERSION, sprintf(__('The admin page for %s was not correctly setup because it is using an older method for integrating with Event Espresso Core.  This means that full functionality for this component is not available.  This error message usually appears with an Add-on that is out of date.  Make sure you update all your Event Espresso 4 add-ons to the latest version to ensure they have necessary compatibility updates in place.', 'event_espresso'), $page->label));
472 472
 					continue;
473 473
 				}
474 474
 
475 475
 				//if page map is NOT a EE_Admin_Page_Menu_Map object then throw error.
476
-				if ( ! $page_map instanceof EE_Admin_Page_Menu_Map ) {
477
-					throw new EE_Error( sprintf( __('The menu map for %s must be an EE_Admin_Page_Menu_Map object.  Instead it is %s.  Please double check that the menu map has been configured correctly.', 'event_espresso'), $page->label, $page_map ) );
476
+				if ( ! $page_map instanceof EE_Admin_Page_Menu_Map) {
477
+					throw new EE_Error(sprintf(__('The menu map for %s must be an EE_Admin_Page_Menu_Map object.  Instead it is %s.  Please double check that the menu map has been configured correctly.', 'event_espresso'), $page->label, $page_map));
478 478
 				}
479 479
 
480 480
 				//use the maintenance_mode_parent property and maintenance mode status to determine if this page even gets added to array.
481
-				if ( empty( $page_map->maintenance_mode_parent ) &&  EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) {
481
+				if (empty($page_map->maintenance_mode_parent) && EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
482 482
 					continue;
483 483
 				}
484 484
 
@@ -487,21 +487,21 @@  discard block
 block discarded – undo
487 487
 			}
488 488
 		}
489 489
 
490
-		if ( empty( $pages_array )) {
491
-			throw new EE_Error(__('Something went wrong when prepping the admin pages', 'event_espresso') );
490
+		if (empty($pages_array)) {
491
+			throw new EE_Error(__('Something went wrong when prepping the admin pages', 'event_espresso'));
492 492
 		}
493 493
 
494 494
 		//let's sort the groups, make sure it's a valid group, add header (if to show).
495
-		foreach ( $pages_array as $group => $menu_maps ) {
495
+		foreach ($pages_array as $group => $menu_maps) {
496 496
 			//valid_group?
497
-			if ( ! array_key_exists( $group, $menu_groups ) )
497
+			if ( ! array_key_exists($group, $menu_groups))
498 498
 				continue;
499 499
 
500 500
 			//sort pages.
501
-			usort( $menu_maps, array( $this, '_sort_menu_maps' ) );
501
+			usort($menu_maps, array($this, '_sort_menu_maps'));
502 502
 
503 503
 			//prepend header
504
-			array_unshift( $menu_maps, $menu_groups[$group] );
504
+			array_unshift($menu_maps, $menu_groups[$group]);
505 505
 
506 506
 			//reset $pages_array with prepped data
507 507
 			$pages_array[$group] = $menu_maps;
@@ -509,9 +509,9 @@  discard block
 block discarded – undo
509 509
 
510 510
 
511 511
 		//now let's setup the _prepped_menu_maps property
512
-		foreach ( $menu_groups as $group => $group_objs ) {
513
-			if ( isset( $pages_array[$group] ) )
514
-				$this->_prepped_menu_maps = array_merge( $this->_prepped_menu_maps, $pages_array[$group] );
512
+		foreach ($menu_groups as $group => $group_objs) {
513
+			if (isset($pages_array[$group]))
514
+				$this->_prepped_menu_maps = array_merge($this->_prepped_menu_maps, $pages_array[$group]);
515 515
 		}/**/
516 516
 
517 517
 	}
@@ -531,10 +531,10 @@  discard block
 block discarded – undo
531 531
 	 * @param array $installed_refs the original installed_refs array that may contain our NEW EE_Admin_Pages to be loaded.
532 532
 	 * @return array
533 533
 	 */
534
-	private function _set_caffeinated( $installed_refs ) {
534
+	private function _set_caffeinated($installed_refs) {
535 535
 
536 536
 		//first let's check if there IS a caffeinated folder. If there is not then lets get out.
537
-		if ( ! is_dir( EE_PLUGIN_DIR_PATH . 'caffeinated' . DS . 'admin' ) || ( defined( 'EE_DECAF' ) && EE_DECAF )) {
537
+		if ( ! is_dir(EE_PLUGIN_DIR_PATH.'caffeinated'.DS.'admin') || (defined('EE_DECAF') && EE_DECAF)) {
538 538
 			return $installed_refs;
539 539
 		}
540 540
 
@@ -543,15 +543,15 @@  discard block
 block discarded – undo
543 543
 		$exclude = array('tickets');
544 544
 
545 545
 		//okay let's setup an "New" pages first (we'll return installed refs later)
546
-		$new_admin_screens = glob( EE_CORE_CAF_ADMIN . 'new/*', GLOB_ONLYDIR );
547
-		if ( $new_admin_screens ) {
548
-			foreach( $new_admin_screens as $admin_screen ) {
546
+		$new_admin_screens = glob(EE_CORE_CAF_ADMIN.'new/*', GLOB_ONLYDIR);
547
+		if ($new_admin_screens) {
548
+			foreach ($new_admin_screens as $admin_screen) {
549 549
 				// files and anything in the exclude array need not apply
550
-				if ( is_dir( $admin_screen ) && ! in_array( basename( $admin_screen ), $exclude )) {
550
+				if (is_dir($admin_screen) && ! in_array(basename($admin_screen), $exclude)) {
551 551
 					// these folders represent the different NEW EE admin pages
552
-					$installed_refs[ basename( $admin_screen ) ] = $admin_screen;
552
+					$installed_refs[basename($admin_screen)] = $admin_screen;
553 553
 					// set autoloaders for our admin page classes based on included path information
554
-					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $admin_screen );
554
+					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($admin_screen);
555 555
 //					$this->_caf_autoloader[] = array(
556 556
 //						'dir' => 'new',
557 557
 //						'folder' => basename( $admin_screen )
@@ -561,18 +561,18 @@  discard block
 block discarded – undo
561 561
 		}
562 562
 
563 563
 		//let's see if there are any EXTENDS to setup in the $_caffeinated_extends array (that will be used later for hooking into the _initialize_admin_age in the related core_init admin page)
564
-		$extends = glob( EE_CORE_CAF_ADMIN . 'extend/*', GLOB_ONLYDIR );
565
-		if ( $extends ) {
566
-			foreach( $extends as $extend ) {
567
-				if ( is_dir( $extend ) ) {
568
-					$extend_ref = basename( $extend );
564
+		$extends = glob(EE_CORE_CAF_ADMIN.'extend/*', GLOB_ONLYDIR);
565
+		if ($extends) {
566
+			foreach ($extends as $extend) {
567
+				if (is_dir($extend)) {
568
+					$extend_ref = basename($extend);
569 569
 					//now let's make sure there is a file that matches the expected format
570
-					$filename = str_replace(' ', '_', ucwords( str_replace('_', ' ', $extend_ref ) ) );
571
-					$filename = 'Extend_' . $filename . '_Admin_Page';
572
-					$this->_caffeinated_extends[$extend_ref]['path'] = str_replace( array( '\\', '/' ), DS, EE_CORE_CAF_ADMIN . 'extend' . DS . $extend_ref . DS . $filename . '.core.php' );
570
+					$filename = str_replace(' ', '_', ucwords(str_replace('_', ' ', $extend_ref)));
571
+					$filename = 'Extend_'.$filename.'_Admin_Page';
572
+					$this->_caffeinated_extends[$extend_ref]['path'] = str_replace(array('\\', '/'), DS, EE_CORE_CAF_ADMIN.'extend'.DS.$extend_ref.DS.$filename.'.core.php');
573 573
 					$this->_caffeinated_extends[$extend_ref]['admin_page'] = $filename;
574 574
 					// set autoloaders for our admin page classes based on included path information
575
-					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( $extend );
575
+					EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder($extend);
576 576
 //					$this->_caf_autoloader[] = array(
577 577
 //						'dir' => 'extend',
578 578
 //						'folder' => $extend_ref
@@ -583,22 +583,22 @@  discard block
 block discarded – undo
583 583
 
584 584
 		//let's see if there are any HOOK files and instantiate them if there are (so that hooks are loaded early!).
585 585
 		$ee_admin_hooks = array();
586
-		$hooks = glob( EE_CORE_CAF_ADMIN . 'hooks/*.class.php' );
587
-		if ( $hooks ) {
588
-			foreach ( $hooks as $hook ) {
589
-				if ( is_readable( $hook ) ) {
586
+		$hooks = glob(EE_CORE_CAF_ADMIN.'hooks/*.class.php');
587
+		if ($hooks) {
588
+			foreach ($hooks as $hook) {
589
+				if (is_readable($hook)) {
590 590
 					require_once $hook;
591
-					$classname = str_replace( EE_CORE_CAF_ADMIN . 'hooks/', '', $hook );
591
+					$classname = str_replace(EE_CORE_CAF_ADMIN.'hooks/', '', $hook);
592 592
 					$classname = str_replace('.class.php', '', $classname);
593
-					if ( class_exists( $classname ) ) {
594
-						$a = new ReflectionClass( $classname );
593
+					if (class_exists($classname)) {
594
+						$a = new ReflectionClass($classname);
595 595
 						$ee_admin_hooks[] = $a->newInstance();
596 596
 					}
597 597
 				}
598 598
 			}
599 599
 		}/**/
600 600
 
601
-		$ee_admin_hooks = apply_filters( 'FHEE__EE_Admin_Page_Loader__set_caffeinated__ee_admin_hooks', $ee_admin_hooks );
601
+		$ee_admin_hooks = apply_filters('FHEE__EE_Admin_Page_Loader__set_caffeinated__ee_admin_hooks', $ee_admin_hooks);
602 602
 
603 603
 		return $installed_refs;
604 604
 
@@ -655,8 +655,8 @@  discard block
 block discarded – undo
655 655
 	 * @param  EE_Admin_Page_Menu_Map $b being compared to
656 656
 	 * @return int    sort order
657 657
 	 */
658
-	private function _sort_menu_maps( EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b ) {
659
-		if ( $a->menu_order == $b->menu_order )
658
+	private function _sort_menu_maps(EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b) {
659
+		if ($a->menu_order == $b->menu_order)
660 660
 			return 0;
661 661
 		return ($a->menu_order < $b->menu_order) ? -1 : 1;
662 662
 	}
Please login to merge, or discard this patch.
Braces   +14 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -237,8 +238,9 @@  discard block
 block discarded – undo
237 238
 		//first let's order the menu groups by their internal menu order (note usort type hinting to ensure the incoming array is EE_Admin_Page_Menu_Map objects )
238 239
 		usort( $this->_admin_menu_groups, array( $this, '_sort_menu_maps' ) );
239 240
 		foreach ( $this->_admin_menu_groups as $group ) {
240
-			if ( ! $group instanceof EE_Admin_Page_Menu_Group )
241
-				throw new EE_Error( sprintf( __('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups.  All values in this array are required to be a EE_Admin_Page_Menu_Group object.  Instead there was: %s', 'event_espresso'), print_r($group, TRUE) ) );
241
+			if ( ! $group instanceof EE_Admin_Page_Menu_Group ) {
242
+							throw new EE_Error( sprintf( __('Unable to continue sorting the menu groups array because there is an invalid value for the menu groups.  All values in this array are required to be a EE_Admin_Page_Menu_Group object.  Instead there was: %s', 'event_espresso'), print_r($group, TRUE) ) );
243
+			}
242 244
 			$groups[$group->menu_slug] = $group;
243 245
 		}
244 246
 		return $groups;
@@ -494,8 +496,9 @@  discard block
 block discarded – undo
494 496
 		//let's sort the groups, make sure it's a valid group, add header (if to show).
495 497
 		foreach ( $pages_array as $group => $menu_maps ) {
496 498
 			//valid_group?
497
-			if ( ! array_key_exists( $group, $menu_groups ) )
498
-				continue;
499
+			if ( ! array_key_exists( $group, $menu_groups ) ) {
500
+							continue;
501
+			}
499 502
 
500 503
 			//sort pages.
501 504
 			usort( $menu_maps, array( $this, '_sort_menu_maps' ) );
@@ -510,8 +513,9 @@  discard block
 block discarded – undo
510 513
 
511 514
 		//now let's setup the _prepped_menu_maps property
512 515
 		foreach ( $menu_groups as $group => $group_objs ) {
513
-			if ( isset( $pages_array[$group] ) )
514
-				$this->_prepped_menu_maps = array_merge( $this->_prepped_menu_maps, $pages_array[$group] );
516
+			if ( isset( $pages_array[$group] ) ) {
517
+							$this->_prepped_menu_maps = array_merge( $this->_prepped_menu_maps, $pages_array[$group] );
518
+			}
515 519
 		}/**/
516 520
 
517 521
 	}
@@ -656,8 +660,9 @@  discard block
 block discarded – undo
656 660
 	 * @return int    sort order
657 661
 	 */
658 662
 	private function _sort_menu_maps( EE_Admin_Page_Menu_Map $a, EE_Admin_Page_Menu_Map $b ) {
659
-		if ( $a->menu_order == $b->menu_order )
660
-			return 0;
663
+		if ( $a->menu_order == $b->menu_order ) {
664
+					return 0;
665
+		}
661 666
 		return ($a->menu_order < $b->menu_order) ? -1 : 1;
662 667
 	}
663 668
 
Please login to merge, or discard this patch.
core/admin/EE_Help_Tour_final_stop.class.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 			'action' => 'admin_option_settings',
61 61
 			'page' => 'espresso_general_settings'
62 62
 			);
63
-		return '<p>' . sprintf( __('That\'s it for the tour!  At any time you can restart a tour by clicking on this help dropdown and then clicking one of the Tour buttons.  There are help tours available on all Event Espresso Admin pages.  If you want to turn off help tours for all pages, %sgo here%s. All the best with your events!', 'event_espresso'), '<a href="' . EE_Admin_Page::add_query_args_and_nonce($query_args, admin_url('admin.php') ) . '">', '</a>' ) . '</p>';
63
+		return '<p>'.sprintf(__('That\'s it for the tour!  At any time you can restart a tour by clicking on this help dropdown and then clicking one of the Tour buttons.  There are help tours available on all Event Espresso Admin pages.  If you want to turn off help tours for all pages, %sgo here%s. All the best with your events!', 'event_espresso'), '<a href="'.EE_Admin_Page::add_query_args_and_nonce($query_args, admin_url('admin.php')).'">', '</a>').'</p>';
64 64
 	}
65 65
 
66 66
 }
67 67
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
Please login to merge, or discard this patch.
core/admin/templates/about_admin_wrapper.template.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 block discarded – undo
1 1
 <div class="wrap espresso-admin about-wrap">
2 2
 
3 3
 	<h1><?php  echo $admin_page_title; ?></h1>
4
-	<div class="about-text"><?php echo !empty($admin_page_subtitle) ? $admin_page_subtitle : ''; ?></div>
5
-	<div class="ee-badge"><img class="" src=" <?php echo EE_GLOBAL_ASSETS_URL; ?>images/event-espresso-cup-90x90.png" width="90" height="90" alt="<?php printf( esc_attr__( '%s Logo', 'event_espresso' ), 'Event Espresso' ); ?>"/><br /><?php printf( __('Version %s', 'event_espresso' ),  EVENT_ESPRESSO_VERSION ); ?></div>
4
+	<div class="about-text"><?php echo ! empty($admin_page_subtitle) ? $admin_page_subtitle : ''; ?></div>
5
+	<div class="ee-badge"><img class="" src=" <?php echo EE_GLOBAL_ASSETS_URL; ?>images/event-espresso-cup-90x90.png" width="90" height="90" alt="<?php printf(esc_attr__('%s Logo', 'event_espresso'), 'Event Espresso'); ?>"/><br /><?php printf(__('Version %s', 'event_espresso'), EVENT_ESPRESSO_VERSION); ?></div>
6 6
 
7 7
 	<?php echo $nav_tabs; ?>
8 8
 
9 9
 
10 10
 <?php
11
-	do_action( 'AHEE__admin_wrapper__template__before_about_admin_page_content' );
11
+	do_action('AHEE__admin_wrapper__template__before_about_admin_page_content');
12 12
 	echo $about_admin_page_content;
13
-	do_action( 'AHEE__admin_wrapper__template__after_about_admin_page_content' );
13
+	do_action('AHEE__admin_wrapper__template__after_about_admin_page_content');
14 14
 ?>
15 15
 
16 16
 </div>
Please login to merge, or discard this patch.
core/admin/templates/admin_details_metabox_column_wrapper.template.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@
 block discarded – undo
10 10
 
11 11
 		<?php
12 12
 		//let's loop through the columns
13
-		 for ( $i = 1; $i <= $num_columns; $i++ ) {
14
-		 	$metaref = ( $i === 1 ) ? 'normal' : 'side';
15
-		 	$metaref = ( $i > 2 ) ? 'column'.$i : $metaref;
13
+		 for ($i = 1; $i <= $num_columns; $i++) {
14
+		 	$metaref = ($i === 1) ? 'normal' : 'side';
15
+		 	$metaref = ($i > 2) ? 'column'.$i : $metaref;
16 16
 		 ?>
17 17
 
18 18
 			<div id='postbox-container-<?php echo $i; ?>' class='postbox-container'>
19
-				<?php do_meta_boxes( $current_page, $metaref, NULL ); ?>
19
+				<?php do_meta_boxes($current_page, $metaref, NULL); ?>
20 20
 			</div>
21 21
 		<?php }// end column loop ?>
22 22
 	</div> <!-- post-body -->
Please login to merge, or discard this patch.
core/admin/templates/admin_details_publish_metabox.template.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( $publish_box_extra_content ) : ?>
1
+<?php if ($publish_box_extra_content) : ?>
2 2
 <div id="minor-publishing">
3 3
 <?php echo $publish_box_extra_content; ?>
4 4
 </div>
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	
14 14
 	<div id="espresso_major_buttons_wrapper">
15 15
 	
16
-		<?php if ( $publish_delete_link ) : ?>
16
+		<?php if ($publish_delete_link) : ?>
17 17
 		<div id="delete-action">
18 18
 			<?php echo $publish_delete_link; ?>
19 19
 		</div>
Please login to merge, or discard this patch.
core/admin/templates/admin_details_wrapper_no_sidebar.template.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@
 block discarded – undo
13 13
 			
14 14
 			
15 15
 			<div id="postbox-container-2" class="postbox-container">
16
-				<?php do_meta_boxes( $current_page, 'normal', NULL ); ?>
17
-				<?php do_meta_boxes( $current_page, 'advanced', NULL ); ?>
16
+				<?php do_meta_boxes($current_page, 'normal', NULL); ?>
17
+				<?php do_meta_boxes($current_page, 'advanced', NULL); ?>
18 18
 			</div>
19 19
 			<!-- postbox-container-2 -->
20 20
 			
Please login to merge, or discard this patch.