Completed
Branch FET-9795-new-interfaces (ea072c)
by
unknown
51:56 queued 35:16
created
core/EE_System.core.php 1 patch
Spacing   +269 added lines, -269 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\interfaces\ResettableInterface;
2 2
 
3
-if ( ! defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
4 4
 /**
5 5
  *
6 6
  * EE_System
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 	 * @param  \EE_Registry        $Registry
91 91
 	 * @return \EE_System
92 92
 	 */
93
-	public static function instance( EE_Registry $Registry = null ) {
93
+	public static function instance(EE_Registry $Registry = null) {
94 94
 		// check if class object is instantiated
95
-		if ( ! self::$_instance instanceof EE_System ) {
96
-			self::$_instance = new self( $Registry );
95
+		if ( ! self::$_instance instanceof EE_System) {
96
+			self::$_instance = new self($Registry);
97 97
 		}
98 98
 		return self::$_instance;
99 99
 	}
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
 	 * resets the instance and returns it
104 104
 	 * @return EE_System
105 105
 	 */
106
-	public static function reset(){
106
+	public static function reset() {
107 107
 		self::$_instance->_req_type = NULL;
108 108
 
109 109
 		//make sure none of the old hooks are left hanging around
110
-		remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' );
110
+		remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations');
111 111
 
112 112
 		//we need to reset the migration manager in order for it to detect DMSs properly
113 113
 		EE_Data_Migration_Manager::reset();
@@ -127,28 +127,28 @@  discard block
 block discarded – undo
127 127
 	 * @access private
128 128
 	 * @param  \EE_Registry        $Registry
129 129
 	 */
130
-	private function __construct( EE_Registry $Registry ) {
130
+	private function __construct(EE_Registry $Registry) {
131 131
 		$this->registry = $Registry;
132
-		do_action( 'AHEE__EE_System__construct__begin', $this );
132
+		do_action('AHEE__EE_System__construct__begin', $this);
133 133
 		// allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc
134
-		add_action( 'AHEE__EE_Bootstrap__load_espresso_addons', array( $this, 'load_espresso_addons' ) );
134
+		add_action('AHEE__EE_Bootstrap__load_espresso_addons', array($this, 'load_espresso_addons'));
135 135
 		// when an ee addon is activated, we want to call the core hook(s) again
136 136
 		// because the newly-activated addon didn't get a chance to run at all
137
-		add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 );
137
+		add_action('activate_plugin', array($this, 'load_espresso_addons'), 1);
138 138
 		// detect whether install or upgrade
139
-		add_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', array( $this, 'detect_activations_or_upgrades' ), 3 );
139
+		add_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades', array($this, 'detect_activations_or_upgrades'), 3);
140 140
 		// load EE_Config, EE_Textdomain, etc
141
-		add_action( 'AHEE__EE_Bootstrap__load_core_configuration', array( $this, 'load_core_configuration' ), 5 );
141
+		add_action('AHEE__EE_Bootstrap__load_core_configuration', array($this, 'load_core_configuration'), 5);
142 142
 		// load EE_Config, EE_Textdomain, etc
143
-		add_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 );
143
+		add_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_modules_and_widgets'), 7);
144 144
 		// you wanna get going? I wanna get going... let's get going!
145
-		add_action( 'AHEE__EE_Bootstrap__brew_espresso', array( $this, 'brew_espresso' ), 9 );
145
+		add_action('AHEE__EE_Bootstrap__brew_espresso', array($this, 'brew_espresso'), 9);
146 146
 		//other housekeeping
147 147
 		//exclude EE critical pages from wp_list_pages
148
-		add_filter( 'wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages' ), 10 );
148
+		add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10);
149 149
 		// ALL EE Addons should use the following hook point to attach their initial setup too
150 150
 		// it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads
151
-		do_action( 'AHEE__EE_System__construct__complete', $this );
151
+		do_action('AHEE__EE_System__construct__complete', $this);
152 152
 	}
153 153
 
154 154
 
@@ -168,30 +168,30 @@  discard block
 block discarded – undo
168 168
 	public function load_espresso_addons() {
169 169
 		// set autoloaders for all of the classes implementing EEI_Plugin_API
170 170
 		// which provide helpers for EE plugin authors to more easily register certain components with EE.
171
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' );
171
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api');
172 172
 		//load and setup EE_Capabilities
173
-		$this->registry->load_core( 'Capabilities' );
173
+		$this->registry->load_core('Capabilities');
174 174
 		//caps need to be initialized on every request so that capability maps are set.
175 175
 		//@see https://events.codebasehq.com/projects/event-espresso/tickets/8674
176 176
 		$this->registry->CAP->init_caps();
177
-		do_action( 'AHEE__EE_System__load_espresso_addons' );
177
+		do_action('AHEE__EE_System__load_espresso_addons');
178 178
 		//if the WP API basic auth plugin isn't already loaded, load it now.
179 179
 		//We want it for mobile apps. Just include the entire plugin
180 180
 		//also, don't load the basic auth when a plugin is getting activated, because
181 181
 		//it could be the basic auth plugin, and it doesn't check if its methods are already defined
182 182
 		//and causes a fatal error
183
-		if( !function_exists( 'json_basic_auth_handler' )
184
-			&& ! function_exists( 'json_basic_auth_error' )
183
+		if ( ! function_exists('json_basic_auth_handler')
184
+			&& ! function_exists('json_basic_auth_error')
185 185
 			&& ! (
186
-				isset( $_GET[ 'action'] )
187
-				&& in_array( $_GET[ 'action' ], array( 'activate', 'activate-selected' ) )
186
+				isset($_GET['action'])
187
+				&& in_array($_GET['action'], array('activate', 'activate-selected'))
188 188
 			)
189 189
 			&& ! (
190
-				isset( $_GET['activate' ] )
191
-				&& $_GET['activate' ] === 'true'
190
+				isset($_GET['activate'])
191
+				&& $_GET['activate'] === 'true'
192 192
 			)
193 193
 		) {
194
-			include_once EE_THIRD_PARTY . 'wp-api-basic-auth' . DS . 'basic-auth.php';
194
+			include_once EE_THIRD_PARTY.'wp-api-basic-auth'.DS.'basic-auth.php';
195 195
 		}
196 196
 	}
197 197
 
@@ -207,10 +207,10 @@  discard block
 block discarded – undo
207 207
 	 * @access public
208 208
 	 * @return void
209 209
 	 */
210
-	public function detect_activations_or_upgrades(){
210
+	public function detect_activations_or_upgrades() {
211 211
 		//first off: let's make sure to handle core
212 212
 		$this->detect_if_activation_or_upgrade();
213
-		foreach($this->registry->addons as $addon){
213
+		foreach ($this->registry->addons as $addon) {
214 214
 			//detect teh request type for that addon
215 215
 			$addon->detect_activation_or_upgrade();
216 216
 		}
@@ -231,41 +231,41 @@  discard block
 block discarded – undo
231 231
 		do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin');
232 232
 
233 233
 		// load M-Mode class
234
-		$this->registry->load_core( 'Maintenance_Mode' );
234
+		$this->registry->load_core('Maintenance_Mode');
235 235
 		// check if db has been updated, or if its a brand-new installation
236 236
 
237 237
 		$espresso_db_update = $this->fix_espresso_db_upgrade_option();
238
-		$request_type =  $this->detect_req_type($espresso_db_update);
238
+		$request_type = $this->detect_req_type($espresso_db_update);
239 239
 		//EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ );
240 240
 
241
-		switch($request_type){
241
+		switch ($request_type) {
242 242
 			case EE_System::req_type_new_activation:
243
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' );
244
-				$this->_handle_core_version_change( $espresso_db_update );
243
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation');
244
+				$this->_handle_core_version_change($espresso_db_update);
245 245
 				break;
246 246
 			case EE_System::req_type_reactivation:
247
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' );
248
-				$this->_handle_core_version_change( $espresso_db_update );
247
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation');
248
+				$this->_handle_core_version_change($espresso_db_update);
249 249
 				break;
250 250
 			case EE_System::req_type_upgrade:
251
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' );
251
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade');
252 252
 				//migrations may be required now that we've upgraded
253 253
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
254
-				$this->_handle_core_version_change( $espresso_db_update );
254
+				$this->_handle_core_version_change($espresso_db_update);
255 255
 //				echo "done upgrade";die;
256 256
 				break;
257 257
 			case EE_System::req_type_downgrade:
258
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' );
258
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade');
259 259
 				//its possible migrations are no longer required
260 260
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
261
-				$this->_handle_core_version_change( $espresso_db_update );
261
+				$this->_handle_core_version_change($espresso_db_update);
262 262
 				break;
263 263
 			case EE_System::req_type_normal:
264 264
 			default:
265 265
 //				$this->_maybe_redirect_to_ee_about();
266 266
 				break;
267 267
 		}
268
-		do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' );
268
+		do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete');
269 269
 	}
270 270
 
271 271
 	/**
@@ -273,10 +273,10 @@  discard block
 block discarded – undo
273 273
 	 * initializing the database later during the request
274 274
 	 * @param array $espresso_db_update
275 275
 	 */
276
-	protected function _handle_core_version_change( $espresso_db_update ){
277
-		$this->update_list_of_installed_versions( $espresso_db_update );
276
+	protected function _handle_core_version_change($espresso_db_update) {
277
+		$this->update_list_of_installed_versions($espresso_db_update);
278 278
 		//get ready to verify the DB is ok (provided we aren't in maintenance mode, of course)
279
-		add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' ));
279
+		add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required'));
280 280
 	}
281 281
 
282 282
 
@@ -291,44 +291,44 @@  discard block
 block discarded – undo
291 291
 	 * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table
292 292
 	 * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction
293 293
 	 */
294
-	private function fix_espresso_db_upgrade_option($espresso_db_update = null){
295
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update );
296
-		if( ! $espresso_db_update){
297
-			$espresso_db_update = get_option( 'espresso_db_update' );
294
+	private function fix_espresso_db_upgrade_option($espresso_db_update = null) {
295
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update);
296
+		if ( ! $espresso_db_update) {
297
+			$espresso_db_update = get_option('espresso_db_update');
298 298
 		}
299 299
 		// check that option is an array
300
-		if( ! is_array( $espresso_db_update )) {
300
+		if ( ! is_array($espresso_db_update)) {
301 301
 			// if option is FALSE, then it never existed
302
-			if ( $espresso_db_update === FALSE ) {
302
+			if ($espresso_db_update === FALSE) {
303 303
 				// make $espresso_db_update an array and save option with autoload OFF
304
-				$espresso_db_update =  array();
305
-				add_option( 'espresso_db_update', $espresso_db_update, '', 'no' );
304
+				$espresso_db_update = array();
305
+				add_option('espresso_db_update', $espresso_db_update, '', 'no');
306 306
 			} else {
307 307
 				// option is NOT FALSE but also is NOT an array, so make it an array and save it
308
-				$espresso_db_update =  array( $espresso_db_update=>array() );
309
-				update_option( 'espresso_db_update', $espresso_db_update );
308
+				$espresso_db_update = array($espresso_db_update=>array());
309
+				update_option('espresso_db_update', $espresso_db_update);
310 310
 			}
311
-		}else{
311
+		} else {
312 312
 			$corrected_db_update = array();
313 313
 			//if IS an array, but is it an array where KEYS are version numbers, and values are arrays?
314
-			foreach($espresso_db_update as $should_be_version_string => $should_be_array){
315
-				if(is_int($should_be_version_string) && ! is_array($should_be_array)){
314
+			foreach ($espresso_db_update as $should_be_version_string => $should_be_array) {
315
+				if (is_int($should_be_version_string) && ! is_array($should_be_array)) {
316 316
 					//the key is an int, and the value IS NOT an array
317 317
 					//so it must be numerically-indexed, where values are versions installed...
318 318
 					//fix it!
319 319
 					$version_string = $should_be_array;
320 320
 					$corrected_db_update[$version_string] = array('unknown-date');
321
-				}else{
321
+				} else {
322 322
 					//ok it checks out
323 323
 					$corrected_db_update[$should_be_version_string] = $should_be_array;
324 324
 				}
325 325
 			}
326 326
 			$espresso_db_update = $corrected_db_update;
327
-			update_option( 'espresso_db_update', $espresso_db_update );
327
+			update_option('espresso_db_update', $espresso_db_update);
328 328
 
329 329
 		}
330 330
 
331
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update );
331
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update);
332 332
 		return $espresso_db_update;
333 333
 	}
334 334
 
@@ -348,34 +348,34 @@  discard block
 block discarded – undo
348 348
 	 * so we prefer to only do it when necessary
349 349
 	 * @return void
350 350
 	 */
351
-	public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE, $verify_schema = true ){
351
+	public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true) {
352 352
 		$request_type = $this->detect_req_type();
353 353
 		//only initialize system if we're not in maintenance mode.
354
-		if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){
355
-			update_option( 'ee_flush_rewrite_rules', TRUE );
354
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
355
+			update_option('ee_flush_rewrite_rules', TRUE);
356 356
 
357
-			if( $verify_schema ) {
357
+			if ($verify_schema) {
358 358
 				EEH_Activation::initialize_db_and_folders();
359 359
 			}
360 360
 			EEH_Activation::initialize_db_content();
361 361
 			EEH_Activation::system_initialization();
362
-			if( $initialize_addons_too ) {
362
+			if ($initialize_addons_too) {
363 363
 				$this->initialize_addons();
364 364
 			}
365
-		}else{
366
-			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' );
365
+		} else {
366
+			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core');
367 367
 		}
368
-		if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) {
369
-			add_action( 'AHEE__EE_System__initialize_last', array( $this, 'redirect_to_about_ee' ), 9 );
368
+		if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) {
369
+			add_action('AHEE__EE_System__initialize_last', array($this, 'redirect_to_about_ee'), 9);
370 370
 		}
371 371
 	}
372 372
 
373 373
 	/**
374 374
 	 * Initializes the db for all registered addons
375 375
 	 */
376
-	public function initialize_addons(){
376
+	public function initialize_addons() {
377 377
 		//foreach registered addon, make sure its db is up-to-date too
378
-		foreach($this->registry->addons as $addon){
378
+		foreach ($this->registry->addons as $addon) {
379 379
 			$addon->initialize_db_if_no_migrations_required();
380 380
 		}
381 381
 	}
@@ -387,16 +387,16 @@  discard block
 block discarded – undo
387 387
 	 * @param 	string 	$current_version_to_add 	version to be added to the version history
388 388
 	 * @return 	boolean success as to whether or not this option was changed
389 389
 	 */
390
-	public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) {
391
-		if( ! $version_history ) {
390
+	public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) {
391
+		if ( ! $version_history) {
392 392
 			$version_history = $this->fix_espresso_db_upgrade_option($version_history);
393 393
 		}
394
-		if( $current_version_to_add == NULL){
394
+		if ($current_version_to_add == NULL) {
395 395
 			$current_version_to_add = espresso_version();
396 396
 		}
397
-		$version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() );
397
+		$version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time());
398 398
 		// re-save
399
-		return update_option( 'espresso_db_update', $version_history );
399
+		return update_option('espresso_db_update', $version_history);
400 400
 	}
401 401
 
402 402
 
@@ -413,10 +413,10 @@  discard block
 block discarded – undo
413 413
 	 *                            but still know if this is a new install or not
414 414
 	 * @return int one of the constants on EE_System::req_type_
415 415
 	 */
416
-	public function detect_req_type( $espresso_db_update = NULL ){
417
-		if ( $this->_req_type === NULL ){
418
-			$espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
419
-			$this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() );
416
+	public function detect_req_type($espresso_db_update = NULL) {
417
+		if ($this->_req_type === NULL) {
418
+			$espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
419
+			$this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version());
420 420
 		}
421 421
 		return $this->_req_type;
422 422
 	}
@@ -432,39 +432,39 @@  discard block
 block discarded – undo
432 432
 	 * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version())
433 433
 	 * @return int one of the constants on EE_System::req_type_*
434 434
 	 */
435
-	public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){
436
-		$version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to );
437
-		if( $activation_history_for_addon ){
435
+	public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) {
436
+		$version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to);
437
+		if ($activation_history_for_addon) {
438 438
 			//it exists, so this isn't a completely new install
439 439
 			//check if this version already in that list of previously installed versions
440
-			if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) {
440
+			if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) {
441 441
 				//it a version we haven't seen before
442
-				if( $version_is_higher === 1 ){
442
+				if ($version_is_higher === 1) {
443 443
 					$req_type = EE_System::req_type_upgrade;
444
-				}else{
444
+				} else {
445 445
 					$req_type = EE_System::req_type_downgrade;
446 446
 				}
447
-				delete_option( $activation_indicator_option_name );
447
+				delete_option($activation_indicator_option_name);
448 448
 			} else {
449 449
 				// its not an update. maybe a reactivation?
450
-				if( get_option( $activation_indicator_option_name, FALSE ) ){
451
-					if ( $version_is_higher === -1 ){
450
+				if (get_option($activation_indicator_option_name, FALSE)) {
451
+					if ($version_is_higher === -1) {
452 452
 						$req_type = EE_System::req_type_downgrade;
453
-					}elseif( $version_is_higher === 0 ){
453
+					}elseif ($version_is_higher === 0) {
454 454
 						//we've seen this version before, but it's an activation. must be a reactivation
455 455
 						$req_type = EE_System::req_type_reactivation;
456
-					}else{//$version_is_higher === 1
456
+					} else {//$version_is_higher === 1
457 457
 						$req_type = EE_System::req_type_upgrade;
458 458
 					}
459
-					delete_option( $activation_indicator_option_name );
459
+					delete_option($activation_indicator_option_name);
460 460
 				} else {
461 461
 					//we've seen this version before and the activation indicate doesn't show it was just activated
462
-					if ( $version_is_higher === -1 ){
462
+					if ($version_is_higher === -1) {
463 463
 						$req_type = EE_System::req_type_downgrade;
464
-					}elseif( $version_is_higher === 0 ){
464
+					}elseif ($version_is_higher === 0) {
465 465
 						//we've seen this version before and it's not an activation. its normal request
466 466
 						$req_type = EE_System::req_type_normal;
467
-					}else{//$version_is_higher === 1
467
+					} else {//$version_is_higher === 1
468 468
 						$req_type = EE_System::req_type_upgrade;
469 469
 					}
470 470
 				}
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 		} else {
473 473
 			//brand new install
474 474
 			$req_type = EE_System::req_type_new_activation;
475
-			delete_option( $activation_indicator_option_name );
475
+			delete_option($activation_indicator_option_name);
476 476
 		}
477 477
 		return $req_type;
478 478
 	}
@@ -490,30 +490,30 @@  discard block
 block discarded – undo
490 490
 	 *		0 if $version_to_upgrade_to MATCHES (reactivation or normal request);
491 491
 	 *		1 if $version_to_upgrade_to is HIGHER (upgrade) ;
492 492
 	 */
493
-	protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){
493
+	protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) {
494 494
 		//find the most recently-activated version
495 495
 		$most_recently_active_version_activation = '1970-01-01 00:00:00';
496 496
 		$most_recently_active_version = '0.0.0.dev.000';
497
-		if( is_array( $activation_history_for_addon ) ){
498
-			foreach( $activation_history_for_addon as $version => $times_activated ){
497
+		if (is_array($activation_history_for_addon)) {
498
+			foreach ($activation_history_for_addon as $version => $times_activated) {
499 499
 				//check there is a record of when this version was activated. Otherwise,
500 500
 				//mark it as unknown
501
-				if( ! $times_activated ){
502
-					$times_activated = array( 'unknown-date');
501
+				if ( ! $times_activated) {
502
+					$times_activated = array('unknown-date');
503 503
 				}
504
-				if( is_string( $times_activated ) ){
505
-					$times_activated = array( $times_activated );
504
+				if (is_string($times_activated)) {
505
+					$times_activated = array($times_activated);
506 506
 				}
507
-				foreach( $times_activated as $an_activation ){
508
-					if( $an_activation != 'unknown-date' &&
509
-							$an_activation > $most_recently_active_version_activation  ){
507
+				foreach ($times_activated as $an_activation) {
508
+					if ($an_activation != 'unknown-date' &&
509
+							$an_activation > $most_recently_active_version_activation) {
510 510
 						$most_recently_active_version = $version;
511 511
 						$most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation;
512 512
 					}
513 513
 				}
514 514
 			}
515 515
 		}
516
-		return version_compare( $version_to_upgrade_to, $most_recently_active_version );
516
+		return version_compare($version_to_upgrade_to, $most_recently_active_version);
517 517
 	}
518 518
 
519 519
 
@@ -523,24 +523,24 @@  discard block
 block discarded – undo
523 523
 	 * @return void
524 524
 	 */
525 525
 	public function redirect_to_about_ee() {
526
-		$notices = EE_Error::get_notices( FALSE );
526
+		$notices = EE_Error::get_notices(FALSE);
527 527
 		//if current user is an admin and it's not an ajax request
528 528
 		if (
529
-			$this->registry->CAP->current_user_can( 'manage_options', 'espresso_about_default' )
530
-			&& ! ( defined( 'DOING_AJAX' ) && DOING_AJAX )
531
-			&& ! isset( $notices[ 'errors' ] )
529
+			$this->registry->CAP->current_user_can('manage_options', 'espresso_about_default')
530
+			&& ! (defined('DOING_AJAX') && DOING_AJAX)
531
+			&& ! isset($notices['errors'])
532 532
 		) {
533
-			$query_params =  array( 'page' => 'espresso_about' );
533
+			$query_params = array('page' => 'espresso_about');
534 534
 
535
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) {
535
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) {
536 536
 			    $query_params['new_activation'] = TRUE;
537 537
 			}
538 538
 
539
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) {
539
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) {
540 540
 			    $query_params['reactivation'] = TRUE;
541 541
 			}
542
-			$url = add_query_arg( $query_params, admin_url( 'admin.php' ) );
543
-			wp_safe_redirect( $url );
542
+			$url = add_query_arg($query_params, admin_url('admin.php'));
543
+			wp_safe_redirect($url);
544 544
 			exit();
545 545
 		}
546 546
 	}
@@ -554,31 +554,31 @@  discard block
 block discarded – undo
554 554
 	 *
555 555
 	 * @return void
556 556
 	 */
557
-	public function load_core_configuration(){
558
-		do_action( 'AHEE__EE_System__load_core_configuration__begin', $this );
559
-		$this->registry->load_core( 'EE_Load_Textdomain' );
557
+	public function load_core_configuration() {
558
+		do_action('AHEE__EE_System__load_core_configuration__begin', $this);
559
+		$this->registry->load_core('EE_Load_Textdomain');
560 560
 		//load textdomain
561 561
 		EE_Load_Textdomain::load_textdomain();
562 562
 		// load and setup EE_Config and EE_Network_Config
563
-		$this->registry->load_core( 'Config' );
564
-		$this->registry->load_core( 'Network_Config' );
563
+		$this->registry->load_core('Config');
564
+		$this->registry->load_core('Network_Config');
565 565
 		// setup autoloaders
566 566
 		// enable logging?
567
-		if ( $this->registry->CFG->admin->use_full_logging ) {
568
-			$this->registry->load_core( 'Log' );
567
+		if ($this->registry->CFG->admin->use_full_logging) {
568
+			$this->registry->load_core('Log');
569 569
 		}
570 570
 		// check for activation errors
571
-		$activation_errors = get_option( 'ee_plugin_activation_errors', FALSE );
572
-		if ( $activation_errors ) {
573
-			EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ );
574
-			update_option( 'ee_plugin_activation_errors', FALSE );
571
+		$activation_errors = get_option('ee_plugin_activation_errors', FALSE);
572
+		if ($activation_errors) {
573
+			EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__);
574
+			update_option('ee_plugin_activation_errors', FALSE);
575 575
 		}
576 576
 		// get model names
577 577
 		$this->_parse_model_names();
578 578
 
579 579
 		//load caf stuff a chance to play during the activation process too.
580 580
 		$this->_maybe_brew_regular();
581
-		do_action( 'AHEE__EE_System__load_core_configuration__complete', $this );
581
+		do_action('AHEE__EE_System__load_core_configuration__complete', $this);
582 582
 	}
583 583
 
584 584
 
@@ -587,23 +587,23 @@  discard block
 block discarded – undo
587 587
 	 *
588 588
 	 * @return void
589 589
 	 */
590
-	private function _parse_model_names(){
590
+	private function _parse_model_names() {
591 591
 		//get all the files in the EE_MODELS folder that end in .model.php
592
-		$models = glob( EE_MODELS.'*.model.php');
592
+		$models = glob(EE_MODELS.'*.model.php');
593 593
 		$model_names = array();
594 594
 		$non_abstract_db_models = array();
595
-		foreach( $models as $model ){
595
+		foreach ($models as $model) {
596 596
 			// get model classname
597
-			$classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model );
598
-			$short_name = str_replace( 'EEM_', '', $classname );
597
+			$classname = EEH_File::get_classname_from_filepath_with_standard_filename($model);
598
+			$short_name = str_replace('EEM_', '', $classname);
599 599
 			$reflectionClass = new ReflectionClass($classname);
600
-			if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){
601
-				$non_abstract_db_models[ $short_name ] = $classname;
600
+			if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) {
601
+				$non_abstract_db_models[$short_name] = $classname;
602 602
 			}
603
-			$model_names[ $short_name ] = $classname;
603
+			$model_names[$short_name] = $classname;
604 604
 		}
605
-		$this->registry->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names );
606
-		$this->registry->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models );
605
+		$this->registry->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names);
606
+		$this->registry->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models);
607 607
 	}
608 608
 
609 609
 
@@ -613,8 +613,8 @@  discard block
 block discarded – undo
613 613
 	 * @return void
614 614
 	 */
615 615
 	private function _maybe_brew_regular() {
616
-		if (( ! defined( 'EE_DECAF' ) ||  EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) {
617
-			require_once EE_CAFF_PATH . 'brewing_regular.php';
616
+		if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) {
617
+			require_once EE_CAFF_PATH.'brewing_regular.php';
618 618
 		}
619 619
 	}
620 620
 
@@ -631,9 +631,9 @@  discard block
 block discarded – undo
631 631
 	 * @return void
632 632
 	 */
633 633
 	public function register_shortcodes_modules_and_widgets() {
634
-		do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' );
634
+		do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets');
635 635
 		// check for addons using old hookpoint
636
-		if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) {
636
+		if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) {
637 637
 			$this->_incompatible_addon_error();
638 638
 		}
639 639
 	}
@@ -647,19 +647,19 @@  discard block
 block discarded – undo
647 647
 	*/
648 648
 	private function _incompatible_addon_error() {
649 649
 		// get array of classes hooking into here
650
-		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' );
651
-		if ( ! empty( $class_names )) {
652
-			$msg = __( 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso' );
650
+		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons');
651
+		if ( ! empty($class_names)) {
652
+			$msg = __('The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso');
653 653
 			$msg .= '<ul>';
654
-			foreach ( $class_names as $class_name ) {
655
-				$msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>';
654
+			foreach ($class_names as $class_name) {
655
+				$msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>';
656 656
 			}
657 657
 			$msg .= '</ul>';
658
-			$msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' );
658
+			$msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso');
659 659
 			// save list of incompatible addons to wp-options for later use
660
-			add_option( 'ee_incompatible_addons', $class_names, '', 'no' );
661
-			if ( is_admin() ) {
662
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
660
+			add_option('ee_incompatible_addons', $class_names, '', 'no');
661
+			if (is_admin()) {
662
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
663 663
 			}
664 664
 		}
665 665
 	}
@@ -676,26 +676,26 @@  discard block
 block discarded – undo
676 676
 	 *
677 677
 	 * @return void
678 678
 	 */
679
-	public function brew_espresso(){
680
-		do_action( 'AHEE__EE_System__brew_espresso__begin', $this );
679
+	public function brew_espresso() {
680
+		do_action('AHEE__EE_System__brew_espresso__begin', $this);
681 681
 		// load some final core systems
682
-		add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 );
683
-		add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 );
684
-		add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 );
685
-		add_action( 'init', array( $this, 'load_controllers' ), 7 );
686
-		add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 );
687
-		add_action( 'init', array( $this, 'initialize' ), 10 );
688
-		add_action( 'init', array( $this, 'initialize_last' ), 100 );
689
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 );
690
-		add_action('admin_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 );
691
-		add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 );
692
-
693
-		if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE )  ) {
682
+		add_action('init', array($this, 'set_hooks_for_core'), 1);
683
+		add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3);
684
+		add_action('init', array($this, 'load_CPTs_and_session'), 5);
685
+		add_action('init', array($this, 'load_controllers'), 7);
686
+		add_action('init', array($this, 'core_loaded_and_ready'), 9);
687
+		add_action('init', array($this, 'initialize'), 10);
688
+		add_action('init', array($this, 'initialize_last'), 100);
689
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25);
690
+		add_action('admin_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25);
691
+		add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100);
692
+
693
+		if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) {
694 694
 			// pew pew pew
695
-			$this->registry->load_core( 'PUE' );
696
-			do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' );
695
+			$this->registry->load_core('PUE');
696
+			do_action('AHEE__EE_System__brew_espresso__after_pue_init');
697 697
 		}
698
-		do_action( 'AHEE__EE_System__brew_espresso__complete', $this );
698
+		do_action('AHEE__EE_System__brew_espresso__complete', $this);
699 699
 	}
700 700
 
701 701
 
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 	 */
710 710
 	public function set_hooks_for_core() {
711 711
 		$this->_deactivate_incompatible_addons();
712
-		do_action( 'AHEE__EE_System__set_hooks_for_core' );
712
+		do_action('AHEE__EE_System__set_hooks_for_core');
713 713
 	}
714 714
 
715 715
 
@@ -718,15 +718,15 @@  discard block
 block discarded – undo
718 718
 	 * Using the information gathered in EE_System::_incompatible_addon_error,
719 719
 	 * deactivates any addons considered incompatible with the current version of EE
720 720
 	 */
721
-	private function _deactivate_incompatible_addons(){
722
-		$incompatible_addons = get_option( 'ee_incompatible_addons', array() );
723
-		if ( ! empty( $incompatible_addons )) {
724
-			$active_plugins = get_option( 'active_plugins', array() );
725
-			foreach ( $active_plugins as $active_plugin ) {
726
-				foreach ( $incompatible_addons as $incompatible_addon ) {
727
-					if ( strpos( $active_plugin,  $incompatible_addon ) !== FALSE ) {
728
-						unset( $_GET['activate'] );
729
-						espresso_deactivate_plugin( $active_plugin );
721
+	private function _deactivate_incompatible_addons() {
722
+		$incompatible_addons = get_option('ee_incompatible_addons', array());
723
+		if ( ! empty($incompatible_addons)) {
724
+			$active_plugins = get_option('active_plugins', array());
725
+			foreach ($active_plugins as $active_plugin) {
726
+				foreach ($incompatible_addons as $incompatible_addon) {
727
+					if (strpos($active_plugin, $incompatible_addon) !== FALSE) {
728
+						unset($_GET['activate']);
729
+						espresso_deactivate_plugin($active_plugin);
730 730
 					}
731 731
 				}
732 732
 			}
@@ -743,10 +743,10 @@  discard block
 block discarded – undo
743 743
 	 */
744 744
 	public function perform_activations_upgrades_and_migrations() {
745 745
 		//first check if we had previously attempted to setup EE's directories but failed
746
-		if( EEH_Activation::upload_directories_incomplete() ) {
746
+		if (EEH_Activation::upload_directories_incomplete()) {
747 747
 			EEH_Activation::create_upload_directories();
748 748
 		}
749
-		do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' );
749
+		do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations');
750 750
 	}
751 751
 
752 752
 
@@ -758,10 +758,10 @@  discard block
 block discarded – undo
758 758
 	 *  	@return 	void
759 759
 	 */
760 760
 	public function load_CPTs_and_session() {
761
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__start' );
761
+		do_action('AHEE__EE_System__load_CPTs_and_session__start');
762 762
 		// register Custom Post Types
763
-		$this->registry->load_core( 'Register_CPTs' );
764
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' );
763
+		$this->registry->load_core('Register_CPTs');
764
+		do_action('AHEE__EE_System__load_CPTs_and_session__complete');
765 765
 	}
766 766
 
767 767
 
@@ -776,16 +776,16 @@  discard block
 block discarded – undo
776 776
 	* @return void
777 777
 	*/
778 778
 	public function load_controllers() {
779
-		do_action( 'AHEE__EE_System__load_controllers__start' );
779
+		do_action('AHEE__EE_System__load_controllers__start');
780 780
 		// let's get it started
781
-		if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level() ) {
782
-			do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' );
783
-			$this->registry->load_core( 'Front_Controller', array(), false, true );
784
-		} else if ( ! EE_FRONT_AJAX ) {
785
-			do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' );
786
-			EE_Registry::instance()->load_core( 'Admin' );
781
+		if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) {
782
+			do_action('AHEE__EE_System__load_controllers__load_front_controllers');
783
+			$this->registry->load_core('Front_Controller', array(), false, true);
784
+		} else if ( ! EE_FRONT_AJAX) {
785
+			do_action('AHEE__EE_System__load_controllers__load_admin_controllers');
786
+			EE_Registry::instance()->load_core('Admin');
787 787
 		}
788
-		do_action( 'AHEE__EE_System__load_controllers__complete' );
788
+		do_action('AHEE__EE_System__load_controllers__complete');
789 789
 	}
790 790
 
791 791
 
@@ -799,9 +799,9 @@  discard block
 block discarded – undo
799 799
 	* @return void
800 800
 	*/
801 801
 	public function core_loaded_and_ready() {
802
-		do_action( 'AHEE__EE_System__core_loaded_and_ready' );
803
-		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
804
-		$this->registry->load_core( 'Session' );
802
+		do_action('AHEE__EE_System__core_loaded_and_ready');
803
+		do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons');
804
+		$this->registry->load_core('Session');
805 805
 		//		add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 );
806 806
 	}
807 807
 
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
 	* @return void
817 817
 	*/
818 818
 	public function initialize() {
819
-		do_action( 'AHEE__EE_System__initialize' );
819
+		do_action('AHEE__EE_System__initialize');
820 820
 	}
821 821
 
822 822
 
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 	* @return void
831 831
 	*/
832 832
 	public function initialize_last() {
833
-		do_action( 'AHEE__EE_System__initialize_last' );
833
+		do_action('AHEE__EE_System__initialize_last');
834 834
 	}
835 835
 
836 836
 
@@ -862,21 +862,21 @@  discard block
 block discarded – undo
862 862
 	*/
863 863
 	public static function do_not_cache() {
864 864
 		// set no cache constants
865
-		if ( ! defined( 'DONOTCACHEPAGE' ) ) {
866
-			define( 'DONOTCACHEPAGE', true );
865
+		if ( ! defined('DONOTCACHEPAGE')) {
866
+			define('DONOTCACHEPAGE', true);
867 867
 		}
868
-		if ( ! defined( 'DONOTCACHCEOBJECT' ) ) {
869
-			define( 'DONOTCACHCEOBJECT', true );
868
+		if ( ! defined('DONOTCACHCEOBJECT')) {
869
+			define('DONOTCACHCEOBJECT', true);
870 870
 		}
871
-		if ( ! defined( 'DONOTCACHEDB' ) ) {
872
-			define( 'DONOTCACHEDB', true );
871
+		if ( ! defined('DONOTCACHEDB')) {
872
+			define('DONOTCACHEDB', true);
873 873
 		}
874 874
 		// add no cache headers
875
-		add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 );
875
+		add_action('send_headers', array('EE_System', 'nocache_headers'), 10);
876 876
 		// plus a little extra for nginx and Google Chrome
877
-		add_filter( 'nocache_headers', array( 'EE_System', 'extra_nocache_headers' ), 10, 1 );
877
+		add_filter('nocache_headers', array('EE_System', 'extra_nocache_headers'), 10, 1);
878 878
 		// prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process
879
-		remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' );
879
+		remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
880 880
 	}
881 881
 
882 882
 
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 	 * @param $headers
889 889
 	 * @return    array
890 890
 	 */
891
-	public static function extra_nocache_headers ( $headers ) {
891
+	public static function extra_nocache_headers($headers) {
892 892
 		// for NGINX
893 893
 		$headers['X-Accel-Expires'] = 0;
894 894
 		// plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store"
@@ -917,14 +917,14 @@  discard block
 block discarded – undo
917 917
 	 * @param  WP_Admin_Bar $admin_bar
918 918
 	 * @return void
919 919
 	 */
920
-	public function espresso_toolbar_items( WP_Admin_Bar $admin_bar ) {
920
+	public function espresso_toolbar_items(WP_Admin_Bar $admin_bar) {
921 921
 
922 922
 		// if in full M-Mode, or its an AJAX request, or user is NOT an admin
923
-		if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) {
923
+		if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! $this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) {
924 924
 			return;
925 925
 		}
926 926
 
927
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
927
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
928 928
 		$menu_class = 'espresso_menu_item_class';
929 929
 		//we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL
930 930
 		//because they're only defined in each of their respective constructors
@@ -936,20 +936,20 @@  discard block
 block discarded – undo
936 936
 		//Top Level
937 937
 		$admin_bar->add_menu(array(
938 938
 				'id' => 'espresso-toolbar',
939
-				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">' . _x('Event Espresso', 'admin bar menu group label', 'event_espresso') . '</span>',
939
+				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'._x('Event Espresso', 'admin bar menu group label', 'event_espresso').'</span>',
940 940
 				'href' => $events_admin_url,
941 941
 				'meta' => array(
942 942
 						'title' => __('Event Espresso', 'event_espresso'),
943
-						'class' => $menu_class . 'first'
943
+						'class' => $menu_class.'first'
944 944
 				),
945 945
 		));
946 946
 
947 947
 		//Events
948
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) {
948
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) {
949 949
 			$admin_bar->add_menu(array(
950 950
 					'id' => 'espresso-toolbar-events',
951 951
 					'parent' => 'espresso-toolbar',
952
-					'title' => __( 'Events', 'event_espresso' ),
952
+					'title' => __('Events', 'event_espresso'),
953 953
 					'href' => $events_admin_url,
954 954
 					'meta' => array(
955 955
 							'title' => __('Events', 'event_espresso'),
@@ -960,13 +960,13 @@  discard block
 block discarded – undo
960 960
 		}
961 961
 
962 962
 
963
-		if ( $this->registry->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) {
963
+		if ($this->registry->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) {
964 964
 			//Events Add New
965 965
 			$admin_bar->add_menu(array(
966 966
 					'id' => 'espresso-toolbar-events-new',
967 967
 					'parent' => 'espresso-toolbar-events',
968 968
 					'title' => __('Add New', 'event_espresso'),
969
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ),
969
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url),
970 970
 					'meta' => array(
971 971
 							'title' => __('Add New', 'event_espresso'),
972 972
 							'target' => '',
@@ -975,18 +975,18 @@  discard block
 block discarded – undo
975 975
 			));
976 976
 		}
977 977
 
978
-		if ( is_single() && ( get_post_type() == 'espresso_events' ) ) {
978
+		if (is_single() && (get_post_type() == 'espresso_events')) {
979 979
 
980 980
 			//Current post
981 981
 			global $post;
982 982
 
983
-	    	if ( $this->registry->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) {
983
+	    	if ($this->registry->CAP->current_user_can('ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID)) {
984 984
 				//Events Edit Current Event
985 985
 				$admin_bar->add_menu(array(
986 986
 						'id' => 'espresso-toolbar-events-edit',
987 987
 						'parent' => 'espresso-toolbar-events',
988 988
 						'title' => __('Edit Event', 'event_espresso'),
989
-						'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$post->ID ), $events_admin_url ),
989
+						'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$post->ID), $events_admin_url),
990 990
 						'meta' => array(
991 991
 								'title' => __('Edit Event', 'event_espresso'),
992 992
 								'target' => '',
@@ -998,11 +998,11 @@  discard block
 block discarded – undo
998 998
 		}
999 999
 
1000 1000
 		//Events View
1001
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) {
1001
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) {
1002 1002
 			$admin_bar->add_menu(array(
1003 1003
 					'id' => 'espresso-toolbar-events-view',
1004 1004
 					'parent' => 'espresso-toolbar-events',
1005
-					'title' => __( 'View', 'event_espresso' ),
1005
+					'title' => __('View', 'event_espresso'),
1006 1006
 					'href' => $events_admin_url,
1007 1007
 					'meta' => array(
1008 1008
 							'title' => __('View', 'event_espresso'),
@@ -1012,12 +1012,12 @@  discard block
 block discarded – undo
1012 1012
 			));
1013 1013
 		}
1014 1014
 
1015
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) {
1015
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) {
1016 1016
 			//Events View All
1017 1017
 			$admin_bar->add_menu(array(
1018 1018
 					'id' => 'espresso-toolbar-events-all',
1019 1019
 					'parent' => 'espresso-toolbar-events-view',
1020
-					'title' => __( 'All', 'event_espresso' ),
1020
+					'title' => __('All', 'event_espresso'),
1021 1021
 					'href' => $events_admin_url,
1022 1022
 					'meta' => array(
1023 1023
 							'title' => __('All', 'event_espresso'),
@@ -1028,13 +1028,13 @@  discard block
 block discarded – undo
1028 1028
 		}
1029 1029
 
1030 1030
 
1031
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) {
1031
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) {
1032 1032
 			//Events View Today
1033 1033
 			$admin_bar->add_menu(array(
1034 1034
 					'id' => 'espresso-toolbar-events-today',
1035 1035
 					'parent' => 'espresso-toolbar-events-view',
1036 1036
 					'title' => __('Today', 'event_espresso'),
1037
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ),
1037
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url),
1038 1038
 					'meta' => array(
1039 1039
 							'title' => __('Today', 'event_espresso'),
1040 1040
 							'target' => '',
@@ -1044,13 +1044,13 @@  discard block
 block discarded – undo
1044 1044
 		}
1045 1045
 
1046 1046
 
1047
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) {
1047
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) {
1048 1048
 			//Events View This Month
1049 1049
 			$admin_bar->add_menu(array(
1050 1050
 					'id' => 'espresso-toolbar-events-month',
1051 1051
 					'parent' => 'espresso-toolbar-events-view',
1052
-					'title' => __( 'This Month', 'event_espresso'),
1053
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ),
1052
+					'title' => __('This Month', 'event_espresso'),
1053
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url),
1054 1054
 					'meta' => array(
1055 1055
 							'title' => __('This Month', 'event_espresso'),
1056 1056
 							'target' => '',
@@ -1060,11 +1060,11 @@  discard block
 block discarded – undo
1060 1060
 		}
1061 1061
 
1062 1062
 		//Registration Overview
1063
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) {
1063
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) {
1064 1064
 			$admin_bar->add_menu(array(
1065 1065
 					'id' => 'espresso-toolbar-registrations',
1066 1066
 					'parent' => 'espresso-toolbar',
1067
-					'title' => __( 'Registrations', 'event_espresso' ),
1067
+					'title' => __('Registrations', 'event_espresso'),
1068 1068
 					'href' => $reg_admin_url,
1069 1069
 					'meta' => array(
1070 1070
 							'title' => __('Registrations', 'event_espresso'),
@@ -1075,12 +1075,12 @@  discard block
 block discarded – undo
1075 1075
 		}
1076 1076
 
1077 1077
 		//Registration Overview Today
1078
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) {
1078
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) {
1079 1079
 			$admin_bar->add_menu(array(
1080 1080
 					'id' => 'espresso-toolbar-registrations-today',
1081 1081
 					'parent' => 'espresso-toolbar-registrations',
1082
-					'title' => __( 'Today', 'event_espresso'),
1083
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ),
1082
+					'title' => __('Today', 'event_espresso'),
1083
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url),
1084 1084
 					'meta' => array(
1085 1085
 							'title' => __('Today', 'event_espresso'),
1086 1086
 							'target' => '',
@@ -1090,14 +1090,14 @@  discard block
 block discarded – undo
1090 1090
 		}
1091 1091
 
1092 1092
 		//Registration Overview Today Completed
1093
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) {
1093
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) {
1094 1094
 			$admin_bar->add_menu(array(
1095 1095
 					'id' => 'espresso-toolbar-registrations-today-approved',
1096 1096
 					'parent' => 'espresso-toolbar-registrations-today',
1097
-					'title' => __( 'Approved', 'event_espresso' ),
1098
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1097
+					'title' => __('Approved', 'event_espresso'),
1098
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1099 1099
 					'meta' => array(
1100
-							'title' => __('Approved', 'event_espresso' ),
1100
+							'title' => __('Approved', 'event_espresso'),
1101 1101
 							'target' => '',
1102 1102
 							'class' => $menu_class
1103 1103
 					),
@@ -1105,14 +1105,14 @@  discard block
 block discarded – undo
1105 1105
 		}
1106 1106
 
1107 1107
 		//Registration Overview Today Pending\
1108
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) {
1108
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) {
1109 1109
 			$admin_bar->add_menu(array(
1110 1110
 					'id' => 'espresso-toolbar-registrations-today-pending',
1111 1111
 					'parent' => 'espresso-toolbar-registrations-today',
1112
-					'title' => __( 'Pending', 'event_espresso' ),
1113
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1112
+					'title' => __('Pending', 'event_espresso'),
1113
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1114 1114
 					'meta' => array(
1115
-							'title' => __('Pending Payment', 'event_espresso' ),
1115
+							'title' => __('Pending Payment', 'event_espresso'),
1116 1116
 							'target' => '',
1117 1117
 							'class' => $menu_class
1118 1118
 					),
@@ -1120,14 +1120,14 @@  discard block
 block discarded – undo
1120 1120
 		}
1121 1121
 
1122 1122
 		//Registration Overview Today Incomplete
1123
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) {
1123
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) {
1124 1124
 			$admin_bar->add_menu(array(
1125 1125
 					'id' => 'espresso-toolbar-registrations-today-not-approved',
1126 1126
 					'parent' => 'espresso-toolbar-registrations-today',
1127
-					'title' => __( 'Not Approved', 'event_espresso' ),
1128
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1127
+					'title' => __('Not Approved', 'event_espresso'),
1128
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1129 1129
 					'meta' => array(
1130
-							'title' => __('Not Approved', 'event_espresso' ),
1130
+							'title' => __('Not Approved', 'event_espresso'),
1131 1131
 							'target' => '',
1132 1132
 							'class' => $menu_class
1133 1133
 					),
@@ -1135,12 +1135,12 @@  discard block
 block discarded – undo
1135 1135
 		}
1136 1136
 
1137 1137
 		//Registration Overview Today Incomplete
1138
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) {
1138
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) {
1139 1139
 			$admin_bar->add_menu(array(
1140 1140
 					'id' => 'espresso-toolbar-registrations-today-cancelled',
1141 1141
 					'parent' => 'espresso-toolbar-registrations-today',
1142
-					'title' => __( 'Cancelled', 'event_espresso'),
1143
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1142
+					'title' => __('Cancelled', 'event_espresso'),
1143
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1144 1144
 					'meta' => array(
1145 1145
 							'title' => __('Cancelled', 'event_espresso'),
1146 1146
 							'target' => '',
@@ -1150,12 +1150,12 @@  discard block
 block discarded – undo
1150 1150
 		}
1151 1151
 
1152 1152
 		//Registration Overview This Month
1153
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) {
1153
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) {
1154 1154
 			$admin_bar->add_menu(array(
1155 1155
 					'id' => 'espresso-toolbar-registrations-month',
1156 1156
 					'parent' => 'espresso-toolbar-registrations',
1157
-					'title' => __( 'This Month', 'event_espresso' ),
1158
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ),
1157
+					'title' => __('This Month', 'event_espresso'),
1158
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url),
1159 1159
 					'meta' => array(
1160 1160
 							'title' => __('This Month', 'event_espresso'),
1161 1161
 							'target' => '',
@@ -1165,12 +1165,12 @@  discard block
 block discarded – undo
1165 1165
 		}
1166 1166
 
1167 1167
 		//Registration Overview This Month Approved
1168
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) {
1168
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) {
1169 1169
 			$admin_bar->add_menu(array(
1170 1170
 					'id' => 'espresso-toolbar-registrations-month-approved',
1171 1171
 					'parent' => 'espresso-toolbar-registrations-month',
1172
-					'title' => __( 'Approved', 'event_espresso' ),
1173
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1172
+					'title' => __('Approved', 'event_espresso'),
1173
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1174 1174
 					'meta' => array(
1175 1175
 							'title' => __('Approved', 'event_espresso'),
1176 1176
 							'target' => '',
@@ -1180,12 +1180,12 @@  discard block
 block discarded – undo
1180 1180
 		}
1181 1181
 
1182 1182
 		//Registration Overview This Month Pending
1183
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) {
1183
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) {
1184 1184
 			$admin_bar->add_menu(array(
1185 1185
 					'id' => 'espresso-toolbar-registrations-month-pending',
1186 1186
 					'parent' => 'espresso-toolbar-registrations-month',
1187
-					'title' => __( 'Pending', 'event_espresso'),
1188
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1187
+					'title' => __('Pending', 'event_espresso'),
1188
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1189 1189
 					'meta' => array(
1190 1190
 							'title' => __('Pending', 'event_espresso'),
1191 1191
 							'target' => '',
@@ -1195,14 +1195,14 @@  discard block
 block discarded – undo
1195 1195
 		}
1196 1196
 
1197 1197
 		//Registration Overview This Month Not Approved
1198
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) {
1198
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) {
1199 1199
 			$admin_bar->add_menu(array(
1200 1200
 					'id' => 'espresso-toolbar-registrations-month-not-approved',
1201 1201
 					'parent' => 'espresso-toolbar-registrations-month',
1202
-					'title' => __( 'Not Approved', 'event_espresso'),
1203
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1202
+					'title' => __('Not Approved', 'event_espresso'),
1203
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1204 1204
 					'meta' => array(
1205
-							'title' => __('Not Approved', 'event_espresso' ),
1205
+							'title' => __('Not Approved', 'event_espresso'),
1206 1206
 							'target' => '',
1207 1207
 							'class' => $menu_class
1208 1208
 					),
@@ -1211,12 +1211,12 @@  discard block
 block discarded – undo
1211 1211
 
1212 1212
 
1213 1213
 		//Registration Overview This Month Cancelled
1214
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) {
1214
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) {
1215 1215
 			$admin_bar->add_menu(array(
1216 1216
 					'id' => 'espresso-toolbar-registrations-month-cancelled',
1217 1217
 					'parent' => 'espresso-toolbar-registrations-month',
1218 1218
 					'title' => __('Cancelled', 'event_espresso'),
1219
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1219
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1220 1220
 					'meta' => array(
1221 1221
 							'title' => __('Cancelled', 'event_espresso'),
1222 1222
 							'target' => '',
@@ -1226,11 +1226,11 @@  discard block
 block discarded – undo
1226 1226
 		}
1227 1227
 
1228 1228
 		//Extensions & Services
1229
-		if ( $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services' ) ) {
1229
+		if ($this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services')) {
1230 1230
 			$admin_bar->add_menu(array(
1231 1231
 					'id' => 'espresso-toolbar-extensions-and-services',
1232 1232
 					'parent' => 'espresso-toolbar',
1233
-					'title' => __( 'Extensions & Services', 'event_espresso' ),
1233
+					'title' => __('Extensions & Services', 'event_espresso'),
1234 1234
 					'href' => $extensions_admin_url,
1235 1235
 					'meta' => array(
1236 1236
 							'title' => __('Extensions & Services', 'event_espresso'),
@@ -1252,8 +1252,8 @@  discard block
 block discarded – undo
1252 1252
 	 * @param  array  $exclude_array any existing pages being excluded are in this array.
1253 1253
 	 * @return array
1254 1254
 	 */
1255
-	public function remove_pages_from_wp_list_pages( $exclude_array ) {
1256
-		return  array_merge( $exclude_array, $this->registry->CFG->core->get_critical_pages_array() );
1255
+	public function remove_pages_from_wp_list_pages($exclude_array) {
1256
+		return  array_merge($exclude_array, $this->registry->CFG->core->get_critical_pages_array());
1257 1257
 	}
1258 1258
 
1259 1259
 
@@ -1273,12 +1273,12 @@  discard block
 block discarded – undo
1273 1273
 	 */
1274 1274
 	public function wp_enqueue_scripts() {
1275 1275
 		// unlike other systems, EE_System_scripts loading is turned ON by default, but prior to the init hook, can be turned off via: add_filter( 'FHEE_load_EE_System_scripts', '__return_false' );
1276
-		if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) {
1276
+		if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) {
1277 1277
 			// jquery_validate loading is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via:  add_filter( 'FHEE_load_jquery_validate', '__return_true' );
1278
-			if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
1278
+			if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
1279 1279
 				// register jQuery Validate and additional methods
1280
-				wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery' ), '1.15.0', TRUE );
1281
-				wp_register_script( 'jquery-validate-extra-methods', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js', array( 'jquery', 'jquery-validate' ), '1.15.0', TRUE );
1280
+				wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
1281
+				wp_register_script('jquery-validate-extra-methods', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.additional-methods.min.js', array('jquery', 'jquery-validate'), '1.15.0', TRUE);
1282 1282
 			}
1283 1283
 		}
1284 1284
 	}
Please login to merge, or discard this patch.
core/admin/EE_Admin.core.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@
 block discarded – undo
1 1
 <?php use EventEspresso\core\interfaces\ResettableInterface;
2 2
 
3
-if ( ! defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
3
+if ( ! defined( 'EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5
+}
4 6
 /**
5 7
  * Event Espresso
6 8
  *
Please login to merge, or discard this patch.
core/EE_Payment_Processor.core.php 1 patch
Spacing   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\interfaces\ResettableInterface;
2 2
 
3
-if ( ! defined( 'EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
4
-EE_Registry::instance()->load_class( 'Processor_Base' );
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
4
+EE_Registry::instance()->load_class('Processor_Base');
5 5
 /**
6 6
  *
7 7
  * EE_Payment_Processor
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public static function instance() {
31 31
 		// check if class object is instantiated
32
-		if ( ! self::$_instance instanceof EE_Payment_Processor ) {
32
+		if ( ! self::$_instance instanceof EE_Payment_Processor) {
33 33
 			self::$_instance = new self();
34 34
 		}
35 35
 		return self::$_instance;
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 *@return EE_Payment_Processor
55 55
 	 */
56 56
 	private function __construct() {
57
-		do_action( 'AHEE__EE_Payment_Processor__construct' );
57
+		do_action('AHEE__EE_Payment_Processor__construct');
58 58
 	}
59 59
 
60 60
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 		$update_txn = true,
94 94
 		$cancel_url = ''
95 95
 	) {
96
-		if( (float)$amount < 0 ) {
96
+		if ((float) $amount < 0) {
97 97
 			throw new EE_Error(
98 98
 				sprintf(
99 99
 					__(
@@ -106,33 +106,33 @@  discard block
 block discarded – undo
106 106
 			);
107 107
 		}
108 108
 		// verify payment method
109
-		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj( $payment_method, TRUE );
109
+		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, TRUE);
110 110
 		// verify transaction
111
-		EEM_Transaction::instance()->ensure_is_obj( $transaction );
112
-		$transaction->set_payment_method_ID( $payment_method->ID() );
111
+		EEM_Transaction::instance()->ensure_is_obj($transaction);
112
+		$transaction->set_payment_method_ID($payment_method->ID());
113 113
 		// verify payment method type
114
-		if ( $payment_method->type_obj() instanceof EE_PMT_Base ) {
114
+		if ($payment_method->type_obj() instanceof EE_PMT_Base) {
115 115
 			$payment = $payment_method->type_obj()->process_payment(
116 116
 				$transaction,
117
-				min( $amount, $transaction->remaining() ),//make sure we don't overcharge
117
+				min($amount, $transaction->remaining()), //make sure we don't overcharge
118 118
 				$billing_form,
119 119
 				$return_url,
120
-				add_query_arg( array( 'ee_cancel_payment' => true ), $cancel_url ),
120
+				add_query_arg(array('ee_cancel_payment' => true), $cancel_url),
121 121
 				$method,
122 122
 				$by_admin
123 123
 			);
124 124
 			// check if payment method uses an off-site gateway
125
-			if ( $payment_method->type_obj()->payment_occurs() !== EE_PMT_Base::offsite ) {
125
+			if ($payment_method->type_obj()->payment_occurs() !== EE_PMT_Base::offsite) {
126 126
 				// don't process payments for off-site gateways yet because no payment has occurred yet
127
-				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn );
127
+				$this->update_txn_based_on_payment($transaction, $payment, $update_txn);
128 128
 			}
129 129
 			return $payment;
130 130
 		} else {
131 131
 			EE_Error::add_error(
132 132
 				sprintf(
133
-					__( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ),
133
+					__('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'),
134 134
 					'<br/>',
135
-					EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
135
+					EE_Registry::instance()->CFG->organization->get_pretty('email')
136 136
 				), __FILE__, __FUNCTION__, __LINE__
137 137
 			);
138 138
 			return NULL;
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
 	 * @throws EE_Error
149 149
 	 * @return string
150 150
 	 */
151
-	public function get_ipn_url_for_payment_method( $transaction, $payment_method ){
151
+	public function get_ipn_url_for_payment_method($transaction, $payment_method) {
152 152
 		/** @type \EE_Transaction $transaction */
153
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
153
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
154 154
 		$primary_reg = $transaction->primary_registration();
155
-		if( ! $primary_reg instanceof EE_Registration ){
155
+		if ( ! $primary_reg instanceof EE_Registration) {
156 156
 			throw new EE_Error(
157 157
 				sprintf(
158 158
 					__(
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 				)
164 164
 			);
165 165
 		}
166
-		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method,true);
166
+		$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, true);
167 167
 		$url = add_query_arg(
168 168
 			array(
169 169
 				'e_reg_url_link'=>$primary_reg->reg_url_link(),
@@ -200,92 +200,92 @@  discard block
 block discarded – undo
200 200
 		$update_txn = true,
201 201
 		$separate_IPN_request = true
202 202
 	) {
203
-		EE_Registry::instance()->load_model( 'Change_Log' );
204
-		$_req_data = $this->_remove_unusable_characters_from_array( (array)$_req_data );
205
-		EE_Processor_Base::set_IPN( $separate_IPN_request );
203
+		EE_Registry::instance()->load_model('Change_Log');
204
+		$_req_data = $this->_remove_unusable_characters_from_array((array) $_req_data);
205
+		EE_Processor_Base::set_IPN($separate_IPN_request);
206 206
 		$obj_for_log = null;
207
-		if( $transaction instanceof EE_Transaction ){
207
+		if ($transaction instanceof EE_Transaction) {
208 208
 			$obj_for_log = $transaction;
209
-			if( $payment_method instanceof EE_Payment_Method ) {
209
+			if ($payment_method instanceof EE_Payment_Method) {
210 210
 				$obj_for_log = EEM_Payment::instance()->get_one(
211 211
 					array(
212
-						array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ),
213
-						'order_by' => array( 'PAY_timestamp' => 'desc' )
212
+						array('TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID()),
213
+						'order_by' => array('PAY_timestamp' => 'desc')
214 214
 					)
215 215
 				);
216 216
 			}
217
-		} else if( $payment_method instanceof EE_Payment ) {
217
+		} else if ($payment_method instanceof EE_Payment) {
218 218
 			$obj_for_log = $payment_method;
219 219
 		}
220 220
 		$log = EEM_Change_Log::instance()->log(
221 221
 			EEM_Change_Log::type_gateway,
222
-			array( 'IPN data received' => $_req_data ),
222
+			array('IPN data received' => $_req_data),
223 223
 			$obj_for_log
224 224
 		);
225
-		try{
225
+		try {
226 226
 			/**
227 227
 			 * @var EE_Payment $payment
228 228
 			 */
229 229
 			$payment = NULL;
230
-			if($transaction && $payment_method){
230
+			if ($transaction && $payment_method) {
231 231
 				/** @type EE_Transaction $transaction */
232 232
 				$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
233 233
 				/** @type EE_Payment_Method $payment_method */
234 234
 				$payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method);
235
-				if ( $payment_method->type_obj() instanceof EE_PMT_Base ) {
236
-						$payment = $payment_method->type_obj()->handle_ipn( $_req_data, $transaction );
235
+				if ($payment_method->type_obj() instanceof EE_PMT_Base) {
236
+						$payment = $payment_method->type_obj()->handle_ipn($_req_data, $transaction);
237 237
 						$log->set_object($payment);
238 238
 				} else {
239 239
 					// not a payment
240 240
 					EE_Error::add_error(
241 241
 						sprintf(
242
-							__( 'A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso' ),
242
+							__('A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso'),
243 243
 							'<br/>',
244
-							EE_Registry::instance()->CFG->organization->get_pretty( 'email' )
244
+							EE_Registry::instance()->CFG->organization->get_pretty('email')
245 245
 						),
246 246
 						__FILE__, __FUNCTION__, __LINE__
247 247
 					);
248 248
 				}
249
-			}else{
249
+			} else {
250 250
 				//that's actually pretty ok. The IPN just wasn't able
251 251
 				//to identify which transaction or payment method this was for
252 252
 				// give all active payment methods a chance to claim it
253 253
 				$active_payment_methods = EEM_Payment_Method::instance()->get_all_active();
254
-				foreach( $active_payment_methods as $active_payment_method ){
255
-					try{
256
-						$payment = $active_payment_method->type_obj()->handle_unclaimed_ipn( $_req_data );
254
+				foreach ($active_payment_methods as $active_payment_method) {
255
+					try {
256
+						$payment = $active_payment_method->type_obj()->handle_unclaimed_ipn($_req_data);
257 257
 						$payment_method = $active_payment_method;
258 258
 						EEM_Change_Log::instance()->log(
259 259
 							EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment
260 260
 						);
261 261
 						break;
262
-					} catch( EE_Error $e ) {
262
+					} catch (EE_Error $e) {
263 263
 						//that's fine- it apparently couldn't handle the IPN
264 264
 					}
265 265
 				}
266 266
 
267 267
 			}
268 268
 // 			EEM_Payment_Log::instance()->log("got to 7",$transaction,$payment_method);
269
-			if( $payment instanceof EE_Payment){
269
+			if ($payment instanceof EE_Payment) {
270 270
 				$payment->save();
271 271
 				//  update the TXN
272
-				$this->update_txn_based_on_payment( $transaction, $payment, $update_txn, $separate_IPN_request );
273
-			}else{
272
+				$this->update_txn_based_on_payment($transaction, $payment, $update_txn, $separate_IPN_request);
273
+			} else {
274 274
 				//we couldn't find the payment for this IPN... let's try and log at least SOMETHING
275
-				if($payment_method){
275
+				if ($payment_method) {
276 276
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method);
277
-				}elseif($transaction){
277
+				}elseif ($transaction) {
278 278
 					EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction);
279 279
 				}
280 280
 			}
281 281
 			return $payment;
282 282
 
283
-		} catch( EE_Error $e ) {
283
+		} catch (EE_Error $e) {
284 284
 			do_action(
285 285
 				'AHEE__log', __FILE__, __FUNCTION__, sprintf(
286
-					__( 'Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso' ),
287
-					print_r( $transaction, TRUE ),
288
-					print_r( $_req_data, TRUE ),
286
+					__('Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso'),
287
+					print_r($transaction, TRUE),
288
+					print_r($_req_data, TRUE),
289 289
 					$e->getMessage()
290 290
 				)
291 291
 			);
@@ -300,10 +300,10 @@  discard block
 block discarded – undo
300 300
 	 * @param  array $request_data
301 301
 	 * @return array
302 302
 	 */
303
-	protected function _remove_unusable_characters_from_array( array $request_data ) {
303
+	protected function _remove_unusable_characters_from_array(array $request_data) {
304 304
 		$return_data = array();
305
-		foreach( $request_data as $key => $value ) {
306
-			$return_data[ $this->_remove_unusable_characters( $key ) ] = $this->_remove_unusable_characters( $value );
305
+		foreach ($request_data as $key => $value) {
306
+			$return_data[$this->_remove_unusable_characters($key)] = $this->_remove_unusable_characters($value);
307 307
 		}
308 308
 		return $return_data;
309 309
 	}
@@ -315,8 +315,8 @@  discard block
 block discarded – undo
315 315
 	 * @param string $request_data
316 316
 	 * @return string
317 317
 	 */
318
-	protected function _remove_unusable_characters( $request_data ) {
319
-		return preg_replace( '/[^[:print:]]/', '', $request_data );
318
+	protected function _remove_unusable_characters($request_data) {
319
+		return preg_replace('/[^[:print:]]/', '', $request_data);
320 320
 	}
321 321
 
322 322
 
@@ -338,13 +338,13 @@  discard block
 block discarded – undo
338 338
 	 * @deprecated 4.6.24 method is no longer used. Instead it is up to client code, like SPCO,
339 339
 	 *                                      to call handle_ipn() for offsite gateways that don't receive separate IPNs
340 340
 	 */
341
-	public function finalize_payment_for( $transaction, $update_txn = TRUE ){
341
+	public function finalize_payment_for($transaction, $update_txn = TRUE) {
342 342
 		/** @var $transaction EE_Transaction */
343
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
343
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
344 344
 		$last_payment_method = $transaction->payment_method();
345
-		if ( $last_payment_method instanceof EE_Payment_Method ) {
346
-			$payment = $last_payment_method->type_obj()->finalize_payment_for( $transaction );
347
-			$this->update_txn_based_on_payment( $transaction, $payment, $update_txn );
345
+		if ($last_payment_method instanceof EE_Payment_Method) {
346
+			$payment = $last_payment_method->type_obj()->finalize_payment_for($transaction);
347
+			$this->update_txn_based_on_payment($transaction, $payment, $update_txn);
348 348
 			return $payment;
349 349
 		} else {
350 350
 			return NULL;
@@ -367,9 +367,9 @@  discard block
 block discarded – undo
367 367
 		EE_Payment $payment_to_refund,
368 368
 		$refund_info = array()
369 369
 	) {
370
-		if ( $payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds() ) {
371
-			$payment_method->type_obj()->process_refund( $payment_to_refund, $refund_info );
372
-			$this->update_txn_based_on_payment( $payment_to_refund->transaction(), $payment_to_refund );
370
+		if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds()) {
371
+			$payment_method->type_obj()->process_refund($payment_to_refund, $refund_info);
372
+			$this->update_txn_based_on_payment($payment_to_refund->transaction(), $payment_to_refund);
373 373
 		}
374 374
 		return $payment_to_refund;
375 375
 	}
@@ -410,12 +410,12 @@  discard block
 block discarded – undo
410 410
 	 *                        TXN is locked before updating
411 411
 	 * @throws \EE_Error
412 412
 	 */
413
-	public function update_txn_based_on_payment( $transaction, $payment, $update_txn = true, $IPN = false ){
413
+	public function update_txn_based_on_payment($transaction, $payment, $update_txn = true, $IPN = false) {
414 414
 		$do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__not_successful';
415 415
 		/** @type EE_Transaction $transaction */
416
-		$transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction );
416
+		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
417 417
 		// can we freely update the TXN at this moment?
418
-		if ( $IPN && $transaction->is_locked() ) {
418
+		if ($IPN && $transaction->is_locked()) {
419 419
 			// don't update the transaction at this exact moment
420 420
 			// because the TXN is active in another request
421 421
 			EE_Cron_Tasks::schedule_update_transaction_with_payment(
@@ -425,45 +425,45 @@  discard block
 block discarded – undo
425 425
 			);
426 426
 		} else {
427 427
 			// verify payment and that it has been saved
428
-			if ( $payment instanceof EE_Payment && $payment->ID() ) {
429
-				if(
428
+			if ($payment instanceof EE_Payment && $payment->ID()) {
429
+				if (
430 430
 					$payment->payment_method() instanceof EE_Payment_Method
431 431
 					&& $payment->payment_method()->type_obj() instanceof EE_PMT_Base
432
-				){
433
-					$payment->payment_method()->type_obj()->update_txn_based_on_payment( $payment );
432
+				) {
433
+					$payment->payment_method()->type_obj()->update_txn_based_on_payment($payment);
434 434
 					// update TXN registrations with payment info
435
-					$this->process_registration_payments( $transaction, $payment );
435
+					$this->process_registration_payments($transaction, $payment);
436 436
 				}
437 437
 				$do_action = $payment->just_approved()
438 438
 					? 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful'
439 439
 					: $do_action;
440 440
 			} else {
441 441
 				// send out notifications
442
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
442
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
443 443
 				$do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__no_payment_made';
444 444
 			}
445 445
 			// if this is an IPN, then we want to know the initial TXN status prior to updating the TXN
446 446
 			// so that we know whether the status has changed and notifications should be triggered
447
-			if ( $IPN ) {
447
+			if ($IPN) {
448 448
 				/** @type EE_Transaction_Processor $transaction_processor */
449
-				$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
450
-				$transaction_processor->set_old_txn_status( $transaction->status_ID() );
449
+				$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
450
+				$transaction_processor->set_old_txn_status($transaction->status_ID());
451 451
 			}
452
-			if ( $payment->status() !== EEM_Payment::status_id_failed ) {
452
+			if ($payment->status() !== EEM_Payment::status_id_failed) {
453 453
 				/** @type EE_Transaction_Payments $transaction_payments */
454
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
454
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
455 455
 				// set new value for total paid
456
-				$transaction_payments->calculate_total_payments_and_update_status( $transaction );
456
+				$transaction_payments->calculate_total_payments_and_update_status($transaction);
457 457
 				// call EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment() ???
458
-				if ( $update_txn ) {
459
-					$this->_post_payment_processing( $transaction, $payment, $IPN );
458
+				if ($update_txn) {
459
+					$this->_post_payment_processing($transaction, $payment, $IPN);
460 460
 				}
461 461
 			}
462 462
 			// granular hook for others to use.
463
-			do_action( $do_action, $transaction, $payment );
464
-			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action' );
463
+			do_action($do_action, $transaction, $payment);
464
+			do_action('AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action');
465 465
 			//global hook for others to use.
466
-			do_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment );
466
+			do_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment);
467 467
 		}
468 468
 	}
469 469
 
@@ -483,25 +483,25 @@  discard block
 block discarded – undo
483 483
 		$registrations = array()
484 484
 	) {
485 485
 		// only process if payment was successful
486
-		if ( $payment->status() !== EEM_Payment::status_id_approved ) {
486
+		if ($payment->status() !== EEM_Payment::status_id_approved) {
487 487
 			return;
488 488
 		}
489 489
 		//EEM_Registration::instance()->show_next_x_db_queries();
490
-		if ( empty( $registrations )) {
490
+		if (empty($registrations)) {
491 491
 			// find registrations with monies owing that can receive a payment
492 492
 			$registrations = $transaction->registrations(
493 493
 				array(
494 494
 					array(
495 495
 						// only these reg statuses can receive payments
496
-						'STS_ID'           => array( 'IN', EEM_Registration::reg_statuses_that_allow_payment() ),
497
-						'REG_final_price'  => array( '!=', 0 ),
498
-						'REG_final_price*' => array( '!=', 'REG_paid', true ),
496
+						'STS_ID'           => array('IN', EEM_Registration::reg_statuses_that_allow_payment()),
497
+						'REG_final_price'  => array('!=', 0),
498
+						'REG_final_price*' => array('!=', 'REG_paid', true),
499 499
 					)
500 500
 				)
501 501
 			);
502 502
 		}
503 503
 		// still nothing ??!??
504
-		if ( empty( $registrations )) {
504
+		if (empty($registrations)) {
505 505
 			return;
506 506
 		}
507 507
 		// todo: break out the following logic into a separate strategy class
@@ -513,28 +513,28 @@  discard block
 block discarded – undo
513 513
 
514 514
 		$refund = $payment->is_a_refund();
515 515
 		// how much is available to apply to registrations?
516
-		$available_payment_amount = abs( $payment->amount() );
517
-		foreach ( $registrations as $registration ) {
518
-			if ( $registration instanceof EE_Registration ) {
516
+		$available_payment_amount = abs($payment->amount());
517
+		foreach ($registrations as $registration) {
518
+			if ($registration instanceof EE_Registration) {
519 519
 				// nothing left?
520
-				if ( $available_payment_amount <= 0 ) {
520
+				if ($available_payment_amount <= 0) {
521 521
 					break;
522 522
 				}
523
-				if ( $refund ) {
524
-					$available_payment_amount = $this->process_registration_refund( $registration, $payment, $available_payment_amount );
523
+				if ($refund) {
524
+					$available_payment_amount = $this->process_registration_refund($registration, $payment, $available_payment_amount);
525 525
 				} else {
526
-					$available_payment_amount = $this->process_registration_payment( $registration, $payment, $available_payment_amount );
526
+					$available_payment_amount = $this->process_registration_payment($registration, $payment, $available_payment_amount);
527 527
 				}
528 528
 			}
529 529
 		}
530
-		if ( $available_payment_amount > 0 && apply_filters( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false ) ) {
530
+		if ($available_payment_amount > 0 && apply_filters('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false)) {
531 531
 			EE_Error::add_attention(
532 532
 				sprintf(
533
-					__( 'A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso' ),
534
-					EEH_Template::format_currency( $available_payment_amount ),
535
-					implode( ', ',  array_keys( $registrations ) ),
533
+					__('A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso'),
534
+					EEH_Template::format_currency($available_payment_amount),
535
+					implode(', ', array_keys($registrations)),
536 536
 					'<br/>',
537
-					EEH_Template::format_currency( $payment->amount() )
537
+					EEH_Template::format_currency($payment->amount())
538 538
 				),
539 539
 				__FILE__, __FUNCTION__, __LINE__
540 540
 			);
@@ -552,17 +552,17 @@  discard block
 block discarded – undo
552 552
 	 * @return float
553 553
 	 * @throws \EE_Error
554 554
 	 */
555
-	public function process_registration_payment( EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00 ) {
555
+	public function process_registration_payment(EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00) {
556 556
 		$owing = $registration->final_price() - $registration->paid();
557
-		if ( $owing > 0 ) {
557
+		if ($owing > 0) {
558 558
 			// don't allow payment amount to exceed the available payment amount, OR the amount owing
559
-			$payment_amount = min( $available_payment_amount, $owing );
559
+			$payment_amount = min($available_payment_amount, $owing);
560 560
 			// update $available_payment_amount
561 561
 			$available_payment_amount -= $payment_amount;
562 562
 			//calculate and set new REG_paid
563
-			$registration->set_paid( $registration->paid() + $payment_amount );
563
+			$registration->set_paid($registration->paid() + $payment_amount);
564 564
 			// now save it
565
-			$this->_apply_registration_payment( $registration, $payment, $payment_amount );
565
+			$this->_apply_registration_payment($registration, $payment, $payment_amount);
566 566
 		}
567 567
 		return $available_payment_amount;
568 568
 	}
@@ -578,19 +578,19 @@  discard block
 block discarded – undo
578 578
 	 * @return float
579 579
 	 * @throws \EE_Error
580 580
 	 */
581
-	protected function _apply_registration_payment( EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00 ) {
581
+	protected function _apply_registration_payment(EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00) {
582 582
 		// find any existing reg payment records for this registration and payment
583 583
 		$existing_reg_payment = EEM_Registration_Payment::instance()->get_one(
584
-			array( array( 'REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID() ) )
584
+			array(array('REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID()))
585 585
 		);
586 586
 		// if existing registration payment exists
587
-		if ( $existing_reg_payment instanceof EE_Registration_Payment ) {
587
+		if ($existing_reg_payment instanceof EE_Registration_Payment) {
588 588
 			// then update that record
589
-			$existing_reg_payment->set_amount( $payment_amount );
589
+			$existing_reg_payment->set_amount($payment_amount);
590 590
 			$existing_reg_payment->save();
591 591
 		} else {
592 592
 			// or add new relation between registration and payment and set amount
593
-			$registration->_add_relation_to( $payment, 'Payment', array( 'RPY_amount' => $payment_amount ) );
593
+			$registration->_add_relation_to($payment, 'Payment', array('RPY_amount' => $payment_amount));
594 594
 			// make it stick
595 595
 			$registration->save();
596 596
 		}
@@ -607,21 +607,21 @@  discard block
 block discarded – undo
607 607
 	 * @return float
608 608
 	 * @throws \EE_Error
609 609
 	 */
610
-	public function process_registration_refund( EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00 ) {
610
+	public function process_registration_refund(EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00) {
611 611
 		//EEH_Debug_Tools::printr( $payment->amount(), '$payment->amount()', __FILE__, __LINE__ );
612
-		if ( $registration->paid() > 0 ) {
612
+		if ($registration->paid() > 0) {
613 613
 			// ensure $available_refund_amount is NOT negative
614
-			$available_refund_amount = (float)abs( $available_refund_amount );
614
+			$available_refund_amount = (float) abs($available_refund_amount);
615 615
 			// don't allow refund amount to exceed the available payment amount, OR the amount paid
616
-			$refund_amount = min( $available_refund_amount, (float)$registration->paid() );
616
+			$refund_amount = min($available_refund_amount, (float) $registration->paid());
617 617
 			// update $available_payment_amount
618 618
 			$available_refund_amount -= $refund_amount;
619 619
 			//calculate and set new REG_paid
620
-			$registration->set_paid( $registration->paid() - $refund_amount );
620
+			$registration->set_paid($registration->paid() - $refund_amount);
621 621
 			// convert payment amount back to a negative value for storage in the db
622
-			$refund_amount = (float)abs( $refund_amount ) * -1;
622
+			$refund_amount = (float) abs($refund_amount) * -1;
623 623
 			// now save it
624
-			$this->_apply_registration_payment( $registration, $payment, $refund_amount );
624
+			$this->_apply_registration_payment($registration, $payment, $refund_amount);
625 625
 		}
626 626
 		return $available_refund_amount;
627 627
 	}
@@ -640,21 +640,21 @@  discard block
 block discarded – undo
640 640
 	 * @param bool           $IPN
641 641
 	 * @throws \EE_Error
642 642
 	 */
643
-	protected function _post_payment_processing( EE_Transaction $transaction, EE_Payment $payment, $IPN = false ) {
643
+	protected function _post_payment_processing(EE_Transaction $transaction, EE_Payment $payment, $IPN = false) {
644 644
 
645 645
 		/** @type EE_Transaction_Processor $transaction_processor */
646
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
646
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
647 647
 		// is the Payment Options Reg Step completed ?
648
-		$payment_options_step_completed = $transaction_processor->reg_step_completed( $transaction, 'payment_options' );
648
+		$payment_options_step_completed = $transaction_processor->reg_step_completed($transaction, 'payment_options');
649 649
 		// if the Payment Options Reg Step is completed...
650 650
 		$revisit = $payment_options_step_completed === true ? true : false;
651 651
 		// then this is kinda sorta a revisit with regards to payments at least
652
-		$transaction_processor->set_revisit( $revisit );
652
+		$transaction_processor->set_revisit($revisit);
653 653
 		// if this is an IPN, let's consider the Payment Options Reg Step completed if not already
654 654
 		if (
655 655
 			$IPN &&
656 656
 			$payment_options_step_completed !== true &&
657
-			( $payment->is_approved() || $payment->is_pending() )
657
+			($payment->is_approved() || $payment->is_pending())
658 658
 		) {
659 659
 			$payment_options_step_completed = $transaction_processor->set_reg_step_completed(
660 660
 				$transaction,
@@ -662,34 +662,34 @@  discard block
 block discarded – undo
662 662
 			);
663 663
 		}
664 664
 		/** @type EE_Transaction_Payments $transaction_payments */
665
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
665
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
666 666
 		// maybe update status, but don't save transaction just yet
667
-		$transaction_payments->update_transaction_status_based_on_total_paid( $transaction, false );
667
+		$transaction_payments->update_transaction_status_based_on_total_paid($transaction, false);
668 668
 		// check if 'finalize_registration' step has been completed...
669
-		$finalized = $transaction_processor->reg_step_completed( $transaction, 'finalize_registration' );
669
+		$finalized = $transaction_processor->reg_step_completed($transaction, 'finalize_registration');
670 670
 		//  if this is an IPN and the final step has not been initiated
671
-		if ( $IPN && $payment_options_step_completed && $finalized === false ) {
671
+		if ($IPN && $payment_options_step_completed && $finalized === false) {
672 672
 			// and if it hasn't already been set as being started...
673
-			$finalized = $transaction_processor->set_reg_step_initiated( $transaction, 'finalize_registration' );
673
+			$finalized = $transaction_processor->set_reg_step_initiated($transaction, 'finalize_registration');
674 674
 		}
675 675
 		$transaction->save();
676 676
 		// because the above will return false if the final step was not fully completed, we need to check again...
677
-		if ( $IPN && $finalized !== false ) {
677
+		if ($IPN && $finalized !== false) {
678 678
 			// and if we are all good to go, then send out notifications
679
-			add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
679
+			add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
680 680
 			//ok, now process the transaction according to the payment
681
-			$transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $transaction, $payment );
681
+			$transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($transaction, $payment);
682 682
 		}
683 683
 		// DEBUG LOG
684 684
 		$payment_method = $payment->payment_method();
685
-		if ( $payment_method instanceof EE_Payment_Method ) {
685
+		if ($payment_method instanceof EE_Payment_Method) {
686 686
 			$payment_method_type_obj = $payment_method->type_obj();
687
-			if ( $payment_method_type_obj instanceof EE_PMT_Base ) {
687
+			if ($payment_method_type_obj instanceof EE_PMT_Base) {
688 688
 				$gateway = $payment_method_type_obj->get_gateway();
689
-				if ( $gateway instanceof EE_Gateway ){
689
+				if ($gateway instanceof EE_Gateway) {
690 690
 					$gateway->log(
691 691
 						array(
692
-							'message'               => __( 'Post Payment Transaction Details', 'event_espresso' ),
692
+							'message'               => __('Post Payment Transaction Details', 'event_espresso'),
693 693
 							'transaction'           => $transaction->model_field_array(),
694 694
 							'finalized'             => $finalized,
695 695
 							'IPN'                   => $IPN,
Please login to merge, or discard this patch.
espresso.php 1 patch
Spacing   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'ABSPATH' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('ABSPATH')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /*
5 5
   Plugin Name:		Event Espresso
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
  *
43 43
  */
44 44
 
45
-if ( ! defined('EE_MIN_WP_VER_REQUIRED') ) {
46
-	define( 'EE_MIN_WP_VER_REQUIRED', '4.1' );
47
-	define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' );
48
-	define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' );
49
-	define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' );
45
+if ( ! defined('EE_MIN_WP_VER_REQUIRED')) {
46
+	define('EE_MIN_WP_VER_REQUIRED', '4.1');
47
+	define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
48
+	define('EE_MIN_PHP_VER_REQUIRED', '5.3.0');
49
+	define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
50 50
 }
51 51
 
52
-if ( function_exists( 'espresso_version' ) ) {
52
+if (function_exists('espresso_version')) {
53 53
 
54 54
 	/**
55 55
 	 *    espresso_duplicate_plugin_error
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
 	function espresso_duplicate_plugin_error() {
59 59
 		?>
60 60
 		<div class="error">
61
-			<p><?php esc_html_e( 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso' ); ?></p>
61
+			<p><?php esc_html_e('Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso'); ?></p>
62 62
 		</div>
63 63
 		<?php
64
-		espresso_deactivate_plugin( plugin_basename( __FILE__ ) );
64
+		espresso_deactivate_plugin(plugin_basename(__FILE__));
65 65
 	}
66
-	add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 );
66
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
67 67
 
68
-} else if ( version_compare( PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '<' ) ) {
68
+} else if (version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '<')) {
69 69
 	/**
70 70
 	 * espresso_minimum_php_version_error
71 71
 	 * displays if EE is activated on a server running an incompatible version of PHP
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 			</p>
90 90
 		</div>
91 91
 		<?php
92
-		espresso_deactivate_plugin( plugin_basename( __FILE__ ) );
92
+		espresso_deactivate_plugin(plugin_basename(__FILE__));
93 93
 	}
94
-	add_action( 'admin_notices', 'espresso_minimum_php_version_error', 1 );
94
+	add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95 95
 } else {
96 96
 
97 97
 	/**
@@ -101,90 +101,90 @@  discard block
 block discarded – undo
101 101
 	 * @return string
102 102
 	 */
103 103
 	function espresso_version() {
104
-		return apply_filters( 'FHEE__espresso__espresso_version', '4.9.10.rc.008' );
104
+		return apply_filters('FHEE__espresso__espresso_version', '4.9.10.rc.008');
105 105
 	}
106 106
 
107 107
 	// define versions
108
-	define( 'EVENT_ESPRESSO_VERSION', espresso_version() );
109
-	define( 'EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - ' . EVENT_ESPRESSO_VERSION );
110
-	define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ );
108
+	define('EVENT_ESPRESSO_VERSION', espresso_version());
109
+	define('EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - '.EVENT_ESPRESSO_VERSION);
110
+	define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
111 111
 	//used to be DIRECTORY_SEPARATOR, but that caused issues on windows
112
-	if ( ! defined( 'DS' ) ) {
113
-		define( 'DS', '/' );
112
+	if ( ! defined('DS')) {
113
+		define('DS', '/');
114 114
 	}
115
-	if ( ! defined( 'PS' ) ) {
116
-		define( 'PS', PATH_SEPARATOR );
115
+	if ( ! defined('PS')) {
116
+		define('PS', PATH_SEPARATOR);
117 117
 	}
118
-	if ( ! defined( 'SP' ) ) {
119
-		define( 'SP', ' ' );
118
+	if ( ! defined('SP')) {
119
+		define('SP', ' ');
120 120
 	}
121
-	if ( ! defined( 'EENL' ) ) {
122
-		define( 'EENL', "\n" );
121
+	if ( ! defined('EENL')) {
122
+		define('EENL', "\n");
123 123
 	}
124
-	define( 'EE_SUPPORT_EMAIL', '[email protected]' );
124
+	define('EE_SUPPORT_EMAIL', '[email protected]');
125 125
 	// define the plugin directory and URL
126
-	define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) );
127
-	define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) );
128
-	define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) );
126
+	define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
127
+	define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
128
+	define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
129 129
 	// main root folder paths
130
-	define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS );
131
-	define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS );
132
-	define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS );
133
-	define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS );
134
-	define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS );
135
-	define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS );
136
-	define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS );
137
-	define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS );
130
+	define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS);
131
+	define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS);
132
+	define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS);
133
+	define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS);
134
+	define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS);
135
+	define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS);
136
+	define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS);
137
+	define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS);
138 138
 	// core system paths
139
-	define( 'EE_ADMIN', EE_CORE . 'admin' . DS );
140
-	define( 'EE_CPTS', EE_CORE . 'CPTs' . DS );
141
-	define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS );
142
-	define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS );
143
-	define( 'EE_BUSINESS', EE_CORE . 'business' . DS );
144
-	define( 'EE_MODELS', EE_CORE . 'db_models' . DS );
145
-	define( 'EE_HELPERS', EE_CORE . 'helpers' . DS );
146
-	define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS );
147
-	define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS );
148
-	define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS );
149
-	define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS );
150
-	define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS );
139
+	define('EE_ADMIN', EE_CORE.'admin'.DS);
140
+	define('EE_CPTS', EE_CORE.'CPTs'.DS);
141
+	define('EE_CLASSES', EE_CORE.'db_classes'.DS);
142
+	define('EE_INTERFACES', EE_CORE.'interfaces'.DS);
143
+	define('EE_BUSINESS', EE_CORE.'business'.DS);
144
+	define('EE_MODELS', EE_CORE.'db_models'.DS);
145
+	define('EE_HELPERS', EE_CORE.'helpers'.DS);
146
+	define('EE_LIBRARIES', EE_CORE.'libraries'.DS);
147
+	define('EE_TEMPLATES', EE_CORE.'templates'.DS);
148
+	define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS);
149
+	define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS);
150
+	define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS);
151 151
 	// gateways
152
-	define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS );
153
-	define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS );
152
+	define('EE_GATEWAYS', EE_MODULES.'gateways'.DS);
153
+	define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS);
154 154
 	// asset URL paths
155
-	define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS );
156
-	define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS );
157
-	define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS );
158
-	define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS );
159
-	define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' );
160
-	define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' );
155
+	define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS);
156
+	define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS);
157
+	define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS);
158
+	define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS);
159
+	define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/');
160
+	define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/');
161 161
 	// define upload paths
162 162
 	$uploads = wp_upload_dir();
163 163
 	// define the uploads directory and URL
164
-	define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS );
165
-	define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS );
164
+	define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS);
165
+	define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS);
166 166
 	// define the templates directory and URL
167
-	define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS );
168
-	define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS );
167
+	define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS);
168
+	define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS);
169 169
 	// define the gateway directory and URL
170
-	define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS );
171
-	define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS );
170
+	define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS);
171
+	define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS);
172 172
 	// languages folder/path
173
-	define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS );
174
-	define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS );
173
+	define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS);
174
+	define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS);
175 175
 	//check for dompdf fonts in uploads
176
-	if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) {
177
-		define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS );
176
+	if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) {
177
+		define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS);
178 178
 	}
179 179
 	//ajax constants
180
-	define( 'EE_FRONT_AJAX', isset( $_REQUEST['ee_front_ajax'] ) || isset( $_REQUEST['data']['ee_front_ajax'] ) ? true : false );
181
-	define( 'EE_ADMIN_AJAX', isset( $_REQUEST['ee_admin_ajax'] ) || isset( $_REQUEST['data']['ee_admin_ajax'] ) ? true : false );
180
+	define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false);
181
+	define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false);
182 182
 	//just a handy constant occasionally needed for finding values representing infinity in the DB
183 183
 	//you're better to use this than its straight value (currently -1) in case you ever
184 184
 	//want to change its default value! or find when -1 means infinity
185
-	define( 'EE_INF_IN_DB', -1 );
186
-	define( 'EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX );
187
-	define( 'EE_DEBUG', false );
185
+	define('EE_INF_IN_DB', -1);
186
+	define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX);
187
+	define('EE_DEBUG', false);
188 188
 
189 189
 
190 190
 	/**
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
 	 *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
193 193
 	 */
194 194
 	function espresso_plugin_activation() {
195
-		update_option( 'ee_espresso_activation', true );
195
+		update_option('ee_espresso_activation', true);
196 196
 	}
197
-	register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' );
197
+	register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
198 198
 
199 199
 
200 200
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 		//	}
209 209
 		//
210 210
 	}
211
-	register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' );
211
+	register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation');
212 212
 
213 213
 
214 214
 
@@ -218,15 +218,15 @@  discard block
 block discarded – undo
218 218
 	 */
219 219
 	function espresso_load_error_handling() {
220 220
 		// load debugging tools
221
-		if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) {
222
-			require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' );
221
+		if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) {
222
+			require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php');
223 223
 			EEH_Debug_Tools::instance();
224 224
 		}
225 225
 		// load error handling
226
-		if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) {
227
-			require_once( EE_CORE . 'EE_Error.core.php' );
226
+		if (is_readable(EE_CORE.'EE_Error.core.php')) {
227
+			require_once(EE_CORE.'EE_Error.core.php');
228 228
 		} else {
229
-			wp_die( esc_html__( 'The EE_Error core class could not be loaded.', 'event_espresso' ) );
229
+			wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso'));
230 230
 		}
231 231
 	}
232 232
 
@@ -240,38 +240,38 @@  discard block
 block discarded – undo
240 240
 	 * @param    string $full_path_to_file
241 241
 	 * @throws    EE_Error
242 242
 	 */
243
-	function espresso_load_required( $classname, $full_path_to_file ) {
243
+	function espresso_load_required($classname, $full_path_to_file) {
244 244
 		static $error_handling_loaded = false;
245
-		if ( ! $error_handling_loaded ) {
245
+		if ( ! $error_handling_loaded) {
246 246
 			espresso_load_error_handling();
247 247
 			$error_handling_loaded = true;
248 248
 		}
249
-		if ( is_readable( $full_path_to_file ) ) {
250
-			require_once( $full_path_to_file );
249
+		if (is_readable($full_path_to_file)) {
250
+			require_once($full_path_to_file);
251 251
 		} else {
252
-			throw new EE_Error (
252
+			throw new EE_Error(
253 253
 				sprintf(
254
-					esc_html__( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ),
254
+					esc_html__('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'),
255 255
 					$classname
256 256
 				)
257 257
 			);
258 258
 		}
259 259
 	}
260 260
 
261
-	espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' );
262
-	espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' );
261
+	espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php');
262
+	espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php');
263 263
 	// PSR4 Autoloaders
264
-	espresso_load_required( 'EE_Psr4AutoloaderInit', EE_CORE . 'EE_Psr4AutoloaderInit.core.php' );
264
+	espresso_load_required('EE_Psr4AutoloaderInit', EE_CORE.'EE_Psr4AutoloaderInit.core.php');
265 265
 	EE_Psr4AutoloaderInit::initialize_psr4_loader();
266 266
 	// bootstrap EE
267
-	espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' );
267
+	espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php');
268 268
 	new EE_Bootstrap();
269 269
 
270 270
 }
271 271
 
272 272
 
273 273
 
274
-if ( ! function_exists( 'espresso_deactivate_plugin' ) ) {
274
+if ( ! function_exists('espresso_deactivate_plugin')) {
275 275
 	/**
276 276
 	*    deactivate_plugin
277 277
 	* usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
@@ -280,12 +280,12 @@  discard block
 block discarded – undo
280 280
 	* @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
281 281
 	* @return    void
282 282
 	*/
283
-	function espresso_deactivate_plugin( $plugin_basename = '' ) {
284
-		if ( ! function_exists( 'deactivate_plugins' ) ) {
285
-			require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
283
+	function espresso_deactivate_plugin($plugin_basename = '') {
284
+		if ( ! function_exists('deactivate_plugins')) {
285
+			require_once(ABSPATH.'wp-admin/includes/plugin.php');
286 286
 		}
287
-		unset( $_GET[ 'activate' ], $_REQUEST[ 'activate' ] );
288
-		deactivate_plugins( $plugin_basename );
287
+		unset($_GET['activate'], $_REQUEST['activate']);
288
+		deactivate_plugins($plugin_basename);
289 289
 	}
290 290
 }
291 291
 
Please login to merge, or discard this patch.