Completed
Branch BUG-8866-category-permalink (0af2d2)
by
unknown
22:53 queued 19s
created
caffeinated/admin/extend/events/help_tabs/import_page.help_tab.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -2,18 +2,18 @@
 block discarded – undo
2 2
 <p>
3 3
 <?php _e('The importer can be used to import event information into Event Espresso using a CSV file.', 'event_espresso'); ?>
4 4
 </p>
5
-<h3><?php _e("Importing from other Event Espresso 4 Sites", 'event_espresso');?></h3>
5
+<h3><?php _e("Importing from other Event Espresso 4 Sites", 'event_espresso'); ?></h3>
6 6
 <p>
7 7
 <?php _e('To import Event Espresso data from another Event Espresso 4 install, export a CSV file from the admin Events overview page, or anywhere you can generate a CSV export file from. Then upload that file here (regardless of what type of information was exported).', 'event_espresso'); ?>
8 8
 </p>
9 9
 <p>
10 10
 <?php _e('Note: its possible that data from the other site have the same IDs as data in this site. The importer recognizes that this data is from a different database and inserts new items for each item in the CSV file, regardless of whether its ID matches that of an item in this site\'s database or not. However, the importer also remembers the mapping from the old site\'s database to this site\'s database, and on subsequent CSV importers from that site, the data in this database will be updated instead of re-inserting new items.', 'event_espresso'); ?>
11 11
 </p>
12
-<h3><?php _e("Importing from this Site", 'event_espresso');?></h3>
13
-<p><?php _e("You may want to export data from this site, modify it (or modify the database), and re-import it. When this is done, the importer recognizes that the data is from this site\'s database and updates the records (instead of inserting new items like it would have, had the CSV data been from a different site).", 'event_espresso');?></p>
12
+<h3><?php _e("Importing from this Site", 'event_espresso'); ?></h3>
13
+<p><?php _e("You may want to export data from this site, modify it (or modify the database), and re-import it. When this is done, the importer recognizes that the data is from this site\'s database and updates the records (instead of inserting new items like it would have, had the CSV data been from a different site).", 'event_espresso'); ?></p>
14 14
 
15
-	<h3><?php _e("Notes about Generating your own CSV Import Files", "event_espresso");?></h3>
16
-	<p><?php _e("If you think you could save time entering data into a CSV file, you can use the sample import file below. Note that creating your own CSV file is more complicated than in Event Espresso 3.1 because of the more advanced data structure, and so we recommend creating/editing your events using the normal web-interface.", "event_espresso");?></p>
17
-	<p><?php _e("The export file is just an export of an event, or if you do not have any events in your system, it will only contain column headers. Do not change those column headers. Add as many rows as you like. ", "event_espresso");?></p>
18
-	<p><?php _e("In the ID columns (columns ending in '_ID'), you should enter 'temporary IDs', which are unique numbers/words that identify that item, which can be used later when you want to refer to that item. (For example, if you assign an event's EVT_ID to be a temporary id of 'my-event-1', then use that same phrase 'my-event-1' to refer to that event in the Datetime model's EVT_ID column)", "event_espresso");?></p>
19
-	<p><?php _e("Also note, you do NOT have to enter info in for each model. (You can, for example, only enter in Term_Taxonomies and Term model data)", "event_espresso");?></p>
20 15
\ No newline at end of file
16
+	<h3><?php _e("Notes about Generating your own CSV Import Files", "event_espresso"); ?></h3>
17
+	<p><?php _e("If you think you could save time entering data into a CSV file, you can use the sample import file below. Note that creating your own CSV file is more complicated than in Event Espresso 3.1 because of the more advanced data structure, and so we recommend creating/editing your events using the normal web-interface.", "event_espresso"); ?></p>
18
+	<p><?php _e("The export file is just an export of an event, or if you do not have any events in your system, it will only contain column headers. Do not change those column headers. Add as many rows as you like. ", "event_espresso"); ?></p>
19
+	<p><?php _e("In the ID columns (columns ending in '_ID'), you should enter 'temporary IDs', which are unique numbers/words that identify that item, which can be used later when you want to refer to that item. (For example, if you assign an event's EVT_ID to be a temporary id of 'my-event-1', then use that same phrase 'my-event-1' to refer to that event in the Datetime model's EVT_ID column)", "event_espresso"); ?></p>
20
+	<p><?php _e("Also note, you do NOT have to enter info in for each model. (You can, for example, only enter in Term_Taxonomies and Term model data)", "event_espresso"); ?></p>
21 21
\ No newline at end of file
Please login to merge, or discard this patch.
core/admin/EE_Admin_Hooks.core.php 1 patch
Spacing   +105 added lines, -105 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
 /**
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	 * constructor
210 210
 	 * @param EE_Admin_Page $admin_page the calling admin_page_object
211 211
 	 */
212
-	public function __construct( EE_Admin_Page $adminpage ) {
212
+	public function __construct(EE_Admin_Page $adminpage) {
213 213
 
214 214
 		$this->_adminpage_obj = $adminpage;
215 215
 		$this->_req_data = array_merge($_GET, $_POST);
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
 		$this->_set_hooks_properties();
218 218
 
219 219
 		//first let's verify we're on the right page
220
-		if ( !isset( $this->_req_data['page'] ) || ( isset( $this->_req_data['page'] ) && $this->_adminpage_obj->page_slug != $this->_req_data['page'] ) )
220
+		if ( ! isset($this->_req_data['page']) || (isset($this->_req_data['page']) && $this->_adminpage_obj->page_slug != $this->_req_data['page']))
221 221
 			return; //get out nothing more to be done here.
222 222
 
223 223
 		//allow for extends to modify properties
224
-		if ( method_exists( $this, '_extend_properties' ) )
224
+		if (method_exists($this, '_extend_properties'))
225 225
 			$this->_extend_properties();
226 226
 
227 227
 		$this->_set_page_object();
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
 		$this->_load_custom_methods();
230 230
 		$this->_load_routed_hooks();
231 231
 
232
-		add_action( 'admin_enqueue_scripts', array($this, 'enqueue_scripts_styles' ) );
233
-		add_action( 'admin_enqueue_scripts', array($this, 'add_metaboxes'), 20 );
234
-		add_action( 'admin_enqueue_scripts', array($this, 'remove_metaboxes'), 15 );
232
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts_styles'));
233
+		add_action('admin_enqueue_scripts', array($this, 'add_metaboxes'), 20);
234
+		add_action('admin_enqueue_scripts', array($this, 'remove_metaboxes'), 15);
235 235
 
236 236
 		$this->_ajax_hooks();
237 237
 
@@ -272,15 +272,15 @@  discard block
 block discarded – undo
272 272
 	 */
273 273
 	public function enqueue_scripts_styles() {
274 274
 
275
-		if ( !empty( $this->_scripts_styles ) ) {
275
+		if ( ! empty($this->_scripts_styles)) {
276 276
 			//first let's do all the registrations
277
-			if ( !isset($this->_scripts_styles['registers'] ) ) {
277
+			if ( ! isset($this->_scripts_styles['registers'])) {
278 278
 				$msg[] = __('There is no "registers" index in the <code>$this->_scripts_styles</code> property.', 'event_espresso');
279
-				$msg[] = sprintf ( __('Make sure you read the phpdoc comments above the definition of the $_scripts_styles property in the <code>EE_Admin_Hooks</code> class and modify according in the %s child', 'event_espresso'), '<strong>' . $this->caller . '</strong>' );
280
-				throw new EE_Error( implode( '||', $msg ) );
279
+				$msg[] = sprintf(__('Make sure you read the phpdoc comments above the definition of the $_scripts_styles property in the <code>EE_Admin_Hooks</code> class and modify according in the %s child', 'event_espresso'), '<strong>'.$this->caller.'</strong>');
280
+				throw new EE_Error(implode('||', $msg));
281 281
 			}
282 282
 
283
-			foreach( $this->_scripts_styles['registers'] as $ref => $details ) {
283
+			foreach ($this->_scripts_styles['registers'] as $ref => $details) {
284 284
 				$defaults = array(
285 285
 					'type' => 'js',
286 286
 					'url' => '',
@@ -289,48 +289,48 @@  discard block
 block discarded – undo
289 289
 					'footer' => TRUE
290 290
 					);
291 291
 				$details = wp_parse_args($details, $defaults);
292
-				extract( $details );
292
+				extract($details);
293 293
 
294 294
 				//let's make sure that we set the 'registers' type if it's not set! We need it later to determine whhich enqueu we do
295 295
 				$this->_scripts_styles['registers'][$ref]['type'] = $type;
296 296
 
297 297
 				//let's make sure we're not missing any REQUIRED parameters
298
-				if ( empty($url) ) {
299
-					$msg[] = sprintf( __('Missing the url for the requested %s', 'event_espresso'), $type == 'js' ? 'script' : 'stylesheet' );
300
-					$msg[] = sprintf( __('Doublecheck your <code>$this->_scripts_styles</code> array in %s and make sure that there is a "url" set for the %s ref', 'event_espresso'), '<strong>' . $this->caller . '</strong>', $ref );
301
-					throw new EE_Error( implode( '||', $msg ) );
298
+				if (empty($url)) {
299
+					$msg[] = sprintf(__('Missing the url for the requested %s', 'event_espresso'), $type == 'js' ? 'script' : 'stylesheet');
300
+					$msg[] = sprintf(__('Doublecheck your <code>$this->_scripts_styles</code> array in %s and make sure that there is a "url" set for the %s ref', 'event_espresso'), '<strong>'.$this->caller.'</strong>', $ref);
301
+					throw new EE_Error(implode('||', $msg));
302 302
 				}
303 303
 				//made it here so let's do the appropriate registration
304
-				$type == 'js' ? wp_register_script( $ref, $url, $depends, $version, $footer ) : wp_register_style( $ref, $url, $depends, $version );
304
+				$type == 'js' ? wp_register_script($ref, $url, $depends, $version, $footer) : wp_register_style($ref, $url, $depends, $version);
305 305
 			}
306 306
 
307 307
 			//k now lets do the enqueues
308
-			if( !isset( $this->_scripts_styles['enqueues'] ) )
309
-				return;  //not sure if we should throw an error here or not.
310
-			foreach( $this->_scripts_styles['enqueues'] as $ref => $routes ) {
308
+			if ( ! isset($this->_scripts_styles['enqueues']))
309
+				return; //not sure if we should throw an error here or not.
310
+			foreach ($this->_scripts_styles['enqueues'] as $ref => $routes) {
311 311
 				//make sure $routes is an array
312 312
 				$routes = (array) $routes;
313 313
 
314
-				if ( in_array($this->_current_route, $routes ) ) {
314
+				if (in_array($this->_current_route, $routes)) {
315 315
 					$this->_scripts_styles['registers'][$ref]['type'] == 'js' ? wp_enqueue_script($ref) : wp_enqueue_style($ref);
316 316
 					//if we have a localization for the script let's do that too.
317
-					if ( isset( $this->_scripts_styles['localize'][$ref] ) ) {
318
-						foreach ( $this->_scripts_styles['localize'][$ref] as $object_name => $indexes ) {
319
-							wp_localize_script($ref, $object_name , $this->_scripts_styles['localize'][$ref][$object_name] );
317
+					if (isset($this->_scripts_styles['localize'][$ref])) {
318
+						foreach ($this->_scripts_styles['localize'][$ref] as $object_name => $indexes) {
319
+							wp_localize_script($ref, $object_name, $this->_scripts_styles['localize'][$ref][$object_name]);
320 320
 						}
321 321
 					}
322 322
 				}
323 323
 			}
324 324
 
325 325
 			//let's do the deregisters
326
-			if ( !isset( $this->_scripts_styles['deregisters'] ) )
326
+			if ( ! isset($this->_scripts_styles['deregisters']))
327 327
 				return;
328
-			foreach ( $this->_scripts_styles['deregisters'] as $ref => $details ) {
328
+			foreach ($this->_scripts_styles['deregisters'] as $ref => $details) {
329 329
 				$defaults = array(
330 330
 					'type' => 'js'
331 331
 					);
332
-				$details = wp_parse_args( $details, $defaults );
333
-				extract( $details );
332
+				$details = wp_parse_args($details, $defaults);
333
+				extract($details);
334 334
 
335 335
 				$type == 'js' ? wp_deregister_script($ref) : wp_deregister_style($ref);
336 336
 
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 	 */
350 350
 	private function _set_defaults() {
351 351
 		$this->_ajax_func = $this->_init_func = $this->_metaboxes = $this->_scripts = $this->_styles = $this->_wp_action_filters_priority = array();
352
-		$this->_current_route = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'default';
352
+		$this->_current_route = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'default';
353 353
 		$this->caller = get_class($this);
354 354
 		$this->_extend = stripos($this->caller, 'Extend') ? TRUE : FALSE;
355 355
 	}
@@ -364,34 +364,34 @@  discard block
 block discarded – undo
364 364
 	 */
365 365
 	protected function _set_page_object() {
366 366
 		//first make sure $this->_name is set
367
-		if ( empty( $this->_name ) ) {
367
+		if (empty($this->_name)) {
368 368
 			$msg[] = __('We can\'t load the page object', 'event_espresso');
369
-			$msg[] = sprintf( __("This is because the %s child class has not set the '_name' property", 'event_espresso'), $this->caller );
370
-			throw new EE_Error( implode( '||', $msg ) );
369
+			$msg[] = sprintf(__("This is because the %s child class has not set the '_name' property", 'event_espresso'), $this->caller);
370
+			throw new EE_Error(implode('||', $msg));
371 371
 		}
372 372
 
373
-		$ref = str_replace('_' , ' ', $this->_name); //take the_message -> the message
374
-		$ref = str_replace(' ', '_', ucwords($ref) ) . '_Admin_Page'; //take the message -> The_Message
373
+		$ref = str_replace('_', ' ', $this->_name); //take the_message -> the message
374
+		$ref = str_replace(' ', '_', ucwords($ref)).'_Admin_Page'; //take the message -> The_Message
375 375
 
376 376
 		//first default file (if exists)
377
-		$decaf_file = EE_ADMIN_PAGES . $this->_name . DS . $ref . '.core.php';
378
-		if ( is_readable( $decaf_file ) )
379
-		require_once( $decaf_file );
377
+		$decaf_file = EE_ADMIN_PAGES.$this->_name.DS.$ref.'.core.php';
378
+		if (is_readable($decaf_file))
379
+		require_once($decaf_file);
380 380
 
381 381
 		//now we have to do require for extended file (if needed)
382
-		if ( $this->_extend ) {
383
-			require_once( EE_CORE_CAF_ADMIN_EXTEND . $this->_name . DS . 'Extend_' . $ref . '.core.php' );
382
+		if ($this->_extend) {
383
+			require_once(EE_CORE_CAF_ADMIN_EXTEND.$this->_name.DS.'Extend_'.$ref.'.core.php');
384 384
 		}
385 385
 
386 386
 
387 387
 		//if we've got an extended class we use that!
388
-		$ref = $this->_extend ? 'Extend_' . $ref : $ref;
388
+		$ref = $this->_extend ? 'Extend_'.$ref : $ref;
389 389
 
390 390
 		//let's make sure the class exists
391
-		if ( !class_exists( $ref ) ) {
391
+		if ( ! class_exists($ref)) {
392 392
 			$msg[] = __('We can\'t load the page object', 'event_espresso');
393
-			$msg[] = sprintf( __('The class name that was given is %s. Check the spelling and make sure its correct, also there needs to be an autoloader setup for the class', 'event_espresso'), $ref );
394
-			throw new EE_Error( implode( '||', $msg ) );
393
+			$msg[] = sprintf(__('The class name that was given is %s. Check the spelling and make sure its correct, also there needs to be an autoloader setup for the class', 'event_espresso'), $ref);
394
+			throw new EE_Error(implode('||', $msg));
395 395
 		}
396 396
 
397 397
 		$a = new ReflectionClass($ref);
@@ -416,27 +416,27 @@  discard block
 block discarded – undo
416 416
 		$method_callback = $this->_current_route == 'default' ? 'default_callback' : $this->_current_route;
417 417
 
418 418
 		//these run before the Admin_Page route executes.
419
-		if ( method_exists( $this, $method_callback ) ) {
420
-			call_user_func( array( $this, $method_callback) );
419
+		if (method_exists($this, $method_callback)) {
420
+			call_user_func(array($this, $method_callback));
421 421
 		}
422 422
 
423 423
 
424 424
 		//these run via the _redirect_after_action method in EE_Admin_Page which usually happens after non_UI methods in EE_Admin_Page classes.  There are two redirect actions, the first fires before $query_args might be manipulated by "save and close" actions and the seond fires right before the actual redirect happens.
425 425
 		//first the actions
426 426
 		//note that these action hooks will have the $query_args value available.
427
-		$admin_class_name = get_class( $this->_adminpage_obj );
427
+		$admin_class_name = get_class($this->_adminpage_obj);
428 428
 
429
-		if ( method_exists( $this, '_redirect_action_early_' . $this->_current_route ) ) {
430
-			add_action( 'AHEE__' . $admin_class_name . '___redirect_after_action__before_redirect_modification_' . $this->_current_route, array( $this, '_redirect_action_early_' . $this->_current_route ), 10 );
429
+		if (method_exists($this, '_redirect_action_early_'.$this->_current_route)) {
430
+			add_action('AHEE__'.$admin_class_name.'___redirect_after_action__before_redirect_modification_'.$this->_current_route, array($this, '_redirect_action_early_'.$this->_current_route), 10);
431 431
 		}
432 432
 
433
-		if ( method_exists( $this, '_redirect_action_' . $this->_current_route ) ) {
434
-			add_action( 'AHEE_redirect_' . $admin_class_name . $this->_current_route, array( $this, '_redirect_action_' . $this->_current_route ), 10 );
433
+		if (method_exists($this, '_redirect_action_'.$this->_current_route)) {
434
+			add_action('AHEE_redirect_'.$admin_class_name.$this->_current_route, array($this, '_redirect_action_'.$this->_current_route), 10);
435 435
 		}
436 436
 
437 437
 		//let's hook into the _redirect itself and allow for changing where the user goes after redirect.  This will have $query_args and $redirect_url available.
438
-		if ( method_exists( $this, '_redirect_filter_' . $this->_current_route ) ) {
439
-			add_filter( 'FHEE_redirect_' . $admin_class_name . $this->_current_route, array( $this, '_redirect_filter_' . $this->_current_route ), 10, 2 );
438
+		if (method_exists($this, '_redirect_filter_'.$this->_current_route)) {
439
+			add_filter('FHEE_redirect_'.$admin_class_name.$this->_current_route, array($this, '_redirect_filter_'.$this->_current_route), 10, 2);
440 440
 		}
441 441
 
442 442
 	}
@@ -459,12 +459,12 @@  discard block
 block discarded – undo
459 459
 				'argnum' => 1,
460 460
 				'priority' => 10
461 461
 				),
462
-			'FHEE_list_table_views_' . $this->_adminpage_obj->page_slug . '_' . $this->_current_route => array(
462
+			'FHEE_list_table_views_'.$this->_adminpage_obj->page_slug.'_'.$this->_current_route => array(
463 463
 				'type' => 'filter',
464 464
 				'argnum' => 1,
465 465
 				'priority' => 10
466 466
 				),
467
-			'FHEE_list_table_views_' . $this->_adminpage_obj->page_slug => array(
467
+			'FHEE_list_table_views_'.$this->_adminpage_obj->page_slug => array(
468 468
 				'type' => 'filter',
469 469
 				'argnum' => 1,
470 470
 				'priority' => 10
@@ -483,14 +483,14 @@  discard block
 block discarded – undo
483 483
 
484 484
 
485 485
 
486
-		foreach ( $hook_filter_array as $hook => $args ) {
487
-			if ( method_exists( $this, $this->_current_route . '_' . $hook ) ) {
488
-				if ( isset( $this->_wp_action_filters_priority[$hook] ) )
486
+		foreach ($hook_filter_array as $hook => $args) {
487
+			if (method_exists($this, $this->_current_route.'_'.$hook)) {
488
+				if (isset($this->_wp_action_filters_priority[$hook]))
489 489
 					$args['priority'] = $this->_wp_action_filters_priority[$hook];
490
-				if ( $args['type'] == 'action' )
491
-					add_action( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] );
490
+				if ($args['type'] == 'action')
491
+					add_action($hook, array($this, $this->_current_route.'_'.$hook), $args['priority'], $args['argnum']);
492 492
 				else
493
-					add_filter( $hook, array( $this, $this->_current_route . '_' . $hook ), $args['priority'], $args['argnum'] );
493
+					add_filter($hook, array($this, $this->_current_route.'_'.$hook), $args['priority'], $args['argnum']);
494 494
 			}
495 495
 		}
496 496
 
@@ -503,18 +503,18 @@  discard block
 block discarded – undo
503 503
 	 */
504 504
 	private function _ajax_hooks() {
505 505
 
506
-		if ( empty( $this->_ajax_func) )
506
+		if (empty($this->_ajax_func))
507 507
 			return; //get out there's nothing to take care of.
508 508
 
509
-		foreach ( $this->_ajax_func as $action => $method ) {
509
+		foreach ($this->_ajax_func as $action => $method) {
510 510
 			//make sure method exists
511
-			if ( !method_exists($this, $method) ) {
512
-				$msg[] = __('There is no corresponding method for the hook labeled in the _ajax_func array', 'event_espresso') . '<br />';
513
-				$msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $method, $this->caller );
514
-				throw new EE_Error( implode('||', $msg ) );
511
+			if ( ! method_exists($this, $method)) {
512
+				$msg[] = __('There is no corresponding method for the hook labeled in the _ajax_func array', 'event_espresso').'<br />';
513
+				$msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $method, $this->caller);
514
+				throw new EE_Error(implode('||', $msg));
515 515
 			}
516 516
 
517
-			add_action('wp_ajax_' . $action, array( $this, $method ) );
517
+			add_action('wp_ajax_'.$action, array($this, $method));
518 518
 		}
519 519
 
520 520
 	}
@@ -527,21 +527,21 @@  discard block
 block discarded – undo
527 527
 	 * @return void
528 528
 	 */
529 529
 	protected function _init_hooks() {
530
-		if ( empty( $this->_init_func) )
530
+		if (empty($this->_init_func))
531 531
 			return; //get out there's nothing to take care of.
532 532
 
533 533
 		//We need to determine what page_route we are on!
534
-		$current_route = isset ( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'default';
534
+		$current_route = isset ($_REQUEST['action']) ? $_REQUEST['action'] : 'default';
535 535
 
536
-		foreach ( $this->_init_func as $route => $method ) {
536
+		foreach ($this->_init_func as $route => $method) {
537 537
 			//make sure method exists
538
-			if ( !method_exists($this, $method) ) {
539
-				$msg[] = __('There is no corresponding method for the hook labeled in the _init_func array', 'event_espresso') . '<br />';
540
-				$msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $method, $this->caller );
541
-				throw new EE_Error( implode('||', $msg ) );
538
+			if ( ! method_exists($this, $method)) {
539
+				$msg[] = __('There is no corresponding method for the hook labeled in the _init_func array', 'event_espresso').'<br />';
540
+				$msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $method, $this->caller);
541
+				throw new EE_Error(implode('||', $msg));
542 542
 			}
543
-			if ( $route == $this->_current_route )
544
-				add_action('admin_init', array( $this, $method ) );
543
+			if ($route == $this->_current_route)
544
+				add_action('admin_init', array($this, $method));
545 545
 		}
546 546
 
547 547
 	}
@@ -556,28 +556,28 @@  discard block
 block discarded – undo
556 556
 	 * @return void
557 557
 	 */
558 558
 	public function add_metaboxes() {
559
-		if ( empty( $this->_metaboxes ) )
559
+		if (empty($this->_metaboxes))
560 560
 			return; //get out we don't have any metaboxes to set for this connection
561 561
 
562
-		$this->_handle_metabox_array( $this->_metaboxes );
562
+		$this->_handle_metabox_array($this->_metaboxes);
563 563
 
564 564
 	}
565 565
 
566 566
 
567 567
 
568
-	private function _handle_metabox_array( $boxes, $add = TRUE ) {
568
+	private function _handle_metabox_array($boxes, $add = TRUE) {
569 569
 
570
-		foreach ( $boxes as $box ) {
571
-			if ( !isset($box['page_route']) )
570
+		foreach ($boxes as $box) {
571
+			if ( ! isset($box['page_route']))
572 572
 				continue; //we dont' have a valid array
573 573
 
574 574
 			//let's make sure $box['page_route'] is an array so the "foreach" will work.
575 575
 			$box['page_route'] = (array) $box['page_route'];
576 576
 
577
-			foreach ( $box['page_route'] as $route ) {
578
-				if ( $route != $this->_current_route )
577
+			foreach ($box['page_route'] as $route) {
578
+				if ($route != $this->_current_route)
579 579
 					continue; //get out we only add metaboxes for set route.
580
-				if ( $add )
580
+				if ($add)
581 581
 					$this->_add_metabox($box);
582 582
 				else
583 583
 					$this->_remove_metabox($box);
@@ -595,10 +595,10 @@  discard block
 block discarded – undo
595 595
 	 */
596 596
 	public function remove_metaboxes() {
597 597
 
598
-		if ( empty( $this->_remove_metaboxes ) )
598
+		if (empty($this->_remove_metaboxes))
599 599
 			return; //get out there are no metaboxes to remove
600 600
 
601
-		$this->_handle_metabox_array( $this->_remove_metaboxes, FALSE );
601
+		$this->_handle_metabox_array($this->_remove_metaboxes, FALSE);
602 602
 	}
603 603
 
604 604
 
@@ -608,53 +608,53 @@  discard block
 block discarded – undo
608 608
 	 * @access private
609 609
 	 * @param array $args an array of args that have been set for this metabox by the child class
610 610
 	 */
611
-	private function _add_metabox( $args ) {
611
+	private function _add_metabox($args) {
612 612
 		$current_screen = get_current_screen();
613
-		$screen_id = is_object( $current_screen ) ? $current_screen->id : NULL;
614
-		$func = isset( $args['func'] ) ? $args['func'] : 'some_invalid_callback';
613
+		$screen_id = is_object($current_screen) ? $current_screen->id : NULL;
614
+		$func = isset($args['func']) ? $args['func'] : 'some_invalid_callback';
615 615
 
616 616
 		//set defaults
617 617
 		$defaults = array(
618 618
 			'func' => $func,
619
-			'id' => $this->caller . '_' . $func . '_metabox',
619
+			'id' => $this->caller.'_'.$func.'_metabox',
620 620
 			'priority' => 'default',
621 621
 			'label' => $this->caller,
622 622
 			'context' => 'advanced',
623 623
 			'callback_args' => array(),
624
-			'page' => isset( $args['page'] ) ? $args['page'] : $screen_id
624
+			'page' => isset($args['page']) ? $args['page'] : $screen_id
625 625
 			);
626 626
 
627
-		$args = wp_parse_args( $args, $defaults );
627
+		$args = wp_parse_args($args, $defaults);
628 628
 		extract($args);
629 629
 
630 630
 
631 631
 		//make sure method exists
632
-		if ( !method_exists($this, $func) ) {
633
-			$msg[] = __('There is no corresponding method to display the metabox content', 'event_espresso') . '<br />';
634
-			$msg[] = sprintf( __('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso' ), $func, $this->caller );
635
-			throw new EE_Error( implode('||', $msg ) );
632
+		if ( ! method_exists($this, $func)) {
633
+			$msg[] = __('There is no corresponding method to display the metabox content', 'event_espresso').'<br />';
634
+			$msg[] = sprintf(__('The method name given in the array is %s, check the spelling and make sure it exists in the %s class', 'event_espresso'), $func, $this->caller);
635
+			throw new EE_Error(implode('||', $msg));
636 636
 		}
637 637
 
638 638
 		//everything checks out so lets add the metabox
639
-		add_meta_box( $id, $label, array( $this, $func ), $page, $context, $priority, $callback_args);
639
+		add_meta_box($id, $label, array($this, $func), $page, $context, $priority, $callback_args);
640 640
 	}
641 641
 
642 642
 
643 643
 
644
-	private function _remove_metabox( $args ) {
644
+	private function _remove_metabox($args) {
645 645
 		$current_screen = get_current_screen();
646
-		$screen_id = is_object( $current_screen ) ? $current_screen->id : NULL;
647
-		$func = isset( $args['func'] ) ? $args['func'] : 'some_invalid_callback';
646
+		$screen_id = is_object($current_screen) ? $current_screen->id : NULL;
647
+		$func = isset($args['func']) ? $args['func'] : 'some_invalid_callback';
648 648
 
649 649
 		//set defaults
650 650
 		$defaults = array(
651
-			'id' => isset( $args['id'] ) ? $args['id'] : $this->_current_route . '_' . $this->caller . '_' . $func . '_metabox',
651
+			'id' => isset($args['id']) ? $args['id'] : $this->_current_route.'_'.$this->caller.'_'.$func.'_metabox',
652 652
 			'context' => 'default',
653
-			'screen' => isset( $args['screen'] ) ? $args['screen'] : $screen_id
653
+			'screen' => isset($args['screen']) ? $args['screen'] : $screen_id
654 654
 		);
655 655
 
656
-		$args = wp_parse_args( $args, $defaults );
657
-		extract( $args );
656
+		$args = wp_parse_args($args, $defaults);
657
+		extract($args);
658 658
 
659 659
 		//everything checks out so lets remove the box!
660 660
 		remove_meta_box($id, $screen, $context);
Please login to merge, or discard this patch.
modules/ticket_selector/EED_Ticket_Selector.module.php 2 patches
Spacing   +209 added lines, -209 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,19 +169,19 @@  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 177
 		EE_Registry::instance()->load_helper('Template');
178
-		$template_args[ 'notices' ] = EEH_Template::display_template(
179
-			EE_TEMPLATES . 'espresso-ajax-notices.template.php',
178
+		$template_args['notices'] = EEH_Template::display_template(
179
+			EE_TEMPLATES.'espresso-ajax-notices.template.php',
180 180
 			array(),
181 181
 			true
182 182
 		);
183 183
 		EEH_Template::display_template(
184
-			TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php',
184
+			TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php',
185 185
 			$template_args
186 186
 		);
187 187
 		exit;
@@ -200,23 +200,23 @@  discard block
 block discarded – undo
200 200
 	 *
201 201
 	 * @return string The new html string for the permalink area.
202 202
 	 */
203
-	public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) {
203
+	public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) {
204 204
 		//make sure this is ONLY when editing and the event id has been set.
205
-		if ( ! empty( $id ) )  {
206
-			$post = get_post( $id );
205
+		if ( ! empty($id)) {
206
+			$post = get_post($id);
207 207
 
208 208
 			//if NOT event then let's get out.
209
-			if ( $post->post_type !== 'espresso_events' ) {
209
+			if ($post->post_type !== 'espresso_events') {
210 210
 				return $permalink_string;
211 211
 			}
212 212
 
213
-			$ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() );
213
+			$ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url());
214 214
 
215
-			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">' . __('Embed', 'event_espresso') . '</a> ';
215
+			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">'.__('Embed', 'event_espresso').'</a> ';
216 216
 			$permalink_string .= '
217 217
 <div id="js-ts-iframe" style="display:none">
218 218
 	<div style="width:100%; height: 500px;">
219
-		<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>
219
+		<iframe src="' . $ticket_selector_url.'" width="100%" height="100%"></iframe>
220 220
 	</div>
221 221
 </div>';
222 222
 		}
@@ -235,22 +235,22 @@  discard block
 block discarded – undo
235 235
 	 * @param 	mixed $event
236 236
 	 * @return 	bool
237 237
 	 */
238
-	protected static function set_event( $event = null ) {
239
-		if( $event === null ) {
238
+	protected static function set_event($event = null) {
239
+		if ($event === null) {
240 240
 			global $post;
241 241
 			$event = $post;
242 242
 		}
243
-		if ( $event instanceof EE_Event ) {
243
+		if ($event instanceof EE_Event) {
244 244
 			self::$_event = $event;
245
-		} else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) {
245
+		} else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) {
246 246
 			self::$_event = $event->EE_Event;
247
-		} else if ( $event instanceof WP_Post && $event->post_type == 'espresso_events' ) {
248
-			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event );
247
+		} else if ($event instanceof WP_Post && $event->post_type == 'espresso_events') {
248
+			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event);
249 249
 			self::$_event = $event->EE_Event;
250 250
 		} else {
251
-			$user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' );
252
-			$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' );
253
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
251
+			$user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso');
252
+			$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');
253
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
254 254
 			return false;
255 255
 		}
256 256
 		return true;
@@ -269,11 +269,11 @@  discard block
 block discarded – undo
269 269
 	 * @param 	bool 	$view_details
270 270
 	 * @return 	string
271 271
 	 */
272
-	public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) {
272
+	public static function display_ticket_selector($event = NULL, $view_details = FALSE) {
273 273
 		// reset filter for displaying submit button
274
-		remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
274
+		remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
275 275
 		// poke and prod incoming event till it tells us what it is
276
-		if ( ! EED_Ticket_Selector::set_event( $event )) {
276
+		if ( ! EED_Ticket_Selector::set_event($event)) {
277 277
 			return false;
278 278
 		}
279 279
 		$event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event;
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 			&& (
285 285
 				! self::$_event->display_ticket_selector()
286 286
 				|| $view_details
287
-				|| post_password_required( $event_post )
287
+				|| post_password_required($event_post)
288 288
 				|| (
289 289
 					$_event_active_status != EE_Datetime::active
290 290
 					&& $_event_active_status != EE_Datetime::upcoming
@@ -302,70 +302,70 @@  discard block
 block discarded – undo
302 302
 		$template_args = array();
303 303
 		$template_args['event_status'] = $_event_active_status;
304 304
 
305
-		$template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) );
306
-		$template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) );
305
+		$template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format'));
306
+		$template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format'));
307 307
 
308 308
 		$template_args['EVT_ID'] = self::$_event->ID();
309 309
 		$template_args['event'] = self::$_event;
310 310
 
311 311
 		// is the event expired ?
312 312
 		$template_args['event_is_expired'] = self::$_event->is_expired();
313
-		if ( $template_args['event_is_expired'] ) {
314
-			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>';
313
+		if ($template_args['event_is_expired']) {
314
+			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>';
315 315
 		}
316 316
 
317 317
 		$ticket_query_args = array(
318
-			array( 'Datetime.EVT_ID' => self::$_event->ID() ),
319
-			'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' )
318
+			array('Datetime.EVT_ID' => self::$_event->ID()),
319
+			'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC')
320 320
 		);
321 321
 
322
-		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) {
322
+		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) {
323 323
 			//use the correct applicable time query depending on what version of core is being run.
324
-			$current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp');
325
-			$ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time );
324
+			$current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp');
325
+			$ticket_query_args[0]['TKT_end_date'] = array('>', $current_time);
326 326
 		}
327 327
 
328 328
 		// get all tickets for this event ordered by the datetime
329
-		$template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args );
329
+		$template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args);
330 330
 
331
-		if ( count( $template_args['tickets'] ) < 1 ) {
332
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>';
331
+		if (count($template_args['tickets']) < 1) {
332
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>';
333 333
 		}
334 334
 
335 335
 		// filter the maximum qty that can appear in the Ticket Selector qty dropdowns
336
-		$template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit() );
337
-		if ( $template_args['max_atndz'] < 1 ) {
338
-			$sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' );
339
-			if ( current_user_can( 'edit_post', self::$_event->ID() )) {
340
-				$sales_closed_msg .=  sprintf(
341
-					__( '%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' ),
336
+		$template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit());
337
+		if ($template_args['max_atndz'] < 1) {
338
+			$sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso');
339
+			if (current_user_can('edit_post', self::$_event->ID())) {
340
+				$sales_closed_msg .= sprintf(
341
+					__('%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'),
342 342
 					'<div class="ee-attention" style="text-align: left;"><b>',
343 343
 					'</b><br />',
344
-					$link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">',
344
+					$link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">',
345 345
 					'</a></span></div>'
346 346
 				);
347 347
 			}
348
-			return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>';
348
+			return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>';
349 349
 		}
350 350
 
351
-		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php';
352
-		$templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event );
351
+		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php';
352
+		$templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event);
353 353
 
354 354
 		// redirecting to another site for registration ??
355 355
 		$external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE;
356 356
 		// set up the form (but not for the admin)
357
-		$ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open( self::$_event->ID(), $external_url ) : '';
357
+		$ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open(self::$_event->ID(), $external_url) : '';
358 358
 		// if not redirecting to another site for registration
359
-		if ( ! $external_url ) {
360
-			EE_Registry::instance()->load_helper( 'Template' );
361
-			EE_Registry::instance()->load_helper( 'URL' );
359
+		if ( ! $external_url) {
360
+			EE_Registry::instance()->load_helper('Template');
361
+			EE_Registry::instance()->load_helper('URL');
362 362
 			// then display the ticket selector
363
-			$ticket_selector .= EEH_Template::locate_template( $templates['ticket_selector'], $template_args );
363
+			$ticket_selector .= EEH_Template::locate_template($templates['ticket_selector'], $template_args);
364 364
 		} else {
365 365
 			// if not we still need to trigger the display of the submit button
366
-			add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
366
+			add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
367 367
 			//display notice to admin that registration is external
368
-			$ticket_selector .= ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' );
368
+			$ticket_selector .= ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso');
369 369
 		}
370 370
 		// submit button and form close tag
371 371
 		$ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : '';
@@ -385,27 +385,27 @@  discard block
 block discarded – undo
385 385
 	 * @param 		string $external_url
386 386
 	 * @return 		string
387 387
 	 */
388
-	public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) {
388
+	public static function ticket_selector_form_open($ID = 0, $external_url = '') {
389 389
 		// if redirecting, we don't need any anything else
390
-		if ( $external_url ) {
391
-			EE_Registry::instance()->load_helper( 'URL' );
392
-			$html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">';
393
-			$query_args = EEH_URL::get_query_string( $external_url );
394
-			foreach ( $query_args as $query_arg => $value ) {
395
-				$html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">';
390
+		if ($external_url) {
391
+			EE_Registry::instance()->load_helper('URL');
392
+			$html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">';
393
+			$query_args = EEH_URL::get_query_string($external_url);
394
+			foreach ($query_args as $query_arg => $value) {
395
+				$html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">';
396 396
 			}
397 397
 			return $html;
398 398
 		}
399
-		EE_Registry::instance()->load_helper( 'Event_View' );
400
-		$checkout_url = EEH_Event_View::event_link_url( $ID );
401
-		if ( ! $checkout_url ) {
402
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
399
+		EE_Registry::instance()->load_helper('Event_View');
400
+		$checkout_url = EEH_Event_View::event_link_url($ID);
401
+		if ( ! $checkout_url) {
402
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
403 403
 		}
404 404
 		$extra_params = self::$_in_iframe ? ' target="_blank"' : '';
405
-		$html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>';
406
-		$html .= wp_nonce_field( 	'process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE );
405
+		$html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>';
406
+		$html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE);
407 407
 		$html .= '<input type="hidden" name="ee" value="process_ticket_selections">';
408
-		$html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event );
408
+		$html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event);
409 409
 		return $html;
410 410
 	}
411 411
 
@@ -420,21 +420,21 @@  discard block
 block discarded – undo
420 420
 	 * 	@return		string
421 421
 	 */
422 422
 	public static function display_ticket_selector_submit() {
423
-		if ( ! is_admin() ) {
424
-			if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE ) ) {
423
+		if ( ! is_admin()) {
424
+			if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE)) {
425 425
 				$btn_text = apply_filters(
426 426
 					'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text',
427
-					__('Register Now', 'event_espresso' ),
427
+					__('Register Now', 'event_espresso'),
428 428
 					self::$_event
429 429
 				);
430
-				$html = '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn"';
430
+				$html = '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn"';
431 431
 				$html .= ' class="ticket-selector-submit-btn ticket-selector-submit-ajax"';
432
-				$html .= ' type="submit" value="' . $btn_text . '" />';
433
-				$html .= apply_filters( 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event );
432
+				$html .= ' type="submit" value="'.$btn_text.'" />';
433
+				$html .= apply_filters('FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event);
434 434
 				$html .= '<div class="clear"><br/></div></form>';
435 435
 				return $html;
436
-			} else if ( is_archive() ) {
437
-				return EED_Ticket_Selector::ticket_selector_form_close() . EED_Ticket_Selector::display_view_details_btn();
436
+			} else if (is_archive()) {
437
+				return EED_Ticket_Selector::ticket_selector_form_close().EED_Ticket_Selector::display_view_details_btn();
438 438
 			}
439 439
 		}
440 440
 		return '';
@@ -466,13 +466,13 @@  discard block
 block discarded – undo
466 466
 	 * 	@return		string
467 467
 	 */
468 468
 	public static function display_view_details_btn() {
469
-		if ( ! self::$_event->get_permalink() ) {
470
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
469
+		if ( ! self::$_event->get_permalink()) {
470
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
471 471
 		}
472
-		$view_details_btn = '<form method="POST" action="' . self::$_event->get_permalink() . '">';
473
-		$btn_text = apply_filters( 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __( 'View Details', 'event_espresso' ), self::$_event );
474
-		$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 . '" />';
475
-		$view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event );
472
+		$view_details_btn = '<form method="POST" action="'.self::$_event->get_permalink().'">';
473
+		$btn_text = apply_filters('FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __('View Details', 'event_espresso'), self::$_event);
474
+		$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.'" />';
475
+		$view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event);
476 476
 		$view_details_btn .= '<div class="clear"><br/></div>';
477 477
 		$view_details_btn .= '</form>';
478 478
 		return $view_details_btn;
@@ -491,11 +491,11 @@  discard block
 block discarded – undo
491 491
 	 * 	@return		array  or FALSE
492 492
 	 */
493 493
 	public function process_ticket_selections() {
494
-		do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
494
+		do_action('EED_Ticket_Selector__process_ticket_selections__before');
495 495
 		// check nonce
496
-		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' ))) {
496
+		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'))) {
497 497
 			EE_Error::add_error(
498
-				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/>' ),
498
+				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/>'),
499 499
 				__FILE__, __FUNCTION__, __LINE__
500 500
 			);
501 501
 			return FALSE;
@@ -509,16 +509,16 @@  discard block
 block discarded – undo
509 509
 
510 510
 		//we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart.
511 511
 		// When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc.
512
-		EE_Registry::instance()->load_core( 'Session' );
512
+		EE_Registry::instance()->load_core('Session');
513 513
 		// unless otherwise requested, clear the session
514
-		if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) {
515
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
514
+		if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) {
515
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
516 516
 		}
517 517
 		//d( EE_Registry::instance()->SSN );
518 518
 
519
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
519
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
520 520
 		// do we have an event id?
521
-		if ( EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) {
521
+		if (EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) {
522 522
 			// validate/sanitize data
523 523
 			$valid = self::_validate_post_data();
524 524
 
@@ -528,43 +528,43 @@  discard block
 block discarded – undo
528 528
 			//EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ );
529 529
 
530 530
 			//check total tickets ordered vs max number of attendees that can register
531
-			if ( $valid['total_tickets'] > $valid['max_atndz'] ) {
531
+			if ($valid['total_tickets'] > $valid['max_atndz']) {
532 532
 
533 533
 				// ordering too many tickets !!!
534 534
 				$singular = 'You have attempted to purchase %s ticket.';
535 535
 				$plural = 'You have attempted to purchase %s tickets.';
536
-				$limit_error_1 = sprintf( _n( $singular, $plural, $valid['total_tickets'], 'event_espresso' ), $valid['total_tickets'], $valid['total_tickets'] );
536
+				$limit_error_1 = sprintf(_n($singular, $plural, $valid['total_tickets'], 'event_espresso'), $valid['total_tickets'], $valid['total_tickets']);
537 537
 				// dev only message
538 538
 				$singular = '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.';
539 539
 				$plural = '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.';
540
-				$limit_error_2 = sprintf( _n( $singular, $plural, $valid['max_atndz'], 'event_espresso' ), $valid['max_atndz'], $valid['max_atndz'] );
541
-				EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ );
540
+				$limit_error_2 = sprintf(_n($singular, $plural, $valid['max_atndz'], 'event_espresso'), $valid['max_atndz'], $valid['max_atndz']);
541
+				EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__);
542 542
 			} else {
543 543
 
544 544
 				// all data appears to be valid
545 545
 				$tckts_slctd = FALSE;
546 546
 				$success = TRUE;
547 547
 				// load cart
548
-				EE_Registry::instance()->load_core( 'Cart' );
548
+				EE_Registry::instance()->load_core('Cart');
549 549
 
550 550
 				// cycle thru the number of data rows sent from the event listing
551
-				for ( $x = 0; $x < $valid['rows']; $x++ ) {
551
+				for ($x = 0; $x < $valid['rows']; $x++) {
552 552
 					// does this row actually contain a ticket quantity?
553
-					if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) {
553
+					if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) {
554 554
 						// YES we have a ticket quantity
555 555
 						$tckts_slctd = TRUE;
556 556
 						//						d( $valid['ticket_obj'][$x] );
557
-						if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) {
557
+						if ($valid['ticket_obj'][$x] instanceof EE_Ticket) {
558 558
 							// then add ticket to cart
559
-							$ticket_added = self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] );
559
+							$ticket_added = self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]);
560 560
 							$success = ! $ticket_added ? FALSE : $success;
561
-							if ( EE_Error::has_error() ) {
561
+							if (EE_Error::has_error()) {
562 562
 								break;
563 563
 							}
564 564
 						} else {
565 565
 							// nothing added to cart retrieved
566 566
 							EE_Error::add_error(
567
-								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/>' ),
567
+								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/>'),
568 568
 								__FILE__, __FUNCTION__, __LINE__
569 569
 							);
570 570
 						}
@@ -573,45 +573,45 @@  discard block
 block discarded – undo
573 573
 				//d( EE_Registry::instance()->CART );
574 574
 				//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE
575 575
 
576
-				if ( $tckts_slctd ) {
577
-					if ( $success ) {
578
-						do_action( 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this );
576
+				if ($tckts_slctd) {
577
+					if ($success) {
578
+						do_action('FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this);
579 579
 						EE_Registry::instance()->CART->recalculate_all_cart_totals();
580
-						EE_Registry::instance()->CART->save_cart( FALSE );
580
+						EE_Registry::instance()->CART->save_cart(FALSE);
581 581
 						EE_Registry::instance()->SSN->update();
582 582
 						//d( EE_Registry::instance()->CART );
583 583
 						//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE
584 584
 						// just return TRUE for registrations being made from admin
585
-						if ( is_admin() ) {
585
+						if (is_admin()) {
586 586
 							return TRUE;
587 587
 						}
588
-						wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() ));
588
+						wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url()));
589 589
 						exit();
590 590
 
591 591
 					} else {
592
-						if ( ! EE_Error::has_error() ) {
592
+						if ( ! EE_Error::has_error()) {
593 593
 							// nothing added to cart
594
-							EE_Error::add_attention( __( 'No tickets were added for the event', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
594
+							EE_Error::add_attention(__('No tickets were added for the event', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
595 595
 						}
596 596
 					}
597 597
 
598 598
 				} else {
599 599
 					// no ticket quantities were selected
600
-					EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
600
+					EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
601 601
 				}
602 602
 			}
603 603
 			//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT
604 604
 			// at this point, just return if registration is being made from admin
605
-			if ( is_admin() ) {
605
+			if (is_admin()) {
606 606
 				return FALSE;
607 607
 			}
608
-			if ( $valid['return_url'] ) {
609
-				EE_Error::get_notices( FALSE, TRUE );
610
-				wp_safe_redirect( $valid['return_url'] );
608
+			if ($valid['return_url']) {
609
+				EE_Error::get_notices(FALSE, TRUE);
610
+				wp_safe_redirect($valid['return_url']);
611 611
 				exit();
612
-			} elseif ( isset( $event_to_add['id'] )) {
613
-				EE_Error::get_notices( FALSE, TRUE );
614
-				wp_safe_redirect( get_permalink( $event_to_add['id'] ));
612
+			} elseif (isset($event_to_add['id'])) {
613
+				EE_Error::get_notices(FALSE, TRUE);
614
+				wp_safe_redirect(get_permalink($event_to_add['id']));
615 615
 				exit();
616 616
 			} else {
617 617
 				echo EE_Error::get_notices();
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 		} else {
621 621
 			// $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
622 622
 			EE_Error::add_error(
623
-				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/>' ),
623
+				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/>'),
624 624
 				__FILE__, __FUNCTION__, __LINE__
625 625
 			);
626 626
 		}
@@ -638,18 +638,18 @@  discard block
 block discarded – undo
638 638
 	 * @return        array  or FALSE
639 639
 	 */
640 640
 	private static function _validate_post_data() {
641
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
641
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
642 642
 
643 643
 		// start with an empty array()
644 644
 		$valid_data = array();
645 645
 		//		d( $_POST );
646 646
 		//if event id is valid
647
-		$id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' ));
648
-		if ( $id ) {
647
+		$id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id'));
648
+		if ($id) {
649 649
 			// grab valid id
650 650
 			$valid_data['id'] = $id;
651 651
 			// grab and sanitize return-url
652
-			$valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id ));
652
+			$valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id));
653 653
 			// array of other form names
654 654
 			$inputs_to_clean = array(
655 655
 				'event_id' => 'tkt-slctr-event-id',
@@ -662,22 +662,22 @@  discard block
 block discarded – undo
662 662
 			// let's track the total number of tickets ordered.'
663 663
 			$valid_data['total_tickets'] = 0;
664 664
 			// cycle through $inputs_to_clean array
665
-			foreach ( $inputs_to_clean as $what => $input_to_clean ) {
665
+			foreach ($inputs_to_clean as $what => $input_to_clean) {
666 666
 				// check for POST data
667
-				if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) {
667
+				if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) {
668 668
 					// grab value
669
-					$input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id );
669
+					$input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id);
670 670
 					switch ($what) {
671 671
 
672 672
 						// integers
673 673
 						case 'event_id':
674
-							$valid_data[$what] = absint( $input_value );
674
+							$valid_data[$what] = absint($input_value);
675 675
 							// get event via the event id we put in the form
676
-							$valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] );
676
+							$valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']);
677 677
 							break;
678 678
 						case 'rows':
679 679
 						case 'max_atndz':
680
-							$valid_data[$what] = absint( $input_value );
680
+							$valid_data[$what] = absint($input_value);
681 681
 							break;
682 682
 
683 683
 						// arrays of integers
@@ -685,27 +685,27 @@  discard block
 block discarded – undo
685 685
 							//							d( $input_value );
686 686
 							$row_qty = $input_value;
687 687
 							// if qty is coming from a radio button input, then we need to assemble an array of rows
688
-							if( ! is_array( $row_qty )) {
688
+							if ( ! is_array($row_qty)) {
689 689
 								// get number of rows
690
-								$rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1;
690
+								$rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1;
691 691
 								//								d( $rows );
692 692
 								// explode ints by the dash
693
-								$row_qty = explode( '-', $row_qty );
694
-								$row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1;
695
-								$qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0;
696
-								$row_qty = array( $row => $qty );
693
+								$row_qty = explode('-', $row_qty);
694
+								$row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1;
695
+								$qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0;
696
+								$row_qty = array($row => $qty);
697 697
 								//								 d( $row_qty );
698
-								for( $x = 1; $x <= $rows; $x++ ) {
699
-									if ( ! isset( $row_qty[$x] )) {
698
+								for ($x = 1; $x <= $rows; $x++) {
699
+									if ( ! isset($row_qty[$x])) {
700 700
 										$row_qty[$x] = 0;
701 701
 									}
702 702
 								}
703 703
 							}
704
-							ksort( $row_qty );
704
+							ksort($row_qty);
705 705
 							//							 d( $row_qty );
706 706
 							// cycle thru values
707
-							foreach ( $row_qty as $qty ) {
708
-								$qty = absint( $qty );
707
+							foreach ($row_qty as $qty) {
708
+								$qty = absint($qty);
709 709
 								// sanitize as integers
710 710
 								$valid_data[$what][] = $qty;
711 711
 								$valid_data['total_tickets'] += $qty;
@@ -716,19 +716,19 @@  discard block
 block discarded – undo
716 716
 						case 'ticket_id':
717 717
 							$value_array = array();
718 718
 							// cycle thru values
719
-							foreach ( $input_value as $key=>$value ) {
719
+							foreach ($input_value as $key=>$value) {
720 720
 								// allow only numbers, letters,  spaces, commas and dashes
721
-								$value_array[ $key ] = wp_strip_all_tags( $value );
721
+								$value_array[$key] = wp_strip_all_tags($value);
722 722
 								// get ticket via the ticket id we put in the form
723
-								$ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value );
724
-								$valid_data['ticket_obj'][ $key ] = $ticket_obj;
723
+								$ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value);
724
+								$valid_data['ticket_obj'][$key] = $ticket_obj;
725 725
 							}
726
-							$valid_data[ $what ] = $value_array;
726
+							$valid_data[$what] = $value_array;
727 727
 							break;
728 728
 
729 729
 						case 'return_url' :
730 730
 							// grab and sanitize return-url
731
-							$valid_data[$what] = esc_url_raw( $input_value );
731
+							$valid_data[$what] = esc_url_raw($input_value);
732 732
 							break;
733 733
 
734 734
 					} 	// end switch $what
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
 			} 	// end foreach $inputs_to_clean
737 737
 
738 738
 		} else {
739
-			EE_Error::add_error( __('The event id provided was not valid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
739
+			EE_Error::add_error(__('The event id provided was not valid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
740 740
 			return FALSE;
741 741
 		}
742 742
 
@@ -754,28 +754,28 @@  discard block
 block discarded – undo
754 754
 	 * @param int       $qty
755 755
 	 * @return TRUE on success, FALSE on fail
756 756
 	 */
757
-	private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) {
758
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
757
+	private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) {
758
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
759 759
 		// get the number of spaces left for this datetime ticket
760
-		$available_spaces = self::_ticket_datetime_availability( $ticket );
760
+		$available_spaces = self::_ticket_datetime_availability($ticket);
761 761
 		// compare available spaces against the number of tickets being purchased
762
-		if ( $available_spaces >= $qty ) {
762
+		if ($available_spaces >= $qty) {
763 763
 			// allow addons to prevent a ticket from being added to cart
764
-			if ( ! apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces ) ) {
764
+			if ( ! apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces)) {
765 765
 				return false;
766 766
 			}
767 767
 			// add event to cart
768
-			if( EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) {
769
-				self::_recalculate_ticket_datetime_availability( $ticket, $qty );
768
+			if (EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) {
769
+				self::_recalculate_ticket_datetime_availability($ticket, $qty);
770 770
 				return true;
771 771
 			} else {
772 772
 				return false;
773 773
 			}
774 774
 		} else {
775 775
 			// tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets
776
-			$available_spaces = self::_ticket_datetime_availability( $ticket, true );
776
+			$available_spaces = self::_ticket_datetime_availability($ticket, true);
777 777
 			// greedy greedy greedy eh?
778
-			if ( $available_spaces > 0 ) {
778
+			if ($available_spaces > 0) {
779 779
 				// 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
780 780
 				EE_Error::add_error(
781 781
 					sprintf(
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 					__FILE__, __FUNCTION__, __LINE__
792 792
 				);
793 793
 			} else {
794
-				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__ );
794
+				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__);
795 795
 			}
796 796
 			return false;
797 797
 		}
@@ -809,22 +809,22 @@  discard block
 block discarded – undo
809 809
 	 * @param 	bool         $get_original_ticket_spaces
810 810
 	 * @return 	int
811 811
 	 */
812
-	private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) {
812
+	private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) {
813 813
 		// if the $_available_spaces array has not been set up yet...
814
-		if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
815
-				self::_set_initial_ticket_datetime_availability( $ticket );
814
+		if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
815
+				self::_set_initial_ticket_datetime_availability($ticket);
816 816
 		}
817 817
 		$available_spaces = $ticket->qty() - $ticket->sold();
818
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
818
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
819 819
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
820
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
820
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
821 821
 				// if we want the original datetime availability BEFORE we started subtracting tickets ?
822
-				if ( $get_original_ticket_spaces ) {
822
+				if ($get_original_ticket_spaces) {
823 823
 					// then grab the available spaces from the "tickets" array and compare with the above to get the lowest number
824
-					$available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] );
824
+					$available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]);
825 825
 				} else {
826 826
 					// we want the updated ticket availability as stored in the "datetimes" array
827
-					$available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] );
827
+					$available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]);
828 828
 				}
829 829
 			}
830 830
 		}
@@ -840,23 +840,23 @@  discard block
 block discarded – undo
840 840
 	 * @param 	EE_Ticket $ticket
841 841
 	 * @return 	int
842 842
 	 */
843
-	private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) {
843
+	private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) {
844 844
 		// first, get all of the datetimes that are available to this ticket
845 845
 		$datetimes = $ticket->get_many_related(
846 846
 			'Datetime',
847
-			array( array( 'DTT_EVT_end' => array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' ))
847
+			array(array('DTT_EVT_end' => array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))), 'order_by' => array('DTT_EVT_start' => 'ASC'))
848 848
 		);
849
-		if ( ! empty( $datetimes )) {
849
+		if ( ! empty($datetimes)) {
850 850
 			// now loop thru all of the datetimes
851
-			foreach ( $datetimes as $datetime  ) {
852
-				if ( $datetime instanceof EE_Datetime ) {
851
+			foreach ($datetimes as $datetime) {
852
+				if ($datetime instanceof EE_Datetime) {
853 853
 					// the number of spaces available for the datetime without considering individual ticket quantities
854 854
 					$spaces_remaining = $datetime->spaces_remaining();
855 855
 					// 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
856
-					self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining );
856
+					self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining);
857 857
 					// if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number,
858 858
 					// else just take the datetime spaces remaining, and assign to the datetimes array
859
-					self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining;
859
+					self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining;
860 860
 				}
861 861
 			}
862 862
 		}
@@ -872,12 +872,12 @@  discard block
 block discarded – undo
872 872
 	 * @param 	int   $qty
873 873
 	 * @return 	int
874 874
 	 */
875
-	private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) {
876
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
875
+	private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) {
876
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
877 877
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
878
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
878
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
879 879
 				// subtract the qty of selected tickets from each datetime's available spaces this ticket has access to,
880
-				self::$_available_spaces['datetimes'][ $DTD_ID ] = self::$_available_spaces['datetimes'][ $DTD_ID ] - $qty;
880
+				self::$_available_spaces['datetimes'][$DTD_ID] = self::$_available_spaces['datetimes'][$DTD_ID] - $qty;
881 881
 			}
882 882
 		}
883 883
 	}
@@ -894,8 +894,8 @@  discard block
 block discarded – undo
894 894
 	*/
895 895
 	public static function load_tckt_slctr_assets() {
896 896
 		// add some style
897
-		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
898
-			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css');
897
+		if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) {
898
+			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css');
899 899
 			wp_enqueue_style('ticket_selector');
900 900
 			// make it dance
901 901
 			//			wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE);
@@ -909,9 +909,9 @@  discard block
 block discarded – undo
909 909
 
910 910
 	public static function load_tckt_slctr_assets_admin() {
911 911
 		//iframe button js on admin event editor page
912
-		if ( EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit' ) {
913
-			wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true );
914
-			wp_enqueue_script( 'ticket_selector_embed' );
912
+		if (EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit') {
913
+			wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true);
914
+			wp_enqueue_script('ticket_selector_embed');
915 915
 		}
916 916
 	}
917 917
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/helpers/EEH_Tabbed_Content.helper.php 2 patches
Spacing   +36 added lines, -36 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
 /**
@@ -46,22 +46,22 @@  discard block
 block discarded – undo
46 46
 	 * @return string the assembled html string containing the tabbed content for display.
47 47
 	 * @throws \EE_Error
48 48
 	 */
49
-	public static function display($tabs_contents, $tabs_names = array(), $small_tabs = true, $tabs_content = TRUE ) {
49
+	public static function display($tabs_contents, $tabs_names = array(), $small_tabs = true, $tabs_content = TRUE) {
50 50
 
51 51
 		//first check if $tabs_names is not empty then the count must match the count of $tabs_content otherwise we've got a problem houston
52
-		if ( !empty( $tabs_names) && ( count( (array) $tabs_names) != count( (array) $tabs_content) ) ) {
53
-			throw new EE_Error( __('The count for $tabs_names and $tabs_content does not match.', 'event_espresso') );
52
+		if ( ! empty($tabs_names) && (count((array) $tabs_names) != count((array) $tabs_content))) {
53
+			throw new EE_Error(__('The count for $tabs_names and $tabs_content does not match.', 'event_espresso'));
54 54
 		}
55 55
 
56 56
 		//make sure we've got incoming data setup properly
57
-		$tabs = !empty( $tabs_names ) ? (array) $tabs_names : array_keys( (array) $tabs_contents );
58
-		$tabs_content = !empty( $tabs_names ) ? array_combine( (array) $tabs_names, (array) $tabs_content ) : $tabs_contents;
57
+		$tabs = ! empty($tabs_names) ? (array) $tabs_names : array_keys((array) $tabs_contents);
58
+		$tabs_content = ! empty($tabs_names) ? array_combine((array) $tabs_names, (array) $tabs_content) : $tabs_contents;
59 59
 
60
-		$all_tabs = '<h2 class="nav-tab-wrapper">' . "\n";
60
+		$all_tabs = '<h2 class="nav-tab-wrapper">'."\n";
61 61
 		$all_tabs_content = '';
62 62
 
63 63
 		$index = 0;
64
-		foreach ( $tabs as $tab ) {
64
+		foreach ($tabs as $tab) {
65 65
 			$active = $index === 0 ? true : false;
66 66
 			$all_tabs .= self::tab($tab, $active);
67 67
 			$all_tabs_content .= self::tab_content($tab, $tabs_content[$tab], $active);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
 		$tab_container_class = $small_tabs ? 'ee-nav-tabs ee-nav-tabs-small' : 'ee-nav-tabs';
80 80
 
81
-		return '<div class="'. $tab_container_class . '">' . "\n\t" . $all_tabs . $all_tabs_content . "\n" . '</div>';
81
+		return '<div class="'.$tab_container_class.'">'."\n\t".$all_tabs.$all_tabs_content."\n".'</div>';
82 82
 	}
83 83
 
84 84
 
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
 	 * @throws \EE_Error
103 103
 	 */
104 104
 	public static function display_admin_nav_tabs($nav_tabs = array()) {
105
-		if ( empty($nav_tabs) )
106
-			throw new EE_Error( __('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso' ) );
105
+		if (empty($nav_tabs))
106
+			throw new EE_Error(__('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso'));
107 107
 
108
-		$all_tabs = '<h2 class="nav-tab-wrapper">' . "\n";
109
-		foreach ( $nav_tabs as $slug => $tab ) {
108
+		$all_tabs = '<h2 class="nav-tab-wrapper">'."\n";
109
+		foreach ($nav_tabs as $slug => $tab) {
110 110
 			$all_tabs .= self::tab($slug, false, $tab['link_text'], $tab['url'], $tab['css_class']);
111 111
 		}
112 112
 		$all_tabs .= '</h2>';
@@ -122,13 +122,13 @@  discard block
 block discarded – undo
122 122
 	 * @param bool|string $css If string given then the generated tab will include that as the class.
123 123
 	 * @return string          html for tab
124 124
 	 */
125
-	private static function tab($name, $active = false, $nice_name = FALSE, $url = FALSE, $css = FALSE ) {
125
+	private static function tab($name, $active = false, $nice_name = FALSE, $url = FALSE, $css = FALSE) {
126 126
 		$name = str_replace(' ', '-', $name);
127 127
 		$class = $active ? 'nav-tab nav-tab-active' : 'nav-tab';
128
-		$class = $css ? $class . ' ' . $css : $class;
129
-		$nice_name = $nice_name ? $nice_name : ucwords( preg_replace('/(-|_)/', ' ', $name) );
130
-		$url = $url ? $url : '#' . $name;
131
-		$tab = '<a class="' . $class . '" rel="ee-tab-' . $name . '" href="' . $url . '">' . $nice_name . '</a>' . "\n\t";
128
+		$class = $css ? $class.' '.$css : $class;
129
+		$nice_name = $nice_name ? $nice_name : ucwords(preg_replace('/(-|_)/', ' ', $name));
130
+		$url = $url ? $url : '#'.$name;
131
+		$tab = '<a class="'.$class.'" rel="ee-tab-'.$name.'" href="'.$url.'">'.$nice_name.'</a>'."\n\t";
132 132
 		return $tab;
133 133
 	}
134 134
 
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	private static function tab_content($name, $tab_content, $active = false) {
146 146
 		$class = $active ? 'nav-tab-content' : 'nav-tab-content hidden';
147
-		$name = str_replace( ' ', '-', $name);
148
-		$content = "\t" . '<div class="'. $class . '" id="ee-tab-' . $name . '">' . "\n";
149
-		$content .= "\t" . $tab_content . "\n";
147
+		$name = str_replace(' ', '-', $name);
148
+		$content = "\t".'<div class="'.$class.'" id="ee-tab-'.$name.'">'."\n";
149
+		$content .= "\t".$tab_content."\n";
150 150
 		$content .= '<div style="clear:both"></div></div>';
151 151
 		return $content;
152 152
 	}
@@ -172,9 +172,9 @@  discard block
 block discarded – undo
172 172
 	 * @param string $default 			You can include a string for the item that will receive the "item_display" class for the js.
173 173
 	 * @return string                  a html snippet of of all the formatted link elements.
174 174
 	 */
175
-	public static function tab_text_links( $item_array, $container_class = '', $sep = '|', $default = '' ) {
176
-		$item_array = apply_filters( 'FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class );
177
-		if ( !is_array($item_array) || empty( $item_array ) )
175
+	public static function tab_text_links($item_array, $container_class = '', $sep = '|', $default = '') {
176
+		$item_array = apply_filters('FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class);
177
+		if ( ! is_array($item_array) || empty($item_array))
178 178
 			return false; //get out we don't have even the basic thing we need!
179 179
 
180 180
 
@@ -185,15 +185,15 @@  discard block
 block discarded – undo
185 185
 			'title' => esc_attr__('Link for Item', 'event_espresso'),
186 186
 			'slug' => 'item_slug'
187 187
 		);
188
-		$container_class = !empty($container_class) ? 'ee-text-links ' . $container_class : 'ee-text-links';
189
-		$list = '<ul class="' . $container_class . '">';
188
+		$container_class = ! empty($container_class) ? 'ee-text-links '.$container_class : 'ee-text-links';
189
+		$list = '<ul class="'.$container_class.'">';
190 190
 
191 191
 		$ci = 1;
192
-		foreach ( $item_array as $item ) {
193
-			$item = wp_parse_args( $item, $defaults );
194
-			$item['class'] = !empty($default) && $default == $item['slug'] ? 'item_display ' . $item['class'] : $item['class'];
192
+		foreach ($item_array as $item) {
193
+			$item = wp_parse_args($item, $defaults);
194
+			$item['class'] = ! empty($default) && $default == $item['slug'] ? 'item_display '.$item['class'] : $item['class'];
195 195
 			$list .= self::_text_link_item($item);
196
-			if ( !empty($sep) && $ci != count($item_array) )
196
+			if ( ! empty($sep) && $ci != count($item_array))
197 197
 				$list .= self::_text_link_item($sep);
198 198
 			$ci++;
199 199
 		}
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
 
205 205
 
206 206
 
207
-	private static function _text_link_item( $item ) {
207
+	private static function _text_link_item($item) {
208 208
 		//if this isn't an array then we're doing a separator
209
-		if ( !is_array( $item ) ) {
209
+		if ( ! is_array($item)) {
210 210
 			$label = $item;
211 211
 			$class = 'ee-text-link-sep';
212 212
 			$href = '';
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
 			extract($item);
216 216
 		}
217 217
 
218
-		$class = $class != 'ee-text-link-sep'  ? 'class="ee-text-link-li ' . $class . '"' : 'class="ee-text-link-sep"';
218
+		$class = $class != 'ee-text-link-sep' ? 'class="ee-text-link-li '.$class.'"' : 'class="ee-text-link-sep"';
219 219
 
220
-		$content = '<li ' . $class . '>';
221
-		$content .= !empty($href) ? '<a class="ee-text-link" href="#' . $href . '" title="' . $title . '">' : '';
220
+		$content = '<li '.$class.'>';
221
+		$content .= ! empty($href) ? '<a class="ee-text-link" href="#'.$href.'" title="'.$title.'">' : '';
222 222
 		$content .= $label;
223
-		$content .= !empty($href) ? '</a>' : '';
223
+		$content .= ! empty($href) ? '</a>' : '';
224 224
 		$content .= '</li>';
225 225
 		return $content;
226 226
 	}
Please login to merge, or discard this patch.
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -102,8 +103,9 @@  discard block
 block discarded – undo
102 103
 	 * @throws \EE_Error
103 104
 	 */
104 105
 	public static function display_admin_nav_tabs($nav_tabs = array()) {
105
-		if ( empty($nav_tabs) )
106
-			throw new EE_Error( __('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso' ) );
106
+		if ( empty($nav_tabs) ) {
107
+					throw new EE_Error( __('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso' ) );
108
+		}
107 109
 
108 110
 		$all_tabs = '<h2 class="nav-tab-wrapper">' . "\n";
109 111
 		foreach ( $nav_tabs as $slug => $tab ) {
@@ -174,8 +176,10 @@  discard block
 block discarded – undo
174 176
 	 */
175 177
 	public static function tab_text_links( $item_array, $container_class = '', $sep = '|', $default = '' ) {
176 178
 		$item_array = apply_filters( 'FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class );
177
-		if ( !is_array($item_array) || empty( $item_array ) )
178
-			return false; //get out we don't have even the basic thing we need!
179
+		if ( !is_array($item_array) || empty( $item_array ) ) {
180
+					return false;
181
+		}
182
+		//get out we don't have even the basic thing we need!
179 183
 
180 184
 
181 185
 		$defaults = array(
@@ -193,8 +197,9 @@  discard block
 block discarded – undo
193 197
 			$item = wp_parse_args( $item, $defaults );
194 198
 			$item['class'] = !empty($default) && $default == $item['slug'] ? 'item_display ' . $item['class'] : $item['class'];
195 199
 			$list .= self::_text_link_item($item);
196
-			if ( !empty($sep) && $ci != count($item_array) )
197
-				$list .= self::_text_link_item($sep);
200
+			if ( !empty($sep) && $ci != count($item_array) ) {
201
+							$list .= self::_text_link_item($sep);
202
+			}
198 203
 			$ci++;
199 204
 		}
200 205
 
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_8_0.dms.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -715,7 +715,7 @@
 block discarded – undo
715 715
 				}
716 716
 			}
717 717
 		}
718
-        }
718
+		}
719 719
 	/**
720 720
 	 * addresses https://events.codebasehq.com/projects/event-espresso/tickets/8731
721 721
 	 * which should just be a temporary issue for folks who installed 4.8.0-4.8.5;
Please login to merge, or discard this patch.
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@  discard block
 block discarded – undo
13 13
 //(all other times it gets resurrected from a wordpress option)
14 14
 $stages = glob(EE_CORE.'data_migration_scripts/4_8_0_stages/*');
15 15
 $class_to_filepath = array();
16
-foreach($stages as $filepath){
16
+foreach ($stages as $filepath) {
17 17
 	$matches = array();
18
-	preg_match('~4_8_0_stages/(.*).dmsstage.php~',$filepath,$matches);
18
+	preg_match('~4_8_0_stages/(.*).dmsstage.php~', $filepath, $matches);
19 19
 	$class_to_filepath[$matches[1]] = $filepath;
20 20
 }
21 21
 //give addons a chance to autoload their stages too
22
-$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages',$class_to_filepath);
22
+$class_to_filepath = apply_filters('FHEE__EE_DMS_4_8_0__autoloaded_stages', $class_to_filepath);
23 23
 EEH_Autoloader::register_autoloader($class_to_filepath);
24 24
 
25 25
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
  * @since                4.6.0
36 36
  *
37 37
  */
38
-class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base{
38
+class EE_DMS_Core_4_8_0 extends EE_Data_Migration_Script_Base {
39 39
 
40 40
 	/**
41 41
 	 * return EE_DMS_Core_4_8_0
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public function can_migrate_from_version($version_array) {
64 64
 		$version_string = $version_array['Core'];
65
-		if( $version_string <= '4.8.0' && $version_string >= '4.7.0' ){
65
+		if ($version_string <= '4.8.0' && $version_string >= '4.7.0') {
66 66
 //			echo "$version_string can be migrated from";
67 67
 			return true;
68
-		}elseif( ! $version_string ){
68
+		}elseif ( ! $version_string) {
69 69
 //			echo "no version string provided: $version_string";
70 70
 			//no version string provided... this must be pre 4.3
71
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
72
-		}else{
71
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
72
+		} else {
73 73
 //			echo "$version_string doesnt apply";
74 74
 			return false;
75 75
 		}
@@ -90,18 +90,18 @@  discard block
 block discarded – undo
90 90
 	 * @return bool
91 91
 	 */
92 92
 	public function schema_changes_before_migration() {
93
-		$now_in_mysql = current_time( 'mysql', true );
93
+		$now_in_mysql = current_time('mysql', true);
94 94
 
95
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
96
-		$table_name='esp_answer';
97
-		$sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
95
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
96
+		$table_name = 'esp_answer';
97
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
98 98
 					REG_ID INT UNSIGNED NOT NULL,
99 99
 					QST_ID INT UNSIGNED NOT NULL,
100 100
 					ANS_value TEXT NOT NULL,
101 101
 					PRIMARY KEY  (ANS_ID),
102 102
 					KEY REG_ID (REG_ID),
103 103
 					KEY QST_ID (QST_ID)";
104
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
104
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
105 105
 
106 106
 		$table_name = 'esp_attendee_meta';
107 107
 		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
142 142
 					  CNT_active TINYINT(1) DEFAULT '0',
143 143
 					  PRIMARY KEY  (CNT_ISO)";
144
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
144
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
145 145
 
146 146
 		$table_name = 'esp_currency';
147 147
 		$sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 				CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2',
152 152
 				CUR_active TINYINT(1) DEFAULT '0',
153 153
 				PRIMARY KEY  (CUR_code)";
154
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
154
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
155 155
 
156 156
 
157 157
 		$table_name = 'esp_currency_payment_method';
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 						KEY EVT_ID (EVT_ID),
182 182
 						KEY DTT_is_primary (DTT_is_primary)";
183 183
 
184
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
184
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
185 185
 
186 186
 		$table_name = 'esp_event_meta';
187 187
 		$sql = "
@@ -200,41 +200,41 @@  discard block
 block discarded – undo
200 200
 			EVT_donations TINYINT(1) NULL,
201 201
 			PRIMARY KEY  (EVTM_ID),
202 202
 			KEY EVT_ID (EVT_ID)";
203
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
203
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
204 204
 
205 205
 
206 206
 
207
-		$table_name='esp_event_question_group';
208
-		$sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
207
+		$table_name = 'esp_event_question_group';
208
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
209 209
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
210 210
 					QSG_ID INT UNSIGNED NOT NULL,
211 211
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
212 212
 					PRIMARY KEY  (EQG_ID),
213 213
 					KEY EVT_ID (EVT_ID),
214 214
 					KEY QSG_ID (QSG_ID)";
215
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
215
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
216 216
 
217 217
 
218 218
 
219
-		$table_name='esp_event_venue';
220
-		$sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
219
+		$table_name = 'esp_event_venue';
220
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
221 221
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
222 222
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
223 223
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
224 224
 				PRIMARY KEY  (EVV_ID)";
225
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
225
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
226 226
 
227 227
 
228 228
 
229
-		$table_name='esp_extra_meta';
230
-		$sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
229
+		$table_name = 'esp_extra_meta';
230
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
231 231
 				OBJ_ID INT(11) DEFAULT NULL,
232 232
 				EXM_type VARCHAR(45) DEFAULT NULL,
233 233
 				EXM_key VARCHAR(45) DEFAULT NULL,
234 234
 				EXM_value TEXT,
235 235
 				PRIMARY KEY  (EXM_ID),
236 236
 				KEY EXM_type (EXM_type,OBJ_ID,EXM_key)";
237
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
237
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
238 238
 
239 239
 		$table_name = 'esp_extra_join';
240 240
 		$sql = "EXJ_ID INT(11) NOT NULL AUTO_INCREMENT,
@@ -247,8 +247,8 @@  discard block
 block discarded – undo
247 247
 				KEY second_model (EXJ_second_model_name,EXJ_second_model_id)";
248 248
 		$this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB ');
249 249
 
250
-		$table_name='esp_line_item';
251
-		$sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
250
+		$table_name = 'esp_line_item';
251
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
252 252
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
253 253
 				TXN_ID INT(11) DEFAULT NULL,
254 254
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 				PRIMARY KEY  (LIN_ID),
268 268
 				KEY LIN_code (LIN_code(191)),
269 269
 				KEY TXN_ID (TXN_ID)";
270
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB' );
270
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
271 271
 
272 272
 		$table_name = 'esp_log';
273 273
 		$sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
307 307
 					PRIMARY KEY  (GRP_ID),
308 308
 					KEY MTP_user_id (MTP_user_id)";
309
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
309
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
310 310
 
311 311
 		$table_name = 'esp_event_message_template';
312 312
 		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 					PRIMARY KEY  (EMT_ID),
316 316
 					KEY EVT_ID (EVT_ID),
317 317
 					KEY GRP_ID (GRP_ID)";
318
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
318
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
319 319
 
320 320
 
321 321
 		$table_name = 'esp_payment';
@@ -388,8 +388,8 @@  discard block
 block discarded – undo
388 388
 					  PRIMARY KEY  (TTM_ID)";
389 389
 		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
390 390
 
391
-		$table_name='esp_question';
392
-		$sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
391
+		$table_name = 'esp_question';
392
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
393 393
 					QST_display_text TEXT NOT NULL,
394 394
 					QST_admin_label VARCHAR(255) NOT NULL,
395 395
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -403,22 +403,22 @@  discard block
 block discarded – undo
403 403
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
404 404
 					PRIMARY KEY  (QST_ID),
405 405
 					KEY QST_order (QST_order)';
406
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
406
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
407 407
 
408
-		$table_name='esp_question_group_question';
409
-		$sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
408
+		$table_name = 'esp_question_group_question';
409
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
410 410
 					QSG_ID INT UNSIGNED NOT NULL,
411 411
 					QST_ID INT UNSIGNED NOT NULL,
412 412
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
413 413
 					PRIMARY KEY  (QGQ_ID),
414 414
 					KEY QST_ID (QST_ID),
415 415
 					KEY QSG_ID_order (QSG_ID,QGQ_order)";
416
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
416
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
417 417
 
418 418
 
419 419
 
420
-		$table_name='esp_question_option';
421
-		$sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
420
+		$table_name = 'esp_question_option';
421
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
422 422
 					QSO_value VARCHAR(255) NOT NULL,
423 423
 					QSO_desc TEXT NOT NULL,
424 424
 					QST_ID INT UNSIGNED NOT NULL,
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 					PRIMARY KEY  (QSO_ID),
429 429
 					KEY QST_ID (QST_ID),
430 430
 					KEY QSO_order (QSO_order)";
431
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
431
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
432 432
 
433 433
 
434 434
 
@@ -474,8 +474,8 @@  discard block
 block discarded – undo
474 474
 
475 475
 
476 476
 
477
-		$table_name='esp_checkin';
478
-		$sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
477
+		$table_name = 'esp_checkin';
478
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
479 479
 					REG_ID INT(10) UNSIGNED NOT NULL,
480 480
 					DTT_ID INT(10) UNSIGNED NOT NULL,
481 481
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
571 571
 					  PRIMARY KEY  (PRC_ID),
572 572
 					  KEY PRT_ID (PRT_ID)";
573
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
573
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
574 574
 
575 575
 		$table_name = "esp_price_type";
576 576
 		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -608,10 +608,10 @@  discard block
 block discarded – undo
608 608
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
609 609
 					  PRIMARY KEY  (TKT_ID),
610 610
 					  KEY TKT_start_date (TKT_start_date)";
611
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
611
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
612 612
 
613 613
 		$table_name = 'esp_question_group';
614
-		$sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
614
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
615 615
 					QSG_name VARCHAR(255) NOT NULL,
616 616
 					QSG_identifier VARCHAR(100) NOT NULL,
617 617
 					QSG_desc TEXT NULL,
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 					PRIMARY KEY  (QSG_ID),
625 625
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
626 626
 					KEY QSG_order (QSG_order)';
627
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
627
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
628 628
 
629 629
 		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
630 630
 		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 		return $script_4_7_defaults->schema_changes_after_migration();
661 661
 	}
662 662
 
663
-	public function migration_page_hooks(){
663
+	public function migration_page_hooks() {
664 664
 
665 665
 	}
666 666
 	
@@ -674,19 +674,19 @@  discard block
 block discarded – undo
674 674
 		//CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active
675 675
 		//('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0),
676 676
 		$newer_countries = array(
677
-			array( 'AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0 ),
678
-			array( 'BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ),
679
-			array( 'CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0 ),
680
-			array( 'GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0 ),
681
-			array( 'IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2,  '+44', 0, 0  ),
682
-			array( 'JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ),
683
-			array( 'MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ),
684
-			array( 'MN', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1,  2, '+382', 0, 0 ),
685
-			array( 'RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0 ),
686
-			array( 'SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0 ),
687
-			array( 'SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0 ),
688
-			array( 'XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0 ),
689
-			array( 'YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0 ),
677
+			array('AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0),
678
+			array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
679
+			array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0),
680
+			array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0),
681
+			array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
682
+			array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
683
+			array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
684
+			array('MN', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0),
685
+			array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0),
686
+			array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0),
687
+			array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0),
688
+			array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0),
689
+			array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0),
690 690
 		);
691 691
 		global $wpdb;
692 692
 		$country_table = $wpdb->prefix."esp_country";
@@ -705,14 +705,14 @@  discard block
 block discarded – undo
705 705
 							"CNT_is_EU" => '%d',
706 706
 							"CNT_active" => '%d',
707 707
 						);
708
-		if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $country_table . "'") == $country_table ) {
709
-			foreach( $newer_countries as $country ) {
710
-				$SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1" ;
708
+		if ($wpdb->get_var("SHOW TABLES LIKE '".$country_table."'") == $country_table) {
709
+			foreach ($newer_countries as $country) {
710
+				$SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1";
711 711
 				$countries = $wpdb->get_var($SQL);
712
-				if ( ! $countries ) {
712
+				if ( ! $countries) {
713 713
 
714
-					$wpdb->insert( $country_table,
715
-							array_combine( array_keys( $country_format), $country ),
714
+					$wpdb->insert($country_table,
715
+							array_combine(array_keys($country_format), $country),
716 716
 							$country_format
717 717
 							);
718 718
 				}
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 		// CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active
731 731
 		//( 'EUR',  'Euro',  'Euros',  '€',  2,1),
732 732
 		$newer_currencies = array(
733
-			array( 'RSD', 'Dinar', 'Dinars', '', 3, 1 ),
733
+			array('RSD', 'Dinar', 'Dinars', '', 3, 1),
734 734
 		);
735 735
 		global $wpdb;
736 736
 		$currency_table = $wpdb->prefix."esp_currency";
@@ -742,14 +742,14 @@  discard block
 block discarded – undo
742 742
 							"CUR_dec_plc" => '%d',
743 743
 							"CUR_active" => '%d',
744 744
 						);
745
-		if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $currency_table . "'") == $currency_table ) {
746
-			foreach( $newer_currencies as $currency ) {
747
-				$SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1" ;
745
+		if ($wpdb->get_var("SHOW TABLES LIKE '".$currency_table."'") == $currency_table) {
746
+			foreach ($newer_currencies as $currency) {
747
+				$SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1";
748 748
 				$countries = $wpdb->get_var($SQL);
749
-				if ( ! $countries ) {
749
+				if ( ! $countries) {
750 750
 
751
-					$wpdb->insert( $currency_table,
752
-							array_combine( array_keys( $currency_format), $currency ),
751
+					$wpdb->insert($currency_table,
752
+							array_combine(array_keys($currency_format), $currency),
753 753
 							$currency_format
754 754
 							);
755 755
 				}
@@ -761,9 +761,9 @@  discard block
 block discarded – undo
761 761
 	 * which should just be a temporary issue for folks who installed 4.8.0-4.8.5;
762 762
 	 * we should be able to stop doing this in 4.9
763 763
 	 */
764
-	public function fix_non_default_taxes(){
764
+	public function fix_non_default_taxes() {
765 765
 		global $wpdb;
766
-		$query = $wpdb->prepare( "UPDATE
766
+		$query = $wpdb->prepare("UPDATE
767 767
 				{$wpdb->prefix}esp_price p INNER JOIN
768 768
 				{$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID
769 769
 			SET
@@ -771,8 +771,8 @@  discard block
 block discarded – undo
771 771
 			WHERE
772 772
 				p.PRC_is_default = 0 AND
773 773
 				pt.PBT_ID = %d
774
-					", EEM_Price_Type::base_type_tax );
775
-		$wpdb->query( $query );
774
+					", EEM_Price_Type::base_type_tax);
775
+		$wpdb->query($query);
776 776
 	}
777 777
 }
778 778
 
Please login to merge, or discard this patch.
registrations/templates/attendee_registrations_main_meta_box.template.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -5,42 +5,42 @@
 block discarded – undo
5 5
 		<table class="admin-primary-mbox-tbl">
6 6
 			<thead>
7 7
 				<tr>
8
-					<th class="jst-left"><?php esc_html_e( 'Event Name', 'event_espresso' );?></th>
9
-					<th class="jst-left"><?php esc_html_e( 'REG ID', 'event_espresso' );?></th>
10
-					<th class="jst-left"><?php esc_html_e( 'TXN ID', 'event_espresso' );?></th>
11
-					<th class="jst-left"><?php esc_html_e( 'Reg Code', 'event_espresso' );?></th>
12
-					<th class="jst-rght"><?php esc_html_e( 'Ticket Price', 'event_espresso' );?></th>
8
+					<th class="jst-left"><?php esc_html_e('Event Name', 'event_espresso'); ?></th>
9
+					<th class="jst-left"><?php esc_html_e('REG ID', 'event_espresso'); ?></th>
10
+					<th class="jst-left"><?php esc_html_e('TXN ID', 'event_espresso'); ?></th>
11
+					<th class="jst-left"><?php esc_html_e('Reg Code', 'event_espresso'); ?></th>
12
+					<th class="jst-rght"><?php esc_html_e('Ticket Price', 'event_espresso'); ?></th>
13 13
 				</tr>
14 14
 			</thead>
15 15
 			<tbody>
16
-			<?php foreach( $registrations as $registration ) : ?>
16
+			<?php foreach ($registrations as $registration) : ?>
17 17
 				<tr>
18 18
 					<td class="jst-left">
19 19
 					<?php
20
-						$event_url = add_query_arg( array( 'action' => 'edit', 'post' => $registration->event_ID() ), admin_url( 'admin.php?page=espresso_events' ));
21
-						echo EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $registration->event_ID() ) ?  '<a href="'. $event_url .'"  title="'. esc_attr__( 'Edit Event', 'event_espresso' ) .'">' . $registration->event_name() . '</a>' : $registration->event_name();
20
+						$event_url = add_query_arg(array('action' => 'edit', 'post' => $registration->event_ID()), admin_url('admin.php?page=espresso_events'));
21
+						echo EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $registration->event_ID()) ? '<a href="'.$event_url.'"  title="'.esc_attr__('Edit Event', 'event_espresso').'">'.$registration->event_name().'</a>' : $registration->event_name();
22 22
 					?>
23 23
 					</td>
24 24
 					<td class="jst-left">
25 25
 					<?php
26
-							$reg_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL );
27
-							echo EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $registration->ID() ) ? '
28
-							<a href="'.$reg_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . 
29
-								esc_html__( 'View Registration', 'event_espresso' ) .
26
+							$reg_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL);
27
+							echo EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $registration->ID()) ? '
28
+							<a href="'.$reg_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'. 
29
+								esc_html__('View Registration', 'event_espresso').
30 30
 							'</a>' : $registration->ID();
31 31
 					?>
32 32
 					</td>
33 33
 					<td class="jst-left">
34 34
 					<?php
35
-						$txn_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$registration->transaction_ID() ), TXN_ADMIN_URL );
36
-						echo EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? '
37
-						<a href="'.$txn_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '">' .
38
-							sprintf( esc_html__('View Transaction %d', 'event_espresso'), $registration->transaction_ID() ) .
35
+						$txn_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$registration->transaction_ID()), TXN_ADMIN_URL);
36
+						echo EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '
37
+						<a href="'.$txn_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'">'.
38
+							sprintf(esc_html__('View Transaction %d', 'event_espresso'), $registration->transaction_ID()).
39 39
 						'</a>' : $registration->transaction_ID();
40 40
 					?>
41 41
 					</td>
42
-					<td class="jst-left"><?php echo $registration->reg_code();?></td>
43
-					<td class="jst-rght"><?php echo EEH_Template::format_currency( $registration->final_price() );?></td>
42
+					<td class="jst-left"><?php echo $registration->reg_code(); ?></td>
43
+					<td class="jst-rght"><?php echo EEH_Template::format_currency($registration->final_price()); ?></td>
44 44
 				</tr>
45 45
 			<?php endforeach; ?>
46 46
 			</tbody>
Please login to merge, or discard this patch.
core/admin/EE_Admin.core.php 2 patches
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -220,8 +222,9 @@  discard block
 block discarded – undo
220 222
 	 */
221 223
 	public function remove_pages_from_nav_menu( $post_type ) {
222 224
 		//if this isn't the "pages" post type let's get out
223
-		if ( $post_type->name !== 'page' )
224
-			return $post_type;
225
+		if ( $post_type->name !== 'page' ) {
226
+					return $post_type;
227
+		}
225 228
 
226 229
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
227 230
 
@@ -296,8 +299,9 @@  discard block
 block discarded – undo
296 299
 	 * @return string  the (maybe) modified link
297 300
 	 */
298 301
 	public function modify_edit_post_link( $link, $id, $context ) {
299
-		if ( ! $post = get_post( $id ) )
300
-			return $link;
302
+		if ( ! $post = get_post( $id ) ) {
303
+					return $link;
304
+		}
301 305
 
302 306
 		if ( $post->post_type == 'espresso_attendees' ) {
303 307
 			$query_args = array(
@@ -337,7 +341,10 @@  discard block
 block discarded – undo
337 341
 		<div id="posttype-extra-nav-menu-pages" class="posttypediv">
338 342
 			<ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs">
339 343
 				<li <?php echo ( 'event-archives' == $current_tab ? ' class="tabs"' : '' ); ?>>
340
-					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
344
+					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) {
345
+	echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args)));
346
+}
347
+?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
341 348
 						<?php _e( 'Event Archive Pages', 'event_espresso' ); ?>
342 349
 					</a>
343 350
 				</li>
@@ -870,8 +877,9 @@  discard block
 block discarded – undo
870 877
 	 */
871 878
 	public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) {
872 879
 		EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated.  Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' );
873
-		if ( class_exists( 'EE_Register_Admin_Page' ) )
874
-			$config['page_path'] = $page_path;
880
+		if ( class_exists( 'EE_Register_Admin_Page' ) ) {
881
+					$config['page_path'] = $page_path;
882
+		}
875 883
 			EE_Register_Admin_Page::register( $page_basename, $config );
876 884
 	}
877 885
 
Please login to merge, or discard this patch.
Spacing   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public static function instance() {
49 49
 		// check if class object is instantiated
50
-		if (  ! self::$_instance instanceof EE_Admin ) {
50
+		if ( ! self::$_instance instanceof EE_Admin) {
51 51
 			self::$_instance = new self();
52 52
 		}
53 53
 		return self::$_instance;
@@ -62,25 +62,25 @@  discard block
 block discarded – undo
62 62
 		// define global EE_Admin constants
63 63
 		$this->_define_all_constants();
64 64
 		// set autoloaders for our admin page classes based on included path information
65
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_ADMIN );
65
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_ADMIN);
66 66
 		// admin hooks
67
-		add_filter( 'plugin_action_links', array( $this, 'filter_plugin_actions' ), 10, 2 );
67
+		add_filter('plugin_action_links', array($this, 'filter_plugin_actions'), 10, 2);
68 68
 		// load EE_Request_Handler early
69
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'get_request' ));
70
-		add_action( 'AHEE__EE_System__initialize_last', array( $this, 'init' ));
71
-		add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'route_admin_request' ), 100, 2 );
72
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 100 );
73
-		add_action( 'admin_init', array( $this, 'admin_init' ), 100 );
74
-		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ), 20 );
75
-		add_action( 'admin_notices', array( $this, 'display_admin_notices' ), 10 );
76
-		add_action( 'network_admin_notices', array( $this, 'display_admin_notices' ), 10 );
77
-		add_filter( 'pre_update_option', array( $this, 'check_for_invalid_datetime_formats' ), 100, 2 );
78
-		add_filter('admin_footer_text', array( $this, 'espresso_admin_footer' ));
69
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'get_request'));
70
+		add_action('AHEE__EE_System__initialize_last', array($this, 'init'));
71
+		add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'route_admin_request'), 100, 2);
72
+		add_action('wp_loaded', array($this, 'wp_loaded'), 100);
73
+		add_action('admin_init', array($this, 'admin_init'), 100);
74
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'), 20);
75
+		add_action('admin_notices', array($this, 'display_admin_notices'), 10);
76
+		add_action('network_admin_notices', array($this, 'display_admin_notices'), 10);
77
+		add_filter('pre_update_option', array($this, 'check_for_invalid_datetime_formats'), 100, 2);
78
+		add_filter('admin_footer_text', array($this, 'espresso_admin_footer'));
79 79
 
80 80
 		//reset Environment config (we only do this on admin page loads);
81 81
 		EE_Registry::instance()->CFG->environment->recheck_values();
82 82
 
83
-		do_action( 'AHEE__EE_Admin__loaded' );
83
+		do_action('AHEE__EE_Admin__loaded');
84 84
 	}
85 85
 
86 86
 
@@ -95,12 +95,12 @@  discard block
 block discarded – undo
95 95
 	 * @return void
96 96
 	 */
97 97
 	private function _define_all_constants() {
98
-		define( 'EE_ADMIN_URL', EE_PLUGIN_DIR_URL . 'core/admin/' );
99
-		define( 'EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL . 'admin_pages/' );
100
-		define( 'EE_ADMIN_TEMPLATE', EE_ADMIN . 'templates' . DS );
101
-		define( 'WP_ADMIN_PATH', ABSPATH . 'wp-admin/' );
102
-		define( 'WP_AJAX_URL', admin_url( 'admin-ajax.php' ));
103
-		define( 'JQPLOT_URL', EE_GLOBAL_ASSETS_URL . 'scripts/jqplot/' );
98
+		define('EE_ADMIN_URL', EE_PLUGIN_DIR_URL.'core/admin/');
99
+		define('EE_ADMIN_PAGES_URL', EE_PLUGIN_DIR_URL.'admin_pages/');
100
+		define('EE_ADMIN_TEMPLATE', EE_ADMIN.'templates'.DS);
101
+		define('WP_ADMIN_PATH', ABSPATH.'wp-admin/');
102
+		define('WP_AJAX_URL', admin_url('admin-ajax.php'));
103
+		define('JQPLOT_URL', EE_GLOBAL_ASSETS_URL.'scripts/jqplot/');
104 104
 	}
105 105
 
106 106
 
@@ -113,23 +113,23 @@  discard block
 block discarded – undo
113 113
 	 * @param 	string 	$plugin
114 114
 	 * @return 	array
115 115
 	 */
116
-	public function filter_plugin_actions( $links, $plugin ) {
116
+	public function filter_plugin_actions($links, $plugin) {
117 117
 		// set $main_file in stone
118 118
 		static $main_file;
119 119
 		// if $main_file is not set yet
120
-		if ( ! $main_file ) {
121
-			$main_file = plugin_basename( EVENT_ESPRESSO_MAIN_FILE );
120
+		if ( ! $main_file) {
121
+			$main_file = plugin_basename(EVENT_ESPRESSO_MAIN_FILE);
122 122
 		}
123
-		 if ( $plugin == $main_file ) {
123
+		 if ($plugin == $main_file) {
124 124
 		 	// compare current plugin to this one
125
-			if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) {
126
-				$maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode.  Click this link to learn why.">' . __('Maintenance Mode Active', 'event_espresso' ) . '</a>';
127
-				array_unshift( $links, $maintenance_link );
125
+			if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) {
126
+				$maintenance_link = '<a href="admin.php?page=espresso_maintenance_settings" title="Event Espresso is in maintenance mode.  Click this link to learn why.">'.__('Maintenance Mode Active', 'event_espresso').'</a>';
127
+				array_unshift($links, $maintenance_link);
128 128
 			} else {
129
-				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">' . __( 'Settings', 'event_espresso' ) . '</a>';
130
-				$events_link = '<a href="admin.php?page=espresso_events">' . __( 'Events', 'event_espresso' ) . '</a>';
129
+				$org_settings_link = '<a href="admin.php?page=espresso_general_settings">'.__('Settings', 'event_espresso').'</a>';
130
+				$events_link = '<a href="admin.php?page=espresso_events">'.__('Events', 'event_espresso').'</a>';
131 131
 				// add before other links
132
-				array_unshift( $links, $org_settings_link, $events_link );
132
+				array_unshift($links, $org_settings_link, $events_link);
133 133
 			}
134 134
 		}
135 135
 		return $links;
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 	 *	@return void
145 145
 	 */
146 146
 	public function get_request() {
147
-		EE_Registry::instance()->load_core( 'Request_Handler' );
148
-		EE_Registry::instance()->load_core( 'CPT_Strategy' );
147
+		EE_Registry::instance()->load_core('Request_Handler');
148
+		EE_Registry::instance()->load_core('CPT_Strategy');
149 149
 	}
150 150
 
151 151
 
@@ -157,11 +157,11 @@  discard block
 block discarded – undo
157 157
 	 * @param array $admin_page_folder_names
158 158
 	 * @return array
159 159
 	 */
160
-	public function hide_admin_pages_except_maintenance_mode( $admin_page_folder_names = array() ){
160
+	public function hide_admin_pages_except_maintenance_mode($admin_page_folder_names = array()) {
161 161
 		return array(
162
-			'maintenance' => EE_ADMIN_PAGES . 'maintenance' . DS,
163
-			'about' => EE_ADMIN_PAGES . 'about' . DS,
164
-			'support' => EE_ADMIN_PAGES . 'support' . DS
162
+			'maintenance' => EE_ADMIN_PAGES.'maintenance'.DS,
163
+			'about' => EE_ADMIN_PAGES.'about'.DS,
164
+			'support' => EE_ADMIN_PAGES.'support'.DS
165 165
 		);
166 166
 	}
167 167
 
@@ -176,36 +176,36 @@  discard block
 block discarded – undo
176 176
 	public function init() {
177 177
 
178 178
 		//only enable most of the EE_Admin IF we're not in full maintenance mode
179
-		if ( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){
179
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
180 180
 			//ok so we want to enable the entire admin
181
-			add_action( 'wp_ajax_dismiss_ee_nag_notice', array( $this, 'dismiss_ee_nag_notice_callback' ));
182
-			add_action( 'save_post', array( 'EE_Admin', 'parse_post_content_on_save' ), 100, 2 );
183
-			add_action( 'update_option', array( $this, 'reset_page_for_posts_on_change' ), 100, 3 );
184
-			add_filter( 'content_save_pre', array( $this, 'its_eSpresso' ), 10, 1 );
185
-			add_action( 'admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
186
-			add_action( 'network_admin_notices', array( $this, 'get_persistent_admin_notices' ), 9 );
181
+			add_action('wp_ajax_dismiss_ee_nag_notice', array($this, 'dismiss_ee_nag_notice_callback'));
182
+			add_action('save_post', array('EE_Admin', 'parse_post_content_on_save'), 100, 2);
183
+			add_action('update_option', array($this, 'reset_page_for_posts_on_change'), 100, 3);
184
+			add_filter('content_save_pre', array($this, 'its_eSpresso'), 10, 1);
185
+			add_action('admin_notices', array($this, 'get_persistent_admin_notices'), 9);
186
+			add_action('network_admin_notices', array($this, 'get_persistent_admin_notices'), 9);
187 187
 			//at a glance dashboard widget
188
-			add_filter( 'dashboard_glance_items', array( $this, 'dashboard_glance_items'), 10 );
188
+			add_filter('dashboard_glance_items', array($this, 'dashboard_glance_items'), 10);
189 189
 			//filter for get_edit_post_link used on comments for custom post types
190
-			add_filter('get_edit_post_link', array( $this, 'modify_edit_post_link' ), 10, 3 );
190
+			add_filter('get_edit_post_link', array($this, 'modify_edit_post_link'), 10, 3);
191 191
 		}
192 192
 
193 193
 		// run the admin page factory but ONLY if we are doing an ee admin ajax request
194
-		if ( !defined('DOING_AJAX') || EE_ADMIN_AJAX ) {
194
+		if ( ! defined('DOING_AJAX') || EE_ADMIN_AJAX) {
195 195
 			try {
196 196
 				//this loads the controller for the admin pages which will setup routing etc
197
-				EE_Registry::instance()->load_core( 'Admin_Page_Loader' );
198
-			} catch ( EE_Error $e ) {
197
+				EE_Registry::instance()->load_core('Admin_Page_Loader');
198
+			} catch (EE_Error $e) {
199 199
 				$e->get_error();
200 200
 			}
201 201
 		}
202 202
 
203 203
 		//make sure our CPTs and custom taxonomy metaboxes get shown for first time users
204
-		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes' ), 10 );
205
-		add_action('admin_head', array( $this, 'register_custom_nav_menu_boxes' ), 10 );
204
+		add_action('admin_head', array($this, 'enable_hidden_ee_nav_menu_metaboxes'), 10);
205
+		add_action('admin_head', array($this, 'register_custom_nav_menu_boxes'), 10);
206 206
 
207 207
 		//exclude EE critical pages from all nav menus and wp_list_pages
208
-		add_filter('nav_menu_meta_box_object', array( $this, 'remove_pages_from_nav_menu'), 10 );
208
+		add_filter('nav_menu_meta_box_object', array($this, 'remove_pages_from_nav_menu'), 10);
209 209
 	}
210 210
 
211 211
 
@@ -218,9 +218,9 @@  discard block
 block discarded – undo
218 218
 	 * @param  object $post_type WP post type object
219 219
 	 * @return object            WP post type object
220 220
 	 */
221
-	public function remove_pages_from_nav_menu( $post_type ) {
221
+	public function remove_pages_from_nav_menu($post_type) {
222 222
 		//if this isn't the "pages" post type let's get out
223
-		if ( $post_type->name !== 'page' )
223
+		if ($post_type->name !== 'page')
224 224
 			return $post_type;
225 225
 
226 226
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
@@ -240,28 +240,28 @@  discard block
 block discarded – undo
240 240
 	 */
241 241
 	public function enable_hidden_ee_nav_menu_metaboxes() {
242 242
 		global $wp_meta_boxes, $pagenow;
243
-		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php' ) {
243
+		if ( ! is_array($wp_meta_boxes) || $pagenow !== 'nav-menus.php') {
244 244
 			return;
245 245
 		}
246 246
 		$user = wp_get_current_user();
247 247
 		//has this been done yet?
248
-		if ( get_user_option( 'ee_nav_menu_initialized', $user->ID ) ) {
248
+		if (get_user_option('ee_nav_menu_initialized', $user->ID)) {
249 249
 			return;
250 250
 		}
251 251
 
252
-		$hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus', $user->ID );
253
-		$initial_meta_boxes = apply_filters( 'FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array( 'nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page' ) );
252
+		$hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus', $user->ID);
253
+		$initial_meta_boxes = apply_filters('FHEE__EE_Admin__enable_hidden_ee_nav_menu_boxes__initial_meta_boxes', array('nav-menu-theme-locations', 'add-page', 'add-custom-links', 'add-category', 'add-espresso_events', 'add-espresso_venues', 'add-espresso_event_categories', 'add-espresso_venue_categories', 'add-post-type-post', 'add-post-type-page'));
254 254
 
255
-		if ( is_array( $hidden_meta_boxes ) ) {
256
-			foreach ( $hidden_meta_boxes as $key => $meta_box_id ) {
257
-				if ( in_array( $meta_box_id, $initial_meta_boxes ) ) {
258
-					unset( $hidden_meta_boxes[ $key ] );
255
+		if (is_array($hidden_meta_boxes)) {
256
+			foreach ($hidden_meta_boxes as $key => $meta_box_id) {
257
+				if (in_array($meta_box_id, $initial_meta_boxes)) {
258
+					unset($hidden_meta_boxes[$key]);
259 259
 				}
260 260
 			}
261 261
 		}
262 262
 
263
-		update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
264
-		update_user_option( $user->ID, 'ee_nav_menu_initialized', 1, true );
263
+		update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true);
264
+		update_user_option($user->ID, 'ee_nav_menu_initialized', 1, true);
265 265
 	}
266 266
 
267 267
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	 * @return void
281 281
 	 */
282 282
 	public function register_custom_nav_menu_boxes() {
283
-		add_meta_box( 'add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array( $this, 'ee_cpt_archive_pages' ), 'nav-menus', 'side', 'core' );
283
+		add_meta_box('add-extra-nav-menu-pages', __('Event Espresso Pages', 'event_espresso'), array($this, 'ee_cpt_archive_pages'), 'nav-menus', 'side', 'core');
284 284
 	}
285 285
 
286 286
 
@@ -297,17 +297,17 @@  discard block
 block discarded – undo
297 297
 	 *
298 298
 	 * @return string  the (maybe) modified link
299 299
 	 */
300
-	public function modify_edit_post_link( $link, $id, $context ) {
301
-		if ( ! $post = get_post( $id ) )
300
+	public function modify_edit_post_link($link, $id, $context) {
301
+		if ( ! $post = get_post($id))
302 302
 			return $link;
303 303
 
304
-		if ( $post->post_type == 'espresso_attendees' ) {
304
+		if ($post->post_type == 'espresso_attendees') {
305 305
 			$query_args = array(
306 306
 				'action' => 'edit_attendee',
307 307
 				'post' => $id
308 308
 				);
309 309
 			EE_Registry::instance()->load_helper('URL');
310
-			return EEH_URL::add_query_args_and_nonce( $query_args, admin_url('admin.php?page=espresso_registrations') );
310
+			return EEH_URL::add_query_args_and_nonce($query_args, admin_url('admin.php?page=espresso_registrations'));
311 311
 		}
312 312
 		return $link;
313 313
 	}
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 		global $nav_menu_selected_id;
320 320
 
321 321
 		$db_fields = false;
322
-		$walker = new Walker_Nav_Menu_Checklist( $db_fields );
322
+		$walker = new Walker_Nav_Menu_Checklist($db_fields);
323 323
 		$current_tab = 'event-archives';
324 324
 
325 325
 		/*if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) {
@@ -338,9 +338,9 @@  discard block
 block discarded – undo
338 338
 		?>
339 339
 		<div id="posttype-extra-nav-menu-pages" class="posttypediv">
340 340
 			<ul id="posttype-extra-nav-menu-pages-tabs" class="posttype-tabs add-menu-item-tabs">
341
-				<li <?php echo ( 'event-archives' == $current_tab ? ' class="tabs"' : '' ); ?>>
342
-					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
343
-						<?php _e( 'Event Archive Pages', 'event_espresso' ); ?>
341
+				<li <?php echo ('event-archives' == $current_tab ? ' class="tabs"' : ''); ?>>
342
+					<a class="nav-tab-link" data-type="tabs-panel-posttype-extra-nav-menu-pages-event-archives" href="<?php if ($nav_menu_selected_id) echo esc_url(add_query_arg('extra-nav-menu-pages-tab', 'event-archives', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-extra-nav-menu-pages-event-archives">
343
+						<?php _e('Event Archive Pages', 'event_espresso'); ?>
344 344
 					</a>
345 345
 				</li>
346 346
 			<?php /* // temporarily removing but leaving skeleton in place in case we ever decide to add more tabs.
@@ -358,13 +358,13 @@  discard block
 block discarded – undo
358 358
  			<?php */ ?>
359 359
 
360 360
 			<div id="tabs-panel-posttype-extra-nav-menu-pages-event-archives" class="tabs-panel <?php
361
-			echo ( 'event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
361
+			echo ('event-archives' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive');
362 362
 			?>">
363 363
 				<ul id="extra-nav-menu-pageschecklist-event-archives" class="categorychecklist form-no-clear">
364 364
 					<?php
365 365
 					$pages = $this->_get_extra_nav_menu_pages_items();
366 366
 					$args['walker'] = $walker;
367
-					echo walk_nav_menu_tree( array_map( array( $this, '_setup_extra_nav_menu_pages_items' ), $pages), 0, (object) $args );
367
+					echo walk_nav_menu_tree(array_map(array($this, '_setup_extra_nav_menu_pages_items'), $pages), 0, (object) $args);
368 368
 					?>
369 369
 				</ul>
370 370
 			</div><!-- /.tabs-panel -->
@@ -372,18 +372,18 @@  discard block
 block discarded – undo
372 372
 			<p class="button-controls">
373 373
 				<span class="list-controls">
374 374
 					<a href="<?php
375
-						echo esc_url( add_query_arg(
375
+						echo esc_url(add_query_arg(
376 376
 							array(
377 377
 								'extra-nav-menu-pages-tab' => 'event-archives',
378 378
 								'selectall' => 1,
379 379
 							),
380
-							remove_query_arg( $removed_args )
380
+							remove_query_arg($removed_args)
381 381
 						));
382 382
 					?>#posttype-extra-nav-menu-pages>" class="select-all"><?php _e('Select All'); ?></a>
383 383
 				</span>
384 384
 
385 385
 				<span class="add-to-menu">
386
-					<input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( __( 'Add to Menu' ) ); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e( 'submit-posttype-extra-nav-menu-pages' ); ?>" />
386
+					<input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e(__('Add to Menu')); ?>" name="add-post-type-menu-item" id="<?php esc_attr_e('submit-posttype-extra-nav-menu-pages'); ?>" />
387 387
 					<span class="spinner"></span>
388 388
 				</span>
389 389
 			</p>
@@ -404,10 +404,10 @@  discard block
 block discarded – undo
404 404
 	private function _get_extra_nav_menu_pages_items() {
405 405
 		$menuitems[] = array(
406 406
 			'title' => __('Event List', 'event_espresso'),
407
-			'url' => get_post_type_archive_link( 'espresso_events' ),
407
+			'url' => get_post_type_archive_link('espresso_events'),
408 408
 			'description' => __('Archive page for all events.', 'event_espresso')
409 409
 		);
410
-		return apply_filters( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems );
410
+		return apply_filters('FHEE__EE_Admin__get_extra_nav_menu_pages_items', $menuitems);
411 411
 	}
412 412
 
413 413
 
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 	 * @param $menuitem
420 420
 	 * @return stdClass
421 421
 	 */
422
-	private function _setup_extra_nav_menu_pages_items( $menuitem ) {
422
+	private function _setup_extra_nav_menu_pages_items($menuitem) {
423 423
 		$menu_item = new stdClass();
424 424
 		$keys = array(
425 425
 			'ID' => 0,
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 			'xfn' => ''
440 440
 			);
441 441
 
442
-		foreach ( $keys as $key => $value) {
442
+		foreach ($keys as $key => $value) {
443 443
 			$menu_item->$key = isset($menuitem[$key]) ? $menuitem[$key] : $value;
444 444
 		}
445 445
 		return $menu_item;
@@ -479,10 +479,10 @@  discard block
 block discarded – undo
479 479
 		 * - check if doing post processing of one of EE CPTs
480 480
 		 * - instantiate the corresponding EE CPT model for the post_type being processed.
481 481
 		 */
482
-		if ( isset( $_POST['action'] ) && $_POST['action'] == 'editpost' ) {
483
-			if ( isset( $_POST['post_type'] ) ) {
484
-				EE_Registry::instance()->load_core( 'Register_CPTs' );
485
-				EE_Register_CPTs::instantiate_cpt_models( $_POST['post_type'] );
482
+		if (isset($_POST['action']) && $_POST['action'] == 'editpost') {
483
+			if (isset($_POST['post_type'])) {
484
+				EE_Registry::instance()->load_core('Register_CPTs');
485
+				EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']);
486 486
 			}
487 487
 		}
488 488
 
@@ -492,8 +492,8 @@  discard block
 block discarded – undo
492 492
 		 * 'options-reading.php' core WordPress admin settings page.  This is for user-proofing.
493 493
 		 */
494 494
 		global $pagenow;
495
-		if ( $pagenow == 'options-reading.php' ) {
496
-			add_filter( 'wp_dropdown_pages', array( $this, 'modify_dropdown_pages' ) );
495
+		if ($pagenow == 'options-reading.php') {
496
+			add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages'));
497 497
 		}
498 498
 
499 499
 	}
@@ -505,25 +505,25 @@  discard block
 block discarded – undo
505 505
 	 * @param string $output  Current output.
506 506
 	 * @return string
507 507
 	 */
508
-	public function modify_dropdown_pages( $output ) {
508
+	public function modify_dropdown_pages($output) {
509 509
 		//get critical pages
510 510
 		$critical_pages = EE_Registry::instance()->CFG->core->get_critical_pages_array();
511 511
 
512 512
 		//split current output by line break for easier parsing.
513
-		$split_output = explode( "\n", $output );
513
+		$split_output = explode("\n", $output);
514 514
 
515 515
 		//loop through to remove any critical pages from the array.
516
-		foreach ( $critical_pages as $page_id ) {
517
-			$needle = 'value="' . $page_id . '"';
518
-			foreach( $split_output as $key => $haystack ) {
519
-				if( strpos( $haystack, $needle ) !== false ) {
520
-					unset( $split_output[$key] );
516
+		foreach ($critical_pages as $page_id) {
517
+			$needle = 'value="'.$page_id.'"';
518
+			foreach ($split_output as $key => $haystack) {
519
+				if (strpos($haystack, $needle) !== false) {
520
+					unset($split_output[$key]);
521 521
 				}
522 522
 			}
523 523
 		}
524 524
 
525 525
 		//replace output with the new contents
526
-		$output = implode( "\n", $split_output );
526
+		$output = implode("\n", $split_output);
527 527
 
528 528
 		return $output;
529 529
 	}
@@ -539,37 +539,37 @@  discard block
 block discarded – undo
539 539
 	public function enqueue_admin_scripts() {
540 540
 		// this javascript is loaded on every admin page to catch any injections ee needs to add to wp run js.
541 541
 		// Note: the intention of this script is to only do TARGETED injections.  I.E, only injecting on certain script calls.
542
-		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL . 'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
542
+		wp_enqueue_script('ee-inject-wp', EE_ADMIN_URL.'assets/ee-cpt-wp-injects.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
543 543
 		// register cookie script for future dependencies
544
-		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL . 'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE );
544
+		wp_register_script('jquery-cookie', EE_THIRD_PARTY_URL.'joyride/jquery.cookie.js', array('jquery'), '2.1', TRUE);
545 545
 		// jquery_validate loading is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via:  add_filter( 'FHEE_load_jquery_validate', '__return_true' );
546
-		if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
546
+		if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
547 547
 			// register jQuery Validate
548
-			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE);
548
+			wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE);
549 549
 		}
550 550
 		//joyride is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again vai: add_filter('FHEE_load_joyride', '__return_true' );
551
-		if ( apply_filters( 'FHEE_load_joyride', FALSE ) ) {
551
+		if (apply_filters('FHEE_load_joyride', FALSE)) {
552 552
 			//joyride style
553
-			wp_register_style('joyride-css', EE_THIRD_PARTY_URL . 'joyride/joyride-2.1.css', array(), '2.1');
554
-			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL . 'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION );
555
-			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL . 'joyride/modernizr.mq.js', array(), '2.1', TRUE );
553
+			wp_register_style('joyride-css', EE_THIRD_PARTY_URL.'joyride/joyride-2.1.css', array(), '2.1');
554
+			wp_register_style('ee-joyride-css', EE_GLOBAL_ASSETS_URL.'css/ee-joyride-styles.css', array('joyride-css'), EVENT_ESPRESSO_VERSION);
555
+			wp_register_script('joyride-modernizr', EE_THIRD_PARTY_URL.'joyride/modernizr.mq.js', array(), '2.1', TRUE);
556 556
 			//joyride JS
557
-			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL . 'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE );
557
+			wp_register_script('jquery-joyride', EE_THIRD_PARTY_URL.'joyride/jquery.joyride-2.1.js', array('jquery-cookie', 'joyride-modernizr'), '2.1', TRUE);
558 558
 			// wanna go for a joyride?
559 559
 			wp_enqueue_style('ee-joyride-css');
560 560
 			wp_enqueue_script('jquery-joyride');
561 561
 		}
562 562
 		//qtip is turned OFF by default, but prior to the admin_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtips', '__return_true' );
563
-		if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) {
563
+		if (apply_filters('FHEE_load_qtip', FALSE)) {
564 564
 			EE_Registry::instance()->load_helper('Qtip_Loader');
565 565
 			EEH_Qtip_Loader::instance()->register_and_enqueue();
566 566
 		}
567 567
 		//accounting.js library
568 568
 		// @link http://josscrowcroft.github.io/accounting.js/
569
-		if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) {
570
-			wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE );
571
-			wp_register_script( 'ee-accounting-core', EE_THIRD_PARTY_URL . 'accounting/accounting.js', array('underscore'), '0.3.2', TRUE );
572
-			wp_enqueue_script( 'ee-accounting' );
569
+		if (apply_filters('FHEE_load_accounting_js', FALSE)) {
570
+			wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE);
571
+			wp_register_script('ee-accounting-core', EE_THIRD_PARTY_URL.'accounting/accounting.js', array('underscore'), '0.3.2', TRUE);
572
+			wp_enqueue_script('ee-accounting');
573 573
 			// array of settings to get converted to JSON array via wp_localize_script
574 574
 			$currency_config = array(
575 575
 				'currency' => array(
@@ -616,11 +616,11 @@  discard block
 block discarded – undo
616 616
 	public function get_persistent_admin_notices() {
617 617
 		// http://www.example.com/wp-admin/admin.php?page=espresso_general_settings&action=critical_pages&critical_pages_nonce=2831ce0f30
618 618
 		$args = array(
619
-			'page' => EE_Registry::instance()->REQ->is_set( 'page' ) ? EE_Registry::instance()->REQ->get( 'page' ) : '',
620
-			'action' => EE_Registry::instance()->REQ->is_set( 'action' ) ? EE_Registry::instance()->REQ->get( 'action' ) : '',
619
+			'page' => EE_Registry::instance()->REQ->is_set('page') ? EE_Registry::instance()->REQ->get('page') : '',
620
+			'action' => EE_Registry::instance()->REQ->is_set('action') ? EE_Registry::instance()->REQ->get('action') : '',
621 621
 		);
622
-		$return_url = EE_Admin_Page::add_query_args_and_nonce( $args, EE_ADMIN_URL );
623
-		echo EE_Error::get_persistent_admin_notices( $return_url );
622
+		$return_url = EE_Admin_Page::add_query_args_and_nonce($args, EE_ADMIN_URL);
623
+		echo EE_Error::get_persistent_admin_notices($return_url);
624 624
 	}
625 625
 
626 626
 
@@ -641,26 +641,26 @@  discard block
 block discarded – undo
641 641
 	 * @param $elements
642 642
 	 * @return array
643 643
 	 */
644
-	public function dashboard_glance_items( $elements ) {
644
+	public function dashboard_glance_items($elements) {
645 645
 		$events = EEM_Event::instance()->count();
646
-		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_events'), admin_url('admin.php') );
647
-		$items['events']['text'] = sprintf( _n( '%s Event', '%s Events', $events ), number_format_i18n( $events ) );
646
+		$items['events']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events'), admin_url('admin.php'));
647
+		$items['events']['text'] = sprintf(_n('%s Event', '%s Events', $events), number_format_i18n($events));
648 648
 		$items['events']['title'] = __('Click to view all Events', 'event_espresso');
649 649
 		$registrations = EEM_Registration::instance()->count(
650 650
 			array(
651 651
 				array(
652
-					'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete )
652
+					'STS_ID' => array('!=', EEM_Registration::status_id_incomplete)
653 653
 				)
654 654
 			)
655 655
 		);
656
-		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce( array('page' => 'espresso_registrations' ), admin_url('admin.php') );
657
-		$items['registrations']['text'] = sprintf( _n( '%s Registration', '%s Registrations', $registrations ), number_format_i18n($registrations) );
656
+		$items['registrations']['url'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_registrations'), admin_url('admin.php'));
657
+		$items['registrations']['text'] = sprintf(_n('%s Registration', '%s Registrations', $registrations), number_format_i18n($registrations));
658 658
 		$items['registrations']['title'] = __('Click to view all registrations', 'event_espresso');
659 659
 
660
-		$items = apply_filters( 'FHEE__EE_Admin__dashboard_glance_items__items', $items );
660
+		$items = apply_filters('FHEE__EE_Admin__dashboard_glance_items__items', $items);
661 661
 
662
-		foreach ( $items as $type => $item_properties ) {
663
-			$elements[] = sprintf( '<a class="ee-dashboard-link-' . $type . '" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text'] );
662
+		foreach ($items as $type => $item_properties) {
663
+			$elements[] = sprintf('<a class="ee-dashboard-link-'.$type.'" href="%s" title="%s">%s</a>', $item_properties['url'], $item_properties['title'], $item_properties['text']);
664 664
 		}
665 665
 		return $elements;
666 666
 	}
@@ -679,63 +679,63 @@  discard block
 block discarded – undo
679 679
 	 * @param $post
680 680
 	 * @return    void
681 681
 	 */
682
-	public static function parse_post_content_on_save( $post_ID, $post ) {
682
+	public static function parse_post_content_on_save($post_ID, $post) {
683 683
 		// default post types
684
-		$post_types = array( 'post' => 0, 'page' => 1 );
684
+		$post_types = array('post' => 0, 'page' => 1);
685 685
 		// add CPTs
686 686
 		$CPTs = EE_Register_CPTs::get_CPTs();
687
-		$post_types = array_merge( $post_types, $CPTs );
687
+		$post_types = array_merge($post_types, $CPTs);
688 688
 		// for default or CPT posts...
689
-		if ( isset( $post_types[ $post->post_type ] )) {
689
+		if (isset($post_types[$post->post_type])) {
690 690
 			// post on frontpage ?
691 691
 			$page_for_posts = EE_Config::get_page_for_posts();
692 692
 			$maybe_remove_from_posts = array();
693 693
 			// critical page shortcodes that we do NOT want added to the Posts page (blog)
694 694
 			$critical_shortcodes = EE_Registry::instance()->CFG->core->get_critical_pages_shortcodes_array();
695 695
 			// array of shortcodes indexed by post name
696
-			EE_Registry::instance()->CFG->core->post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes ) ? EE_Registry::instance()->CFG->core->post_shortcodes : array();
696
+			EE_Registry::instance()->CFG->core->post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array();
697 697
 			// whether to proceed with update, if an entry already exists for this post, then we want to update
698
-			$update_post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ] ) ? true : false;
698
+			$update_post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name]) ? true : false;
699 699
 			// empty both arrays
700
-			EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ] = array();
700
+			EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name] = array();
701 701
 			// check that posts page is already being tracked
702
-			if ( ! isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] ) ) {
702
+			if ( ! isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts])) {
703 703
 				// if not, then ensure that it is properly added
704
-				EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] = array();
704
+				EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts] = array();
705 705
 			}
706 706
 			// loop thru shortcodes
707
-			foreach ( EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir ) {
707
+			foreach (EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir) {
708 708
 				// convert to UPPERCASE to get actual shortcode
709
-				$EES_Shortcode = strtoupper( $EES_Shortcode );
709
+				$EES_Shortcode = strtoupper($EES_Shortcode);
710 710
 				// is the shortcode in the post_content ?
711
-				if ( strpos( $post->post_content, $EES_Shortcode ) !== FALSE ) {
711
+				if (strpos($post->post_content, $EES_Shortcode) !== FALSE) {
712 712
 					// map shortcode to post names and post IDs
713
-					EE_Registry::instance()->CFG->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] = $post_ID;
713
+					EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name][$EES_Shortcode] = $post_ID;
714 714
 					// if the shortcode is NOT one of the critical page shortcodes like ESPRESSO_TXN_PAGE
715
-					if ( ! in_array( $EES_Shortcode, $critical_shortcodes )) {
715
+					if ( ! in_array($EES_Shortcode, $critical_shortcodes)) {
716 716
 						// add shortcode to "Posts page" tracking
717
-						EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = $post_ID;
717
+						EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$EES_Shortcode] = $post_ID;
718 718
 					}
719 719
 					$update_post_shortcodes = TRUE;
720
-					unset( $maybe_remove_from_posts[ $EES_Shortcode ] );
720
+					unset($maybe_remove_from_posts[$EES_Shortcode]);
721 721
 				} else {
722
-					$maybe_remove_from_posts[ $EES_Shortcode ] = $post_ID;
722
+					$maybe_remove_from_posts[$EES_Shortcode] = $post_ID;
723 723
 				}
724 724
 			}
725
-			if ( $update_post_shortcodes ) {
725
+			if ($update_post_shortcodes) {
726 726
 				// remove shortcodes from $maybe_remove_from_posts that are still being used
727
-				foreach ( EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $shortcodes ) {
728
-					if ( $post_name == $page_for_posts ) {
727
+				foreach (EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $shortcodes) {
728
+					if ($post_name == $page_for_posts) {
729 729
 						continue;
730 730
 					}
731 731
 					// compute difference between active post_shortcodes array and $maybe_remove_from_posts array
732
-					$maybe_remove_from_posts = array_diff_key( $maybe_remove_from_posts, $shortcodes );
732
+					$maybe_remove_from_posts = array_diff_key($maybe_remove_from_posts, $shortcodes);
733 733
 				}
734 734
 				// now unset unused shortcodes from the $page_for_posts post_shortcodes
735
-				foreach ( $maybe_remove_from_posts as $shortcode => $post_ID ) {
736
-					unset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $shortcode ] );
735
+				foreach ($maybe_remove_from_posts as $shortcode => $post_ID) {
736
+					unset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$shortcode]);
737 737
 				}
738
-				EE_Registry::instance()->CFG->update_post_shortcodes( $page_for_posts );
738
+				EE_Registry::instance()->CFG->update_post_shortcodes($page_for_posts);
739 739
 			}
740 740
 		}
741 741
 	}
@@ -753,32 +753,32 @@  discard block
 block discarded – undo
753 753
 	 * @throws EE_Error
754 754
 	 * @return    string
755 755
 	 */
756
-	public function check_for_invalid_datetime_formats( $value, $option ) {
757
-		EE_Registry::instance()->load_helper( 'DTT_Helper' );
756
+	public function check_for_invalid_datetime_formats($value, $option) {
757
+		EE_Registry::instance()->load_helper('DTT_Helper');
758 758
 		// check for date_format or time_format
759
-		switch ( $option ) {
759
+		switch ($option) {
760 760
 			case 'date_format' :
761
-				$date_time_format = $value . ' ' . get_option('time_format');
761
+				$date_time_format = $value.' '.get_option('time_format');
762 762
 				break;
763 763
 			case 'time_format' :
764
-				$date_time_format = get_option('date_format') . ' ' . $value;
764
+				$date_time_format = get_option('date_format').' '.$value;
765 765
 				break;
766 766
 			default :
767 767
 				$date_time_format = FALSE;
768 768
 		}
769 769
 		// do we have a date_time format to check ?
770
-		if ( $date_time_format ) {
771
-			$error_msg = EEH_DTT_Helper::validate_format_string( $date_time_format );
770
+		if ($date_time_format) {
771
+			$error_msg = EEH_DTT_Helper::validate_format_string($date_time_format);
772 772
 
773
-			if ( is_array( $error_msg ) ) {
774
-				$msg = '<p>' . sprintf( __( 'The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso' ), date( $date_time_format ) , $date_time_format  ) . '</p><p><ul>';
773
+			if (is_array($error_msg)) {
774
+				$msg = '<p>'.sprintf(__('The following date time "%s" ( %s ) is difficult to be properly parsed by PHP for the following reasons:', 'event_espresso'), date($date_time_format), $date_time_format).'</p><p><ul>';
775 775
 
776 776
 
777
-				foreach ( $error_msg as $error ) {
778
-					$msg .= '<li>' . $error . '</li>';
777
+				foreach ($error_msg as $error) {
778
+					$msg .= '<li>'.$error.'</li>';
779 779
 				}
780 780
 
781
-				$msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>';
781
+				$msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "F j, Y" and "g:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>';
782 782
 
783 783
 				// trigger WP settings error
784 784
 				add_settings_error(
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 				);
789 789
 
790 790
 				// set format to something valid
791
-				switch ( $option ) {
791
+				switch ($option) {
792 792
 					case 'date_format' :
793 793
 						$value = 'F j, Y';
794 794
 						break;
@@ -814,14 +814,14 @@  discard block
 block discarded – undo
814 814
 	 * @param 	$value
815 815
 	 * @return 	void
816 816
 	 */
817
-	public function reset_page_for_posts_on_change( $option, $old_value, $value ) {
818
-		if ( $option == 'page_for_posts' ) {
817
+	public function reset_page_for_posts_on_change($option, $old_value, $value) {
818
+		if ($option == 'page_for_posts') {
819 819
 			global $wpdb;
820
-			$SQL = 'SELECT post_name from ' . $wpdb->posts . ' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s';
821
-			$old_page_for_posts = $old_value ? $wpdb->get_var( $wpdb->prepare( $SQL, $old_value )) : 'posts';
822
-			$new_page_for_posts = $value ? $wpdb->get_var( $wpdb->prepare( $SQL, $value )) : 'posts';
823
-			EE_Registry::instance()->CFG->core->post_shortcodes[ $new_page_for_posts ] = EE_Registry::instance()->CFG->core->post_shortcodes[ $old_page_for_posts ];
824
-			EE_Registry::instance()->CFG->update_post_shortcodes( $new_page_for_posts );
820
+			$SQL = 'SELECT post_name from '.$wpdb->posts.' WHERE post_type="posts" OR post_type="page" AND post_status="publish" AND ID=%s';
821
+			$old_page_for_posts = $old_value ? $wpdb->get_var($wpdb->prepare($SQL, $old_value)) : 'posts';
822
+			$new_page_for_posts = $value ? $wpdb->get_var($wpdb->prepare($SQL, $value)) : 'posts';
823
+			EE_Registry::instance()->CFG->core->post_shortcodes[$new_page_for_posts] = EE_Registry::instance()->CFG->core->post_shortcodes[$old_page_for_posts];
824
+			EE_Registry::instance()->CFG->update_post_shortcodes($new_page_for_posts);
825 825
 		}
826 826
 	}
827 827
 
@@ -834,8 +834,8 @@  discard block
 block discarded – undo
834 834
 	 * @param $content
835 835
 	 * @return    string
836 836
 	 */
837
-	public function its_eSpresso( $content ) {
838
-		return str_replace( '[EXPRESSO_', '[ESPRESSO_', $content );
837
+	public function its_eSpresso($content) {
838
+		return str_replace('[EXPRESSO_', '[ESPRESSO_', $content);
839 839
 	}
840 840
 
841 841
 
@@ -848,9 +848,9 @@  discard block
 block discarded – undo
848 848
 	 */
849 849
 	public function espresso_admin_footer() {
850 850
 		return sprintf(
851
-			__( 'Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso' ),
851
+			__('Event Registration and Ticketing Powered by %sEvent Registration Powered by Event Espresso%s', 'event_espresso'),
852 852
 			'<a href="https://eventespresso.com/" title="',
853
-			'">' . EVENT_ESPRESSO_POWERED_BY . '</a>'
853
+			'">'.EVENT_ESPRESSO_POWERED_BY.'</a>'
854 854
 		);
855 855
 	}
856 856
 
@@ -870,11 +870,11 @@  discard block
 block discarded – undo
870 870
 	 * @param array $config
871 871
 	 * @return void
872 872
 	 */
873
-	public static function register_ee_admin_page( $page_basename, $page_path, $config = array() ) {
874
-		EE_Error::doing_it_wrong( __METHOD__, sprintf( __('Usage is deprecated.  Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3' );
875
-		if ( class_exists( 'EE_Register_Admin_Page' ) )
873
+	public static function register_ee_admin_page($page_basename, $page_path, $config = array()) {
874
+		EE_Error::doing_it_wrong(__METHOD__, sprintf(__('Usage is deprecated.  Use EE_Register_Admin_Page::register() for registering the %s admin page.', 'event_espresso'), $page_basename), '4.3');
875
+		if (class_exists('EE_Register_Admin_Page'))
876 876
 			$config['page_path'] = $page_path;
877
-			EE_Register_Admin_Page::register( $page_basename, $config );
877
+			EE_Register_Admin_Page::register($page_basename, $config);
878 878
 	}
879 879
 
880 880
 
Please login to merge, or discard this patch.
core/helpers/EEH_Template.helper.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 *
283 283
 	 * given two paths, this determines if there is a common base path between the two
284 284
 	 *
285
-	 * @param array $paths
285
+	 * @param string[] $paths
286 286
 	 * @return string
287 287
 	 */
288 288
 	protected static function _find_common_base_path( $paths ) {
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 * @param bool|string $template_path server path to the file to be loaded, including file name and extension
310 310
 	 * @param  array      $template_args an array of arguments to be extracted for use in the template
311 311
 	 * @param  boolean    $return_string whether to send output immediately to screen, or capture and return as a string
312
-	 * @return mixed string
312
+	 * @return string string
313 313
 	 */
314 314
 	public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) {
315 315
 		//require the template validator for verifying variables are set according to how the template requires
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 				return array();
100 100
 			}
101 101
 			if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) {
102
-			    unset( $espresso_themes[ $key ] );
102
+				unset( $espresso_themes[ $key ] );
103 103
 			}
104 104
 			EEH_Template::$_espresso_themes = array();
105 105
 			foreach ( $espresso_themes as $espresso_theme ) {
@@ -709,9 +709,9 @@  discard block
 block discarded – undo
709 709
 		);
710 710
 
711 711
 		if ( empty( $items_label )
712
-		     || ! is_array( $items_label )
713
-		     || ! isset( $items_label['single'] )
714
-		     || ! isset( $items_label['plural'] ) ) {
712
+			 || ! is_array( $items_label )
713
+			 || ! isset( $items_label['single'] )
714
+			 || ! isset( $items_label['plural'] ) ) {
715 715
 			$items_label = array(
716 716
 				'single' => __( '1 item', 'event_espresso' ),
717 717
 				'plural' => __( '%s items', 'event_espresso' )
Please login to merge, or discard this patch.
Spacing   +196 added lines, -196 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 
17 17
 
18
-if ( ! function_exists( 'espresso_get_template_part' )) {
18
+if ( ! function_exists('espresso_get_template_part')) {
19 19
 	/**
20 20
 	 * espresso_get_template_part
21 21
 	 * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
 	 * @param string $name The name of the specialised template.
26 26
 	 * @return string        the html output for the formatted money value
27 27
 	 */
28
-	function espresso_get_template_part( $slug = NULL, $name = NULL ) {
29
-		EEH_Template::get_template_part( $slug, $name );
28
+	function espresso_get_template_part($slug = NULL, $name = NULL) {
29
+		EEH_Template::get_template_part($slug, $name);
30 30
 	}
31 31
 }
32 32
 
33 33
 
34 34
 
35
-if ( ! function_exists( 'espresso_get_object_css_class' )) {
35
+if ( ! function_exists('espresso_get_object_css_class')) {
36 36
 	/**
37 37
 	 * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed
38 38
 	 *
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	 * @param  string $suffix added to the end of the generated class
43 43
 	 * @return string
44 44
 	 */
45
-	function espresso_get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) {
46
-		return EEH_Template::get_object_css_class( $object, $prefix, $suffix );
45
+	function espresso_get_object_css_class($object = NULL, $prefix = '', $suffix = '') {
46
+		return EEH_Template::get_object_css_class($object, $prefix, $suffix);
47 47
 	}
48 48
 }
49 49
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 * 	@return boolean
71 71
 	 */
72 72
 	public static function is_espresso_theme() {
73
-		return wp_get_theme()->get( 'TextDomain' ) == 'event_espresso' ? TRUE : FALSE;
73
+		return wp_get_theme()->get('TextDomain') == 'event_espresso' ? TRUE : FALSE;
74 74
 	}
75 75
 
76 76
 	/**
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 	 * 	@return void
80 80
 	 */
81 81
 	public static function load_espresso_theme_functions() {
82
-		if ( ! defined( 'EE_THEME_FUNCTIONS_LOADED' )) {
83
-			if ( is_readable( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' )) {
84
-				require_once( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' );
82
+		if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) {
83
+			if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) {
84
+				require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php');
85 85
 			}
86 86
 		}
87 87
 	}
@@ -93,17 +93,17 @@  discard block
 block discarded – undo
93 93
 	 * 	@return array
94 94
 	 */
95 95
 	public static function get_espresso_themes() {
96
-		if ( empty( EEH_Template::$_espresso_themes )) {
97
-			$espresso_themes =  glob( EE_PUBLIC . '*', GLOB_ONLYDIR );
98
-			if ( empty( $espresso_themes ) ) {
96
+		if (empty(EEH_Template::$_espresso_themes)) {
97
+			$espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR);
98
+			if (empty($espresso_themes)) {
99 99
 				return array();
100 100
 			}
101
-			if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) {
102
-			    unset( $espresso_themes[ $key ] );
101
+			if (($key = array_search('global_assets', $espresso_themes)) !== FALSE) {
102
+			    unset($espresso_themes[$key]);
103 103
 			}
104 104
 			EEH_Template::$_espresso_themes = array();
105
-			foreach ( $espresso_themes as $espresso_theme ) {
106
-				EEH_Template::$_espresso_themes[ basename( $espresso_theme ) ] = $espresso_theme;
105
+			foreach ($espresso_themes as $espresso_theme) {
106
+				EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme;
107 107
 			}
108 108
 		}
109 109
 		return EEH_Template::$_espresso_themes;
@@ -122,16 +122,16 @@  discard block
 block discarded – undo
122 122
 	 * @param bool   $return_string
123 123
 	 * @return string        the html output for the formatted money value
124 124
 	 */
125
-	public static function get_template_part( $slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE  ) {
126
-		do_action( "get_template_part_{$slug}-{$name}", $slug, $name );
125
+	public static function get_template_part($slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE) {
126
+		do_action("get_template_part_{$slug}-{$name}", $slug, $name);
127 127
 		$templates = array();
128 128
 		$name = (string) $name;
129
-		if ( $name != '' ) {
129
+		if ($name != '') {
130 130
 			$templates[] = "{$slug}-{$name}.php";
131 131
 		}
132 132
 		// allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' );
133
-		if ( apply_filters( "FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE )) {
134
-			EEH_Template::locate_template( $templates, $template_args, TRUE, $return_string );
133
+		if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE)) {
134
+			EEH_Template::locate_template($templates, $template_args, TRUE, $return_string);
135 135
 		}
136 136
 	}
137 137
 
@@ -182,26 +182,26 @@  discard block
 block discarded – undo
182 182
 	 * 				Used in places where you don't actually load the template, you just want to know if there's a custom version of it.
183 183
 	 * @return mixed
184 184
 	 */
185
-	public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) {
185
+	public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) {
186 186
 		// first use WP locate_template to check for template in the current theme folder
187
-		$template_path = locate_template( $templates );
187
+		$template_path = locate_template($templates);
188 188
 
189
-		if ( $check_if_custom && !empty( $template_path ) )
189
+		if ($check_if_custom && ! empty($template_path))
190 190
 			return TRUE;
191 191
 
192 192
 		// not in the theme
193
-		if ( empty( $template_path )) {
193
+		if (empty($template_path)) {
194 194
 			// not even a template to look for ?
195
-			if ( empty( $templates )) {
195
+			if (empty($templates)) {
196 196
 				// get post_type
197
-				$post_type = EE_Registry::instance()->REQ->get( 'post_type' );
197
+				$post_type = EE_Registry::instance()->REQ->get('post_type');
198 198
 				// get array of EE Custom Post Types
199 199
 				$EE_CPTs = EE_Register_CPTs::get_CPTs();
200 200
 				// build template name based on request
201
-				if ( isset( $EE_CPTs[ $post_type ] )) {
202
-					$archive_or_single =  is_archive() ? 'archive' : '';
203
-					$archive_or_single =  is_single() ? 'single' : $archive_or_single;
204
-					$templates = $archive_or_single . '-' . $post_type . '.php';
201
+				if (isset($EE_CPTs[$post_type])) {
202
+					$archive_or_single = is_archive() ? 'archive' : '';
203
+					$archive_or_single = is_single() ? 'single' : $archive_or_single;
204
+					$templates = $archive_or_single.'-'.$post_type.'.php';
205 205
 				}
206 206
 			}
207 207
 			// currently active EE template theme
@@ -210,80 +210,80 @@  discard block
 block discarded – undo
210 210
 			// array of paths to folders that may contain templates
211 211
 			$template_folder_paths = array(
212 212
 				// first check the /wp-content/uploads/espresso/templates/(current EE theme)/  folder for an EE theme template file
213
-				EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme,
213
+				EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme,
214 214
 				// then in the root of the /wp-content/uploads/espresso/templates/ folder
215 215
 				EVENT_ESPRESSO_TEMPLATE_DIR
216 216
 			);
217 217
 
218 218
 			//add core plugin folders for checking only if we're not $check_if_custom
219
-			if ( ! $check_if_custom ) {
219
+			if ( ! $check_if_custom) {
220 220
 				$core_paths = array(
221 221
 					// in the  /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin
222
-					EE_PUBLIC . $current_theme,
222
+					EE_PUBLIC.$current_theme,
223 223
 					// in the  /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin
224
-					EE_TEMPLATES . $current_theme,
224
+					EE_TEMPLATES.$current_theme,
225 225
 					// or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/
226 226
 					EE_PLUGIN_DIR_PATH
227 227
 					);
228
-				$template_folder_paths = array_merge( $template_folder_paths, $core_paths );
228
+				$template_folder_paths = array_merge($template_folder_paths, $core_paths);
229 229
 			}
230 230
 
231 231
 			// now filter that array
232
-			$template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths );
233
-			$templates = is_array( $templates ) ? $templates : array( $templates );
234
-			$template_folder_paths = is_array( $template_folder_paths ) ? $template_folder_paths : array( $template_folder_paths );
232
+			$template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths);
233
+			$templates = is_array($templates) ? $templates : array($templates);
234
+			$template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths);
235 235
 			// array to hold all possible template paths
236 236
 			$full_template_paths = array();
237 237
 
238 238
 			EE_Registry::instance()->load_helper('File');
239 239
 			// loop through $templates
240
-			foreach ( $templates as $template ) {
240
+			foreach ($templates as $template) {
241 241
 				// normalize directory separators
242
-				$template = EEH_File::standardise_directory_separators( $template );
243
-				$file_name = basename( $template );
244
-				$template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) );
242
+				$template = EEH_File::standardise_directory_separators($template);
243
+				$file_name = basename($template);
244
+				$template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1));
245 245
 				// while looping through all template folder paths
246
-				foreach ( $template_folder_paths as $template_folder_path ) {
246
+				foreach ($template_folder_paths as $template_folder_path) {
247 247
 					// normalize directory separators
248
-					$template_folder_path = EEH_File::standardise_directory_separators( $template_folder_path );
248
+					$template_folder_path = EEH_File::standardise_directory_separators($template_folder_path);
249 249
 					// determine if any common base path exists between the two paths
250 250
 					$common_base_path = EEH_Template::_find_common_base_path(
251
-						array( $template_folder_path, $template_path_minus_file_name )
251
+						array($template_folder_path, $template_path_minus_file_name)
252 252
 					);
253
-					if ( $common_base_path !== '' ) {
253
+					if ($common_base_path !== '') {
254 254
 						// both paths have a common base, so just tack the filename onto our search path
255
-						$resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $file_name;
255
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name;
256 256
 					} else {
257 257
 						// no common base path, so let's just concatenate
258
-						$resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $template;
258
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template;
259 259
 					}
260 260
 					// build up our template locations array by adding our resolved paths
261 261
 					$full_template_paths[] = $resolved_path;
262 262
 				}
263 263
 				// if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first
264
-				array_unshift( $full_template_paths, $template );
264
+				array_unshift($full_template_paths, $template);
265 265
 				// path to the directory of the current theme: /wp-content/themes/(current WP theme)/
266
-				array_unshift( $full_template_paths, get_stylesheet_directory() . DS . $file_name );
266
+				array_unshift($full_template_paths, get_stylesheet_directory().DS.$file_name);
267 267
 			}
268 268
 			// filter final array of full template paths
269
-			$full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name );
269
+			$full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name);
270 270
 			// now loop through our final array of template location paths and check each location
271
-			foreach ( (array)$full_template_paths as $full_template_path ) {
272
-				if ( is_readable( $full_template_path )) {
273
-					$template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path );
271
+			foreach ((array) $full_template_paths as $full_template_path) {
272
+				if (is_readable($full_template_path)) {
273
+					$template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path);
274 274
 					break;
275 275
 				}
276 276
 			}
277 277
 		}
278 278
 		// if we got it and you want to see it...
279
-		if ( $template_path && $load && ! $check_if_custom  ) {
280
-			if ( $return_string ) {
281
-				return EEH_Template::display_template( $template_path, $template_args, TRUE );
279
+		if ($template_path && $load && ! $check_if_custom) {
280
+			if ($return_string) {
281
+				return EEH_Template::display_template($template_path, $template_args, TRUE);
282 282
 			} else {
283
-				EEH_Template::display_template( $template_path, $template_args, FALSE );
283
+				EEH_Template::display_template($template_path, $template_args, FALSE);
284 284
 			}
285 285
 		}
286
-		return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path;
286
+		return $check_if_custom && ! empty($template_path) ? TRUE : $template_path;
287 287
 	}
288 288
 
289 289
 
@@ -296,21 +296,21 @@  discard block
 block discarded – undo
296 296
 	 * @param array $paths
297 297
 	 * @return string
298 298
 	 */
299
-	protected static function _find_common_base_path( $paths ) {
299
+	protected static function _find_common_base_path($paths) {
300 300
 		$last_offset = 0;
301 301
 		$common_base_path = '';
302
-		while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) {
302
+		while (($index = strpos($paths[0], DS, $last_offset)) !== false) {
303 303
 			$dir_length = $index - $last_offset + 1;
304
-			$directory = substr( $paths[ 0 ], $last_offset, $dir_length );
305
-			foreach ( $paths as $path ) {
306
-				if ( substr( $path, $last_offset, $dir_length ) != $directory ) {
304
+			$directory = substr($paths[0], $last_offset, $dir_length);
305
+			foreach ($paths as $path) {
306
+				if (substr($path, $last_offset, $dir_length) != $directory) {
307 307
 					return $common_base_path;
308 308
 				}
309 309
 			}
310 310
 			$common_base_path .= $directory;
311 311
 			$last_offset = $index + 1;
312 312
 		}
313
-		return substr( $common_base_path, 0, -1 );
313
+		return substr($common_base_path, 0, -1);
314 314
 	}
315 315
 
316 316
 
@@ -322,9 +322,9 @@  discard block
 block discarded – undo
322 322
 	 * @param  boolean    $return_string whether to send output immediately to screen, or capture and return as a string
323 323
 	 * @return mixed string
324 324
 	 */
325
-	public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) {
325
+	public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) {
326 326
 		//require the template validator for verifying variables are set according to how the template requires
327
-		EE_Registry::instance()->load_helper( 'Template_Validator' );
327
+		EE_Registry::instance()->load_helper('Template_Validator');
328 328
 
329 329
 		/**
330 330
 		 * These two filters are intended for last minute changes to templates being loaded and/or template arg
@@ -335,26 +335,26 @@  discard block
 block discarded – undo
335 335
 		 *
336 336
 		 * @since 4.6.0
337 337
 		 */
338
-		$template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path );
339
-		$template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args );
338
+		$template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path);
339
+		$template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args);
340 340
 
341 341
 		// you gimme nuttin - YOU GET NUTTIN !!
342
-		if ( ! $template_path || ! is_readable( $template_path )) {
342
+		if ( ! $template_path || ! is_readable($template_path)) {
343 343
 			return '';
344 344
 		}
345 345
 		// if $template_args are not in an array, then make it so
346
-		if ( ! is_array( $template_args ) && ! is_object( $template_args )) {
347
-			$template_args = array( $template_args );
346
+		if ( ! is_array($template_args) && ! is_object($template_args)) {
347
+			$template_args = array($template_args);
348 348
 		}
349
-		extract( (array) $template_args);
349
+		extract((array) $template_args);
350 350
 
351
-		if ( $return_string ) {
351
+		if ($return_string) {
352 352
 			// because we want to return a string, we are going to capture the output
353 353
 			ob_start();
354
-			include( $template_path );
354
+			include($template_path);
355 355
 			return ob_get_clean();
356 356
 		} else {
357
-			include( $template_path );
357
+			include($template_path);
358 358
 		}
359 359
 		return '';
360 360
 	}
@@ -372,27 +372,27 @@  discard block
 block discarded – undo
372 372
 	 * @param  string $suffix added to the end of the generated class
373 373
 	 * @return string
374 374
 	 */
375
-	public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) {
375
+	public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') {
376 376
 		// in the beginning...
377
-		$prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : '';
377
+		$prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : '';
378 378
 		// da muddle
379 379
 		$class = '';
380 380
 		// the end
381
-		$suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : '';
381
+		$suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : '';
382 382
 		// is the passed object an EE object ?
383
-		if ( $object instanceof EE_Base_Class ) {
383
+		if ($object instanceof EE_Base_Class) {
384 384
 			// grab the exact type of object
385
-			$obj_class = get_class( $object );
385
+			$obj_class = get_class($object);
386 386
 			// depending on the type of object...
387
-			switch ( $obj_class ) {
387
+			switch ($obj_class) {
388 388
 				// no specifics just yet...
389 389
 				default :
390
-					$class = strtolower( str_replace( '_', '-', $obj_class ));
391
-					$class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : '';
390
+					$class = strtolower(str_replace('_', '-', $obj_class));
391
+					$class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : '';
392 392
 
393 393
 			}
394 394
 		}
395
-		return $prefix . $class . $suffix;
395
+		return $prefix.$class.$suffix;
396 396
 	}
397 397
 
398 398
 
@@ -408,50 +408,50 @@  discard block
 block discarded – undo
408 408
 	 * @param string      $cur_code_span_class
409 409
 	 * @return string        the html output for the formatted money value
410 410
 	 */
411
-	public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) {
411
+	public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') {
412 412
 		// ensure amount was received
413
-		if ( is_null( $amount ) ) {
414
-			$msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' );
415
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
413
+		if (is_null($amount)) {
414
+			$msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso');
415
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
416 416
 			return '';
417 417
 		}
418 418
 		//ensure amount is float
419 419
 		$amount = (float) $amount;
420 420
 		// filter raw amount (allows 0.00 to be changed to "free" for example)
421
-		$amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw );
421
+		$amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw);
422 422
 		// still a number or was amount converted to a string like "free" ?
423
-		if ( is_float( $amount_formatted )) {
423
+		if (is_float($amount_formatted)) {
424 424
 			// was a country ISO code passed ? if so generate currency config object for that country
425
-			$mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL;
425
+			$mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL;
426 426
 			// verify results
427
-			if ( ! $mny instanceof EE_Currency_Config ) {
427
+			if ( ! $mny instanceof EE_Currency_Config) {
428 428
 				// set default config country currency settings
429 429
 				$mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config();
430 430
 			}
431 431
 			// format float
432
-			$amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds );
432
+			$amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds);
433 433
 			// add formatting ?
434
-			if ( ! $return_raw ) {
434
+			if ( ! $return_raw) {
435 435
 				// add currency sign
436
-				if( $mny->sign_b4 ){
437
-					if( $amount >= 0 ){
438
-						$amount_formatted = $mny->sign . $amount_formatted;
439
-					}else{
440
-						$amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted );
436
+				if ($mny->sign_b4) {
437
+					if ($amount >= 0) {
438
+						$amount_formatted = $mny->sign.$amount_formatted;
439
+					} else {
440
+						$amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted);
441 441
 					}
442 442
 
443
-				}else{
444
-					$amount_formatted =  $amount_formatted . $mny->sign;
443
+				} else {
444
+					$amount_formatted = $amount_formatted.$mny->sign;
445 445
 				}
446 446
 
447 447
 				// add currency code ?
448
-				$amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted;
448
+				$amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted;
449 449
 			}
450 450
 			// filter results
451
-			$amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw );
451
+			$amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw);
452 452
 		}
453 453
 		// clean up vars
454
-		unset( $mny );
454
+		unset($mny);
455 455
 		// return formatted currency amount
456 456
 		return $amount_formatted;
457 457
 	}
@@ -466,11 +466,11 @@  discard block
 block discarded – undo
466 466
 	 * @param  string  $schema    'UPPER', 'lower', or 'Sentence'
467 467
 	 * @return string             The localized label for the status id.
468 468
 	 */
469
-	public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) {
469
+	public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') {
470 470
 		/** @type EEM_Status $EEM_Status */
471
-		$EEM_Status = EE_Registry::instance()->load_model( 'Status' );
472
-		$status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema );
473
-		return $status[ $status_id ];
471
+		$EEM_Status = EE_Registry::instance()->load_model('Status');
472
+		$status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema);
473
+		return $status[$status_id];
474 474
 	}
475 475
 
476 476
 
@@ -483,9 +483,9 @@  discard block
 block discarded – undo
483 483
 	 * @param string  $icon
484 484
 	 * @return string 	the html output for the button
485 485
 	 */
486
-	public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '' ) {
487
-		$label = ! empty( $icon ) ? '<span class="' . $icon . '"></span>' . $label : $label;
488
-		$button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '">' . $label . '</a>';
486
+	public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '') {
487
+		$label = ! empty($icon) ? '<span class="'.$icon.'"></span>'.$label : $label;
488
+		$button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'">'.$label.'</a>';
489 489
 		return $button;
490 490
 	}
491 491
 
@@ -502,21 +502,21 @@  discard block
 block discarded – undo
502 502
 	 * @param bool|string $help_text   (optional) send help text you want to use for the link if default not to be used
503 503
 	 * @return string              generated link
504 504
 	 */
505
-	public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) {
505
+	public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) {
506 506
 
507
-		if ( ! $page )
508
-			$page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page;
507
+		if ( ! $page)
508
+			$page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page;
509 509
 
510
-		if ( ! $action )
511
-			$action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action;
510
+		if ( ! $action)
511
+			$action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action;
512 512
 
513 513
 		$action = empty($action) ? 'default' : $action;
514 514
 
515 515
 
516
-		$help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id;
517
-		$icon = !$icon_style ? ' dashicons-editor-help' : $icon_style;
518
-		$help_text = !$help_text ? '' : $help_text;
519
-		return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso') . '" > ' . $help_text . ' </a>';
516
+		$help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id;
517
+		$icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style;
518
+		$help_text = ! $help_text ? '' : $help_text;
519
+		return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso').'" > '.$help_text.' </a>';
520 520
 	}
521 521
 
522 522
 
@@ -528,31 +528,31 @@  discard block
 block discarded – undo
528 528
 	 * @param EE_Help_Tour
529 529
 	 * @return string         html
530 530
 	 */
531
-	public static function help_tour_stops_generator( EE_Help_Tour $tour ) {
531
+	public static function help_tour_stops_generator(EE_Help_Tour $tour) {
532 532
 		$id = $tour->get_slug();
533 533
 		$stops = $tour->get_stops();
534 534
 
535
-		$content = '<ol style="display:none" id="' . $id . '">';
535
+		$content = '<ol style="display:none" id="'.$id.'">';
536 536
 
537
-		foreach ( $stops as $stop ) {
538
-			$data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : '';
539
-			$data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : '';
537
+		foreach ($stops as $stop) {
538
+			$data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : '';
539
+			$data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : '';
540 540
 
541 541
 			//if container is set to modal then let's make sure we set the options accordingly
542
-			if ( empty( $data_id ) && empty( $data_class ) ) {
542
+			if (empty($data_id) && empty($data_class)) {
543 543
 				$stop['options']['modal'] = true;
544 544
 				$stop['options']['expose'] = true;
545 545
 			}
546 546
 
547
-			$custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : '';
548
-			$button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : '';
547
+			$custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : '';
548
+			$button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : '';
549 549
 			$inner_content = isset($stop['content']) ? $stop['content'] : '';
550 550
 
551 551
 			//options
552
-			if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) {
552
+			if (isset($stop['options']) && is_array($stop['options'])) {
553 553
 				$options = ' data-options="';
554
-				foreach ( $stop['options'] as $option => $value ) {
555
-					$options .= $option . ':' . $value . ';';
554
+				foreach ($stop['options'] as $option => $value) {
555
+					$options .= $option.':'.$value.';';
556 556
 				}
557 557
 				$options .= '"';
558 558
 			} else {
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 			}
561 561
 
562 562
 			//let's put all together
563
-			$content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>';
563
+			$content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>';
564 564
 		}
565 565
 
566 566
 		$content .= '</ol>';
@@ -581,31 +581,31 @@  discard block
 block discarded – undo
581 581
 	 * @throws EE_Error
582 582
 	 * @return string               html structure for status.
583 583
 	 */
584
-	public static function status_legend( $status_array, $active_status = '' ) {
585
-		if ( !is_array( $status_array ) )
586
-			throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') );
584
+	public static function status_legend($status_array, $active_status = '') {
585
+		if ( ! is_array($status_array))
586
+			throw new EE_Error(__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso'));
587 587
 
588 588
 		$setup_array = array();
589
-		foreach ( $status_array as $item => $status ) {
589
+		foreach ($status_array as $item => $status) {
590 590
 			$setup_array[$item] = array(
591
-					'class' => 'ee-status-legend ee-status-legend-' . $status,
592
-					'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ),
591
+					'class' => 'ee-status-legend ee-status-legend-'.$status,
592
+					'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'),
593 593
 					'status' => $status
594 594
 				);
595 595
 		}
596 596
 
597
-		$content = '<div class="ee-list-table-legend-container">' . "\n";
598
-		$content .= '<h4>' . __('Status Legend', 'event_espresso') . '</h4>' . "\n";
599
-		$content .= '<dl class="ee-list-table-legend">' . "\n\t";
600
-		foreach ( $setup_array as $item => $details ) {
597
+		$content = '<div class="ee-list-table-legend-container">'."\n";
598
+		$content .= '<h4>'.__('Status Legend', 'event_espresso').'</h4>'."\n";
599
+		$content .= '<dl class="ee-list-table-legend">'."\n\t";
600
+		foreach ($setup_array as $item => $details) {
601 601
 			$active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : '';
602
-			$content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t";
603
-			$content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t";
604
-			$content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t";
605
-			$content .= '</dt>' . "\n";
602
+			$content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t";
603
+			$content .= '<span class="'.$details['class'].'"></span>'."\n\t\t";
604
+			$content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t";
605
+			$content .= '</dt>'."\n";
606 606
 		}
607
-		$content .= '</dl>' . "\n";
608
-		$content .= '</div>' . "\n";
607
+		$content .= '</dl>'."\n";
608
+		$content .= '</div>'."\n";
609 609
 		return $content;
610 610
 	}
611 611
 
@@ -618,8 +618,8 @@  discard block
 block discarded – undo
618 618
 	 * @return string
619 619
 	 */
620 620
 	public static function layout_array_as_table($data) {
621
-	if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) {
622
-		$data = (array)$data;
621
+	if (is_object($data) || $data instanceof __PHP_Incomplete_Class) {
622
+		$data = (array) $data;
623 623
 	}
624 624
 	EE_Registry::instance()->load_helper('Array');
625 625
 	ob_start();
@@ -633,10 +633,10 @@  discard block
 block discarded – undo
633 633
 						?>
634 634
 						<tr>
635 635
 							<td>
636
-								<?php echo $data_key;?>
636
+								<?php echo $data_key; ?>
637 637
 							</td>
638 638
 							<td>
639
-								<?php echo self::layout_array_as_table($data_values);?>
639
+								<?php echo self::layout_array_as_table($data_values); ?>
640 640
 							</td>
641 641
 						</tr>
642 642
 						<?php
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 			<ul>
651 651
 				<?php
652 652
 				foreach ($data as $datum) {
653
-					echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>";
653
+					echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>";
654 654
 				}?>
655 655
 			</ul>
656 656
 			<?php
@@ -680,8 +680,8 @@  discard block
 block discarded – undo
680 680
 	 *
681 681
 	 * @return string
682 682
 	 */
683
-	public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) {
684
-		echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label );
683
+	public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) {
684
+		echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label);
685 685
 	}
686 686
 
687 687
 
@@ -705,13 +705,13 @@  discard block
 block discarded – undo
705 705
 	 *                                 )
706 706
 	 * @return  string
707 707
 	 */
708
-	public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) {
708
+	public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) {
709 709
 		$page_links = array();
710 710
 		$disable_first = $disable_last = '';
711 711
 		$total_items = (int) $total_items;
712 712
 		$per_page = (int) $per_page;
713 713
 		$current = (int) $current;
714
-		$paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name );
714
+		$paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name);
715 715
 
716 716
 		//filter items_label
717 717
 		$items_label = apply_filters(
@@ -719,68 +719,68 @@  discard block
 block discarded – undo
719 719
 			$items_label
720 720
 		);
721 721
 
722
-		if ( empty( $items_label )
723
-		     || ! is_array( $items_label )
724
-		     || ! isset( $items_label['single'] )
725
-		     || ! isset( $items_label['plural'] ) ) {
722
+		if (empty($items_label)
723
+		     || ! is_array($items_label)
724
+		     || ! isset($items_label['single'])
725
+		     || ! isset($items_label['plural'])) {
726 726
 			$items_label = array(
727
-				'single' => __( '1 item', 'event_espresso' ),
728
-				'plural' => __( '%s items', 'event_espresso' )
727
+				'single' => __('1 item', 'event_espresso'),
728
+				'plural' => __('%s items', 'event_espresso')
729 729
 			);
730 730
 		} else {
731 731
 			$items_label = array(
732
-				'single' => '1 ' . esc_html( $items_label['single'] ),
733
-				'plural' => '%s ' . esc_html( $items_label['plural'] )
732
+				'single' => '1 '.esc_html($items_label['single']),
733
+				'plural' => '%s '.esc_html($items_label['plural'])
734 734
 			);
735 735
 		}
736 736
 
737
-		$total_pages = ceil( $total_items / $per_page );
737
+		$total_pages = ceil($total_items / $per_page);
738 738
 
739
-		if ( $total_pages <= 1 )
739
+		if ($total_pages <= 1)
740 740
 			return '';
741 741
 
742
-		$item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single'];
742
+		$item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single'];
743 743
 
744
-		$output = '<span class="displaying-num">' . $item_label . '</span>';
744
+		$output = '<span class="displaying-num">'.$item_label.'</span>';
745 745
 
746
-		if ( $current === 1 ) {
746
+		if ($current === 1) {
747 747
 			$disable_first = ' disabled';
748 748
 		}
749
-		if ( $current == $total_pages ) {
749
+		if ($current == $total_pages) {
750 750
 			$disable_last = ' disabled';
751 751
 		}
752 752
 
753
-		$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
754
-			'first-page' . $disable_first,
755
-			esc_attr__( 'Go to the first page' ),
756
-			esc_url( remove_query_arg( $paged_arg_name, $url ) ),
753
+		$page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>",
754
+			'first-page'.$disable_first,
755
+			esc_attr__('Go to the first page'),
756
+			esc_url(remove_query_arg($paged_arg_name, $url)),
757 757
 			'&laquo;'
758 758
 		);
759 759
 
760 760
 		$page_links[] = sprintf(
761 761
 			'<a class="%s" title="%s" href="%s">%s</a>',
762
-			'prev-page' . $disable_first,
763
-			esc_attr__( 'Go to the previous page' ),
764
-			esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ),
762
+			'prev-page'.$disable_first,
763
+			esc_attr__('Go to the previous page'),
764
+			esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)),
765 765
 			'&lsaquo;'
766 766
 		);
767 767
 
768
-		if ( ! $show_num_field ) {
768
+		if ( ! $show_num_field) {
769 769
 			$html_current_page = $current;
770 770
 		} else {
771
-			$html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
772
-				esc_attr__( 'Current page' ),
771
+			$html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
772
+				esc_attr__('Current page'),
773 773
 				$current,
774
-				strlen( $total_pages )
774
+				strlen($total_pages)
775 775
 			);
776 776
 		}
777 777
 
778 778
 		$html_total_pages = sprintf(
779 779
 			'<span class="total-pages">%s</span>',
780
-			number_format_i18n( $total_pages )
780
+			number_format_i18n($total_pages)
781 781
 		);
782 782
 		$page_links[] = sprintf(
783
-			_x( '%3$s%1$s of %2$s%4$s', 'paging' ),
783
+			_x('%3$s%1$s of %2$s%4$s', 'paging'),
784 784
 			$html_current_page,
785 785
 			$html_total_pages,
786 786
 			'<span class="paging-input">',
@@ -789,29 +789,29 @@  discard block
 block discarded – undo
789 789
 
790 790
 		$page_links[] = sprintf(
791 791
 			'<a class="%s" title="%s" href="%s">%s</a>',
792
-			'next-page' . $disable_last,
793
-			esc_attr__( 'Go to the next page' ),
794
-			esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ),
792
+			'next-page'.$disable_last,
793
+			esc_attr__('Go to the next page'),
794
+			esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)),
795 795
 			'&rsaquo;'
796 796
 		);
797 797
 
798 798
 		$page_links[] = sprintf(
799 799
 			'<a class="%s" title="%s" href="%s">%s</a>',
800
-			'last-page' . $disable_last,
801
-			esc_attr__( 'Go to the last page' ),
802
-			esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ),
800
+			'last-page'.$disable_last,
801
+			esc_attr__('Go to the last page'),
802
+			esc_url(add_query_arg($paged_arg_name, $total_pages, $url)),
803 803
 			'&raquo;'
804 804
 		);
805 805
 
806
-		$output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>';
806
+		$output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>';
807 807
 		// set page class
808
-		if ( $total_pages ) {
808
+		if ($total_pages) {
809 809
 			$page_class = $total_pages < 2 ? ' one-page' : '';
810 810
 		} else {
811 811
 			$page_class = ' no-pages';
812 812
 		}
813 813
 
814
-		return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>';
814
+		return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>';
815 815
 	}
816 816
 
817 817
 
Please login to merge, or discard this patch.
core/db_models/relations/EE_HABTM_Any_Relation.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,6 @@
 block discarded – undo
32 32
 	/**
33 33
 	 * 
34 34
 	 * @param string $model_name
35
-	 * @param string $comparison_model_name
36 35
 	 * @param string $id_or_name_field should be the string 'ID' or 'name' only
37 36
 	 * @return EE_Model_Field_Base
38 37
 	 */
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
  * Joins any two models together via a has-and-belongs-to-many relation, using 
4 4
  * the esp_extra_join table.
5 5
  */
6
-class EE_HABTM_Any_Relation extends EE_HABTM_Relation{	
6
+class EE_HABTM_Any_Relation extends EE_HABTM_Relation {	
7 7
 	/**
8 8
 	 *
9 9
 	 * @var string
@@ -17,16 +17,16 @@  discard block
 block discarded – undo
17 17
 	 * @param boolean $block_deletes for this type of relation, we block by default for now. if there are related models across this relation, block (prevent and add an error) the deletion of this model
18 18
 	 * @param type $blocking_delete_error_message a customized error message on blocking deletes instead of the default
19 19
 	 */
20
-	function __construct( $block_deletes = true, $blocking_delete_error_message =''){
21
-		parent::__construct( 'Extra_Join', $block_deletes, $blocking_delete_error_message);
20
+	function __construct($block_deletes = true, $blocking_delete_error_message = '') {
21
+		parent::__construct('Extra_Join', $block_deletes, $blocking_delete_error_message);
22 22
 	}
23
-	function _construct_finalize_set_models($this_model_name, $other_model_name){
24
-		if( $this_model_name < $other_model_name ) {
23
+	function _construct_finalize_set_models($this_model_name, $other_model_name) {
24
+		if ($this_model_name < $other_model_name) {
25 25
 			$this->_alphabetically_first_model_name = $this_model_name;
26
-		} else{
26
+		} else {
27 27
 			$this->_alphabetically_first_model_name = $other_model_name;
28 28
 		}
29
-		return parent::_construct_finalize_set_models( $this_model_name, $other_model_name );
29
+		return parent::_construct_finalize_set_models($this_model_name, $other_model_name);
30 30
 	}
31 31
 	
32 32
 	/**
@@ -36,21 +36,21 @@  discard block
 block discarded – undo
36 36
 	 * @param string $id_or_name_field should be the string 'ID' or 'name' only
37 37
 	 * @return EE_Model_Field_Base
38 38
 	 */
39
-	function get_join_table_fk_field_to( $model_name, $id_or_name_field ) {
39
+	function get_join_table_fk_field_to($model_name, $id_or_name_field) {
40 40
 		$order = null;
41
-		if( $model_name === $this->_alphabetically_first_model_name ) {
41
+		if ($model_name === $this->_alphabetically_first_model_name) {
42 42
 			$order = 'first';
43 43
 		} else {
44 44
 			$order = 'second';
45 45
 		}
46
-		return $this->get_join_model()->field_settings_for( 'EXJ_' . $order . '_model_' . $id_or_name_field );
46
+		return $this->get_join_model()->field_settings_for('EXJ_'.$order.'_model_'.$id_or_name_field);
47 47
 	}
48 48
 	/**
49 49
 	 * Gets the SQL string for joining the main model's table containing the pk to the join table. Eg "LEFT JOIN real_join_table AS join_table_alias ON this_table_alias.pk = join_table_alias.fk_to_this_table"
50 50
 	 * @param string $model_relation_chain like 'Event.Event_Venue.Venue'
51 51
 	 * @return string of SQL
52 52
 	 */
53
-	function get_join_to_intermediate_model_statement($model_relation_chain){
53
+	function get_join_to_intermediate_model_statement($model_relation_chain) {
54 54
 		//create sql like
55 55
 		//LEFT JOIN join_table AS join_table_alias ON this_table_alias.this_table_pk = join_table_alias.join_table_fk_to_this
56 56
 		//LEFT JOIN other_table AS other_table_alias ON join_table_alias.join_table_fk_to_other = other_table_alias.other_table_pk
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
 		$field_with_model_name = $this->get_join_table_fk_field_to( 
65 65
 				$this->get_this_model()->get_this_model_name(), 
66 66
 				'name' );
67
-		$this_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($model_relation_chain, $this->get_this_model()->get_this_model_name()) . $this_table_pk_field->get_table_alias();
68
-		$join_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($model_relation_chain, $this->get_join_model()->get_this_model_name()) . $join_table_fk_field_to_this_table->get_table_alias();
67
+		$this_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($model_relation_chain, $this->get_this_model()->get_this_model_name()).$this_table_pk_field->get_table_alias();
68
+		$join_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($model_relation_chain, $this->get_join_model()->get_this_model_name()).$join_table_fk_field_to_this_table->get_table_alias();
69 69
 		$join_table = $this->get_join_model()->get_table_for_alias($join_table_alias);
70 70
 		//phew! ok, we have all the info we need, now we can create the SQL join string
71 71
 		$SQL = $this->_left_join(
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 					$join_table_fk_field_to_this_table->get_table_column(), 
75 75
 					$this_table_alias, 
76 76
 					$this_table_pk_field->get_table_column(),
77
-					$field_with_model_name->get_qualified_column()."='".$this->get_this_model()->get_this_model_name()."'" ) .
77
+					$field_with_model_name->get_qualified_column()."='".$this->get_this_model()->get_this_model_name()."'" ).
78 78
 				$this->get_join_model()->_construct_internal_join_to_table_with_alias($join_table_alias);
79 79
 
80 80
 		return $SQL;
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
 	 * @param string $model_relation_chain like 'Event.Event_Venue.Venue'
88 88
 	 * @return string of SQL
89 89
 	 */
90
-	function get_join_statement($model_relation_chain){
91
-		if( $this->_model_relation_chain_to_join_model === NULL ){
92
-			throw new EE_Error( sprintf( __( 'When using EE_HABTM_Relation to create a join, you must call get_join_to_intermediate_model_statement BEFORE get_join_statement', 'event_espresso' )));
90
+	function get_join_statement($model_relation_chain) {
91
+		if ($this->_model_relation_chain_to_join_model === NULL) {
92
+			throw new EE_Error(sprintf(__('When using EE_HABTM_Relation to create a join, you must call get_join_to_intermediate_model_statement BEFORE get_join_statement', 'event_espresso')));
93 93
 		}
94 94
 		$join_table_fk_field_to_this_table = $this->get_join_table_fk_field_to( 
95 95
 				$this->get_this_model()->get_this_model_name(), 
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
 				$this->get_other_model()->get_this_model_name(), 
102 102
 				'name' );
103 103
 		
104
-		$join_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($this->_model_relation_chain_to_join_model, $this->get_join_model()->get_this_model_name()) . $join_table_fk_field_to_this_table->get_table_alias();
104
+		$join_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($this->_model_relation_chain_to_join_model, $this->get_join_model()->get_this_model_name()).$join_table_fk_field_to_this_table->get_table_alias();
105 105
 		
106 106
 		$other_table_pk_field = $this->get_other_model()->get_primary_key_field();
107
-		$other_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($model_relation_chain, $this->get_other_model()->get_this_model_name()) . $other_table_pk_field->get_table_alias();
107
+		$other_table_alias = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($model_relation_chain, $this->get_other_model()->get_this_model_name()).$other_table_pk_field->get_table_alias();
108 108
 		$other_table = $this->get_other_model()->get_table_for_alias($other_table_alias);
109 109
 
110 110
 		$SQL = $this->_left_join(
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 					$join_table_alias, 
115 115
 					$join_table_fk_field_to_other_table->get_table_column(),
116 116
 					$field_with_other_model_name->get_qualified_column()."='".$this->get_other_model()->get_this_model_name()."'" 
117
-				) . 
117
+				). 
118 118
 				$this->get_other_model()->_construct_internal_join_to_table_with_alias($other_table_alias);
119 119
 		return $SQL;
120 120
 	}
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * @param array             $extra_join_model_fields_n_values col=>val pairs that are used as extra conditions for checking existing values and for setting new rows if no exact matches.
127 127
 	 * @return EE_Base_Class
128 128
 	 */
129
-	 function add_relation_to($this_obj_or_id, $other_obj_or_id, $extra_join_model_fields_n_values = array() ){
129
+	 function add_relation_to($this_obj_or_id, $other_obj_or_id, $extra_join_model_fields_n_values = array()) {
130 130
 		 $this_model_obj = $this->get_this_model()->ensure_is_obj($this_obj_or_id, true);
131 131
 		 $other_model_obj = $this->get_other_model()->ensure_is_obj($other_obj_or_id, true);
132 132
 		//check if such a relationship already exists
@@ -143,31 +143,31 @@  discard block
 block discarded – undo
143 143
 				$this->get_other_model()->get_this_model_name(),
144 144
 				'name' );
145 145
 
146
-		$cols_n_values =  array(
146
+		$cols_n_values = array(
147 147
 				$join_model_fk_to_this_model->get_name() => $this_model_obj->ID(),
148 148
 				$join_model_name_field_to_this_model->get_name() => $this_model_obj->get_model()->get_this_model_name(),
149 149
 				$join_model_fk_to_other_model->get_name() => $other_model_obj->ID(),
150 150
 				$join_model_name_field_to_other_model->get_name() => $other_model_obj->get_model()->get_this_model_name() );
151 151
 
152 152
 		//if $where_query exists lets add them to the query_params.
153
-		if ( !empty( $extra_join_model_fields_n_values ) ) {
153
+		if ( ! empty($extra_join_model_fields_n_values)) {
154 154
 		   //make sure we strip any of the join model names from the $where_query cause we don't need that in here (why? because client code may have used the same conditionals for get_all_related which DOES need the join model name)
155 155
 		   //make sure we strip THIS models name from the query param
156
-		   foreach ( $extra_join_model_fields_n_values as $query_param => $val ) {
157
-			   $query_param = str_replace($this->get_join_model()->get_this_model_name().".","", $query_param);
156
+		   foreach ($extra_join_model_fields_n_values as $query_param => $val) {
157
+			   $query_param = str_replace($this->get_join_model()->get_this_model_name().".", "", $query_param);
158 158
 			   $parsed_query[$query_param] = $val;
159 159
 		   }
160
-		   $cols_n_values = array_merge( $cols_n_values, $parsed_query );
160
+		   $cols_n_values = array_merge($cols_n_values, $parsed_query);
161 161
 		}
162 162
 
163
-		$query_params = array( $cols_n_values );
163
+		$query_params = array($cols_n_values);
164 164
 
165 165
 
166 166
 		$existing_entry_in_join_table = $this->get_join_model()->get_one($query_params);
167 167
 		//if there is already an entry in the join table, indicating a relationship, we're done
168 168
 		 //again, if you want more sophisticated logic or insertions (handling more columns than just 2 foreign keys to
169 169
 		 //the other tables, use the joining model directly!
170
-		if( ! $existing_entry_in_join_table ){
170
+		if ( ! $existing_entry_in_join_table) {
171 171
 			$this->get_join_model()->insert($cols_n_values);
172 172
 		}
173 173
 		return $other_model_obj;
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 * * @param array           $where_query col=>val pairs that are used as extra conditions for checking existing values and for removing existing rows if exact matches exist.
180 180
 	 * @return EE_Base_Class
181 181
 	 */
182
-	 function remove_relation_to($this_obj_or_id, $other_obj_or_id, $where_query = array() ){
182
+	 function remove_relation_to($this_obj_or_id, $other_obj_or_id, $where_query = array()) {
183 183
 		 $this_model_obj = $this->get_this_model()->ensure_is_obj($this_obj_or_id, true);
184 184
 		 $other_model_obj = $this->get_other_model()->ensure_is_obj($other_obj_or_id, true);
185 185
 		//check if such a relationship already exists
@@ -196,24 +196,24 @@  discard block
 block discarded – undo
196 196
 				$this->get_other_model()->get_this_model_name(), 
197 197
 				'name' );
198 198
 
199
-		$cols_n_values =  array(
199
+		$cols_n_values = array(
200 200
 				$join_model_fk_to_this_model->get_name() => $this_model_obj->ID(),
201 201
 				$join_model_name_field_to_this_model->get_name() => $this_model_obj->get_model()->get_this_model_name(),
202 202
 				$join_model_fk_to_other_model->get_name() => $other_model_obj->ID(),
203 203
 				$join_model_name_field_to_other_model->get_name() => $other_model_obj->get_model()->get_this_model_name() );
204 204
 
205 205
 		//if $where_query exists lets add them to the query_params.
206
-		if ( !empty( $where_query ) ) {
206
+		if ( ! empty($where_query)) {
207 207
 		 	//make sure we strip any of the join model names from the $where_query cause we don't need that in here (why? because client code may have used the same conditionals for get_all_related which DOES need the join model name)
208 208
 		 	//make sure we strip THIS models name from the query param
209
-		 	foreach ( $where_query as $query_param => $val ) {
210
-				$query_param = str_replace($this->get_join_model()->get_this_model_name().".","", $query_param);
209
+		 	foreach ($where_query as $query_param => $val) {
210
+				$query_param = str_replace($this->get_join_model()->get_this_model_name().".", "", $query_param);
211 211
 				$parsed_query[$query_param] = $val;
212 212
 			}
213
-		 	$cols_n_values = array_merge( $cols_n_values, $parsed_query );
213
+		 	$cols_n_values = array_merge($cols_n_values, $parsed_query);
214 214
 		}
215 215
 
216
-		$existing_entry_in_join_table = $this->get_join_model()->delete( array($cols_n_values) );
216
+		$existing_entry_in_join_table = $this->get_join_model()->delete(array($cols_n_values));
217 217
 		return $other_model_obj;
218 218
 	 }
219 219
 }
Please login to merge, or discard this patch.