Completed
Branch DECAF-4.7 (a62460)
by
unknown
403:44 queued 390:56
created
caffeinated/admin/new/pricing/espresso_events_Pricing_Hooks.class.php 3 patches
Braces   +30 added lines, -19 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' );
@@ -268,8 +270,9 @@  discard block
 block discarded – undo
268 270
 			$dtts_to_delete = array_diff( $old_datetimes, array_keys($saved_dtts) );
269 271
 			foreach ( $dtts_to_delete as $id ) {
270 272
 				$id = absint( $id );
271
-				if ( empty( $id ) )
272
-					continue;
273
+				if ( empty( $id ) ) {
274
+									continue;
275
+				}
273 276
 
274 277
 				$dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id);
275 278
 
@@ -507,8 +510,9 @@  discard block
 block discarded – undo
507 510
 				}
508 511
 
509 512
 				//if we have a new_tkt... let's add to it as well
510
-				if ( !empty( $new_tkt ) )
511
-					$new_tkt->_add_relation_to($saved_dtts[$dttrow], 'Datetime' );
513
+				if ( !empty( $new_tkt ) ) {
514
+									$new_tkt->_add_relation_to($saved_dtts[$dttrow], 'Datetime' );
515
+				}
512 516
 			}
513 517
 
514 518
 
@@ -518,8 +522,9 @@  discard block
 block discarded – undo
518 522
 			foreach ( $dtts_removed as $dttrow ) {
519 523
 				$dttrow = (int) $dttrow;
520 524
 				//its entirely possible that a datetime got deleted (instead of just removed from relationship.  So make sure we skip over this if the dtt isn't in the saved_dtts array)
521
-				if ( empty($saved_dtts[$dttrow] ) || ! $saved_dtts[$dttrow] instanceof EE_Datetime )
522
-					continue;
525
+				if ( empty($saved_dtts[$dttrow] ) || ! $saved_dtts[$dttrow] instanceof EE_Datetime ) {
526
+									continue;
527
+				}
523 528
 
524 529
 				$TKT->_remove_relation_to($saved_dtts[$dttrow], 'Datetime');
525 530
 
@@ -529,8 +534,9 @@  discard block
 block discarded – undo
529 534
 					$saved_dtts[$dttrow]->save();
530 535
 				}
531 536
 
532
-				if ( !empty( $new_tkt ) )
533
-					$new_tkt->_remove_relation_to($saved_dtts[$dttrow], 'Datetime');
537
+				if ( !empty( $new_tkt ) ) {
538
+									$new_tkt->_remove_relation_to($saved_dtts[$dttrow], 'Datetime');
539
+				}
534 540
 			}
535 541
 
536 542
 
@@ -572,8 +578,9 @@  discard block
 block discarded – undo
572 578
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
573 579
 
574 580
 			//if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime
575
-			if ( $tkt_to_remove->get('TKT_is_default') )
576
-				continue;
581
+			if ( $tkt_to_remove->get('TKT_is_default') ) {
582
+							continue;
583
+			}
577 584
 
578 585
 			//if this tkt has any registrations attached so then we just ARCHIVE because we don't actually permanently delete these tickets.
579 586
 			if ( $tkt_to_remove->count_related('Registration') > 0 ) {
@@ -634,13 +641,16 @@  discard block
 block discarded – undo
634 641
 		}
635 642
 
636 643
 		//possibly need to save tkt
637
-		if ( ! $ticket->ID() )
638
-			$ticket->save();
644
+		if ( ! $ticket->ID() ) {
645
+					$ticket->save();
646
+		}
639 647
 
640 648
 		foreach ( $prices as $row => $prc ) {
641 649
 			$prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL;
642
-			if ( empty($prt_id) )
643
-				continue; //prices MUST have a price type id.
650
+			if ( empty($prt_id) ) {
651
+							continue;
652
+			}
653
+			//prices MUST have a price type id.
644 654
 			$PRC_values = array(
645 655
 				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
646 656
 				'PRT_ID' => $prt_id,
@@ -784,8 +794,9 @@  discard block
 block discarded – undo
784 794
 				$datetime_tickets[$dttid][] = $tktrow;
785 795
 
786 796
 				//temporary cache of this datetime info for this ticket for later processing of ticket rows.
787
-				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) )
788
-					$ticket_datetimes[$tktid][] = $dttrow;
797
+				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) ) {
798
+									$ticket_datetimes[$tktid][] = $dttrow;
799
+				}
789 800
 			}
790 801
 		}
791 802
 
Please login to merge, or discard this patch.
Doc Comments   +20 added lines, -3 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 * Handles saving everything related to Tickets (datetimes, tickets, prices)
130 130
 	 * @param  EE_Event $evtobj The Event object we're attaching data to
131 131
 	 * @param  array    $data   The request data from the form
132
-	 * @return bool             success or fail
132
+	 * @return boolean|null             success or fail
133 133
 	 */
134 134
 	public function dtt_and_tickets_caf_update( $evtobj, $data ) {
135 135
 		//first we need to start with datetimes cause they are the "root" items attached to events.
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * @param  EE_Event         $evtobj     Event object being updated
233 233
 	 * @param  EE_Datetime[]    $saved_dtts an array of datetime ids being updated
234 234
 	 * @param  array            $data       incoming request data
235
-	 * @return bool                 		success or fail
235
+	 * @return boolean|null                 		success or fail
236 236
 	 */
237 237
 	private function _update_tkts( $evtobj, $saved_dtts, $data ) {
238 238
 		//stripslashes because WP filtered the $_POST ($data) array to add slashes
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 	 * @param bool 		$new_prices Whether attach existing incoming prices or create new ones.
521 521
 	 * @param int|bool 		$base_price if FALSE then NOT doing a base price add.
522 522
 	 * @param int|bool 		$base_price_id  if present then this is the base_price_id being updated.
523
-	 * @return  void
523
+	 * @return  EE_Ticket
524 524
 	 */
525 525
 	private function  _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) {
526 526
 
@@ -732,6 +732,9 @@  discard block
 block discarded – undo
732 732
 
733 733
 
734 734
 
735
+	/**
736
+	 * @param integer $dttrow
737
+	 */
735 738
 	private function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) {
736 739
 
737 740
 		$dtt_display_template_args = array(
@@ -745,6 +748,10 @@  discard block
 block discarded – undo
745 748
 
746 749
 
747 750
 
751
+	/**
752
+	 * @param EE_Datetime|null $dtt
753
+	 * @param boolean $default
754
+	 */
748 755
 	private function _get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ) {
749 756
 
750 757
 		$template_args = array(
@@ -773,6 +780,10 @@  discard block
 block discarded – undo
773 780
 	}
774 781
 
775 782
 
783
+	/**
784
+	 * @param EE_Datetime|null $dtt
785
+	 * @param boolean $default
786
+	 */
776 787
 	private function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) {
777 788
 
778 789
 		$template_args = array(
@@ -977,6 +988,9 @@  discard block
 block discarded – undo
977 988
 
978 989
 
979 990
 
991
+	/**
992
+	 * @param boolean $default
993
+	 */
980 994
 	private function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) {
981 995
 		$send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
982 996
 		$template_args = array(
@@ -1083,6 +1097,9 @@  discard block
 block discarded – undo
1083 1097
 
1084 1098
 
1085 1099
 
1100
+	/**
1101
+	 * @param boolean $default
1102
+	 */
1086 1103
 	private function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) {
1087 1104
 		$dttid = !empty($dtt) ? $dtt->ID() : 0;
1088 1105
 		$displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0;
Please login to merge, or discard this patch.
Spacing   +328 added lines, -328 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
 /**
@@ -40,21 +40,21 @@  discard block
 block discarded – undo
40 40
 		$this->_name = 'pricing';
41 41
 
42 42
 		//capability check
43
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_default_prices', 'advanced_ticket_datetime_metabox' ) ) {
43
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_default_prices', 'advanced_ticket_datetime_metabox')) {
44 44
 			return;
45 45
 		}
46 46
 
47 47
 		//if we were going to add our own metaboxes we'd use the below.
48 48
 		$this->_metaboxes = array(
49 49
 			0 => array(
50
-				'page_route' => array('edit','create_new'),
50
+				'page_route' => array('edit', 'create_new'),
51 51
 				'func' => 'pricing_metabox',
52 52
 				'label' => __('Event Tickets & Datetimes', 'event_espresso'),
53 53
 				'priority' => 'high',
54 54
 				'context' => 'normal'
55 55
 				),
56 56
 
57
-			);/**/
57
+			); /**/
58 58
 
59 59
 		$this->_remove_metaboxes = array(
60 60
 			0 => array(
@@ -67,35 +67,35 @@  discard block
 block discarded – undo
67 67
 		$this->_scripts_styles = array(
68 68
 			'registers' => array(
69 69
 				'ee-tickets-datetimes-css' => array(
70
-					'url' => PRICING_ASSETS_URL . 'event-tickets-datetimes.css',
70
+					'url' => PRICING_ASSETS_URL.'event-tickets-datetimes.css',
71 71
 					'type' => 'css'
72 72
 					),
73 73
 				'ee-dtt-ticket-metabox' => array(
74
-					'url' => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js',
74
+					'url' => PRICING_ASSETS_URL.'ee-datetime-ticket-metabox.js',
75 75
 					'depends' => array('ee-datepicker', 'ee-dialog', 'underscore')
76 76
 					)
77 77
 				),
78 78
 			'deregisters' => array(
79
-				'event-editor-css' => array('type' => 'css' ),
79
+				'event-editor-css' => array('type' => 'css'),
80 80
 				'event-datetime-metabox' => array('type' => 'js')
81 81
 				),
82 82
 			'enqueues' => array(
83
-				'ee-tickets-datetimes-css' => array( 'edit', 'create_new' ),
84
-				'ee-dtt-ticket-metabox' => array( 'edit', 'create_new' )
83
+				'ee-tickets-datetimes-css' => array('edit', 'create_new'),
84
+				'ee-dtt-ticket-metabox' => array('edit', 'create_new')
85 85
 				),
86 86
 			'localize' => array(
87 87
 				'ee-dtt-ticket-metabox' => array(
88 88
 					'DTT_TRASH_BLOCK' => array(
89 89
 						'main_warning' => __('The Datetime you are attempting to trash is the only datetime selected for the following ticket(s):', 'event_espresso'),
90 90
 						'after_warning' => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.', 'event_espresso'),
91
-						'cancel_button' => '<button class="button-secondary ee-modal-cancel">' . __('Cancel', 'event_espresso') . '</button>',
91
+						'cancel_button' => '<button class="button-secondary ee-modal-cancel">'.__('Cancel', 'event_espresso').'</button>',
92 92
 						'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'),
93 93
 						'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'),
94
-						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button>'
94
+						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button>'
95 95
 						),
96 96
 					'DTT_ERROR_MSG' => array(
97 97
 						'no_ticket_name' => __('General Admission', 'event_espresso'),
98
-						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button></div>'
98
+						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button></div>'
99 99
 						),
100 100
 					'DTT_OVERSELL_WARNING' => array(
101 101
 						'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'),
@@ -106,19 +106,19 @@  discard block
 block discarded – undo
106 106
 			);
107 107
 
108 108
 
109
-		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array( $this, 'autosave_handling' ), 10 );
110
-		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 );
109
+		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array($this, 'autosave_handling'), 10);
110
+		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10);
111 111
 	}
112 112
 
113 113
 
114 114
 
115
-	public function caf_updates( $update_callbacks ) {
116
-		foreach ( $update_callbacks as $key => $callback ) {
117
-			if ( $callback[1] == '_default_tickets_update' )
118
-				unset( $update_callbacks[$key] );
115
+	public function caf_updates($update_callbacks) {
116
+		foreach ($update_callbacks as $key => $callback) {
117
+			if ($callback[1] == '_default_tickets_update')
118
+				unset($update_callbacks[$key]);
119 119
 		}
120 120
 
121
-		$update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' );
121
+		$update_callbacks[] = array($this, 'dtt_and_tickets_caf_update');
122 122
 		return $update_callbacks;
123 123
 	}
124 124
 
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
 	 * @param  array    $data   The request data from the form
132 132
 	 * @return bool             success or fail
133 133
 	 */
134
-	public function dtt_and_tickets_caf_update( $evtobj, $data ) {
134
+	public function dtt_and_tickets_caf_update($evtobj, $data) {
135 135
 		//first we need to start with datetimes cause they are the "root" items attached to events.
136
-		$saved_dtts = $this->_update_dtts( $evtobj, $data );
136
+		$saved_dtts = $this->_update_dtts($evtobj, $data);
137 137
 		//next tackle the tickets (and prices?)
138
-		$success = $this->_update_tkts( $evtobj, $saved_dtts, $data );
138
+		$success = $this->_update_tkts($evtobj, $saved_dtts, $data);
139 139
 	}
140 140
 
141 141
 
@@ -146,76 +146,76 @@  discard block
 block discarded – undo
146 146
 	 * @param  array    	$data    the request data from the form
147 147
 	 * @return EE_Datetime           array of EE_Datetime ids created/updated.
148 148
 	 */
149
-	private function _update_dtts( $evt_obj, $data ) {
150
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
149
+	private function _update_dtts($evt_obj, $data) {
150
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
151 151
 		$success = TRUE;
152 152
 
153
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
154
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
153
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
154
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
155 155
 			$datetime_values = array(
156
-				'DTT_ID' => !empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
157
-				'DTT_name' => !empty( $dtt['DTT_name'] ) ? $dtt['DTT_name'] : '',
158
-				'DTT_description' => !empty( $dtt['DTT_description'] ) ? $dtt['DTT_description'] : '',
156
+				'DTT_ID' => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
157
+				'DTT_name' => ! empty($dtt['DTT_name']) ? $dtt['DTT_name'] : '',
158
+				'DTT_description' => ! empty($dtt['DTT_description']) ? $dtt['DTT_description'] : '',
159 159
 				'DTT_EVT_start' => $dtt['DTT_EVT_start'],
160 160
 				'DTT_EVT_end' => $dtt['DTT_EVT_end'],
161
-				'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? INF : $dtt['DTT_reg_limit'],
162
-				'DTT_order' => !isset( $dtt['DTT_order'] ) ? $row : $dtt['DTT_order'],
161
+				'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? INF : $dtt['DTT_reg_limit'],
162
+				'DTT_order' => ! isset($dtt['DTT_order']) ? $row : $dtt['DTT_order'],
163 163
 				);
164 164
 
165 165
 			//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.
166 166
 
167
-			if ( !empty( $dtt['DTT_ID'] ) ) {
168
-				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) )->get_one_by_ID($dtt['DTT_ID'] );
169
-				foreach ( $datetime_values as $field => $value ) {
170
-					$DTM->set( $field, $value );
167
+			if ( ! empty($dtt['DTT_ID'])) {
168
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone))->get_one_by_ID($dtt['DTT_ID']);
169
+				foreach ($datetime_values as $field => $value) {
170
+					$DTM->set($field, $value);
171 171
 				}
172 172
 
173 173
 				//make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.  We need to do this so we dont' TRASH the parent DTT.
174 174
 				$saved_dtts[$DTM->ID()] = $DTM;
175 175
 			} else {
176
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values, $timezone ), FALSE, FALSE );
176
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values, $timezone), FALSE, FALSE);
177 177
 			}
178 178
 
179 179
 			$DTM->save();
180
-			$DTT = $evt_obj->_add_relation_to( $DTM, 'Datetime' );
180
+			$DTT = $evt_obj->_add_relation_to($DTM, 'Datetime');
181 181
 
182 182
 			//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.
183
-			if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) {
184
-				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') );
183
+			if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) {
184
+				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start'));
185 185
 				EE_Registry::instance()->load_helper('DTT_Helper');
186 186
 				EE_Registry::instance()->load_helper('DTT_Helper');
187 187
 				$DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days');
188 188
 				$DTT->save();
189 189
 			}
190
-			$datetimes_start_times[$DTT->start_date_and_time('Y-m-d','H:i:s')] = $DTT->ID();
190
+			$datetimes_start_times[$DTT->start_date_and_time('Y-m-d', 'H:i:s')] = $DTT->ID();
191 191
 			//now we got to make sure we add the new DTT_ID to the $saved_dtts array  because it is possible there was a new one created for the autosave.
192 192
 			$saved_dtts[$DTT->ID()] = $DTT;
193 193
 			$saved_dtt_objs[$row] = $DTT;
194 194
 
195
-			$success = !$success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
195
+			$success = ! $success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
196 196
 		}
197 197
 
198 198
 		//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.
199
-		$old_datetimes = explode(',', $data['datetime_IDs'] );
199
+		$old_datetimes = explode(',', $data['datetime_IDs']);
200 200
 		$old_datetimes = $old_datetimes[0] == '' ? array() : $old_datetimes;
201 201
 
202
-		if ( is_array( $old_datetimes ) ) {
203
-			$dtts_to_delete = array_diff( $old_datetimes, array_keys($saved_dtts) );
204
-			foreach ( $dtts_to_delete as $id ) {
205
-				$id = absint( $id );
206
-				if ( empty( $id ) )
202
+		if (is_array($old_datetimes)) {
203
+			$dtts_to_delete = array_diff($old_datetimes, array_keys($saved_dtts));
204
+			foreach ($dtts_to_delete as $id) {
205
+				$id = absint($id);
206
+				if (empty($id))
207 207
 					continue;
208 208
 
209 209
 				$dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id);
210 210
 
211 211
 				//remove tkt relationships.
212 212
 				$related_tickets = $dtt_to_remove->get_many_related('Ticket');
213
-				foreach ( $related_tickets as $tkt ) {
213
+				foreach ($related_tickets as $tkt) {
214 214
 					$dtt_to_remove->_remove_relation_to($tkt, 'Ticket');
215 215
 				}
216 216
 
217 217
 
218
-				$evt_obj->_remove_relation_to( $id, 'Datetime' );
218
+				$evt_obj->_remove_relation_to($id, 'Datetime');
219 219
 			}
220 220
 		}
221 221
 
@@ -234,63 +234,63 @@  discard block
 block discarded – undo
234 234
 	 * @param  array            $data       incoming request data
235 235
 	 * @return bool                 		success or fail
236 236
 	 */
237
-	private function _update_tkts( $evtobj, $saved_dtts, $data ) {
237
+	private function _update_tkts($evtobj, $saved_dtts, $data) {
238 238
 		//stripslashes because WP filtered the $_POST ($data) array to add slashes
239 239
 		$data = stripslashes_deep($data);
240
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
240
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
241 241
 		$success = TRUE;
242 242
 		$saved_tickets = $dtts_on_existing = array();
243
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
243
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
244 244
 
245 245
 		//load money helper
246
-		EE_Registry::instance()->load_helper( 'Money' );
246
+		EE_Registry::instance()->load_helper('Money');
247 247
 
248
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
248
+		foreach ($data['edit_tickets'] as $row => $tkt) {
249 249
 
250 250
 			$update_prices = $create_new_TKT = $ticket_sold = FALSE;
251 251
 			$new_default = $new_tkt = NULL;
252 252
 
253 253
 			//figure out what dtts were added to the ticket and what dtts were removed from the ticket in the session.
254 254
 
255
-			$starting_tkt_dtt_rows = explode(',',$data['starting_ticket_datetime_rows'][$row]);
256
-			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row] );
255
+			$starting_tkt_dtt_rows = explode(',', $data['starting_ticket_datetime_rows'][$row]);
256
+			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row]);
257 257
 			$dtts_added = array_diff($tkt_dtt_rows, $starting_tkt_dtt_rows);
258 258
 			$dtts_removed = array_diff($starting_tkt_dtt_rows, $tkt_dtt_rows);
259 259
 
260 260
 			//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.
261 261
 			//note incoming ['TKT_price'] value is already in standard notation (via js).
262
-			$ticket_price = isset( $tkt['TKT_price'] ) ?  round ( (float) $tkt['TKT_price'], 3 ) : 0;
262
+			$ticket_price = isset($tkt['TKT_price']) ? round((float) $tkt['TKT_price'], 3) : 0;
263 263
 
264 264
 			//note incoming base price needs converted from localized value.
265
-			$base_price = isset( $tkt['TKT_base_price'] ) ? EEH_Money::convert_to_float_from_localized_money( $tkt['TKT_base_price'] ) : 0;
265
+			$base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0;
266 266
 			//if ticket price == 0 and $base_price != 0 then ticket price == base_price
267 267
 			$ticket_price = $ticket_price === 0 && $base_price !== 0 ? $base_price : $ticket_price;
268
-			$base_price_id = isset( $tkt['TKT_base_price_ID'] ) ? $tkt['TKT_base_price_ID'] : 0;
268
+			$base_price_id = isset($tkt['TKT_base_price_ID']) ? $tkt['TKT_base_price_ID'] : 0;
269 269
 
270 270
 			$price_rows = is_array($data['edit_prices']) && isset($data['edit_prices'][$row]) ? $data['edit_prices'][$row] : array();
271 271
 
272 272
 			$TKT_values = array(
273
-				'TKT_ID' => !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
274
-				'TTM_ID' => !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
275
-				'TKT_name' => !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
276
-				'TKT_description' => !empty( $tkt['TKT_description'] ) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
277
-				'TKT_start_date' => isset( $tkt['TKT_start_date'] ) ? $tkt['TKT_start_date'] : current_time('mysql'),
278
-				'TKT_end_date' => isset( $tkt['TKT_end_date'] ) ? $tkt['TKT_end_date'] : current_time('mysql'),
279
-				'TKT_qty' => empty( $tkt['TKT_qty'] ) ? INF : $tkt['TKT_qty'],
280
-				'TKT_uses' => empty( $tkt['TKT_uses'] ) ? INF : $tkt['TKT_uses'],
281
-				'TKT_min' => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
282
-				'TKT_max' => empty( $tkt['TKT_max'] ) ? INF : $tkt['TKT_max'],
273
+				'TKT_ID' => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
274
+				'TTM_ID' => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
275
+				'TKT_name' => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
276
+				'TKT_description' => ! empty($tkt['TKT_description']) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
277
+				'TKT_start_date' => isset($tkt['TKT_start_date']) ? $tkt['TKT_start_date'] : current_time('mysql'),
278
+				'TKT_end_date' => isset($tkt['TKT_end_date']) ? $tkt['TKT_end_date'] : current_time('mysql'),
279
+				'TKT_qty' => empty($tkt['TKT_qty']) ? INF : $tkt['TKT_qty'],
280
+				'TKT_uses' => empty($tkt['TKT_uses']) ? INF : $tkt['TKT_uses'],
281
+				'TKT_min' => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
282
+				'TKT_max' => empty($tkt['TKT_max']) ? INF : $tkt['TKT_max'],
283 283
 				'TKT_row' => $row,
284
-				'TKT_order' => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : 0,
285
-				'TKT_taxable' => !empty( $tkt['TKT_taxable'] ) ? 1 : 0,
286
-				'TKT_required' => !empty( $tkt['TKT_required'] ) ? 1 : 0,
284
+				'TKT_order' => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : 0,
285
+				'TKT_taxable' => ! empty($tkt['TKT_taxable']) ? 1 : 0,
286
+				'TKT_required' => ! empty($tkt['TKT_required']) ? 1 : 0,
287 287
 				'TKT_price' => $ticket_price
288 288
 				);
289 289
 
290 290
 
291 291
 
292 292
 			//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.
293
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
293
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
294 294
 				$TKT_values['TKT_ID'] = 0;
295 295
 				$TKT_values['TKT_is_default'] = 0;
296 296
 				$update_prices = TRUE;
@@ -300,25 +300,25 @@  discard block
 block discarded – undo
300 300
 			//we actually do our saves ahead of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified.
301 301
 			//keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
302 302
 
303
-			if ( !empty( $TKT_values['TKT_ID'] ) ) {
304
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $timezone ) )->get_one_by_ID( $tkt['TKT_ID'] );
303
+			if ( ! empty($TKT_values['TKT_ID'])) {
304
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($timezone))->get_one_by_ID($tkt['TKT_ID']);
305 305
 
306
-				$ticket_sold = $TKT->count_related('Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false;
306
+				$ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false;
307 307
 
308 308
 				//let's just check the total price for the existing ticket and determine if it matches the new total price.  if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket.
309 309
 				$orig_price = $TKT->price();
310
-				$create_new_TKT = $ticket_sold && $ticket_price != $orig_price && !$TKT->get('TKT_deleted') ? TRUE : FALSE;
310
+				$create_new_TKT = $ticket_sold && $ticket_price != $orig_price && ! $TKT->get('TKT_deleted') ? TRUE : FALSE;
311 311
 
312 312
 				//set new values
313
-				foreach ( $TKT_values as $field => $value ) {
314
-					$TKT->set( $field, $value );
313
+				foreach ($TKT_values as $field => $value) {
314
+					$TKT->set($field, $value);
315 315
 				}
316 316
 
317 317
 				//make sure price is set if it hasn't been already
318
-				$TKT->set( 'TKT_price', $ticket_price );
318
+				$TKT->set('TKT_price', $ticket_price);
319 319
 
320 320
 				//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
321
-				if ( $create_new_TKT ) {
321
+				if ($create_new_TKT) {
322 322
 					//@TODO need to move this logic into its own method that just receives the ticket object (and other necessary info)
323 323
 					$new_tkt = clone($TKT);
324 324
 
@@ -328,26 +328,26 @@  discard block
 block discarded – undo
328 328
 					//TKT will get archived later b/c we are NOT adding it to the saved_tickets array.
329 329
 
330 330
 					//if existing $TKT has sold amount, then we need to adjust the qty for the new TKT to = the remaining available.
331
-					if ( $TKT->get('TKT_sold') > 0 ) {
331
+					if ($TKT->get('TKT_sold') > 0) {
332 332
 						$new_qty = $TKT->get('TKT_qty') - $TKT->get('TKT_sold');
333 333
 						$new_tkt->set_qty($new_qty);
334 334
 					}
335 335
 
336 336
 
337 337
 					//create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it.
338
-					$new_tkt->set( 'TKT_ID', 0 );
339
-					$new_tkt->set( 'TKT_deleted', 0 );
340
-					$new_tkt->set( 'TKT_price', $ticket_price );
341
-					$new_tkt->set( 'TKT_sold', 0 );
338
+					$new_tkt->set('TKT_ID', 0);
339
+					$new_tkt->set('TKT_deleted', 0);
340
+					$new_tkt->set('TKT_price', $ticket_price);
341
+					$new_tkt->set('TKT_sold', 0);
342 342
 
343 343
 					//now we update the prices just for this ticket
344
-					$new_tkt = $this->_add_prices_to_ticket( $price_rows, $new_tkt, TRUE );
344
+					$new_tkt = $this->_add_prices_to_ticket($price_rows, $new_tkt, TRUE);
345 345
 
346 346
 					//and we update the base price
347
-					$new_tkt =  $this->_add_prices_to_ticket( array(), $new_tkt, TRUE, $base_price, $base_price_id );
347
+					$new_tkt = $this->_add_prices_to_ticket(array(), $new_tkt, TRUE, $base_price, $base_price_id);
348 348
 
349
-					foreach ( $dtts_on_existing as $adddtt ) {
350
-						$new_tkt->_add_relation_to( $adddtt, 'Datetime' );
349
+					foreach ($dtts_on_existing as $adddtt) {
350
+						$new_tkt->_add_relation_to($adddtt, 'Datetime');
351 351
 					}
352 352
 
353 353
 				}
@@ -355,38 +355,38 @@  discard block
 block discarded – undo
355 355
 			} else {
356 356
 				//no TKT_id so a new TKT
357 357
 				$TKT_values['TKT_price'] = $ticket_price;
358
-				$TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values, $timezone ), FALSE, FALSE );
358
+				$TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values, $timezone), FALSE, FALSE);
359 359
 				$update_prices = TRUE;
360 360
 			}
361 361
 
362 362
 			$TKT->save(); //make sure any current values have been saved.
363 363
 
364 364
 			//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.
365
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
366
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
365
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
366
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
367 367
 				EE_Registry::instance()->load_helper('DTT_Helper');
368 368
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
369 369
 			}
370 370
 
371 371
 			//let's make sure the base price is handled
372
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( array(), $TKT, $update_prices, $base_price, $base_price_id ) : $TKT;
372
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket(array(), $TKT, $update_prices, $base_price, $base_price_id) : $TKT;
373 373
 
374 374
 			//add/update price_modifiers
375
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( $price_rows, $TKT, $update_prices ) : $TKT;
375
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket($price_rows, $TKT, $update_prices) : $TKT;
376 376
 
377 377
 			//need to make sue that the TKT_price is accurate after saving the prices.
378 378
 			$TKT->ensure_TKT_Price_correct();
379 379
 
380 380
 
381 381
 			//handle CREATING a default tkt from the incoming tkt but ONLY if this isn't an autosave.
382
-			if ( ! defined('DOING_AUTOSAVE' ) ) {
383
-				if ( !empty($tkt['TKT_is_default_selector'] ) ) {
382
+			if ( ! defined('DOING_AUTOSAVE')) {
383
+				if ( ! empty($tkt['TKT_is_default_selector'])) {
384 384
 					$update_prices = TRUE;
385 385
 					$new_default = clone $TKT;
386
-					$new_default->set( 'TKT_ID', 0 );
387
-					$new_default->set( 'TKT_is_default', 1 );
388
-					$new_default->set( 'TKT_row', 1 );
389
-					$new_default->set( 'TKT_price', $ticket_price );
386
+					$new_default->set('TKT_ID', 0);
387
+					$new_default->set('TKT_is_default', 1);
388
+					$new_default->set('TKT_row', 1);
389
+					$new_default->set('TKT_price', $ticket_price);
390 390
 					//remove any dtt relations cause we DON'T want dtt relations attached (note this is just removing the cached relations in the object)
391 391
 					$new_default->_remove_relations('Datetime');
392 392
 					$new_default->save();
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 					$new_default = $this->_add_prices_to_ticket($price_rows, $new_default, $update_prices);
395 395
 
396 396
 					//don't forget the base price!
397
-					$new_default = $this->_add_prices_to_ticket( array(), $new_default, $update_prices, $base_price, $base_price_id );
397
+					$new_default = $this->_add_prices_to_ticket(array(), $new_default, $update_prices, $base_price, $base_price_id);
398 398
 				}
399 399
 			}
400 400
 
@@ -402,42 +402,42 @@  discard block
 block discarded – undo
402 402
 
403 403
 
404 404
 			//first let's do the add_relation_to()
405
-			$dtts_added = empty( $dtts_added ) || ( is_array( $dtts_added ) && ( isset( $dtts_added[0] ) && $dtts_added[0] == '' ) ) ? array() : $dtts_added;
405
+			$dtts_added = empty($dtts_added) || (is_array($dtts_added) && (isset($dtts_added[0]) && $dtts_added[0] == '')) ? array() : $dtts_added;
406 406
 
407
-			foreach ( $dtts_added as $dttrow ) {
407
+			foreach ($dtts_added as $dttrow) {
408 408
 				$dttrow = (int) $dttrow;
409 409
 				$TKT->_add_relation_to($saved_dtts[$dttrow], 'Datetime');
410 410
 
411 411
 				//now wait a minute.  Does this tkt have any sold?  Cause if it does then we need to add that to the DTT sold because this DTT is getting added.
412
-				if ( $TKT->get('TKT_sold') > 0 ) {
413
-					$saved_dtts[$dttrow]->increase_sold($TKT->get('TKT_sold') );
412
+				if ($TKT->get('TKT_sold') > 0) {
413
+					$saved_dtts[$dttrow]->increase_sold($TKT->get('TKT_sold'));
414 414
 					$saved_dtts[$dttrow]->save();
415 415
 				}
416 416
 
417 417
 				//if we have a new_tkt... let's add to it as well
418
-				if ( !empty( $new_tkt ) )
419
-					$new_tkt->_add_relation_to($saved_dtts[$dttrow], 'Datetime' );
418
+				if ( ! empty($new_tkt))
419
+					$new_tkt->_add_relation_to($saved_dtts[$dttrow], 'Datetime');
420 420
 			}
421 421
 
422 422
 
423
-			$dtts_removed = empty( $dtts_removed ) || ( is_array( $dtts_removed ) && isset( $dtts_removed[0] ) && $dtts_removed[0] == '' ) ? array() : $dtts_removed;
423
+			$dtts_removed = empty($dtts_removed) || (is_array($dtts_removed) && isset($dtts_removed[0]) && $dtts_removed[0] == '') ? array() : $dtts_removed;
424 424
 
425 425
 			//now let's do the remove_relation_to()
426
-			foreach ( $dtts_removed as $dttrow ) {
426
+			foreach ($dtts_removed as $dttrow) {
427 427
 				$dttrow = (int) $dttrow;
428 428
 				//its entirely possible that a datetime got deleted (instead of just removed from relationship.  So make sure we skip over this if the dtt isn't in the saved_dtts array)
429
-				if ( empty($saved_dtts[$dttrow] ) || ! $saved_dtts[$dttrow] instanceof EE_Datetime )
429
+				if (empty($saved_dtts[$dttrow]) || ! $saved_dtts[$dttrow] instanceof EE_Datetime)
430 430
 					continue;
431 431
 
432 432
 				$TKT->_remove_relation_to($saved_dtts[$dttrow], 'Datetime');
433 433
 
434 434
 				//now wait a minute.  Does this tkt have any sold? Cause if it does then we need to remove it's sold from the DTT_sold.
435
-				if ( $TKT->get('TKT_sold') > 0 ) {
436
-					$saved_dtts[$dttrow]->decrease_sold($TKT->get('TKT_sold') );
435
+				if ($TKT->get('TKT_sold') > 0) {
436
+					$saved_dtts[$dttrow]->decrease_sold($TKT->get('TKT_sold'));
437 437
 					$saved_dtts[$dttrow]->save();
438 438
 				}
439 439
 
440
-				if ( !empty( $new_tkt ) )
440
+				if ( ! empty($new_tkt))
441 441
 					$new_tkt->_remove_relation_to($saved_dtts[$dttrow], 'Datetime');
442 442
 			}
443 443
 
@@ -448,43 +448,43 @@  discard block
 block discarded – undo
448 448
 			//let's assign any tickets that have been setup to the saved_tickets tracker
449 449
 			//save existing TKT
450 450
 			$TKT->save();
451
-			if ( $create_new_TKT ) {
451
+			if ($create_new_TKT) {
452 452
 				//save new TKT
453 453
 				$new_tkt->save();
454 454
 				//add new ticket to array
455 455
 				$saved_tickets[$new_tkt->ID()] = $new_tkt;
456 456
 
457
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data );
457
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data);
458 458
 
459 459
 			} else {
460 460
 				//add tkt to saved tkts
461 461
 				//save existing TKT
462 462
 				$saved_tickets[$TKT->ID()] = $TKT;
463 463
 
464
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data );
464
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data);
465 465
 			}
466 466
 
467 467
 		}
468 468
 
469 469
 		//now we need to handle tickets actually "deleted permanently".  There are cases where we'd want this to happen (i.e. autosaves are happening and then in between autosaves the user trashes a ticket).  Or a draft event was saved and in the process of editing a ticket is trashed.  No sense in keeping all the related data in the db!
470
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
471
-		$tickets_removed = array_diff( $old_tickets, array_keys($saved_tickets) );
470
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
471
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
472 472
 		/*var_dump($old_tickets);
473 473
 		var_dump($saved_tickets);
474 474
 		var_dump($tickets_removed);*/
475 475
 
476
-		foreach ( $tickets_removed as $id ) {
477
-			$id = absint( $id );
476
+		foreach ($tickets_removed as $id) {
477
+			$id = absint($id);
478 478
 
479 479
 			//get the ticket for this id
480 480
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
481 481
 
482 482
 			//if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime
483
-			if ( $tkt_to_remove->get('TKT_is_default') )
483
+			if ($tkt_to_remove->get('TKT_is_default'))
484 484
 				continue;
485 485
 
486 486
 			//if this tkt has any registrations attached so then we just ARCHIVE because we don't actually permanently delete these tickets.
487
-			if ( $tkt_to_remove->count_related('Registration') > 0 ) {
487
+			if ($tkt_to_remove->count_related('Registration') > 0) {
488 488
 				$tkt_to_remove->delete();
489 489
 				continue;
490 490
 			}
@@ -492,14 +492,14 @@  discard block
 block discarded – undo
492 492
 			//need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold)
493 493
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
494 494
 
495
-			foreach( $dtts as $dtt ) {
495
+			foreach ($dtts as $dtt) {
496 496
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
497 497
 			}
498 498
 
499 499
 			//need to do the same for prices (except these prices can also be deleted because again, tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived))
500 500
 			$tkt_to_remove->delete_related_permanently('Price');
501 501
 
502
-			do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove );
502
+			do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove);
503 503
 
504 504
 			//finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships)
505 505
 			$tkt_to_remove->delete_permanently();
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 	 * @param int|bool 		$base_price_id  if present then this is the base_price_id being updated.
523 523
 	 * @return  void
524 524
 	 */
525
-	private function  _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) {
525
+	private function  _add_prices_to_ticket($prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE) {
526 526
 
527 527
 		//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.
528 528
 		$current_prices_on_ticket = $base_price !== FALSE ? $ticket->base_price(TRUE) : $ticket->price_modifiers();
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 		$updated_prices = array();
531 531
 
532 532
 		// if $base_price ! FALSE then updating a base price.
533
-		if ( $base_price !== FALSE ) {
533
+		if ($base_price !== FALSE) {
534 534
 			$prices[1] = array(
535 535
 				'PRC_ID' => $new_prices || $base_price_id === 1 ? NULL : $base_price_id,
536 536
 				'PRT_ID' => 1,
@@ -541,47 +541,47 @@  discard block
 block discarded – undo
541 541
 		}
542 542
 
543 543
 		//possibly need to save tkt
544
-		if ( ! $ticket->ID() )
544
+		if ( ! $ticket->ID())
545 545
 			$ticket->save();
546 546
 
547
-		foreach ( $prices as $row => $prc ) {
548
-			$prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL;
549
-			if ( empty($prt_id) )
547
+		foreach ($prices as $row => $prc) {
548
+			$prt_id = ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL;
549
+			if (empty($prt_id))
550 550
 				continue; //prices MUST have a price type id.
551 551
 			$PRC_values = array(
552
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
552
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
553 553
 				'PRT_ID' => $prt_id,
554
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
555
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
556
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
554
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
555
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
556
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
557 557
 				'PRC_is_default' => 0, //make sure we set PRC_is_default to 0 for all ticket saves from event_editor
558 558
 				'PRC_order' => $row
559 559
 				);
560
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
560
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
561 561
 				$PRC_values['PRC_ID'] = 0;
562
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
562
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
563 563
 			} else {
564
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
564
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
565 565
 				//update this price with new values
566
-				foreach ( $PRC_values as $field => $newprc ) {
567
-					$PRC->set( $field, $newprc );
566
+				foreach ($PRC_values as $field => $newprc) {
567
+					$PRC->set($field, $newprc);
568 568
 				}
569 569
 			}
570 570
 			$PRC->save();
571 571
 			$prcid = $PRC->ID();
572 572
 			$updated_prices[$prcid] = $PRC;
573
-			$ticket->_add_relation_to( $PRC, 'Price' );
573
+			$ticket->_add_relation_to($PRC, 'Price');
574 574
 		}
575 575
 
576 576
 		//now let's remove any prices that got removed from the ticket
577
-		if ( !empty ( $current_prices_on_ticket ) ) {
577
+		if ( ! empty ($current_prices_on_ticket)) {
578 578
 			$current = array_keys($current_prices_on_ticket);
579 579
 			$updated = array_keys($updated_prices);
580 580
 			$prices_to_remove = array_diff($current, $updated);
581
-			if ( !empty( $prices_to_remove ) ) {
582
-				foreach ( $prices_to_remove as $prc_id ) {
581
+			if ( ! empty($prices_to_remove)) {
582
+				foreach ($prices_to_remove as $prc_id) {
583 583
 					$p = $current_prices_on_ticket[$prc_id];
584
-					$ticket->_remove_relation_to( $p, 'Price' );
584
+					$ticket->_remove_relation_to($p, 'Price');
585 585
 
586 586
 					//delete permanently the price
587 587
 					$p->delete_permanently();
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 
595 595
 
596 596
 
597
-	public function autosave_handling( $event_admin_obj ) {
597
+	public function autosave_handling($event_admin_obj) {
598 598
 		return $event_admin_obj; //doing nothing for the moment.
599 599
 		//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)
600 600
 
@@ -628,12 +628,12 @@  discard block
 block discarded – undo
628 628
 
629 629
 		//default main template args
630 630
 		$main_template_args = array(
631
-			'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
631
+			'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
632 632
 			'existing_datetime_ids' => '',
633 633
 			'total_dtt_rows' => 1,
634
-			'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.
634
+			'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.
635 635
 			'datetime_rows' => '',
636
-			'show_tickets_container' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
636
+			'show_tickets_container' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
637 637
 			'ticket_rows' => '',
638 638
 			'existing_ticket_ids' => '',
639 639
 			'total_ticket_rows' => 1,
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 
644 644
 		$timezone = $evtobj instanceof EE_Event ? $evtobj->timezone_string() : NULL;
645 645
 
646
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
646
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
647 647
 
648 648
 		/**
649 649
 		 * 1. Start with retrieving Datetimes
@@ -651,25 +651,25 @@  discard block
 block discarded – undo
651 651
 		 * 3. For each ticket get related prices
652 652
 		 */
653 653
 
654
-		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) );
655
-		$times = $DTM->get_all_event_dates( $evtID );
654
+		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone));
655
+		$times = $DTM->get_all_event_dates($evtID);
656 656
 
657 657
 
658 658
 
659 659
 		$main_template_args['total_dtt_rows'] = count($times);
660
-		foreach ( $times as $time ) {
660
+		foreach ($times as $time) {
661 661
 			$dttid = $time->get('DTT_ID');
662 662
 			$dttrow = $time->get('DTT_order');
663 663
 			$existing_datetime_ids[] = $dttid;
664 664
 
665 665
 			//tickets attached
666
-			$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();
666
+			$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();
667 667
 
668 668
 			//if there are no related tickets this is likely a new event OR autodraft
669 669
 			// event so we need to generate the default tickets because dtts
670 670
 			// ALWAYS have at least one related ticket!!.  EXCEPT, we dont' do this if there is already more than one
671 671
 			// datetime on the event.
672
-			if ( empty ( $related_tickets ) && count( $times ) < 2 ) {
672
+			if (empty ($related_tickets) && count($times) < 2) {
673 673
 				$related_tickets = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
674 674
 			}
675 675
 
@@ -678,11 +678,11 @@  discard block
 block discarded – undo
678 678
 
679 679
 			//loop through and setup the ticket rows and make sure the order is set.
680 680
 			$order = 0;
681
-			foreach ( $related_tickets as $ticket ) {
681
+			foreach ($related_tickets as $ticket) {
682 682
 				$tktid = $ticket->get('TKT_ID');
683 683
 				$tktrow = $ticket->get('TKT_row');
684 684
 				//we only want unique tickets in our final display!!
685
-				if ( !in_array( $tktid, $existing_ticket_ids ) ) {
685
+				if ( ! in_array($tktid, $existing_ticket_ids)) {
686 686
 					$existing_ticket_ids[] = $tktid;
687 687
 					$all_tickets[] = $ticket;
688 688
 				}
@@ -691,89 +691,89 @@  discard block
 block discarded – undo
691 691
 				$datetime_tickets[$dttid][] = $tktrow;
692 692
 
693 693
 				//temporary cache of this datetime info for this ticket for later processing of ticket rows.
694
-				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) )
694
+				if ( ! isset($ticket_datetimes[$tktid]) || ! in_array($dttrow, $ticket_datetimes[$tktid]))
695 695
 					$ticket_datetimes[$tktid][] = $dttrow;
696 696
 			}
697 697
 		}
698 698
 
699
-		$main_template_args['total_ticket_rows'] = count( $existing_ticket_ids );
700
-		$main_template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids );
701
-		$main_template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids );
699
+		$main_template_args['total_ticket_rows'] = count($existing_ticket_ids);
700
+		$main_template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
701
+		$main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
702 702
 
703 703
 		//sort $all_tickets by order
704
-		usort( $all_tickets, function( $a, $b ) {
704
+		usort($all_tickets, function($a, $b) {
705 705
 			$a_order = (int) $a->get('TKT_order');
706 706
 			$b_order = (int) $b->get('TKT_order');
707
-			if ( $a_order == $b_order ) {
707
+			if ($a_order == $b_order) {
708 708
 				return 0;
709 709
 			}
710
-			return ( $a_order < $b_order ) ? -1 : 1;
710
+			return ($a_order < $b_order) ? -1 : 1;
711 711
 		});
712 712
 
713 713
 		//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.
714 714
 		$dttrow = 1;
715
-		foreach ( $times as $time ) {
716
-			$main_template_args['datetime_rows'] .= $this->_get_datetime_row( $dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times );
715
+		foreach ($times as $time) {
716
+			$main_template_args['datetime_rows'] .= $this->_get_datetime_row($dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times);
717 717
 			$dttrow++;
718 718
 		}
719 719
 
720 720
 		//then loop through all tickets for the ticket rows.
721 721
 		$tktrow = 1;
722
-		foreach ( $all_tickets as $ticket ) {
723
-			$main_template_args['ticket_rows'] .= $this->_get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets );
722
+		foreach ($all_tickets as $ticket) {
723
+			$main_template_args['ticket_rows'] .= $this->_get_ticket_row($tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets);
724 724
 			$tktrow++;
725 725
 		}
726 726
 
727 727
 		$main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets);
728
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php';
729
-		EEH_Template::display_template( $template, $main_template_args );
728
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_metabox_main.template.php';
729
+		EEH_Template::display_template($template, $main_template_args);
730 730
 		return;
731 731
 	}
732 732
 
733 733
 
734 734
 
735
-	private function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) {
735
+	private function _get_datetime_row($dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array()) {
736 736
 
737 737
 		$dtt_display_template_args = array(
738
-			'dtt_edit_row' => $this->_get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ),
739
-			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ),
738
+			'dtt_edit_row' => $this->_get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts),
739
+			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default),
740 740
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow
741 741
 			);
742
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php';
743
-		return EEH_Template::display_template( $template, $dtt_display_template_args, TRUE);
742
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_row_wrapper.template.php';
743
+		return EEH_Template::display_template($template, $dtt_display_template_args, TRUE);
744 744
 	}
745 745
 
746 746
 
747 747
 
748
-	private function _get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ) {
748
+	private function _get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts) {
749 749
 
750 750
 		$template_args = array(
751 751
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
752 752
 			'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes',
753
-			'edit_dtt_expanded' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
753
+			'edit_dtt_expanded' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
754 754
 			'DTT_ID' => $default ? '' : $dtt->ID(),
755 755
 			'DTT_name' => $default ? '' : $dtt->name(),
756 756
 			'DTT_description' => $default ? '' : $dtt->description(),
757
-			'DTT_EVT_start' => $default ? '' : $dtt->start_date( 'Y-m-d h:i a'),
758
-			'DTT_EVT_end' => $default ? '' : $dtt->end_date( 'Y-m-d h:i a'),
759
-			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit','input'),
757
+			'DTT_EVT_start' => $default ? '' : $dtt->start_date('Y-m-d h:i a'),
758
+			'DTT_EVT_end' => $default ? '' : $dtt->end_date('Y-m-d h:i a'),
759
+			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'),
760 760
 			'DTT_order' => $default ? 'DTTNUM' : $dttrow,
761 761
 			'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'),
762
-			'clone_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
763
-			'trash_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0  ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable'
762
+			'clone_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
763
+			'trash_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable'
764 764
 			);
765 765
 
766
-		$template_args['show_trash'] = count( $all_dtts ) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
766
+		$template_args['show_trash'] = count($all_dtts) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
767 767
 
768 768
 		//allow filtering of template args at this point.
769
-		$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 );
769
+		$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);
770 770
 
771
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php';
772
-		return EEH_Template::display_template( $template, $template_args, TRUE );
771
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_edit_row.template.php';
772
+		return EEH_Template::display_template($template, $template_args, TRUE);
773 773
 	}
774 774
 
775 775
 
776
-	private function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) {
776
+	private function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default) {
777 777
 
778 778
 		$template_args = array(
779 779
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
@@ -781,61 +781,61 @@  discard block
 block discarded – undo
781 781
 			'DTT_description' => $default ? '' : $dtt->description(),
782 782
 			'datetime_tickets_list' => $default ? '<li class="hidden"></li>' : '',
783 783
 			'show_tickets_row' => ' style="display:none;"', //$default || $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' style="display:none;"' : '',
784
-			'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.
784
+			'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.
785 785
 			'DTT_ID' => $default ? '' : $dtt->ID()
786 786
 			);
787 787
 
788 788
 		//need to setup the list items (but only if this isnt' a default skeleton setup)
789
-		if ( !$default ) {
789
+		if ( ! $default) {
790 790
 			$tktrow = 1;
791
-			foreach ( $all_tickets as $ticket ) {
792
-				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default );
791
+			foreach ($all_tickets as $ticket) {
792
+				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default);
793 793
 				$tktrow++;
794 794
 			}
795 795
 		}
796 796
 
797 797
 		//filter template args at this point
798
-		$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 );
798
+		$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);
799 799
 
800
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php';
801
-		return EEH_Template::display_template( $template, $template_args, TRUE );
800
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_attached_tickets_row.template.php';
801
+		return EEH_Template::display_template($template, $template_args, TRUE);
802 802
 	}
803 803
 
804 804
 
805 805
 
806
-	private function _get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ) {
807
-		$tktid = !empty( $ticket ) ? $ticket->ID() : 0;
808
-		$dtt_tkts = $dtt instanceof EE_Datetime && isset( $datetime_tickets[$dtt->ID()] ) ? $datetime_tickets[$dtt->ID()] : array();
806
+	private function _get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default) {
807
+		$tktid = ! empty($ticket) ? $ticket->ID() : 0;
808
+		$dtt_tkts = $dtt instanceof EE_Datetime && isset($datetime_tickets[$dtt->ID()]) ? $datetime_tickets[$dtt->ID()] : array();
809 809
 
810
-		$displayrow = !empty( $ticket ) ? $ticket->get('TKT_row') : 0;
810
+		$displayrow = ! empty($ticket) ? $ticket->get('TKT_row') : 0;
811 811
 		$template_args = array(
812 812
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
813
-			'tkt_row' => $default && empty( $ticket ) ? 'TICKETNUM' : $tktrow,
813
+			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
814 814
 			'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '',
815 815
 			'ticket_selected' => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '',
816
-			'TKT_name' => $default && empty( $ticket ) ? 'TKTNAME' : $ticket->get('TKT_name'),
817
-			'tkt_status_class' => ( $default && empty( $ticket ) ) || $this->_is_creating_event ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(),
816
+			'TKT_name' => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'),
817
+			'tkt_status_class' => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(),
818 818
 			);
819 819
 
820 820
 		//filter template args
821
-		$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 );
821
+		$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);
822 822
 
823
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php';
824
-		return EEH_Template::display_template( $template, $template_args, TRUE );
823
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_dtt_tickets_list.template.php';
824
+		return EEH_Template::display_template($template, $template_args, TRUE);
825 825
 	}
826 826
 
827 827
 
828 828
 
829 829
 
830
-	private function _get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array() ) {
831
-		$prices = !empty($ticket) && !$default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC') ) ) : array();
830
+	private function _get_ticket_row($tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array()) {
831
+		$prices = ! empty($ticket) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))) : array();
832 832
 
833 833
 		// 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.
834
-		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default') ) ? TRUE : FALSE;
834
+		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default')) ? TRUE : FALSE;
835 835
 
836
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
836
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
837 837
 
838
-		$ticket_subtotal = !empty( $ticket ) ? $ticket->get_ticket_subtotal() : 0;
838
+		$ticket_subtotal = ! empty($ticket) ? $ticket->get_ticket_subtotal() : 0;
839 839
 		$base_price = $ticket instanceof EE_Ticket ? $ticket->base_price() : NULL;
840 840
 		$count_price_mods = EEM_Price::instance()->get_all_default_prices(TRUE);
841 841
 
@@ -843,24 +843,24 @@  discard block
 block discarded – undo
843 843
 		$template_args = array(
844 844
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
845 845
 			'TKT_order' => $default ? 'TICKETNUM' : $tktrow, //on initial page load this will always be the correct order.
846
-			'tkt_status_class' => $default ? ' tkt-status-' . EE_Ticket::onsale : $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(),
846
+			'tkt_status_class' => $default ? ' tkt-status-'.EE_Ticket::onsale : $ticket->is_default() ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(),
847 847
 			'display_edit_tkt_row' => ' style="display:none;"', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 || $default ? ' style="display:none"' : '',
848 848
 			'edit_tkt_expanded' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
849 849
 			'edit_tickets_name' => $default ? 'TICKETNAMEATTR' : 'edit_tickets',
850 850
 			'TKT_name' => $default ? '' : $ticket->get('TKT_name'),
851 851
 			'TKT_start_date' => $ticket instanceof EE_Ticket ? $ticket->get_date('TKT_start_date', 'Y-m-d h:i a') : '',
852
-			'TKT_end_date' => $ticket instanceof EE_Ticket ? $ticket->get_date('TKT_end_date', 'Y-m-d h:i a' ) : '',
853
-			'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),
852
+			'TKT_end_date' => $ticket instanceof EE_Ticket ? $ticket->get_date('TKT_end_date', 'Y-m-d h:i a') : '',
853
+			'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),
854 854
 			'TKT_price' => $default ? '' : EEH_Template::format_currency($ticket->get_ticket_total_with_taxes(), FALSE, FALSE),
855 855
 			'TKT_price_code' => EE_Registry::instance()->CFG->currency->code,
856 856
 			'TKT_price_amount' => $default ? 0 : $ticket_subtotal,
857
-			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty','symbol'),
858
-			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty','input'),
859
-			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses','input'),
860
-			'TKT_min' => $default ? '' : ( $ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min') ),
861
-			'TKT_max' => $default ? '' :  $ticket->get_pretty('TKT_max','input'),
857
+			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty', 'symbol'),
858
+			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty', 'input'),
859
+			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses', 'input'),
860
+			'TKT_min' => $default ? '' : ($ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min')),
861
+			'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max', 'input'),
862 862
 			'TKT_sold' => $default ? 0 : $ticket->tickets_sold('ticket'),
863
-			'TKT_registrations' => $default ? 0 : $ticket->count_registrations( array( array( 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ) ) ),
863
+			'TKT_registrations' => $default ? 0 : $ticket->count_registrations(array(array('STS_ID' => array('!=', EEM_Registration::status_id_incomplete)))),
864 864
 			'TKT_ID' => $default ? 0 : $ticket->get('TKT_ID'),
865 865
 			'TKT_description' => $default ? '' : $ticket->get('TKT_description'),
866 866
 			'TKT_is_default' => $default ? 0 : $ticket->get('TKT_is_default'),
@@ -869,99 +869,99 @@  discard block
 block discarded – undo
869 869
 			'ticket_price_rows' => '',
870 870
 			'TKT_base_price' => $default || ! $base_price instanceof EE_Price ? '' : $base_price->get_pretty('PRC_amount', 'localized_float'),
871 871
 			'TKT_base_price_ID' => $default || ! $base_price instanceof EE_Price ? 0 : $base_price->ID(),
872
-			'show_price_modifier' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) ? '' : ' style="display:none;"',
873
-			'show_price_mod_button' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) || ( !$default && $ticket->get('TKT_deleted') ) ? ' style="display:none;"' : '',
872
+			'show_price_modifier' => count($prices) > 1 || ($default && $count_price_mods > 0) ? '' : ' style="display:none;"',
873
+			'show_price_mod_button' => count($prices) > 1 || ($default && $count_price_mods > 0) || ( ! $default && $ticket->get('TKT_deleted')) ? ' style="display:none;"' : '',
874 874
 			'total_price_rows' => count($prices) > 1 ? count($prices) : 1,
875 875
 			'ticket_datetimes_list' => $default ? '<li class="hidden"></li>' : '',
876 876
 			'starting_ticket_datetime_rows' => $default || $default_dtt ? '' : implode(',', $tkt_dtts),
877 877
 			'ticket_datetime_rows' => $default ? '' : implode(',', $tkt_dtts),
878
-			'existing_ticket_price_ids' => $default, '', implode(',', array_keys( $prices) ),
878
+			'existing_ticket_price_ids' => $default, '', implode(',', array_keys($prices)),
879 879
 			'ticket_template_id' => $default ? 0 : $ticket->get('TTM_ID'),
880
-			'TKT_taxable' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? ' checked="checked"' : '',
881
-			'display_subtotal' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? '' : ' style="display:none"',
880
+			'TKT_taxable' => ! empty($ticket) && $ticket->get('TKT_taxable') ? ' checked="checked"' : '',
881
+			'display_subtotal' => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none"',
882 882
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
883
-			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE ),
883
+			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE),
884 884
 			'TKT_subtotal_amount' => $ticket_subtotal,
885
-			'tax_rows' => $this->_get_tax_rows( $tktrow, $ticket ),
886
-			'disabled' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE: FALSE,
887
-			'ticket_archive_class' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? ' ticket-archived' : '',
888
-			'trash_icon' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable',
889
-			'clone_icon' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable'
885
+			'tax_rows' => $this->_get_tax_rows($tktrow, $ticket),
886
+			'disabled' => ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE,
887
+			'ticket_archive_class' => ! empty($ticket) && $ticket->get('TKT_deleted') ? ' ticket-archived' : '',
888
+			'trash_icon' => ! empty($ticket) && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable',
889
+			'clone_icon' => ! empty($ticket) && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable'
890 890
 			);
891 891
 
892
-		$template_args['trash_hidden'] = count( $all_tickets ) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
892
+		$template_args['trash_hidden'] = count($all_tickets) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
893 893
 
894 894
 		//handle rows that should NOT be empty
895
-		if ( empty( $template_args['TKT_start_date'] ) ) {
895
+		if (empty($template_args['TKT_start_date'])) {
896 896
 			//if empty then the start date will be now.
897 897
 			$template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp'));
898
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
898
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
899 899
 		}
900 900
 
901
-		if ( empty( $template_args['TKT_end_date'] ) ) {
901
+		if (empty($template_args['TKT_end_date'])) {
902 902
 
903 903
 			//get the earliest datetime (if present);
904
-			$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;
904
+			$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;
905 905
 
906
-			if ( !empty( $earliest_dtt ) ) {
906
+			if ( ! empty($earliest_dtt)) {
907 907
 				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
908 908
 			} else {
909 909
 				//default so let's just use what's been set for the default date-time which is 30 days from now.
910
-				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(24, 0, 0, date("m"), date("d") + 29, date("Y") )  );
910
+				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(24, 0, 0, date("m"), date("d") + 29, date("Y")));
911 911
 			}
912
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
912
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
913 913
 		}
914 914
 
915 915
 		//generate ticket_datetime items
916
-		if ( ! $default ) {
916
+		if ( ! $default) {
917 917
 			$dttrow = 1;
918
-			foreach ( $all_dtts as $dtt ) {
919
-				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default );
918
+			foreach ($all_dtts as $dtt) {
919
+				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default);
920 920
 				$dttrow++;
921 921
 			}
922 922
 		}
923 923
 
924 924
 		$prcrow = 1;
925
-		foreach ( $prices as $price ) {
926
-			if ( $price->is_base_price() ) {
925
+		foreach ($prices as $price) {
926
+			if ($price->is_base_price()) {
927 927
 				$prcrow++;
928 928
 				continue;
929 929
 			}
930
-			$show_trash = ( count( $prices ) > 1 && $prcrow === 1 ) || count( $prices ) === 1  ? FALSE : TRUE;
931
-			$show_create = count( $prices ) > 1 && count( $prices ) !== $prcrow ? FALSE : TRUE;
932
-			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create );
930
+			$show_trash = (count($prices) > 1 && $prcrow === 1) || count($prices) === 1 ? FALSE : TRUE;
931
+			$show_create = count($prices) > 1 && count($prices) !== $prcrow ? FALSE : TRUE;
932
+			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create);
933 933
 			$prcrow++;
934 934
 		}
935 935
 
936 936
 		//filter $template_args
937
-		$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 );
937
+		$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);
938 938
 
939
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php';
940
-		return EEH_Template::display_template( $template, $template_args, TRUE );
939
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_row.template.php';
940
+		return EEH_Template::display_template($template, $template_args, TRUE);
941 941
 	}
942 942
 
943 943
 
944 944
 
945 945
 
946 946
 
947
-	private function _get_tax_rows( $tktrow, $ticket ) {
947
+	private function _get_tax_rows($tktrow, $ticket) {
948 948
 		$tax_rows = '';
949
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php';
949
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_tax_row.template.php';
950 950
 		$template_args = array();
951
-		$taxes = empty( $ticket ) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
952
-		foreach ( $taxes as $tax ) {
953
-			$tax_added = $this->_get_tax_added( $tax, $ticket );
951
+		$taxes = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
952
+		foreach ($taxes as $tax) {
953
+			$tax_added = $this->_get_tax_added($tax, $ticket);
954 954
 			$template_args = array(
955
-				'display_tax' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
955
+				'display_tax' => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
956 956
 				'tax_id' => $tax->ID(),
957 957
 				'tkt_row' => $tktrow,
958 958
 				'tax_label' => $tax->get('PRC_name'),
959 959
 				'tax_added' => $tax_added,
960
-				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE ),
960
+				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE),
961 961
 				'tax_amount' => $tax->get('PRC_amount')
962 962
 				);
963
-			$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event  );
964
-			$tax_rows .= EEH_Template::display_template( $template, $template_args, TRUE );
963
+			$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event);
964
+			$tax_rows .= EEH_Template::display_template($template, $template_args, TRUE);
965 965
 		}
966 966
 
967 967
 
@@ -969,81 +969,81 @@  discard block
 block discarded – undo
969 969
 	}
970 970
 
971 971
 
972
-	private function _get_tax_added( EE_Price $tax, $ticket ) {
973
-		$subtotal = empty( $ticket ) ? 0 : $ticket->get_ticket_subtotal();
972
+	private function _get_tax_added(EE_Price $tax, $ticket) {
973
+		$subtotal = empty($ticket) ? 0 : $ticket->get_ticket_subtotal();
974 974
 		return $subtotal * $tax->get('PRC_amount') / 100;
975 975
 	}
976 976
 
977 977
 
978 978
 
979 979
 
980
-	private function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) {
981
-		$send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
980
+	private function _get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE) {
981
+		$send_disabled = ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
982 982
 		$template_args = array(
983 983
 			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
984 984
 			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
985 985
 			'edit_prices_name' => $default && empty($price) ? 'PRICENAMEATTR' : 'edit_prices',
986
-			'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 ),
986
+			'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),
987 987
 			'PRC_ID' => $default && empty($price) ? 0 : $price->ID(),
988 988
 			'PRC_is_default' => $default && empty($price) ? 0 : $price->get('PRC_is_default'),
989 989
 			'PRC_name' => $default && empty($price) ? '' : $price->get('PRC_name'),
990 990
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
991 991
 			'show_plus_or_minus' => $default && empty($price) ? '' : ' style="display:none;"',
992
-			'show_plus' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
993
-			'show_minus' => $default && empty( $price ) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
994
-			'show_currency_symbol' => $default && empty( $price ) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : '' ),
995
-			'PRC_amount' => $default && empty( $price ) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
996
-			'show_percentage' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_percent() ? '' : ' style="display:none;"' ),
992
+			'show_plus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
993
+			'show_minus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
994
+			'show_currency_symbol' => $default && empty($price) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : ''),
995
+			'PRC_amount' => $default && empty($price) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
996
+			'show_percentage' => $default && empty($price) ? ' style="display:none;"' : ($price->is_percent() ? '' : ' style="display:none;"'),
997 997
 			'show_trash_icon' => $show_trash ? '' : ' style="display:none;"',
998 998
 			'show_create_button' => $show_create ? '' : ' style="display:none;"',
999
-			'PRC_desc' => $default && empty( $price ) ? '' : $price->get('PRC_desc'),
1000
-			'disabled' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE
999
+			'PRC_desc' => $default && empty($price) ? '' : $price->get('PRC_desc'),
1000
+			'disabled' => ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE
1001 1001
 			);
1002 1002
 
1003
-	$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 );
1003
+	$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);
1004 1004
 
1005
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php';
1006
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1005
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_price_row.template.php';
1006
+		return EEH_Template::display_template($template, $template_args, TRUE);
1007 1007
 	}
1008 1008
 
1009 1009
 
1010
-	private function _get_price_type_selector( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1011
-		if ( $price->is_base_price() ) {
1012
-			return $this->_get_base_price_template( $tktrow, $prcrow, $price, $default );
1010
+	private function _get_price_type_selector($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1011
+		if ($price->is_base_price()) {
1012
+			return $this->_get_base_price_template($tktrow, $prcrow, $price, $default);
1013 1013
 		} else {
1014
-			return $this->_get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled );
1014
+			return $this->_get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled);
1015 1015
 		}
1016 1016
 
1017 1017
 	}
1018 1018
 
1019 1019
 
1020
-	private function _get_base_price_template( $tktrow, $prcrow, $price, $default ) {
1020
+	private function _get_base_price_template($tktrow, $prcrow, $price, $default) {
1021 1021
 		$template_args = array(
1022 1022
 				'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1023
-				'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1024
-				'PRT_ID' => $default && empty( $price ) ? 1 : $price->get('PRT_ID'),
1023
+				'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1024
+				'PRT_ID' => $default && empty($price) ? 1 : $price->get('PRT_ID'),
1025 1025
 				'PRT_name' => __('Price', 'event_espresso'),
1026 1026
 				'price_selected_operator' => '+',
1027 1027
 				'price_selected_is_percent' => 0
1028 1028
 			);
1029
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php';
1029
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_type_base.template.php';
1030 1030
 
1031
-		$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 );
1031
+		$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);
1032 1032
 
1033
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1033
+		return EEH_Template::display_template($template, $template_args, TRUE);
1034 1034
 	}
1035 1035
 
1036 1036
 
1037 1037
 
1038
-	private function _get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1039
-		$select_name = $default && empty( $price ) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]';
1040
-		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array( array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3' ) ) ) );
1041
-		$price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php';
1042
-		$all_price_types = $default && empty( $price ) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso')) ) : array();
1043
-		$selected_price_type_id = $default && empty( $price ) ? 0 : $price->type();
1038
+	private function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1039
+		$select_name = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices['.$tktrow.']['.$prcrow.'][PRT_ID]';
1040
+		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array(array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3'))));
1041
+		$price_option_span_template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_option_span.template.php';
1042
+		$all_price_types = $default && empty($price) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso'))) : array();
1043
+		$selected_price_type_id = $default && empty($price) ? 0 : $price->type();
1044 1044
 		$price_option_spans = '';
1045 1045
 		//setup pricetypes for selector
1046
-		foreach ( $price_types as $price_type ) {
1046
+		foreach ($price_types as $price_type) {
1047 1047
 			$all_price_types[] = array(
1048 1048
 				'id' => $price_type->ID(),
1049 1049
 				'text' => $price_type->get('PRT_name'),
@@ -1055,50 +1055,50 @@  discard block
 block discarded – undo
1055 1055
 				'PRT_operator' => $price_type->is_discount() ? '-' : '+',
1056 1056
 				'PRT_is_percent' => $price_type->get('PRT_is_percent') ? 1 : 0
1057 1057
 				);
1058
-			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE );
1058
+			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE);
1059 1059
 		}
1060 1060
 
1061
-		$select_params = $disabled ? 'style="width:auto;" disabled'  : 'style="width:auto;"';
1061
+		$select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"';
1062 1062
 		$main_name = $select_name;
1063
-		$select_name = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name;
1063
+		$select_name = $disabled ? 'archive_price['.$tktrow.']['.$prcrow.'][PRT_ID]' : $main_name;
1064 1064
 
1065 1065
 		$template_args = array(
1066 1066
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1067
-			'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1068
-			'price_modifier_selector' => EEH_Form_Fields::select_input( $select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID' ),
1067
+			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1068
+			'price_modifier_selector' => EEH_Form_Fields::select_input($select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID'),
1069 1069
 			'main_name' => $main_name,
1070 1070
 			'selected_price_type_id' => $selected_price_type_id,
1071 1071
 			'price_option_spans' => $price_option_spans,
1072
-			'price_selected_operator' => $default && empty( $price ) ? '' : ( $price->is_discount() ? '-' : '+' ),
1073
-			'price_selected_is_percent' => $default && empty( $price ) ? '' : ( $price->is_percent() ? 1 : 0 ),
1072
+			'price_selected_operator' => $default && empty($price) ? '' : ($price->is_discount() ? '-' : '+'),
1073
+			'price_selected_is_percent' => $default && empty($price) ? '' : ($price->is_percent() ? 1 : 0),
1074 1074
 			'disabled' => $disabled
1075 1075
 			);
1076 1076
 
1077
-		$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 );
1077
+		$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);
1078 1078
 
1079
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php';
1079
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_modifier_selector.template.php';
1080 1080
 
1081
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1081
+		return EEH_Template::display_template($template, $template_args, TRUE);
1082 1082
 	}
1083 1083
 
1084 1084
 
1085 1085
 
1086
-	private function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) {
1087
-		$dttid = !empty($dtt) ? $dtt->ID() : 0;
1088
-		$displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0;
1089
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
1086
+	private function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default) {
1087
+		$dttid = ! empty($dtt) ? $dtt->ID() : 0;
1088
+		$displayrow = ! empty($dtt) ? $dtt->get('DTT_order') : 0;
1089
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1090 1090
 		$template_args = array(
1091
-			'dtt_row' => $default && empty( $dtt ) ? 'DTTNUM' : $dttrow,
1091
+			'dtt_row' => $default && empty($dtt) ? 'DTTNUM' : $dttrow,
1092 1092
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1093
-			'ticket_datetime_selected' => in_array( $displayrow, $tkt_dtts ) ? ' ticket-selected' : '',
1094
-			'ticket_datetime_checked' => in_array( $displayrow, $tkt_dtts ) ? ' checked="checked"' : '',
1095
-			'DTT_name' => $default && empty( $dtt ) ? 'DTTNAME' : $dtt->get_dtt_display_name( TRUE ),
1093
+			'ticket_datetime_selected' => in_array($displayrow, $tkt_dtts) ? ' ticket-selected' : '',
1094
+			'ticket_datetime_checked' => in_array($displayrow, $tkt_dtts) ? ' checked="checked"' : '',
1095
+			'DTT_name' => $default && empty($dtt) ? 'DTTNAME' : $dtt->get_dtt_display_name(TRUE),
1096 1096
 			'tkt_status_class' => '',
1097 1097
 			);
1098 1098
 
1099
-		$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 );
1100
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1101
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1099
+		$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);
1100
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1101
+		return EEH_Template::display_template($template, $template_args, TRUE);
1102 1102
 	}
1103 1103
 
1104 1104
 
@@ -1106,53 +1106,53 @@  discard block
 block discarded – undo
1106 1106
 	private function _get_ticket_js_structure($all_dtts, $all_tickets) {
1107 1107
 		$template_args = array(
1108 1108
 			'default_datetime_edit_row' => $this->_get_dtt_edit_row('DTTNUM', NULL, TRUE, $all_dtts),
1109
-			'default_ticket_row' => $this->_get_ticket_row( 'TICKETNUM', NULL, array(), array(), TRUE),
1110
-			'default_price_row' => $this->_get_ticket_price_row( 'TICKETNUM', 'PRICENUM', NULL, TRUE, NULL ),
1109
+			'default_ticket_row' => $this->_get_ticket_row('TICKETNUM', NULL, array(), array(), TRUE),
1110
+			'default_price_row' => $this->_get_ticket_price_row('TICKETNUM', 'PRICENUM', NULL, TRUE, NULL),
1111 1111
 			'default_price_rows' => '',
1112 1112
 			'default_base_price_amount' => 0,
1113 1113
 			'default_base_price_name' => '',
1114 1114
 			'default_base_price_description' => '',
1115
-			'default_price_modifier_selector_row' => $this->_get_price_modifier_template( 'TICKETNUM', 'PRICENUM', NULL, TRUE ),
1116
-			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row( 'DTTNUM', NULL, array(), array(), TRUE ),
1115
+			'default_price_modifier_selector_row' => $this->_get_price_modifier_template('TICKETNUM', 'PRICENUM', NULL, TRUE),
1116
+			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row('DTTNUM', NULL, array(), array(), TRUE),
1117 1117
 			'existing_available_datetime_tickets_list' => '',
1118 1118
 			'existing_available_ticket_datetimes_list' => '',
1119
-			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ),
1120
-			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE )
1119
+			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE),
1120
+			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE)
1121 1121
 			);
1122 1122
 
1123 1123
 		$tktrow = 1;
1124
-		foreach ( $all_tickets as $ticket ) {
1125
-			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( 'DTTNUM', $tktrow, NULL, $ticket, array(), TRUE );
1124
+		foreach ($all_tickets as $ticket) {
1125
+			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item('DTTNUM', $tktrow, NULL, $ticket, array(), TRUE);
1126 1126
 			$tktrow++;
1127 1127
 		}
1128 1128
 
1129 1129
 
1130 1130
 		$dttrow = 1;
1131
-		foreach ( $all_dtts as $dtt ) {
1132
-			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE );
1131
+		foreach ($all_dtts as $dtt) {
1132
+			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE);
1133 1133
 			$dttrow++;
1134 1134
 		}
1135 1135
 
1136 1136
 		$default_prices = EE_Registry::instance()->load_model('Price')->get_all_default_prices();
1137 1137
 		$prcrow = 1;
1138
-		foreach ( $default_prices as $price ) {
1139
-			if ( $price->is_base_price() ) {
1138
+		foreach ($default_prices as $price) {
1139
+			if ($price->is_base_price()) {
1140 1140
 				$template_args['default_base_price_amount'] = $price->get_pretty('PRC_amount', 'localized_float');
1141 1141
 				$template_args['default_base_price_name'] = $price->get('PRC_name');
1142 1142
 				$template_args['default_base_price_description'] = $price->get('PRC_desc');
1143 1143
 				$prcrow++;
1144 1144
 				continue;
1145 1145
 			}
1146
-			$show_trash = ( count( $default_prices ) > 1 && $prcrow === 1 ) || count( $default_prices ) === 1  ? FALSE : TRUE;
1147
-			$show_create = count( $default_prices ) > 1 && count( $default_prices ) !== $prcrow ? FALSE : TRUE;
1148
-			$template_args['default_price_rows'] .= $this->_get_ticket_price_row( 'TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create );
1146
+			$show_trash = (count($default_prices) > 1 && $prcrow === 1) || count($default_prices) === 1 ? FALSE : TRUE;
1147
+			$show_create = count($default_prices) > 1 && count($default_prices) !== $prcrow ? FALSE : TRUE;
1148
+			$template_args['default_price_rows'] .= $this->_get_ticket_price_row('TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create);
1149 1149
 			$prcrow++;
1150 1150
 		}
1151 1151
 
1152
-		$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 );
1152
+		$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);
1153 1153
 
1154
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php';
1155
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1154
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_js_structure.template.php';
1155
+		return EEH_Template::display_template($template, $template_args, TRUE);
1156 1156
 	}
1157 1157
 
1158 1158
 
Please login to merge, or discard this patch.
new/pricing/help_tours/Pricing_Add_New_Default_Price_Help_Tour.class.php 2 patches
Spacing   +7 added lines, -7 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
 /**
@@ -78,25 +78,25 @@  discard block
 block discarded – undo
78 78
 
79 79
 
80 80
 	protected function _start() {
81
-		$content = '<h3>' . __('Add New Default Price', 'event_espresso') . '</h3>';
82
-		$content .= '<p>' . __('This tour of the add new default price page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso') . '</p>';
81
+		$content = '<h3>'.__('Add New Default Price', 'event_espresso').'</h3>';
82
+		$content .= '<p>'.__('This tour of the add new default price page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso').'</p>';
83 83
 		return $content;
84 84
 	}
85 85
 
86 86
 	protected function _price_type_stop() {
87
-		return '<p>' . __('Price Types are a way of categorizing a price, discount, tax, or surcharge and indicating how it gets applied to a running total when a transaction occurs.', 'event_espresso') . '</p>';
87
+		return '<p>'.__('Price Types are a way of categorizing a price, discount, tax, or surcharge and indicating how it gets applied to a running total when a transaction occurs.', 'event_espresso').'</p>';
88 88
 	}
89 89
 
90 90
 	protected function _price_name_stop() {
91
-		return '<p>' . __('The name of the price, discount, tax, or surcharge that will be seen by your customers.', 'event_espresso') . '</p>';
91
+		return '<p>'.__('The name of the price, discount, tax, or surcharge that will be seen by your customers.', 'event_espresso').'</p>';
92 92
 	}
93 93
 
94 94
 	protected function _price_description_stop() {
95
-		return '<p>' . __('View the price type (price, discount, tax or surcharge) description.', 'event_espresso') . '</p>';
95
+		return '<p>'.__('View the price type (price, discount, tax or surcharge) description.', 'event_espresso').'</p>';
96 96
 	}
97 97
 
98 98
 	protected function _price_amount_stop() {
99
-		return '<p>' . __('The ticket amount before any deductions.', 'event_espresso') . '</p>';
99
+		return '<p>'.__('The ticket amount before any deductions.', 'event_espresso').'</p>';
100 100
 	}
101 101
 
102 102
 }
103 103
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
admin/new/pricing/help_tours/Pricing_Add_New_Price_Type_Help_Tour.class.php 2 patches
Spacing   +7 added lines, -7 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
 /**
@@ -78,25 +78,25 @@  discard block
 block discarded – undo
78 78
 
79 79
 
80 80
 	protected function _start() {
81
-		$content = '<h3>' . __('Add New Price Type', 'event_espresso') . '</h3>';
82
-		$content .= '<p>' . __('This tour of the Add New Price Type page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso') . '</p>';
81
+		$content = '<h3>'.__('Add New Price Type', 'event_espresso').'</h3>';
82
+		$content .= '<p>'.__('This tour of the Add New Price Type page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso').'</p>';
83 83
 		return $content;
84 84
 	}
85 85
 	
86 86
 	protected function _basic_type_stop() {
87
-		return '<p>' . __('Set a price type to be a discount, surcharge, or tax.', 'event_espresso') . '</p>';
87
+		return '<p>'.__('Set a price type to be a discount, surcharge, or tax.', 'event_espresso').'</p>';
88 88
 	}
89 89
 
90 90
 	protected function _price_type_name_stop() {
91
-		return '<p>' . __('The name of the price type.', 'event_espresso') . '</p>';
91
+		return '<p>'.__('The name of the price type.', 'event_espresso').'</p>';
92 92
 	}
93 93
 
94 94
 	protected function _percentage_dollar_amount_stop() {
95
-		return '<p>' . __('Set a price type to be percentage-based or a fixed amount.', 'event_espresso') . '</p>';
95
+		return '<p>'.__('Set a price type to be percentage-based or a fixed amount.', 'event_espresso').'</p>';
96 96
 	}
97 97
 
98 98
 	protected function _order_of_application_stop() {
99
-		return '<p>' . __('Set the order of application for a price type.', 'event_espresso') . '</p>';
99
+		return '<p>'.__('Set the order of application for a price type.', 'event_espresso').'</p>';
100 100
 	}
101 101
 
102 102
 }
103 103
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
admin/new/pricing/help_tours/Pricing_Default_Prices_Help_Tour.class.php 2 patches
Spacing   +9 added lines, -9 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
 /**
@@ -99,33 +99,33 @@  discard block
 block discarded – undo
99 99
 
100 100
 
101 101
 	protected function _start() {
102
-		$content = '<h3>' . __('Default Pricing', 'event_espresso') . '</h3>';
103
-		$content .= '<p>' . __('This tour of the Default Pricing page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso') . '</p>';
102
+		$content = '<h3>'.__('Default Pricing', 'event_espresso').'</h3>';
103
+		$content .= '<p>'.__('This tour of the Default Pricing page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso').'</p>';
104 104
 		return $content;
105 105
 	}
106 106
 
107 107
 	protected function _name_column_stop() {
108
-		return '<p>' . __('The name of the price, discount, tax, or surcharge that will be seen by your customers. Can be sorted in ascending or descending order.', 'event_espresso') . '</p>';
108
+		return '<p>'.__('The name of the price, discount, tax, or surcharge that will be seen by your customers. Can be sorted in ascending or descending order.', 'event_espresso').'</p>';
109 109
 	}
110 110
 
111 111
 	protected function _type_column_stop() {
112
-		return '<p>' . __('Price Types are a way of categorizing a price, discount, tax, or surcharge and indicating how it gets applied to a running total when a transaction occurs. Can be sorted in ascending or descending order.', 'event_espresso') . '</p>';
112
+		return '<p>'.__('Price Types are a way of categorizing a price, discount, tax, or surcharge and indicating how it gets applied to a running total when a transaction occurs. Can be sorted in ascending or descending order.', 'event_espresso').'</p>';
113 113
 	}
114 114
 
115 115
 	protected function _description_column_stop() {
116
-		return '<p>' . __('View the price type (price, discount, tax or surcharge) description.', 'event_espresso') . '</p>';
116
+		return '<p>'.__('View the price type (price, discount, tax or surcharge) description.', 'event_espresso').'</p>';
117 117
 	}
118 118
 
119 119
 	protected function _amount_column_stop() {
120
-		return '<p>' . __('The ticket amount before any deductions. Can be sorted in ascending or descending order.', 'event_espresso') . '</p>';
120
+		return '<p>'.__('The ticket amount before any deductions. Can be sorted in ascending or descending order.', 'event_espresso').'</p>';
121 121
 	}
122 122
 
123 123
 	protected function _bulk_actions_stop() {
124
-		return '<p>' . __('Perform bulk actions to multiple price types.', 'event_espresso') . '</p>';
124
+		return '<p>'.__('Perform bulk actions to multiple price types.', 'event_espresso').'</p>';
125 125
 	}
126 126
 
127 127
 	protected function _search_stop() {
128
-		return '<p>' . __('Search through default pricing. The following sources will be searched: Price Name, Price Type, Price Description, and Price Amount.', 'event_espresso') . '</p>';
128
+		return '<p>'.__('Search through default pricing. The following sources will be searched: Price Name, Price Type, Price Description, and Price Amount.', 'event_espresso').'</p>';
129 129
 	}
130 130
 
131 131
 }
132 132
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
admin/new/pricing/help_tours/Pricing_Edit_Default_Price_Help_Tour.class.php 2 patches
Spacing   +7 added lines, -7 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
 /**
@@ -78,25 +78,25 @@  discard block
 block discarded – undo
78 78
 
79 79
 
80 80
 	protected function _start() {
81
-		$content = '<h3>' . __('Edit Default Price', 'event_espresso') . '</h3>';
82
-		$content .= '<p>' . __('This tour of the Edit Default Price page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso') . '</p>';
81
+		$content = '<h3>'.__('Edit Default Price', 'event_espresso').'</h3>';
82
+		$content .= '<p>'.__('This tour of the Edit Default Price page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso').'</p>';
83 83
 		return $content;
84 84
 	}
85 85
 
86 86
 	protected function _price_type_stop() {
87
-		return '<p>' . __('Price Types are a way of categorizing a price, discount, tax, or surcharge and indicating how it gets applied to a running total when a transaction occurs.', 'event_espresso') . '</p>';
87
+		return '<p>'.__('Price Types are a way of categorizing a price, discount, tax, or surcharge and indicating how it gets applied to a running total when a transaction occurs.', 'event_espresso').'</p>';
88 88
 	}
89 89
 
90 90
 	protected function _price_name_stop() {
91
-		return '<p>' . __('The name of the price, discount, tax, or surcharge that will be seen by your customers.', 'event_espresso') . '</p>';
91
+		return '<p>'.__('The name of the price, discount, tax, or surcharge that will be seen by your customers.', 'event_espresso').'</p>';
92 92
 	}
93 93
 
94 94
 	protected function _price_description_stop() {
95
-		return '<p>' . __('View the price type (price, discount, tax or surcharge) description.', 'event_espresso') . '</p>';
95
+		return '<p>'.__('View the price type (price, discount, tax or surcharge) description.', 'event_espresso').'</p>';
96 96
 	}
97 97
 
98 98
 	protected function _price_amount_stop() {
99
-		return '<p>' . __('The ticket amount before any deductions.', 'event_espresso') . '</p>';
99
+		return '<p>'.__('The ticket amount before any deductions.', 'event_espresso').'</p>';
100 100
 	}
101 101
 
102 102
 }
103 103
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
admin/new/pricing/help_tours/Pricing_Edit_Price_Type_Help_Tour.class.php 2 patches
Spacing   +7 added lines, -7 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
 /**
@@ -78,25 +78,25 @@  discard block
 block discarded – undo
78 78
 
79 79
 
80 80
 	protected function _start() {
81
-		$content = '<h3>' . __('Edit Price Type', 'event_espresso') . '</h3>';
82
-		$content .= '<p>' . __('This tour of the Edit Price Type page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso') . '</p>';
81
+		$content = '<h3>'.__('Edit Price Type', 'event_espresso').'</h3>';
82
+		$content .= '<p>'.__('This tour of the Edit Price Type page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso').'</p>';
83 83
 		return $content;
84 84
 	}
85 85
 
86 86
 	protected function _basic_type_stop() {
87
-		return '<p>' . __('Set a price type to be a discount, surcharge, or tax.', 'event_espresso') . '</p>';
87
+		return '<p>'.__('Set a price type to be a discount, surcharge, or tax.', 'event_espresso').'</p>';
88 88
 	}
89 89
 
90 90
 	protected function _price_type_name_stop() {
91
-		return '<p>' . __('The name of the price type.', 'event_espresso') . '</p>';
91
+		return '<p>'.__('The name of the price type.', 'event_espresso').'</p>';
92 92
 	}
93 93
 
94 94
 	protected function _percentage_dollar_amount_stop() {
95
-		return '<p>' . __('Set a price type to be percentage-based or a fixed amount.', 'event_espresso') . '</p>';
95
+		return '<p>'.__('Set a price type to be percentage-based or a fixed amount.', 'event_espresso').'</p>';
96 96
 	}
97 97
 
98 98
 	protected function _order_of_application_stop() {
99
-		return '<p>' . __('Set the order of application for a price type.', 'event_espresso') . '</p>';
99
+		return '<p>'.__('Set the order of application for a price type.', 'event_espresso').'</p>';
100 100
 	}
101 101
 
102 102
 }
103 103
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
new/pricing/help_tours/Pricing_Price_Types_Default_Help_Tour.class.php 2 patches
Spacing   +10 added lines, -10 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
 /**
@@ -99,37 +99,37 @@  discard block
 block discarded – undo
99 99
 
100 100
 
101 101
 	protected function _start() {
102
-		$content = '<h3>' . __('Price Types', 'event_espresso') . '</h3>';
103
-		$content .= '<p>' . __('This tour of the Price Types page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso') . '</p>';
102
+		$content = '<h3>'.__('Price Types', 'event_espresso').'</h3>';
103
+		$content .= '<p>'.__('This tour of the Price Types page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso').'</p>';
104 104
 		return $content;
105 105
 	}
106 106
 
107 107
 	protected function _name_column_stop() {
108
-		return '<p>' . __('The name of the price type. Can be sorted in ascending or descending order.', 'event_espresso') . '</p>';
108
+		return '<p>'.__('The name of the price type. Can be sorted in ascending or descending order.', 'event_espresso').'</p>';
109 109
 	}
110 110
 
111 111
 	protected function _base_type_stop() {
112
-		return '<p>' . __('View if a price type is a discount, surcharge, or tax.', 'event_espresso') . '</p>';
112
+		return '<p>'.__('View if a price type is a discount, surcharge, or tax.', 'event_espresso').'</p>';
113 113
 	}
114 114
 
115 115
 	protected function _member_column_stop() {
116
-		return '<p>' . __('Here you can see if the discount/surcharge is percentage based or a flat monetary amount.', 'event_espresso') . '</p>';
116
+		return '<p>'.__('Here you can see if the discount/surcharge is percentage based or a flat monetary amount.', 'event_espresso').'</p>';
117 117
 	}
118 118
 
119 119
 	protected function _percent_column_stop() {
120
-		return '<p>' . __('View if the discount, surcharge, or tax is percentage-based or a fixed amount.', 'event_espresso') . '</p>';
120
+		return '<p>'.__('View if the discount, surcharge, or tax is percentage-based or a fixed amount.', 'event_espresso').'</p>';
121 121
 	}
122 122
 
123 123
 	protected function _order_column_stop() {
124
-		return '<p>' . __('View the order in which each discount, surcharge, or tax will be applied to the base ticket cost. Zero (0) means it will be applied first.', 'event_espresso') . '</p>';
124
+		return '<p>'.__('View the order in which each discount, surcharge, or tax will be applied to the base ticket cost. Zero (0) means it will be applied first.', 'event_espresso').'</p>';
125 125
 	}
126 126
 
127 127
 	protected function _bulk_actions_stop() {
128
-		return '<p>' . __('Perform bulk actions to multiple price types.', 'event_espresso') . '</p>';
128
+		return '<p>'.__('Perform bulk actions to multiple price types.', 'event_espresso').'</p>';
129 129
 	}
130 130
 
131 131
 	protected function _search_stop() {
132
-		return '<p>' . __('Search through price types. The following source will be searched: Price Type Name.', 'event_espresso') . '</p>';
132
+		return '<p>'.__('Search through price types. The following source will be searched: Price Type Name.', 'event_espresso').'</p>';
133 133
 	}
134 134
 
135 135
 }
136 136
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
pricing/templates/event_tickets_datetime_attached_tickets_row.template.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
 				</table>
52 52
 				<div class="ee-editor-footer-container">
53 53
 					<div class="ee-editor-id-container">
54
-						<span class="ee-item-id"><?php echo $DTT_ID ? 'Datetime ID: ' . $DTT_ID : ''; ?></span>
54
+						<span class="ee-item-id"><?php echo $DTT_ID ? 'Datetime ID: '.$DTT_ID : ''; ?></span>
55 55
 					</div>
56 56
 					<div class="save-cancel-button-container">
57 57
 						<button data-context="short-ticket" data-datetime-row="<?php echo $dtt_row; ?>" class="button-primary ee-create-button">
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -71,12 +71,12 @@
 block discarded – undo
71 71
 
72 72
 <?php 
73 73
 /**
74
- * template args used
75
- *
76
- * $dtt_row
77
- * $DTT_description
78
- * $show_tickets_row
79
- * $datetime_tickets_list
80
- * $add_new_datetime_ticket_help_link
81
- * $DTT_ID
82
- */
83 74
\ No newline at end of file
75
+					 * template args used
76
+					 *
77
+					 * $dtt_row
78
+					 * $DTT_description
79
+					 * $show_tickets_row
80
+					 * $datetime_tickets_list
81
+					 * $add_new_datetime_ticket_help_link
82
+					 * $DTT_ID
83
+					 */
84 84
\ No newline at end of file
Please login to merge, or discard this patch.
templates/event_tickets_datetime_price_modifier_selector.template.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php echo $price_modifier_selector; ?>
2
-<?php if ( $disabled ) : ?>
2
+<?php if ($disabled) : ?>
3 3
 	<input type="hidden" name="<?php echo $main_name; ?>" value="<?php echo $selected_price_type_id; ?>">
4 4
 <?php endif; ?>
5 5
 
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,15 +11,15 @@
 block discarded – undo
11 11
 
12 12
 <?php
13 13
 /**
14
- * template args in use
15
- *
16
- * $tkt_row
17
- * $PRC_order
18
- * $price_modifier_selector
19
- * $price_option_spans;
20
- * $price_selected_operator
21
- * $price_selected_is_percent
22
- * $main_name
23
- * $selected_price_type_id
24
- * $disabled
25
- */
26 14
\ No newline at end of file
15
+					 * template args in use
16
+					 *
17
+					 * $tkt_row
18
+					 * $PRC_order
19
+					 * $price_modifier_selector
20
+					 * $price_option_spans;
21
+					 * $price_selected_operator
22
+					 * $price_selected_is_percent
23
+					 * $main_name
24
+					 * $selected_price_type_id
25
+					 * $disabled
26
+					 */
27 27
\ No newline at end of file
Please login to merge, or discard this patch.