Completed
Branch BUG-9715-shortcode-resources (0cf20f)
by
unknown
695:33 queued 678:11
created
core/EE_Registry.core.php 2 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -276,6 +276,7 @@  discard block
 block discarded – undo
276 276
 
277 277
 	/**
278 278
 	 * @param mixed string | EED_Module $module
279
+	 * @param string $module
279 280
 	 */
280 281
 	public function add_module( $module ) {
281 282
 		if ( $module instanceof EED_Module ) {
@@ -953,7 +954,7 @@  discard block
 block discarded – undo
953 954
 	 *        $this->LIB->{$class_name}     ie:    $this->LIB->Some_Class
954 955
 	 *
955 956
 	 * @access protected
956
-	 * @param object $class_obj
957
+	 * @param string|null $class_obj
957 958
 	 * @param string $class_name
958 959
 	 * @param string $class_prefix
959 960
 	 * @param bool $from_db
Please login to merge, or discard this patch.
Spacing   +194 added lines, -194 removed lines patch added patch discarded remove patch
@@ -178,10 +178,10 @@  discard block
 block discarded – undo
178 178
 	 * @param  \EE_Dependency_Map $dependency_map
179 179
 	 * @return \EE_Registry instance
180 180
 	 */
181
-	public static function instance( \EE_Dependency_Map $dependency_map = null ) {
181
+	public static function instance(\EE_Dependency_Map $dependency_map = null) {
182 182
 		// check if class object is instantiated
183
-		if ( ! self::$_instance instanceof EE_Registry ) {
184
-			self::$_instance = apply_filters( 'FHEE__EE_Registry__instance', new EE_Registry( $dependency_map ) );
183
+		if ( ! self::$_instance instanceof EE_Registry) {
184
+			self::$_instance = apply_filters('FHEE__EE_Registry__instance', new EE_Registry($dependency_map));
185 185
 		}
186 186
 		return self::$_instance;
187 187
 	}
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
 	 * @param  \EE_Dependency_Map $dependency_map
197 197
 	 * @return \EE_Registry
198 198
 	 */
199
-	protected function __construct( \EE_Dependency_Map $dependency_map ) {
199
+	protected function __construct(\EE_Dependency_Map $dependency_map) {
200 200
 		$this->_dependency_map = $dependency_map;
201
-		add_action( 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', array( $this, 'initialize' ) );
201
+		add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize'));
202 202
 	}
203 203
 
204 204
 
@@ -225,17 +225,17 @@  discard block
 block discarded – undo
225 225
 		$this->modules = new stdClass();
226 226
 		$this->shortcodes = new stdClass();
227 227
 		$this->widgets = new stdClass();
228
-		$this->load_core( 'Base', array(), true );
228
+		$this->load_core('Base', array(), true);
229 229
 		// add our request and response objects to the cache
230 230
 		$this->_set_cached_class(
231
-			$this->_dependency_map->class_loader( 'EE_Request' ),
231
+			$this->_dependency_map->class_loader('EE_Request'),
232 232
 			'EE_Request'
233 233
 		);
234 234
 		$this->_set_cached_class(
235
-			$this->_dependency_map->class_loader( 'EE_Response' ),
235
+			$this->_dependency_map->class_loader('EE_Response'),
236 236
 			'EE_Response'
237 237
 		);
238
-		add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'init' ) );
238
+		add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'init'));
239 239
 	}
240 240
 
241 241
 
@@ -248,10 +248,10 @@  discard block
 block discarded – undo
248 248
 	 */
249 249
 	public function init() {
250 250
 		// Get current page protocol
251
-		$protocol = isset( $_SERVER[ 'HTTPS' ] ) ? 'https://' : 'http://';
251
+		$protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
252 252
 		// Output admin-ajax.php URL with same protocol as current page
253
-		self::$i18n_js_strings[ 'ajax_url' ] = admin_url( 'admin-ajax.php', $protocol );
254
-		self::$i18n_js_strings[ 'wp_debug' ] = defined( 'WP_DEBUG' ) ? WP_DEBUG : false;
253
+		self::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php', $protocol);
254
+		self::$i18n_js_strings['wp_debug'] = defined('WP_DEBUG') ? WP_DEBUG : false;
255 255
 	}
256 256
 
257 257
 
@@ -262,14 +262,14 @@  discard block
 block discarded – undo
262 262
 	 * @return string
263 263
 	 */
264 264
 	public static function localize_i18n_js_strings() {
265
-		$i18n_js_strings = (array)EE_Registry::$i18n_js_strings;
266
-		foreach ( $i18n_js_strings as $key => $value ) {
267
-			if ( is_scalar( $value ) ) {
268
-				$i18n_js_strings[ $key ] = html_entity_decode( (string)$value, ENT_QUOTES, 'UTF-8' );
265
+		$i18n_js_strings = (array) EE_Registry::$i18n_js_strings;
266
+		foreach ($i18n_js_strings as $key => $value) {
267
+			if (is_scalar($value)) {
268
+				$i18n_js_strings[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8');
269 269
 			}
270 270
 		}
271 271
 
272
-		return "/* <![CDATA[ */ var eei18n = " . wp_json_encode( $i18n_js_strings ) . '; /* ]]> */';
272
+		return "/* <![CDATA[ */ var eei18n = ".wp_json_encode($i18n_js_strings).'; /* ]]> */';
273 273
 	}
274 274
 
275 275
 
@@ -277,15 +277,15 @@  discard block
 block discarded – undo
277 277
 	/**
278 278
 	 * @param mixed string | EED_Module $module
279 279
 	 */
280
-	public function add_module( $module ) {
281
-		if ( $module instanceof EED_Module ) {
282
-			$module_class = get_class( $module );
280
+	public function add_module($module) {
281
+		if ($module instanceof EED_Module) {
282
+			$module_class = get_class($module);
283 283
 			$this->modules->{$module_class} = $module;
284 284
 		} else {
285
-			if ( ! class_exists( 'EE_Module_Request_Router' ) ) {
286
-				$this->load_core( 'Module_Request_Router' );
285
+			if ( ! class_exists('EE_Module_Request_Router')) {
286
+				$this->load_core('Module_Request_Router');
287 287
 			}
288
-			$this->modules->{$module} = EE_Module_Request_Router::module_factory( $module );
288
+			$this->modules->{$module} = EE_Module_Request_Router::module_factory($module);
289 289
 		}
290 290
 	}
291 291
 
@@ -295,8 +295,8 @@  discard block
 block discarded – undo
295 295
 	 * @param string $module_name
296 296
 	 * @return mixed EED_Module | NULL
297 297
 	 */
298
-	public function get_module( $module_name = '' ) {
299
-		return isset( $this->modules->{$module_name} ) ? $this->modules->{$module_name} : null;
298
+	public function get_module($module_name = '') {
299
+		return isset($this->modules->{$module_name} ) ? $this->modules->{$module_name} : null;
300 300
 	}
301 301
 
302 302
 
@@ -310,20 +310,20 @@  discard block
 block discarded – undo
310 310
 	 * @param bool $load_only
311 311
 	 * @return mixed
312 312
 	 */
313
-	public function load_core( $class_name, $arguments = array(), $load_only = false ) {
313
+	public function load_core($class_name, $arguments = array(), $load_only = false) {
314 314
 		$core_paths = apply_filters(
315 315
 			'FHEE__EE_Registry__load_core__core_paths',
316 316
 			array(
317 317
 				EE_CORE,
318 318
 				EE_ADMIN,
319 319
 				EE_CPTS,
320
-				EE_CORE . 'data_migration_scripts' . DS,
321
-				EE_CORE . 'request_stack' . DS,
322
-				EE_CORE . 'middleware' . DS,
320
+				EE_CORE.'data_migration_scripts'.DS,
321
+				EE_CORE.'request_stack'.DS,
322
+				EE_CORE.'middleware'.DS,
323 323
 			)
324 324
 		);
325 325
 		// retrieve instantiated class
326
-		return $this->_load( $core_paths, 'EE_', $class_name, 'core', $arguments, false, true, $load_only );
326
+		return $this->_load($core_paths, 'EE_', $class_name, 'core', $arguments, false, true, $load_only);
327 327
 	}
328 328
 
329 329
 
@@ -337,15 +337,15 @@  discard block
 block discarded – undo
337 337
 	 * @param bool $load_only
338 338
 	 * @return mixed
339 339
 	 */
340
-	public function load_service( $class_name, $arguments = array(), $load_only = false ) {
340
+	public function load_service($class_name, $arguments = array(), $load_only = false) {
341 341
 		$service_paths = apply_filters(
342 342
 			'FHEE__EE_Registry__load_service__service_paths',
343 343
 			array(
344
-				EE_CORE . 'services' . DS,
344
+				EE_CORE.'services'.DS,
345 345
 			)
346 346
 		);
347 347
 		// retrieve instantiated class
348
-		return $this->_load( $service_paths, 'EE_', $class_name, 'class', $arguments, false, true, $load_only );
348
+		return $this->_load($service_paths, 'EE_', $class_name, 'class', $arguments, false, true, $load_only);
349 349
 	}
350 350
 
351 351
 
@@ -358,9 +358,9 @@  discard block
 block discarded – undo
358 358
 	 * @param mixed $arguments
359 359
 	 * @return EE_Data_Migration_Script_Base
360 360
 	 */
361
-	public function load_dms( $class_name, $arguments = array() ) {
361
+	public function load_dms($class_name, $arguments = array()) {
362 362
 		// retrieve instantiated class
363
-		return $this->_load( EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, false, false, false );
363
+		return $this->_load(EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, false, false, false);
364 364
 	}
365 365
 
366 366
 
@@ -375,14 +375,14 @@  discard block
 block discarded – undo
375 375
 	 * @param bool $load_only whether or not to just load the file and NOT instantiate, or load AND instantiate (default)
376 376
 	 * @return EE_Base_Class | bool
377 377
 	 */
378
-	public function load_class( $class_name, $arguments = array(), $from_db = false, $cache = true, $load_only = false ) {
379
-		$paths = apply_filters( 'FHEE__EE_Registry__load_class__paths', array(
378
+	public function load_class($class_name, $arguments = array(), $from_db = false, $cache = true, $load_only = false) {
379
+		$paths = apply_filters('FHEE__EE_Registry__load_class__paths', array(
380 380
 			EE_CORE,
381 381
 			EE_CLASSES,
382 382
 			EE_BUSINESS
383
-		) );
383
+		));
384 384
 		// retrieve instantiated class
385
-		return $this->_load( $paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only );
385
+		return $this->_load($paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only);
386 386
 	}
387 387
 
388 388
 
@@ -395,11 +395,11 @@  discard block
 block discarded – undo
395 395
 	 * @param bool $load_only
396 396
 	 * @return EEH_Base | bool
397 397
 	 */
398
-	public function load_helper( $class_name, $arguments = array(), $load_only = true ) {
398
+	public function load_helper($class_name, $arguments = array(), $load_only = true) {
399 399
 		// todo: add doing_it_wrong() in a few versions after all addons have had calls to this method removed
400
-		$helper_paths = apply_filters( 'FHEE__EE_Registry__load_helper__helper_paths', array( EE_HELPERS ) );
400
+		$helper_paths = apply_filters('FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS));
401 401
 		// retrieve instantiated class
402
-		return $this->_load( $helper_paths, 'EEH_', $class_name, 'helper', $arguments, false, true, $load_only );
402
+		return $this->_load($helper_paths, 'EEH_', $class_name, 'helper', $arguments, false, true, $load_only);
403 403
 	}
404 404
 
405 405
 
@@ -414,16 +414,16 @@  discard block
 block discarded – undo
414 414
 	 * @param bool $cache  whether to cache the object or not.
415 415
 	 * @return mixed
416 416
 	 */
417
-	public function load_lib( $class_name, $arguments = array(), $load_only = false, $cache = true ) {
417
+	public function load_lib($class_name, $arguments = array(), $load_only = false, $cache = true) {
418 418
 		$paths = array(
419 419
 			EE_LIBRARIES,
420
-			EE_LIBRARIES . 'messages' . DS,
421
-			EE_LIBRARIES . 'shortcodes' . DS,
422
-			EE_LIBRARIES . 'qtips' . DS,
423
-			EE_LIBRARIES . 'payment_methods' . DS,
420
+			EE_LIBRARIES.'messages'.DS,
421
+			EE_LIBRARIES.'shortcodes'.DS,
422
+			EE_LIBRARIES.'qtips'.DS,
423
+			EE_LIBRARIES.'payment_methods'.DS,
424 424
 		);
425 425
 		// retrieve instantiated class
426
-		return $this->_load( $paths, 'EE_', $class_name, 'lib', $arguments, false, $cache, $load_only );
426
+		return $this->_load($paths, 'EE_', $class_name, 'lib', $arguments, false, $cache, $load_only);
427 427
 	}
428 428
 
429 429
 
@@ -436,13 +436,13 @@  discard block
 block discarded – undo
436 436
 	 * @param bool $load_only
437 437
 	 * @return EEM_Base | bool
438 438
 	 */
439
-	public function load_model( $class_name, $arguments = array(), $load_only = false ) {
440
-		$paths = apply_filters( 'FHEE__EE_Registry__load_model__paths', array(
439
+	public function load_model($class_name, $arguments = array(), $load_only = false) {
440
+		$paths = apply_filters('FHEE__EE_Registry__load_model__paths', array(
441 441
 			EE_MODELS,
442 442
 			EE_CORE
443
-		) );
443
+		));
444 444
 		// retrieve instantiated class
445
-		return $this->_load( $paths, 'EEM_', $class_name, 'model', $arguments, false, true, $load_only );
445
+		return $this->_load($paths, 'EEM_', $class_name, 'model', $arguments, false, true, $load_only);
446 446
 	}
447 447
 
448 448
 
@@ -455,15 +455,15 @@  discard block
 block discarded – undo
455 455
 	 * @param bool $load_only
456 456
 	 * @return mixed | bool
457 457
 	 */
458
-	public function load_model_class( $class_name, $arguments = array(), $load_only = true ) {
458
+	public function load_model_class($class_name, $arguments = array(), $load_only = true) {
459 459
 		$paths = array(
460
-			EE_MODELS . 'fields' . DS,
461
-			EE_MODELS . 'helpers' . DS,
462
-			EE_MODELS . 'relations' . DS,
463
-			EE_MODELS . 'strategies' . DS
460
+			EE_MODELS.'fields'.DS,
461
+			EE_MODELS.'helpers'.DS,
462
+			EE_MODELS.'relations'.DS,
463
+			EE_MODELS.'strategies'.DS
464 464
 		);
465 465
 		// retrieve instantiated class
466
-		return $this->_load( $paths, 'EE_', $class_name, '', $arguments, false, true, $load_only );
466
+		return $this->_load($paths, 'EE_', $class_name, '', $arguments, false, true, $load_only);
467 467
 	}
468 468
 
469 469
 
@@ -473,8 +473,8 @@  discard block
 block discarded – undo
473 473
 	 * @param string $model_name like Event, Attendee, Question_Group_Question, etc.
474 474
 	 * @return boolean
475 475
 	 */
476
-	public function is_model_name( $model_name ) {
477
-		return isset( $this->models[ $model_name ] ) ? true : false;
476
+	public function is_model_name($model_name) {
477
+		return isset($this->models[$model_name]) ? true : false;
478 478
 	}
479 479
 
480 480
 
@@ -489,9 +489,9 @@  discard block
 block discarded – undo
489 489
 	 * @param bool $load_only
490 490
 	 * @return mixed
491 491
 	 */
492
-	public function load_file( $path_to_file, $file_name, $type = '', $arguments = array(), $load_only = true ) {
492
+	public function load_file($path_to_file, $file_name, $type = '', $arguments = array(), $load_only = true) {
493 493
 		// retrieve instantiated class
494
-		return $this->_load( $path_to_file, '', $file_name, $type, $arguments, false, true, $load_only );
494
+		return $this->_load($path_to_file, '', $file_name, $type, $arguments, false, true, $load_only);
495 495
 	}
496 496
 
497 497
 
@@ -506,9 +506,9 @@  discard block
 block discarded – undo
506 506
 	 * @param bool $load_only
507 507
 	 * @return EE_Addon
508 508
 	 */
509
-	public function load_addon( $path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = false ) {
509
+	public function load_addon($path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = false) {
510 510
 		// retrieve instantiated class
511
-		return $this->_load( $path_to_file, 'addon', $class_name, $type, $arguments, false, true, $load_only );
511
+		return $this->_load($path_to_file, 'addon', $class_name, $type, $arguments, false, true, $load_only);
512 512
 	}
513 513
 
514 514
 
@@ -539,46 +539,46 @@  discard block
 block discarded – undo
539 539
 		$load_only = false
540 540
 	) {
541 541
 		// strip php file extension
542
-		$class_name = str_replace( '.php', '', trim( $class_name ) );
542
+		$class_name = str_replace('.php', '', trim($class_name));
543 543
 		// does the class have a prefix ?
544
-		if ( ! empty( $class_prefix ) && $class_prefix != 'addon' ) {
544
+		if ( ! empty($class_prefix) && $class_prefix != 'addon') {
545 545
 			// make sure $class_prefix is uppercase
546
-			$class_prefix = strtoupper( trim( $class_prefix ) );
546
+			$class_prefix = strtoupper(trim($class_prefix));
547 547
 			// add class prefix ONCE!!!
548
-			$class_name = $class_prefix . str_replace( $class_prefix, '', $class_name );
548
+			$class_name = $class_prefix.str_replace($class_prefix, '', $class_name);
549 549
 		}
550
-		$class_exists = class_exists( $class_name );
550
+		$class_exists = class_exists($class_name);
551 551
 		// if we're only loading the class and it already exists, then let's just return true immediately
552
-		if ( $load_only && $class_exists ) {
552
+		if ($load_only && $class_exists) {
553 553
 			return true;
554 554
 		}
555 555
 		// $this->_cache_on is toggled during the recursive loading that can occur with dependency injection
556 556
 		// $cache is controlled by individual calls to separate Registry loader methods like load_class()
557 557
 		// $load_only is also controlled by individual calls to separate Registry loader methods like load_file()
558
-		if ( $this->_cache_on && $cache && ! $load_only ) {
558
+		if ($this->_cache_on && $cache && ! $load_only) {
559 559
 			// return object if it's already cached
560
-			$cached_class = $this->_get_cached_class( $class_name, $class_prefix );
561
-			if ( $cached_class !== null ) {
560
+			$cached_class = $this->_get_cached_class($class_name, $class_prefix);
561
+			if ($cached_class !== null) {
562 562
 				return $cached_class;
563 563
 			}
564 564
 		}
565 565
 		// if the class doesn't already exist.. then we need to try and find the file and load it
566
-		if ( ! $class_exists ) {
566
+		if ( ! $class_exists) {
567 567
 			// get full path to file
568
-			$path = $this->_resolve_path( $class_name, $type, $file_paths );
568
+			$path = $this->_resolve_path($class_name, $type, $file_paths);
569 569
 			// load the file
570
-			$loaded = $this->_require_file( $path, $class_name, $type, $file_paths );
570
+			$loaded = $this->_require_file($path, $class_name, $type, $file_paths);
571 571
 			// if loading failed, or we are only loading a file but NOT instantiating an object
572
-			if ( ! $loaded || $load_only ) {
572
+			if ( ! $loaded || $load_only) {
573 573
 				// return boolean if only loading, or null if an object was expected
574 574
 				return $load_only ? $loaded : null;
575 575
 			}
576 576
 		}
577 577
 		// instantiate the requested object
578
-		$class_obj = $this->_create_object( $class_name, $arguments, $type, $from_db );
579
-		if ( $this->_cache_on && $cache ) {
578
+		$class_obj = $this->_create_object($class_name, $arguments, $type, $from_db);
579
+		if ($this->_cache_on && $cache) {
580 580
 			// save it for later... kinda like gum  { : $
581
-			$this->_set_cached_class( $class_obj, $class_name, $class_prefix, $from_db );
581
+			$this->_set_cached_class($class_obj, $class_name, $class_prefix, $from_db);
582 582
 		}
583 583
 		$this->_cache_on = true;
584 584
 		return $class_obj;
@@ -601,21 +601,21 @@  discard block
 block discarded – undo
601 601
 	 * @param string $class_prefix
602 602
 	 * @return null|object
603 603
 	 */
604
-	protected function _get_cached_class( $class_name, $class_prefix = '' ) {
605
-		if ( isset( $this->_class_abbreviations[ $class_name ] ) ) {
606
-			$class_abbreviation = $this->_class_abbreviations[ $class_name ];
604
+	protected function _get_cached_class($class_name, $class_prefix = '') {
605
+		if (isset($this->_class_abbreviations[$class_name])) {
606
+			$class_abbreviation = $this->_class_abbreviations[$class_name];
607 607
 		} else {
608 608
 			// have to specify something, but not anything that will conflict
609 609
 			$class_abbreviation = 'FANCY_BATMAN_PANTS';
610 610
 		}
611 611
 		// check if class has already been loaded, and return it if it has been
612
-		if ( isset( $this->{$class_abbreviation} ) && ! is_null( $this->{$class_abbreviation} ) ) {
612
+		if (isset($this->{$class_abbreviation} ) && ! is_null($this->{$class_abbreviation} )) {
613 613
 			return $this->{$class_abbreviation};
614
-		} else if ( isset ( $this->{$class_name} ) ) {
614
+		} else if (isset ($this->{$class_name} )) {
615 615
 			return $this->{$class_name};
616
-		} else if ( isset ( $this->LIB->{$class_name} ) ) {
616
+		} else if (isset ($this->LIB->{$class_name} )) {
617 617
 			return $this->LIB->{$class_name};
618
-		} else if ( $class_prefix == 'addon' && isset ( $this->addons->{$class_name} ) ) {
618
+		} else if ($class_prefix == 'addon' && isset ($this->addons->{$class_name} )) {
619 619
 			return $this->addons->{$class_name};
620 620
 		}
621 621
 		return null;
@@ -636,20 +636,20 @@  discard block
 block discarded – undo
636 636
 	 * @param array $file_paths
637 637
 	 * @return string | bool
638 638
 	 */
639
-	protected function _resolve_path( $class_name, $type = '', $file_paths = array() ) {
639
+	protected function _resolve_path($class_name, $type = '', $file_paths = array()) {
640 640
 		// make sure $file_paths is an array
641
-		$file_paths = is_array( $file_paths ) ? $file_paths : array( $file_paths );
641
+		$file_paths = is_array($file_paths) ? $file_paths : array($file_paths);
642 642
 		// cycle thru paths
643
-		foreach ( $file_paths as $key => $file_path ) {
643
+		foreach ($file_paths as $key => $file_path) {
644 644
 			// convert all separators to proper DS, if no filepath, then use EE_CLASSES
645
-			$file_path = $file_path ? str_replace( array( '/', '\\' ), DS, $file_path ) : EE_CLASSES;
645
+			$file_path = $file_path ? str_replace(array('/', '\\'), DS, $file_path) : EE_CLASSES;
646 646
 			// prep file type
647
-			$type = ! empty( $type ) ? trim( $type, '.' ) . '.' : '';
647
+			$type = ! empty($type) ? trim($type, '.').'.' : '';
648 648
 			// build full file path
649
-			$file_paths[ $key ] = rtrim( $file_path, DS ) . DS . $class_name . '.' . $type . 'php';
649
+			$file_paths[$key] = rtrim($file_path, DS).DS.$class_name.'.'.$type.'php';
650 650
 			//does the file exist and can be read ?
651
-			if ( is_readable( $file_paths[ $key ] ) ) {
652
-				return $file_paths[ $key ];
651
+			if (is_readable($file_paths[$key])) {
652
+				return $file_paths[$key];
653 653
 			}
654 654
 		}
655 655
 		return false;
@@ -671,29 +671,29 @@  discard block
 block discarded – undo
671 671
 	 * @return boolean
672 672
 	 * @throws \EE_Error
673 673
 	 */
674
-	protected function _require_file( $path, $class_name, $type = '', $file_paths = array() ) {
674
+	protected function _require_file($path, $class_name, $type = '', $file_paths = array()) {
675 675
 		// don't give up! you gotta...
676 676
 		try {
677 677
 			//does the file exist and can it be read ?
678
-			if ( ! $path ) {
678
+			if ( ! $path) {
679 679
 				// so sorry, can't find the file
680
-				throw new EE_Error (
680
+				throw new EE_Error(
681 681
 					sprintf(
682
-						__( 'The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s', 'event_espresso' ),
683
-						trim( $type, '.' ),
682
+						__('The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s', 'event_espresso'),
683
+						trim($type, '.'),
684 684
 						$class_name,
685
-						'<br />' . implode( ',<br />', $file_paths )
685
+						'<br />'.implode(',<br />', $file_paths)
686 686
 					)
687 687
 				);
688 688
 			}
689 689
 			// get the file
690
-			require_once( $path );
690
+			require_once($path);
691 691
 			// if the class isn't already declared somewhere
692
-			if ( class_exists( $class_name, false ) === false ) {
692
+			if (class_exists($class_name, false) === false) {
693 693
 				// so sorry, not a class
694 694
 				throw new EE_Error(
695 695
 					sprintf(
696
-						__( 'The %s file %s does not appear to contain the %s Class.', 'event_espresso' ),
696
+						__('The %s file %s does not appear to contain the %s Class.', 'event_espresso'),
697 697
 						$type,
698 698
 						$path,
699 699
 						$class_name
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 				);
702 702
 			}
703 703
 
704
-		} catch ( EE_Error $e ) {
704
+		} catch (EE_Error $e) {
705 705
 			$e->get_error();
706 706
 			return false;
707 707
 		}
@@ -733,55 +733,55 @@  discard block
 block discarded – undo
733 733
 	 * @return null | object
734 734
 	 * @throws \EE_Error
735 735
 	 */
736
-	protected function _create_object( $class_name, $arguments = array(), $type = '', $from_db = false ) {
736
+	protected function _create_object($class_name, $arguments = array(), $type = '', $from_db = false) {
737 737
 		$class_obj = null;
738 738
 		// don't give up! you gotta...
739 739
 		try {
740 740
 			// create reflection
741
-			$reflector = $this->get_ReflectionClass( $class_name );
741
+			$reflector = $this->get_ReflectionClass($class_name);
742 742
 			// make sure arguments are an array
743
-			$arguments = is_array( $arguments ) ? $arguments : array( $arguments );
743
+			$arguments = is_array($arguments) ? $arguments : array($arguments);
744 744
 			// and if arguments array is numerically and sequentially indexed, then we want it to remain as is,
745 745
 			// else wrap it in an additional array so that it doesn't get split into multiple parameters
746
-			$arguments = $this->_array_is_numerically_and_sequentially_indexed( $arguments )
746
+			$arguments = $this->_array_is_numerically_and_sequentially_indexed($arguments)
747 747
 				? $arguments
748
-				: array( $arguments );
748
+				: array($arguments);
749 749
 			// attempt to inject dependencies ?
750
-			if ( $this->_dependency_map->has( $class_name ) ) {
751
-				$arguments = $this->_resolve_dependencies( $reflector, $class_name, $arguments );
750
+			if ($this->_dependency_map->has($class_name)) {
751
+				$arguments = $this->_resolve_dependencies($reflector, $class_name, $arguments);
752 752
 			}
753 753
 			// instantiate the class and add to the LIB array for tracking
754 754
 			// EE_Base_Classes are instantiated via new_instance by default (models call them via new_instance_from_db)
755
-			if ( $reflector->getConstructor() === null || $reflector->isAbstract() ) {
755
+			if ($reflector->getConstructor() === null || $reflector->isAbstract()) {
756 756
 				// no constructor = static methods only... nothing to instantiate, loading file was enough
757 757
 				//$instantiation_mode = "no constructor";
758 758
 				$class_obj = true;
759
-			} else if ( $from_db && method_exists( $class_name, 'new_instance_from_db' ) ) {
759
+			} else if ($from_db && method_exists($class_name, 'new_instance_from_db')) {
760 760
 				//$instantiation_mode = "new_instance_from_db";
761
-				$class_obj = call_user_func_array( array( $class_name, 'new_instance_from_db' ), $arguments );
762
-			} else if ( method_exists( $class_name, 'new_instance' ) ) {
761
+				$class_obj = call_user_func_array(array($class_name, 'new_instance_from_db'), $arguments);
762
+			} else if (method_exists($class_name, 'new_instance')) {
763 763
 				//$instantiation_mode = "new_instance";
764
-				$class_obj = call_user_func_array( array( $class_name, 'new_instance' ), $arguments );
765
-			} else if ( method_exists( $class_name, 'instance' ) ) {
764
+				$class_obj = call_user_func_array(array($class_name, 'new_instance'), $arguments);
765
+			} else if (method_exists($class_name, 'instance')) {
766 766
 				//$instantiation_mode = "instance";
767
-				$class_obj = call_user_func_array( array( $class_name, 'instance' ), $arguments );
768
-			} else if ( $reflector->isInstantiable() ) {
767
+				$class_obj = call_user_func_array(array($class_name, 'instance'), $arguments);
768
+			} else if ($reflector->isInstantiable()) {
769 769
 				//$instantiation_mode = "isInstantiable";
770
-				$class_obj = $reflector->newInstanceArgs( $arguments );
770
+				$class_obj = $reflector->newInstanceArgs($arguments);
771 771
 			} else {
772 772
 				// heh ? something's not right !
773 773
 				//$instantiation_mode = 'none';
774 774
 				throw new EE_Error(
775 775
 					sprintf(
776
-						__( 'The %s file %s could not be instantiated.', 'event_espresso' ),
776
+						__('The %s file %s could not be instantiated.', 'event_espresso'),
777 777
 						$type,
778 778
 						$class_name
779 779
 					)
780 780
 				);
781 781
 			}
782
-		} catch ( Exception $e ) {
783
-			if ( ! $e instanceof EE_Error ) {
784
-				$e = new EE_Error( $e->getMessage() );
782
+		} catch (Exception $e) {
783
+			if ( ! $e instanceof EE_Error) {
784
+				$e = new EE_Error($e->getMessage());
785 785
 			}
786 786
 			$e->get_error();
787 787
 		}
@@ -795,8 +795,8 @@  discard block
 block discarded – undo
795 795
 	 * @param array $array
796 796
 	 * @return bool
797 797
 	 */
798
-	protected function _array_is_numerically_and_sequentially_indexed( array $array ) {
799
-		return ! empty( $array ) ? array_keys( $array ) === range( 0, count( $array ) - 1 ) : true;
798
+	protected function _array_is_numerically_and_sequentially_indexed(array $array) {
799
+		return ! empty($array) ? array_keys($array) === range(0, count($array) - 1) : true;
800 800
 	}
801 801
 
802 802
 
@@ -811,14 +811,14 @@  discard block
 block discarded – undo
811 811
 	 * @param string $class_name
812 812
 	 * @return ReflectionClass
813 813
 	 */
814
-	public function get_ReflectionClass( $class_name ) {
814
+	public function get_ReflectionClass($class_name) {
815 815
 		if (
816
-			! isset( $this->_reflectors[ $class_name ] )
817
-			|| ! $this->_reflectors[ $class_name ] instanceof ReflectionClass
816
+			! isset($this->_reflectors[$class_name])
817
+			|| ! $this->_reflectors[$class_name] instanceof ReflectionClass
818 818
 		) {
819
-			$this->_reflectors[ $class_name ] = new ReflectionClass( $class_name );
819
+			$this->_reflectors[$class_name] = new ReflectionClass($class_name);
820 820
 		}
821
-		return $this->_reflectors[ $class_name ];
821
+		return $this->_reflectors[$class_name];
822 822
 	}
823 823
 
824 824
 
@@ -843,48 +843,48 @@  discard block
 block discarded – undo
843 843
 	 * @param array $arguments
844 844
 	 * @return array
845 845
 	 */
846
-	protected function _resolve_dependencies( ReflectionClass $reflector, $class_name, $arguments = array() ) {
846
+	protected function _resolve_dependencies(ReflectionClass $reflector, $class_name, $arguments = array()) {
847 847
 		// let's examine the constructor
848 848
 		$constructor = $reflector->getConstructor();
849 849
 		// whu? huh? nothing?
850
-		if ( ! $constructor ) {
850
+		if ( ! $constructor) {
851 851
 			return $arguments;
852 852
 		}
853 853
 		// get constructor parameters
854 854
 		$params = $constructor->getParameters();
855 855
 		// and the keys for the incoming arguments array so that we can compare existing arguments with what is expected
856
-		$argument_keys = array_keys( $arguments );
856
+		$argument_keys = array_keys($arguments);
857 857
 		// now loop thru all of the constructors expected parameters
858
-		foreach ( $params as $index => $param ) {
858
+		foreach ($params as $index => $param) {
859 859
 			// is this a dependency for a specific class ?
860 860
 			$param_class = $param->getClass() ? $param->getClass()->name : null;
861 861
 			// you want a piece of me ?
862
-			if ( $param_class === 'EE_Registry' ) {
863
-				$arguments[ $index ] = $this;
862
+			if ($param_class === 'EE_Registry') {
863
+				$arguments[$index] = $this;
864 864
 			} else if (
865 865
 				// param is not even a class
866
-				empty( $param_class )
866
+				empty($param_class)
867 867
 				// and something already exists in the incoming arguments for this param
868
-				&& isset( $argument_keys[ $index ], $arguments[ $argument_keys[ $index ] ] )
868
+				&& isset($argument_keys[$index], $arguments[$argument_keys[$index]])
869 869
 			) {
870 870
 				// so let's skip this argument and move on to the next
871 871
 				continue;
872 872
 			} else if (
873 873
 				// parameter is type hinted as a class, exists as an incoming argument, AND it's the correct class
874
-				! empty( $param_class )
875
-				&& isset( $argument_keys[ $index ], $arguments[ $argument_keys[ $index ] ] )
876
-				&& $arguments[ $argument_keys[ $index ] ] instanceof $param_class
874
+				! empty($param_class)
875
+				&& isset($argument_keys[$index], $arguments[$argument_keys[$index]])
876
+				&& $arguments[$argument_keys[$index]] instanceof $param_class
877 877
 			) {
878 878
 				// skip this argument and move on to the next
879 879
 				continue;
880 880
 			} else if (
881 881
 				// parameter is type hinted as a class, and should be injected
882
-				! empty( $param_class )
883
-				&& $this->_dependency_map->has_dependency_for_class( $class_name, $param_class )
882
+				! empty($param_class)
883
+				&& $this->_dependency_map->has_dependency_for_class($class_name, $param_class)
884 884
 			) {
885
-				$arguments = $this->_resolve_dependency( $class_name, $param_class, $arguments, $index );
885
+				$arguments = $this->_resolve_dependency($class_name, $param_class, $arguments, $index);
886 886
 			} else {
887
-				$arguments[ $index ] = $param->getDefaultValue();
887
+				$arguments[$index] = $param->getDefaultValue();
888 888
 			}
889 889
 
890 890
 		}
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 	 * @param mixed $index
902 902
 	 * @return array
903 903
 	 */
904
-	protected function _resolve_dependency( $class_name, $param_class , $arguments, $index ) {
904
+	protected function _resolve_dependency($class_name, $param_class, $arguments, $index) {
905 905
 		$dependency = null;
906 906
 		// should dependency be loaded from cache ?
907 907
 		$cache_on = $this->_dependency_map->loading_strategy_for_class_dependency(
@@ -911,30 +911,30 @@  discard block
 block discarded – undo
911 911
 			: false;
912 912
 		// we might have a dependency...
913 913
 		// let's MAYBE try and find it in our cache if that's what's been requested
914
-		$cached_class = $cache_on ? $this->_get_cached_class( $param_class ) : null;
914
+		$cached_class = $cache_on ? $this->_get_cached_class($param_class) : null;
915 915
 		// and grab it if it exists
916
-		if ( $cached_class instanceof $param_class ) {
916
+		if ($cached_class instanceof $param_class) {
917 917
 			$dependency = $cached_class;
918
-		} else if ( $param_class != $class_name ) {
918
+		} else if ($param_class != $class_name) {
919 919
 			// obtain the loader method from the dependency map
920
-			$loader = $this->_dependency_map->class_loader( $param_class );
920
+			$loader = $this->_dependency_map->class_loader($param_class);
921 921
 			// is loader a custom closure ?
922
-			if ( $loader instanceof Closure ) {
922
+			if ($loader instanceof Closure) {
923 923
 				$dependency = $loader();
924 924
 			} else {
925 925
 				// set the cache on property for the recursive loading call
926 926
 				$this->_cache_on = $cache_on;
927 927
 				// if not, then let's try and load it via the registry
928
-				$dependency = $this->{$loader}( $param_class );
928
+				$dependency = $this->{$loader}($param_class);
929 929
 			}
930 930
 		}
931 931
 		// did we successfully find the correct dependency ?
932
-		if ( $dependency instanceof $param_class ) {
932
+		if ($dependency instanceof $param_class) {
933 933
 			// then let's inject it into the incoming array of arguments at the correct location
934
-			if ( isset( $argument_keys[ $index ] ) ) {
935
-				$arguments[ $argument_keys[ $index ] ] = $dependency;
934
+			if (isset($argument_keys[$index])) {
935
+				$arguments[$argument_keys[$index]] = $dependency;
936 936
 			} else {
937
-				$arguments[ $index ] = $dependency;
937
+				$arguments[$index] = $dependency;
938 938
 			}
939 939
 		}
940 940
 		return $arguments;
@@ -959,16 +959,16 @@  discard block
 block discarded – undo
959 959
 	 * @param bool $from_db
960 960
 	 * @return void
961 961
 	 */
962
-	protected function _set_cached_class( $class_obj, $class_name, $class_prefix = '', $from_db = false ) {
962
+	protected function _set_cached_class($class_obj, $class_name, $class_prefix = '', $from_db = false) {
963 963
 		// return newly instantiated class
964
-		if ( isset( $this->_class_abbreviations[ $class_name ] ) ) {
965
-			$class_abbreviation = $this->_class_abbreviations[ $class_name ];
964
+		if (isset($this->_class_abbreviations[$class_name])) {
965
+			$class_abbreviation = $this->_class_abbreviations[$class_name];
966 966
 			$this->{$class_abbreviation} = $class_obj;
967
-		} else if ( property_exists( $this, $class_name ) ) {
967
+		} else if (property_exists($this, $class_name)) {
968 968
 			$this->{$class_name} = $class_obj;
969
-		} else if ( $class_prefix == 'addon' ) {
969
+		} else if ($class_prefix == 'addon') {
970 970
 			$this->addons->{$class_name} = $class_obj;
971
-		} else if ( ! $from_db ) {
971
+		} else if ( ! $from_db) {
972 972
 			$this->LIB->{$class_name} = $class_obj;
973 973
 		}
974 974
 	}
@@ -985,12 +985,12 @@  discard block
 block discarded – undo
985 985
 	 * @param array  $arguments
986 986
 	 * @return object
987 987
 	 */
988
-	public static function factory( $classname, $arguments = array() ) {
989
-		$loader = self::instance()->_dependency_map->class_loader( $classname );
990
-		if ( $loader instanceof Closure ) {
991
-			return $loader( $arguments );
992
-		} else if ( method_exists( EE_Registry::instance(), $loader ) ) {
993
-			return EE_Registry::instance()->{$loader}( $classname, $arguments );
988
+	public static function factory($classname, $arguments = array()) {
989
+		$loader = self::instance()->_dependency_map->class_loader($classname);
990
+		if ($loader instanceof Closure) {
991
+			return $loader($arguments);
992
+		} else if (method_exists(EE_Registry::instance(), $loader)) {
993
+			return EE_Registry::instance()->{$loader}($classname, $arguments);
994 994
 		}
995 995
 		return null;
996 996
 	}
@@ -1003,9 +1003,9 @@  discard block
 block discarded – undo
1003 1003
 	 * @param string $name
1004 1004
 	 * @return EE_Addon
1005 1005
 	 */
1006
-	public function get_addon_by_name( $name ) {
1007
-		foreach ( $this->addons as $addon ) {
1008
-			if ( $addon->name() == $name ) {
1006
+	public function get_addon_by_name($name) {
1007
+		foreach ($this->addons as $addon) {
1008
+			if ($addon->name() == $name) {
1009 1009
 				return $addon;
1010 1010
 			}
1011 1011
 		}
@@ -1021,8 +1021,8 @@  discard block
 block discarded – undo
1021 1021
 	 */
1022 1022
 	public function get_addons_by_name() {
1023 1023
 		$addons = array();
1024
-		foreach ( $this->addons as $addon ) {
1025
-			$addons[ $addon->name() ] = $addon;
1024
+		foreach ($this->addons as $addon) {
1025
+			$addons[$addon->name()] = $addon;
1026 1026
 		}
1027 1027
 		return $addons;
1028 1028
 	}
@@ -1037,14 +1037,14 @@  discard block
 block discarded – undo
1037 1037
 	 * @return \EEM_Base
1038 1038
 	 * @throws \EE_Error
1039 1039
 	 */
1040
-	public function reset_model( $model_name ) {
1041
-		$model = $this->load_model( $model_name );
1042
-		$model_class_name = get_class( $model );
1040
+	public function reset_model($model_name) {
1041
+		$model = $this->load_model($model_name);
1042
+		$model_class_name = get_class($model);
1043 1043
 		//get that model reset it and make sure we nuke the old reference to it
1044
-		if ( $model instanceof $model_class_name && is_callable( array( $model_class_name, 'reset' ))) {
1044
+		if ($model instanceof $model_class_name && is_callable(array($model_class_name, 'reset'))) {
1045 1045
 			$this->LIB->{$model_class_name} = $model::reset();
1046 1046
 		} else {
1047
-			throw new EE_Error( sprintf( __( 'Model %s does not have a method "reset"', 'event_espresso' ), $model_name ) );
1047
+			throw new EE_Error(sprintf(__('Model %s does not have a method "reset"', 'event_espresso'), $model_name));
1048 1048
 		}
1049 1049
 		return $this->LIB->{$model_class_name};
1050 1050
 	}
@@ -1062,17 +1062,17 @@  discard block
 block discarded – undo
1062 1062
 	 * currently reinstantiate the singletons at the moment)
1063 1063
 	 * @return EE_Registry
1064 1064
 	 */
1065
-	public static function reset( $hard = false, $reinstantiate = true ) {
1065
+	public static function reset($hard = false, $reinstantiate = true) {
1066 1066
 		self::$_instance = null;
1067
-		$instance = self::instance( EE_Dependency_Map::instance() );
1067
+		$instance = self::instance(EE_Dependency_Map::instance());
1068 1068
 		$instance->initialize();
1069 1069
 		EEH_Activation::reset();
1070 1070
 		$instance->_cache_on = true;
1071
-		$instance->CFG = EE_Config::reset( $hard, $reinstantiate, $instance );
1071
+		$instance->CFG = EE_Config::reset($hard, $reinstantiate, $instance);
1072 1072
 		$instance->LIB->EE_Data_Migration_Manager = EE_Data_Migration_Manager::reset();
1073 1073
 		$instance->LIB = new stdClass();
1074
-		foreach ( array_keys( $instance->non_abstract_db_models ) as $model_name ) {
1075
-			$instance->reset_model( $model_name );
1074
+		foreach (array_keys($instance->non_abstract_db_models) as $model_name) {
1075
+			$instance->reset_model($model_name);
1076 1076
 		}
1077 1077
 		return $instance;
1078 1078
 	}
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
 	 * @param $a
1093 1093
 	 * @param $b
1094 1094
 	 */
1095
-	final function __call( $a, $b ) {
1095
+	final function __call($a, $b) {
1096 1096
 	}
1097 1097
 
1098 1098
 
@@ -1100,7 +1100,7 @@  discard block
 block discarded – undo
1100 1100
 	/**
1101 1101
 	 * @param $a
1102 1102
 	 */
1103
-	final function __get( $a ) {
1103
+	final function __get($a) {
1104 1104
 	}
1105 1105
 
1106 1106
 
@@ -1109,7 +1109,7 @@  discard block
 block discarded – undo
1109 1109
 	 * @param $a
1110 1110
 	 * @param $b
1111 1111
 	 */
1112
-	final function __set( $a, $b ) {
1112
+	final function __set($a, $b) {
1113 1113
 	}
1114 1114
 
1115 1115
 
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
 	/**
1118 1118
 	 * @param $a
1119 1119
 	 */
1120
-	final function __isset( $a ) {
1120
+	final function __isset($a) {
1121 1121
 	}
1122 1122
 
1123 1123
 
@@ -1125,7 +1125,7 @@  discard block
 block discarded – undo
1125 1125
 	/**
1126 1126
 	 * @param $a
1127 1127
 	 */
1128
-	final function __unset( $a ) {
1128
+	final function __unset($a) {
1129 1129
 	}
1130 1130
 
1131 1131
 
@@ -1172,7 +1172,7 @@  discard block
 block discarded – undo
1172 1172
 	 * @param $a
1173 1173
 	 * @param $b
1174 1174
 	 */
1175
-	final static function __callStatic( $a, $b ) {
1175
+	final static function __callStatic($a, $b) {
1176 1176
 	}
1177 1177
 
1178 1178
 	/**
@@ -1181,9 +1181,9 @@  discard block
 block discarded – undo
1181 1181
 	 */
1182 1182
 	public function cpt_models() {
1183 1183
 		$cpt_models = array();
1184
-		foreach( $this->non_abstract_db_models as $short_name => $classname ) {
1185
-			if( is_subclass_of(  $classname, 'EEM_CPT_Base' ) ) {
1186
-				$cpt_models[ $short_name ] = $classname;
1184
+		foreach ($this->non_abstract_db_models as $short_name => $classname) {
1185
+			if (is_subclass_of($classname, 'EEM_CPT_Base')) {
1186
+				$cpt_models[$short_name] = $classname;
1187 1187
 			}
1188 1188
 		}
1189 1189
 		return $cpt_models;
Please login to merge, or discard this patch.
core/EE_Load_Espresso_Core.core.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 /**
6 6
  *
@@ -65,27 +65,27 @@  discard block
 block discarded – undo
65 65
 	 * @param 	EE_Response $response
66 66
 	 * @return 	EE_Response
67 67
 	 */
68
-	public function handle_request( EE_Request $request, EE_Response $response ) {
68
+	public function handle_request(EE_Request $request, EE_Response $response) {
69 69
 		$this->request = $request;
70 70
 		$this->response = $response;
71
-		do_action( 'AHEE__EE_Load_Espresso_Core__handle_request__start', $this );
71
+		do_action('AHEE__EE_Load_Espresso_Core__handle_request__start', $this);
72 72
 		// info about how to load classes required by other classes
73 73
 		$this->dependency_map = $this->_load_dependency_map();
74 74
 		// central repository for classes
75 75
 		$this->registry = $this->_load_registry();
76
-		do_action( 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', $this );
76
+		do_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', $this);
77 77
 		// PSR4 Autoloaders
78
-		$this->registry->load_core( 'EE_Psr4AutoloaderInit' );
78
+		$this->registry->load_core('EE_Psr4AutoloaderInit');
79 79
 		// workarounds for PHP < 5.3
80 80
 		$this->_load_class_tools();
81 81
 		// load interfaces
82
-		espresso_load_required( 'EEI_Payment_Method_Interfaces', EE_LIBRARIES . 'payment_methods' . DS . 'EEI_Payment_Method_Interfaces.php' );
82
+		espresso_load_required('EEI_Payment_Method_Interfaces', EE_LIBRARIES.'payment_methods'.DS.'EEI_Payment_Method_Interfaces.php');
83 83
 		// deprecated functions
84
-		espresso_load_required( 'EE_Deprecated', EE_CORE . 'EE_Deprecated.core.php' );
84
+		espresso_load_required('EE_Deprecated', EE_CORE.'EE_Deprecated.core.php');
85 85
 		// WP cron jobs
86
-		$this->registry->load_core( 'Cron_Tasks' );
87
-		$this->registry->load_core( 'EE_Request_Handler' );
88
-		$this->registry->load_core( 'EE_System' );
86
+		$this->registry->load_core('Cron_Tasks');
87
+		$this->registry->load_core('EE_Request_Handler');
88
+		$this->registry->load_core('EE_System');
89 89
 
90 90
 		return $this->response;
91 91
 	}
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
 	 * @throws \EE_Error
116 116
 	 */
117 117
 	public function dependency_map() {
118
-		if ( ! $this->dependency_map instanceof EE_Dependency_Map ) {
118
+		if ( ! $this->dependency_map instanceof EE_Dependency_Map) {
119 119
 			throw new EE_Error(
120 120
 				sprintf(
121
-					__( 'Invalid EE_Dependency_Map: "%1$s"', 'event_espresso' ),
122
-					print_r( $this->dependency_map, true )
121
+					__('Invalid EE_Dependency_Map: "%1$s"', 'event_espresso'),
122
+					print_r($this->dependency_map, true)
123 123
 				)
124 124
 			);
125 125
 		}
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
 	 * @throws \EE_Error
134 134
 	 */
135 135
 	public function registry() {
136
-		if ( ! $this->registry instanceof EE_Registry ) {
136
+		if ( ! $this->registry instanceof EE_Registry) {
137 137
 			throw new EE_Error(
138 138
 				sprintf(
139
-					__( 'Invalid EE_Registry: "%1$s"', 'event_espresso' ),
140
-					print_r( $this->registry, true )
139
+					__('Invalid EE_Registry: "%1$s"', 'event_espresso'),
140
+					print_r($this->registry, true)
141 141
 				)
142 142
 			);
143 143
 		}
@@ -153,17 +153,17 @@  discard block
 block discarded – undo
153 153
 	 * 	@return EE_Dependency_Map
154 154
 	 */
155 155
 	private function _load_dependency_map() {
156
-		if ( ! is_readable( EE_CORE . 'EE_Dependency_Map.core.php' ) ) {
156
+		if ( ! is_readable(EE_CORE.'EE_Dependency_Map.core.php')) {
157 157
 			EE_Error::add_error(
158
-				__( 'The EE_Dependency_Map core class could not be loaded.', 'event_espresso' ),
158
+				__('The EE_Dependency_Map core class could not be loaded.', 'event_espresso'),
159 159
 				__FILE__, __FUNCTION__, __LINE__
160 160
 			);
161
-			wp_die( EE_Error::get_notices() );
161
+			wp_die(EE_Error::get_notices());
162 162
 		}
163
-		require_once( EE_CORE . 'EE_Dependency_Map.core.php' );
163
+		require_once(EE_CORE.'EE_Dependency_Map.core.php');
164 164
 		return apply_filters(
165 165
 			'FHEE__EE_Load_Espresso_Core___load_dependency_map',
166
-			EE_Dependency_Map::instance( $this->request, $this->response )
166
+			EE_Dependency_Map::instance($this->request, $this->response)
167 167
 		);
168 168
 	}
169 169
 
@@ -176,17 +176,17 @@  discard block
 block discarded – undo
176 176
 	 * 	@return EE_Registry
177 177
 	 */
178 178
 	private function _load_registry() {
179
-		if ( ! is_readable( EE_CORE . 'EE_Registry.core.php' )) {
179
+		if ( ! is_readable(EE_CORE.'EE_Registry.core.php')) {
180 180
 			EE_Error::add_error(
181
-				__( 'The EE_Registry core class could not be loaded.', 'event_espresso' ),
181
+				__('The EE_Registry core class could not be loaded.', 'event_espresso'),
182 182
 				__FILE__, __FUNCTION__, __LINE__
183 183
 			);
184
-			wp_die( EE_Error::get_notices() );
184
+			wp_die(EE_Error::get_notices());
185 185
 		}
186
-		require_once( EE_CORE . 'EE_Registry.core.php' );
186
+		require_once(EE_CORE.'EE_Registry.core.php');
187 187
 		return apply_filters(
188 188
 			'FHEE__EE_Load_Espresso_Core___load_registry',
189
-			EE_Registry::instance( $this->dependency_map )
189
+			EE_Registry::instance($this->dependency_map)
190 190
 		);
191 191
 	}
192 192
 
@@ -198,13 +198,13 @@  discard block
 block discarded – undo
198 198
 	 * 	@return void
199 199
 	 */
200 200
 	private function _load_class_tools() {
201
-		if ( ! is_readable( EE_HELPERS . 'EEH_Class_Tools.helper.php' )) {
201
+		if ( ! is_readable(EE_HELPERS.'EEH_Class_Tools.helper.php')) {
202 202
 			EE_Error::add_error(
203
-				__( 'The EEH_Class_Tools helper could not be loaded.', 'event_espresso' ),
203
+				__('The EEH_Class_Tools helper could not be loaded.', 'event_espresso'),
204 204
 				__FILE__, __FUNCTION__, __LINE__
205 205
 			);
206 206
 		}
207
-		require_once( EE_HELPERS . 'EEH_Class_Tools.helper.php' );
207
+		require_once(EE_HELPERS.'EEH_Class_Tools.helper.php');
208 208
 	}
209 209
 
210 210
 
@@ -218,9 +218,9 @@  discard block
 block discarded – undo
218 218
 	 * @param \EE_Request $request
219 219
 	 * @param \EE_Response $response
220 220
 	 */
221
-	public function handle_response( EE_Request $request, EE_Response $response ) {
222
-		if ( $response->plugin_deactivated() ) {
223
-			espresso_deactivate_plugin( EE_PLUGIN_BASENAME );
221
+	public function handle_response(EE_Request $request, EE_Response $response) {
222
+		if ($response->plugin_deactivated()) {
223
+			espresso_deactivate_plugin(EE_PLUGIN_BASENAME);
224 224
 		}
225 225
 	}
226 226
 
Please login to merge, or discard this patch.
core/EE_Dependency_Map.core.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 
@@ -70,11 +70,11 @@  discard block
 block discarded – undo
70 70
 	 * @param  \EE_Request  $request
71 71
 	 * @param  \EE_Response $response
72 72
 	 */
73
-	protected function __construct( EE_Request $request, EE_Response $response ) {
73
+	protected function __construct(EE_Request $request, EE_Response $response) {
74 74
 		$this->_request = $request;
75 75
 		$this->_response = $response;
76
-		add_action( 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', array( $this, 'initialize' ) );
77
-		do_action( 'EE_Dependency_Map____construct' );
76
+		add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize'));
77
+		do_action('EE_Dependency_Map____construct');
78 78
 	}
79 79
 
80 80
 
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
 	 * @param  \EE_Response $response
96 96
 	 * @return \EE_Dependency_Map instance
97 97
 	 */
98
-	public static function instance( EE_Request $request = null, EE_Response $response = null ) {
98
+	public static function instance(EE_Request $request = null, EE_Response $response = null) {
99 99
 		// check if class object is instantiated, and instantiated properly
100
-		if ( ! self::$_instance instanceof EE_Dependency_Map ) {
101
-			self::$_instance = new EE_Dependency_Map( $request, $response );
100
+		if ( ! self::$_instance instanceof EE_Dependency_Map) {
101
+			self::$_instance = new EE_Dependency_Map($request, $response);
102 102
 		}
103 103
 		return self::$_instance;
104 104
 	}
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
 	 * @param array  $dependencies
111 111
 	 * @return boolean
112 112
 	 */
113
-	public static function register_dependencies( $class, $dependencies ) {
114
-		if ( ! isset( self::$_instance->_dependency_map[ $class ] ) ) {
115
-			self::$_instance->_dependency_map[ $class ] = (array)$dependencies;
113
+	public static function register_dependencies($class, $dependencies) {
114
+		if ( ! isset(self::$_instance->_dependency_map[$class])) {
115
+			self::$_instance->_dependency_map[$class] = (array) $dependencies;
116 116
 			return true;
117 117
 		}
118 118
 		return false;
@@ -126,18 +126,18 @@  discard block
 block discarded – undo
126 126
 	 * @return bool
127 127
 	 * @throws \EE_Error
128 128
 	 */
129
-	public static function register_class_loader( $class_name, $loader = 'load_core' ) {
129
+	public static function register_class_loader($class_name, $loader = 'load_core') {
130 130
 		// check that loader method starts with "load_" and exists in EE_Registry
131
-		if ( strpos( $loader, 'load_' ) !== 0 || ! method_exists( 'EE_Registry', $loader ) ) {
131
+		if (strpos($loader, 'load_') !== 0 || ! method_exists('EE_Registry', $loader)) {
132 132
 			throw new EE_Error(
133 133
 				sprintf(
134
-					__( '"%1$s" is not a valid loader method on EE_Registry.', 'event_espresso' ),
134
+					__('"%1$s" is not a valid loader method on EE_Registry.', 'event_espresso'),
135 135
 					$loader
136 136
 				)
137 137
 			);
138 138
 		}
139
-		if ( ! isset( self::$_instance->_class_loaders[ $class_name ] ) ) {
140
-			self::$_instance->_class_loaders[ $class_name ] = $loader;
139
+		if ( ! isset(self::$_instance->_class_loaders[$class_name])) {
140
+			self::$_instance->_class_loaders[$class_name] = $loader;
141 141
 			return true;
142 142
 		}
143 143
 		return false;
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 	 * @param string $class_name
161 161
 	 * @return boolean
162 162
 	 */
163
-	public function has( $class_name = '' ) {
164
-		return isset( $this->_dependency_map[ $class_name ] ) ? true : false;
163
+	public function has($class_name = '') {
164
+		return isset($this->_dependency_map[$class_name]) ? true : false;
165 165
 	}
166 166
 
167 167
 
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	 * @param string $dependency
174 174
 	 * @return bool
175 175
 	 */
176
-	public function has_dependency_for_class( $class_name = '', $dependency = '' ) {
177
-		return isset( $this->_dependency_map[ $class_name ], $this->_dependency_map[ $class_name ][ $dependency ] )
176
+	public function has_dependency_for_class($class_name = '', $dependency = '') {
177
+		return isset($this->_dependency_map[$class_name], $this->_dependency_map[$class_name][$dependency])
178 178
 			? true
179 179
 			: false;
180 180
 	}
@@ -188,9 +188,9 @@  discard block
 block discarded – undo
188 188
 	 * @param string $dependency
189 189
 	 * @return int
190 190
 	 */
191
-	public function loading_strategy_for_class_dependency( $class_name = '', $dependency = '' ) {
192
-		return $this->has_dependency_for_class( $class_name, $dependency )
193
-			? $this->_dependency_map[ $class_name ][ $dependency ]
191
+	public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') {
192
+		return $this->has_dependency_for_class($class_name, $dependency)
193
+			? $this->_dependency_map[$class_name][$dependency]
194 194
 			: EE_Dependency_Map::not_registered;
195 195
 	}
196 196
 
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
 	 * @param string $class_name
201 201
 	 * @return string | Closure
202 202
 	 */
203
-	public function class_loader( $class_name ) {
204
-		return isset( $this->_class_loaders[ $class_name ] ) ? $this->_class_loaders[ $class_name ] : '';
203
+	public function class_loader($class_name) {
204
+		return isset($this->_class_loaders[$class_name]) ? $this->_class_loaders[$class_name] : '';
205 205
 	}
206 206
 
207 207
 
@@ -326,13 +326,13 @@  discard block
 block discarded – undo
326 326
 		$this->_class_loaders = array_merge(
327 327
 			$this->_class_loaders,
328 328
 			array(
329
-				'EE_Request'  => function () use ( &$request ) {
329
+				'EE_Request'  => function() use (&$request) {
330 330
 					return $request;
331 331
 				},
332
-				'EE_Response' => function () use ( &$response ) {
332
+				'EE_Response' => function() use (&$response) {
333 333
 					return $response;
334 334
 				},
335
-				'EE_Dependency_Map' => function () use ( &$dep_map ) {
335
+				'EE_Dependency_Map' => function() use (&$dep_map) {
336 336
 					return $dep_map;
337 337
 				},
338 338
 				//load_core
@@ -356,17 +356,17 @@  discard block
 block discarded – undo
356 356
 				'EE_Messages_Data_Handler_Collection'  => 'load_lib',
357 357
 				'EE_Message_Template_Group_Collection' => 'load_lib',
358 358
 				'EE_Messages_Generator' => function() {
359
-					return EE_Registry::instance()->load_lib( 'Messages_Generator', array(), false, false );
359
+					return EE_Registry::instance()->load_lib('Messages_Generator', array(), false, false);
360 360
 				},
361
-				'EE_Messages_Template_Defaults' => function( $arguments = array() ) {
362
-					return EE_Registry::instance()->load_lib( 'Messages_Template_Defaults', $arguments, false, false );
361
+				'EE_Messages_Template_Defaults' => function($arguments = array()) {
362
+					return EE_Registry::instance()->load_lib('Messages_Template_Defaults', $arguments, false, false);
363 363
 				},
364 364
 				//load_model
365 365
 				'EEM_Message_Template_Group'           => 'load_model',
366 366
 				'EEM_Message_Template'                 => 'load_model',
367 367
 				//load_helper
368 368
 				'EEH_Parse_Shortcodes'                 => function() {
369
-					if ( EE_Registry::instance()->load_helper( 'Parse_Shortcodes' ) ) {
369
+					if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) {
370 370
 						return new EEH_Parse_Shortcodes();
371 371
 					}
372 372
 					return null;
Please login to merge, or discard this patch.
core/EE_Front_Controller.core.php 1 patch
Spacing   +116 added lines, -116 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
  * Event Espresso
4 4
  *
@@ -75,37 +75,37 @@  discard block
 block discarded – undo
75 75
 		$this->Request_Handler = $Request_Handler;
76 76
 		$this->Module_Request_Router = $Module_Request_Router;
77 77
 		// make sure template tags are loaded immediately so that themes don't break
78
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'load_espresso_template_tags' ), 10 );
78
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'load_espresso_template_tags'), 10);
79 79
 		// determine how to integrate WP_Query with the EE models
80
-		add_action( 'AHEE__EE_System__initialize', array( $this, 'employ_CPT_Strategy' ));
80
+		add_action('AHEE__EE_System__initialize', array($this, 'employ_CPT_Strategy'));
81 81
 		// load other resources and begin to actually run shortcodes and modules
82
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 5 );
82
+		add_action('wp_loaded', array($this, 'wp_loaded'), 5);
83 83
 		// analyse the incoming WP request
84
-		add_action( 'parse_request', array( $this, 'get_request' ), 1, 1 );
84
+		add_action('parse_request', array($this, 'get_request'), 1, 1);
85 85
 		// process any content shortcodes
86
-		add_action( 'parse_request', array( $this, '_initialize_shortcodes' ), 5 );
86
+		add_action('parse_request', array($this, '_initialize_shortcodes'), 5);
87 87
 		// process request with module factory
88
-		add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 10, 1 );
88
+		add_action('pre_get_posts', array($this, 'pre_get_posts'), 10, 1);
89 89
 		// before headers sent
90
-		add_action( 'wp', array( $this, 'wp' ), 5 );
90
+		add_action('wp', array($this, 'wp'), 5);
91 91
 		// load css and js
92
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 1 );
92
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 1);
93 93
 		// header
94
-		add_action('wp_head', array( $this, 'header_meta_tag' ), 5 );
95
-		add_filter( 'template_include', array( $this, 'template_include' ), 1 );
94
+		add_action('wp_head', array($this, 'header_meta_tag'), 5);
95
+		add_filter('template_include', array($this, 'template_include'), 1);
96 96
 		// display errors
97
-		add_action('loop_start', array( $this, 'display_errors' ), 2 );
97
+		add_action('loop_start', array($this, 'display_errors'), 2);
98 98
 		// the content
99 99
 		// add_filter( 'the_content', array( $this, 'the_content' ), 5, 1 );
100 100
 		//exclude our private cpt comments
101
-		add_filter( 'comments_clauses', array( $this, 'filter_wp_comments'), 10, 1 );
101
+		add_filter('comments_clauses', array($this, 'filter_wp_comments'), 10, 1);
102 102
 		//make sure any ajax requests will respect the url schema when requests are made against admin-ajax.php (http:// or https://)
103
-		add_filter( 'admin_url', array( $this, 'maybe_force_admin_ajax_ssl' ), 200, 1 );
103
+		add_filter('admin_url', array($this, 'maybe_force_admin_ajax_ssl'), 200, 1);
104 104
 		// action hook EE
105
-		do_action( 'AHEE__EE_Front_Controller__construct__done',$this );
105
+		do_action('AHEE__EE_Front_Controller__construct__done', $this);
106 106
 		// for checking that browser cookies are enabled
107
-		if ( apply_filters( 'FHEE__EE_Front_Controller____construct__set_test_cookie', true )) {
108
-			setcookie( 'ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/' );
107
+		if (apply_filters('FHEE__EE_Front_Controller____construct__set_test_cookie', true)) {
108
+			setcookie('ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/');
109 109
 		}
110 110
 	}
111 111
 
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
 	 * 	@return void
142 142
 	 */
143 143
 	public function load_espresso_template_tags() {
144
-		if ( is_readable( EE_PUBLIC . 'template_tags.php' )) {
145
-			require_once( EE_PUBLIC . 'template_tags.php' );
144
+		if (is_readable(EE_PUBLIC.'template_tags.php')) {
145
+			require_once(EE_PUBLIC.'template_tags.php');
146 146
 		}
147 147
 	}
148 148
 
@@ -157,12 +157,12 @@  discard block
 block discarded – undo
157 157
 	 * @param  array $clauses array of comment clauses setup by WP_Comment_Query
158 158
 	 * @return array array of comment clauses with modifications.
159 159
 	 */
160
-	public function filter_wp_comments( $clauses ) {
160
+	public function filter_wp_comments($clauses) {
161 161
 		global $wpdb;
162
-		if ( strpos( $clauses['join'], $wpdb->posts ) !== FALSE ) {
162
+		if (strpos($clauses['join'], $wpdb->posts) !== FALSE) {
163 163
 			$cpts = EE_Register_CPTs::get_private_CPTs();
164
-			foreach ( $cpts as $cpt => $details ) {
165
-				$clauses['where'] .= $wpdb->prepare( " AND $wpdb->posts.post_type != %s", $cpt );
164
+			foreach ($cpts as $cpt => $details) {
165
+				$clauses['where'] .= $wpdb->prepare(" AND $wpdb->posts.post_type != %s", $cpt);
166 166
 			}
167 167
 		}
168 168
 		return $clauses;
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 	 *  @return 	void
180 180
 	 */
181 181
 	public function employ_CPT_Strategy() {
182
-		if ( apply_filters( 'FHEE__EE_Front_Controller__employ_CPT_Strategy',true) ){
183
-			$this->Registry->load_core( 'CPT_Strategy' );
182
+		if (apply_filters('FHEE__EE_Front_Controller__employ_CPT_Strategy', true)) {
183
+			$this->Registry->load_core('CPT_Strategy');
184 184
 		}
185 185
 	}
186 186
 
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
 	 * @param  string $url    incoming url
193 193
 	 * @return string         final assembled url
194 194
 	 */
195
-	public function maybe_force_admin_ajax_ssl( $url ) {
196
-		if ( is_ssl() && preg_match( '/admin-ajax.php/', $url )) {
197
-			$url = str_replace( 'http://', 'https://', $url );
195
+	public function maybe_force_admin_ajax_ssl($url) {
196
+		if (is_ssl() && preg_match('/admin-ajax.php/', $url)) {
197
+			$url = str_replace('http://', 'https://', $url);
198 198
 		}
199 199
 		return $url;
200 200
 	}
@@ -231,10 +231,10 @@  discard block
 block discarded – undo
231 231
 	 * @param WP $WP
232 232
 	 * @return void
233 233
 	 */
234
-	public function get_request( WP $WP ) {
235
-		do_action( 'AHEE__EE_Front_Controller__get_request__start' );
236
-		$this->Request_Handler->parse_request( $WP );
237
-		do_action( 'AHEE__EE_Front_Controller__get_request__complete' );
234
+	public function get_request(WP $WP) {
235
+		do_action('AHEE__EE_Front_Controller__get_request__start');
236
+		$this->Request_Handler->parse_request($WP);
237
+		do_action('AHEE__EE_Front_Controller__get_request__complete');
238 238
 	}
239 239
 
240 240
 
@@ -248,24 +248,24 @@  discard block
 block discarded – undo
248 248
 	 * @param WP $WP
249 249
 	 * @return    void
250 250
 	 */
251
-	public function _initialize_shortcodes( WP $WP ) {
252
-		do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this );
253
-		$this->Request_Handler->set_request_vars( $WP );
251
+	public function _initialize_shortcodes(WP $WP) {
252
+		do_action('AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this);
253
+		$this->Request_Handler->set_request_vars($WP);
254 254
 		// grab post_name from request
255 255
 		$current_post = apply_filters(
256 256
 			'FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name',
257
-			$this->Request_Handler->get( 'post_name' )
257
+			$this->Request_Handler->get('post_name')
258 258
 		);
259
-		$show_on_front = get_option( 'show_on_front' );
259
+		$show_on_front = get_option('show_on_front');
260 260
 		// if it's not set, then check if frontpage is blog
261
-		if ( empty( $current_post ) ) {
261
+		if (empty($current_post)) {
262 262
 			// yup.. this is the posts page, prepare to load all shortcode modules
263 263
 			$current_post = 'posts';
264 264
 			// unless..
265
-			if ( $show_on_front === 'page' ) {
265
+			if ($show_on_front === 'page') {
266 266
 				// some other page is set as the homepage
267
-				$page_on_front = get_option( 'page_on_front' );
268
-				if ( $page_on_front ) {
267
+				$page_on_front = get_option('page_on_front');
268
+				if ($page_on_front) {
269 269
 					// k now we need to find the post_name for this page
270 270
 					global $wpdb;
271 271
 					$page_on_front = $wpdb->get_var(
@@ -282,16 +282,16 @@  discard block
 block discarded – undo
282 282
 		// where are posts being displayed ?
283 283
 		$page_for_posts = EE_Config::get_page_for_posts();
284 284
 		// in case $current_post is hierarchical like: /parent-page/current-page
285
-		$current_post = basename( $current_post );
285
+		$current_post = basename($current_post);
286 286
 		// are we on a category page?
287
-		$term_exists = is_array( term_exists( $current_post, 'category' ) ) || $this->_is_espresso_category( $WP );
287
+		$term_exists = is_array(term_exists($current_post, 'category')) || $this->_is_espresso_category($WP);
288 288
 		// make sure shortcodes are set
289
-		if ( isset( $this->Registry->CFG->core->post_shortcodes )) {
290
-			if ( ! isset( $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ] ) ) {
291
-				$this->Registry->CFG->core->post_shortcodes[ $page_for_posts ] = array();
289
+		if (isset($this->Registry->CFG->core->post_shortcodes)) {
290
+			if ( ! isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts])) {
291
+				$this->Registry->CFG->core->post_shortcodes[$page_for_posts] = array();
292 292
 			}
293 293
 			// cycle thru all posts with shortcodes set
294
-			foreach ( $this->Registry->CFG->core->post_shortcodes as $post_name => $post_shortcodes ) {
294
+			foreach ($this->Registry->CFG->core->post_shortcodes as $post_name => $post_shortcodes) {
295 295
 				$this->_process_post_shortcodes(
296 296
 					$post_shortcodes,
297 297
 					$term_exists,
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 				);
303 303
 			}
304 304
 		}
305
-		do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__end', $this );
305
+		do_action('AHEE__EE_Front_Controller__initialize_shortcodes__end', $this);
306 306
 	}
307 307
 
308 308
 
@@ -313,11 +313,11 @@  discard block
 block discarded – undo
313 313
 	 * @param WP $WP
314 314
 	 * @return bool
315 315
 	 */
316
-	protected function _is_espresso_category( WP $WP ) {
316
+	protected function _is_espresso_category(WP $WP) {
317 317
 		$taxonomies = EE_Register_CPTs::get_taxonomies();
318 318
 		// $taxonomies = array_keys( $taxonomies );
319
-		foreach ( (array) $WP->query_vars as $query_var => $category ) {
320
-			if ( isset( $taxonomies[ $query_var ] ) ) {
319
+		foreach ((array) $WP->query_vars as $query_var => $category) {
320
+			if (isset($taxonomies[$query_var])) {
321 321
 				return true;
322 322
 			}
323 323
 		}
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 		$page_for_posts,
347 347
 		$post_name,
348 348
 		$WP
349
-	){
349
+	) {
350 350
 		static $processed = array();
351 351
 		// filter shortcodes so
352 352
 		$post_shortcodes = (array) apply_filters(
@@ -354,10 +354,10 @@  discard block
 block discarded – undo
354 354
 			$post_shortcodes
355 355
 		);
356 356
 		// now cycle thru shortcodes...
357
-		foreach ( $post_shortcodes as $shortcode_name => $post_id ) {
357
+		foreach ($post_shortcodes as $shortcode_name => $post_id) {
358 358
 			if (
359 359
 				// but IF... we have processed this shortcode already in this request
360
-				isset( $processed[ $shortcode_name ] )
360
+				isset($processed[$shortcode_name])
361 361
 				|| (
362 362
 					// or we're on a tag or category page
363 363
 					$term_exists
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 				continue;
378 378
 			}
379 379
 			// are we on this page ? or on the blog page ? or an EE CPT category page ?
380
-			if ( $current_post === $post_name || $term_exists ) {
380
+			if ($current_post === $post_name || $term_exists) {
381 381
 				// maybe init the shortcode
382 382
 				if (
383 383
 					$this->initialize_shortcode_if_active_on_page(
@@ -389,18 +389,18 @@  discard block
 block discarded – undo
389 389
 						$WP
390 390
 					)
391 391
 				) {
392
-					$processed[ $shortcode_name ] = true;
392
+					$processed[$shortcode_name] = true;
393 393
 				}
394 394
 				// if this is NOT the "Posts page" and we have a valid entry
395 395
 				// for the "Posts page" in our tracked post_shortcodes array
396 396
 				// but the shortcode is not being tracked for this page
397 397
 			} else if (
398 398
 				$post_name !== $page_for_posts
399
-				&& isset( $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ] )
400
-				&& ! isset( $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ][ $shortcode_name ] )
399
+				&& isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts])
400
+				&& ! isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts][$shortcode_name])
401 401
 			) {
402 402
 				// then remove the "fallback" shortcode processor
403
-				remove_shortcode( $shortcode_name );
403
+				remove_shortcode($shortcode_name);
404 404
 			}
405 405
 		}
406 406
 	}
@@ -429,8 +429,8 @@  discard block
 block discarded – undo
429 429
 		$WP
430 430
 	) {
431 431
 		// verify shortcode is in list of registered shortcodes
432
-		if ( ! isset( $this->Registry->shortcodes->{$shortcode_name} ) ) {
433
-			if ( $current_post !== $page_for_posts && current_user_can( 'edit_post', $post_id ) ) {
432
+		if ( ! isset($this->Registry->shortcodes->{$shortcode_name} )) {
433
+			if ($current_post !== $page_for_posts && current_user_can('edit_post', $post_id)) {
434 434
 				EE_Error::add_error(
435 435
 					sprintf(
436 436
 						__(
@@ -443,9 +443,9 @@  discard block
 block discarded – undo
443 443
 					__FUNCTION__,
444 444
 					__LINE__
445 445
 				);
446
-				add_filter( 'FHEE_run_EE_the_content', '__return_true' );
446
+				add_filter('FHEE_run_EE_the_content', '__return_true');
447 447
 			}
448
-			add_shortcode( $shortcode_name, array( 'EES_Shortcode', 'invalid_shortcode_processor' ) );
448
+			add_shortcode($shortcode_name, array('EES_Shortcode', 'invalid_shortcode_processor'));
449 449
 			return false;
450 450
 		}
451 451
 		// is this shortcode set:
@@ -455,13 +455,13 @@  discard block
 block discarded – undo
455 455
 			// for the WP "Posts" page (blog) ?
456 456
 			|| $current_post === $page_for_posts
457 457
 			// exclusively for this post ?
458
-			|| isset( $this->Registry->CFG->core->post_shortcodes[ $current_post ] )
458
+			|| isset($this->Registry->CFG->core->post_shortcodes[$current_post])
459 459
 		) {
460 460
 			// let's pause to reflect on this...
461
-			$sc_reflector = new ReflectionClass( 'EES_' . $shortcode_name );
461
+			$sc_reflector = new ReflectionClass('EES_'.$shortcode_name);
462 462
 			// ensure that class is actually a shortcode
463
-			if ( ! $sc_reflector->isSubclassOf( 'EES_Shortcode' ) ) {
464
-				if ( defined( 'WP_DEBUG' ) && WP_DEBUG === true  ) {
463
+			if ( ! $sc_reflector->isSubclassOf('EES_Shortcode')) {
464
+				if (defined('WP_DEBUG') && WP_DEBUG === true) {
465 465
 					EE_Error::add_error(
466 466
 						sprintf(
467 467
 							__(
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 						__FUNCTION__,
475 475
 						__LINE__
476 476
 					);
477
-					add_filter( 'FHEE_run_EE_the_content', '__return_true' );
477
+					add_filter('FHEE_run_EE_the_content', '__return_true');
478 478
 				}
479 479
 				return false;
480 480
 			}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 				)
490 490
 			) {
491 491
 				// fire the shortcode class's run method, so that it can activate resources
492
-				$this->Registry->shortcodes->{$shortcode_name}->run( $WP );
492
+				$this->Registry->shortcodes->{$shortcode_name}->run($WP);
493 493
 			}
494 494
 			return true;
495 495
 		}
@@ -505,19 +505,19 @@  discard block
 block discarded – undo
505 505
 	 * @param   WP_Query    $WP_Query
506 506
 	 * @return    void
507 507
 	 */
508
-	public function pre_get_posts( $WP_Query ) {
508
+	public function pre_get_posts($WP_Query) {
509 509
 		// only load Module_Request_Router if this is the main query
510 510
 		if (
511 511
 			$this->Module_Request_Router instanceof EE_Module_Request_Router
512 512
 			&& $WP_Query->is_main_query()
513 513
 		) {
514 514
 				// cycle thru module routes
515
-				while ( $route = $this->Module_Request_Router->get_route( $WP_Query )) {
515
+				while ($route = $this->Module_Request_Router->get_route($WP_Query)) {
516 516
 					// determine module and method for route
517
-					$module = $this->Module_Request_Router->resolve_route( $route[0], $route[1] );
518
-					if( $module instanceof EED_Module ) {
517
+					$module = $this->Module_Request_Router->resolve_route($route[0], $route[1]);
518
+					if ($module instanceof EED_Module) {
519 519
 						// get registered view for route
520
-						$this->_template_path = $this->Module_Request_Router->get_view( $route );
520
+						$this->_template_path = $this->Module_Request_Router->get_view($route);
521 521
 						// grab module name
522 522
 						$module_name = $module->module_name();
523 523
 						// map the module to the module objects
@@ -559,29 +559,29 @@  discard block
 block discarded – undo
559 559
 	public function wp_enqueue_scripts() {
560 560
 
561 561
 		// css is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF  via:  add_filter( 'FHEE_load_css', '__return_false' );
562
-		if ( apply_filters( 'FHEE_load_css', TRUE ) ) {
562
+		if (apply_filters('FHEE_load_css', TRUE)) {
563 563
 
564 564
 			$this->Registry->CFG->template_settings->enable_default_style = TRUE;
565 565
 			//Load the ThemeRoller styles if enabled
566
-			if ( isset( $this->Registry->CFG->template_settings->enable_default_style ) && $this->Registry->CFG->template_settings->enable_default_style ) {
566
+			if (isset($this->Registry->CFG->template_settings->enable_default_style) && $this->Registry->CFG->template_settings->enable_default_style) {
567 567
 
568 568
 				//Load custom style sheet if available
569
-				if ( isset( $this->Registry->CFG->template_settings->custom_style_sheet )) {
570
-					wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->Registry->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION );
569
+				if (isset($this->Registry->CFG->template_settings->custom_style_sheet)) {
570
+					wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL.'css/'.$this->Registry->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION);
571 571
 					wp_enqueue_style('espresso_custom_css');
572 572
 				}
573 573
 
574
-				if ( is_readable( EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css' )) {
575
-					wp_register_style( 'espresso_default', EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION );
574
+				if (is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/style.css')) {
575
+					wp_register_style('espresso_default', EVENT_ESPRESSO_UPLOAD_DIR.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION);
576 576
 				} else {
577
-					wp_register_style( 'espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION );
577
+					wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION);
578 578
 				}
579 579
 				wp_enqueue_style('espresso_default');
580 580
 
581
-				if ( is_readable( get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'style.css' )) {
582
-					wp_register_style( 'espresso_style', get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
581
+				if (is_readable(get_stylesheet_directory().EE_Config::get_current_theme().DS.'style.css')) {
582
+					wp_register_style('espresso_style', get_stylesheet_directory_uri().EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default'));
583 583
 				} else {
584
-					wp_register_style( 'espresso_style', EE_TEMPLATES_URL . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
584
+					wp_register_style('espresso_style', EE_TEMPLATES_URL.EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default'));
585 585
 				}
586 586
 
587 587
 			}
@@ -589,38 +589,38 @@  discard block
 block discarded – undo
589 589
 		}
590 590
 
591 591
 		// js is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF  via:  add_filter( 'FHEE_load_js', '__return_false' );
592
-		if ( apply_filters( 'FHEE_load_js', TRUE ) ) {
592
+		if (apply_filters('FHEE_load_js', TRUE)) {
593 593
 
594
-			wp_enqueue_script( 'jquery' );
594
+			wp_enqueue_script('jquery');
595 595
 			//let's make sure that all required scripts have been setup
596
-			if ( function_exists( 'wp_script_is' ) && ! wp_script_is( 'jquery' )) {
596
+			if (function_exists('wp_script_is') && ! wp_script_is('jquery')) {
597 597
 				$msg = sprintf(
598
-					__( '%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso' ),
598
+					__('%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso'),
599 599
 					'<em><br />',
600 600
 					'</em>'
601 601
 				);
602
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
602
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
603 603
 			}
604 604
 			// load core js
605
-			wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
606
-			wp_enqueue_script( 'espresso_core' );
607
-			wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings );
605
+			wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
606
+			wp_enqueue_script('espresso_core');
607
+			wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings);
608 608
 
609 609
 		}
610 610
 
611 611
 		//qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' );
612
-		if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) {
612
+		if (apply_filters('FHEE_load_qtip', FALSE)) {
613 613
 			EEH_Qtip_Loader::instance()->register_and_enqueue();
614 614
 		}
615 615
 
616 616
 
617 617
 		//accounting.js library
618 618
 		// @link http://josscrowcroft.github.io/accounting.js/
619
-		if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) {
620
-			$acct_js = EE_THIRD_PARTY_URL . 'accounting/accounting.js';
621
-			wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE );
622
-			wp_register_script( 'ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE );
623
-			wp_enqueue_script( 'ee-accounting' );
619
+		if (apply_filters('FHEE_load_accounting_js', FALSE)) {
620
+			$acct_js = EE_THIRD_PARTY_URL.'accounting/accounting.js';
621
+			wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE);
622
+			wp_register_script('ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE);
623
+			wp_enqueue_script('ee-accounting');
624 624
 
625 625
 			$currency_config = array(
626 626
 				'currency' => array(
@@ -643,21 +643,21 @@  discard block
 block discarded – undo
643 643
 			wp_localize_script('ee-accounting', 'EE_ACCOUNTING_CFG', $currency_config);
644 644
 		}
645 645
 
646
-		if ( ! function_exists( 'wp_head' )) {
646
+		if ( ! function_exists('wp_head')) {
647 647
 			$msg = sprintf(
648
-				__( '%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ),
648
+				__('%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'),
649 649
 				'<em><br />',
650 650
 				'</em>'
651 651
 			);
652
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
652
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
653 653
 		}
654
-		if ( ! function_exists( 'wp_footer' )) {
654
+		if ( ! function_exists('wp_footer')) {
655 655
 			$msg = sprintf(
656
-				__( '%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ),
656
+				__('%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'),
657 657
 				'<em><br />',
658 658
 				'</em>'
659 659
 			);
660
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
660
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
661 661
 		}
662 662
 
663 663
 	}
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 	 *  @return 	void
672 672
 	 */
673 673
 	public function header_meta_tag() {
674
-		print( apply_filters("FHEE__EE_Front_Controller__header_meta_tag","<meta name='generator' content='Event Espresso Version " . EVENT_ESPRESSO_VERSION . "' />"));
674
+		print(apply_filters("FHEE__EE_Front_Controller__header_meta_tag", "<meta name='generator' content='Event Espresso Version ".EVENT_ESPRESSO_VERSION."' />"));
675 675
 	}
676 676
 
677 677
 
@@ -712,10 +712,10 @@  discard block
 block discarded – undo
712 712
 	 */
713 713
 	public function display_errors() {
714 714
 		static $shown_already = FALSE;
715
-		do_action( 'AHEE__EE_Front_Controller__display_errors__begin' );
715
+		do_action('AHEE__EE_Front_Controller__display_errors__begin');
716 716
 		if (
717 717
 			! $shown_already
718
-			&& apply_filters( 'FHEE__EE_Front_Controller__display_errors', TRUE )
718
+			&& apply_filters('FHEE__EE_Front_Controller__display_errors', TRUE)
719 719
 			&& is_main_query()
720 720
 			&& ! is_feed()
721 721
 			&& in_the_loop()
@@ -723,9 +723,9 @@  discard block
 block discarded – undo
723 723
 		) {
724 724
 			echo EE_Error::get_notices();
725 725
 			$shown_already = TRUE;
726
-			EEH_Template::display_template( EE_TEMPLATES . 'espresso-ajax-notices.template.php' );
726
+			EEH_Template::display_template(EE_TEMPLATES.'espresso-ajax-notices.template.php');
727 727
 		}
728
-		do_action( 'AHEE__EE_Front_Controller__display_errors__end' );
728
+		do_action('AHEE__EE_Front_Controller__display_errors__end');
729 729
 	}
730 730
 
731 731
 
@@ -740,12 +740,12 @@  discard block
 block discarded – undo
740 740
 	 * @param   string $template_include_path
741 741
 	 * @return    string
742 742
 	 */
743
-	public function template_include( $template_include_path = NULL ) {
744
-		if ( $this->Request_Handler->is_espresso_page() ) {
745
-			$this->_template_path = ! empty( $this->_template_path ) ? basename( $this->_template_path ) : basename( $template_include_path );
746
-			$template_path = EEH_Template::locate_template( $this->_template_path, array(), false );
747
-			$this->_template_path = ! empty( $template_path ) ? $template_path : $template_include_path;
748
-			$this->_template = basename( $this->_template_path );
743
+	public function template_include($template_include_path = NULL) {
744
+		if ($this->Request_Handler->is_espresso_page()) {
745
+			$this->_template_path = ! empty($this->_template_path) ? basename($this->_template_path) : basename($template_include_path);
746
+			$template_path = EEH_Template::locate_template($this->_template_path, array(), false);
747
+			$this->_template_path = ! empty($template_path) ? $template_path : $template_include_path;
748
+			$this->_template = basename($this->_template_path);
749 749
 			return $this->_template_path;
750 750
 		}
751 751
 		return $template_include_path;
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 	 * @param bool $with_path
761 761
 	 * @return    string
762 762
 	 */
763
-	public function get_selected_template( $with_path = FALSE ) {
763
+	public function get_selected_template($with_path = FALSE) {
764 764
 		return $with_path ? $this->_template_path : $this->_template;
765 765
 	}
766 766
 
Please login to merge, or discard this patch.