Completed
Branch BUG-9583-fix-fetching-term-rel... (646110)
by
unknown
539:15 queued 523:53
created
reg_steps/payment_options/payment_options_main.template.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,37 +1,37 @@
 block discarded – undo
1 1
 
2 2
 	<h4 id="reg-page-totals-hdr" class="">
3
-		<span class="drk-grey-text"><?php _e('Registrations:', 'event_espresso'); ?></span> <?php echo $reg_count;?>
3
+		<span class="drk-grey-text"><?php _e('Registrations:', 'event_espresso'); ?></span> <?php echo $reg_count; ?>
4 4
 	</h4>
5 5
 
6 6
 	<div class="spco-payment-info-dv">
7 7
 		<table id="spco-payment-info-table">
8 8
 			<thead>
9 9
 				<tr>
10
-					<th scope="col" width=""><?php _e('Name and Description', 'event_espresso');?></th>
11
-					<th scope="col" width="15%" class="jst-cntr"><?php _e('Price', 'event_espresso');?></th>
12
-					<th scope="col" width="5%" class="jst-cntr"><?php _e( 'Qty', 'event_espresso' ); ?></th>
13
-					<th scope="col" width="15%" class="jst-cntr"><?php _e('Total', 'event_espresso');?></th>
14
-					<?php	do_action( 'AHEE__registration_page_payment_options__payment_info_table_thead_row_end' ); ?>
10
+					<th scope="col" width=""><?php _e('Name and Description', 'event_espresso'); ?></th>
11
+					<th scope="col" width="15%" class="jst-cntr"><?php _e('Price', 'event_espresso'); ?></th>
12
+					<th scope="col" width="5%" class="jst-cntr"><?php _e('Qty', 'event_espresso'); ?></th>
13
+					<th scope="col" width="15%" class="jst-cntr"><?php _e('Total', 'event_espresso'); ?></th>
14
+					<?php	do_action('AHEE__registration_page_payment_options__payment_info_table_thead_row_end'); ?>
15 15
 				</tr>
16 16
 			</thead>
17 17
 			<tbody>
18
-			<?php echo $transaction_details;?>
19
-			<?php	do_action( 'AHEE__registration_page_payment_options__payment_info_table_tbody_end' ); ?>
18
+			<?php echo $transaction_details; ?>
19
+			<?php	do_action('AHEE__registration_page_payment_options__payment_info_table_tbody_end'); ?>
20 20
 			</tbody>
21 21
 		</table>
22 22
 	</div>
23 23
 	<div class="clear-float"> </div>
24 24
 
25
-	<?php  echo $before_payment_options;  ?>
25
+	<?php  echo $before_payment_options; ?>
26 26
 
27 27
 	<div id="methods-of-payment">
28 28
 		<?php echo $payment_options; ?>
29
-		<a id="reg-page-select-other-method-of-payment-lnk" class="hidden smaller-text right" rel=""><?php echo apply_filters( 'FHEE__registration_page_payment_options__select_other_method_of_payment_lnk', __( 'select a different method of payment:', 'event_espresso' )); ?></a>
29
+		<a id="reg-page-select-other-method-of-payment-lnk" class="hidden smaller-text right" rel=""><?php echo apply_filters('FHEE__registration_page_payment_options__select_other_method_of_payment_lnk', __('select a different method of payment:', 'event_espresso')); ?></a>
30 30
 	</div>
31 31
 	<!-- end #methods-of-payment -->
32 32
 
33
-	<?php  echo $after_payment_options;  ?>
33
+	<?php  echo $after_payment_options; ?>
34 34
 
35
-	<?php  echo $default_hidden_inputs;  ?>
36
-	<?php  echo $extra_hidden_inputs;  ?>
35
+	<?php  echo $default_hidden_inputs; ?>
36
+	<?php  echo $extra_hidden_inputs; ?>
37 37
 
Please login to merge, or discard this patch.
public/Espresso_Arabica_2014/content-espresso_venues-details.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,43 +1,43 @@
 block discarded – undo
1 1
 <?php //echo '<h1>' . __FILE__ . '</h1>'; ?>
2 2
 <?php global $post; ?>
3 3
 <div class="venue-content">
4
-<?php if ( apply_filters( 'FHEE__content_espresso_venues_details_template__display_entry_meta', TRUE )): ?>
4
+<?php if (apply_filters('FHEE__content_espresso_venues_details_template__display_entry_meta', TRUE)): ?>
5 5
 	<div class="entry-meta">
6
-		<span class="tags-links"><?php espresso_venue_categories( $post->ID, TRUE, TRUE ); ?></span>
6
+		<span class="tags-links"><?php espresso_venue_categories($post->ID, TRUE, TRUE); ?></span>
7 7
 		<?php
8
-			if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) :
8
+			if ( ! post_password_required() && (comments_open() || get_comments_number())) :
9 9
 		?>
10
-		<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'event_espresso' ), __( '1 Comment', 'event_espresso' ), __( '% Comments', 'event_espresso' ) ); ?></span>
10
+		<span class="comments-link"><?php comments_popup_link(__('Leave a comment', 'event_espresso'), __('1 Comment', 'event_espresso'), __('% Comments', 'event_espresso')); ?></span>
11 11
 		<?php
12 12
 			endif;
13 13
 
14
-			edit_post_link( __( 'Edit', 'event_espresso' ), '<span class="edit-link">', '</span>' );
14
+			edit_post_link(__('Edit', 'event_espresso'), '<span class="edit-link">', '</span>');
15 15
 		?>
16 16
 	</div>
17 17
 <?php  endif; ?>
18 18
 	
19 19
 	<h3 class="event-venues-h3 ee-event-h3">
20
-		<?php _e( 'Details', 'event_espresso' ); ?>
20
+		<?php _e('Details', 'event_espresso'); ?>
21 21
 	</h3>
22 22
 
23
-	<?php if ( $venue_phone = espresso_venue_phone( $post->ID, FALSE )) : ?>
23
+	<?php if ($venue_phone = espresso_venue_phone($post->ID, FALSE)) : ?>
24 24
 	<p>
25
-		<span class="small-text"><strong><?php _e( 'Venue Phone:', 'event_espresso' ); ?> </strong></span><?php echo $venue_phone; ?>
25
+		<span class="small-text"><strong><?php _e('Venue Phone:', 'event_espresso'); ?> </strong></span><?php echo $venue_phone; ?>
26 26
 	</p>
27 27
 	<?php endif; ?>
28
-	<?php if ( $venue_website = espresso_venue_website( $post->ID, FALSE )) : ?>
28
+	<?php if ($venue_website = espresso_venue_website($post->ID, FALSE)) : ?>
29 29
 	<p>
30
-		<span class="small-text"><strong><?php _e( 'Venue Website:', 'event_espresso' ); ?> </strong></span><?php echo $venue_website; ?>
30
+		<span class="small-text"><strong><?php _e('Venue Website:', 'event_espresso'); ?> </strong></span><?php echo $venue_website; ?>
31 31
 	</p>
32 32
 	<?php endif; ?>
33 33
 	<?php 
34
-	do_action( 'AHEE__content_espresso_venues_details_template__before_the_content', $post ); 
35
-	if ( is_archive() && has_excerpt( $post->ID )) {
34
+	do_action('AHEE__content_espresso_venues_details_template__before_the_content', $post); 
35
+	if (is_archive() && has_excerpt($post->ID)) {
36 36
 		the_excerpt();
37 37
 	} else {
38 38
 		the_content();
39 39
 	}
40
-	do_action( 'AHEE__content_espresso_venues_details_template__after_the_content', $post ); 
40
+	do_action('AHEE__content_espresso_venues_details_template__after_the_content', $post); 
41 41
 	?>
42 42
 </div>
43 43
 <!-- .venue-content -->
Please login to merge, or discard this patch.
core/db_models/EEM_Post_Meta.model.php 2 patches
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.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,20 +31,20 @@  discard block
 block discarded – undo
31 31
  *
32 32
  * ------------------------------------------------------------------------
33 33
  */
34
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
34
+require_once (EE_MODELS.'EEM_Base.model.php');
35 35
 
36 36
 class EEM_Post_Meta extends EEM_Base {
37 37
 
38 38
   	// private instance of the EE_Post_Meta object
39 39
 	protected static $_instance = NULL;
40 40
 
41
-	protected function __construct( $timezone = NULL ) {
42
-		$this->singular_item = __('Post Meta','event_espresso');
43
-		$this->plural_item = __('Post Metas','event_espresso');
41
+	protected function __construct($timezone = NULL) {
42
+		$this->singular_item = __('Post Meta', 'event_espresso');
43
+		$this->plural_item = __('Post Metas', 'event_espresso');
44 44
 		$this->_tables = array(
45 45
 			'Post_Meta'=> new EE_Primary_Table('postmeta', 'meta_id')
46 46
 		);
47
-		$models_this_can_attach_to = array_keys( EE_Registry::instance()->cpt_models() );
47
+		$models_this_can_attach_to = array_keys(EE_Registry::instance()->cpt_models());
48 48
 		$this->_fields = array(
49 49
 			'Post_Meta'=>array(
50 50
 				'meta_id'=>new EE_Primary_Key_Int_Field('meta_id', __("Meta ID", "event_espresso")),
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
 				'meta_value'=>new EE_Maybe_Serialized_Text_Field('meta_value', __("Meta Value", "event_espresso"), true)
54 54
 			));
55 55
 		$this->_model_relations = array();
56
-		foreach($models_this_can_attach_to as $model){
56
+		foreach ($models_this_can_attach_to as $model) {
57 57
 			$this->_model_relations[$model] = new EE_Belongs_To_Relation();
58 58
 		}
59
-		foreach( $this->cap_contexts_to_cap_action_map() as $cap_context => $action ) {
60
-			$this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta( 'meta_key', 'meta_value' );
59
+		foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) {
60
+			$this->_cap_restriction_generators[$cap_context] = new EE_Restriction_Generator_Meta('meta_key', 'meta_value');
61 61
 		}
62
-		parent::__construct( $timezone );
62
+		parent::__construct($timezone);
63 63
 	}
64 64
 
65 65
 
Please login to merge, or discard this patch.
admin_pages/venues/Venues_Admin_Page.core.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -944,7 +944,7 @@
 block discarded – undo
944 944
 	 * @access  private
945 945
 	 * @param  int $VNU_ID
946 946
 	 * @param  string $venue_status
947
-	 * @return void
947
+	 * @return boolean
948 948
 	 */
949 949
 	private function _change_venue_status( $VNU_ID = 0, $venue_status = '' ) {
950 950
 		// grab venue id
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
@@ -893,8 +894,9 @@  discard block
 block discarded – undo
893 894
 		}
894 895
 		$action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
895 896
 
896
-		if ( $redirect_after )
897
-			$this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default'));
897
+		if ( $redirect_after ) {
898
+					$this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default'));
899
+		}
898 900
 
899 901
 	}
900 902
 
@@ -1013,8 +1015,9 @@  discard block
 block discarded – undo
1013 1015
 			$msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso');
1014 1016
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1015 1017
 		}
1016
-		if ( $redirect_after )
1017
-			$this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default'));
1018
+		if ( $redirect_after ) {
1019
+					$this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default'));
1020
+		}
1018 1021
 	}
1019 1022
 
1020 1023
 
@@ -1185,8 +1188,10 @@  discard block
 block discarded – undo
1185 1188
 	 * @return void
1186 1189
 	 */
1187 1190
 	private function _set_category_object() {
1188
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
1189
-			return; //already have the category object so get out.
1191
+		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) {
1192
+					return;
1193
+		}
1194
+		//already have the category object so get out.
1190 1195
 
1191 1196
 		//set default category object
1192 1197
 		$this->_set_empty_category_object();
Please login to merge, or discard this patch.
Spacing   +238 added lines, -238 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
 /**
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
 
63 63
 
64 64
 	protected function _init_page_props() {
65
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
65
+		require_once(EE_MODELS.'EEM_Venue.model.php');
66 66
 		$this->page_slug = EE_VENUES_PG_SLUG;
67 67
 		$this->_admin_base_url = EE_VENUES_ADMIN_URL;
68
-		$this->_admin_base_path = EE_ADMIN_PAGES . 'venues';
68
+		$this->_admin_base_path = EE_ADMIN_PAGES.'venues';
69 69
 		$this->page_label = __('Event Venues', 'event_espresso');
70 70
 		$this->_cpt_model_names = array(
71 71
 			'create_new' => 'EEM_Venue',
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 				'edit' => __('Update Venue', 'event_espresso'),
109 109
 				'add_category' => __('Save New Category', 'event_espresso'),
110 110
 				'edit_category' => __('Update Category', 'event_espresso'),
111
-				'google_map_settings' => __( 'Update Settings', 'event_espresso' )
111
+				'google_map_settings' => __('Update Settings', 'event_espresso')
112 112
 				)
113 113
 		);
114 114
 	}
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 		//load field generator helper
124 124
 
125 125
 		//is there a vnu_id in the request?
126
-		$vnu_id = ! empty( $this->_req_data['VNU_ID'] ) && ! is_array( $this->_req_data['VNU_ID'] ) ? $this->_req_data['VNU_ID'] : 0;
127
-		$vnu_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $vnu_id;
126
+		$vnu_id = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) ? $this->_req_data['VNU_ID'] : 0;
127
+		$vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id;
128 128
 
129 129
 		$this->_page_routes = array(
130 130
 			'default' => array(
@@ -142,27 +142,27 @@  discard block
 block discarded – undo
142 142
 				),
143 143
 			'trash_venue' => array(
144 144
 				'func' => '_trash_or_restore_venue',
145
-				'args' => array( 'venue_status' => 'trash' ),
145
+				'args' => array('venue_status' => 'trash'),
146 146
 				'noheader' => TRUE,
147 147
 				'capability' => 'ee_delete_venue',
148 148
 				'obj_id' => $vnu_id
149 149
 				),
150 150
 			'trash_venues' => array(
151 151
 				'func' => '_trash_or_restore_venues',
152
-				'args' => array( 'venue_status' => 'trash' ),
152
+				'args' => array('venue_status' => 'trash'),
153 153
 				'noheader' => TRUE,
154 154
 				'capability' => 'ee_delete_venues'
155 155
 				),
156 156
 			'restore_venue' => array(
157 157
 				'func' => '_trash_or_restore_venue',
158
-				'args' => array( 'venue_status' => 'draft' ),
158
+				'args' => array('venue_status' => 'draft'),
159 159
 				'noheader' => TRUE,
160 160
 				'capability' => 'ee_delete_venue',
161 161
 				'obj_id' => $vnu_id
162 162
 				),
163 163
 			'restore_venues' => array(
164 164
 				'func' => '_trash_or_restore_venues',
165
-				'args' => array( 'venue_status' => 'draft' ),
165
+				'args' => array('venue_status' => 'draft'),
166 166
 				'noheader' => TRUE,
167 167
 				'capability' => 'ee_delete_venues'
168 168
 				),
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 						'filename' => 'venues_overview_views_bulk_actions_search'
265 265
 					)
266 266
 				),
267
-				'help_tour' => array( 'Venues_Overview_Help_Tour' ),
267
+				'help_tour' => array('Venues_Overview_Help_Tour'),
268 268
 				'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'),
269 269
 				'require_nonce' => FALSE
270 270
 			),
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 						'filename' => 'venues_editor_other'
301 301
 					)
302 302
 				),
303
-				'help_tour' => array( 'Venues_Add_Venue_Help_Tour' ),
303
+				'help_tour' => array('Venues_Add_Venue_Help_Tour'),
304 304
 				'metaboxes' => array('_venue_editor_metaboxes'),
305 305
 				'require_nonce' => FALSE
306 306
 				),
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 					'label' => __('Edit Venue', 'event_espresso'),
310 310
 					'order' => 5,
311 311
 					'persistent' => FALSE,
312
-					'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post'] ), $this->_current_page_view_url )  : $this->_admin_base_url
312
+					'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post']), $this->_current_page_view_url) : $this->_admin_base_url
313 313
 				),
314 314
 				'help_tabs' => array(
315 315
 					'venues_editor_help_tab' => array(
@@ -346,14 +346,14 @@  discard block
 block discarded – undo
346 346
 					'label' => __('Google Maps'),
347 347
 					'order' => 40
348 348
 				),
349
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
349
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
350 350
 				'help_tabs' => array(
351 351
 					'general_settings_google_maps_help_tab' => array(
352 352
 						'title' => __('Google Maps', 'event_espresso'),
353 353
 						'filename' => 'general_settings_google_maps'
354 354
 					)
355 355
 				),
356
-				'help_tour' => array( 'Google_Maps_Help_Tour' ),
356
+				'help_tour' => array('Google_Maps_Help_Tour'),
357 357
 				'require_nonce' => FALSE
358 358
 			),
359 359
 			//venue category stuff
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 						'filename' => 'venues_add_category'
370 370
 					)
371 371
 				),
372
-				'help_tour' => array( 'Venues_Add_Category_Help_Tour' ),
372
+				'help_tour' => array('Venues_Add_Category_Help_Tour'),
373 373
 				'require_nonce' => FALSE
374 374
 				),
375 375
 			'edit_category' => array(
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 					'label' => __('Edit Category', 'event_espresso'),
378 378
 					'order' => 15,
379 379
 					'persistent' => FALSE,
380
-					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
380
+					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
381 381
 					),
382 382
 				'metaboxes' => array('_publish_post_box'),
383 383
 				'help_tabs' => array(
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 						'filename' => 'venues_categories_other'
414 414
 					)
415 415
 				),
416
-				'help_tour' => array( 'Venues_Categories_Help_Tour' ),
416
+				'help_tour' => array('Venues_Categories_Help_Tour'),
417 417
 				'metaboxes' => $this->_default_espresso_metaboxes,
418 418
 				'require_nonce' => FALSE
419 419
 				)
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 
471 471
 
472 472
 	public function load_scripts_styles() {
473
-		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
473
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
474 474
 		wp_enqueue_style('ee-cat-admin');
475 475
 	}
476 476
 
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 	public function load_scripts_styles_edit() {
494 494
 		//styles
495 495
 		wp_enqueue_style('espresso-ui-theme');
496
-		wp_register_style( 'espresso_venues', EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION );
496
+		wp_register_style('espresso_venues', EE_VENUES_ASSETS_URL.'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION);
497 497
 		wp_enqueue_style('espresso_venues');
498 498
 	}
499 499
 
@@ -512,13 +512,13 @@  discard block
 block discarded – undo
512 512
 				)
513 513
 		);
514 514
 
515
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venues', 'espresso_venues_trash_venues' ) ) {
515
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) {
516 516
 			$this->_views['all']['bulk_action'] = array(
517 517
 				'trash_venues' => __('Move to Trash', 'event_espresso')
518 518
 			);
519 519
 			$this->_views['trash'] = array(
520 520
 				'slug' => 'trash',
521
-				'label' => __( 'Trash', 'event_espresso' ),
521
+				'label' => __('Trash', 'event_espresso'),
522 522
 				'count' => 0,
523 523
 				'bulk_action' => array(
524 524
 					'restore_venues' => __('Restore from Trash', 'event_espresso'),
@@ -551,8 +551,8 @@  discard block
 block discarded – undo
551 551
 
552 552
 
553 553
 	protected function _overview_list_table() {
554
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
555
-		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button' );
554
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
555
+		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button');
556 556
 		$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2');
557 557
 		$this->_search_btn_label = __('Venues', 'event_espresso');
558 558
 		$this->display_admin_list_table_page_with_sidebar();
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
 			'vnu_url' => $this->_cpt_model_obj->venue_url(),
567 567
 			'vnu_phone' => $this->_cpt_model_obj->phone()
568 568
 			);
569
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php';
570
-		EEH_Template::display_template( $template, $extra_rows );
569
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_publish_box_extras.template.php';
570
+		EEH_Template::display_template($template, $extra_rows);
571 571
 	}
572 572
 
573 573
 
@@ -583,31 +583,31 @@  discard block
 block discarded – undo
583 583
 		$default_map_settings->use_google_maps = TRUE;
584 584
 		$default_map_settings->google_map_api_key = '';
585 585
 		// for event details pages (reg page)
586
-		$default_map_settings->event_details_map_width = 585; 			// ee_map_width_single
587
-		$default_map_settings->event_details_map_height = 362; 			// ee_map_height_single
588
-		$default_map_settings->event_details_map_zoom = 14; 			// ee_map_zoom_single
589
-		$default_map_settings->event_details_display_nav = TRUE; 			// ee_map_nav_display_single
590
-		$default_map_settings->event_details_nav_size = FALSE; 			// ee_map_nav_size_single
591
-		$default_map_settings->event_details_control_type = 'default'; 		// ee_map_type_control_single
592
-		$default_map_settings->event_details_map_align = 'center'; 			// ee_map_align_single
586
+		$default_map_settings->event_details_map_width = 585; // ee_map_width_single
587
+		$default_map_settings->event_details_map_height = 362; // ee_map_height_single
588
+		$default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single
589
+		$default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single
590
+		$default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single
591
+		$default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single
592
+		$default_map_settings->event_details_map_align = 'center'; // ee_map_align_single
593 593
 		// for event list pages
594
-		$default_map_settings->event_list_map_width = 300; 			// ee_map_width
595
-		$default_map_settings->event_list_map_height = 185; 		// ee_map_height
596
-		$default_map_settings->event_list_map_zoom = 12; 			// ee_map_zoom
597
-		$default_map_settings->event_list_display_nav = FALSE; 		// ee_map_nav_display
598
-		$default_map_settings->event_list_nav_size = TRUE; 			// ee_map_nav_size
599
-		$default_map_settings->event_list_control_type = 'dropdown'; 		// ee_map_type_control
600
-		$default_map_settings->event_list_map_align = 'center'; 			// ee_map_align
594
+		$default_map_settings->event_list_map_width = 300; // ee_map_width
595
+		$default_map_settings->event_list_map_height = 185; // ee_map_height
596
+		$default_map_settings->event_list_map_zoom = 12; // ee_map_zoom
597
+		$default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display
598
+		$default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size
599
+		$default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control
600
+		$default_map_settings->event_list_map_align = 'center'; // ee_map_align
601 601
 
602 602
 		$this->_template_args['map_settings'] =
603
-			isset( EE_Registry::instance()->CFG->map_settings ) && ! empty( EE_Registry::instance()->CFG->map_settings )
604
-				? (object)array_merge( (array)$default_map_settings, (array)EE_Registry::instance()->CFG->map_settings )
603
+			isset(EE_Registry::instance()->CFG->map_settings) && ! empty(EE_Registry::instance()->CFG->map_settings)
604
+				? (object) array_merge((array) $default_map_settings, (array) EE_Registry::instance()->CFG->map_settings)
605 605
 				: $default_map_settings;
606 606
 
607
-		$this->_set_add_edit_form_tags( 'update_google_map_settings' );
608
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
607
+		$this->_set_add_edit_form_tags('update_google_map_settings');
608
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
609 609
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
610
-			EE_VENUES_TEMPLATE_PATH . 'google_map.template.php',
610
+			EE_VENUES_TEMPLATE_PATH.'google_map.template.php',
611 611
 			$this->_template_args,
612 612
 			true
613 613
 		);
@@ -617,83 +617,83 @@  discard block
 block discarded – undo
617 617
 	protected function _update_google_map_settings() {
618 618
 
619 619
 		EE_Registry::instance()->CFG->map_settings->use_google_maps =
620
-			isset( $this->_req_data['use_google_maps'] )
621
-				? absint( $this->_req_data['use_google_maps'] )
620
+			isset($this->_req_data['use_google_maps'])
621
+				? absint($this->_req_data['use_google_maps'])
622 622
 				: EE_Registry::instance()->CFG->map_settings->use_google_maps;
623 623
 
624 624
 		EE_Registry::instance()->CFG->map_settings->google_map_api_key =
625
-			isset( $this->_req_data['google_map_api_key'] )
626
-				? sanitize_text_field( $this->_req_data['google_map_api_key'] )
625
+			isset($this->_req_data['google_map_api_key'])
626
+				? sanitize_text_field($this->_req_data['google_map_api_key'])
627 627
 				: EE_Registry::instance()->CFG->map_settings->google_map_api_key;
628 628
 
629 629
 		EE_Registry::instance()->CFG->map_settings->event_details_map_width =
630
-			isset( $this->_req_data['event_details_map_width'] )
631
-				? absint( $this->_req_data['event_details_map_width'] )
630
+			isset($this->_req_data['event_details_map_width'])
631
+				? absint($this->_req_data['event_details_map_width'])
632 632
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_width;
633 633
 
634 634
 		EE_Registry::instance()->CFG->map_settings->event_details_map_height =
635
-			isset( $this->_req_data['event_details_map_height'] )
636
-				? absint( $this->_req_data['event_details_map_height'] )
635
+			isset($this->_req_data['event_details_map_height'])
636
+				? absint($this->_req_data['event_details_map_height'])
637 637
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_height;
638 638
 
639 639
 		EE_Registry::instance()->CFG->map_settings->event_details_map_zoom =
640
-			isset( $this->_req_data['event_details_map_zoom'] )
641
-				? absint( $this->_req_data['event_details_map_zoom'] )
640
+			isset($this->_req_data['event_details_map_zoom'])
641
+				? absint($this->_req_data['event_details_map_zoom'])
642 642
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_zoom;
643 643
 
644 644
 		EE_Registry::instance()->CFG->map_settings->event_details_display_nav =
645
-			isset( $this->_req_data['event_details_display_nav'] )
646
-				? absint( $this->_req_data['event_details_display_nav'] )
645
+			isset($this->_req_data['event_details_display_nav'])
646
+				? absint($this->_req_data['event_details_display_nav'])
647 647
 				: EE_Registry::instance()->CFG->map_settings->event_details_display_nav;
648 648
 
649 649
 		EE_Registry::instance()->CFG->map_settings->event_details_nav_size =
650
-			isset( $this->_req_data['event_details_nav_size'] )
651
-				? absint( $this->_req_data['event_details_nav_size'] )
650
+			isset($this->_req_data['event_details_nav_size'])
651
+				? absint($this->_req_data['event_details_nav_size'])
652 652
 				: EE_Registry::instance()->CFG->map_settings->event_details_nav_size;
653 653
 
654 654
 		EE_Registry::instance()->CFG->map_settings->event_details_control_type =
655
-			isset( $this->_req_data['event_details_control_type'] )
656
-				? sanitize_text_field( $this->_req_data['event_details_control_type'] )
655
+			isset($this->_req_data['event_details_control_type'])
656
+				? sanitize_text_field($this->_req_data['event_details_control_type'])
657 657
 				: EE_Registry::instance()->CFG->map_settings->event_details_control_type;
658 658
 
659 659
 		EE_Registry::instance()->CFG->map_settings->event_details_map_align =
660
-			isset( $this->_req_data['event_details_map_align'] )
661
-				? sanitize_text_field( $this->_req_data['event_details_map_align'] )
660
+			isset($this->_req_data['event_details_map_align'])
661
+				? sanitize_text_field($this->_req_data['event_details_map_align'])
662 662
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_align;
663 663
 
664 664
 		EE_Registry::instance()->CFG->map_settings->event_list_map_width =
665
-			isset( $this->_req_data['event_list_map_width'] )
666
-				? absint( $this->_req_data['event_list_map_width'] )
665
+			isset($this->_req_data['event_list_map_width'])
666
+				? absint($this->_req_data['event_list_map_width'])
667 667
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_width;
668 668
 
669 669
 		EE_Registry::instance()->CFG->map_settings->event_list_map_height =
670
-			isset( $this->_req_data['event_list_map_height'] )
671
-				? absint( $this->_req_data['event_list_map_height'] )
670
+			isset($this->_req_data['event_list_map_height'])
671
+				? absint($this->_req_data['event_list_map_height'])
672 672
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_height;
673 673
 
674 674
 		EE_Registry::instance()->CFG->map_settings->event_list_map_zoom =
675
-			isset( $this->_req_data['event_list_map_zoom'] )
676
-				? absint( $this->_req_data['event_list_map_zoom'] )
675
+			isset($this->_req_data['event_list_map_zoom'])
676
+				? absint($this->_req_data['event_list_map_zoom'])
677 677
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_zoom;
678 678
 
679 679
 		EE_Registry::instance()->CFG->map_settings->event_list_display_nav =
680
-			isset( $this->_req_data['event_list_display_nav'] )
681
-				? absint( $this->_req_data['event_list_display_nav'] )
680
+			isset($this->_req_data['event_list_display_nav'])
681
+				? absint($this->_req_data['event_list_display_nav'])
682 682
 				: EE_Registry::instance()->CFG->map_settings->event_list_display_nav;
683 683
 
684 684
 		EE_Registry::instance()->CFG->map_settings->event_list_nav_size =
685
-			isset( $this->_req_data['event_list_nav_size'] )
686
-				? absint( $this->_req_data['event_list_nav_size'] )
685
+			isset($this->_req_data['event_list_nav_size'])
686
+				? absint($this->_req_data['event_list_nav_size'])
687 687
 				: EE_Registry::instance()->CFG->map_settings->event_list_nav_size;
688 688
 
689 689
 		EE_Registry::instance()->CFG->map_settings->event_list_control_type =
690
-			isset( $this->_req_data['event_list_control_type'] )
691
-				? sanitize_text_field( $this->_req_data['event_list_control_type'] )
690
+			isset($this->_req_data['event_list_control_type'])
691
+				? sanitize_text_field($this->_req_data['event_list_control_type'])
692 692
 				: EE_Registry::instance()->CFG->map_settings->event_list_control_type;
693 693
 
694 694
 		EE_Registry::instance()->CFG->map_settings->event_list_map_align =
695
-			isset( $this->_req_data['event_list_map_align'] )
696
-				? sanitize_text_field( $this->_req_data['event_list_map_align'] )
695
+			isset($this->_req_data['event_list_map_align'])
696
+				? sanitize_text_field($this->_req_data['event_list_map_align'])
697 697
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_align;
698 698
 
699 699
 		EE_Registry::instance()->CFG->map_settings = apply_filters(
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 			EE_Registry::instance()->CFG->map_settings,
708 708
 			__FILE__, __FUNCTION__, __LINE__
709 709
 		);
710
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'google_map_settings' ) );
710
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings'));
711 711
 
712 712
 	}
713 713
 
@@ -716,9 +716,9 @@  discard block
 block discarded – undo
716 716
 	protected function _venue_editor_metaboxes() {
717 717
 		$this->verify_cpt_object();
718 718
 
719
-		add_meta_box( 'espresso_venue_address_options', __('Physical Location', 'event_espresso'), array( $this, 'venue_address_metabox'), $this->page_slug, 'side', 'default' );
720
-		add_meta_box( 'espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array( $this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default' );
721
-		add_meta_box( 'espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array( $this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default' );
719
+		add_meta_box('espresso_venue_address_options', __('Physical Location', 'event_espresso'), array($this, 'venue_address_metabox'), $this->page_slug, 'side', 'default');
720
+		add_meta_box('espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array($this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default');
721
+		add_meta_box('espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array($this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default');
722 722
 
723 723
 	}
724 724
 
@@ -726,23 +726,23 @@  discard block
 block discarded – undo
726 726
 
727 727
 	public function venue_gmap_metabox() {
728 728
 		$template_args = array(
729
-			'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap() ),
729
+			'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap()),
730 730
 			'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(),
731 731
 			);
732
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php';
733
-		EEH_Template::display_template( $template, $template_args );
732
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_gmap_metabox_content.template.php';
733
+		EEH_Template::display_template($template, $template_args);
734 734
 	}
735 735
 
736 736
 
737 737
 
738 738
 	public function venue_address_metabox() {
739 739
 
740
-		$template_args['_venue'] =$this->_cpt_model_obj;
740
+		$template_args['_venue'] = $this->_cpt_model_obj;
741 741
 
742 742
 		$template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input(
743 743
 			$QFI = new EE_Question_Form_Input(
744
-				EE_Question::new_instance( array( 'QST_display_text' => 'State', 'QST_system' => 'state' )),
745
-				EE_Answer::new_instance( array(  'ANS_value'=> $this->_cpt_model_obj->state_ID() )),
744
+				EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')),
745
+				EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->state_ID())),
746 746
 				array(
747 747
 					'input_name' =>  'sta_id',
748 748
 					'input_id' => 'sta_id',
@@ -754,8 +754,8 @@  discard block
 block discarded – undo
754 754
 		);
755 755
 		$template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input(
756 756
 			$QFI = new EE_Question_Form_Input(
757
-				EE_Question::new_instance( array( 'QST_display_text' => 'Country', 'QST_system' => 'country' )),
758
-				EE_Answer::new_instance( array(  'ANS_value'=> $this->_cpt_model_obj->country_ID() )),
757
+				EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')),
758
+				EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->country_ID())),
759 759
 				array(
760 760
 					'input_name' =>  'cnt_iso',
761 761
 					'input_id' => 'cnt_iso',
@@ -766,8 +766,8 @@  discard block
 block discarded – undo
766 766
 			)
767 767
 		);
768 768
 
769
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php';
770
-		EEH_Template::display_template( $template, $template_args );
769
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_address_metabox_content.template.php';
770
+		EEH_Template::display_template($template, $template_args);
771 771
 	}
772 772
 
773 773
 
@@ -779,8 +779,8 @@  discard block
 block discarded – undo
779 779
 		$template_args = array(
780 780
 			'_venue' => $this->_cpt_model_obj
781 781
 			);
782
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php';
783
-		EEH_Template::display_template( $template, $template_args );
782
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_virtual_location_metabox_content.template.php';
783
+		EEH_Template::display_template($template, $template_args);
784 784
 	}
785 785
 
786 786
 
@@ -803,52 +803,52 @@  discard block
 block discarded – undo
803 803
 	 * @param  object $post    Post object (with "blessed" WP properties)
804 804
 	 * @return void
805 805
 	 */
806
-	protected function _insert_update_cpt_item( $post_id, $post ) {
806
+	protected function _insert_update_cpt_item($post_id, $post) {
807 807
 
808
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_venues' ) {
809
-			return;// get out we're not processing the saving of venues.
808
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') {
809
+			return; // get out we're not processing the saving of venues.
810 810
 		}
811 811
 
812
-		$wheres = array( $this->_venue_model->primary_key_name() => $post_id );
812
+		$wheres = array($this->_venue_model->primary_key_name() => $post_id);
813 813
 
814 814
 		$venue_values = array(
815
-			'VNU_address' => !empty( $this->_req_data['vnu_address'] ) ? $this->_req_data['vnu_address'] : NULL,
816
-			'VNU_address2' => !empty( $this->_req_data['vnu_address2'] ) ? $this->_req_data['vnu_address2'] : NULL,
817
-			'VNU_city' => !empty( $this->_req_data['vnu_city'] ) ? $this->_req_data['vnu_city'] : NULL,
818
-			'STA_ID' => !empty( $this->_req_data['sta_id'] ) ? $this->_req_data['sta_id'] : NULL,
819
-			'CNT_ISO' => !empty( $this->_req_data['cnt_iso'] ) ? $this->_req_data['cnt_iso'] : NULL,
820
-			'VNU_zip' => !empty( $this->_req_data['vnu_zip'] ) ? $this->_req_data['vnu_zip'] : NULL,
821
-			'VNU_phone' => !empty( $this->_req_data['vnu_phone'] ) ? $this->_req_data['vnu_phone'] : NULL,
822
-			'VNU_capacity' => !empty( $this->_req_data['vnu_capacity'] ) ? str_replace( ',', '', $this->_req_data['vnu_capacity'] ) : EE_INF,
823
-			'VNU_url' => !empty( $this->_req_data['vnu_url'] ) ? $this->_req_data['vnu_url'] : NULL,
824
-			'VNU_virtual_phone' => !empty( $this->_req_data['vnu_virtual_phone'] ) ? $this->_req_data['vnu_virtual_phone'] : NULL,
825
-			'VNU_virtual_url' => !empty( $this->_req_data['vnu_virtual_url'] ) ? $this->_req_data['vnu_virtual_url'] : NULL,
826
-			'VNU_enable_for_gmap' => !empty( $this->_req_data['vnu_enable_for_gmap'] ) ? TRUE : FALSE,
827
-			'VNU_google_map_link' => !empty( $this->_req_data['vnu_google_map_link'] ) ? $this->_req_data['vnu_google_map_link'] : NULL
815
+			'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : NULL,
816
+			'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] : NULL,
817
+			'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : NULL,
818
+			'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : NULL,
819
+			'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : NULL,
820
+			'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : NULL,
821
+			'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : NULL,
822
+			'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace(',', '', $this->_req_data['vnu_capacity']) : EE_INF,
823
+			'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : NULL,
824
+			'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) ? $this->_req_data['vnu_virtual_phone'] : NULL,
825
+			'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] : NULL,
826
+			'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? TRUE : FALSE,
827
+			'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) ? $this->_req_data['vnu_google_map_link'] : NULL
828 828
 			);
829 829
 
830 830
 		//update venue
831
-		$success = $this->_venue_model->update( $venue_values, array( $wheres ) );
831
+		$success = $this->_venue_model->update($venue_values, array($wheres));
832 832
 
833 833
 		//get venue_object for other metaboxes that might be added via the filter... though it would seem to make sense to just use $this->_venue_model->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id!
834
-		$get_one_where = array( $this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status  );
835
-		$venue = $this->_venue_model->get_one( array( $get_one_where ) );
834
+		$get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status);
835
+		$venue = $this->_venue_model->get_one(array($get_one_where));
836 836
 
837 837
 		//notice we've applied a filter for venue metabox callbacks but we don't actually have any default venue metaboxes in use.  So this is just here for addons to more easily hook into venue saves.
838
-		$venue_update_callbacks = apply_filters( 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array() );
838
+		$venue_update_callbacks = apply_filters('FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array());
839 839
 
840 840
 		$att_success = TRUE;
841 841
 
842
-		foreach ( $venue_update_callbacks as $v_callback ) {
843
-			$_succ = call_user_func_array( $v_callback, array( $venue,  $this->_req_data ) );
844
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
842
+		foreach ($venue_update_callbacks as $v_callback) {
843
+			$_succ = call_user_func_array($v_callback, array($venue, $this->_req_data));
844
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
845 845
 		}
846 846
 
847 847
 		//any errors?
848
-		if ( $success && !$att_success ) {
849
-			EE_Error::add_error( __('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
850
-		} else if ( $success === FALSE ) {
851
-			EE_Error::add_error( __('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
848
+		if ($success && ! $att_success) {
849
+			EE_Error::add_error(__('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
850
+		} else if ($success === FALSE) {
851
+			EE_Error::add_error(__('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
852 852
 		}
853 853
 	}
854 854
 
@@ -856,9 +856,9 @@  discard block
 block discarded – undo
856 856
 
857 857
 
858 858
 
859
-	public function trash_cpt_item( $post_id ) {
859
+	public function trash_cpt_item($post_id) {
860 860
 		$this->_req_data['VNU_ID'] = $post_id;
861
-		$this->_trash_or_restore_venue( 'trash', FALSE );
861
+		$this->_trash_or_restore_venue('trash', FALSE);
862 862
 	}
863 863
 
864 864
 
@@ -866,18 +866,18 @@  discard block
 block discarded – undo
866 866
 
867 867
 
868 868
 
869
-	public function restore_cpt_item( $post_id ) {
869
+	public function restore_cpt_item($post_id) {
870 870
 		$this->_req_data['VNU_ID'] = $post_id;
871
-		$this->_trash_or_restore_venue( 'draft', FALSE );
871
+		$this->_trash_or_restore_venue('draft', FALSE);
872 872
 	}
873 873
 
874 874
 
875 875
 
876 876
 
877 877
 
878
-	public function delete_cpt_item( $post_id ) {
878
+	public function delete_cpt_item($post_id) {
879 879
 		$this->_req_data['VNU_ID'] = $post_id;
880
-		$this->_delete_venue( FALSE );
880
+		$this->_delete_venue(FALSE);
881 881
 	}
882 882
 
883 883
 
@@ -892,15 +892,15 @@  discard block
 block discarded – undo
892 892
 
893 893
 
894 894
 
895
-	protected function _trash_or_restore_venue( $venue_status = 'trash', $redirect_after = TRUE ) {
896
-		$VNU_ID = isset( $this->_req_data['VNU_ID'] ) ? absint( $this->_req_data['VNU_ID'] ) : FALSE;
895
+	protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = TRUE) {
896
+		$VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : FALSE;
897 897
 
898 898
 		//loop thru venues
899
-		if ( $VNU_ID ) {
899
+		if ($VNU_ID) {
900 900
 			//clean status
901
-			$venue_status = sanitize_key( $venue_status );
901
+			$venue_status = sanitize_key($venue_status);
902 902
 			// grab status
903
-			if (!empty($venue_status)) {
903
+			if ( ! empty($venue_status)) {
904 904
 				$success = $this->_change_venue_status($VNU_ID, $venue_status);
905 905
 			} else {
906 906
 				$success = FALSE;
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
 		}
915 915
 		$action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
916 916
 
917
-		if ( $redirect_after )
917
+		if ($redirect_after)
918 918
 			$this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default'));
919 919
 
920 920
 	}
@@ -923,11 +923,11 @@  discard block
 block discarded – undo
923 923
 
924 924
 
925 925
 
926
-	protected function _trash_or_restore_venues( $venue_status = 'trash' ) {
926
+	protected function _trash_or_restore_venues($venue_status = 'trash') {
927 927
 		// clean status
928 928
 		$venue_status = sanitize_key($venue_status);
929 929
 		// grab status
930
-		if (!empty($venue_status)) {
930
+		if ( ! empty($venue_status)) {
931 931
 			$success = TRUE;
932 932
 			//determine the event id and set to array.
933 933
 			$VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array();
@@ -967,20 +967,20 @@  discard block
 block discarded – undo
967 967
 	 * @param  string $venue_status
968 968
 	 * @return void
969 969
 	 */
970
-	private function _change_venue_status( $VNU_ID = 0, $venue_status = '' ) {
970
+	private function _change_venue_status($VNU_ID = 0, $venue_status = '') {
971 971
 		// grab venue id
972
-		if (! $VNU_ID) {
972
+		if ( ! $VNU_ID) {
973 973
 			$msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso');
974 974
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
975 975
 			return FALSE;
976 976
 		}
977 977
 
978
-		$this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID( $VNU_ID );
978
+		$this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID);
979 979
 
980 980
 		// clean status
981 981
 		$venue_status = sanitize_key($venue_status);
982 982
 		// grab status
983
-		if ( ! $venue_status ) {
983
+		if ( ! $venue_status) {
984 984
 			$msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso');
985 985
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
986 986
 			return FALSE;
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
 				$hook = FALSE;
1002 1002
 		}
1003 1003
 		//use class to change status
1004
-		$this->_cpt_model_obj->set_status( $venue_status );
1004
+		$this->_cpt_model_obj->set_status($venue_status);
1005 1005
 		$success = $this->_cpt_model_obj->save();
1006 1006
 
1007 1007
 		if ($success === FALSE) {
@@ -1020,21 +1020,21 @@  discard block
 block discarded – undo
1020 1020
 	 * @param  bool $redirect_after
1021 1021
 	 * @return void
1022 1022
 	 */
1023
-	protected function _delete_venue( $redirect_after = true ) {
1023
+	protected function _delete_venue($redirect_after = true) {
1024 1024
 		//determine the venue id and set to array.
1025 1025
 		$VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : NULL;
1026
-		$VNU_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $VNU_ID;
1026
+		$VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID;
1027 1027
 
1028 1028
 
1029 1029
 		// loop thru venues
1030 1030
 		if ($VNU_ID) {
1031
-			$success = $this->_delete_or_trash_venue( $VNU_ID );
1031
+			$success = $this->_delete_or_trash_venue($VNU_ID);
1032 1032
 		} else {
1033 1033
 			$success = FALSE;
1034 1034
 			$msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso');
1035 1035
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1036 1036
 		}
1037
-		if ( $redirect_after )
1037
+		if ($redirect_after)
1038 1038
 			$this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default'));
1039 1039
 	}
1040 1040
 
@@ -1066,7 +1066,7 @@  discard block
 block discarded – undo
1066 1066
 	//todo: put in parent
1067 1067
 	private function _delete_or_trash_venue($VNU_ID = FALSE) {
1068 1068
 		// grab event id
1069
-		if (!$VNU_ID = absint($VNU_ID)) {
1069
+		if ( ! $VNU_ID = absint($VNU_ID)) {
1070 1070
 			$msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso');
1071 1071
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1072 1072
 			return FALSE;
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1087 1087
 			return FALSE;
1088 1088
 		}
1089
-		do_action( 'AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted' );
1089
+		do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted');
1090 1090
 		return TRUE;
1091 1091
 	}
1092 1092
 
@@ -1097,11 +1097,11 @@  discard block
 block discarded – undo
1097 1097
 	/* QUERIES */
1098 1098
 
1099 1099
 
1100
-	public function get_venues( $per_page = 10, $count = FALSE ) {
1100
+	public function get_venues($per_page = 10, $count = FALSE) {
1101 1101
 
1102
-		$_orderby = !empty( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : '';
1102
+		$_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1103 1103
 
1104
-		switch ( $_orderby ) {
1104
+		switch ($_orderby) {
1105 1105
 			case 'id':
1106 1106
 				$orderby = 'VNU_ID';
1107 1107
 				break;
@@ -1119,43 +1119,43 @@  discard block
 block discarded – undo
1119 1119
 		}
1120 1120
 
1121 1121
 
1122
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
1122
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
1123 1123
 
1124
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1125
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
1126
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
1124
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1125
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
1126
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
1127 1127
 
1128 1128
 
1129
-		$offset = ($current_page-1)*$per_page;
1129
+		$offset = ($current_page - 1) * $per_page;
1130 1130
 		$limit = array($offset, $per_page);
1131 1131
 
1132
-		$category = isset( $this->_req_data['category'] ) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
1132
+		$category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
1133 1133
 		$where = array();
1134 1134
 
1135 1135
 		//only set initial status if it is in the incoming request.  Otherwise the "all" view display's all statuses.
1136
-		if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] != 'all' ) {
1136
+		if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') {
1137 1137
 			$where['status'] = $this->_req_data['status'];
1138 1138
 		}
1139 1139
 
1140
-		if ( isset( $this->_req_data['venue_status'] ) ) {
1140
+		if (isset($this->_req_data['venue_status'])) {
1141 1141
 			$where['status'] = $this->_req_data['venue_status'];
1142 1142
 		}
1143 1143
 
1144 1144
 
1145
-		if ( $category ) {
1145
+		if ($category) {
1146 1146
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories';
1147 1147
 			$where['Term_Taxonomy.term_id'] = $category;
1148 1148
 		}
1149 1149
 
1150 1150
 
1151
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_venues', 'get_venues' ) ) {
1152
-			$where['VNU_wp_user'] =  get_current_user_id();
1151
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) {
1152
+			$where['VNU_wp_user'] = get_current_user_id();
1153 1153
 		} else {
1154
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' ) ) {
1154
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) {
1155 1155
 					$where['OR'] = array(
1156
-						'status*restrict_private' => array( '!=', 'private' ),
1156
+						'status*restrict_private' => array('!=', 'private'),
1157 1157
 						'AND'                     => array(
1158
-							'status*inclusive' => array( '=', 'private' ),
1158
+							'status*inclusive' => array('=', 'private'),
1159 1159
 							'VNU_wp_user'      => get_current_user_id()
1160 1160
 						)
1161 1161
 					);
@@ -1165,30 +1165,30 @@  discard block
 block discarded – undo
1165 1165
 
1166 1166
 
1167 1167
 
1168
-		if ( isset( $this->_req_data['s'] ) ) {
1169
-			$sstr = '%' . $this->_req_data['s'] . '%';
1168
+		if (isset($this->_req_data['s'])) {
1169
+			$sstr = '%'.$this->_req_data['s'].'%';
1170 1170
 			$where['OR'] = array(
1171
-				'VNU_name' => array('LIKE',$sstr ),
1172
-				'VNU_desc' => array('LIKE',$sstr ),
1173
-				'VNU_short_desc' => array( 'LIKE',$sstr ),
1174
-				'VNU_address' => array( 'LIKE', $sstr ),
1175
-				'VNU_address2' => array( 'LIKE', $sstr ),
1176
-				'VNU_city' => array( 'LIKE', $sstr ),
1177
-				'VNU_zip' => array( 'LIKE', $sstr ),
1178
-				'VNU_phone' => array( 'LIKE', $sstr ),
1179
-				'VNU_url' => array( 'LIKE', $sstr ),
1180
-				'VNU_virtual_phone' => array( 'LIKE', $sstr ),
1181
-				'VNU_virtual_url' => array( 'LIKE', $sstr ),
1182
-				'VNU_google_map_link' => array( 'LIKE', $sstr ),
1183
-				'Event.EVT_name' => array('LIKE', $sstr ),
1184
-				'Event.EVT_desc' => array('LIKE', $sstr ),
1185
-				'Event.EVT_phone' => array('LIKE', $sstr ),
1186
-				'Event.EVT_external_URL' => array('LIKE', $sstr ),
1171
+				'VNU_name' => array('LIKE', $sstr),
1172
+				'VNU_desc' => array('LIKE', $sstr),
1173
+				'VNU_short_desc' => array('LIKE', $sstr),
1174
+				'VNU_address' => array('LIKE', $sstr),
1175
+				'VNU_address2' => array('LIKE', $sstr),
1176
+				'VNU_city' => array('LIKE', $sstr),
1177
+				'VNU_zip' => array('LIKE', $sstr),
1178
+				'VNU_phone' => array('LIKE', $sstr),
1179
+				'VNU_url' => array('LIKE', $sstr),
1180
+				'VNU_virtual_phone' => array('LIKE', $sstr),
1181
+				'VNU_virtual_url' => array('LIKE', $sstr),
1182
+				'VNU_google_map_link' => array('LIKE', $sstr),
1183
+				'Event.EVT_name' => array('LIKE', $sstr),
1184
+				'Event.EVT_desc' => array('LIKE', $sstr),
1185
+				'Event.EVT_phone' => array('LIKE', $sstr),
1186
+				'Event.EVT_external_URL' => array('LIKE', $sstr),
1187 1187
 				);
1188 1188
 		}
1189 1189
 
1190 1190
 
1191
-		$venues = $count ? $this->_venue_model->count( array($where), 'VNU_ID' ) : $this->_venue_model->get_all( array( $where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort ) );
1191
+		$venues = $count ? $this->_venue_model->count(array($where), 'VNU_ID') : $this->_venue_model->get_all(array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort));
1192 1192
 
1193 1193
 		return $venues;
1194 1194
 
@@ -1206,22 +1206,22 @@  discard block
 block discarded – undo
1206 1206
 	 * @return void
1207 1207
 	 */
1208 1208
 	private function _set_category_object() {
1209
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
1209
+		if (isset($this->_category->id) && ! empty($this->_category->id))
1210 1210
 			return; //already have the category object so get out.
1211 1211
 
1212 1212
 		//set default category object
1213 1213
 		$this->_set_empty_category_object();
1214 1214
 
1215 1215
 		//only set if we've got an id
1216
-		if ( !isset($this->_req_data['VEN_CAT_ID'] ) ) {
1216
+		if ( ! isset($this->_req_data['VEN_CAT_ID'])) {
1217 1217
 			return;
1218 1218
 		}
1219 1219
 
1220 1220
 		$category_id = absint($this->_req_data['VEN_CAT_ID']);
1221
-		$term = get_term( $category_id, 'espresso_venue_categories' );
1221
+		$term = get_term($category_id, 'espresso_venue_categories');
1222 1222
 
1223 1223
 
1224
-		if ( !empty( $term ) ) {
1224
+		if ( ! empty($term)) {
1225 1225
 			$this->_category->category_name = $term->name;
1226 1226
 			$this->_category->category_identifier = $term->slug;
1227 1227
 			$this->_category->category_desc = $term->description;
@@ -1235,14 +1235,14 @@  discard block
 block discarded – undo
1235 1235
 
1236 1236
 	private function _set_empty_category_object() {
1237 1237
 		$this->_category = new stdClass();
1238
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
1238
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
1239 1239
 		$this->_category->id = $this->_category->parent = 0;
1240 1240
 	}
1241 1241
 
1242 1242
 
1243 1243
 
1244 1244
 	protected function _category_list_table() {
1245
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1245
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1246 1246
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
1247 1247
 		$this->_search_btn_label = __('Venue Categories', 'event_espresso');
1248 1248
 		$this->display_admin_list_table_page_with_sidebar();
@@ -1258,13 +1258,13 @@  discard block
 block discarded – undo
1258 1258
 		$this->_set_add_edit_form_tags($route);
1259 1259
 
1260 1260
 		$this->_set_category_object();
1261
-		$id = !empty($this->_category->id) ? $this->_category->id : '';
1261
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
1262 1262
 
1263 1263
 		$delete_action = 'delete_category';
1264 1264
 
1265
-		$redirect = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'category_list' ), $this->_admin_base_url );
1265
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
1266 1266
 
1267
-		$this->_set_publish_post_box_vars( 'VEN_CAT_ID', $id, $delete_action, $redirect );
1267
+		$this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect);
1268 1268
 
1269 1269
 		//take care of contents
1270 1270
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
@@ -1278,25 +1278,25 @@  discard block
 block discarded – undo
1278 1278
 			'type' => 'wp_editor',
1279 1279
 			'value' => EEH_Formatter::admin_format_content($this->_category->category_desc),
1280 1280
 			'class' => 'my_editor_custom',
1281
-			'wpeditor_args' => array( 'media_buttons' => FALSE )
1281
+			'wpeditor_args' => array('media_buttons' => FALSE)
1282 1282
 		);
1283
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
1283
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
1284 1284
 
1285
-		$all_terms = get_terms( array('espresso_venue_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) );
1285
+		$all_terms = get_terms(array('espresso_venue_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id)));
1286 1286
 
1287 1287
 		//setup category select for term parents.
1288 1288
 		$category_select_values[] = array(
1289 1289
 			'text' => __('No Parent', 'event_espresso'),
1290 1290
 			'id' => 0
1291 1291
 			);
1292
-		foreach ( $all_terms as $term ) {
1292
+		foreach ($all_terms as $term) {
1293 1293
 			$category_select_values[] = array(
1294 1294
 				'text' => $term->name,
1295 1295
 				'id' => $term->term_id
1296 1296
 				);
1297 1297
 		}
1298 1298
 
1299
-		$category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent );
1299
+		$category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent);
1300 1300
 		$template_args = array(
1301 1301
 			'category' => $this->_category,
1302 1302
 			'category_select' => $category_select,
@@ -1305,15 +1305,15 @@  discard block
 block discarded – undo
1305 1305
 			'disable' => '',
1306 1306
 			'disabled_message' =>FALSE
1307 1307
 			);
1308
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
1309
-		return EEH_Template::display_template($template, $template_args, TRUE );
1308
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
1309
+		return EEH_Template::display_template($template, $template_args, TRUE);
1310 1310
 	}
1311 1311
 
1312 1312
 
1313 1313
 	protected function _delete_categories() {
1314
-		$cat_ids = isset( $this->_req_data['VEN_CAT_ID'] ) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id'];
1314
+		$cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id'];
1315 1315
 
1316
-		foreach ( $cat_ids as $cat_id ) {
1316
+		foreach ($cat_ids as $cat_id) {
1317 1317
 			$this->_delete_category($cat_id);
1318 1318
 		}
1319 1319
 
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
 		$query_args = array(
1322 1322
 			'action' => 'category_list'
1323 1323
 			);
1324
-		$this->_redirect_after_action(0,'','',$query_args);
1324
+		$this->_redirect_after_action(0, '', '', $query_args);
1325 1325
 
1326 1326
 	}
1327 1327
 
@@ -1330,58 +1330,58 @@  discard block
 block discarded – undo
1330 1330
 
1331 1331
 
1332 1332
 	protected function _delete_category($cat_id) {
1333
-		$cat_id = absint( $cat_id );
1334
-		wp_delete_term( $cat_id, 'espresso_venue_categories' );
1333
+		$cat_id = absint($cat_id);
1334
+		wp_delete_term($cat_id, 'espresso_venue_categories');
1335 1335
 	}
1336 1336
 
1337 1337
 
1338 1338
 
1339 1339
 	protected function _insert_or_update_category($new_category) {
1340 1340
 
1341
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE );
1341
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE);
1342 1342
 		$success = 0; //we already have a success message so lets not send another.
1343
-		if ( $cat_id ) {
1343
+		if ($cat_id) {
1344 1344
 			$query_args = array(
1345 1345
 				'action'     => 'edit_category',
1346 1346
 				'VEN_CAT_ID' => $cat_id
1347 1347
 			);
1348 1348
 		} else {
1349
-			$query_args = array( 'action' => 'add_category' );
1349
+			$query_args = array('action' => 'add_category');
1350 1350
 		}
1351
-		$this->_redirect_after_action( $success, '','', $query_args, TRUE );
1351
+		$this->_redirect_after_action($success, '', '', $query_args, TRUE);
1352 1352
 
1353 1353
 	}
1354 1354
 
1355 1355
 
1356 1356
 
1357
-	private function _insert_category( $update = FALSE ) {
1357
+	private function _insert_category($update = FALSE) {
1358 1358
 		$cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : '';
1359
-		$category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
1360
-		$category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
1361
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
1359
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
1360
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
1361
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
1362 1362
 
1363
-		if ( empty( $category_name ) ) {
1364
-			$msg = __( 'You must add a name for the category.', 'event_espresso' );
1365
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1363
+		if (empty($category_name)) {
1364
+			$msg = __('You must add a name for the category.', 'event_espresso');
1365
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1366 1366
 			return false;
1367 1367
 		}
1368 1368
 
1369 1369
 
1370
-		$term_args=array(
1370
+		$term_args = array(
1371 1371
 			'name'=>$category_name,
1372 1372
 			'description'=>$category_desc,
1373 1373
 			'parent'=>$category_parent
1374 1374
 		);
1375 1375
 
1376
-		$insert_ids = $update ? wp_update_term( $cat_id, 'espresso_venue_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_venue_categories', $term_args );
1376
+		$insert_ids = $update ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) : wp_insert_term($category_name, 'espresso_venue_categories', $term_args);
1377 1377
 
1378
-		if ( !is_array( $insert_ids ) ) {
1379
-			$msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' );
1380
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1378
+		if ( ! is_array($insert_ids)) {
1379
+			$msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso');
1380
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1381 1381
 		} else {
1382 1382
 			$cat_id = $insert_ids['term_id'];
1383
-			$msg = sprintf ( __('The category %s was successfully created', 'event_espresso'), $category_name );
1384
-			EE_Error::add_success( $msg );
1383
+			$msg = sprintf(__('The category %s was successfully created', 'event_espresso'), $category_name);
1384
+			EE_Error::add_success($msg);
1385 1385
 		}
1386 1386
 
1387 1387
 		return $cat_id;
@@ -1401,11 +1401,11 @@  discard block
 block discarded – undo
1401 1401
 			'category_ids' => $this->_req_data['VEN_CAT_ID']
1402 1402
 			);
1403 1403
 
1404
-		$this->_req_data = array_merge( $this->_req_data, $new_request_args );
1404
+		$this->_req_data = array_merge($this->_req_data, $new_request_args);
1405 1405
 
1406
-		if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) {
1407
-			require_once( EE_CLASSES . 'EE_Export.class.php');
1408
-			$EE_Export = EE_Export::instance( $this->_req_data );
1406
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
1407
+			require_once(EE_CLASSES.'EE_Export.class.php');
1408
+			$EE_Export = EE_Export::instance($this->_req_data);
1409 1409
 			$EE_Export->export();
1410 1410
 		}
1411 1411
 
@@ -1417,7 +1417,7 @@  discard block
 block discarded – undo
1417 1417
 
1418 1418
 	protected function _import_categories() {
1419 1419
 
1420
-		require_once(EE_CLASSES . 'EE_Import.class.php');
1420
+		require_once(EE_CLASSES.'EE_Import.class.php');
1421 1421
 		EE_Import::instance()->import();
1422 1422
 
1423 1423
 	}
@@ -1425,29 +1425,29 @@  discard block
 block discarded – undo
1425 1425
 
1426 1426
 
1427 1427
 
1428
-	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
1428
+	public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) {
1429 1429
 
1430 1430
 		//testing term stuff
1431
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
1432
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
1433
-		$limit = ($current_page-1)*$per_page;
1434
-		$where = array( 'taxonomy' => 'espresso_venue_categories' );
1435
-		if ( isset( $this->_req_data['s'] ) ) {
1436
-			$sstr = '%' . $this->_req_data['s'] . '%';
1431
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
1432
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
1433
+		$limit = ($current_page - 1) * $per_page;
1434
+		$where = array('taxonomy' => 'espresso_venue_categories');
1435
+		if (isset($this->_req_data['s'])) {
1436
+			$sstr = '%'.$this->_req_data['s'].'%';
1437 1437
 			$where['OR'] = array(
1438
-				'Term.name' => array( 'LIKE', $sstr),
1439
-				'description' => array( 'LIKE', $sstr )
1438
+				'Term.name' => array('LIKE', $sstr),
1439
+				'description' => array('LIKE', $sstr)
1440 1440
 				);
1441 1441
 		}
1442 1442
 
1443 1443
 		$query_params = array(
1444 1444
 			$where,
1445
-			'order_by' => array( $orderby => $order ),
1446
-			'limit' => $limit . ',' . $per_page,
1445
+			'order_by' => array($orderby => $order),
1446
+			'limit' => $limit.','.$per_page,
1447 1447
 			'force_join' => array('Term')
1448 1448
 			);
1449 1449
 
1450
-		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
1450
+		$categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params);
1451 1451
 
1452 1452
 		return $categories;
1453 1453
 	}
Please login to merge, or discard this patch.
caffeinated/admin/new/pricing/espresso_events_Pricing_Hooks.class.php 3 patches
Doc Comments   +18 added lines, -1 removed lines patch added patch discarded remove patch
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * Handles saving everything related to Tickets (datetimes, tickets, prices)
182 182
 	 * @param  EE_Event $evtobj The Event object we're attaching data to
183 183
 	 * @param  array    $data   The request data from the form
184
-	 * @return bool             success or fail
184
+	 * @return boolean|null             success or fail
185 185
 	 */
186 186
 	public function dtt_and_tickets_caf_update( $evtobj, $data ) {
187 187
 		//first we need to start with datetimes cause they are the "root" items attached to events.
@@ -879,6 +879,9 @@  discard block
 block discarded – undo
879 879
 
880 880
 
881 881
 
882
+	/**
883
+	 * @param integer $dttrow
884
+	 */
882 885
 	protected function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) {
883 886
 
884 887
 		$dtt_display_template_args = array(
@@ -902,6 +905,7 @@  discard block
 block discarded – undo
902 905
 	 *                               				object.
903 906
 	 * @param bool   $default  		         Whether a default row is being generated or not.
904 907
 	 * @param EE_Datetime[] $all_dtts             This is the array of all datetimes used in the editor.
908
+	 * @param EE_Datetime|null $dtt
905 909
 	 *
906 910
 	 * @return string Generated edit row.
907 911
 	 */
@@ -936,6 +940,10 @@  discard block
 block discarded – undo
936 940
 	}
937 941
 
938 942
 
943
+	/**
944
+	 * @param EE_Datetime|null $dtt
945
+	 * @param boolean $default
946
+	 */
939 947
 	protected function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) {
940 948
 
941 949
 		$template_args = array(
@@ -1142,6 +1150,9 @@  discard block
 block discarded – undo
1142 1150
 
1143 1151
 
1144 1152
 
1153
+	/**
1154
+	 * @param integer $tktrow
1155
+	 */
1145 1156
 	protected function _get_tax_rows( $tktrow, $ticket ) {
1146 1157
 		$tax_rows = '';
1147 1158
 		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php';
@@ -1175,6 +1186,9 @@  discard block
 block discarded – undo
1175 1186
 
1176 1187
 
1177 1188
 
1189
+	/**
1190
+	 * @param boolean $default
1191
+	 */
1178 1192
 	protected function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) {
1179 1193
 		$send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1180 1194
 		$template_args = array(
@@ -1281,6 +1295,9 @@  discard block
 block discarded – undo
1281 1295
 
1282 1296
 
1283 1297
 
1298
+	/**
1299
+	 * @param boolean $default
1300
+	 */
1284 1301
 	protected function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) {
1285 1302
 		$dttid = !empty($dtt) ? $dtt->ID() : 0;
1286 1303
 		$displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0;
Please login to merge, or discard this patch.
Braces   +21 added lines, -13 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
@@ -166,8 +167,9 @@  discard block
 block discarded – undo
166 167
 
167 168
 	public function caf_updates( $update_callbacks ) {
168 169
 		foreach ( $update_callbacks as $key => $callback ) {
169
-			if ( $callback[1] == '_default_tickets_update' )
170
-				unset( $update_callbacks[$key] );
170
+			if ( $callback[1] == '_default_tickets_update' ) {
171
+							unset( $update_callbacks[$key] );
172
+			}
171 173
 		}
172 174
 
173 175
 		$update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' );
@@ -273,8 +275,9 @@  discard block
 block discarded – undo
273 275
 			$dtts_to_delete = array_diff( $old_datetimes, $saved_dtt_ids );
274 276
 			foreach ( $dtts_to_delete as $id ) {
275 277
 				$id = absint( $id );
276
-				if ( empty( $id ) )
277
-					continue;
278
+				if ( empty( $id ) ) {
279
+									continue;
280
+				}
278 281
 
279 282
 				$dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id);
280 283
 
@@ -512,8 +515,9 @@  discard block
 block discarded – undo
512 515
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
513 516
 
514 517
 			//if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime
515
-			if ( $tkt_to_remove->get('TKT_is_default') )
516
-				continue;
518
+			if ( $tkt_to_remove->get('TKT_is_default') ) {
519
+							continue;
520
+			}
517 521
 
518 522
 			// if this tkt has any registrations attached so then we just ARCHIVE
519 523
 			// because we don't actually permanently delete these tickets.
@@ -688,13 +692,16 @@  discard block
 block discarded – undo
688 692
 		}
689 693
 
690 694
 		//possibly need to save tkt
691
-		if ( ! $ticket->ID() )
692
-			$ticket->save();
695
+		if ( ! $ticket->ID() ) {
696
+					$ticket->save();
697
+		}
693 698
 
694 699
 		foreach ( $prices as $row => $prc ) {
695 700
 			$prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL;
696
-			if ( empty($prt_id) )
697
-				continue; //prices MUST have a price type id.
701
+			if ( empty($prt_id) ) {
702
+							continue;
703
+			}
704
+			//prices MUST have a price type id.
698 705
 			$PRC_values = array(
699 706
 				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
700 707
 				'PRT_ID' => $prt_id,
@@ -838,8 +845,9 @@  discard block
 block discarded – undo
838 845
 				$datetime_tickets[$dttid][] = $tktrow;
839 846
 
840 847
 				//temporary cache of this datetime info for this ticket for later processing of ticket rows.
841
-				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) )
842
-					$ticket_datetimes[$tktid][] = $dttrow;
848
+				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) ) {
849
+									$ticket_datetimes[$tktid][] = $dttrow;
850
+				}
843 851
 			}
844 852
 		}
845 853
 
Please login to merge, or discard this patch.
Spacing   +381 added lines, -381 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
 /**
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		$this->_name = 'pricing';
55 55
 
56 56
 		//capability check
57
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_default_prices', 'advanced_ticket_datetime_metabox' ) ) {
57
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_default_prices', 'advanced_ticket_datetime_metabox')) {
58 58
 			return;
59 59
 		}
60 60
 
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
 		//if we were going to add our own metaboxes we'd use the below.
63 63
 		$this->_metaboxes = array(
64 64
 			0 => array(
65
-				'page_route' => array('edit','create_new'),
65
+				'page_route' => array('edit', 'create_new'),
66 66
 				'func' => 'pricing_metabox',
67 67
 				'label' => __('Event Tickets & Datetimes', 'event_espresso'),
68 68
 				'priority' => 'high',
69 69
 				'context' => 'normal'
70 70
 				),
71 71
 
72
-			);/**/
72
+			); /**/
73 73
 
74 74
 		$this->_remove_metaboxes = array(
75 75
 			0 => array(
@@ -88,24 +88,24 @@  discard block
 block discarded – undo
88 88
 		 *
89 89
 		 * @var array  Expected an array returned with 'date' and 'time' keys.
90 90
 		 */
91
-		$this->_date_format_strings = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array(
91
+		$this->_date_format_strings = apply_filters('FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array(
92 92
 				'date' => 'Y-m-d',
93 93
 				'time' => 'h:i a'
94 94
 			));
95 95
 
96 96
 		//validate
97
-		$this->_date_format_strings['date'] = isset( $this->_date_format_strings['date'] ) ? $this->_date_format_strings['date'] : null;
98
-		$this->_date_format_strings['time'] = isset( $this->_date_format_strings['time'] ) ? $this->_date_format_strings['time'] : null;
97
+		$this->_date_format_strings['date'] = isset($this->_date_format_strings['date']) ? $this->_date_format_strings['date'] : null;
98
+		$this->_date_format_strings['time'] = isset($this->_date_format_strings['time']) ? $this->_date_format_strings['time'] : null;
99 99
 
100 100
 		//validate format strings
101
-		$format_validation = EEH_DTT_Helper::validate_format_string( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
102
-		if ( is_array( $format_validation ) ) {
103
-			$msg = '<p>' . sprintf( __( 'The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso' ), $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ) . '</p><ul>';
104
-			foreach ( $format_validation as $error ) {
105
-				$msg .= '<li>' . $error . '</li>';
101
+		$format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
102
+		if (is_array($format_validation)) {
103
+			$msg = '<p>'.sprintf(__('The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso'), $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']).'</p><ul>';
104
+			foreach ($format_validation as $error) {
105
+				$msg .= '<li>'.$error.'</li>';
106 106
 			}
107
-			$msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>';
108
-			EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
107
+			$msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>';
108
+			EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
109 109
 			$this->_date_format_strings = array(
110 110
 				'date' => 'Y-m-d',
111 111
 				'time' => 'h:i a'
@@ -116,60 +116,60 @@  discard block
 block discarded – undo
116 116
 		$this->_scripts_styles = array(
117 117
 			'registers' => array(
118 118
 				'ee-tickets-datetimes-css' => array(
119
-					'url' => PRICING_ASSETS_URL . 'event-tickets-datetimes.css',
119
+					'url' => PRICING_ASSETS_URL.'event-tickets-datetimes.css',
120 120
 					'type' => 'css'
121 121
 					),
122 122
 				'ee-dtt-ticket-metabox' => array(
123
-					'url' => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js',
123
+					'url' => PRICING_ASSETS_URL.'ee-datetime-ticket-metabox.js',
124 124
 					'depends' => array('ee-datepicker', 'ee-dialog', 'underscore')
125 125
 					)
126 126
 				),
127 127
 			'deregisters' => array(
128
-				'event-editor-css' => array('type' => 'css' ),
128
+				'event-editor-css' => array('type' => 'css'),
129 129
 				'event-datetime-metabox' => array('type' => 'js')
130 130
 				),
131 131
 			'enqueues' => array(
132
-				'ee-tickets-datetimes-css' => array( 'edit', 'create_new' ),
133
-				'ee-dtt-ticket-metabox' => array( 'edit', 'create_new' )
132
+				'ee-tickets-datetimes-css' => array('edit', 'create_new'),
133
+				'ee-dtt-ticket-metabox' => array('edit', 'create_new')
134 134
 				),
135 135
 			'localize' => array(
136 136
 				'ee-dtt-ticket-metabox' => array(
137 137
 					'DTT_TRASH_BLOCK' => array(
138 138
 						'main_warning' => __('The Datetime you are attempting to trash is the only datetime selected for the following ticket(s):', 'event_espresso'),
139 139
 						'after_warning' => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.', 'event_espresso'),
140
-						'cancel_button' => '<button class="button-secondary ee-modal-cancel">' . __('Cancel', 'event_espresso') . '</button>',
140
+						'cancel_button' => '<button class="button-secondary ee-modal-cancel">'.__('Cancel', 'event_espresso').'</button>',
141 141
 						'single_warning_from_tkt' => __('The Datetime you are attempting to unassign from this ticket is the only remaining datetime for this ticket. Tickets must always have at least one datetime assigned to them.', 'event_espresso'),
142 142
 						'single_warning_from_dtt' => __('The ticket you are attempting to unassign from this datetime cannot be unassigned because the datetime is the only remaining datetime for the ticket.  Tickets must always have at least one datetime assigned to them.', 'event_espresso'),
143
-						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button>'
143
+						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button>'
144 144
 						),
145 145
 					'DTT_ERROR_MSG' => array(
146 146
 						'no_ticket_name' => __('General Admission', 'event_espresso'),
147
-						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button></div>'
147
+						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button></div>'
148 148
 						),
149 149
 					'DTT_OVERSELL_WARNING' => array(
150 150
 						'datetime_ticket' => __('You cannot add this ticket to this datetime because it has a sold amount that is greater than the amount of spots remaining for this datetime.', 'event_espresso'),
151 151
 						'ticket_datetime' => __('You cannot add this datetime to this ticket because the ticket has a sold amount that is greater than the amount of spots remaining on the datetime.', 'event_espresso')
152 152
 						),
153
-					'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats( $this->_date_format_strings['date'], $this->_date_format_strings['time'] ),
154
-					'DTT_START_OF_WEEK' => array( 'dayValue' => (int) get_option( 'start_of_week' ) )
153
+					'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats($this->_date_format_strings['date'], $this->_date_format_strings['time']),
154
+					'DTT_START_OF_WEEK' => array('dayValue' => (int) get_option('start_of_week'))
155 155
 					)
156 156
 				)
157 157
 			);
158 158
 
159 159
 
160
-		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array( $this, 'autosave_handling' ), 10 );
161
-		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 );
160
+		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array($this, 'autosave_handling'), 10);
161
+		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10);
162 162
 	}
163 163
 
164 164
 
165 165
 
166
-	public function caf_updates( $update_callbacks ) {
167
-		foreach ( $update_callbacks as $key => $callback ) {
168
-			if ( $callback[1] == '_default_tickets_update' )
169
-				unset( $update_callbacks[$key] );
166
+	public function caf_updates($update_callbacks) {
167
+		foreach ($update_callbacks as $key => $callback) {
168
+			if ($callback[1] == '_default_tickets_update')
169
+				unset($update_callbacks[$key]);
170 170
 		}
171 171
 
172
-		$update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' );
172
+		$update_callbacks[] = array($this, 'dtt_and_tickets_caf_update');
173 173
 		return $update_callbacks;
174 174
 	}
175 175
 
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
 	 * @param  array    $data   The request data from the form
183 183
 	 * @return bool             success or fail
184 184
 	 */
185
-	public function dtt_and_tickets_caf_update( $evtobj, $data ) {
185
+	public function dtt_and_tickets_caf_update($evtobj, $data) {
186 186
 		//first we need to start with datetimes cause they are the "root" items attached to events.
187
-		$saved_dtts = $this->_update_dtts( $evtobj, $data );
187
+		$saved_dtts = $this->_update_dtts($evtobj, $data);
188 188
 		//next tackle the tickets (and prices?)
189
-		$this->_update_tkts( $evtobj, $saved_dtts, $data );
189
+		$this->_update_tkts($evtobj, $saved_dtts, $data);
190 190
 	}
191 191
 
192 192
 
@@ -197,41 +197,41 @@  discard block
 block discarded – undo
197 197
 	 * @param  array    	$data    the request data from the form
198 198
 	 * @return EE_Datetime[]
199 199
 	 */
200
-	protected function _update_dtts( $evt_obj, $data ) {
201
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
200
+	protected function _update_dtts($evt_obj, $data) {
201
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
202 202
 		$saved_dtt_ids = array();
203 203
 		$saved_dtt_objs = array();
204 204
 
205
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
205
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
206 206
 			//trim all values to ensure any excess whitespace is removed.
207 207
 			$dtt = array_map(
208
-				function( $datetime_data ) {
209
-					return is_array( $datetime_data ) ? $datetime_data : trim( $datetime_data );
208
+				function($datetime_data) {
209
+					return is_array($datetime_data) ? $datetime_data : trim($datetime_data);
210 210
 				},
211 211
 				$dtt
212 212
 			);
213
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
213
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
214 214
 			$datetime_values = array(
215
-				'DTT_ID' 			=> ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
216
-				'DTT_name' 			=> ! empty( $dtt['DTT_name'] ) ? $dtt['DTT_name'] : '',
217
-				'DTT_description' 	=> ! empty( $dtt['DTT_description'] ) ? $dtt['DTT_description'] : '',
215
+				'DTT_ID' 			=> ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
216
+				'DTT_name' 			=> ! empty($dtt['DTT_name']) ? $dtt['DTT_name'] : '',
217
+				'DTT_description' 	=> ! empty($dtt['DTT_description']) ? $dtt['DTT_description'] : '',
218 218
 				'DTT_EVT_start' 	=> $dtt['DTT_EVT_start'],
219 219
 				'DTT_EVT_end' 		=> $dtt['DTT_EVT_end'],
220
-				'DTT_reg_limit' 	=> empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt[ 'DTT_reg_limit' ],
221
-				'DTT_order' 		=> ! isset( $dtt['DTT_order'] ) ? $row : $dtt['DTT_order'],
220
+				'DTT_reg_limit' 	=> empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
221
+				'DTT_order' 		=> ! isset($dtt['DTT_order']) ? $row : $dtt['DTT_order'],
222 222
 			);
223 223
 
224 224
 			//if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
225 225
 
226
-			if ( !empty( $dtt['DTT_ID'] ) ) {
227
-				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) )->get_one_by_ID($dtt['DTT_ID'] );
226
+			if ( ! empty($dtt['DTT_ID'])) {
227
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone))->get_one_by_ID($dtt['DTT_ID']);
228 228
 
229 229
 				//set date and time format according to what is set in this class.
230
-				$DTM->set_date_format( $this->_date_format_strings['date'] );
231
-				$DTM->set_time_format( $this->_date_format_strings['time'] );
230
+				$DTM->set_date_format($this->_date_format_strings['date']);
231
+				$DTM->set_time_format($this->_date_format_strings['time']);
232 232
 
233
-				foreach ( $datetime_values as $field => $value ) {
234
-					$DTM->set( $field, $value );
233
+				foreach ($datetime_values as $field => $value) {
234
+					$DTM->set($field, $value);
235 235
 				}
236 236
 
237 237
 				// make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.
@@ -239,24 +239,24 @@  discard block
 block discarded – undo
239 239
 				$saved_dtt_ids[$DTM->ID()] = $DTM->ID();
240 240
 
241 241
 			} else {
242
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values, $timezone ), FALSE, FALSE );
242
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values, $timezone), FALSE, FALSE);
243 243
 
244 244
 				//reset date and times to match the format
245
-				$DTM->set_date_format( $this->_date_format_strings['date'] );
246
-				$DTM->set_time_format( $this->_date_format_strings['time'] );
247
-				foreach( $datetime_values as $field => $value ) {
248
-					$DTM->set( $field, $value );
245
+				$DTM->set_date_format($this->_date_format_strings['date']);
246
+				$DTM->set_time_format($this->_date_format_strings['time']);
247
+				foreach ($datetime_values as $field => $value) {
248
+					$DTM->set($field, $value);
249 249
 				}
250 250
 			}
251 251
 
252 252
 
253 253
 			$DTM->save();
254
-			$DTM = $evt_obj->_add_relation_to( $DTM, 'Datetime' );
254
+			$DTM = $evt_obj->_add_relation_to($DTM, 'Datetime');
255 255
 			$evt_obj->save();
256 256
 
257 257
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
258
-			if( $DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end') ) {
259
-				$DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start') );
258
+			if ($DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end')) {
259
+				$DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start'));
260 260
 				$DTM = EEH_DTT_Helper::date_time_add($DTM, 'DTT_EVT_end', 'days');
261 261
 				$DTM->save();
262 262
 			}
@@ -271,25 +271,25 @@  discard block
 block discarded – undo
271 271
 		}
272 272
 
273 273
 		//now we need to REMOVE any dtts that got deleted.  Keep in mind that this process will only kick in for DTT's that don't have any DTT_sold on them. So its safe to permanently delete at this point.
274
-		$old_datetimes = explode(',', $data['datetime_IDs'] );
274
+		$old_datetimes = explode(',', $data['datetime_IDs']);
275 275
 		$old_datetimes = $old_datetimes[0] == '' ? array() : $old_datetimes;
276 276
 
277
-		if ( is_array( $old_datetimes ) ) {
278
-			$dtts_to_delete = array_diff( $old_datetimes, $saved_dtt_ids );
279
-			foreach ( $dtts_to_delete as $id ) {
280
-				$id = absint( $id );
281
-				if ( empty( $id ) )
277
+		if (is_array($old_datetimes)) {
278
+			$dtts_to_delete = array_diff($old_datetimes, $saved_dtt_ids);
279
+			foreach ($dtts_to_delete as $id) {
280
+				$id = absint($id);
281
+				if (empty($id))
282 282
 					continue;
283 283
 
284 284
 				$dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id);
285 285
 
286 286
 				//remove tkt relationships.
287 287
 				$related_tickets = $dtt_to_remove->get_many_related('Ticket');
288
-				foreach ( $related_tickets as $tkt ) {
288
+				foreach ($related_tickets as $tkt) {
289 289
 					$dtt_to_remove->_remove_relation_to($tkt, 'Ticket');
290 290
 				}
291 291
 
292
-				$evt_obj->_remove_relation_to( $id, 'Datetime' );
292
+				$evt_obj->_remove_relation_to($id, 'Datetime');
293 293
 				$dtt_to_remove->refresh_cache_of_related_objects();
294 294
 
295 295
 			}
@@ -310,85 +310,85 @@  discard block
 block discarded – undo
310 310
 	 * @param  array            $data       incoming request data
311 311
 	 * @return EE_Ticket[]
312 312
 	 */
313
-	protected function _update_tkts( $evtobj, $saved_dtts, $data ) {
313
+	protected function _update_tkts($evtobj, $saved_dtts, $data) {
314 314
 
315 315
 		$new_tkt = null;
316 316
 		$new_default = null;
317 317
 		//stripslashes because WP filtered the $_POST ($data) array to add slashes
318 318
 		$data = stripslashes_deep($data);
319
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
319
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
320 320
 		$saved_tickets = $dtts_on_existing = array();
321
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
321
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
322 322
 
323 323
 		//load money helper
324 324
 
325
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
325
+		foreach ($data['edit_tickets'] as $row => $tkt) {
326 326
 
327 327
 			$update_prices = $create_new_TKT = FALSE;
328 328
 
329 329
 			//figure out what dtts were added to the ticket and what dtts were removed from the ticket in the session.
330 330
 
331
-			$starting_tkt_dtt_rows = explode(',',$data['starting_ticket_datetime_rows'][$row]);
332
-			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row] );
331
+			$starting_tkt_dtt_rows = explode(',', $data['starting_ticket_datetime_rows'][$row]);
332
+			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row]);
333 333
 			$dtts_added = array_diff($tkt_dtt_rows, $starting_tkt_dtt_rows);
334 334
 			$dtts_removed = array_diff($starting_tkt_dtt_rows, $tkt_dtt_rows);
335 335
 
336 336
 			// trim inputs to ensure any excess whitespace is removed.
337 337
 			$tkt = array_map(
338
-				function( $ticket_data ) {
339
-					return is_array( $ticket_data ) ? $ticket_data : trim( $ticket_data );
338
+				function($ticket_data) {
339
+					return is_array($ticket_data) ? $ticket_data : trim($ticket_data);
340 340
 				},
341 341
 				$tkt
342 342
 			);
343 343
 
344 344
 			//note we are doing conversions to floats here instead of allowing EE_Money_Field to handle because we're doing calcs prior to using the models.
345 345
 			//note incoming ['TKT_price'] value is already in standard notation (via js).
346
-			$ticket_price = isset( $tkt['TKT_price'] ) ?  round ( (float) $tkt['TKT_price'], 3 ) : 0;
346
+			$ticket_price = isset($tkt['TKT_price']) ? round((float) $tkt['TKT_price'], 3) : 0;
347 347
 
348 348
 			//note incoming base price needs converted from localized value.
349
-			$base_price = isset( $tkt['TKT_base_price'] ) ? EEH_Money::convert_to_float_from_localized_money( $tkt['TKT_base_price'] ) : 0;
349
+			$base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0;
350 350
 			//if ticket price == 0 and $base_price != 0 then ticket price == base_price
351 351
 			$ticket_price = $ticket_price === 0 && $base_price !== 0 ? $base_price : $ticket_price;
352
-			$base_price_id = isset( $tkt['TKT_base_price_ID'] ) ? $tkt['TKT_base_price_ID'] : 0;
352
+			$base_price_id = isset($tkt['TKT_base_price_ID']) ? $tkt['TKT_base_price_ID'] : 0;
353 353
 
354 354
 			$price_rows = is_array($data['edit_prices']) && isset($data['edit_prices'][$row]) ? $data['edit_prices'][$row] : array();
355 355
 
356 356
 			$now = null;
357
-			if ( empty( $tkt['TKT_start_date'] ) ) {
357
+			if (empty($tkt['TKT_start_date'])) {
358 358
 				//lets' use now in the set timezone.
359
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
360
-				$tkt['TKT_start_date'] = $now->format( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
359
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
360
+				$tkt['TKT_start_date'] = $now->format($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
361 361
 			}
362 362
 
363
-			if ( empty( $tkt['TKT_end_date'] ) ) {
363
+			if (empty($tkt['TKT_end_date'])) {
364 364
 				/**
365 365
 				 * set the TKT_end_date to the first datetime attached to the ticket.
366 366
 				 */
367
-				$first_dtt = $saved_dtts[reset( $tkt_dtt_rows )];
368
-				$tkt['TKT_end_date'] = $first_dtt->start_date_and_time( $this->_date_format_strings['date'] . ' ' . $this->_date_format_string['time'] );
367
+				$first_dtt = $saved_dtts[reset($tkt_dtt_rows)];
368
+				$tkt['TKT_end_date'] = $first_dtt->start_date_and_time($this->_date_format_strings['date'].' '.$this->_date_format_string['time']);
369 369
 			}
370 370
 
371 371
 			$TKT_values = array(
372
-				'TKT_ID' 			=> ! empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
373
-				'TTM_ID' 			=> ! empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
374
-				'TKT_name' 			=> ! empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
375
-				'TKT_description' 	=> ! empty( $tkt['TKT_description'] ) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
372
+				'TKT_ID' 			=> ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
373
+				'TTM_ID' 			=> ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
374
+				'TKT_name' 			=> ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
375
+				'TKT_description' 	=> ! empty($tkt['TKT_description']) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
376 376
 				'TKT_start_date' 	=> $tkt['TKT_start_date'],
377 377
 				'TKT_end_date' 		=> $tkt['TKT_end_date'],
378
-				'TKT_qty' 			=> ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt[ 'TKT_qty' ],
379
-				'TKT_uses' 			=> ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt['TKT_uses'],
380
-				'TKT_min' 			=> empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
381
-				'TKT_max' 			=> empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'],
378
+				'TKT_qty' 			=> ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
379
+				'TKT_uses' 			=> ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
380
+				'TKT_min' 			=> empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
381
+				'TKT_max' 			=> empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
382 382
 				'TKT_row' 			=> $row,
383
-				'TKT_order' 		=> isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : 0,
384
-				'TKT_taxable' 		=> ! empty( $tkt['TKT_taxable'] ) ? 1 : 0,
385
-				'TKT_required' 		=> ! empty( $tkt['TKT_required'] ) ? 1 : 0,
383
+				'TKT_order' 		=> isset($tkt['TKT_order']) ? $tkt['TKT_order'] : 0,
384
+				'TKT_taxable' 		=> ! empty($tkt['TKT_taxable']) ? 1 : 0,
385
+				'TKT_required' 		=> ! empty($tkt['TKT_required']) ? 1 : 0,
386 386
 				'TKT_price' 		=> $ticket_price
387 387
 			);
388 388
 
389 389
 
390 390
 			//if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well.
391
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
391
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
392 392
 				$TKT_values['TKT_ID'] = 0;
393 393
 				$TKT_values['TKT_is_default'] = 0;
394 394
 				$update_prices = TRUE;
@@ -400,21 +400,21 @@  discard block
 block discarded – undo
400 400
 			// but DID have it's items modified.
401 401
 			// keep in mind that if the TKT has been sold (and we have changed pricing information),
402 402
 			// then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
403
-			if ( absint( $TKT_values['TKT_ID'] ) ) {
404
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $timezone ) )->get_one_by_ID( $tkt['TKT_ID'] );
405
-				if ( $TKT instanceof EE_Ticket ) {
403
+			if (absint($TKT_values['TKT_ID'])) {
404
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($timezone))->get_one_by_ID($tkt['TKT_ID']);
405
+				if ($TKT instanceof EE_Ticket) {
406 406
 
407
-					$TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed );
407
+					$TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed);
408 408
 					// are there any registrations using this ticket ?
409 409
 					$tickets_sold = $TKT->count_related(
410 410
 						'Registration',
411
-						array( array(
412
-								'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) )
413
-						) )
411
+						array(array(
412
+								'STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))
413
+						))
414 414
 					);
415 415
 					//set ticket formats
416
-					$TKT->set_date_format( $this->_date_format_strings['date'] );
417
-					$TKT->set_time_format( $this->_date_format_strings['time'] );
416
+					$TKT->set_date_format($this->_date_format_strings['date']);
417
+					$TKT->set_time_format($this->_date_format_strings['time']);
418 418
 
419 419
 					// let's just check the total price for the existing ticket
420 420
 					// and determine if it matches the new total price.
@@ -424,17 +424,17 @@  discard block
 block discarded – undo
424 424
 							? TRUE : FALSE;
425 425
 
426 426
 					//set new values
427
-					foreach ( $TKT_values as $field => $value ) {
428
-						if ( $field === 'TKT_qty' ) {
429
-							$TKT->set_qty( $value );
427
+					foreach ($TKT_values as $field => $value) {
428
+						if ($field === 'TKT_qty') {
429
+							$TKT->set_qty($value);
430 430
 						} else {
431
-							$TKT->set( $field, $value );
431
+							$TKT->set($field, $value);
432 432
 						}
433 433
 					}
434 434
 
435 435
 					//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
436
-					if ( $create_new_TKT ) {
437
-						$new_tkt = $this->_duplicate_ticket( $TKT, $price_rows, $ticket_price, $base_price, $base_price_id );
436
+					if ($create_new_TKT) {
437
+						$new_tkt = $this->_duplicate_ticket($TKT, $price_rows, $ticket_price, $base_price, $base_price_id);
438 438
 					}
439 439
 				}
440 440
 
@@ -443,12 +443,12 @@  discard block
 block discarded – undo
443 443
 				$TKT = EE_Ticket::new_instance(
444 444
 					$TKT_values,
445 445
 					$timezone,
446
-					array( $this->_date_format_strings[ 'date' ], $this->_date_format_strings[ 'time' ]  )
446
+					array($this->_date_format_strings['date'], $this->_date_format_strings['time'])
447 447
 				);
448
-				if ( $TKT instanceof EE_Ticket ) {
448
+				if ($TKT instanceof EE_Ticket) {
449 449
 					// make sure ticket has an ID of setting relations won't work
450 450
 					$TKT->save();
451
-					$TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed );
451
+					$TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed);
452 452
 					$update_prices = TRUE;
453 453
 				}
454 454
 			}
@@ -456,37 +456,37 @@  discard block
 block discarded – undo
456 456
 			//$TKT->save();
457 457
 
458 458
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
459
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
460
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
459
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
460
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
461 461
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
462 462
 			}
463 463
 
464 464
 			//let's make sure the base price is handled
465
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( array(), $TKT, $update_prices, $base_price, $base_price_id ) : $TKT;
465
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket(array(), $TKT, $update_prices, $base_price, $base_price_id) : $TKT;
466 466
 
467 467
 			//add/update price_modifiers
468
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( $price_rows, $TKT, $update_prices ) : $TKT;
468
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket($price_rows, $TKT, $update_prices) : $TKT;
469 469
 
470 470
 			//need to make sue that the TKT_price is accurate after saving the prices.
471 471
 			$TKT->ensure_TKT_Price_correct();
472 472
 
473 473
 			//handle CREATING a default tkt from the incoming tkt but ONLY if this isn't an autosave.
474
-			if ( ! defined('DOING_AUTOSAVE' ) ) {
475
-				if ( !empty($tkt['TKT_is_default_selector'] ) ) {
474
+			if ( ! defined('DOING_AUTOSAVE')) {
475
+				if ( ! empty($tkt['TKT_is_default_selector'])) {
476 476
 					$update_prices = TRUE;
477 477
 					$new_default = clone $TKT;
478
-					$new_default->set( 'TKT_ID', 0 );
479
-					$new_default->set( 'TKT_is_default', 1 );
480
-					$new_default->set( 'TKT_row', 1 );
481
-					$new_default->set( 'TKT_price', $ticket_price );
478
+					$new_default->set('TKT_ID', 0);
479
+					$new_default->set('TKT_is_default', 1);
480
+					$new_default->set('TKT_row', 1);
481
+					$new_default->set('TKT_price', $ticket_price);
482 482
 					//remove any dtt relations cause we DON'T want dtt relations attached (note this is just removing the cached relations in the object)
483 483
 					$new_default->_remove_relations('Datetime');
484 484
 					//todo we need to add the current attached prices as new prices to the new default ticket.
485
-					$new_default = $this->_add_prices_to_ticket( $price_rows, $new_default, $update_prices );
485
+					$new_default = $this->_add_prices_to_ticket($price_rows, $new_default, $update_prices);
486 486
 					//don't forget the base price!
487
-					$new_default = $this->_add_prices_to_ticket( array(), $new_default, $update_prices, $base_price, $base_price_id );
487
+					$new_default = $this->_add_prices_to_ticket(array(), $new_default, $update_prices, $base_price, $base_price_id);
488 488
 					$new_default->save();
489
-					do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data );
489
+					do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data);
490 490
 				}
491 491
 			}
492 492
 
@@ -497,19 +497,19 @@  discard block
 block discarded – undo
497 497
 			//let's assign any tickets that have been setup to the saved_tickets tracker
498 498
 			//save existing TKT
499 499
 			$TKT->save();
500
-			if ( $create_new_TKT && $new_tkt instanceof EE_Ticket ) {
500
+			if ($create_new_TKT && $new_tkt instanceof EE_Ticket) {
501 501
 				//save new TKT
502 502
 				$new_tkt->save();
503 503
 				//add new ticket to array
504
-				$saved_tickets[ $new_tkt->ID() ] = $new_tkt;
504
+				$saved_tickets[$new_tkt->ID()] = $new_tkt;
505 505
 
506
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data );
506
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data);
507 507
 
508 508
 			} else {
509 509
 				//add tkt to saved tkts
510
-				$saved_tickets[ $TKT->ID() ] = $TKT;
510
+				$saved_tickets[$TKT->ID()] = $TKT;
511 511
 
512
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data );
512
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data);
513 513
 			}
514 514
 
515 515
 		}
@@ -519,22 +519,22 @@  discard block
 block discarded – undo
519 519
 		// (i.e. autosaves are happening and then in between autosaves the user trashes a ticket).
520 520
 		// Or a draft event was saved and in the process of editing a ticket is trashed.
521 521
 		// No sense in keeping all the related data in the db!
522
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
523
-		$tickets_removed = array_diff( $old_tickets, array_keys($saved_tickets) );
522
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
523
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
524 524
 
525
-		foreach ( $tickets_removed as $id ) {
526
-			$id = absint( $id );
525
+		foreach ($tickets_removed as $id) {
526
+			$id = absint($id);
527 527
 
528 528
 			//get the ticket for this id
529 529
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
530 530
 
531 531
 			//if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime
532
-			if ( $tkt_to_remove->get('TKT_is_default') )
532
+			if ($tkt_to_remove->get('TKT_is_default'))
533 533
 				continue;
534 534
 
535 535
 			// if this tkt has any registrations attached so then we just ARCHIVE
536 536
 			// because we don't actually permanently delete these tickets.
537
-			if ( $tkt_to_remove->count_related('Registration') > 0 ) {
537
+			if ($tkt_to_remove->count_related('Registration') > 0) {
538 538
 				$tkt_to_remove->delete();
539 539
 				continue;
540 540
 			}
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 			// (remember this process can ONLY kick off if there are NO tkts_sold)
544 544
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
545 545
 
546
-			foreach( $dtts as $dtt ) {
546
+			foreach ($dtts as $dtt) {
547 547
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
548 548
 			}
549 549
 
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 			// tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived))
552 552
 			$tkt_to_remove->delete_related_permanently('Price');
553 553
 
554
-			do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove );
554
+			do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove);
555 555
 
556 556
 			// finally let's delete this ticket
557 557
 			// (which should not be blocked at this point b/c we've removed all our relationships)
@@ -583,39 +583,39 @@  discard block
 block discarded – undo
583 583
 		// and removing the ticket from datetimes it got removed from.
584 584
 
585 585
 		// first let's add datetimes
586
-		if ( ! empty( $added_datetimes ) && is_array( $added_datetimes ) ) {
587
-			foreach ( $added_datetimes as $row_id ) {
586
+		if ( ! empty($added_datetimes) && is_array($added_datetimes)) {
587
+			foreach ($added_datetimes as $row_id) {
588 588
 				$row_id = (int) $row_id;
589
-				if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) {
590
-					$ticket->_add_relation_to( $saved_datetimes[ $row_id ], 'Datetime' );
589
+				if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) {
590
+					$ticket->_add_relation_to($saved_datetimes[$row_id], 'Datetime');
591 591
 					// Is this an existing ticket (has an ID) and does it have any sold?
592 592
 					// If so, then we need to add that to the DTT sold because this DTT is getting added.
593
-					if ( $ticket->ID() && $ticket->sold() > 0 ) {
594
-						$saved_datetimes[ $row_id ]->increase_sold( $ticket->sold() );
595
-						$saved_datetimes[ $row_id ]->save();
593
+					if ($ticket->ID() && $ticket->sold() > 0) {
594
+						$saved_datetimes[$row_id]->increase_sold($ticket->sold());
595
+						$saved_datetimes[$row_id]->save();
596 596
 					}
597 597
 				}
598 598
 			}
599 599
 		}
600 600
 		// then remove datetimes
601
-		if ( ! empty( $removed_datetimes ) && is_array( $removed_datetimes ) ) {
602
-			foreach ( $removed_datetimes as $row_id ) {
603
-				$row_id = (int)$row_id;
601
+		if ( ! empty($removed_datetimes) && is_array($removed_datetimes)) {
602
+			foreach ($removed_datetimes as $row_id) {
603
+				$row_id = (int) $row_id;
604 604
 				// its entirely possible that a datetime got deleted (instead of just removed from relationship.
605 605
 				// So make sure we skip over this if the dtt isn't in the $saved_datetimes array)
606
-				if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) {
607
-					$ticket->_remove_relation_to( $saved_datetimes[ $row_id ], 'Datetime' );
606
+				if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) {
607
+					$ticket->_remove_relation_to($saved_datetimes[$row_id], 'Datetime');
608 608
 					// Is this an existing ticket (has an ID) and does it have any sold?
609 609
 					// If so, then we need to remove it's sold from the DTT_sold.
610
-					if ( $ticket->ID() && $ticket->sold() > 0 ) {
611
-						$saved_datetimes[ $row_id ]->decrease_sold( $ticket->sold() );
612
-						$saved_datetimes[ $row_id ]->save();
610
+					if ($ticket->ID() && $ticket->sold() > 0) {
611
+						$saved_datetimes[$row_id]->decrease_sold($ticket->sold());
612
+						$saved_datetimes[$row_id]->save();
613 613
 					}
614 614
 				}
615 615
 			}
616 616
 		}
617 617
 		// cap ticket qty by datetime reg limits
618
-		$ticket->set_qty( min( $ticket->qty(), $ticket->qty( 'reg_limit' ) ) );
618
+		$ticket->set_qty(min($ticket->qty(), $ticket->qty('reg_limit')));
619 619
 		return $ticket;
620 620
 	}
621 621
 
@@ -636,39 +636,39 @@  discard block
 block discarded – undo
636 636
 		EE_Ticket $ticket,
637 637
 		$price_rows = array(),
638 638
 		$ticket_price = 0,
639
-		$base_price = 0 ,
639
+		$base_price = 0,
640 640
 		$base_price_id = 0
641 641
 	) {
642 642
 
643 643
 		// create new ticket that's a copy of the existing
644 644
 		// except a new id of course (and not archived)
645 645
 		// AND has the new TKT_price associated with it.
646
-		$new_ticket = clone( $ticket );
647
-		$new_ticket->set( 'TKT_ID', 0 );
648
-		$new_ticket->set( 'TKT_deleted', 0 );
649
-		$new_ticket->set( 'TKT_price', $ticket_price );
650
-		$new_ticket->set( 'TKT_sold', 0 );
646
+		$new_ticket = clone($ticket);
647
+		$new_ticket->set('TKT_ID', 0);
648
+		$new_ticket->set('TKT_deleted', 0);
649
+		$new_ticket->set('TKT_price', $ticket_price);
650
+		$new_ticket->set('TKT_sold', 0);
651 651
 		// let's get a new ID for this ticket
652 652
 		$new_ticket->save();
653 653
 		// we also need to make sure this new ticket gets the same datetime attachments as the archived ticket
654
-		$datetimes_on_existing = $ticket->get_many_related( 'Datetime' );
654
+		$datetimes_on_existing = $ticket->get_many_related('Datetime');
655 655
 		$new_ticket = $this->_update_ticket_datetimes(
656 656
 			$new_ticket,
657 657
 			$datetimes_on_existing,
658
-			array_keys( $datetimes_on_existing )
658
+			array_keys($datetimes_on_existing)
659 659
 		);
660 660
 
661 661
 		// $ticket will get archived later b/c we are NOT adding it to the saved_tickets array.
662 662
 		// if existing $ticket has sold amount, then we need to adjust the qty for the new TKT to = the remaining
663 663
 		// available.
664
-		if ( $ticket->sold() > 0 ) {
664
+		if ($ticket->sold() > 0) {
665 665
 			$new_qty = $ticket->qty() - $ticket->sold();
666
-			$new_ticket->set_qty( $new_qty );
666
+			$new_ticket->set_qty($new_qty);
667 667
 		}
668 668
 		//now we update the prices just for this ticket
669
-		$new_ticket = $this->_add_prices_to_ticket( $price_rows, $new_ticket, true );
669
+		$new_ticket = $this->_add_prices_to_ticket($price_rows, $new_ticket, true);
670 670
 		//and we update the base price
671
-		$new_ticket = $this->_add_prices_to_ticket( array(), $new_ticket, true, $base_price, $base_price_id );
671
+		$new_ticket = $this->_add_prices_to_ticket(array(), $new_ticket, true, $base_price, $base_price_id);
672 672
 		return $new_ticket;
673 673
 	}
674 674
 
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 	 * @param int|bool 		$base_price_id  if present then this is the base_price_id being updated.
689 689
 	 * @return EE_Ticket
690 690
 	 */
691
-	protected function  _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) {
691
+	protected function  _add_prices_to_ticket($prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE) {
692 692
 
693 693
 		//let's just get any current prices that may exist on the given ticket so we can remove any prices that got trashed in this session.
694 694
 		$current_prices_on_ticket = $base_price !== FALSE ? $ticket->base_price(TRUE) : $ticket->price_modifiers();
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 		$updated_prices = array();
697 697
 
698 698
 		// if $base_price ! FALSE then updating a base price.
699
-		if ( $base_price !== FALSE ) {
699
+		if ($base_price !== FALSE) {
700 700
 			$prices[1] = array(
701 701
 				'PRC_ID' => $new_prices || $base_price_id === 1 ? NULL : $base_price_id,
702 702
 				'PRT_ID' => 1,
@@ -707,47 +707,47 @@  discard block
 block discarded – undo
707 707
 		}
708 708
 
709 709
 		//possibly need to save tkt
710
-		if ( ! $ticket->ID() )
710
+		if ( ! $ticket->ID())
711 711
 			$ticket->save();
712 712
 
713
-		foreach ( $prices as $row => $prc ) {
714
-			$prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL;
715
-			if ( empty($prt_id) )
713
+		foreach ($prices as $row => $prc) {
714
+			$prt_id = ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL;
715
+			if (empty($prt_id))
716 716
 				continue; //prices MUST have a price type id.
717 717
 			$PRC_values = array(
718
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
718
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
719 719
 				'PRT_ID' => $prt_id,
720
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
721
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
722
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
720
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
721
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
722
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
723 723
 				'PRC_is_default' => false, //make sure we set PRC_is_default to false for all ticket saves from event_editor
724 724
 				'PRC_order' => $row
725 725
 				);
726
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
726
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
727 727
 				$PRC_values['PRC_ID'] = 0;
728
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
728
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
729 729
 			} else {
730
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
730
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
731 731
 				//update this price with new values
732
-				foreach ( $PRC_values as $field => $newprc ) {
733
-					$PRC->set( $field, $newprc );
732
+				foreach ($PRC_values as $field => $newprc) {
733
+					$PRC->set($field, $newprc);
734 734
 				}
735 735
 			}
736 736
 			$PRC->save();
737 737
 			$prcid = $PRC->ID();
738 738
 			$updated_prices[$prcid] = $PRC;
739
-			$ticket->_add_relation_to( $PRC, 'Price' );
739
+			$ticket->_add_relation_to($PRC, 'Price');
740 740
 		}
741 741
 
742 742
 		//now let's remove any prices that got removed from the ticket
743
-		if ( !empty ( $current_prices_on_ticket ) ) {
743
+		if ( ! empty ($current_prices_on_ticket)) {
744 744
 			$current = array_keys($current_prices_on_ticket);
745 745
 			$updated = array_keys($updated_prices);
746 746
 			$prices_to_remove = array_diff($current, $updated);
747
-			if ( !empty( $prices_to_remove ) ) {
748
-				foreach ( $prices_to_remove as $prc_id ) {
747
+			if ( ! empty($prices_to_remove)) {
748
+				foreach ($prices_to_remove as $prc_id) {
749 749
 					$p = $current_prices_on_ticket[$prc_id];
750
-					$ticket->_remove_relation_to( $p, 'Price' );
750
+					$ticket->_remove_relation_to($p, 'Price');
751 751
 
752 752
 					//delete permanently the price
753 753
 					$p->delete_permanently();
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 
761 761
 
762 762
 
763
-	public function autosave_handling( $event_admin_obj ) {
763
+	public function autosave_handling($event_admin_obj) {
764 764
 		return $event_admin_obj; //doing nothing for the moment.
765 765
 		//todo when I get to this remember that I need to set the template args on the $event_admin_obj (use the set_template_args() method)
766 766
 
@@ -794,12 +794,12 @@  discard block
 block discarded – undo
794 794
 
795 795
 		//default main template args
796 796
 		$main_template_args = array(
797
-			'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help
797
+			'event_datetime_help_link' => EEH_Template::get_help_tab_link('event_editor_event_datetimes_help_tab', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add a filter to the template for the help text in the Events_Admin_Page core file so we can add further help
798 798
 			'existing_datetime_ids' => '',
799 799
 			'total_dtt_rows' => 1,
800
-			'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
800
+			'add_new_dtt_help_link' => EEH_Template::get_help_tab_link('add_new_dtt_info', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
801 801
 			'datetime_rows' => '',
802
-			'show_tickets_container' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
802
+			'show_tickets_container' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
803 803
 			'ticket_rows' => '',
804 804
 			'existing_ticket_ids' => '',
805 805
 			'total_ticket_rows' => 1,
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 
810 810
 		$timezone = $evtobj instanceof EE_Event ? $evtobj->timezone_string() : NULL;
811 811
 
812
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
812
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
813 813
 
814 814
 		/**
815 815
 		 * 1. Start with retrieving Datetimes
@@ -817,8 +817,8 @@  discard block
 block discarded – undo
817 817
 		 * 3. For each ticket get related prices
818 818
 		 */
819 819
 
820
-		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) );
821
-		$times = $DTM->get_all_event_dates( $evtID );
820
+		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone));
821
+		$times = $DTM->get_all_event_dates($evtID);
822 822
 
823 823
 
824 824
 
@@ -826,31 +826,31 @@  discard block
 block discarded – undo
826 826
 
827 827
 		/** @see https://events.codebasehq.com/projects/event-espresso/tickets/9486 for why we are counting $dttrow and then setting that on the Datetime object */
828 828
 		$dttrow = 1;
829
-		foreach ( $times as $time ) {
829
+		foreach ($times as $time) {
830 830
 			$dttid = $time->get('DTT_ID');
831
-			$time->set( 'DTT_order', $dttrow );
831
+			$time->set('DTT_order', $dttrow);
832 832
 			$existing_datetime_ids[] = $dttid;
833 833
 
834 834
 			//tickets attached
835
-			$related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array( array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC' ) ) ) : array();
835
+			$related_tickets = $time->ID() > 0 ? $time->get_many_related('Ticket', array(array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)), 'default_where_conditions' => 'none', 'order_by' => array('TKT_order' => 'ASC'))) : array();
836 836
 
837 837
 			//if there are no related tickets this is likely a new event OR autodraft
838 838
 			// event so we need to generate the default tickets because dtts
839 839
 			// ALWAYS have at least one related ticket!!.  EXCEPT, we dont' do this if there is already more than one
840 840
 			// datetime on the event.
841
-			if ( empty ( $related_tickets ) && count( $times ) < 2 ) {
841
+			if (empty ($related_tickets) && count($times) < 2) {
842 842
 				$related_tickets = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
843 843
 
844 844
 				//this should be ordered by TKT_ID, so let's grab the first default ticket (which will be the main default) and ensure it has any default prices added to it (but do NOT save).
845 845
 				$default_prices = EEM_Price::instance()->get_all_default_prices();
846 846
 
847
-				$main_default_ticket = reset( $related_tickets );
848
-				if ( $main_default_ticket instanceof EE_Ticket ) {
849
-					foreach ( $default_prices as $default_price ) {
850
-						if ( $default_price->is_base_price() ) {
847
+				$main_default_ticket = reset($related_tickets);
848
+				if ($main_default_ticket instanceof EE_Ticket) {
849
+					foreach ($default_prices as $default_price) {
850
+						if ($default_price->is_base_price()) {
851 851
 							continue;
852 852
 						}
853
-						$main_default_ticket->cache( 'Price', $default_price );
853
+						$main_default_ticket->cache('Price', $default_price);
854 854
 					}
855 855
 				}
856 856
 			}
@@ -859,11 +859,11 @@  discard block
 block discarded – undo
859 859
 			//we can't actually setup rows in this loop yet cause we don't know all the unique tickets for this event yet (tickets are linked through all datetimes). So we're going to temporarily cache some of that information.
860 860
 
861 861
 			//loop through and setup the ticket rows and make sure the order is set.
862
-			foreach ( $related_tickets as $ticket ) {
862
+			foreach ($related_tickets as $ticket) {
863 863
 				$tktid = $ticket->get('TKT_ID');
864 864
 				$tktrow = $ticket->get('TKT_row');
865 865
 				//we only want unique tickets in our final display!!
866
-				if ( !in_array( $tktid, $existing_ticket_ids ) ) {
866
+				if ( ! in_array($tktid, $existing_ticket_ids)) {
867 867
 					$existing_ticket_ids[] = $tktid;
868 868
 					$all_tickets[] = $ticket;
869 869
 				}
@@ -872,57 +872,57 @@  discard block
 block discarded – undo
872 872
 				$datetime_tickets[$dttid][] = $tktrow;
873 873
 
874 874
 				//temporary cache of this datetime info for this ticket for later processing of ticket rows.
875
-				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) )
875
+				if ( ! isset($ticket_datetimes[$tktid]) || ! in_array($dttrow, $ticket_datetimes[$tktid]))
876 876
 					$ticket_datetimes[$tktid][] = $dttrow;
877 877
 			}
878 878
 			$dttrow++;
879 879
 		}
880 880
 
881
-		$main_template_args['total_ticket_rows'] = count( $existing_ticket_ids );
882
-		$main_template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids );
883
-		$main_template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids );
881
+		$main_template_args['total_ticket_rows'] = count($existing_ticket_ids);
882
+		$main_template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
883
+		$main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
884 884
 
885 885
 		//sort $all_tickets by order
886
-		usort( $all_tickets, function( $a, $b ) {
886
+		usort($all_tickets, function($a, $b) {
887 887
 			$a_order = (int) $a->get('TKT_order');
888 888
 			$b_order = (int) $b->get('TKT_order');
889
-			if ( $a_order == $b_order ) {
889
+			if ($a_order == $b_order) {
890 890
 				return 0;
891 891
 			}
892
-			return ( $a_order < $b_order ) ? -1 : 1;
892
+			return ($a_order < $b_order) ? -1 : 1;
893 893
 		});
894 894
 
895 895
 		//k NOW we have all the data we need for setting up the dtt rows and ticket rows so we start our dtt loop again.
896 896
 		$dttrow = 1;
897
-		foreach ( $times as $time ) {
898
-			$main_template_args['datetime_rows'] .= $this->_get_datetime_row( $dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times );
897
+		foreach ($times as $time) {
898
+			$main_template_args['datetime_rows'] .= $this->_get_datetime_row($dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times);
899 899
 			$dttrow++;
900 900
 		}
901 901
 
902 902
 		//then loop through all tickets for the ticket rows.
903 903
 		$tktrow = 1;
904
-		foreach ( $all_tickets as $ticket ) {
905
-			$main_template_args['ticket_rows'] .= $this->_get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets );
904
+		foreach ($all_tickets as $ticket) {
905
+			$main_template_args['ticket_rows'] .= $this->_get_ticket_row($tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets);
906 906
 			$tktrow++;
907 907
 		}
908 908
 
909 909
 		$main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets);
910
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php';
911
-		EEH_Template::display_template( $template, $main_template_args );
910
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_metabox_main.template.php';
911
+		EEH_Template::display_template($template, $main_template_args);
912 912
 		return;
913 913
 	}
914 914
 
915 915
 
916 916
 
917
-	protected function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) {
917
+	protected function _get_datetime_row($dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array()) {
918 918
 
919 919
 		$dtt_display_template_args = array(
920
-			'dtt_edit_row' => $this->_get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ),
921
-			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ),
920
+			'dtt_edit_row' => $this->_get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts),
921
+			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default),
922 922
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow
923 923
 			);
924
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php';
925
-		return EEH_Template::display_template( $template, $dtt_display_template_args, TRUE);
924
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_row_wrapper.template.php';
925
+		return EEH_Template::display_template($template, $dtt_display_template_args, TRUE);
926 926
 	}
927 927
 
928 928
 
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 	 *
941 941
 	 * @return string Generated edit row.
942 942
 	 */
943
-	protected function _get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ) {
943
+	protected function _get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts) {
944 944
 
945 945
 		// if the incomign $dtt object is NOT an instance of EE_Datetime then force default to true.
946 946
 		$default = ! $dtt instanceof EE_Datetime ? true : false;
@@ -948,30 +948,30 @@  discard block
 block discarded – undo
948 948
 		$template_args = array(
949 949
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
950 950
 			'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes',
951
-			'edit_dtt_expanded' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
951
+			'edit_dtt_expanded' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
952 952
 			'DTT_ID' => $default ? '' : $dtt->ID(),
953 953
 			'DTT_name' => $default ? '' : $dtt->name(),
954 954
 			'DTT_description' => $default ? '' : $dtt->description(),
955
-			'DTT_EVT_start' => $default ? '' : $dtt->start_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
956
-			'DTT_EVT_end' => $default ? '' : $dtt->end_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
957
-			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit','input'),
955
+			'DTT_EVT_start' => $default ? '' : $dtt->start_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
956
+			'DTT_EVT_end' => $default ? '' : $dtt->end_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
957
+			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'),
958 958
 			'DTT_order' => $default ? 'DTTNUM' : $dttrow,
959 959
 			'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'),
960
-			'clone_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
961
-			'trash_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0  ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable'
960
+			'clone_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
961
+			'trash_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable'
962 962
 			);
963 963
 
964
-		$template_args['show_trash'] = count( $all_dtts ) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
964
+		$template_args['show_trash'] = count($all_dtts) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
965 965
 
966 966
 		//allow filtering of template args at this point.
967
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event );
967
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_edit_row__template_args', $template_args, $dttrow, $dtt, $default, $all_dtts, $this->_is_creating_event);
968 968
 
969
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php';
970
-		return EEH_Template::display_template( $template, $template_args, TRUE );
969
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_edit_row.template.php';
970
+		return EEH_Template::display_template($template, $template_args, TRUE);
971 971
 	}
972 972
 
973 973
 
974
-	protected function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) {
974
+	protected function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default) {
975 975
 
976 976
 		$template_args = array(
977 977
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
@@ -979,47 +979,47 @@  discard block
 block discarded – undo
979 979
 			'DTT_description' => $default ? '' : $dtt->description(),
980 980
 			'datetime_tickets_list' => $default ? '<li class="hidden"></li>' : '',
981 981
 			'show_tickets_row' => ' style="display:none;"', //$default || $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' style="display:none;"' : '',
982
-			'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE ), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
982
+			'add_new_datetime_ticket_help_link' => EEH_Template::get_help_tab_link('add_new_ticket_via_datetime', $this->_adminpage_obj->page_slug, $this->_adminpage_obj->get_req_action(), FALSE, FALSE), //todo need to add this help info id to the Events_Admin_Page core file so we can access it here.
983 983
 			'DTT_ID' => $default ? '' : $dtt->ID()
984 984
 			);
985 985
 
986 986
 		//need to setup the list items (but only if this isnt' a default skeleton setup)
987
-		if ( !$default ) {
987
+		if ( ! $default) {
988 988
 			$tktrow = 1;
989
-			foreach ( $all_tickets as $ticket ) {
990
-				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default );
989
+			foreach ($all_tickets as $ticket) {
990
+				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default);
991 991
 				$tktrow++;
992 992
 			}
993 993
 		}
994 994
 
995 995
 		//filter template args at this point
996
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event );
996
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_dtt_attached_ticket_row__template_args', $template_args, $dttrow, $dtt, $datetime_tickets, $all_tickets, $default, $this->_is_creating_event);
997 997
 
998
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php';
999
-		return EEH_Template::display_template( $template, $template_args, TRUE );
998
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_attached_tickets_row.template.php';
999
+		return EEH_Template::display_template($template, $template_args, TRUE);
1000 1000
 	}
1001 1001
 
1002 1002
 
1003 1003
 
1004
-	protected function _get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ) {
1005
-		$tktid = !empty( $ticket ) ? $ticket->ID() : 0;
1006
-		$dtt_tkts = $dtt instanceof EE_Datetime && isset( $datetime_tickets[$dtt->ID()] ) ? $datetime_tickets[$dtt->ID()] : array();
1004
+	protected function _get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default) {
1005
+		$tktid = ! empty($ticket) ? $ticket->ID() : 0;
1006
+		$dtt_tkts = $dtt instanceof EE_Datetime && isset($datetime_tickets[$dtt->ID()]) ? $datetime_tickets[$dtt->ID()] : array();
1007 1007
 
1008
-		$displayrow = !empty( $ticket ) ? $ticket->get('TKT_row') : 0;
1008
+		$displayrow = ! empty($ticket) ? $ticket->get('TKT_row') : 0;
1009 1009
 		$template_args = array(
1010 1010
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
1011
-			'tkt_row' => $default && empty( $ticket ) ? 'TICKETNUM' : $tktrow,
1011
+			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
1012 1012
 			'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '',
1013 1013
 			'ticket_selected' => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '',
1014
-			'TKT_name' => $default && empty( $ticket ) ? 'TKTNAME' : $ticket->get('TKT_name'),
1015
-			'tkt_status_class' => ( $default && empty( $ticket ) ) || $this->_is_creating_event ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(),
1014
+			'TKT_name' => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'),
1015
+			'tkt_status_class' => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(),
1016 1016
 			);
1017 1017
 
1018 1018
 		//filter template args
1019
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event );
1019
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_datetime_tickets_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default, $this->_is_creating_event);
1020 1020
 
1021
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php';
1022
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1021
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_dtt_tickets_list.template.php';
1022
+		return EEH_Template::display_template($template, $template_args, TRUE);
1023 1023
 	}
1024 1024
 
1025 1025
 
@@ -1041,37 +1041,37 @@  discard block
 block discarded – undo
1041 1041
 	 *
1042 1042
 	 * @return [type] [description]
1043 1043
 	 */
1044
-	protected function _get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array() ) {
1044
+	protected function _get_ticket_row($tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array()) {
1045 1045
 
1046 1046
 		//if $ticket is not an instance of EE_Ticket then force default to true.
1047
-		$default =  ! $ticket instanceof EE_Ticket ? true : false;
1047
+		$default = ! $ticket instanceof EE_Ticket ? true : false;
1048 1048
 
1049
-		$prices = ! empty( $ticket ) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC') ) ) : array();
1049
+		$prices = ! empty($ticket) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))) : array();
1050 1050
 
1051 1051
 		//if there is only one price (which would be the base price) or NO prices and this ticket is a default ticket, let's just make sure there are no cached default prices on
1052 1052
 		//the object.  This is done by not including any query_params.
1053
-		if ( $ticket instanceof EE_Ticket && $ticket->is_default() && ( count( $prices ) === 1  || empty( $prices ) ) ) {
1054
-			$prices = $ticket->get_many_related( 'Price' );
1053
+		if ($ticket instanceof EE_Ticket && $ticket->is_default() && (count($prices) === 1 || empty($prices))) {
1054
+			$prices = $ticket->get_many_related('Price');
1055 1055
 		}
1056 1056
 
1057 1057
 		// check if we're dealing with a default ticket in which case we don't want any starting_ticket_datetime_row values set (otherwise there won't be any new relationships created for tickets based off of the default ticket).  This will future proof in case there is ever any behaviour change between what the primary_key defaults to.
1058
-		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default') ) ? TRUE : FALSE;
1058
+		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default')) ? TRUE : FALSE;
1059 1059
 
1060
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
1060
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1061 1061
 
1062 1062
 		$ticket_subtotal = $default ? 0 : $ticket->get_ticket_subtotal();
1063
-		$base_price = $default ? NULL :  $ticket->base_price();
1063
+		$base_price = $default ? NULL : $ticket->base_price();
1064 1064
 		$count_price_mods = EEM_Price::instance()->get_all_default_prices(TRUE);
1065 1065
 
1066 1066
 		//breaking out complicated condition for ticket_status
1067
-		if ( $default ) {
1068
-			$ticket_status_class = ' tkt-status-' . EE_Ticket::onsale;
1067
+		if ($default) {
1068
+			$ticket_status_class = ' tkt-status-'.EE_Ticket::onsale;
1069 1069
 		} else {
1070
-			$ticket_status_class =  $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status();
1070
+			$ticket_status_class = $ticket->is_default() ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status();
1071 1071
 		}
1072 1072
 
1073 1073
 		//breaking out complicated condition for TKT_taxable
1074
-		if ( $default ) {
1074
+		if ($default) {
1075 1075
 			$TKT_taxable = '';
1076 1076
 		} else {
1077 1077
 			$TKT_taxable = $ticket->get('TKT_taxable') ? ' checked="checked"' : '';
@@ -1086,19 +1086,19 @@  discard block
 block discarded – undo
1086 1086
 			'edit_tkt_expanded' => '',
1087 1087
 			'edit_tickets_name' => $default ? 'TICKETNAMEATTR' : 'edit_tickets',
1088 1088
 			'TKT_name' => $default ? '' : $ticket->get('TKT_name'),
1089
-			'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
1090
-			'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']  ),
1091
-			'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE),
1089
+			'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
1090
+			'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
1091
+			'TKT_status' => $default ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->is_default() ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : $ticket->ticket_status(TRUE),
1092 1092
 			'TKT_price' => $default ? '' : EEH_Template::format_currency($ticket->get_ticket_total_with_taxes(), FALSE, FALSE),
1093 1093
 			'TKT_price_code' => EE_Registry::instance()->CFG->currency->code,
1094 1094
 			'TKT_price_amount' => $default ? 0 : $ticket_subtotal,
1095
-			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty','symbol'),
1096
-			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty','input'),
1097
-			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses','input'),
1098
-			'TKT_min' => $default ? '' : ( $ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min') ),
1099
-			'TKT_max' => $default ? '' :  $ticket->get_pretty('TKT_max','input'),
1095
+			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty', 'symbol'),
1096
+			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty', 'input'),
1097
+			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses', 'input'),
1098
+			'TKT_min' => $default ? '' : ($ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min')),
1099
+			'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max', 'input'),
1100 1100
 			'TKT_sold' => $default ? 0 : $ticket->tickets_sold('ticket'),
1101
-			'TKT_registrations' => $default ? 0 : $ticket->count_registrations( array( array( 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ) ) ),
1101
+			'TKT_registrations' => $default ? 0 : $ticket->count_registrations(array(array('STS_ID' => array('!=', EEM_Registration::status_id_incomplete)))),
1102 1102
 			'TKT_ID' => $default ? 0 : $ticket->get('TKT_ID'),
1103 1103
 			'TKT_description' => $default ? '' : $ticket->get('TKT_description'),
1104 1104
 			'TKT_is_default' => $default ? 0 : $ticket->get('TKT_is_default'),
@@ -1107,99 +1107,99 @@  discard block
 block discarded – undo
1107 1107
 			'ticket_price_rows' => '',
1108 1108
 			'TKT_base_price' => $default || ! $base_price instanceof EE_Price ? '' : $base_price->get_pretty('PRC_amount', 'localized_float'),
1109 1109
 			'TKT_base_price_ID' => $default || ! $base_price instanceof EE_Price ? 0 : $base_price->ID(),
1110
-			'show_price_modifier' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) ? '' : ' style="display:none;"',
1111
-			'show_price_mod_button' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) || ( !$default && $ticket->get('TKT_deleted') ) ? ' style="display:none;"' : '',
1110
+			'show_price_modifier' => count($prices) > 1 || ($default && $count_price_mods > 0) ? '' : ' style="display:none;"',
1111
+			'show_price_mod_button' => count($prices) > 1 || ($default && $count_price_mods > 0) || ( ! $default && $ticket->get('TKT_deleted')) ? ' style="display:none;"' : '',
1112 1112
 			'total_price_rows' => count($prices) > 1 ? count($prices) : 1,
1113 1113
 			'ticket_datetimes_list' => $default ? '<li class="hidden"></li>' : '',
1114 1114
 			'starting_ticket_datetime_rows' => $default || $default_dtt ? '' : implode(',', $tkt_dtts),
1115 1115
 			'ticket_datetime_rows' => $default ? '' : implode(',', $tkt_dtts),
1116
-			'existing_ticket_price_ids' => $default, '', implode(',', array_keys( $prices) ),
1116
+			'existing_ticket_price_ids' => $default, '', implode(',', array_keys($prices)),
1117 1117
 			'ticket_template_id' => $default ? 0 : $ticket->get('TTM_ID'),
1118 1118
 			'TKT_taxable' => $TKT_taxable,
1119 1119
 			'display_subtotal' => $ticket instanceof EE_Ticket && $ticket->get('TKT_taxable') ? '' : ' style="display:none"',
1120 1120
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1121
-			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE ),
1121
+			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE),
1122 1122
 			'TKT_subtotal_amount' => $ticket_subtotal,
1123
-			'tax_rows' => $this->_get_tax_rows( $tktrow, $ticket ),
1124
-			'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE: FALSE,
1123
+			'tax_rows' => $this->_get_tax_rows($tktrow, $ticket),
1124
+			'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE : FALSE,
1125 1125
 			'ticket_archive_class' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? ' ticket-archived' : '',
1126 1126
 			'trash_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable',
1127 1127
 			'clone_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable'
1128 1128
 			);
1129 1129
 
1130
-		$template_args['trash_hidden'] = count( $all_tickets ) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
1130
+		$template_args['trash_hidden'] = count($all_tickets) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
1131 1131
 
1132 1132
 		//handle rows that should NOT be empty
1133
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1133
+		if (empty($template_args['TKT_start_date'])) {
1134 1134
 			//if empty then the start date will be now.
1135
-			$template_args['TKT_start_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , current_time('timestamp'));
1136
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1135
+			$template_args['TKT_start_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], current_time('timestamp'));
1136
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
1137 1137
 		}
1138 1138
 
1139
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1139
+		if (empty($template_args['TKT_end_date'])) {
1140 1140
 
1141 1141
 			//get the earliest datetime (if present);
1142
-			$earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
1142
+			$earliest_dtt = $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? $this->_adminpage_obj->get_cpt_model_obj()->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL;
1143 1143
 
1144
-			if ( !empty( $earliest_dtt ) ) {
1145
-				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
1144
+			if ( ! empty($earliest_dtt)) {
1145
+				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
1146 1146
 			} else {
1147 1147
 				//default so let's just use what's been set for the default date-time which is 30 days from now.
1148
-				$template_args['TKT_end_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , mktime(24, 0, 0, date("m"), date("d") + 29, date("Y") )  );
1148
+				$template_args['TKT_end_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], mktime(24, 0, 0, date("m"), date("d") + 29, date("Y")));
1149 1149
 			}
1150
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1150
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
1151 1151
 		}
1152 1152
 
1153 1153
 		//generate ticket_datetime items
1154
-		if ( ! $default ) {
1154
+		if ( ! $default) {
1155 1155
 			$dttrow = 1;
1156
-			foreach ( $all_dtts as $dtt ) {
1157
-				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default );
1156
+			foreach ($all_dtts as $dtt) {
1157
+				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default);
1158 1158
 				$dttrow++;
1159 1159
 			}
1160 1160
 		}
1161 1161
 
1162 1162
 		$prcrow = 1;
1163
-		foreach ( $prices as $price ) {
1164
-			if ( $price->is_base_price() ) {
1163
+		foreach ($prices as $price) {
1164
+			if ($price->is_base_price()) {
1165 1165
 				$prcrow++;
1166 1166
 				continue;
1167 1167
 			}
1168
-			$show_trash = ( count( $prices ) > 1 && $prcrow === 1 ) || count( $prices ) === 1  ? FALSE : TRUE;
1169
-			$show_create = count( $prices ) > 1 && count( $prices ) !== $prcrow ? FALSE : TRUE;
1170
-			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create );
1168
+			$show_trash = (count($prices) > 1 && $prcrow === 1) || count($prices) === 1 ? FALSE : TRUE;
1169
+			$show_create = count($prices) > 1 && count($prices) !== $prcrow ? FALSE : TRUE;
1170
+			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create);
1171 1171
 			$prcrow++;
1172 1172
 		}
1173 1173
 
1174 1174
 		//filter $template_args
1175
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event );
1175
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_row__template_args', $template_args, $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default, $all_tickets, $this->_is_creating_event);
1176 1176
 
1177
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php';
1178
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1177
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_row.template.php';
1178
+		return EEH_Template::display_template($template, $template_args, TRUE);
1179 1179
 	}
1180 1180
 
1181 1181
 
1182 1182
 
1183 1183
 
1184 1184
 
1185
-	protected function _get_tax_rows( $tktrow, $ticket ) {
1185
+	protected function _get_tax_rows($tktrow, $ticket) {
1186 1186
 		$tax_rows = '';
1187
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php';
1187
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_tax_row.template.php';
1188 1188
 		$template_args = array();
1189
-		$taxes = empty( $ticket ) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
1190
-		foreach ( $taxes as $tax ) {
1191
-			$tax_added = $this->_get_tax_added( $tax, $ticket );
1189
+		$taxes = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
1190
+		foreach ($taxes as $tax) {
1191
+			$tax_added = $this->_get_tax_added($tax, $ticket);
1192 1192
 			$template_args = array(
1193
-				'display_tax' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
1193
+				'display_tax' => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
1194 1194
 				'tax_id' => $tax->ID(),
1195 1195
 				'tkt_row' => $tktrow,
1196 1196
 				'tax_label' => $tax->get('PRC_name'),
1197 1197
 				'tax_added' => $tax_added,
1198
-				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE ),
1198
+				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE),
1199 1199
 				'tax_amount' => $tax->get('PRC_amount')
1200 1200
 				);
1201
-			$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event  );
1202
-			$tax_rows .= EEH_Template::display_template( $template, $template_args, TRUE );
1201
+			$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event);
1202
+			$tax_rows .= EEH_Template::display_template($template, $template_args, TRUE);
1203 1203
 		}
1204 1204
 
1205 1205
 
@@ -1207,81 +1207,81 @@  discard block
 block discarded – undo
1207 1207
 	}
1208 1208
 
1209 1209
 
1210
-	protected function _get_tax_added( EE_Price $tax, $ticket ) {
1211
-		$subtotal = empty( $ticket ) ? 0 : $ticket->get_ticket_subtotal();
1210
+	protected function _get_tax_added(EE_Price $tax, $ticket) {
1211
+		$subtotal = empty($ticket) ? 0 : $ticket->get_ticket_subtotal();
1212 1212
 		return $subtotal * $tax->get('PRC_amount') / 100;
1213 1213
 	}
1214 1214
 
1215 1215
 
1216 1216
 
1217 1217
 
1218
-	protected function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) {
1219
-		$send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1218
+	protected function _get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE) {
1219
+		$send_disabled = ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1220 1220
 		$template_args = array(
1221 1221
 			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
1222 1222
 			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1223 1223
 			'edit_prices_name' => $default && empty($price) ? 'PRICENAMEATTR' : 'edit_prices',
1224
-			'price_type_selector' => $default && empty( $price ) ? $this->_get_base_price_template( $tktrow, $prcrow, $price, $default ) : $this->_get_price_type_selector( $tktrow, $prcrow, $price, $default, $send_disabled ),
1224
+			'price_type_selector' => $default && empty($price) ? $this->_get_base_price_template($tktrow, $prcrow, $price, $default) : $this->_get_price_type_selector($tktrow, $prcrow, $price, $default, $send_disabled),
1225 1225
 			'PRC_ID' => $default && empty($price) ? 0 : $price->ID(),
1226 1226
 			'PRC_is_default' => $default && empty($price) ? 0 : $price->get('PRC_is_default'),
1227 1227
 			'PRC_name' => $default && empty($price) ? '' : $price->get('PRC_name'),
1228 1228
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1229 1229
 			'show_plus_or_minus' => $default && empty($price) ? '' : ' style="display:none;"',
1230
-			'show_plus' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
1231
-			'show_minus' => $default && empty( $price ) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
1232
-			'show_currency_symbol' => $default && empty( $price ) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : '' ),
1233
-			'PRC_amount' => $default && empty( $price ) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
1234
-			'show_percentage' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_percent() ? '' : ' style="display:none;"' ),
1230
+			'show_plus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
1231
+			'show_minus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
1232
+			'show_currency_symbol' => $default && empty($price) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : ''),
1233
+			'PRC_amount' => $default && empty($price) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
1234
+			'show_percentage' => $default && empty($price) ? ' style="display:none;"' : ($price->is_percent() ? '' : ' style="display:none;"'),
1235 1235
 			'show_trash_icon' => $show_trash ? '' : ' style="display:none;"',
1236 1236
 			'show_create_button' => $show_create ? '' : ' style="display:none;"',
1237
-			'PRC_desc' => $default && empty( $price ) ? '' : $price->get('PRC_desc'),
1238
-			'disabled' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE
1237
+			'PRC_desc' => $default && empty($price) ? '' : $price->get('PRC_desc'),
1238
+			'disabled' => ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE
1239 1239
 			);
1240 1240
 
1241
-	$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event );
1241
+	$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_price_row__template_args', $template_args, $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create, $this->_is_creating_event);
1242 1242
 
1243
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php';
1244
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1243
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_price_row.template.php';
1244
+		return EEH_Template::display_template($template, $template_args, TRUE);
1245 1245
 	}
1246 1246
 
1247 1247
 
1248
-	protected function _get_price_type_selector( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1249
-		if ( $price->is_base_price() ) {
1250
-			return $this->_get_base_price_template( $tktrow, $prcrow, $price, $default );
1248
+	protected function _get_price_type_selector($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1249
+		if ($price->is_base_price()) {
1250
+			return $this->_get_base_price_template($tktrow, $prcrow, $price, $default);
1251 1251
 		} else {
1252
-			return $this->_get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled );
1252
+			return $this->_get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled);
1253 1253
 		}
1254 1254
 
1255 1255
 	}
1256 1256
 
1257 1257
 
1258
-	protected function _get_base_price_template( $tktrow, $prcrow, $price, $default ) {
1258
+	protected function _get_base_price_template($tktrow, $prcrow, $price, $default) {
1259 1259
 		$template_args = array(
1260 1260
 				'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1261
-				'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1262
-				'PRT_ID' => $default && empty( $price ) ? 1 : $price->get('PRT_ID'),
1261
+				'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1262
+				'PRT_ID' => $default && empty($price) ? 1 : $price->get('PRT_ID'),
1263 1263
 				'PRT_name' => __('Price', 'event_espresso'),
1264 1264
 				'price_selected_operator' => '+',
1265 1265
 				'price_selected_is_percent' => 0
1266 1266
 			);
1267
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php';
1267
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_type_base.template.php';
1268 1268
 
1269
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event );
1269
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_base_price_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $this->_is_creating_event);
1270 1270
 
1271
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1271
+		return EEH_Template::display_template($template, $template_args, TRUE);
1272 1272
 	}
1273 1273
 
1274 1274
 
1275 1275
 
1276
-	protected function _get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1277
-		$select_name = $default && empty( $price ) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]';
1278
-		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array( array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3' ) ) ) );
1279
-		$price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php';
1280
-		$all_price_types = $default && empty( $price ) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso')) ) : array();
1281
-		$selected_price_type_id = $default && empty( $price ) ? 0 : $price->type();
1276
+	protected function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1277
+		$select_name = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices['.$tktrow.']['.$prcrow.'][PRT_ID]';
1278
+		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array(array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3'))));
1279
+		$price_option_span_template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_option_span.template.php';
1280
+		$all_price_types = $default && empty($price) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso'))) : array();
1281
+		$selected_price_type_id = $default && empty($price) ? 0 : $price->type();
1282 1282
 		$price_option_spans = '';
1283 1283
 		//setup pricetypes for selector
1284
-		foreach ( $price_types as $price_type ) {
1284
+		foreach ($price_types as $price_type) {
1285 1285
 			$all_price_types[] = array(
1286 1286
 				'id' => $price_type->ID(),
1287 1287
 				'text' => $price_type->get('PRT_name'),
@@ -1293,50 +1293,50 @@  discard block
 block discarded – undo
1293 1293
 				'PRT_operator' => $price_type->is_discount() ? '-' : '+',
1294 1294
 				'PRT_is_percent' => $price_type->get('PRT_is_percent') ? 1 : 0
1295 1295
 				);
1296
-			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE );
1296
+			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE);
1297 1297
 		}
1298 1298
 
1299
-		$select_params = $disabled ? 'style="width:auto;" disabled'  : 'style="width:auto;"';
1299
+		$select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"';
1300 1300
 		$main_name = $select_name;
1301
-		$select_name = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name;
1301
+		$select_name = $disabled ? 'archive_price['.$tktrow.']['.$prcrow.'][PRT_ID]' : $main_name;
1302 1302
 
1303 1303
 		$template_args = array(
1304 1304
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1305
-			'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1306
-			'price_modifier_selector' => EEH_Form_Fields::select_input( $select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID' ),
1305
+			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1306
+			'price_modifier_selector' => EEH_Form_Fields::select_input($select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID'),
1307 1307
 			'main_name' => $main_name,
1308 1308
 			'selected_price_type_id' => $selected_price_type_id,
1309 1309
 			'price_option_spans' => $price_option_spans,
1310
-			'price_selected_operator' => $default && empty( $price ) ? '' : ( $price->is_discount() ? '-' : '+' ),
1311
-			'price_selected_is_percent' => $default && empty( $price ) ? '' : ( $price->is_percent() ? 1 : 0 ),
1310
+			'price_selected_operator' => $default && empty($price) ? '' : ($price->is_discount() ? '-' : '+'),
1311
+			'price_selected_is_percent' => $default && empty($price) ? '' : ($price->is_percent() ? 1 : 0),
1312 1312
 			'disabled' => $disabled
1313 1313
 			);
1314 1314
 
1315
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event );
1315
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_price_modifier_template__template_args', $template_args, $tktrow, $prcrow, $price, $default, $disabled, $this->_is_creating_event);
1316 1316
 
1317
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php';
1317
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_modifier_selector.template.php';
1318 1318
 
1319
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1319
+		return EEH_Template::display_template($template, $template_args, TRUE);
1320 1320
 	}
1321 1321
 
1322 1322
 
1323 1323
 
1324
-	protected function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) {
1325
-		$dttid = !empty($dtt) ? $dtt->ID() : 0;
1326
-		$displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0;
1327
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
1324
+	protected function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default) {
1325
+		$dttid = ! empty($dtt) ? $dtt->ID() : 0;
1326
+		$displayrow = ! empty($dtt) ? $dtt->get('DTT_order') : 0;
1327
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1328 1328
 		$template_args = array(
1329
-			'dtt_row' => $default && empty( $dtt ) ? 'DTTNUM' : $dttrow,
1329
+			'dtt_row' => $default && empty($dtt) ? 'DTTNUM' : $dttrow,
1330 1330
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1331
-			'ticket_datetime_selected' => in_array( $displayrow, $tkt_dtts ) ? ' ticket-selected' : '',
1332
-			'ticket_datetime_checked' => in_array( $displayrow, $tkt_dtts ) ? ' checked="checked"' : '',
1333
-			'DTT_name' => $default && empty( $dtt ) ? 'DTTNAME' : $dtt->get_dtt_display_name( TRUE ),
1331
+			'ticket_datetime_selected' => in_array($displayrow, $tkt_dtts) ? ' ticket-selected' : '',
1332
+			'ticket_datetime_checked' => in_array($displayrow, $tkt_dtts) ? ' checked="checked"' : '',
1333
+			'DTT_name' => $default && empty($dtt) ? 'DTTNAME' : $dtt->get_dtt_display_name(TRUE),
1334 1334
 			'tkt_status_class' => '',
1335 1335
 			);
1336 1336
 
1337
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event );
1338
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1339
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1337
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_datetime_list_item__template_args', $template_args, $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default, $this->_is_creating_event);
1338
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1339
+		return EEH_Template::display_template($template, $template_args, TRUE);
1340 1340
 	}
1341 1341
 
1342 1342
 
@@ -1344,53 +1344,53 @@  discard block
 block discarded – undo
1344 1344
 	protected function _get_ticket_js_structure($all_dtts, $all_tickets) {
1345 1345
 		$template_args = array(
1346 1346
 			'default_datetime_edit_row' => $this->_get_dtt_edit_row('DTTNUM', NULL, TRUE, $all_dtts),
1347
-			'default_ticket_row' => $this->_get_ticket_row( 'TICKETNUM', NULL, array(), array(), TRUE),
1348
-			'default_price_row' => $this->_get_ticket_price_row( 'TICKETNUM', 'PRICENUM', NULL, TRUE, NULL ),
1347
+			'default_ticket_row' => $this->_get_ticket_row('TICKETNUM', NULL, array(), array(), TRUE),
1348
+			'default_price_row' => $this->_get_ticket_price_row('TICKETNUM', 'PRICENUM', NULL, TRUE, NULL),
1349 1349
 			'default_price_rows' => '',
1350 1350
 			'default_base_price_amount' => 0,
1351 1351
 			'default_base_price_name' => '',
1352 1352
 			'default_base_price_description' => '',
1353
-			'default_price_modifier_selector_row' => $this->_get_price_modifier_template( 'TICKETNUM', 'PRICENUM', NULL, TRUE ),
1354
-			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row( 'DTTNUM', NULL, array(), array(), TRUE ),
1353
+			'default_price_modifier_selector_row' => $this->_get_price_modifier_template('TICKETNUM', 'PRICENUM', NULL, TRUE),
1354
+			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row('DTTNUM', NULL, array(), array(), TRUE),
1355 1355
 			'existing_available_datetime_tickets_list' => '',
1356 1356
 			'existing_available_ticket_datetimes_list' => '',
1357
-			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ),
1358
-			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE )
1357
+			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE),
1358
+			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE)
1359 1359
 			);
1360 1360
 
1361 1361
 		$tktrow = 1;
1362
-		foreach ( $all_tickets as $ticket ) {
1363
-			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( 'DTTNUM', $tktrow, NULL, $ticket, array(), TRUE );
1362
+		foreach ($all_tickets as $ticket) {
1363
+			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item('DTTNUM', $tktrow, NULL, $ticket, array(), TRUE);
1364 1364
 			$tktrow++;
1365 1365
 		}
1366 1366
 
1367 1367
 
1368 1368
 		$dttrow = 1;
1369
-		foreach ( $all_dtts as $dtt ) {
1370
-			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE );
1369
+		foreach ($all_dtts as $dtt) {
1370
+			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE);
1371 1371
 			$dttrow++;
1372 1372
 		}
1373 1373
 
1374 1374
 		$default_prices = EE_Registry::instance()->load_model('Price')->get_all_default_prices();
1375 1375
 		$prcrow = 1;
1376
-		foreach ( $default_prices as $price ) {
1377
-			if ( $price->is_base_price() ) {
1376
+		foreach ($default_prices as $price) {
1377
+			if ($price->is_base_price()) {
1378 1378
 				$template_args['default_base_price_amount'] = $price->get_pretty('PRC_amount', 'localized_float');
1379 1379
 				$template_args['default_base_price_name'] = $price->get('PRC_name');
1380 1380
 				$template_args['default_base_price_description'] = $price->get('PRC_desc');
1381 1381
 				$prcrow++;
1382 1382
 				continue;
1383 1383
 			}
1384
-			$show_trash = ( count( $default_prices ) > 1 && $prcrow === 1 ) || count( $default_prices ) === 1  ? FALSE : TRUE;
1385
-			$show_create = count( $default_prices ) > 1 && count( $default_prices ) !== $prcrow ? FALSE : TRUE;
1386
-			$template_args['default_price_rows'] .= $this->_get_ticket_price_row( 'TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create );
1384
+			$show_trash = (count($default_prices) > 1 && $prcrow === 1) || count($default_prices) === 1 ? FALSE : TRUE;
1385
+			$show_create = count($default_prices) > 1 && count($default_prices) !== $prcrow ? FALSE : TRUE;
1386
+			$template_args['default_price_rows'] .= $this->_get_ticket_price_row('TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create);
1387 1387
 			$prcrow++;
1388 1388
 		}
1389 1389
 
1390
-		$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event );
1390
+		$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_ticket_js_structure__template_args', $template_args, $all_dtts, $all_tickets, $this->_is_creating_event);
1391 1391
 
1392
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php';
1393
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1392
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_js_structure.template.php';
1393
+		return EEH_Template::display_template($template, $template_args, TRUE);
1394 1394
 	}
1395 1395
 
1396 1396
 
Please login to merge, or discard this patch.
core/db_classes/EE_Event.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1006,7 +1006,7 @@
 block discarded – undo
1006 1006
 	 *
1007 1007
 	 * @access public
1008 1008
 	 * @param boolean $echo     whether to return (FALSE), or echo out the result (TRUE)
1009
-	 * @return mixed void|string
1009
+	 * @return string void|string
1010 1010
 	 */
1011 1011
 	public function pretty_active_status( $echo = TRUE ) {
1012 1012
 		$active_status = $this->get_active_status();
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -352,8 +352,7 @@  discard block
 block discarded – undo
352 352
 		$short_desc = $this->get( 'EVT_short_desc' );
353 353
 		if ( !empty( $short_desc ) || $not_full_desc ) {
354 354
 			return $short_desc;
355
-		}
356
-		else {
355
+		} else {
357 356
 			$full_desc = $this->get( 'EVT_desc' );
358 357
 			return wp_trim_words( $full_desc, $num_words, $more );
359 358
 		}
@@ -965,8 +964,7 @@  discard block
 block discarded – undo
965 964
 	public function is_sold_out( $actual = FALSE ) {
966 965
 		if ( ! $actual ) {
967 966
 			return $this->status() == EEM_Event::sold_out;
968
-		}
969
-		else {
967
+		} else {
970 968
 			return $this->perform_sold_out_status_check();
971 969
 		}
972 970
 	}
@@ -1158,8 +1156,7 @@  discard block
 block discarded – undo
1158 1156
 	public function get_permalink() {
1159 1157
 		if ( $this->external_url() ) {
1160 1158
 			return $this->external_url();
1161
-		}
1162
-		else {
1159
+		} else {
1163 1160
 			return parent::get_permalink();
1164 1161
 		}
1165 1162
 	}
Please login to merge, or discard this patch.
Spacing   +216 added lines, -216 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 /**
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 *                             		    date_format and the second value is the time format
36 36
 	 * @return EE_Event
37 37
 	 */
38
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
39
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
40
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
38
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
39
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
40
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
41 41
 	}
42 42
 
43 43
 
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 *                          		the website will be used.
49 49
 	 * @return EE_Event
50 50
 	 */
51
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
52
-		return new self( $props_n_values, TRUE, $timezone );
51
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
52
+		return new self($props_n_values, TRUE, $timezone);
53 53
 	}
54 54
 
55 55
 
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
 	 * @param mixed  $field_value
62 62
 	 * @param bool   $use_default
63 63
 	 */
64
-	public function set( $field_name, $field_value, $use_default = false ) {
65
-		switch ( $field_name ) {
64
+	public function set($field_name, $field_value, $use_default = false) {
65
+		switch ($field_name) {
66 66
 			case 'status' :
67
-				$this->set_status( $field_value, $use_default );
67
+				$this->set_status($field_value, $use_default);
68 68
 				break;
69 69
 			default :
70
-				parent::set( $field_name, $field_value, $use_default );
70
+				parent::set($field_name, $field_value, $use_default);
71 71
 		}
72 72
 	}
73 73
 
@@ -86,29 +86,29 @@  discard block
 block discarded – undo
86 86
 	 * @return bool|void
87 87
 	 * @throws \EE_Error
88 88
 	 */
89
-	public function set_status( $new_status = null, $use_default = false ) {
89
+	public function set_status($new_status = null, $use_default = false) {
90 90
 		// get current Event status
91 91
 		$old_status = $this->status();
92 92
 		// if status has changed
93
-		if ( $old_status != $new_status ) {
93
+		if ($old_status != $new_status) {
94 94
 			// TO sold_out
95
-			if ( $new_status == EEM_Event::sold_out ) {
95
+			if ($new_status == EEM_Event::sold_out) {
96 96
 				// save the previous event status so that we can revert if the event is no longer sold out
97
-				$this->add_post_meta( '_previous_event_status', $old_status );
98
-				do_action( 'AHEE__EE_Event__set_status__to_sold_out', $this, $old_status, $new_status );
97
+				$this->add_post_meta('_previous_event_status', $old_status);
98
+				do_action('AHEE__EE_Event__set_status__to_sold_out', $this, $old_status, $new_status);
99 99
 				// OR FROM  sold_out
100
-			} else if ( $old_status == EEM_Event::sold_out ) {
101
-				$this->delete_post_meta( '_previous_event_status' );
102
-				do_action( 'AHEE__EE_Event__set_status__from_sold_out', $this, $old_status, $new_status );
100
+			} else if ($old_status == EEM_Event::sold_out) {
101
+				$this->delete_post_meta('_previous_event_status');
102
+				do_action('AHEE__EE_Event__set_status__from_sold_out', $this, $old_status, $new_status);
103 103
 			}
104 104
 			// update status
105
-			parent::set( 'status', $new_status, $use_default );
106
-			do_action( 'AHEE__EE_Event__set_status__after_update', $this );
105
+			parent::set('status', $new_status, $use_default);
106
+			do_action('AHEE__EE_Event__set_status__after_update', $this);
107 107
 			return true;
108 108
 		} else {
109 109
 			// even though the old value matches the new value, it's still good to
110 110
 			// allow the parent set method to have a say
111
-			parent::set( 'status', $new_status, $use_default );
111
+			parent::set('status', $new_status, $use_default);
112 112
 			return true;
113 113
 		}
114 114
 	}
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 	 * @param array $query_params like EEM_Base::get_all
122 122
 	 * @return EE_Datetime[]
123 123
 	 */
124
-	public function datetimes( $query_params = array() ) {
125
-		return $this->get_many_related( 'Datetime', $query_params );
124
+	public function datetimes($query_params = array()) {
125
+		return $this->get_many_related('Datetime', $query_params);
126 126
 	}
127 127
 
128 128
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * @return EE_Datetime[]
134 134
 	 */
135 135
 	public function datetimes_in_chronological_order() {
136
-		return $this->get_many_related( 'Datetime', array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) );
136
+		return $this->get_many_related('Datetime', array('order_by' => array('DTT_EVT_start' => 'ASC')));
137 137
 	}
138 138
 
139 139
 
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 	 * @param null $limit
150 150
 	 * @return \EE_Datetime[]
151 151
 	 */
152
-	public function datetimes_ordered( $show_expired = true, $show_deleted = false, $limit = null ) {
153
-		return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_event_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted, $limit );
152
+	public function datetimes_ordered($show_expired = true, $show_deleted = false, $limit = null) {
153
+		return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_event_ordered_by_DTT_order($this->ID(), $show_expired, $show_deleted, $limit);
154 154
 	}
155 155
 
156 156
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 * @return EE_Datetime
161 161
 	 */
162 162
 	public function first_datetime() {
163
-		return $this->get_first_related( 'Datetime' );
163
+		return $this->get_first_related('Datetime');
164 164
 	}
165 165
 
166 166
 
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 	 * @param bool $try_to_exclude_deleted
172 172
 	 * @return EE_Datetime
173 173
 	 */
174
-	public function primary_datetime( $try_to_exclude_expired = TRUE, $try_to_exclude_deleted = TRUE ) {
175
-		if ( !empty ( $this->_Primary_Datetime ) ) {
174
+	public function primary_datetime($try_to_exclude_expired = TRUE, $try_to_exclude_deleted = TRUE) {
175
+		if ( ! empty ($this->_Primary_Datetime)) {
176 176
 			return $this->_Primary_Datetime;
177 177
 		}
178
-		$this->_Primary_Datetime = EEM_Datetime::instance( $this->_timezone )->get_primary_datetime_for_event( $this->ID(), $try_to_exclude_expired, $try_to_exclude_deleted );
178
+		$this->_Primary_Datetime = EEM_Datetime::instance($this->_timezone)->get_primary_datetime_for_event($this->ID(), $try_to_exclude_expired, $try_to_exclude_deleted);
179 179
 		return $this->_Primary_Datetime;
180 180
 	}
181 181
 
@@ -186,30 +186,30 @@  discard block
 block discarded – undo
186 186
 	 * @param array $query_params like EEM_Base::get_all
187 187
 	 * @return EE_Ticket[]
188 188
 	 */
189
-	public function tickets( $query_params = array() ) {
189
+	public function tickets($query_params = array()) {
190 190
 		//first get all datetimes
191 191
 		$datetimes = $this->datetimes_ordered();
192
-		if ( ! $datetimes ) {
192
+		if ( ! $datetimes) {
193 193
 			return array();
194 194
 		}
195 195
 
196 196
 		$datetime_ids = array();
197
-		foreach ( $datetimes as $datetime ) {
197
+		foreach ($datetimes as $datetime) {
198 198
 			$datetime_ids[] = $datetime->ID();
199 199
 		}
200 200
 
201
-		$where_params = array( 'Datetime.DTT_ID' => array( 'IN', $datetime_ids ) );
201
+		$where_params = array('Datetime.DTT_ID' => array('IN', $datetime_ids));
202 202
 
203 203
 		//if incoming $query_params has where conditions let's merge but not override existing.
204
-		if ( is_array( $query_params ) && isset( $query_params[0]) ) {
205
-			$where_params = array_merge( $query_params[0], $where_params );
206
-			unset( $query_params[0] );
204
+		if (is_array($query_params) && isset($query_params[0])) {
205
+			$where_params = array_merge($query_params[0], $where_params);
206
+			unset($query_params[0]);
207 207
 		}
208 208
 
209 209
 		//now add $where_params to $query_params
210 210
 		$query_params[0] = $where_params;
211 211
 
212
-		return EEM_Ticket::instance()->get_all( $query_params );
212
+		return EEM_Ticket::instance()->get_all($query_params);
213 213
 	}
214 214
 
215 215
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 * @return bool
219 219
 	 */
220 220
 	function additional_limit() {
221
-		return $this->get( 'EVT_additional_limit' );
221
+		return $this->get('EVT_additional_limit');
222 222
 	}
223 223
 
224 224
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 	 * @return bool
228 228
 	 */
229 229
 	function allow_overflow() {
230
-		return $this->get( 'EVT_allow_overflow' );
230
+		return $this->get('EVT_allow_overflow');
231 231
 	}
232 232
 
233 233
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	 * @return bool
237 237
 	 */
238 238
 	function created() {
239
-		return $this->get( 'EVT_created' );
239
+		return $this->get('EVT_created');
240 240
 	}
241 241
 
242 242
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 * @return bool
246 246
 	 */
247 247
 	function description() {
248
-		return $this->get( 'EVT_desc' );
248
+		return $this->get('EVT_desc');
249 249
 	}
250 250
 
251 251
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	 * @return string of html
256 256
 	 */
257 257
 	function description_filtered() {
258
-		return $this->get_pretty( 'EVT_desc' );
258
+		return $this->get_pretty('EVT_desc');
259 259
 	}
260 260
 
261 261
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	 * @return bool
265 265
 	 */
266 266
 	function display_description() {
267
-		return $this->get( 'EVT_display_desc' );
267
+		return $this->get('EVT_display_desc');
268 268
 	}
269 269
 
270 270
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 * @return bool
274 274
 	 */
275 275
 	function display_ticket_selector() {
276
-		return (bool)$this->get( 'EVT_display_ticket_selector' );
276
+		return (bool) $this->get('EVT_display_ticket_selector');
277 277
 	}
278 278
 
279 279
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 * @return bool
283 283
 	 */
284 284
 	function external_url() {
285
-		return $this->get( 'EVT_external_URL' );
285
+		return $this->get('EVT_external_URL');
286 286
 	}
287 287
 
288 288
 
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 	 * @return bool
292 292
 	 */
293 293
 	function member_only() {
294
-		return $this->get( 'EVT_member_only' );
294
+		return $this->get('EVT_member_only');
295 295
 	}
296 296
 
297 297
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	 * @return bool
301 301
 	 */
302 302
 	function phone() {
303
-		return $this->get( 'EVT_phone' );
303
+		return $this->get('EVT_phone');
304 304
 	}
305 305
 
306 306
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 * @return bool
310 310
 	 */
311 311
 	function modified() {
312
-		return $this->get( 'EVT_modified' );
312
+		return $this->get('EVT_modified');
313 313
 	}
314 314
 
315 315
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	 * @return bool
319 319
 	 */
320 320
 	function name() {
321
-		return $this->get( 'EVT_name' );
321
+		return $this->get('EVT_name');
322 322
 	}
323 323
 
324 324
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	 * @return bool
328 328
 	 */
329 329
 	function order() {
330
-		return $this->get( 'EVT_order' );
330
+		return $this->get('EVT_order');
331 331
 	}
332 332
 
333 333
 
@@ -336,8 +336,8 @@  discard block
 block discarded – undo
336 336
 	 * @return bool|string
337 337
 	 */
338 338
 	function default_registration_status() {
339
-		$event_default_registration_status = $this->get( 'EVT_default_registration_status' );
340
-		return !empty( $event_default_registration_status ) ? $event_default_registration_status : EE_Registry::instance()->CFG->registration->default_STS_ID;
339
+		$event_default_registration_status = $this->get('EVT_default_registration_status');
340
+		return ! empty($event_default_registration_status) ? $event_default_registration_status : EE_Registry::instance()->CFG->registration->default_STS_ID;
341 341
 	}
342 342
 
343 343
 
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
 	 * @param bool $not_full_desc
349 349
 	 * @return bool|string
350 350
 	 */
351
-	function short_description( $num_words = 55, $more = NULL, $not_full_desc = FALSE ) {
352
-		$short_desc = $this->get( 'EVT_short_desc' );
353
-		if ( !empty( $short_desc ) || $not_full_desc ) {
351
+	function short_description($num_words = 55, $more = NULL, $not_full_desc = FALSE) {
352
+		$short_desc = $this->get('EVT_short_desc');
353
+		if ( ! empty($short_desc) || $not_full_desc) {
354 354
 			return $short_desc;
355 355
 		}
356 356
 		else {
357
-			$full_desc = $this->get( 'EVT_desc' );
358
-			return wp_trim_words( $full_desc, $num_words, $more );
357
+			$full_desc = $this->get('EVT_desc');
358
+			return wp_trim_words($full_desc, $num_words, $more);
359 359
 		}
360 360
 	}
361 361
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 * @return bool
366 366
 	 */
367 367
 	function slug() {
368
-		return $this->get( 'EVT_slug' );
368
+		return $this->get('EVT_slug');
369 369
 	}
370 370
 
371 371
 
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 	 * @return bool
375 375
 	 */
376 376
 	function timezone_string() {
377
-		return $this->get( 'EVT_timezone_string' );
377
+		return $this->get('EVT_timezone_string');
378 378
 	}
379 379
 
380 380
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	 * @return bool
384 384
 	 */
385 385
 	function visible_on() {
386
-		return $this->get( 'EVT_visible_on' );
386
+		return $this->get('EVT_visible_on');
387 387
 	}
388 388
 
389 389
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 	 * @return int
393 393
 	 */
394 394
 	function wp_user() {
395
-		return $this->get( 'EVT_wp_user' );
395
+		return $this->get('EVT_wp_user');
396 396
 	}
397 397
 
398 398
 
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 	 * @return bool
402 402
 	 */
403 403
 	function donations() {
404
-		return $this->get( 'EVT_donations' );
404
+		return $this->get('EVT_donations');
405 405
 	}
406 406
 
407 407
 
@@ -409,8 +409,8 @@  discard block
 block discarded – undo
409 409
 	/**
410 410
 	 * @param $limit
411 411
 	 */
412
-	function set_additional_limit( $limit ) {
413
-		$this->set( 'EVT_additional_limit', $limit );
412
+	function set_additional_limit($limit) {
413
+		$this->set('EVT_additional_limit', $limit);
414 414
 	}
415 415
 
416 416
 
@@ -418,8 +418,8 @@  discard block
 block discarded – undo
418 418
 	/**
419 419
 	 * @param $created
420 420
 	 */
421
-	function set_created( $created ) {
422
-		$this->set( 'EVT_created', $created );
421
+	function set_created($created) {
422
+		$this->set('EVT_created', $created);
423 423
 	}
424 424
 
425 425
 
@@ -427,8 +427,8 @@  discard block
 block discarded – undo
427 427
 	/**
428 428
 	 * @param $desc
429 429
 	 */
430
-	function set_description( $desc ) {
431
-		$this->set( 'EVT_desc', $desc );
430
+	function set_description($desc) {
431
+		$this->set('EVT_desc', $desc);
432 432
 	}
433 433
 
434 434
 
@@ -436,8 +436,8 @@  discard block
 block discarded – undo
436 436
 	/**
437 437
 	 * @param $display_desc
438 438
 	 */
439
-	function set_display_description( $display_desc ) {
440
-		$this->set( 'EVT_display_desc', $display_desc );
439
+	function set_display_description($display_desc) {
440
+		$this->set('EVT_display_desc', $display_desc);
441 441
 	}
442 442
 
443 443
 
@@ -445,8 +445,8 @@  discard block
 block discarded – undo
445 445
 	/**
446 446
 	 * @param $display_ticket_selector
447 447
 	 */
448
-	function set_display_ticket_selector( $display_ticket_selector ) {
449
-		$this->set( 'EVT_display_ticket_selector', $display_ticket_selector );
448
+	function set_display_ticket_selector($display_ticket_selector) {
449
+		$this->set('EVT_display_ticket_selector', $display_ticket_selector);
450 450
 	}
451 451
 
452 452
 
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 	/**
455 455
 	 * @param $external_url
456 456
 	 */
457
-	function set_external_url( $external_url ) {
458
-		$this->set( 'EVT_external_URL', $external_url );
457
+	function set_external_url($external_url) {
458
+		$this->set('EVT_external_URL', $external_url);
459 459
 	}
460 460
 
461 461
 
@@ -463,8 +463,8 @@  discard block
 block discarded – undo
463 463
 	/**
464 464
 	 * @param $member_only
465 465
 	 */
466
-	function set_member_only( $member_only ) {
467
-		$this->set( 'EVT_member_only', $member_only );
466
+	function set_member_only($member_only) {
467
+		$this->set('EVT_member_only', $member_only);
468 468
 	}
469 469
 
470 470
 
@@ -472,8 +472,8 @@  discard block
 block discarded – undo
472 472
 	/**
473 473
 	 * @param $event_phone
474 474
 	 */
475
-	function set_event_phone( $event_phone ) {
476
-		$this->set( 'EVT_phone', $event_phone );
475
+	function set_event_phone($event_phone) {
476
+		$this->set('EVT_phone', $event_phone);
477 477
 	}
478 478
 
479 479
 
@@ -481,8 +481,8 @@  discard block
 block discarded – undo
481 481
 	/**
482 482
 	 * @param $modified
483 483
 	 */
484
-	function set_modified( $modified ) {
485
-		$this->set( 'EVT_modified', $modified );
484
+	function set_modified($modified) {
485
+		$this->set('EVT_modified', $modified);
486 486
 	}
487 487
 
488 488
 
@@ -490,8 +490,8 @@  discard block
 block discarded – undo
490 490
 	/**
491 491
 	 * @param $name
492 492
 	 */
493
-	function set_name( $name ) {
494
-		$this->set( 'EVT_name', $name );
493
+	function set_name($name) {
494
+		$this->set('EVT_name', $name);
495 495
 	}
496 496
 
497 497
 
@@ -499,8 +499,8 @@  discard block
 block discarded – undo
499 499
 	/**
500 500
 	 * @param $order
501 501
 	 */
502
-	function set_order( $order ) {
503
-		$this->set( 'EVT_order', $order );
502
+	function set_order($order) {
503
+		$this->set('EVT_order', $order);
504 504
 	}
505 505
 
506 506
 
@@ -508,8 +508,8 @@  discard block
 block discarded – undo
508 508
 	/**
509 509
 	 * @param $short_desc
510 510
 	 */
511
-	function set_short_description( $short_desc ) {
512
-		$this->set( 'EVT_short_desc', $short_desc );
511
+	function set_short_description($short_desc) {
512
+		$this->set('EVT_short_desc', $short_desc);
513 513
 	}
514 514
 
515 515
 
@@ -517,8 +517,8 @@  discard block
 block discarded – undo
517 517
 	/**
518 518
 	 * @param $slug
519 519
 	 */
520
-	function set_slug( $slug ) {
521
-		$this->set( 'EVT_slug', $slug );
520
+	function set_slug($slug) {
521
+		$this->set('EVT_slug', $slug);
522 522
 	}
523 523
 
524 524
 
@@ -526,8 +526,8 @@  discard block
 block discarded – undo
526 526
 	/**
527 527
 	 * @param $timezone_string
528 528
 	 */
529
-	function set_timezone_string( $timezone_string ) {
530
-		$this->set( 'EVT_timezone_string', $timezone_string );
529
+	function set_timezone_string($timezone_string) {
530
+		$this->set('EVT_timezone_string', $timezone_string);
531 531
 	}
532 532
 
533 533
 
@@ -535,8 +535,8 @@  discard block
 block discarded – undo
535 535
 	/**
536 536
 	 * @param $visible_on
537 537
 	 */
538
-	function set_visible_on( $visible_on ) {
539
-		$this->set( 'EVT_visible_on', $visible_on );
538
+	function set_visible_on($visible_on) {
539
+		$this->set('EVT_visible_on', $visible_on);
540 540
 	}
541 541
 
542 542
 
@@ -544,8 +544,8 @@  discard block
 block discarded – undo
544 544
 	/**
545 545
 	 * @param $wp_user
546 546
 	 */
547
-	function set_wp_user( $wp_user ) {
548
-		$this->set( 'EVT_wp_user', $wp_user );
547
+	function set_wp_user($wp_user) {
548
+		$this->set('EVT_wp_user', $wp_user);
549 549
 	}
550 550
 
551 551
 
@@ -553,8 +553,8 @@  discard block
 block discarded – undo
553 553
 	/**
554 554
 	 * @param $default_registration_status
555 555
 	 */
556
-	function set_default_registration_status( $default_registration_status ) {
557
-		$this->set( 'EVT_default_registration_status', $default_registration_status );
556
+	function set_default_registration_status($default_registration_status) {
557
+		$this->set('EVT_default_registration_status', $default_registration_status);
558 558
 	}
559 559
 
560 560
 
@@ -562,8 +562,8 @@  discard block
 block discarded – undo
562 562
 	/**
563 563
 	 * @param $donations
564 564
 	 */
565
-	function set_donations( $donations ) {
566
-		$this->set( 'EVT_donations', $donations );
565
+	function set_donations($donations) {
566
+		$this->set('EVT_donations', $donations);
567 567
 	}
568 568
 
569 569
 
@@ -573,8 +573,8 @@  discard block
 block discarded – undo
573 573
 	 * @param EE_Venue /int $venue_id_or_obj
574 574
 	 * @return EE_Venue
575 575
 	 */
576
-	function add_venue( $venue_id_or_obj ) {
577
-		return $this->_add_relation_to( $venue_id_or_obj, 'Venue' );
576
+	function add_venue($venue_id_or_obj) {
577
+		return $this->_add_relation_to($venue_id_or_obj, 'Venue');
578 578
 	}
579 579
 
580 580
 
@@ -584,8 +584,8 @@  discard block
 block discarded – undo
584 584
 	 * @param EE_Venue /int $venue_id_or_obj
585 585
 	 * @return EE_Venue
586 586
 	 */
587
-	function remove_venue( $venue_id_or_obj ) {
588
-		return $this->_remove_relation_to( $venue_id_or_obj, 'Venue' );
587
+	function remove_venue($venue_id_or_obj) {
588
+		return $this->_remove_relation_to($venue_id_or_obj, 'Venue');
589 589
 	}
590 590
 
591 591
 
@@ -595,8 +595,8 @@  discard block
 block discarded – undo
595 595
 	 * @param array $query_params like EEM_Base::get_all's $query_params
596 596
 	 * @return EE_Venue[]
597 597
 	 */
598
-	function venues( $query_params = array() ) {
599
-		return $this->get_many_related( 'Venue', $query_params );
598
+	function venues($query_params = array()) {
599
+		return $this->get_many_related('Venue', $query_params);
600 600
 	}
601 601
 
602 602
 
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 	 */
609 609
 	private function _has_ID_and_is_published() {
610 610
 		// first check if event id is present and not NULL, then check if this event is published (or any of the equivalent "published" statuses)
611
-		return ( $this->ID() && $this->ID() !== NULL && ( $this->status() == 'publish' || $this->status() == EEM_Event::sold_out || $this->status() == EEM_Event::postponed || $this->status() == EEM_Event::cancelled ) ) ? TRUE : FALSE;
611
+		return ($this->ID() && $this->ID() !== NULL && ($this->status() == 'publish' || $this->status() == EEM_Event::sold_out || $this->status() == EEM_Event::postponed || $this->status() == EEM_Event::cancelled)) ? TRUE : FALSE;
612 612
 	}
613 613
 
614 614
 
@@ -620,21 +620,21 @@  discard block
 block discarded – undo
620 620
 	 */
621 621
 	public function is_upcoming() {
622 622
 		// check if event id is present and if this event is published
623
-		if ( $this->is_inactive() ) {
623
+		if ($this->is_inactive()) {
624 624
 			return FALSE;
625 625
 		}
626 626
 		// set initial value
627 627
 		$upcoming = FALSE;
628 628
 		//next let's get all datetimes and loop through them
629 629
 		$datetimes = $this->datetimes_in_chronological_order();
630
-		foreach ( $datetimes as $datetime ) {
631
-			if ( $datetime instanceof EE_Datetime ) {
630
+		foreach ($datetimes as $datetime) {
631
+			if ($datetime instanceof EE_Datetime) {
632 632
 				//if this dtt is expired then we continue cause one of the other datetimes might be upcoming.
633
-				if ( $datetime->is_expired() ) {
633
+				if ($datetime->is_expired()) {
634 634
 					continue;
635 635
 				}
636 636
 				//if this dtt is active then we return false.
637
-				if ( $datetime->is_active() ) {
637
+				if ($datetime->is_active()) {
638 638
 					return FALSE;
639 639
 				}
640 640
 				//otherwise let's check upcoming status
@@ -651,21 +651,21 @@  discard block
 block discarded – undo
651 651
 	 */
652 652
 	public function is_active() {
653 653
 		// check if event id is present and if this event is published
654
-		if ( $this->is_inactive() ) {
654
+		if ($this->is_inactive()) {
655 655
 			return FALSE;
656 656
 		}
657 657
 		// set initial value
658 658
 		$active = FALSE;
659 659
 		//next let's get all datetimes and loop through them
660 660
 		$datetimes = $this->datetimes_in_chronological_order();
661
-		foreach ( $datetimes as $datetime ) {
662
-			if ( $datetime instanceof EE_Datetime ) {
661
+		foreach ($datetimes as $datetime) {
662
+			if ($datetime instanceof EE_Datetime) {
663 663
 				//if this dtt is expired then we continue cause one of the other datetimes might be active.
664
-				if ( $datetime->is_expired() ) {
664
+				if ($datetime->is_expired()) {
665 665
 					continue;
666 666
 				}
667 667
 				//if this dtt is upcoming then we return false.
668
-				if ( $datetime->is_upcoming() ) {
668
+				if ($datetime->is_upcoming()) {
669 669
 					return FALSE;
670 670
 				}
671 671
 				//otherwise let's check active status
@@ -682,17 +682,17 @@  discard block
 block discarded – undo
682 682
 	 */
683 683
 	public function is_expired() {
684 684
 		// check if event id is present and if this event is published
685
-		if ( $this->is_inactive() ) {
685
+		if ($this->is_inactive()) {
686 686
 			return FALSE;
687 687
 		}
688 688
 		// set initial value
689 689
 		$expired = FALSE;
690 690
 		//first let's get all datetimes and loop through them
691 691
 		$datetimes = $this->datetimes_in_chronological_order();
692
-		foreach ( $datetimes as $datetime ) {
693
-			if ( $datetime instanceof EE_Datetime ) {
692
+		foreach ($datetimes as $datetime) {
693
+			if ($datetime instanceof EE_Datetime) {
694 694
 				//if this dtt is upcoming or active then we return false.
695
-				if ( $datetime->is_upcoming() || $datetime->is_active() ) {
695
+				if ($datetime->is_upcoming() || $datetime->is_active()) {
696 696
 					return FALSE;
697 697
 				}
698 698
 				//otherwise let's check active status
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 	 */
710 710
 	public function is_inactive() {
711 711
 		// check if event id is present and if this event is published
712
-		if ( $this->_has_ID_and_is_published() ) {
712
+		if ($this->_has_ID_and_is_published()) {
713 713
 			return FALSE;
714 714
 		}
715 715
 		return TRUE;
@@ -727,37 +727,37 @@  discard block
 block discarded – undo
727 727
 	 */
728 728
 	public function perform_sold_out_status_check() {
729 729
 		// get all unexpired untrashed tickets
730
-		$tickets = $this->tickets( array(
730
+		$tickets = $this->tickets(array(
731 731
 			array(
732
-				'TKT_end_date'   => array( '>=', EEM_Ticket::instance()->current_time_for_query( 'TKT_end_date' ) ),
732
+				'TKT_end_date'   => array('>=', EEM_Ticket::instance()->current_time_for_query('TKT_end_date')),
733 733
 				'TKT_deleted'    => false
734 734
 			)
735 735
 		));
736 736
 		// if all the tickets are just expired, then don't update the event status to sold out
737
-		if ( empty( $tickets )) {
737
+		if (empty($tickets)) {
738 738
 			return true;
739 739
 		}
740 740
 		// set initial value
741 741
 		$spaces_remaining = 0;
742
-		foreach( $tickets as $ticket ) {
743
-			if ( $ticket instanceof EE_Ticket ) {
744
-				$spaces_remaining += $ticket->qty( 'saleable' );
742
+		foreach ($tickets as $ticket) {
743
+			if ($ticket instanceof EE_Ticket) {
744
+				$spaces_remaining += $ticket->qty('saleable');
745 745
 			}
746 746
 		}
747
-		if ( $spaces_remaining === 0 ) {
748
-			$this->set_status( EEM_Event::sold_out );
749
-			if ( !is_admin() || ( is_admin() && defined( 'DOING_AJAX' ) ) ) {
747
+		if ($spaces_remaining === 0) {
748
+			$this->set_status(EEM_Event::sold_out);
749
+			if ( ! is_admin() || (is_admin() && defined('DOING_AJAX'))) {
750 750
 				$this->save();
751 751
 			}
752 752
 			$sold_out = TRUE;
753 753
 		} else {
754 754
 			$sold_out = FALSE;
755 755
 			// was event previously marked as sold out ?
756
-			if ( $this->status() == EEM_Event::sold_out ) {
756
+			if ($this->status() == EEM_Event::sold_out) {
757 757
 				// revert status to previous value, if it was set
758
-				$previous_event_status = $this->get_post_meta( '_previous_event_status', true );
759
-				if ( $previous_event_status ) {
760
-					$this->set_status( $previous_event_status );
758
+				$previous_event_status = $this->get_post_meta('_previous_event_status', true);
759
+				if ($previous_event_status) {
760
+					$this->set_status($previous_event_status);
761 761
 				}
762 762
 			}
763 763
 		}
@@ -781,15 +781,15 @@  discard block
 block discarded – undo
781 781
 	 */
782 782
 	public function spaces_remaining_for_sale() {
783 783
 		//first get total available spaces including consideration for tickets that have already sold.
784
-		$spaces_available = $this->total_available_spaces( true );
784
+		$spaces_available = $this->total_available_spaces(true);
785 785
 
786 786
 		//if total available = 0, then exit right away because that means everything is expired.
787
-		if ( $spaces_available === 0 ) {
787
+		if ($spaces_available === 0) {
788 788
 			return 0;
789 789
 		}
790 790
 
791 791
 		//subtract total approved registrations from spaces available to get how many are remaining.
792
-		$spots_taken = EEM_Registration::instance()->count( array( array( 'EVT_ID' => $this->ID(), 'STS_ID' => EEM_Registration::status_id_approved ) ), 'REG_ID', true );
792
+		$spots_taken = EEM_Registration::instance()->count(array(array('EVT_ID' => $this->ID(), 'STS_ID' => EEM_Registration::status_id_approved)), 'REG_ID', true);
793 793
 		$spaces_remaining = $spaces_available - $spots_taken;
794 794
 
795 795
 		return $spaces_remaining > 0 ? $spaces_remaining : 0;
@@ -822,29 +822,29 @@  discard block
 block discarded – undo
822 822
 	 *
823 823
 	 * @return  int|float  (Note: if EE_INF is returned its considered a float by PHP)
824 824
 	 */
825
-	public function total_available_spaces( $current_total_available = false ) {
825
+	public function total_available_spaces($current_total_available = false) {
826 826
 		$spaces_available = 0;
827 827
 
828 828
 		//first get all tickets on the event and include expired tickets
829
-		$tickets = $this->tickets( array( 'default_where_conditions' => 'none' ) );
829
+		$tickets = $this->tickets(array('default_where_conditions' => 'none'));
830 830
 		$ticket_sums = array();
831 831
 		$datetime_limits = array();
832 832
 
833 833
 		//loop through tickets and normalize them
834
-		foreach ( $tickets as $ticket ) {
835
-			$datetimes = $ticket->datetimes( array( 'order_by' => array( 'DTT_reg_limit' => 'ASC' ) ) );
834
+		foreach ($tickets as $ticket) {
835
+			$datetimes = $ticket->datetimes(array('order_by' => array('DTT_reg_limit' => 'ASC')));
836 836
 
837
-			if ( empty( $datetimes ) ) {
837
+			if (empty($datetimes)) {
838 838
 				continue;
839 839
 			}
840 840
 
841 841
 			//first datetime should be the lowest datetime
842
-			$least_datetime = reset( $datetimes );
842
+			$least_datetime = reset($datetimes);
843 843
 
844 844
 			//lets reset the ticket quantity to be the lower of either the lowest datetime reg limit or the ticket quantity
845 845
 			//IF datetimes sold (and we're not doing current live total available, then use spaces remaining for datetime, not reg_limit.
846
-			if ( $current_total_available ) {
847
-				if ( $ticket->is_remaining() ) {
846
+			if ($current_total_available) {
847
+				if ($ticket->is_remaining()) {
848 848
 					$remaining = $ticket->remaining();
849 849
 				} else {
850 850
 					$spaces_available += $ticket->sold();
@@ -852,23 +852,23 @@  discard block
 block discarded – undo
852 852
 					continue;
853 853
 				}
854 854
 			} else {
855
-				$remaining = min( $ticket->qty(), $least_datetime->reg_limit() );
855
+				$remaining = min($ticket->qty(), $least_datetime->reg_limit());
856 856
 			}
857 857
 
858 858
 			//if $ticket_limit == infinity then let's drop out right away and just return that because any infinity amount trumps all other "available" amounts.
859
-			if ( $remaining === EE_INF ) {
859
+			if ($remaining === EE_INF) {
860 860
 				return EE_INF;
861 861
 			}
862 862
 
863 863
 			//multiply normalized $tkt quantity by the number of datetimes on the ticket as the "sum"
864 864
 			//also include the sum of all the datetime reg limits on the ticket for breaking ties.
865
-			$ticket_sums[$ticket->ID()]['sum'] = $remaining * count( $datetimes );
865
+			$ticket_sums[$ticket->ID()]['sum'] = $remaining * count($datetimes);
866 866
 			$ticket_sums[$ticket->ID()]['datetime_sums'] = 0;
867
-			foreach ( $datetimes as $datetime ) {
868
-				if ( $datetime->reg_limit() === EE_INF ) {
867
+			foreach ($datetimes as $datetime) {
868
+				if ($datetime->reg_limit() === EE_INF) {
869 869
 					$ticket_sums[$ticket->ID()]['datetime_sums'] = EE_INF;
870 870
 				} else {
871
-					$ticket_sums[ $ticket->ID() ]['datetime_sums'] += $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit();
871
+					$ticket_sums[$ticket->ID()]['datetime_sums'] += $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit();
872 872
 				}
873 873
 				$datetime_limits[$datetime->ID()] = $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit();
874 874
 			}
@@ -879,74 +879,74 @@  discard block
 block discarded – undo
879 879
 		//ticket quantity by the number of datetimes on the ticket).  For tie-breakers, then the next sort is based on the
880 880
 		//ticket with the greatest sum of all remaining datetime->spaces_remaining() ( or $datetime->reg_limit() if not
881 881
 		//$current_total_available ) for the datetimes on the ticket.
882
-		usort( $ticket_sums, function( $a, $b ) {
883
-			if ( $a['sum'] == $b['sum'] ) {
884
-				if ( $a['datetime_sums'] == $b['datetime_sums'] ) {
882
+		usort($ticket_sums, function($a, $b) {
883
+			if ($a['sum'] == $b['sum']) {
884
+				if ($a['datetime_sums'] == $b['datetime_sums']) {
885 885
 					return 0;
886 886
 				}
887 887
 
888 888
 				return $a['datetime_sums'] < $b['datetime_sums'] ? 1 : -1;
889 889
 			}
890
-			return ( $a['sum'] < $b['sum'] ) ? -1 : 1;
890
+			return ($a['sum'] < $b['sum']) ? -1 : 1;
891 891
 		});
892 892
 
893 893
 		//now let's loop through the sorted tickets and simulate sellouts
894
-		foreach ( $ticket_sums as $ticket_info ) {
895
-			if ( $ticket_info['ticket'] instanceof EE_Ticket ) {
894
+		foreach ($ticket_sums as $ticket_info) {
895
+			if ($ticket_info['ticket'] instanceof EE_Ticket) {
896 896
 
897
-				$datetimes = $ticket_info['ticket']->datetimes( array( 'order_by' => array( 'DTT_reg_limit' => 'ASC' ) ) );
897
+				$datetimes = $ticket_info['ticket']->datetimes(array('order_by' => array('DTT_reg_limit' => 'ASC')));
898 898
 				//need to sort these $datetimes by remaining (only if $current_total_available)
899 899
 				//setup datetimes for simulation
900 900
 				$ticket_datetimes_remaining = array();
901
-				foreach( $datetimes as $datetime ) {
901
+				foreach ($datetimes as $datetime) {
902 902
 					$ticket_datetimes_remaining[$datetime->ID()]['rem'] = $datetime_limits[$datetime->ID()];
903 903
 					$ticket_datetimes_remaining[$datetime->ID()]['datetime'] = $datetime;
904 904
 				}
905
-				usort( $ticket_datetimes_remaining, function( $a, $b ) {
906
-					if ( $a['rem'] == $b['rem'] ) {
905
+				usort($ticket_datetimes_remaining, function($a, $b) {
906
+					if ($a['rem'] == $b['rem']) {
907 907
 						return 0;
908 908
 					}
909
-					return ( $a['rem'] < $b['rem'] ) ? -1 : 1;
909
+					return ($a['rem'] < $b['rem']) ? -1 : 1;
910 910
 				});
911 911
 
912 912
 
913 913
 				//get the remaining on the first datetime (which should be the one with the least remaining) and that is
914 914
 				//what we add to the spaces_available running total.  Then we need to decrease the remaining on our datetime tracker.
915
-				$lowest_datetime = reset( $ticket_datetimes_remaining );
915
+				$lowest_datetime = reset($ticket_datetimes_remaining);
916 916
 
917 917
 				//need to get the lower of; what the remaining is on the lowest datetime, and the remaining on the ticket.
918 918
 				// If this ends up being 0 (because of previous tickets in our simulation selling out), then it has already
919 919
 				// been tracked on $spaces available and this ticket is now sold out for the simulation, so we can continue
920 920
 				// to the next ticket.
921
-				if ( $current_total_available ) {
922
-					$remaining = min( $lowest_datetime['rem'], $ticket_info['ticket']->remaining() );
921
+				if ($current_total_available) {
922
+					$remaining = min($lowest_datetime['rem'], $ticket_info['ticket']->remaining());
923 923
 				} else {
924
-					$remaining = min( $lowest_datetime['rem'], $ticket_info['ticket']->qty() );
924
+					$remaining = min($lowest_datetime['rem'], $ticket_info['ticket']->qty());
925 925
 				}
926 926
 
927 927
 				//if $remaining is infinite that means that all datetimes on this ticket are infinite but we've made it here because all
928 928
 				//tickets have a quantity.  So we don't have to track datetimes, we can just use ticket quantities for total
929 929
 				//available.
930
-				if ( $remaining === EE_INF ) {
930
+				if ($remaining === EE_INF) {
931 931
 					$spaces_available += $ticket_info['ticket']->qty();
932 932
 					continue;
933 933
 				}
934 934
 
935 935
 				//if ticket has sold amounts then we also need to add that (but only if doing live counts)
936
-				if ( $current_total_available ) {
936
+				if ($current_total_available) {
937 937
 					$spaces_available += $ticket_info['ticket']->sold();
938 938
 				}
939 939
 
940
-				if ( $remaining <= 0 ) {
940
+				if ($remaining <= 0) {
941 941
 					continue;
942 942
 				} else {
943 943
 					$spaces_available += $remaining;
944 944
 				}
945 945
 
946 946
 				//loop through the datetimes and sell them out!
947
-				foreach ( $ticket_datetimes_remaining as $datetime_info ) {
948
-					if ( $datetime_info['datetime'] instanceof EE_Datetime ) {
949
-						$datetime_limits[ $datetime_info['datetime']->ID() ] += - $remaining;
947
+				foreach ($ticket_datetimes_remaining as $datetime_info) {
948
+					if ($datetime_info['datetime'] instanceof EE_Datetime) {
949
+						$datetime_limits[$datetime_info['datetime']->ID()] += - $remaining;
950 950
 					}
951 951
 				}
952 952
 			}
@@ -962,8 +962,8 @@  discard block
 block discarded – undo
962 962
 	 * @param  bool $actual whether or not to perform calculations to not only figure the actual status but also to flip the status if necessary to sold out If false, we just check the existing status of the event
963 963
 	 * @return boolean
964 964
 	 */
965
-	public function is_sold_out( $actual = FALSE ) {
966
-		if ( ! $actual ) {
965
+	public function is_sold_out($actual = FALSE) {
966
+		if ( ! $actual) {
967 967
 			return $this->status() == EEM_Event::sold_out;
968 968
 		}
969 969
 		else {
@@ -1008,30 +1008,30 @@  discard block
 block discarded – undo
1008 1008
 	 *
1009 1009
 	 * @return bool | string - based on EE_Datetime active constants or FALSE if error.
1010 1010
 	 */
1011
-	public function get_active_status( $reset = false ) {
1011
+	public function get_active_status($reset = false) {
1012 1012
 		// if the active status has already been set, then just use that value (unless we are resetting it)
1013
-		if ( ! empty( $this->_active_status ) && ! $reset ) {
1013
+		if ( ! empty($this->_active_status) && ! $reset) {
1014 1014
 			return $this->_active_status;
1015 1015
 		}
1016 1016
 		//first check if event id is present on this object
1017
-		if ( ! $this->ID() ) {
1017
+		if ( ! $this->ID()) {
1018 1018
 			return false;
1019 1019
 		}
1020 1020
 
1021
-		$where_params_for_event  = array( array( 'EVT_ID' => $this->ID() ) );
1021
+		$where_params_for_event = array(array('EVT_ID' => $this->ID()));
1022 1022
 
1023 1023
 		//if event is published:
1024
-		if ( $this->status() === 'publish' ) {
1024
+		if ($this->status() === 'publish') {
1025 1025
 			//active?
1026
-			if ( EEM_Datetime::instance()->get_datetime_count_for_status( EE_Datetime::active, $where_params_for_event ) > 0 ) {
1026
+			if (EEM_Datetime::instance()->get_datetime_count_for_status(EE_Datetime::active, $where_params_for_event) > 0) {
1027 1027
 				$this->_active_status = EE_Datetime::active;
1028 1028
 			} else {
1029 1029
 				//upcoming?
1030
-				if ( EEM_Datetime::instance()->get_datetime_count_for_status( EE_Datetime::upcoming, $where_params_for_event  ) > 0 ) {
1030
+				if (EEM_Datetime::instance()->get_datetime_count_for_status(EE_Datetime::upcoming, $where_params_for_event) > 0) {
1031 1031
 					$this->_active_status = EE_Datetime::upcoming;
1032 1032
 				} else {
1033 1033
 					//expired?
1034
-					if ( EEM_Datetime::instance()->get_datetime_count_for_status( EE_Datetime::expired, $where_params_for_event  ) > 0 ) {
1034
+					if (EEM_Datetime::instance()->get_datetime_count_for_status(EE_Datetime::expired, $where_params_for_event) > 0) {
1035 1035
 						$this->_active_status = EE_Datetime::expired;
1036 1036
 					} else {
1037 1037
 						//it would be odd if things make it this far because it basically means there are no datetime's
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
 			}
1043 1043
 		} else {
1044 1044
 			//the event is not published, so let's just set it's active status according to its' post status
1045
-			switch ( $this->status() ) {
1045
+			switch ($this->status()) {
1046 1046
 				case EEM_Event::sold_out :
1047 1047
 					$this->_active_status = EE_Datetime::sold_out;
1048 1048
 					break;
@@ -1068,10 +1068,10 @@  discard block
 block discarded – undo
1068 1068
 	 * @param boolean $echo     whether to return (FALSE), or echo out the result (TRUE)
1069 1069
 	 * @return mixed void|string
1070 1070
 	 */
1071
-	public function pretty_active_status( $echo = TRUE ) {
1071
+	public function pretty_active_status($echo = TRUE) {
1072 1072
 		$active_status = $this->get_active_status();
1073
-		$status = '<span class="ee-status event-active-status-' . $active_status . '">' . EEH_Template::pretty_status( $active_status, FALSE, 'sentence' ) . '</span>';
1074
-		if ( $echo ) {
1073
+		$status = '<span class="ee-status event-active-status-'.$active_status.'">'.EEH_Template::pretty_status($active_status, FALSE, 'sentence').'</span>';
1074
+		if ($echo) {
1075 1075
 			echo $status;
1076 1076
 			return '';
1077 1077
 		}
@@ -1085,12 +1085,12 @@  discard block
 block discarded – undo
1085 1085
 	 */
1086 1086
 	public function get_number_of_tickets_sold() {
1087 1087
 		$tkt_sold = 0;
1088
-		if ( !$this->ID() ) {
1088
+		if ( ! $this->ID()) {
1089 1089
 			return 0;
1090 1090
 		}
1091 1091
 		$datetimes = $this->datetimes();
1092
-		foreach ( $datetimes as $datetime ) {
1093
-			if ( $datetime instanceof EE_Datetime ) {
1092
+		foreach ($datetimes as $datetime) {
1093
+			if ($datetime instanceof EE_Datetime) {
1094 1094
 				$tkt_sold += $datetime->sold();
1095 1095
 			}
1096 1096
 		}
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 	 * @return int
1106 1106
 	 */
1107 1107
 	public function get_count_of_all_registrations() {
1108
-		return EEM_Event::instance()->count_related( $this, 'Registration' );
1108
+		return EEM_Event::instance()->count_related($this, 'Registration');
1109 1109
 	}
1110 1110
 
1111 1111
 
@@ -1115,9 +1115,9 @@  discard block
 block discarded – undo
1115 1115
 	 * @return EE_Ticket
1116 1116
 	 */
1117 1117
 	public function get_ticket_with_earliest_start_time() {
1118
-		$where[ 'Datetime.EVT_ID' ] = $this->ID();
1119
-		$query_params = array( $where, 'order_by' => array( 'TKT_start_date' => 'ASC' ) );
1120
-		return EE_Registry::instance()->load_model( 'Ticket' )->get_one( $query_params );
1118
+		$where['Datetime.EVT_ID'] = $this->ID();
1119
+		$query_params = array($where, 'order_by' => array('TKT_start_date' => 'ASC'));
1120
+		return EE_Registry::instance()->load_model('Ticket')->get_one($query_params);
1121 1121
 	}
1122 1122
 
1123 1123
 
@@ -1127,9 +1127,9 @@  discard block
 block discarded – undo
1127 1127
 	 * @return EE_Ticket
1128 1128
 	 */
1129 1129
 	public function get_ticket_with_latest_end_time() {
1130
-		$where[ 'Datetime.EVT_ID' ] = $this->ID();
1131
-		$query_params = array( $where, 'order_by' => array( 'TKT_end_date' => 'DESC' ) );
1132
-		return EE_Registry::instance()->load_model( 'Ticket' )->get_one( $query_params );
1130
+		$where['Datetime.EVT_ID'] = $this->ID();
1131
+		$query_params = array($where, 'order_by' => array('TKT_end_date' => 'DESC'));
1132
+		return EE_Registry::instance()->load_model('Ticket')->get_one($query_params);
1133 1133
 	}
1134 1134
 
1135 1135
 
@@ -1141,11 +1141,11 @@  discard block
 block discarded – undo
1141 1141
 	public function tickets_on_sale() {
1142 1142
 		$earliest_ticket = $this->get_ticket_with_earliest_start_time();
1143 1143
 		$latest_ticket = $this->get_ticket_with_latest_end_time();
1144
-		if ( !$latest_ticket instanceof EE_Ticket && !$earliest_ticket instanceof EE_Ticket ) {
1144
+		if ( ! $latest_ticket instanceof EE_Ticket && ! $earliest_ticket instanceof EE_Ticket) {
1145 1145
 			return FALSE;
1146 1146
 		}
1147 1147
 		//check on sale for these two tickets.
1148
-		if ( $latest_ticket->is_on_sale() || $earliest_ticket->is_on_sale() ) {
1148
+		if ($latest_ticket->is_on_sale() || $earliest_ticket->is_on_sale()) {
1149 1149
 			return TRUE;
1150 1150
 		}
1151 1151
 		return FALSE;
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 	 * @return string
1160 1160
 	 */
1161 1161
 	public function get_permalink() {
1162
-		if ( $this->external_url() ) {
1162
+		if ($this->external_url()) {
1163 1163
 			return $this->external_url();
1164 1164
 		}
1165 1165
 		else {
@@ -1174,10 +1174,10 @@  discard block
 block discarded – undo
1174 1174
 	 * @param array $query_params like EEM_Base::get_all
1175 1175
 	 * @return EE_Term
1176 1176
 	 */
1177
-	public function first_event_category( $query_params = array() ) {
1178
-		$query_params[ 0 ][ 'Term_Taxonomy.taxonomy' ] = 'espresso_event_categories';
1179
-		$query_params[ 0 ][ 'Term_Taxonomy.Event.EVT_ID' ] = $this->ID();
1180
-		return EEM_Term::instance()->get_one( $query_params );
1177
+	public function first_event_category($query_params = array()) {
1178
+		$query_params[0]['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1179
+		$query_params[0]['Term_Taxonomy.Event.EVT_ID'] = $this->ID();
1180
+		return EEM_Term::instance()->get_one($query_params);
1181 1181
 	}
1182 1182
 
1183 1183
 
@@ -1187,10 +1187,10 @@  discard block
 block discarded – undo
1187 1187
 	 * @param array $query_params
1188 1188
 	 * @return EE_Term[]
1189 1189
 	 */
1190
-	public function get_all_event_categories( $query_params = array() ) {
1191
-		$query_params[ 0 ][ 'Term_Taxonomy.taxonomy' ] = 'espresso_event_categories';
1192
-		$query_params[ 0 ][ 'Term_Taxonomy.Event.EVT_ID' ] = $this->ID();
1193
-		return EEM_Term::instance()->get_all( $query_params );
1190
+	public function get_all_event_categories($query_params = array()) {
1191
+		$query_params[0]['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1192
+		$query_params[0]['Term_Taxonomy.Event.EVT_ID'] = $this->ID();
1193
+		return EEM_Term::instance()->get_all($query_params);
1194 1194
 	}
1195 1195
 
1196 1196
 	/**
@@ -1198,8 +1198,8 @@  discard block
 block discarded – undo
1198 1198
 	 * @param array $query_params @see EEM_Base::get_all
1199 1199
 	 * @return EE_Question_Group[]
1200 1200
 	 */
1201
-	public function question_groups($query_params = array()){
1202
-		$query_params = ! empty( $query_params ) ? $query_params : array( 'order_by' => array( 'QSG_order' => 'ASC' ));
1201
+	public function question_groups($query_params = array()) {
1202
+		$query_params = ! empty($query_params) ? $query_params : array('order_by' => array('QSG_order' => 'ASC'));
1203 1203
 		return $this->get_many_related('Question_Group', $query_params);
1204 1204
 	}
1205 1205
 
@@ -1239,12 +1239,12 @@  discard block
 block discarded – undo
1239 1239
 	 */
1240 1240
 	public function get_admin_edit_link() {
1241 1241
 		EE_Registry::instance()->load_helper('URL');
1242
-		return EEH_URL::add_query_args_and_nonce( array(
1242
+		return EEH_URL::add_query_args_and_nonce(array(
1243 1243
 			'page' => 'espresso_events',
1244 1244
 			'action' => 'edit',
1245 1245
 			'post' => $this->ID()
1246 1246
 			),
1247
-			admin_url( 'admin.php' )
1247
+			admin_url('admin.php')
1248 1248
 		);
1249 1249
 	}
1250 1250
 
@@ -1257,11 +1257,11 @@  discard block
 block discarded – undo
1257 1257
 	 */
1258 1258
 	public function get_admin_settings_link() {
1259 1259
 		EE_Registry::instance()->load_helper('URL');
1260
-		return EEH_URL::add_query_args_and_nonce( array(
1260
+		return EEH_URL::add_query_args_and_nonce(array(
1261 1261
 			'page' => 'espresso_events',
1262 1262
 			'action' => 'default_event_settings'
1263 1263
 			),
1264
-			admin_url( 'admin.php' )
1264
+			admin_url('admin.php')
1265 1265
 		);
1266 1266
 	}
1267 1267
 
@@ -1277,11 +1277,11 @@  discard block
 block discarded – undo
1277 1277
 	public function get_admin_overview_link() {
1278 1278
 
1279 1279
 		EE_Registry::instance()->load_helper('URL');
1280
-		return EEH_URL::add_query_args_and_nonce( array(
1280
+		return EEH_URL::add_query_args_and_nonce(array(
1281 1281
 			'page' => 'espresso_events',
1282 1282
 			'action' => 'default'
1283 1283
 		),
1284
-			admin_url( 'admin.php' )
1284
+			admin_url('admin.php')
1285 1285
 		);
1286 1286
 	}
1287 1287
 
Please login to merge, or discard this patch.
core/Psr4Autoloader.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * Loads the class file for a given class name.
112 112
 	 *
113 113
 	 * @param string $class The fully-qualified class name.
114
-	 * @return mixed The mapped file name on success, or boolean false on
114
+	 * @return string|false The mapped file name on success, or boolean false on
115 115
 	 * failure.
116 116
 	 */
117 117
 	public function loadClass( $class ) {
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 *
145 145
 	 * @param string $prefix The namespace prefix.
146 146
 	 * @param string $relative_class The relative class name.
147
-	 * @return mixed Boolean false if no mapped file can be loaded, or the
147
+	 * @return false|string Boolean false if no mapped file can be loaded, or the
148 148
 	 * name of the mapped file that was loaded.
149 149
 	 */
150 150
 	protected function loadMappedFile( $prefix, $relative_class ) {
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 * @return void
73 73
 	 */
74 74
 	public function register() {
75
-		spl_autoload_register( array( $this, 'loadClass' ) );
75
+		spl_autoload_register(array($this, 'loadClass'));
76 76
 	}
77 77
 
78 78
 
@@ -88,20 +88,20 @@  discard block
 block discarded – undo
88 88
 	 * than last.
89 89
 	 * @return void
90 90
 	 */
91
-	public function addNamespace( $prefix, $base_dir, $prepend = false ) {
91
+	public function addNamespace($prefix, $base_dir, $prepend = false) {
92 92
 		// normalize namespace prefix
93
-		$prefix = trim( $prefix, '\\' ) . '\\';
93
+		$prefix = trim($prefix, '\\').'\\';
94 94
 		// normalize the base directory with a trailing separator
95
-		$base_dir = rtrim( $base_dir, DIRECTORY_SEPARATOR ) . '/';
95
+		$base_dir = rtrim($base_dir, DIRECTORY_SEPARATOR).'/';
96 96
 		// initialize the namespace prefix array
97
-		if ( isset( $this->prefixes[ $prefix ] ) === false ) {
98
-			$this->prefixes[ $prefix ] = array();
97
+		if (isset($this->prefixes[$prefix]) === false) {
98
+			$this->prefixes[$prefix] = array();
99 99
 		}
100 100
 		// retain the base directory for the namespace prefix
101
-		if ( $prepend ) {
102
-			array_unshift( $this->prefixes[ $prefix ], $base_dir );
101
+		if ($prepend) {
102
+			array_unshift($this->prefixes[$prefix], $base_dir);
103 103
 		} else {
104
-			array_push( $this->prefixes[ $prefix ], $base_dir );
104
+			array_push($this->prefixes[$prefix], $base_dir);
105 105
 		}
106 106
 	}
107 107
 
@@ -114,24 +114,24 @@  discard block
 block discarded – undo
114 114
 	 * @return mixed The mapped file name on success, or boolean false on
115 115
 	 * failure.
116 116
 	 */
117
-	public function loadClass( $class ) {
117
+	public function loadClass($class) {
118 118
 		// the current namespace prefix
119 119
 		$prefix = $class;
120 120
 		// work backwards through the namespace names of the fully-qualified
121 121
 		// class name to find a mapped file name
122
-		while ( false !== $pos = strrpos( $prefix, '\\' ) ) {
122
+		while (false !== $pos = strrpos($prefix, '\\')) {
123 123
 			// retain the trailing namespace separator in the prefix
124
-			$prefix = substr( $class, 0, $pos + 1 );
124
+			$prefix = substr($class, 0, $pos + 1);
125 125
 			// the rest is the relative class name
126
-			$relative_class = substr( $class, $pos + 1 );
126
+			$relative_class = substr($class, $pos + 1);
127 127
 			// try to load a mapped file for the prefix and relative class
128
-			$mapped_file = $this->loadMappedFile( $prefix, $relative_class );
129
-			if ( $mapped_file ) {
128
+			$mapped_file = $this->loadMappedFile($prefix, $relative_class);
129
+			if ($mapped_file) {
130 130
 				return $mapped_file;
131 131
 			}
132 132
 			// remove the trailing namespace separator for the next iteration
133 133
 			// of strrpos()
134
-			$prefix = rtrim( $prefix, '\\' );
134
+			$prefix = rtrim($prefix, '\\');
135 135
 		}
136 136
 		// never found a mapped file
137 137
 		return false;
@@ -147,21 +147,21 @@  discard block
 block discarded – undo
147 147
 	 * @return mixed Boolean false if no mapped file can be loaded, or the
148 148
 	 * name of the mapped file that was loaded.
149 149
 	 */
150
-	protected function loadMappedFile( $prefix, $relative_class ) {
150
+	protected function loadMappedFile($prefix, $relative_class) {
151 151
 		// are there any base directories for this namespace prefix?
152
-		if ( isset( $this->prefixes[ $prefix ] ) === false ) {
152
+		if (isset($this->prefixes[$prefix]) === false) {
153 153
 			return false;
154 154
 		}
155 155
 		// look through base directories for this namespace prefix
156
-		foreach ( $this->prefixes[ $prefix ] as $base_dir ) {
156
+		foreach ($this->prefixes[$prefix] as $base_dir) {
157 157
 			// replace the namespace prefix with the base directory,
158 158
 			// replace namespace separators with directory separators
159 159
 			// in the relative class name, append with .php
160 160
 			$file = $base_dir
161
-				. str_replace( '\\', '/', $relative_class )
161
+				. str_replace('\\', '/', $relative_class)
162 162
 				. '.php';
163 163
 			// if the mapped file exists, require it
164
-			if ( $this->requireFile( $file ) ) {
164
+			if ($this->requireFile($file)) {
165 165
 				// yes, we're done
166 166
 				return $file;
167 167
 			}
@@ -178,8 +178,8 @@  discard block
 block discarded – undo
178 178
 	 * @param string $file The file to require.
179 179
 	 * @return bool True if the file exists, false if not.
180 180
 	 */
181
-	protected function requireFile( $file ) {
182
-		if ( file_exists( $file ) ) {
181
+	protected function requireFile($file) {
182
+		if (file_exists($file)) {
183 183
 			require $file;
184 184
 			return true;
185 185
 		}
Please login to merge, or discard this patch.
admin_pages/events/help_tabs/event_editor_venue_details.help_tab.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,5 +3,5 @@
 block discarded – undo
3 3
 <?php _e('A venue is the place or location that is hosting your event. This setting is optional which means that you are not required to select a venue for your event.', 'event_espresso'); ?>
4 4
 </p>
5 5
 <p>
6
-<?php echo sprintf(__('Venues can be managed through the %sVenues page%s.', 'event_espresso'),'<a href="admin.php?page=espresso_venues">','</a>'); ?>
6
+<?php echo sprintf(__('Venues can be managed through the %sVenues page%s.', 'event_espresso'), '<a href="admin.php?page=espresso_venues">', '</a>'); ?>
7 7
 </p>
8 8
\ No newline at end of file
Please login to merge, or discard this patch.
admin_pages/events/templates/event_tickets_metabox_main.template.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php do_action( 'AHEE__event_tickets_metabox_main__before_content' ); ?>
1
+<?php do_action('AHEE__event_tickets_metabox_main__before_content'); ?>
2 2
 <div id="event-and-ticket-form-content">
3 3
 	<h4 class="event-tickets-datetimes-title"><?php _e('Event Datetime', 'event_espresso'); ?></h4><?php echo $event_datetime_help_link; ?>
4 4
 	<div class="event-datetimes-container">
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
 						</td>
30 30
 						<td class="event-datetime-column reg-limit-column">
31 31
 							<?php
32
-								$reg_limit = $time->get_pretty('DTT_reg_limit','input');
32
+								$reg_limit = $time->get_pretty('DTT_reg_limit', 'input');
33 33
 							?>
34 34
 							<input type="text" name="edit_event_datetimes[1][DTT_reg_limit]" id="event-datetime-DTT_reg_limit-1" class="ee-small-text-inp ee-inp-right event-datetime-DTT_reg_limit" value="<?php echo $reg_limit; ?>">
35 35
 						</td>
36
-						<td class="datetime-tickets-sold"><?php printf( __('Tickets Sold: %s', 'event_espresso'), $time->get('DTT_sold') ); ?></td>
36
+						<td class="datetime-tickets-sold"><?php printf(__('Tickets Sold: %s', 'event_espresso'), $time->get('DTT_sold')); ?></td>
37 37
 					</tr>
38 38
 				</tbody>
39 39
 			</table>
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	<div style="clear:both"></div>
72 72
 </div> <!-- end #event-and-ticket-form-content -->
73 73
 
74
-<?php do_action( 'AHEE__event_tickets_metabox_main__after_content' ); ?>
74
+<?php do_action('AHEE__event_tickets_metabox_main__after_content'); ?>
75 75
 
76 76
 <table id="new-ticket-row-form" class="hidden">
77 77
 	<tbody><?php echo $ticket_js_structure; ?></tbody>
Please login to merge, or discard this patch.