Completed
Branch BUG-9647-cpt-queries (303307)
by
unknown
201:19 queued 184:10
created
core/EE_Config.core.php 1 patch
Spacing   +382 added lines, -382 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	public static function instance() {
130 130
 		// check if class object is instantiated, and instantiated properly
131
-		if ( ! self::$_instance instanceof EE_Config ) {
131
+		if ( ! self::$_instance instanceof EE_Config) {
132 132
 			self::$_instance = new self();
133 133
 		}
134 134
 		return self::$_instance;
@@ -145,22 +145,22 @@  discard block
 block discarded – undo
145 145
 	 * not be ready to instantiate EE_Config currently (eg if the site was put into maintenance mode)
146 146
 	 * @return EE_Config
147 147
 	 */
148
-	public static function reset( $hard_reset = FALSE, $reinstantiate = TRUE ){
149
-		if ( $hard_reset ) {
148
+	public static function reset($hard_reset = FALSE, $reinstantiate = TRUE) {
149
+		if ($hard_reset) {
150 150
 			self::$_instance->_config_option_names = array();
151 151
 			self::$_instance->_initialize_config();
152 152
 			self::$_instance->update_espresso_config();
153 153
 		}
154
-		if( self::$_instance instanceof EE_Config ){
154
+		if (self::$_instance instanceof EE_Config) {
155 155
 			self::$_instance->shutdown();
156 156
 		}
157 157
 		self::$_instance = NULL;
158 158
 		//we don't need to reset the static properties imo because those should
159 159
 		//only change when a module is added or removed. Currently we don't
160 160
 		//support removing a module during a request when it previously existed
161
-		if( $reinstantiate ){
161
+		if ($reinstantiate) {
162 162
 			return self::instance();
163
-		}else{
163
+		} else {
164 164
 			return NULL;
165 165
 		}
166 166
 	}
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
 	 * @return \EE_Config
175 175
 	 */
176 176
 	private function __construct() {
177
-		do_action( 'AHEE__EE_Config__construct__begin',$this );
178
-		$this->_config_option_names = get_option( 'ee_config_option_names', array() );
177
+		do_action('AHEE__EE_Config__construct__begin', $this);
178
+		$this->_config_option_names = get_option('ee_config_option_names', array());
179 179
 		// setup empty config classes
180 180
 		$this->_initialize_config();
181 181
 		// load existing EE site settings
@@ -183,15 +183,15 @@  discard block
 block discarded – undo
183 183
 		// confirm everything loaded correctly and set filtered defaults if not
184 184
 		$this->_verify_config();
185 185
 		//  register shortcodes and modules
186
-		add_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_and_modules' ), 999 );
186
+		add_action('AHEE__EE_System__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_and_modules'), 999);
187 187
 		//  initialize shortcodes and modules
188
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ));
188
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules'));
189 189
 		// register widgets
190
-		add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 );
190
+		add_action('widgets_init', array($this, 'widgets_init'), 10);
191 191
 		// shutdown
192
-		add_action( 'shutdown', array( $this, 'shutdown' ), 10 );
192
+		add_action('shutdown', array($this, 'shutdown'), 10);
193 193
 		// construct__end hook
194
-		do_action( 'AHEE__EE_Config__construct__end',$this );
194
+		do_action('AHEE__EE_Config__construct__end', $this);
195 195
 		// hardcoded hack
196 196
 		$this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014';
197 197
 	}
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	 * @return string current theme set.
205 205
 	 */
206 206
 	public static function get_current_theme() {
207
-		return isset( self::$_instance->template_settings->current_espresso_theme ) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014';
207
+		return isset(self::$_instance->template_settings->current_espresso_theme) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014';
208 208
 	}
209 209
 
210 210
 
@@ -238,27 +238,27 @@  discard block
 block discarded – undo
238 238
 	 */
239 239
 	private function _load_core_config() {
240 240
 		// load_core_config__start hook
241
-		do_action( 'AHEE__EE_Config___load_core_config__start', $this );
241
+		do_action('AHEE__EE_Config___load_core_config__start', $this);
242 242
 		$espresso_config = $this->get_espresso_config();
243
-		foreach ( $espresso_config as $config => $settings ) {
243
+		foreach ($espresso_config as $config => $settings) {
244 244
 			// load_core_config__start hook
245
-			$settings = apply_filters( 'FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this );
246
-			if ( is_object( $settings ) && property_exists( $this, $config ) ) {
247
-				$this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings );
245
+			$settings = apply_filters('FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this);
246
+			if (is_object($settings) && property_exists($this, $config)) {
247
+				$this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings);
248 248
 				//call configs populate method to ensure any defaults are set for empty values.
249
-				if ( method_exists( $settings, 'populate' ) ) {
249
+				if (method_exists($settings, 'populate')) {
250 250
 					$this->{$config}->populate();
251 251
 				}
252
-				if ( method_exists( $settings, 'do_hooks' ) ) {
252
+				if (method_exists($settings, 'do_hooks')) {
253 253
 					$this->{$config}->do_hooks();
254 254
 				}
255 255
 			}
256 256
 		}
257
-		if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', FALSE ) ) {
257
+		if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', FALSE)) {
258 258
 			$this->update_espresso_config();
259 259
 		}
260 260
 		// load_core_config__end hook
261
-		do_action( 'AHEE__EE_Config___load_core_config__end', $this );
261
+		do_action('AHEE__EE_Config___load_core_config__end', $this);
262 262
 	}
263 263
 
264 264
 
@@ -272,40 +272,40 @@  discard block
 block discarded – undo
272 272
 	protected function _verify_config() {
273 273
 
274 274
 		$this->core = $this->core instanceof EE_Core_Config
275
-			? $this->core  : new EE_Core_Config();
276
-		$this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core );
275
+			? $this->core : new EE_Core_Config();
276
+		$this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core);
277 277
 
278 278
 		$this->organization = $this->organization instanceof EE_Organization_Config
279
-			? $this->organization  : new EE_Organization_Config();
280
-		$this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization );
279
+			? $this->organization : new EE_Organization_Config();
280
+		$this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization);
281 281
 
282 282
 		$this->currency = $this->currency instanceof EE_Currency_Config
283 283
 			? $this->currency : new EE_Currency_Config();
284
-		$this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency );
284
+		$this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency);
285 285
 
286 286
 		$this->registration = $this->registration instanceof EE_Registration_Config
287 287
 			? $this->registration : new EE_Registration_Config();
288
-		$this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration );
288
+		$this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration);
289 289
 
290 290
 		$this->admin = $this->admin instanceof EE_Admin_Config
291 291
 			? $this->admin : new EE_Admin_Config();
292
-		$this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin );
292
+		$this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin);
293 293
 
294 294
 		$this->template_settings = $this->template_settings instanceof EE_Template_Config
295 295
 			? $this->template_settings : new EE_Template_Config();
296
-		$this->template_settings = apply_filters( 'FHEE__EE_Config___initialize_config__template_settings', $this->template_settings );
296
+		$this->template_settings = apply_filters('FHEE__EE_Config___initialize_config__template_settings', $this->template_settings);
297 297
 
298 298
 		$this->map_settings = $this->map_settings instanceof EE_Map_Config
299 299
 			? $this->map_settings : new EE_Map_Config();
300
-		$this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings );
300
+		$this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings);
301 301
 
302 302
 		$this->environment = $this->environment instanceof EE_Environment_Config
303 303
 			? $this->environment : new EE_Environment_Config();
304
-		$this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment );
304
+		$this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment);
305 305
 
306 306
 		$this->gateway = $this->gateway instanceof EE_Gateway_Config
307 307
 			? $this->gateway : new EE_Gateway_Config();
308
-		$this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway );
308
+		$this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway);
309 309
 
310 310
 	}
311 311
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 	 */
320 320
 	public function get_espresso_config() {
321 321
 		// grab espresso configuration
322
-		return apply_filters( 'FHEE__EE_Config__get_espresso_config__CFG', get_option( 'ee_config', array() ));
322
+		return apply_filters('FHEE__EE_Config__get_espresso_config__CFG', get_option('ee_config', array()));
323 323
 	}
324 324
 
325 325
 
@@ -332,12 +332,12 @@  discard block
 block discarded – undo
332 332
 	 * @param        $old_value
333 333
 	 * @param        $value
334 334
 	 */
335
-	public function double_check_config_comparison( $option = '', $old_value, $value ) {
335
+	public function double_check_config_comparison($option = '', $old_value, $value) {
336 336
 		// make sure we're checking the ee config
337
-		if ( $option == 'ee_config' ) {
337
+		if ($option == 'ee_config') {
338 338
 			// run a loose comparison of the old value against the new value for type and properties,
339 339
 			// but NOT exact instance like WP update_option does
340
-			if ( $value != $old_value ) {
340
+			if ($value != $old_value) {
341 341
 				// if they are NOT the same, then remove the hook,
342 342
 				// which means the subsequent update results will be based solely on the update query results
343 343
 				// the reason we do this is because, as stated above,
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 				// the string it sees in the db looks the same as the new one it has been passed!!!
353 353
 				// This results in the query returning an "affected rows" value of ZERO,
354 354
 				// which gets returned immediately by WP update_option and looks like an error.
355
-				remove_action( 'update_option', array( $this, 'check_config_updated' ));
355
+				remove_action('update_option', array($this, 'check_config_updated'));
356 356
 			}
357 357
 		}
358 358
 	}
@@ -367,11 +367,11 @@  discard block
 block discarded – undo
367 367
 	 */
368 368
 	protected function  _reset_espresso_addon_config() {
369 369
 		$this->_config_option_names = array();
370
-		foreach( $this->addons as $addon_name => $addon_config_obj ) {
371
-			$addon_config_obj = maybe_unserialize( $addon_config_obj );
372
-			$config_class = get_class( $addon_config_obj );
373
-			if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) {
374
-				$this->update_config( 'addons', $addon_name, $addon_config_obj, FALSE );
370
+		foreach ($this->addons as $addon_name => $addon_config_obj) {
371
+			$addon_config_obj = maybe_unserialize($addon_config_obj);
372
+			$config_class = get_class($addon_config_obj);
373
+			if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) {
374
+				$this->update_config('addons', $addon_name, $addon_config_obj, FALSE);
375 375
 			}
376 376
 			$this->addons->{$addon_name} = NULL;
377 377
 		}
@@ -387,17 +387,17 @@  discard block
 block discarded – undo
387 387
 	 * @param   bool $add_error
388 388
 	 * @return   bool
389 389
 	 */
390
-	public function  update_espresso_config( $add_success = FALSE, $add_error = TRUE ) {
390
+	public function  update_espresso_config($add_success = FALSE, $add_error = TRUE) {
391 391
 		// commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197
392 392
 		//$clone = clone( self::$_instance );
393 393
 		//self::$_instance = NULL;
394
-		do_action( 'AHEE__EE_Config__update_espresso_config__begin',$this );
394
+		do_action('AHEE__EE_Config__update_espresso_config__begin', $this);
395 395
 		$this->_reset_espresso_addon_config();
396 396
 		// hook into update_option because that happens AFTER the ( $value === $old_value ) conditional
397 397
 		// but BEFORE the actual update occurs
398
-		add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 );
398
+		add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3);
399 399
 		// now update "ee_config"
400
-		$saved = update_option( 'ee_config', $this );
400
+		$saved = update_option('ee_config', $this);
401 401
 		// if not saved... check if the hook we just added still exists;
402 402
 		// if it does, it means one of two things:
403 403
 		// 		that update_option bailed at the ( $value === $old_value ) conditional,
@@ -408,25 +408,25 @@  discard block
 block discarded – undo
408 408
 		// but just means no update occurred, so don't display an error to the user.
409 409
 		// BUT... if update_option returns FALSE, AND the hook is missing,
410 410
 		// then it means that something truly went wrong
411
-		$saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' )) : $saved;
411
+		$saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved;
412 412
 		// remove our action since we don't want it in the system anymore
413
-		remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 );
414
-		do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved );
413
+		remove_action('update_option', array($this, 'double_check_config_comparison'), 1);
414
+		do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved);
415 415
 		//self::$_instance = $clone;
416 416
 		//unset( $clone );
417 417
 		// if config remains the same or was updated successfully
418
-		if ( $saved ) {
419
-			if ( $add_success ) {
418
+		if ($saved) {
419
+			if ($add_success) {
420 420
 				EE_Error::add_success(
421
-					__( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ),
421
+					__('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'),
422 422
 					__FILE__, __FUNCTION__, __LINE__
423 423
 				);
424 424
 			}
425 425
 			return TRUE;
426 426
 		} else {
427
-			if ( $add_error ) {
427
+			if ($add_error) {
428 428
 				EE_Error::add_error(
429
-					__( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ),
429
+					__('The Event Espresso Configuration Settings were not updated.', 'event_espresso'),
430 430
 					__FILE__, __FUNCTION__, __LINE__
431 431
 				);
432 432
 			}
@@ -452,20 +452,20 @@  discard block
 block discarded – undo
452 452
 		$name = '',
453 453
 		$config_class = '',
454 454
 		$config_obj = NULL,
455
-		$tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ),
455
+		$tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8),
456 456
 		$display_errors = TRUE
457 457
 	) {
458 458
 		try {
459
-			foreach ( $tests_to_run as $test ) {
460
-				switch ( $test ) {
459
+			foreach ($tests_to_run as $test) {
460
+				switch ($test) {
461 461
 
462 462
 					// TEST #1 : check that section was set
463 463
 					case 1 :
464
-						if ( empty( $section ) ) {
465
-							if ( $display_errors ) {
464
+						if (empty($section)) {
465
+							if ($display_errors) {
466 466
 								throw new EE_Error(
467 467
 									sprintf(
468
-										__( 'No configuration section has been provided while attempting to save "%s".', 'event_espresso' ),
468
+										__('No configuration section has been provided while attempting to save "%s".', 'event_espresso'),
469 469
 										$config_class
470 470
 									)
471 471
 								);
@@ -476,11 +476,11 @@  discard block
 block discarded – undo
476 476
 
477 477
 					// TEST #2 : check that settings section exists
478 478
 					case 2 :
479
-						if ( ! isset( $this->{$section} ) ) {
480
-							if ( $display_errors ) {
479
+						if ( ! isset($this->{$section} )) {
480
+							if ($display_errors) {
481 481
 								throw new EE_Error(
482
-									sprintf( __( 'The "%s" configuration section does not exist.', 'event_espresso' ),
483
-											 $section )
482
+									sprintf(__('The "%s" configuration section does not exist.', 'event_espresso'),
483
+											 $section)
484 484
 								);
485 485
 							}
486 486
 							return false;
@@ -490,12 +490,12 @@  discard block
 block discarded – undo
490 490
 					// TEST #3 : check that section is the proper format
491 491
 					case 3 :
492 492
 						if (
493
-							! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass )
493
+							! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass)
494 494
 						) {
495
-							if ( $display_errors ) {
495
+							if ($display_errors) {
496 496
 								throw new EE_Error(
497 497
 									sprintf(
498
-										__( 'The "%s" configuration settings have not been formatted correctly.', 'event_espresso' ),
498
+										__('The "%s" configuration settings have not been formatted correctly.', 'event_espresso'),
499 499
 										$section
500 500
 									)
501 501
 								);
@@ -506,10 +506,10 @@  discard block
 block discarded – undo
506 506
 
507 507
 					// TEST #4 : check that config section name has been set
508 508
 					case 4 :
509
-						if ( empty( $name ) ) {
510
-							if ( $display_errors ) {
509
+						if (empty($name)) {
510
+							if ($display_errors) {
511 511
 								throw new EE_Error(
512
-									__( 'No name has been provided for the specific configuration section.', 'event_espresso' )
512
+									__('No name has been provided for the specific configuration section.', 'event_espresso')
513 513
 								);
514 514
 							}
515 515
 							return false;
@@ -518,10 +518,10 @@  discard block
 block discarded – undo
518 518
 
519 519
 					// TEST #5 : check that a config class name has been set
520 520
 					case 5 :
521
-						if ( empty( $config_class ) ) {
522
-							if ( $display_errors ) {
521
+						if (empty($config_class)) {
522
+							if ($display_errors) {
523 523
 								throw new EE_Error(
524
-									__( 'No class name has been provided for the specific configuration section.', 'event_espresso' )
524
+									__('No class name has been provided for the specific configuration section.', 'event_espresso')
525 525
 								);
526 526
 							}
527 527
 							return false;
@@ -530,11 +530,11 @@  discard block
 block discarded – undo
530 530
 
531 531
 					// TEST #6 : verify config class is accessible
532 532
 					case 6 :
533
-						if ( ! class_exists( $config_class ) ) {
534
-							if ( $display_errors ) {
533
+						if ( ! class_exists($config_class)) {
534
+							if ($display_errors) {
535 535
 								throw new EE_Error(
536 536
 									sprintf(
537
-										__( 'The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso' ),
537
+										__('The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso'),
538 538
 										$config_class
539 539
 									)
540 540
 								);
@@ -545,11 +545,11 @@  discard block
 block discarded – undo
545 545
 
546 546
 					// TEST #7 : check that config has even been set
547 547
 					case 7 :
548
-						if ( ! isset( $this->{$section}->{$name} ) ) {
549
-							if ( $display_errors ) {
548
+						if ( ! isset($this->{$section}->{$name} )) {
549
+							if ($display_errors) {
550 550
 								throw new EE_Error(
551 551
 									sprintf(
552
-										__( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ),
552
+										__('No configuration has been set for "%1$s->%2$s".', 'event_espresso'),
553 553
 										$section,
554 554
 										$name
555 555
 									)
@@ -558,17 +558,17 @@  discard block
 block discarded – undo
558 558
 							return false;
559 559
 						} else {
560 560
 							// and make sure it's not serialized
561
-							$this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} );
561
+							$this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} );
562 562
 						}
563 563
 						break;
564 564
 
565 565
 					// TEST #8 : check that config is the requested type
566 566
 					case 8 :
567
-						if ( ! $this->{$section}->{$name} instanceof $config_class ) {
568
-							if ( $display_errors ) {
567
+						if ( ! $this->{$section}->{$name} instanceof $config_class) {
568
+							if ($display_errors) {
569 569
 								throw new EE_Error(
570 570
 									sprintf(
571
-										__( 'The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso' ),
571
+										__('The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso'),
572 572
 										$section,
573 573
 										$name,
574 574
 										$config_class
@@ -581,12 +581,12 @@  discard block
 block discarded – undo
581 581
 
582 582
 					// TEST #9 : verify config object
583 583
 					case 9 :
584
-						if ( ! $config_obj instanceof EE_Config_Base ) {
585
-							if ( $display_errors ) {
584
+						if ( ! $config_obj instanceof EE_Config_Base) {
585
+							if ($display_errors) {
586 586
 								throw new EE_Error(
587 587
 									sprintf(
588
-										__( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ),
589
-										print_r( $config_obj, true )
588
+										__('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'),
589
+										print_r($config_obj, true)
590 590
 									)
591 591
 								);
592 592
 							}
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 				}
598 598
 			}
599 599
 
600
-		} catch( EE_Error $e ) {
600
+		} catch (EE_Error $e) {
601 601
 			$e->get_error();
602 602
 		}
603 603
 		// you have successfully run the gauntlet
@@ -614,8 +614,8 @@  discard block
 block discarded – undo
614 614
 	 * @param        string          $name
615 615
 	 * @return        string
616 616
 	 */
617
-	private function _generate_config_option_name( $section = '', $name = '' ) {
618
-		return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) );
617
+	private function _generate_config_option_name($section = '', $name = '') {
618
+		return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name));
619 619
 	}
620 620
 
621 621
 
@@ -629,10 +629,10 @@  discard block
 block discarded – undo
629 629
 	 * @param 	string $name
630 630
 	 * @return 	string
631 631
 	 */
632
-	private function _set_config_class( $config_class = '', $name = '' ) {
633
-		return ! empty( $config_class )
632
+	private function _set_config_class($config_class = '', $name = '') {
633
+		return ! empty($config_class)
634 634
 			? $config_class
635
-			: str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config';
635
+			: str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config';
636 636
 	}
637 637
 
638 638
 
@@ -646,34 +646,34 @@  discard block
 block discarded – undo
646 646
 	 * @param 	EE_Config_Base $config_obj
647 647
 	 * @return 	EE_Config_Base
648 648
 	 */
649
-	public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) {
649
+	public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) {
650 650
 		// ensure config class is set to something
651
-		$config_class = $this->_set_config_class( $config_class, $name );
651
+		$config_class = $this->_set_config_class($config_class, $name);
652 652
 		// run tests 1-4, 6, and 7 to verify all config params are set and valid
653
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ))) {
653
+		if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) {
654 654
 			return null;
655 655
 		}
656
-		$config_option_name = $this->_generate_config_option_name( $section, $name );
656
+		$config_option_name = $this->_generate_config_option_name($section, $name);
657 657
 		// if the config option name hasn't been added yet to the list of option names we're tracking, then do so now
658
-		if ( ! isset( $this->_config_option_names[ $config_option_name ] )) {
659
-			$this->_config_option_names[ $config_option_name ] = $config_class;
658
+		if ( ! isset($this->_config_option_names[$config_option_name])) {
659
+			$this->_config_option_names[$config_option_name] = $config_class;
660 660
 		}
661 661
 		// verify the incoming config object but suppress errors
662
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false )) {
662
+		if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) {
663 663
 			$config_obj = new $config_class();
664 664
 		}
665
-		if ( get_option( $config_option_name ) ) {
666
-			update_option( $config_option_name, $config_obj );
665
+		if (get_option($config_option_name)) {
666
+			update_option($config_option_name, $config_obj);
667 667
 			$this->{$section}->{$name} = $config_obj;
668 668
 			return $this->{$section}->{$name};
669 669
 		} else {
670 670
 			// create a wp-option for this config
671
-			if ( add_option( $config_option_name, $config_obj, '', 'no' )) {
672
-				$this->{$section}->{$name} = maybe_unserialize( $config_obj );
671
+			if (add_option($config_option_name, $config_obj, '', 'no')) {
672
+				$this->{$section}->{$name} = maybe_unserialize($config_obj);
673 673
 				return $this->{$section}->{$name};
674 674
 			} else {
675 675
 				EE_Error::add_error(
676
-					sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ),
676
+					sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class),
677 677
 					__FILE__, __FUNCTION__, __LINE__
678 678
 				);
679 679
 				return null;
@@ -694,37 +694,37 @@  discard block
 block discarded – undo
694 694
 	 * @param 	bool 					$throw_errors
695 695
 	 * @return 	bool
696 696
 	 */
697
-	public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) {
698
-		$config_obj = maybe_unserialize( $config_obj );
697
+	public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) {
698
+		$config_obj = maybe_unserialize($config_obj);
699 699
 		// get class name of the incoming object
700
-		$config_class = get_class( $config_obj );
700
+		$config_class = get_class($config_obj);
701 701
 		// run tests 1-5 and 9 to verify config
702
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 1, 2, 3, 4, 7, 9 ))) {
702
+		if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(1, 2, 3, 4, 7, 9))) {
703 703
 			return false;
704 704
 		}
705
-		$config_option_name = $this->_generate_config_option_name( $section, $name );
705
+		$config_option_name = $this->_generate_config_option_name($section, $name);
706 706
 		// check if config object has been added to db by seeing if config option name is in $this->_config_option_names array
707
-		if ( ! isset( $this->_config_option_names[ $config_option_name ] )) {
707
+		if ( ! isset($this->_config_option_names[$config_option_name])) {
708 708
 			// save new config to db
709
-			return $this->set_config( $section, $name, $config_class, $config_obj );
709
+			return $this->set_config($section, $name, $config_class, $config_obj);
710 710
 		} else {
711 711
 			// first check if the record already exists
712
-			$existing_config = get_option( $config_option_name );
713
-			$config_obj = serialize( $config_obj );
712
+			$existing_config = get_option($config_option_name);
713
+			$config_obj = serialize($config_obj);
714 714
 			// just return if db record is already up to date
715
-			if ( $existing_config == $config_obj ) {
715
+			if ($existing_config == $config_obj) {
716 716
 				$this->{$section}->{$name} = $config_obj;
717 717
 				return true;
718
-			} else if ( update_option( $config_option_name, $config_obj )) {
718
+			} else if (update_option($config_option_name, $config_obj)) {
719 719
 				// update wp-option for this config class
720 720
 				$this->{$section}->{$name} = $config_obj;
721 721
 				return true;
722
-			} elseif ( $throw_errors ) {
722
+			} elseif ($throw_errors) {
723 723
 				EE_Error::add_error(
724 724
 					sprintf(
725
-						__( 'The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso' ),
725
+						__('The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso'),
726 726
 						$config_class,
727
-						'EE_Config->' . $section . '->' . $name
727
+						'EE_Config->'.$section.'->'.$name
728 728
 					),
729 729
 					__FILE__, __FUNCTION__, __LINE__
730 730
 				);
@@ -744,34 +744,34 @@  discard block
 block discarded – undo
744 744
 	 * @param 	string 	$config_class
745 745
 	 * @return 	mixed EE_Config_Base | NULL
746 746
 	 */
747
-	public function get_config( $section = '', $name = '', $config_class = '' ) {
747
+	public function get_config($section = '', $name = '', $config_class = '') {
748 748
 		// ensure config class is set to something
749
-		$config_class = $this->_set_config_class( $config_class, $name );
749
+		$config_class = $this->_set_config_class($config_class, $name);
750 750
 		// run tests 1-4, 6 and 7 to verify that all params have been set
751
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, NULL, array( 1, 2, 3, 4, 5, 6 ))) {
751
+		if ( ! $this->_verify_config_params($section, $name, $config_class, NULL, array(1, 2, 3, 4, 5, 6))) {
752 752
 			return NULL;
753 753
 		}
754 754
 		// now test if the requested config object exists, but suppress errors
755
-		if ( $this->_verify_config_params( $section, $name, $config_class, NULL, array( 7, 8 ), FALSE )) {
755
+		if ($this->_verify_config_params($section, $name, $config_class, NULL, array(7, 8), FALSE)) {
756 756
 			// config already exists, so pass it back
757 757
 			return $this->{$section}->{$name};
758 758
 		}
759 759
 		// load config option from db if it exists
760
-		$config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ));
760
+		$config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name));
761 761
 		// verify the newly retrieved config object, but suppress errors
762
-		if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), FALSE )) {
762
+		if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), FALSE)) {
763 763
 			// config is good, so set it and pass it back
764 764
 			$this->{$section}->{$name} = $config_obj;
765 765
 			return $this->{$section}->{$name};
766 766
 		}
767 767
 		// oops! $config_obj is not already set and does not exist in the db, so create a new one
768
-		$config_obj =$this->set_config( $section, $name, $config_class );
768
+		$config_obj = $this->set_config($section, $name, $config_class);
769 769
 		// verify the newly created config object
770
-		if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ))) {
770
+		if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) {
771 771
 			return $this->{$section}->{$name};
772 772
 		} else {
773 773
 			EE_Error::add_error(
774
-				sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ),
774
+				sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class),
775 775
 				__FILE__, __FUNCTION__, __LINE__
776 776
 			);
777 777
 		}
@@ -786,9 +786,9 @@  discard block
 block discarded – undo
786 786
 	 * @param 	string 	$config_option_name
787 787
 	 * @return 	mixed EE_Config_Base | FALSE
788 788
 	 */
789
-	public function get_config_option( $config_option_name = '' ) {
789
+	public function get_config_option($config_option_name = '') {
790 790
 		// retrieve the wp-option for this config class.
791
-		return maybe_unserialize( get_option( $config_option_name ));
791
+		return maybe_unserialize(get_option($config_option_name));
792 792
 	}
793 793
 
794 794
 
@@ -803,14 +803,14 @@  discard block
 block discarded – undo
803 803
 	 *  @return 	string
804 804
 	 */
805 805
 	public static function get_page_for_posts() {
806
-		$page_for_posts = get_option( 'page_for_posts' );
807
-		if ( ! $page_for_posts ) {
806
+		$page_for_posts = get_option('page_for_posts');
807
+		if ( ! $page_for_posts) {
808 808
 			return 'posts';
809 809
 		}
810 810
 		/** @type WPDB $wpdb */
811 811
 		global $wpdb;
812 812
 		$SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d";
813
-		return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ));
813
+		return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts));
814 814
 	}
815 815
 
816 816
 
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 	 */
828 828
 	public function register_shortcodes_and_modules() {
829 829
 		// allow shortcodes to register with WP and to set hooks for the rest of the system
830
-		EE_Registry::instance()->shortcodes =$this->_register_shortcodes();
830
+		EE_Registry::instance()->shortcodes = $this->_register_shortcodes();
831 831
 		// allow modules to set hooks for the rest of the system
832 832
 		EE_Registry::instance()->modules = $this->_register_modules();
833 833
 	}
@@ -859,21 +859,21 @@  discard block
 block discarded – undo
859 859
 	public function widgets_init() {
860 860
 		//only init widgets on admin pages when not in complete maintenance, and
861 861
 		//on frontend when not in any maintenance mode
862
-		if (( is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance)  || ! EE_Maintenance_Mode::instance()->level() ) {
862
+		if ((is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level()) {
863 863
 			// grab list of installed widgets
864
-			$widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR );
864
+			$widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR);
865 865
 			// filter list of modules to register
866
-			$widgets_to_register = apply_filters( 'FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register );
866
+			$widgets_to_register = apply_filters('FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register);
867 867
 
868
-			if ( ! empty( $widgets_to_register ) ) {
868
+			if ( ! empty($widgets_to_register)) {
869 869
 				// cycle thru widget folders
870
-				foreach ( $widgets_to_register as $widget_path ) {
870
+				foreach ($widgets_to_register as $widget_path) {
871 871
 					// add to list of installed widget modules
872
-					EE_Config::register_ee_widget( $widget_path );
872
+					EE_Config::register_ee_widget($widget_path);
873 873
 				}
874 874
 			}
875 875
 			// filter list of installed modules
876
-			EE_Registry::instance()->widgets = apply_filters( 'FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets );
876
+			EE_Registry::instance()->widgets = apply_filters('FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets);
877 877
 		}
878 878
 	}
879 879
 
@@ -886,54 +886,54 @@  discard block
 block discarded – undo
886 886
 	 *  @param 	string 	$widget_path - full path up to and including widget folder
887 887
 	 *  @return 	void
888 888
 	 */
889
-	public static function register_ee_widget( $widget_path = NULL ) {
890
-		do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path );
889
+	public static function register_ee_widget($widget_path = NULL) {
890
+		do_action('AHEE__EE_Config__register_widget__begin', $widget_path);
891 891
 		$widget_ext = '.widget.php';
892 892
 		// make all separators match
893
-		$widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS );
893
+		$widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS);
894 894
 		// does the file path INCLUDE the actual file name as part of the path ?
895
-		if ( strpos( $widget_path, $widget_ext ) !== FALSE ) {
895
+		if (strpos($widget_path, $widget_ext) !== FALSE) {
896 896
 			// grab and shortcode file name from directory name and break apart at dots
897
-			$file_name = explode( '.', basename( $widget_path ));
897
+			$file_name = explode('.', basename($widget_path));
898 898
 			// take first segment from file name pieces and remove class prefix if it exists
899
-			$widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0];
899
+			$widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0];
900 900
 			// sanitize shortcode directory name
901
-			$widget = sanitize_key( $widget );
901
+			$widget = sanitize_key($widget);
902 902
 			// now we need to rebuild the shortcode path
903
-			$widget_path = explode( DS, $widget_path );
903
+			$widget_path = explode(DS, $widget_path);
904 904
 			// remove last segment
905
-			array_pop( $widget_path );
905
+			array_pop($widget_path);
906 906
 			// glue it back together
907
-			$widget_path = implode( DS, $widget_path );
907
+			$widget_path = implode(DS, $widget_path);
908 908
 		} else {
909 909
 			// grab and sanitize widget directory name
910
-			$widget = sanitize_key( basename( $widget_path ));
910
+			$widget = sanitize_key(basename($widget_path));
911 911
 		}
912 912
 		// create classname from widget directory name
913
-		$widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget )));
913
+		$widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget)));
914 914
 		// add class prefix
915
-		$widget_class = 'EEW_' . $widget;
915
+		$widget_class = 'EEW_'.$widget;
916 916
 		// does the widget exist ?
917
-		if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext )) {
917
+		if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) {
918 918
 			$msg = sprintf(
919
-				__( 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso' ),
919
+				__('The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso'),
920 920
 				$widget_class,
921
-				$widget_path . DS . $widget_class . $widget_ext
921
+				$widget_path.DS.$widget_class.$widget_ext
922 922
 			);
923
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
923
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
924 924
 			return;
925 925
 		}
926 926
 		// load the widget class file
927
-		require_once( $widget_path . DS . $widget_class . $widget_ext );
927
+		require_once($widget_path.DS.$widget_class.$widget_ext);
928 928
 		// verify that class exists
929
-		if ( ! class_exists( $widget_class )) {
930
-			$msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class );
931
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
929
+		if ( ! class_exists($widget_class)) {
930
+			$msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class);
931
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
932 932
 			return;
933 933
 		}
934
-		register_widget( $widget_class );
934
+		register_widget($widget_class);
935 935
 		// add to array of registered widgets
936
-		EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext;
936
+		EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext;
937 937
 	}
938 938
 
939 939
 
@@ -946,18 +946,18 @@  discard block
 block discarded – undo
946 946
 	 */
947 947
 	private function _register_shortcodes() {
948 948
 		// grab list of installed shortcodes
949
-		$shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR );
949
+		$shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR);
950 950
 		// filter list of modules to register
951
-		$shortcodes_to_register = apply_filters( 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register );
952
-		if ( ! empty( $shortcodes_to_register ) ) {
951
+		$shortcodes_to_register = apply_filters('FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register);
952
+		if ( ! empty($shortcodes_to_register)) {
953 953
 			// cycle thru shortcode folders
954
-			foreach ( $shortcodes_to_register as $shortcode_path ) {
954
+			foreach ($shortcodes_to_register as $shortcode_path) {
955 955
 				// add to list of installed shortcode modules
956
-				EE_Config::register_shortcode( $shortcode_path );
956
+				EE_Config::register_shortcode($shortcode_path);
957 957
 			}
958 958
 		}
959 959
 		// filter list of installed modules
960
-		return apply_filters( 'FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes );
960
+		return apply_filters('FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes);
961 961
 	}
962 962
 
963 963
 
@@ -969,56 +969,56 @@  discard block
 block discarded – undo
969 969
 	 *  @param 	string 		$shortcode_path - full path up to and including shortcode folder
970 970
 	 *  @return 	bool
971 971
 	 */
972
-	public static function register_shortcode( $shortcode_path = NULL ) {
973
-		do_action( 'AHEE__EE_Config__register_shortcode__begin',$shortcode_path );
972
+	public static function register_shortcode($shortcode_path = NULL) {
973
+		do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path);
974 974
 		$shortcode_ext = '.shortcode.php';
975 975
 		// make all separators match
976
-		$shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path );
976
+		$shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path);
977 977
 		// does the file path INCLUDE the actual file name as part of the path ?
978
-		if ( strpos( $shortcode_path, $shortcode_ext ) !== FALSE ) {
978
+		if (strpos($shortcode_path, $shortcode_ext) !== FALSE) {
979 979
 			// grab shortcode file name from directory name and break apart at dots
980
-			$shortcode_file = explode( '.', basename( $shortcode_path ));
980
+			$shortcode_file = explode('.', basename($shortcode_path));
981 981
 			// take first segment from file name pieces and remove class prefix if it exists
982
-			$shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 ? substr( $shortcode_file[0], 4 ) : $shortcode_file[0];
982
+			$shortcode = strpos($shortcode_file[0], 'EES_') === 0 ? substr($shortcode_file[0], 4) : $shortcode_file[0];
983 983
 			// sanitize shortcode directory name
984
-			$shortcode = sanitize_key( $shortcode );
984
+			$shortcode = sanitize_key($shortcode);
985 985
 			// now we need to rebuild the shortcode path
986
-			$shortcode_path = explode( DS, $shortcode_path );
986
+			$shortcode_path = explode(DS, $shortcode_path);
987 987
 			// remove last segment
988
-			array_pop( $shortcode_path );
988
+			array_pop($shortcode_path);
989 989
 			// glue it back together
990
-			$shortcode_path = implode( DS, $shortcode_path ) . DS;
990
+			$shortcode_path = implode(DS, $shortcode_path).DS;
991 991
 		} else {
992 992
 			// we need to generate the filename based off of the folder name
993 993
 			// grab and sanitize shortcode directory name
994
-			$shortcode = sanitize_key( basename( $shortcode_path ));
995
-			$shortcode_path = rtrim( $shortcode_path, DS ) . DS;
994
+			$shortcode = sanitize_key(basename($shortcode_path));
995
+			$shortcode_path = rtrim($shortcode_path, DS).DS;
996 996
 		}
997 997
 		// create classname from shortcode directory or file name
998
-		$shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode )));
998
+		$shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode)));
999 999
 		// add class prefix
1000
-		$shortcode_class = 'EES_' . $shortcode;
1000
+		$shortcode_class = 'EES_'.$shortcode;
1001 1001
 		// does the shortcode exist ?
1002
-		if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext )) {
1002
+		if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) {
1003 1003
 			$msg = sprintf(
1004
-				__( 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso' ),
1004
+				__('The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso'),
1005 1005
 				$shortcode_class,
1006
-				$shortcode_path . DS . $shortcode_class . $shortcode_ext
1006
+				$shortcode_path.DS.$shortcode_class.$shortcode_ext
1007 1007
 			);
1008
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1008
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1009 1009
 			return FALSE;
1010 1010
 		}
1011 1011
 		// load the shortcode class file
1012
-		require_once( $shortcode_path . $shortcode_class . $shortcode_ext );
1012
+		require_once($shortcode_path.$shortcode_class.$shortcode_ext);
1013 1013
 		// verify that class exists
1014
-		if ( ! class_exists( $shortcode_class )) {
1015
-			$msg = sprintf( __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), $shortcode_class );
1016
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1014
+		if ( ! class_exists($shortcode_class)) {
1015
+			$msg = sprintf(__('The requested %s shortcode class does not exist.', 'event_espresso'), $shortcode_class);
1016
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1017 1017
 			return FALSE;
1018 1018
 		}
1019
-		$shortcode = strtoupper( $shortcode );
1019
+		$shortcode = strtoupper($shortcode);
1020 1020
 		// add to array of registered shortcodes
1021
-		EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext;
1021
+		EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext;
1022 1022
 		return TRUE;
1023 1023
 	}
1024 1024
 
@@ -1033,23 +1033,23 @@  discard block
 block discarded – undo
1033 1033
 	 */
1034 1034
 	private function _register_modules() {
1035 1035
 		// grab list of installed modules
1036
-		$modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR );
1036
+		$modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR);
1037 1037
 		// filter list of modules to register
1038
-		$modules_to_register = apply_filters( 'FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register );
1038
+		$modules_to_register = apply_filters('FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register);
1039 1039
 
1040 1040
 
1041
-		if ( ! empty( $modules_to_register ) ) {
1041
+		if ( ! empty($modules_to_register)) {
1042 1042
 			// loop through folders
1043
-			foreach ( $modules_to_register as $module_path ) {
1043
+			foreach ($modules_to_register as $module_path) {
1044 1044
 				/**TEMPORARILY EXCLUDE gateways from modules for time being**/
1045
-				if ( $module_path != EE_MODULES . 'zzz-copy-this-module-template' && $module_path != EE_MODULES . 'gateways' ) {
1045
+				if ($module_path != EE_MODULES.'zzz-copy-this-module-template' && $module_path != EE_MODULES.'gateways') {
1046 1046
 					// add to list of installed modules
1047
-					EE_Config::register_module( $module_path );
1047
+					EE_Config::register_module($module_path);
1048 1048
 				}
1049 1049
 			}
1050 1050
 		}
1051 1051
 		// filter list of installed modules
1052
-		return apply_filters( 'FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules );
1052
+		return apply_filters('FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules);
1053 1053
 	}
1054 1054
 
1055 1055
 
@@ -1062,54 +1062,54 @@  discard block
 block discarded – undo
1062 1062
 	 *  @param 	string 		$module_path - full path up to and including module folder
1063 1063
 	 *  @return 	bool
1064 1064
 	 */
1065
-	public static function register_module( $module_path = NULL ) {
1066
-		do_action( 'AHEE__EE_Config__register_module__begin', $module_path );
1065
+	public static function register_module($module_path = NULL) {
1066
+		do_action('AHEE__EE_Config__register_module__begin', $module_path);
1067 1067
 		$module_ext = '.module.php';
1068 1068
 		// make all separators match
1069
-		$module_path = str_replace( array( '\\', '/' ), DS, $module_path );
1069
+		$module_path = str_replace(array('\\', '/'), DS, $module_path);
1070 1070
 		// does the file path INCLUDE the actual file name as part of the path ?
1071
-		if ( strpos( $module_path, $module_ext ) !== FALSE ) {
1071
+		if (strpos($module_path, $module_ext) !== FALSE) {
1072 1072
 			// grab and shortcode file name from directory name and break apart at dots
1073
-			$module_file = explode( '.', basename( $module_path ));
1073
+			$module_file = explode('.', basename($module_path));
1074 1074
 			// now we need to rebuild the shortcode path
1075
-			$module_path = explode( DS, $module_path );
1075
+			$module_path = explode(DS, $module_path);
1076 1076
 			// remove last segment
1077
-			array_pop( $module_path );
1077
+			array_pop($module_path);
1078 1078
 			// glue it back together
1079
-			$module_path = implode( DS, $module_path ) . DS;
1079
+			$module_path = implode(DS, $module_path).DS;
1080 1080
 			// take first segment from file name pieces and sanitize it
1081
-			$module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] );
1081
+			$module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]);
1082 1082
 			// ensure class prefix is added
1083
-			$module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module;
1083
+			$module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module;
1084 1084
 		} else {
1085 1085
 			// we need to generate the filename based off of the folder name
1086 1086
 			// grab and sanitize module name
1087
-			$module = strtolower( basename( $module_path ));
1088
-			$module = preg_replace( '/[^a-z0-9_\-]/', '', $module);
1087
+			$module = strtolower(basename($module_path));
1088
+			$module = preg_replace('/[^a-z0-9_\-]/', '', $module);
1089 1089
 			// like trailingslashit()
1090
-			$module_path = rtrim( $module_path, DS ) . DS;
1090
+			$module_path = rtrim($module_path, DS).DS;
1091 1091
 			// create classname from module directory name
1092
-			$module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module )));
1092
+			$module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module)));
1093 1093
 			// add class prefix
1094
-			$module_class = 'EED_' . $module;
1094
+			$module_class = 'EED_'.$module;
1095 1095
 		}
1096 1096
 		// does the module exist ?
1097
-		if ( ! is_readable( $module_path . DS . $module_class . $module_ext )) {
1098
-			$msg = sprintf( __( 'The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module );
1099
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1097
+		if ( ! is_readable($module_path.DS.$module_class.$module_ext)) {
1098
+			$msg = sprintf(__('The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso'), $module);
1099
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1100 1100
 			return FALSE;
1101 1101
 		}
1102 1102
 		// load the module class file
1103
-		require_once( $module_path . $module_class . $module_ext );
1103
+		require_once($module_path.$module_class.$module_ext);
1104 1104
 		// verify that class exists
1105
-		if ( ! class_exists( $module_class )) {
1106
-			$msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class );
1107
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1105
+		if ( ! class_exists($module_class)) {
1106
+			$msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class);
1107
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1108 1108
 			return FALSE;
1109 1109
 		}
1110 1110
 		// add to array of registered modules
1111
-		EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext;
1112
-		do_action( 'AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->{$module_class} );
1111
+		EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext;
1112
+		do_action('AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->{$module_class} );
1113 1113
 		return TRUE;
1114 1114
 	}
1115 1115
 
@@ -1123,23 +1123,23 @@  discard block
 block discarded – undo
1123 1123
 	 */
1124 1124
 	private function _initialize_shortcodes() {
1125 1125
 		// cycle thru shortcode folders
1126
-		foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) {
1126
+		foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) {
1127 1127
 			// add class prefix
1128
-			$shortcode_class = 'EES_' . $shortcode;
1128
+			$shortcode_class = 'EES_'.$shortcode;
1129 1129
 			// fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
1130 1130
 			// which set hooks ?
1131
-			if ( is_admin() ) {
1131
+			if (is_admin()) {
1132 1132
 				// fire immediately
1133
-				call_user_func( array( $shortcode_class, 'set_hooks_admin' ));
1133
+				call_user_func(array($shortcode_class, 'set_hooks_admin'));
1134 1134
 			} else {
1135 1135
 				// delay until other systems are online
1136
-				add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $shortcode_class,'set_hooks' ));
1136
+				add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($shortcode_class, 'set_hooks'));
1137 1137
 				// convert classname to UPPERCASE and create WP shortcode.
1138
-				$shortcode_tag = strtoupper( $shortcode );
1138
+				$shortcode_tag = strtoupper($shortcode);
1139 1139
 				// but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor'
1140
-				if ( ! shortcode_exists( $shortcode_tag )) {
1140
+				if ( ! shortcode_exists($shortcode_tag)) {
1141 1141
 					// NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes()
1142
-					add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ));
1142
+					add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor'));
1143 1143
 				}
1144 1144
 			}
1145 1145
 		}
@@ -1156,15 +1156,15 @@  discard block
 block discarded – undo
1156 1156
 	 */
1157 1157
 	private function _initialize_modules() {
1158 1158
 		// cycle thru shortcode folders
1159
-		foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) {
1159
+		foreach (EE_Registry::instance()->modules as $module_class => $module_path) {
1160 1160
 			// fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
1161 1161
 			// which set hooks ?
1162
-			if ( is_admin() ) {
1162
+			if (is_admin()) {
1163 1163
 				// fire immediately
1164
-				call_user_func( array( $module_class, 'set_hooks_admin' ));
1164
+				call_user_func(array($module_class, 'set_hooks_admin'));
1165 1165
 			} else {
1166 1166
 				// delay until other systems are online
1167
-				add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $module_class,'set_hooks' ));
1167
+				add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($module_class, 'set_hooks'));
1168 1168
 			}
1169 1169
 		}
1170 1170
 	}
@@ -1182,26 +1182,26 @@  discard block
 block discarded – undo
1182 1182
 	 *  @param 	string 		$key - url param key indicating a route is being called
1183 1183
 	 *  @return 	bool
1184 1184
 	 */
1185
-	public static function register_route( $route = NULL, $module = NULL, $method_name = NULL, $key = 'ee' ) {
1186
-		do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name );
1187
-		$module = str_replace( 'EED_', '', $module );
1188
-		$module_class = 'EED_' . $module;
1189
-		if ( ! isset( EE_Registry::instance()->modules->{$module_class} )) {
1190
-			$msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module );
1191
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1185
+	public static function register_route($route = NULL, $module = NULL, $method_name = NULL, $key = 'ee') {
1186
+		do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name);
1187
+		$module = str_replace('EED_', '', $module);
1188
+		$module_class = 'EED_'.$module;
1189
+		if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) {
1190
+			$msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module);
1191
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1192 1192
 			return FALSE;
1193 1193
 		}
1194
-		if ( empty( $route )) {
1195
-			$msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route );
1196
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1194
+		if (empty($route)) {
1195
+			$msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route);
1196
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1197 1197
 			return FALSE;
1198 1198
 		}
1199
-		if ( ! method_exists ( 'EED_' . $module, $method_name )) {
1200
-			$msg = sprintf( __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), $route );
1201
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1199
+		if ( ! method_exists('EED_'.$module, $method_name)) {
1200
+			$msg = sprintf(__('A valid class method for the %s route has not been supplied.', 'event_espresso'), $route);
1201
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1202 1202
 			return FALSE;
1203 1203
 		}
1204
-		EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name );
1204
+		EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name);
1205 1205
 		return TRUE;
1206 1206
 	}
1207 1207
 
@@ -1215,11 +1215,11 @@  discard block
 block discarded – undo
1215 1215
 	 *  @param 	string 		$key - url param key indicating a route is being called
1216 1216
 	 *  @return 	string
1217 1217
 	 */
1218
-	public static function get_route( $route = NULL, $key = 'ee' ) {
1219
-		do_action( 'AHEE__EE_Config__get_route__begin',$route );
1220
-		$route = apply_filters( 'FHEE__EE_Config__get_route',$route );
1221
-		if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] )) {
1222
-			return EE_Config::$_module_route_map[ $key ][ $route ];
1218
+	public static function get_route($route = NULL, $key = 'ee') {
1219
+		do_action('AHEE__EE_Config__get_route__begin', $route);
1220
+		$route = apply_filters('FHEE__EE_Config__get_route', $route);
1221
+		if (isset(EE_Config::$_module_route_map[$key][$route])) {
1222
+			return EE_Config::$_module_route_map[$key][$route];
1223 1223
 		}
1224 1224
 		return NULL;
1225 1225
 	}
@@ -1248,35 +1248,35 @@  discard block
 block discarded – undo
1248 1248
 	 * @param    string 		$key - url param key indicating a route is being called
1249 1249
 	 * @return    bool
1250 1250
 	 */
1251
-	public static function register_forward( $route = NULL, $status = 0, $forward = NULL, $key = 'ee' ) {
1252
-		do_action( 'AHEE__EE_Config__register_forward',$route,$status,$forward );
1253
-		if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ||  empty( $route )) {
1254
-			$msg = sprintf( __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), $route );
1255
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1251
+	public static function register_forward($route = NULL, $status = 0, $forward = NULL, $key = 'ee') {
1252
+		do_action('AHEE__EE_Config__register_forward', $route, $status, $forward);
1253
+		if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) {
1254
+			$msg = sprintf(__('The module route %s for this forward has not been registered.', 'event_espresso'), $route);
1255
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1256 1256
 			return FALSE;
1257 1257
 		}
1258
-		if ( empty( $forward )) {
1259
-			$msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route );
1260
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1258
+		if (empty($forward)) {
1259
+			$msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route);
1260
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1261 1261
 			return FALSE;
1262 1262
 		}
1263
-		if ( is_array( $forward )) {
1264
-			if ( ! isset( $forward[1] )) {
1265
-				$msg = sprintf( __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), $route );
1266
-				EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1263
+		if (is_array($forward)) {
1264
+			if ( ! isset($forward[1])) {
1265
+				$msg = sprintf(__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), $route);
1266
+				EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1267 1267
 				return FALSE;
1268 1268
 			}
1269
-			if ( ! method_exists( $forward[0], $forward[1] )) {
1270
-				$msg = sprintf( __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward[1], $route );
1271
-				EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1269
+			if ( ! method_exists($forward[0], $forward[1])) {
1270
+				$msg = sprintf(__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward[1], $route);
1271
+				EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1272 1272
 				return FALSE;
1273 1273
 			}
1274
-		} else if ( ! function_exists( $forward )) {
1275
-			$msg = sprintf( __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward, $route );
1276
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1274
+		} else if ( ! function_exists($forward)) {
1275
+			$msg = sprintf(__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward, $route);
1276
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1277 1277
 			return FALSE;
1278 1278
 		}
1279
-		EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward;
1279
+		EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward;
1280 1280
 		return TRUE;
1281 1281
 	}
1282 1282
 
@@ -1291,10 +1291,10 @@  discard block
 block discarded – undo
1291 1291
 	 *  @param    string 		$key - url param key indicating a route is being called
1292 1292
 	 *  @return 	string
1293 1293
 	 */
1294
-	public static function get_forward( $route = NULL, $status = 0, $key = 'ee' ) {
1295
-		do_action( 'AHEE__EE_Config__get_forward__begin',$route,$status );
1296
-		if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] )) {
1297
-			return apply_filters( 'FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], $route,$status );
1294
+	public static function get_forward($route = NULL, $status = 0, $key = 'ee') {
1295
+		do_action('AHEE__EE_Config__get_forward__begin', $route, $status);
1296
+		if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) {
1297
+			return apply_filters('FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[$key][$route][$status], $route, $status);
1298 1298
 		}
1299 1299
 		return NULL;
1300 1300
 	}
@@ -1311,19 +1311,19 @@  discard block
 block discarded – undo
1311 1311
 	 * @param    string 		$key - url param key indicating a route is being called
1312 1312
 	 * @return    bool
1313 1313
 	 */
1314
-	public static function register_view( $route = NULL, $status = 0, $view = NULL, $key = 'ee' ) {
1315
-		do_action( 'AHEE__EE_Config__register_view__begin',$route,$status,$view );
1316
-		if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ||  empty( $route )) {
1317
-			$msg = sprintf( __( 'The module route %s for this view has not been registered.', 'event_espresso' ), $route );
1318
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1314
+	public static function register_view($route = NULL, $status = 0, $view = NULL, $key = 'ee') {
1315
+		do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view);
1316
+		if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) {
1317
+			$msg = sprintf(__('The module route %s for this view has not been registered.', 'event_espresso'), $route);
1318
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1319 1319
 			return FALSE;
1320 1320
 		}
1321
-		if ( ! is_readable( $view )) {
1322
-			$msg = sprintf( __( 'The %s view file could not be found or is not readable due to file permissions.', 'event_espresso' ), $view );
1323
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1321
+		if ( ! is_readable($view)) {
1322
+			$msg = sprintf(__('The %s view file could not be found or is not readable due to file permissions.', 'event_espresso'), $view);
1323
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1324 1324
 			return FALSE;
1325 1325
 		}
1326
-		EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view;
1326
+		EE_Config::$_module_view_map[$key][$route][absint($status)] = $view;
1327 1327
 		return TRUE;
1328 1328
 	}
1329 1329
 
@@ -1340,10 +1340,10 @@  discard block
 block discarded – undo
1340 1340
 	 *  @param    string 		$key - url param key indicating a route is being called
1341 1341
 	 *  @return 	string
1342 1342
 	 */
1343
-	public static function get_view( $route = NULL, $status = 0, $key = 'ee' ) {
1344
-		do_action( 'AHEE__EE_Config__get_view__begin',$route,$status );
1345
-		if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] )) {
1346
-			return apply_filters( 'FHEE__EE_Config__get_view', EE_Config::$_module_view_map[ $key ][ $route ][ $status ], $route,$status );
1343
+	public static function get_view($route = NULL, $status = 0, $key = 'ee') {
1344
+		do_action('AHEE__EE_Config__get_view__begin', $route, $status);
1345
+		if (isset(EE_Config::$_module_view_map[$key][$route][$status])) {
1346
+			return apply_filters('FHEE__EE_Config__get_view', EE_Config::$_module_view_map[$key][$route][$status], $route, $status);
1347 1347
 		}
1348 1348
 		return NULL;
1349 1349
 	}
@@ -1351,7 +1351,7 @@  discard block
 block discarded – undo
1351 1351
 
1352 1352
 
1353 1353
 	public function shutdown() {
1354
-		update_option( 'ee_config_option_names', $this->_config_option_names );
1354
+		update_option('ee_config_option_names', $this->_config_option_names);
1355 1355
 	}
1356 1356
 
1357 1357
 
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
  * magic functions in use, except we'll allow them to magically set and get stuff...
1368 1368
  * basically, they should just be well-defined stdClasses
1369 1369
  */
1370
-class EE_Config_Base{
1370
+class EE_Config_Base {
1371 1371
 
1372 1372
 	/**
1373 1373
 	 * Utility function for escaping the value of a property and returning.
@@ -1376,13 +1376,13 @@  discard block
 block discarded – undo
1376 1376
 	 * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned.
1377 1377
 	 * @throws \EE_Error
1378 1378
 	 */
1379
-	public function get_pretty( $property ) {
1380
-		if ( ! property_exists( $this, $property ) ) {
1381
-			throw new EE_Error( sprintf( __('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso' ), get_class( $this ), $property ) );
1379
+	public function get_pretty($property) {
1380
+		if ( ! property_exists($this, $property)) {
1381
+			throw new EE_Error(sprintf(__('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso'), get_class($this), $property));
1382 1382
 		}
1383 1383
 		//just handling escaping of strings for now.
1384
-		if ( is_string( $this->{$property} ) ) {
1385
-			return stripslashes( $this->{$property} );
1384
+		if (is_string($this->{$property} )) {
1385
+			return stripslashes($this->{$property} );
1386 1386
 		}
1387 1387
 		return $this->{$property};
1388 1388
 	}
@@ -1391,19 +1391,19 @@  discard block
 block discarded – undo
1391 1391
 
1392 1392
 	public function populate() {
1393 1393
 		//grab defaults via a new instance of this class.
1394
-		$class_name = get_class( $this );
1394
+		$class_name = get_class($this);
1395 1395
 		$defaults = new $class_name;
1396 1396
 
1397 1397
 		//loop through the properties for this class and see if they are set.  If they are NOT, then grab the
1398 1398
 		//default from our $defaults object.
1399
-		foreach ( get_object_vars( $defaults ) as $property => $value ) {
1400
-			if ( is_null( $this->{$property} ) ) {
1399
+		foreach (get_object_vars($defaults) as $property => $value) {
1400
+			if (is_null($this->{$property} )) {
1401 1401
 				$this->{$property} = $value;
1402 1402
 			}
1403 1403
 		}
1404 1404
 
1405 1405
 		//cleanup
1406
-		unset( $defaults );
1406
+		unset($defaults);
1407 1407
 	}
1408 1408
 
1409 1409
 
@@ -1495,12 +1495,12 @@  discard block
 block discarded – undo
1495 1495
 	 */
1496 1496
 	public function __construct() {
1497 1497
 		$current_network_main_site = is_multisite() ? get_current_site() : NULL;
1498
-		$current_main_site_id = !empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1;
1498
+		$current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1;
1499 1499
 		// set default organization settings
1500 1500
 		$this->current_blog_id = get_current_blog_id();
1501 1501
 		$this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id;
1502
-		$this->ee_ueip_optin = is_main_site() ? get_option( 'ee_ueip_optin', TRUE ) : get_blog_option( $current_main_site_id, 'ee_ueip_optin', TRUE );
1503
-		$this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', FALSE ) : TRUE;
1502
+		$this->ee_ueip_optin = is_main_site() ? get_option('ee_ueip_optin', TRUE) : get_blog_option($current_main_site_id, 'ee_ueip_optin', TRUE);
1503
+		$this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', FALSE) : TRUE;
1504 1504
 		$this->post_shortcodes = array();
1505 1505
 		$this->module_route_map = array();
1506 1506
 		$this->module_forward_map = array();
@@ -1519,7 +1519,7 @@  discard block
 block discarded – undo
1519 1519
 		$this->event_cpt_slug = __('events', 'event_espresso');
1520 1520
 
1521 1521
 		//ueip constant check
1522
-		if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) {
1522
+		if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) {
1523 1523
 			$this->ee_ueip_optin = FALSE;
1524 1524
 			$this->ee_ueip_has_notified = TRUE;
1525 1525
 		}
@@ -1559,8 +1559,8 @@  discard block
 block discarded – undo
1559 1559
 	 *  @return 	string
1560 1560
 	 */
1561 1561
 	public function reg_page_url() {
1562
-		if ( ! $this->reg_page_url ) {
1563
-			$this->reg_page_url = get_permalink( $this->reg_page_id ) . '#checkout';
1562
+		if ( ! $this->reg_page_url) {
1563
+			$this->reg_page_url = get_permalink($this->reg_page_id).'#checkout';
1564 1564
 		}
1565 1565
 		return $this->reg_page_url;
1566 1566
 	}
@@ -1573,12 +1573,12 @@  discard block
 block discarded – undo
1573 1573
 	 *  @return 	string
1574 1574
 	 */
1575 1575
 	public function txn_page_url($query_args = array()) {
1576
-		if ( ! $this->txn_page_url ) {
1577
-			$this->txn_page_url = get_permalink( $this->txn_page_id );
1576
+		if ( ! $this->txn_page_url) {
1577
+			$this->txn_page_url = get_permalink($this->txn_page_id);
1578 1578
 		}
1579
-		if($query_args){
1580
-			return add_query_arg($query_args,$this->txn_page_url);
1581
-		}else{
1579
+		if ($query_args) {
1580
+			return add_query_arg($query_args, $this->txn_page_url);
1581
+		} else {
1582 1582
 			return $this->txn_page_url;
1583 1583
 		}
1584 1584
 	}
@@ -1590,12 +1590,12 @@  discard block
 block discarded – undo
1590 1590
 	 *  @return 	string
1591 1591
 	 */
1592 1592
 	public function thank_you_page_url($query_args = array()) {
1593
-		if ( ! $this->thank_you_page_url ) {
1594
-			$this->thank_you_page_url = get_permalink( $this->thank_you_page_id );
1593
+		if ( ! $this->thank_you_page_url) {
1594
+			$this->thank_you_page_url = get_permalink($this->thank_you_page_id);
1595 1595
 		}
1596
-		if($query_args){
1597
-			return add_query_arg($query_args,$this->thank_you_page_url);
1598
-		}else{
1596
+		if ($query_args) {
1597
+			return add_query_arg($query_args, $this->thank_you_page_url);
1598
+		} else {
1599 1599
 			return $this->thank_you_page_url;
1600 1600
 		}
1601 1601
 	}
@@ -1606,8 +1606,8 @@  discard block
 block discarded – undo
1606 1606
 	 *  @return 	string
1607 1607
 	 */
1608 1608
 	public function cancel_page_url() {
1609
-		if ( ! $this->cancel_page_url ) {
1610
-			$this->cancel_page_url = get_permalink( $this->cancel_page_id );
1609
+		if ( ! $this->cancel_page_url) {
1610
+			$this->cancel_page_url = get_permalink($this->cancel_page_id);
1611 1611
 		}
1612 1612
 		return $this->cancel_page_url;
1613 1613
 	}
@@ -1635,7 +1635,7 @@  discard block
 block discarded – undo
1635 1635
 		//reset all url properties
1636 1636
 		$this->_reset_urls();
1637 1637
 		//return what to save to db
1638
-		return array_keys( get_object_vars( $this ) );
1638
+		return array_keys(get_object_vars($this));
1639 1639
 	}
1640 1640
 
1641 1641
 }
@@ -1867,38 +1867,38 @@  discard block
 block discarded – undo
1867 1867
 	 * @param null $CNT_ISO
1868 1868
 	 * @return \EE_Currency_Config
1869 1869
 	 */
1870
-	public function __construct( $CNT_ISO = NULL ) {
1870
+	public function __construct($CNT_ISO = NULL) {
1871 1871
 
1872 1872
 		// get country code from organization settings or use default
1873
-		$ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL;
1873
+		$ORG_CNT = isset(EE_Registry::instance()->CFG->organization) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL;
1874 1874
 		// but override if requested
1875
-		$CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT;
1875
+		$CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT;
1876 1876
 		// so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists
1877
-		if ( ! empty( $CNT_ISO ) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) ) {
1877
+		if ( ! empty($CNT_ISO) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table())) {
1878 1878
 			// retrieve the country settings from the db, just in case they have been customized
1879
-			$country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO );
1880
-			if ( $country instanceof EE_Country ) {
1881
-				$this->code = $country->currency_code(); 	// currency code: USD, CAD, EUR
1882
-				$this->name = $country->currency_name_single();	// Dollar
1883
-				$this->plural = $country->currency_name_plural(); 	// Dollars
1884
-				$this->sign =  $country->currency_sign(); 			// currency sign: $
1885
-				$this->sign_b4 = $country->currency_sign_before(); 		// currency sign before or after: $TRUE  or  FALSE$
1886
-				$this->dec_plc = $country->currency_decimal_places();	// decimal places: 2 = 0.00  3 = 0.000
1887
-				$this->dec_mrk = $country->currency_decimal_mark();	// decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
1888
-				$this->thsnds = $country->currency_thousands_separator();	// thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
1879
+			$country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO);
1880
+			if ($country instanceof EE_Country) {
1881
+				$this->code = $country->currency_code(); // currency code: USD, CAD, EUR
1882
+				$this->name = $country->currency_name_single(); // Dollar
1883
+				$this->plural = $country->currency_name_plural(); // Dollars
1884
+				$this->sign = $country->currency_sign(); // currency sign: $
1885
+				$this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE  or  FALSE$
1886
+				$this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00  3 = 0.000
1887
+				$this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
1888
+				$this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
1889 1889
 			}
1890 1890
 		}
1891 1891
 		// fallback to hardcoded defaults, in case the above failed
1892
-		if ( empty( $this->code )) {
1892
+		if (empty($this->code)) {
1893 1893
 			// set default currency settings
1894
-			$this->code = 'USD'; 	// currency code: USD, CAD, EUR
1895
-			$this->name = __( 'Dollar', 'event_espresso' ); 	// Dollar
1896
-			$this->plural = __( 'Dollars', 'event_espresso' ); 	// Dollars
1897
-			$this->sign =  '$'; 	// currency sign: $
1898
-			$this->sign_b4 = TRUE; 	// currency sign before or after: $TRUE  or  FALSE$
1899
-			$this->dec_plc = 2; 	// decimal places: 2 = 0.00  3 = 0.000
1900
-			$this->dec_mrk = '.'; 	// decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
1901
-			$this->thsnds = ','; 	// thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
1894
+			$this->code = 'USD'; // currency code: USD, CAD, EUR
1895
+			$this->name = __('Dollar', 'event_espresso'); // Dollar
1896
+			$this->plural = __('Dollars', 'event_espresso'); // Dollars
1897
+			$this->sign = '$'; // currency sign: $
1898
+			$this->sign_b4 = TRUE; // currency sign before or after: $TRUE  or  FALSE$
1899
+			$this->dec_plc = 2; // decimal places: 2 = 0.00  3 = 0.000
1900
+			$this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
1901
+			$this->thsnds = ','; // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
1902 1902
 		}
1903 1903
 	}
1904 1904
 }
@@ -2047,7 +2047,7 @@  discard block
 block discarded – undo
2047 2047
 	 * @since 4.8.8.rc.019
2048 2048
 	 */
2049 2049
 	public function do_hooks() {
2050
-		add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ));
2050
+		add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event'));
2051 2051
 	}
2052 2052
 
2053 2053
 
@@ -2055,7 +2055,7 @@  discard block
 block discarded – undo
2055 2055
 	 * @return void
2056 2056
 	 */
2057 2057
 	public function set_default_reg_status_on_EEM_Event() {
2058
-		EEM_Event::set_default_reg_status( $this->default_STS_ID );
2058
+		EEM_Event::set_default_reg_status($this->default_STS_ID);
2059 2059
 	}
2060 2060
 
2061 2061
 
@@ -2160,10 +2160,10 @@  discard block
 block discarded – undo
2160 2160
 	 * @param bool $reset
2161 2161
 	 * @return string
2162 2162
 	 */
2163
-	public function log_file_name( $reset = FALSE ) {
2164
-		if ( empty( $this->log_file_name ) || $reset ) {
2165
-			$this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', TRUE ))) . '.txt';
2166
-			EE_Config::instance()->update_espresso_config( FALSE, FALSE );
2163
+	public function log_file_name($reset = FALSE) {
2164
+		if (empty($this->log_file_name) || $reset) {
2165
+			$this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', TRUE))).'.txt';
2166
+			EE_Config::instance()->update_espresso_config(FALSE, FALSE);
2167 2167
 		}
2168 2168
 		return $this->log_file_name;
2169 2169
 	}
@@ -2175,10 +2175,10 @@  discard block
 block discarded – undo
2175 2175
 	 * @param bool $reset
2176 2176
 	 * @return string
2177 2177
 	 */
2178
-	public function debug_file_name( $reset = FALSE ) {
2179
-		if ( empty( $this->debug_file_name ) || $reset ) {
2180
-			$this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', TRUE ))) . '.txt';
2181
-			EE_Config::instance()->update_espresso_config( FALSE, FALSE );
2178
+	public function debug_file_name($reset = FALSE) {
2179
+		if (empty($this->debug_file_name) || $reset) {
2180
+			$this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', TRUE))).'.txt';
2181
+			EE_Config::instance()->update_espresso_config(FALSE, FALSE);
2182 2182
 		}
2183 2183
 		return $this->debug_file_name;
2184 2184
 	}
@@ -2351,21 +2351,21 @@  discard block
 block discarded – undo
2351 2351
 		// set default map settings
2352 2352
 		$this->use_google_maps = TRUE;
2353 2353
 		// for event details pages (reg page)
2354
-		$this->event_details_map_width = 585; 			// ee_map_width_single
2355
-		$this->event_details_map_height = 362; 			// ee_map_height_single
2356
-		$this->event_details_map_zoom = 14; 			// ee_map_zoom_single
2357
-		$this->event_details_display_nav = TRUE; 			// ee_map_nav_display_single
2358
-		$this->event_details_nav_size = FALSE; 			// ee_map_nav_size_single
2359
-		$this->event_details_control_type = 'default'; 		// ee_map_type_control_single
2360
-		$this->event_details_map_align = 'center'; 			// ee_map_align_single
2354
+		$this->event_details_map_width = 585; // ee_map_width_single
2355
+		$this->event_details_map_height = 362; // ee_map_height_single
2356
+		$this->event_details_map_zoom = 14; // ee_map_zoom_single
2357
+		$this->event_details_display_nav = TRUE; // ee_map_nav_display_single
2358
+		$this->event_details_nav_size = FALSE; // ee_map_nav_size_single
2359
+		$this->event_details_control_type = 'default'; // ee_map_type_control_single
2360
+		$this->event_details_map_align = 'center'; // ee_map_align_single
2361 2361
 		// for event list pages
2362
-		$this->event_list_map_width = 300; 			// ee_map_width
2363
-		$this->event_list_map_height = 185; 		// ee_map_height
2364
-		$this->event_list_map_zoom = 12; 			// ee_map_zoom
2365
-		$this->event_list_display_nav = FALSE; 		// ee_map_nav_display
2366
-		$this->event_list_nav_size = TRUE; 			// ee_map_nav_size
2367
-		$this->event_list_control_type = 'dropdown'; 		// ee_map_type_control
2368
-		$this->event_list_map_align = 'center'; 			// ee_map_align
2362
+		$this->event_list_map_width = 300; // ee_map_width
2363
+		$this->event_list_map_height = 185; // ee_map_height
2364
+		$this->event_list_map_zoom = 12; // ee_map_zoom
2365
+		$this->event_list_display_nav = FALSE; // ee_map_nav_display
2366
+		$this->event_list_nav_size = TRUE; // ee_map_nav_size
2367
+		$this->event_list_control_type = 'dropdown'; // ee_map_type_control
2368
+		$this->event_list_map_align = 'center'; // ee_map_align
2369 2369
 	}
2370 2370
 
2371 2371
 }
@@ -2376,7 +2376,7 @@  discard block
 block discarded – undo
2376 2376
 /**
2377 2377
  * stores Events_Archive settings
2378 2378
  */
2379
-class EE_Events_Archive_Config extends EE_Config_Base{
2379
+class EE_Events_Archive_Config extends EE_Config_Base {
2380 2380
 
2381 2381
 	public $display_status_banner;
2382 2382
 	public $display_description;
@@ -2395,7 +2395,7 @@  discard block
 block discarded – undo
2395 2395
 	/**
2396 2396
 	 *	class constructor
2397 2397
 	 */
2398
-	public function __construct(){
2398
+	public function __construct() {
2399 2399
 		$this->display_status_banner = 0;
2400 2400
 		$this->display_description = 1;
2401 2401
 		$this->display_ticket_selector = 0;
@@ -2415,7 +2415,7 @@  discard block
 block discarded – undo
2415 2415
 /**
2416 2416
  * Stores Event_Single_Config settings
2417 2417
  */
2418
-class EE_Event_Single_Config extends EE_Config_Base{
2418
+class EE_Event_Single_Config extends EE_Config_Base {
2419 2419
 
2420 2420
 	public $display_status_banner_single;
2421 2421
 	public $display_venue;
@@ -2444,7 +2444,7 @@  discard block
 block discarded – undo
2444 2444
 /**
2445 2445
  * Stores Ticket_Selector_Config settings
2446 2446
  */
2447
-class EE_Ticket_Selector_Config extends EE_Config_Base{
2447
+class EE_Ticket_Selector_Config extends EE_Config_Base {
2448 2448
 	public $show_ticket_sale_columns;
2449 2449
 	public $show_ticket_details;
2450 2450
 	public $show_expired_tickets;
@@ -2498,7 +2498,7 @@  discard block
 block discarded – undo
2498 2498
 	 * @return void
2499 2499
 	 */
2500 2500
 	protected function _set_php_values() {
2501
-		$this->php->max_input_vars = ini_get( 'max_input_vars' );
2501
+		$this->php->max_input_vars = ini_get('max_input_vars');
2502 2502
 		$this->php->version = phpversion();
2503 2503
 	}
2504 2504
 
@@ -2517,9 +2517,9 @@  discard block
 block discarded – undo
2517 2517
 	 *         @type string $msg 		Any message to be displayed.
2518 2518
 	 * }
2519 2519
 	 */
2520
-	public function max_input_vars_limit_check( $input_count = 0 ) {
2521
-		if ( ! empty( $this->php->max_input_vars ) && ( $input_count >= $this->php->max_input_vars ) && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >=9 ) ) {
2522
-			return  sprintf( __('The maximum number of inputs on this page has been exceeded.  You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.%1$sThere are %2$d inputs and the maximum amount currently allowed by your server is %3$d.', 'event_espresso'), '<br>', $input_count, $this->php->max_input_vars);
2520
+	public function max_input_vars_limit_check($input_count = 0) {
2521
+		if ( ! empty($this->php->max_input_vars) && ($input_count >= $this->php->max_input_vars) && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9)) {
2522
+			return  sprintf(__('The maximum number of inputs on this page has been exceeded.  You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.%1$sThere are %2$d inputs and the maximum amount currently allowed by your server is %3$d.', 'event_espresso'), '<br>', $input_count, $this->php->max_input_vars);
2523 2523
 		} else {
2524 2524
 			return '';
2525 2525
 		}
@@ -2554,7 +2554,7 @@  discard block
 block discarded – undo
2554 2554
  * stores payment gateway info
2555 2555
  * @deprecated
2556 2556
  */
2557
-class EE_Gateway_Config extends EE_Config_Base{
2557
+class EE_Gateway_Config extends EE_Config_Base {
2558 2558
 
2559 2559
 	/**
2560 2560
 	 * Array with keys that are payment gateways slugs, and values are arrays
@@ -2576,9 +2576,9 @@  discard block
 block discarded – undo
2576 2576
 	 *	class constructor
2577 2577
 	 * @deprecated
2578 2578
 	 */
2579
-	public function __construct(){
2579
+	public function __construct() {
2580 2580
 		$this->payment_settings = array();
2581
-		$this->active_gateways = array( 'Invoice' => FALSE );
2581
+		$this->active_gateways = array('Invoice' => FALSE);
2582 2582
 	}
2583 2583
 }
2584 2584
 
Please login to merge, or discard this patch.
core/EE_Front_Controller.core.php 1 patch
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');}
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); }
2 2
 /**
3 3
  * Event Espresso
4 4
  *
@@ -75,37 +75,37 @@  discard block
 block discarded – undo
75 75
 		$this->Request_Handler = $Request_Handler;
76 76
 		$this->Module_Request_Router = $Module_Request_Router;
77 77
 		// make sure template tags are loaded immediately so that themes don't break
78
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'load_espresso_template_tags' ), 10 );
78
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'load_espresso_template_tags'), 10);
79 79
 		// determine how to integrate WP_Query with the EE models
80
-		add_action( 'AHEE__EE_System__initialize', array( $this, 'employ_CPT_Strategy' ));
80
+		add_action('AHEE__EE_System__initialize', array($this, 'employ_CPT_Strategy'));
81 81
 		// load other resources and begin to actually run shortcodes and modules
82
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 5 );
82
+		add_action('wp_loaded', array($this, 'wp_loaded'), 5);
83 83
 		// analyse the incoming WP request
84
-		add_action( 'parse_request', array( $this, 'get_request' ), 1, 1 );
84
+		add_action('parse_request', array($this, 'get_request'), 1, 1);
85 85
 		// process any content shortcodes
86
-		add_action( 'parse_request', array( $this, '_initialize_shortcodes' ), 5 );
86
+		add_action('parse_request', array($this, '_initialize_shortcodes'), 5);
87 87
 		// process request with module factory
88
-		add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 10, 1 );
88
+		add_action('pre_get_posts', array($this, 'pre_get_posts'), 10, 1);
89 89
 		// before headers sent
90
-		add_action( 'wp', array( $this, 'wp' ), 5 );
90
+		add_action('wp', array($this, 'wp'), 5);
91 91
 		// load css and js
92
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 1 );
92
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 1);
93 93
 		// header
94
-		add_action('wp_head', array( $this, 'header_meta_tag' ), 5 );
95
-		add_filter( 'template_include', array( $this, 'template_include' ), 1 );
94
+		add_action('wp_head', array($this, 'header_meta_tag'), 5);
95
+		add_filter('template_include', array($this, 'template_include'), 1);
96 96
 		// display errors
97
-		add_action('loop_start', array( $this, 'display_errors' ), 2 );
97
+		add_action('loop_start', array($this, 'display_errors'), 2);
98 98
 		// the content
99 99
 		// add_filter( 'the_content', array( $this, 'the_content' ), 5, 1 );
100 100
 		//exclude our private cpt comments
101
-		add_filter( 'comments_clauses', array( $this, 'filter_wp_comments'), 10, 1 );
101
+		add_filter('comments_clauses', array($this, 'filter_wp_comments'), 10, 1);
102 102
 		//make sure any ajax requests will respect the url schema when requests are made against admin-ajax.php (http:// or https://)
103
-		add_filter( 'admin_url', array( $this, 'maybe_force_admin_ajax_ssl' ), 200, 1 );
103
+		add_filter('admin_url', array($this, 'maybe_force_admin_ajax_ssl'), 200, 1);
104 104
 		// action hook EE
105
-		do_action( 'AHEE__EE_Front_Controller__construct__done',$this );
105
+		do_action('AHEE__EE_Front_Controller__construct__done', $this);
106 106
 		// for checking that browser cookies are enabled
107
-		if ( apply_filters( 'FHEE__EE_Front_Controller____construct__set_test_cookie', true )) {
108
-			setcookie( 'ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/' );
107
+		if (apply_filters('FHEE__EE_Front_Controller____construct__set_test_cookie', true)) {
108
+			setcookie('ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/');
109 109
 		}
110 110
 	}
111 111
 
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
 	 * 	@return void
142 142
 	 */
143 143
 	public function load_espresso_template_tags() {
144
-		if ( is_readable( EE_PUBLIC . 'template_tags.php' )) {
145
-			require_once( EE_PUBLIC . 'template_tags.php' );
144
+		if (is_readable(EE_PUBLIC.'template_tags.php')) {
145
+			require_once(EE_PUBLIC.'template_tags.php');
146 146
 		}
147 147
 	}
148 148
 
@@ -157,12 +157,12 @@  discard block
 block discarded – undo
157 157
 	 * @param  array $clauses array of comment clauses setup by WP_Comment_Query
158 158
 	 * @return array array of comment clauses with modifications.
159 159
 	 */
160
-	public function filter_wp_comments( $clauses ) {
160
+	public function filter_wp_comments($clauses) {
161 161
 		global $wpdb;
162
-		if ( strpos( $clauses['join'], $wpdb->posts ) !== FALSE ) {
162
+		if (strpos($clauses['join'], $wpdb->posts) !== FALSE) {
163 163
 			$cpts = EE_Register_CPTs::get_private_CPTs();
164
-			foreach ( $cpts as $cpt => $details ) {
165
-				$clauses['where'] .= $wpdb->prepare( " AND $wpdb->posts.post_type != %s", $cpt );
164
+			foreach ($cpts as $cpt => $details) {
165
+				$clauses['where'] .= $wpdb->prepare(" AND $wpdb->posts.post_type != %s", $cpt);
166 166
 			}
167 167
 		}
168 168
 		return $clauses;
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 	 *  @return 	void
180 180
 	 */
181 181
 	public function employ_CPT_Strategy() {
182
-		if ( apply_filters( 'FHEE__EE_Front_Controller__employ_CPT_Strategy',true) ){
183
-			$this->Registry->load_core( 'CPT_Strategy' );
182
+		if (apply_filters('FHEE__EE_Front_Controller__employ_CPT_Strategy', true)) {
183
+			$this->Registry->load_core('CPT_Strategy');
184 184
 		}
185 185
 	}
186 186
 
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
 	 * @param  string $url    incoming url
193 193
 	 * @return string         final assembled url
194 194
 	 */
195
-	public function maybe_force_admin_ajax_ssl( $url ) {
196
-		if ( is_ssl() && preg_match( '/admin-ajax.php/', $url )) {
197
-			$url = str_replace( 'http://', 'https://', $url );
195
+	public function maybe_force_admin_ajax_ssl($url) {
196
+		if (is_ssl() && preg_match('/admin-ajax.php/', $url)) {
197
+			$url = str_replace('http://', 'https://', $url);
198 198
 		}
199 199
 		return $url;
200 200
 	}
@@ -231,10 +231,10 @@  discard block
 block discarded – undo
231 231
 	 * @param WP $WP
232 232
 	 * @return void
233 233
 	 */
234
-	public function get_request( WP $WP ) {
235
-		do_action( 'AHEE__EE_Front_Controller__get_request__start' );
236
-		$this->Request_Handler->parse_request( $WP );
237
-		do_action( 'AHEE__EE_Front_Controller__get_request__complete' );
234
+	public function get_request(WP $WP) {
235
+		do_action('AHEE__EE_Front_Controller__get_request__start');
236
+		$this->Request_Handler->parse_request($WP);
237
+		do_action('AHEE__EE_Front_Controller__get_request__complete');
238 238
 	}
239 239
 
240 240
 
@@ -246,21 +246,21 @@  discard block
 block discarded – undo
246 246
 	 * @param WP $WP
247 247
 	 * @return    void
248 248
 	 */
249
-	public function _initialize_shortcodes( WP $WP ) {
250
-		do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this );
251
-		$this->Request_Handler->set_request_vars( $WP );
249
+	public function _initialize_shortcodes(WP $WP) {
250
+		do_action('AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this);
251
+		$this->Request_Handler->set_request_vars($WP);
252 252
 		// grab post_name from request
253
-		$current_post = apply_filters( 'FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', $this->Request_Handler->get( 'post_name' ));
254
-		$show_on_front = get_option( 'show_on_front' );
253
+		$current_post = apply_filters('FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', $this->Request_Handler->get('post_name'));
254
+		$show_on_front = get_option('show_on_front');
255 255
 		// if it's not set, then check if frontpage is blog
256
-		if ( empty( $current_post ) ) {
256
+		if (empty($current_post)) {
257 257
 			// yup.. this is the posts page, prepare to load all shortcode modules
258 258
 			$current_post = 'posts';
259 259
 			// unless..
260
-			if ( $show_on_front === 'page' ) {
260
+			if ($show_on_front === 'page') {
261 261
 				// some other page is set as the homepage
262
-				$page_on_front = get_option( 'page_on_front' );
263
-				if ( $page_on_front ) {
262
+				$page_on_front = get_option('page_on_front');
263
+				if ($page_on_front) {
264 264
 					// k now we need to find the post_name for this page
265 265
 					global $wpdb;
266 266
 					$page_on_front = $wpdb->get_var(
@@ -277,22 +277,22 @@  discard block
 block discarded – undo
277 277
 		// where are posts being displayed ?
278 278
 		$page_for_posts = EE_Config::get_page_for_posts();
279 279
 		// in case $current_post is hierarchical like: /parent-page/current-page
280
-		$current_post = basename( $current_post );
280
+		$current_post = basename($current_post);
281 281
 		// are we on a category page?
282
-		$term_exists = is_array( term_exists( $current_post, 'category' )) || array_key_exists( 'category_name', $WP->query_vars );
282
+		$term_exists = is_array(term_exists($current_post, 'category')) || array_key_exists('category_name', $WP->query_vars);
283 283
 		// make sure shortcodes are set
284
-		if ( isset( $this->Registry->CFG->core->post_shortcodes )) {
285
-			if ( ! isset( $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ] ) ) {
286
-				$this->Registry->CFG->core->post_shortcodes[ $page_for_posts ] = array();
284
+		if (isset($this->Registry->CFG->core->post_shortcodes)) {
285
+			if ( ! isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts])) {
286
+				$this->Registry->CFG->core->post_shortcodes[$page_for_posts] = array();
287 287
 			}
288 288
 			// cycle thru all posts with shortcodes set
289
-			foreach ( $this->Registry->CFG->core->post_shortcodes as $post_name => $post_shortcodes ) {
289
+			foreach ($this->Registry->CFG->core->post_shortcodes as $post_name => $post_shortcodes) {
290 290
 				// filter shortcodes so
291
-				$post_shortcodes = apply_filters( 'FHEE__Front_Controller__initialize_shortcodes__post_shortcodes', $post_shortcodes );
291
+				$post_shortcodes = apply_filters('FHEE__Front_Controller__initialize_shortcodes__post_shortcodes', $post_shortcodes);
292 292
 				// now cycle thru shortcodes
293
-				foreach ( $post_shortcodes as $shortcode_class => $post_id ) {
293
+				foreach ($post_shortcodes as $shortcode_class => $post_id) {
294 294
 					// are we on this page, or on the blog page, or an EE CPT category page ?
295
-					if ( $current_post === $post_name || $term_exists ) {
295
+					if ($current_post === $post_name || $term_exists) {
296 296
 						// maybe init the shortcode
297 297
 						$this->initialize_shortcode_if_active_on_page(
298 298
 							$shortcode_class,
@@ -307,16 +307,16 @@  discard block
 block discarded – undo
307 307
 					// but the shortcode is not being tracked for this page
308 308
 					} else if (
309 309
 						$post_name !== $page_for_posts
310
-						&& isset( $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ] )
311
-						&& ! isset( $this->Registry->CFG->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] )
310
+						&& isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts])
311
+						&& ! isset($this->Registry->CFG->core->post_shortcodes[$page_for_posts][$shortcode_class])
312 312
 					) {
313 313
 						// then remove the "fallback" shortcode processor
314
-						remove_shortcode( $shortcode_class );
314
+						remove_shortcode($shortcode_class);
315 315
 					}
316 316
 				}
317 317
 			}
318 318
 		}
319
-		do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__end', $this );
319
+		do_action('AHEE__EE_Front_Controller__initialize_shortcodes__end', $this);
320 320
 	}
321 321
 
322 322
 
@@ -338,8 +338,8 @@  discard block
 block discarded – undo
338 338
 		$WP
339 339
 	) {
340 340
 		// verify shortcode is in list of registered shortcodes
341
-		if ( ! isset( $this->Registry->shortcodes->{$shortcode_class} ) ) {
342
-			if ( $current_post !== $page_for_posts && current_user_can( 'edit_post', $post_id ) ) {
341
+		if ( ! isset($this->Registry->shortcodes->{$shortcode_class} )) {
342
+			if ($current_post !== $page_for_posts && current_user_can('edit_post', $post_id)) {
343 343
 				EE_Error::add_error(
344 344
 					sprintf(
345 345
 						__(
@@ -352,24 +352,24 @@  discard block
 block discarded – undo
352 352
 					__FUNCTION__,
353 353
 					__LINE__
354 354
 				);
355
-				add_filter( 'FHEE_run_EE_the_content', '__return_true' );
355
+				add_filter('FHEE_run_EE_the_content', '__return_true');
356 356
 			}
357
-			add_shortcode( $shortcode_class, array( 'EES_Shortcode', 'invalid_shortcode_processor' ) );
357
+			add_shortcode($shortcode_class, array('EES_Shortcode', 'invalid_shortcode_processor'));
358 358
 			return;
359 359
 		}
360 360
 		// is this : a shortcodes set exclusively for this post, or for the home page, or a category, or a taxonomy ?
361 361
 		if (
362 362
 			$term_exists
363 363
 			|| $current_post === $page_for_posts
364
-			|| isset( $this->Registry->CFG->core->post_shortcodes[ $current_post ] )
364
+			|| isset($this->Registry->CFG->core->post_shortcodes[$current_post])
365 365
 		) {
366 366
 			// let's pause to reflect on this...
367
-			$sc_reflector = new ReflectionClass( 'EES_' . $shortcode_class );
367
+			$sc_reflector = new ReflectionClass('EES_'.$shortcode_class);
368 368
 			// ensure that class is actually a shortcode
369 369
 			if (
370
-				defined( 'WP_DEBUG' )
370
+				defined('WP_DEBUG')
371 371
 				&& WP_DEBUG === true
372
-				&& ! $sc_reflector->isSubclassOf( 'EES_Shortcode' )
372
+				&& ! $sc_reflector->isSubclassOf('EES_Shortcode')
373 373
 			) {
374 374
 				EE_Error::add_error(
375 375
 					sprintf(
@@ -383,13 +383,13 @@  discard block
 block discarded – undo
383 383
 					__FUNCTION__,
384 384
 					__LINE__
385 385
 				);
386
-				add_filter( 'FHEE_run_EE_the_content', '__return_true' );
386
+				add_filter('FHEE_run_EE_the_content', '__return_true');
387 387
 				return;
388 388
 			}
389 389
 			// and pass the request object to the run method
390 390
 			$this->Registry->shortcodes->{$shortcode_class} = $sc_reflector->newInstance();
391 391
 			// fire the shortcode class's run method, so that it can activate resources
392
-			$this->Registry->shortcodes->{$shortcode_class}->run( $WP );
392
+			$this->Registry->shortcodes->{$shortcode_class}->run($WP);
393 393
 		}
394 394
 	}
395 395
 
@@ -402,19 +402,19 @@  discard block
 block discarded – undo
402 402
 	 * @param   WP_Query    $WP_Query
403 403
 	 * @return    void
404 404
 	 */
405
-	public function pre_get_posts( $WP_Query ) {
405
+	public function pre_get_posts($WP_Query) {
406 406
 		// only load Module_Request_Router if this is the main query
407 407
 		if (
408 408
 			$this->Module_Request_Router instanceof EE_Module_Request_Router
409 409
 			&& $WP_Query->is_main_query()
410 410
 		) {
411 411
 				// cycle thru module routes
412
-				while ( $route = $this->Module_Request_Router->get_route( $WP_Query )) {
412
+				while ($route = $this->Module_Request_Router->get_route($WP_Query)) {
413 413
 					// determine module and method for route
414
-					$module = $this->Module_Request_Router->resolve_route( $route[0], $route[1] );
415
-					if( $module instanceof EED_Module ) {
414
+					$module = $this->Module_Request_Router->resolve_route($route[0], $route[1]);
415
+					if ($module instanceof EED_Module) {
416 416
 						// get registered view for route
417
-						$this->_template_path = $this->Module_Request_Router->get_view( $route );
417
+						$this->_template_path = $this->Module_Request_Router->get_view($route);
418 418
 						// grab module name
419 419
 						$module_name = $module->module_name();
420 420
 						// map the module to the module objects
@@ -456,29 +456,29 @@  discard block
 block discarded – undo
456 456
 	public function wp_enqueue_scripts() {
457 457
 
458 458
 		// css is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF  via:  add_filter( 'FHEE_load_css', '__return_false' );
459
-		if ( apply_filters( 'FHEE_load_css', TRUE ) ) {
459
+		if (apply_filters('FHEE_load_css', TRUE)) {
460 460
 
461 461
 			$this->Registry->CFG->template_settings->enable_default_style = TRUE;
462 462
 			//Load the ThemeRoller styles if enabled
463
-			if ( isset( $this->Registry->CFG->template_settings->enable_default_style ) && $this->Registry->CFG->template_settings->enable_default_style ) {
463
+			if (isset($this->Registry->CFG->template_settings->enable_default_style) && $this->Registry->CFG->template_settings->enable_default_style) {
464 464
 
465 465
 				//Load custom style sheet if available
466
-				if ( isset( $this->Registry->CFG->template_settings->custom_style_sheet )) {
467
-					wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL . 'css/' . $this->Registry->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION );
466
+				if (isset($this->Registry->CFG->template_settings->custom_style_sheet)) {
467
+					wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL.'css/'.$this->Registry->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION);
468 468
 					wp_enqueue_style('espresso_custom_css');
469 469
 				}
470 470
 
471
-				if ( is_readable( EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css' )) {
472
-					wp_register_style( 'espresso_default', EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION );
471
+				if (is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/style.css')) {
472
+					wp_register_style('espresso_default', EVENT_ESPRESSO_UPLOAD_DIR.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION);
473 473
 				} else {
474
-					wp_register_style( 'espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION );
474
+					wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION);
475 475
 				}
476 476
 				wp_enqueue_style('espresso_default');
477 477
 
478
-				if ( is_readable( get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'style.css' )) {
479
-					wp_register_style( 'espresso_style', get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
478
+				if (is_readable(get_stylesheet_directory().EE_Config::get_current_theme().DS.'style.css')) {
479
+					wp_register_style('espresso_style', get_stylesheet_directory_uri().EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default'));
480 480
 				} else {
481
-					wp_register_style( 'espresso_style', EE_TEMPLATES_URL . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
481
+					wp_register_style('espresso_style', EE_TEMPLATES_URL.EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default'));
482 482
 				}
483 483
 
484 484
 			}
@@ -486,38 +486,38 @@  discard block
 block discarded – undo
486 486
 		}
487 487
 
488 488
 		// js is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF  via:  add_filter( 'FHEE_load_js', '__return_false' );
489
-		if ( apply_filters( 'FHEE_load_js', TRUE ) ) {
489
+		if (apply_filters('FHEE_load_js', TRUE)) {
490 490
 
491
-			wp_enqueue_script( 'jquery' );
491
+			wp_enqueue_script('jquery');
492 492
 			//let's make sure that all required scripts have been setup
493
-			if ( function_exists( 'wp_script_is' ) && ! wp_script_is( 'jquery' )) {
493
+			if (function_exists('wp_script_is') && ! wp_script_is('jquery')) {
494 494
 				$msg = sprintf(
495
-					__( '%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso' ),
495
+					__('%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso'),
496 496
 					'<em><br />',
497 497
 					'</em>'
498 498
 				);
499
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
499
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
500 500
 			}
501 501
 			// load core js
502
-			wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
503
-			wp_enqueue_script( 'espresso_core' );
504
-			wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings );
502
+			wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
503
+			wp_enqueue_script('espresso_core');
504
+			wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings);
505 505
 
506 506
 		}
507 507
 
508 508
 		//qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' );
509
-		if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) {
509
+		if (apply_filters('FHEE_load_qtip', FALSE)) {
510 510
 			EEH_Qtip_Loader::instance()->register_and_enqueue();
511 511
 		}
512 512
 
513 513
 
514 514
 		//accounting.js library
515 515
 		// @link http://josscrowcroft.github.io/accounting.js/
516
-		if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) {
517
-			$acct_js = EE_THIRD_PARTY_URL . 'accounting/accounting.js';
518
-			wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE );
519
-			wp_register_script( 'ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE );
520
-			wp_enqueue_script( 'ee-accounting' );
516
+		if (apply_filters('FHEE_load_accounting_js', FALSE)) {
517
+			$acct_js = EE_THIRD_PARTY_URL.'accounting/accounting.js';
518
+			wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE);
519
+			wp_register_script('ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE);
520
+			wp_enqueue_script('ee-accounting');
521 521
 
522 522
 			$currency_config = array(
523 523
 				'currency' => array(
@@ -540,21 +540,21 @@  discard block
 block discarded – undo
540 540
 			wp_localize_script('ee-accounting', 'EE_ACCOUNTING_CFG', $currency_config);
541 541
 		}
542 542
 
543
-		if ( ! function_exists( 'wp_head' )) {
543
+		if ( ! function_exists('wp_head')) {
544 544
 			$msg = sprintf(
545
-				__( '%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ),
545
+				__('%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'),
546 546
 				'<em><br />',
547 547
 				'</em>'
548 548
 			);
549
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
549
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
550 550
 		}
551
-		if ( ! function_exists( 'wp_footer' )) {
551
+		if ( ! function_exists('wp_footer')) {
552 552
 			$msg = sprintf(
553
-				__( '%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ),
553
+				__('%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'),
554 554
 				'<em><br />',
555 555
 				'</em>'
556 556
 			);
557
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
557
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
558 558
 		}
559 559
 
560 560
 	}
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 	 *  @return 	void
569 569
 	 */
570 570
 	public function header_meta_tag() {
571
-		print( apply_filters("FHEE__EE_Front_Controller__header_meta_tag","<meta name='generator' content='Event Espresso Version " . EVENT_ESPRESSO_VERSION . "' />"));
571
+		print(apply_filters("FHEE__EE_Front_Controller__header_meta_tag", "<meta name='generator' content='Event Espresso Version ".EVENT_ESPRESSO_VERSION."' />"));
572 572
 	}
573 573
 
574 574
 
@@ -609,10 +609,10 @@  discard block
 block discarded – undo
609 609
 	 */
610 610
 	public function display_errors() {
611 611
 		static $shown_already = FALSE;
612
-		do_action( 'AHEE__EE_Front_Controller__display_errors__begin' );
612
+		do_action('AHEE__EE_Front_Controller__display_errors__begin');
613 613
 		if (
614 614
 			! $shown_already
615
-			&& apply_filters( 'FHEE__EE_Front_Controller__display_errors', TRUE )
615
+			&& apply_filters('FHEE__EE_Front_Controller__display_errors', TRUE)
616 616
 			&& is_main_query()
617 617
 			&& ! is_feed()
618 618
 			&& in_the_loop()
@@ -620,9 +620,9 @@  discard block
 block discarded – undo
620 620
 		) {
621 621
 			echo EE_Error::get_notices();
622 622
 			$shown_already = TRUE;
623
-			EEH_Template::display_template( EE_TEMPLATES . 'espresso-ajax-notices.template.php' );
623
+			EEH_Template::display_template(EE_TEMPLATES.'espresso-ajax-notices.template.php');
624 624
 		}
625
-		do_action( 'AHEE__EE_Front_Controller__display_errors__end' );
625
+		do_action('AHEE__EE_Front_Controller__display_errors__end');
626 626
 	}
627 627
 
628 628
 
@@ -637,12 +637,12 @@  discard block
 block discarded – undo
637 637
 	 * @param   string $template_include_path
638 638
 	 * @return    string
639 639
 	 */
640
-	public function template_include( $template_include_path = NULL ) {
641
-		if ( $this->Request_Handler->is_espresso_page() ) {
642
-			$this->_template_path = ! empty( $this->_template_path ) ? basename( $this->_template_path ) : basename( $template_include_path );
643
-			$template_path = EEH_Template::locate_template( $this->_template_path, array(), false );
644
-			$this->_template_path = ! empty( $template_path ) ? $template_path : $template_include_path;
645
-			$this->_template = basename( $this->_template_path );
640
+	public function template_include($template_include_path = NULL) {
641
+		if ($this->Request_Handler->is_espresso_page()) {
642
+			$this->_template_path = ! empty($this->_template_path) ? basename($this->_template_path) : basename($template_include_path);
643
+			$template_path = EEH_Template::locate_template($this->_template_path, array(), false);
644
+			$this->_template_path = ! empty($template_path) ? $template_path : $template_include_path;
645
+			$this->_template = basename($this->_template_path);
646 646
 			return $this->_template_path;
647 647
 		}
648 648
 		return $template_include_path;
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 	 * @param bool $with_path
658 658
 	 * @return    string
659 659
 	 */
660
-	public function get_selected_template( $with_path = FALSE ) {
660
+	public function get_selected_template($with_path = FALSE) {
661 661
 		return $with_path ? $this->_template_path : $this->_template;
662 662
 	}
663 663
 
Please login to merge, or discard this patch.
core/libraries/payment_methods/EE_PMT_Base.lib.php 1 patch
Spacing   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  * @since 				$VID:$
15 15
  *
16 16
  */
17
-abstract class EE_PMT_Base{
17
+abstract class EE_PMT_Base {
18 18
 
19 19
 	const onsite = 'on-site';
20 20
 	const offsite = 'off-site';
@@ -95,31 +95,31 @@  discard block
 block discarded – undo
95 95
 	 * @return EE_PMT_Base
96 96
 	 */
97 97
 	function __construct($pm_instance = NULL) {
98
-		if ( $pm_instance instanceof EE_Payment_Method ){
98
+		if ($pm_instance instanceof EE_Payment_Method) {
99 99
 			$this->set_instance($pm_instance);
100 100
 		}
101
-		if($this->_gateway){
102
-			$this->_gateway->set_payment_model( EEM_Payment::instance() );
103
-			$this->_gateway->set_payment_log( EEM_Change_Log::instance() );
104
-			$this->_gateway->set_template_helper( new EEH_Template() );
105
-			$this->_gateway->set_line_item_helper( new EEH_Line_Item() );
106
-			$this->_gateway->set_money_helper( new EEH_Money() );
101
+		if ($this->_gateway) {
102
+			$this->_gateway->set_payment_model(EEM_Payment::instance());
103
+			$this->_gateway->set_payment_log(EEM_Change_Log::instance());
104
+			$this->_gateway->set_template_helper(new EEH_Template());
105
+			$this->_gateway->set_line_item_helper(new EEH_Line_Item());
106
+			$this->_gateway->set_money_helper(new EEH_Money());
107 107
 		}
108
-		if ( ! isset( $this->_has_billing_form ) ) {
108
+		if ( ! isset($this->_has_billing_form)) {
109 109
 			// by default, On Site gateways have a billing form
110
-			if ( $this->payment_occurs() == EE_PMT_Base::onsite ) {
111
-				$this->set_has_billing_form( true );
110
+			if ($this->payment_occurs() == EE_PMT_Base::onsite) {
111
+				$this->set_has_billing_form(true);
112 112
 			} else {
113
-				$this->set_has_billing_form( false );
113
+				$this->set_has_billing_form(false);
114 114
 			}
115 115
 		}
116 116
 
117
-		if( ! $this->_pretty_name){
117
+		if ( ! $this->_pretty_name) {
118 118
 			throw new EE_Error(sprintf(__("You must set the pretty name for the Payment Method Type in the constructor (_pretty_name), and please make it internationalized", "event_espresso")));
119 119
 		}
120 120
 		//if the child didn't specify a default button, use the credit card one
121
-		if( $this->_default_button_url === NULL){
122
-			$this->_default_button_url = EE_PLUGIN_DIR_URL . 'payment_methods' . DS . 'pay-by-credit-card.png';
121
+		if ($this->_default_button_url === NULL) {
122
+			$this->_default_button_url = EE_PLUGIN_DIR_URL.'payment_methods'.DS.'pay-by-credit-card.png';
123 123
 		}
124 124
 	}
125 125
 
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
 	/**
129 129
 	 * @param boolean $has_billing_form
130 130
 	 */
131
-	public function set_has_billing_form( $has_billing_form ) {
132
-		$this->_has_billing_form = filter_var( $has_billing_form, FILTER_VALIDATE_BOOLEAN );
131
+	public function set_has_billing_form($has_billing_form) {
132
+		$this->_has_billing_form = filter_var($has_billing_form, FILTER_VALIDATE_BOOLEAN);
133 133
 	}
134 134
 
135 135
 
@@ -137,10 +137,10 @@  discard block
 block discarded – undo
137 137
 	/**
138 138
 	 * sets the file_folder property
139 139
 	 */
140
-	protected function _set_file_folder(){
140
+	protected function _set_file_folder() {
141 141
 		$reflector = new ReflectionClass(get_class($this));
142 142
 		$fn = $reflector->getFileName();
143
-		$this->_file_folder =  dirname($fn).DS;
143
+		$this->_file_folder = dirname($fn).DS;
144 144
 	}
145 145
 
146 146
 
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
 	/**
149 149
 	 * sets the file URL with a trailing slash for this PMT
150 150
 	 */
151
-	protected function _set_file_url(){
152
-		$plugins_dir_fixed = str_replace('\\',DS,WP_PLUGIN_DIR);
153
-		$file_folder_fixed = str_replace('\\',DS,$this->file_folder());
154
-		$file_path = str_replace($plugins_dir_fixed,WP_PLUGIN_URL,$file_folder_fixed);
151
+	protected function _set_file_url() {
152
+		$plugins_dir_fixed = str_replace('\\', DS, WP_PLUGIN_DIR);
153
+		$file_folder_fixed = str_replace('\\', DS, $this->file_folder());
154
+		$file_path = str_replace($plugins_dir_fixed, WP_PLUGIN_URL, $file_folder_fixed);
155 155
 		$this->_file_url = $file_path;
156 156
 	}
157 157
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 * Gets the default description on all payment methods of this type
160 160
 	 * @return string
161 161
 	 */
162
-	public function default_description(){
162
+	public function default_description() {
163 163
 		return $this->_default_description;
164 164
 	}
165 165
 
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 	 * Returns the folder containing the PMT child class, with a trailing slash
170 170
 	 * @return string
171 171
 	 */
172
-	public function file_folder(){
173
-		if( ! $this->_file_folder ) {
172
+	public function file_folder() {
173
+		if ( ! $this->_file_folder) {
174 174
 			$this->_set_file_folder();
175 175
 		}
176 176
 		return $this->_file_folder;
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
 	/**
182 182
 	 * @return string
183 183
 	 */
184
-	public function file_url(){
185
-		if( ! $this->_file_url ) {
184
+	public function file_url() {
185
+		if ( ! $this->_file_url) {
186 186
 			$this->_set_file_url();
187 187
 		}
188 188
 		return $this->_file_url;
@@ -195,14 +195,14 @@  discard block
 block discarded – undo
195 195
 	 * Its important teh payment method instance is set before
196 196
 	 * @param EE_Payment_Method $payment_method_instance
197 197
 	 */
198
-	function set_instance($payment_method_instance){
198
+	function set_instance($payment_method_instance) {
199 199
 		$this->_pm_instance = $payment_method_instance;
200 200
 		//if they have already requested the settings form, make sure its
201 201
 		//data matches this model object
202
-		if($this->_settings_form){
202
+		if ($this->_settings_form) {
203 203
 			$this->settings_form()->populate_model_obj($payment_method_instance);
204 204
 		}
205
-		if($this->_gateway && $this->_gateway instanceof EE_Gateway){
205
+		if ($this->_gateway && $this->_gateway instanceof EE_Gateway) {
206 206
 			$this->_gateway->set_settings($payment_method_instance->settings_array());
207 207
 		}
208 208
 	}
@@ -213,14 +213,14 @@  discard block
 block discarded – undo
213 213
 	 * Gets teh form for displaying to admins where they setup the payment method
214 214
 	 * @return EE_Payment_Method_Form
215 215
 	 */
216
-	function settings_form(){
217
-		if( ! $this->_settings_form){
216
+	function settings_form() {
217
+		if ( ! $this->_settings_form) {
218 218
 			$this->_settings_form = $this->generate_new_settings_form();
219
-			$this->_settings_form->set_payment_method_type( $this );
220
-			$this->_settings_form->_construct_finalize(NULL, NULL );
219
+			$this->_settings_form->set_payment_method_type($this);
220
+			$this->_settings_form->_construct_finalize(NULL, NULL);
221 221
 			//if we have already assigned a model object to this pmt, make
222 222
 			//sure its reflected in teh form we just generated
223
-			if($this->_pm_instance){
223
+			if ($this->_pm_instance) {
224 224
 				$this->_settings_form->populate_model_obj($this->_pm_instance);
225 225
 			}
226 226
 		}
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 * this payment method type's settings form later in the request
247 247
 	 * @param EE_Payment_Method_Form $form
248 248
 	 */
249
-	public function set_settings_form($form){
249
+	public function set_settings_form($form) {
250 250
 		$this->_settings_form = $form;
251 251
 	}
252 252
 
@@ -269,10 +269,10 @@  discard block
 block discarded – undo
269 269
 	 * @param array $extra_args
270 270
 	 * @return \EE_Billing_Attendee_Info_Form|\EE_Billing_Info_Form|null
271 271
 	 */
272
-	public function billing_form( EE_Transaction $transaction = NULL, $extra_args = array() ){
272
+	public function billing_form(EE_Transaction $transaction = NULL, $extra_args = array()) {
273 273
 		// has billing form already been regenerated ? or overwrite cache?
274
-		if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form ){
275
-			$this->_billing_form = $this->generate_new_billing_form( $transaction, $extra_args );
274
+		if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form) {
275
+			$this->_billing_form = $this->generate_new_billing_form($transaction, $extra_args);
276 276
 		}
277 277
 		//if we know who the attendee is, and this is a billing form
278 278
 		//that uses attendee info, populate it
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
 			$transaction instanceof EE_Transaction &&
282 282
 			$transaction->primary_registration() instanceof EE_Registration &&
283 283
 			$transaction->primary_registration()->attendee() instanceof EE_Attendee
284
-		){
285
-			$this->_billing_form->populate_from_attendee( $transaction->primary_registration()->attendee() );
284
+		) {
285
+			$this->_billing_form->populate_from_attendee($transaction->primary_registration()->attendee());
286 286
 		}
287 287
 		return $this->_billing_form;
288 288
 	}
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 	 * @param \EE_Transaction $transaction
294 294
 	 * @return \EE_Billing_Info_Form
295 295
 	 */
296
-	abstract function generate_new_billing_form( EE_Transaction $transaction = NULL );
296
+	abstract function generate_new_billing_form(EE_Transaction $transaction = NULL);
297 297
 
298 298
 
299 299
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 	 * @param \EE_Billing_Info_Form $billing_form
305 305
 	 * @return \EE_Billing_Info_Form
306 306
 	 */
307
-	public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) {
307
+	public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) {
308 308
 		return $billing_form;
309 309
 	}
310 310
 
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	 * if you have form
316 316
 	 * @param EE_Payment_Method $form
317 317
 	 */
318
-	public function set_billing_form($form){
318
+	public function set_billing_form($form) {
319 319
 		$this->_billing_form = $form;
320 320
 	}
321 321
 
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 	 * Returns whether or not this payment method requires HTTPS to be used
326 326
 	 * @return boolean
327 327
 	 */
328
-	function requires_https(){
328
+	function requires_https() {
329 329
 		return $this->_requires_https;
330 330
 	}
331 331
 
@@ -343,9 +343,9 @@  discard block
 block discarded – undo
343 343
 	 * @return EE_Payment
344 344
 	 * @throws EE_Error
345 345
 	 */
346
-	function process_payment( EE_Transaction $transaction, $amount = null, $billing_info = null, $return_url = null,$fail_url = '', $method = 'CART', $by_admin = false ){
346
+	function process_payment(EE_Transaction $transaction, $amount = null, $billing_info = null, $return_url = null, $fail_url = '', $method = 'CART', $by_admin = false) {
347 347
 		// @todo: add surcharge for the payment method, if any
348
-		if ( $this->_gateway ) {
348
+		if ($this->_gateway) {
349 349
 			//there is a gateway, so we're going to make a payment object
350 350
 			//but wait! do they already have a payment in progress that we thought was failed?
351 351
 			$duplicate_properties = array(
@@ -356,10 +356,10 @@  discard block
 block discarded – undo
356 356
 				'PAY_amount' 					=> $amount !== null ? $amount : $transaction->remaining(),
357 357
 				'PAY_gateway_response' 	=> null,
358 358
 			);
359
-			$payment = EEM_Payment::instance()->get_one( array( $duplicate_properties ));
359
+			$payment = EEM_Payment::instance()->get_one(array($duplicate_properties));
360 360
 			//if we didn't already have a payment in progress for the same thing,
361 361
 			//then we actually want to make a new payment
362
-			if ( ! $payment instanceof EE_Payment ){
362
+			if ( ! $payment instanceof EE_Payment) {
363 363
 				$payment = EE_Payment::new_instance(
364 364
 					array_merge(
365 365
 						$duplicate_properties,
@@ -375,10 +375,10 @@  discard block
 block discarded – undo
375 375
 			}
376 376
 			//make sure the payment has been saved to show we started it, and so it has an ID should the gateway try to log it
377 377
 			$payment->save();
378
-			$billing_values = $this->_get_billing_values_from_form( $billing_info );
378
+			$billing_values = $this->_get_billing_values_from_form($billing_info);
379 379
 
380 380
 			//  Offsite Gateway
381
-			if( $this->_gateway instanceof EE_Offsite_Gateway ){
381
+			if ($this->_gateway instanceof EE_Offsite_Gateway) {
382 382
 
383 383
 				$payment = $this->_gateway->set_redirection_info(
384 384
 					$payment,
@@ -394,17 +394,17 @@  discard block
 block discarded – undo
394 394
 				);
395 395
 				$payment->save();
396 396
 			//  Onsite Gateway
397
-			} elseif ( $this->_gateway instanceof EE_Onsite_Gateway ) {
397
+			} elseif ($this->_gateway instanceof EE_Onsite_Gateway) {
398 398
 
399
-				$payment = $this->_gateway->do_direct_payment($payment,$billing_values);
399
+				$payment = $this->_gateway->do_direct_payment($payment, $billing_values);
400 400
 				$payment->save();
401 401
 
402 402
 			} else {
403 403
 				throw new EE_Error(
404 404
 					sprintf(
405
-						__('Gateway for payment method type "%s" is "%s", not a subclass of either EE_Offsite_Gateway or EE_Onsite_Gateway, or null (to indicate NO gateway)', 'event_espresso' ),
405
+						__('Gateway for payment method type "%s" is "%s", not a subclass of either EE_Offsite_Gateway or EE_Onsite_Gateway, or null (to indicate NO gateway)', 'event_espresso'),
406 406
 						get_class($this),
407
-						gettype( $this->_gateway )
407
+						gettype($this->_gateway)
408 408
 					)
409 409
 				);
410 410
 			}
@@ -426,8 +426,8 @@  discard block
 block discarded – undo
426 426
 		}
427 427
 
428 428
 		// if there is billing info, clean it and save it now
429
-		if( $billing_info instanceof EE_Billing_Attendee_Info_Form ){
430
-			$this->_save_billing_info_to_attendee( $billing_info, $transaction );
429
+		if ($billing_info instanceof EE_Billing_Attendee_Info_Form) {
430
+			$this->_save_billing_info_to_attendee($billing_info, $transaction);
431 431
 		}
432 432
 
433 433
 		return $payment;
@@ -440,10 +440,10 @@  discard block
 block discarded – undo
440 440
 	 * @param EE_Billing_Info_Form $billing_form
441 441
 	 * @return array
442 442
 	 */
443
-	protected function _get_billing_values_from_form( $billing_form ){
444
-		if($billing_form instanceof EE_Form_Section_Proper ){
445
-			return $billing_form->input_pretty_values( true );
446
-		}else{
443
+	protected function _get_billing_values_from_form($billing_form) {
444
+		if ($billing_form instanceof EE_Form_Section_Proper) {
445
+			return $billing_form->input_pretty_values(true);
446
+		} else {
447 447
 			return NULL;
448 448
 		}
449 449
 	}
@@ -457,13 +457,13 @@  discard block
 block discarded – undo
457 457
 	 * @return EE_Payment
458 458
 	 * @throws EE_Error
459 459
 	 */
460
-	public function handle_ipn($req_data,$transaction){
460
+	public function handle_ipn($req_data, $transaction) {
461 461
 		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
462
-		if( ! $this->_gateway instanceof EE_Offsite_Gateway){
463
-			throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r( $this->_gateway, TRUE )));
462
+		if ( ! $this->_gateway instanceof EE_Offsite_Gateway) {
463
+			throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r($this->_gateway, TRUE)));
464 464
 
465 465
 		}
466
-		$payment = $this->_gateway->handle_payment_update( $req_data, $transaction );
466
+		$payment = $this->_gateway->handle_payment_update($req_data, $transaction);
467 467
 		return $payment;
468 468
 	}
469 469
 
@@ -476,22 +476,22 @@  discard block
 block discarded – undo
476 476
 	 * @param EE_Transaction $transaction
477 477
 	 * @return boolean success
478 478
 	 */
479
-	protected function _save_billing_info_to_attendee($billing_form, $transaction){
480
-		if( ! $transaction || ! $transaction instanceof EE_Transaction){
479
+	protected function _save_billing_info_to_attendee($billing_form, $transaction) {
480
+		if ( ! $transaction || ! $transaction instanceof EE_Transaction) {
481 481
 			EE_Error::add_error(__("Cannot save billing info because no transaction was specified", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
482 482
 			return false;
483 483
 		}
484 484
 		$primary_reg = $transaction->primary_registration();
485
-		if( ! $primary_reg ){
485
+		if ( ! $primary_reg) {
486 486
 			EE_Error::add_error(__("Cannot save billing info because the transaction has no primary registration", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
487 487
 			return false;
488 488
 		}
489 489
 		$attendee = $primary_reg->attendee();
490
-		if( ! $attendee ){
490
+		if ( ! $attendee) {
491 491
 			EE_Error::add_error(__("Cannot save billing info because the transaction's primary registration has no attendee!", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
492 492
 			return false;
493 493
 		}
494
-		return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method() );
494
+		return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method());
495 495
 
496 496
 	}
497 497
 
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 	 * @param array $req_data
505 505
 	 * @return EE_Payment
506 506
 	 */
507
-	protected function find_payment_for_ipn( EE_Transaction $transaction, $req_data = array() ){
507
+	protected function find_payment_for_ipn(EE_Transaction $transaction, $req_data = array()) {
508 508
 		return $transaction->last_payment();
509 509
 	}
510 510
 
@@ -521,8 +521,8 @@  discard block
 block discarded – undo
521 521
 	 * and identifies the IPN as being for this payment method (not just fo ra payment method of this type)
522 522
 	 * @throws EE_Error
523 523
 	 */
524
-	public function handle_unclaimed_ipn( $req_data = array() ){
525
-		throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this) ));
524
+	public function handle_unclaimed_ipn($req_data = array()) {
525
+		throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this)));
526 526
 	}
527 527
 
528 528
 
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 	 * @param EE_Transaction $transaction
539 539
 	 * @return EE_Payment
540 540
 	 */
541
-	public function finalize_payment_for($transaction){
541
+	public function finalize_payment_for($transaction) {
542 542
 		return $transaction->last_payment();
543 543
 	}
544 544
 
@@ -548,10 +548,10 @@  discard block
 block discarded – undo
548 548
 	 * Whether or not this payment method's gateway supports sending refund requests
549 549
 	 * @return boolean
550 550
 	 */
551
-	public function supports_sending_refunds(){
552
-		if($this->_gateway && $this->_gateway instanceof EE_Gateway){
551
+	public function supports_sending_refunds() {
552
+		if ($this->_gateway && $this->_gateway instanceof EE_Gateway) {
553 553
 			return $this->_gateway->supports_sending_refunds();
554
-		}else{
554
+		} else {
555 555
 			return false;
556 556
 		}
557 557
 	}
@@ -565,14 +565,14 @@  discard block
 block discarded – undo
565 565
 	 * @throws EE_Error
566 566
 	 * @return EE_Payment
567 567
 	 */
568
-	public function process_refund( EE_Payment $payment, $refund_info = array()){
569
-		if ( $this->_gateway && $this->_gateway instanceof EE_Gateway ) {
570
-			return $this->_gateway->do_direct_refund( $payment, $refund_info );
568
+	public function process_refund(EE_Payment $payment, $refund_info = array()) {
569
+		if ($this->_gateway && $this->_gateway instanceof EE_Gateway) {
570
+			return $this->_gateway->do_direct_refund($payment, $refund_info);
571 571
 		} else {
572 572
 			throw new EE_Error(
573 573
 				sprintf(
574
-					__( 'Payment Method Type "%s" does not support sending refund requests', 'event_espresso' ),
575
-					get_class( $this )
574
+					__('Payment Method Type "%s" does not support sending refund requests', 'event_espresso'),
575
+					get_class($this)
576 576
 				)
577 577
 			);
578 578
 		}
@@ -586,15 +586,15 @@  discard block
 block discarded – undo
586 586
 	 * @return string
587 587
 	 * @throws EE_Error
588 588
 	 */
589
-	public function payment_occurs(){
590
-		if( ! $this->_gateway){
589
+	public function payment_occurs() {
590
+		if ( ! $this->_gateway) {
591 591
 			return EE_PMT_Base::offline;
592
-		}elseif($this->_gateway instanceof EE_Onsite_Gateway){
592
+		}elseif ($this->_gateway instanceof EE_Onsite_Gateway) {
593 593
 			return EE_PMT_Base::onsite;
594
-		}elseif($this->_gateway instanceof EE_Offsite_Gateway){
594
+		}elseif ($this->_gateway instanceof EE_Offsite_Gateway) {
595 595
 			return EE_PMT_Base::offsite;
596
-		}else{
597
-			throw new EE_Error(sprintf(__("Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those", "event_espresso"),get_class($this)));
596
+		} else {
597
+			throw new EE_Error(sprintf(__("Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those", "event_espresso"), get_class($this)));
598 598
 		}
599 599
 	}
600 600
 
@@ -607,8 +607,8 @@  discard block
 block discarded – undo
607 607
 	 * @param EE_Payment $payment
608 608
 	 * @return string
609 609
 	 */
610
-	public function payment_overview_content(EE_Payment $payment){
611
-		return EEH_Template::display_template(EE_LIBRARIES.'payment_methods'.DS.'templates'.DS.'payment_details_content.template.php', array('payment_method'=>$this->_pm_instance,'payment'=>$payment) , true);
610
+	public function payment_overview_content(EE_Payment $payment) {
611
+		return EEH_Template::display_template(EE_LIBRARIES.'payment_methods'.DS.'templates'.DS.'payment_details_content.template.php', array('payment_method'=>$this->_pm_instance, 'payment'=>$payment), true);
612 612
 	}
613 613
 
614 614
 
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 	 *	@type array $template_args any arguments you want passed to the template file while rendering.
622 622
 	 *				Keys will be variable names and values with be their values.
623 623
 	 */
624
-	public function help_tabs_config(){
624
+	public function help_tabs_config() {
625 625
 		return array();
626 626
 	}
627 627
 
@@ -632,9 +632,9 @@  discard block
 block discarded – undo
632 632
 	 * the payment method's table's PMT_type column)
633 633
 	 * @return string
634 634
 	 */
635
-	public function system_name(){
635
+	public function system_name() {
636 636
 		$classname = get_class($this);
637
-		return str_replace("EE_PMT_",'',$classname);
637
+		return str_replace("EE_PMT_", '', $classname);
638 638
 	}
639 639
 
640 640
 
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 	 * A pretty i18n version of the PMT name
644 644
 	 * @return string
645 645
 	 */
646
-	public function pretty_name(){
646
+	public function pretty_name() {
647 647
 		return $this->_pretty_name;
648 648
 	}
649 649
 
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 	 * Gets the default absolute URL to the payment method type's button
654 654
 	 * @return string
655 655
 	 */
656
-	public function default_button_url(){
656
+	public function default_button_url() {
657 657
 		return $this->_default_button_url;
658 658
 	}
659 659
 
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 	 * Gets the gateway used by this payment method (if any)
664 664
 	 * @return EE_Gateway
665 665
 	 */
666
-	public function get_gateway(){
666
+	public function get_gateway() {
667 667
 		return $this->_gateway;
668 668
 	}
669 669
 
@@ -672,8 +672,8 @@  discard block
 block discarded – undo
672 672
 	/**
673 673
 	 * @return string html for the link to a help tab
674 674
 	 */
675
-	public function get_help_tab_link(){
676
-		return EEH_Template::get_help_tab_link( $this->get_help_tab_name() );
675
+	public function get_help_tab_link() {
676
+		return EEH_Template::get_help_tab_link($this->get_help_tab_name());
677 677
 	}
678 678
 
679 679
 
@@ -682,8 +682,8 @@  discard block
 block discarded – undo
682 682
 	 * Returns the name of the help tab for this PMT
683 683
 	 * @return string
684 684
 	 */
685
-	public function get_help_tab_name(){
686
-		return 'ee_' . strtolower( $this->system_name() ) . '_help_tab';
685
+	public function get_help_tab_name() {
686
+		return 'ee_'.strtolower($this->system_name()).'_help_tab';
687 687
 	}
688 688
 
689 689
 	/**
@@ -691,8 +691,8 @@  discard block
 block discarded – undo
691 691
 	 * this PMT by an admin
692 692
 	 * @return string
693 693
 	 */
694
-	public function cap_name(){
695
-		return 'ee_payment_method_' . strtolower( $this->system_name() );
694
+	public function cap_name() {
695
+		return 'ee_payment_method_'.strtolower($this->system_name());
696 696
 	}
697 697
 
698 698
 	/**
@@ -704,9 +704,9 @@  discard block
 block discarded – undo
704 704
 	 * @param EE_Payment $payment
705 705
 	 * @return void
706 706
 	 */
707
-	public function update_txn_based_on_payment( $payment ){
708
-		if( $this->_gateway instanceof EE_Gateway ){
709
-			$this->_gateway->update_txn_based_on_payment( $payment );
707
+	public function update_txn_based_on_payment($payment) {
708
+		if ($this->_gateway instanceof EE_Gateway) {
709
+			$this->_gateway->update_txn_based_on_payment($payment);
710 710
 		}
711 711
 	}
712 712
 
Please login to merge, or discard this patch.
core/libraries/payment_methods/EE_Payment_Method_Manager.lib.php 1 patch
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');}
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); }
2 2
 /**
3 3
  *
4 4
  * Class EE_Payment_Method_Manager
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public static function instance() {
37 37
 		// check if class object is instantiated, and instantiated properly
38
-		if ( ! self::$_instance instanceof EE_Payment_Method_Manager ) {
38
+		if ( ! self::$_instance instanceof EE_Payment_Method_Manager) {
39 39
 			self::$_instance = new self();
40 40
 		}
41 41
 		EE_Registry::instance()->load_lib('PMT_Base');
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * Resets the instance and returns a new one
47 47
 	 * @return EE_Payment_Method_Manager
48 48
 	 */
49
-	public static function reset(){
49
+	public static function reset() {
50 50
 		self::$_instance = NULL;
51 51
 		return self::instance();
52 52
 	}
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 	 * or just re-use the PMTs we found last time we checked during this request (if
58 58
 	 * we have not yet checked during this request, then we need to check anyways)
59 59
 	 */
60
-	public function maybe_register_payment_methods( $force_recheck = FALSE ){
61
-		if( ! $this->_payment_method_types || $force_recheck ){
60
+	public function maybe_register_payment_methods($force_recheck = FALSE) {
61
+		if ( ! $this->_payment_method_types || $force_recheck) {
62 62
 			$this->_register_payment_methods();
63 63
 			//if in admin lets ensure caps are set.
64
-			if ( is_admin() ) {
65
-				add_filter( 'FHEE__EE_Capabilities__init_caps_map__caps', array( $this, 'add_payment_method_caps' ) );
64
+			if (is_admin()) {
65
+				add_filter('FHEE__EE_Capabilities__init_caps_map__caps', array($this, 'add_payment_method_caps'));
66 66
 				EE_Registry::instance()->CAP->init_caps();
67 67
 			}
68 68
 		}
@@ -75,19 +75,19 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	protected function _register_payment_methods() {
77 77
 		// grab list of installed modules
78
-		$pm_to_register = glob( EE_PAYMENT_METHODS . '*', GLOB_ONLYDIR );
78
+		$pm_to_register = glob(EE_PAYMENT_METHODS.'*', GLOB_ONLYDIR);
79 79
 		// filter list of modules to register
80
-		$pm_to_register = apply_filters( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', $pm_to_register );
80
+		$pm_to_register = apply_filters('FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', $pm_to_register);
81 81
 
82 82
 		// loop through folders
83
-		foreach ( $pm_to_register as $pm_path ) {
84
-				$this->register_payment_method( $pm_path );
83
+		foreach ($pm_to_register as $pm_path) {
84
+				$this->register_payment_method($pm_path);
85 85
 		}
86
-		do_action( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__registered_payment_methods' );
86
+		do_action('FHEE__EE_Payment_Method_Manager__register_payment_methods__registered_payment_methods');
87 87
 		// filter list of installed modules
88 88
 		//keep them organized alphabetically by the payment method type's name
89
-		ksort( $this->_payment_method_types );
90
-		return apply_filters( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__installed_payment_methods', $this->_payment_method_types );
89
+		ksort($this->_payment_method_types);
90
+		return apply_filters('FHEE__EE_Payment_Method_Manager__register_payment_methods__installed_payment_methods', $this->_payment_method_types);
91 91
 	}
92 92
 
93 93
 
@@ -99,35 +99,35 @@  discard block
 block discarded – undo
99 99
 	 * @param string $payment_method_path - full path up to and including payment method folder
100 100
 	 * @return boolean
101 101
 	 */
102
-	public function register_payment_method( $payment_method_path = '' ) {
103
-		do_action( 'AHEE__EE_Payment_Method_Manager__register_payment_method__begin',$payment_method_path );
102
+	public function register_payment_method($payment_method_path = '') {
103
+		do_action('AHEE__EE_Payment_Method_Manager__register_payment_method__begin', $payment_method_path);
104 104
 		$module_ext = '.pm.php';
105 105
 		// make all separators match
106
-		$payment_method_path = rtrim( str_replace( '/\\', DS, $payment_method_path ), DS );
106
+		$payment_method_path = rtrim(str_replace('/\\', DS, $payment_method_path), DS);
107 107
 		// grab and sanitize module name
108
-		$module_dir = basename( $payment_method_path );
108
+		$module_dir = basename($payment_method_path);
109 109
 		// create classname from module directory name
110
-		$module = str_replace( ' ', '_', str_replace( '_', ' ', $module_dir ));
110
+		$module = str_replace(' ', '_', str_replace('_', ' ', $module_dir));
111 111
 		// add class prefix
112
-		$module_class = 'EE_PMT_' . $module;
112
+		$module_class = 'EE_PMT_'.$module;
113 113
 		// does the module exist ?
114
-		if ( ! is_readable( $payment_method_path . DS . $module_class . $module_ext )) {
115
-			$msg = sprintf( __( 'The requested %s payment method file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module );
116
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
114
+		if ( ! is_readable($payment_method_path.DS.$module_class.$module_ext)) {
115
+			$msg = sprintf(__('The requested %s payment method file could not be found or is not readable due to file permissions.', 'event_espresso'), $module);
116
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
117 117
 			return FALSE;
118 118
 		}
119
-		if ( WP_DEBUG === TRUE ) { EEH_Debug_Tools::instance()->start_timer(); }
119
+		if (WP_DEBUG === TRUE) { EEH_Debug_Tools::instance()->start_timer(); }
120 120
 		// load the module class file
121
-		require_once( $payment_method_path . DS . $module_class . $module_ext );
122
-		if ( WP_DEBUG === TRUE ) { EEH_Debug_Tools::instance()->stop_timer("Requiring payment method $module_class"); }
121
+		require_once($payment_method_path.DS.$module_class.$module_ext);
122
+		if (WP_DEBUG === TRUE) { EEH_Debug_Tools::instance()->stop_timer("Requiring payment method $module_class"); }
123 123
 		// verify that class exists
124
-		if ( ! class_exists( $module_class )) {
125
-			$msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class );
126
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
124
+		if ( ! class_exists($module_class)) {
125
+			$msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class);
126
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
127 127
 			return FALSE;
128 128
 		}
129 129
 		// add to array of registered modules
130
-		$this->_payment_method_types[ $module ] = $payment_method_path . DS . $module_class . $module_ext;
130
+		$this->_payment_method_types[$module] = $payment_method_path.DS.$module_class.$module_ext;
131 131
 		return TRUE;
132 132
 	}
133 133
 	/**
@@ -136,18 +136,18 @@  discard block
 block discarded – undo
136 136
 	 * @param boolean $force_recheck whether to force re-checking for new payment method types
137 137
 	 * @return boolean
138 138
 	 */
139
-	public function payment_method_type_exists($payment_method_name, $force_recheck = FALSE){
139
+	public function payment_method_type_exists($payment_method_name, $force_recheck = FALSE) {
140 140
 		if (
141 141
 			$force_recheck
142
-			|| ! is_array( $this->_payment_method_types )
143
-			|| ! isset( $this->_payment_method_types[$payment_method_name] )
142
+			|| ! is_array($this->_payment_method_types)
143
+			|| ! isset($this->_payment_method_types[$payment_method_name])
144 144
 		) {
145 145
 			$this->maybe_register_payment_methods($force_recheck);
146 146
 		}
147
-		if(isset($this->_payment_method_types[$payment_method_name])){
147
+		if (isset($this->_payment_method_types[$payment_method_name])) {
148 148
 			require_once($this->_payment_method_types[$payment_method_name]);
149 149
 			return true;
150
-		}else{
150
+		} else {
151 151
 			return false;
152 152
 		}
153 153
 	}
@@ -158,16 +158,16 @@  discard block
 block discarded – undo
158 158
 	 * @param boolean $force_recheck whether to force re-checking for new payment method types
159 159
 	 * @return array
160 160
 	 */
161
-	public function payment_method_type_names($with_prefixes = FALSE, $force_recheck = FALSE ){
161
+	public function payment_method_type_names($with_prefixes = FALSE, $force_recheck = FALSE) {
162 162
 		$this->maybe_register_payment_methods($force_recheck);
163
-		if($with_prefixes){
163
+		if ($with_prefixes) {
164 164
 			$classnames = array_keys($this->_payment_method_types);
165 165
 			$payment_methods = array();
166
-			foreach($classnames as $classname){
166
+			foreach ($classnames as $classname) {
167 167
 				$payment_methods[] = $this->payment_method_class_from_type($classname);
168 168
 			}
169 169
 			return $payment_methods;
170
-		}else{
170
+		} else {
171 171
 			return array_keys($this->_payment_method_types);
172 172
 		}
173 173
 	}
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
 	 * @param boolean $force_recheck whether to force re-checking for new payment method types
178 178
 	 * @return EE_PMT_Base[]
179 179
 	 */
180
-	public function payment_method_types( $force_recheck = FALSE ){
180
+	public function payment_method_types($force_recheck = FALSE) {
181 181
 		$this->maybe_register_payment_methods($force_recheck);
182 182
 		$pmt_objs = array();
183
-		foreach($this->payment_method_type_names(true) as $classname){
183
+		foreach ($this->payment_method_type_names(true) as $classname) {
184 184
 			$pmt_objs[] = new $classname;
185 185
 		}
186 186
 		return $pmt_objs;
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
 	 * @param string $classname
193 193
 	 * @return string
194 194
 	 */
195
-	public function payment_method_type_sans_class_prefix($classname){
196
-		return str_replace( "EE_PMT_", "", $classname );
195
+	public function payment_method_type_sans_class_prefix($classname) {
196
+		return str_replace("EE_PMT_", "", $classname);
197 197
 	}
198 198
 
199 199
 	/**
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 * @param string $type
202 202
 	 * @return string
203 203
 	 */
204
-	public function payment_method_class_from_type($type){
204
+	public function payment_method_class_from_type($type) {
205 205
 		$this->maybe_register_payment_methods();
206 206
 		return "EE_PMT_".$type;
207 207
 	}
@@ -215,39 +215,39 @@  discard block
 block discarded – undo
215 215
 	 * @return \EE_Payment_Method
216 216
 	 * @throws \EE_Error
217 217
 	 */
218
-	public function activate_a_payment_method_of_type( $payment_method_type ){
218
+	public function activate_a_payment_method_of_type($payment_method_type) {
219 219
 		$payment_method = EEM_Payment_Method::instance()->get_one_of_type($payment_method_type);
220
-		if( ! $payment_method instanceof EE_Payment_Method ){
220
+		if ( ! $payment_method instanceof EE_Payment_Method) {
221 221
 			$pm_type_class = $this->payment_method_class_from_type($payment_method_type);
222
-			if(class_exists($pm_type_class)){
222
+			if (class_exists($pm_type_class)) {
223 223
 				/** @var $pm_type_obj EE_PMT_Base */
224 224
 				$pm_type_obj = new $pm_type_class;
225 225
 				$payment_method = EEM_Payment_Method::instance()->get_one_by_slug($pm_type_obj->system_name());
226
-				if( ! $payment_method){
227
-					$payment_method = $this->create_payment_method_of_type( $pm_type_obj );
226
+				if ( ! $payment_method) {
227
+					$payment_method = $this->create_payment_method_of_type($pm_type_obj);
228 228
 				}
229
-				$payment_method->set_type( $payment_method_type );
230
-				$this->initialize_payment_method( $payment_method );
229
+				$payment_method->set_type($payment_method_type);
230
+				$this->initialize_payment_method($payment_method);
231 231
 			} else {
232 232
 				throw new EE_Error(
233 233
 					sprintf(
234
-						__( 'There is no payment method of type %1$s, so it could not be activated', 'event_espresso'),
234
+						__('There is no payment method of type %1$s, so it could not be activated', 'event_espresso'),
235 235
 						$pm_type_class )
236 236
 				);
237 237
 			}
238 238
 		}
239 239
 		$payment_method->set_active();
240 240
 		$payment_method->save();
241
-		$this->set_usable_currencies_on_payment_method( $payment_method );
242
-		if( $payment_method->type() === 'Invoice' ){
241
+		$this->set_usable_currencies_on_payment_method($payment_method);
242
+		if ($payment_method->type() === 'Invoice') {
243 243
 			/** @type EE_Message_Resource_Manager $message_resource_manager */
244
-			$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
245
-			$message_resource_manager->ensure_message_type_is_active( 'invoice', 'html' );
246
-			$message_resource_manager->ensure_messenger_is_active( 'pdf' );
244
+			$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
245
+			$message_resource_manager->ensure_message_type_is_active('invoice', 'html');
246
+			$message_resource_manager->ensure_messenger_is_active('pdf');
247 247
 			EE_Error::add_attention(
248 248
 				sprintf(
249
-					__( 'Note, when the invoice payment method is activated, the invoice message type, html messenger, and pdf messenger are activated as well for the %1$smessages system%2$s.', 'event_espresso' ),
250
-					'<a href="' . admin_url( 'admin.php?page=espresso_messages') . '">',
249
+					__('Note, when the invoice payment method is activated, the invoice message type, html messenger, and pdf messenger are activated as well for the %1$smessages system%2$s.', 'event_espresso'),
250
+					'<a href="'.admin_url('admin.php?page=espresso_messages').'">',
251 251
 					'</a>'
252 252
 				)
253 253
 			);
@@ -265,17 +265,17 @@  discard block
 block discarded – undo
265 265
 	 * @return EE_Payment_Method
266 266
 	 * @throws \EE_Error
267 267
 	 */
268
-	public function create_payment_method_of_type( $pm_type_obj ) {
268
+	public function create_payment_method_of_type($pm_type_obj) {
269 269
 		global $current_user;
270 270
 		$payment_method = EE_Payment_Method::new_instance(
271 271
 			array(
272 272
 				'PMD_type' 		 => $pm_type_obj->system_name(),
273 273
 				'PMD_name' 		 => $pm_type_obj->pretty_name(),
274 274
 				'PMD_admin_name' => $pm_type_obj->pretty_name(),
275
-				'PMD_slug' 		 => $pm_type_obj->system_name(),//automatically converted to slug
275
+				'PMD_slug' 		 => $pm_type_obj->system_name(), //automatically converted to slug
276 276
 				'PMD_wp_user' 	 => $current_user->ID,
277 277
 				'PMD_order' 	 => EEM_Payment_Method::instance()->count(
278
-					array( array( 'PMD_type' => array( '!=', 'Admin_Only' )))
278
+					array(array('PMD_type' => array('!=', 'Admin_Only')))
279 279
 				) * 10,
280 280
 			)
281 281
 		);
@@ -291,21 +291,21 @@  discard block
 block discarded – undo
291 291
 	 * @return EE_Payment_Method
292 292
 	 * @throws \EE_Error
293 293
 	 */
294
-	public function initialize_payment_method( $payment_method ) {
294
+	public function initialize_payment_method($payment_method) {
295 295
 		$pm_type_obj = $payment_method->type_obj();
296
-		$payment_method->set_description( $pm_type_obj->default_description() );
297
-		if( ! $payment_method->button_url() ){
298
-			$payment_method->set_button_url( $pm_type_obj->default_button_url() );
296
+		$payment_method->set_description($pm_type_obj->default_description());
297
+		if ( ! $payment_method->button_url()) {
298
+			$payment_method->set_button_url($pm_type_obj->default_button_url());
299 299
 		}
300 300
 		//now add setup its default extra meta properties
301 301
 		$extra_metas = $pm_type_obj->settings_form()->extra_meta_inputs();
302
-		if ( ! empty( $extra_metas ) ) {
302
+		if ( ! empty($extra_metas)) {
303 303
 			//verify the payment method has an ID before adding extra meta
304
-			if ( ! $payment_method->ID() ) {
304
+			if ( ! $payment_method->ID()) {
305 305
 				$payment_method->save();
306 306
 			}
307
-			foreach ( $extra_metas as $meta_name => $input ) {
308
-				$payment_method->update_extra_meta( $meta_name, $input->raw_value() );
307
+			foreach ($extra_metas as $meta_name => $input) {
308
+				$payment_method->update_extra_meta($meta_name, $input->raw_value());
309 309
 			}
310 310
 		}
311 311
 		return $payment_method;
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
 	 * @return EE_Payment_Method
321 321
 	 * @throws \EE_Error
322 322
 	 */
323
-	public function set_usable_currencies_on_payment_method( $payment_method ) {
324
-		foreach($payment_method->get_all_usable_currencies() as $currency_obj){
323
+	public function set_usable_currencies_on_payment_method($payment_method) {
324
+		foreach ($payment_method->get_all_usable_currencies() as $currency_obj) {
325 325
 			$payment_method->_add_relation_to($currency_obj, 'Currency');
326 326
 		}
327 327
 		return $payment_method;
@@ -339,19 +339,19 @@  discard block
 block discarded – undo
339 339
 	 *
340 340
 	 * @return int count of rows updated.
341 341
 	 */
342
-	public function deactivate_payment_method( $payment_method_slug ) {
342
+	public function deactivate_payment_method($payment_method_slug) {
343 343
 		EE_Log::instance()->log(
344 344
 				__FILE__,
345 345
 				__FUNCTION__,
346 346
 				sprintf(
347
-					__( 'Payment method with slug %1$s is being deactivated by site admin', 'event_espresso' ),
347
+					__('Payment method with slug %1$s is being deactivated by site admin', 'event_espresso'),
348 348
 					$payment_method_slug
349 349
 				),
350 350
 				'payment_method_change'
351 351
 			);
352 352
 		$count_updated = EEM_Payment_Method::instance()->update(
353
-			array( 'PMD_scope' => array() ),
354
-			array( array( 'PMD_slug' => $payment_method_slug ) )
353
+			array('PMD_scope' => array()),
354
+			array(array('PMD_slug' => $payment_method_slug))
355 355
 		);
356 356
 		return $count_updated;
357 357
 	}
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 * @param array $caps capabilities being filtered
366 366
 	 * @return array
367 367
 	 */
368
-	public function add_payment_method_caps( $caps ) {
368
+	public function add_payment_method_caps($caps) {
369 369
 		/* add dynamic caps from payment methods
370 370
 		 * at the time of writing, october 20 2014, these are the caps added:
371 371
 		 * ee_payment_method_admin_only
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 		 * their related capability automatically added too, so long as they are
381 381
 		 * registered properly using EE_Register_Payment_Method::register()
382 382
 		 */
383
-		foreach( $this->payment_method_types() as $payment_method_type_obj ){
383
+		foreach ($this->payment_method_types() as $payment_method_type_obj) {
384 384
 			$caps['administrator'][] = $payment_method_type_obj->cap_name();
385 385
 		}
386 386
 		return $caps;
Please login to merge, or discard this patch.
strategies/validation/EE_Simple_HTML_Validation_Strategy.strategy.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -10,17 +10,17 @@  discard block
 block discarded – undo
10 10
  * @since 				4.6
11 11
  *
12 12
  */
13
-class EE_Simple_HTML_Validation_Strategy extends EE_Validation_Strategy_Base{
13
+class EE_Simple_HTML_Validation_Strategy extends EE_Validation_Strategy_Base {
14 14
 
15 15
 	/**
16 16
 	 * @param null $validation_error_message
17 17
 	 */
18
-	public function __construct( $validation_error_message = NULL ) {
19
-		if( ! $validation_error_message ){
18
+	public function __construct($validation_error_message = NULL) {
19
+		if ( ! $validation_error_message) {
20 20
 			$allowedtags = $this->_get_allowed_tags();
21
-			$validation_error_message = sprintf( __( "Only simple HTML tags are allowed. Eg, %s", "event_espresso" ), implode( ",", array_keys( $allowedtags ) ) );
21
+			$validation_error_message = sprintf(__("Only simple HTML tags are allowed. Eg, %s", "event_espresso"), implode(",", array_keys($allowedtags)));
22 22
 		}
23
-		parent::__construct( $validation_error_message );
23
+		parent::__construct($validation_error_message);
24 24
 	}
25 25
 
26 26
 
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function get_list_of_allowed_tags() {
45 45
 		$allowed_tags = $this->_get_allowed_tags();
46
-		ksort( $allowed_tags );
47
-		return implode( ', ', array_keys( $allowed_tags ) );
46
+		ksort($allowed_tags);
47
+		return implode(', ', array_keys($allowed_tags));
48 48
 	}
49 49
 
50 50
 
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	public function validate($normalized_value) {
57 57
 		$allowedtags = $this->_get_allowed_tags();
58
-		parent::validate( $normalized_value );
59
-		$normalized_value_sans_tags =  wp_kses( "$normalized_value",$allowedtags );
60
-		if ( strlen( $normalized_value ) > strlen( $normalized_value_sans_tags ) ) {
61
-			throw new EE_Validation_Error( $this->get_validation_error_message(), 'complex_html_tags' );
58
+		parent::validate($normalized_value);
59
+		$normalized_value_sans_tags = wp_kses("$normalized_value", $allowedtags);
60
+		if (strlen($normalized_value) > strlen($normalized_value_sans_tags)) {
61
+			throw new EE_Validation_Error($this->get_validation_error_message(), 'complex_html_tags');
62 62
 		}
63 63
 	}
64 64
 }
65 65
\ No newline at end of file
Please login to merge, or discard this patch.
core/libraries/batch/JobHandlers/AttendeesReport.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 use EventEspressoBatchRequest\Helpers\JobParameters;
19 19
 use EventEspressoBatchRequest\Helpers\JobStepResponse;
20 20
 
21
-if (!defined('EVENT_ESPRESSO_VERSION')) {
21
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
22 22
 	exit('No direct script access allowed');
23 23
 }
24 24
 
@@ -27,84 +27,84 @@  discard block
 block discarded – undo
27 27
 
28 28
 
29 29
 	public function create_job(JobParameters $job_parameters) {
30
-		if( ! \EE_Capabilities::instance()->current_user_can( 'ee_read_contacts', 'generating_report' ) ) {
30
+		if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_contacts', 'generating_report')) {
31 31
 			throw new BatchRequestException(
32
-				__( 'You do not have permission to view contacts', 'event_espresso')
32
+				__('You do not have permission to view contacts', 'event_espresso')
33 33
 			);
34 34
 		}
35 35
 		$filepath = $this->create_file_from_job_with_name(
36 36
 			$job_parameters->job_id(),
37 37
 			__('contact-list-report.csv', 'event_espresso')
38 38
 		);
39
-		$job_parameters->add_extra_data( 'filepath', $filepath );
40
-		$job_parameters->set_job_size( $this->count_units_to_process() );
39
+		$job_parameters->add_extra_data('filepath', $filepath);
40
+		$job_parameters->set_job_size($this->count_units_to_process());
41 41
 		//we should also set the header columns
42
-		$csv_data_for_row = $this->get_csv_data( 0, 1 );
43
-		\EEH_Export::write_data_array_to_csv( $filepath, $csv_data_for_row, true );
42
+		$csv_data_for_row = $this->get_csv_data(0, 1);
43
+		\EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true);
44 44
 		//if we actually processed a row there, record it
45
-		if( $job_parameters->job_size() ) {
46
-			$job_parameters->mark_processed( 1 );
45
+		if ($job_parameters->job_size()) {
46
+			$job_parameters->mark_processed(1);
47 47
 		}
48 48
 		return new JobStepResponse(
49 49
 			$job_parameters,
50
-			__( 'Contacts report started successfully...', 'event_espresso' )
50
+			__('Contacts report started successfully...', 'event_espresso')
51 51
 		);
52 52
 	}
53 53
 
54 54
 
55 55
 	public function continue_job(JobParameters $job_parameters, $batch_size = 50) {
56
-		$csv_data = $this->get_csv_data( $job_parameters->units_processed(), $batch_size );
57
-		\EEH_Export::write_data_array_to_csv( $job_parameters->extra_datum( 'filepath' ), $csv_data, false );
58
-		$units_processed = count( $csv_data );
59
-		$job_parameters->mark_processed( $units_processed );
56
+		$csv_data = $this->get_csv_data($job_parameters->units_processed(), $batch_size);
57
+		\EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false);
58
+		$units_processed = count($csv_data);
59
+		$job_parameters->mark_processed($units_processed);
60 60
 		$extra_response_data = array(
61 61
 			'file_url' => ''
62 62
 		);
63
-		if( $units_processed < $batch_size ) {
64
-			$job_parameters->set_status( JobParameters::status_complete );
65
-			$extra_response_data[ 'file_url' ] = $this->get_url_to_file( $job_parameters->extra_datum( 'filepath' ) );
63
+		if ($units_processed < $batch_size) {
64
+			$job_parameters->set_status(JobParameters::status_complete);
65
+			$extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath'));
66 66
 		}
67 67
 		return new JobStepResponse(
68 68
 				$job_parameters,
69 69
 				sprintf(
70
-					__( 'Wrote %1$s rows to report CSV file...', 'event_espresso' ),
71
-					count( $csv_data ) ),
70
+					__('Wrote %1$s rows to report CSV file...', 'event_espresso'),
71
+					count($csv_data) ),
72 72
 				$extra_response_data );
73 73
 	}
74 74
 
75 75
 
76 76
 	public function cleanup_job(JobParameters $job_parameters) {
77 77
 		$this->_file_helper->delete(
78
-			\EEH_File::remove_filename_from_filepath( $job_parameters->extra_datum( 'filepath' ) ),
78
+			\EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')),
79 79
 			true,
80 80
 			'd'
81 81
 		);
82
-		return new JobStepResponse( $job_parameters, __( 'Cleaned up temporary file', 'event_espresso' ) );
82
+		return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso'));
83 83
 	}
84 84
 
85 85
 	public function count_units_to_process() {
86
-		return \EEM_Attendee::instance()->count( array( 'caps' => \EEM_Base::caps_read_admin ));
86
+		return \EEM_Attendee::instance()->count(array('caps' => \EEM_Base::caps_read_admin));
87 87
 	}
88
-	public function get_csv_data( $offset, $limit ) {
88
+	public function get_csv_data($offset, $limit) {
89 89
 		$attendee_rows = \EEM_Attendee::instance()->get_all_wpdb_results( 
90 90
 			array( 
91
-				'limit' => array( $offset, $limit ),
92
-				'force_join' => array( 'State', 'Country' ),
91
+				'limit' => array($offset, $limit),
92
+				'force_join' => array('State', 'Country'),
93 93
 				'caps' => \EEM_Base::caps_read_admin
94 94
 			) 
95 95
 		);
96 96
 		$csv_data = array();
97
-		foreach( $attendee_rows as $attendee_row ){
97
+		foreach ($attendee_rows as $attendee_row) {
98 98
 			$csv_row = array();
99
-			foreach( \EEM_Attendee::instance()->field_settings() as $field_name => $field_obj ){
100
-				if( $field_name == 'STA_ID' ){
101
-					$state_name_field = \EEM_State::instance()->field_settings_for( 'STA_name' );
102
-					$csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ];
103
-				}elseif( $field_name == 'CNT_ISO' ){
104
-					$country_name_field = \EEM_Country::instance()->field_settings_for( 'CNT_name' );
105
-					$csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ];
106
-				}else{
107
-					$csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ];
99
+			foreach (\EEM_Attendee::instance()->field_settings() as $field_name => $field_obj) {
100
+				if ($field_name == 'STA_ID') {
101
+					$state_name_field = \EEM_State::instance()->field_settings_for('STA_name');
102
+					$csv_row[__('State', 'event_espresso')] = $attendee_row[$state_name_field->get_qualified_column()];
103
+				}elseif ($field_name == 'CNT_ISO') {
104
+					$country_name_field = \EEM_Country::instance()->field_settings_for('CNT_name');
105
+					$csv_row[__('Country', 'event_espresso')] = $attendee_row[$country_name_field->get_qualified_column()];
106
+				} else {
107
+					$csv_row[$field_obj->get_nicename()] = $attendee_row[$field_obj->get_qualified_column()];
108 108
 				}
109 109
 			}
110 110
 			$csv_data[] = $csv_row;
Please login to merge, or discard this patch.
modules/ticket_selector/EED_Ticket_Selector.module.php 1 patch
Spacing   +206 added lines, -206 removed lines patch added patch discarded remove patch
@@ -57,15 +57,15 @@  discard block
 block discarded – undo
57 57
 	 * @return EED_Ticket_Selector
58 58
 	 */
59 59
 	public static function instance() {
60
-		return parent::get_instance( __CLASS__ );
60
+		return parent::get_instance(__CLASS__);
61 61
 	}
62 62
 
63 63
 
64 64
 
65
-	protected function set_config(){
66
-		$this->set_config_section( 'template_settings' );
67
-		$this->set_config_class( 'EE_Ticket_Selector_Config' );
68
-		$this->set_config_name( 'EED_Ticket_Selector' );
65
+	protected function set_config() {
66
+		$this->set_config_section('template_settings');
67
+		$this->set_config_class('EE_Ticket_Selector_Config');
68
+		$this->set_config_name('EED_Ticket_Selector');
69 69
 	}
70 70
 
71 71
 
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public static function set_hooks() {
82 82
 		// routing
83
-		EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' );
84
-		EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' );
85
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
83
+		EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector');
84
+		EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections');
85
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
86 86
 		//add_action( 'AHEE_event_details_before_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_open' ), 10, 1 );
87
-		add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 );
87
+		add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1);
88 88
 		//add_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', array( 'EED_Ticket_Selector', 'display_ticket_selector_submit' ), 10, 1 );
89 89
 		//add_action( 'AHEE_event_details_after_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_close' ), 10 );
90
-		add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 );
90
+		add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10);
91 91
 	}
92 92
 
93 93
 
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
 	 *  @return 	void
100 100
 	 */
101 101
 	public static function set_hooks_admin() {
102
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
102
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
103 103
 		//add button for iframe code to event editor.
104
-		add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 );
105
-		add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 );
104
+		add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4);
105
+		add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10);
106 106
 	}
107 107
 
108 108
 
@@ -114,15 +114,15 @@  discard block
 block discarded – undo
114 114
 	 *  @return 	void
115 115
 	 */
116 116
 	public static function set_definitions() {
117
-		define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
118
-		define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
117
+		define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
118
+		define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
119 119
 
120 120
 		//if config is not set, initialize
121 121
 		//If config is not set, set it.
122
-		if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) {
122
+		if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) {
123 123
 			EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config();
124 124
 		}
125
-		EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' );
125
+		EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso');
126 126
 	}
127 127
 
128 128
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * 	@param	object 			$WP
134 134
 	 * 	@return 	void
135 135
 	 */
136
-	public function run( $WP ) {}
136
+	public function run($WP) {}
137 137
 
138 138
 
139 139
 	/**
@@ -145,23 +145,23 @@  discard block
 block discarded – undo
145 145
 	public function ticket_selector_iframe() {
146 146
 		self::$_in_iframe = true;
147 147
 		/** @type EEM_Event $EEM_Event */
148
-		$EEM_Event = EE_Registry::instance()->load_model( 'Event' );
148
+		$EEM_Event = EE_Registry::instance()->load_model('Event');
149 149
 		$event = $EEM_Event->get_one_by_ID(
150
-			EE_Registry::instance()->REQ->get( 'event', 0 )
150
+			EE_Registry::instance()->REQ->get('event', 0)
151 151
 		);
152
-		EE_Registry::instance()->REQ->set_espresso_page( true );
153
-		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event );
152
+		EE_Registry::instance()->REQ->set_espresso_page(true);
153
+		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event);
154 154
 		$template_args['css'] = apply_filters(
155 155
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
156 156
 			array(
157
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION,
158
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION,
159
-				includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ),
160
-				EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION
157
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION,
158
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION,
159
+				includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']),
160
+				EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION
161 161
 			)
162 162
 		);
163
-		EE_Registry::$i18n_js_strings[ 'ticket_selector_iframe' ] = true;
164
-		EE_Registry::$i18n_js_strings[ 'EEDTicketSelectorMsg' ] = __( 'Please choose at least one ticket before continuing.', 'event_espresso' );
163
+		EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true;
164
+		EE_Registry::$i18n_js_strings['EEDTicketSelectorMsg'] = __('Please choose at least one ticket before continuing.', 'event_espresso');
165 165
 		$template_args['eei18n'] = apply_filters(
166 166
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__eei18n_js_strings',
167 167
 			EE_Registry::localize_i18n_js_strings()
@@ -169,18 +169,18 @@  discard block
 block discarded – undo
169 169
 		$template_args['js'] = apply_filters(
170 170
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
171 171
 			array(
172
-				includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ),
173
-				EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION,
174
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION
172
+				includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']),
173
+				EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION,
174
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION
175 175
 			)
176 176
 		);
177
-		$template_args[ 'notices' ] = EEH_Template::display_template(
178
-			EE_TEMPLATES . 'espresso-ajax-notices.template.php',
177
+		$template_args['notices'] = EEH_Template::display_template(
178
+			EE_TEMPLATES.'espresso-ajax-notices.template.php',
179 179
 			array(),
180 180
 			true
181 181
 		);
182 182
 		EEH_Template::display_template(
183
-			TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php',
183
+			TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php',
184 184
 			$template_args
185 185
 		);
186 186
 		exit;
@@ -199,23 +199,23 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @return string The new html string for the permalink area.
201 201
 	 */
202
-	public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) {
202
+	public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) {
203 203
 		//make sure this is ONLY when editing and the event id has been set.
204
-		if ( ! empty( $id ) )  {
205
-			$post = get_post( $id );
204
+		if ( ! empty($id)) {
205
+			$post = get_post($id);
206 206
 
207 207
 			//if NOT event then let's get out.
208
-			if ( $post->post_type !== 'espresso_events' ) {
208
+			if ($post->post_type !== 'espresso_events') {
209 209
 				return $permalink_string;
210 210
 			}
211 211
 
212
-			$ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() );
212
+			$ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url());
213 213
 
214
-			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">' . __('Embed', 'event_espresso') . '</a> ';
214
+			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">'.__('Embed', 'event_espresso').'</a> ';
215 215
 			$permalink_string .= '
216 216
 <div id="js-ts-iframe" style="display:none">
217 217
 	<div style="width:100%; height: 500px;">
218
-		<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>
218
+		<iframe src="' . $ticket_selector_url.'" width="100%" height="100%"></iframe>
219 219
 	</div>
220 220
 </div>';
221 221
 		}
@@ -234,22 +234,22 @@  discard block
 block discarded – undo
234 234
 	 * @param 	mixed $event
235 235
 	 * @return 	bool
236 236
 	 */
237
-	protected static function set_event( $event = null ) {
238
-		if( $event === null ) {
237
+	protected static function set_event($event = null) {
238
+		if ($event === null) {
239 239
 			global $post;
240 240
 			$event = $post;
241 241
 		}
242
-		if ( $event instanceof EE_Event ) {
242
+		if ($event instanceof EE_Event) {
243 243
 			self::$_event = $event;
244
-		} else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) {
244
+		} else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) {
245 245
 			self::$_event = $event->EE_Event;
246
-		} else if ( $event instanceof WP_Post && $event->post_type == 'espresso_events' ) {
247
-			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event );
246
+		} else if ($event instanceof WP_Post && $event->post_type == 'espresso_events') {
247
+			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event);
248 248
 			self::$_event = $event->EE_Event;
249 249
 		} else {
250
-			$user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' );
251
-			$dev_msg = $user_msg . __( 'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso' );
252
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
250
+			$user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso');
251
+			$dev_msg = $user_msg.__('In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso');
252
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
253 253
 			return false;
254 254
 		}
255 255
 		return true;
@@ -268,11 +268,11 @@  discard block
 block discarded – undo
268 268
 	 * @param 	bool 	$view_details
269 269
 	 * @return 	string
270 270
 	 */
271
-	public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) {
271
+	public static function display_ticket_selector($event = NULL, $view_details = FALSE) {
272 272
 		// reset filter for displaying submit button
273
-		remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
273
+		remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
274 274
 		// poke and prod incoming event till it tells us what it is
275
-		if ( ! EED_Ticket_Selector::set_event( $event )) {
275
+		if ( ! EED_Ticket_Selector::set_event($event)) {
276 276
 			return false;
277 277
 		}
278 278
 		$event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event;
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 			&& (
284 284
 				! self::$_event->display_ticket_selector()
285 285
 				|| $view_details
286
-				|| post_password_required( $event_post )
286
+				|| post_password_required($event_post)
287 287
 				|| (
288 288
 					$_event_active_status != EE_Datetime::active
289 289
 					&& $_event_active_status != EE_Datetime::upcoming
@@ -301,68 +301,68 @@  discard block
 block discarded – undo
301 301
 		$template_args = array();
302 302
 		$template_args['event_status'] = $_event_active_status;
303 303
 
304
-		$template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) );
305
-		$template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) );
304
+		$template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format'));
305
+		$template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format'));
306 306
 
307 307
 		$template_args['EVT_ID'] = self::$_event->ID();
308 308
 		$template_args['event'] = self::$_event;
309 309
 
310 310
 		// is the event expired ?
311 311
 		$template_args['event_is_expired'] = self::$_event->is_expired();
312
-		if ( $template_args['event_is_expired'] ) {
313
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso' ) . '</span></div>';
312
+		if ($template_args['event_is_expired']) {
313
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso').'</span></div>';
314 314
 		}
315 315
 
316 316
 		$ticket_query_args = array(
317
-			array( 'Datetime.EVT_ID' => self::$_event->ID() ),
318
-			'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' )
317
+			array('Datetime.EVT_ID' => self::$_event->ID()),
318
+			'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC')
319 319
 		);
320 320
 
321
-		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) {
321
+		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) {
322 322
 			//use the correct applicable time query depending on what version of core is being run.
323
-			$current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp');
324
-			$ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time );
323
+			$current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp');
324
+			$ticket_query_args[0]['TKT_end_date'] = array('>', $current_time);
325 325
 		}
326 326
 
327 327
 		// get all tickets for this event ordered by the datetime
328
-		$template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args );
328
+		$template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args);
329 329
 
330
-		if ( count( $template_args['tickets'] ) < 1 ) {
331
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>';
330
+		if (count($template_args['tickets']) < 1) {
331
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>';
332 332
 		}
333 333
 
334 334
 		// filter the maximum qty that can appear in the Ticket Selector qty dropdowns
335
-		$template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit() );
336
-		if ( $template_args['max_atndz'] < 1 ) {
337
-			$sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' );
338
-			if ( current_user_can( 'edit_post', self::$_event->ID() )) {
339
-				$sales_closed_msg .=  sprintf(
340
-					__( '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso' ),
335
+		$template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit());
336
+		if ($template_args['max_atndz'] < 1) {
337
+			$sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso');
338
+			if (current_user_can('edit_post', self::$_event->ID())) {
339
+				$sales_closed_msg .= sprintf(
340
+					__('%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso'),
341 341
 					'<div class="ee-attention" style="text-align: left;"><b>',
342 342
 					'</b><br />',
343
-					$link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">',
343
+					$link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">',
344 344
 					'</a></span></div>'
345 345
 				);
346 346
 			}
347
-			return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>';
347
+			return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>';
348 348
 		}
349 349
 
350
-		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php';
351
-		$templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event );
350
+		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php';
351
+		$templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event);
352 352
 
353 353
 		// redirecting to another site for registration ??
354 354
 		$external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE;
355 355
 		// set up the form (but not for the admin)
356
-		$ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open( self::$_event->ID(), $external_url ) : '';
356
+		$ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open(self::$_event->ID(), $external_url) : '';
357 357
 		// if not redirecting to another site for registration
358
-		if ( ! $external_url ) {
358
+		if ( ! $external_url) {
359 359
 			// then display the ticket selector
360
-			$ticket_selector .= EEH_Template::locate_template( $templates['ticket_selector'], $template_args );
360
+			$ticket_selector .= EEH_Template::locate_template($templates['ticket_selector'], $template_args);
361 361
 		} else {
362 362
 			// if not we still need to trigger the display of the submit button
363
-			add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
363
+			add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
364 364
 			//display notice to admin that registration is external
365
-			$ticket_selector .= ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' );
365
+			$ticket_selector .= ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso');
366 366
 		}
367 367
 		// submit button and form close tag
368 368
 		$ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : '';
@@ -382,25 +382,25 @@  discard block
 block discarded – undo
382 382
 	 * @param 		string $external_url
383 383
 	 * @return 		string
384 384
 	 */
385
-	public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) {
385
+	public static function ticket_selector_form_open($ID = 0, $external_url = '') {
386 386
 		// if redirecting, we don't need any anything else
387
-		if ( $external_url ) {
388
-			$html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">';
389
-			$query_args = EEH_URL::get_query_string( $external_url );
390
-			foreach ( $query_args as $query_arg => $value ) {
391
-				$html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">';
387
+		if ($external_url) {
388
+			$html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">';
389
+			$query_args = EEH_URL::get_query_string($external_url);
390
+			foreach ($query_args as $query_arg => $value) {
391
+				$html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">';
392 392
 			}
393 393
 			return $html;
394 394
 		}
395
-		$checkout_url = EEH_Event_View::event_link_url( $ID );
396
-		if ( ! $checkout_url ) {
397
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
395
+		$checkout_url = EEH_Event_View::event_link_url($ID);
396
+		if ( ! $checkout_url) {
397
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
398 398
 		}
399 399
 		$extra_params = self::$_in_iframe ? ' target="_blank"' : '';
400
-		$html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>';
401
-		$html .= wp_nonce_field( 	'process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE );
400
+		$html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>';
401
+		$html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE);
402 402
 		$html .= '<input type="hidden" name="ee" value="process_ticket_selections">';
403
-		$html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event );
403
+		$html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event);
404 404
 		return $html;
405 405
 	}
406 406
 
@@ -415,23 +415,23 @@  discard block
 block discarded – undo
415 415
 	 * 	@return		string
416 416
 	 */
417 417
 	public static function display_ticket_selector_submit() {
418
-		if ( ! is_admin() ) {
419
-			if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE ) ) {
418
+		if ( ! is_admin()) {
419
+			if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE)) {
420 420
 				$btn_text = apply_filters(
421 421
 					'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text',
422
-					__('Register Now', 'event_espresso' ),
422
+					__('Register Now', 'event_espresso'),
423 423
 					self::$_event
424 424
 				);
425 425
 				$external_url = self::$_event->external_url();
426
-				$html = '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn"';
426
+				$html = '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn"';
427 427
 				$html .= ' class="ticket-selector-submit-btn ';
428
-				$html .= empty( $external_url ) ? 'ticket-selector-submit-ajax"' : '"';
429
-				$html .= ' type="submit" value="' . $btn_text . '" />';
430
-				$html .= apply_filters( 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event );
428
+				$html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"';
429
+				$html .= ' type="submit" value="'.$btn_text.'" />';
430
+				$html .= apply_filters('FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event);
431 431
 				$html .= '<div class="clear"><br/></div></form>';
432 432
 				return $html;
433
-			} else if ( is_archive() ) {
434
-				return EED_Ticket_Selector::ticket_selector_form_close() . EED_Ticket_Selector::display_view_details_btn();
433
+			} else if (is_archive()) {
434
+				return EED_Ticket_Selector::ticket_selector_form_close().EED_Ticket_Selector::display_view_details_btn();
435 435
 			}
436 436
 		}
437 437
 		return '';
@@ -463,13 +463,13 @@  discard block
 block discarded – undo
463 463
 	 * 	@return		string
464 464
 	 */
465 465
 	public static function display_view_details_btn() {
466
-		if ( ! self::$_event->get_permalink() ) {
467
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
466
+		if ( ! self::$_event->get_permalink()) {
467
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
468 468
 		}
469
-		$view_details_btn = '<form method="POST" action="' . self::$_event->get_permalink() . '">';
470
-		$btn_text = apply_filters( 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __( 'View Details', 'event_espresso' ), self::$_event );
471
-		$view_details_btn .= '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="' . $btn_text . '" />';
472
-		$view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event );
469
+		$view_details_btn = '<form method="POST" action="'.self::$_event->get_permalink().'">';
470
+		$btn_text = apply_filters('FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __('View Details', 'event_espresso'), self::$_event);
471
+		$view_details_btn .= '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'.$btn_text.'" />';
472
+		$view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event);
473 473
 		$view_details_btn .= '<div class="clear"><br/></div>';
474 474
 		$view_details_btn .= '</form>';
475 475
 		return $view_details_btn;
@@ -488,11 +488,11 @@  discard block
 block discarded – undo
488 488
 	 * 	@return		array  or FALSE
489 489
 	 */
490 490
 	public function process_ticket_selections() {
491
-		do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
491
+		do_action('EED_Ticket_Selector__process_ticket_selections__before');
492 492
 		// check nonce
493
-		if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' ) || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ), 'process_ticket_selections' ))) {
493
+		if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set('process_ticket_selections_nonce') || ! wp_verify_nonce(EE_Registry::instance()->REQ->get('process_ticket_selections_nonce'), 'process_ticket_selections'))) {
494 494
 			EE_Error::add_error(
495
-				sprintf( __( 'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
495
+				sprintf(__('We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
496 496
 				__FILE__, __FUNCTION__, __LINE__
497 497
 			);
498 498
 			return FALSE;
@@ -506,16 +506,16 @@  discard block
 block discarded – undo
506 506
 
507 507
 		//we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart.
508 508
 		// When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc.
509
-		EE_Registry::instance()->load_core( 'Session' );
509
+		EE_Registry::instance()->load_core('Session');
510 510
 		// unless otherwise requested, clear the session
511
-		if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) {
512
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
511
+		if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) {
512
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
513 513
 		}
514 514
 		//d( EE_Registry::instance()->SSN );
515 515
 
516
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
516
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
517 517
 		// do we have an event id?
518
-		if ( EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) {
518
+		if (EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) {
519 519
 			// validate/sanitize data
520 520
 			$valid = self::_validate_post_data();
521 521
 
@@ -525,41 +525,41 @@  discard block
 block discarded – undo
525 525
 			//EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ );
526 526
 
527 527
 			//check total tickets ordered vs max number of attendees that can register
528
-			if ( $valid['total_tickets'] > $valid['max_atndz'] ) {
528
+			if ($valid['total_tickets'] > $valid['max_atndz']) {
529 529
 
530 530
 				// ordering too many tickets !!!
531 531
 				$total_tickets_string = _n('You have attempted to purchase %s ticket.', 'You have attempted to purchase %s tickets.', $valid['total_tickets'], 'event_espresso');
532
-				$limit_error_1 = sprintf( $total_tickets_string, $valid['total_tickets'] );
532
+				$limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']);
533 533
 				// dev only message
534 534
 				$max_atndz_string = _n('The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', $valid['max_atndz'], 'event_espresso');
535
-				$limit_error_2 = sprintf( $max_atndz_string, $valid['max_atndz'], $valid['max_atndz'] );
536
-				EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ );
535
+				$limit_error_2 = sprintf($max_atndz_string, $valid['max_atndz'], $valid['max_atndz']);
536
+				EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__);
537 537
 			} else {
538 538
 
539 539
 				// all data appears to be valid
540 540
 				$tckts_slctd = FALSE;
541 541
 				$success = TRUE;
542 542
 				// load cart
543
-				EE_Registry::instance()->load_core( 'Cart' );
543
+				EE_Registry::instance()->load_core('Cart');
544 544
 
545 545
 				// cycle thru the number of data rows sent from the event listing
546
-				for ( $x = 0; $x < $valid['rows']; $x++ ) {
546
+				for ($x = 0; $x < $valid['rows']; $x++) {
547 547
 					// does this row actually contain a ticket quantity?
548
-					if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) {
548
+					if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) {
549 549
 						// YES we have a ticket quantity
550 550
 						$tckts_slctd = TRUE;
551 551
 						//						d( $valid['ticket_obj'][$x] );
552
-						if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) {
552
+						if ($valid['ticket_obj'][$x] instanceof EE_Ticket) {
553 553
 							// then add ticket to cart
554
-							$ticket_added = self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] );
554
+							$ticket_added = self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]);
555 555
 							$success = ! $ticket_added ? FALSE : $success;
556
-							if ( EE_Error::has_error() ) {
556
+							if (EE_Error::has_error()) {
557 557
 								break;
558 558
 							}
559 559
 						} else {
560 560
 							// nothing added to cart retrieved
561 561
 							EE_Error::add_error(
562
-								sprintf( __( 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
562
+								sprintf(__('A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
563 563
 								__FILE__, __FUNCTION__, __LINE__
564 564
 							);
565 565
 						}
@@ -568,45 +568,45 @@  discard block
 block discarded – undo
568 568
 				//d( EE_Registry::instance()->CART );
569 569
 				//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE
570 570
 
571
-				if ( $tckts_slctd ) {
572
-					if ( $success ) {
573
-						do_action( 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this );
571
+				if ($tckts_slctd) {
572
+					if ($success) {
573
+						do_action('FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this);
574 574
 						EE_Registry::instance()->CART->recalculate_all_cart_totals();
575
-						EE_Registry::instance()->CART->save_cart( FALSE );
575
+						EE_Registry::instance()->CART->save_cart(FALSE);
576 576
 						EE_Registry::instance()->SSN->update();
577 577
 						//d( EE_Registry::instance()->CART );
578 578
 						//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE
579 579
 						// just return TRUE for registrations being made from admin
580
-						if ( is_admin() ) {
580
+						if (is_admin()) {
581 581
 							return TRUE;
582 582
 						}
583
-						wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() ));
583
+						wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url()));
584 584
 						exit();
585 585
 
586 586
 					} else {
587
-						if ( ! EE_Error::has_error() ) {
587
+						if ( ! EE_Error::has_error()) {
588 588
 							// nothing added to cart
589
-							EE_Error::add_attention( __( 'No tickets were added for the event', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
589
+							EE_Error::add_attention(__('No tickets were added for the event', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
590 590
 						}
591 591
 					}
592 592
 
593 593
 				} else {
594 594
 					// no ticket quantities were selected
595
-					EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
595
+					EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
596 596
 				}
597 597
 			}
598 598
 			//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT
599 599
 			// at this point, just return if registration is being made from admin
600
-			if ( is_admin() ) {
600
+			if (is_admin()) {
601 601
 				return FALSE;
602 602
 			}
603
-			if ( $valid['return_url'] ) {
604
-				EE_Error::get_notices( FALSE, TRUE );
605
-				wp_safe_redirect( $valid['return_url'] );
603
+			if ($valid['return_url']) {
604
+				EE_Error::get_notices(FALSE, TRUE);
605
+				wp_safe_redirect($valid['return_url']);
606 606
 				exit();
607
-			} elseif ( isset( $event_to_add['id'] )) {
608
-				EE_Error::get_notices( FALSE, TRUE );
609
-				wp_safe_redirect( get_permalink( $event_to_add['id'] ));
607
+			} elseif (isset($event_to_add['id'])) {
608
+				EE_Error::get_notices(FALSE, TRUE);
609
+				wp_safe_redirect(get_permalink($event_to_add['id']));
610 610
 				exit();
611 611
 			} else {
612 612
 				echo EE_Error::get_notices();
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 		} else {
616 616
 			// $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
617 617
 			EE_Error::add_error(
618
-				sprintf( __( 'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
618
+				sprintf(__('An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
619 619
 				__FILE__, __FUNCTION__, __LINE__
620 620
 			);
621 621
 		}
@@ -633,18 +633,18 @@  discard block
 block discarded – undo
633 633
 	 * @return        array  or FALSE
634 634
 	 */
635 635
 	private static function _validate_post_data() {
636
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
636
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
637 637
 
638 638
 		// start with an empty array()
639 639
 		$valid_data = array();
640 640
 		//		d( $_POST );
641 641
 		//if event id is valid
642
-		$id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' ));
643
-		if ( $id ) {
642
+		$id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id'));
643
+		if ($id) {
644 644
 			// grab valid id
645 645
 			$valid_data['id'] = $id;
646 646
 			// grab and sanitize return-url
647
-			$valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id ));
647
+			$valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id));
648 648
 			// array of other form names
649 649
 			$inputs_to_clean = array(
650 650
 				'event_id' => 'tkt-slctr-event-id',
@@ -657,22 +657,22 @@  discard block
 block discarded – undo
657 657
 			// let's track the total number of tickets ordered.'
658 658
 			$valid_data['total_tickets'] = 0;
659 659
 			// cycle through $inputs_to_clean array
660
-			foreach ( $inputs_to_clean as $what => $input_to_clean ) {
660
+			foreach ($inputs_to_clean as $what => $input_to_clean) {
661 661
 				// check for POST data
662
-				if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) {
662
+				if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) {
663 663
 					// grab value
664
-					$input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id );
664
+					$input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id);
665 665
 					switch ($what) {
666 666
 
667 667
 						// integers
668 668
 						case 'event_id':
669
-							$valid_data[$what] = absint( $input_value );
669
+							$valid_data[$what] = absint($input_value);
670 670
 							// get event via the event id we put in the form
671
-							$valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] );
671
+							$valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']);
672 672
 							break;
673 673
 						case 'rows':
674 674
 						case 'max_atndz':
675
-							$valid_data[$what] = absint( $input_value );
675
+							$valid_data[$what] = absint($input_value);
676 676
 							break;
677 677
 
678 678
 						// arrays of integers
@@ -680,27 +680,27 @@  discard block
 block discarded – undo
680 680
 							//							d( $input_value );
681 681
 							$row_qty = $input_value;
682 682
 							// if qty is coming from a radio button input, then we need to assemble an array of rows
683
-							if( ! is_array( $row_qty )) {
683
+							if ( ! is_array($row_qty)) {
684 684
 								// get number of rows
685
-								$rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1;
685
+								$rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1;
686 686
 								//								d( $rows );
687 687
 								// explode ints by the dash
688
-								$row_qty = explode( '-', $row_qty );
689
-								$row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1;
690
-								$qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0;
691
-								$row_qty = array( $row => $qty );
688
+								$row_qty = explode('-', $row_qty);
689
+								$row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1;
690
+								$qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0;
691
+								$row_qty = array($row => $qty);
692 692
 								//								 d( $row_qty );
693
-								for( $x = 1; $x <= $rows; $x++ ) {
694
-									if ( ! isset( $row_qty[$x] )) {
693
+								for ($x = 1; $x <= $rows; $x++) {
694
+									if ( ! isset($row_qty[$x])) {
695 695
 										$row_qty[$x] = 0;
696 696
 									}
697 697
 								}
698 698
 							}
699
-							ksort( $row_qty );
699
+							ksort($row_qty);
700 700
 							//							 d( $row_qty );
701 701
 							// cycle thru values
702
-							foreach ( $row_qty as $qty ) {
703
-								$qty = absint( $qty );
702
+							foreach ($row_qty as $qty) {
703
+								$qty = absint($qty);
704 704
 								// sanitize as integers
705 705
 								$valid_data[$what][] = $qty;
706 706
 								$valid_data['total_tickets'] += $qty;
@@ -711,19 +711,19 @@  discard block
 block discarded – undo
711 711
 						case 'ticket_id':
712 712
 							$value_array = array();
713 713
 							// cycle thru values
714
-							foreach ( $input_value as $key=>$value ) {
714
+							foreach ($input_value as $key=>$value) {
715 715
 								// allow only numbers, letters,  spaces, commas and dashes
716
-								$value_array[ $key ] = wp_strip_all_tags( $value );
716
+								$value_array[$key] = wp_strip_all_tags($value);
717 717
 								// get ticket via the ticket id we put in the form
718
-								$ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value );
719
-								$valid_data['ticket_obj'][ $key ] = $ticket_obj;
718
+								$ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value);
719
+								$valid_data['ticket_obj'][$key] = $ticket_obj;
720 720
 							}
721
-							$valid_data[ $what ] = $value_array;
721
+							$valid_data[$what] = $value_array;
722 722
 							break;
723 723
 
724 724
 						case 'return_url' :
725 725
 							// grab and sanitize return-url
726
-							$valid_data[$what] = esc_url_raw( $input_value );
726
+							$valid_data[$what] = esc_url_raw($input_value);
727 727
 							break;
728 728
 
729 729
 					} 	// end switch $what
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
 			} 	// end foreach $inputs_to_clean
732 732
 
733 733
 		} else {
734
-			EE_Error::add_error( __('The event id provided was not valid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
734
+			EE_Error::add_error(__('The event id provided was not valid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
735 735
 			return FALSE;
736 736
 		}
737 737
 
@@ -749,28 +749,28 @@  discard block
 block discarded – undo
749 749
 	 * @param int       $qty
750 750
 	 * @return TRUE on success, FALSE on fail
751 751
 	 */
752
-	private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) {
753
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
752
+	private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) {
753
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
754 754
 		// get the number of spaces left for this datetime ticket
755
-		$available_spaces = self::_ticket_datetime_availability( $ticket );
755
+		$available_spaces = self::_ticket_datetime_availability($ticket);
756 756
 		// compare available spaces against the number of tickets being purchased
757
-		if ( $available_spaces >= $qty ) {
757
+		if ($available_spaces >= $qty) {
758 758
 			// allow addons to prevent a ticket from being added to cart
759
-			if ( ! apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces ) ) {
759
+			if ( ! apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces)) {
760 760
 				return false;
761 761
 			}
762 762
 			// add event to cart
763
-			if( EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) {
764
-				self::_recalculate_ticket_datetime_availability( $ticket, $qty );
763
+			if (EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) {
764
+				self::_recalculate_ticket_datetime_availability($ticket, $qty);
765 765
 				return true;
766 766
 			} else {
767 767
 				return false;
768 768
 			}
769 769
 		} else {
770 770
 			// tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets
771
-			$available_spaces = self::_ticket_datetime_availability( $ticket, true );
771
+			$available_spaces = self::_ticket_datetime_availability($ticket, true);
772 772
 			// greedy greedy greedy eh?
773
-			if ( $available_spaces > 0 ) {
773
+			if ($available_spaces > 0) {
774 774
 				// add error messaging - we're using the _n function that will generate the appropriate singular or plural message based on the number of $available_spaces
775 775
 				EE_Error::add_error(
776 776
 					sprintf(
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
 					__FILE__, __FUNCTION__, __LINE__
787 787
 				);
788 788
 			} else {
789
-				EE_Error::add_error( __('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
789
+				EE_Error::add_error(__('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
790 790
 			}
791 791
 			return false;
792 792
 		}
@@ -804,22 +804,22 @@  discard block
 block discarded – undo
804 804
 	 * @param 	bool         $get_original_ticket_spaces
805 805
 	 * @return 	int
806 806
 	 */
807
-	private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) {
807
+	private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) {
808 808
 		// if the $_available_spaces array has not been set up yet...
809
-		if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
810
-				self::_set_initial_ticket_datetime_availability( $ticket );
809
+		if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
810
+				self::_set_initial_ticket_datetime_availability($ticket);
811 811
 		}
812 812
 		$available_spaces = $ticket->qty() - $ticket->sold();
813
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
813
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
814 814
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
815
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
815
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
816 816
 				// if we want the original datetime availability BEFORE we started subtracting tickets ?
817
-				if ( $get_original_ticket_spaces ) {
817
+				if ($get_original_ticket_spaces) {
818 818
 					// then grab the available spaces from the "tickets" array and compare with the above to get the lowest number
819
-					$available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] );
819
+					$available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]);
820 820
 				} else {
821 821
 					// we want the updated ticket availability as stored in the "datetimes" array
822
-					$available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] );
822
+					$available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]);
823 823
 				}
824 824
 			}
825 825
 		}
@@ -835,23 +835,23 @@  discard block
 block discarded – undo
835 835
 	 * @param 	EE_Ticket $ticket
836 836
 	 * @return 	int
837 837
 	 */
838
-	private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) {
838
+	private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) {
839 839
 		// first, get all of the datetimes that are available to this ticket
840 840
 		$datetimes = $ticket->get_many_related(
841 841
 			'Datetime',
842
-			array( array( 'DTT_EVT_end' => array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' ))
842
+			array(array('DTT_EVT_end' => array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))), 'order_by' => array('DTT_EVT_start' => 'ASC'))
843 843
 		);
844
-		if ( ! empty( $datetimes )) {
844
+		if ( ! empty($datetimes)) {
845 845
 			// now loop thru all of the datetimes
846
-			foreach ( $datetimes as $datetime  ) {
847
-				if ( $datetime instanceof EE_Datetime ) {
846
+			foreach ($datetimes as $datetime) {
847
+				if ($datetime instanceof EE_Datetime) {
848 848
 					// the number of spaces available for the datetime without considering individual ticket quantities
849 849
 					$spaces_remaining = $datetime->spaces_remaining();
850 850
 					// save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key
851
-					self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining );
851
+					self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining);
852 852
 					// if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number,
853 853
 					// else just take the datetime spaces remaining, and assign to the datetimes array
854
-					self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining;
854
+					self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining;
855 855
 				}
856 856
 			}
857 857
 		}
@@ -867,12 +867,12 @@  discard block
 block discarded – undo
867 867
 	 * @param 	int   $qty
868 868
 	 * @return 	int
869 869
 	 */
870
-	private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) {
871
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
870
+	private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) {
871
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
872 872
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
873
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
873
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
874 874
 				// subtract the qty of selected tickets from each datetime's available spaces this ticket has access to,
875
-				self::$_available_spaces['datetimes'][ $DTD_ID ] = self::$_available_spaces['datetimes'][ $DTD_ID ] - $qty;
875
+				self::$_available_spaces['datetimes'][$DTD_ID] = self::$_available_spaces['datetimes'][$DTD_ID] - $qty;
876 876
 			}
877 877
 		}
878 878
 	}
@@ -889,8 +889,8 @@  discard block
 block discarded – undo
889 889
 	*/
890 890
 	public static function load_tckt_slctr_assets() {
891 891
 		// add some style
892
-		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
893
-			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css');
892
+		if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) {
893
+			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css');
894 894
 			wp_enqueue_style('ticket_selector');
895 895
 			// make it dance
896 896
 			//			wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE);
@@ -904,9 +904,9 @@  discard block
 block discarded – undo
904 904
 
905 905
 	public static function load_tckt_slctr_assets_admin() {
906 906
 		//iframe button js on admin event editor page
907
-		if ( EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit' ) {
908
-			wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true );
909
-			wp_enqueue_script( 'ticket_selector_embed' );
907
+		if (EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit') {
908
+			wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true);
909
+			wp_enqueue_script('ticket_selector_embed');
910 910
 		}
911 911
 	}
912 912
 
Please login to merge, or discard this patch.
shortcodes/espresso_txn_page/EES_Espresso_Txn_Page.shortcode.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');}
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); }
2 2
 /**
3 3
  * EES_Espresso_Txn_Page
4 4
  *
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 *  @return 	void
28 28
 	 */
29 29
 	public static function set_hooks() {
30
-		add_action( 'wp_loaded', array( 'EES_Espresso_Txn_Page', 'set_definitions' ), 2 );
30
+		add_action('wp_loaded', array('EES_Espresso_Txn_Page', 'set_definitions'), 2);
31 31
 	}
32 32
 
33 33
 	/**
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 *  @return 	void
49 49
 	 */
50 50
 	public static function set_definitions() {
51
-		define( 'TXN_PAGE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
52
-		define( 'TXN_PAGE_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
51
+		define('TXN_PAGE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
52
+		define('TXN_PAGE_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
53 53
 	}
54 54
 
55 55
 
@@ -66,21 +66,21 @@  discard block
 block discarded – undo
66 66
 	 * @throws \Exception
67 67
 	 * @throws \EE_Error
68 68
 	 */
69
-	public function run( WP $WP ) {
69
+	public function run(WP $WP) {
70 70
 		$this->_current_txn = null;
71
-		if ( EE_Registry::instance()->REQ->is_set('e_reg_url_link' )){
71
+		if (EE_Registry::instance()->REQ->is_set('e_reg_url_link')) {
72 72
 			/** @var EEM_Transaction $EEM_Transaction */
73
-			$EEM_Transaction = EE_Registry::instance()->load_model( 'Transaction' );
73
+			$EEM_Transaction = EE_Registry::instance()->load_model('Transaction');
74 74
 			$this->_current_txn = $EEM_Transaction->get_transaction_from_reg_url_link();
75 75
 		}
76
-		if ( $this->_current_txn instanceof EE_Transaction ) {
76
+		if ($this->_current_txn instanceof EE_Transaction) {
77 77
 			$payment_method = null;
78
-			$payment_method_slug = EE_Registry::instance()->REQ->get( 'ee_payment_method', null );
79
-			if( $payment_method_slug ) {
80
-				$payment_method = EEM_Payment_Method::instance()->get_one_by_slug( $payment_method_slug );
78
+			$payment_method_slug = EE_Registry::instance()->REQ->get('ee_payment_method', null);
79
+			if ($payment_method_slug) {
80
+				$payment_method = EEM_Payment_Method::instance()->get_one_by_slug($payment_method_slug);
81 81
 			}
82 82
 
83
-			if ( $payment_method instanceof EE_Payment_Method && $payment_method->is_off_site() ) {
83
+			if ($payment_method instanceof EE_Payment_Method && $payment_method->is_off_site()) {
84 84
 				$gateway = $payment_method->type_obj()->get_gateway();
85 85
 				if (
86 86
 					$gateway instanceof EE_Offsite_Gateway
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
 					)
91 91
 				) {
92 92
 					/** @type EE_Payment_Processor $payment_processor */
93
-					$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
94
-					$payment_processor->process_ipn( $_REQUEST, $this->_current_txn, $payment_method );
93
+					$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
94
+					$payment_processor->process_ipn($_REQUEST, $this->_current_txn, $payment_method);
95 95
 				}
96 96
 			}
97 97
 			//allow gateways to add a filter to stop rendering the page
98
-			if( apply_filters( 'FHEE__EES_Espresso_Txn_Page__run__exit', FALSE ) ){
98
+			if (apply_filters('FHEE__EES_Espresso_Txn_Page__run__exit', FALSE)) {
99 99
 				exit;
100 100
 			}
101 101
 		}
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 	 *  @param		array 	$attributes
113 113
 	 *  @return 	string
114 114
 	 */
115
-	public function process_shortcode( $attributes = array() ) {
116
-		return __( 'This is the Event Espresso Transactions page. This page receives instant payment notification (IPN) requests and should have a status of published, but should not be easily accessible by site visitors. Do not add it to your website\'s navigation menu or link to it from another page. Also, do not delete it or change its status to private.', 'event_espresso' );
115
+	public function process_shortcode($attributes = array()) {
116
+		return __('This is the Event Espresso Transactions page. This page receives instant payment notification (IPN) requests and should have a status of published, but should not be easily accessible by site visitors. Do not add it to your website\'s navigation menu or link to it from another page. Also, do not delete it or change its status to private.', 'event_espresso');
117 117
 	}
118 118
 
119 119
 
Please login to merge, or discard this patch.
admin_pages/events/Events_Admin_Page.core.php 1 patch
Spacing   +383 added lines, -383 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION'))
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 		$this->_cpt_edit_routes = array(
67 67
 			'espresso_events' => 'edit'
68 68
 		);
69
-		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array( $this, 'verify_event_edit' ) );
69
+		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array($this, 'verify_event_edit'));
70 70
 	}
71 71
 
72 72
 	protected function _ajax_hooks() {
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 				'edit' => __('Update Event', 'event_espresso'),
93 93
 				'add_category' => __('Save New Category', 'event_espresso'),
94 94
 				'edit_category' => __('Update Category', 'event_espresso'),
95
-				'template_settings' => __( 'Update Settings', 'event_espresso' )
95
+				'template_settings' => __('Update Settings', 'event_espresso')
96 96
 				)
97 97
 		);
98 98
 	}
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 		//load field generator helper
103 103
 
104 104
 		//is there a evt_id in the request?
105
-		$evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0;
106
-		$evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id;
105
+		$evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0;
106
+		$evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
107 107
 
108 108
 
109 109
 		$this->_page_routes = array(
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 				'help_tour' => array(
318 318
 					'Event_Editor_Help_Tour'
319 319
 					),
320
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
320
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
321 321
 				'require_nonce' => FALSE
322 322
 			),
323 323
 			'edit' => array(
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 				/*'help_tour' => array(
374 374
 					'Event_Edit_Help_Tour'
375 375
 				),*/
376
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
376
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
377 377
 				'require_nonce' => FALSE
378 378
 			),
379 379
 			'default_event_settings' => array(
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 						'filename' => 'events_default_settings_status'
396 396
 					)
397 397
 				),
398
-				'help_tour' => array( 'Event_Default_Settings_Help_Tour'),
398
+				'help_tour' => array('Event_Default_Settings_Help_Tour'),
399 399
 				'require_nonce' => FALSE
400 400
 			),
401 401
 			//template settings
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 						'filename' => 'general_settings_templates'
412 412
 					)
413 413
 				),
414
-				'help_tour' => array( 'Templates_Help_Tour' ),
414
+				'help_tour' => array('Templates_Help_Tour'),
415 415
 				'require_nonce' => FALSE
416 416
 			),
417 417
 			//event category stuff
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 					'label' => __('Edit Category', 'event_espresso'),
436 436
 					'order' => 15,
437 437
 					'persistent' => FALSE,
438
-					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
438
+					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
439 439
 					),
440 440
 				'help_tabs' => array(
441 441
 					'edit_category_help_tab' => array(
@@ -505,14 +505,14 @@  discard block
 block discarded – undo
505 505
 
506 506
 	public function load_scripts_styles() {
507 507
 
508
-		wp_register_style('events-admin-css', EVENTS_ASSETS_URL . 'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
509
-		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
508
+		wp_register_style('events-admin-css', EVENTS_ASSETS_URL.'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
509
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
510 510
 		wp_enqueue_style('events-admin-css');
511 511
 		wp_enqueue_style('ee-cat-admin');
512 512
 		//todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details
513 513
 		//registers for all views
514 514
 		//scripts
515
-		wp_register_script('event_editor_js', EVENTS_ASSETS_URL . 'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE);
515
+		wp_register_script('event_editor_js', EVENTS_ASSETS_URL.'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE);
516 516
 	}
517 517
 
518 518
 	/**
@@ -530,11 +530,11 @@  discard block
 block discarded – undo
530 530
 	public function load_scripts_styles_edit() {
531 531
 		//styles
532 532
 		wp_enqueue_style('espresso-ui-theme');
533
-		wp_register_style('event-editor-css', EVENTS_ASSETS_URL . 'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
533
+		wp_register_style('event-editor-css', EVENTS_ASSETS_URL.'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
534 534
 		wp_enqueue_style('event-editor-css');
535 535
 
536 536
 		//scripts
537
-		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL . 'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION );
537
+		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL.'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION);
538 538
 		wp_enqueue_script('event-datetime-metabox');
539 539
 
540 540
 	}
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 
570 570
 
571 571
 	public function admin_init() {
572
-		EE_Registry::$i18n_js_strings[ 'image_confirm' ] = __( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' );
572
+		EE_Registry::$i18n_js_strings['image_confirm'] = __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso');
573 573
 	}
574 574
 
575 575
 
@@ -590,12 +590,12 @@  discard block
 block discarded – undo
590 590
 	 */
591 591
 	public function verify_event_edit($event = NULL) {
592 592
 		// no event?
593
-		if ( empty( $event )) {
593
+		if (empty($event)) {
594 594
 			// set event
595 595
 			$event = $this->_cpt_model_obj;
596 596
 		}
597 597
 		// STILL no event?
598
-		if ( empty ( $event )) {
598
+		if (empty ($event)) {
599 599
 			return;
600 600
 		}
601 601
 		$orig_status = $event->status();
@@ -609,27 +609,27 @@  discard block
 block discarded – undo
609 609
 			return;
610 610
 		}
611 611
 		//made it here so it IS active... next check that any of the tickets are sold.
612
-		if ( $event->is_sold_out( true ) ) {
613
-			if ( $orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status ) {
612
+		if ($event->is_sold_out(true)) {
613
+			if ($orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status) {
614 614
 				EE_Error::add_attention(
615 615
 					sprintf(
616
-						__( 'Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You can change the status back to something else before updating if you wish.', 'event_espresso' ),
617
-						EEH_Template::pretty_status( EEM_Event::sold_out, FALSE, 'sentence' )
616
+						__('Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You can change the status back to something else before updating if you wish.', 'event_espresso'),
617
+						EEH_Template::pretty_status(EEM_Event::sold_out, FALSE, 'sentence')
618 618
 					)
619 619
 				);
620 620
 			}
621 621
 			return;
622
-		} else if ( $orig_status === EEM_Event::sold_out ) {
622
+		} else if ($orig_status === EEM_Event::sold_out) {
623 623
 			EE_Error::add_attention(
624 624
 				sprintf(
625
-					__( 'Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets.  However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.',
626
-						'event_espresso' ),
627
-					EEH_Template::pretty_status( $event->status(), false, 'sentence' )
625
+					__('Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets.  However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.',
626
+						'event_espresso'),
627
+					EEH_Template::pretty_status($event->status(), false, 'sentence')
628 628
 				)
629 629
 			);
630 630
 		}
631 631
 		//now we need to determine if the event has any tickets on sale.  If not then we dont' show the error
632
-		if ( ! $event->tickets_on_sale() ) {
632
+		if ( ! $event->tickets_on_sale()) {
633 633
 			return;
634 634
 		}
635 635
 		//made it here so show warning
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 	 */
649 649
 	protected function _edit_event_warning() {
650 650
 		// we don't want to add warnings during these requests
651
-		if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] === 'editpost' ) {
651
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] === 'editpost') {
652 652
 			return;
653 653
 		}
654 654
 		EE_Error::add_attention(
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 			),
680 680
 		);
681 681
 
682
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) {
682
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) {
683 683
 			$this->_views['trash'] = array(
684 684
 				'slug' => 'trash',
685 685
 				'label' => __('Trash', 'event_espresso'),
@@ -709,39 +709,39 @@  discard block
 block discarded – undo
709 709
 				'desc' => __('View Registrations for Event', 'event_espresso')
710 710
 			)
711 711
 		);
712
-		$items  = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items );
712
+		$items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items);
713 713
 		$statuses = array(
714 714
 			'sold_out_status' => array(
715
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out,
716
-				'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, FALSE, 'sentence' )
715
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out,
716
+				'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, FALSE, 'sentence')
717 717
 			),
718 718
 			'active_status' => array(
719
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active,
720
-				'desc' => EEH_Template::pretty_status( EE_Datetime::active, FALSE, 'sentence' )
719
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active,
720
+				'desc' => EEH_Template::pretty_status(EE_Datetime::active, FALSE, 'sentence')
721 721
 			),
722 722
 			'upcoming_status' => array(
723
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming,
724
-				'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, FALSE, 'sentence' )
723
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming,
724
+				'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, FALSE, 'sentence')
725 725
 			),
726 726
 			'postponed_status' => array(
727
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed,
728
-				'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, FALSE, 'sentence' )
727
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed,
728
+				'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, FALSE, 'sentence')
729 729
 			),
730 730
 			'cancelled_status' => array(
731
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled,
732
-				'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, FALSE, 'sentence' )
731
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled,
732
+				'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, FALSE, 'sentence')
733 733
 			),
734 734
 			'expired_status' => array(
735
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired,
736
-				'desc' => EEH_Template::pretty_status( EE_Datetime::expired, FALSE, 'sentence' )
735
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired,
736
+				'desc' => EEH_Template::pretty_status(EE_Datetime::expired, FALSE, 'sentence')
737 737
 			),
738 738
 			'inactive_status' => array(
739
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive,
740
-				'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, FALSE, 'sentence' )
739
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive,
740
+				'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, FALSE, 'sentence')
741 741
 			)
742 742
 		);
743
-		$statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses );
744
-		return array_merge( $items, $statuses );
743
+		$statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses);
744
+		return array_merge($items, $statuses);
745 745
 	}
746 746
 
747 747
 
@@ -753,8 +753,8 @@  discard block
 block discarded – undo
753 753
 	 * @return EEM_Event
754 754
 	 */
755 755
 	private function _event_model() {
756
-		if ( ! $this->_event_model instanceof EEM_Event ) {
757
-			$this->_event_model = EE_Registry::instance()->load_model( 'Event' );
756
+		if ( ! $this->_event_model instanceof EEM_Event) {
757
+			$this->_event_model = EE_Registry::instance()->load_model('Event');
758 758
 		}
759 759
 		return $this->_event_model;
760 760
 	}
@@ -773,12 +773,12 @@  discard block
 block discarded – undo
773 773
 	 * @param  string $new_slug  what the slug is
774 774
 	 * @return string            The new html string for the permalink area
775 775
 	 */
776
-	public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) {
776
+	public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) {
777 777
 		//make sure this is only when editing
778
-		if ( !empty( $id ) ) {
779
-			$post = get_post( $id );
780
-			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">' . __('Shortcode', 'event_espresso') . '</a> ';
781
-			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=' . $post->ID . ']">';
778
+		if ( ! empty($id)) {
779
+			$post = get_post($id);
780
+			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">'.__('Shortcode', 'event_espresso').'</a> ';
781
+			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id='.$post->ID.']">';
782 782
 		}
783 783
 		return $return;
784 784
 	}
@@ -794,8 +794,8 @@  discard block
 block discarded – undo
794 794
 	 * @return string html for generated table
795 795
 	 */
796 796
 	protected function _events_overview_list_table() {
797
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
798
-		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button' ) .
797
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
798
+		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button').
799 799
 		$this->_display_legend($this->_event_legend_items());
800 800
 		$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2');
801 801
 		$this->display_admin_list_table_page_with_no_sidebar();
@@ -813,51 +813,51 @@  discard block
 block discarded – undo
813 813
 
814 814
 
815 815
 
816
-	protected function _insert_update_cpt_item( $post_id, $post ) {
816
+	protected function _insert_update_cpt_item($post_id, $post) {
817 817
 
818
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) {
818
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') {
819 819
 			//getout we're not processing an event save.
820 820
 			return;
821 821
 		}
822 822
 
823 823
 		$event_values = array(
824
-			'EVT_display_desc' => !empty( $this->_req_data['display_desc'] ) ? 1 : 0,
825
-			'EVT_display_ticket_selector' => !empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0,
824
+			'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0,
825
+			'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0,
826 826
 			'EVT_additional_limit' => min(
827
-					apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ),
828
-					!empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : NULL ),
829
-			'EVT_default_registration_status' => !empty( $this->_req_data['EVT_default_registration_status'] ) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID,
830
-			'EVT_member_only' => !empty( $this->_req_data['member_only'] ) ? 1 : 0,
831
-			'EVT_allow_overflow' => !empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0,
832
-			'EVT_timezone_string' => !empty( $this->_req_data['timezone_string'] ) ? $this->_req_data['timezone_string'] : NULL,
833
-			'EVT_external_URL' => !empty( $this->_req_data['externalURL'] ) ? $this->_req_data['externalURL'] : NULL,
834
-			'EVT_phone' => !empty( $this->_req_data['event_phone'] ) ? $this->_req_data['event_phone'] : NULL
827
+					apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255),
828
+					! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : NULL ),
829
+			'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status']) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID,
830
+			'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0,
831
+			'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0,
832
+			'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) ? $this->_req_data['timezone_string'] : NULL,
833
+			'EVT_external_URL' => ! empty($this->_req_data['externalURL']) ? $this->_req_data['externalURL'] : NULL,
834
+			'EVT_phone' => ! empty($this->_req_data['event_phone']) ? $this->_req_data['event_phone'] : NULL
835 835
 			);
836 836
 
837 837
 		//update event
838
-		$success = $this->_event_model()->update_by_ID( $event_values, $post_id );
838
+		$success = $this->_event_model()->update_by_ID($event_values, $post_id);
839 839
 
840 840
 
841 841
 		//get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id!
842
-		$get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status );
843
-		$event = $this->_event_model()->get_one( array($get_one_where) );
842
+		$get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status);
843
+		$event = $this->_event_model()->get_one(array($get_one_where));
844 844
 
845 845
 
846 846
 		//the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons.
847
-		$event_update_callbacks = apply_filters( 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( array($this, '_default_venue_update' ), array( $this, '_default_tickets_update') ) );
847
+		$event_update_callbacks = apply_filters('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array(array($this, '_default_venue_update'), array($this, '_default_tickets_update')));
848 848
 
849 849
 		$att_success = TRUE;
850 850
 
851
-		foreach ( $event_update_callbacks as $e_callback ) {
852
-			$_succ = call_user_func_array( $e_callback, array( $event,  $this->_req_data ) );
853
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
851
+		foreach ($event_update_callbacks as $e_callback) {
852
+			$_succ = call_user_func_array($e_callback, array($event, $this->_req_data));
853
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
854 854
 		}
855 855
 
856 856
 		//any errors?
857
-		if ( $success && FALSE === $att_success ) {
858
-			EE_Error::add_error( __('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
859
-		} else if ( $success === FALSE ) {
860
-			EE_Error::add_error( __('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
857
+		if ($success && FALSE === $att_success) {
858
+			EE_Error::add_error(__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
859
+		} else if ($success === FALSE) {
860
+			EE_Error::add_error(__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
861 861
 		}
862 862
 	}
863 863
 
@@ -867,14 +867,14 @@  discard block
 block discarded – undo
867 867
 	/**
868 868
 	 * @see parent::restore_item()
869 869
 	 */
870
-	protected function _restore_cpt_item( $post_id, $revision_id ) {
870
+	protected function _restore_cpt_item($post_id, $revision_id) {
871 871
 		//copy existing event meta to new post
872 872
 		$post_evt = $this->_event_model()->get_one_by_ID($post_id);
873
-		if ( $post_evt instanceof EE_Event ) {
873
+		if ($post_evt instanceof EE_Event) {
874 874
 			//meta revision restore
875
-			$post_evt->restore_revision( $revision_id );
875
+			$post_evt->restore_revision($revision_id);
876 876
 			//related objs restore
877
-			$post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) );
877
+			$post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price'));
878 878
 		}
879 879
 	}
880 880
 
@@ -887,52 +887,52 @@  discard block
 block discarded – undo
887 887
 	 * @param  array  $data   The request data from the form
888 888
 	 * @return bool           Success or fail.
889 889
 	 */
890
-	protected function _default_venue_update( $evtobj, $data ) {
891
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
890
+	protected function _default_venue_update($evtobj, $data) {
891
+		require_once(EE_MODELS.'EEM_Venue.model.php');
892 892
 		$venue_model = EE_Registry::instance()->load_model('Venue');
893 893
 		$rows_affected = NULL;
894
-		$venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL;
894
+		$venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : NULL;
895 895
 
896 896
 		// very important.  If we don't have a venue name...
897 897
 		// then we'll get out because not necessary to create empty venue
898
-		if ( empty( $data['venue_title'] ) ) {
898
+		if (empty($data['venue_title'])) {
899 899
 			return false;
900 900
 		}
901 901
 
902 902
 		$venue_array = array(
903 903
 				'VNU_wp_user' => $evtobj->get('EVT_wp_user'),
904
-				'VNU_name' => !empty( $data['venue_title'] ) ? $data['venue_title'] : NULL,
905
-				'VNU_desc' => !empty( $data['venue_description'] ) ? $data['venue_description'] : NULL,
906
-				'VNU_identifier' => !empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : NULL,
907
-				'VNU_short_desc' => !empty( $data['venue_short_description'] ) ? $data['venue_short_description'] : NULL,
908
-				'VNU_address' => !empty( $data['address'] ) ? $data['address'] : NULL,
909
-				'VNU_address2' => !empty( $data['address2'] ) ? $data['address2'] : NULL,
910
-				'VNU_city' => !empty( $data['city'] ) ? $data['city'] : NULL,
911
-				'STA_ID' => !empty( $data['state'] ) ? $data['state'] : NULL,
912
-				'CNT_ISO' => !empty( $data['countries'] ) ? $data['countries'] : NULL,
913
-				'VNU_zip' => !empty( $data['zip'] ) ? $data['zip'] : NULL,
914
-				'VNU_phone' => !empty( $data['venue_phone'] ) ? $data['venue_phone'] : NULL,
915
-				'VNU_capacity' => !empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : NULL,
916
-				'VNU_url' => !empty($data['venue_url'] ) ? $data['venue_url'] : NULL,
917
-				'VNU_virtual_phone' => !empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
918
-				'VNU_virtual_url' => !empty( $data['virtual_url'] ) ? $data['virtual_url'] : NULL,
919
-				'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0,
904
+				'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : NULL,
905
+				'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : NULL,
906
+				'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : NULL,
907
+				'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] : NULL,
908
+				'VNU_address' => ! empty($data['address']) ? $data['address'] : NULL,
909
+				'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : NULL,
910
+				'VNU_city' => ! empty($data['city']) ? $data['city'] : NULL,
911
+				'STA_ID' => ! empty($data['state']) ? $data['state'] : NULL,
912
+				'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : NULL,
913
+				'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : NULL,
914
+				'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : NULL,
915
+				'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : NULL,
916
+				'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : NULL,
917
+				'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
918
+				'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : NULL,
919
+				'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0,
920 920
 				'status' => 'publish'
921 921
 			);
922 922
 
923 923
 
924 924
 		//if we've got the venue_id then we're just updating the existing venue so let's do that and then get out.
925
-		if ( !empty( $venue_id ) ) {
926
-			$update_where = array( $venue_model->primary_key_name() => $venue_id );
927
-			$rows_affected = $venue_model->update( $venue_array, array( $update_where ) );
925
+		if ( ! empty($venue_id)) {
926
+			$update_where = array($venue_model->primary_key_name() => $venue_id);
927
+			$rows_affected = $venue_model->update($venue_array, array($update_where));
928 928
 			//we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present.
929
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
929
+			$evtobj->_add_relation_to($venue_id, 'Venue');
930 930
 			return $rows_affected > 0 ? TRUE : FALSE;
931 931
 		} else {
932 932
 			//we insert the venue
933
-			$venue_id = $venue_model->insert( $venue_array );
934
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
935
-			return !empty( $venue_id ) ? TRUE : FALSE;
933
+			$venue_id = $venue_model->insert($venue_array);
934
+			$evtobj->_add_relation_to($venue_id, 'Venue');
935
+			return ! empty($venue_id) ? TRUE : FALSE;
936 936
 		}
937 937
 		//when we have the ancestor come in it's already been handled by the revision save.
938 938
 	}
@@ -946,54 +946,54 @@  discard block
 block discarded – undo
946 946
 	 * @param  array    $data   The request data from the form
947 947
 	 * @return bool             success or fail
948 948
 	 */
949
-	protected function _default_tickets_update( EE_Event $evtobj, $data ) {
949
+	protected function _default_tickets_update(EE_Event $evtobj, $data) {
950 950
 		$success = true;
951 951
 		$saved_dtt = null;
952 952
 		$saved_tickets = array();
953
-		$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
953
+		$incoming_date_formats = array('Y-m-d', 'h:i a');
954 954
 
955
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
955
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
956 956
 			//trim all values to ensure any excess whitespace is removed.
957
-			$dtt =  array_map( 'trim', $dtt );
958
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
957
+			$dtt = array_map('trim', $dtt);
958
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
959 959
 			$datetime_values = array(
960
-				'DTT_ID' 		=> ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
960
+				'DTT_ID' 		=> ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
961 961
 				'DTT_EVT_start' => $dtt['DTT_EVT_start'],
962 962
 				'DTT_EVT_end' 	=> $dtt['DTT_EVT_end'],
963
-				'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'],
963
+				'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
964 964
 				'DTT_order' 	=> $row,
965 965
 			);
966 966
 
967 967
 			//if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
968 968
 
969
-			if ( !empty( $dtt['DTT_ID'] ) ) {
970
-				$DTM = EE_Registry::instance()->load_model('Datetime', array( $evtobj->get_timezone() ) )->get_one_by_ID($dtt['DTT_ID'] );
971
-				$DTM->set_date_format( $incoming_date_formats[0] );
972
-				$DTM->set_time_format( $incoming_date_formats[1] );
973
-				foreach ( $datetime_values as $field => $value ) {
974
-					$DTM->set( $field, $value );
969
+			if ( ! empty($dtt['DTT_ID'])) {
970
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($evtobj->get_timezone()))->get_one_by_ID($dtt['DTT_ID']);
971
+				$DTM->set_date_format($incoming_date_formats[0]);
972
+				$DTM->set_time_format($incoming_date_formats[1]);
973
+				foreach ($datetime_values as $field => $value) {
974
+					$DTM->set($field, $value);
975 975
 				}
976 976
 
977 977
 				//make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.  We need to do this so we dont' TRASH the parent DTT.
978 978
 				$saved_dtts[$DTM->ID()] = $DTM;
979 979
 			} else {
980
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values ), FALSE, FALSE );
981
-				$DTM->set_date_format( $incoming_date_formats[0] );
982
-				$DTM->set_time_format( $incoming_date_formats[1] );
983
-				$DTM->set_timezone( $evtobj->get_timezone() );
984
-				foreach ( $datetime_values as $field => $value ) {
985
-					$DTM->set( $field, $value );
980
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), FALSE, FALSE);
981
+				$DTM->set_date_format($incoming_date_formats[0]);
982
+				$DTM->set_time_format($incoming_date_formats[1]);
983
+				$DTM->set_timezone($evtobj->get_timezone());
984
+				foreach ($datetime_values as $field => $value) {
985
+					$DTM->set($field, $value);
986 986
 				}
987 987
 			}
988 988
 			$DTM->save();
989 989
 
990
-			$DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' );
990
+			$DTT = $evtobj->_add_relation_to($DTM, 'Datetime');
991 991
 
992 992
 			//load DTT helper
993 993
 
994 994
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
995
-			if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) {
996
-				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') );
995
+			if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) {
996
+				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start'));
997 997
 				$DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days');
998 998
 				$DTT->save();
999 999
 			}
@@ -1001,45 +1001,45 @@  discard block
 block discarded – undo
1001 1001
 			//now we got to make sure we add the new DTT_ID to the $saved_dtts array  because it is possible there was a new one created for the autosave.
1002 1002
 			$saved_dtt = $DTT;
1003 1003
 
1004
-			$success = !$success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
1004
+			$success = ! $success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
1005 1005
 		}
1006 1006
 
1007 1007
 		//no dtts get deleted so we don't do any of that logic here.
1008 1008
 		//update tickets next
1009
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
1010
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
1011
-			$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
1009
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
1010
+		foreach ($data['edit_tickets'] as $row => $tkt) {
1011
+			$incoming_date_formats = array('Y-m-d', 'h:i a');
1012 1012
 			$update_prices = false;
1013
-			$ticket_price = isset( $data['edit_prices'][$row][1]['PRC_amount'] ) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1013
+			$ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1014 1014
 
1015 1015
 			// trim inputs to ensure any excess whitespace is removed.
1016
-			$tkt = array_map( 'trim', $tkt );
1016
+			$tkt = array_map('trim', $tkt);
1017 1017
 
1018
-			if ( empty( $tkt['TKT_start_date'] ) ) {
1018
+			if (empty($tkt['TKT_start_date'])) {
1019 1019
 				//let's use now in the set timezone.
1020
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
1021
-				$tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] );
1020
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
1021
+				$tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]);
1022 1022
 			}
1023 1023
 
1024
-			if ( empty( $tkt['TKT_end_date'] ) ) {
1024
+			if (empty($tkt['TKT_end_date'])) {
1025 1025
 				//use the start date of the first datetime
1026 1026
 				$dtt = $evtobj->first_datetime();
1027
-				$tkt['TKT_end_date'] = $dtt->start_date_and_time( $incoming_date_formats[0], $incoming_date_formats[1] );
1027
+				$tkt['TKT_end_date'] = $dtt->start_date_and_time($incoming_date_formats[0], $incoming_date_formats[1]);
1028 1028
 			}
1029 1029
 
1030 1030
 			$TKT_values = array(
1031
-				'TKT_ID' 			=> !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
1032
-				'TTM_ID' 			=> !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
1033
-				'TKT_name' 			=> !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
1034
-				'TKT_description' 	=> !empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '',
1031
+				'TKT_ID' 			=> ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
1032
+				'TTM_ID' 			=> ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
1033
+				'TKT_name' 			=> ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
1034
+				'TKT_description' 	=> ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '',
1035 1035
 				'TKT_start_date' 	=> $tkt['TKT_start_date'],
1036 1036
 				'TKT_end_date' 		=> $tkt['TKT_end_date'],
1037
-				'TKT_qty' 			=> ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt['TKT_qty'],
1038
-				'TKT_uses' 			=> ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt[ 'TKT_uses' ],
1039
-				'TKT_min' 			=> empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
1040
-				'TKT_max' 			=> empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'],
1037
+				'TKT_qty' 			=> ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
1038
+				'TKT_uses' 			=> ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
1039
+				'TKT_min' 			=> empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
1040
+				'TKT_max' 			=> empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
1041 1041
 				'TKT_row' 			=> $row,
1042
-				'TKT_order' 		=> isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row,
1042
+				'TKT_order' 		=> isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row,
1043 1043
 				'TKT_price' 		=> $ticket_price
1044 1044
 			);
1045 1045
 
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
 
1048 1048
 
1049 1049
 			//if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well.
1050
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
1050
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
1051 1051
 				$TKT_values['TKT_ID'] = 0;
1052 1052
 				$TKT_values['TKT_is_default'] = 0;
1053 1053
 				$TKT_values['TKT_price'] = $ticket_price;
@@ -1058,58 +1058,58 @@  discard block
 block discarded – undo
1058 1058
 			//we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified.
1059 1059
 			//keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
1060 1060
 
1061
-			if ( !empty( $tkt['TKT_ID'] ) ) {
1062
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $evtobj->get_timezone() ) )->get_one_by_ID( $tkt['TKT_ID'] );
1063
-				if ( $TKT instanceof EE_Ticket ) {
1064
-					$ticket_sold = $TKT->count_related( 'Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false;
1061
+			if ( ! empty($tkt['TKT_ID'])) {
1062
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($evtobj->get_timezone()))->get_one_by_ID($tkt['TKT_ID']);
1063
+				if ($TKT instanceof EE_Ticket) {
1064
+					$ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false;
1065 1065
 					//let's just check the total price for the existing ticket and determine if it matches the new total price.  if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket.
1066
-					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) && ! $TKT->get( 'TKT_deleted' ) ? true : false;
1067
-					$TKT->set_date_format( $incoming_date_formats[ 0 ] );
1068
-					$TKT->set_time_format( $incoming_date_formats[ 1 ] );
1066
+					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && ! $TKT->get('TKT_deleted') ? true : false;
1067
+					$TKT->set_date_format($incoming_date_formats[0]);
1068
+					$TKT->set_time_format($incoming_date_formats[1]);
1069 1069
 					//set new values
1070
-					foreach ( $TKT_values as $field => $value ) {
1071
-						if ( $field == 'TKT_qty' ) {
1072
-							$TKT->set_qty( $value );
1070
+					foreach ($TKT_values as $field => $value) {
1071
+						if ($field == 'TKT_qty') {
1072
+							$TKT->set_qty($value);
1073 1073
 						} else {
1074
-							$TKT->set( $field, $value );
1074
+							$TKT->set($field, $value);
1075 1075
 						}
1076 1076
 					}
1077 1077
 					//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
1078
-					if ( $create_new_TKT ) {
1078
+					if ($create_new_TKT) {
1079 1079
 						//archive the old ticket first
1080
-						$TKT->set( 'TKT_deleted', 1 );
1080
+						$TKT->set('TKT_deleted', 1);
1081 1081
 						$TKT->save();
1082 1082
 						//make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine.
1083
-						$saved_tickets[ $TKT->ID() ] = $TKT;
1083
+						$saved_tickets[$TKT->ID()] = $TKT;
1084 1084
 						//create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it.
1085 1085
 						$TKT = clone $TKT;
1086
-						$TKT->set( 'TKT_ID', 0 );
1087
-						$TKT->set( 'TKT_deleted', 0 );
1088
-						$TKT->set( 'TKT_price', $ticket_price );
1089
-						$TKT->set( 'TKT_sold', 0 );
1086
+						$TKT->set('TKT_ID', 0);
1087
+						$TKT->set('TKT_deleted', 0);
1088
+						$TKT->set('TKT_price', $ticket_price);
1089
+						$TKT->set('TKT_sold', 0);
1090 1090
 						//now we need to make sure that $new prices are created as well and attached to new ticket.
1091 1091
 						$update_prices = true;
1092 1092
 					}
1093 1093
 					//make sure price is set if it hasn't been already
1094
-					$TKT->set( 'TKT_price', $ticket_price );
1094
+					$TKT->set('TKT_price', $ticket_price);
1095 1095
 				}
1096 1096
 
1097 1097
 			} else {
1098 1098
 				//no TKT_id so a new TKT
1099 1099
 				$TKT_values['TKT_price'] = $ticket_price;
1100
-				$TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values ), FALSE, FALSE );
1101
-				if ( $TKT instanceof EE_Ticket ) {
1100
+				$TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), FALSE, FALSE);
1101
+				if ($TKT instanceof EE_Ticket) {
1102 1102
 					//need to reset values to properly account for the date formats
1103
-					$TKT->set_date_format( $incoming_date_formats[0] );
1104
-					$TKT->set_time_format( $incoming_date_formats[1] );
1105
-					$TKT->set_timezone( $evtobj->get_timezone() );
1103
+					$TKT->set_date_format($incoming_date_formats[0]);
1104
+					$TKT->set_time_format($incoming_date_formats[1]);
1105
+					$TKT->set_timezone($evtobj->get_timezone());
1106 1106
 
1107 1107
 					//set new values
1108
-					foreach ( $TKT_values as $field => $value ) {
1109
-						if ( $field == 'TKT_qty' ) {
1110
-							$TKT->set_qty( $value );
1108
+					foreach ($TKT_values as $field => $value) {
1109
+						if ($field == 'TKT_qty') {
1110
+							$TKT->set_qty($value);
1111 1111
 						} else {
1112
-							$TKT->set( $field, $value );
1112
+							$TKT->set($field, $value);
1113 1113
 						}
1114 1114
 					}
1115 1115
 
@@ -1117,31 +1117,31 @@  discard block
 block discarded – undo
1117 1117
 				}
1118 1118
 			}
1119 1119
 			// cap ticket qty by datetime reg limits
1120
-			$TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) );
1120
+			$TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit')));
1121 1121
 			//update ticket.
1122 1122
 			$TKT->save();
1123 1123
 
1124 1124
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
1125
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
1126
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
1125
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
1126
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
1127 1127
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
1128 1128
 				$TKT->save();
1129 1129
 			}
1130 1130
 
1131 1131
 			//initially let's add the ticket to the dtt
1132
-			$saved_dtt->_add_relation_to( $TKT, 'Ticket' );
1132
+			$saved_dtt->_add_relation_to($TKT, 'Ticket');
1133 1133
 
1134 1134
 			$saved_tickets[$TKT->ID()] = $TKT;
1135 1135
 
1136 1136
 			//add prices to ticket
1137
-			$this->_add_prices_to_ticket( $data['edit_prices'][$row], $TKT, $update_prices );
1137
+			$this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices);
1138 1138
 		}
1139 1139
 		//however now we need to handle permanently deleting tickets via the ui.  Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold.  However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanently because there is no need to save in db.
1140
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
1141
-		$tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) );
1140
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
1141
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
1142 1142
 
1143
-		foreach ( $tickets_removed as $id ) {
1144
-			$id = absint( $id );
1143
+		foreach ($tickets_removed as $id) {
1144
+			$id = absint($id);
1145 1145
 
1146 1146
 			//get the ticket for this id
1147 1147
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
 			//need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold)
1150 1150
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
1151 1151
 
1152
-			foreach( $dtts as $dtt ) {
1152
+			foreach ($dtts as $dtt) {
1153 1153
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
1154 1154
 			}
1155 1155
 
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
 			//finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships)
1161 1161
 			$tkt_to_remove->delete_permanently();
1162 1162
 		}
1163
-		return array( $saved_dtt, $saved_tickets );
1163
+		return array($saved_dtt, $saved_tickets);
1164 1164
 	}
1165 1165
 
1166 1166
 
@@ -1175,31 +1175,31 @@  discard block
 block discarded – undo
1175 1175
 	 * @param bool 		$new_prices Whether attach existing incoming prices or create new ones.
1176 1176
 	 * @return  void
1177 1177
 	 */
1178
-	private function  _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = FALSE ) {
1179
-		foreach ( $prices as $row => $prc ) {
1178
+	private function  _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = FALSE) {
1179
+		foreach ($prices as $row => $prc) {
1180 1180
 			$PRC_values = array(
1181
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
1182
-				'PRT_ID' => !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL,
1183
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
1184
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
1185
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
1181
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
1182
+				'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL,
1183
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
1184
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
1185
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
1186 1186
 				'PRC_is_default' => 0, //make sure prices are NOT set as default from this context
1187 1187
 				'PRC_order' => $row
1188 1188
 			);
1189 1189
 
1190
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
1190
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
1191 1191
 				$PRC_values['PRC_ID'] = 0;
1192
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
1192
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
1193 1193
 			} else {
1194
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
1194
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
1195 1195
 				//update this price with new values
1196
-				foreach ( $PRC_values as $field => $newprc ) {
1197
-					$PRC->set( $field, $newprc );
1196
+				foreach ($PRC_values as $field => $newprc) {
1197
+					$PRC->set($field, $newprc);
1198 1198
 				}
1199 1199
 				$PRC->save();
1200 1200
 			}
1201 1201
 
1202
-			$ticket->_add_relation_to( $PRC, 'Price' );
1202
+			$ticket->_add_relation_to($PRC, 'Price');
1203 1203
 		}
1204 1204
 	}
1205 1205
 
@@ -1237,9 +1237,9 @@  discard block
 block discarded – undo
1237 1237
 		//load formatter helper
1238 1238
 
1239 1239
   		//args for getting related registrations
1240
-  		$approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) );
1241
-  		$not_approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved ) );
1242
-  		$pending_payment_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment ) );
1240
+  		$approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved));
1241
+  		$not_approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved));
1242
+  		$pending_payment_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment));
1243 1243
 
1244 1244
 
1245 1245
 		// publish box
@@ -1268,9 +1268,9 @@  discard block
 block discarded – undo
1268 1268
 				),
1269 1269
 				REG_ADMIN_URL
1270 1270
 			),
1271
-			'approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $approved_query_args ),
1272
-			'not_approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $not_approved_query_args ),
1273
-			'pending_payment_regs' => $this->_cpt_model_obj->count_related( 'Registration', $pending_payment_query_args ),
1271
+			'approved_regs' => $this->_cpt_model_obj->count_related('Registration', $approved_query_args),
1272
+			'not_approved_regs' => $this->_cpt_model_obj->count_related('Registration', $not_approved_query_args),
1273
+			'pending_payment_regs' => $this->_cpt_model_obj->count_related('Registration', $pending_payment_query_args),
1274 1274
 			'misc_pub_section_class' => apply_filters(
1275 1275
 				'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class',
1276 1276
 				'misc-pub-section'
@@ -1289,9 +1289,9 @@  discard block
 block discarded – undo
1289 1289
 			'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add',
1290 1290
 			$this->_cpt_model_obj
1291 1291
 		);
1292
-		$publish_box_extra_args[ 'event_editor_overview_add' ] = ob_get_clean();
1292
+		$publish_box_extra_args['event_editor_overview_add'] = ob_get_clean();
1293 1293
 		// load template
1294
-		EEH_Template::display_template( EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', $publish_box_extra_args );
1294
+		EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', $publish_box_extra_args);
1295 1295
 	}
1296 1296
 
1297 1297
 
@@ -1323,16 +1323,16 @@  discard block
 block discarded – undo
1323 1323
 		$this->verify_cpt_object();
1324 1324
 		add_meta_box(
1325 1325
 			'espresso_event_editor_tickets',
1326
-			__( 'Event Datetime & Ticket', 'event_espresso' ),
1327
-			array( $this, 'ticket_metabox' ),
1326
+			__('Event Datetime & Ticket', 'event_espresso'),
1327
+			array($this, 'ticket_metabox'),
1328 1328
 			$this->page_slug,
1329 1329
 			'normal',
1330 1330
 			'high'
1331 1331
 		);
1332 1332
 		add_meta_box(
1333 1333
 			'espresso_event_editor_event_options',
1334
-			__( 'Event Registration Options', 'event_espresso' ),
1335
-			array( $this, 'registration_options_meta_box' ),
1334
+			__('Event Registration Options', 'event_espresso'),
1335
+			array($this, 'registration_options_meta_box'),
1336 1336
 			$this->page_slug,
1337 1337
 			'side',
1338 1338
 			'default'
@@ -1362,36 +1362,36 @@  discard block
 block discarded – undo
1362 1362
 			'disabled' => ''
1363 1363
 			);
1364 1364
 
1365
-		$event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : NULL;
1365
+		$event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : NULL;
1366 1366
 
1367
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1367
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1368 1368
 
1369 1369
 		/**
1370 1370
 		 * 1. Start with retrieving Datetimes
1371 1371
 		 * 2. Fore each datetime get related tickets
1372 1372
 		 * 3. For each ticket get related prices
1373 1373
 		 */
1374
-		$times = EE_Registry::instance()->load_model('Datetime' )->get_all_event_dates( $event_id );
1374
+		$times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id);
1375 1375
 		/** @type EE_Datetime $first_datetime */
1376
-		$first_datetime = reset( $times );
1376
+		$first_datetime = reset($times);
1377 1377
 		//do we get related tickets?
1378
-		if ( $first_datetime instanceof EE_Datetime
1379
-			&& $first_datetime->ID() !== 0 ) {
1378
+		if ($first_datetime instanceof EE_Datetime
1379
+			&& $first_datetime->ID() !== 0) {
1380 1380
 			$existing_datetime_ids[] = $first_datetime->get('DTT_ID');
1381 1381
 			$template_args['time'] = $first_datetime;
1382 1382
 			$related_tickets = $first_datetime->tickets(
1383 1383
 				array(
1384
-					array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ),
1384
+					array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)),
1385 1385
 					'default_where_conditions' => 'none'
1386 1386
 				)
1387 1387
 			);
1388 1388
 
1389
-			if ( !empty($related_tickets) ) {
1389
+			if ( ! empty($related_tickets)) {
1390 1390
 				$template_args['total_ticket_rows'] = count($related_tickets);
1391 1391
 				$row = 0;
1392
-				foreach ( $related_tickets as $ticket ) {
1392
+				foreach ($related_tickets as $ticket) {
1393 1393
 					$existing_ticket_ids[] = $ticket->get('TKT_ID');
1394
-					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row );
1394
+					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row);
1395 1395
 
1396 1396
 					$row++;
1397 1397
 				}
@@ -1399,13 +1399,13 @@  discard block
 block discarded – undo
1399 1399
 				$template_args['total_ticket_rows'] = 1;
1400 1400
 				/** @type EE_Ticket $ticket */
1401 1401
 				$ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object();
1402
-				$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket );
1402
+				$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket);
1403 1403
 			}
1404 1404
 		} else {
1405 1405
 			$template_args['time'] = $times[0];
1406 1406
 			/** @type EE_Ticket $ticket */
1407 1407
 			$ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
1408
-			$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] );
1408
+			$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]);
1409 1409
 			// NOTE: we're just sending the first default row
1410 1410
 			// (decaf can't manage default tickets so this should be sufficient);
1411 1411
 		}
@@ -1414,8 +1414,8 @@  discard block
 block discarded – undo
1414 1414
 		$template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info');
1415 1415
 		$template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
1416 1416
 		$template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
1417
-		$template_args['ticket_js_structure'] = $this->_get_ticket_row( EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE );
1418
-		$template = apply_filters( 'FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' );
1417
+		$template_args['ticket_js_structure'] = $this->_get_ticket_row(EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE);
1418
+		$template = apply_filters('FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php');
1419 1419
 		EEH_Template::display_template($template, $template_args);
1420 1420
 	}
1421 1421
 
@@ -1430,21 +1430,21 @@  discard block
 block discarded – undo
1430 1430
 	 * @param int        $row
1431 1431
 	 * @return string generated html for the ticket row.
1432 1432
 	 */
1433
-	private function _get_ticket_row( $ticket, $skeleton = FALSE, $row = 0 ) {
1433
+	private function _get_ticket_row($ticket, $skeleton = FALSE, $row = 0) {
1434 1434
 		$template_args = array(
1435
-			'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(),
1436
-			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && !$skeleton ? ' tkt-archived' : '',
1435
+			'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(),
1436
+			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' : '',
1437 1437
 			'ticketrow' => $skeleton ? 'TICKETNUM' : $row,
1438 1438
 			'TKT_ID' => $ticket->get('TKT_ID'),
1439 1439
 			'TKT_name' => $ticket->get('TKT_name'),
1440 1440
 			'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'),
1441 1441
 			'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'),
1442 1442
 			'TKT_is_default' => $ticket->get('TKT_is_default'),
1443
-			'TKT_qty' => $ticket->get_pretty('TKT_qty','input'),
1443
+			'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'),
1444 1444
 			'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets',
1445 1445
 			'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'),
1446
-			'trash_icon' => ( $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted') ) ) && ( !empty( $ticket ) && $ticket->get('TKT_sold') === 0 ) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1447
-			'disabled' => $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted' ) ) ? '' : ' disabled=disabled'
1446
+			'trash_icon' => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted'))) && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1447
+			'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' : ' disabled=disabled'
1448 1448
 			);
1449 1449
 
1450 1450
 		$price = $ticket->ID() !== 0 ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) : EE_Registry::instance()->load_model('Price')->create_default_object();
@@ -1460,23 +1460,23 @@  discard block
 block discarded – undo
1460 1460
 
1461 1461
 		//make sure we have default start and end dates if skeleton
1462 1462
 		//handle rows that should NOT be empty
1463
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1463
+		if (empty($template_args['TKT_start_date'])) {
1464 1464
 			//if empty then the start date will be now.
1465 1465
 			$template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp'));
1466 1466
 		}
1467 1467
 
1468
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1468
+		if (empty($template_args['TKT_end_date'])) {
1469 1469
 			//get the earliest datetime (if present);
1470
-			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
1470
+			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL;
1471 1471
 
1472
-			if ( !empty( $earliest_dtt ) )
1472
+			if ( ! empty($earliest_dtt))
1473 1473
 				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1474 1474
 			else
1475
-				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1475
+				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d") + 7, date("Y")));
1476 1476
 		}
1477 1477
 
1478
-		$template_args = array_merge( $template_args, $price_args );
1479
-		$template = apply_filters( 'FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', $ticket);
1478
+		$template_args = array_merge($template_args, $price_args);
1479
+		$template = apply_filters('FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', $ticket);
1480 1480
 		return EEH_Template::display_template($template, $template_args, TRUE);
1481 1481
 	}
1482 1482
 
@@ -1505,8 +1505,8 @@  discard block
 block discarded – undo
1505 1505
 		$template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status());
1506 1506
 		$template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description());
1507 1507
 		$template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false);
1508
-		$template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values );
1509
-		$templatepath = EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php';
1508
+		$template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values);
1509
+		$templatepath = EVENTS_TEMPLATE_PATH.'event_registration_options.template.php';
1510 1510
 		EEH_Template::display_template($templatepath, $template_args);
1511 1511
 	}
1512 1512
 
@@ -1534,21 +1534,21 @@  discard block
 block discarded – undo
1534 1534
 		$EEME = $this->_event_model();
1535 1535
 
1536 1536
 		$offset = ($current_page - 1) * $per_page;
1537
-		$limit = $count ? NULL : $offset . ',' . $per_page;
1537
+		$limit = $count ? NULL : $offset.','.$per_page;
1538 1538
 		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID';
1539 1539
 		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC";
1540 1540
 
1541 1541
 		if (isset($this->_req_data['month_range'])) {
1542 1542
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1543
-			$month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1544
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
1543
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1544
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1545 1545
 		}
1546 1546
 
1547 1547
 		$where = array();
1548 1548
 
1549
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL;
1549
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL;
1550 1550
 		//determine what post_status our condition will have for the query.
1551
-		switch ( $status ) {
1551
+		switch ($status) {
1552 1552
 			case 'month' :
1553 1553
 			case 'today' :
1554 1554
 			case NULL :
@@ -1556,7 +1556,7 @@  discard block
 block discarded – undo
1556 1556
 				break;
1557 1557
 
1558 1558
 			case 'draft' :
1559
-				$where['status'] = array( 'IN', array('draft', 'auto-draft') );
1559
+				$where['status'] = array('IN', array('draft', 'auto-draft'));
1560 1560
 				break;
1561 1561
 
1562 1562
 			default :
@@ -1564,43 +1564,43 @@  discard block
 block discarded – undo
1564 1564
 		}
1565 1565
 
1566 1566
 		//categories?
1567
-		$category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1567
+		$category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1568 1568
 
1569
-		if ( !empty ( $category ) ) {
1569
+		if ( ! empty ($category)) {
1570 1570
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1571 1571
 			$where['Term_Taxonomy.term_id'] = $category;
1572 1572
 		}
1573 1573
 
1574 1574
 		//date where conditions
1575
-		$start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' );
1575
+		$start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start');
1576 1576
 		if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') {
1577
-			$DateTime = new DateTime( $year_r . '-' . $month_r . '-01 00:00:00', new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) );
1578
-			$start = $DateTime->format( implode( ' ', $start_formats  ) );
1579
-			$end = $DateTime->setDate( $year_r, $month_r, $DateTime->format('t') )->setTime(23,59,59)->format( implode( ' ', $start_formats ) );
1580
-			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array( $start, $end ) );
1577
+			$DateTime = new DateTime($year_r.'-'.$month_r.'-01 00:00:00', new DateTimeZone(EEM_Datetime::instance()->get_timezone()));
1578
+			$start = $DateTime->format(implode(' ', $start_formats));
1579
+			$end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1580
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1581 1581
 		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') {
1582
-			$DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1583
-			$start = $DateTime->setTime( 0,0,0 )->format( implode( ' ', $start_formats ) );
1584
-			$end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1585
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1586
-		} else if ( isset($this->_req_data['status']) && $this->_req_data['status'] == 'month' ) {
1587
-			$now = date( 'Y-m-01' );
1588
-			$DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1589
-			$start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) );
1590
-			$end = $DateTime->setDate( date('Y'), date('m'), $DateTime->format('t' ) )->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1591
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1582
+			$DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone()));
1583
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1584
+			$end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1585
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1586
+		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') {
1587
+			$now = date('Y-m-01');
1588
+			$DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone()));
1589
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1590
+			$end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1591
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1592 1592
 		}
1593 1593
 
1594 1594
 
1595
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1596
-			$where['EVT_wp_user'] =  get_current_user_id();
1595
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1596
+			$where['EVT_wp_user'] = get_current_user_id();
1597 1597
 		} else {
1598
-			if ( ! isset( $where['status'] ) ) {
1599
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) {
1598
+			if ( ! isset($where['status'])) {
1599
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
1600 1600
 					$where['OR'] = array(
1601
-						'status*restrict_private' => array( '!=', 'private' ),
1601
+						'status*restrict_private' => array('!=', 'private'),
1602 1602
 						'AND' => array(
1603
-							'status*inclusive' => array( '=', 'private' ),
1603
+							'status*inclusive' => array('=', 'private'),
1604 1604
 							'EVT_wp_user' => get_current_user_id()
1605 1605
 						)
1606 1606
 					);
@@ -1608,16 +1608,16 @@  discard block
 block discarded – undo
1608 1608
 			}
1609 1609
 		}
1610 1610
 
1611
-		if ( isset( $this->_req_data['EVT_wp_user'] ) ) {
1612
-			if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1611
+		if (isset($this->_req_data['EVT_wp_user'])) {
1612
+			if ($this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1613 1613
 				$where['EVT_wp_user'] = $this->_req_data['EVT_wp_user'];
1614 1614
 			}
1615 1615
 		}
1616 1616
 
1617 1617
 
1618 1618
 		//search query handling
1619
-		if ( isset( $this->_req_data['s'] ) ) {
1620
-			$search_string = '%' . $this->_req_data['s'] . '%';
1619
+		if (isset($this->_req_data['s'])) {
1620
+			$search_string = '%'.$this->_req_data['s'].'%';
1621 1621
 			$where['OR'] = array(
1622 1622
 				'EVT_name' => array('LIKE', $search_string),
1623 1623
 				'EVT_desc' => array('LIKE', $search_string),
@@ -1626,32 +1626,32 @@  discard block
 block discarded – undo
1626 1626
 		}
1627 1627
 
1628 1628
 
1629
-		$where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data );
1630
-		$query_params = apply_filters( 'FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID' ), $this->_req_data );
1629
+		$where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data);
1630
+		$query_params = apply_filters('FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID'), $this->_req_data);
1631 1631
 
1632 1632
 
1633 1633
 		//let's first check if we have special requests coming in.
1634
-		if ( isset( $this->_req_data['active_status'] ) ) {
1635
-			switch ( $this->_req_data['active_status'] ) {
1634
+		if (isset($this->_req_data['active_status'])) {
1635
+			switch ($this->_req_data['active_status']) {
1636 1636
 				case 'upcoming' :
1637
-					return $EEME->get_upcoming_events( $query_params, $count );
1637
+					return $EEME->get_upcoming_events($query_params, $count);
1638 1638
 					break;
1639 1639
 
1640 1640
 				case 'expired' :
1641
-					return $EEME->get_expired_events( $query_params, $count );
1641
+					return $EEME->get_expired_events($query_params, $count);
1642 1642
 					break;
1643 1643
 
1644 1644
 				case 'active' :
1645
-					return $EEME->get_active_events( $query_params, $count );
1645
+					return $EEME->get_active_events($query_params, $count);
1646 1646
 					break;
1647 1647
 
1648 1648
 				case 'inactive' :
1649
-					return $EEME->get_inactive_events( $query_params, $count );
1649
+					return $EEME->get_inactive_events($query_params, $count);
1650 1650
 					break;
1651 1651
 			}
1652 1652
 		}
1653 1653
 
1654
-		$events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params );
1654
+		$events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params);
1655 1655
 
1656 1656
 		return $events;
1657 1657
 	}
@@ -1660,23 +1660,23 @@  discard block
 block discarded – undo
1660 1660
 
1661 1661
 
1662 1662
 	//handling for WordPress CPT actions (trash, restore, delete)
1663
-	public function trash_cpt_item( $post_id ) {
1663
+	public function trash_cpt_item($post_id) {
1664 1664
 		$this->_req_data['EVT_ID'] = $post_id;
1665
-		$this->_trash_or_restore_event( 'trash', FALSE );
1665
+		$this->_trash_or_restore_event('trash', FALSE);
1666 1666
 	}
1667 1667
 
1668 1668
 
1669 1669
 
1670 1670
 
1671
-	public function restore_cpt_item( $post_id ) {
1671
+	public function restore_cpt_item($post_id) {
1672 1672
 		$this->_req_data['EVT_ID'] = $post_id;
1673
-		$this->_trash_or_restore_event( 'draft', FALSE );
1673
+		$this->_trash_or_restore_event('draft', FALSE);
1674 1674
 	}
1675 1675
 
1676 1676
 
1677
-	public function delete_cpt_item( $post_id ) {
1677
+	public function delete_cpt_item($post_id) {
1678 1678
 		$this->_req_data['EVT_ID'] = $post_id;
1679
-		$this->_delete_event( FALSE );
1679
+		$this->_delete_event(FALSE);
1680 1680
 	}
1681 1681
 
1682 1682
 
@@ -1688,7 +1688,7 @@  discard block
 block discarded – undo
1688 1688
 	 * @param  string $event_status
1689 1689
 	 * @return void
1690 1690
 	 */
1691
-	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE ) {
1691
+	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE) {
1692 1692
 		//determine the event id and set to array.
1693 1693
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : FALSE;
1694 1694
 		// loop thru events
@@ -1696,7 +1696,7 @@  discard block
 block discarded – undo
1696 1696
 			// clean status
1697 1697
 			$event_status = sanitize_key($event_status);
1698 1698
 			// grab status
1699
-			if (!empty($event_status)) {
1699
+			if ( ! empty($event_status)) {
1700 1700
 				$success = $this->_change_event_status($EVT_ID, $event_status);
1701 1701
 			} else {
1702 1702
 				$success = FALSE;
@@ -1710,7 +1710,7 @@  discard block
 block discarded – undo
1710 1710
 		}
1711 1711
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1712 1712
 
1713
-		if ( $redirect_after )
1713
+		if ($redirect_after)
1714 1714
 			$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1715 1715
 	}
1716 1716
 
@@ -1725,7 +1725,7 @@  discard block
 block discarded – undo
1725 1725
 		// clean status
1726 1726
 		$event_status = sanitize_key($event_status);
1727 1727
 		// grab status
1728
-		if (!empty($event_status)) {
1728
+		if ( ! empty($event_status)) {
1729 1729
 			$success = TRUE;
1730 1730
 			//determine the event id and set to array.
1731 1731
 			$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
@@ -1760,15 +1760,15 @@  discard block
 block discarded – undo
1760 1760
 	 * @param  string $event_status
1761 1761
 	 * @return bool
1762 1762
 	 */
1763
-	private function _change_event_status( $EVT_ID = 0, $event_status = '') {
1763
+	private function _change_event_status($EVT_ID = 0, $event_status = '') {
1764 1764
 		// grab event id
1765
-		if (!$EVT_ID) {
1765
+		if ( ! $EVT_ID) {
1766 1766
 			$msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1767 1767
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1768 1768
 			return FALSE;
1769 1769
 		}
1770 1770
 
1771
-		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1771
+		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1772 1772
 
1773 1773
 		// clean status
1774 1774
 		$event_status = sanitize_key($event_status);
@@ -1794,7 +1794,7 @@  discard block
 block discarded – undo
1794 1794
 				$hook = FALSE;
1795 1795
 		}
1796 1796
 		//use class to change status
1797
-		$this->_cpt_model_obj->set_status( $event_status );
1797
+		$this->_cpt_model_obj->set_status($event_status);
1798 1798
 		$success = $this->_cpt_model_obj->save();
1799 1799
 
1800 1800
 		if ($success === FALSE) {
@@ -1816,15 +1816,15 @@  discard block
 block discarded – undo
1816 1816
 	 * @access protected
1817 1817
 	 * @param bool $redirect_after
1818 1818
 	 */
1819
-	protected function _delete_event( $redirect_after = TRUE ) {
1819
+	protected function _delete_event($redirect_after = TRUE) {
1820 1820
 		//determine the event id and set to array.
1821 1821
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : NULL;
1822
-		$EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID;
1822
+		$EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID;
1823 1823
 
1824 1824
 
1825 1825
 		// loop thru events
1826 1826
 		if ($EVT_ID) {
1827
-			$success = $this->_permanently_delete_event( $EVT_ID );
1827
+			$success = $this->_permanently_delete_event($EVT_ID);
1828 1828
 			// get list of events with no prices
1829 1829
 			$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array());
1830 1830
 			// remove this event from the list of events with no prices
@@ -1838,7 +1838,7 @@  discard block
 block discarded – undo
1838 1838
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1839 1839
 		}
1840 1840
 
1841
-		if ( $redirect_after )
1841
+		if ($redirect_after)
1842 1842
 			$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1843 1843
 	}
1844 1844
 
@@ -1856,12 +1856,12 @@  discard block
 block discarded – undo
1856 1856
 		$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
1857 1857
 		// loop thru events
1858 1858
 		foreach ($EVT_IDs as $EVT_ID) {
1859
-			$EVT_ID = absint( $EVT_ID );
1860
-			if ( $EVT_ID ) {
1861
-				$results = $this->_permanently_delete_event( $EVT_ID );
1859
+			$EVT_ID = absint($EVT_ID);
1860
+			if ($EVT_ID) {
1861
+				$results = $this->_permanently_delete_event($EVT_ID);
1862 1862
 				$success = $results !== FALSE ? $success : FALSE;
1863 1863
 				// remove this event from the list of events with no prices
1864
-				unset( $espresso_no_ticket_prices[ $EVT_ID ] );
1864
+				unset($espresso_no_ticket_prices[$EVT_ID]);
1865 1865
 			} else {
1866 1866
 				$success = FALSE;
1867 1867
 				$msg = __('An error occurred. An event could not be deleted because a valid event ID was not not supplied.', 'event_espresso');
@@ -1881,9 +1881,9 @@  discard block
 block discarded – undo
1881 1881
 	 * @param  int $EVT_ID
1882 1882
 	 * @return bool
1883 1883
 	 */
1884
-	private function _permanently_delete_event( $EVT_ID = 0 ) {
1884
+	private function _permanently_delete_event($EVT_ID = 0) {
1885 1885
 		// grab event id
1886
-		if ( ! $EVT_ID ) {
1886
+		if ( ! $EVT_ID) {
1887 1887
 			$msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1888 1888
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1889 1889
 			return FALSE;
@@ -1892,19 +1892,19 @@  discard block
 block discarded – undo
1892 1892
 			! $this->_cpt_model_obj instanceof EE_Event
1893 1893
 			|| $this->_cpt_model_obj->ID() !== $EVT_ID
1894 1894
 		) {
1895
-			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1895
+			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1896 1896
 		}
1897 1897
 
1898
-		if ( ! $this->_cpt_model instanceof EE_Event ) {
1898
+		if ( ! $this->_cpt_model instanceof EE_Event) {
1899 1899
 			return false;
1900 1900
 		}
1901 1901
 
1902 1902
 		//need to delete related tickets and prices first.
1903 1903
 		$datetimes = $this->_cpt_model_obj->get_many_related('Datetime');
1904
-		foreach ( $datetimes as $datetime ) {
1904
+		foreach ($datetimes as $datetime) {
1905 1905
 			$this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime');
1906 1906
 			$tickets = $datetime->get_many_related('Ticket');
1907
-			foreach ( $tickets as $ticket ) {
1907
+			foreach ($tickets as $ticket) {
1908 1908
 				$ticket->_remove_relation_to($datetime, 'Datetime');
1909 1909
 				$ticket->delete_related_permanently('Price');
1910 1910
 				$ticket->delete_permanently();
@@ -1914,14 +1914,14 @@  discard block
 block discarded – undo
1914 1914
 
1915 1915
 		//what about related venues or terms?
1916 1916
 		$venues = $this->_cpt_model_obj->get_many_related('Venue');
1917
-		foreach ( $venues as $venue ) {
1917
+		foreach ($venues as $venue) {
1918 1918
 			$this->_cpt_model_obj->_remove_relation_to($venue, 'Venue');
1919 1919
 		}
1920 1920
 
1921 1921
 		//any attached question groups?
1922 1922
 		$question_groups = $this->_cpt_model_obj->get_many_related('Question_Group');
1923
-		if ( !empty( $question_groups ) ) {
1924
-			foreach ( $question_groups as $question_group ) {
1923
+		if ( ! empty($question_groups)) {
1924
+			foreach ($question_groups as $question_group) {
1925 1925
 				$this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group');
1926 1926
 			}
1927 1927
 		}
@@ -1930,12 +1930,12 @@  discard block
 block discarded – undo
1930 1930
 
1931 1931
 
1932 1932
 		//Message Template Groups
1933
-		$this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' );
1933
+		$this->_cpt_model_obj->_remove_relations('Message_Template_Group');
1934 1934
 
1935 1935
 		/** @type EE_Term_Taxonomy[] $term_taxonomies */
1936 1936
 		$term_taxonomies = $this->_cpt_model_obj->term_taxonomies();
1937 1937
 
1938
-		foreach ( $term_taxonomies as $term_taxonomy ) {
1938
+		foreach ($term_taxonomies as $term_taxonomy) {
1939 1939
 			$this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy);
1940 1940
 		}
1941 1941
 
@@ -1949,7 +1949,7 @@  discard block
 block discarded – undo
1949 1949
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1950 1950
 			return FALSE;
1951 1951
 		}
1952
-		do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID );
1952
+		do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID);
1953 1953
 		return TRUE;
1954 1954
 	}
1955 1955
 
@@ -1966,7 +1966,7 @@  discard block
 block discarded – undo
1966 1966
 	 */
1967 1967
 	public function total_events() {
1968 1968
 
1969
-		$count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true );
1969
+		$count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true);
1970 1970
 		return $count;
1971 1971
 	}
1972 1972
 
@@ -1981,10 +1981,10 @@  discard block
 block discarded – undo
1981 1981
 	 */
1982 1982
 	public function total_events_draft() {
1983 1983
 		$where = array(
1984
-			'status' => array( 'IN', array('draft', 'auto-draft' ) )
1984
+			'status' => array('IN', array('draft', 'auto-draft'))
1985 1985
 			);
1986 1986
 
1987
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
1987
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
1988 1988
 		return $count;
1989 1989
 	}
1990 1990
 
@@ -2003,7 +2003,7 @@  discard block
 block discarded – undo
2003 2003
 			'status' => 'trash'
2004 2004
 			);
2005 2005
 
2006
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
2006
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
2007 2007
 		return $count;
2008 2008
 	}
2009 2009
 
@@ -2031,11 +2031,11 @@  discard block
 block discarded – undo
2031 2031
 			// translated
2032 2032
 			TRUE
2033 2033
 		);
2034
-		$this->_template_args['default_reg_status'] = isset( EE_Registry::instance()->CFG->registration->default_STS_ID ) ? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID ) : EEM_Registration::status_id_pending_payment;
2034
+		$this->_template_args['default_reg_status'] = isset(EE_Registry::instance()->CFG->registration->default_STS_ID) ? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID) : EEM_Registration::status_id_pending_payment;
2035 2035
 
2036 2036
 		$this->_set_add_edit_form_tags('update_default_event_settings');
2037 2037
 		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
2038
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH . 'event_settings.template.php', $this->_template_args, TRUE);
2038
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_settings.template.php', $this->_template_args, TRUE);
2039 2039
 		$this->display_admin_page_with_sidebar();
2040 2040
 	}
2041 2041
 
@@ -2061,9 +2061,9 @@  discard block
 block discarded – undo
2061 2061
 
2062 2062
 	protected function _template_settings() {
2063 2063
 		$this->_admin_page_title = __('Template Settings (Preview)', 'event_espresso');
2064
-		$this->_template_args['preview_img'] = '<img src="' . EVENTS_ASSETS_URL . DS . 'images' . DS . 'caffeinated_template_features.jpg" alt="' . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) . '" />';
2065
-		$this->_template_args['preview_text'] = '<strong>'.__( 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso' ).'</strong>';
2066
-		$this->display_admin_caf_preview_page( 'template_settings_tab' );
2064
+		$this->_template_args['preview_img'] = '<img src="'.EVENTS_ASSETS_URL.DS.'images'.DS.'caffeinated_template_features.jpg" alt="'.esc_attr__('Template Settings Preview screenshot', 'event_espresso').'" />';
2065
+		$this->_template_args['preview_text'] = '<strong>'.__('Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso').'</strong>';
2066
+		$this->display_admin_caf_preview_page('template_settings_tab');
2067 2067
 	}
2068 2068
 
2069 2069
 
@@ -2076,22 +2076,22 @@  discard block
 block discarded – undo
2076 2076
 	 * @return void
2077 2077
 	 */
2078 2078
 	private function _set_category_object() {
2079
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
2079
+		if (isset($this->_category->id) && ! empty($this->_category->id))
2080 2080
 			return; //already have the category object so get out.
2081 2081
 
2082 2082
 		//set default category object
2083 2083
 		$this->_set_empty_category_object();
2084 2084
 
2085 2085
 		//only set if we've got an id
2086
-		if ( !isset($this->_req_data['EVT_CAT_ID'] ) ) {
2086
+		if ( ! isset($this->_req_data['EVT_CAT_ID'])) {
2087 2087
 			return;
2088 2088
 		}
2089 2089
 
2090 2090
 		$category_id = absint($this->_req_data['EVT_CAT_ID']);
2091 2091
 
2092
-		$term = get_term( $category_id, 'espresso_event_categories' );
2092
+		$term = get_term($category_id, 'espresso_event_categories');
2093 2093
 
2094
-		if ( !empty( $term ) ) {
2094
+		if ( ! empty($term)) {
2095 2095
 			$this->_category->category_name = $term->name;
2096 2096
 			$this->_category->category_identifier = $term->slug;
2097 2097
 			$this->_category->category_desc = $term->description;
@@ -2105,13 +2105,13 @@  discard block
 block discarded – undo
2105 2105
 
2106 2106
 	private function _set_empty_category_object() {
2107 2107
 		$this->_category = new stdClass();
2108
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
2108
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
2109 2109
 		$this->_category->id = $this->_category->parent = 0;
2110 2110
 	}
2111 2111
 
2112 2112
 
2113 2113
 	protected function _category_list_table() {
2114
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2114
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2115 2115
 		$this->_search_btn_label = __('Categories', 'event_espresso');
2116 2116
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
2117 2117
 		$this->display_admin_list_table_page_with_sidebar();
@@ -2127,14 +2127,14 @@  discard block
 block discarded – undo
2127 2127
 		$this->_set_add_edit_form_tags($route);
2128 2128
 
2129 2129
 		$this->_set_category_object();
2130
-		$id = !empty($this->_category->id) ? $this->_category->id : '';
2130
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
2131 2131
 
2132 2132
 		$delete_action = 'delete_category';
2133 2133
 
2134 2134
 		//custom redirect
2135
-		$redirect = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'category_list'), $this->_admin_base_url );
2135
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
2136 2136
 
2137
-		$this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect );
2137
+		$this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect);
2138 2138
 
2139 2139
 		//take care of contents
2140 2140
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
@@ -2148,25 +2148,25 @@  discard block
 block discarded – undo
2148 2148
 			'type' => 'wp_editor',
2149 2149
 			'value' => EEH_Formatter::admin_format_content($this->_category->category_desc),
2150 2150
 			'class' => 'my_editor_custom',
2151
-			'wpeditor_args' => array('media_buttons' => FALSE )
2151
+			'wpeditor_args' => array('media_buttons' => FALSE)
2152 2152
 		);
2153
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
2153
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
2154 2154
 
2155
-		$all_terms = get_terms( array('espresso_event_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) );
2155
+		$all_terms = get_terms(array('espresso_event_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id)));
2156 2156
 
2157 2157
 		//setup category select for term parents.
2158 2158
 		$category_select_values[] = array(
2159 2159
 			'text' => __('No Parent', 'event_espresso'),
2160 2160
 			'id' => 0
2161 2161
 			);
2162
-		foreach ( $all_terms as $term ) {
2162
+		foreach ($all_terms as $term) {
2163 2163
 			$category_select_values[] = array(
2164 2164
 				'text' => $term->name,
2165 2165
 				'id' => $term->term_id
2166 2166
 				);
2167 2167
 		}
2168 2168
 
2169
-		$category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent );
2169
+		$category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent);
2170 2170
 
2171 2171
 		$template_args = array(
2172 2172
 			'category' => $this->_category,
@@ -2176,15 +2176,15 @@  discard block
 block discarded – undo
2176 2176
 			'disable' => '',
2177 2177
 			'disabled_message' => FALSE
2178 2178
 			);
2179
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
2180
-		return EEH_Template::display_template($template, $template_args, TRUE );
2179
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
2180
+		return EEH_Template::display_template($template, $template_args, TRUE);
2181 2181
 	}
2182 2182
 
2183 2183
 
2184 2184
 	protected function _delete_categories() {
2185
-		$cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2185
+		$cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2186 2186
 
2187
-		foreach ( $cat_ids as $cat_id ) {
2187
+		foreach ($cat_ids as $cat_id) {
2188 2188
 			$this->_delete_category($cat_id);
2189 2189
 		}
2190 2190
 
@@ -2192,7 +2192,7 @@  discard block
 block discarded – undo
2192 2192
 		$query_args = array(
2193 2193
 			'action' => 'category_list'
2194 2194
 			);
2195
-		$this->_redirect_after_action(0,'','',$query_args);
2195
+		$this->_redirect_after_action(0, '', '', $query_args);
2196 2196
 
2197 2197
 	}
2198 2198
 
@@ -2202,61 +2202,61 @@  discard block
 block discarded – undo
2202 2202
 
2203 2203
 	protected function _delete_category($cat_id) {
2204 2204
 		global $wpdb;
2205
-		$cat_id = absint( $cat_id );
2206
-		wp_delete_term( $cat_id, 'espresso_event_categories' );
2205
+		$cat_id = absint($cat_id);
2206
+		wp_delete_term($cat_id, 'espresso_event_categories');
2207 2207
 	}
2208 2208
 
2209 2209
 
2210 2210
 
2211 2211
 	protected function _insert_or_update_category($new_category) {
2212 2212
 
2213
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE );
2213
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE);
2214 2214
 		$success = 0; //we already have a success message so lets not send another.
2215 2215
 
2216
-		if ( $cat_id ) {
2216
+		if ($cat_id) {
2217 2217
 			$query_args = array(
2218 2218
 				'action'     => 'edit_category',
2219 2219
 				'EVT_CAT_ID' => $cat_id
2220 2220
 			);
2221 2221
 		} else {
2222
-			$query_args = array( 'action' => 'add_category' );
2222
+			$query_args = array('action' => 'add_category');
2223 2223
 		}
2224
-		$this->_redirect_after_action( $success, '','', $query_args, TRUE );
2224
+		$this->_redirect_after_action($success, '', '', $query_args, TRUE);
2225 2225
 
2226 2226
 	}
2227 2227
 
2228 2228
 
2229 2229
 
2230
-	private function _insert_category( $update = FALSE ) {
2230
+	private function _insert_category($update = FALSE) {
2231 2231
 		$cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : '';
2232
-		$category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
2233
-		$category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
2234
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
2232
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
2233
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
2234
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
2235 2235
 
2236
-		if ( empty( $category_name ) ) {
2237
-			$msg = __( 'You must add a name for the category.', 'event_espresso' );
2238
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2236
+		if (empty($category_name)) {
2237
+			$msg = __('You must add a name for the category.', 'event_espresso');
2238
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2239 2239
 			return false;
2240 2240
 		}
2241 2241
 
2242
-		$term_args=array(
2242
+		$term_args = array(
2243 2243
 			'name'=>$category_name,
2244 2244
 			'description'=>$category_desc,
2245 2245
 			'parent'=>$category_parent
2246 2246
 		);
2247 2247
 		//was the category_identifier input disabled?
2248
-		if(isset($this->_req_data['category_identifier'])){
2248
+		if (isset($this->_req_data['category_identifier'])) {
2249 2249
 			$term_args['slug'] = $this->_req_data['category_identifier'];
2250 2250
 		}
2251
-		$insert_ids = $update ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_event_categories', $term_args );
2251
+		$insert_ids = $update ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) : wp_insert_term($category_name, 'espresso_event_categories', $term_args);
2252 2252
 
2253
-		if ( !is_array( $insert_ids ) ) {
2254
-			$msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' );
2255
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2253
+		if ( ! is_array($insert_ids)) {
2254
+			$msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso');
2255
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2256 2256
 		} else {
2257 2257
 			$cat_id = $insert_ids['term_id'];
2258
-			$msg = sprintf ( __('The category %s was successfuly saved', 'event_espresso'), $category_name );
2259
-			EE_Error::add_success( $msg );
2258
+			$msg = sprintf(__('The category %s was successfuly saved', 'event_espresso'), $category_name);
2259
+			EE_Error::add_success($msg);
2260 2260
 		}
2261 2261
 
2262 2262
 		return $cat_id;
@@ -2265,32 +2265,32 @@  discard block
 block discarded – undo
2265 2265
 
2266 2266
 
2267 2267
 
2268
-	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
2268
+	public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) {
2269 2269
 		global $wpdb;
2270 2270
 
2271 2271
 		//testing term stuff
2272
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
2273
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
2274
-		$limit = ($current_page-1)*$per_page;
2272
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
2273
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
2274
+		$limit = ($current_page - 1) * $per_page;
2275 2275
 
2276
-		$where = array( 'taxonomy' => 'espresso_event_categories' );
2276
+		$where = array('taxonomy' => 'espresso_event_categories');
2277 2277
 
2278
-		if ( isset( $this->_req_data['s'] ) ) {
2279
-			$sstr = '%' . $this->_req_data['s'] . '%';
2278
+		if (isset($this->_req_data['s'])) {
2279
+			$sstr = '%'.$this->_req_data['s'].'%';
2280 2280
 			$where['OR'] = array(
2281
-				'Term.name' => array( 'LIKE', $sstr),
2282
-				'description' => array( 'LIKE', $sstr )
2281
+				'Term.name' => array('LIKE', $sstr),
2282
+				'description' => array('LIKE', $sstr)
2283 2283
 				);
2284 2284
 		}
2285 2285
 
2286 2286
 		$query_params = array(
2287
-			$where ,
2288
-			'order_by' => array( $orderby => $order ),
2289
-			'limit' => $limit . ',' . $per_page,
2287
+			$where,
2288
+			'order_by' => array($orderby => $order),
2289
+			'limit' => $limit.','.$per_page,
2290 2290
 			'force_join' => array('Term')
2291 2291
 			);
2292 2292
 
2293
-		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
2293
+		$categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params);
2294 2294
 
2295 2295
 		return $categories;
2296 2296
 	}
Please login to merge, or discard this patch.