Completed
Branch FET-9643-checkin-system-docume... (5f5a9c)
by
unknown
200:04 queued 188:44
created
caffeinated/admin/new/pricing/espresso_events_Pricing_Hooks.class.php 3 patches
Doc Comments   +18 added lines, -1 removed lines patch added patch discarded remove patch
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * Handles saving everything related to Tickets (datetimes, tickets, prices)
182 182
 	 * @param  EE_Event $evtobj The Event object we're attaching data to
183 183
 	 * @param  array    $data   The request data from the form
184
-	 * @return bool             success or fail
184
+	 * @return boolean|null             success or fail
185 185
 	 */
186 186
 	public function dtt_and_tickets_caf_update( $evtobj, $data ) {
187 187
 		//first we need to start with datetimes cause they are the "root" items attached to events.
@@ -879,6 +879,9 @@  discard block
 block discarded – undo
879 879
 
880 880
 
881 881
 
882
+	/**
883
+	 * @param integer $dttrow
884
+	 */
882 885
 	protected function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) {
883 886
 
884 887
 		$dtt_display_template_args = array(
@@ -902,6 +905,7 @@  discard block
 block discarded – undo
902 905
 	 *                               				object.
903 906
 	 * @param bool   $default  		         Whether a default row is being generated or not.
904 907
 	 * @param EE_Datetime[] $all_dtts             This is the array of all datetimes used in the editor.
908
+	 * @param EE_Datetime|null $dtt
905 909
 	 *
906 910
 	 * @return string Generated edit row.
907 911
 	 */
@@ -936,6 +940,10 @@  discard block
 block discarded – undo
936 940
 	}
937 941
 
938 942
 
943
+	/**
944
+	 * @param EE_Datetime|null $dtt
945
+	 * @param boolean $default
946
+	 */
939 947
 	protected function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) {
940 948
 
941 949
 		$template_args = array(
@@ -1142,6 +1150,9 @@  discard block
 block discarded – undo
1142 1150
 
1143 1151
 
1144 1152
 
1153
+	/**
1154
+	 * @param integer $tktrow
1155
+	 */
1145 1156
 	protected function _get_tax_rows( $tktrow, $ticket ) {
1146 1157
 		$tax_rows = '';
1147 1158
 		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php';
@@ -1175,6 +1186,9 @@  discard block
 block discarded – undo
1175 1186
 
1176 1187
 
1177 1188
 
1189
+	/**
1190
+	 * @param boolean $default
1191
+	 */
1178 1192
 	protected function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) {
1179 1193
 		$send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1180 1194
 		$template_args = array(
@@ -1281,6 +1295,9 @@  discard block
 block discarded – undo
1281 1295
 
1282 1296
 
1283 1297
 
1298
+	/**
1299
+	 * @param boolean $default
1300
+	 */
1284 1301
 	protected function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) {
1285 1302
 		$dttid = !empty($dtt) ? $dtt->ID() : 0;
1286 1303
 		$displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0;
Please login to merge, or discard this patch.
Spacing   +383 added lines, -383 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -54,23 +54,23 @@  discard block
 block discarded – undo
54 54
 		$this->_name = 'pricing';
55 55
 
56 56
 		//capability check
57
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_default_prices', 'advanced_ticket_datetime_metabox' ) ) {
57
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_default_prices', 'advanced_ticket_datetime_metabox')) {
58 58
 			return;
59 59
 		}
60 60
 
61
-		EE_Registry::instance()->load_helper( 'DTT_Helper' );
61
+		EE_Registry::instance()->load_helper('DTT_Helper');
62 62
 
63 63
 		//if we were going to add our own metaboxes we'd use the below.
64 64
 		$this->_metaboxes = array(
65 65
 			0 => array(
66
-				'page_route' => array('edit','create_new'),
66
+				'page_route' => array('edit', 'create_new'),
67 67
 				'func' => 'pricing_metabox',
68 68
 				'label' => __('Event Tickets & Datetimes', 'event_espresso'),
69 69
 				'priority' => 'high',
70 70
 				'context' => 'normal'
71 71
 				),
72 72
 
73
-			);/**/
73
+			); /**/
74 74
 
75 75
 		$this->_remove_metaboxes = array(
76 76
 			0 => array(
@@ -89,24 +89,24 @@  discard block
 block discarded – undo
89 89
 		 *
90 90
 		 * @var array  Expected an array returned with 'date' and 'time' keys.
91 91
 		 */
92
-		$this->_date_format_strings = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array(
92
+		$this->_date_format_strings = apply_filters('FHEE__espresso_events_Pricing_Hooks___set_hooks_properties__date_format_strings', array(
93 93
 				'date' => 'Y-m-d',
94 94
 				'time' => 'h:i a'
95 95
 			));
96 96
 
97 97
 		//validate
98
-		$this->_date_format_strings['date'] = isset( $this->_date_format_strings['date'] ) ? $this->_date_format_strings['date'] : null;
99
-		$this->_date_format_strings['time'] = isset( $this->_date_format_strings['time'] ) ? $this->_date_format_strings['time'] : null;
98
+		$this->_date_format_strings['date'] = isset($this->_date_format_strings['date']) ? $this->_date_format_strings['date'] : null;
99
+		$this->_date_format_strings['time'] = isset($this->_date_format_strings['time']) ? $this->_date_format_strings['time'] : null;
100 100
 
101 101
 		//validate format strings
102
-		$format_validation = EEH_DTT_Helper::validate_format_string( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
103
-		if ( is_array( $format_validation ) ) {
104
-			$msg = '<p>' . sprintf( __( 'The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso' ), $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ) . '</p><ul>';
105
-			foreach ( $format_validation as $error ) {
106
-				$msg .= '<li>' . $error . '</li>';
102
+		$format_validation = EEH_DTT_Helper::validate_format_string($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
103
+		if (is_array($format_validation)) {
104
+			$msg = '<p>'.sprintf(__('The format "%s" was likely added via a filter and is invalid for the following reasons:', 'event_espresso'), $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']).'</p><ul>';
105
+			foreach ($format_validation as $error) {
106
+				$msg .= '<li>'.$error.'</li>';
107 107
 			}
108
-			$msg .= '</ul></p><p>' . sprintf( __( '%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso' ), '<span style="color:#D54E21;">', '</span>' ) . '</p>';
109
-			EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ );
108
+			$msg .= '</ul></p><p>'.sprintf(__('%sPlease note that your date and time formats have been reset to "Y-m-d" and "h:i a" respectively.%s', 'event_espresso'), '<span style="color:#D54E21;">', '</span>').'</p>';
109
+			EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__);
110 110
 			$this->_date_format_strings = array(
111 111
 				'date' => 'Y-m-d',
112 112
 				'time' => 'h:i a'
@@ -117,60 +117,60 @@  discard block
 block discarded – undo
117 117
 		$this->_scripts_styles = array(
118 118
 			'registers' => array(
119 119
 				'ee-tickets-datetimes-css' => array(
120
-					'url' => PRICING_ASSETS_URL . 'event-tickets-datetimes.css',
120
+					'url' => PRICING_ASSETS_URL.'event-tickets-datetimes.css',
121 121
 					'type' => 'css'
122 122
 					),
123 123
 				'ee-dtt-ticket-metabox' => array(
124
-					'url' => PRICING_ASSETS_URL . 'ee-datetime-ticket-metabox.js',
124
+					'url' => PRICING_ASSETS_URL.'ee-datetime-ticket-metabox.js',
125 125
 					'depends' => array('ee-datepicker', 'ee-dialog', 'underscore')
126 126
 					)
127 127
 				),
128 128
 			'deregisters' => array(
129
-				'event-editor-css' => array('type' => 'css' ),
129
+				'event-editor-css' => array('type' => 'css'),
130 130
 				'event-datetime-metabox' => array('type' => 'js')
131 131
 				),
132 132
 			'enqueues' => array(
133
-				'ee-tickets-datetimes-css' => array( 'edit', 'create_new' ),
134
-				'ee-dtt-ticket-metabox' => array( 'edit', 'create_new' )
133
+				'ee-tickets-datetimes-css' => array('edit', 'create_new'),
134
+				'ee-dtt-ticket-metabox' => array('edit', 'create_new')
135 135
 				),
136 136
 			'localize' => array(
137 137
 				'ee-dtt-ticket-metabox' => array(
138 138
 					'DTT_TRASH_BLOCK' => array(
139 139
 						'main_warning' => __('The Datetime you are attempting to trash is the only datetime selected for the following ticket(s):', 'event_espresso'),
140 140
 						'after_warning' => __('In order to trash this datetime you must first make sure the above ticket(s) are assigned to other datetimes.', 'event_espresso'),
141
-						'cancel_button' => '<button class="button-secondary ee-modal-cancel">' . __('Cancel', 'event_espresso') . '</button>',
141
+						'cancel_button' => '<button class="button-secondary ee-modal-cancel">'.__('Cancel', 'event_espresso').'</button>',
142 142
 						'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'),
143 143
 						'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'),
144
-						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button>'
144
+						'dismiss_button' => '<button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button>'
145 145
 						),
146 146
 					'DTT_ERROR_MSG' => array(
147 147
 						'no_ticket_name' => __('General Admission', 'event_espresso'),
148
-						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">' . __('Dismiss', 'event_espresso') . '</button></div>'
148
+						'dismiss_button' => '<div class="save-cancel-button-container"><button class="button-secondary ee-modal-cancel">'.__('Dismiss', 'event_espresso').'</button></div>'
149 149
 						),
150 150
 					'DTT_OVERSELL_WARNING' => array(
151 151
 						'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'),
152 152
 						'ticket_datetime' => __('You cannot add this datetime to this ticket because the ticket has a sold amount that is greater than the amount of spots remaining on the datetime.', 'event_espresso')
153 153
 						),
154
-					'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats( $this->_date_format_strings['date'], $this->_date_format_strings['time'] ),
155
-					'DTT_START_OF_WEEK' => array( 'dayValue' => (int) get_option( 'start_of_week' ) )
154
+					'DTT_CONVERTED_FORMATS' => EEH_DTT_Helper::convert_php_to_js_and_moment_date_formats($this->_date_format_strings['date'], $this->_date_format_strings['time']),
155
+					'DTT_START_OF_WEEK' => array('dayValue' => (int) get_option('start_of_week'))
156 156
 					)
157 157
 				)
158 158
 			);
159 159
 
160 160
 
161
-		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array( $this, 'autosave_handling' ), 10 );
162
-		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 );
161
+		add_action('AHEE__EE_Admin_Page_CPT__do_extra_autosave_stuff__after_Extend_Events_Admin_Page', array($this, 'autosave_handling'), 10);
162
+		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10);
163 163
 	}
164 164
 
165 165
 
166 166
 
167
-	public function caf_updates( $update_callbacks ) {
168
-		foreach ( $update_callbacks as $key => $callback ) {
169
-			if ( $callback[1] == '_default_tickets_update' )
170
-				unset( $update_callbacks[$key] );
167
+	public function caf_updates($update_callbacks) {
168
+		foreach ($update_callbacks as $key => $callback) {
169
+			if ($callback[1] == '_default_tickets_update')
170
+				unset($update_callbacks[$key]);
171 171
 		}
172 172
 
173
-		$update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' );
173
+		$update_callbacks[] = array($this, 'dtt_and_tickets_caf_update');
174 174
 		return $update_callbacks;
175 175
 	}
176 176
 
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 	 * @param  array    $data   The request data from the form
184 184
 	 * @return bool             success or fail
185 185
 	 */
186
-	public function dtt_and_tickets_caf_update( $evtobj, $data ) {
186
+	public function dtt_and_tickets_caf_update($evtobj, $data) {
187 187
 		//first we need to start with datetimes cause they are the "root" items attached to events.
188
-		$saved_dtts = $this->_update_dtts( $evtobj, $data );
188
+		$saved_dtts = $this->_update_dtts($evtobj, $data);
189 189
 		//next tackle the tickets (and prices?)
190
-		$this->_update_tkts( $evtobj, $saved_dtts, $data );
190
+		$this->_update_tkts($evtobj, $saved_dtts, $data);
191 191
 	}
192 192
 
193 193
 
@@ -198,41 +198,41 @@  discard block
 block discarded – undo
198 198
 	 * @param  array    	$data    the request data from the form
199 199
 	 * @return EE_Datetime[]
200 200
 	 */
201
-	protected function _update_dtts( $evt_obj, $data ) {
202
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
201
+	protected function _update_dtts($evt_obj, $data) {
202
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
203 203
 		$saved_dtt_ids = array();
204 204
 		$saved_dtt_objs = array();
205 205
 
206
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
206
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
207 207
 			//trim all values to ensure any excess whitespace is removed.
208 208
 			$dtt = array_map(
209
-				function( $datetime_data ) {
210
-					return is_array( $datetime_data ) ? $datetime_data : trim( $datetime_data );
209
+				function($datetime_data) {
210
+					return is_array($datetime_data) ? $datetime_data : trim($datetime_data);
211 211
 				},
212 212
 				$dtt
213 213
 			);
214
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
214
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
215 215
 			$datetime_values = array(
216
-				'DTT_ID' 			=> ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
217
-				'DTT_name' 			=> ! empty( $dtt['DTT_name'] ) ? $dtt['DTT_name'] : '',
218
-				'DTT_description' 	=> ! empty( $dtt['DTT_description'] ) ? $dtt['DTT_description'] : '',
216
+				'DTT_ID' 			=> ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
217
+				'DTT_name' 			=> ! empty($dtt['DTT_name']) ? $dtt['DTT_name'] : '',
218
+				'DTT_description' 	=> ! empty($dtt['DTT_description']) ? $dtt['DTT_description'] : '',
219 219
 				'DTT_EVT_start' 	=> $dtt['DTT_EVT_start'],
220 220
 				'DTT_EVT_end' 		=> $dtt['DTT_EVT_end'],
221
-				'DTT_reg_limit' 	=> empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt[ 'DTT_reg_limit' ],
222
-				'DTT_order' 		=> ! isset( $dtt['DTT_order'] ) ? $row : $dtt['DTT_order'],
221
+				'DTT_reg_limit' 	=> empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
222
+				'DTT_order' 		=> ! isset($dtt['DTT_order']) ? $row : $dtt['DTT_order'],
223 223
 			);
224 224
 
225 225
 			//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.
226 226
 
227
-			if ( !empty( $dtt['DTT_ID'] ) ) {
228
-				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) )->get_one_by_ID($dtt['DTT_ID'] );
227
+			if ( ! empty($dtt['DTT_ID'])) {
228
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone))->get_one_by_ID($dtt['DTT_ID']);
229 229
 
230 230
 				//set date and time format according to what is set in this class.
231
-				$DTM->set_date_format( $this->_date_format_strings['date'] );
232
-				$DTM->set_time_format( $this->_date_format_strings['time'] );
231
+				$DTM->set_date_format($this->_date_format_strings['date']);
232
+				$DTM->set_time_format($this->_date_format_strings['time']);
233 233
 
234
-				foreach ( $datetime_values as $field => $value ) {
235
-					$DTM->set( $field, $value );
234
+				foreach ($datetime_values as $field => $value) {
235
+					$DTM->set($field, $value);
236 236
 				}
237 237
 
238 238
 				// make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.
@@ -240,24 +240,24 @@  discard block
 block discarded – undo
240 240
 				$saved_dtt_ids[$DTM->ID()] = $DTM->ID();
241 241
 
242 242
 			} else {
243
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values, $timezone ), FALSE, FALSE );
243
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values, $timezone), FALSE, FALSE);
244 244
 
245 245
 				//reset date and times to match the format
246
-				$DTM->set_date_format( $this->_date_format_strings['date'] );
247
-				$DTM->set_time_format( $this->_date_format_strings['time'] );
248
-				foreach( $datetime_values as $field => $value ) {
249
-					$DTM->set( $field, $value );
246
+				$DTM->set_date_format($this->_date_format_strings['date']);
247
+				$DTM->set_time_format($this->_date_format_strings['time']);
248
+				foreach ($datetime_values as $field => $value) {
249
+					$DTM->set($field, $value);
250 250
 				}
251 251
 			}
252 252
 
253 253
 
254 254
 			$DTM->save();
255
-			$DTM = $evt_obj->_add_relation_to( $DTM, 'Datetime' );
255
+			$DTM = $evt_obj->_add_relation_to($DTM, 'Datetime');
256 256
 			$evt_obj->save();
257 257
 
258 258
 			//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.
259
-			if( $DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end') ) {
260
-				$DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start') );
259
+			if ($DTM->get_raw('DTT_EVT_start') > $DTM->get_raw('DTT_EVT_end')) {
260
+				$DTM->set('DTT_EVT_end', $DTM->get('DTT_EVT_start'));
261 261
 				EE_Registry::instance()->load_helper('DTT_Helper');
262 262
 				$DTM = EEH_DTT_Helper::date_time_add($DTM, 'DTT_EVT_end', 'days');
263 263
 				$DTM->save();
@@ -273,25 +273,25 @@  discard block
 block discarded – undo
273 273
 		}
274 274
 
275 275
 		//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.
276
-		$old_datetimes = explode(',', $data['datetime_IDs'] );
276
+		$old_datetimes = explode(',', $data['datetime_IDs']);
277 277
 		$old_datetimes = $old_datetimes[0] == '' ? array() : $old_datetimes;
278 278
 
279
-		if ( is_array( $old_datetimes ) ) {
280
-			$dtts_to_delete = array_diff( $old_datetimes, $saved_dtt_ids );
281
-			foreach ( $dtts_to_delete as $id ) {
282
-				$id = absint( $id );
283
-				if ( empty( $id ) )
279
+		if (is_array($old_datetimes)) {
280
+			$dtts_to_delete = array_diff($old_datetimes, $saved_dtt_ids);
281
+			foreach ($dtts_to_delete as $id) {
282
+				$id = absint($id);
283
+				if (empty($id))
284 284
 					continue;
285 285
 
286 286
 				$dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id);
287 287
 
288 288
 				//remove tkt relationships.
289 289
 				$related_tickets = $dtt_to_remove->get_many_related('Ticket');
290
-				foreach ( $related_tickets as $tkt ) {
290
+				foreach ($related_tickets as $tkt) {
291 291
 					$dtt_to_remove->_remove_relation_to($tkt, 'Ticket');
292 292
 				}
293 293
 
294
-				$evt_obj->_remove_relation_to( $id, 'Datetime' );
294
+				$evt_obj->_remove_relation_to($id, 'Datetime');
295 295
 				$dtt_to_remove->refresh_cache_of_related_objects();
296 296
 
297 297
 			}
@@ -312,86 +312,86 @@  discard block
 block discarded – undo
312 312
 	 * @param  array            $data       incoming request data
313 313
 	 * @return EE_Ticket[]
314 314
 	 */
315
-	protected function _update_tkts( $evtobj, $saved_dtts, $data ) {
315
+	protected function _update_tkts($evtobj, $saved_dtts, $data) {
316 316
 
317 317
 		$new_tkt = null;
318 318
 		$new_default = null;
319 319
 		//stripslashes because WP filtered the $_POST ($data) array to add slashes
320 320
 		$data = stripslashes_deep($data);
321
-		$timezone = isset( $data['timezone_string'] ) ? $data['timezone_string'] : NULL;
321
+		$timezone = isset($data['timezone_string']) ? $data['timezone_string'] : NULL;
322 322
 		$saved_tickets = $dtts_on_existing = array();
323
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
323
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
324 324
 
325 325
 		//load money helper
326
-		EE_Registry::instance()->load_helper( 'Money' );
326
+		EE_Registry::instance()->load_helper('Money');
327 327
 
328
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
328
+		foreach ($data['edit_tickets'] as $row => $tkt) {
329 329
 
330 330
 			$update_prices = $create_new_TKT = FALSE;
331 331
 
332 332
 			//figure out what dtts were added to the ticket and what dtts were removed from the ticket in the session.
333 333
 
334
-			$starting_tkt_dtt_rows = explode(',',$data['starting_ticket_datetime_rows'][$row]);
335
-			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row] );
334
+			$starting_tkt_dtt_rows = explode(',', $data['starting_ticket_datetime_rows'][$row]);
335
+			$tkt_dtt_rows = explode(',', $data['ticket_datetime_rows'][$row]);
336 336
 			$dtts_added = array_diff($tkt_dtt_rows, $starting_tkt_dtt_rows);
337 337
 			$dtts_removed = array_diff($starting_tkt_dtt_rows, $tkt_dtt_rows);
338 338
 
339 339
 			// trim inputs to ensure any excess whitespace is removed.
340 340
 			$tkt = array_map(
341
-				function( $ticket_data ) {
342
-					return is_array( $ticket_data ) ? $ticket_data : trim( $ticket_data );
341
+				function($ticket_data) {
342
+					return is_array($ticket_data) ? $ticket_data : trim($ticket_data);
343 343
 				},
344 344
 				$tkt
345 345
 			);
346 346
 
347 347
 			//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.
348 348
 			//note incoming ['TKT_price'] value is already in standard notation (via js).
349
-			$ticket_price = isset( $tkt['TKT_price'] ) ?  round ( (float) $tkt['TKT_price'], 3 ) : 0;
349
+			$ticket_price = isset($tkt['TKT_price']) ? round((float) $tkt['TKT_price'], 3) : 0;
350 350
 
351 351
 			//note incoming base price needs converted from localized value.
352
-			$base_price = isset( $tkt['TKT_base_price'] ) ? EEH_Money::convert_to_float_from_localized_money( $tkt['TKT_base_price'] ) : 0;
352
+			$base_price = isset($tkt['TKT_base_price']) ? EEH_Money::convert_to_float_from_localized_money($tkt['TKT_base_price']) : 0;
353 353
 			//if ticket price == 0 and $base_price != 0 then ticket price == base_price
354 354
 			$ticket_price = $ticket_price === 0 && $base_price !== 0 ? $base_price : $ticket_price;
355
-			$base_price_id = isset( $tkt['TKT_base_price_ID'] ) ? $tkt['TKT_base_price_ID'] : 0;
355
+			$base_price_id = isset($tkt['TKT_base_price_ID']) ? $tkt['TKT_base_price_ID'] : 0;
356 356
 
357 357
 			$price_rows = is_array($data['edit_prices']) && isset($data['edit_prices'][$row]) ? $data['edit_prices'][$row] : array();
358 358
 
359 359
 			$now = null;
360
-			if ( empty( $tkt['TKT_start_date'] ) ) {
360
+			if (empty($tkt['TKT_start_date'])) {
361 361
 				//lets' use now in the set timezone.
362
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
363
-				$tkt['TKT_start_date'] = $now->format( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
362
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
363
+				$tkt['TKT_start_date'] = $now->format($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
364 364
 			}
365 365
 
366
-			if ( empty( $tkt['TKT_end_date'] ) ) {
366
+			if (empty($tkt['TKT_end_date'])) {
367 367
 				/**
368 368
 				 * set the TKT_end_date to the first datetime attached to the ticket.
369 369
 				 */
370
-				$first_dtt = $saved_dtts[reset( $tkt_dtt_rows )];
371
-				$tkt['TKT_end_date'] = $first_dtt->start_date_and_time( $this->_date_format_strings['date'] . ' ' . $this->_date_format_string['time'] );
370
+				$first_dtt = $saved_dtts[reset($tkt_dtt_rows)];
371
+				$tkt['TKT_end_date'] = $first_dtt->start_date_and_time($this->_date_format_strings['date'].' '.$this->_date_format_string['time']);
372 372
 			}
373 373
 
374 374
 			$TKT_values = array(
375
-				'TKT_ID' 			=> ! empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
376
-				'TTM_ID' 			=> ! empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
377
-				'TKT_name' 			=> ! empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
378
-				'TKT_description' 	=> ! empty( $tkt['TKT_description'] ) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
375
+				'TKT_ID' 			=> ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
376
+				'TTM_ID' 			=> ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
377
+				'TKT_name' 			=> ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
378
+				'TKT_description' 	=> ! empty($tkt['TKT_description']) && $tkt['TKT_description'] != __('You can modify this description', 'event_espresso') ? $tkt['TKT_description'] : '',
379 379
 				'TKT_start_date' 	=> $tkt['TKT_start_date'],
380 380
 				'TKT_end_date' 		=> $tkt['TKT_end_date'],
381
-				'TKT_qty' 			=> ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt[ 'TKT_qty' ],
382
-				'TKT_uses' 			=> ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt['TKT_uses'],
383
-				'TKT_min' 			=> empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
384
-				'TKT_max' 			=> empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'],
381
+				'TKT_qty' 			=> ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
382
+				'TKT_uses' 			=> ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
383
+				'TKT_min' 			=> empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
384
+				'TKT_max' 			=> empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
385 385
 				'TKT_row' 			=> $row,
386
-				'TKT_order' 		=> isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : 0,
387
-				'TKT_taxable' 		=> ! empty( $tkt['TKT_taxable'] ) ? 1 : 0,
388
-				'TKT_required' 		=> ! empty( $tkt['TKT_required'] ) ? 1 : 0,
386
+				'TKT_order' 		=> isset($tkt['TKT_order']) ? $tkt['TKT_order'] : 0,
387
+				'TKT_taxable' 		=> ! empty($tkt['TKT_taxable']) ? 1 : 0,
388
+				'TKT_required' 		=> ! empty($tkt['TKT_required']) ? 1 : 0,
389 389
 				'TKT_price' 		=> $ticket_price
390 390
 			);
391 391
 
392 392
 
393 393
 			//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.
394
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
394
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
395 395
 				$TKT_values['TKT_ID'] = 0;
396 396
 				$TKT_values['TKT_is_default'] = 0;
397 397
 				$update_prices = TRUE;
@@ -403,21 +403,21 @@  discard block
 block discarded – undo
403 403
 			// but DID have it's items modified.
404 404
 			// keep in mind that if the TKT has been sold (and we have changed pricing information),
405 405
 			// then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
406
-			if ( absint( $TKT_values['TKT_ID'] ) ) {
407
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $timezone ) )->get_one_by_ID( $tkt['TKT_ID'] );
408
-				if ( $TKT instanceof EE_Ticket ) {
406
+			if (absint($TKT_values['TKT_ID'])) {
407
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($timezone))->get_one_by_ID($tkt['TKT_ID']);
408
+				if ($TKT instanceof EE_Ticket) {
409 409
 
410
-					$TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed );
410
+					$TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed);
411 411
 					// are there any registrations using this ticket ?
412 412
 					$tickets_sold = $TKT->count_related(
413 413
 						'Registration',
414
-						array( array(
415
-								'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) )
416
-						) )
414
+						array(array(
415
+								'STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))
416
+						))
417 417
 					);
418 418
 					//set ticket formats
419
-					$TKT->set_date_format( $this->_date_format_strings['date'] );
420
-					$TKT->set_time_format( $this->_date_format_strings['time'] );
419
+					$TKT->set_date_format($this->_date_format_strings['date']);
420
+					$TKT->set_time_format($this->_date_format_strings['time']);
421 421
 
422 422
 					// let's just check the total price for the existing ticket
423 423
 					// and determine if it matches the new total price.
@@ -427,17 +427,17 @@  discard block
 block discarded – undo
427 427
 							? TRUE : FALSE;
428 428
 
429 429
 					//set new values
430
-					foreach ( $TKT_values as $field => $value ) {
431
-						if ( $field === 'TKT_qty' ) {
432
-							$TKT->set_qty( $value );
430
+					foreach ($TKT_values as $field => $value) {
431
+						if ($field === 'TKT_qty') {
432
+							$TKT->set_qty($value);
433 433
 						} else {
434
-							$TKT->set( $field, $value );
434
+							$TKT->set($field, $value);
435 435
 						}
436 436
 					}
437 437
 
438 438
 					//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
439
-					if ( $create_new_TKT ) {
440
-						$new_tkt = $this->_duplicate_ticket( $TKT, $price_rows, $ticket_price, $base_price, $base_price_id );
439
+					if ($create_new_TKT) {
440
+						$new_tkt = $this->_duplicate_ticket($TKT, $price_rows, $ticket_price, $base_price, $base_price_id);
441 441
 					}
442 442
 				}
443 443
 
@@ -446,12 +446,12 @@  discard block
 block discarded – undo
446 446
 				$TKT = EE_Ticket::new_instance(
447 447
 					$TKT_values,
448 448
 					$timezone,
449
-					array( $this->_date_format_strings[ 'date' ], $this->_date_format_strings[ 'time' ]  )
449
+					array($this->_date_format_strings['date'], $this->_date_format_strings['time'])
450 450
 				);
451
-				if ( $TKT instanceof EE_Ticket ) {
451
+				if ($TKT instanceof EE_Ticket) {
452 452
 					// make sure ticket has an ID of setting relations won't work
453 453
 					$TKT->save();
454
-					$TKT = $this->_update_ticket_datetimes( $TKT, $saved_dtts, $dtts_added, $dtts_removed );
454
+					$TKT = $this->_update_ticket_datetimes($TKT, $saved_dtts, $dtts_added, $dtts_removed);
455 455
 					$update_prices = TRUE;
456 456
 				}
457 457
 			}
@@ -459,38 +459,38 @@  discard block
 block discarded – undo
459 459
 			//$TKT->save();
460 460
 
461 461
 			//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.
462
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
463
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
462
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
463
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
464 464
 				EE_Registry::instance()->load_helper('DTT_Helper');
465 465
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
466 466
 			}
467 467
 
468 468
 			//let's make sure the base price is handled
469
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( array(), $TKT, $update_prices, $base_price, $base_price_id ) : $TKT;
469
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket(array(), $TKT, $update_prices, $base_price, $base_price_id) : $TKT;
470 470
 
471 471
 			//add/update price_modifiers
472
-			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket( $price_rows, $TKT, $update_prices ) : $TKT;
472
+			$TKT = ! $create_new_TKT ? $this->_add_prices_to_ticket($price_rows, $TKT, $update_prices) : $TKT;
473 473
 
474 474
 			//need to make sue that the TKT_price is accurate after saving the prices.
475 475
 			$TKT->ensure_TKT_Price_correct();
476 476
 
477 477
 			//handle CREATING a default tkt from the incoming tkt but ONLY if this isn't an autosave.
478
-			if ( ! defined('DOING_AUTOSAVE' ) ) {
479
-				if ( !empty($tkt['TKT_is_default_selector'] ) ) {
478
+			if ( ! defined('DOING_AUTOSAVE')) {
479
+				if ( ! empty($tkt['TKT_is_default_selector'])) {
480 480
 					$update_prices = TRUE;
481 481
 					$new_default = clone $TKT;
482
-					$new_default->set( 'TKT_ID', 0 );
483
-					$new_default->set( 'TKT_is_default', 1 );
484
-					$new_default->set( 'TKT_row', 1 );
485
-					$new_default->set( 'TKT_price', $ticket_price );
482
+					$new_default->set('TKT_ID', 0);
483
+					$new_default->set('TKT_is_default', 1);
484
+					$new_default->set('TKT_row', 1);
485
+					$new_default->set('TKT_price', $ticket_price);
486 486
 					//remove any dtt relations cause we DON'T want dtt relations attached (note this is just removing the cached relations in the object)
487 487
 					$new_default->_remove_relations('Datetime');
488 488
 					//todo we need to add the current attached prices as new prices to the new default ticket.
489
-					$new_default = $this->_add_prices_to_ticket( $price_rows, $new_default, $update_prices );
489
+					$new_default = $this->_add_prices_to_ticket($price_rows, $new_default, $update_prices);
490 490
 					//don't forget the base price!
491
-					$new_default = $this->_add_prices_to_ticket( array(), $new_default, $update_prices, $base_price, $base_price_id );
491
+					$new_default = $this->_add_prices_to_ticket(array(), $new_default, $update_prices, $base_price, $base_price_id);
492 492
 					$new_default->save();
493
-					do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data );
493
+					do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_default_ticket', $new_default, $row, $TKT, $data);
494 494
 				}
495 495
 			}
496 496
 
@@ -501,19 +501,19 @@  discard block
 block discarded – undo
501 501
 			//let's assign any tickets that have been setup to the saved_tickets tracker
502 502
 			//save existing TKT
503 503
 			$TKT->save();
504
-			if ( $create_new_TKT && $new_tkt instanceof EE_Ticket ) {
504
+			if ($create_new_TKT && $new_tkt instanceof EE_Ticket) {
505 505
 				//save new TKT
506 506
 				$new_tkt->save();
507 507
 				//add new ticket to array
508
-				$saved_tickets[ $new_tkt->ID() ] = $new_tkt;
508
+				$saved_tickets[$new_tkt->ID()] = $new_tkt;
509 509
 
510
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data );
510
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_new_ticket', $new_tkt, $row, $tkt, $data);
511 511
 
512 512
 			} else {
513 513
 				//add tkt to saved tkts
514
-				$saved_tickets[ $TKT->ID() ] = $TKT;
514
+				$saved_tickets[$TKT->ID()] = $TKT;
515 515
 
516
-				do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data );
516
+				do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_update_ticket', $TKT, $row, $tkt, $data);
517 517
 			}
518 518
 
519 519
 		}
@@ -523,22 +523,22 @@  discard block
 block discarded – undo
523 523
 		// (i.e. autosaves are happening and then in between autosaves the user trashes a ticket).
524 524
 		// Or a draft event was saved and in the process of editing a ticket is trashed.
525 525
 		// No sense in keeping all the related data in the db!
526
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
527
-		$tickets_removed = array_diff( $old_tickets, array_keys($saved_tickets) );
526
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
527
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
528 528
 
529
-		foreach ( $tickets_removed as $id ) {
530
-			$id = absint( $id );
529
+		foreach ($tickets_removed as $id) {
530
+			$id = absint($id);
531 531
 
532 532
 			//get the ticket for this id
533 533
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
534 534
 
535 535
 			//if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime
536
-			if ( $tkt_to_remove->get('TKT_is_default') )
536
+			if ($tkt_to_remove->get('TKT_is_default'))
537 537
 				continue;
538 538
 
539 539
 			// if this tkt has any registrations attached so then we just ARCHIVE
540 540
 			// because we don't actually permanently delete these tickets.
541
-			if ( $tkt_to_remove->count_related('Registration') > 0 ) {
541
+			if ($tkt_to_remove->count_related('Registration') > 0) {
542 542
 				$tkt_to_remove->delete();
543 543
 				continue;
544 544
 			}
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 			// (remember this process can ONLY kick off if there are NO tkts_sold)
548 548
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
549 549
 
550
-			foreach( $dtts as $dtt ) {
550
+			foreach ($dtts as $dtt) {
551 551
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
552 552
 			}
553 553
 
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 			// tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived))
556 556
 			$tkt_to_remove->delete_related_permanently('Price');
557 557
 
558
-			do_action( 'AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove );
558
+			do_action('AHEE__espresso_events_Pricing_Hooks___update_tkts_delete_ticket', $tkt_to_remove);
559 559
 
560 560
 			// finally let's delete this ticket
561 561
 			// (which should not be blocked at this point b/c we've removed all our relationships)
@@ -587,39 +587,39 @@  discard block
 block discarded – undo
587 587
 		// and removing the ticket from datetimes it got removed from.
588 588
 
589 589
 		// first let's add datetimes
590
-		if ( ! empty( $added_datetimes ) && is_array( $added_datetimes ) ) {
591
-			foreach ( $added_datetimes as $row_id ) {
590
+		if ( ! empty($added_datetimes) && is_array($added_datetimes)) {
591
+			foreach ($added_datetimes as $row_id) {
592 592
 				$row_id = (int) $row_id;
593
-				if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) {
594
-					$ticket->_add_relation_to( $saved_datetimes[ $row_id ], 'Datetime' );
593
+				if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) {
594
+					$ticket->_add_relation_to($saved_datetimes[$row_id], 'Datetime');
595 595
 					// Is this an existing ticket (has an ID) and does it have any sold?
596 596
 					// If so, then we need to add that to the DTT sold because this DTT is getting added.
597
-					if ( $ticket->ID() && $ticket->sold() > 0 ) {
598
-						$saved_datetimes[ $row_id ]->increase_sold( $ticket->sold() );
599
-						$saved_datetimes[ $row_id ]->save();
597
+					if ($ticket->ID() && $ticket->sold() > 0) {
598
+						$saved_datetimes[$row_id]->increase_sold($ticket->sold());
599
+						$saved_datetimes[$row_id]->save();
600 600
 					}
601 601
 				}
602 602
 			}
603 603
 		}
604 604
 		// then remove datetimes
605
-		if ( ! empty( $removed_datetimes ) && is_array( $removed_datetimes ) ) {
606
-			foreach ( $removed_datetimes as $row_id ) {
607
-				$row_id = (int)$row_id;
605
+		if ( ! empty($removed_datetimes) && is_array($removed_datetimes)) {
606
+			foreach ($removed_datetimes as $row_id) {
607
+				$row_id = (int) $row_id;
608 608
 				// its entirely possible that a datetime got deleted (instead of just removed from relationship.
609 609
 				// So make sure we skip over this if the dtt isn't in the $saved_datetimes array)
610
-				if ( isset( $saved_datetimes[ $row_id ] ) && $saved_datetimes[ $row_id ] instanceof EE_Datetime ) {
611
-					$ticket->_remove_relation_to( $saved_datetimes[ $row_id ], 'Datetime' );
610
+				if (isset($saved_datetimes[$row_id]) && $saved_datetimes[$row_id] instanceof EE_Datetime) {
611
+					$ticket->_remove_relation_to($saved_datetimes[$row_id], 'Datetime');
612 612
 					// Is this an existing ticket (has an ID) and does it have any sold?
613 613
 					// If so, then we need to remove it's sold from the DTT_sold.
614
-					if ( $ticket->ID() && $ticket->sold() > 0 ) {
615
-						$saved_datetimes[ $row_id ]->decrease_sold( $ticket->sold() );
616
-						$saved_datetimes[ $row_id ]->save();
614
+					if ($ticket->ID() && $ticket->sold() > 0) {
615
+						$saved_datetimes[$row_id]->decrease_sold($ticket->sold());
616
+						$saved_datetimes[$row_id]->save();
617 617
 					}
618 618
 				}
619 619
 			}
620 620
 		}
621 621
 		// cap ticket qty by datetime reg limits
622
-		$ticket->set_qty( min( $ticket->qty(), $ticket->qty( 'reg_limit' ) ) );
622
+		$ticket->set_qty(min($ticket->qty(), $ticket->qty('reg_limit')));
623 623
 		return $ticket;
624 624
 	}
625 625
 
@@ -640,39 +640,39 @@  discard block
 block discarded – undo
640 640
 		EE_Ticket $ticket,
641 641
 		$price_rows = array(),
642 642
 		$ticket_price = 0,
643
-		$base_price = 0 ,
643
+		$base_price = 0,
644 644
 		$base_price_id = 0
645 645
 	) {
646 646
 
647 647
 		// create new ticket that's a copy of the existing
648 648
 		// except a new id of course (and not archived)
649 649
 		// AND has the new TKT_price associated with it.
650
-		$new_ticket = clone( $ticket );
651
-		$new_ticket->set( 'TKT_ID', 0 );
652
-		$new_ticket->set( 'TKT_deleted', 0 );
653
-		$new_ticket->set( 'TKT_price', $ticket_price );
654
-		$new_ticket->set( 'TKT_sold', 0 );
650
+		$new_ticket = clone($ticket);
651
+		$new_ticket->set('TKT_ID', 0);
652
+		$new_ticket->set('TKT_deleted', 0);
653
+		$new_ticket->set('TKT_price', $ticket_price);
654
+		$new_ticket->set('TKT_sold', 0);
655 655
 		// let's get a new ID for this ticket
656 656
 		$new_ticket->save();
657 657
 		// we also need to make sure this new ticket gets the same datetime attachments as the archived ticket
658
-		$datetimes_on_existing = $ticket->get_many_related( 'Datetime' );
658
+		$datetimes_on_existing = $ticket->get_many_related('Datetime');
659 659
 		$new_ticket = $this->_update_ticket_datetimes(
660 660
 			$new_ticket,
661 661
 			$datetimes_on_existing,
662
-			array_keys( $datetimes_on_existing )
662
+			array_keys($datetimes_on_existing)
663 663
 		);
664 664
 
665 665
 		// $ticket will get archived later b/c we are NOT adding it to the saved_tickets array.
666 666
 		// if existing $ticket has sold amount, then we need to adjust the qty for the new TKT to = the remaining
667 667
 		// available.
668
-		if ( $ticket->sold() > 0 ) {
668
+		if ($ticket->sold() > 0) {
669 669
 			$new_qty = $ticket->qty() - $ticket->sold();
670
-			$new_ticket->set_qty( $new_qty );
670
+			$new_ticket->set_qty($new_qty);
671 671
 		}
672 672
 		//now we update the prices just for this ticket
673
-		$new_ticket = $this->_add_prices_to_ticket( $price_rows, $new_ticket, true );
673
+		$new_ticket = $this->_add_prices_to_ticket($price_rows, $new_ticket, true);
674 674
 		//and we update the base price
675
-		$new_ticket = $this->_add_prices_to_ticket( array(), $new_ticket, true, $base_price, $base_price_id );
675
+		$new_ticket = $this->_add_prices_to_ticket(array(), $new_ticket, true, $base_price, $base_price_id);
676 676
 		return $new_ticket;
677 677
 	}
678 678
 
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 	 * @param int|bool 		$base_price_id  if present then this is the base_price_id being updated.
693 693
 	 * @return EE_Ticket
694 694
 	 */
695
-	protected function  _add_prices_to_ticket( $prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE ) {
695
+	protected function  _add_prices_to_ticket($prices = array(), EE_Ticket $ticket, $new_prices = FALSE, $base_price = FALSE, $base_price_id = FALSE) {
696 696
 
697 697
 		//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.
698 698
 		$current_prices_on_ticket = $base_price !== FALSE ? $ticket->base_price(TRUE) : $ticket->price_modifiers();
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 		$updated_prices = array();
701 701
 
702 702
 		// if $base_price ! FALSE then updating a base price.
703
-		if ( $base_price !== FALSE ) {
703
+		if ($base_price !== FALSE) {
704 704
 			$prices[1] = array(
705 705
 				'PRC_ID' => $new_prices || $base_price_id === 1 ? NULL : $base_price_id,
706 706
 				'PRT_ID' => 1,
@@ -711,47 +711,47 @@  discard block
 block discarded – undo
711 711
 		}
712 712
 
713 713
 		//possibly need to save tkt
714
-		if ( ! $ticket->ID() )
714
+		if ( ! $ticket->ID())
715 715
 			$ticket->save();
716 716
 
717
-		foreach ( $prices as $row => $prc ) {
718
-			$prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL;
719
-			if ( empty($prt_id) )
717
+		foreach ($prices as $row => $prc) {
718
+			$prt_id = ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL;
719
+			if (empty($prt_id))
720 720
 				continue; //prices MUST have a price type id.
721 721
 			$PRC_values = array(
722
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
722
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
723 723
 				'PRT_ID' => $prt_id,
724
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
725
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
726
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
724
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
725
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
726
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
727 727
 				'PRC_is_default' => false, //make sure we set PRC_is_default to false for all ticket saves from event_editor
728 728
 				'PRC_order' => $row
729 729
 				);
730
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
730
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
731 731
 				$PRC_values['PRC_ID'] = 0;
732
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
732
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
733 733
 			} else {
734
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
734
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
735 735
 				//update this price with new values
736
-				foreach ( $PRC_values as $field => $newprc ) {
737
-					$PRC->set( $field, $newprc );
736
+				foreach ($PRC_values as $field => $newprc) {
737
+					$PRC->set($field, $newprc);
738 738
 				}
739 739
 			}
740 740
 			$PRC->save();
741 741
 			$prcid = $PRC->ID();
742 742
 			$updated_prices[$prcid] = $PRC;
743
-			$ticket->_add_relation_to( $PRC, 'Price' );
743
+			$ticket->_add_relation_to($PRC, 'Price');
744 744
 		}
745 745
 
746 746
 		//now let's remove any prices that got removed from the ticket
747
-		if ( !empty ( $current_prices_on_ticket ) ) {
747
+		if ( ! empty ($current_prices_on_ticket)) {
748 748
 			$current = array_keys($current_prices_on_ticket);
749 749
 			$updated = array_keys($updated_prices);
750 750
 			$prices_to_remove = array_diff($current, $updated);
751
-			if ( !empty( $prices_to_remove ) ) {
752
-				foreach ( $prices_to_remove as $prc_id ) {
751
+			if ( ! empty($prices_to_remove)) {
752
+				foreach ($prices_to_remove as $prc_id) {
753 753
 					$p = $current_prices_on_ticket[$prc_id];
754
-					$ticket->_remove_relation_to( $p, 'Price' );
754
+					$ticket->_remove_relation_to($p, 'Price');
755 755
 
756 756
 					//delete permanently the price
757 757
 					$p->delete_permanently();
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 
765 765
 
766 766
 
767
-	public function autosave_handling( $event_admin_obj ) {
767
+	public function autosave_handling($event_admin_obj) {
768 768
 		return $event_admin_obj; //doing nothing for the moment.
769 769
 		//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)
770 770
 
@@ -798,12 +798,12 @@  discard block
 block discarded – undo
798 798
 
799 799
 		//default main template args
800 800
 		$main_template_args = array(
801
-			'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
801
+			'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
802 802
 			'existing_datetime_ids' => '',
803 803
 			'total_dtt_rows' => 1,
804
-			'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.
804
+			'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.
805 805
 			'datetime_rows' => '',
806
-			'show_tickets_container' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
806
+			'show_tickets_container' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 1 ? ' style="display:none;"' : '',
807 807
 			'ticket_rows' => '',
808 808
 			'existing_ticket_ids' => '',
809 809
 			'total_ticket_rows' => 1,
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
 
814 814
 		$timezone = $evtobj instanceof EE_Event ? $evtobj->timezone_string() : NULL;
815 815
 
816
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
816
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
817 817
 
818 818
 		/**
819 819
 		 * 1. Start with retrieving Datetimes
@@ -821,8 +821,8 @@  discard block
 block discarded – undo
821 821
 		 * 3. For each ticket get related prices
822 822
 		 */
823 823
 
824
-		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone) );
825
-		$times = $DTM->get_all_event_dates( $evtID );
824
+		$DTM = EE_Registry::instance()->load_model('Datetime', array($timezone));
825
+		$times = $DTM->get_all_event_dates($evtID);
826 826
 
827 827
 
828 828
 
@@ -830,31 +830,31 @@  discard block
 block discarded – undo
830 830
 
831 831
 		/** @see https://events.codebasehq.com/projects/event-espresso/tickets/9486 for why we are counting $dttrow and then setting that on the Datetime object */
832 832
 		$dttrow = 1;
833
-		foreach ( $times as $time ) {
833
+		foreach ($times as $time) {
834 834
 			$dttid = $time->get('DTT_ID');
835
-			$time->set( 'DTT_order', $dttrow );
835
+			$time->set('DTT_order', $dttrow);
836 836
 			$existing_datetime_ids[] = $dttid;
837 837
 
838 838
 			//tickets attached
839
-			$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();
839
+			$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();
840 840
 
841 841
 			//if there are no related tickets this is likely a new event OR autodraft
842 842
 			// event so we need to generate the default tickets because dtts
843 843
 			// ALWAYS have at least one related ticket!!.  EXCEPT, we dont' do this if there is already more than one
844 844
 			// datetime on the event.
845
-			if ( empty ( $related_tickets ) && count( $times ) < 2 ) {
845
+			if (empty ($related_tickets) && count($times) < 2) {
846 846
 				$related_tickets = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
847 847
 
848 848
 				//this should be ordered by TKT_ID, so let's grab the first default ticket (which will be the main default) and ensure it has any default prices added to it (but do NOT save).
849 849
 				$default_prices = EEM_Price::instance()->get_all_default_prices();
850 850
 
851
-				$main_default_ticket = reset( $related_tickets );
852
-				if ( $main_default_ticket instanceof EE_Ticket ) {
853
-					foreach ( $default_prices as $default_price ) {
854
-						if ( $default_price->is_base_price() ) {
851
+				$main_default_ticket = reset($related_tickets);
852
+				if ($main_default_ticket instanceof EE_Ticket) {
853
+					foreach ($default_prices as $default_price) {
854
+						if ($default_price->is_base_price()) {
855 855
 							continue;
856 856
 						}
857
-						$main_default_ticket->cache( 'Price', $default_price );
857
+						$main_default_ticket->cache('Price', $default_price);
858 858
 					}
859 859
 				}
860 860
 			}
@@ -863,11 +863,11 @@  discard block
 block discarded – undo
863 863
 			//we can't actually setup rows in this loop yet cause we don't know all the unique tickets for this event yet (tickets are linked through all datetimes). So we're going to temporarily cache some of that information.
864 864
 
865 865
 			//loop through and setup the ticket rows and make sure the order is set.
866
-			foreach ( $related_tickets as $ticket ) {
866
+			foreach ($related_tickets as $ticket) {
867 867
 				$tktid = $ticket->get('TKT_ID');
868 868
 				$tktrow = $ticket->get('TKT_row');
869 869
 				//we only want unique tickets in our final display!!
870
-				if ( !in_array( $tktid, $existing_ticket_ids ) ) {
870
+				if ( ! in_array($tktid, $existing_ticket_ids)) {
871 871
 					$existing_ticket_ids[] = $tktid;
872 872
 					$all_tickets[] = $ticket;
873 873
 				}
@@ -876,57 +876,57 @@  discard block
 block discarded – undo
876 876
 				$datetime_tickets[$dttid][] = $tktrow;
877 877
 
878 878
 				//temporary cache of this datetime info for this ticket for later processing of ticket rows.
879
-				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) )
879
+				if ( ! isset($ticket_datetimes[$tktid]) || ! in_array($dttrow, $ticket_datetimes[$tktid]))
880 880
 					$ticket_datetimes[$tktid][] = $dttrow;
881 881
 			}
882 882
 			$dttrow++;
883 883
 		}
884 884
 
885
-		$main_template_args['total_ticket_rows'] = count( $existing_ticket_ids );
886
-		$main_template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids );
887
-		$main_template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids );
885
+		$main_template_args['total_ticket_rows'] = count($existing_ticket_ids);
886
+		$main_template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
887
+		$main_template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
888 888
 
889 889
 		//sort $all_tickets by order
890
-		usort( $all_tickets, function( $a, $b ) {
890
+		usort($all_tickets, function($a, $b) {
891 891
 			$a_order = (int) $a->get('TKT_order');
892 892
 			$b_order = (int) $b->get('TKT_order');
893
-			if ( $a_order == $b_order ) {
893
+			if ($a_order == $b_order) {
894 894
 				return 0;
895 895
 			}
896
-			return ( $a_order < $b_order ) ? -1 : 1;
896
+			return ($a_order < $b_order) ? -1 : 1;
897 897
 		});
898 898
 
899 899
 		//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.
900 900
 		$dttrow = 1;
901
-		foreach ( $times as $time ) {
902
-			$main_template_args['datetime_rows'] .= $this->_get_datetime_row( $dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times );
901
+		foreach ($times as $time) {
902
+			$main_template_args['datetime_rows'] .= $this->_get_datetime_row($dttrow, $time, $datetime_tickets, $all_tickets, FALSE, $times);
903 903
 			$dttrow++;
904 904
 		}
905 905
 
906 906
 		//then loop through all tickets for the ticket rows.
907 907
 		$tktrow = 1;
908
-		foreach ( $all_tickets as $ticket ) {
909
-			$main_template_args['ticket_rows'] .= $this->_get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets );
908
+		foreach ($all_tickets as $ticket) {
909
+			$main_template_args['ticket_rows'] .= $this->_get_ticket_row($tktrow, $ticket, $ticket_datetimes, $times, FALSE, $all_tickets);
910 910
 			$tktrow++;
911 911
 		}
912 912
 
913 913
 		$main_template_args['ticket_js_structure'] = $this->_get_ticket_js_structure($times, $all_tickets);
914
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php';
915
-		EEH_Template::display_template( $template, $main_template_args );
914
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_metabox_main.template.php';
915
+		EEH_Template::display_template($template, $main_template_args);
916 916
 		return;
917 917
 	}
918 918
 
919 919
 
920 920
 
921
-	protected function _get_datetime_row( $dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array() ) {
921
+	protected function _get_datetime_row($dttrow, EE_Datetime $dtt, $datetime_tickets, $all_tickets, $default = FALSE, $all_dtts = array()) {
922 922
 
923 923
 		$dtt_display_template_args = array(
924
-			'dtt_edit_row' => $this->_get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ),
925
-			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ),
924
+			'dtt_edit_row' => $this->_get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts),
925
+			'dtt_attached_tickets_row' => $this->_get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default),
926 926
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow
927 927
 			);
928
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_row_wrapper.template.php';
929
-		return EEH_Template::display_template( $template, $dtt_display_template_args, TRUE);
928
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_row_wrapper.template.php';
929
+		return EEH_Template::display_template($template, $dtt_display_template_args, TRUE);
930 930
 	}
931 931
 
932 932
 
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
 	 *
945 945
 	 * @return string Generated edit row.
946 946
 	 */
947
-	protected function _get_dtt_edit_row( $dttrow, $dtt, $default, $all_dtts ) {
947
+	protected function _get_dtt_edit_row($dttrow, $dtt, $default, $all_dtts) {
948 948
 
949 949
 		// if the incomign $dtt object is NOT an instance of EE_Datetime then force default to true.
950 950
 		$default = ! $dtt instanceof EE_Datetime ? true : false;
@@ -952,30 +952,30 @@  discard block
 block discarded – undo
952 952
 		$template_args = array(
953 953
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
954 954
 			'event_datetimes_name' => $default ? 'DTTNAMEATTR' : 'edit_event_datetimes',
955
-			'edit_dtt_expanded' => '',//$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
955
+			'edit_dtt_expanded' => '', //$this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? '' : ' ee-edit-editing',
956 956
 			'DTT_ID' => $default ? '' : $dtt->ID(),
957 957
 			'DTT_name' => $default ? '' : $dtt->name(),
958 958
 			'DTT_description' => $default ? '' : $dtt->description(),
959
-			'DTT_EVT_start' => $default ? '' : $dtt->start_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
960
-			'DTT_EVT_end' => $default ? '' : $dtt->end_date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
961
-			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit','input'),
959
+			'DTT_EVT_start' => $default ? '' : $dtt->start_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
960
+			'DTT_EVT_end' => $default ? '' : $dtt->end_date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
961
+			'DTT_reg_limit' => $default ? '' : $dtt->get_pretty('DTT_reg_limit', 'input'),
962 962
 			'DTT_order' => $default ? 'DTTNUM' : $dttrow,
963 963
 			'dtt_sold' => $default ? '0' : $dtt->get('DTT_sold'),
964
-			'clone_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
965
-			'trash_icon' => !empty( $dtt ) && $dtt->get('DTT_sold') > 0  ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable'
964
+			'clone_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? '' : 'clone-icon ee-icon ee-icon-clone clickable',
965
+			'trash_icon' => ! empty($dtt) && $dtt->get('DTT_sold') > 0 ? 'ee-lock-icon' : 'trash-icon dashicons dashicons-post-trash clickable'
966 966
 			);
967 967
 
968
-		$template_args['show_trash'] = count( $all_dtts ) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
968
+		$template_args['show_trash'] = count($all_dtts) === 1 && $template_args['trash_icon'] !== 'ee-lock-icon' ? ' style="display:none"' : '';
969 969
 
970 970
 		//allow filtering of template args at this point.
971
-		$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 );
971
+		$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);
972 972
 
973
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_edit_row.template.php';
974
-		return EEH_Template::display_template( $template, $template_args, TRUE );
973
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_edit_row.template.php';
974
+		return EEH_Template::display_template($template, $template_args, TRUE);
975 975
 	}
976 976
 
977 977
 
978
-	protected function _get_dtt_attached_tickets_row( $dttrow, $dtt, $datetime_tickets, $all_tickets, $default ) {
978
+	protected function _get_dtt_attached_tickets_row($dttrow, $dtt, $datetime_tickets, $all_tickets, $default) {
979 979
 
980 980
 		$template_args = array(
981 981
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
@@ -983,47 +983,47 @@  discard block
 block discarded – undo
983 983
 			'DTT_description' => $default ? '' : $dtt->description(),
984 984
 			'datetime_tickets_list' => $default ? '<li class="hidden"></li>' : '',
985 985
 			'show_tickets_row' => ' style="display:none;"', //$default || $this->_adminpage_obj->get_cpt_model_obj()->ID() > 0 ? ' style="display:none;"' : '',
986
-			'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.
986
+			'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.
987 987
 			'DTT_ID' => $default ? '' : $dtt->ID()
988 988
 			);
989 989
 
990 990
 		//need to setup the list items (but only if this isnt' a default skeleton setup)
991
-		if ( !$default ) {
991
+		if ( ! $default) {
992 992
 			$tktrow = 1;
993
-			foreach ( $all_tickets as $ticket ) {
994
-				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default );
993
+			foreach ($all_tickets as $ticket) {
994
+				$template_args['datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default);
995 995
 				$tktrow++;
996 996
 			}
997 997
 		}
998 998
 
999 999
 		//filter template args at this point
1000
-		$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 );
1000
+		$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);
1001 1001
 
1002
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_attached_tickets_row.template.php';
1003
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1002
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_attached_tickets_row.template.php';
1003
+		return EEH_Template::display_template($template, $template_args, TRUE);
1004 1004
 	}
1005 1005
 
1006 1006
 
1007 1007
 
1008
-	protected function _get_datetime_tickets_list_item( $dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default ) {
1009
-		$tktid = !empty( $ticket ) ? $ticket->ID() : 0;
1010
-		$dtt_tkts = $dtt instanceof EE_Datetime && isset( $datetime_tickets[$dtt->ID()] ) ? $datetime_tickets[$dtt->ID()] : array();
1008
+	protected function _get_datetime_tickets_list_item($dttrow, $tktrow, $dtt, $ticket, $datetime_tickets, $default) {
1009
+		$tktid = ! empty($ticket) ? $ticket->ID() : 0;
1010
+		$dtt_tkts = $dtt instanceof EE_Datetime && isset($datetime_tickets[$dtt->ID()]) ? $datetime_tickets[$dtt->ID()] : array();
1011 1011
 
1012
-		$displayrow = !empty( $ticket ) ? $ticket->get('TKT_row') : 0;
1012
+		$displayrow = ! empty($ticket) ? $ticket->get('TKT_row') : 0;
1013 1013
 		$template_args = array(
1014 1014
 			'dtt_row' => $default ? 'DTTNUM' : $dttrow,
1015
-			'tkt_row' => $default && empty( $ticket ) ? 'TICKETNUM' : $tktrow,
1015
+			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
1016 1016
 			'datetime_ticket_checked' => in_array($displayrow, $dtt_tkts) ? ' checked="checked"' : '',
1017 1017
 			'ticket_selected' => in_array($displayrow, $dtt_tkts) ? ' ticket-selected' : '',
1018
-			'TKT_name' => $default && empty( $ticket ) ? 'TKTNAME' : $ticket->get('TKT_name'),
1019
-			'tkt_status_class' => ( $default && empty( $ticket ) ) || $this->_is_creating_event ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status(),
1018
+			'TKT_name' => $default && empty($ticket) ? 'TKTNAME' : $ticket->get('TKT_name'),
1019
+			'tkt_status_class' => ($default && empty($ticket)) || $this->_is_creating_event ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status(),
1020 1020
 			);
1021 1021
 
1022 1022
 		//filter template args
1023
-		$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 );
1023
+		$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);
1024 1024
 
1025
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_dtt_tickets_list.template.php';
1026
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1025
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_dtt_tickets_list.template.php';
1026
+		return EEH_Template::display_template($template, $template_args, TRUE);
1027 1027
 	}
1028 1028
 
1029 1029
 
@@ -1045,37 +1045,37 @@  discard block
 block discarded – undo
1045 1045
 	 *
1046 1046
 	 * @return [type] [description]
1047 1047
 	 */
1048
-	protected function _get_ticket_row( $tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array() ) {
1048
+	protected function _get_ticket_row($tktrow, $ticket, $ticket_datetimes, $all_dtts, $default = FALSE, $all_tickets = array()) {
1049 1049
 
1050 1050
 		//if $ticket is not an instance of EE_Ticket then force default to true.
1051
-		$default =  ! $ticket instanceof EE_Ticket ? true : false;
1051
+		$default = ! $ticket instanceof EE_Ticket ? true : false;
1052 1052
 
1053
-		$prices = ! empty( $ticket ) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC') ) ) : array();
1053
+		$prices = ! empty($ticket) && ! $default ? $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))) : array();
1054 1054
 
1055 1055
 		//if there is only one price (which would be the base price) or NO prices and this ticket is a default ticket, let's just make sure there are no cached default prices on
1056 1056
 		//the object.  This is done by not including any query_params.
1057
-		if ( $ticket instanceof EE_Ticket && $ticket->is_default() && ( count( $prices ) === 1  || empty( $prices ) ) ) {
1058
-			$prices = $ticket->get_many_related( 'Price' );
1057
+		if ($ticket instanceof EE_Ticket && $ticket->is_default() && (count($prices) === 1 || empty($prices))) {
1058
+			$prices = $ticket->get_many_related('Price');
1059 1059
 		}
1060 1060
 
1061 1061
 		// 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.
1062
-		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default') ) ? TRUE : FALSE;
1062
+		$default_dtt = $default || ($ticket instanceof EE_Ticket && $ticket->get('TKT_is_default')) ? TRUE : FALSE;
1063 1063
 
1064
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
1064
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1065 1065
 
1066 1066
 		$ticket_subtotal = $default ? 0 : $ticket->get_ticket_subtotal();
1067
-		$base_price = $default ? NULL :  $ticket->base_price();
1067
+		$base_price = $default ? NULL : $ticket->base_price();
1068 1068
 		$count_price_mods = EEM_Price::instance()->get_all_default_prices(TRUE);
1069 1069
 
1070 1070
 		//breaking out complicated condition for ticket_status
1071
-		if ( $default ) {
1072
-			$ticket_status_class = ' tkt-status-' . EE_Ticket::onsale;
1071
+		if ($default) {
1072
+			$ticket_status_class = ' tkt-status-'.EE_Ticket::onsale;
1073 1073
 		} else {
1074
-			$ticket_status_class =  $ticket->is_default() ? ' tkt-status-' . EE_Ticket::onsale : ' tkt-status-' . $ticket->ticket_status();
1074
+			$ticket_status_class = $ticket->is_default() ? ' tkt-status-'.EE_Ticket::onsale : ' tkt-status-'.$ticket->ticket_status();
1075 1075
 		}
1076 1076
 
1077 1077
 		//breaking out complicated condition for TKT_taxable
1078
-		if ( $default ) {
1078
+		if ($default) {
1079 1079
 			$TKT_taxable = '';
1080 1080
 		} else {
1081 1081
 			$TKT_taxable = $ticket->get('TKT_taxable') ? ' checked="checked"' : '';
@@ -1090,19 +1090,19 @@  discard block
 block discarded – undo
1090 1090
 			'edit_tkt_expanded' => '',
1091 1091
 			'edit_tickets_name' => $default ? 'TICKETNAMEATTR' : 'edit_tickets',
1092 1092
 			'TKT_name' => $default ? '' : $ticket->get('TKT_name'),
1093
-			'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] ),
1094
-			'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time']  ),
1095
-			'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),
1093
+			'TKT_start_date' => $default ? '' : $ticket->get_date('TKT_start_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
1094
+			'TKT_end_date' => $default ? '' : $ticket->get_date('TKT_end_date', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']),
1095
+			'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),
1096 1096
 			'TKT_price' => $default ? '' : EEH_Template::format_currency($ticket->get_ticket_total_with_taxes(), FALSE, FALSE),
1097 1097
 			'TKT_price_code' => EE_Registry::instance()->CFG->currency->code,
1098 1098
 			'TKT_price_amount' => $default ? 0 : $ticket_subtotal,
1099
-			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty','symbol'),
1100
-			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty','input'),
1101
-			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses','input'),
1102
-			'TKT_min' => $default ? '' : ( $ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min') ),
1103
-			'TKT_max' => $default ? '' :  $ticket->get_pretty('TKT_max','input'),
1099
+			'TKT_qty' => $default ? '' : $ticket->get_pretty('TKT_qty', 'symbol'),
1100
+			'TKT_qty_for_input'=> $default ? '' : $ticket->get_pretty('TKT_qty', 'input'),
1101
+			'TKT_uses' => $default ? '' : $ticket->get_pretty('TKT_uses', 'input'),
1102
+			'TKT_min' => $default ? '' : ($ticket->get('TKT_min') === -1 || $ticket->get('TKT_min') === 0 ? '' : $ticket->get('TKT_min')),
1103
+			'TKT_max' => $default ? '' : $ticket->get_pretty('TKT_max', 'input'),
1104 1104
 			'TKT_sold' => $default ? 0 : $ticket->tickets_sold('ticket'),
1105
-			'TKT_registrations' => $default ? 0 : $ticket->count_registrations( array( array( 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) ) ) ),
1105
+			'TKT_registrations' => $default ? 0 : $ticket->count_registrations(array(array('STS_ID' => array('!=', EEM_Registration::status_id_incomplete)))),
1106 1106
 			'TKT_ID' => $default ? 0 : $ticket->get('TKT_ID'),
1107 1107
 			'TKT_description' => $default ? '' : $ticket->get('TKT_description'),
1108 1108
 			'TKT_is_default' => $default ? 0 : $ticket->get('TKT_is_default'),
@@ -1111,99 +1111,99 @@  discard block
 block discarded – undo
1111 1111
 			'ticket_price_rows' => '',
1112 1112
 			'TKT_base_price' => $default || ! $base_price instanceof EE_Price ? '' : $base_price->get_pretty('PRC_amount', 'localized_float'),
1113 1113
 			'TKT_base_price_ID' => $default || ! $base_price instanceof EE_Price ? 0 : $base_price->ID(),
1114
-			'show_price_modifier' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) ? '' : ' style="display:none;"',
1115
-			'show_price_mod_button' => count($prices) > 1 || ( $default && $count_price_mods > 0 ) || ( !$default && $ticket->get('TKT_deleted') ) ? ' style="display:none;"' : '',
1114
+			'show_price_modifier' => count($prices) > 1 || ($default && $count_price_mods > 0) ? '' : ' style="display:none;"',
1115
+			'show_price_mod_button' => count($prices) > 1 || ($default && $count_price_mods > 0) || ( ! $default && $ticket->get('TKT_deleted')) ? ' style="display:none;"' : '',
1116 1116
 			'total_price_rows' => count($prices) > 1 ? count($prices) : 1,
1117 1117
 			'ticket_datetimes_list' => $default ? '<li class="hidden"></li>' : '',
1118 1118
 			'starting_ticket_datetime_rows' => $default || $default_dtt ? '' : implode(',', $tkt_dtts),
1119 1119
 			'ticket_datetime_rows' => $default ? '' : implode(',', $tkt_dtts),
1120
-			'existing_ticket_price_ids' => $default, '', implode(',', array_keys( $prices) ),
1120
+			'existing_ticket_price_ids' => $default, '', implode(',', array_keys($prices)),
1121 1121
 			'ticket_template_id' => $default ? 0 : $ticket->get('TTM_ID'),
1122 1122
 			'TKT_taxable' => $TKT_taxable,
1123 1123
 			'display_subtotal' => $ticket instanceof EE_Ticket && $ticket->get('TKT_taxable') ? '' : ' style="display:none"',
1124 1124
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1125
-			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE ),
1125
+			'TKT_subtotal_amount_display' => EEH_Template::format_currency($ticket_subtotal, FALSE, FALSE),
1126 1126
 			'TKT_subtotal_amount' => $ticket_subtotal,
1127
-			'tax_rows' => $this->_get_tax_rows( $tktrow, $ticket ),
1128
-			'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE: FALSE,
1127
+			'tax_rows' => $this->_get_tax_rows($tktrow, $ticket),
1128
+			'disabled' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? TRUE : FALSE,
1129 1129
 			'ticket_archive_class' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? ' ticket-archived' : '',
1130 1130
 			'trash_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? 'ee-lock-icon ' : 'trash-icon dashicons dashicons-post-trash clickable',
1131 1131
 			'clone_icon' => $ticket instanceof EE_Ticket && $ticket->get('TKT_deleted') ? '' : 'clone-icon ee-icon ee-icon-clone clickable'
1132 1132
 			);
1133 1133
 
1134
-		$template_args['trash_hidden'] = count( $all_tickets ) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
1134
+		$template_args['trash_hidden'] = count($all_tickets) === 1 && $template_args['trash_icon'] != 'ee-lock-icon' ? ' style="display:none"' : '';
1135 1135
 
1136 1136
 		//handle rows that should NOT be empty
1137
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1137
+		if (empty($template_args['TKT_start_date'])) {
1138 1138
 			//if empty then the start date will be now.
1139
-			$template_args['TKT_start_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , current_time('timestamp'));
1140
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1139
+			$template_args['TKT_start_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], current_time('timestamp'));
1140
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
1141 1141
 		}
1142 1142
 
1143
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1143
+		if (empty($template_args['TKT_end_date'])) {
1144 1144
 
1145 1145
 			//get the earliest datetime (if present);
1146
-			$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;
1146
+			$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;
1147 1147
 
1148
-			if ( !empty( $earliest_dtt ) ) {
1149
-				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] );
1148
+			if ( ! empty($earliest_dtt)) {
1149
+				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', $this->_date_format_strings['date'].' '.$this->_date_format_strings['time']);
1150 1150
 			} else {
1151 1151
 				//default so let's just use what's been set for the default date-time which is 30 days from now.
1152
-				$template_args['TKT_end_date'] = date( $this->_date_format_strings['date'] . ' ' . $this->_date_format_strings['time'] , mktime(24, 0, 0, date("m"), date("d") + 29, date("Y") )  );
1152
+				$template_args['TKT_end_date'] = date($this->_date_format_strings['date'].' '.$this->_date_format_strings['time'], mktime(24, 0, 0, date("m"), date("d") + 29, date("Y")));
1153 1153
 			}
1154
-			$template_args['tkt_status_class'] = ' tkt-status-' . EE_Ticket::onsale;
1154
+			$template_args['tkt_status_class'] = ' tkt-status-'.EE_Ticket::onsale;
1155 1155
 		}
1156 1156
 
1157 1157
 		//generate ticket_datetime items
1158
-		if ( ! $default ) {
1158
+		if ( ! $default) {
1159 1159
 			$dttrow = 1;
1160
-			foreach ( $all_dtts as $dtt ) {
1161
-				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default );
1160
+			foreach ($all_dtts as $dtt) {
1161
+				$template_args['ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default);
1162 1162
 				$dttrow++;
1163 1163
 			}
1164 1164
 		}
1165 1165
 
1166 1166
 		$prcrow = 1;
1167
-		foreach ( $prices as $price ) {
1168
-			if ( $price->is_base_price() ) {
1167
+		foreach ($prices as $price) {
1168
+			if ($price->is_base_price()) {
1169 1169
 				$prcrow++;
1170 1170
 				continue;
1171 1171
 			}
1172
-			$show_trash = ( count( $prices ) > 1 && $prcrow === 1 ) || count( $prices ) === 1  ? FALSE : TRUE;
1173
-			$show_create = count( $prices ) > 1 && count( $prices ) !== $prcrow ? FALSE : TRUE;
1174
-			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create );
1172
+			$show_trash = (count($prices) > 1 && $prcrow === 1) || count($prices) === 1 ? FALSE : TRUE;
1173
+			$show_create = count($prices) > 1 && count($prices) !== $prcrow ? FALSE : TRUE;
1174
+			$template_args['ticket_price_rows'] .= $this->_get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash, $show_create);
1175 1175
 			$prcrow++;
1176 1176
 		}
1177 1177
 
1178 1178
 		//filter $template_args
1179
-		$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 );
1179
+		$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);
1180 1180
 
1181
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_row.template.php';
1182
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1181
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_row.template.php';
1182
+		return EEH_Template::display_template($template, $template_args, TRUE);
1183 1183
 	}
1184 1184
 
1185 1185
 
1186 1186
 
1187 1187
 
1188 1188
 
1189
-	protected function _get_tax_rows( $tktrow, $ticket ) {
1189
+	protected function _get_tax_rows($tktrow, $ticket) {
1190 1190
 		$tax_rows = '';
1191
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_tax_row.template.php';
1191
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_tax_row.template.php';
1192 1192
 		$template_args = array();
1193
-		$taxes = empty( $ticket ) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
1194
-		foreach ( $taxes as $tax ) {
1195
-			$tax_added = $this->_get_tax_added( $tax, $ticket );
1193
+		$taxes = empty($ticket) ? EE_Taxes::get_taxes_for_admin() : $ticket->get_ticket_taxes_for_admin();
1194
+		foreach ($taxes as $tax) {
1195
+			$tax_added = $this->_get_tax_added($tax, $ticket);
1196 1196
 			$template_args = array(
1197
-				'display_tax' => !empty( $ticket ) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
1197
+				'display_tax' => ! empty($ticket) && $ticket->get('TKT_taxable') ? '' : ' style="display:none;"',
1198 1198
 				'tax_id' => $tax->ID(),
1199 1199
 				'tkt_row' => $tktrow,
1200 1200
 				'tax_label' => $tax->get('PRC_name'),
1201 1201
 				'tax_added' => $tax_added,
1202
-				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE ),
1202
+				'tax_added_display' => EEH_Template::format_currency($tax_added, FALSE, FALSE),
1203 1203
 				'tax_amount' => $tax->get('PRC_amount')
1204 1204
 				);
1205
-			$template_args = apply_filters( 'FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event  );
1206
-			$tax_rows .= EEH_Template::display_template( $template, $template_args, TRUE );
1205
+			$template_args = apply_filters('FHEE__espresso_events_Pricing_Hooks___get_tax_rows__template_args', $template_args, $tktrow, $ticket, $this->_is_creating_event);
1206
+			$tax_rows .= EEH_Template::display_template($template, $template_args, TRUE);
1207 1207
 		}
1208 1208
 
1209 1209
 
@@ -1211,81 +1211,81 @@  discard block
 block discarded – undo
1211 1211
 	}
1212 1212
 
1213 1213
 
1214
-	protected function _get_tax_added( EE_Price $tax, $ticket ) {
1215
-		$subtotal = empty( $ticket ) ? 0 : $ticket->get_ticket_subtotal();
1214
+	protected function _get_tax_added(EE_Price $tax, $ticket) {
1215
+		$subtotal = empty($ticket) ? 0 : $ticket->get_ticket_subtotal();
1216 1216
 		return $subtotal * $tax->get('PRC_amount') / 100;
1217 1217
 	}
1218 1218
 
1219 1219
 
1220 1220
 
1221 1221
 
1222
-	protected function _get_ticket_price_row( $tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE ) {
1223
-		$send_disabled = !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1222
+	protected function _get_ticket_price_row($tktrow, $prcrow, $price, $default, $ticket, $show_trash = TRUE, $show_create = TRUE) {
1223
+		$send_disabled = ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE;
1224 1224
 		$template_args = array(
1225 1225
 			'tkt_row' => $default && empty($ticket) ? 'TICKETNUM' : $tktrow,
1226 1226
 			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1227 1227
 			'edit_prices_name' => $default && empty($price) ? 'PRICENAMEATTR' : 'edit_prices',
1228
-			'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 ),
1228
+			'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),
1229 1229
 			'PRC_ID' => $default && empty($price) ? 0 : $price->ID(),
1230 1230
 			'PRC_is_default' => $default && empty($price) ? 0 : $price->get('PRC_is_default'),
1231 1231
 			'PRC_name' => $default && empty($price) ? '' : $price->get('PRC_name'),
1232 1232
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1233 1233
 			'show_plus_or_minus' => $default && empty($price) ? '' : ' style="display:none;"',
1234
-			'show_plus' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
1235
-			'show_minus' => $default && empty( $price ) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
1236
-			'show_currency_symbol' => $default && empty( $price ) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : '' ),
1237
-			'PRC_amount' => $default && empty( $price ) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
1238
-			'show_percentage' => $default && empty( $price ) ? ' style="display:none;"' : ( $price->is_percent() ? '' : ' style="display:none;"' ),
1234
+			'show_plus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() || $price->is_base_price() ? ' style="display:none;"' : ''),
1235
+			'show_minus' => $default && empty($price) ? ' style="display:none;"' : ($price->is_discount() ? '' : ' style="display:none;"'),
1236
+			'show_currency_symbol' => $default && empty($price) ? ' style="display:none"' : ($price->is_percent() ? ' style="display:none"' : ''),
1237
+			'PRC_amount' => $default && empty($price) ? 0 : $price->get_pretty('PRC_amount', 'localized_float'),
1238
+			'show_percentage' => $default && empty($price) ? ' style="display:none;"' : ($price->is_percent() ? '' : ' style="display:none;"'),
1239 1239
 			'show_trash_icon' => $show_trash ? '' : ' style="display:none;"',
1240 1240
 			'show_create_button' => $show_create ? '' : ' style="display:none;"',
1241
-			'PRC_desc' => $default && empty( $price ) ? '' : $price->get('PRC_desc'),
1242
-			'disabled' => !empty( $ticket ) && $ticket->get('TKT_deleted') ? TRUE : FALSE
1241
+			'PRC_desc' => $default && empty($price) ? '' : $price->get('PRC_desc'),
1242
+			'disabled' => ! empty($ticket) && $ticket->get('TKT_deleted') ? TRUE : FALSE
1243 1243
 			);
1244 1244
 
1245
-	$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 );
1245
+	$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);
1246 1246
 
1247
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_price_row.template.php';
1248
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1247
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_price_row.template.php';
1248
+		return EEH_Template::display_template($template, $template_args, TRUE);
1249 1249
 	}
1250 1250
 
1251 1251
 
1252
-	protected function _get_price_type_selector( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1253
-		if ( $price->is_base_price() ) {
1254
-			return $this->_get_base_price_template( $tktrow, $prcrow, $price, $default );
1252
+	protected function _get_price_type_selector($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1253
+		if ($price->is_base_price()) {
1254
+			return $this->_get_base_price_template($tktrow, $prcrow, $price, $default);
1255 1255
 		} else {
1256
-			return $this->_get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled );
1256
+			return $this->_get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled);
1257 1257
 		}
1258 1258
 
1259 1259
 	}
1260 1260
 
1261 1261
 
1262
-	protected function _get_base_price_template( $tktrow, $prcrow, $price, $default ) {
1262
+	protected function _get_base_price_template($tktrow, $prcrow, $price, $default) {
1263 1263
 		$template_args = array(
1264 1264
 				'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1265
-				'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1266
-				'PRT_ID' => $default && empty( $price ) ? 1 : $price->get('PRT_ID'),
1265
+				'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1266
+				'PRT_ID' => $default && empty($price) ? 1 : $price->get('PRT_ID'),
1267 1267
 				'PRT_name' => __('Price', 'event_espresso'),
1268 1268
 				'price_selected_operator' => '+',
1269 1269
 				'price_selected_is_percent' => 0
1270 1270
 			);
1271
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_type_base.template.php';
1271
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_type_base.template.php';
1272 1272
 
1273
-		$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 );
1273
+		$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);
1274 1274
 
1275
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1275
+		return EEH_Template::display_template($template, $template_args, TRUE);
1276 1276
 	}
1277 1277
 
1278 1278
 
1279 1279
 
1280
-	protected function _get_price_modifier_template( $tktrow, $prcrow, $price, $default, $disabled = FALSE ) {
1281
-		$select_name = $default && empty( $price ) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices[' . $tktrow . '][' . $prcrow . '][PRT_ID]';
1282
-		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array( array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3' ) ) ) );
1283
-		$price_option_span_template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_option_span.template.php';
1284
-		$all_price_types = $default && empty( $price ) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso')) ) : array();
1285
-		$selected_price_type_id = $default && empty( $price ) ? 0 : $price->type();
1280
+	protected function _get_price_modifier_template($tktrow, $prcrow, $price, $default, $disabled = FALSE) {
1281
+		$select_name = $default && empty($price) ? 'edit_prices[TICKETNUM][PRICENUM][PRT_ID]' : 'edit_prices['.$tktrow.']['.$prcrow.'][PRT_ID]';
1282
+		$price_types = EE_Registry::instance()->load_model('Price_Type')->get_all(array(array('OR' => array('PBT_ID' => '2', 'PBT_ID*' => '3'))));
1283
+		$price_option_span_template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_option_span.template.php';
1284
+		$all_price_types = $default && empty($price) ? array(array('id' => 0, 'text' => __('Select Modifier', 'event_espresso'))) : array();
1285
+		$selected_price_type_id = $default && empty($price) ? 0 : $price->type();
1286 1286
 		$price_option_spans = '';
1287 1287
 		//setup pricetypes for selector
1288
-		foreach ( $price_types as $price_type ) {
1288
+		foreach ($price_types as $price_type) {
1289 1289
 			$all_price_types[] = array(
1290 1290
 				'id' => $price_type->ID(),
1291 1291
 				'text' => $price_type->get('PRT_name'),
@@ -1297,50 +1297,50 @@  discard block
 block discarded – undo
1297 1297
 				'PRT_operator' => $price_type->is_discount() ? '-' : '+',
1298 1298
 				'PRT_is_percent' => $price_type->get('PRT_is_percent') ? 1 : 0
1299 1299
 				);
1300
-			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE );
1300
+			$price_option_spans .= EEH_Template::display_template($price_option_span_template, $spanargs, TRUE);
1301 1301
 		}
1302 1302
 
1303
-		$select_params = $disabled ? 'style="width:auto;" disabled'  : 'style="width:auto;"';
1303
+		$select_params = $disabled ? 'style="width:auto;" disabled' : 'style="width:auto;"';
1304 1304
 		$main_name = $select_name;
1305
-		$select_name = $disabled ? 'archive_price[' . $tktrow . '][' . $prcrow . '][PRT_ID]' : $main_name;
1305
+		$select_name = $disabled ? 'archive_price['.$tktrow.']['.$prcrow.'][PRT_ID]' : $main_name;
1306 1306
 
1307 1307
 		$template_args = array(
1308 1308
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1309
-			'PRC_order' => $default && empty( $price ) ? 'PRICENUM' : $prcrow,
1310
-			'price_modifier_selector' => EEH_Form_Fields::select_input( $select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID' ),
1309
+			'PRC_order' => $default && empty($price) ? 'PRICENUM' : $prcrow,
1310
+			'price_modifier_selector' => EEH_Form_Fields::select_input($select_name, $all_price_types, $selected_price_type_id, $select_params, 'edit-price-PRT_ID'),
1311 1311
 			'main_name' => $main_name,
1312 1312
 			'selected_price_type_id' => $selected_price_type_id,
1313 1313
 			'price_option_spans' => $price_option_spans,
1314
-			'price_selected_operator' => $default && empty( $price ) ? '' : ( $price->is_discount() ? '-' : '+' ),
1315
-			'price_selected_is_percent' => $default && empty( $price ) ? '' : ( $price->is_percent() ? 1 : 0 ),
1314
+			'price_selected_operator' => $default && empty($price) ? '' : ($price->is_discount() ? '-' : '+'),
1315
+			'price_selected_is_percent' => $default && empty($price) ? '' : ($price->is_percent() ? 1 : 0),
1316 1316
 			'disabled' => $disabled
1317 1317
 			);
1318 1318
 
1319
-		$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 );
1319
+		$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);
1320 1320
 
1321
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_price_modifier_selector.template.php';
1321
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_price_modifier_selector.template.php';
1322 1322
 
1323
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1323
+		return EEH_Template::display_template($template, $template_args, TRUE);
1324 1324
 	}
1325 1325
 
1326 1326
 
1327 1327
 
1328
-	protected function _get_ticket_datetime_list_item( $dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default ) {
1329
-		$dttid = !empty($dtt) ? $dtt->ID() : 0;
1330
-		$displayrow = !empty($dtt) ? $dtt->get('DTT_order') : 0;
1331
-		$tkt_dtts = $ticket instanceof EE_Ticket && isset( $ticket_datetimes[$ticket->ID()] ) ? $ticket_datetimes[$ticket->ID()] : array();
1328
+	protected function _get_ticket_datetime_list_item($dttrow, $tktrow, $dtt, $ticket, $ticket_datetimes, $default) {
1329
+		$dttid = ! empty($dtt) ? $dtt->ID() : 0;
1330
+		$displayrow = ! empty($dtt) ? $dtt->get('DTT_order') : 0;
1331
+		$tkt_dtts = $ticket instanceof EE_Ticket && isset($ticket_datetimes[$ticket->ID()]) ? $ticket_datetimes[$ticket->ID()] : array();
1332 1332
 		$template_args = array(
1333
-			'dtt_row' => $default && empty( $dtt ) ? 'DTTNUM' : $dttrow,
1333
+			'dtt_row' => $default && empty($dtt) ? 'DTTNUM' : $dttrow,
1334 1334
 			'tkt_row' => $default ? 'TICKETNUM' : $tktrow,
1335
-			'ticket_datetime_selected' => in_array( $displayrow, $tkt_dtts ) ? ' ticket-selected' : '',
1336
-			'ticket_datetime_checked' => in_array( $displayrow, $tkt_dtts ) ? ' checked="checked"' : '',
1337
-			'DTT_name' => $default && empty( $dtt ) ? 'DTTNAME' : $dtt->get_dtt_display_name( TRUE ),
1335
+			'ticket_datetime_selected' => in_array($displayrow, $tkt_dtts) ? ' ticket-selected' : '',
1336
+			'ticket_datetime_checked' => in_array($displayrow, $tkt_dtts) ? ' checked="checked"' : '',
1337
+			'DTT_name' => $default && empty($dtt) ? 'DTTNAME' : $dtt->get_dtt_display_name(TRUE),
1338 1338
 			'tkt_status_class' => '',
1339 1339
 			);
1340 1340
 
1341
-		$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 );
1342
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1343
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1341
+		$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);
1342
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_datetimes_list_item.template.php';
1343
+		return EEH_Template::display_template($template, $template_args, TRUE);
1344 1344
 	}
1345 1345
 
1346 1346
 
@@ -1348,53 +1348,53 @@  discard block
 block discarded – undo
1348 1348
 	protected function _get_ticket_js_structure($all_dtts, $all_tickets) {
1349 1349
 		$template_args = array(
1350 1350
 			'default_datetime_edit_row' => $this->_get_dtt_edit_row('DTTNUM', NULL, TRUE, $all_dtts),
1351
-			'default_ticket_row' => $this->_get_ticket_row( 'TICKETNUM', NULL, array(), array(), TRUE),
1352
-			'default_price_row' => $this->_get_ticket_price_row( 'TICKETNUM', 'PRICENUM', NULL, TRUE, NULL ),
1351
+			'default_ticket_row' => $this->_get_ticket_row('TICKETNUM', NULL, array(), array(), TRUE),
1352
+			'default_price_row' => $this->_get_ticket_price_row('TICKETNUM', 'PRICENUM', NULL, TRUE, NULL),
1353 1353
 			'default_price_rows' => '',
1354 1354
 			'default_base_price_amount' => 0,
1355 1355
 			'default_base_price_name' => '',
1356 1356
 			'default_base_price_description' => '',
1357
-			'default_price_modifier_selector_row' => $this->_get_price_modifier_template( 'TICKETNUM', 'PRICENUM', NULL, TRUE ),
1358
-			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row( 'DTTNUM', NULL, array(), array(), TRUE ),
1357
+			'default_price_modifier_selector_row' => $this->_get_price_modifier_template('TICKETNUM', 'PRICENUM', NULL, TRUE),
1358
+			'default_available_tickets_for_datetime' => $this->_get_dtt_attached_tickets_row('DTTNUM', NULL, array(), array(), TRUE),
1359 1359
 			'existing_available_datetime_tickets_list' => '',
1360 1360
 			'existing_available_ticket_datetimes_list' => '',
1361
-			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE ),
1362
-			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item( 'DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE )
1361
+			'new_available_datetime_ticket_list_item' => $this->_get_datetime_tickets_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE),
1362
+			'new_available_ticket_datetime_list_item' => $this->_get_ticket_datetime_list_item('DTTNUM', 'TICKETNUM', NULL, NULL, array(), TRUE)
1363 1363
 			);
1364 1364
 
1365 1365
 		$tktrow = 1;
1366
-		foreach ( $all_tickets as $ticket ) {
1367
-			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item( 'DTTNUM', $tktrow, NULL, $ticket, array(), TRUE );
1366
+		foreach ($all_tickets as $ticket) {
1367
+			$template_args['existing_available_datetime_tickets_list'] .= $this->_get_datetime_tickets_list_item('DTTNUM', $tktrow, NULL, $ticket, array(), TRUE);
1368 1368
 			$tktrow++;
1369 1369
 		}
1370 1370
 
1371 1371
 
1372 1372
 		$dttrow = 1;
1373
-		foreach ( $all_dtts as $dtt ) {
1374
-			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item( $dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE );
1373
+		foreach ($all_dtts as $dtt) {
1374
+			$template_args['existing_available_ticket_datetimes_list'] .= $this->_get_ticket_datetime_list_item($dttrow, 'TICKETNUM', $dtt, NULL, array(), TRUE);
1375 1375
 			$dttrow++;
1376 1376
 		}
1377 1377
 
1378 1378
 		$default_prices = EE_Registry::instance()->load_model('Price')->get_all_default_prices();
1379 1379
 		$prcrow = 1;
1380
-		foreach ( $default_prices as $price ) {
1381
-			if ( $price->is_base_price() ) {
1380
+		foreach ($default_prices as $price) {
1381
+			if ($price->is_base_price()) {
1382 1382
 				$template_args['default_base_price_amount'] = $price->get_pretty('PRC_amount', 'localized_float');
1383 1383
 				$template_args['default_base_price_name'] = $price->get('PRC_name');
1384 1384
 				$template_args['default_base_price_description'] = $price->get('PRC_desc');
1385 1385
 				$prcrow++;
1386 1386
 				continue;
1387 1387
 			}
1388
-			$show_trash = ( count( $default_prices ) > 1 && $prcrow === 1 ) || count( $default_prices ) === 1  ? FALSE : TRUE;
1389
-			$show_create = count( $default_prices ) > 1 && count( $default_prices ) !== $prcrow ? FALSE : TRUE;
1390
-			$template_args['default_price_rows'] .= $this->_get_ticket_price_row( 'TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create );
1388
+			$show_trash = (count($default_prices) > 1 && $prcrow === 1) || count($default_prices) === 1 ? FALSE : TRUE;
1389
+			$show_create = count($default_prices) > 1 && count($default_prices) !== $prcrow ? FALSE : TRUE;
1390
+			$template_args['default_price_rows'] .= $this->_get_ticket_price_row('TICKETNUM', $prcrow, $price, TRUE, NULL, $show_trash, $show_create);
1391 1391
 			$prcrow++;
1392 1392
 		}
1393 1393
 
1394
-		$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 );
1394
+		$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);
1395 1395
 
1396
-		$template = PRICING_TEMPLATE_PATH . 'event_tickets_datetime_ticket_js_structure.template.php';
1397
-		return EEH_Template::display_template( $template, $template_args, TRUE );
1396
+		$template = PRICING_TEMPLATE_PATH.'event_tickets_datetime_ticket_js_structure.template.php';
1397
+		return EEH_Template::display_template($template, $template_args, TRUE);
1398 1398
 	}
1399 1399
 
1400 1400
 
Please login to merge, or discard this patch.
Braces   +21 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -165,8 +166,9 @@  discard block
 block discarded – undo
165 166
 
166 167
 	public function caf_updates( $update_callbacks ) {
167 168
 		foreach ( $update_callbacks as $key => $callback ) {
168
-			if ( $callback[1] == '_default_tickets_update' )
169
-				unset( $update_callbacks[$key] );
169
+			if ( $callback[1] == '_default_tickets_update' ) {
170
+							unset( $update_callbacks[$key] );
171
+			}
170 172
 		}
171 173
 
172 174
 		$update_callbacks[] = array( $this, 'dtt_and_tickets_caf_update' );
@@ -278,8 +280,9 @@  discard block
 block discarded – undo
278 280
 			$dtts_to_delete = array_diff( $old_datetimes, $saved_dtt_ids );
279 281
 			foreach ( $dtts_to_delete as $id ) {
280 282
 				$id = absint( $id );
281
-				if ( empty( $id ) )
282
-					continue;
283
+				if ( empty( $id ) ) {
284
+									continue;
285
+				}
283 286
 
284 287
 				$dtt_to_remove = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($id);
285 288
 
@@ -529,8 +532,9 @@  discard block
 block discarded – undo
529 532
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
530 533
 
531 534
 			//if this tkt is a default tkt we leave it alone cause it won't be attached to the datetime
532
-			if ( $tkt_to_remove->get('TKT_is_default') )
533
-				continue;
535
+			if ( $tkt_to_remove->get('TKT_is_default') ) {
536
+							continue;
537
+			}
534 538
 
535 539
 			// if this tkt has any registrations attached so then we just ARCHIVE
536 540
 			// because we don't actually permanently delete these tickets.
@@ -707,13 +711,16 @@  discard block
 block discarded – undo
707 711
 		}
708 712
 
709 713
 		//possibly need to save tkt
710
-		if ( ! $ticket->ID() )
711
-			$ticket->save();
714
+		if ( ! $ticket->ID() ) {
715
+					$ticket->save();
716
+		}
712 717
 
713 718
 		foreach ( $prices as $row => $prc ) {
714 719
 			$prt_id = !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL;
715
-			if ( empty($prt_id) )
716
-				continue; //prices MUST have a price type id.
720
+			if ( empty($prt_id) ) {
721
+							continue;
722
+			}
723
+			//prices MUST have a price type id.
717 724
 			$PRC_values = array(
718 725
 				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
719 726
 				'PRT_ID' => $prt_id,
@@ -872,8 +879,9 @@  discard block
 block discarded – undo
872 879
 				$datetime_tickets[$dttid][] = $tktrow;
873 880
 
874 881
 				//temporary cache of this datetime info for this ticket for later processing of ticket rows.
875
-				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) )
876
-					$ticket_datetimes[$tktid][] = $dttrow;
882
+				if ( !isset( $ticket_datetimes[$tktid] ) || ! in_array( $dttrow, $ticket_datetimes[$tktid] ) ) {
883
+									$ticket_datetimes[$tktid][] = $dttrow;
884
+				}
877 885
 			}
878 886
 			$dttrow++;
879 887
 		}
Please login to merge, or discard this patch.
core/db_classes/EE_Event.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1006,7 +1006,7 @@
 block discarded – undo
1006 1006
 	 *
1007 1007
 	 * @access public
1008 1008
 	 * @param boolean $echo     whether to return (FALSE), or echo out the result (TRUE)
1009
-	 * @return mixed void|string
1009
+	 * @return string void|string
1010 1010
 	 */
1011 1011
 	public function pretty_active_status( $echo = TRUE ) {
1012 1012
 		$active_status = $this->get_active_status();
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -352,8 +352,7 @@  discard block
 block discarded – undo
352 352
 		$short_desc = $this->get( 'EVT_short_desc' );
353 353
 		if ( !empty( $short_desc ) || $not_full_desc ) {
354 354
 			return $short_desc;
355
-		}
356
-		else {
355
+		} else {
357 356
 			$full_desc = $this->get( 'EVT_desc' );
358 357
 			return wp_trim_words( $full_desc, $num_words, $more );
359 358
 		}
@@ -965,8 +964,7 @@  discard block
 block discarded – undo
965 964
 	public function is_sold_out( $actual = FALSE ) {
966 965
 		if ( ! $actual ) {
967 966
 			return $this->status() == EEM_Event::sold_out;
968
-		}
969
-		else {
967
+		} else {
970 968
 			return $this->perform_sold_out_status_check();
971 969
 		}
972 970
 	}
@@ -1158,8 +1156,7 @@  discard block
 block discarded – undo
1158 1156
 	public function get_permalink() {
1159 1157
 		if ( $this->external_url() ) {
1160 1158
 			return $this->external_url();
1161
-		}
1162
-		else {
1159
+		} else {
1163 1160
 			return parent::get_permalink();
1164 1161
 		}
1165 1162
 	}
Please login to merge, or discard this patch.
Spacing   +216 added lines, -216 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 /**
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 *                             		    date_format and the second value is the time format
36 36
 	 * @return EE_Event
37 37
 	 */
38
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
39
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
40
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
38
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
39
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
40
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
41 41
 	}
42 42
 
43 43
 
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 *                          		the website will be used.
49 49
 	 * @return EE_Event
50 50
 	 */
51
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
52
-		return new self( $props_n_values, TRUE, $timezone );
51
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
52
+		return new self($props_n_values, TRUE, $timezone);
53 53
 	}
54 54
 
55 55
 
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
 	 * @param mixed  $field_value
62 62
 	 * @param bool   $use_default
63 63
 	 */
64
-	public function set( $field_name, $field_value, $use_default = false ) {
65
-		switch ( $field_name ) {
64
+	public function set($field_name, $field_value, $use_default = false) {
65
+		switch ($field_name) {
66 66
 			case 'status' :
67
-				$this->set_status( $field_value, $use_default );
67
+				$this->set_status($field_value, $use_default);
68 68
 				break;
69 69
 			default :
70
-				parent::set( $field_name, $field_value, $use_default );
70
+				parent::set($field_name, $field_value, $use_default);
71 71
 		}
72 72
 	}
73 73
 
@@ -86,29 +86,29 @@  discard block
 block discarded – undo
86 86
 	 * @return bool|void
87 87
 	 * @throws \EE_Error
88 88
 	 */
89
-	public function set_status( $new_status = null, $use_default = false ) {
89
+	public function set_status($new_status = null, $use_default = false) {
90 90
 		// get current Event status
91 91
 		$old_status = $this->status();
92 92
 		// if status has changed
93
-		if ( $old_status != $new_status ) {
93
+		if ($old_status != $new_status) {
94 94
 			// TO sold_out
95
-			if ( $new_status == EEM_Event::sold_out ) {
95
+			if ($new_status == EEM_Event::sold_out) {
96 96
 				// save the previous event status so that we can revert if the event is no longer sold out
97
-				$this->add_post_meta( '_previous_event_status', $old_status );
98
-				do_action( 'AHEE__EE_Event__set_status__to_sold_out', $this, $old_status, $new_status );
97
+				$this->add_post_meta('_previous_event_status', $old_status);
98
+				do_action('AHEE__EE_Event__set_status__to_sold_out', $this, $old_status, $new_status);
99 99
 				// OR FROM  sold_out
100
-			} else if ( $old_status == EEM_Event::sold_out ) {
101
-				$this->delete_post_meta( '_previous_event_status' );
102
-				do_action( 'AHEE__EE_Event__set_status__from_sold_out', $this, $old_status, $new_status );
100
+			} else if ($old_status == EEM_Event::sold_out) {
101
+				$this->delete_post_meta('_previous_event_status');
102
+				do_action('AHEE__EE_Event__set_status__from_sold_out', $this, $old_status, $new_status);
103 103
 			}
104 104
 			// update status
105
-			parent::set( 'status', $new_status, $use_default );
106
-			do_action( 'AHEE__EE_Event__set_status__after_update', $this );
105
+			parent::set('status', $new_status, $use_default);
106
+			do_action('AHEE__EE_Event__set_status__after_update', $this);
107 107
 			return true;
108 108
 		} else {
109 109
 			// even though the old value matches the new value, it's still good to
110 110
 			// allow the parent set method to have a say
111
-			parent::set( 'status', $new_status, $use_default );
111
+			parent::set('status', $new_status, $use_default);
112 112
 			return true;
113 113
 		}
114 114
 	}
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 	 * @param array $query_params like EEM_Base::get_all
122 122
 	 * @return EE_Datetime[]
123 123
 	 */
124
-	public function datetimes( $query_params = array() ) {
125
-		return $this->get_many_related( 'Datetime', $query_params );
124
+	public function datetimes($query_params = array()) {
125
+		return $this->get_many_related('Datetime', $query_params);
126 126
 	}
127 127
 
128 128
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * @return EE_Datetime[]
134 134
 	 */
135 135
 	public function datetimes_in_chronological_order() {
136
-		return $this->get_many_related( 'Datetime', array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) );
136
+		return $this->get_many_related('Datetime', array('order_by' => array('DTT_EVT_start' => 'ASC')));
137 137
 	}
138 138
 
139 139
 
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 	 * @param null $limit
150 150
 	 * @return \EE_Datetime[]
151 151
 	 */
152
-	public function datetimes_ordered( $show_expired = true, $show_deleted = false, $limit = null ) {
153
-		return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_event_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted, $limit );
152
+	public function datetimes_ordered($show_expired = true, $show_deleted = false, $limit = null) {
153
+		return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_event_ordered_by_DTT_order($this->ID(), $show_expired, $show_deleted, $limit);
154 154
 	}
155 155
 
156 156
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 * @return EE_Datetime
161 161
 	 */
162 162
 	public function first_datetime() {
163
-		return $this->get_first_related( 'Datetime' );
163
+		return $this->get_first_related('Datetime');
164 164
 	}
165 165
 
166 166
 
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 	 * @param bool $try_to_exclude_deleted
172 172
 	 * @return EE_Datetime
173 173
 	 */
174
-	public function primary_datetime( $try_to_exclude_expired = TRUE, $try_to_exclude_deleted = TRUE ) {
175
-		if ( !empty ( $this->_Primary_Datetime ) ) {
174
+	public function primary_datetime($try_to_exclude_expired = TRUE, $try_to_exclude_deleted = TRUE) {
175
+		if ( ! empty ($this->_Primary_Datetime)) {
176 176
 			return $this->_Primary_Datetime;
177 177
 		}
178
-		$this->_Primary_Datetime = EEM_Datetime::instance( $this->_timezone )->get_primary_datetime_for_event( $this->ID(), $try_to_exclude_expired, $try_to_exclude_deleted );
178
+		$this->_Primary_Datetime = EEM_Datetime::instance($this->_timezone)->get_primary_datetime_for_event($this->ID(), $try_to_exclude_expired, $try_to_exclude_deleted);
179 179
 		return $this->_Primary_Datetime;
180 180
 	}
181 181
 
@@ -186,30 +186,30 @@  discard block
 block discarded – undo
186 186
 	 * @param array $query_params like EEM_Base::get_all
187 187
 	 * @return EE_Ticket[]
188 188
 	 */
189
-	public function tickets( $query_params = array() ) {
189
+	public function tickets($query_params = array()) {
190 190
 		//first get all datetimes
191 191
 		$datetimes = $this->datetimes_ordered();
192
-		if ( ! $datetimes ) {
192
+		if ( ! $datetimes) {
193 193
 			return array();
194 194
 		}
195 195
 
196 196
 		$datetime_ids = array();
197
-		foreach ( $datetimes as $datetime ) {
197
+		foreach ($datetimes as $datetime) {
198 198
 			$datetime_ids[] = $datetime->ID();
199 199
 		}
200 200
 
201
-		$where_params = array( 'Datetime.DTT_ID' => array( 'IN', $datetime_ids ) );
201
+		$where_params = array('Datetime.DTT_ID' => array('IN', $datetime_ids));
202 202
 
203 203
 		//if incoming $query_params has where conditions let's merge but not override existing.
204
-		if ( is_array( $query_params ) && isset( $query_params[0]) ) {
205
-			$where_params = array_merge( $query_params[0], $where_params );
206
-			unset( $query_params[0] );
204
+		if (is_array($query_params) && isset($query_params[0])) {
205
+			$where_params = array_merge($query_params[0], $where_params);
206
+			unset($query_params[0]);
207 207
 		}
208 208
 
209 209
 		//now add $where_params to $query_params
210 210
 		$query_params[0] = $where_params;
211 211
 
212
-		return EEM_Ticket::instance()->get_all( $query_params );
212
+		return EEM_Ticket::instance()->get_all($query_params);
213 213
 	}
214 214
 
215 215
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 * @return bool
219 219
 	 */
220 220
 	function additional_limit() {
221
-		return $this->get( 'EVT_additional_limit' );
221
+		return $this->get('EVT_additional_limit');
222 222
 	}
223 223
 
224 224
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 	 * @return bool
228 228
 	 */
229 229
 	function allow_overflow() {
230
-		return $this->get( 'EVT_allow_overflow' );
230
+		return $this->get('EVT_allow_overflow');
231 231
 	}
232 232
 
233 233
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	 * @return bool
237 237
 	 */
238 238
 	function created() {
239
-		return $this->get( 'EVT_created' );
239
+		return $this->get('EVT_created');
240 240
 	}
241 241
 
242 242
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 * @return bool
246 246
 	 */
247 247
 	function description() {
248
-		return $this->get( 'EVT_desc' );
248
+		return $this->get('EVT_desc');
249 249
 	}
250 250
 
251 251
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	 * @return string of html
256 256
 	 */
257 257
 	function description_filtered() {
258
-		return $this->get_pretty( 'EVT_desc' );
258
+		return $this->get_pretty('EVT_desc');
259 259
 	}
260 260
 
261 261
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	 * @return bool
265 265
 	 */
266 266
 	function display_description() {
267
-		return $this->get( 'EVT_display_desc' );
267
+		return $this->get('EVT_display_desc');
268 268
 	}
269 269
 
270 270
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 * @return bool
274 274
 	 */
275 275
 	function display_ticket_selector() {
276
-		return (bool)$this->get( 'EVT_display_ticket_selector' );
276
+		return (bool) $this->get('EVT_display_ticket_selector');
277 277
 	}
278 278
 
279 279
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 * @return bool
283 283
 	 */
284 284
 	function external_url() {
285
-		return $this->get( 'EVT_external_URL' );
285
+		return $this->get('EVT_external_URL');
286 286
 	}
287 287
 
288 288
 
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 	 * @return bool
292 292
 	 */
293 293
 	function member_only() {
294
-		return $this->get( 'EVT_member_only' );
294
+		return $this->get('EVT_member_only');
295 295
 	}
296 296
 
297 297
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	 * @return bool
301 301
 	 */
302 302
 	function phone() {
303
-		return $this->get( 'EVT_phone' );
303
+		return $this->get('EVT_phone');
304 304
 	}
305 305
 
306 306
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 * @return bool
310 310
 	 */
311 311
 	function modified() {
312
-		return $this->get( 'EVT_modified' );
312
+		return $this->get('EVT_modified');
313 313
 	}
314 314
 
315 315
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	 * @return bool
319 319
 	 */
320 320
 	function name() {
321
-		return $this->get( 'EVT_name' );
321
+		return $this->get('EVT_name');
322 322
 	}
323 323
 
324 324
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	 * @return bool
328 328
 	 */
329 329
 	function order() {
330
-		return $this->get( 'EVT_order' );
330
+		return $this->get('EVT_order');
331 331
 	}
332 332
 
333 333
 
@@ -336,8 +336,8 @@  discard block
 block discarded – undo
336 336
 	 * @return bool|string
337 337
 	 */
338 338
 	function default_registration_status() {
339
-		$event_default_registration_status = $this->get( 'EVT_default_registration_status' );
340
-		return !empty( $event_default_registration_status ) ? $event_default_registration_status : EE_Registry::instance()->CFG->registration->default_STS_ID;
339
+		$event_default_registration_status = $this->get('EVT_default_registration_status');
340
+		return ! empty($event_default_registration_status) ? $event_default_registration_status : EE_Registry::instance()->CFG->registration->default_STS_ID;
341 341
 	}
342 342
 
343 343
 
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
 	 * @param bool $not_full_desc
349 349
 	 * @return bool|string
350 350
 	 */
351
-	function short_description( $num_words = 55, $more = NULL, $not_full_desc = FALSE ) {
352
-		$short_desc = $this->get( 'EVT_short_desc' );
353
-		if ( !empty( $short_desc ) || $not_full_desc ) {
351
+	function short_description($num_words = 55, $more = NULL, $not_full_desc = FALSE) {
352
+		$short_desc = $this->get('EVT_short_desc');
353
+		if ( ! empty($short_desc) || $not_full_desc) {
354 354
 			return $short_desc;
355 355
 		}
356 356
 		else {
357
-			$full_desc = $this->get( 'EVT_desc' );
358
-			return wp_trim_words( $full_desc, $num_words, $more );
357
+			$full_desc = $this->get('EVT_desc');
358
+			return wp_trim_words($full_desc, $num_words, $more);
359 359
 		}
360 360
 	}
361 361
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 * @return bool
366 366
 	 */
367 367
 	function slug() {
368
-		return $this->get( 'EVT_slug' );
368
+		return $this->get('EVT_slug');
369 369
 	}
370 370
 
371 371
 
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 	 * @return bool
375 375
 	 */
376 376
 	function timezone_string() {
377
-		return $this->get( 'EVT_timezone_string' );
377
+		return $this->get('EVT_timezone_string');
378 378
 	}
379 379
 
380 380
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	 * @return bool
384 384
 	 */
385 385
 	function visible_on() {
386
-		return $this->get( 'EVT_visible_on' );
386
+		return $this->get('EVT_visible_on');
387 387
 	}
388 388
 
389 389
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 	 * @return bool
393 393
 	 */
394 394
 	function wp_user() {
395
-		return $this->get( 'EVT_wp_user' );
395
+		return $this->get('EVT_wp_user');
396 396
 	}
397 397
 
398 398
 
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 	 * @return bool
402 402
 	 */
403 403
 	function donations() {
404
-		return $this->get( 'EVT_donations' );
404
+		return $this->get('EVT_donations');
405 405
 	}
406 406
 
407 407
 
@@ -409,8 +409,8 @@  discard block
 block discarded – undo
409 409
 	/**
410 410
 	 * @param $limit
411 411
 	 */
412
-	function set_additional_limit( $limit ) {
413
-		$this->set( 'EVT_additional_limit', $limit );
412
+	function set_additional_limit($limit) {
413
+		$this->set('EVT_additional_limit', $limit);
414 414
 	}
415 415
 
416 416
 
@@ -418,8 +418,8 @@  discard block
 block discarded – undo
418 418
 	/**
419 419
 	 * @param $created
420 420
 	 */
421
-	function set_created( $created ) {
422
-		$this->set( 'EVT_created', $created );
421
+	function set_created($created) {
422
+		$this->set('EVT_created', $created);
423 423
 	}
424 424
 
425 425
 
@@ -427,8 +427,8 @@  discard block
 block discarded – undo
427 427
 	/**
428 428
 	 * @param $desc
429 429
 	 */
430
-	function set_description( $desc ) {
431
-		$this->set( 'EVT_desc', $desc );
430
+	function set_description($desc) {
431
+		$this->set('EVT_desc', $desc);
432 432
 	}
433 433
 
434 434
 
@@ -436,8 +436,8 @@  discard block
 block discarded – undo
436 436
 	/**
437 437
 	 * @param $display_desc
438 438
 	 */
439
-	function set_display_description( $display_desc ) {
440
-		$this->set( 'EVT_display_desc', $display_desc );
439
+	function set_display_description($display_desc) {
440
+		$this->set('EVT_display_desc', $display_desc);
441 441
 	}
442 442
 
443 443
 
@@ -445,8 +445,8 @@  discard block
 block discarded – undo
445 445
 	/**
446 446
 	 * @param $display_ticket_selector
447 447
 	 */
448
-	function set_display_ticket_selector( $display_ticket_selector ) {
449
-		$this->set( 'EVT_display_ticket_selector', $display_ticket_selector );
448
+	function set_display_ticket_selector($display_ticket_selector) {
449
+		$this->set('EVT_display_ticket_selector', $display_ticket_selector);
450 450
 	}
451 451
 
452 452
 
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 	/**
455 455
 	 * @param $external_url
456 456
 	 */
457
-	function set_external_url( $external_url ) {
458
-		$this->set( 'EVT_external_URL', $external_url );
457
+	function set_external_url($external_url) {
458
+		$this->set('EVT_external_URL', $external_url);
459 459
 	}
460 460
 
461 461
 
@@ -463,8 +463,8 @@  discard block
 block discarded – undo
463 463
 	/**
464 464
 	 * @param $member_only
465 465
 	 */
466
-	function set_member_only( $member_only ) {
467
-		$this->set( 'EVT_member_only', $member_only );
466
+	function set_member_only($member_only) {
467
+		$this->set('EVT_member_only', $member_only);
468 468
 	}
469 469
 
470 470
 
@@ -472,8 +472,8 @@  discard block
 block discarded – undo
472 472
 	/**
473 473
 	 * @param $event_phone
474 474
 	 */
475
-	function set_event_phone( $event_phone ) {
476
-		$this->set( 'EVT_phone', $event_phone );
475
+	function set_event_phone($event_phone) {
476
+		$this->set('EVT_phone', $event_phone);
477 477
 	}
478 478
 
479 479
 
@@ -481,8 +481,8 @@  discard block
 block discarded – undo
481 481
 	/**
482 482
 	 * @param $modified
483 483
 	 */
484
-	function set_modified( $modified ) {
485
-		$this->set( 'EVT_modified', $modified );
484
+	function set_modified($modified) {
485
+		$this->set('EVT_modified', $modified);
486 486
 	}
487 487
 
488 488
 
@@ -490,8 +490,8 @@  discard block
 block discarded – undo
490 490
 	/**
491 491
 	 * @param $name
492 492
 	 */
493
-	function set_name( $name ) {
494
-		$this->set( 'EVT_name', $name );
493
+	function set_name($name) {
494
+		$this->set('EVT_name', $name);
495 495
 	}
496 496
 
497 497
 
@@ -499,8 +499,8 @@  discard block
 block discarded – undo
499 499
 	/**
500 500
 	 * @param $order
501 501
 	 */
502
-	function set_order( $order ) {
503
-		$this->set( 'EVT_order', $order );
502
+	function set_order($order) {
503
+		$this->set('EVT_order', $order);
504 504
 	}
505 505
 
506 506
 
@@ -508,8 +508,8 @@  discard block
 block discarded – undo
508 508
 	/**
509 509
 	 * @param $short_desc
510 510
 	 */
511
-	function set_short_description( $short_desc ) {
512
-		$this->set( 'EVT_short_desc', $short_desc );
511
+	function set_short_description($short_desc) {
512
+		$this->set('EVT_short_desc', $short_desc);
513 513
 	}
514 514
 
515 515
 
@@ -517,8 +517,8 @@  discard block
 block discarded – undo
517 517
 	/**
518 518
 	 * @param $slug
519 519
 	 */
520
-	function set_slug( $slug ) {
521
-		$this->set( 'EVT_slug', $slug );
520
+	function set_slug($slug) {
521
+		$this->set('EVT_slug', $slug);
522 522
 	}
523 523
 
524 524
 
@@ -526,8 +526,8 @@  discard block
 block discarded – undo
526 526
 	/**
527 527
 	 * @param $timezone_string
528 528
 	 */
529
-	function set_timezone_string( $timezone_string ) {
530
-		$this->set( 'EVT_timezone_string', $timezone_string );
529
+	function set_timezone_string($timezone_string) {
530
+		$this->set('EVT_timezone_string', $timezone_string);
531 531
 	}
532 532
 
533 533
 
@@ -535,8 +535,8 @@  discard block
 block discarded – undo
535 535
 	/**
536 536
 	 * @param $visible_on
537 537
 	 */
538
-	function set_visible_on( $visible_on ) {
539
-		$this->set( 'EVT_visible_on', $visible_on );
538
+	function set_visible_on($visible_on) {
539
+		$this->set('EVT_visible_on', $visible_on);
540 540
 	}
541 541
 
542 542
 
@@ -544,8 +544,8 @@  discard block
 block discarded – undo
544 544
 	/**
545 545
 	 * @param $wp_user
546 546
 	 */
547
-	function set_wp_user( $wp_user ) {
548
-		$this->set( 'EVT_wp_user', $wp_user );
547
+	function set_wp_user($wp_user) {
548
+		$this->set('EVT_wp_user', $wp_user);
549 549
 	}
550 550
 
551 551
 
@@ -553,8 +553,8 @@  discard block
 block discarded – undo
553 553
 	/**
554 554
 	 * @param $default_registration_status
555 555
 	 */
556
-	function set_default_registration_status( $default_registration_status ) {
557
-		$this->set( 'EVT_default_registration_status', $default_registration_status );
556
+	function set_default_registration_status($default_registration_status) {
557
+		$this->set('EVT_default_registration_status', $default_registration_status);
558 558
 	}
559 559
 
560 560
 
@@ -562,8 +562,8 @@  discard block
 block discarded – undo
562 562
 	/**
563 563
 	 * @param $donations
564 564
 	 */
565
-	function set_donations( $donations ) {
566
-		$this->set( 'EVT_donations', $donations );
565
+	function set_donations($donations) {
566
+		$this->set('EVT_donations', $donations);
567 567
 	}
568 568
 
569 569
 
@@ -573,8 +573,8 @@  discard block
 block discarded – undo
573 573
 	 * @param EE_Venue /int $venue_id_or_obj
574 574
 	 * @return EE_Venue
575 575
 	 */
576
-	function add_venue( $venue_id_or_obj ) {
577
-		return $this->_add_relation_to( $venue_id_or_obj, 'Venue' );
576
+	function add_venue($venue_id_or_obj) {
577
+		return $this->_add_relation_to($venue_id_or_obj, 'Venue');
578 578
 	}
579 579
 
580 580
 
@@ -584,8 +584,8 @@  discard block
 block discarded – undo
584 584
 	 * @param EE_Venue /int $venue_id_or_obj
585 585
 	 * @return EE_Venue
586 586
 	 */
587
-	function remove_venue( $venue_id_or_obj ) {
588
-		return $this->_remove_relation_to( $venue_id_or_obj, 'Venue' );
587
+	function remove_venue($venue_id_or_obj) {
588
+		return $this->_remove_relation_to($venue_id_or_obj, 'Venue');
589 589
 	}
590 590
 
591 591
 
@@ -595,8 +595,8 @@  discard block
 block discarded – undo
595 595
 	 * @param array $query_params like EEM_Base::get_all's $query_params
596 596
 	 * @return EE_Venue[]
597 597
 	 */
598
-	function venues( $query_params = array() ) {
599
-		return $this->get_many_related( 'Venue', $query_params );
598
+	function venues($query_params = array()) {
599
+		return $this->get_many_related('Venue', $query_params);
600 600
 	}
601 601
 
602 602
 
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 	 */
609 609
 	private function _has_ID_and_is_published() {
610 610
 		// first check if event id is present and not NULL, then check if this event is published (or any of the equivalent "published" statuses)
611
-		return ( $this->ID() && $this->ID() !== NULL && ( $this->status() == 'publish' || $this->status() == EEM_Event::sold_out || $this->status() == EEM_Event::postponed || $this->status() == EEM_Event::cancelled ) ) ? TRUE : FALSE;
611
+		return ($this->ID() && $this->ID() !== NULL && ($this->status() == 'publish' || $this->status() == EEM_Event::sold_out || $this->status() == EEM_Event::postponed || $this->status() == EEM_Event::cancelled)) ? TRUE : FALSE;
612 612
 	}
613 613
 
614 614
 
@@ -620,21 +620,21 @@  discard block
 block discarded – undo
620 620
 	 */
621 621
 	public function is_upcoming() {
622 622
 		// check if event id is present and if this event is published
623
-		if ( $this->is_inactive() ) {
623
+		if ($this->is_inactive()) {
624 624
 			return FALSE;
625 625
 		}
626 626
 		// set initial value
627 627
 		$upcoming = FALSE;
628 628
 		//next let's get all datetimes and loop through them
629 629
 		$datetimes = $this->datetimes_in_chronological_order();
630
-		foreach ( $datetimes as $datetime ) {
631
-			if ( $datetime instanceof EE_Datetime ) {
630
+		foreach ($datetimes as $datetime) {
631
+			if ($datetime instanceof EE_Datetime) {
632 632
 				//if this dtt is expired then we continue cause one of the other datetimes might be upcoming.
633
-				if ( $datetime->is_expired() ) {
633
+				if ($datetime->is_expired()) {
634 634
 					continue;
635 635
 				}
636 636
 				//if this dtt is active then we return false.
637
-				if ( $datetime->is_active() ) {
637
+				if ($datetime->is_active()) {
638 638
 					return FALSE;
639 639
 				}
640 640
 				//otherwise let's check upcoming status
@@ -651,21 +651,21 @@  discard block
 block discarded – undo
651 651
 	 */
652 652
 	public function is_active() {
653 653
 		// check if event id is present and if this event is published
654
-		if ( $this->is_inactive() ) {
654
+		if ($this->is_inactive()) {
655 655
 			return FALSE;
656 656
 		}
657 657
 		// set initial value
658 658
 		$active = FALSE;
659 659
 		//next let's get all datetimes and loop through them
660 660
 		$datetimes = $this->datetimes_in_chronological_order();
661
-		foreach ( $datetimes as $datetime ) {
662
-			if ( $datetime instanceof EE_Datetime ) {
661
+		foreach ($datetimes as $datetime) {
662
+			if ($datetime instanceof EE_Datetime) {
663 663
 				//if this dtt is expired then we continue cause one of the other datetimes might be active.
664
-				if ( $datetime->is_expired() ) {
664
+				if ($datetime->is_expired()) {
665 665
 					continue;
666 666
 				}
667 667
 				//if this dtt is upcoming then we return false.
668
-				if ( $datetime->is_upcoming() ) {
668
+				if ($datetime->is_upcoming()) {
669 669
 					return FALSE;
670 670
 				}
671 671
 				//otherwise let's check active status
@@ -682,17 +682,17 @@  discard block
 block discarded – undo
682 682
 	 */
683 683
 	public function is_expired() {
684 684
 		// check if event id is present and if this event is published
685
-		if ( $this->is_inactive() ) {
685
+		if ($this->is_inactive()) {
686 686
 			return FALSE;
687 687
 		}
688 688
 		// set initial value
689 689
 		$expired = FALSE;
690 690
 		//first let's get all datetimes and loop through them
691 691
 		$datetimes = $this->datetimes_in_chronological_order();
692
-		foreach ( $datetimes as $datetime ) {
693
-			if ( $datetime instanceof EE_Datetime ) {
692
+		foreach ($datetimes as $datetime) {
693
+			if ($datetime instanceof EE_Datetime) {
694 694
 				//if this dtt is upcoming or active then we return false.
695
-				if ( $datetime->is_upcoming() || $datetime->is_active() ) {
695
+				if ($datetime->is_upcoming() || $datetime->is_active()) {
696 696
 					return FALSE;
697 697
 				}
698 698
 				//otherwise let's check active status
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 	 */
710 710
 	public function is_inactive() {
711 711
 		// check if event id is present and if this event is published
712
-		if ( $this->_has_ID_and_is_published() ) {
712
+		if ($this->_has_ID_and_is_published()) {
713 713
 			return FALSE;
714 714
 		}
715 715
 		return TRUE;
@@ -727,37 +727,37 @@  discard block
 block discarded – undo
727 727
 	 */
728 728
 	public function perform_sold_out_status_check() {
729 729
 		// get all unexpired untrashed tickets
730
-		$tickets = $this->tickets( array(
730
+		$tickets = $this->tickets(array(
731 731
 			array(
732
-				'TKT_end_date'   => array( '>=', EEM_Ticket::instance()->current_time_for_query( 'TKT_end_date' ) ),
732
+				'TKT_end_date'   => array('>=', EEM_Ticket::instance()->current_time_for_query('TKT_end_date')),
733 733
 				'TKT_deleted'    => false
734 734
 			)
735 735
 		));
736 736
 		// if all the tickets are just expired, then don't update the event status to sold out
737
-		if ( empty( $tickets )) {
737
+		if (empty($tickets)) {
738 738
 			return true;
739 739
 		}
740 740
 		// set initial value
741 741
 		$spaces_remaining = 0;
742
-		foreach( $tickets as $ticket ) {
743
-			if ( $ticket instanceof EE_Ticket ) {
744
-				$spaces_remaining += $ticket->qty( 'saleable' );
742
+		foreach ($tickets as $ticket) {
743
+			if ($ticket instanceof EE_Ticket) {
744
+				$spaces_remaining += $ticket->qty('saleable');
745 745
 			}
746 746
 		}
747
-		if ( $spaces_remaining === 0 ) {
748
-			$this->set_status( EEM_Event::sold_out );
749
-			if ( !is_admin() || ( is_admin() && defined( 'DOING_AJAX' ) ) ) {
747
+		if ($spaces_remaining === 0) {
748
+			$this->set_status(EEM_Event::sold_out);
749
+			if ( ! is_admin() || (is_admin() && defined('DOING_AJAX'))) {
750 750
 				$this->save();
751 751
 			}
752 752
 			$sold_out = TRUE;
753 753
 		} else {
754 754
 			$sold_out = FALSE;
755 755
 			// was event previously marked as sold out ?
756
-			if ( $this->status() == EEM_Event::sold_out ) {
756
+			if ($this->status() == EEM_Event::sold_out) {
757 757
 				// revert status to previous value, if it was set
758
-				$previous_event_status = $this->get_post_meta( '_previous_event_status', true );
759
-				if ( $previous_event_status ) {
760
-					$this->set_status( $previous_event_status );
758
+				$previous_event_status = $this->get_post_meta('_previous_event_status', true);
759
+				if ($previous_event_status) {
760
+					$this->set_status($previous_event_status);
761 761
 				}
762 762
 			}
763 763
 		}
@@ -781,15 +781,15 @@  discard block
 block discarded – undo
781 781
 	 */
782 782
 	public function spaces_remaining_for_sale() {
783 783
 		//first get total available spaces including consideration for tickets that have already sold.
784
-		$spaces_available = $this->total_available_spaces( true );
784
+		$spaces_available = $this->total_available_spaces(true);
785 785
 
786 786
 		//if total available = 0, then exit right away because that means everything is expired.
787
-		if ( $spaces_available === 0 ) {
787
+		if ($spaces_available === 0) {
788 788
 			return 0;
789 789
 		}
790 790
 
791 791
 		//subtract total approved registrations from spaces available to get how many are remaining.
792
-		$spots_taken = EEM_Registration::instance()->count( array( array( 'EVT_ID' => $this->ID(), 'STS_ID' => EEM_Registration::status_id_approved ) ), 'REG_ID', true );
792
+		$spots_taken = EEM_Registration::instance()->count(array(array('EVT_ID' => $this->ID(), 'STS_ID' => EEM_Registration::status_id_approved)), 'REG_ID', true);
793 793
 		$spaces_remaining = $spaces_available - $spots_taken;
794 794
 
795 795
 		return $spaces_remaining > 0 ? $spaces_remaining : 0;
@@ -822,29 +822,29 @@  discard block
 block discarded – undo
822 822
 	 *
823 823
 	 * @return  int|float  (Note: if EE_INF is returned its considered a float by PHP)
824 824
 	 */
825
-	public function total_available_spaces( $current_total_available = false ) {
825
+	public function total_available_spaces($current_total_available = false) {
826 826
 		$spaces_available = 0;
827 827
 
828 828
 		//first get all tickets on the event and include expired tickets
829
-		$tickets = $this->tickets( array( 'default_where_conditions' => 'none' ) );
829
+		$tickets = $this->tickets(array('default_where_conditions' => 'none'));
830 830
 		$ticket_sums = array();
831 831
 		$datetime_limits = array();
832 832
 
833 833
 		//loop through tickets and normalize them
834
-		foreach ( $tickets as $ticket ) {
835
-			$datetimes = $ticket->datetimes( array( 'order_by' => array( 'DTT_reg_limit' => 'ASC' ) ) );
834
+		foreach ($tickets as $ticket) {
835
+			$datetimes = $ticket->datetimes(array('order_by' => array('DTT_reg_limit' => 'ASC')));
836 836
 
837
-			if ( empty( $datetimes ) ) {
837
+			if (empty($datetimes)) {
838 838
 				continue;
839 839
 			}
840 840
 
841 841
 			//first datetime should be the lowest datetime
842
-			$least_datetime = reset( $datetimes );
842
+			$least_datetime = reset($datetimes);
843 843
 
844 844
 			//lets reset the ticket quantity to be the lower of either the lowest datetime reg limit or the ticket quantity
845 845
 			//IF datetimes sold (and we're not doing current live total available, then use spaces remaining for datetime, not reg_limit.
846
-			if ( $current_total_available ) {
847
-				if ( $ticket->is_remaining() ) {
846
+			if ($current_total_available) {
847
+				if ($ticket->is_remaining()) {
848 848
 					$remaining = $ticket->remaining();
849 849
 				} else {
850 850
 					$spaces_available += $ticket->sold();
@@ -852,23 +852,23 @@  discard block
 block discarded – undo
852 852
 					continue;
853 853
 				}
854 854
 			} else {
855
-				$remaining = min( $ticket->qty(), $least_datetime->reg_limit() );
855
+				$remaining = min($ticket->qty(), $least_datetime->reg_limit());
856 856
 			}
857 857
 
858 858
 			//if $ticket_limit == infinity then let's drop out right away and just return that because any infinity amount trumps all other "available" amounts.
859
-			if ( $remaining === EE_INF ) {
859
+			if ($remaining === EE_INF) {
860 860
 				return EE_INF;
861 861
 			}
862 862
 
863 863
 			//multiply normalized $tkt quantity by the number of datetimes on the ticket as the "sum"
864 864
 			//also include the sum of all the datetime reg limits on the ticket for breaking ties.
865
-			$ticket_sums[$ticket->ID()]['sum'] = $remaining * count( $datetimes );
865
+			$ticket_sums[$ticket->ID()]['sum'] = $remaining * count($datetimes);
866 866
 			$ticket_sums[$ticket->ID()]['datetime_sums'] = 0;
867
-			foreach ( $datetimes as $datetime ) {
868
-				if ( $datetime->reg_limit() === EE_INF ) {
867
+			foreach ($datetimes as $datetime) {
868
+				if ($datetime->reg_limit() === EE_INF) {
869 869
 					$ticket_sums[$ticket->ID()]['datetime_sums'] = EE_INF;
870 870
 				} else {
871
-					$ticket_sums[ $ticket->ID() ]['datetime_sums'] += $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit();
871
+					$ticket_sums[$ticket->ID()]['datetime_sums'] += $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit();
872 872
 				}
873 873
 				$datetime_limits[$datetime->ID()] = $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit();
874 874
 			}
@@ -879,74 +879,74 @@  discard block
 block discarded – undo
879 879
 		//ticket quantity by the number of datetimes on the ticket).  For tie-breakers, then the next sort is based on the
880 880
 		//ticket with the greatest sum of all remaining datetime->spaces_remaining() ( or $datetime->reg_limit() if not
881 881
 		//$current_total_available ) for the datetimes on the ticket.
882
-		usort( $ticket_sums, function( $a, $b ) {
883
-			if ( $a['sum'] == $b['sum'] ) {
884
-				if ( $a['datetime_sums'] == $b['datetime_sums'] ) {
882
+		usort($ticket_sums, function($a, $b) {
883
+			if ($a['sum'] == $b['sum']) {
884
+				if ($a['datetime_sums'] == $b['datetime_sums']) {
885 885
 					return 0;
886 886
 				}
887 887
 
888 888
 				return $a['datetime_sums'] < $b['datetime_sums'] ? 1 : -1;
889 889
 			}
890
-			return ( $a['sum'] < $b['sum'] ) ? -1 : 1;
890
+			return ($a['sum'] < $b['sum']) ? -1 : 1;
891 891
 		});
892 892
 
893 893
 		//now let's loop through the sorted tickets and simulate sellouts
894
-		foreach ( $ticket_sums as $ticket_info ) {
895
-			if ( $ticket_info['ticket'] instanceof EE_Ticket ) {
894
+		foreach ($ticket_sums as $ticket_info) {
895
+			if ($ticket_info['ticket'] instanceof EE_Ticket) {
896 896
 
897
-				$datetimes = $ticket_info['ticket']->datetimes( array( 'order_by' => array( 'DTT_reg_limit' => 'ASC' ) ) );
897
+				$datetimes = $ticket_info['ticket']->datetimes(array('order_by' => array('DTT_reg_limit' => 'ASC')));
898 898
 				//need to sort these $datetimes by remaining (only if $current_total_available)
899 899
 				//setup datetimes for simulation
900 900
 				$ticket_datetimes_remaining = array();
901
-				foreach( $datetimes as $datetime ) {
901
+				foreach ($datetimes as $datetime) {
902 902
 					$ticket_datetimes_remaining[$datetime->ID()]['rem'] = $datetime_limits[$datetime->ID()];
903 903
 					$ticket_datetimes_remaining[$datetime->ID()]['datetime'] = $datetime;
904 904
 				}
905
-				usort( $ticket_datetimes_remaining, function( $a, $b ) {
906
-					if ( $a['rem'] == $b['rem'] ) {
905
+				usort($ticket_datetimes_remaining, function($a, $b) {
906
+					if ($a['rem'] == $b['rem']) {
907 907
 						return 0;
908 908
 					}
909
-					return ( $a['rem'] < $b['rem'] ) ? -1 : 1;
909
+					return ($a['rem'] < $b['rem']) ? -1 : 1;
910 910
 				});
911 911
 
912 912
 
913 913
 				//get the remaining on the first datetime (which should be the one with the least remaining) and that is
914 914
 				//what we add to the spaces_available running total.  Then we need to decrease the remaining on our datetime tracker.
915
-				$lowest_datetime = reset( $ticket_datetimes_remaining );
915
+				$lowest_datetime = reset($ticket_datetimes_remaining);
916 916
 
917 917
 				//need to get the lower of; what the remaining is on the lowest datetime, and the remaining on the ticket.
918 918
 				// If this ends up being 0 (because of previous tickets in our simulation selling out), then it has already
919 919
 				// been tracked on $spaces available and this ticket is now sold out for the simulation, so we can continue
920 920
 				// to the next ticket.
921
-				if ( $current_total_available ) {
922
-					$remaining = min( $lowest_datetime['rem'], $ticket_info['ticket']->remaining() );
921
+				if ($current_total_available) {
922
+					$remaining = min($lowest_datetime['rem'], $ticket_info['ticket']->remaining());
923 923
 				} else {
924
-					$remaining = min( $lowest_datetime['rem'], $ticket_info['ticket']->qty() );
924
+					$remaining = min($lowest_datetime['rem'], $ticket_info['ticket']->qty());
925 925
 				}
926 926
 
927 927
 				//if $remaining is infinite that means that all datetimes on this ticket are infinite but we've made it here because all
928 928
 				//tickets have a quantity.  So we don't have to track datetimes, we can just use ticket quantities for total
929 929
 				//available.
930
-				if ( $remaining === EE_INF ) {
930
+				if ($remaining === EE_INF) {
931 931
 					$spaces_available += $ticket_info['ticket']->qty();
932 932
 					continue;
933 933
 				}
934 934
 
935 935
 				//if ticket has sold amounts then we also need to add that (but only if doing live counts)
936
-				if ( $current_total_available ) {
936
+				if ($current_total_available) {
937 937
 					$spaces_available += $ticket_info['ticket']->sold();
938 938
 				}
939 939
 
940
-				if ( $remaining <= 0 ) {
940
+				if ($remaining <= 0) {
941 941
 					continue;
942 942
 				} else {
943 943
 					$spaces_available += $remaining;
944 944
 				}
945 945
 
946 946
 				//loop through the datetimes and sell them out!
947
-				foreach ( $ticket_datetimes_remaining as $datetime_info ) {
948
-					if ( $datetime_info['datetime'] instanceof EE_Datetime ) {
949
-						$datetime_limits[ $datetime_info['datetime']->ID() ] += - $remaining;
947
+				foreach ($ticket_datetimes_remaining as $datetime_info) {
948
+					if ($datetime_info['datetime'] instanceof EE_Datetime) {
949
+						$datetime_limits[$datetime_info['datetime']->ID()] += - $remaining;
950 950
 					}
951 951
 				}
952 952
 			}
@@ -962,8 +962,8 @@  discard block
 block discarded – undo
962 962
 	 * @param  bool $actual whether or not to perform calculations to not only figure the actual status but also to flip the status if necessary to sold out If false, we just check the existing status of the event
963 963
 	 * @return boolean
964 964
 	 */
965
-	public function is_sold_out( $actual = FALSE ) {
966
-		if ( ! $actual ) {
965
+	public function is_sold_out($actual = FALSE) {
966
+		if ( ! $actual) {
967 967
 			return $this->status() == EEM_Event::sold_out;
968 968
 		}
969 969
 		else {
@@ -1008,30 +1008,30 @@  discard block
 block discarded – undo
1008 1008
 	 *
1009 1009
 	 * @return bool | string - based on EE_Datetime active constants or FALSE if error.
1010 1010
 	 */
1011
-	public function get_active_status( $reset = false ) {
1011
+	public function get_active_status($reset = false) {
1012 1012
 		// if the active status has already been set, then just use that value (unless we are resetting it)
1013
-		if ( ! empty( $this->_active_status ) && ! $reset ) {
1013
+		if ( ! empty($this->_active_status) && ! $reset) {
1014 1014
 			return $this->_active_status;
1015 1015
 		}
1016 1016
 		//first check if event id is present on this object
1017
-		if ( ! $this->ID() ) {
1017
+		if ( ! $this->ID()) {
1018 1018
 			return false;
1019 1019
 		}
1020 1020
 
1021
-		$where_params_for_event  = array( array( 'EVT_ID' => $this->ID() ) );
1021
+		$where_params_for_event = array(array('EVT_ID' => $this->ID()));
1022 1022
 
1023 1023
 		//if event is published:
1024
-		if ( $this->status() === 'publish' ) {
1024
+		if ($this->status() === 'publish') {
1025 1025
 			//active?
1026
-			if ( EEM_Datetime::instance()->get_datetime_count_for_status( EE_Datetime::active, $where_params_for_event ) > 0 ) {
1026
+			if (EEM_Datetime::instance()->get_datetime_count_for_status(EE_Datetime::active, $where_params_for_event) > 0) {
1027 1027
 				$this->_active_status = EE_Datetime::active;
1028 1028
 			} else {
1029 1029
 				//upcoming?
1030
-				if ( EEM_Datetime::instance()->get_datetime_count_for_status( EE_Datetime::upcoming, $where_params_for_event  ) > 0 ) {
1030
+				if (EEM_Datetime::instance()->get_datetime_count_for_status(EE_Datetime::upcoming, $where_params_for_event) > 0) {
1031 1031
 					$this->_active_status = EE_Datetime::upcoming;
1032 1032
 				} else {
1033 1033
 					//expired?
1034
-					if ( EEM_Datetime::instance()->get_datetime_count_for_status( EE_Datetime::expired, $where_params_for_event  ) > 0 ) {
1034
+					if (EEM_Datetime::instance()->get_datetime_count_for_status(EE_Datetime::expired, $where_params_for_event) > 0) {
1035 1035
 						$this->_active_status = EE_Datetime::expired;
1036 1036
 					} else {
1037 1037
 						//it would be odd if things make it this far because it basically means there are no datetime's
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
 			}
1043 1043
 		} else {
1044 1044
 			//the event is not published, so let's just set it's active status according to its' post status
1045
-			switch ( $this->status() ) {
1045
+			switch ($this->status()) {
1046 1046
 				case EEM_Event::sold_out :
1047 1047
 					$this->_active_status = EE_Datetime::sold_out;
1048 1048
 					break;
@@ -1068,10 +1068,10 @@  discard block
 block discarded – undo
1068 1068
 	 * @param boolean $echo     whether to return (FALSE), or echo out the result (TRUE)
1069 1069
 	 * @return mixed void|string
1070 1070
 	 */
1071
-	public function pretty_active_status( $echo = TRUE ) {
1071
+	public function pretty_active_status($echo = TRUE) {
1072 1072
 		$active_status = $this->get_active_status();
1073
-		$status = '<span class="ee-status event-active-status-' . $active_status . '">' . EEH_Template::pretty_status( $active_status, FALSE, 'sentence' ) . '</span>';
1074
-		if ( $echo ) {
1073
+		$status = '<span class="ee-status event-active-status-'.$active_status.'">'.EEH_Template::pretty_status($active_status, FALSE, 'sentence').'</span>';
1074
+		if ($echo) {
1075 1075
 			echo $status;
1076 1076
 			return '';
1077 1077
 		}
@@ -1085,12 +1085,12 @@  discard block
 block discarded – undo
1085 1085
 	 */
1086 1086
 	public function get_number_of_tickets_sold() {
1087 1087
 		$tkt_sold = 0;
1088
-		if ( !$this->ID() ) {
1088
+		if ( ! $this->ID()) {
1089 1089
 			return 0;
1090 1090
 		}
1091 1091
 		$datetimes = $this->datetimes();
1092
-		foreach ( $datetimes as $datetime ) {
1093
-			if ( $datetime instanceof EE_Datetime ) {
1092
+		foreach ($datetimes as $datetime) {
1093
+			if ($datetime instanceof EE_Datetime) {
1094 1094
 				$tkt_sold += $datetime->sold();
1095 1095
 			}
1096 1096
 		}
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 	 * @return int
1106 1106
 	 */
1107 1107
 	public function get_count_of_all_registrations() {
1108
-		return EEM_Event::instance()->count_related( $this, 'Registration' );
1108
+		return EEM_Event::instance()->count_related($this, 'Registration');
1109 1109
 	}
1110 1110
 
1111 1111
 
@@ -1115,9 +1115,9 @@  discard block
 block discarded – undo
1115 1115
 	 * @return EE_Ticket
1116 1116
 	 */
1117 1117
 	public function get_ticket_with_earliest_start_time() {
1118
-		$where[ 'Datetime.EVT_ID' ] = $this->ID();
1119
-		$query_params = array( $where, 'order_by' => array( 'TKT_start_date' => 'ASC' ) );
1120
-		return EE_Registry::instance()->load_model( 'Ticket' )->get_one( $query_params );
1118
+		$where['Datetime.EVT_ID'] = $this->ID();
1119
+		$query_params = array($where, 'order_by' => array('TKT_start_date' => 'ASC'));
1120
+		return EE_Registry::instance()->load_model('Ticket')->get_one($query_params);
1121 1121
 	}
1122 1122
 
1123 1123
 
@@ -1127,9 +1127,9 @@  discard block
 block discarded – undo
1127 1127
 	 * @return EE_Ticket
1128 1128
 	 */
1129 1129
 	public function get_ticket_with_latest_end_time() {
1130
-		$where[ 'Datetime.EVT_ID' ] = $this->ID();
1131
-		$query_params = array( $where, 'order_by' => array( 'TKT_end_date' => 'DESC' ) );
1132
-		return EE_Registry::instance()->load_model( 'Ticket' )->get_one( $query_params );
1130
+		$where['Datetime.EVT_ID'] = $this->ID();
1131
+		$query_params = array($where, 'order_by' => array('TKT_end_date' => 'DESC'));
1132
+		return EE_Registry::instance()->load_model('Ticket')->get_one($query_params);
1133 1133
 	}
1134 1134
 
1135 1135
 
@@ -1141,11 +1141,11 @@  discard block
 block discarded – undo
1141 1141
 	public function tickets_on_sale() {
1142 1142
 		$earliest_ticket = $this->get_ticket_with_earliest_start_time();
1143 1143
 		$latest_ticket = $this->get_ticket_with_latest_end_time();
1144
-		if ( !$latest_ticket instanceof EE_Ticket && !$earliest_ticket instanceof EE_Ticket ) {
1144
+		if ( ! $latest_ticket instanceof EE_Ticket && ! $earliest_ticket instanceof EE_Ticket) {
1145 1145
 			return FALSE;
1146 1146
 		}
1147 1147
 		//check on sale for these two tickets.
1148
-		if ( $latest_ticket->is_on_sale() || $earliest_ticket->is_on_sale() ) {
1148
+		if ($latest_ticket->is_on_sale() || $earliest_ticket->is_on_sale()) {
1149 1149
 			return TRUE;
1150 1150
 		}
1151 1151
 		return FALSE;
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 	 * @return string
1160 1160
 	 */
1161 1161
 	public function get_permalink() {
1162
-		if ( $this->external_url() ) {
1162
+		if ($this->external_url()) {
1163 1163
 			return $this->external_url();
1164 1164
 		}
1165 1165
 		else {
@@ -1174,10 +1174,10 @@  discard block
 block discarded – undo
1174 1174
 	 * @param array $query_params like EEM_Base::get_all
1175 1175
 	 * @return EE_Term
1176 1176
 	 */
1177
-	public function first_event_category( $query_params = array() ) {
1178
-		$query_params[ 0 ][ 'Term_Taxonomy.taxonomy' ] = 'espresso_event_categories';
1179
-		$query_params[ 0 ][ 'Term_Taxonomy.Event.EVT_ID' ] = $this->ID();
1180
-		return EEM_Term::instance()->get_one( $query_params );
1177
+	public function first_event_category($query_params = array()) {
1178
+		$query_params[0]['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1179
+		$query_params[0]['Term_Taxonomy.Event.EVT_ID'] = $this->ID();
1180
+		return EEM_Term::instance()->get_one($query_params);
1181 1181
 	}
1182 1182
 
1183 1183
 
@@ -1187,10 +1187,10 @@  discard block
 block discarded – undo
1187 1187
 	 * @param array $query_params
1188 1188
 	 * @return EE_Term[]
1189 1189
 	 */
1190
-	public function get_all_event_categories( $query_params = array() ) {
1191
-		$query_params[ 0 ][ 'Term_Taxonomy.taxonomy' ] = 'espresso_event_categories';
1192
-		$query_params[ 0 ][ 'Term_Taxonomy.Event.EVT_ID' ] = $this->ID();
1193
-		return EEM_Term::instance()->get_all( $query_params );
1190
+	public function get_all_event_categories($query_params = array()) {
1191
+		$query_params[0]['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1192
+		$query_params[0]['Term_Taxonomy.Event.EVT_ID'] = $this->ID();
1193
+		return EEM_Term::instance()->get_all($query_params);
1194 1194
 	}
1195 1195
 
1196 1196
 	/**
@@ -1198,8 +1198,8 @@  discard block
 block discarded – undo
1198 1198
 	 * @param array $query_params @see EEM_Base::get_all
1199 1199
 	 * @return EE_Question_Group[]
1200 1200
 	 */
1201
-	public function question_groups($query_params = array()){
1202
-		$query_params = ! empty( $query_params ) ? $query_params : array( 'order_by' => array( 'QSG_order' => 'ASC' ));
1201
+	public function question_groups($query_params = array()) {
1202
+		$query_params = ! empty($query_params) ? $query_params : array('order_by' => array('QSG_order' => 'ASC'));
1203 1203
 		return $this->get_many_related('Question_Group', $query_params);
1204 1204
 	}
1205 1205
 
@@ -1239,12 +1239,12 @@  discard block
 block discarded – undo
1239 1239
 	 */
1240 1240
 	public function get_admin_edit_link() {
1241 1241
 		EE_Registry::instance()->load_helper('URL');
1242
-		return EEH_URL::add_query_args_and_nonce( array(
1242
+		return EEH_URL::add_query_args_and_nonce(array(
1243 1243
 			'page' => 'espresso_events',
1244 1244
 			'action' => 'edit',
1245 1245
 			'post' => $this->ID()
1246 1246
 			),
1247
-			admin_url( 'admin.php' )
1247
+			admin_url('admin.php')
1248 1248
 		);
1249 1249
 	}
1250 1250
 
@@ -1257,11 +1257,11 @@  discard block
 block discarded – undo
1257 1257
 	 */
1258 1258
 	public function get_admin_settings_link() {
1259 1259
 		EE_Registry::instance()->load_helper('URL');
1260
-		return EEH_URL::add_query_args_and_nonce( array(
1260
+		return EEH_URL::add_query_args_and_nonce(array(
1261 1261
 			'page' => 'espresso_events',
1262 1262
 			'action' => 'default_event_settings'
1263 1263
 			),
1264
-			admin_url( 'admin.php' )
1264
+			admin_url('admin.php')
1265 1265
 		);
1266 1266
 	}
1267 1267
 
@@ -1277,11 +1277,11 @@  discard block
 block discarded – undo
1277 1277
 	public function get_admin_overview_link() {
1278 1278
 
1279 1279
 		EE_Registry::instance()->load_helper('URL');
1280
-		return EEH_URL::add_query_args_and_nonce( array(
1280
+		return EEH_URL::add_query_args_and_nonce(array(
1281 1281
 			'page' => 'espresso_events',
1282 1282
 			'action' => 'default'
1283 1283
 		),
1284
-			admin_url( 'admin.php' )
1284
+			admin_url('admin.php')
1285 1285
 		);
1286 1286
 	}
1287 1287
 
Please login to merge, or discard this patch.
core/db_classes/EE_Post_Meta.class.php 2 patches
Doc Comments   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
 	/**
51 51
 	 * Gets meta_id
52
-	 * @return int
52
+	 * @return boolean
53 53
 	 */
54 54
 	function meta_id() {
55 55
 		return $this->get( 'meta_id' );
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 	/**
61 61
 	 * Sets meta_id
62 62
 	 * @param int $meta_id
63
-	 * @return boolean
63
+	 * @return boolean|null
64 64
 	 */
65 65
 	function set_meta_id( $meta_id) {
66 66
 		return $this->set( 'meta_id', $meta_id);
67 67
 	}
68 68
 	/**
69 69
 	 * Gets post_id
70
-	 * @return int
70
+	 * @return boolean
71 71
 	 */
72 72
 	function post_id() {
73 73
 		return $this->get( 'post_id' );
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
 	/**
79 79
 	 * Sets post_id
80 80
 	 * @param int $post_id
81
-	 * @return boolean
81
+	 * @return boolean|null
82 82
 	 */
83 83
 	function set_post_id( $post_id) {
84 84
 		return $this->set( 'post_id', $post_id);
85 85
 	}
86 86
 	/**
87 87
 	 * Gets meta_key
88
-	 * @return string
88
+	 * @return boolean
89 89
 	 */
90 90
 	function meta_key() {
91 91
 		return $this->get( 'meta_key' );
@@ -96,14 +96,14 @@  discard block
 block discarded – undo
96 96
 	/**
97 97
 	 * Sets meta_key
98 98
 	 * @param string $meta_key
99
-	 * @return boolean
99
+	 * @return boolean|null
100 100
 	 */
101 101
 	function set_meta_key( $meta_key) {
102 102
 		return $this->set( 'meta_key', $meta_key);
103 103
 	}
104 104
 	/**
105 105
 	 * Gets meta_value
106
-	 * @return mixed
106
+	 * @return boolean
107 107
 	 */
108 108
 	function meta_value() {
109 109
 		return $this->get( 'meta_value' );
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	/**
115 115
 	 * Sets meta_value
116 116
 	 * @param mixed $meta_value
117
-	 * @return boolean
117
+	 * @return boolean|null
118 118
 	 */
119 119
 	function set_meta_value( $meta_value) {
120 120
 		return $this->set( 'meta_value', $meta_value);
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
 	 * @param array $props_n_values
31 31
 	 * @return EE_Post_Meta|mixed
32 32
 	 */
33
-	public static function new_instance( $props_n_values = array() ) {
34
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
35
-		return $has_object ? $has_object : new self( $props_n_values );
33
+	public static function new_instance($props_n_values = array()) {
34
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
35
+		return $has_object ? $has_object : new self($props_n_values);
36 36
 	}
37 37
 
38 38
 
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 	 * @param array $props_n_values
42 42
 	 * @return EE_Post_Meta
43 43
 	 */
44
-	public static function new_instance_from_db( $props_n_values = array() ) {
45
-		return new self( $props_n_values, TRUE );
44
+	public static function new_instance_from_db($props_n_values = array()) {
45
+		return new self($props_n_values, TRUE);
46 46
 	}
47 47
 
48 48
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 * @return int
53 53
 	 */
54 54
 	function meta_id() {
55
-		return $this->get( 'meta_id' );
55
+		return $this->get('meta_id');
56 56
 	}
57 57
 
58 58
 
@@ -62,15 +62,15 @@  discard block
 block discarded – undo
62 62
 	 * @param int $meta_id
63 63
 	 * @return boolean
64 64
 	 */
65
-	function set_meta_id( $meta_id) {
66
-		return $this->set( 'meta_id', $meta_id);
65
+	function set_meta_id($meta_id) {
66
+		return $this->set('meta_id', $meta_id);
67 67
 	}
68 68
 	/**
69 69
 	 * Gets post_id
70 70
 	 * @return int
71 71
 	 */
72 72
 	function post_id() {
73
-		return $this->get( 'post_id' );
73
+		return $this->get('post_id');
74 74
 	}
75 75
 
76 76
 
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
 	 * @param int $post_id
81 81
 	 * @return boolean
82 82
 	 */
83
-	function set_post_id( $post_id) {
84
-		return $this->set( 'post_id', $post_id);
83
+	function set_post_id($post_id) {
84
+		return $this->set('post_id', $post_id);
85 85
 	}
86 86
 	/**
87 87
 	 * Gets meta_key
88 88
 	 * @return string
89 89
 	 */
90 90
 	function meta_key() {
91
-		return $this->get( 'meta_key' );
91
+		return $this->get('meta_key');
92 92
 	}
93 93
 
94 94
 
@@ -98,15 +98,15 @@  discard block
 block discarded – undo
98 98
 	 * @param string $meta_key
99 99
 	 * @return boolean
100 100
 	 */
101
-	function set_meta_key( $meta_key) {
102
-		return $this->set( 'meta_key', $meta_key);
101
+	function set_meta_key($meta_key) {
102
+		return $this->set('meta_key', $meta_key);
103 103
 	}
104 104
 	/**
105 105
 	 * Gets meta_value
106 106
 	 * @return mixed
107 107
 	 */
108 108
 	function meta_value() {
109
-		return $this->get( 'meta_value' );
109
+		return $this->get('meta_value');
110 110
 	}
111 111
 
112 112
 
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
 	 * @param mixed $meta_value
117 117
 	 * @return boolean
118 118
 	 */
119
-	function set_meta_value( $meta_value) {
120
-		return $this->set( 'meta_value', $meta_value);
119
+	function set_meta_value($meta_value) {
120
+		return $this->set('meta_value', $meta_value);
121 121
 	}
122 122
 
123 123
 
Please login to merge, or discard this patch.
core/db_classes/EE_Question_Option.class.php 2 patches
Doc Comments   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * @param array $props_n_values  incoming values from the database
57 57
 	 * @param string $timezone  incoming timezone as set by the model.  If not set the timezone for
58 58
 	 *                          		the website will be used.
59
-	 * @return EE_Attendee
59
+	 * @return EE_Question_Option
60 60
 	 */
61 61
 	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
62 62
 		return new self( $props_n_values, TRUE, $timezone );
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	/**
68 68
 	 * Sets the option's key value
69 69
 	 * @param string $value
70
-	 * @return bool success
70
+	 * @return boolean|null success
71 71
 	 */
72 72
 	public function set_value( $value ) {
73 73
 		$this->set( 'QSO_value', $value );
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	/**
79 79
 	 * Sets the option's Display Text
80 80
 	 * @param string $text
81
-	 * @return bool success
81
+	 * @return boolean|null success
82 82
 	 */
83 83
 	public function set_desc( $text ) {
84 84
 		$this->set( 'QSO_desc', $text );
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 * @access public
93 93
 	 * @param integer $order
94
-	 * @return bool      $success
94
+	 * @return boolean|null      $success
95 95
 	 */
96 96
 	public function set_order( $order ) {
97 97
 		$this->set( 'QSO_order', $order );
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	/**
103 103
 	 * Sets the ID of the related question
104 104
 	 * @param int $question_ID
105
-	 * @return bool success
105
+	 * @return boolean|null success
106 106
 	 */
107 107
 	public function set_question_ID( $question_ID ) {
108 108
 		$this->set( 'QST_ID', $question_ID );
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	/**
114 114
 	 * Sets the option's opt_group
115 115
 	 * @param string $text
116
-	 * @return bool success
116
+	 * @return string success
117 117
 	 */
118 118
 	public function set_opt_group( $text ) {
119 119
 		return $this->_QSO_opt_group = $text;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
 	/**
125 125
 	 * Gets the option's key value
126
-	 * @return string
126
+	 * @return boolean
127 127
 	 */
128 128
 	public function value() {
129 129
 		return $this->get( 'QSO_value' );
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
 	/**
135 135
 	 * Gets the option's display text
136
-	 * @return string
136
+	 * @return boolean
137 137
 	 */
138 138
 	public function desc() {
139 139
 		return $this->get( 'QSO_desc' );
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 * Returns the order or the Question Option
156 156
 	 *
157 157
 	 * @access public
158
-	 * @return integer
158
+	 * @return boolean
159 159
 	 */
160 160
 	public function order() {
161 161
 		return $this->get( 'QSO_option' );
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 
166 166
 	/**
167 167
 	 * Gets the related question's ID
168
-	 * @return int
168
+	 * @return boolean
169 169
 	 */
170 170
 	public function question_ID() {
171 171
 		return $this->get( 'QST_ID' );
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	
209 209
 	/**
210 210
 	 * Gets the QSO_system value
211
-	 * @return string|null
211
+	 * @return boolean
212 212
 	 */
213 213
 	public function system() {
214 214
 		return $this->get('QSO_system');
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	/**
218 218
 	 * Sets QSO_system
219 219
 	 * @param string $QSO_system
220
-	 * @return bool
220
+	 * @return boolean|null
221 221
 	 */
222 222
 	public function set_system( $QSO_system ) {
223 223
 		return $this->set( 'QSO_system', $QSO_system );
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 	 *                             		    date_format and the second value is the time format
46 46
 	 * @return EE_Attendee
47 47
 	 */
48
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
49
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
50
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
48
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
49
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
50
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
51 51
 	}
52 52
 
53 53
 
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 	 *                          		the website will be used.
59 59
 	 * @return EE_Attendee
60 60
 	 */
61
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
62
-		return new self( $props_n_values, TRUE, $timezone );
61
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
62
+		return new self($props_n_values, TRUE, $timezone);
63 63
 	}
64 64
 
65 65
 
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 	 * @param string $value
70 70
 	 * @return bool success
71 71
 	 */
72
-	public function set_value( $value ) {
73
-		$this->set( 'QSO_value', $value );
72
+	public function set_value($value) {
73
+		$this->set('QSO_value', $value);
74 74
 	}
75 75
 
76 76
 
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 	 * @param string $text
81 81
 	 * @return bool success
82 82
 	 */
83
-	public function set_desc( $text ) {
84
-		$this->set( 'QSO_desc', $text );
83
+	public function set_desc($text) {
84
+		$this->set('QSO_desc', $text);
85 85
 	}
86 86
 
87 87
 
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 	 * @param integer $order
94 94
 	 * @return bool      $success
95 95
 	 */
96
-	public function set_order( $order ) {
97
-		$this->set( 'QSO_order', $order );
96
+	public function set_order($order) {
97
+		$this->set('QSO_order', $order);
98 98
 	}
99 99
 
100 100
 
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 	 * @param int $question_ID
105 105
 	 * @return bool success
106 106
 	 */
107
-	public function set_question_ID( $question_ID ) {
108
-		$this->set( 'QST_ID', $question_ID );
107
+	public function set_question_ID($question_ID) {
108
+		$this->set('QST_ID', $question_ID);
109 109
 	}
110 110
 
111 111
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 * @param string $text
116 116
 	 * @return bool success
117 117
 	 */
118
-	public function set_opt_group( $text ) {
118
+	public function set_opt_group($text) {
119 119
 		return $this->_QSO_opt_group = $text;
120 120
 	}
121 121
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * @return string
127 127
 	 */
128 128
 	public function value() {
129
-		return $this->get( 'QSO_value' );
129
+		return $this->get('QSO_value');
130 130
 	}
131 131
 
132 132
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 * @return string
137 137
 	 */
138 138
 	public function desc() {
139
-		return $this->get( 'QSO_desc' );
139
+		return $this->get('QSO_desc');
140 140
 	}
141 141
 
142 142
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @return boolean
147 147
 	 */
148 148
 	public function deleted() {
149
-		return $this->get( 'QSO_deleted' );
149
+		return $this->get('QSO_deleted');
150 150
 	}
151 151
 
152 152
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 * @return integer
159 159
 	 */
160 160
 	public function order() {
161
-		return $this->get( 'QSO_option' );
161
+		return $this->get('QSO_option');
162 162
 	}
163 163
 
164 164
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 * @return int
169 169
 	 */
170 170
 	public function question_ID() {
171
-		return $this->get( 'QST_ID' );
171
+		return $this->get('QST_ID');
172 172
 	}
173 173
 
174 174
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 * @return EE_Question
179 179
 	 */
180 180
 	public function question() {
181
-		return $this->get_first_related( 'Question' );
181
+		return $this->get_first_related('Question');
182 182
 	}
183 183
 
184 184
 
@@ -197,11 +197,11 @@  discard block
 block discarded – undo
197 197
 	 * @param array $options {
198 198
 	 *	@type int $QST_ID the QST_ID attribute of this question option, otherwise it will be for the same question as the original
199 199
 	 */
200
-	public function duplicate( $options = array() ) {
200
+	public function duplicate($options = array()) {
201 201
 		$new_question_option = clone $this;
202
-		$new_question_option->set( 'QSO_ID', null );
203
-		if( array_key_exists( 'QST_ID', $options ) ) {//use array_key_exists instead of isset because NULL might be a valid value
204
-			$new_question_option->set_question_ID( $options[ 'QST_ID' ] );
202
+		$new_question_option->set('QSO_ID', null);
203
+		if (array_key_exists('QST_ID', $options)) {//use array_key_exists instead of isset because NULL might be a valid value
204
+			$new_question_option->set_question_ID($options['QST_ID']);
205 205
 		}
206 206
 		$new_question_option->save();
207 207
 	}
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
 	 * @param string $QSO_system
220 220
 	 * @return bool
221 221
 	 */
222
-	public function set_system( $QSO_system ) {
223
-		return $this->set( 'QSO_system', $QSO_system );
222
+	public function set_system($QSO_system) {
223
+		return $this->set('QSO_system', $QSO_system);
224 224
 	}
225 225
 }
226 226
 
Please login to merge, or discard this patch.
core/db_classes/EE_Ticket.class.php 3 patches
Doc Comments   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 
198 198
 	/**
199 199
 	 * Gets min
200
-	 * @return int
200
+	 * @return boolean
201 201
 	 */
202 202
 	function min() {
203 203
 		return $this->get( 'TKT_min' );
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	 * This returns the chronologically last datetime that this ticket is associated with
240 240
 	 * @param string 	$dt_frmt
241 241
 	 * @param string 	$conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31
242
-	 * @return array
242
+	 * @return string
243 243
 	 */
244 244
 	public function date_range( $dt_frmt = '', $conjunction = ' - ' ) {
245 245
 		$first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date( $dt_frmt ) : '';
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 	/**
381 381
 	 * Gets all the ticket applicabilities (ie, relations between datetimes and tickets)
382 382
 	 * @param array $query_params see EEM_Base::get_all()
383
-	 * @return EE_Datetime_Ticket
383
+	 * @return EE_Base_Class[]
384 384
 	 */
385 385
 	public function datetime_tickets( $query_params = array() ) {
386 386
 		return $this->get_many_related( 'Datetime_Ticket', $query_params );
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 
403 403
 	/**
404 404
 	 * Gets ID
405
-	 * @return string
405
+	 * @return boolean
406 406
 	 */
407 407
 	function ID() {
408 408
 		return $this->get( 'TKT_ID' );
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 	 *
417 417
 	 * @since 4.5.0
418 418
 	 *
419
-	 * @return int
419
+	 * @return boolean
420 420
 	 */
421 421
 	public function wp_user() {
422 422
 		return $this->get('TKT_wp_user');
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 	/**
515 515
 	 * Sets name
516 516
 	 * @param string $name
517
-	 * @return boolean
517
+	 * @return boolean|null
518 518
 	 */
519 519
 	function set_name( $name ) {
520 520
 		$this->set( 'TKT_name', $name );
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 
525 525
 	/**
526 526
 	 * Gets description
527
-	 * @return string
527
+	 * @return boolean
528 528
 	 */
529 529
 	function description() {
530 530
 		return $this->get( 'TKT_description' );
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 	/**
536 536
 	 * Sets description
537 537
 	 * @param string $description
538
-	 * @return boolean
538
+	 * @return boolean|null
539 539
 	 */
540 540
 	function set_description( $description ) {
541 541
 		$this->set( 'TKT_description', $description );
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 	/**
606 606
 	 * Sets min
607 607
 	 * @param int $min
608
-	 * @return boolean
608
+	 * @return boolean|null
609 609
 	 */
610 610
 	function set_min( $min ) {
611 611
 		$this->set( 'TKT_min', $min );
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 
616 616
 	/**
617 617
 	 * Gets max
618
-	 * @return int
618
+	 * @return boolean
619 619
 	 */
620 620
 	function max() {
621 621
 		return $this->get( 'TKT_max' );
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
 	/**
627 627
 	 * Sets max
628 628
 	 * @param int $max
629
-	 * @return boolean
629
+	 * @return boolean|null
630 630
 	 */
631 631
 	function set_max( $max ) {
632 632
 		$this->set( 'TKT_max', $max );
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
 	/**
638 638
 	 * Sets price
639 639
 	 * @param float $price
640
-	 * @return boolean
640
+	 * @return boolean|null
641 641
 	 */
642 642
 	function set_price( $price ) {
643 643
 		$this->set( 'TKT_price', $price );
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 	/**
659 659
 	 * increments sold by amount passed by $qty
660 660
 	 * @param int $qty
661
-	 * @return boolean
661
+	 * @return boolean|null
662 662
 	 */
663 663
 	function increase_sold( $qty = 1 ) {
664 664
 		$sold = $this->sold() + $qty;
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 	/**
672 672
 	 * Increases sold on related datetimes
673 673
 	 * @param int $qty
674
-	 * @return boolean
674
+	 * @return boolean|null
675 675
 	 */
676 676
 	protected function _increase_sold_for_datetimes( $qty = 1 ) {
677 677
 		$datetimes = $this->datetimes();
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
 	/**
691 691
 	 * Sets sold
692 692
 	 * @param int $sold
693
-	 * @return boolean
693
+	 * @return boolean|null
694 694
 	 */
695 695
 	function set_sold( $sold ) {
696 696
 		// sold can not go below zero
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 	/**
704 704
 	 * decrements (subtracts) sold by amount passed by $qty
705 705
 	 * @param int $qty
706
-	 * @return boolean
706
+	 * @return boolean|null
707 707
 	 */
708 708
 	function decrease_sold( $qty = 1 ) {
709 709
 		$sold = $this->sold() - $qty;
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 	* Decreases sold on related datetimes
718 718
 	*
719 719
 	* @param int $qty
720
-	* @return boolean
720
+	* @return boolean|null
721 721
 	*/
722 722
 	protected function _decrease_sold_for_datetimes( $qty = 1 ) {
723 723
 		$datetimes = $this->datetimes();
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
 	 * Sets qty - IMPORTANT!!! Does NOT allow QTY to be set higher than the lowest reg limit of any related datetimes
809 809
 	 *
810 810
 	 * @param int  $qty
811
-	 * @return bool
811
+	 * @return boolean|null
812 812
 	 * @throws \EE_Error
813 813
 	 */
814 814
 	function set_qty( $qty ) {
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
 
826 826
 	/**
827 827
 	 * Gets uses
828
-	 * @return int
828
+	 * @return boolean
829 829
 	 */
830 830
 	function uses() {
831 831
 		return $this->get( 'TKT_uses' );
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
 	/**
837 837
 	 * Sets uses
838 838
 	 * @param int $uses
839
-	 * @return boolean
839
+	 * @return boolean|null
840 840
 	 */
841 841
 	function set_uses( $uses ) {
842 842
 		$this->set( 'TKT_uses', $uses );
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
 	/**
858 858
 	 * sets the TKT_required property
859 859
 	 * @param boolean $required
860
-	 * @return boolean
860
+	 * @return boolean|null
861 861
 	 */
862 862
 	public function set_required( $required ) {
863 863
 		$this->set( 'TKT_required', $required );
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
 	/**
879 879
 	 * Sets taxable
880 880
 	 * @param boolean $taxable
881
-	 * @return boolean
881
+	 * @return boolean|null
882 882
 	 */
883 883
 	function set_taxable( $taxable ) {
884 884
 		$this->set( 'TKT_taxable', $taxable );
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
 	/**
900 900
 	 * Sets is_default
901 901
 	 * @param boolean $is_default
902
-	 * @return boolean
902
+	 * @return boolean|null
903 903
 	 */
904 904
 	function set_is_default( $is_default ) {
905 905
 		$this->set( 'TKT_is_default', $is_default );
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
 
910 910
 	/**
911 911
 	 * Gets order
912
-	 * @return int
912
+	 * @return boolean
913 913
 	 */
914 914
 	function order() {
915 915
 		return $this->get( 'TKT_order' );
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
 	/**
921 921
 	 * Sets order
922 922
 	 * @param int $order
923
-	 * @return boolean
923
+	 * @return boolean|null
924 924
 	 */
925 925
 	function set_order( $order ) {
926 926
 		$this->set( 'TKT_order', $order );
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
 
931 931
 	/**
932 932
 	 * Gets row
933
-	 * @return int
933
+	 * @return boolean
934 934
 	 */
935 935
 	function row() {
936 936
 		return $this->get( 'TKT_row' );
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
 	/**
942 942
 	 * Sets row
943 943
 	 * @param int $row
944
-	 * @return boolean
944
+	 * @return boolean|null
945 945
 	 */
946 946
 	function set_row( $row ) {
947 947
 		$this->set( 'TKT_row', $row );
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
 	/**
963 963
 	 * Sets deleted
964 964
 	 * @param boolean $deleted
965
-	 * @return boolean
965
+	 * @return boolean|null
966 966
 	 */
967 967
 	function set_deleted( $deleted ) {
968 968
 		$this->set( 'TKT_deleted', $deleted );
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
 
973 973
 	/**
974 974
 	 * Gets parent
975
-	 * @return int
975
+	 * @return boolean
976 976
 	 */
977 977
 	function parent_ID() {
978 978
 		return $this->get( 'TKT_parent' );
@@ -983,7 +983,7 @@  discard block
 block discarded – undo
983 983
 	/**
984 984
 	 * Sets parent
985 985
 	 * @param int $parent
986
-	 * @return boolean
986
+	 * @return boolean|null
987 987
 	 */
988 988
 	function set_parent_ID( $parent ) {
989 989
 		$this->set( 'TKT_parent', $parent );
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
 
1008 1008
 	/**
1009 1009
 	 * Gets name
1010
-	 * @return string
1010
+	 * @return boolean
1011 1011
 	 */
1012 1012
 	function name() {
1013 1013
 		return $this->get( 'TKT_name' );
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
 
1018 1018
 	/**
1019 1019
 	 * Gets price
1020
-	 * @return float
1020
+	 * @return boolean
1021 1021
 	 */
1022 1022
 	function price() {
1023 1023
 		return $this->get( 'TKT_price' );
Please login to merge, or discard this patch.
Spacing   +181 added lines, -181 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	 *                             		    date_format and the second value is the time format
67 67
 	 * @return EE_Ticket
68 68
 	 */
69
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
70
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
71
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
69
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
70
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
71
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
72 72
 	}
73 73
 
74 74
 
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 	 *                          		the website will be used.
80 80
 	 * @return EE_Ticket
81 81
 	 */
82
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
83
-		return new self( $props_n_values, TRUE, $timezone );
82
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
83
+		return new self($props_n_values, TRUE, $timezone);
84 84
 	}
85 85
 
86 86
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * @return bool
90 90
 	 */
91 91
 	public function parent() {
92
-		return $this->get( 'TKT_parent' );
92
+		return $this->get('TKT_parent');
93 93
 	}
94 94
 
95 95
 
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
 	 * @param  int $DTT_ID the primary key for a particular datetime
100 100
 	 * @return boolean
101 101
 	 */
102
-	public function available( $DTT_ID = 0 ) {
102
+	public function available($DTT_ID = 0) {
103 103
 		// are we checking availability for a particular datetime ?
104
-		if ( $DTT_ID ) {
104
+		if ($DTT_ID) {
105 105
 			// get that datetime object
106
-			$datetime = $this->get_first_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) );
106
+			$datetime = $this->get_first_related('Datetime', array(array('DTT_ID' => $DTT_ID)));
107 107
 			// if  ticket sales for this datetime have exceeded the reg limit...
108
-			if ( $datetime instanceof EE_Datetime && $datetime->sold_out() ) {
108
+			if ($datetime instanceof EE_Datetime && $datetime->sold_out()) {
109 109
 				return FALSE;
110 110
 			}
111 111
 		}
@@ -120,21 +120,21 @@  discard block
 block discarded – undo
120 120
 	 * @param bool $display true = we'll return a localized string, otherwise we just return the value of the relevant status const
121 121
 	 * @return mixed(int|string) status int if the display string isn't requested
122 122
 	 */
123
-	public function ticket_status( $display = FALSE ) {
124
-		if ( ! $this->is_remaining() ) {
125
-			return $display ? EEH_Template::pretty_status( EE_Ticket::sold_out, FALSE, 'sentence' ) : EE_Ticket::sold_out;
123
+	public function ticket_status($display = FALSE) {
124
+		if ( ! $this->is_remaining()) {
125
+			return $display ? EEH_Template::pretty_status(EE_Ticket::sold_out, FALSE, 'sentence') : EE_Ticket::sold_out;
126 126
 		}
127
-		if ( $this->get( 'TKT_deleted' ) ) {
128
-			return $display ? EEH_Template::pretty_status( EE_Ticket::archived, FALSE, 'sentence' ) : EE_Ticket::archived;
127
+		if ($this->get('TKT_deleted')) {
128
+			return $display ? EEH_Template::pretty_status(EE_Ticket::archived, FALSE, 'sentence') : EE_Ticket::archived;
129 129
 		}
130
-		if ( $this->is_expired() ) {
131
-			return $display ? EEH_Template::pretty_status( EE_Ticket::expired, FALSE, 'sentence' ) : EE_Ticket::expired;
130
+		if ($this->is_expired()) {
131
+			return $display ? EEH_Template::pretty_status(EE_Ticket::expired, FALSE, 'sentence') : EE_Ticket::expired;
132 132
 		}
133
-		if ( $this->is_pending() ) {
134
-			return $display ? EEH_Template::pretty_status( EE_Ticket::pending, FALSE, 'sentence' ) : EE_Ticket::pending;
133
+		if ($this->is_pending()) {
134
+			return $display ? EEH_Template::pretty_status(EE_Ticket::pending, FALSE, 'sentence') : EE_Ticket::pending;
135 135
 		}
136
-		if ( $this->is_on_sale() ) {
137
-			return $display ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence' ) : EE_Ticket::onsale;
136
+		if ($this->is_on_sale()) {
137
+			return $display ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : EE_Ticket::onsale;
138 138
 		}
139 139
 		return '';
140 140
 	}
@@ -148,12 +148,12 @@  discard block
 block discarded – undo
148 148
 	 * @param  int $DTT_ID if an int above 0 is included here then we get a specific dtt.
149 149
 	 * @return boolean         true = tickets remaining, false not.
150 150
 	 */
151
-	public function is_remaining( $DTT_ID = 0 ) {
152
-		$num_remaining = $this->remaining( $DTT_ID );
153
-		if ( $num_remaining === 0 ) {
151
+	public function is_remaining($DTT_ID = 0) {
152
+		$num_remaining = $this->remaining($DTT_ID);
153
+		if ($num_remaining === 0) {
154 154
 			return FALSE;
155 155
 		}
156
-		if ( $num_remaining > 0 && $num_remaining < $this->min() ) {
156
+		if ($num_remaining > 0 && $num_remaining < $this->min()) {
157 157
 			return FALSE;
158 158
 		}
159 159
 		return TRUE;
@@ -167,25 +167,25 @@  discard block
 block discarded – undo
167 167
 	 *                     all related datetimes
168 168
 	 * @return int
169 169
 	 */
170
-	public function remaining( $DTT_ID = 0 ) {
170
+	public function remaining($DTT_ID = 0) {
171 171
 		// are we checking availability for a particular datetime ?
172
-		if ( $DTT_ID ) {
172
+		if ($DTT_ID) {
173 173
 			// get array with the one requested datetime
174
-			$datetimes = $this->get_many_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) );
174
+			$datetimes = $this->get_many_related('Datetime', array(array('DTT_ID' => $DTT_ID)));
175 175
 		} else {
176 176
 			// we need to check availability of ALL datetimes
177
-			$datetimes = $this->get_many_related( 'Datetime', array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) );
177
+			$datetimes = $this->get_many_related('Datetime', array('order_by' => array('DTT_EVT_start' => 'ASC')));
178 178
 		}
179 179
 		//		d( $datetimes );
180 180
 		// if datetime reg limit is not unlimited
181
-		if ( ! empty( $datetimes ) ) {
181
+		if ( ! empty($datetimes)) {
182 182
 			// although TKT_qty and $datetime->spaces_remaining() could both be EE_INF
183 183
 			// we only need to check for EE_INF explicitly if we want to optimize.
184 184
 			// because EE_INF - x = EE_INF; and min(x,EE_INF) = x;
185 185
 			$tickets_remaining = $this->qty() - $this->sold();
186
-			foreach ( $datetimes as $datetime ) {
187
-				if ( $datetime instanceof EE_Datetime ) {
188
-					$tickets_remaining = min( $tickets_remaining, $datetime->spaces_remaining() );
186
+			foreach ($datetimes as $datetime) {
187
+				if ($datetime instanceof EE_Datetime) {
188
+					$tickets_remaining = min($tickets_remaining, $datetime->spaces_remaining());
189 189
 				}
190 190
 			}
191 191
 			return $tickets_remaining;
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 * @return int
201 201
 	 */
202 202
 	function min() {
203
-		return $this->get( 'TKT_min' );
203
+		return $this->get('TKT_min');
204 204
 	}
205 205
 
206 206
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 * @return boolean
211 211
 	 */
212 212
 	public function is_expired() {
213
-		return ( $this->get_raw( 'TKT_end_date' ) < time() );
213
+		return ($this->get_raw('TKT_end_date') < time());
214 214
 	}
215 215
 
216 216
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	 * @return boolean
221 221
 	 */
222 222
 	public function is_pending() {
223
-		return ( $this->get_raw( 'TKT_start_date' ) > time() );
223
+		return ($this->get_raw('TKT_start_date') > time());
224 224
 	}
225 225
 
226 226
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	 * @return boolean
231 231
 	 */
232 232
 	public function is_on_sale() {
233
-		return ( $this->get_raw( 'TKT_start_date' ) < time() && $this->get_raw( 'TKT_end_date' ) > time() );
233
+		return ($this->get_raw('TKT_start_date') < time() && $this->get_raw('TKT_end_date') > time());
234 234
 	}
235 235
 
236 236
 
@@ -241,11 +241,11 @@  discard block
 block discarded – undo
241 241
 	 * @param string 	$conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31
242 242
 	 * @return array
243 243
 	 */
244
-	public function date_range( $dt_frmt = '', $conjunction = ' - ' ) {
245
-		$first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date( $dt_frmt ) : '';
246
-		$last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date( $dt_frmt ) : '';
244
+	public function date_range($dt_frmt = '', $conjunction = ' - ') {
245
+		$first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date($dt_frmt) : '';
246
+		$last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date($dt_frmt) : '';
247 247
 
248
-		return $first_date && $last_date ? $first_date . $conjunction  . $last_date : '';
248
+		return $first_date && $last_date ? $first_date.$conjunction.$last_date : '';
249 249
 	}
250 250
 
251 251
 
@@ -255,8 +255,8 @@  discard block
 block discarded – undo
255 255
 	 * @return EE_Datetime
256 256
 	 */
257 257
 	public function first_datetime() {
258
-		$datetimes = $this->datetimes( array( 'limit' => 1 ) );
259
-		return reset( $datetimes );
258
+		$datetimes = $this->datetimes(array('limit' => 1));
259
+		return reset($datetimes);
260 260
 	}
261 261
 
262 262
 
@@ -267,11 +267,11 @@  discard block
 block discarded – undo
267 267
 	 * @param array $query_params see EEM_Base::get_all()
268 268
 	 * @return EE_Datetime[]
269 269
 	 */
270
-	public function datetimes( $query_params = array() ) {
271
-		if ( ! isset( $query_params[ 'order_by' ] ) ) {
272
-			$query_params[ 'order_by' ][ 'DTT_order' ] = 'ASC';
270
+	public function datetimes($query_params = array()) {
271
+		if ( ! isset($query_params['order_by'])) {
272
+			$query_params['order_by']['DTT_order'] = 'ASC';
273 273
 		}
274
-		return $this->get_many_related( 'Datetime', $query_params );
274
+		return $this->get_many_related('Datetime', $query_params);
275 275
 	}
276 276
 
277 277
 
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
 	 * @return EE_Datetime
282 282
 	 */
283 283
 	public function last_datetime() {
284
-		$datetimes = $this->datetimes( array( 'limit' => 1, 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) ) );
285
-		return end( $datetimes );
284
+		$datetimes = $this->datetimes(array('limit' => 1, 'order_by' => array('DTT_EVT_start' => 'DESC')));
285
+		return end($datetimes);
286 286
 	}
287 287
 
288 288
 
@@ -296,22 +296,22 @@  discard block
 block discarded – undo
296 296
 	 * @param  int    $dtt_id [optional] include the dtt_id with $what = 'datetime'.
297 297
 	 * @return mixed (array|int)          how many tickets have sold
298 298
 	 */
299
-	public function tickets_sold( $what = 'ticket', $dtt_id = NULL ) {
299
+	public function tickets_sold($what = 'ticket', $dtt_id = NULL) {
300 300
 		$total = 0;
301 301
 		$tickets_sold = $this->_all_tickets_sold();
302
-		switch ( $what ) {
302
+		switch ($what) {
303 303
 			case 'ticket' :
304
-				return $tickets_sold[ 'ticket' ];
304
+				return $tickets_sold['ticket'];
305 305
 				break;
306 306
 			case 'datetime' :
307
-				if ( empty( $tickets_sold[ 'datetime' ] ) ) {
307
+				if (empty($tickets_sold['datetime'])) {
308 308
 					return $total;
309 309
 				}
310
-				if ( ! empty( $dtt_id ) && ! isset( $tickets_sold[ 'datetime' ][ $dtt_id ] ) ) {
311
-					EE_Error::add_error( __( "You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included.  Are you SURE that is a datetime related to this ticket?", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ );
310
+				if ( ! empty($dtt_id) && ! isset($tickets_sold['datetime'][$dtt_id])) {
311
+					EE_Error::add_error(__("You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included.  Are you SURE that is a datetime related to this ticket?", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
312 312
 					return $total;
313 313
 				}
314
-				return empty( $dtt_id ) ? $tickets_sold[ 'datetime' ] : $tickets_sold[ 'datetime' ][ $dtt_id ];
314
+				return empty($dtt_id) ? $tickets_sold['datetime'] : $tickets_sold['datetime'][$dtt_id];
315 315
 				break;
316 316
 			default:
317 317
 				return $total;
@@ -325,15 +325,15 @@  discard block
 block discarded – undo
325 325
 	 * @return EE_Ticket[]
326 326
 	 */
327 327
 	protected function _all_tickets_sold() {
328
-		$datetimes = $this->get_many_related( 'Datetime' );
328
+		$datetimes = $this->get_many_related('Datetime');
329 329
 		$tickets_sold = array();
330
-		if ( ! empty( $datetimes ) ) {
331
-			foreach ( $datetimes as $datetime ) {
332
-				$tickets_sold[ 'datetime' ][ $datetime->ID() ] = $datetime->get( 'DTT_sold' );
330
+		if ( ! empty($datetimes)) {
331
+			foreach ($datetimes as $datetime) {
332
+				$tickets_sold['datetime'][$datetime->ID()] = $datetime->get('DTT_sold');
333 333
 			}
334 334
 		}
335 335
 		//Tickets sold
336
-		$tickets_sold[ 'ticket' ] = $this->sold();
336
+		$tickets_sold['ticket'] = $this->sold();
337 337
 		return $tickets_sold;
338 338
 	}
339 339
 
@@ -346,9 +346,9 @@  discard block
 block discarded – undo
346 346
 	 * @param  bool $return_array whether to return as an array indexed by price id or just the object.
347 347
 	 * @return EE_Price
348 348
 	 */
349
-	public function base_price( $return_array = FALSE ) {
350
-		$_where = array( 'Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price );
351
-		return $return_array ? $this->get_many_related( 'Price', array( $_where ) ) : $this->get_first_related( 'Price', array( $_where ) );
349
+	public function base_price($return_array = FALSE) {
350
+		$_where = array('Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price);
351
+		return $return_array ? $this->get_many_related('Price', array($_where)) : $this->get_first_related('Price', array($_where));
352 352
 	}
353 353
 
354 354
 
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
 	 * @return EE_Price[]
361 361
 	 */
362 362
 	public function price_modifiers() {
363
-		$query_params = array( 0 => array( 'Price_Type.PBT_ID' => array( 'NOT IN', array( EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax ) ) ) );
364
-		return $this->prices( $query_params );
363
+		$query_params = array(0 => array('Price_Type.PBT_ID' => array('NOT IN', array(EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax))));
364
+		return $this->prices($query_params);
365 365
 	}
366 366
 
367 367
 
@@ -371,8 +371,8 @@  discard block
 block discarded – undo
371 371
 	 * @param array $query_params like EEM_Base::get_all
372 372
 	 * @return EE_Price[]
373 373
 	 */
374
-	public function prices( $query_params = array() ) {
375
-		return $this->get_many_related( 'Price', $query_params );
374
+	public function prices($query_params = array()) {
375
+		return $this->get_many_related('Price', $query_params);
376 376
 	}
377 377
 
378 378
 
@@ -382,8 +382,8 @@  discard block
 block discarded – undo
382 382
 	 * @param array $query_params see EEM_Base::get_all()
383 383
 	 * @return EE_Datetime_Ticket
384 384
 	 */
385
-	public function datetime_tickets( $query_params = array() ) {
386
-		return $this->get_many_related( 'Datetime_Ticket', $query_params );
385
+	public function datetime_tickets($query_params = array()) {
386
+		return $this->get_many_related('Datetime_Ticket', $query_params);
387 387
 	}
388 388
 
389 389
 
@@ -394,8 +394,8 @@  discard block
 block discarded – undo
394 394
 	 * @param boolean $show_deleted
395 395
 	 * @return EE_Datetime[]
396 396
 	 */
397
-	public function datetimes_ordered( $show_expired = TRUE, $show_deleted = FALSE ) {
398
-		return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_ticket_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted );
397
+	public function datetimes_ordered($show_expired = TRUE, $show_deleted = FALSE) {
398
+		return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_ticket_ordered_by_DTT_order($this->ID(), $show_expired, $show_deleted);
399 399
 	}
400 400
 
401 401
 
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 	 * @return string
406 406
 	 */
407 407
 	function ID() {
408
-		return $this->get( 'TKT_ID' );
408
+		return $this->get('TKT_ID');
409 409
 	}
410 410
 
411 411
 
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 	 * @return EE_Ticket_Template
430 430
 	 */
431 431
 	public function template() {
432
-		return $this->get_first_related( 'Ticket_Template' );
432
+		return $this->get_first_related('Ticket_Template');
433 433
 	}
434 434
 
435 435
 
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 	 * @return bool
449 449
 	 */
450 450
 	public function ticket_price() {
451
-		return $this->get( 'TKT_price' );
451
+		return $this->get('TKT_price');
452 452
 	}
453 453
 
454 454
 
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 	 * @return mixed
458 458
 	 */
459 459
 	public function pretty_price() {
460
-		return $this->get_pretty( 'TKT_price' );
460
+		return $this->get_pretty('TKT_price');
461 461
 	}
462 462
 
463 463
 
@@ -476,17 +476,17 @@  discard block
 block discarded – undo
476 476
 	 * @param bool $no_cache
477 477
 	 * @return float
478 478
 	 */
479
-	public function get_ticket_total_with_taxes( $no_cache = FALSE ) {
480
-		if ( ! isset( $this->_ticket_total_with_taxes ) || $no_cache ) {
479
+	public function get_ticket_total_with_taxes($no_cache = FALSE) {
480
+		if ( ! isset($this->_ticket_total_with_taxes) || $no_cache) {
481 481
 			$this->_ticket_total_with_taxes = $this->get_ticket_subtotal() + $this->get_ticket_taxes_total_for_admin();
482 482
 		}
483
-		return (float)$this->_ticket_total_with_taxes;
483
+		return (float) $this->_ticket_total_with_taxes;
484 484
 	}
485 485
 
486 486
 
487 487
 
488 488
 	public function ensure_TKT_Price_correct() {
489
-		$this->set( 'TKT_price', EE_Taxes::get_subtotal_for_admin( $this ) );
489
+		$this->set('TKT_price', EE_Taxes::get_subtotal_for_admin($this));
490 490
 		$this->save();
491 491
 	}
492 492
 
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 	 * @return float
497 497
 	 */
498 498
 	public function get_ticket_subtotal() {
499
-		return EE_Taxes::get_subtotal_for_admin( $this );
499
+		return EE_Taxes::get_subtotal_for_admin($this);
500 500
 	}
501 501
 
502 502
 
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 	 * @return float
507 507
 	 */
508 508
 	public function get_ticket_taxes_total_for_admin() {
509
-		return EE_Taxes::get_total_taxes_for_admin( $this );
509
+		return EE_Taxes::get_total_taxes_for_admin($this);
510 510
 	}
511 511
 
512 512
 
@@ -516,8 +516,8 @@  discard block
 block discarded – undo
516 516
 	 * @param string $name
517 517
 	 * @return boolean
518 518
 	 */
519
-	function set_name( $name ) {
520
-		$this->set( 'TKT_name', $name );
519
+	function set_name($name) {
520
+		$this->set('TKT_name', $name);
521 521
 	}
522 522
 
523 523
 
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	 * @return string
528 528
 	 */
529 529
 	function description() {
530
-		return $this->get( 'TKT_description' );
530
+		return $this->get('TKT_description');
531 531
 	}
532 532
 
533 533
 
@@ -537,8 +537,8 @@  discard block
 block discarded – undo
537 537
 	 * @param string $description
538 538
 	 * @return boolean
539 539
 	 */
540
-	function set_description( $description ) {
541
-		$this->set( 'TKT_description', $description );
540
+	function set_description($description) {
541
+		$this->set('TKT_description', $description);
542 542
 	}
543 543
 
544 544
 
@@ -549,8 +549,8 @@  discard block
 block discarded – undo
549 549
 	 * @param string $tm_frmt
550 550
 	 * @return string
551 551
 	 */
552
-	function start_date( $dt_frmt = '', $tm_frmt = '' ) {
553
-		return $this->_get_datetime( 'TKT_start_date', $dt_frmt, $tm_frmt );
552
+	function start_date($dt_frmt = '', $tm_frmt = '') {
553
+		return $this->_get_datetime('TKT_start_date', $dt_frmt, $tm_frmt);
554 554
 	}
555 555
 
556 556
 
@@ -560,8 +560,8 @@  discard block
 block discarded – undo
560 560
 	 * @param string $start_date
561 561
 	 * @return void
562 562
 	 */
563
-	function set_start_date( $start_date ) {
564
-		$this->_set_date_time( 'B', $start_date, 'TKT_start_date' );
563
+	function set_start_date($start_date) {
564
+		$this->_set_date_time('B', $start_date, 'TKT_start_date');
565 565
 	}
566 566
 
567 567
 
@@ -572,8 +572,8 @@  discard block
 block discarded – undo
572 572
 	 * @param string $tm_frmt
573 573
 	 * @return string
574 574
 	 */
575
-	function end_date( $dt_frmt = '', $tm_frmt = '' ) {
576
-		return $this->_get_datetime( 'TKT_end_date', $dt_frmt, $tm_frmt );
575
+	function end_date($dt_frmt = '', $tm_frmt = '') {
576
+		return $this->_get_datetime('TKT_end_date', $dt_frmt, $tm_frmt);
577 577
 	}
578 578
 
579 579
 
@@ -583,8 +583,8 @@  discard block
 block discarded – undo
583 583
 	 * @param string $end_date
584 584
 	 * @return void
585 585
 	 */
586
-	function set_end_date( $end_date ) {
587
-		$this->_set_date_time( 'B', $end_date, 'TKT_end_date' );
586
+	function set_end_date($end_date) {
587
+		$this->_set_date_time('B', $end_date, 'TKT_end_date');
588 588
 	}
589 589
 
590 590
 
@@ -596,8 +596,8 @@  discard block
 block discarded – undo
596 596
 	 *
597 597
 	 * @param string $time a string representation of the sell until time (ex 9am or 7:30pm)
598 598
 	 */
599
-	function set_end_time( $time ) {
600
-		$this->_set_time_for( $time, 'TKT_end_date' );
599
+	function set_end_time($time) {
600
+		$this->_set_time_for($time, 'TKT_end_date');
601 601
 	}
602 602
 
603 603
 
@@ -607,8 +607,8 @@  discard block
 block discarded – undo
607 607
 	 * @param int $min
608 608
 	 * @return boolean
609 609
 	 */
610
-	function set_min( $min ) {
611
-		$this->set( 'TKT_min', $min );
610
+	function set_min($min) {
611
+		$this->set('TKT_min', $min);
612 612
 	}
613 613
 
614 614
 
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 	 * @return int
619 619
 	 */
620 620
 	function max() {
621
-		return $this->get( 'TKT_max' );
621
+		return $this->get('TKT_max');
622 622
 	}
623 623
 
624 624
 
@@ -628,8 +628,8 @@  discard block
 block discarded – undo
628 628
 	 * @param int $max
629 629
 	 * @return boolean
630 630
 	 */
631
-	function set_max( $max ) {
632
-		$this->set( 'TKT_max', $max );
631
+	function set_max($max) {
632
+		$this->set('TKT_max', $max);
633 633
 	}
634 634
 
635 635
 
@@ -639,8 +639,8 @@  discard block
 block discarded – undo
639 639
 	 * @param float $price
640 640
 	 * @return boolean
641 641
 	 */
642
-	function set_price( $price ) {
643
-		$this->set( 'TKT_price', $price );
642
+	function set_price($price) {
643
+		$this->set('TKT_price', $price);
644 644
 	}
645 645
 
646 646
 
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 	 * @return int
651 651
 	 */
652 652
 	function sold() {
653
-		return $this->get_raw( 'TKT_sold' );
653
+		return $this->get_raw('TKT_sold');
654 654
 	}
655 655
 
656 656
 
@@ -660,10 +660,10 @@  discard block
 block discarded – undo
660 660
 	 * @param int $qty
661 661
 	 * @return boolean
662 662
 	 */
663
-	function increase_sold( $qty = 1 ) {
663
+	function increase_sold($qty = 1) {
664 664
 		$sold = $this->sold() + $qty;
665
-		$this->_increase_sold_for_datetimes( $qty );
666
-		return $this->set_sold( $sold );
665
+		$this->_increase_sold_for_datetimes($qty);
666
+		return $this->set_sold($sold);
667 667
 	}
668 668
 
669 669
 
@@ -673,12 +673,12 @@  discard block
 block discarded – undo
673 673
 	 * @param int $qty
674 674
 	 * @return boolean
675 675
 	 */
676
-	protected function _increase_sold_for_datetimes( $qty = 1 ) {
676
+	protected function _increase_sold_for_datetimes($qty = 1) {
677 677
 		$datetimes = $this->datetimes();
678
-		if ( is_array( $datetimes ) ) {
679
-			foreach ( $datetimes as $datetime ) {
680
-				if ( $datetime instanceof EE_Datetime ) {
681
-					$datetime->increase_sold( $qty );
678
+		if (is_array($datetimes)) {
679
+			foreach ($datetimes as $datetime) {
680
+				if ($datetime instanceof EE_Datetime) {
681
+					$datetime->increase_sold($qty);
682 682
 					$datetime->save();
683 683
 				}
684 684
 			}
@@ -692,10 +692,10 @@  discard block
 block discarded – undo
692 692
 	 * @param int $sold
693 693
 	 * @return boolean
694 694
 	 */
695
-	function set_sold( $sold ) {
695
+	function set_sold($sold) {
696 696
 		// sold can not go below zero
697
-		$sold = max( 0, $sold );
698
-		$this->set( 'TKT_sold', $sold );
697
+		$sold = max(0, $sold);
698
+		$this->set('TKT_sold', $sold);
699 699
 	}
700 700
 
701 701
 
@@ -705,10 +705,10 @@  discard block
 block discarded – undo
705 705
 	 * @param int $qty
706 706
 	 * @return boolean
707 707
 	 */
708
-	function decrease_sold( $qty = 1 ) {
708
+	function decrease_sold($qty = 1) {
709 709
 		$sold = $this->sold() - $qty;
710
-		$this->_decrease_sold_for_datetimes( $qty );
711
-		return $this->set_sold( $sold );
710
+		$this->_decrease_sold_for_datetimes($qty);
711
+		return $this->set_sold($sold);
712 712
 	}
713 713
 
714 714
 
@@ -719,12 +719,12 @@  discard block
 block discarded – undo
719 719
 	* @param int $qty
720 720
 	* @return boolean
721 721
 	*/
722
-	protected function _decrease_sold_for_datetimes( $qty = 1 ) {
722
+	protected function _decrease_sold_for_datetimes($qty = 1) {
723 723
 		$datetimes = $this->datetimes();
724
-		if ( is_array( $datetimes ) ) {
725
-			foreach ( $datetimes as $datetime ) {
726
-				if ( $datetime instanceof EE_Datetime ) {
727
-					$datetime->decrease_sold( $qty );
724
+		if (is_array($datetimes)) {
725
+			foreach ($datetimes as $datetime) {
726
+				if ($datetime instanceof EE_Datetime) {
727
+					$datetime->decrease_sold($qty);
728 728
 					$datetime->save();
729 729
 				}
730 730
 			}
@@ -745,14 +745,14 @@  discard block
 block discarded – undo
745 745
 	 *
746 746
 	 * @return int
747 747
 	 */
748
-	function qty( $context = '' ) {
749
-		switch ( $context ) {
748
+	function qty($context = '') {
749
+		switch ($context) {
750 750
 			case 'reg_limit' :
751 751
 				return $this->real_quantity_on_ticket();
752 752
 			case 'saleable' :
753
-				return $this->real_quantity_on_ticket( 'saleable' );
753
+				return $this->real_quantity_on_ticket('saleable');
754 754
 			default:
755
-				return $this->get_raw( 'TKT_qty' );
755
+				return $this->get_raw('TKT_qty');
756 756
 		}
757 757
 	}
758 758
 
@@ -769,38 +769,38 @@  discard block
 block discarded – undo
769 769
 	 *
770 770
 	 * @return int
771 771
 	 */
772
-	function real_quantity_on_ticket( $context = 'reg_limit' ) {
772
+	function real_quantity_on_ticket($context = 'reg_limit') {
773 773
 		// start with the original db value for ticket quantity
774
-		$raw = $this->get_raw( 'TKT_qty' );
774
+		$raw = $this->get_raw('TKT_qty');
775 775
 		// return immediately if it's zero
776
-		if ( $raw === 0 ) {
776
+		if ($raw === 0) {
777 777
 			return $raw;
778 778
 		}
779 779
 		// ensure qty doesn't exceed raw value for THIS ticket
780
-		$qty = min( EE_INF, $raw );
780
+		$qty = min(EE_INF, $raw);
781 781
 		// NOW that we know the  maximum number of tickets available for the ticket
782 782
 		// we need to calculate the maximum number of tickets available for the datetime
783 783
 		// without really factoring this ticket into the calculations
784 784
 		$datetimes = $this->datetimes();
785
-		foreach ( $datetimes as $datetime ) {
786
-			if ( $datetime instanceof EE_Datetime ) {
785
+		foreach ($datetimes as $datetime) {
786
+			if ($datetime instanceof EE_Datetime) {
787 787
 				// initialize with no restrictions for each datetime
788 788
 				// but adjust datetime qty based on datetime reg limit
789
-				$datetime_qty = min( EE_INF, $datetime->reg_limit() );
789
+				$datetime_qty = min(EE_INF, $datetime->reg_limit());
790 790
 				// if we want the actual saleable amount, then we need to consider OTHER ticket sales
791 791
 				// for this datetime, that do NOT include sales for this ticket (so we add THIS ticket's sales back in)
792
-				if ( $context == 'saleable' ) {
793
-					$datetime_qty = max( $datetime_qty - $datetime->sold() + $this->sold(), 0 );
792
+				if ($context == 'saleable') {
793
+					$datetime_qty = max($datetime_qty - $datetime->sold() + $this->sold(), 0);
794 794
 					$datetime_qty = ! $datetime->sold_out() ? $datetime_qty : 0;
795 795
 				}
796
-				$qty = min( $datetime_qty, $qty );
796
+				$qty = min($datetime_qty, $qty);
797 797
 			}
798 798
 
799 799
 		}
800 800
 		// we need to factor in the details for this specific ticket
801
-		if ( $qty > 0 && $context == 'saleable' ) {
801
+		if ($qty > 0 && $context == 'saleable') {
802 802
 			// and subtract the sales for THIS ticket
803
-			$qty = max( $qty - $this->sold(), 0 );
803
+			$qty = max($qty - $this->sold(), 0);
804 804
 			//echo '&nbsp; $qty: ' . $qty . "<br />";
805 805
 		}
806 806
 		//echo '$qty: ' . $qty . "<br />";
@@ -816,14 +816,14 @@  discard block
 block discarded – undo
816 816
 	 * @return bool
817 817
 	 * @throws \EE_Error
818 818
 	 */
819
-	function set_qty( $qty ) {
819
+	function set_qty($qty) {
820 820
 		$datetimes = $this->datetimes();
821
-		foreach ( $datetimes as $datetime ) {
822
-			if ( $datetime instanceof EE_Datetime ) {
823
-				$qty = min( $qty, $datetime->reg_limit() );
821
+		foreach ($datetimes as $datetime) {
822
+			if ($datetime instanceof EE_Datetime) {
823
+				$qty = min($qty, $datetime->reg_limit());
824 824
 			}
825 825
 		}
826
-		$this->set( 'TKT_qty', $qty );
826
+		$this->set('TKT_qty', $qty);
827 827
 	}
828 828
 
829 829
 
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
 	 * @return int
834 834
 	 */
835 835
 	function uses() {
836
-		return $this->get( 'TKT_uses' );
836
+		return $this->get('TKT_uses');
837 837
 	}
838 838
 
839 839
 
@@ -843,8 +843,8 @@  discard block
 block discarded – undo
843 843
 	 * @param int $uses
844 844
 	 * @return boolean
845 845
 	 */
846
-	function set_uses( $uses ) {
847
-		$this->set( 'TKT_uses', $uses );
846
+	function set_uses($uses) {
847
+		$this->set('TKT_uses', $uses);
848 848
 	}
849 849
 
850 850
 
@@ -854,7 +854,7 @@  discard block
 block discarded – undo
854 854
 	 * @return boolean
855 855
 	 */
856 856
 	public function required() {
857
-		return $this->get( 'TKT_required' );
857
+		return $this->get('TKT_required');
858 858
 	}
859 859
 
860 860
 
@@ -864,8 +864,8 @@  discard block
 block discarded – undo
864 864
 	 * @param boolean $required
865 865
 	 * @return boolean
866 866
 	 */
867
-	public function set_required( $required ) {
868
-		$this->set( 'TKT_required', $required );
867
+	public function set_required($required) {
868
+		$this->set('TKT_required', $required);
869 869
 	}
870 870
 
871 871
 
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
 	 * @return boolean
876 876
 	 */
877 877
 	function taxable() {
878
-		return $this->get( 'TKT_taxable' );
878
+		return $this->get('TKT_taxable');
879 879
 	}
880 880
 
881 881
 
@@ -885,8 +885,8 @@  discard block
 block discarded – undo
885 885
 	 * @param boolean $taxable
886 886
 	 * @return boolean
887 887
 	 */
888
-	function set_taxable( $taxable ) {
889
-		$this->set( 'TKT_taxable', $taxable );
888
+	function set_taxable($taxable) {
889
+		$this->set('TKT_taxable', $taxable);
890 890
 	}
891 891
 
892 892
 
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
 	 * @return boolean
897 897
 	 */
898 898
 	function is_default() {
899
-		return $this->get( 'TKT_is_default' );
899
+		return $this->get('TKT_is_default');
900 900
 	}
901 901
 
902 902
 
@@ -906,8 +906,8 @@  discard block
 block discarded – undo
906 906
 	 * @param boolean $is_default
907 907
 	 * @return boolean
908 908
 	 */
909
-	function set_is_default( $is_default ) {
910
-		$this->set( 'TKT_is_default', $is_default );
909
+	function set_is_default($is_default) {
910
+		$this->set('TKT_is_default', $is_default);
911 911
 	}
912 912
 
913 913
 
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 	 * @return int
918 918
 	 */
919 919
 	function order() {
920
-		return $this->get( 'TKT_order' );
920
+		return $this->get('TKT_order');
921 921
 	}
922 922
 
923 923
 
@@ -927,8 +927,8 @@  discard block
 block discarded – undo
927 927
 	 * @param int $order
928 928
 	 * @return boolean
929 929
 	 */
930
-	function set_order( $order ) {
931
-		$this->set( 'TKT_order', $order );
930
+	function set_order($order) {
931
+		$this->set('TKT_order', $order);
932 932
 	}
933 933
 
934 934
 
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
 	 * @return int
939 939
 	 */
940 940
 	function row() {
941
-		return $this->get( 'TKT_row' );
941
+		return $this->get('TKT_row');
942 942
 	}
943 943
 
944 944
 
@@ -948,8 +948,8 @@  discard block
 block discarded – undo
948 948
 	 * @param int $row
949 949
 	 * @return boolean
950 950
 	 */
951
-	function set_row( $row ) {
952
-		$this->set( 'TKT_row', $row );
951
+	function set_row($row) {
952
+		$this->set('TKT_row', $row);
953 953
 	}
954 954
 
955 955
 
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
 	 * @return boolean
960 960
 	 */
961 961
 	function deleted() {
962
-		return $this->get( 'TKT_deleted' );
962
+		return $this->get('TKT_deleted');
963 963
 	}
964 964
 
965 965
 
@@ -969,8 +969,8 @@  discard block
 block discarded – undo
969 969
 	 * @param boolean $deleted
970 970
 	 * @return boolean
971 971
 	 */
972
-	function set_deleted( $deleted ) {
973
-		$this->set( 'TKT_deleted', $deleted );
972
+	function set_deleted($deleted) {
973
+		$this->set('TKT_deleted', $deleted);
974 974
 	}
975 975
 
976 976
 
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
 	 * @return int
981 981
 	 */
982 982
 	function parent_ID() {
983
-		return $this->get( 'TKT_parent' );
983
+		return $this->get('TKT_parent');
984 984
 	}
985 985
 
986 986
 
@@ -990,8 +990,8 @@  discard block
 block discarded – undo
990 990
 	 * @param int $parent
991 991
 	 * @return boolean
992 992
 	 */
993
-	function set_parent_ID( $parent ) {
994
-		$this->set( 'TKT_parent', $parent );
993
+	function set_parent_ID($parent) {
994
+		$this->set('TKT_parent', $parent);
995 995
 	}
996 996
 
997 997
 
@@ -1002,10 +1002,10 @@  discard block
 block discarded – undo
1002 1002
 	 */
1003 1003
 	function name_and_info() {
1004 1004
 		$times = array();
1005
-		foreach ( $this->datetimes() as $datetime ) {
1005
+		foreach ($this->datetimes() as $datetime) {
1006 1006
 			$times[] = $datetime->start_date_and_time();
1007 1007
 		}
1008
-		return $this->name() . " @ " . implode( ", ", $times ) . " for " . $this->price();
1008
+		return $this->name()." @ ".implode(", ", $times)." for ".$this->price();
1009 1009
 	}
1010 1010
 
1011 1011
 
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 	 * @return string
1016 1016
 	 */
1017 1017
 	function name() {
1018
-		return $this->get( 'TKT_name' );
1018
+		return $this->get('TKT_name');
1019 1019
 	}
1020 1020
 
1021 1021
 
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
 	 * @return float
1026 1026
 	 */
1027 1027
 	function price() {
1028
-		return $this->get( 'TKT_price' );
1028
+		return $this->get('TKT_price');
1029 1029
 	}
1030 1030
 
1031 1031
 
@@ -1035,8 +1035,8 @@  discard block
 block discarded – undo
1035 1035
 	 * @param array $query_params like EEM_Base::get_all's
1036 1036
 	 * @return EE_Registration[]
1037 1037
 	 */
1038
-	public function registrations( $query_params = array() ) {
1039
-		return $this->get_many_related( 'Registration', $query_params );
1038
+	public function registrations($query_params = array()) {
1039
+		return $this->get_many_related('Registration', $query_params);
1040 1040
 	}
1041 1041
 
1042 1042
 
@@ -1047,8 +1047,8 @@  discard block
 block discarded – undo
1047 1047
 	 * @return int
1048 1048
 	 */
1049 1049
 	public function update_tickets_sold() {
1050
-		$count_regs_for_this_ticket = $this->count_registrations( array( array( 'STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0 ) ) );
1051
-		$this->set_sold( $count_regs_for_this_ticket );
1050
+		$count_regs_for_this_ticket = $this->count_registrations(array(array('STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0)));
1051
+		$this->set_sold($count_regs_for_this_ticket);
1052 1052
 		$this->save();
1053 1053
 		return $count_regs_for_this_ticket;
1054 1054
 	}
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
 	 * @param array $query_params like EEM_Base::get_all's
1061 1061
 	 * @return int
1062 1062
 	 */
1063
-	public function count_registrations( $query_params = array() ) {
1063
+	public function count_registrations($query_params = array()) {
1064 1064
 		return $this->count_related('Registration', $query_params);
1065 1065
 	}
1066 1066
 
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
 	public function get_related_event() {
1086 1086
 		//get one datetime to use for getting the event
1087 1087
 		$datetime = $this->first_datetime();
1088
-		if ( $datetime instanceof EE_Datetime ) {
1088
+		if ($datetime instanceof EE_Datetime) {
1089 1089
 			return $datetime->event();
1090 1090
 		}
1091 1091
 		return null;
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -714,11 +714,11 @@
 block discarded – undo
714 714
 
715 715
 
716 716
 	/**
717
-	* Decreases sold on related datetimes
718
-	*
719
-	* @param int $qty
720
-	* @return boolean
721
-	*/
717
+	 * Decreases sold on related datetimes
718
+	 *
719
+	 * @param int $qty
720
+	 * @return boolean
721
+	 */
722 722
 	protected function _decrease_sold_for_datetimes( $qty = 1 ) {
723 723
 		$datetimes = $this->datetimes();
724 724
 		if ( is_array( $datetimes ) ) {
Please login to merge, or discard this patch.
core/db_models/EEM_Question.model.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -219,7 +219,7 @@
 block discarded – undo
219 219
 	 * Gets an array for converting between QST_system and QST_IDs for system questions. Eg, if you want to know
220 220
 	 * which system question QST_ID corresponds to the QST_system 'city', use EEM_Question::instance()->get_Question_ID_from_system_string('city');
221 221
 	 * @param $QST_system
222
-	 * @return int of QST_ID for the question that corresponds to that QST_system
222
+	 * @return string of QST_ID for the question that corresponds to that QST_system
223 223
 	 */
224 224
 	public function get_Question_ID_from_system_string( $QST_system ){
225 225
 		 return $this->get_var( array( array( 'QST_system' => $QST_system ) ) );
Please login to merge, or discard this patch.
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2 2
 	exit('No direct script access allowed');
3 3
 }
4
-require_once( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
5
-require_once( EE_CLASSES . 'EE_Question.class.php' );
4
+require_once(EE_MODELS.'EEM_Soft_Delete_Base.model.php');
5
+require_once(EE_CLASSES.'EE_Question.class.php');
6 6
 
7 7
 
8 8
 
@@ -74,24 +74,24 @@  discard block
 block discarded – undo
74 74
 	/**
75 75
 	 * @param null $timezone
76 76
 	 */
77
-	protected function __construct( $timezone = NULL ) {
78
-		$this->singular_item = __('Question','event_espresso');
79
-		$this->plural_item = __('Questions','event_espresso');
80
-		$this->_allowed_question_types=apply_filters(
77
+	protected function __construct($timezone = NULL) {
78
+		$this->singular_item = __('Question', 'event_espresso');
79
+		$this->plural_item = __('Questions', 'event_espresso');
80
+		$this->_allowed_question_types = apply_filters(
81 81
 			'FHEE__EEM_Question__construct__allowed_question_types',
82 82
 			array(
83
-				EEM_Question::QST_type_text =>__('Text','event_espresso'),
84
-				EEM_Question::QST_type_textarea =>__('Textarea','event_espresso'),
85
-				EEM_Question::QST_type_checkbox =>__('Checkboxes','event_espresso'),
86
-				EEM_Question::QST_type_radio =>__('Radio Buttons','event_espresso'),
87
-				EEM_Question::QST_type_dropdown =>__('Dropdown','event_espresso'),
88
-				EEM_Question::QST_type_state =>__('State/Province Dropdown','event_espresso'),
89
-				EEM_Question::QST_type_country =>__('Country Dropdown','event_espresso'),
90
-				EEM_Question::QST_type_date =>__('Date Picker','event_espresso'),
91
-				EEM_Question::QST_type_html_textarea => __( 'HTML Textarea', 'event_espresso' ),
83
+				EEM_Question::QST_type_text =>__('Text', 'event_espresso'),
84
+				EEM_Question::QST_type_textarea =>__('Textarea', 'event_espresso'),
85
+				EEM_Question::QST_type_checkbox =>__('Checkboxes', 'event_espresso'),
86
+				EEM_Question::QST_type_radio =>__('Radio Buttons', 'event_espresso'),
87
+				EEM_Question::QST_type_dropdown =>__('Dropdown', 'event_espresso'),
88
+				EEM_Question::QST_type_state =>__('State/Province Dropdown', 'event_espresso'),
89
+				EEM_Question::QST_type_country =>__('Country Dropdown', 'event_espresso'),
90
+				EEM_Question::QST_type_date =>__('Date Picker', 'event_espresso'),
91
+				EEM_Question::QST_type_html_textarea => __('HTML Textarea', 'event_espresso'),
92 92
 			)
93 93
 		);
94
-		$this->_question_type_categories = (array)apply_filters(
94
+		$this->_question_type_categories = (array) apply_filters(
95 95
 				'FHEE__EEM_Question__construct__question_type_categories',
96 96
 				array(
97 97
 				'text' => array(
@@ -107,22 +107,22 @@  discard block
 block discarded – undo
107 107
 		);
108 108
 
109 109
 		$this->_tables = array(
110
-			'Question'=>new EE_Primary_Table('esp_question','QST_ID')
110
+			'Question'=>new EE_Primary_Table('esp_question', 'QST_ID')
111 111
 		);
112 112
 		$this->_fields = array(
113 113
 			'Question'=>array(
114
-				'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID','event_espresso')),
115
-				'QST_display_text'=>new EE_Full_HTML_Field('QST_display_text', __('Question Text','event_espresso'), true, ''),
116
-				'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)','event_espresso'), true, ''),
117
-				'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question','event_espresso'), TRUE, NULL ),
118
-				'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type','event_espresso'),false, 'TEXT',$this->_allowed_question_types),
119
-				'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?','event_espresso'), false, false),
120
-				'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided','event_espresso'), true, ''),
121
-				'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order','event_espresso'), false, 0),
122
-				'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?','event_espresso'), false, false),
123
-				'QST_max' => new EE_Infinite_Integer_Field( 'QST_max', __( 'Max Size', 'event_espresso'	), false, EE_INF ),
124
-				'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID','event_espresso'), false ),
125
-				'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted','event_espresso'), false, false)
114
+				'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso')),
115
+				'QST_display_text'=>new EE_Full_HTML_Field('QST_display_text', __('Question Text', 'event_espresso'), true, ''),
116
+				'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)', 'event_espresso'), true, ''),
117
+				'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question', 'event_espresso'), TRUE, NULL),
118
+				'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type', 'event_espresso'), false, 'TEXT', $this->_allowed_question_types),
119
+				'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?', 'event_espresso'), false, false),
120
+				'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided', 'event_espresso'), true, ''),
121
+				'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order', 'event_espresso'), false, 0),
122
+				'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?', 'event_espresso'), false, false),
123
+				'QST_max' => new EE_Infinite_Integer_Field('QST_max', __('Max Size', 'event_espresso'), false, EE_INF),
124
+				'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID', 'event_espresso'), false),
125
+				'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted', 'event_espresso'), false, false)
126 126
 			)
127 127
 		);
128 128
 		$this->_model_relations = array(
@@ -134,11 +134,11 @@  discard block
 block discarded – undo
134 134
 			'Question_Group_Question'=>new EE_Has_Many_Relation()
135 135
 		);
136 136
 		//this model is generally available for reading
137
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
138
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QST_system');
139
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QST_system');
140
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QST_system');
141
-		parent::__construct( $timezone );
137
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
138
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QST_system');
139
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QST_system');
140
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QST_system');
141
+		parent::__construct($timezone);
142 142
 	}
143 143
 
144 144
 	/**
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * but they can be extended
147 147
 	 * @return string[]
148 148
 	 */
149
-	public function allowed_question_types(){
149
+	public function allowed_question_types() {
150 150
 		return $this->_allowed_question_types;
151 151
 	}
152 152
 	/**
@@ -154,16 +154,16 @@  discard block
 block discarded – undo
154 154
 	 * @param string $question_type one of EEM_Question::allowed_question_types(
155 155
 	 * @return string[] like EEM_Question::allowed_question_types()
156 156
 	 */
157
-	public function question_types_in_same_category( $question_type ) {
158
-		$question_types = array( $question_type );
159
-		foreach( $this->_question_type_categories as $category => $question_types_in_category ) {
160
-			if( in_array( $question_type, $question_types_in_category ) ) {
157
+	public function question_types_in_same_category($question_type) {
158
+		$question_types = array($question_type);
159
+		foreach ($this->_question_type_categories as $category => $question_types_in_category) {
160
+			if (in_array($question_type, $question_types_in_category)) {
161 161
 				$question_types = $question_types_in_category;
162 162
 				break;
163 163
 			}
164 164
 		}
165 165
 
166
-		return array_intersect_key( $this->allowed_question_types(), array_flip( $question_types ) );
166
+		return array_intersect_key($this->allowed_question_types(), array_flip($question_types));
167 167
 	}
168 168
 
169 169
 	/**
@@ -172,11 +172,11 @@  discard block
 block discarded – undo
172 172
 	 * @param string $category one of the top-level keys of EEM_Question::question_type_categories()
173 173
 	 * @return boolean
174 174
 	 */
175
-	public function question_type_is_in_category( $question_type, $category ) {
176
-		if( ! isset( $this->_question_type_categories[ $category ] ) ) {
175
+	public function question_type_is_in_category($question_type, $category) {
176
+		if ( ! isset($this->_question_type_categories[$category])) {
177 177
 			return false;
178 178
 		}
179
-		return in_array( $question_type, $this->_question_type_categories[ $category ] );
179
+		return in_array($question_type, $this->_question_type_categories[$category]);
180 180
 	}
181 181
 
182 182
 	/**
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
 	 * @param string $system_question_group_id QSG_system
194 194
 	 * @return array of system question names (QST_system)
195 195
 	 */
196
-	public function allowed_system_questions_in_system_question_group( $system_question_group_id ) {
196
+	public function allowed_system_questions_in_system_question_group($system_question_group_id) {
197 197
 		$question_system_ids = array();
198
-		switch( $system_question_group_id ) {
198
+		switch ($system_question_group_id) {
199 199
 			case EEM_Question_Group::system_personal:
200 200
 				$question_system_ids = array(
201 201
 					EEM_Attendee::system_question_fname,
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 				);
217 217
 				break;
218 218
 		}
219
-		return apply_filters( 'FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id );
219
+		return apply_filters('FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id);
220 220
 	}
221 221
 
222 222
 	/**
@@ -225,11 +225,11 @@  discard block
 block discarded – undo
225 225
 	 * @param string $system_question_group_id QSG_system
226 226
 	 * @return array of system question names (QST_system)
227 227
 	 */
228
-	public function required_system_questions_in_system_question_group( $system_question_group_id ) {
228
+	public function required_system_questions_in_system_question_group($system_question_group_id) {
229 229
 		$question_system_ids = null;
230
-		switch( $system_question_group_id ) {
230
+		switch ($system_question_group_id) {
231 231
 			case EEM_Question_Group::system_personal:
232
-				$question_system_ids =  array(
232
+				$question_system_ids = array(
233 233
 					EEM_Attendee::system_question_fname,
234 234
 					EEM_Attendee::system_question_email,
235 235
 				);
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 			default:
238 238
 				$question_system_ids = array();
239 239
 		}
240
-		return apply_filters( 'FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id );
240
+		return apply_filters('FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id);
241 241
 	}
242 242
 
243 243
 
@@ -248,8 +248,8 @@  discard block
 block discarded – undo
248 248
 	 * @param $QST_system
249 249
 	 * @return int of QST_ID for the question that corresponds to that QST_system
250 250
 	 */
251
-	public function get_Question_ID_from_system_string( $QST_system ){
252
-		 return $this->get_var( array( array( 'QST_system' => $QST_system ) ) );
251
+	public function get_Question_ID_from_system_string($QST_system) {
252
+		 return $this->get_var(array(array('QST_system' => $QST_system)));
253 253
 	}
254 254
 
255 255
 
@@ -261,10 +261,10 @@  discard block
 block discarded – undo
261 261
 	 */
262 262
 	public function get_latest_question_order() {
263 263
 		$columns_to_select = array(
264
-			'max_order' => array("MAX(QST_order)","%d")
264
+			'max_order' => array("MAX(QST_order)", "%d")
265 265
 		);
266
-		$max = $this->_get_all_wpdb_results( array(), ARRAY_A, $columns_to_select );
267
-		return isset( $max[0], $max[0]['max_order'] ) ? $max[0]['max_order'] : 0;
266
+		$max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select);
267
+		return isset($max[0], $max[0]['max_order']) ? $max[0]['max_order'] : 0;
268 268
 	}
269 269
 
270 270
 	/**
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
 	 * @param string $system_question_value
294 294
 	 * @return int|float
295 295
 	 */
296
-	public function absolute_max_for_system_question( $system_question_value ) {
296
+	public function absolute_max_for_system_question($system_question_value) {
297 297
 		$maxes = $this->system_question_maxes();
298
-		if( isset( $maxes[ $system_question_value ] ) ) {
299
-			return $maxes[ $system_question_value ];
298
+		if (isset($maxes[$system_question_value])) {
299
+			return $maxes[$system_question_value];
300 300
 		} else {
301 301
 			return EE_INF;
302 302
 		}
Please login to merge, or discard this patch.
core/helpers/EEH_Formatter.helper.php 4 patches
Doc Comments   +14 added lines, -2 removed lines patch added patch discarded remove patch
@@ -88,6 +88,7 @@  discard block
 block discarded – undo
88 88
 	/**
89 89
 	 * [ee_tep_not_null description]
90 90
 	 * @param  string | array $value [description]
91
+	 * @param string $value
91 92
 	 * @return bool       [description]
92 93
 	 */
93 94
 	static public function ee_tep_not_null($value) {
@@ -152,6 +153,15 @@  discard block
 block discarded – undo
152 153
  */
153 154
 class EE_Address_Formatter {
154 155
 
156
+	/**
157
+	 * @param string $address
158
+	 * @param string $address2
159
+	 * @param string $city
160
+	 * @param string $state
161
+	 * @param string $zip
162
+	 * @param string $country
163
+	 * @param string $sub
164
+	 */
155 165
 	protected function parse_formatted_address( $address, $address2, $city, $state, $zip, $country, $formatted_address, $sub ) {
156 166
 		// swap address part placeholders for the real text
157 167
 		$formatted_address = str_replace(
@@ -629,6 +639,8 @@  discard block
 block discarded – undo
629 639
 	 * @param EE_State | string $state
630 640
 	 * @param string $zip
631 641
 	 * @param EE_Country | string $country
642
+	 * @param integer $state
643
+	 * @param string $country
632 644
 	 * @return EE_Generic_Address
633 645
 	 */
634 646
 	public function __construct( $address, $address2, $city, $state, $zip, $country ) {
@@ -716,7 +728,7 @@  discard block
 block discarded – undo
716 728
 
717 729
 
718 730
 	/**
719
-	 * @return \EE_State
731
+	 * @return string
720 732
 	 */
721 733
 	public function state_obj() {
722 734
 		return $this->_state_obj;
@@ -765,7 +777,7 @@  discard block
 block discarded – undo
765 777
 
766 778
 
767 779
 	/**
768
-	 * @return \EE_Country
780
+	 * @return string
769 781
 	 */
770 782
 	public function country_obj() {
771 783
 		return $this->_country_obj;
Please login to merge, or discard this patch.
Spacing   +69 added lines, -69 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
 /**
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @param  string $content content to format
40 40
 	 * @return string          formatted content
41 41
 	 */
42
-	static public function admin_format_content($content='') {
42
+	static public function admin_format_content($content = '') {
43 43
 		return wpautop(stripslashes_deep(html_entity_decode($content, ENT_QUOTES, "UTF-8")));
44 44
 	}
45 45
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 * @return string
80 80
 	 */
81 81
 	static public	function ee_tep_parse_input_field_data($data, $parse) {
82
-		return strtr( trim($data), $parse);
82
+		return strtr(trim($data), $parse);
83 83
 	}
84 84
 
85 85
 
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
 	 * @return string
119 119
 	 * @deprecated v4.6.21
120 120
 	 */
121
-	static public function event_date_display( $date, $format = '' ) {
121
+	static public function event_date_display($date, $format = '') {
122 122
 		EE_Error::doing_it_wrong(
123 123
 			__METHOD__,
124
-			__( 'This method is deprecated as of EE 4.6.12.  Currently it does not reformat as with prior behaviour but just returns the incoming string.  Please use the EE_Datetime helpers for Datetime on the event to display as desired.', 'event_espresso' ),
124
+			__('This method is deprecated as of EE 4.6.12.  Currently it does not reformat as with prior behaviour but just returns the incoming string.  Please use the EE_Datetime helpers for Datetime on the event to display as desired.', 'event_espresso'),
125 125
 			'4.6.21'
126 126
 		);
127 127
 
@@ -152,18 +152,18 @@  discard block
 block discarded – undo
152 152
  */
153 153
 class EE_Address_Formatter {
154 154
 
155
-	protected function parse_formatted_address( $address, $address2, $city, $state, $zip, $country, $formatted_address, $sub ) {
155
+	protected function parse_formatted_address($address, $address2, $city, $state, $zip, $country, $formatted_address, $sub) {
156 156
 		// swap address part placeholders for the real text
157 157
 		$formatted_address = str_replace(
158 158
 			// find
159
-			array( '{address}', '{address2}', '{city}', '{state}', '{zip}', '{country}' ),
159
+			array('{address}', '{address2}', '{city}', '{state}', '{zip}', '{country}'),
160 160
 			// replace
161
-			array( $address, $address2, $city, $state, $zip, $country ),
161
+			array($address, $address2, $city, $state, $zip, $country),
162 162
 			// string
163 163
 			$formatted_address
164 164
 		);
165 165
 		// remove placeholder from start and end, reduce repeating placeholders to singles, then replace with HTML line breaks
166
-		return preg_replace( '/%+/', $sub, trim( $formatted_address, '%' ) );
166
+		return preg_replace('/%+/', $sub, trim($formatted_address, '%'));
167 167
 	}
168 168
 
169 169
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 * @param string $CNT_ISO
200 200
 	 * @return string
201 201
 	 */
202
-	public function format( $address, $address2, $city, $state, $zip, $country, $CNT_ISO ) {
202
+	public function format($address, $address2, $city, $state, $zip, $country, $CNT_ISO) {
203 203
 
204 204
 		$address_formats = apply_filters(
205 205
 			'FHEE__EE_MultiLine_Address_Formatter__address_formats',
@@ -211,8 +211,8 @@  discard block
 block discarded – undo
211 211
 			)
212 212
 		);
213 213
 		// if the incoming country has a set format, use that, else use the default
214
-		$formatted_address = isset( $address_formats[ $CNT_ISO ] ) ? $address_formats[ $CNT_ISO ] : $address_formats[ 'ZZ' ];
215
-		return $this->parse_formatted_address( $address, $address2, $city, $state, $zip, $country, $formatted_address, '<br />' );
214
+		$formatted_address = isset($address_formats[$CNT_ISO]) ? $address_formats[$CNT_ISO] : $address_formats['ZZ'];
215
+		return $this->parse_formatted_address($address, $address2, $city, $state, $zip, $country, $formatted_address, '<br />');
216 216
 	}
217 217
 }
218 218
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 * @param string $CNT_ISO
246 246
 	 * @return string
247 247
 	 */
248
-	public function format( $address, $address2, $city, $state, $zip, $country, $CNT_ISO ) {
248
+	public function format($address, $address2, $city, $state, $zip, $country, $CNT_ISO) {
249 249
 		$address_formats = apply_filters(
250 250
 			'FHEE__EE_Inline_Address_Formatter__address_formats',
251 251
 			array(
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
 			)
257 257
 		);
258 258
 		// if the incoming country has a set format, use that, else use the default
259
-		$formatted_address = isset( $address_formats[ $CNT_ISO ] ) ? $address_formats[ $CNT_ISO ] : $address_formats[ 'ZZZ' ];
260
-		return $this->parse_formatted_address( $address, $address2, $city, $state, $zip, $country, $formatted_address, ', ' );
259
+		$formatted_address = isset($address_formats[$CNT_ISO]) ? $address_formats[$CNT_ISO] : $address_formats['ZZZ'];
260
+		return $this->parse_formatted_address($address, $address2, $city, $state, $zip, $country, $formatted_address, ', ');
261 261
 
262 262
 	}
263 263
 }
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 	 * @param string $CNT_ISO
293 293
 	 * @return string
294 294
 	 */
295
-	public function format( $address, $address2, $city, $state, $zip, $country, $CNT_ISO ) {
295
+	public function format($address, $address2, $city, $state, $zip, $country, $CNT_ISO) {
296 296
 		return NULL;
297 297
 	}
298 298
 }
@@ -328,20 +328,20 @@  discard block
 block discarded – undo
328 328
 	 * @param bool    $add_wrapper
329 329
 	 * @return string
330 330
 	 */
331
-	public static function format ( $obj_with_address = null, $type = 'multiline', $use_schema = true, $add_wrapper = true ) {
331
+	public static function format($obj_with_address = null, $type = 'multiline', $use_schema = true, $add_wrapper = true) {
332 332
 		// check that incoming object implements the EEI_Address interface
333
-		if ( ! $obj_with_address instanceof EEI_Address ) {
334
-			$msg = __( 'The address could not be formatted.', 'event_espresso' );
335
-			$dev_msg = __( 'The EE_Address_Formatter requires passed objects to implement the EEI_Address interface.', 'event_espresso' );
336
-			EE_Error::add_error( $msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
333
+		if ( ! $obj_with_address instanceof EEI_Address) {
334
+			$msg = __('The address could not be formatted.', 'event_espresso');
335
+			$dev_msg = __('The EE_Address_Formatter requires passed objects to implement the EEI_Address interface.', 'event_espresso');
336
+			EE_Error::add_error($msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
337 337
 			return null;
338 338
 		}
339 339
 		// obtain an address formatter
340
-		$formatter = EEH_Address::_get_formatter( $type );
340
+		$formatter = EEH_Address::_get_formatter($type);
341 341
 		// apply schema.org formatting ?
342 342
 		$use_schema = ! is_admin() ? $use_schema : false;
343
-		$formatted_address = $use_schema ? EEH_Address::_schema_formatting( $formatter, $obj_with_address ) : EEH_Address::_regular_formatting( $formatter, $obj_with_address, $add_wrapper ) ;
344
-		$formatted_address = $add_wrapper && ! $use_schema ? '<div class="espresso-address-dv">' . $formatted_address . '</div>' : $formatted_address;
343
+		$formatted_address = $use_schema ? EEH_Address::_schema_formatting($formatter, $obj_with_address) : EEH_Address::_regular_formatting($formatter, $obj_with_address, $add_wrapper);
344
+		$formatted_address = $add_wrapper && ! $use_schema ? '<div class="espresso-address-dv">'.$formatted_address.'</div>' : $formatted_address;
345 345
 		// return the formatted address
346 346
 		return $formatted_address;
347 347
 	}
@@ -355,8 +355,8 @@  discard block
 block discarded – undo
355 355
 	* 	@param string $type how the address is formatted. for example: 'multiline' or 'inline'
356 356
 	* 	@return EEI_Address_Formatter
357 357
 	*/
358
-	private static function _get_formatter( $type ) {
359
-		switch( $type ) {
358
+	private static function _get_formatter($type) {
359
+		switch ($type) {
360 360
 
361 361
 			case 'multiline' :
362 362
 				return new EE_MultiLine_Address_Formatter();
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 	 * @param bool $add_wrapper
383 383
 	 * @return string
384 384
 	 */
385
-	private static function _regular_formatting( EEI_Address_Formatter $formatter, EEI_Address $obj_with_address, $add_wrapper = TRUE ){
385
+	private static function _regular_formatting(EEI_Address_Formatter $formatter, EEI_Address $obj_with_address, $add_wrapper = TRUE) {
386 386
 		$formatted_address = $add_wrapper ? '<div>' : '';
387 387
 		$formatted_address .= $formatter->format(
388 388
 			$obj_with_address->address(),
@@ -409,15 +409,15 @@  discard block
 block discarded – undo
409 409
 	* 	@param object EEI_Address $obj_with_address
410 410
 	* 	@return string
411 411
 	*/
412
-	private static function _schema_formatting( EEI_Address_Formatter $formatter, EEI_Address $obj_with_address ){
412
+	private static function _schema_formatting(EEI_Address_Formatter $formatter, EEI_Address $obj_with_address) {
413 413
 		$formatted_address = '<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">';
414 414
 		$formatted_address .= $formatter->format(
415
-			EEH_Schema::streetAddress( $obj_with_address ),
416
-			EEH_Schema::postOfficeBoxNumber( $obj_with_address ),
417
-			EEH_Schema::addressLocality( $obj_with_address ),
418
-			EEH_Schema::addressRegion( $obj_with_address ),
419
-			EEH_Schema::postalCode( $obj_with_address ),
420
-			EEH_Schema::addressCountry( $obj_with_address ),
415
+			EEH_Schema::streetAddress($obj_with_address),
416
+			EEH_Schema::postOfficeBoxNumber($obj_with_address),
417
+			EEH_Schema::addressLocality($obj_with_address),
418
+			EEH_Schema::addressRegion($obj_with_address),
419
+			EEH_Schema::postalCode($obj_with_address),
420
+			EEH_Schema::addressCountry($obj_with_address),
421 421
 			$obj_with_address->country_ID()
422 422
 		);
423 423
 		$formatted_address .= '</div>';
@@ -460,8 +460,8 @@  discard block
 block discarded – undo
460 460
 	* 	@param string $location
461 461
 	* 	@return string
462 462
 	*/
463
-	public static function location ( $location = NULL ) {
464
-		return ! empty( $location ) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">' . $location . '</div>' : '';
463
+	public static function location($location = NULL) {
464
+		return ! empty($location) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">'.$location.'</div>' : '';
465 465
 	}
466 466
 
467 467
 	/**
@@ -472,8 +472,8 @@  discard block
 block discarded – undo
472 472
 	* 	@param string $name
473 473
 	* 	@return string
474 474
 	*/
475
-	public static function name ( $name = NULL ) {
476
-		return ! empty( $name ) ? '<span itemprop="name">' . $name . '</span>' : '';
475
+	public static function name($name = NULL) {
476
+		return ! empty($name) ? '<span itemprop="name">'.$name.'</span>' : '';
477 477
 	}
478 478
 
479 479
 	/**
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
 	* 	@param EEI_Address $obj_with_address
485 485
 	* 	@return string
486 486
 	*/
487
-	public static function streetAddress ( EEI_Address $obj_with_address = NULL ) {
488
-		return $obj_with_address->address() !== NULL && $obj_with_address->address() !== '' ? '<span itemprop="streetAddress">' . $obj_with_address->address() . '</span>' : '';
487
+	public static function streetAddress(EEI_Address $obj_with_address = NULL) {
488
+		return $obj_with_address->address() !== NULL && $obj_with_address->address() !== '' ? '<span itemprop="streetAddress">'.$obj_with_address->address().'</span>' : '';
489 489
 	}
490 490
 
491 491
 	/**
@@ -496,10 +496,10 @@  discard block
 block discarded – undo
496 496
 	* 	@param EEI_Address $obj_with_address
497 497
 	* 	@return string
498 498
 	*/
499
-	public static function postOfficeBoxNumber ( EEI_Address $obj_with_address = NULL ) {
499
+	public static function postOfficeBoxNumber(EEI_Address $obj_with_address = NULL) {
500 500
 		// regex check for some form of PO Box or P.O. Box, etc, etc, etc
501
-		if ( preg_match("/^\s*((P(OST)?.?\s*(O(FF(ICE)?)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i", $obj_with_address->address2() )) {
502
-			return $obj_with_address->address2() !== NULL && $obj_with_address->address2() !== '' ? '<span itemprop="postOfficeBoxNumber">' . $obj_with_address->address2() . '</span>' : '';
501
+		if (preg_match("/^\s*((P(OST)?.?\s*(O(FF(ICE)?)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i", $obj_with_address->address2())) {
502
+			return $obj_with_address->address2() !== NULL && $obj_with_address->address2() !== '' ? '<span itemprop="postOfficeBoxNumber">'.$obj_with_address->address2().'</span>' : '';
503 503
 		} else {
504 504
 			return $obj_with_address->address2();
505 505
 		}
@@ -513,8 +513,8 @@  discard block
 block discarded – undo
513 513
 	* 	@param EEI_Address $obj_with_address
514 514
 	* 	@return string
515 515
 	*/
516
-	public static function addressLocality ( EEI_Address $obj_with_address = NULL ) {
517
-		return $obj_with_address->city() !== NULL && $obj_with_address->city() !== '' ? '<span itemprop="addressLocality">' . $obj_with_address->city() . '</span>' : '';
516
+	public static function addressLocality(EEI_Address $obj_with_address = NULL) {
517
+		return $obj_with_address->city() !== NULL && $obj_with_address->city() !== '' ? '<span itemprop="addressLocality">'.$obj_with_address->city().'</span>' : '';
518 518
 	}
519 519
 
520 520
 	/**
@@ -525,10 +525,10 @@  discard block
 block discarded – undo
525 525
 	* 	@param EEI_Address $obj_with_address
526 526
 	* 	@return string
527 527
 	*/
528
-	public static function addressRegion ( EEI_Address $obj_with_address = NULL ) {
528
+	public static function addressRegion(EEI_Address $obj_with_address = NULL) {
529 529
 		$state = $obj_with_address->state_name();
530
-		if ( ! empty( $state ) ) {
531
-			return '<span itemprop="addressRegion">' . $state . '</span>';
530
+		if ( ! empty($state)) {
531
+			return '<span itemprop="addressRegion">'.$state.'</span>';
532 532
 		} else {
533 533
 			return '';
534 534
 		}
@@ -542,10 +542,10 @@  discard block
 block discarded – undo
542 542
 	* 	@param EEI_Address $obj_with_address
543 543
 	* 	@return string
544 544
 	*/
545
-	public static function addressCountry ( EEI_Address $obj_with_address = NULL ) {
545
+	public static function addressCountry(EEI_Address $obj_with_address = NULL) {
546 546
 		$country = $obj_with_address->country_name();
547
-		if ( ! empty( $country ) ) {
548
-			return '<span itemprop="addressCountry">' . $country . '</span>';
547
+		if ( ! empty($country)) {
548
+			return '<span itemprop="addressCountry">'.$country.'</span>';
549 549
 		} else {
550 550
 			return '';
551 551
 		}
@@ -559,8 +559,8 @@  discard block
 block discarded – undo
559 559
 	* 	@param EEI_Address $obj_with_address
560 560
 	* 	@return string
561 561
 	*/
562
-	public static function postalCode ( EEI_Address $obj_with_address = NULL ) {
563
-		return $obj_with_address->zip() !== NULL && $obj_with_address->zip() !== ''  ? '<span itemprop="postalCode">' . $obj_with_address->zip() . '</span>' : '';
562
+	public static function postalCode(EEI_Address $obj_with_address = NULL) {
563
+		return $obj_with_address->zip() !== NULL && $obj_with_address->zip() !== '' ? '<span itemprop="postalCode">'.$obj_with_address->zip().'</span>' : '';
564 564
 	}
565 565
 
566 566
 	/**
@@ -571,8 +571,8 @@  discard block
 block discarded – undo
571 571
 	* 	@param string $phone_nmbr
572 572
 	* 	@return string
573 573
 	*/
574
-	public static function telephone ( $phone_nmbr = NULL ) {
575
-		return $phone_nmbr !== NULL && $phone_nmbr !== ''  ? '<span itemprop="telephone">' . $phone_nmbr . '</span>' : '';
574
+	public static function telephone($phone_nmbr = NULL) {
575
+		return $phone_nmbr !== NULL && $phone_nmbr !== '' ? '<span itemprop="telephone">'.$phone_nmbr.'</span>' : '';
576 576
 	}
577 577
 
578 578
 	/**
@@ -585,13 +585,13 @@  discard block
 block discarded – undo
585 585
 	* 	@param array $attributes - array of additional link attributes in  attribute_name => value pairs. ie: array( 'title' => 'click here', 'class' => 'link-class' )
586 586
 	* 	@return string (link)
587 587
 	*/
588
-	public static function url ( $url = NULL, $text = NULL, $attributes = array() ) {
588
+	public static function url($url = NULL, $text = NULL, $attributes = array()) {
589 589
 		$atts = '';
590
-		foreach ( $attributes as $attribute => $value ) {
591
-			$atts .= ' ' . $attribute . '="' . $value . '"';
590
+		foreach ($attributes as $attribute => $value) {
591
+			$atts .= ' '.$attribute.'="'.$value.'"';
592 592
 		}
593 593
 		$text = $text !== NULL && $text !== '' ? $text : $url;
594
-		return $url !== NULL && $url !== '' ? '<a itemprop="url" href="' . $url . '"' . $atts . '>' . $text . '</a>' : '';
594
+		return $url !== NULL && $url !== '' ? '<a itemprop="url" href="'.$url.'"'.$atts.'>'.$text.'</a>' : '';
595 595
 	}
596 596
 
597 597
 
@@ -631,18 +631,18 @@  discard block
 block discarded – undo
631 631
 	 * @param EE_Country | string $country
632 632
 	 * @return EE_Generic_Address
633 633
 	 */
634
-	public function __construct( $address, $address2, $city, $state, $zip, $country ) {
634
+	public function __construct($address, $address2, $city, $state, $zip, $country) {
635 635
 		$this->_address = $address;
636 636
 		$this->_address2 = $address2;
637 637
 		$this->_city = $city;
638
-		if ( $state instanceof EE_State ) {
638
+		if ($state instanceof EE_State) {
639 639
 			$this->_state_obj = $state;
640 640
 		} else {
641 641
 			$this->_state_ID = $state;
642 642
 			$this->_state_obj = $this->_get_state_obj();
643 643
 		}
644 644
 		$this->_zip = $zip;
645
-		if ( $country instanceof EE_Country ) {
645
+		if ($country instanceof EE_Country) {
646 646
 			$this->_country_obj = $country;
647 647
 		} else {
648 648
 			$this->_country_ID = $country;
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
 	 * @return \EE_State
684 684
 	 */
685 685
 	private function _get_state_obj() {
686
-		return $this->_state_obj instanceof EE_State ? $this->_state_obj : EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $this->_state_ID );
686
+		return $this->_state_obj instanceof EE_State ? $this->_state_obj : EE_Registry::instance()->load_model('State')->get_one_by_ID($this->_state_ID);
687 687
 	}
688 688
 
689 689
 
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 	 * @return string
702 702
 	 */
703 703
 	public function state_abbrev() {
704
-		return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __( 'Unknown', 'event_espresso' );
704
+		return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __('Unknown', 'event_espresso');
705 705
 	}
706 706
 
707 707
 
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 	 * @return string
711 711
 	 */
712 712
 	public function state_name() {
713
-		return $this->state_obj() instanceof EE_State ? $this->state_obj()->name() :  __( 'Unknown', 'event_espresso' );
713
+		return $this->state_obj() instanceof EE_State ? $this->state_obj()->name() : __('Unknown', 'event_espresso');
714 714
 	}
715 715
 
716 716
 
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 	 * @return string
729 729
 	 */
730 730
 	public function state() {
731
-		if ( apply_filters( 'FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj() ) ) {
731
+		if (apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())) {
732 732
 			return $this->state_obj()->abbrev();
733 733
 		} else {
734 734
 			return $this->state_name();
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 	 * @return EE_Country
742 742
 	 */
743 743
 	private function _get_country_obj() {
744
-		return $this->_country_obj instanceof EE_Country ? $this->_country_obj : EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $this->_country_ID );
744
+		return $this->_country_obj instanceof EE_Country ? $this->_country_obj : EE_Registry::instance()->load_model('Country')->get_one_by_ID($this->_country_ID);
745 745
 	}
746 746
 
747 747
 
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 	 * @return string
760 760
 	 */
761 761
 	public function country_name() {
762
-		return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() :  __( 'Unknown', 'event_espresso' );
762
+		return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() : __('Unknown', 'event_espresso');
763 763
 	}
764 764
 
765 765
 
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
 	 * @return string
778 778
 	 */
779 779
 	public function country() {
780
-		if ( apply_filters( 'FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj() ) ) {
780
+		if (apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())) {
781 781
 			return $this->country_ID();
782 782
 		} else {
783 783
 			return $this->country_name();
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@
 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
Please login to merge, or discard this patch.
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -349,12 +349,12 @@  discard block
 block discarded – undo
349 349
 
350 350
 
351 351
 	/**
352
-	* 	_get_formatter - obtain the requester formatter class
353
-	*
354
-	* 	@access private
355
-	* 	@param string $type how the address is formatted. for example: 'multiline' or 'inline'
356
-	* 	@return EEI_Address_Formatter
357
-	*/
352
+	 * 	_get_formatter - obtain the requester formatter class
353
+	 *
354
+	 * 	@access private
355
+	 * 	@param string $type how the address is formatted. for example: 'multiline' or 'inline'
356
+	 * 	@return EEI_Address_Formatter
357
+	 */
358 358
 	private static function _get_formatter( $type ) {
359 359
 		switch( $type ) {
360 360
 
@@ -401,14 +401,14 @@  discard block
 block discarded – undo
401 401
 
402 402
 
403 403
 	/**
404
-	* 	_schema_formatting
405
-	* 	adds schema.org formatting to an address
406
-	*
407
-	* 	@access private
408
-	* 	@param object EEI_Address_Formatter $formatter
409
-	* 	@param object EEI_Address $obj_with_address
410
-	* 	@return string
411
-	*/
404
+	 * 	_schema_formatting
405
+	 * 	adds schema.org formatting to an address
406
+	 *
407
+	 * 	@access private
408
+	 * 	@param object EEI_Address_Formatter $formatter
409
+	 * 	@param object EEI_Address $obj_with_address
410
+	 * 	@return string
411
+	 */
412 412
 	private static function _schema_formatting( EEI_Address_Formatter $formatter, EEI_Address $obj_with_address ){
413 413
 		$formatted_address = '<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">';
414 414
 		$formatted_address .= $formatter->format(
@@ -452,50 +452,50 @@  discard block
 block discarded – undo
452 452
 
453 453
 
454 454
 	/**
455
-	* 	location
456
-	* 	The location of the event, organization or action.
457
-	* 	Should include the Venue name AND schema formatted address info
458
-	*
459
-	* 	@access public
460
-	* 	@param string $location
461
-	* 	@return string
462
-	*/
455
+	 * 	location
456
+	 * 	The location of the event, organization or action.
457
+	 * 	Should include the Venue name AND schema formatted address info
458
+	 *
459
+	 * 	@access public
460
+	 * 	@param string $location
461
+	 * 	@return string
462
+	 */
463 463
 	public static function location ( $location = NULL ) {
464 464
 		return ! empty( $location ) ? '<div itemprop="location" itemscope itemtype="http://schema.org/Place">' . $location . '</div>' : '';
465 465
 	}
466 466
 
467 467
 	/**
468
-	* 	name
469
-	* 	The name of the Event or Venue.
470
-	*
471
-	* 	@access public
472
-	* 	@param string $name
473
-	* 	@return string
474
-	*/
468
+	 * 	name
469
+	 * 	The name of the Event or Venue.
470
+	 *
471
+	 * 	@access public
472
+	 * 	@param string $name
473
+	 * 	@return string
474
+	 */
475 475
 	public static function name ( $name = NULL ) {
476 476
 		return ! empty( $name ) ? '<span itemprop="name">' . $name . '</span>' : '';
477 477
 	}
478 478
 
479 479
 	/**
480
-	* 	streetAddress
481
-	* 	The street address. For example, 1600 Amphitheatre Pkwy.
482
-	*
483
-	* 	@access public
484
-	* 	@param EEI_Address $obj_with_address
485
-	* 	@return string
486
-	*/
480
+	 * 	streetAddress
481
+	 * 	The street address. For example, 1600 Amphitheatre Pkwy.
482
+	 *
483
+	 * 	@access public
484
+	 * 	@param EEI_Address $obj_with_address
485
+	 * 	@return string
486
+	 */
487 487
 	public static function streetAddress ( EEI_Address $obj_with_address = NULL ) {
488 488
 		return $obj_with_address->address() !== NULL && $obj_with_address->address() !== '' ? '<span itemprop="streetAddress">' . $obj_with_address->address() . '</span>' : '';
489 489
 	}
490 490
 
491 491
 	/**
492
-	* 	postOfficeBoxNumber
493
-	* 	The post office box number for PO box addresses.
494
-	*
495
-	* 	@access public
496
-	* 	@param EEI_Address $obj_with_address
497
-	* 	@return string
498
-	*/
492
+	 * 	postOfficeBoxNumber
493
+	 * 	The post office box number for PO box addresses.
494
+	 *
495
+	 * 	@access public
496
+	 * 	@param EEI_Address $obj_with_address
497
+	 * 	@return string
498
+	 */
499 499
 	public static function postOfficeBoxNumber ( EEI_Address $obj_with_address = NULL ) {
500 500
 		// regex check for some form of PO Box or P.O. Box, etc, etc, etc
501 501
 		if ( preg_match("/^\s*((P(OST)?.?\s*(O(FF(ICE)?)?)?.?\s+(B(IN|OX))?)|B(IN|OX))/i", $obj_with_address->address2() )) {
@@ -506,25 +506,25 @@  discard block
 block discarded – undo
506 506
 	}
507 507
 
508 508
 	/**
509
-	* 	addressLocality
510
-	* 	The locality (city, town, etc). For example, Mountain View.
511
-	*
512
-	* 	@access public
513
-	* 	@param EEI_Address $obj_with_address
514
-	* 	@return string
515
-	*/
509
+	 * 	addressLocality
510
+	 * 	The locality (city, town, etc). For example, Mountain View.
511
+	 *
512
+	 * 	@access public
513
+	 * 	@param EEI_Address $obj_with_address
514
+	 * 	@return string
515
+	 */
516 516
 	public static function addressLocality ( EEI_Address $obj_with_address = NULL ) {
517 517
 		return $obj_with_address->city() !== NULL && $obj_with_address->city() !== '' ? '<span itemprop="addressLocality">' . $obj_with_address->city() . '</span>' : '';
518 518
 	}
519 519
 
520 520
 	/**
521
-	* 	addressRegion
522
-	* 	The region (state, province, etc). For example, CA.
523
-	*
524
-	* 	@access public
525
-	* 	@param EEI_Address $obj_with_address
526
-	* 	@return string
527
-	*/
521
+	 * 	addressRegion
522
+	 * 	The region (state, province, etc). For example, CA.
523
+	 *
524
+	 * 	@access public
525
+	 * 	@param EEI_Address $obj_with_address
526
+	 * 	@return string
527
+	 */
528 528
 	public static function addressRegion ( EEI_Address $obj_with_address = NULL ) {
529 529
 		$state = $obj_with_address->state_name();
530 530
 		if ( ! empty( $state ) ) {
@@ -535,13 +535,13 @@  discard block
 block discarded – undo
535 535
 	}
536 536
 
537 537
 	/**
538
-	* 	addressCountry
539
-	* 	The country. For example, USA. You can also provide the two-letter ISO 3166-1 alpha-2 country code.
540
-	*
541
-	* 	@access public
542
-	* 	@param EEI_Address $obj_with_address
543
-	* 	@return string
544
-	*/
538
+	 * 	addressCountry
539
+	 * 	The country. For example, USA. You can also provide the two-letter ISO 3166-1 alpha-2 country code.
540
+	 *
541
+	 * 	@access public
542
+	 * 	@param EEI_Address $obj_with_address
543
+	 * 	@return string
544
+	 */
545 545
 	public static function addressCountry ( EEI_Address $obj_with_address = NULL ) {
546 546
 		$country = $obj_with_address->country_name();
547 547
 		if ( ! empty( $country ) ) {
@@ -552,39 +552,39 @@  discard block
 block discarded – undo
552 552
 	}
553 553
 
554 554
 	/**
555
-	* 	postalCode
556
-	* 	The postal code. For example, 94043.
557
-	*
558
-	* 	@access public
559
-	* 	@param EEI_Address $obj_with_address
560
-	* 	@return string
561
-	*/
555
+	 * 	postalCode
556
+	 * 	The postal code. For example, 94043.
557
+	 *
558
+	 * 	@access public
559
+	 * 	@param EEI_Address $obj_with_address
560
+	 * 	@return string
561
+	 */
562 562
 	public static function postalCode ( EEI_Address $obj_with_address = NULL ) {
563 563
 		return $obj_with_address->zip() !== NULL && $obj_with_address->zip() !== ''  ? '<span itemprop="postalCode">' . $obj_with_address->zip() . '</span>' : '';
564 564
 	}
565 565
 
566 566
 	/**
567
-	* 	telephone
568
-	* 	The telephone number.
569
-	*
570
-	* 	@access public
571
-	* 	@param string $phone_nmbr
572
-	* 	@return string
573
-	*/
567
+	 * 	telephone
568
+	 * 	The telephone number.
569
+	 *
570
+	 * 	@access public
571
+	 * 	@param string $phone_nmbr
572
+	 * 	@return string
573
+	 */
574 574
 	public static function telephone ( $phone_nmbr = NULL ) {
575 575
 		return $phone_nmbr !== NULL && $phone_nmbr !== ''  ? '<span itemprop="telephone">' . $phone_nmbr . '</span>' : '';
576 576
 	}
577 577
 
578 578
 	/**
579
-	* 	URL
580
-	* 	URL of the item as a clickable link
581
-	*
582
-	* 	@access public
583
-	* 	@param string $url - the URL that the link will resolve to
584
-	* 	@param string $text - the text that will be used for the visible link
585
-	* 	@param array $attributes - array of additional link attributes in  attribute_name => value pairs. ie: array( 'title' => 'click here', 'class' => 'link-class' )
586
-	* 	@return string (link)
587
-	*/
579
+	 * 	URL
580
+	 * 	URL of the item as a clickable link
581
+	 *
582
+	 * 	@access public
583
+	 * 	@param string $url - the URL that the link will resolve to
584
+	 * 	@param string $text - the text that will be used for the visible link
585
+	 * 	@param array $attributes - array of additional link attributes in  attribute_name => value pairs. ie: array( 'title' => 'click here', 'class' => 'link-class' )
586
+	 * 	@return string (link)
587
+	 */
588 588
 	public static function url ( $url = NULL, $text = NULL, $attributes = array() ) {
589 589
 		$atts = '';
590 590
 		foreach ( $attributes as $attribute => $value ) {
Please login to merge, or discard this patch.
core/Psr4Autoloader.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * Loads the class file for a given class name.
112 112
 	 *
113 113
 	 * @param string $class The fully-qualified class name.
114
-	 * @return mixed The mapped file name on success, or boolean false on
114
+	 * @return string|false The mapped file name on success, or boolean false on
115 115
 	 * failure.
116 116
 	 */
117 117
 	public function loadClass( $class ) {
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 *
145 145
 	 * @param string $prefix The namespace prefix.
146 146
 	 * @param string $relative_class The relative class name.
147
-	 * @return mixed Boolean false if no mapped file can be loaded, or the
147
+	 * @return false|string Boolean false if no mapped file can be loaded, or the
148 148
 	 * name of the mapped file that was loaded.
149 149
 	 */
150 150
 	protected function loadMappedFile( $prefix, $relative_class ) {
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 * @return void
73 73
 	 */
74 74
 	public function register() {
75
-		spl_autoload_register( array( $this, 'loadClass' ) );
75
+		spl_autoload_register(array($this, 'loadClass'));
76 76
 	}
77 77
 
78 78
 
@@ -88,20 +88,20 @@  discard block
 block discarded – undo
88 88
 	 * than last.
89 89
 	 * @return void
90 90
 	 */
91
-	public function addNamespace( $prefix, $base_dir, $prepend = false ) {
91
+	public function addNamespace($prefix, $base_dir, $prepend = false) {
92 92
 		// normalize namespace prefix
93
-		$prefix = trim( $prefix, '\\' ) . '\\';
93
+		$prefix = trim($prefix, '\\').'\\';
94 94
 		// normalize the base directory with a trailing separator
95
-		$base_dir = rtrim( $base_dir, DIRECTORY_SEPARATOR ) . '/';
95
+		$base_dir = rtrim($base_dir, DIRECTORY_SEPARATOR).'/';
96 96
 		// initialize the namespace prefix array
97
-		if ( isset( $this->prefixes[ $prefix ] ) === false ) {
98
-			$this->prefixes[ $prefix ] = array();
97
+		if (isset($this->prefixes[$prefix]) === false) {
98
+			$this->prefixes[$prefix] = array();
99 99
 		}
100 100
 		// retain the base directory for the namespace prefix
101
-		if ( $prepend ) {
102
-			array_unshift( $this->prefixes[ $prefix ], $base_dir );
101
+		if ($prepend) {
102
+			array_unshift($this->prefixes[$prefix], $base_dir);
103 103
 		} else {
104
-			array_push( $this->prefixes[ $prefix ], $base_dir );
104
+			array_push($this->prefixes[$prefix], $base_dir);
105 105
 		}
106 106
 	}
107 107
 
@@ -114,24 +114,24 @@  discard block
 block discarded – undo
114 114
 	 * @return mixed The mapped file name on success, or boolean false on
115 115
 	 * failure.
116 116
 	 */
117
-	public function loadClass( $class ) {
117
+	public function loadClass($class) {
118 118
 		// the current namespace prefix
119 119
 		$prefix = $class;
120 120
 		// work backwards through the namespace names of the fully-qualified
121 121
 		// class name to find a mapped file name
122
-		while ( false !== $pos = strrpos( $prefix, '\\' ) ) {
122
+		while (false !== $pos = strrpos($prefix, '\\')) {
123 123
 			// retain the trailing namespace separator in the prefix
124
-			$prefix = substr( $class, 0, $pos + 1 );
124
+			$prefix = substr($class, 0, $pos + 1);
125 125
 			// the rest is the relative class name
126
-			$relative_class = substr( $class, $pos + 1 );
126
+			$relative_class = substr($class, $pos + 1);
127 127
 			// try to load a mapped file for the prefix and relative class
128
-			$mapped_file = $this->loadMappedFile( $prefix, $relative_class );
129
-			if ( $mapped_file ) {
128
+			$mapped_file = $this->loadMappedFile($prefix, $relative_class);
129
+			if ($mapped_file) {
130 130
 				return $mapped_file;
131 131
 			}
132 132
 			// remove the trailing namespace separator for the next iteration
133 133
 			// of strrpos()
134
-			$prefix = rtrim( $prefix, '\\' );
134
+			$prefix = rtrim($prefix, '\\');
135 135
 		}
136 136
 		// never found a mapped file
137 137
 		return false;
@@ -147,21 +147,21 @@  discard block
 block discarded – undo
147 147
 	 * @return mixed Boolean false if no mapped file can be loaded, or the
148 148
 	 * name of the mapped file that was loaded.
149 149
 	 */
150
-	protected function loadMappedFile( $prefix, $relative_class ) {
150
+	protected function loadMappedFile($prefix, $relative_class) {
151 151
 		// are there any base directories for this namespace prefix?
152
-		if ( isset( $this->prefixes[ $prefix ] ) === false ) {
152
+		if (isset($this->prefixes[$prefix]) === false) {
153 153
 			return false;
154 154
 		}
155 155
 		// look through base directories for this namespace prefix
156
-		foreach ( $this->prefixes[ $prefix ] as $base_dir ) {
156
+		foreach ($this->prefixes[$prefix] as $base_dir) {
157 157
 			// replace the namespace prefix with the base directory,
158 158
 			// replace namespace separators with directory separators
159 159
 			// in the relative class name, append with .php
160 160
 			$file = $base_dir
161
-				. str_replace( '\\', '/', $relative_class )
161
+				. str_replace('\\', '/', $relative_class)
162 162
 				. '.php';
163 163
 			// if the mapped file exists, require it
164
-			if ( $this->requireFile( $file ) ) {
164
+			if ($this->requireFile($file)) {
165 165
 				// yes, we're done
166 166
 				return $file;
167 167
 			}
@@ -178,8 +178,8 @@  discard block
 block discarded – undo
178 178
 	 * @param string $file The file to require.
179 179
 	 * @return bool True if the file exists, false if not.
180 180
 	 */
181
-	protected function requireFile( $file ) {
182
-		if ( file_exists( $file ) ) {
181
+	protected function requireFile($file) {
182
+		if (file_exists($file)) {
183 183
 			require $file;
184 184
 			return true;
185 185
 		}
Please login to merge, or discard this patch.
admin_pages/events/help_tabs/event_editor_venue_details.help_tab.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,5 +3,5 @@
 block discarded – undo
3 3
 <?php _e('A venue is the place or location that is hosting your event. This setting is optional which means that you are not required to select a venue for your event.', 'event_espresso'); ?>
4 4
 </p>
5 5
 <p>
6
-<?php echo sprintf(__('Venues can be managed through the %sVenues page%s.', 'event_espresso'),'<a href="admin.php?page=espresso_venues">','</a>'); ?>
6
+<?php echo sprintf(__('Venues can be managed through the %sVenues page%s.', 'event_espresso'), '<a href="admin.php?page=espresso_venues">', '</a>'); ?>
7 7
 </p>
8 8
\ No newline at end of file
Please login to merge, or discard this patch.